X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_printerPPDSelectionDialog.inc;h=335c947b56f4d31e81322bb4f79b9b10e6cb28fe;hb=e646d1b091e3d40c67039125dae867faa6fdd402;hp=b23a77323bc6953be117ef7c64ae8699468d1b9d;hpb=84d2c065af9ce3f287fef380606a593a0cda5a81;p=gosa.git diff --git a/plugins/admin/systems/class_printerPPDSelectionDialog.inc b/plugins/admin/systems/class_printerPPDSelectionDialog.inc index b23a77323..335c947b5 100644 --- a/plugins/admin/systems/class_printerPPDSelectionDialog.inc +++ b/plugins/admin/systems/class_printerPPDSelectionDialog.inc @@ -9,15 +9,13 @@ class printerPPDSelectionDialog extends plugin /* attribute list for save action */ var $ignore_account = FALSE; - var $attributes = array("currentPos","currentSel"); + var $attributes = array(); var $objectclasses = array("whatever"); var $list =array(); var $header =array(); - var $currentPos = ""; - var $currentSel = -1; - var $selectedPPD = ""; + var $Vendor = ""; function printerPPDSelectionDialog ($config, $dn= NULL,$list=false,$headers=false,$ppd=false) { @@ -26,16 +24,6 @@ class printerPPDSelectionDialog extends plugin $this->header = $headers; $this->depselect = $this->config->current['BASE']; - /* If there is already a ppd file selected, use this as preselected object in our ppds list - */ - if(isset($ppd)){ - $tmp2 = split("\n",$ppd['ppd']); - if(count($tmp2)==2){ - $this->currentPos = $tmp2[0]; - $this->currentSel = preg_replace("/^ -/","",$tmp2[1]); - } - } - if(!isset($_SESSION['printerPPDSelectionDialog'])){ $_SESSION['printerPPDSelectionDialog']['regex'] = "*"; } @@ -67,26 +55,54 @@ class printerPPDSelectionDialog extends plugin $regex = str_replace("**","*",$regex); $_SESSION['printerPPDSelectionDialog']['regex'] = $regex; - - /* if manufacturer is selected and a ppd file - * Set this selected file to our return value. - */ - if(isset($this->list[$this->currentPos][$this->currentSel])){ - $this->selectedPPD = $this->list[$this->currentPos][$this->currentSel]; - } - /** Added **/ $list = array(); foreach($this->list as $cat => $ppds){ foreach($ppds as $ppd){ if(preg_match("/^".str_replace("*",".*",$regex)."/i",$ppd['ppd'])){ - $list[$ppd['link']] = $ppd['ppd']; + $list[$ppd['link']] = $ppd; + } + } + } + + if((isset($_GET['act']))&&($_GET['act']=="open")) { + + if((!empty($_GET['id'])) && (!isset( $this->header[base64_decode($_GET['id'])]))){ + print_red(sprintf(_("Selected vendor '%s' does not exists in our list of ppds."),base64_decode($_GET['id']))); + $this->Vendor = ""; + }else{ + $this->Vendor = base64_decode($_GET['id']); + } + } + + $div = new divSelectBox("printerPPDSelectionDialog"); + $div ->SetHeight(450); + $div ->SetSummary(_("Printer ppd selection.")); + + $linkopen = "%s"; + $uselink = "%s"; + + + if(empty($this->Vendor)){ + foreach($this-> header as $key => $entry){ + $div ->AddEntry (array( + array("string"=>sprintf($linkopen,base64_encode($key),$key),"attach"=>"style='border-right:0px;'") + )); + } + }else{ + $div ->AddEntry (array( + array("string"=>sprintf($linkopen,"",".. ["._("back")."]"),"attach"=>"style='border-right:0px;'") + )); + foreach($list as $key => $ppd){ + if(preg_match("/^".$this->Vendor."/",$ppd['ppd'])){ + $div ->AddEntry (array( + array("string"=>sprintf($uselink,base64_encode($key),$ppd['ppd']),"attach"=>"style='border-right:0px;'") + )); } } } - $smarty->assign("objects", $list); - $smarty->assign("objectKeys", array_flip($list)); + $smarty->assign("List", $div -> DrawList()); $smarty->assign("search_image", get_template_path('images/search.png')); $smarty->assign("launchimage", get_template_path('images/small_filter.png')); $smarty->assign("tree_image", get_template_path('images/tree.png'));