aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
Diffstat (limited to 'view')
-rw-r--r--view/js/acl.js86
-rwxr-xr-xview/tpl/acl_selector.tpl6
-rw-r--r--view/tpl/attach_edit.tpl8
-rw-r--r--view/tpl/chatroom_new.tpl6
-rw-r--r--view/tpl/cloud_actionspanel.tpl1
-rwxr-xr-xview/tpl/jot.tpl9
6 files changed, 75 insertions, 41 deletions
diff --git a/view/js/acl.js b/view/js/acl.js
index 79699c589..33895d260 100644
--- a/view/js/acl.js
+++ b/view/js/acl.js
@@ -1,15 +1,17 @@
-function ACL(backend_url, preset) {
+function ACL(backend_url) {
that = this;
that.url = backend_url;
that.kp_timer = null;
- if (preset === undefined) preset = [];
- that.allow_cid = (preset[0] || []);
- that.allow_gid = (preset[1] || []);
- that.deny_cid = (preset[2] || []);
- that.deny_gid = (preset[3] || []);
+ that.self = [];
+
+ that.allow_cid = [];
+ that.allow_gid = [];
+ that.deny_cid = [];
+ that.deny_gid = [];
+
that.group_uids = [];
that.info = $("#acl-info");
@@ -21,11 +23,8 @@ function ACL(backend_url, preset) {
that.showlimited = $("#acl-showlimited");
that.acl_select = $("#acl-select");
- that.preset = preset;
- that.self = [];
-
// set the initial ACL lists in case the enclosing form gets submitted before the ajax loader completes.
- that.on_submit();
+ //that.on_submit();
/*events*/
@@ -47,32 +46,59 @@ function ACL(backend_url, preset) {
}
});
+
+ //$(document).on('click', '.acl-submit', that.get_form_id_and_submit);
+ //$(document).on('click', '.acl-select', that.get_form_id_and_submit);
+
+ $(document).on('focus', '.acl-form', that.get_form_data);
+ $(document).on('click', '.acl-form', that.get_form_data);
+
$(document).on('click','.acl-button-show',that.on_button_show);
$(document).on('click','.acl-button-hide',that.on_button_hide);
+ $(document).on('click','.acl-button-hide',that.on_button_hide);
+
$("#acl-search").keypress(that.on_search);
/* startup! */
that.get(0,15000);
- that.on_submit();
+ //that.on_submit();
});
}
// no longer called only on submit - call to update whenever a change occurs to the acl list.
+ACL.prototype.get_form_data = function(event) {
+//event.preventDefault()
+
+ that.form_id = $(this).data('formid');
+
+ console.log(event);
+
+ that.allow_cid = ($(this).data('allow_cid') || []);
+ that.allow_gid = ($(this).data('allow_gid') || []);
+ that.deny_cid = ($(this).data('deny_cid') || []);
+ that.deny_gid = ($(this).data('deny_gid') || []);
+
+ that.update_view();
+ that.on_submit();
+}
ACL.prototype.on_submit = function() {
- aclfields = $("#acl-fields").html("");
+
+
+ //console.log(that.form_id);
+ $('.acl-field').remove();
$(that.allow_gid).each(function(i,v) {
- aclfields.append("<input type='hidden' name='group_allow[]' value='"+v+"'>");
+ $('#' + that.form_id).append("<input class='acl-field' type='hidden' name='group_allow[]' value='"+v+"'>");
});
$(that.allow_cid).each(function(i,v) {
- aclfields.append("<input type='hidden' name='contact_allow[]' value='"+v+"'>");
+ $('#' + that.form_id).append("<input class='acl-field' type='hidden' name='contact_allow[]' value='"+v+"'>");
});
$(that.deny_gid).each(function(i,v) {
- aclfields.append("<input type='hidden' name='group_deny[]' value='"+v+"'>");
+ $('#' + that.form_id).append("<input class='acl-field' type='hidden' name='group_deny[]' value='"+v+"'>");
});
$(that.deny_cid).each(function(i,v) {
- aclfields.append("<input type='hidden' name='contact_deny[]' value='"+v+"'>");
+ $('#' + that.form_id).append("<input class='acl-field' type='hidden' name='contact_deny[]' value='"+v+"'>");
});
//areYouSure jquery plugin: recheck the form here
@@ -101,6 +127,7 @@ ACL.prototype.on_onlyme = function(event) {
that.deny_cid = [];
that.deny_gid = [];
+
that.update_view(event.target.value);
that.on_submit();
@@ -126,14 +153,14 @@ ACL.prototype.on_showlimited = function(event) {
// preventDefault() isn't called here as we want state changes from update_view() to be applied to the radiobutton
event.stopPropagation();
- if(that.preset[0].length === 0 && that.preset[1].length === 0 && that.preset[2].length === 0 && that.preset[3].length === 0) {
- that.preset[0] = [that.self[0]];
+ if(that.allow_cid.length === 0 && that.allow_gid.length === 0 && that.deny_cid.length === 0 && that.deny_gid.length === 0) {
+ that.allow_cid = [that.self[0]];
}
- that.allow_cid = (that.preset[0] || []);
- that.allow_gid = (that.preset[1] || []);
- that.deny_cid = (that.preset[2] || []);
- that.deny_gid = (that.preset[3] || []);
+ that.allow_cid = (that.allow_cid || []);
+ that.allow_gid = (that.allow_gid || []);
+ that.deny_cid = (that.deny_cid || []);
+ that.deny_gid = (that.deny_gid || []);
that.update_view(event.target.value);
that.on_submit();
@@ -239,14 +266,21 @@ ACL.prototype.set_deny = function(itemid) {
that.update_view();
};
-ACL.prototype.update_select = function(preset) {
- that.showall.prop('selected', preset === 'public');
- that.onlyme.prop('selected', preset === 'onlyme');
- that.showlimited.prop('selected', preset === 'limited');
+ACL.prototype.update_select = function(set) {
+ that.showall.prop('selected', set === 'public');
+ that.onlyme.prop('selected', set === 'onlyme');
+ that.showlimited.prop('selected', set === 'limited');
};
ACL.prototype.update_view = function(value) {
+ console.log(that.form_id);
+
+ console.log(that.allow_cid);
+ console.log(that.allow_gid);
+ console.log(that.deny_cid);
+ console.log(that.deny_gid);
+
if (that.allow_gid.length === 0 && that.allow_cid.length === 0 && that.deny_gid.length === 0 && that.deny_cid.length === 0) {
that.list.hide(); //hide acl-list
that.info.show(); //show acl-info
diff --git a/view/tpl/acl_selector.tpl b/view/tpl/acl_selector.tpl
index 60fae0a29..ddeb25a39 100755
--- a/view/tpl/acl_selector.tpl
+++ b/view/tpl/acl_selector.tpl
@@ -1,3 +1,4 @@
+<form>
<div class="modal" id="aclModal">
<div class="modal-dialog">
<div class="modal-content">
@@ -59,14 +60,13 @@
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
-
+</form>
<script>
$('[data-toggle="popover"]').popover(); // Init the popover, if present
if(typeof acl=="undefined"){
acl = new ACL(
- baseurl+"/acl",
- [ {{$allowcid}},{{$allowgid}},{{$denycid}},{{$denygid}} ]
+ baseurl+"/acl"
);
}
</script>
diff --git a/view/tpl/attach_edit.tpl b/view/tpl/attach_edit.tpl
index 965fb4819..1098049bf 100644
--- a/view/tpl/attach_edit.tpl
+++ b/view/tpl/attach_edit.tpl
@@ -1,4 +1,4 @@
-<form action="filestorage/{{$channelnick}}/{{$file.id}}/edit" method="post" >
+<form id="attach_edit_form_{{$file.id}}" action="filestorage/{{$channelnick}}/{{$file.id}}/edit" method="post" >
<input type="hidden" name="channelnick" value="{{$channelnick}}" />
<input type="hidden" name="filehash" value="{{$file.hash}}" />
<input type="hidden" name="uid" value="{{$uid}}" />
@@ -16,15 +16,13 @@
</button>
</div>
<div id="attach-edit-perms" class="btn-group pull-right">
- <button id="dbtn-acl" class="btn btn-default btn-xs" data-toggle="modal" data-target="#aclModal" title="{{$permset}}" onclick="return false;">
+ <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}}">
<i id="jot-perms-icon" class="fa fa-{{$lockstate}} jot-icons"></i>
</button>
- <button id="dbtn-submit" class="btn btn-primary btn-xs" type="submit" name="submit">
+ <button id="dbtn-submit" class="acl-submit btn btn-primary btn-xs" type="submit" name="submit" data-formid="attach_edit_form_{{$file.id}}">
{{$submit}}
</button>
</div>
- {{$aclselect}}
-
<div id="link-code" class="form-group">
<label for="">{{$cpldesc}}</label>
<input type="text" class="form-control" id="linkpasteinput" name="cutpasteextlink" value="{{$cloudpath}}" onclick="this.select();"/>
diff --git a/view/tpl/chatroom_new.tpl b/view/tpl/chatroom_new.tpl
index a40313934..94f694e41 100644
--- a/view/tpl/chatroom_new.tpl
+++ b/view/tpl/chatroom_new.tpl
@@ -1,12 +1,12 @@
<div id="chatroom-new" class="section-content-tools-wrapper">
- <form action="chat" method="post" >
+ <form id="chatroom-new-form" action="chat" method="post" >
{{include file="field_input.tpl" field=$name}}
{{include file="field_input.tpl" field=$chat_expire}}
- {{$acl}}
<div class="btn-group pull-right">
<button id="dbtn-acl" class="btn btn-default" data-toggle="modal" data-target="#aclModal" title="{{$permissions}}" onclick="return false;" ><i id="jot-perms-icon" class="fa fa-{{$lockstate}}"></i></button>
- <button id="dbtn-submit" class="btn btn-primary" type="submit" name="submit" value="{{$submit}}">{{$submit}}</button>
+ <button id="dbtn-submit" class="acl-submit btn btn-primary" type="submit" name="submit" value="{{$submit}}" data-formid="chatroom-new-form">{{$submit}}</button>
</div>
<div class="clear"></div>
</form>
</div>
+{{$acl}}
diff --git a/view/tpl/cloud_actionspanel.tpl b/view/tpl/cloud_actionspanel.tpl
index eaa613dc4..2c07f5ea7 100644
--- a/view/tpl/cloud_actionspanel.tpl
+++ b/view/tpl/cloud_actionspanel.tpl
@@ -18,3 +18,4 @@
</form>
<div class="clear"></div>
</div>
+{{$aclselect}}
diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl
index 490349a04..a207989fb 100755
--- a/view/tpl/jot.tpl
+++ b/view/tpl/jot.tpl
@@ -1,4 +1,4 @@
-<form id="profile-jot-form" action="{{$action}}" method="post">
+<form id="profile-jot-form" action="{{$action}}" method="post" class="acl-form" data-formid="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}}
{{if $id_select}}
@@ -23,7 +23,6 @@
<input type="hidden" name="webpage" value="{{$webpage}}" />
<input type="hidden" name="preview" id="jot-preview" value="0" />
<input type="hidden" id="jot-consensus" name="consensus" value="{{if $consensus}}{{$consensus}}{{else}}0{{/if}}" />
- {{if $showacl}}{{$acl}}{{/if}}
{{if $webpage}}
<div id="jot-pagetitle-wrap" class="jothidden">
@@ -166,11 +165,11 @@
</button>
{{/if}}
{{if $showacl}}
- <button id="dbtn-acl" class="btn btn-default btn-sm" data-toggle="modal" data-target="#aclModal" title="{{$permset}}" onclick="return false;">
+ <button id="dbtn-acl" class="acl-select btn btn-default btn-sm" data-toggle="modal" data-target="#aclModal" title="{{$permset}}" type="button">
<i id="jot-perms-icon" class="fa fa-{{$lockstate}} jot-icons"></i>{{if $bang}}&nbsp;<i class="fa fa-exclamation jot-icons"></i>{{/if}}
</button>
{{/if}}
- <button id="dbtn-submit" class="btn btn-primary btn-sm" type="submit" tabindex=3 name="button-submit" >{{$share}}</button>
+ <button id="dbtn-submit" class="acl-submit btn btn-primary btn-sm" type="submit" tabindex=3 name="button-submit">{{$share}}</button>
</div>
<div id="profile-jot-perms-end"></div>
<div id="profile-jot-plugin-wrapper">
@@ -184,6 +183,8 @@
<div id="jot-preview-content" style="display:none;"></div>
+{{if $showacl}}{{$acl}}{{/if}}
+
{{if $feature_expire}}
<!-- Modal for item expiry-->
<div class="modal" id="expiryModal" tabindex="-1" role="dialog" aria-labelledby="expiryModalLabel" aria-hidden="true">