summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 060882d)
raw | patch | inline | side by side (parent: 060882d)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 24 Sep 2009 09:39:47 +0000 (09:39 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 24 Sep 2009 09:39:47 +0000 (09:39 +0000) |
that contain several class types.
- Fix function selectable classes: Properly return the abbrevations for
a given class_name instead of constructing it randomly with
false results.
- Implement function get_classes to reduce code duplication and use it
in several places.
- Implement function get_abbrevations_string to determine abbrevations
string and use it.
(Trac: #3381)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@14339 594d385d-05f5-0310-b6e9-bd551577e9d8
- Fix function selectable classes: Properly return the abbrevations for
a given class_name instead of constructing it randomly with
false results.
- Implement function get_classes to reduce code duplication and use it
in several places.
- Implement function get_abbrevations_string to determine abbrevations
string and use it.
(Trac: #3381)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@14339 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc | patch | blob | history |
diff --git a/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc b/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc
index 06a0ed7651b005df66557eafb59dde8b68b4c591..b7c3c97098a72f1edcb36f3fcfb0a7a87a60d2bf 100644 (file)
* to our list of classes, abort and show a message.
*/
foreach($this->FAIclass as $name){
+ # FIXME: Where does FAIclassInfo come from??
if(isset($this->FAIclassInfo[$name])){
foreach($this->FAIclassInfo[$name] as $atr){
if(isset($atr['obj'])){
$i = 1;
if($this->acl_is_readable("FAIclass")){
foreach($tmp as $class){
-
/* Mark invalid classes. (Not in selected release)
*/
$marker = "";
/* Get Description tag
* There may be several FAI objects with the same class name,
* use the description from FAIprofile, if possible.
- */
- $desc = "";
- if(isset($this->cache['CLASSES'][$this->FAIrelease][$class])){
- foreach($this->cache['CLASSES'][$this->FAIrelease][$class] as $types ){
- if(isset($types['Desc'])){
- $desc= $types['Desc'];
- if($types['Type'] == "FAIprofile"){
- break;
- }
- }
- }
- }
- if(!empty($desc)){
- $desc = " [".trim($desc)."]";
+ */
+ $abbrevations = $this->get_abbrevations_string($class);
+
+ if(!empty($abbrevations)){
+ $abbrevations = " [".trim($abbrevations)."]";
}
$div->AddEntry(array(
- array("string"=>$class.$desc.$marker),
+ array("string"=>$class.$abbrevations.$marker),
array("string"=>preg_replace("/\%s/",base64_encode($class),$str),"attach"=>"style='width:50px;border-right:none;'")
));
}
/* Get the list of available servers and their releases.
*/
$o_queue = new gosaSupportDaemon();
- $tmp = $o_queue->FAI_get_classes($release);
+ $classes = $o_queue->FAI_get_classes($release);
$this->cache['CLASSES'][$release] = array();
if($o_queue->is_error()){
msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
$this->cache=array();
return;
}else{
- foreach($tmp as $entry){
- $class = $entry['CLASS'];
- $this->cache['CLASSES'][$release][$class] = $this->analyse_fai_object($entry);
+ foreach($classes as $class){
+ $classname = $class['CLASS'];
+ if (!isset($this->cache['CLASSES'][$release][$classname])) {
+ $this->cache['CLASSES'][$release][$classname] = array();
+ }
+ array_push($this->cache['CLASSES'][$release][$classname], $this->analyse_fai_object($class));
}
}
}
}
-
- /* This function return an array containing all
- * invalid classes for the selected server/release
- */
- function get_invalid_classes($classes)
- {
+ /* Detect the release and get all classes for it */
+ function get_classes() {
$this->update_fai_cache();
+
if($this->FAIdebianMirror == "inherited" && isset($this->cache['CLASSES'][$this->InheritedFAIrelease])){
- $release_classes = $this->cache['CLASSES'][$this->InheritedFAIrelease];
+ $classes = $this->cache['CLASSES'][$this->InheritedFAIrelease];
}elseif(isset($this->cache['CLASSES'][$this->FAIrelease])){
- $release_classes = $this->cache['CLASSES'][$this->FAIrelease];
+ $classes = $this->cache['CLASSES'][$this->FAIrelease];
}else{
- $release_classes = array();
+ $classes = array();
}
+ return $classes;
+ }
+
+ /* This function return an array containing all
+ * invalid classes for the selected server/release
+ */
+ function get_invalid_classes($classes)
+ {
+ $release_classes = $this->get_classes();
/* Detect all classes that are not valid
* for the selected release
return($NA);
}
-
+
+
+ function get_abbrevations_string($class_name) {
+ $classes = $this->get_classes();
+
+ $Abbr = "";
+ foreach($classes[$class_name] as $class_type) {
+ $Abbr .= $class_type['Abbr']." ";
+ }
+ return trim($Abbr);
+ }
+
/* Get all selectable classes for the ui select box
*/
function selectable_classes()
{
- $this->update_fai_cache();
+ $classes = $this->get_classes();
- if($this->FAIdebianMirror == "inherited" && isset($this->cache['CLASSES'][$this->InheritedFAIrelease])){
- $classes = $this->cache['CLASSES'][$this->InheritedFAIrelease];
- }elseif(isset($this->cache['CLASSES'][$this->FAIrelease])){
- $classes = $this->cache['CLASSES'][$this->FAIrelease];
- }else{
- $classes = array();
- }
-
- $Abbr ="";
$ret= array();
- foreach($classes as $class_name => $class_types){
- if(!in_array($class_name,$this->FAIclass)){
- foreach($class_types as $type){
- if(!preg_match("/".$type['Abbr']."/",$Abbr)){
- $Abbr .= $type['Abbr']." ";
- }
- }
- $ret[$class_name] = trim($Abbr);
+ foreach($classes as $class_name => $class_types) {
+ if (!in_array($class_name, $this->FAIclass)) {
+ $ret[$class_name] = $this->get_abbrevations_string($class_name);
}
}
uksort($ret, 'strnatcasecmp');