diff --git a/plugins/gofax/faxaccount/class_gofaxAccount.inc b/plugins/gofax/faxaccount/class_gofaxAccount.inc
index 790525849ac010fbb32b9d1cb323d9ea7977b7c0..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",
- "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
/* Get arrays */
foreach (array("goFaxRBlocklist", "goFaxRBlockgroups", "goFaxSBlocklist",
"goFaxSBlockgroups", "facsimileAlternateTelephoneNumber") as $val){
-
+ $this->$val =array();
if (isset($this->attrs["$val"]["count"])){
for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
array_push($this->$val, $this->attrs["$val"][$i]);
"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($acl, "(&(objectClass=goFaxAccount)$filter)", TRUE, $base, array("sn", "givenName", "facsimileTelephoneNumber"), TRUE);
+ $res= get_list("(&(objectClass=goFaxAccount)$filter)", $acl, $base,
+ array("sn", "givenName", "facsimileTelephoneNumber"), GL_SIZELIMIT | GL_SUBSEARCH);
foreach ($res as $attrs){
$list[$attrs['facsimileTelephoneNumber'][0]]=
/* Create our divselect box */
$divSel = new divSelectBox("divSelectPredefined");
- $divSel->setHeight(300);
- $divSel->setWidth(350);
+ $divSel->setHeight(296);
/* NEW LIST MANAGMENT
* We also need to search for the departments
/*Create DivSel*/
$divSel = new divSelectBox("divSelectPredefined");
- $divSel->setHeight(300);
- $divSel->setWidth(350);
+ $divSel->setHeight(296);
/* NEW LIST MANAGMENT
* We also need to search for the departments
/* 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 ($this->parent->by_object['mailAccount']->is_account){
+ 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);
- $ldap->modify($this->attrs);
- show_ldap_error($ldap->get_error());
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
+
+ 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));
}
/* Check formular input */
function check()
{
- /* Reset message array */
- $message= array();
+ /* Call common method to give check the hook */
+ $message= plugin::check();
/* must: facsimileTelephoneNumber */
if ($this->facsimileTelephoneNumber == ""){
/* 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)){
/* Check if mail account is active and correct the internal
reference to represent the current status. */
- if ($this->parent->by_object['mailAccount']->is_account){
+ if (isset($this->parent->by_object['mailAccount']->is_account)&&($this->parent->by_object['mailAccount']->is_account)){
$this->has_mailAccount= TRUE;
}
}
$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);
- $ldap->modify($this->attrs);
- show_ldap_error($ldap->get_error());
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
+
+ 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));
}
}
$this->facsimileAlternateTelephoneNumber);
}
+ function getCopyDialog()
+ {
+ $str = "";
+ $smarty = get_smarty();
+ $smarty->assign("facsimileTelephoneNumber", $this->facsimileTelephoneNumber);
+ $str['string'] = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
+ $str['status'] ="";
+ return($str);
+ }
+
+ function SaveCopyDialog()
+ {
+ if(isset($_POST['facsimileTelephoneNumber'])){
+ $this->facsimileTelephoneNumber = $_POST['facsimileTelephoneNumber'];
+ }
+ }
}