diff options
author | zotlabs <mike@macgirvin.com> | 2017-07-29 15:42:33 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-07-29 15:42:33 -0700 |
commit | 2ee0f769d90f424d2332708df8c86c7bc8390268 (patch) | |
tree | 8b902fbcefb505b9916ff880605055bf89dcd153 | |
parent | 9b9fe39839632811f22a718307116b61b220b752 (diff) | |
parent | 8161ec88e5a2b9d1f7071dfed6a70c850e42ed4b (diff) | |
download | volse-hubzilla-2ee0f769d90f424d2332708df8c86c7bc8390268.tar.gz volse-hubzilla-2ee0f769d90f424d2332708df8c86c7bc8390268.tar.bz2 volse-hubzilla-2ee0f769d90f424d2332708df8c86c7bc8390268.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge
-rw-r--r-- | Zotlabs/Module/File_upload.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Filestorage.php | 16 | ||||
-rw-r--r-- | Zotlabs/Storage/Browser.php | 3 | ||||
-rw-r--r-- | include/attach.php | 21 | ||||
-rw-r--r-- | view/js/main.js | 2 | ||||
-rw-r--r-- | view/theme/redbasic/js/redbasic.js | 12 | ||||
-rw-r--r-- | view/tpl/cloud_actionspanel.tpl | 1 | ||||
-rwxr-xr-x | view/tpl/nav.tpl | 2 |
8 files changed, 40 insertions, 21 deletions
diff --git a/Zotlabs/Module/File_upload.php b/Zotlabs/Module/File_upload.php index 29a7bd137..f036d3f43 100644 --- a/Zotlabs/Module/File_upload.php +++ b/Zotlabs/Module/File_upload.php @@ -34,10 +34,10 @@ class File_upload extends \Zotlabs\Web\Controller { $_REQUEST['deny_gid'] = perms2str($_REQUEST['group_deny']); if($_REQUEST['filename']) { - $r = attach_mkdir($channel,get_observer_hash(),$_REQUEST); + $r = attach_mkdir($channel, get_observer_hash(), $_REQUEST); } else { - $r = attach_store($channel,get_observer_hash(), '', $_REQUEST); + $r = attach_store($channel, get_observer_hash(), '', $_REQUEST); } goaway(z_root() . '/' . $_REQUEST['return_url']); diff --git a/Zotlabs/Module/Filestorage.php b/Zotlabs/Module/Filestorage.php index 785dff394..0b83dea34 100644 --- a/Zotlabs/Module/Filestorage.php +++ b/Zotlabs/Module/Filestorage.php @@ -26,7 +26,7 @@ class Filestorage extends \Zotlabs\Web\Controller { $recurse = ((x($_POST, 'recurse')) ? intval($_POST['recurse']) : 0); $resource = ((x($_POST, 'filehash')) ? notags($_POST['filehash']) : ''); - $notify = ((x($_POST, 'notify')) ? intval($_POST['notify']) : 0); + $notify = ((x($_POST, 'notify_edit')) ? intval($_POST['notify_edit']) : 0); if(! $resource) { notice(t('Item not found.') . EOL); @@ -39,16 +39,16 @@ class Filestorage extends \Zotlabs\Web\Controller { $acl->set_from_array($_REQUEST); $x = $acl->get(); - $cloudPath = get_parent_cloudpath($channel_id, $channel['channel_address'], $resource); + $url = get_cloud_url($channel_id, $channel['channel_address'], $resource); //get the object before permissions change so we can catch eventual former allowed members - $object = get_file_activity_object($channel_id, $resource, $cloudPath); + $object = get_file_activity_object($channel_id, $resource, $url); attach_change_permissions($channel_id, $resource, $x['allow_cid'], $x['allow_gid'], $x['deny_cid'], $x['deny_gid'], $recurse, true); file_activity($channel_id, $object, $x['allow_cid'], $x['allow_gid'], $x['deny_cid'], $x['deny_gid'], 'post', $notify); - goaway($cloudPath); + goaway(dirname($url)); } function get() { @@ -107,11 +107,11 @@ class Filestorage extends \Zotlabs\Web\Controller { $f = $r[0]; $channel = \App::get_channel(); - $parentpath = get_parent_cloudpath($channel['channel_id'], $channel['channel_address'], $f['hash']); + $url = get_cloud_url($channel['channel_id'], $channel['channel_address'], $f['hash']); attach_delete($owner, $f['hash']); - goaway($parentpath); + goaway(dirname($url)); } if(argc() > 3 && argv(3) === 'edit') { @@ -131,7 +131,6 @@ class Filestorage extends \Zotlabs\Web\Controller { $channel = \App::get_channel(); $cloudpath = get_cloudpath($f); - $parentpath = get_parent_cloudpath($channel['channel_id'], $channel['channel_address'], $f['hash']); $aclselect_e = populate_acl($f, false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_storage')); $is_a_dir = (intval($f['is_dir']) ? true : false); @@ -146,7 +145,6 @@ class Filestorage extends \Zotlabs\Web\Controller { '$header' => t('Edit file permissions'), '$file' => $f, '$cloudpath' => z_root() . '/' . $encoded_path, - '$parentpath' => $parentpath, '$uid' => $channel['channel_id'], '$channelnick' => $channel['channel_address'], '$permissions' => t('Permissions'), @@ -165,7 +163,7 @@ class Filestorage extends \Zotlabs\Web\Controller { '$submit' => t('Submit'), '$attach_btn_title' => t('Share this file'), '$link_btn_title' => t('Show URL to this file'), - '$notify' => array('notify', t('Notify your contacts about this file'), 0, '', array(t('No'), t('Yes'))), + '$notify' => array('notify_edit', t('Show in your contacts shared folder'), 0, '', array(t('No'), t('Yes'))), )); echo $o; diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php index 3af9fcab1..9b7e9ad8e 100644 --- a/Zotlabs/Storage/Browser.php +++ b/Zotlabs/Storage/Browser.php @@ -347,7 +347,8 @@ class Browser extends DAV\Browser\Plugin { '$return_url' => \App::$cmd, '$path' => $path, '$folder' => find_folder_hash_by_path($this->auth->owner_id, $path), - '$dragdroptext' => t('Drop files here to immediately upload') + '$dragdroptext' => t('Drop files here to immediately upload'), + '$notify' => ['notify', t('Show in your contacts shared folder'), 0, '', [t('No'), t('Yes')]] )); } diff --git a/include/attach.php b/include/attach.php index 3a0c8b7ba..4d20f094c 100644 --- a/include/attach.php +++ b/include/attach.php @@ -423,6 +423,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $hash = (($arr && $arr['hash']) ? $arr['hash'] : null); $upload_path = (($arr && $arr['directory']) ? $arr['directory'] : ''); $visible = (($arr && $arr['visible']) ? $arr['visible'] : ''); + $notify = (($arr && $arr['notify']) ? $arr['notify'] : ''); $observer = array(); @@ -884,6 +885,12 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { build_sync_packet($channel['channel_id'],array('file' => array($sync))); } + if($notify) { + $cloudPath = z_root() . '/cloud/' . $channel['channel_address'] . $r['0']['display_path']; + $object = get_file_activity_object($channel['channel_id'], $r['0']['hash'], $cloudPath); + file_activity($channel['channel_id'], $object, $r['0']['allow_cid'], $r['0']['allow_gid'], $r['0']['deny_cid'], $r['0']['deny_gid'], 'post', $notify); + } + return $ret; } @@ -1297,8 +1304,8 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { return; } - $cloudpath = get_parent_cloudpath($channel_id, $channel_address, $resource); - $object = get_file_activity_object($channel_id, $resource, $cloudpath); + $url = get_cloudpath($channel_id, $channel_address, $resource); + $object = get_file_activity_object($channel_id, $resource, $url); // If resource is a directory delete everything in the directory recursive if(intval($r[0]['is_dir'])) { @@ -1439,7 +1446,7 @@ function get_cloudpath($arr) { * @param string $attachHash * @return string with the full folder path */ -function get_parent_cloudpath($channel_id, $channel_name, $attachHash) { +function get_cloud_url($channel_id, $channel_name, $attachHash) { $parentFullPath = ''; // build directory tree $parentHash = $attachHash; @@ -1451,9 +1458,9 @@ function get_parent_cloudpath($channel_id, $channel_name, $attachHash) { } } while ($parentHash); - $parentFullPath = z_root() . '/cloud/' . $channel_name . '/' . $parentFullPath; + $url = z_root() . '/cloud/' . $channel_name . '/' . $parentFullPath . find_filename_by_hash($channel_id, $attachHash); - return $parentFullPath; + return $url; } /** @@ -1731,14 +1738,14 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid, * @param string $hash * @param string $cloudpath */ -function get_file_activity_object($channel_id, $hash, $cloudpath) { +function get_file_activity_object($channel_id, $hash, $url) { $x = q("SELECT creator, filename, filetype, filesize, revision, folder, os_storage, is_photo, is_dir, flags, created, edited, allow_cid, allow_gid, deny_cid, deny_gid FROM attach WHERE uid = %d AND hash = '%s' LIMIT 1", intval($channel_id), dbesc($hash) ); - $url = rawurlencode($cloudpath . $x[0]['filename']); + $url = rawurlencode($url); $links = array(); $links[] = array( diff --git a/view/js/main.js b/view/js/main.js index 8c49e3173..54450858a 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -375,7 +375,7 @@ function NavUpdate() { } else { $('#notifications-btn').css('opacity', 0.5); - $('#navbar-collapse-1').removeClass('in'); + $('#navbar-collapse-1').removeClass('show'); } if(data.network == 0) { diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index a4fee495c..5a586b9f9 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -54,6 +54,18 @@ $(document).ready(function() { } }); + $('#menu-btn').click(function() { + if($('#navbar-collapse-1').hasClass('show')){ + $('#navbar-collapse-1').removeClass('show'); + } + }); + + $('#notifications-btn').click(function() { + if($('#navbar-collapse-2').hasClass('show')){ + $('#navbar-collapse-2').removeClass('show'); + } + }); + $("input[data-role=cat-tagsinput]").tagsinput({ tagClass: 'badge badge-pill badge-warning text-dark' }); diff --git a/view/tpl/cloud_actionspanel.tpl b/view/tpl/cloud_actionspanel.tpl index 0ebecce29..fc3e7f82f 100644 --- a/view/tpl/cloud_actionspanel.tpl +++ b/view/tpl/cloud_actionspanel.tpl @@ -26,6 +26,7 @@ <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"> + {{include file="field_checkbox.tpl" field=$notify}} <div class="pull-right btn-group"> <div class="btn-group"> {{if $lockstate}} diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl index 137fed790..ae354e371 100755 --- a/view/tpl/nav.tpl +++ b/view/tpl/nav.tpl @@ -68,7 +68,7 @@ <i class="fa fa-exclamation-circle"></i> </button> {{/if}} - <button class="navbar-toggler border-0" type="button" data-toggle="collapse" data-target="#navbar-collapse-2"> + <button id="menu-btn" class="navbar-toggler border-0" type="button" data-toggle="collapse" data-target="#navbar-collapse-2"> <i class="fa fa-bars"></i> </button> </div> |