Adminlogs: Forum Manager Actions.
Shave off a few bytes in the templates. Add forum_unknown phrase. Add panel_logs_administration_action_forum_reorder phrase. Add panel_logs_administration_action_forum_create phrase. Add panel_logs_administration_action_forum_delete phrase. Add panel_logs_administration_action_forum_edit phrase.
This commit is contained in:
parent
20984f7ea3
commit
7e1372b0b4
|
@ -1020,6 +1020,7 @@
|
|||
"user_unknown":"Unknown",
|
||||
"topic_unknown":"Unknown",
|
||||
"group_unknown":"Unknown",
|
||||
"forum_unknown":"Unknown",
|
||||
|
||||
"panel_logs_administration_head":"Admin Action Logs",
|
||||
"panel_logs_administration_action_user_edit":"User <a href='%s'>%s</a> was modified by <a href='%s'>%s</a>",
|
||||
|
@ -1027,6 +1028,10 @@
|
|||
"panel_logs_administration_action_group_edit":"Group <a href='%s'>%s</a> was modified by <a href='%s'>%s</a>",
|
||||
"panel_logs_administration_action_group_promotion_create":"A group promotion was created by <a href='%s'>%s</a>",
|
||||
"panel_logs_administration_action_group_promotion_delete":"A group promotion was deleted by <a href='%s'>%s</a>",
|
||||
"panel_logs_administration_action_forum_reorder":"Forums were reordered by <a href='%s'>%s</a>",
|
||||
"panel_logs_administration_action_forum_create":"Forum <a href='%s'>%s</a> was created by <a href='%s'>%s</a>",
|
||||
"panel_logs_administration_action_forum_delete":"Forum <a href='%s'>%s</a> was deleted by <a href='%s'>%s</a>",
|
||||
"panel_logs_administration_action_forum_edit":"Forum <a href='%s'>%s</a> was modified by <a href='%s'>%s</a>",
|
||||
"panel_logs_administration_action_unknown":"Unknown action '%s' on elementType '%s' by <a href='%s'>%s</a>",
|
||||
"panel_logs_administration_no_logs":"There aren't any events logged.",
|
||||
|
||||
|
|
|
@ -67,7 +67,11 @@ func ForumsCreateSubmit(w http.ResponseWriter, r *http.Request, user c.User) c.R
|
|||
factive := r.PostFormValue("active")
|
||||
active := (factive == "on" || factive == "1")
|
||||
|
||||
_, err := c.Forums.Create(fname, fdesc, active, fpreset)
|
||||
fid, err := c.Forums.Create(fname, fdesc, active, fpreset)
|
||||
if err != nil {
|
||||
return c.InternalError(err, w, r)
|
||||
}
|
||||
err = c.AdminLogs.Create("create", fid, "forum", user.LastIP, user.ID)
|
||||
if err != nil {
|
||||
return c.InternalError(err, w, r)
|
||||
}
|
||||
|
@ -90,7 +94,6 @@ func ForumsDelete(w http.ResponseWriter, r *http.Request, user c.User, sfid stri
|
|||
if err != nil {
|
||||
return c.LocalError("The provided Forum ID is not a valid number.", w, r, user)
|
||||
}
|
||||
|
||||
forum, err := c.Forums.Get(fid)
|
||||
if err == sql.ErrNoRows {
|
||||
return c.LocalError("The forum you're trying to delete doesn't exist.", w, r, user)
|
||||
|
@ -127,6 +130,10 @@ func ForumsDeleteSubmit(w http.ResponseWriter, r *http.Request, user c.User, sfi
|
|||
} else if err != nil {
|
||||
return c.InternalError(err, w, r)
|
||||
}
|
||||
err = c.AdminLogs.Create("delete", fid, "forum", user.LastIP, user.ID)
|
||||
if err != nil {
|
||||
return c.InternalError(err, w, r)
|
||||
}
|
||||
|
||||
http.Redirect(w, r, "/panel/forums/?deleted=1", http.StatusSeeOther)
|
||||
return nil
|
||||
|
@ -154,6 +161,11 @@ func ForumsOrderSubmit(w http.ResponseWriter, r *http.Request, user c.User) c.Ro
|
|||
}
|
||||
c.Forums.UpdateOrder(updateMap)
|
||||
|
||||
err := c.AdminLogs.Create("reorder", 0, "forum", user.LastIP, user.ID)
|
||||
if err != nil {
|
||||
return c.InternalErrorJSQ(err, w, r, js)
|
||||
}
|
||||
|
||||
return successRedirect("/panel/forums/", w, r, js)
|
||||
}
|
||||
|
||||
|
@ -224,7 +236,6 @@ func ForumsEditSubmit(w http.ResponseWriter, r *http.Request, user c.User, sfid
|
|||
if err != nil {
|
||||
return c.LocalErrorJSQ("The provided Forum ID is not a valid number.", w, r, user, js)
|
||||
}
|
||||
|
||||
forum, err := c.Forums.Get(fid)
|
||||
if err == sql.ErrNoRows {
|
||||
return c.LocalErrorJSQ("The forum you're trying to edit doesn't exist.", w, r, user, js)
|
||||
|
@ -248,6 +259,11 @@ func ForumsEditSubmit(w http.ResponseWriter, r *http.Request, user c.User, sfid
|
|||
if err != nil {
|
||||
return c.InternalErrorJSQ(err, w, r, js)
|
||||
}
|
||||
err = c.AdminLogs.Create("edit", fid, "forum", user.LastIP, user.ID)
|
||||
if err != nil {
|
||||
return c.InternalError(err, w, r)
|
||||
}
|
||||
|
||||
// ? Should we redirect to the forum editor instead?
|
||||
return successRedirect("/panel/forums/", w, r, js)
|
||||
}
|
||||
|
@ -284,6 +300,10 @@ func ForumsEditPermsSubmit(w http.ResponseWriter, r *http.Request, user c.User,
|
|||
if err != nil {
|
||||
return c.LocalErrorJSQ(err.Error(), w, r, user, js)
|
||||
}
|
||||
err = c.AdminLogs.Create("edit", fid, "forum", user.LastIP, user.ID)
|
||||
if err != nil {
|
||||
return c.InternalError(err, w, r)
|
||||
}
|
||||
|
||||
return successRedirect("/panel/forums/edit/"+strconv.Itoa(fid)+"?updated=1", w, r, js)
|
||||
}
|
||||
|
@ -418,6 +438,10 @@ func ForumsEditPermsAdvanceSubmit(w http.ResponseWriter, r *http.Request, user c
|
|||
if err != nil {
|
||||
return c.LocalErrorJSQ(err.Error(), w, r, user, js)
|
||||
}
|
||||
err = c.AdminLogs.Create("edit", fid, "forum", user.LastIP, user.ID)
|
||||
if err != nil {
|
||||
return c.InternalError(err, w, r)
|
||||
}
|
||||
|
||||
return successRedirect("/panel/forums/edit/perms/"+strconv.Itoa(fid)+"-"+strconv.Itoa(gid)+"?updated=1", w, r, js)
|
||||
}
|
||||
|
|
|
@ -114,6 +114,16 @@ func adminlogsElementType(action string, elementType string, elementID int, acto
|
|||
out = p.GetTmplPhrasef("panel_logs_administration_action_group_"+action, "/panel/groups/edit/"+strconv.Itoa(g.ID), g.Name, actor.Link, actor.Name)
|
||||
case "group_promotion":
|
||||
out = p.GetTmplPhrasef("panel_logs_administration_action_group_promotion_"+action, actor.Link, actor.Name)
|
||||
case "forum":
|
||||
f, err := c.Forums.Get(elementID)
|
||||
if err != nil {
|
||||
f = &c.Forum{Name: p.GetTmplPhrase("forum_unknown")}
|
||||
}
|
||||
if action == "reorder" {
|
||||
out = p.GetTmplPhrasef("panel_logs_administration_action_forum_reorder", actor.Link, actor.Name)
|
||||
} else {
|
||||
out = p.GetTmplPhrasef("panel_logs_administration_action_forum_"+action, "/panel/forums/edit/"+strconv.Itoa(f.ID), f.Name, actor.Link, actor.Name)
|
||||
}
|
||||
}
|
||||
if out == "" {
|
||||
out = p.GetTmplPhrasef("panel_logs_administration_action_unknown", action, elementType, actor.Link, actor.Name)
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
<div class="formrow">
|
||||
<div class="formitem formlabel"><a>{{lang "panel_forum_active"}}</a></div>
|
||||
<div class="formitem"><select name="forum_active">
|
||||
<option{{if .Active}} selected{{end}} value="1">{{lang "option_yes"}}</option>
|
||||
<option{{if not .Active}} selected{{end}} value="0">{{lang "option_no"}}</option>
|
||||
<option{{if .Active}} selected{{end}} value=1>{{lang "option_yes"}}</option>
|
||||
<option{{if not .Active}} selected{{end}} value=0>{{lang "option_no"}}</option>
|
||||
</select></div>
|
||||
</div>
|
||||
<div class="formrow">
|
||||
|
|
|
@ -46,8 +46,8 @@
|
|||
<div class="formrow">
|
||||
<div class="formitem formlabel"><a>{{lang "panel.forums_active_label"}}</a></div>
|
||||
<div class="formitem"><select name="active">
|
||||
<option selected value="1">{{lang "option_yes"}}</option>
|
||||
<option value="0">{{lang "option_no"}}</option>
|
||||
<option selected value=1>{{lang "option_yes"}}</option>
|
||||
<option value=0>{{lang "option_no"}}</option>
|
||||
</select></div>
|
||||
</div>
|
||||
<div class="formrow">
|
||||
|
|
Loading…
Reference in New Issue