From: hickert Date: Tue, 5 Jan 2010 12:09:41 +0000 (+0000) Subject: Second FAI list rebuild X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=88c0fbc6a29196122f1a5a00a55809997d1da54d;p=gosa.git Second FAI list rebuild git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15055 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index d962cf33b..63e1733ee 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -39,8 +39,14 @@ class faiManagement extends management { $this->config = $config; $this->ui = $ui; - - $this->storagePoints = array(get_ou("roleRDN")); + + $this->storagePoints = array( + get_ou('faiPartitionRDN'), + get_ou('faiPackageRDN'), + get_ou('faiScriptRDN'), + get_ou('faiVariableRDN'), + get_ou('faiHookRDN'), + get_ou('faiProfileRDN'),get_ou('faiTemplateRDN')); // Build filter # if (session::global_is_set(get_class($this)."_filter")){ @@ -54,6 +60,7 @@ class faiManagement extends management // Build headpage $headpage = new listing(get_template_path("fai-list.xml", true)); $headpage->setFilter($filter); + $headpage->registerElementFilter("filterProperties", "faiManagement::filterProperties"); // Add copy&paste and snapshot handler. if ($this->config->boolValueIsTrue("main", "copyPaste")){ @@ -106,6 +113,42 @@ class faiManagement extends management } + static function filterProperties($row, $classes) + { + $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 localboot product") , "KZL"=> "OL", "VAR"=>"ShowOpsiLocal")); + + $icon_list = ""; + foreach($objects as $type => $type_data){ + if(in_array($type, $classes)){ + $icon_list .= "\n"; + }else{ + $icon_list .= " \n"; + } + } + + return $icon_list; + } + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/gosa-plugins/fai/admin/fai/class_filterFAI.inc b/gosa-plugins/fai/admin/fai/class_filterFAI.inc new file mode 100644 index 000000000..6583ab14a --- /dev/null +++ b/gosa-plugins/fai/admin/fai/class_filterFAI.inc @@ -0,0 +1,83 @@ + array("OU"=> get_ou('faiPartitionRDN') , "CHKBOX"=>"ShowPartitions" ,"ACL" => "faiPartitionTable"), + "FAIpackageList" => array("OU"=> get_ou('faiPackageRDN') , "CHKBOX"=>"ShowPackages" ,"ACL" => "faiPackage"), + "FAIscript" => array("OU"=> get_ou('faiScriptRDN') , "CHKBOX"=>"ShowScripts" ,"ACL" => "faiScript"), + "FAIvariable" => array("OU"=> get_ou('faiVariableRDN') , "CHKBOX"=>"ShowVariables" ,"ACL" => "faiVariable"), + "FAIhook" => array("OU"=> get_ou('faiHookRDN') , "CHKBOX"=>"ShowHooks" ,"ACL" => "faiHook"), + "FAIprofile" => array("OU"=> get_ou('faiProfileRDN') , "CHKBOX"=>"ShowProfiles" ,"ACL" => "faiProfile"), + "FAItemplate" => array("OU"=> get_ou('faiTemplateRDN') , "CHKBOX"=>"ShowTemplates" ,"ACL" => "faiTemplate")); + + + + global $config; + $tmp = FAI::get_all_objects_for_given_base($base,$filter); + $ui = get_userinfo(); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); + + $result = array(); + foreach($tmp as $entry){ + + /* Get some more informations about the object */ + $ldap->cat($entry['dn'], array("cn","description","objectClass","FAIclass","FAIstate","objectClass")); + $object = $ldap->fetch(); + + /* Walk through possible types */ + foreach($ObjectTypes as $type => $rest){ + + $acl = $ui->get_permissions($object['dn'],"fai/".$rest ['ACL']); + + if(in_array($type,$object['objectClass']) && preg_match("/r/",$acl)){ + + /* Prepare object */ + unset($object['objectClass']['count']); + if(!isset($object['description'][0])){ + $object['description'][0]=""; + } + + $dn = preg_replace("/^[^,]*+,/","",$object['dn']); + + /* Clean up object informations */ + $obj = array(); + $obj['cn'] = $object['cn'][0]; + $obj['dn'] = $object['cn'][0]; + $obj['acl'] = $acl; + $obj['class'] = $rest ['ACL']; + $obj['FAIstate'] = $entry['FAIstate']; + $obj['description'] = $object['description'][0]; + $obj['objectClass'] = $object['objectClass']; + $obj['TYPES'][] = $type; + + if(!isset($result[$obj['cn']])){ + $result[$obj['cn']] = $obj; + }else{ + $result[$obj['cn']]['TYPES'][]=$type; + } + } + } + } + + // Make results useable for the listing class. + $entries = array(); + foreach($result as $entry){ + $item=array('count' => count($entry)); + foreach($entry as $name => $value){ + $item[] = $name; + $item[$name] = $value ; + } + $entries[] = $item; + } + + return($entries); + } +} +?> diff --git a/gosa-plugins/fai/admin/fai/fai-filter.tpl b/gosa-plugins/fai/admin/fai/fai-filter.tpl index 6495f8fb5..3c2904bfc 100644 --- a/gosa-plugins/fai/admin/fai/fai-filter.tpl +++ b/gosa-plugins/fai/admin/fai/fai-filter.tpl @@ -15,6 +15,15 @@ +
+ +{$PROFILE} {t}Show profiles{/t} +
{$TEMPLATE} {t}Show templates{/t} +
{$SCRIPT} {t}Show scripts{/t} +
{$HOOK} {t}Show hooks{/t} +
{$VARIABLE} {t}Show variables{/t} +
{$PACKAGE} {t}Show packages{/t} +
{$PARTITION} {t}Show partition{/t} diff --git a/gosa-plugins/fai/admin/fai/fai-filter.xml b/gosa-plugins/fai/admin/fai/fai-filter.xml index 835a26d08..f54552dd1 100644 --- a/gosa-plugins/fai/admin/fai/fai-filter.xml +++ b/gosa-plugins/fai/admin/fai/fai-filter.xml @@ -9,8 +9,8 @@ - LDAP - (&(objectClass=FAIclass)$NAME) + FAI + (&(|$PROFILE$HOOK$TEMPLATE$SCRIPT$VARIABLE$PACKAGE$PARTITION)$NAME) dn objectClass cn @@ -27,6 +27,62 @@ Loading... + + checkbox + PROFILE + true + + (objectClass=FAIprofile) + + + + checkbox + TEMPLATE + true + + (objectClass=FAItemplate) + + + + checkbox + SCRIPT + true + + (objectClass=FAIscript) + + + + checkbox + HOOK + true + + (objectClass=FAIhook) + + + + checkbox + VARIABLE + true + + (objectClass=FAIvariable) + + + + checkbox + PACKAGE + true + + (objectClass=FAIpackageList) + + + + checkbox + PARTITION + true + + (objectClass=FAIpartitionTable) + + textfield NAME @@ -37,7 +93,7 @@ (cn=*$*) false - LDAP + FAI (&(objectClass=FAIclass)(cn=*$NAME*)) cn 0.5 diff --git a/gosa-plugins/fai/admin/fai/fai-list.xml b/gosa-plugins/fai/admin/fai/fai-list.xml index cd37ca0c1..e4758ef6e 100644 --- a/gosa-plugins/fai/admin/fai/fai-list.xml +++ b/gosa-plugins/fai/admin/fai/fai-list.xml @@ -22,11 +22,7 @@
- |20px;c||250px|170px;r| - - - %{filter:objectType(dn,objectClass)} - + |20px;c|||250px|170px;r| %{filter:departmentLink(row,dn,description)} @@ -53,6 +49,11 @@ true + + + %{filter:filterProperties(row,TYPES)} + + %{filter:actions(dn,row,objectClass)}