From: hickert Date: Mon, 12 Apr 2010 09:40:22 +0000 (+0000) Subject: Updated faxaccount to use new style lists X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ba9585d8aecea2b9b7bbada5060d75c98bbc205a;p=gosa.git Updated faxaccount to use new style lists git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17584 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/gofax/gofax/faxaccount/class_gofaxAccount.inc b/gosa-plugins/gofax/gofax/faxaccount/class_gofaxAccount.inc index 59f474343..973935756 100644 --- a/gosa-plugins/gofax/gofax/faxaccount/class_gofaxAccount.inc +++ b/gosa-plugins/gofax/gofax/faxaccount/class_gofaxAccount.inc @@ -7,7 +7,6 @@ class gofaxAccount extends plugin var $plDescription= "This does something"; var $plIcon = "plugins/gofax/images/plugin.png"; - /* Department list shown in the divSelectList*/ var $departments; /* Fax attributes */ @@ -59,7 +58,6 @@ class gofaxAccount extends plugin } /* Hickert : 11.11.05 - * Added to be able to handle department selection in divSelelect */ if(!session::is_set("Fax_Filter")){ $Fax_Filter = array(); @@ -95,15 +93,15 @@ class gofaxAccount extends plugin $this->printerList[$this->goFaxPrinter] = "[".$this->goFaxPrinter."]"; } - /* Get global filter config */ - if (!session::is_set("faxfilter")){ - $ui= get_userinfo(); - $base= get_base_from_people($ui->dn); - $faxfilter= array( "depselect" => $base, - "fuser" => "*", - "regex" => ""); - session::set("faxfilter", $faxfilter); - } + // Prepare lists + $this->predefinedList = new sortableListing(); + $this->predefinedList->setDeleteable(false); + $this->predefinedList->setEditable(false); + $this->predefinedList->setWidth("100%"); + $this->predefinedList->setHeight("300px"); + $this->predefinedList->setColspecs(array('20px','*')); + $this->predefinedList->setHeader(array("~",_("Name"))); + $this->predefinedList->setDefaultSortColumn(1); } function execute() @@ -117,11 +115,9 @@ class gofaxAccount extends plugin new log("view","users/".get_class($this),$this->dn); } - /* Hickert : 11.11.05 - * Added to be able to handle department selection in divSelelect + /* Department selection handling */ if((isset($_GET['act']))&&($_GET['act']=="dep_open")){ - $Fax_Filter = session::get('Fax_Filter'); if(strlen(base64_decode($_GET['dep_id']))>= strlen($this->config->current['BASE'])){ $Fax_Filter['depselect']= base64_decode($_GET['dep_id']); @@ -264,9 +260,6 @@ class gofaxAccount extends plugin } } - /* Hickert : 11.11.05 - * Add selection from divSelelect to our Blocklist - */ /* Add list to blocklist */ if (isset($_POST['add_blocklist'])){ foreach($_POST as $name => $value){ @@ -361,8 +354,6 @@ class gofaxAccount extends plugin /* Manage incoming blocklists */ if ($this->in_blocklist_dialog){ - /* This handles the divSelectBox */ - /* The base specifies the current position in the ldap tree * The current base was specified by $_GET['dep_id'] before. Or contains the default value. */ @@ -384,10 +375,6 @@ class gofaxAccount extends plugin } } - /* Create our divselect box */ - $divSel = new divSelectBox("divSelectPredefined"); - $divSel->setHeight(296); - /* NEW LIST MANAGMENT * We also need to search for the departments * So we are able to navigate like in konquerer @@ -422,27 +409,35 @@ class gofaxAccount extends plugin $linkopen = "%s"; /* Insert departments in divsel */ + $data = $lData = array(); foreach($this->departments as $key=> $val){ if(!isset($this->config->departments[trim($key)])){ $this->config->departments[trim($key)]=""; } - $field1 = array("string" => image("images/lists/folder.png"),"attach"=>"style='width:16px; text-align:center;'"); - $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val),"attach"=>" style='border:none'"); - $divSel->AddEntry(array($field1,$field2)); + $img = image('images/lists/folder.png'); + $val = sprintf( $linkopen, postEncode($key), $val); + $data[] = array('TYPE' => 'DEP', 'ID' => $key); + $lData[] = array('data' => array($img,$val)); } + /* Append predefined Blocklists */ foreach($list as $entry => $value){ - $divSel->AddEntry(array( - array("string"=>""), - array("string"=>$value,"attach"=>"style='border:0px;'") - )); + $chk = ""; + $data[] = array('TYPE' => 'ENTRY', 'ID' => $key); + $lData[] = array('data' => array($chk,$value)); } + $this->predefinedList->setAcl('rwcdm'); + $this->predefinedList->setListData($data,$lData); + $this->predefinedList->update(); + + /* Show dialog */ $smarty->assign("cblocklist", $this->current_blocklist); $smarty->assign("departments", $this->config->idepartments); - $smarty->assign("divSelectPredefined", $divSel->DrawList()); + $smarty->assign("predefinedList", $this->predefinedList->render()); $display.= $smarty->fetch (get_template_path('lists.tpl', TRUE, dirname(__FILE__))); return ($display); } @@ -451,8 +446,6 @@ class gofaxAccount extends plugin if ($this->out_blocklist_dialog){ - /* This handles the divSelectBox */ - /* The base specifies the current position in the ldap tree * The current base was specified by $_GET['dep_id'] before. Or contains the default value. */ @@ -472,10 +465,6 @@ class gofaxAccount extends plugin } } - /*Create DivSel*/ - $divSel = new divSelectBox("divSelectPredefined"); - $divSel->setHeight(296); - /* NEW LIST MANAGMENT * We also need to search for the departments * So we are able to navigate like in konquerer @@ -500,32 +489,36 @@ class gofaxAccount extends plugin /* END NEW LIST MANAGMENT */ - // Defining Links + /* Insert departments in divsel */ $linkopen = "%s"; - - /* Insert departments in divlist*/ + $data = $lData = array(); foreach($this->departments as $key=> $val){ if(!isset($this->config->departments[trim($key)])){ $this->config->departments[trim($key)]=""; } - - $field1 = array("string" => image("images/lists/folder.png"),"attach"=>"style='width:16px; text-align:center;'"); - $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val),"attach"=>" style='border:none'"); - $divSel->AddEntry(array($field1,$field2)); + $img = image('images/lists/folder.png'); + $val = sprintf( $linkopen, postEncode($key), $val); + $data[] = array('TYPE' => 'DEP', 'ID' => $key); + $lData[] = array('data' => array($img,$val)); } - /* Append Blocklits */ + + /* Append predefined Blocklists */ foreach($list as $entry => $value){ - $divSel->AddEntry(array( - array("string"=>""), - array("string"=>$value,"attach"=>"style='border:0px;'") - )); + $chk = ""; + $data[] = array('TYPE' => 'ENTRY', 'ID' => $key); + $lData[] = array('data' => array($chk,$value)); } + $this->predefinedList->setAcl('rwcdm'); + $this->predefinedList->setListData($data,$lData); + $this->predefinedList->update(); + /* Show dialog */ $smarty->assign("cblocklist", $this->current_blocklist); $smarty->assign("departments", $this->config->idepartments); - $smarty->assign("divSelectPredefined", $divSel->DrawList()); + $smarty->assign("predefinedList", $this->predefinedList->render()); $display.= $smarty->fetch (get_template_path('lists.tpl', TRUE, dirname(__FILE__))); return ($display); } diff --git a/gosa-plugins/gofax/gofax/faxaccount/lists.tpl b/gosa-plugins/gofax/gofax/faxaccount/lists.tpl index 6d6a755e5..35d3a350a 100644 --- a/gosa-plugins/gofax/gofax/faxaccount/lists.tpl +++ b/gosa-plugins/gofax/gofax/faxaccount/lists.tpl @@ -22,7 +22,7 @@
- {$divSelectPredefined} + {$predefinedList}