Give users access to the attachment manager without having to upload any files.
Added the action_end_add_attach_to_reply hook. Added the action_end_remove_attach_from_reply hook.
This commit is contained in:
parent
5dec69b682
commit
3db09c6a1f
@ -83,10 +83,12 @@ var hookTable = &HookTable{
|
|||||||
"simple_forum_check_pre_perms": nil,
|
"simple_forum_check_pre_perms": nil,
|
||||||
"forum_check_pre_perms": nil,
|
"forum_check_pre_perms": nil,
|
||||||
|
|
||||||
"action_end_create_topic": nil,
|
"action_end_create_topic": nil,
|
||||||
"action_end_create_reply": nil,
|
"action_end_create_reply": nil,
|
||||||
"action_end_edit_reply": nil,
|
"action_end_edit_reply": nil,
|
||||||
"action_end_delete_reply": nil,
|
"action_end_delete_reply": nil,
|
||||||
|
"action_end_add_attach_to_reply": nil,
|
||||||
|
"action_end_remove_attach_from_reply": nil,
|
||||||
|
|
||||||
"router_after_filters": nil,
|
"router_after_filters": nil,
|
||||||
"router_pre_route": nil,
|
"router_pre_route": nil,
|
||||||
|
@ -1076,9 +1076,7 @@ function mainInit(){
|
|||||||
$("#mod_topic_mover .pane_row").click(function(){
|
$("#mod_topic_mover .pane_row").click(function(){
|
||||||
modTopicMover.find(".pane_row").removeClass("pane_selected");
|
modTopicMover.find(".pane_row").removeClass("pane_selected");
|
||||||
let fid = this.getAttribute("data-fid");
|
let fid = this.getAttribute("data-fid");
|
||||||
if (fid == null) {
|
if (fid == null) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.classList.add("pane_selected");
|
this.classList.add("pane_selected");
|
||||||
console.log("fid: " + fid);
|
console.log("fid: " + fid);
|
||||||
forumToMoveTo = fid;
|
forumToMoveTo = fid;
|
||||||
|
@ -368,7 +368,7 @@ func AddAttachToReplySubmit(w http.ResponseWriter, r *http.Request, user common.
|
|||||||
return common.NotFoundJS(w, r)
|
return common.NotFoundJS(w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, ferr := common.SimpleForumUserCheck(w, r, &user, topic.ParentID)
|
lite, ferr := common.SimpleForumUserCheck(w, r, &user, topic.ParentID)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
@ -389,6 +389,11 @@ func AddAttachToReplySubmit(w http.ResponseWriter, r *http.Request, user common.
|
|||||||
return common.InternalErrorJS(errors.New("no paths for attachment add"), w, r)
|
return common.InternalErrorJS(errors.New("no paths for attachment add"), w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skip, rerr := lite.Hooks.VhookSkippable("action_end_add_attach_to_reply", reply.ID)
|
||||||
|
if skip || rerr != nil {
|
||||||
|
return rerr
|
||||||
|
}
|
||||||
|
|
||||||
var elemStr string
|
var elemStr string
|
||||||
for path, aids := range pathMap {
|
for path, aids := range pathMap {
|
||||||
elemStr += "\"" + path + "\":\"" + aids + "\","
|
elemStr += "\"" + path + "\":\"" + aids + "\","
|
||||||
@ -420,7 +425,7 @@ func RemoveAttachFromReplySubmit(w http.ResponseWriter, r *http.Request, user co
|
|||||||
return common.NotFoundJS(w, r)
|
return common.NotFoundJS(w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, ferr := common.SimpleForumUserCheck(w, r, &user, topic.ParentID)
|
lite, ferr := common.SimpleForumUserCheck(w, r, &user, topic.ParentID)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
@ -443,6 +448,11 @@ func RemoveAttachFromReplySubmit(w http.ResponseWriter, r *http.Request, user co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skip, rerr := lite.Hooks.VhookSkippable("action_end_remove_attach_from_reply", reply.ID)
|
||||||
|
if skip || rerr != nil {
|
||||||
|
return rerr
|
||||||
|
}
|
||||||
|
|
||||||
w.Write(successJSONBytes)
|
w.Write(successJSONBytes)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
{{if .CurrentUser.Loggedin}}<textarea name="topic_content" class="show_on_edit topic_content_input edit_source">{{.Topic.Content}}</textarea>
|
{{if .CurrentUser.Loggedin}}<textarea name="topic_content" class="show_on_edit topic_content_input edit_source">{{.Topic.Content}}</textarea>
|
||||||
|
|
||||||
{{if .CurrentUser.Perms.EditTopic}}
|
{{if .CurrentUser.Perms.EditTopic}}
|
||||||
{{if .Topic.Attachments}}<div class="show_on_edit attach_edit_bay" type="topic" id="{{.Topic.ID}}">
|
<div class="show_on_edit attach_edit_bay" type="topic" id="{{.Topic.ID}}">
|
||||||
{{range .Topic.Attachments}}
|
{{range .Topic.Attachments}}
|
||||||
<div class="attach_item{{if .Image}} attach_image_holder{{end}}">
|
<div class="attach_item{{if .Image}} attach_image_holder{{end}}">
|
||||||
{{if .Image}}<img src="//{{$.Header.Site.URL}}/attachs/{{.Path}}?sectionID={{.SectionID}}&sectionType=forums" height=24 width=24 />{{end}}
|
{{if .Image}}<img src="//{{$.Header.Site.URL}}/attachs/{{.Path}}?sectionID={{.SectionID}}&sectionType=forums" height=24 width=24 />{{end}}
|
||||||
@ -83,7 +83,7 @@
|
|||||||
<label for="upload_files_op" class="formbutton add_file_button">{{lang "topic.upload_button_text"}}</label>{{end}}
|
<label for="upload_files_op" class="formbutton add_file_button">{{lang "topic.upload_button_text"}}</label>{{end}}
|
||||||
<button class="attach_item_delete">{{lang "topic.delete_button_text"}}</button>
|
<button class="attach_item_delete">{{lang "topic.delete_button_text"}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>{{end}}
|
</div>
|
||||||
|
|
||||||
{{end}}{{end}}
|
{{end}}{{end}}
|
||||||
<div class="controls button_container{{if .Topic.LikeCount}} has_likes{{end}}">
|
<div class="controls button_container{{if .Topic.LikeCount}} has_likes{{end}}">
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<div class="edit_source auto_hide">{{.Content}}</div>
|
<div class="edit_source auto_hide">{{.Content}}</div>
|
||||||
|
|
||||||
{{if $.CurrentUser.Perms.EditReply}}
|
{{if $.CurrentUser.Perms.EditReply}}
|
||||||
{{if .Attachments}}<div class="show_on_edit show_on_block_edit attach_edit_bay" type="reply" id="{{.ID}}">
|
<div class="show_on_edit show_on_block_edit attach_edit_bay" type="reply" id="{{.ID}}">
|
||||||
{{range .Attachments}}
|
{{range .Attachments}}
|
||||||
<div class="attach_item{{if .Image}} attach_image_holder{{end}}">
|
<div class="attach_item{{if .Image}} attach_image_holder{{end}}">
|
||||||
{{if .Image}}<img src="//{{$.Header.Site.URL}}/attachs/{{.Path}}?sectionID={{.SectionID}}&sectionType=forums" height=24 width=24 />{{end}}
|
{{if .Image}}<img src="//{{$.Header.Site.URL}}/attachs/{{.Path}}?sectionID={{.SectionID}}&sectionType=forums" height=24 width=24 />{{end}}
|
||||||
@ -25,7 +25,7 @@
|
|||||||
<label for="upload_files_post_{{.ID}}" class="formbutton add_file_button">{{lang "topic.upload_button_text"}}</label>{{end}}
|
<label for="upload_files_post_{{.ID}}" class="formbutton add_file_button">{{lang "topic.upload_button_text"}}</label>{{end}}
|
||||||
<button class="attach_item_delete">{{lang "topic.delete_button_text"}}</button>
|
<button class="attach_item_delete">{{lang "topic.delete_button_text"}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>{{end}}
|
</div>
|
||||||
{{end}}{{end}}
|
{{end}}{{end}}
|
||||||
|
|
||||||
<div class="controls button_container{{if .LikeCount}} has_likes{{end}}">
|
<div class="controls button_container{{if .LikeCount}} has_likes{{end}}">
|
||||||
|
Loading…
Reference in New Issue
Block a user