HOME


Mini Shell 1.0
DIR:/usr/local/cwpsrv/var/services/roundcubemail-1.4.11/public_html/plugins/acl/
Upload File :
Current File : //usr/local/cwpsrv/var/services/roundcubemail-1.4.11/public_html/plugins/acl/acl.min.js
/**
 * ACL plugin script
 *
 * @licstart  The following is the entire license notice for the
 * JavaScript code in this file.
 *
 * Copyright (c) The Roundcube Dev Team
 *
 * The JavaScript code in this page is free software: you can redistribute it
 * and/or modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * @licend  The above is the entire license notice
 * for the JavaScript code in this file.
 */
window.rcmail&&rcmail.addEventListener("init",function(){if(rcmail.gui_objects.acltable&&(rcmail.acl_list_init(),rcmail.env.acl_users_source)){var a=rcmail.is_framed()?parent.rcmail:rcmail;a.init_address_input_events($("#acluser"),{action:"settings/plugin.acl-autocomplete"});a.set_env({autocomplete_max:rcmail.env.autocomplete_max,autocomplete_min_length:rcmail.env.autocomplete_min_length});a.add_label("autocompletechars",rcmail.labels.autocompletechars);a.add_label("autocompletemore",rcmail.labels.autocompletemore);
a.addEventListener("autocomplete_insert",function(b){"acluser"==b.field.id&&(b.field.value=b.insert.replace(/[ ,;]+$/,""))})}rcmail.enable_command("acl-create","acl-save","acl-cancel","acl-mode-switch",!0);rcmail.enable_command("acl-delete","acl-edit",!1);rcmail.env.acl_advanced&&$("#acl-switch").addClass("selected").find("input").prop("checked",!0)});rcube_webmail.prototype.acl_create=function(){this.acl_init_form()};
rcube_webmail.prototype.acl_edit=function(){var a=this.acl_list.get_single_selection();a&&this.acl_init_form(a)};rcube_webmail.prototype.acl_delete=function(){var a=this.acl_get_usernames();a&&a.length&&this.confirm_dialog(this.get_label("acl.deleteconfirm"),"delete",function(b,c){c.http_post("settings/plugin.acl",{_act:"delete",_user:a.join(","),_mbox:rcmail.env.mailbox},c.set_busy(!0,"acl.deleting"))})};
rcube_webmail.prototype.acl_save=function(){var a,b="",c=$("#acluser",this.acl_form).val();$(this.env.acl_advanced?"#advancedrights :checkbox":"#simplerights :checkbox",this.acl_form).map(function(){this.checked&&(b+=this.value)});(a=$("input:checked[name=usertype]",this.acl_form).val())&&"user"!=a&&(c=a);c?b?(a={_act:"save",_user:c,_acl:b,_mbox:this.env.mailbox},this.acl_id&&(a._old=this.acl_id),this.http_post("settings/plugin.acl",a,this.set_busy(!0,"acl.saving"))):this.alert_dialog(this.get_label("acl.norights")):
this.alert_dialog(this.get_label("acl.nouser"))};rcube_webmail.prototype.acl_cancel=function(){this.ksearch_blur();this.acl_popup.dialog("close")};rcube_webmail.prototype.acl_update=function(a){a.old?this.acl_remove_row(a.old):this.env.acl[a.id]&&this.acl_remove_row(a.id);this.acl_add_row(a,!0);this.ksearch_blur();this.acl_popup.dialog("close")};
rcube_webmail.prototype.acl_mode_switch=function(a){this.env.acl_advanced=!this.env.acl_advanced;this.enable_command("acl-delete","acl-edit",!1);this.http_request("settings/plugin.acl","_act=list&_mode="+(this.env.acl_advanced?"advanced":"simple")+"&_mbox="+urlencode(this.env.mailbox),this.set_busy(!0,"loading"))};
rcube_webmail.prototype.acl_list_init=function(){var a=this.env.acl_advanced?"addClass":"removeClass";$("#acl-switch")[a]("selected");$(this.gui_objects.acltable)[a]("advanced");this.acl_list=new rcube_list_widget(this.gui_objects.acltable,{multiselect:!0,draggable:!1,keyboard:!0});this.acl_list.addEventListener("select",function(b){rcmail.acl_list_select(b)}).addEventListener("dblclick",function(b){rcmail.acl_list_dblclick(b)}).addEventListener("keypress",function(b){rcmail.acl_list_keypress(b)}).init()};
rcube_webmail.prototype.acl_list_select=function(a){rcmail.enable_command("acl-delete",0<a.get_selection().length);rcmail.enable_command("acl-edit",1==a.get_selection().length);a.focus()};rcube_webmail.prototype.acl_list_dblclick=function(a){this.acl_edit()};rcube_webmail.prototype.acl_list_keypress=function(a){if(a.key_pressed==a.ENTER_KEY)this.command("acl-edit");else if(a.key_pressed==a.DELETE_KEY||a.key_pressed==a.BACKSPACE_KEY)this.acl_form&&this.acl_form.is(":visible")||this.command("acl-delete")};
rcube_webmail.prototype.acl_list_update=function(a){$(this.gui_objects.acltable).html(a);this.acl_list_init()};rcube_webmail.prototype.acl_get_usernames=function(){var a=[],b,c,d,g=this.acl_list,h=g.get_selection();var e=0;for(b=h.length;e<b;e++)this.env.acl_specials.length&&0<=$.inArray(h[e],this.env.acl_specials)?a.push(h[e]):(d=g.rows[h[e]])&&(c=$(d.obj).data("userid"))&&a.push(c);return a};
rcube_webmail.prototype.acl_remove_row=function(a){var b=this.acl_list;b.remove_row(a);b.clear_selection();$("#rcmrow"+a).remove();this.env.acl[a]=null;this.enable_command("acl-delete",0<b.get_selection().length);this.enable_command("acl-edit",1==b.get_selection().length)};
rcube_webmail.prototype.acl_add_row=function(a,b){var c=[];var d=[];var g=a.id,h=this.acl_list,e=this.env.acl_advanced?[]:this.env.acl_items,l=$("thead > tr",this.gui_objects.acltable).clone();$("th",l).map(function(){var m=$("<td>"),n=$(this).attr("title"),k=this.className.replace(/^acl/,"");n&&m.attr("title",n);e&&e[k]&&(k=e[k]);"user"==k?m.addClass(k).attr("title",a.title).append($("<a>").text(a.display)):m.addClass(this.className+" "+rcmail.acl_class(a.acl,k)).html("<span/>");$(this).replaceWith(m)});
l=l.attr({id:"rcmrow"+g,"data-userid":a.username}).get(0);this.env.acl[g]=a.acl;for(f in this.env.acl)this.env.acl[f]&&(this.env.acl_specials.length&&0<=$.inArray(f,this.env.acl_specials)?d.push(f):c.push(f));c.sort();c=d.concat(c);var f=0;for(d=c.length;f<d&&c[f]!=g;f++);f&&f<d?($("#rcmrow"+c[f-1]).after(l),h.init_row(l),h.rowcount++):h.insert_row(l);b&&h.select_row(a.id)};
rcube_webmail.prototype.acl_init_form=function(a){var b,c,d="",g="user",h=$("body");var e=$("#advancedrights");var l=$("#simplerights"),f=$("#acluser"),m=$("#usertype");if(!this.acl_form){var n=function(){$('input[value="user"]').prop("checked",!0)};f.click(n).keypress(n)}this.acl_form=$("#aclform");this.env.acl_advanced?(e.show(),l.hide()):(l.show(),e.hide(),e=l);e=$(":checkbox",e);e.attr("checked",!1);a&&(b=this.acl_list.rows[a])?(b=b.obj,e.map(function(){c=$("td."+this.id,b);c.length&&c.hasClass("enabled")&&
(this.checked=!0)}),!this.env.acl_specials.length||0>$.inArray(a,this.env.acl_specials)?d=$(b).data("userid"):g=a):e.filter(function(){return this.id.match(/^acl([lrs]|read)$/)}).prop("checked",!0);f.val(d);$("input[value="+g+"]").prop("checked",!0);this.acl_id=a;d={};var k=this;h=document.body;d[this.get_label("save")]=function(p){k.command("acl-save")};d[this.get_label("cancel")]=function(p){k.command("acl-cancel")};this.acl_popup=this.show_popup_dialog(this.acl_form.show(),a?this.get_label("acl.editperms"):
this.get_label("acl.newuser"),d,{button_classes:["mainaction submit","cancel"],modal:!0,closeOnEscape:!0,close:function(p,q){(k.is_framed()?parent.rcmail:k).ksearch_hide();k.acl_form.appendTo(h).hide();$(this).remove();window.focus()}});"user"==g?f.focus():$("input:checked",m).focus()};rcube_webmail.prototype.acl_class=function(a,b){var c,d=0;a=String(a);b=String(b);var g=0;for(c=b.length;g<c;g++)-1<a.indexOf(b[g])&&d++;return d==c?"enabled":d?"partial":"disabled"};