aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-08-04 10:36:45 +0200
committerMario Vavti <mario@mariovavti.com>2016-08-04 10:36:45 +0200
commit0340160ba71f73ef3dab1141d75f30d85144cc44 (patch)
treebba09795fa6a6b7e240a7c32bb42025253699e94
parent4ede3fd771ea997cffaa6abab29988a58daf892e (diff)
downloadvolse-hubzilla-0340160ba71f73ef3dab1141d75f30d85144cc44.tar.gz
volse-hubzilla-0340160ba71f73ef3dab1141d75f30d85144cc44.tar.bz2
volse-hubzilla-0340160ba71f73ef3dab1141d75f30d85144cc44.zip
multi acl: port /cloud and /filestorage
-rw-r--r--Zotlabs/Module/Filestorage.php11
-rw-r--r--Zotlabs/Storage/Browser.php4
-rw-r--r--view/js/main.js2
-rw-r--r--view/js/mod_filestorage.js15
-rw-r--r--view/tpl/attach_edit.tpl6
-rw-r--r--view/tpl/cloud_actionspanel.tpl3
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 @@
-<form id="attach_edit_form_{{$file.id}}" action="filestorage/{{$channelnick}}/{{$file.id}}/edit" method="post" >
+<form id="attach_edit_form_{{$file.id}}" action="filestorage/{{$channelnick}}/{{$file.id}}/edit" method="post" class="acl-form" data-form_id="attach_edit_form_{{$file.id}}" data-allow_cid='{{$allow_cid}}' data-allow_gid='{{$allow_gid}}' data-deny_cid='{{$deny_cid}}' data-deny_gid='{{$deny_gid}}'>
<input type="hidden" name="channelnick" value="{{$channelnick}}" />
<input type="hidden" name="filehash" value="{{$file.hash}}" />
<input type="hidden" name="uid" value="{{$uid}}" />
@@ -16,10 +16,10 @@
</button>
</div>
<div id="attach-edit-perms" class="btn-group pull-right">
- <button id="dbtn-acl" class="acl-select btn btn-default btn-xs" data-toggle="modal" data-target="#aclModal" title="{{$permset}}" onclick="return false;" data-formid="attach_edit_form_{{$file.id}}" data-allow_cid="{{$allow_cid}}" data-allow_gid="{{$allow_gid}}" data-deny_cid="{{$deny_cid}}" data-deny_gid="{{$deny_gid}}">
+ <button id="dbtn-acl" class="btn btn-default btn-xs" data-toggle="modal" data-target="#aclModal" title="{{$permset}}" type="button">
<i id="jot-perms-icon" class="fa fa-{{$lockstate}} jot-icons"></i>
</button>
- <button id="dbtn-submit" class="acl-submit btn btn-primary btn-xs" type="submit" name="submit" data-formid="attach_edit_form_{{$file.id}}">
+ <button id="dbtn-submit" class="btn btn-primary btn-xs" type="submit" name="submit">
{{$submit}}
</button>
</div>
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 @@
</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}}{{$quota.desc}}</div>{{/if}}
- <form id="ajax-upload-files" method="post" action="" enctype="multipart/form-data">
+ <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="sabreAction" value="put">
<label for="files-upload">{{$upload_header}}</label>
- <div class="clear"></div>
<input class="form-group pull-left" id="files-upload" type="file" name="file">
<button id="upload-submit" class="btn btn-primary btn-sm pull-right" type="submit" value="{{$upload_submit}}">{{$upload_submit}}</button>
</form>