Code

Some changes, 80% ready i think
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 25 Aug 2005 14:01:10 +0000 (14:01 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 25 Aug 2005 14:01:10 +0000 (14:01 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1220 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_environment.inc
plugins/personal/environment/class_logonManagementDialog.inc
plugins/personal/environment/logonManagement.tpl

index c3bfcd8362c44d921cc11363e749f9e58741d4aa..d0b694cff2058e0a40eba29cb767bcafec344e70 100644 (file)
@@ -238,10 +238,28 @@ class environment extends plugin
      * Perform add Delete edit Posts 
      */
 
-    $this->gotoLogonScripts = array("asdf"=>"one","aaaa"=>"two","121"=>"3");
-  
-    $smarty->assign("gotoLogonScripts",$this->gotoLogonScripts);
-    $smarty->assign("gotoLogonScriptKeys",array_flip($this->gotoLogonScripts));
+    /* Dialog Save */
+    if(isset($_POST['LogonSave'])){
+      $this->dialog->save_object();
+      if(count($this->dialog->check())!=0){
+        foreach($this->dialog->check() as $msg){
+          print_red($msg);
+        }
+      }else{
+        $tmp = $this->dialog->save();
+        unset($this->dialog);
+        $this->dialog=NULL;
+        $this->is_dialog=false;
+        $this->gotoLogonScripts[$tmp['LogonName']]=$tmp; 
+      }
+    }
+    
+    /* Dialog Quit without saving */
+    if(isset($_POST['LogonCancel'])){
+      $this->is_dialog= false;
+      unset($this->dialog);
+      $this->dialog= NULL;
+    }
    
     /* Check Edit Del New Posts for a selected LogonScript */ 
     if(isset($_POST['gotoLogonScriptNew'])||isset($_POST['gotoLogonScriptEdit'])||isset($_POST['gotoLogonScriptDel'])){
@@ -271,7 +289,11 @@ class environment extends plugin
         $this->dialog = new logonManagementDialog($this->config,$this->dn,$is_entry);
       }
     }
-    
+     
+    /* Append List to smarty*/
+    $smarty->assign("gotoLogonScripts",   $this->printOutLogonScripts());
+    $smarty->assign("gotoLogonScriptKeys",array_flip($this->printOutLogonScripts()));
+
     /* In this section server shares will be defined 
      * A user can select one of the given shares and a mount point
      *  and attach this combination to his setup.
@@ -473,7 +495,7 @@ class environment extends plugin
     if(isset($_POST['iamposted'])){
       plugin::save_object();
       foreach($this->attributes as $s_attr){
-        if(in_array($s_attr,array("gotoShares","gotoHotplugDevices","gotoPrinters"))) continue;
+        if(in_array($s_attr,array("gotoShares","gotoHotplugDevices","gotoPrinters","gotoLogonScripts"))) continue;
         if(isset($_POST[$s_attr])){
           $this->$s_attr = $_POST[$s_attr];
         }else{
@@ -688,28 +710,37 @@ function printOutHotPlugDevices()
     return($a_return);
   }
 
-/* Generates ListBox frienly output of used printer devices 
- * Append ' - admin' if printer is used in admin mode
- */
-function printOutPrinterDevices()
+  /* Generates ListBox frienly output of used printer devices 
  * Append ' - admin' if printer is used in admin mode
  */
+  function printOutPrinterDevices()
   {
-  $a_return = array();
-  if(is_array($this->gotoPrinters)){
-    foreach($this->gotoPrinters as $printer){
+    $a_return = array();
+    if(is_array($this->gotoPrinters)){
+      foreach($this->gotoPrinters as $printer){
         if($printer['mode'] == "admin"){
-         $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Admin");
+          $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Admin");
         }else{
-         $a_return[$printer['cn'][0]]= $printer['cn'][0]; 
+          $a_return[$printer['cn'][0]]= $printer['cn'][0]; 
         }
       }
     }
-  return($a_return);
+    return($a_return);
   }
 
-
-
-
-
+  /* Generates ListBox frienly output of used logonscripts 
+   */
+  function printOutLogonScripts()
+  {
+    print_a($this->gotoLogonScripts);
+    $a_return = array();
+    if(is_array($this->gotoLogonScripts)){
+      foreach($this->gotoLogonScripts as $script){
+        $a_return[$script['LogonName']]= $script['LogonName']; 
+      }
+    }
+    return($a_return);
+  }
 }
 
 
index 819cee44aa57150d33d6868f5ffa64d581551b09..55b16c7df4ed6135bc32ec4a0db1c6bedec8783d 100644 (file)
@@ -8,12 +8,15 @@ class logonManagementDialog extends plugin
 
   /* attribute list for save action */
   var $ignore_account       = TRUE;
-  var $attributes           = array();
+  var $attributes           = array("LogonName","LogonPriority","LogonLast","LogonOverload","LogonData");
   var $objectclasses        = array("whatever");
   var $use_existing         = false;  
 
-  var $baseDir              = "../kioskProfiles/";
-  var $filePrefix           = ".kioskProfile";
+  var $LogonName      ="";  // Name for the LogonScript
+  var $LogonPriority  ="";  // Priority defines the order in which the scripts will be processed 
+  var $LogonLast      ="";  // Is this script marked as the last, all following scripts will be skipped
+  var $LogonOverload  ="";  // If Overload is activated this script is overlaodable by a group script with same prio
+  var $LogonData      ="";  // The script itself
 
   function logonManagementDialog ($config, $dn= NULL,$use_existing=false )
   {
@@ -25,10 +28,44 @@ class logonManagementDialog extends plugin
   {
     $smarty= get_smarty();
     $display= "";
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+      if($this->$attr){
+        $smarty->assign($attr."CHK"," checked ");
+      }else{
+        $smarty->assign($attr."CHK","");
+      }
+    }
+    $prios=array(1,2,3,4,5,6,7,8,9,10);
+    $smarty->assign("LogonPrioritys",$prios);
+    $smarty->assign("LogonPriorityKeys",$prios);
     $display.= $smarty->fetch(get_template_path('logonManagement.tpl', TRUE,dirname(__FILE__)));
     return($display);
   }
 
+  function save_object()
+  {
+    if(isset($_POST['dialogissubmitted'])){
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr= $_POST[$attr]; 
+        }else{
+          $this->$attr = false;
+        }
+      }
+    }
+  }
+
+  function save()
+  {
+    $a_return= array();
+    foreach($this->attributes as $attr){
+      $a_return[$attr]=$this->$attr;
+    }  
+    return($a_return); 
+  }
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 2f204b947169ef00ee9f57e712fc8e987efa2818..d5abcbd682d0b6d28becd15c4fdcbc035b068021 100644 (file)
@@ -1 +1,62 @@
-TESTESSTEST
+<h2><img alt="" src="images/house.png" align="middle">&nbsp;{t}Logon management{/t}</h2>
+
+    <input type="hidden" name="dialogissubmitted" value="1">
+
+    <table summary="" width="100%">
+       <tr>
+                       <td width="50%">
+                                       <table>
+                                               <tr>
+                                                       <td>{t}Name{/t}
+                                                       </td>
+                                                       <td>
+                                                               <input type="text" value="{$LogonName}" name="LogonName">
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>{t}Priority{/t}
+                                                       </td>
+                                                       <td>
+                                               <select name="LogonPriority">
+                                                       {html_options values=$LogonPriorityKeys output=$LogonPrioritys}
+                                               </select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                       </td>
+                       <td>
+                                       <table>
+                                               <tr>
+                                                       <td>
+                                                               <input type="checkbox" value="L" name="LogonLast" {$LogonLastCHK}>
+                                                       </td>
+                                                       <td>{t}Last proceeded script{/t}
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               <input type="checkbox" value="O" name="LogonOverload" {$LogonOverloadCHK}>
+                                                       </td>
+                                                       <td>{t}Overloadable{/t}
+                                                       </td>
+                                               </tr>
+                                       </table>
+                       </td>
+               </tr>
+               <tr>
+                       <td colspan="2">
+                                       <table width="80%">
+                                               <tr>
+                                                       <td>
+                                                               <textarea style="width:100%;height:400px;" name="LogonData">{$LogonData}</textarea>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                       </td>
+               </tr>
+       <table> 
+
+    <p align="right">
+    <input type="submit" name="LogonSave"     value="{t}Use{/t}">
+    <input type="submit" name="LogonCancel"   value="{t}Cancel{/t}">
+    </p>