Code

Fixed printer removal
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sun, 16 Oct 2005 13:51:19 +0000 (13:51 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sun, 16 Oct 2005 13:51:19 +0000 (13:51 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1573 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_printGeneric.inc
plugins/admin/systems/class_systemManagement.inc
plugins/admin/systems/class_workstationGeneric.inc
plugins/admin/systems/tabs_workstation.inc
plugins/admin/systems/workstation.tpl

index dea5899fdd2f1881f367cf2c323c6eaa12630a83..039be7bb61fc859d9ee13e79323a369f2d79d48e 100644 (file)
@@ -64,7 +64,7 @@ class printgeneric extends plugin
      */
     if((isset($this->attrs['objectClass']))&&(in_array("gotoWorkstation",$this->attrs['objectClass']))){
       $this->is_terminal = "true";   
-      $this->dn   = preg_replace("/ou=workstation/","ou=printer",$this->dn);
+      $this->dn   = preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
       $this->type = "station";
     }elseif((isset($this->attrs['objectClass']))&&(in_array("gotoTerminal",$this->attrs['objectClass']))){
       $this->type = "terminal";
@@ -352,6 +352,7 @@ class printgeneric extends plugin
 
   function remove_from_parent()
   {
+    $this->dn= preg_replace('/ou=workstations,/', 'ou=printers,', $this->dn);
     $ldap= $this->config->get_ldap_link();
     $ldap->rmdir($this->dn);
     show_ldap_error($ldap->get_error());
@@ -417,16 +418,20 @@ class printgeneric extends plugin
   /* Save to LDAP */
   function save()
   {
+    if (!$this->is_account){
+      return;
+    }
+    
     $dn= $this->dn;
     plugin::save();
     $ldap= $this->config->get_ldap_link();
    
     if((in_array("gotoTerminal",$this->attrs['objectClass']))){
-      $this->dn= preg_replace("/ou=terminal/","ou=printer",$this->dn);
+      $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn);
     }
     
     if((in_array("gotoWorkstation",$this->attrs['objectClass']))){
-      $this->dn= preg_replace("/ou=workstation/","ou=printer",$this->dn);
+      $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
     }
 
     /* We are currently editing a Terminal, so we want to save a seperate printer which cn is the terminla cn 
index 17f2fbe01e6e83b0b1c21b8b6e5e8b20a3ef3e9f..e0480b3bb3535d6afacb41958fb8a25a805acb0a 100644 (file)
@@ -206,7 +206,7 @@ class systems extends plugin
               $this->config->data['TABS']['WORKTABS'], $this->dn);
           $this->systab->set_acl ($this->acl);
           $this->systab->by_object['workgeneric']->cn= "wdefault";
-          $this->systab->by_object['termservice']->cn= "default";
+          $this->systab->by_object['workservice']->cn= "default";
           break;
 
         case 'server':
index 1b8775eced24032bf4e6891375fead677ad28722..062073468667b4b0858da34b2ebe4ccfc5be636c 100644 (file)
@@ -9,8 +9,6 @@ class workgeneric extends plugin
 
   /* Generic terminal attributes */
   var $gotoMode= "disabled";
-  var $gotoTerminalPath= "";
-  var $gotoSwapServer= "";
   var $gotoSyslogServer= "";
   var $gotoNtpServer= "";
   var $gotoSndModule= "";
@@ -31,6 +29,7 @@ class workgeneric extends plugin
   /* Needed values and lists */
   var $base= "";
   var $cn= "";
+  var $l= "";
   var $orig_dn= "";
 
   /* Plugin side filled */
@@ -38,11 +37,10 @@ class workgeneric extends plugin
 
   /* attribute list for save action */
   var $ignore_account= TRUE;
-  var $attributes= array("gotoMode", "gotoTerminalPath", "macAddress",
-      "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer",
+  var $attributes= array("gotoMode", "macAddress", "gotoSyslogServer", "gotoNtpServer",
       "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
       "ghCpuType", "ghMemSize", "ghUsbSupport", "ipHostNumber",
-      "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser");
+      "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l");
   var $objectclasses= array("top", "gotoWorkstation", "GOhard");
 
   function workgeneric ($config, $dn= NULL)
@@ -140,6 +138,7 @@ class workgeneric extends plugin
     /* Fill templating stuff */
     $smarty= get_smarty();
     $smarty->assign("cn", $this->cn);
+    $smarty->assign("l", $this->l);
     $smarty->assign("bases", $this->config->idepartments);
     $smarty->assign("staticAddress", "");
         
@@ -160,8 +159,7 @@ class workgeneric extends plugin
     $smarty->assign("ntpservers", $this->config->data['SERVERS']['NTP']);
 
     /* Variables */
-    foreach(array("base", "gotoMode", "gotoTerminalPath", "gotoSwapServer",
-          "gotoSyslogServer", "gotoNtpServer") as $val){
+    foreach(array("base", "gotoMode", "gotoSyslogServer", "gotoNtpServer") as $val){
 
       $smarty->assign($val."_select", $this->$val);
       $smarty->assign($val."ACL", chkacl($this->acl, $val));
@@ -205,10 +203,6 @@ class workgeneric extends plugin
     if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
       $this->base= $_POST['base'];
     }
-
-    /* Save terminal path to parent since it is used by termstartup, too */
-    $this->parent->by_object['termstartup']->gotoTerminalPath=
-      $this->gotoTerminalPath;
   }
 
 
@@ -257,7 +251,7 @@ class workgeneric extends plugin
     plugin::save();
 
     /* Strip out 'default' values */
-    foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){
+    foreach (array("gotoSyslogServer") as $val){
 
       if ($this->attrs[$val] == "default"){
         $this->attrs[$val]= array();
index 4f59e1d5685e0f424a7d3aaca32240cb626af6da..bb5b892a8bb03beccefc975df930e8e561b15b7c 100644 (file)
@@ -10,11 +10,8 @@ class worktabs extends tabs
 
   function save_object($save_current= FALSE)
   {
+echo "Take care of the l attribute. It needs to be synced in case of workstations.";
     tabs::save_object($save_current);
-
-    /* Update reference, transfer variables */
-    $this->by_object['termstartup']->gotoTerminalPath=
-      $this->by_object['workgeneric']->gotoTerminalPath;
   }
 
 
index 385a9e766c32ef6fde37add9bcbfea0ac80877d7..6ad9f4dff6efbd9c2f6ffbb9b0cfd441618c17e6 100644 (file)
      </td>
      {/if}
     </tr>
+    <tr>
+     <td><LABEL for="cn">{t}Location{/t}</LABEL></td>
+     <td>
+      <input name="l" id="l" size=18 maxlength=60 value="{$l}">
+     </td>
+    </tr>
+    <tr>
+     <td colspan=2>&nbsp;</td>
+    </tr>
     <tr>
      <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
      <td>
       </select>
      </td>
     </tr>
-   </table>
-
-  </td>
- </tr>
- <tr>
-  <td style="width:50%;">
-   <table summary="">
-    <tr><td colspan=2><div style="height:15px;"></div></td></tr>
-    <tr>
-     <td>{t}Root server{/t}</td>
-     <td>
-      <select name="gotoTerminalPath" title="{t}Select NFS root filesystem to use{/t}" {$gotoTerminalPathACL}>
-       {html_options values=$nfsservers output=$nfsservers selected=$gotoTerminalPath_select}
-      </select>
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Swap server{/t}</td>
-     <td>
-      <select name="gotoSwapServer" title="{t}Choose NFS filesystem to place swap files on{/t}" {$gotoSwapServerACL}>
-       {html_options values=$nfsservers output=$nfsservers selected=$gotoSwapServer_select}
-      </select>
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="vertical-align:top;">
-
-   <table summary="">
     <tr><td colspan=2><div style="height:15px;"></div></td></tr>
     <tr>
      <td><LABEL for="gotoSyslogServer">{t}Syslog server{/t}</LABEL></td>
@@ -87,7 +67,6 @@
      </td>
     </tr>
    </table>
-
   </td>
  </tr>
 </table>