Code

Fixed Translation Strings.
[gosa.git] / plugins / admin / applications / class_applicationGeneric.inc
index 7dd82fdc8b18a7e3969d656d6ce66564bb63105e..58895c8eabd0283a5bf7e83a1084ac2220ecde25 100644 (file)
@@ -58,17 +58,15 @@ class application extends plugin
   }
 
 
-  function generateTempalte(){
-       $str= "# This code is part of GOsa (https://gosa.gonicus.de)\n".
-           "#\n".
-            "# This program is free software; you can redistribute it and/or modify\n".
-            "# it under the terms of the GNU General Public License as published by\n".
-            "# the Free Software Foundation; either version 2 of the License, or\n".
-            "# (at your option) any later version.\n".
-            "#\n";
-
-       $names = $this->parent->by_object['applicationParameters']->option_name;
-       $values = $this->parent->by_object['applicationParameters']->option_value;
+  function generateTemplate(){
+       $str= "# This code is part of GOsa (https://gosa.gonicus.de)\n#\n";
+
+       $values = array();
+       $names  = array();
+       if($this->parent->by_object['applicationParameters']->is_account){
+               $names = $this->parent->by_object['applicationParameters']->option_name;
+               $values = $this->parent->by_object['applicationParameters']->option_value;
+       }
 
        if (count($names)){
                $str .="# This plugin handles these environment variables:\n";
@@ -79,13 +77,13 @@ class application extends plugin
        foreach($names as $index => $name){
 
                // Fix length
-               if (strlen($name) < 35){
-                       $name= sprintf("%.35s", $name);
+               for($i = strlen($name) ; $i < 30 ; $i++){
+                       $name= $name." ";
                }
-               if(isset($values[$index])){
-                       $str.= "# ".$name."\t\t(e.g. ".$values[$index].")\n";
+               if((isset($values[$index]))&&(!empty($values[$index]))){
+                       $str.= "# ".$name."\t(e.g. '".$values[$index]."')\n";
                }else{
-                       $str.= "# ".$name."\n";
+                       $str.= "# ".$name."\t("._("no example").")\n";
                }
        }
        $str .= "#\n".
@@ -97,6 +95,11 @@ class application extends plugin
 
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
+       $smarty= get_smarty();
+
        /* Do we represent a valid group? */
        if (!$this->is_account && $this->parent == NULL){
                 $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
@@ -104,8 +107,8 @@ class application extends plugin
                 return ($display);
        }
 
-       if(isset($_POST['ScriptTemplate'])){
-               $head = $this->generateTempalte();
+#      if(isset($_POST['ScriptTemplate'])){
+               $head = $this->generateTemplate();
                $scr  = $this->gotoLogonScript; 
                
                if(preg_match("/### END HEADER ###/",$scr)){
@@ -115,7 +118,7 @@ class application extends plugin
                }
 
                $this->gotoLogonScript = $head.$scr;
-       }
+#      }
        
        if((isset($_POST['upLoad']))&&(isset($_FILES['ScriptFile']))){
                $str = file_get_contents($_FILES['ScriptFile']['tmp_name']);
@@ -123,7 +126,6 @@ class application extends plugin
        }
  
        /* Fill templating stuff */
-       $smarty= get_smarty();
        $smarty->assign("cn", $this->cn);
        $smarty->assign("bases", $this->config->idepartments);
        if ($this->dn == "new"){
@@ -139,13 +141,14 @@ class application extends plugin
        $smarty->assign("rand", rand(0, 10000));
 
        /* Variables */
-       foreach(array("description", "gosaApplicationExecute", "gosaApplicationName") as $val){
+       foreach(array("description", "gosaApplicationExecute", "gosaApplicationName","cn") as $val){
                $smarty->assign($val, $this->$val);
                $smarty->assign($val."ACL", chkacl($this->acl, $val));
        }
 
        /* Checkboxes */
        foreach (array("G" => "exec_for_groupmembers", "O" => "overwrite_config",
+                       "L" => "place_on_kicker",
                        "D" => "place_on_desktop", "M" => "place_in_startmenu") as $key => $val){
                if (preg_match("/$key/", $this->gosaApplicationFlags)){
                        $smarty->assign("$val", "checked");
@@ -203,6 +206,9 @@ class application extends plugin
                if (isset($_POST['place_on_desktop']) && $_POST['place_on_desktop'] == 1){
                        $flag.= "D";
                }
+               if (isset($_POST['place_on_kicker']) && $_POST['place_on_kicker'] == 1){
+                       $flag.= "L";
+               }
                if (isset($_POST['place_in_startmenu']) && $_POST['place_in_startmenu'] == 1){
                        $flag.= "M";
                }