選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

acl.min.js 6.3KB

123456789101112131415
  1. 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);
  2. a.addEventListener("autocomplete_insert",function(a){"acluser"==a.field.id&&(a.field.value=a.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")});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)};
  3. rcube_webmail.prototype.acl_delete=function(){var a=this.acl_get_usernames();a&&a.length&&confirm(this.get_label("acl.deleteconfirm"))&&this.http_post("settings/plugin.acl",{_act:"delete",_user:a.join(","),_mbox:this.env.mailbox},this.set_busy(!0,"acl.deleting"))};
  4. 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"))):alert(this.get_label("acl.norights")):
  5. alert(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")};
  6. 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"))};
  7. 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(a){rcmail.acl_list_select(a)}).addEventListener("dblclick",function(a){rcmail.acl_list_dblclick(a)}).addEventListener("keypress",function(a){rcmail.acl_list_keypress(a)}).init()};
  8. rcube_webmail.prototype.acl_list_select=function(a){rcmail.enable_command("acl-delete",0<a.selection.length);rcmail.enable_command("acl-edit",1==a.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")};
  9. 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,e,d=this.acl_list,f=d.get_selection();b=0;for(c=f.length;b<c;b++)if(this.env.acl_specials.length&&0<=$.inArray(f[b],this.env.acl_specials))a.push(f[b]);else if(e=d.rows[f[b]])e=$("td.user",e.obj),1==e.length&&a.push(e.text());return a};
  10. 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.selection.length);this.enable_command("acl-edit",1==b.selection.length)};
  11. rcube_webmail.prototype.acl_add_row=function(a,b){var c,e,d=[];e=[];var f=a.id,h=this.acl_list,k=this.env.acl_advanced?[]:this.env.acl_items,g=$("thead > tr",this.gui_objects.acltable).clone();$("th",g).map(function(){var b=$("<td>"),c=$(this).attr("title"),d=this.className.replace(/^acl/,"");c&&b.attr("title",c);k&&k[d]&&(d=k[d]);"user"==d?b.addClass(d).append($("<a>").text(a.username)):b.addClass(this.className+" "+rcmail.acl_class(a.acl,d)).text("");$(this).replaceWith(b)});g.attr("id","rcmrow"+
  12. f);g=g.get(0);this.env.acl[f]=a.acl;for(c in this.env.acl)this.env.acl[c]&&(this.env.acl_specials.length&&0<=$.inArray(c,this.env.acl_specials)?e.push(c):d.push(c));d.sort();d=e.concat(d);c=0;for(e=d.length;c<e&&d[c]!=f;c++);c&&c<e?($("#rcmrow"+d[c-1]).after(g),h.init_row(g),h.rowcount++):h.insert_row(g);b&&h.select_row(a.id)};
  13. rcube_webmail.prototype.acl_init_form=function(a){var b,c,e,d="",f="user",h=$("body");b=$("#advancedrights");var k=$("#simplerights"),g=$("#acluser"),n=$("#usertype");if(!this.acl_form){var m=function(){$('input[value="user"]').prop("checked",!0)};g.click(m).keypress(m)}this.acl_form=$("#aclform");this.env.acl_advanced?(b.show(),k.hide()):(k.show(),b.hide(),b=k);b=$(":checkbox",b);b.attr("checked",!1);a&&(c=this.acl_list.rows[a])?(c=c.obj,b.map(function(){e=$("td."+this.id,c);e.length&&e.hasClass("enabled")&&
  14. (this.checked=!0)}),!this.env.acl_specials.length||0>$.inArray(a,this.env.acl_specials)?d=$("td.user",c).text():f=a):b.filter(function(){return this.id.match(/^acl([lrs]|read)$/)}).prop("checked",!0);g.val(d);$("input[value="+f+"]").prop("checked",!0);this.acl_id=a;var d={},l=this,h=document.body;d[this.get_label("save")]=function(a){l.command("acl-save")};d[this.get_label("cancel")]=function(a){l.command("acl-cancel")};this.acl_popup=this.show_popup_dialog(this.acl_form.show(),a?this.get_label("acl.editperms"):
  15. this.get_label("acl.newuser"),d,{button_classes:["mainaction"],modal:!0,closeOnEscape:!0,close:function(a,b){(l.is_framed()?parent.rcmail:l).ksearch_hide();l.acl_form.appendTo(h).hide();$(this).remove();window.focus()}});"user"==f?g.focus():$("input:checked",n).focus()};rcube_webmail.prototype.acl_class=function(a,b){var c,e,d=0;a=String(a);b=String(b);c=0;for(e=b.length;c<e;c++)-1<a.indexOf(b[c])&&d++;return d==e?"enabled":d?"partial":"disabled"};