parent = $parent; $this->ui = get_userinfo(); /* Set default base */ if(!isset($_SESSION['CurrentMainBase'])){ $_SESSION['CurrentMainBase'] = $this->config->current['BASE']; } $this->selectedBase = $_SESSION['CurrentMainBase']; /* Set list strings */ $this->SetTitle(_("List of FAI classes")); $this->SetSummary(_("This table displays all FAI classes in the selected tree.")); /* Result page will look like a headpage */ $this->SetHeadpageMode(); $this->SetInformation(_("This menu allows you to create, delete and edit FAI classes.")); $this->EnableAplhabet (true); /* Disable buttonsm */ $this->EnableCloseButton(false); $this->EnableSaveButton (false); /* set Page header */ $this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'")); $this->AddHeader(array("string" => _("Name of FAI class"), "attach" => "style=''")); $this->AddHeader(array("string" => _("Class type"), "attach" => "style='width:200px;'")); $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:80px;border-right:0px;text-align:right;'")); $this->AddCheckBox("ShowProfiles" , _("Display FAI profile objects") ,_("Show profiles") ,true); $this->AddCheckBox("ShowTemplates" , _("Display FAI template objects") ,_("Show templates") ,true); $this->AddCheckBox("ShowScripts" , _("Display FAI scripts") ,_("Show scripts") ,true); $this->AddCheckBox("ShowHooks" , _("Display FAI hooks") ,_("Show hooks") ,true); $this->AddCheckBox("ShowVariables" , _("Display FAI variables") ,_("Show variables") ,true); $this->AddCheckBox("ShowPackages" , _("Display FAI packages") ,_("Show packages") ,true); $this->AddCheckBox("ShowPartitions" , _("Display FAI partitions") ,_("Show partitions") ,true); /* Add SubSearch checkbox */ //$this->AddCheckBox(SEPERATOR); //$this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), false); /* Name ,Text ,Default , Connect with alphabet */ $this->AddRegex ("Regex", _("Display users matching"),"*" , true); } function AddUserBoxToFilter($position){ $str = ""; if($position == 2){ $smarty = get_smarty(); $smarty->assign("selectedBranch",$this->selectedBranch); $smarty->assign("branchimage","images/branch.png"); $smarty->assign("branches",$this->AvailableBranches); $str = $smarty->fetch(get_template_path('branch_selector.tpl', TRUE)); } return($str); } function GenHeader() { /* Prepare departments, which are shown in the listbox on top of the listbox */ $options= ""; foreach ($this->config->idepartments as $key => $value){ if ($this->selectedBase == $key){ $options.= ""; } else { $options.= ""; } } /* Get copy & paste icon */ if($this->parent->CopyPasteHandler){ $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon(); }else{ $Copy_Paste =""; } /* Add default header */ $listhead = MultiSelectWindow::get_default_header(); $listhead.= "  ". "\"\" ". "  ". "  ". "  ". "  ". "  ". "  ". $Copy_Paste. "  ". _("Base")." ". "  ". ""; $this->SetListHeader($listhead); } /* so some basic settings */ function execute() { $this->ClearElementsList(); $this->GenHeader(); } function setEntries($list) { /******************** Variable init ********************/ $objects = array( "FAIpartitionTable" => array("IMG"=> "images/fai_partitionTable.png", "NAME"=>"Partition table","KZL"=> "PT", "VAR"=>"ShowPartitions"), "FAIpackageList" => array("IMG"=> "images/fai_packages.png", "NAME"=>"Package list" , "KZL"=> "PL", "VAR"=>"ShowPackages"), "FAIscript" => array("IMG"=> "images/fai_script.png", "NAME"=>"Scripts" , "KZL"=> "S", "VAR"=>"ShowScripts"), "FAIvariable" => array("IMG"=> "images/fai_variable.png", "NAME"=>"Variables" , "KZL"=> "V", "VAR"=>"ShowVariables"), "FAIhook" => array("IMG"=> "images/fai_hook.png", "NAME"=>"Hooks", "KZL"=> "H", "VAR"=>"ShowHooks"), "FAIprofile" => array("IMG"=> "images/fai_profile.png", "NAME"=>"Profile" , "KZL"=> "P", "VAR"=>"ShowProfiles"), "FAItemplate" => array("IMG"=> "images/fai_template.png", "NAME"=>"Templates" , "KZL"=> "T", "VAR"=>"ShowTemplates")); $editlink ="%NAME%"; /******************** Attach objects ********************/ foreach($list as $key => $value){ $info = ""; $img = ""; $type = $value['type']; $abort =false; if(isset($objects[$type])){ $img = "".$objects[$type]["; $info = $objects[$type]['NAME']; $var = $objects[$type]['VAR']; }else{ $img = ""; $info = ""; $var = ""; } if((isset($value['description']))&&(!empty($value['description']))){ $desc= " [".$value['description']."]"; }else{ $desc= ""; } /* Create action icons */ $action =""; if($this->parent->CopyPasteHandler){ if($value['FAIstate'] != "freeze"){ $action .= " "; } $action.= " "; } if($value['FAIstate'] == "freeze"){ $action .= ""; $edi = $editlink; $acti = $action; }else{ $action .= ""; $action .= ""; $acti = $action; $edi = $editlink; } $field1 = array("string" => $img , "attach" => "style='text-align:center;width:20px;'"); $field2 = array("string" => preg_replace(array("/%KEY%/","/%NAME%/","/%TITLE%/"),array($key,$value['cn'].$desc,preg_replace('/ /', ' ', @LDAP::fix($value['dn']))),$edi) , "attach" => "style=''"); $field3 = array("string" => $info, "attach" => "style='width:200px;'"); $field4 = array("string" => preg_replace("/%KEY%/",$key,$acti) , "attach" => "style='width:80px;border-right:0px;text-align:right;'"); $this->AddElement(array($field1,$field2,$field3,$field4)); } } function Save() { MultiSelectWindow::Save(); } function save_object() { /* Save automatic created POSTs like regex, checkboxes */ MultiSelectWindow::save_object(); $_SESSION['faifilter']['branch'] = $this->selectedBranch; } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>