From 0340160ba71f73ef3dab1141d75f30d85144cc44 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 4 Aug 2016 10:36:45 +0200 Subject: [PATCH] multi acl: port /cloud and /filestorage --- Zotlabs/Module/Filestorage.php | 11 +++++------ Zotlabs/Storage/Browser.php | 4 ++++ view/js/main.js | 2 -- view/js/mod_filestorage.js | 15 +-------------- view/tpl/attach_edit.tpl | 6 +++--- view/tpl/cloud_actionspanel.tpl | 3 +-- 6 files changed, 14 insertions(+), 27 deletions(-) diff --git a/Zotlabs/Module/Filestorage.php b/Zotlabs/Module/Filestorage.php index c8ad147bb..a401f4822 100644 --- a/Zotlabs/Module/Filestorage.php +++ b/Zotlabs/Module/Filestorage.php @@ -141,7 +141,7 @@ class Filestorage extends \Zotlabs\Web\Controller { // Encode path that is used for link so it's a valid URL // Keep slashes as slashes, otherwise mod_rewrite doesn't work correctly $encoded_path = str_replace('%2F', '/', rawurlencode($cloudpath)); - + $o = replace_macros(get_markup_template('attach_edit.tpl'), array( '$header' => t('Edit file permissions'), '$file' => $f, @@ -151,6 +151,10 @@ class Filestorage extends \Zotlabs\Web\Controller { '$channelnick' => $channel['channel_address'], '$permissions' => t('Permissions'), '$aclselect' => $aclselect_e, + '$allow_cid' => acl2json($f['allow_cid']), + '$allow_gid' => acl2json($f['allow_gid']), + '$deny_cid' => acl2json($f['deny_cid']), + '$deny_gid' => acl2json($f['deny_gid']), '$lockstate' => $lockstate, '$permset' => t('Set/edit permissions'), '$recurse' => array('recurse', t('Include all files and sub folders'), 0, '', array(t('No'), t('Yes'))), @@ -162,11 +166,6 @@ class Filestorage extends \Zotlabs\Web\Controller { '$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'))), - - '$allow_cid' => json_encode(expand_acl($f['allow_cid'])), - '$allow_gid' => json_encode(expand_acl($f['allow_gid'])), - '$deny_cid' => json_encode(expand_acl($f['deny_cid'])), - '$deny_cid' => json_encode(expand_acl($f['deny_gid'])) )); echo $o; diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php index 93c55bd4c..78b267bf8 100644 --- a/Zotlabs/Storage/Browser.php +++ b/Zotlabs/Storage/Browser.php @@ -324,6 +324,10 @@ class Browser extends DAV\Browser\Plugin { '$quota' => $quota, '$channick' => $this->auth->owner_nick, '$aclselect' => $aclselect, + '$allow_cid' => acl2json($channel_acl['allow_cid']), + '$allow_gid' => acl2json($channel_acl['allow_gid']), + '$deny_cid' => acl2json($channel_acl['deny_cid']), + '$deny_gid' => acl2json($channel_acl['deny_gid']), '$lockstate' => $lockstate, '$return_url' => \App::$cmd, '$dragdroptext' => t('Drop files here to immediately upload') diff --git a/view/js/main.js b/view/js/main.js index a3fade0ea..21157bdfe 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1015,8 +1015,6 @@ function filestorage(event, nick, id) { $('#cloud-index-' + last_filestorage_id).removeClass('cloud-index-active'); $('#perms-panel-' + last_filestorage_id).hide().html(''); $('#file-edit-' + id).spin('tiny'); - // What for do we need this here? - delete acl; $.get('filestorage/' + nick + '/' + id + '/edit', function(data) { $('#cloud-index-' + id).addClass('cloud-index-active'); $('#perms-panel-' + id).html(data).show(); diff --git a/view/js/mod_filestorage.js b/view/js/mod_filestorage.js index c0620c928..4f58af9d5 100644 --- a/view/js/mod_filestorage.js +++ b/view/js/mod_filestorage.js @@ -1,17 +1,4 @@ /** * JavaScript used by mod/filestorage */ -$(document).ready(function() { - $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() { - var selstr; - $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() { - selstr = $(this).text(); - $('#jot-perms-icon').removeClass('fa-unlock').addClass('fa-lock'); - $('#jot-public').hide(); - }); - if(selstr === null) { - $('#jot-perms-icon').removeClass('fa-lock').addClass('fa-unlock'); - $('#jot-public').show(); - } - }).trigger('change'); -}); \ No newline at end of file + diff --git a/view/tpl/attach_edit.tpl b/view/tpl/attach_edit.tpl index 1098049bf..1d58004e5 100644 --- a/view/tpl/attach_edit.tpl +++ b/view/tpl/attach_edit.tpl @@ -1,4 +1,4 @@ -
+ @@ -16,10 +16,10 @@
- -
diff --git a/view/tpl/cloud_actionspanel.tpl b/view/tpl/cloud_actionspanel.tpl index 2c07f5ea7..0884cd0b4 100644 --- a/view/tpl/cloud_actionspanel.tpl +++ b/view/tpl/cloud_actionspanel.tpl @@ -9,10 +9,9 @@
{{if $quota.limit || $quota.used}}{{/if}} - + -