X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=gosa-plugins%2Ffai%2Fadmin%2Ffai%2Fclass_divListFai.inc;h=6e897c156e13f39916239844d8090962b3844178;hb=803cc8ab6dbca270c2e39fbbf131b10ccd2cdce2;hp=9f0362e4ded39b8cd453a7aa77c7f056c9bc08fb;hpb=fa5d22666fd9d7d2b6fce4c546b37b0071e59cdc;p=gosa.git diff --git a/gosa-plugins/fai/admin/fai/class_divListFai.inc b/gosa-plugins/fai/admin/fai/class_divListFai.inc index 9f0362e4d..6e897c156 100644 --- a/gosa-plugins/fai/admin/fai/class_divListFai.inc +++ b/gosa-plugins/fai/admin/fai/class_divListFai.inc @@ -18,6 +18,9 @@ class divListFai extends MultiSelectWindow var $parent ; var $ui ; + var $ShowOpsiLocal; + var $ShowOpsiNetboot; + function divListFai (&$config,$parent) { MultiSelectWindow::MultiSelectWindow($config, "Fai", "fai"); @@ -27,7 +30,7 @@ class divListFai extends MultiSelectWindow /* Set list strings */ $this->SetTitle( _("List of classes")); - $this->SetSummary(_("List of deployment classes and packages")); + $this->SetSummary(_("List of deployment classes and products")); /* Result page will look like a headpage */ $this->SetHeadpageMode(); @@ -39,7 +42,7 @@ class divListFai extends MultiSelectWindow $this->EnableSaveButton (false); /* Dynamic action col, depending on snapshot icons */ - $action_col_size = 120; + $action_col_size = 130; /* Toggle all selected / deselected */ $chk = "AddHeader(array("string" => _("Class type"), "attach" => "style='width:200px;'")); $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'")); - $this->AddCheckBox("ShowProfiles" , sprintf(_("Display objects of type '%s'."),_("Profile")) ,_("Show profiles") ,true); - $this->AddCheckBox("ShowTemplates" , sprintf(_("Display objects of type '%s'."),_("Variable")) ,_("Show templates") ,true); - $this->AddCheckBox("ShowScripts" , sprintf(_("Display objects of type '%s'."),_("Script")) ,_("Show scripts") ,true); - $this->AddCheckBox("ShowHooks" , sprintf(_("Display objects of type '%s'."),_("Hook")) ,_("Show hooks") ,true); - $this->AddCheckBox("ShowVariables" , sprintf(_("Display objects of type '%s'."),_("Variable")) ,_("Show variables") ,true); - $this->AddCheckBox("ShowPackages" , sprintf(_("Display objects of type '%s'."),_("Package")) ,_("Show packages") ,true); - $this->AddCheckBox("ShowPartitions" , sprintf(_("Display objects of type '%s'."),_("Partition")),_("Show partitions") ,true); + $this->AddCheckBox("ShowProfiles" , sprintf(_("Display objects of type '%s'."), + _("Profile")) ,_("Show profiles") ,true); + $this->AddCheckBox("ShowTemplates" , sprintf(_("Display objects of type '%s'."), + _("Variable")) ,_("Show templates") ,true); + $this->AddCheckBox("ShowScripts" , sprintf(_("Display objects of type '%s'."), + _("Script")) ,_("Show scripts") ,true); + $this->AddCheckBox("ShowHooks" , sprintf(_("Display objects of type '%s'."), + _("Hook")) ,_("Show hooks") ,true); + $this->AddCheckBox("ShowVariables" , sprintf(_("Display objects of type '%s'."), + _("Variable")) ,_("Show variables") ,true); + $this->AddCheckBox("ShowPackages" , sprintf(_("Display objects of type '%s'."), + _("Package")) ,_("Show packages") ,true); + $this->AddCheckBox("ShowPartitions" , sprintf(_("Display objects of type '%s'."), + _("Partition")),_("Show partitions") ,true); + + /* Add opsi checkboxes if opsi is enabled + */ + if($this->parent->opsi instanceof opsi && $this->parent->opsi->enabled()){ + $this->AddCheckBox("ShowOpsiNetboot" , sprintf(_("Display objects of type '%s'."), + _("OPSI netboot product")),_("Show netboot products") ,true); + $this->AddCheckBox("ShowOpsiLocal" , sprintf(_("Display objects of type '%s'."), + _("OPSI local product")),_("Show local products") ,true); + } /* Add SubSearch checkbox */ //$this->AddCheckBox(SEPERATOR); @@ -86,7 +105,7 @@ class divListFai extends MultiSelectWindow $smarty->assign("allow_remove", $r); $smarty->assign("fai_release" , $releases[$this->parent->fai_release]); $smarty->assign("fai_base" , $releases[$this->parent->fai_base]); - $smarty->assign("branchimage","images/branch.png"); + $smarty->assign("branchimage","plugins/fai/images/branch.png"); $smarty->assign("fai_releases", $releases); $plug_id = 0; if(isset($_GET['plug'])){ @@ -110,7 +129,7 @@ class divListFai extends MultiSelectWindow $add_sep = false; /* Get complete fai acls, to be able to check if we must show or hide the snapshot abilities */ - $acl_all = $ui->has_complete_category_acls($this->parent->fai_base,$this->module); + $acl_all = $ui->has_complete_category_acls($this->parent->acl_base,$this->module); /* Add default header */ $listhead = MultiSelectWindow::get_default_header(false); @@ -124,27 +143,33 @@ class divListFai extends MultiSelectWindow $s .= "..|". " "._("Create")."|\n"; - $acl = $ui->get_permissions($this->parent->fai_base,"fai/faiProfile"); + $acl = $ui->get_permissions($this->parent->acl_base,"fai/faiProfile"); if($this->parent->lock_type == "freeze" && !$this->parent->allow_freeze_object_attach){ - $s.= "...|". + $s.= "...|". " "._("Freezed")."|\n"; }else{ if(preg_match("/c/",$acl)){ - $s.= "...|". + $s.= "...|". " "._("Profile")."|Create_profile|\n"; } /* Append create icons for each fai component */ $arr = array( - array("images/fai_new_partitionTable.png" , _("Partition table") ,"Create_partition" , _("PT") , "faiPartitionTable"), - array("images/fai_new_script.png" , _("Scripts") ,"Create_script" , _("S") , "faiScript"), - array("images/fai_new_hook.png" , _("Hooks") ,"Create_hook" , _("H") , "faiHook"), - array("images/fai_new_variable.png" , _("Variables") ,"Create_variable" , _("V") , "faiVariable"), - array("images/fai_new_template.png" , _("Templates ") ,"Create_template" , _("I") , "faiTemplate"), - array("images/fai_new_packages.png" , _("Package list") ,"Create_package" , _("PK") , "faiPackage")); + array("plugins/fai/images/fai_new_partitionTable.png" , _("Partition table") , + "Create_partition" , _("PT") , "faiPartitionTable"), + array("plugins/fai/images/fai_new_script.png" , _("Scripts") , + "Create_script" , _("S") , "faiScript"), + array("plugins/fai/images/fai_new_hook.png" , _("Hooks") , + "Create_hook" , _("H") , "faiHook"), + array("plugins/fai/images/fai_new_variable.png" , _("Variables") , + "Create_variable" , _("V") , "faiVariable"), + array("plugins/fai/images/fai_new_template.png" , _("Templates ") , + "Create_template" , _("I") , "faiTemplate"), + array("plugins/fai/images/fai_new_packages.png" , _("Package list") , + "Create_package" , _("PK") , "faiPackage")); foreach($arr as $ar){ - $acl = $ui->get_permissions($this->parent->fai_base,"fai/".$ar[4]); + $acl = $ui->get_permissions($this->parent->acl_base,"fai/".$ar[4]); if(preg_match("/c/",$acl)){ $s.= "...|". " ".$ar[1]."|".$ar[2]."|\n"; @@ -157,32 +182,11 @@ class divListFai extends MultiSelectWindow " "._("Remove")."|"."remove_multiple|\n"; - if(is_object($this->parent->CopyPasteHandler) && preg_match("/r/",$acl_all)){ - $s.= "..|---|\n"; - $s.= "..|". - " "._("Copy")."|"."multiple_copy_systems|\n"; - } - - /* Add copy & paste icons, currently disabled, this ability is not implemeneted yet */ - if(!($this->parent->lock_type == "freeze" && !$this->parent->allow_freeze_object_attach) && - preg_match("/(c.*w|w.*c)/",$acl_all) && isset($this->parent->CopyPasteHandler) && $this->parent->CopyPasteHandler){ - $s .= "..|---|\n"; - if($this->parent->CopyPasteHandler->entries_queued()){ - $img = ""; - $s.="..|".$img." "._("Paste")."|editPaste|\n"; - }else{ - $img = ""; - $s.="..|".$img." "._("Paste")."\n"; - } - } + /* Add Copy & Paste header */ + $s .= $this->parent->get_copypaste_header($this->selectedBase,$this->module,TRUE,FALSE); # /* Add snapshot icons, if we are allowed to write and create the complete fai module ($ui->has_complete_category_acls) */ -# if(preg_match("/(c.*w|w.*c)/",$acl_all)){ -# if($this->parent->snapshotEnabled()){ -# $s .= "..|---|\n"; -# $s .= $this->get_snapshot_header(TRUE); -# } -# } +# $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module); $this->SetDropDownHeaderMenu($s); $this->SetListHeader($listhead); @@ -202,18 +206,29 @@ class divListFai extends MultiSelectWindow 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")); + $objects = array( + "FAIpartitionTable" => array("IMG"=> "plugins/fai/images/fai_partitionTable.png", + "NAME"=>_("Partition table"),"KZL"=> "PT", "VAR"=>"ShowPartitions"), + "FAIpackageList" => array("IMG"=> "plugins/fai/images/fai_packages.png", + "NAME"=>_("Package list") , "KZL"=> "PL", "VAR"=>"ShowPackages"), + "FAIscript" => array("IMG"=> "plugins/fai/images/fai_script.png", + "NAME"=>_("Scripts") , "KZL"=> "S", "VAR"=>"ShowScripts"), + "FAIvariable" => array("IMG"=> "plugins/fai/images/fai_variable.png", + "NAME"=>_("Variables") , "KZL"=> "V", "VAR"=>"ShowVariables"), + "FAIhook" => array("IMG"=> "plugins/fai/images/fai_hook.png", + "NAME"=>_("Hooks"), "KZL"=> "H", "VAR"=>"ShowHooks"), + "FAIprofile" => array("IMG"=> "plugins/fai/images/fai_profile.png", + "NAME"=>_("Profile") , "KZL"=> "P", "VAR"=>"ShowProfiles"), + "FAItemplate" => array("IMG"=> "plugins/fai/images/fai_template.png", + "NAME"=>_("Templates") , "KZL"=> "T", "VAR"=>"ShowTemplates"), + "opsi_netboot" => array("IMG"=> "plugins/opsi/images/netboot_package.png", + "NAME"=>_("OPSI netboot product") , "KZL"=> "ON", "VAR"=>"ShowOpsiNetboot"), + "opsi_local" => array("IMG"=> "plugins/opsi/images/local_package.png", + "NAME"=>_("OPSI local product") , "KZL"=> "OL", "VAR"=>"ShowOpsiLocal")); /* Dynamic action col, depending on snapshot icons */ - $action_col_size = 120; + $action_col_size = 130; # if($this->parent->snapshotEnabled()){ # $action_col_size += 32; # } @@ -254,27 +269,35 @@ class divListFai extends MultiSelectWindow /* Add copy & cut icons */ $ui = get_userinfo(); $action =""; - $acl_all = $ui->has_complete_category_acls($this->parent->fai_base,$this->module); - if($ui->is_copyable($value['dn'],"fai",$value['class']) && $this->parent->CopyPasteHandler){ - $action .= " "; - } + $acl_all = $ui->has_complete_category_acls($this->parent->acl_base,$this->module); - if(preg_match("/^freeze/", $value['FAIstate'])){ - $editlink ="%NAME%"; + if(preg_match("/^opsi_/",$type)){ + $editlink ="%NAME%"; $action.= ""; - $action.= "F"; + name='entry_opsi_edit_%KEY%' title='"._("Edit product")."'> "; }else{ - $editlink ="%NAME%"; - $action.= ""; - if(preg_match("/d/",$value['acl'])){ - $action.= ""; + + /* Add copy & cut functionality */ + $action.= $this->parent->get_copypaste_action($value['dn'],"fai",$value['class'],TRUE,FALSE); + + if(preg_match("/^freeze/", $value['FAIstate'])){ + $editlink ="%NAME%"; + $action.= ""; + $action.= "F"; + }else{ + $editlink ="%NAME%"; + $action.= ""; + if(preg_match("/d/",$value['acl'])){ + $action.= ""; + } } } +# $action.= $this->parent->get_snapshot_action($val['dn'],$this->module); + /* Cutted objects should be displayed in light grey */ $display = $value['cn'].$desc; if($this->parent->CopyPasteHandler){ @@ -288,11 +311,17 @@ class divListFai extends MultiSelectWindow $edi = $editlink; $acti = $action; - /* Create each field */ + $display = "
".$display."
"; + + /* Some objects are non ldap objects which do not have a dn. + */ + if(!isset($value['dn'])) $value['dn'] = ""; + + /* Create each field */ $field0 = array("string" => "" , "attach" => "style='width:20px;'"); $field1 = array("string" => $img , "attach" => "style='text-align:center;width:20px;'"); - $field2 = array("string" => preg_replace(array("/%KEY%/","/%NAME%/","/%TITLE%/"),array($key,$display,preg_replace('/ /', ' ', @LDAP::fix($value['dn']))),$edi) , "attach" => "style=''"); + $field2 = array("string" => preg_replace(array("/%KEY%/","/%NAME%/","/%TITLE%/"),array($key,$display,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:".$action_col_size."px;border-right:0px;text-align:right;'"); $this->AddElement(array($field0,$field1,$field2,$field3,$field4));