Code

Added http://servername/ppd/ to gotoPrinterPPD
[gosa.git] / plugins / admin / fai / class_faiTemplate.inc
index fd30c52e0204386f0fd2096d3695b4e62262815a..ed4eb8a8212ffb4f3983c9227d389c744842ff4e 100644 (file)
@@ -24,8 +24,8 @@ class faiTemplate extends plugin
   var $subClassName     = "faiTemplateEntry";      
 
   /* Attributes to initialise for each subObject */
-  var $subAttributes    = array("cn","description","FAItemplateFile","FAItemplatePath"); 
-  var $sub64coded       = array("FAItemplateFile","FAItemplatePath");
+  var $subAttributes    = array("cn","description","FAItemplateFile","FAItemplatePath","FAIowner","FAImode"); 
+  var $sub64coded       = array();
 
   /* Specific attributes */
   var $cn               = "";       // The class name for this object
@@ -64,19 +64,23 @@ class faiTemplate extends plugin
         }
 
         foreach($this->sub64coded as $codeIt){
-          $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
+          $this->SubObjects[$object['cn'][0]][$codeIt]= base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
         }       
 
-        $this->SubObjects[$object['cn'][0]]['FAItemplateFile'] =base64_decode($this->readBinary("FAItemplateFile",$object['dn']));
+        $this->SubObjects[$object['cn'][0]]['FAItemplateFile']= $this->readBinary("FAItemplateFile",$object['dn']);
        
-        $this->SubObjects[$object['cn'][0]]['status']      = "edited";
-        $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
+        $this->SubObjects[$object['cn'][0]]['status']= "edited";
+        $this->SubObjects[$object['cn'][0]]['dn']= $object['dn'];
       }
+      ksort($this->SubObjects);
     }
   }
 
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
     /* Fill templating stuff */
     $smarty= get_smarty();
     $display= "";
@@ -87,9 +91,11 @@ class faiTemplate extends plugin
       $this->is_dialog=true;
     }
 
+    $_SESSION['objectinfo'] = $this->dn;
     /* Edit selected Sub Object */
     if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
       $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$_POST['SubObject']]);
+      $_SESSION['objectinfo'] = $this->SubObjects[$_POST['SubObject']]['dn'];
       $this->is_dialog=true;
     }
     
@@ -127,6 +133,7 @@ class faiTemplate extends plugin
         $this->is_dialog=false;
         unset($this->dialog);
         $this->dialog=NULL;
+        ksort($this->SubObjects);
       }
     }
 
@@ -194,10 +201,12 @@ class faiTemplate extends plugin
    */
   function save_object()
   {
-    plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = $_POST[$attrs];
+    if(isset($_POST['FAItemplate_posted'])){
+      plugin::save_object();
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        } 
       }
     }
   }