From b8d5d6c801277e9aacbabec6932bd05f3c59b237 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 2 Jul 2009 14:13:18 +0000 Subject: [PATCH] Added occupant select class. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13875 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../roleManagement/class_occupantSelect.inc | 43 +++++++++++++++++++ .../roleManagement/class_roleGeneric.inc | 28 +++++++++--- .../roleManagement/class_roleManagement.inc | 40 +++++++++-------- .../admin/roleManagement/occupantSelect.tpl | 7 +++ .../admin/roleManagement/roleGeneric.tpl | 8 ---- 5 files changed, 94 insertions(+), 32 deletions(-) create mode 100644 gosa-plugins/roleManagement/admin/roleManagement/class_occupantSelect.inc create mode 100644 gosa-plugins/roleManagement/admin/roleManagement/occupantSelect.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 index 000000000..2d5856e40 --- /dev/null +++ b/gosa-plugins/roleManagement/admin/roleManagement/class_occupantSelect.inc @@ -0,0 +1,43 @@ +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: +?> diff --git a/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc b/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc index 37842a7ef..1892f8115 100644 --- a/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc +++ b/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc @@ -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")) )); } } diff --git a/gosa-plugins/roleManagement/admin/roleManagement/class_roleManagement.inc b/gosa-plugins/roleManagement/admin/roleManagement/class_roleManagement.inc index 1ea9cce88..b819f8195 100644 --- a/gosa-plugins/roleManagement/admin/roleManagement/class_roleManagement.inc +++ b/gosa-plugins/roleManagement/admin/roleManagement/class_roleManagement.inc @@ -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.= "

- -

"; - }else{ + $dialog_opened = ($this->dialog->by_object[$this->dialog->current]->dialog instanceOf plugin); + + if(!$dialog_opened){ + if($this->dialog->read_only == TRUE){ + $display.= "

+ +

"; + }else{ - $display.= "

\n"; - $display.= "\n"; - $display.= " \n"; - if ($this->dn != "new"){ - $display.= "\n"; + $display.= "

\n"; + $display.= "\n"; $display.= " \n"; + if ($this->dn != "new"){ + $display.= "\n"; + $display.= " \n"; + } + $display.= "\n"; + $display.= "

"; } - $display.= "\n"; - $display.= "

"; } return ($display); } diff --git a/gosa-plugins/roleManagement/admin/roleManagement/occupantSelect.tpl b/gosa-plugins/roleManagement/admin/roleManagement/occupantSelect.tpl new file mode 100644 index 000000000..0e5ccffbc --- /dev/null +++ b/gosa-plugins/roleManagement/admin/roleManagement/occupantSelect.tpl @@ -0,0 +1,7 @@ + +

+ +   + +

+ diff --git a/gosa-plugins/roleManagement/admin/roleManagement/roleGeneric.tpl b/gosa-plugins/roleManagement/admin/roleManagement/roleGeneric.tpl index f99855100..21c683edb 100644 --- a/gosa-plugins/roleManagement/admin/roleManagement/roleGeneric.tpl +++ b/gosa-plugins/roleManagement/admin/roleManagement/roleGeneric.tpl @@ -44,14 +44,6 @@

 


- - {t}X.121 Address{/t} - - {render acl=$x121AddressACL} - - {/render} - - {t}Phone number{/t} -- 2.30.2