Code

Added inherit Button to terminal Generic
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 12 Jul 2007 08:27:02 +0000 (08:27 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 12 Jul 2007 08:27:02 +0000 (08:27 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6843 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_terminalGeneric.inc
plugins/admin/systems/terminal.tpl

index 353ee0d324e67eeeaaaecd467bb0f957faf3256e..5a9f52357e450a8afc5acdb9c24874c07f9759b9 100644 (file)
@@ -52,6 +52,8 @@ class termgeneric extends plugin
 
   var $fai_activated = FALSE;
 
+  var $member_of_ogroup = FALSE;
+
   function termgeneric ($config, $dn= NULL, $parent= NULL)
   {
     /* Check if FAI is activated */
@@ -61,6 +63,14 @@ class termgeneric extends plugin
     }
 
     plugin::plugin ($config, $dn, $parent);
+
+    if(!isset($this->parent->by_object['ogroup'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd ($this->config->current['BASE']);
+      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))",array("cn"));
+      $this->member_of_ogroup = $ldap->count() >= 1;
+    }
+
     $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
     /* Read arrays */
     foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
@@ -308,6 +318,9 @@ class termgeneric extends plugin
     $smarty->assign("netconfig", $this->netConfigDNS->execute());
     $smarty->assign("fai_activated",$this->fai_activated);
     $smarty->assign("actionACL", chkacl($this->acl, 'action'));
+
+    $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
+
     return($smarty->fetch (get_template_path('terminal.tpl', TRUE)));
   }
 
@@ -343,6 +356,11 @@ class termgeneric extends plugin
   {
     plugin::save_object();
     $this->netConfigDNS->save_object();
+
+    if(isset($_POST["inheritAll"])){
+      $this->set_everything_to_inherited();
+    }
+
     /* Save base, since this is no LDAP attribute */
     if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
       $this->base= $_POST['base'];
@@ -503,6 +521,24 @@ class termgeneric extends plugin
     show_ldap_error($ldap->get_error(), _("Saving terminal failed"));
   }
 
+
+  function set_everything_to_inherited()
+  {
+    /* Set workstation service attributes to inherited */
+    if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){
+      foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant",
+            "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseType") as $name){
+        $this->parent->by_object['termservice']->$name = "default";
+      }
+    }
+
+    /* Set workstation startup attributes to inherited */
+    if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){
+      $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited";
+      $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited";
+    }
+  }
+
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 677297a6337b93e2e2a950dcb924443cd188a1bc..60b4cb32ca159d4cc27b42bcc52f311b0a134bcc 100644 (file)
         {/if}
                </td>
     </tr>
+{if $member_of_ogroup}
+   <tr>
+          <td>
+                  {t}Inheritance{/t}
+          </td>
+          <td>
+                       <input type='submit' name='inheritAll' value='{t}Inherit all{/t}'>
+          </td>
+   </tr>
+{/if}
    </table>
   </td>
   <td style="vertical-align:top;border-left:1px solid #A0A0A0;" >