parent = $parent; $this->ui = get_userinfo(); // Dynamic action col, depending on snapshot icons $action_col_size = 90; if($this->parent->snapshotEnabled()){ $action_col_size += 38; } // Set list strings $this->SetTitle(_("List of license pools")); $this->SetSummary(_("List of license pools")); $this->EnableAplhabet(true); // Result page will look like a headpage $this->SetHeadpageMode(); // Disable buttonsm $this->EnableCloseButton(false); $this->EnableSaveButton (false); // Add checkbox: Toggle all selected / deselected $chk = ""; // Set Page col headers $this->AddHeader(array("string" => $chk,"attach"=>"style='width:20px;'")); $this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'")); $this->AddHeader(array("string" => _("License pools"), "attach" => "style=''")); $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'")); // Add regex user input field $this->AddRegex ("Regex", _("Regular expression for matching license pools"), "*" , true); } function GenHeader() { /* Get all departments within this subtree */ $ui= get_userinfo(); $first = ""; $found = FALSE; $base = $this->config->current['BASE']; $options = $this->create_department_list($this->module); /* Get copy & paste icon */ $acls = $ui->get_permissions($this->selectedBase,"opsi/licenseGeneric"); $acl_all= $ui->has_complete_category_acls($this->selectedBase,"opsi"); /* Add default header */ $listhead = MultiSelectWindow::get_default_header(false); /* Create Layers menu */ $s = ".|"._("Actions")."|\n"; /* Append create options */ if(preg_match("/c/",$acls)) { $s .= "..|". " "._("Create")."|\n"; $s.= "...|". " "._("License")."|license_new|\n"; } /* Multiple options */ $s.= "..|---|\n"; $s.= "..|". " "._("Remove")."|"."remove_multiple_licenses|\n"; $this->SetDropDownHeaderMenu($s); $this->SetListHeader($listhead); } function execute() { $this->ClearElementsList(); $this->GenHeader(); } function setEntries($list) { // Defining Links $editlink = "%s"; // Dynamic action col, depending on snapshot icons $action_col_size = 90; if($this->parent->snapshotEnabled()){ $action_col_size += 38; } $ui = get_userinfo(); // Assigning licenses foreach($list as $key => $val){ // Get object permissions $acl = $ui->get_permissions($val['dn'],"opsi/licenseGeneric"); $acl_all= $ui->has_complete_category_acls($val['dn'],"opsi"); // Create edit and remove icon buttons $actions = ""; if(preg_match("/d/",$acl)){ $actions.= ""; }else{ $actions.= " "; } // Append license descriptio, if available $title = "title='".preg_replace('/ /', ' ', LDAP::fix($val['dn']))."'"; if(!isset($val['description'][0])){ $desc = ""; }else{ $desc = " - [ ".$val['description'][0]." ]"; } $display = $val['cn'][0].$desc; // Append the entry to the divlist $field0 = array("string" => "" , "attach" => "style='width:20px;'"); $field1 = array("string" => ""._("License")."", "attach" => "style='text-align:center;width: 20px;'"); $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title); $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"); $this->AddElement(array($field0,$field1,$field2,$field4)); } // Create the list summary $num_deps=0; if(!$this->SubSearch){ $num_deps = count($this->Added_Departments); } $num_objs = count($list); $num_obj_str = _("Number of listed license pools"); $str = "".$num_obj_str." ".$num_objs."    "; $this->set_List_Bottom_Info($str); } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>