diff --git a/plugins/gofax/faxaccount/class_gofaxAccount.inc b/plugins/gofax/faxaccount/class_gofaxAccount.inc
index 961dc6dcd7beca10406a37d106506e8a631492d6..42ab729cecd4b5f0765cdff8aa5efdd74e300ad2 100644 (file)
var $plHeadline= "FAX";
var $plDescription= "This does something";
- /* CLI vars */
- var $cli_summary= "Manage users fax account";
- var $cli_description= "Some longer text\nfor help";
- var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-
/* Department list shown in the divSelectList*/
var $departments;
/* Fax attributes */
- var $goFaxDeliveryMode= "";
+ var $goFaxDeliveryMode= "0";
var $facsimileTelephoneNumber= "";
var $goFaxIsEnabled= 1;
var $goFaxPrinter= "";
var $out_blocklist_dialog= FALSE;
var $current_blocklist= array();
+ /* Copy & paste variables */
+ var $CopyPasteVars=array("facsimileTelephoneNumber");//,"goFaxRBlocklist","goFaxRBlockgroups","goFaxSBlocklist","goFaxSBlockgroups");
+
/* attribute list for save action */
- var $attributes= array("goFaxDeliveryMode", "goFaxIsEnabled","goFaxRBlockgroups","facsimileAlternateTelephoneNumber",
- "goFaxPrinter", "goFaxDivertNumber", "goFaxLanguage", "goFaxFormat", "mail");
+ var $attributes= array("goFaxDeliveryMode", "goFaxIsEnabled","facsimileAlternateTelephoneNumber","goFaxRBlocklist","goFaxRBlockgroups","goFaxSBlocklist","goFaxSBlockgroups","goFaxPrinter", "goFaxDivertNumber", "goFaxLanguage", "goFaxFormat", "mail","facsimileTelephoneNumber");
var $objectclasses= array("goFaxAccount");
- function gofaxAccount ($config, $dn= NULL)
+ var $uid= "";
+
+ function gofaxAccount ($config, $dn= NULL, $parent)
{
/* General initialization */
- plugin::plugin ($config, $dn);
+ plugin::plugin ($config, $dn, $parent);
+ /* Get user id */
+ if(isset($this->attrs['uid'])){
+ $this->uid = $this->attrs['uid'][0];
+ }
/* Hickert : 11.11.05
* Added to be able to handle department selection in divSelelect
"regex" => "");
register_global("faxfilter", $faxfilter);
}
+ $this->ui = get_userinfo();
}
function execute()
{
/* Call parent execute */
plugin::execute();
+
+
+ $acl= get_permissions ($this->ui->dn, $this->ui->subtreeACL);
+ $editacl= get_module_permission($acl, "gofax", $this->dn);
+ $this->acl = $editacl;
+
/* Hickert : 11.11.05
* Added to be able to handle department selection in divSelelect
*/
/* Do we need to flip is_account state? */
if (isset($_POST['modify_state'])){
- $this->is_account= !$this->is_account;
+
+ /* Onyl change account state if allowed */
+ if($this->is_account && $this->acl == "#all#"){
+ $this->is_account= !$this->is_account;
+ }elseif(!$this->is_account && chkacl($this->acl,"create") == ""){
+ $this->is_account= !$this->is_account;
+ }
}
/* Do we represent a valid account? */
$base= $faxfilter['depselect'];
$acl= array($this->config->current['BASE'] => ":all");
- print "(&(objectClass=goFaxAccount)$filter)";
$res= get_list("(&(objectClass=goFaxAccount)$filter)", $acl, $base,
array("sn", "givenName", "facsimileTelephoneNumber"), GL_SIZELIMIT | GL_SUBSEARCH);
/* Show main page */
- $smarty->assign("languages", $this->config->data['MAIN']['LANGUAGES']);
+ $smarty->assign("languages", get_languages(TRUE));
+
$smarty->assign("formats", $this->config->data['MAIN']['FAXFORMATS']);
$smarty->assign("printers", $this->printerList);
plugin::remove_from_parent();
- /* Zero out arrays */
- foreach (array("goFaxRBlocklist", "goFaxRBlockgroups", "goFaxSBlocklist",
- "goFaxSBlockgroups", "facsimileAlternateTelephoneNumber") as $val){
-
- $this->attrs[$val]= array();
- }
-
/* Adapt mail settings if needed */
if ((isset($this->parent->by_object['mailAccount']->is_account)) && ($this->parent->by_object['mailAccount']->is_account)){
unset($this->attrs['mail']);
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->dn);
$this->cleanup();
-$ldap->modify ($this->attrs);
+ $ldap->modify ($this->attrs);
- show_ldap_error($ldap->get_error());
+ show_ldap_error($ldap->get_error(), _("Removing FAX account failed"));
/* Optionally execute a command after we're done */
- $this->handle_post_events('remove');
+ $this->handle_post_events('remove',array("uid"=> $this->uid));
}
/* IF mail is specified (which is only the case if there's no mail account
present), check if it's valid.. */
if (@isset($this->parent->by_object['mailAccount']) &&
- $this->goFaxDeliveryMode && 32){
+ $this->goFaxDeliveryMode & 32){
if ($this->mail == ""){
$message[]= _("Mail delivery is checked, but no address has been specified.");
} elseif (!is_email($this->mail)){
$this->attrs[$val]= $this->$val;
}
- /* Adapt mail settings if needed */
- unset($this->attrs['mail']);
- if (!$this->has_mailAccount && $this->goFaxDeliveryMode && 32){
- $this->attrs['mail']= $this->mail;
+ /* Do not save mail address ... it was possibly changed by mail plugin*/
+ if ((isset($this->parent->by_object['mailAccount']->is_account)) && ($this->parent->by_object['mailAccount']->is_account)){
+ unset($this->attrs['mail']);
}
/* Write back to ldap */
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->dn);
$this->cleanup();
-$ldap->modify ($this->attrs);
+ $ldap->modify ($this->attrs);
- show_ldap_error($ldap->get_error());
+ show_ldap_error($ldap->get_error(), _("Saving FAX account failed"));
/* Optionally execute a command after we're done */
if ($this->initially_was_account == $this->is_account){
if ($this->is_modified){
- $this->handle_post_events("mofify");
+ $this->handle_post_events("modify",array("uid" => $this->uid));
}
} else {
- $this->handle_post_events("add");
+ $this->handle_post_events("add",array("uid" => $this->uid));
}
}