Fix combination common rights selector in ACL popup window

This commit is contained in:
Hadi Nategh 2013-12-09 11:17:32 +00:00
parent b06b18e006
commit 95b704bd7d
2 changed files with 68 additions and 19 deletions

View File

@ -37,6 +37,19 @@ app.classes.mail = AppJS.extend(
mail_fileSelectorWindow: null,
mail_isMainWindow: true,
/**
* abbrevations for common access rights
* @array
*
*/
aclCommonRights:['lrs','lprs','ilprs', 'ilprws', 'akxeilprwts', 'custom'],
/**
* Demonstrates ACL rights
* @array
*
*/
aclRights:['l','r','s','w','i','p','c','d','a'],
/**
* Initialize javascript for this application
*
@ -2086,23 +2099,59 @@ app.classes.mail = AppJS.extend(
},
/**
* Select the right combination of the rights for radio buttons from the selected common right
*
* @param {widget} widget common right selectBox
*
*/
acl_delete_btn: function(_egw,_widget)
acl_common_rights_selector: function(widget)
{
var that = this;
var buttonId = _widget.id;
var callbackAclDeleteDialog = function (button_id)
var rowId = widget.id.replace(/[^0-9.]+/g, '');
var rights = (widget.value == "custom")?[]:(widget.value == "akxeilprwts")? widget.value.replace(/[k,x,t,e]/g,"cd").split(""):widget.value.split("");
for (var i=0;i<this.aclRights.length;i++)
{
if (button_id == et2_dialog.YES_BUTTON )
{
that.et2._inst.submit(buttonId);
}
rightsWidget = this.et2.getWidgetById(rowId+'[acl_' + this.aclRights[i]+ ']');
rightsWidget.set_value((jQuery.inArray(this.aclRights[i],rights) != -1 )?true:false);
}
di =et2_dialog.show_dialog(callbackAclDeleteDialog, this.egw.lang("Do you really want to remove all rights from this account"),this.egw.lang("Delete"), {},et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.WARNING_MESSAGE);
},
/**
*
* Choose the right common right option for common ACL selecBox
*
* @param {widget} widget radioButton rights
*
*/
acl_common_rights: function(widget)
{
var rowId = widget.id.replace(/[^0-9.]+/g, '');
var aclCommonWidget = this.et2.getWidgetById(rowId + '[acl]');
var rights = '';
for (var i=0;i<this.aclRights.length;i++)
{
rightsWidget = this.et2.getWidgetById(rowId+'[acl_' + this.aclRights[i]+ ']');
if (rightsWidget.get_value() == "true")
rights += this.aclRights[i];
}
for (var i=0;i<this.aclCommonRights.length;i++)
{
if (rights.split("").sort().toString() == this.aclCommonRights[i].split("").sort().toString())
rights = this.aclCommonRights[i];
}
if (jQuery.inArray(rights,this.aclCommonRights ) == -1)
{
aclCommonWidget.set_value('custom');
}
else
{
aclCommonWidget.set_value(rights);
}
},
/**
* Edit a folder acl for account(s)
*

View File

@ -44,17 +44,17 @@
<row class="row">
<taglist-email id="${row}[acc_id]" allowFreeEntries="true" maxSelection="1" />
<menulist>
<menupopup id="${row}[acl]" onchange="1"/>
<menupopup id="${row}[acl]" onchange="app.mail.acl_common_rights_selector"/>
</menulist>
<checkbox align="center" id="${row}[acl_l]" />
<checkbox align="center" id="${row}[acl_r]" />
<checkbox align="center" id="${row}[acl_s]" />
<checkbox align="center" id="${row}[acl_w]" />
<checkbox align="center" id="${row}[acl_i]" />
<checkbox align="center" id="${row}[acl_p]" />
<checkbox align="center" id="${row}[acl_c]" />
<checkbox align="center" id="${row}[acl_d]" />
<checkbox align="center" id="${row}[acl_a]" />
<checkbox align="center" id="${row}[acl_l]" onchange="app.mail.acl_common_rights"/>
<checkbox align="center" id="${row}[acl_r]" onchange="app.mail.acl_common_rights"/>
<checkbox align="center" id="${row}[acl_s]" onchange="app.mail.acl_common_rights"/>
<checkbox align="center" id="${row}[acl_w]" onchange="app.mail.acl_common_rights"/>
<checkbox align="center" id="${row}[acl_i]" onchange="app.mail.acl_common_rights"/>
<checkbox align="center" id="${row}[acl_p]" onchange="app.mail.acl_common_rights"/>
<checkbox align="center" id="${row}[acl_c]" onchange="app.mail.acl_common_rights"/>
<checkbox align="center" id="${row}[acl_d]" onchange="app.mail.acl_common_rights"/>
<checkbox align="center" id="${row}[acl_a]" onchange="app.mail.acl_common_rights"/>
<checkbox align="center" id="${row}[acl_recursive]"/>
<hbox orient=",0,0">
<button align="right" statustext="Delete this ACL" label="Delete" id="delete[${row}]" value="${row}" image="delete" onclick="et2_dialog.confirm(widget,'Do you really want to remove all rights from this account','Remove')"/>