From f8cc54b3eb72dabb958669408eadb51756d3f8d0 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 20 Dec 2007 09:17:16 +0000 Subject: [PATCH] Multi edit -Aded fax account settings git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8154 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gofax/faxaccount/class_gofaxAccount.inc | 161 +++++++++++++++--- .../plugins/gofax/faxaccount/generic.tpl | 39 +++-- 2 files changed, 159 insertions(+), 41 deletions(-) diff --git a/gosa-core/plugins/gofax/faxaccount/class_gofaxAccount.inc b/gosa-core/plugins/gofax/faxaccount/class_gofaxAccount.inc index eca222857..8ec7e1979 100644 --- a/gosa-core/plugins/gofax/faxaccount/class_gofaxAccount.inc +++ b/gosa-core/plugins/gofax/faxaccount/class_gofaxAccount.inc @@ -50,6 +50,9 @@ class gofaxAccount extends plugin var $objectclasses= array("goFaxAccount"); + /* Enable multiple edit support */ + var $multiple_support = TRUE; + function gofaxAccount (&$config, $dn= NULL) { /* General initialization */ @@ -86,10 +89,7 @@ class gofaxAccount extends plugin } /* Load printer list */ - if (isset($this->config->data['SERVERS']['CUPS'])){ - $this->printerList= get_printer_list ($this->config->data['SERVERS']['CUPS']); - asort ($this->printerList); - } + $this->printerList=get_printer_list(); /* Check if the currently selected printer is still available. If not, append current printer to list of available. @@ -151,30 +151,35 @@ class gofaxAccount extends plugin $smarty->assign("has_mailaccount", "true"); } - /* Do we need to flip is_account state? */ - if (isset($_POST['modify_state'])){ - $this->is_account= !$this->is_account; - } - /* Do we represent a valid account? */ - if (!$this->is_account && $this->parent === NULL){ - $display= "\"\" ". - _("This account has no fax extensions.").""; - $display.= back_to_main(); - return ($display); - } + $display = ""; + if(!$this->multiple_support_active){ - /* Show tab dialog headers */ - $display= ""; - if ($this->parent !== NULL){ - if ($this->is_account){ - $display= $this->show_disable_header(_("Remove fax account"), - _("This account has fax features enabled. You can disable them by clicking below.")); - } else { - $display= $this->show_enable_header(_("Create fax account"), - _("This account has fax features disabled. You can enable them by clicking below.")); + /* Do we need to flip is_account state? */ + if (isset($_POST['modify_state'])){ + $this->is_account= !$this->is_account; + } + + /* Do we represent a valid account? */ + if (!$this->is_account && $this->parent === NULL){ + $display= "\"\" ". + _("This account has no fax extensions.").""; + $display.= back_to_main(); return ($display); } + + /* Show tab dialog headers */ + $display= ""; + if ($this->parent !== NULL){ + if ($this->is_account){ + $display= $this->show_disable_header(_("Remove fax account"), + _("This account has fax features enabled. You can disable them by clicking below.")); + } else { + $display= $this->show_enable_header(_("Create fax account"), + _("This account has fax features disabled. You can enable them by clicking below.")); + return ($display); + } + } } /* Trigger Add local fax alternatives dialog */ @@ -607,7 +612,22 @@ class gofaxAccount extends plugin $smarty->assign("faxtoprinter", ""); } - + foreach($this->attributes as $attr){ + if(in_array($attr,$this->multi_boxes)) { + $smarty->assign("use_".$attr,TRUE); + }else{ + $smarty->assign("use_".$attr,FALSE); + } + } + foreach(array("goFaxIsEnabled","edit_outgoing","edit_incoming","faxtomail","faxtoprinter") as $attr){ + if(in_array($attr,$this->multi_boxes)) { + $smarty->assign("use_".$attr,TRUE); + }else{ + $smarty->assign("use_".$attr,FALSE); + } + } + + $smarty->assign("multiple_support",$this->multiple_support_active); $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__))); return ($display); } @@ -851,6 +871,97 @@ class gofaxAccount extends plugin "goFaxLanguage" => _("Language")) )); } + + /* Multiple edit support + */ + + /* Execute */ + function multiple_execute() + { + return($this->execute()); + } + + function multiple_save_object() + { + if (isset($_POST['faxTab'])){ + plugin::multiple_save_object(); + foreach(array("goFaxIsEnabled","edit_outgoing","edit_incoming","faxtomail","faxtoprinter") as $attr){ + if(isset($_POST["use_".$attr])){ + $this->multi_boxes[] = $attr; + } + } + + $tmp = 0+$this->goFaxDeliveryMode; + if(in_array("faxtomail",$this->multi_boxes)){ + if (isset($_POST["faxtomail"]) && $_POST["faxtomail"] == 1){ + $tmp |= 32; + }elseif($tmp & 32){ + $tmp &= (!32); + } + } + if(in_array("faxtoprinter",$this->multi_boxes)){ + if (isset($_POST["faxtoprinter"]) && $_POST["faxtoprinter"] == 1){ + $tmp |= 64; + }elseif($tmp & 64){ + $tmp &= !64; + } + } + $this->goFaxDeliveryMode = $tmp; + + if (isset($_POST["goFaxIsEnabled"]) && $_POST["goFaxIsEnabled"] == "1"){ + $this->goFaxIsEnabled= "0"; + } else { + $this->goFaxIsEnabled= "1"; + } + if (isset($_POST['mail']) && in_array("mail",$this->multi_boxes)){ + $this->mail= $_POST['mail']; + } + } + } + + function get_multi_edit_values() + { + $ret = plugin::get_multi_edit_values(); + if(in_array("goFaxIsEnabled",$this->multi_boxes)){ + $ret['goFaxIsEnabled'] = $this->goFaxIsEnabled; + } + if(in_array("faxtoprinter",$this->multi_boxes)){ + $ret['faxtoprinter'] = $this->goFaxDeliveryMode & 64; + } + if(in_array("faxtomail",$this->multi_boxes)){ + $ret['faxtomail'] = $this->goFaxDeliveryMode & 32; + } + + if(in_array("edit_incoming",$this->multi_boxes)){ + $ret['goFaxRBlocklist'] = $this->goFaxRBlocklist; + $ret['goFaxRBlockgroups'] = $this->goFaxRBlockgroups; + } + if(in_array("edit_outgoing",$this->multi_boxes)){ + $ret['goFaxSBlocklist'] = $this->goFaxSBlocklist; + $ret['goFaxSBlockgroups'] = $this->goFaxSBlockgroups; + } + return($ret); + } + + function set_multi_edit_values($values) + { + plugin::set_multi_edit_values($values); + + if(isset($values['faxtoprinter'])){ + if($values['faxtoprinter']){ + $this->goFaxDeliveryMode |= 64; + }else{ + $this->goFaxDeliveryMode &= !64; + } + } + if(isset($values['faxtomail'])){ + if($values['faxtomail']){ + $this->goFaxDeliveryMode |= 32; + }else{ + $this->goFaxDeliveryMode &= !32; + } + } + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/gosa-core/plugins/gofax/faxaccount/generic.tpl b/gosa-core/plugins/gofax/faxaccount/generic.tpl index cb56a6c11..eb98dbbee 100644 --- a/gosa-core/plugins/gofax/faxaccount/generic.tpl +++ b/gosa-core/plugins/gofax/faxaccount/generic.tpl @@ -9,11 +9,14 @@ {$must} - +{if $multiple_support} + +{else} {render acl=$facsimileTelephoneNumberACL} {/render} +{/if} @@ -21,7 +24,7 @@ -{render acl=$goFaxLanguageACL} +{render acl=$goFaxLanguageACL checkbox=$multiple_support checked=$use_goFaxLanguage} {html_options values=$formats output=$formats selected=$goFaxFormat} @@ -50,32 +53,32 @@

 {t}Delivery methods{/t}

-{render acl=$goFaxIsEnabledACL} - +{render acl=$goFaxIsEnabledACL checkbox=$multiple_support checked=$use_goFaxIsEnabled} + {/render} {t}Temporary disable fax usage{/t}
{if $has_mailaccount eq "false"} -{render acl=$faxtomailACL} - +{render acl=$faxtomailACL checkbox=$multiple_support checked=$use_faxtomail} + {/render}   -{render acl=$faxtomailACL} - +{render acl=$faxtomailACL checkbox=$multiple_support checked=$use_mail} + {/render} {else} -{render acl=$faxtomailACL} - +{render acl=$faxtomailACL checkbox=$multiple_support checked=$use_faxtomail} + {/render} {t}Deliver fax as mail{/t} {/if}
-{render acl=$faxtoprinterACL} - +{render acl=$faxtoprinterACL checkbox=$multiple_support checked=$use_faxtoprinter} + {/render} {t}Deliver fax to printer{/t}  -{render acl=$faxtoprinterACL} +{render acl=$faxtoprinterACL checkbox=$multiple_support checked=$use_goFaxPrinter} @@ -110,6 +116,7 @@ {render acl=$facsimileAlternateTelephoneNumberACL} {/render} + {/if}

 {t}Blocklists{/t}

@@ -117,7 +124,7 @@ {t}Blocklists for incoming fax{/t} -{render acl=$goFaxRBlocklistACL} +{render acl=$goFaxRBlocklistACL checkbox=$multiple_support checked=$use_edit_incoming} {/render} @@ -125,7 +132,7 @@ {t}Blocklists for outgoing fax{/t} -{render acl=$goFaxSBlocklistACL} +{render acl=$goFaxSBlocklistACL checkbox=$multiple_support checked=$use_edit_outgoing} {/render} -- 2.30.2