X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Ffai%2Fadmin%2Ffai%2Fclass_faiSummaryTab.inc;h=9e6d68651fab9be3bf2e1020c5ffe696252f2b5b;hb=976248a57784ef2d953b5114e5075d2b29a549d8;hp=130efb441edfbabde0def4c71ed3bfa96b3a821d;hpb=5b267fd21af230699c47710ed4be472cdf7f895c;p=gosa.git diff --git a/gosa-plugins/fai/admin/fai/class_faiSummaryTab.inc b/gosa-plugins/fai/admin/fai/class_faiSummaryTab.inc index 130efb441..9e6d68651 100644 --- a/gosa-plugins/fai/admin/fai/class_faiSummaryTab.inc +++ b/gosa-plugins/fai/admin/fai/class_faiSummaryTab.inc @@ -41,13 +41,13 @@ class faiSummaryTab extends plugin{ /* Base object configuration */ $this->objs = array( - "FAIscript" => array( "Image" =>"images/fai_script.png", "Name"=>_("Scripts") ,"Tree" =>get_ou('faiscriptou')) , - "FAIhook" => array( "Image" =>"images/fai_hook.png" , "Name"=>_("Hooks") ,"Tree" =>get_ou('faihookou')), - "FAIvariable" => array( "Image" =>"images/fai_variable.png", "Name"=>_("Variables") ,"Tree" =>get_ou('faivariableou')) , - "FAItemplate" => array( "Image" =>"images/fai_template.png", "Name"=>_("Templates") ,"Tree" =>get_ou('faitemplateou')) , - "FAIpartitionTable" => array( "Image" =>"images/fai_partitionTable.png","Name"=>_("Partition table") ,"Tree" =>get_ou('faipartitionou')) , - "FAIpackageList" => array( "Image" =>"images/fai_packages.png", "Name"=>_("Package list") ,"Tree" =>get_ou('faipackageou')) , - "FAIprofile" => array( "Image" =>"images/fai_profile.png", "Name"=>_("Profiles") ,"Tree" =>get_ou('faiprofileou'))); + "FAIscript" => array( "Image" =>"plugins/fai/images/fai_script.png", "Name"=>_("Scripts") ,"Tree" =>get_ou('faiScriptRDN')) , + "FAIhook" => array( "Image" =>"plugins/fai/images/fai_hook.png" , "Name"=>_("Hooks") ,"Tree" =>get_ou('faiHookRDN')), + "FAIvariable" => array( "Image" =>"plugins/fai/images/fai_variable.png", "Name"=>_("Variables") ,"Tree" =>get_ou('faiVariableRDN')) , + "FAItemplate" => array( "Image" =>"plugins/fai/images/fai_template.png", "Name"=>_("Templates") ,"Tree" =>get_ou('faiTemplateRDN')) , + "FAIpartitionTable" => array( "Image" =>"plugins/fai/images/fai_partitionTable.png","Name"=>_("Partition table") ,"Tree" =>get_ou('faiPartitionRDN')) , + "FAIpackageList" => array( "Image" =>"plugins/fai/images/fai_packages.png", "Name"=>_("Package list") ,"Tree" =>get_ou('faiPackageRDN')) , + "FAIprofile" => array( "Image" =>"plugins/fai/images/fai_profile.png", "Name"=>_("Profiles") ,"Tree" =>get_ou('faiProfileRDN'))); } @@ -62,19 +62,27 @@ class faiSummaryTab extends plugin{ /* Get classes & release name There are 2 different tabs which use the summary tab faiProfile / Workstations */ - + /* Check if given parent object is fai profile tabs */ if(isset($this->parent->by_name['faiProfile'])){ /* Get Classes and release */ $this->Classes = $this->parent->by_object['faiProfile']->FAIclasses; - $this->base = $this->parent->by_object['faiProfile']->base; - $str = preg_replace("/^.*".normalizePreg(get_ou('faiprofileou'))."/","",$this->dn); + $this->base = $this->parent->by_object['faiProfile']->parent->parent->fai_release; + $str = preg_replace("/^.*".preg_quote(get_ou('faiProfileRDN'), '/')."/i","",$this->dn); + $tmp = $this->parent->by_object['faiProfile']->parent->parent->getBranches(); + $this->Release = $tmp[$this->base]; /* Check if parent tab is work tab */ }elseif(isset($this->parent->by_name['workstartup'])){ - $this->Classes = $this->parent->by_object['workstartup']->FAIclass; - $this->Release = $this->parent->by_object['workstartup']->FAIrelease; + + if($this->parent->by_object['workstartup']->FAIdebianMirror == "inherited"){ + $this->Classes = $this->parent->by_object['workstartup']->InheritedFAIclass; + $this->Release = $this->parent->by_object['workstartup']->InheritedFAIrelease; + }else{ + $this->Classes = $this->parent->by_object['workstartup']->FAIclass; + $this->Release = $this->parent->by_object['workstartup']->FAIrelease; + } /* Check if this is a workstation or an object group */ if(isset($this->parent->by_object['workgeneric'])){ @@ -93,6 +101,9 @@ class faiSummaryTab extends plugin{ } } + // All FAI stuff is located on the ldap base, isn't it? + $this->base = $this->config->current['BASE']; + $tmp = array_flip($this->getBranches()); $this->Classes[] = "LAST"; @@ -107,6 +118,7 @@ class faiSummaryTab extends plugin{ $this->Releases = $tmp; $this->usedClasses = array(); + /* Check the configuration */ if(count($this->Classes) && (!empty($this->Release))){ foreach($this->Classes as $class){ @@ -149,9 +161,9 @@ class faiSummaryTab extends plugin{ $value = preg_replace("/_.*$/","",$value); unset($this->Result[$value]['Open']); } - if(preg_match("/^reloadList/",$name)){ - $this->InitCalled = false; - } + } + if(isset($_POST['reloadList'])){ + $this->InitCalled = false; } } @@ -169,11 +181,12 @@ class faiSummaryTab extends plugin{ /* This function calls all nescessary functions to generate the fai class summary tree */ function execute() { + plugin::execute(); /* Skip this if fai is deactivated */ $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs')); if(empty($tmp)){ - $str = "

"._("You can't use this plugin until FAI is activated.")."

"; + $str = "

"._("You can't use this plugin until FAI is activated.")."

"; return $str; } @@ -212,32 +225,27 @@ class faiSummaryTab extends plugin{ function createSummary($data) { /* Don't generate any output, if there is no result */ - $str =" "; if(!count($this->Result)){ - $str.="
"; - $str.= (_("This object has no FAI classes assigned.")); - $str.= "
"; - return($str); + return("

"._("This object has no FAI classes assigned.")."

"); } + $str =" "; /* walk through all classes */ foreach($data as $key => $entry){ - $image = "".$this->objs[$key]["; + $image = image($this->objs[$key]['Image']); if(!isset($entry['Open'])){ $str .= " - "; + "; }else{ - $str .= ""; - + $str .= ""; + /* Display FAItemplate FAIhook FAIscript entries */ if(in_array($key,array("FAItemplate","FAIhook","FAIscript"))){ @@ -382,7 +390,12 @@ class faiSummaryTab extends plugin{ function resolveObject($class) { $ldap = $this->config->get_ldap_link(); - $dn = $this->Releases [$this->Release]; + if(isset($this->Releases[$this->Release])){ + $dn = $this->Releases[$this->Release]; + }else{ + return(FALSE); + } + $resolvedClasses = FAI::get_all_objects_for_given_base($dn,"(&(objectClass=FAIclass)(cn=".$class."))"); /* Try to fetch all types of fai objects with the given cn */ @@ -554,7 +567,7 @@ class faiSummaryTab extends plugin{ /* Create a new Profile entry */ function prepare_FAIprofile($data) { - $classes = split("\ ",$data['FAIclass'][0]); + $classes = explode(" ",$data['FAIclass'][0]); foreach($classes as $class){ $class = trim($class); $this->resolveObject($class);
- - "._("Open")." "; - $str .= $image." "; - $str .= " ".$this->objs[$key]['Name']."
". + image('images/lists/expand.png').$image." ". + "". + "".$this->objs[$key]['Name']."
- - "._("Close")." "; - $str .= $image." "; - $str .= "".$this->objs[$key]['Name']."
". + image('images/lists/sort-down.png').$image." ". + "". + "".$this->objs[$key]['Name']."