Make delete buttons readonly for account owner and entry field. Additionally, clean up some warnings in the code

This commit is contained in:
Hadi Nategh 2014-04-15 16:09:19 +00:00
parent 621d6d46f4
commit d1e3d3b0c0

View File

@ -80,7 +80,7 @@ class mail_acl
$content['mailbox'] = $mailbox; $content['mailbox'] = $mailbox;
$acl = (array)$this->retrive_acl($mailbox, $msg); $acl = (array)$this->retrive_acl($mailbox, $msg);
$n = 1; $n = 1;
foreach ($acl as $keys => $value) foreach ($acl as $key => $value)
{ {
$virtuals = array_pop(array_values((array)$value)); $virtuals = array_pop(array_values((array)$value));
$rights = array_shift(array_values((array)$value)); $rights = array_shift(array_values((array)$value));
@ -104,13 +104,13 @@ class mail_acl
{ {
$content['grid'][$n]['acl'] = 'custom'; $content['grid'][$n]['acl'] = 'custom';
} }
if (($account_id = $this->mail_bo->icServer->getMailBoxAccountId($keys))) if (($account_id = $this->mail_bo->icServer->getMailBoxAccountId($key)))
{ {
$content['grid'][$n++]['acc_id'] = $account_id; $content['grid'][$n++]['acc_id'] = $account_id;
} }
else else
{ {
$content['grid'][$n++]['acc_id'] = $keys; $content['grid'][$n++]['acc_id'] = $key;
} }
} }
//error_log(__METHOD__."() acl=".array2string($acl).' --> grid='.array2string($content['grid'])); //error_log(__METHOD__."() acl=".array2string($acl).' --> grid='.array2string($content['grid']));
@ -180,7 +180,18 @@ class mail_acl
} }
$readonlys = $sel_options = array(); $readonlys = $sel_options = array();
$sel_options['acl'] = $this->aclRightsAbbrvs; $sel_options['acl'] = $this->aclRightsAbbrvs;
$readonlys['grid']['delete[1]'] = true;
//Make the delete buttons readonly for entry filed and account owner
foreach($content['grid'] as $key => $field)
{
if ($field['acc_id'] == $this->mail_bo->icServer->acc_name ||
$field['acc_id'][0] == $this->mail_bo->icServer->acc_name)
{
$readonlys['grid']['delete['.$key.']'] = true;
}
}
$readonlys['grid']['delete['.count($content['grid']).']'] = true;
$preserv ['mailbox'] = $content['mailbox']; $preserv ['mailbox'] = $content['mailbox'];
$content['msg'] = $msg; $content['msg'] = $msg;
$content['grid']['account_type'] = $this->mail_bo->icServer->supportsGroupAcl() ? 'both' : 'accounts'; $content['grid']['account_type'] = $this->mail_bo->icServer->supportsGroupAcl() ? 'both' : 'accounts';
@ -237,7 +248,10 @@ class mail_acl
} }
} }
} }
if (is_array($validator)) return $validator; if (is_array($validator))
{
return $validator;
}
} }
/** /**