Code

Added occupant select class.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 2 Jul 2009 14:13:18 +0000 (14:13 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 2 Jul 2009 14:13:18 +0000 (14:13 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13875 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/roleManagement/admin/roleManagement/class_occupantSelect.inc [new file with mode: 0644]
gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc
gosa-plugins/roleManagement/admin/roleManagement/class_roleManagement.inc
gosa-plugins/roleManagement/admin/roleManagement/occupantSelect.tpl [new file with mode: 0644]
gosa-plugins/roleManagement/admin/roleManagement/roleGeneric.tpl

diff --git a/gosa-plugins/roleManagement/admin/roleManagement/class_occupantSelect.inc b/gosa-plugins/roleManagement/admin/roleManagement/class_occupantSelect.inc
new file mode 100644 (file)
index 0000000..2d5856e
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+/*
+* This code is part of GOsa (http://www.gosa-project.org)
+* Copyright (C) 2003-2008 GONICUS GmbH
+*
+* ID: $$Id: class_roleManagement.inc 13520 2009-03-09 14:54:13Z hickert $$
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+
+class occupantSelect  extends plugin {
+  function __construct($config, $dn, $parent){
+    $this->config = $config;
+    $this->dn = $dn;
+    $this->parent = $parent;
+  }
+  
+
+  function execute()
+  {
+    $smarty = get_smarty();
+  
+    
+  
+    return($smarty->fetch(get_template_path("occupantSelect.tpl",TRUE, dirname(__FILE__))));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
index 37842a7ef4659a034b09cbf67f9332c6a4233f8e..1892f8115e5f6f51928159aa6445b81abf949203 100644 (file)
@@ -28,7 +28,6 @@ class roleGeneric extends plugin {
   var $description ="";
   var $telephoneNumber = "";
   var $facsimileTelephoneNumber = "";
-  var $x121Address = "";
   var $roleOccupant = array();
 
   // The objects base 
@@ -43,7 +42,7 @@ class roleGeneric extends plugin {
   var $objectclasses = array("top","organizationalRole");
 
   // A list of attributes managed by this plugin
-  var $attributes = array("cn","x121Address","description",
+  var $attributes = array("cn","description",
     "telephoneNumber","facsimileTelephoneNumber","roleOccupant");
  
 
@@ -74,6 +73,22 @@ class roleGeneric extends plugin {
     // Get list of possible ldap bases, will be selectable in the ui.
     $tmp = $this->allowedBasesToMoveTo();
 
+
+    /***************
+     * Dialog handling
+     ***************/
+
+    if(isset($_POST['edit_membership']) && !$this->dialog instanceOf plugin){
+      $this->dialog = new occupantSelect($this->config,$this->dn,$this);
+    }
+
+    if($this->dialog instanceOf plugin){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+
+
+
     // Get smarty instance and assign required variables.
     $smarty = get_smarty();
     $smarty->assign("bases", $tmp);
@@ -198,6 +213,7 @@ class roleGeneric extends plugin {
       $tmp->update_acl_membership($this->orig_dn,$this->dn);
     }
 
+    // Log action
     if($mode == "modify"){
       new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
     }else{
@@ -210,12 +226,13 @@ class roleGeneric extends plugin {
    */
   function allowedBasesToMoveTo()
   {
-    /* Get bases */
     $bases  = $this->get_allowed_bases();
     return($bases);
   }
 
-
+  
+  /* Save HTML inputs
+   */
   function save_object()
   {
     plugin::save_object();  
@@ -242,8 +259,7 @@ class roleGeneric extends plugin {
             "base" => _("Base"),
             "telephoneNumber" => _("Telefon number"),
             "facsimileTelephoneNumber" => _("Fax number"),
-            "roleOccupant" => _("Occupants"),
-            "x121Address" => _("X.121 Address"))
+            "roleOccupant" => _("Occupants"))
           ));
   }
 }
index 1ea9cce8851723f02ec33126349c78135d2734db..b819f8195ac66047e3e5be97c29c2b1776148d5d 100644 (file)
@@ -67,18 +67,18 @@ class roleManagement extends plugin
     // Call parent execute 
     plugin::execute();
 
-    /* Variables to restore after 'entry locked' warning was displayed */
+    // Variables to restore after 'entry locked' warning was displayed 
     session::set('LOCK_VARS_TO_USE',array('/^role_/','/^act/','/^id/','/^menu_action/','/^item/'));
 
     $smarty     = get_smarty();
-    $s_action   = "";
-    $s_entry    = "";
 
     /***************
      * Handle _POST/_GET variables
      ***************/
    
     // Get entry related posts 
+    $s_action   = "";
+    $s_entry    = "";
     foreach($_POST as $name => $value){
       if(preg_match("/^role_edit_/",$name)){
         $s_action = "edit";  
@@ -264,24 +264,28 @@ class roleManagement extends plugin
     if($this->dialog instanceOf tabs){
       $display= $this->dialog->execute();
 
-      if($this->dialog->read_only   == TRUE){
-        $display.= "<p style=\"text-align:right\">
-          <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
-          </p>";
-      }else{
+      $dialog_opened = ($this->dialog->by_object[$this->dialog->current]->dialog instanceOf plugin);
+
+      if(!$dialog_opened){
+        if($this->dialog->read_only   == TRUE){
+          $display.= "<p style=\"text-align:right\">
+            <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
+            </p>";
+        }else{
 
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" 
-          value=\"".msgPool::okButton(). "\">\n";
-        $display.= "&nbsp;\n";
-        if ($this->dn != "new"){
-          $display.= "<input type=submit name=\"edit_apply\" 
-            value=\"".msgPool::applyButton()."\">\n";
+          $display.= "<p style=\"text-align:right\">\n";
+          $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" 
+            value=\"".msgPool::okButton(). "\">\n";
           $display.= "&nbsp;\n";
+          if ($this->dn != "new"){
+            $display.= "<input type=submit name=\"edit_apply\" 
+              value=\"".msgPool::applyButton()."\">\n";
+            $display.= "&nbsp;\n";
+          }
+          $display.= "<input type=submit name=\"edit_cancel\" 
+            value=\"".msgPool::cancelButton()."\">\n";
+          $display.= "</p>";
         }
-        $display.= "<input type=submit name=\"edit_cancel\" 
-          value=\"".msgPool::cancelButton()."\">\n";
-        $display.= "</p>";
       }
       return ($display);
     }
diff --git a/gosa-plugins/roleManagement/admin/roleManagement/occupantSelect.tpl b/gosa-plugins/roleManagement/admin/roleManagement/occupantSelect.tpl
new file mode 100644 (file)
index 0000000..0e5ccff
--- /dev/null
@@ -0,0 +1,7 @@
+
+<p class="plugbottom">
+       <input type=submit name="occupants_save" value="{msgPool type=addButton}">
+               &nbsp;
+       <input type=submit name="occupants_cancel" value="{msgPool type=cancelButton}">
+</p>
+
index f998551006936bd4d04656647be2d1186017a67c..21c683edb5e5ef9fd755c91b9191cdbae2fbb6dc 100644 (file)
         <tr>
           <td colspan="2"><p class="seperator">&nbsp;</p><br></td>
         </tr>
-        <tr>
-          <td>{t}X.121 Address{/t}</td>
-          <td>
-            {render acl=$x121AddressACL}
-             <input type='text' value='{$x121Address}' name='x121Address'>
-            {/render}
-          </td>
-        </tr>
         <tr>
           <td>{t}Phone number{/t}</td>
           <td>