Code

* Moved external_hook to repository_hook
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 May 2006 14:07:49 +0000 (14:07 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 May 2006 14:07:49 +0000 (14:07 +0000)
* Introduced new format to handle start tab, too

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3510 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_servRepositorySetup.inc
plugins/admin/systems/class_workstationStartup.inc
plugins/admin/systems/servRepositorySetup.tpl
plugins/admin/systems/workstationStartup.tpl

index 24f1c92bd483a512ecdea67ecfe360e30c02a313..4b885bbd90622fba704b992b2d4d69fea2b6ee0d 100644 (file)
@@ -162,23 +162,23 @@ class servRepositorySetup  extends plugin
   function GetHookElements()
   {
     $ret = array();
-    $cmd= search_config($this->config->data['TABS'], "servrepository", "EXTERNAL_HOOK");
+    $cmd= search_config($this->config->data['TABS'], "servrepository", "REPOSITORY_HOOK");
     if(!empty($cmd)){
       $res = shell_exec($cmd);
       $res2 = trim($res);
       if((!$res)){
-        print_red(sprintf(_("Can't execute specified EXTERNAL_HOOK '%s' please check your gosa.conf."),$cmd));
+        print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s' please check your gosa.conf."),$cmd));
       }elseif(empty($res2)){
-        print_red(sprintf(_("The specified EXTERNAL_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd));
+        print_red(sprintf(_("The specified REPOSITORY_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd));
       }else{  
         $tmp = split("\n",$res);
         foreach($tmp as $hook){
           /* skip empty */
           if(empty($hook)) continue;
 
-          if(preg_match("/\:/",$hook)){ 
-            $hookinfo = split(":",$hook);
-            $ret[$hookinfo[1]] = $hookinfo[0];
+          if(preg_match("/;/",$hook)){ 
+            $hookinfo = split(";",$hook);
+            $ret[$hookinfo[0]] = $hookinfo[0];
           }else{
             $ret[$hook] = $hook;
           }
index f33fcae8f012307850614a0158dbb820a67efdbd..71e39672ed1f42554b1c74262b62f6c2cf0f6168 100644 (file)
@@ -154,7 +154,35 @@ class workstartup extends plugin
         }
       }
     }
-    $this->FAIServRepConfig =$test;
+    
+    /* Add possible elements from hook */
+    $lines= $this->GetHookElements();
+    foreach ($lines as $hline){
+      $entries= split(";", $hline);
+      if (isset($entries[1]) && !isset($test[$entries[1]])){
+        $test[$entries[1]]['RELEASE']= array();
+
+        /* Split releases */
+        if (isset($entries[2])){
+          $releases= split(",", $entries[2]);
+
+          foreach ($releases as $release){
+            $rname= preg_replace('/:.*$/', '', $release);
+            $sections= split(':', preg_replace('/^[^:]+:([^|]+)|.*$/', '\1', $release));
+            $classes= split('\|', preg_replace('/^[^|]+\|(.*)$/', '\1', $release));
+            $test[$entries[1]]['RELEASE'][$rname]= array();
+            $test[$entries[1]]['RELEASE'][$rname]['SECTION']= $sections;
+            foreach ($classes as $class){
+              if ($class != ""){
+                $test[$entries[1]]['RELEASE'][$rname]['PACKAGES'][$class]= $class;
+              }
+            }
+          }
+        }
+      }
+    }
+    
+    $this->FAIServRepConfig= $test;
 
     /* Get arrays */
     foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){
@@ -968,6 +996,29 @@ class workstartup extends plugin
     return($a_return);
   }
 
+
+  function GetHookElements()
+  {
+    $ret = array();
+    $cmd= search_config($this->config->data['TABS'], "servrepository", "REPOSITORY_HOOK");
+    if(!empty($cmd)){
+      $res = shell_exec($cmd);
+      $res2 = trim($res);
+      if((!$res)){
+        print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s' please check your gosa.conf."),$cmd));
+      }elseif(empty($res2)){
+        print_red(sprintf(_("The specified REPOSITORY_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd));
+      }else{
+        $tmp = split("\n",$res);
+        foreach($tmp as $line){
+          if(empty($line)) continue;
+          $ret[]= $line;
+        }
+      }
+    }
+    return($ret);
+  }
+
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index e65ee4d9e01f9e8ef81401a7d0a4da2952a2a360..bdc8b7bdc568176b258396c9d895b61c8f858872 100644 (file)
@@ -5,19 +5,19 @@
                <td width="50%" valign="top" style="border-right:1px solid #A0A0A0">
                        <table summary=''>
                                <tr>
-                                       <td>{t}Release{/t}
+                                       <td>{t}Parent server{/t}
                                        </td>
                                        <td>
-                                               <input type="text" value="{$Release}" name="Release" {$ReleaseACL}>
+                                               <select name="ParentServer" {$ParentServerACL}>
+                                                       {html_options options=$ParentServers values=$ParentServerKeys selected=$ParentServer} 
+                                               </select>
                                        </td>
                                </tr>
                                <tr>
-                                       <td>{t}Parent server{/t}
+                                       <td>{t}Release{/t}
                                        </td>
                                        <td>
-                                               <select name="ParentServer" {$ParentServerACL}>
-                                                       {html_options options=$ParentServers values=$ParentServerKeys selected=$ParentServer} 
-                                               </select>
+                                               <input type="text" value="{$Release}" name="Release" {$ReleaseACL}>
                                        </td>
                                </tr>
                                <tr>
index c27a8ce2a4672428f04a9858fa259c38679064f0..e9ae1070d655960d3d7b25c8072b7b655405132f 100644 (file)
@@ -39,7 +39,6 @@
        <h2><img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}Release{/t}</h2></td>
      </tr><tr>
      <td>
-               <!--<select name="FAIdebianMirror" {$FAIdebianMirrorACL} onchange="document.mainform.submit();">-->
                <select name="FAIdebianMirror" {$FAIdebianMirrorACL} onchange='document.mainform.submit()'>
         {html_options options=$FAIdebianMirrors output=$FAIdebianMirrors selected=$FAIdebianMirror}
         <option disabled>&nbsp;</option>