diff options
author | zotlabs <mike@macgirvin.com> | 2017-12-02 17:31:59 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-12-02 17:31:59 -0800 |
commit | 95311ad07e08c01ff8b9d865cbbc2a0b2bae5239 (patch) | |
tree | 7b366cfd5950c0fa810b6654df61fc69beaad296 | |
parent | ef4a0e5af5a249879e446636bd0ade54e2df0b9b (diff) | |
parent | dd2c4c37ff03eef6470ef0364217b2c6208c38c0 (diff) | |
download | volse-hubzilla-95311ad07e08c01ff8b9d865cbbc2a0b2bae5239.tar.gz volse-hubzilla-95311ad07e08c01ff8b9d865cbbc2a0b2bae5239.tar.bz2 volse-hubzilla-95311ad07e08c01ff8b9d865cbbc2a0b2bae5239.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
-rw-r--r-- | Zotlabs/Lib/Enotify.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/File_upload.php | 6 | ||||
-rw-r--r-- | Zotlabs/Widget/Notifications.php | 15 | ||||
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/attach.php | 2 | ||||
-rw-r--r-- | view/js/main.js | 14 | ||||
-rw-r--r-- | view/js/mod_cloud.js | 95 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 3 | ||||
-rw-r--r-- | view/tpl/cloud.tpl | 4 | ||||
-rw-r--r-- | view/tpl/cloud_actionspanel.tpl | 9 | ||||
-rw-r--r-- | view/tpl/cloud_directory.tpl | 6 | ||||
-rw-r--r-- | view/tpl/notifications_widget.tpl | 23 |
12 files changed, 132 insertions, 49 deletions
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index 697b57b6a..a7b4f28e8 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -804,6 +804,8 @@ class Enotify { 'when' => relative_date($item['created']), 'class' => (intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen'), 'b64mid' => ((in_array($item['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) ? 'b64.' . base64url_encode($item['thr_parent']) : 'b64.' . base64url_encode($item['mid'])), + 'notify_id' => 'undefined', + 'thread_top' => (($item['item_thread_top']) ? true : false), 'message' => strip_tags(bbcode($itemem_text)) ); diff --git a/Zotlabs/Module/File_upload.php b/Zotlabs/Module/File_upload.php index 296dab708..4d1cc4cda 100644 --- a/Zotlabs/Module/File_upload.php +++ b/Zotlabs/Module/File_upload.php @@ -10,7 +10,8 @@ class File_upload extends \Zotlabs\Web\Controller { function post() { - // logger('file upload: ' . print_r($_REQUEST,true)); + logger('file upload: ' . print_r($_REQUEST,true)); + logger('file upload: ' . print_r($_FILES,true)); $channel = (($_REQUEST['channick']) ? channelx_by_nick($_REQUEST['channick']) : null); @@ -56,13 +57,14 @@ class File_upload extends \Zotlabs\Web\Controller { if(array_key_exists('HTTP_CONTENT_RANGE',$_SERVER)) { $pm = preg_match('/bytes (\d*)\-(\d*)\/(\d*)/',$_SERVER['HTTP_CONTENT_RANGE'],$matches); if($pm) { - // logger('Content-Range: ' . print_r($matches,true)); + logger('Content-Range: ' . print_r($matches,true)); $partial = true; } } if($partial) { $x = save_chunk($channel,$matches[1],$matches[2],$matches[3]); + if($x['partial']) { header('Range: bytes=0-' . (($x['length']) ? $x['length'] - 1 : 0)); json_return_and_die($result); diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php index 191f2afb6..450d3565e 100644 --- a/Zotlabs/Widget/Notifications.php +++ b/Zotlabs/Widget/Notifications.php @@ -20,8 +20,10 @@ class Notifications { 'label' => t('View your network activity') ], 'markall' => [ - 'url' => '#', 'label' => t('Mark all notifications read') + ], + 'filter' => [ + 'label' => t('Show new posts only') ] ]; @@ -36,8 +38,10 @@ class Notifications { 'label' => t('View your home activity') ], 'markall' => [ - 'url' => '#', 'label' => t('Mark all notifications seen') + ], + 'filter' => [ + 'label' => t('Show new posts only') ] ]; @@ -52,7 +56,6 @@ class Notifications { 'label' => t('View your private mails') ], 'markall' => [ - 'url' => '#', 'label' => t('Mark all messages seen') ] ]; @@ -68,7 +71,6 @@ class Notifications { 'label' => t('View events') ], 'markall' => [ - 'url' => '#', 'label' => t('Mark all events seen') ] ]; @@ -104,7 +106,6 @@ class Notifications { 'label' => t('View all notices') ], 'markall' => [ - 'url' => '#', 'label' => t('Mark all notices seen') ] ]; @@ -132,8 +133,10 @@ class Notifications { 'label' => t('View the public stream') ], 'markall' => [ - 'url' => '#', 'label' => t('Mark all notifications seen') + ], + 'filter' => [ + 'label' => t('Show new posts only') ] ]; } @@ -50,7 +50,7 @@ require_once('include/hubloc.php'); require_once('include/attach.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); -define ( 'STD_VERSION', '2.9.3' ); +define ( 'STD_VERSION', '2.9.4' ); define ( 'ZOT_REVISION', '1.3' ); define ( 'DB_UPDATE_VERSION', 1198 ); diff --git a/include/attach.php b/include/attach.php index 5b4c24f6f..86c792ed9 100644 --- a/include/attach.php +++ b/include/attach.php @@ -2506,7 +2506,7 @@ function save_chunk($channel,$start,$end,$len) { } if(($len - 1) == $end) { unlink($tmp_path); - $result['name'] = $_FILES['files']['tmp_name']; + $result['name'] = $_FILES['files']['name']; $result['type'] = $_FILES['files']['type']; $result['tmp_name'] = $new_path; $result['error'] = 0; diff --git a/view/js/main.js b/view/js/main.js index 888934ea8..11a09b647 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -874,6 +874,7 @@ function notify_popup_loader(notifyType) { var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html()); var notifications_all = unescape($('<div>').append( $("#nav-" + notifyType + "-see-all").clone() ).html()); //outerHtml hack var notifications_mark = unescape($('<div>').append( $("#nav-" + notifyType + "-mark-all").clone() ).html()); //outerHtml hack + var notifications_tt_only = unescape($('<div>').append( $("#tt-" + notifyType + "-only").clone() ).html()); //outerHtml hack var notifications_empty = unescape($("#nav-" + notifyType + "-menu").html()); var notify_menu = $("#nav-" + notifyType + "-menu"); @@ -885,14 +886,15 @@ function notify_popup_loader(notifyType) { window.location.href=window.location.href; } - $("#navbar-" + notifyType + "-menu").html(notifications_all + notifications_mark); - $("#nav-" + notifyType + "-menu").html(notifications_all + notifications_mark); + $("#navbar-" + notifyType + "-menu").html(notifications_all + notifications_mark + notifications_tt_only); + $("#nav-" + notifyType + "-menu").html(notifications_all + notifications_mark + notifications_tt_only); + $("." + notifyType + "-update").html(data.notify.length); $(data.notify).each(function() { - html = navbar_notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid,this.notify_id); + html = navbar_notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top); $("#navbar-" + notifyType + "-menu").append(html); - html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid,this.notify_id); + html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top); $("#nav-" + notifyType + "-menu").append(html); }); @@ -901,8 +903,12 @@ function notify_popup_loader(notifyType) { $(el).attr('src', $(el).data("src")); $(el).removeAttr("data-src"); }); + + if($('#tt-' + notifyType + '-only').hasClass('active')) + $('#nav-' + notifyType + '-menu [data-thread_top=false]').hide(); }); + setTimeout(function() { if(notify_menu.hasClass('show')) { console.log('updating ' + notifyType + ' notifications...'); diff --git a/view/js/mod_cloud.js b/view/js/mod_cloud.js index 8af90863e..031895caf 100644 --- a/view/js/mod_cloud.js +++ b/view/js/mod_cloud.js @@ -16,26 +16,69 @@ function UploadInit() { var fileselect = $("#files-upload"); var filedrag = $("#cloud-drag-area"); var submit = $("#upload-submit"); + var count = 1; - // is XHR2 available? - var xhr = new XMLHttpRequest(); - if (xhr.upload) { + + $('#invisible-cloud-file-upload').fileupload({ + url: 'file_upload', + dataType: 'json', + dropZone: filedrag, + maxChunkSize: 4 * 1024 * 1024, - // file select - fileselect.attr("multiple", 'multiple'); - fileselect.on("change", UploadFileSelectHandler); + add: function(e,data) { + $(data.files).each( function() { this.count = ++ count; prepareHtml(this); }); + + var allow_cid = ($('#ajax-upload-files').data('allow_cid') || []); + var allow_gid = ($('#ajax-upload-files').data('allow_gid') || []); + var deny_cid = ($('#ajax-upload-files').data('deny_cid') || []); + var deny_gid = ($('#ajax-upload-files').data('deny_gid') || []); - // file submit - submit.on("click", fileselect, UploadFileSelectHandler); + $('.acl-field').remove(); - // file drop - filedrag.on("dragover", DragDropUploadFileHover); - filedrag.on("dragleave", DragDropUploadFileHover); - filedrag.on("drop", DragDropUploadFileSelectHandler); - } + $(allow_gid).each(function(i,v) { + $('#ajax-upload-files').append("<input class='acl-field' type='hidden' name='group_allow[]' value='"+v+"'>"); + }); + $(allow_cid).each(function(i,v) { + $('#ajax-upload-files').append("<input class='acl-field' type='hidden' name='contact_allow[]' value='"+v+"'>"); + }); + $(deny_gid).each(function(i,v) { + $('#ajax-upload-files').append("<input class='acl-field' type='hidden' name='group_deny[]' value='"+v+"'>"); + }); + $(deny_cid).each(function(i,v) { + $('#ajax-upload-files').append("<input class='acl-field' type='hidden' name='contact_deny[]' value='"+v+"'>"); + }); + + data.formData = $('#ajax-upload-files').serializeArray(); + + data.submit(); + }, + + + progress: function(e,data) { + + // there will only be one file, the one we are looking for + + $(data.files).each( function() { + var idx = this.count; + + // Dynamically update the percentage complete displayed in the file upload list + $('#upload-progress-' + idx).html(Math.round(data.loaded / data.total * 100) + '%'); + $('#upload-progress-bar-' + idx).css('background-size', Math.round(data.loaded / data.total * 100) + '%'); + + }); + + + }, + + + stop: function(e,data) { + window.location.href = window.location.href; + } + + }); + + $('#upload-submit').click(function(event) { event.preventDefault(); $('#invisible-cloud-file-upload').trigger('click'); return false;}); - window.filesToUpload = 0; - window.fileUploadsCompleted = 0; } // file drag hover @@ -84,8 +127,9 @@ function UploadFileSelectHandler(e) { } } -function prepareHtml(f, i) { - var num = i - 1; +function prepareHtml(f) { + var num = f.count - 1; + var i = f.count; $('#cloud-index #new-upload-progress-bar-' + num.toString()).after( '<tr id="new-upload-' + i + '" class="new-upload">' + '<td><i class="fa ' + getIconFromType(f.type) + '" title="' + f.type + '"></i></td>' + @@ -158,6 +202,7 @@ function getIconFromType(type) { // upload files function UploadFile(file, idx) { + window.filesToUpload = window.filesToUpload + 1; var xhr = new XMLHttpRequest(); @@ -202,15 +247,15 @@ function UploadFile(file, idx) { }); // POST to the entire cloud path - xhr.open('post', 'file_upload', true); +// xhr.open('post', 'file_upload', true); - var formfields = $("#ajax-upload-files").serializeArray(); +// var formfields = $("#ajax-upload-files").serializeArray(); - var data = new FormData(); - $.each(formfields, function(i, field) { - data.append(field.name, field.value); - }); - data.append('userfile', file); +// var data = new FormData(); +// $.each(formfields, function(i, field) { +// data.append(field.name, field.value); +// }); +// data.append('userfile', file); - xhr.send(data); +// xhr.send(data); } diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 38b01a16f..33536dee4 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -113,7 +113,8 @@ a:focus, color: $link_colour; } -.fakelink { +.fakelink, +.cursor-pointer { cursor: pointer; } diff --git a/view/tpl/cloud.tpl b/view/tpl/cloud.tpl index d1567af9f..e7237c7e6 100644 --- a/view/tpl/cloud.tpl +++ b/view/tpl/cloud.tpl @@ -1,3 +1,7 @@ +<script src="library/blueimp_upload/js/vendor/jquery.ui.widget.js"></script> +<script src="library/blueimp_upload/js/jquery.iframe-transport.js"></script> +<script src="library/blueimp_upload/js/jquery.fileupload.js"></script> + <div class="generic-content-wrapper"> {{include file="cloud_header.tpl"}} {{include file="cloud_directory.tpl"}} diff --git a/view/tpl/cloud_actionspanel.tpl b/view/tpl/cloud_actionspanel.tpl index fc3e7f82f..6b876d2ac 100644 --- a/view/tpl/cloud_actionspanel.tpl +++ b/view/tpl/cloud_actionspanel.tpl @@ -1,3 +1,4 @@ +<input id="invisible-cloud-file-upload" type="file" name="files" style="visibility:hidden;position:absolute;top:-50;left:-50;width:0;height:0;" multiple> <div id="files-mkdir-tools" class="section-content-tools-wrapper"> <label for="files-mkdir">{{$folder_header}}</label> <form id="mkdir-form" method="post" action="file_upload" class="acl-form" data-form_id="mkdir-form" data-allow_cid='{{$allow_cid}}' data-allow_gid='{{$allow_gid}}' data-deny_cid='{{$deny_cid}}' data-deny_gid='{{$deny_gid}}'> @@ -20,12 +21,12 @@ </div> <div id="files-upload-tools" class="section-content-tools-wrapper"> {{if $quota.limit || $quota.used}}<div class="{{if $quota.warning}}section-content-danger-wrapper{{else}}section-content-info-wrapper{{/if}}">{{if $quota.warning}}<strong>{{$quota.warning}} </strong>{{/if}}{{if $quota.desc}}{{$quota.desc}}<br><br>{{/if}}{{$info}}</div>{{/if}} - <form id="ajax-upload-files" method="post" action="file_upload" enctype="multipart/form-data" class="acl-form" data-form_id="ajax-upload-files" data-allow_cid='{{$allow_cid}}' data-allow_gid='{{$allow_gid}}' data-deny_cid='{{$deny_cid}}' data-deny_gid='{{$deny_gid}}'> + <form id="ajax-upload-files" method="post" action="#" enctype="multipart/form-data" class="acl-form" data-form_id="ajax-upload-files" data-allow_cid='{{$allow_cid}}' data-allow_gid='{{$allow_gid}}' data-deny_cid='{{$deny_cid}}' data-deny_gid='{{$deny_gid}}'> <input type="hidden" name="directory" value="{{$path}}" /> <input type="hidden" name="channick" value="{{$channick}}" /> <input type="hidden" name="return_url" value="{{$return_url}}" /> - <label for="files-upload">{{$upload_header}}</label> - <input class="form-group pull-left" id="files-upload" type="file" name="userfile"> + <!--label for="files-upload">{{$upload_header}}</label> + <input class="form-group pull-left" id="files-upload" type="file" name="files[]" multiple --> {{include file="field_checkbox.tpl" field=$notify}} <div class="pull-right btn-group"> <div class="btn-group"> @@ -34,7 +35,7 @@ <i class="jot-perms-icon fa fa-{{$lockstate}}"></i> </button> {{/if}} - <button id="upload-submit" class="btn btn-primary btn-sm pull-right" type="submit" name="submit" value="{{$upload_submit}}">{{$upload_submit}}</button> + <button id="upload-submit" class="btn btn-primary btn-sm pull-right">{{$upload_submit}}</button> </div> </div> </form> diff --git a/view/tpl/cloud_directory.tpl b/view/tpl/cloud_directory.tpl index 88b6bf563..ad3caff88 100644 --- a/view/tpl/cloud_directory.tpl +++ b/view/tpl/cloud_directory.tpl @@ -1,8 +1,12 @@ <div id="cloud-drag-area" class="section-content-wrapper-np"> {{if $tiles}} + <table id="cloud-index"> + <tr id="new-upload-progress-bar-1"></tr> {{* this is needed to append the upload files in the right order *}} + </table> {{if $parentpath}} <div class="cloud-container" > + <div class="cloud-icon tiles"><a href="{{$parentpath.path}}"> <div class="cloud-icon-container"><i class="fa fa-fw fa-level-up" ></i></div> </a> @@ -52,7 +56,7 @@ <td class="d-none d-md-table-cell"></td> </tr> {{/if}} - <tr id="new-upload-progress-bar--1"></tr> {{* this is needed to append the upload files in the right order *}} + <tr id="new-upload-progress-bar-1"></tr> {{* this is needed to append the upload files in the right order *}} {{foreach $entries as $item}} <tr id="cloud-index-{{$item.attachId}}"> <td><i class="fa {{$item.iconFromType}}" title="{{$item.type}}"></i></td> diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index 18f3ef12d..9751f2e75 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -22,7 +22,7 @@ }); {{if $module == 'display' || $module == 'hq'}} - $(document).on('click touch', '.notification', function(e) { + $(document).on('click', '.notification', function(e) { var b64mid = $(this).data('b64mid'); var notify_id = $(this).data('notify_id'); var path = $(this)[0].pathname.substr(1,7); @@ -53,6 +53,16 @@ }); {{/if}} + {{foreach $notifications as $notification}} + {{if $notification.filter}} + $(document).on('click', '#tt-{{$notification.type}}-only', function(e) { + e.preventDefault(); + $('#nav-{{$notification.type}}-menu [data-thread_top=false]').toggle(); + $(this).toggleClass('active'); + }); + {{/if}} + {{/foreach}} + function getData(b64mid, notify_id) { $('.thread-wrapper').remove(); bParam_mid = b64mid; @@ -72,7 +82,7 @@ <div id="notifications_wrapper"> <div id="notifications" class="navbar-nav" data-children=".nav-item"> <div id="nav-notifications-template" rel="template"> - <a class="list-group-item clearfix notification {5}" href="{0}" title="{2} {3}" data-b64mid="{6}" data-notify_id="{7}"> + <a class="list-group-item clearfix notification {5}" href="{0}" title="{2} {3}" data-b64mid="{6}" data-notify_id="{7}" data-thread_top="{8}"> <img class="menu-img-3" data-src="{1}"> <span class="contactname">{2}</span> <span class="dropdown-sub-text">{3}<br>{4}</span> @@ -91,9 +101,14 @@ </a> {{/if}} {{if $notification.markall}} - <a class="list-group-item text-dark" id="nav-{{$notification.type}}-mark-all" href="{{$notification.markall.url}}" onclick="markRead('{{$notification.type}}'); return false;"> + <div class="list-group-item cursor-pointer" id="nav-{{$notification.type}}-mark-all" onclick="markRead('{{$notification.type}}'); return false;"> <i class="fa fa-fw fa-check"></i> {{$notification.markall.label}} - </a> + </div> + {{/if}} + {{if $notification.filter}} + <div class="list-group-item cursor-pointer" id="tt-{{$notification.type}}-only"> + <i class="fa fa-fw fa-filter"></i> {{$notification.filter.label}} + </div> {{/if}} {{$loading}} </div> |