aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/ThreadItem.php1
-rw-r--r--view/js/main.js13
-rwxr-xr-xview/tpl/comment_item.tpl3
-rwxr-xr-xview/tpl/jot-header.tpl31
-rwxr-xr-xview/tpl/jot.tpl1
5 files changed, 49 insertions, 0 deletions
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 9ee16480a..a705e3c2b 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -735,6 +735,7 @@ class ThreadItem {
'$edquote' => t('Quote'),
'$edcode' => t('Code'),
'$edimg' => t('Image'),
+ '$edatt' => t('Attach File'),
'$edurl' => t('Insert Link'),
'$edvideo' => t('Video'),
'$preview' => t('Preview'), // ((feature_enabled($conv->get_profile_owner(),'preview')) ? t('Preview') : ''),
diff --git a/view/js/main.js b/view/js/main.js
index aaadff99b..e4cfcf7b2 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -132,6 +132,19 @@ function inserteditortag(BBcode, id) {
return true;
}
+function insertCommentAttach(comment,id) {
+
+ activeCommentID = id;
+ activeCommentText = comment;
+
+ $('body').css('cursor', 'wait');
+
+ $('#invisible-comment-upload').trigger('click');
+
+ return false;
+
+}
+
function insertCommentURL(comment, id) {
reply = prompt(aStr.linkurl);
if(reply && reply.length) {
diff --git a/view/tpl/comment_item.tpl b/view/tpl/comment_item.tpl
index 02b0c527c..289356107 100755
--- a/view/tpl/comment_item.tpl
+++ b/view/tpl/comment_item.tpl
@@ -47,6 +47,9 @@
</button>
</div>
<div class="btn-group mr-2">
+ <button class="btn btn-outline-secondary btn-sm" title="{{$edatt}}" onclick="insertCommentAttach('{{$comment}}',{{$id}}); return false;">
+ <i class="fa fa-paperclip comment-icon"></i>
+ </button>
<button class="btn btn-outline-secondary btn-sm" title="{{$edurl}}" onclick="insertCommentURL('{{$comment}}',{{$id}}); return false;">
<i class="fa fa-link comment-icon"></i>
</button>
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index 815d17c3c..91c30423d 100755
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -106,6 +106,9 @@ function enableOnUser(){
<script src="library/blueimp_upload/js/jquery.fileupload.js"></script>
<script>
+var activeCommentID = 0;
+var activeCommentText = '';
+
$(document).ready(function() {
/* enable tinymce on focus and click */
$("#profile-jot-text").focus(enableOnUser);
@@ -139,6 +142,34 @@ function enableOnUser(){
DragDropUploadInit();
}
+
+ $('#invisible-comment-upload').fileupload({
+ url: 'wall_attach/{{$nickname}}',
+ dataType: 'json',
+ maxChunkSize: 4 * 1024 * 1024,
+ add: function(e,data) {
+
+ var tmpStr = $("#comment-edit-text-" + activeCommentID).val();
+ if(tmpStr == activeCommentText) {
+ tmpStr = "";
+ $("#comment-edit-text-" + activeCommentID).addClass("comment-edit-text-full");
+ $("#comment-edit-text-" + activeCommentID).removeClass("comment-edit-text-empty");
+ openMenu("comment-tools-" + activeCommentID);
+ $("#comment-edit-text-" + activeCommentID).val(tmpStr);
+ }
+ data.submit();
+ },
+
+ done: function(e,data) {
+ textarea = document.getElementById("comment-edit-text-" + activeCommentID);
+ textarea.value = textarea.value + data.result.message;
+ },
+ stop: function(e,data) {
+ $('body').css('cursor', 'auto');
+ preview_comment(activeCommentID);
+ activeCommentID = 0;
+ },
+ });
});
function deleteCheckedItems() {
diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl
index cf99ede42..39ba9e59b 100755
--- a/view/tpl/jot.tpl
+++ b/view/tpl/jot.tpl
@@ -1,4 +1,5 @@
<input id="invisible-wall-file-upload" type="file" name="files" style="visibility:hidden;position:absolute;top:-50;left:-50;width:0;height:0;" multiple>
+<input id="invisible-comment-upload" type="file" name="files" style="visibility:hidden;position:absolute;top:-50;left:-50;width:0;height:0;" multiple>
<form id="profile-jot-form" action="{{$action}}" method="post" class="acl-form" data-form_id="profile-jot-form" data-allow_cid='{{$allow_cid}}' data-allow_gid='{{$allow_gid}}' data-deny_cid='{{$deny_cid}}' data-deny_gid='{{$deny_gid}}'>
{{$mimeselect}}
{{$layoutselect}}