Code

Updated role management
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 1 Jul 2009 11:46:35 +0000 (11:46 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 1 Jul 2009 11:46:35 +0000 (11:46 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13868 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/roleManagement/admin/roleManagement/class_divListRole.inc
gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc
gosa-plugins/roleManagement/admin/roleManagement/class_roleManagement.inc
gosa-plugins/roleManagement/admin/roleManagement/roleGeneric.tpl
gosa-plugins/roleManagement/html/images/new.png [new file with mode: 0644]
gosa-plugins/roleManagement/html/images/occupant.png [new file with mode: 0644]
gosa-plugins/roleManagement/html/images/plugin.png [new file with mode: 0644]
gosa-plugins/roleManagement/html/images/role.png [new file with mode: 0644]

index 22c7f1d0ac03f55c910eb0935aa05e42f6464206..d83524efebff6eee981188c555dfe84352d02970 100644 (file)
@@ -154,11 +154,8 @@ class divListRole extends MultiSelectWindow
       $acl    = $ui->get_permissions($val['dn'],"roles/role");
       $acl_all= $ui->has_complete_category_acls($val['dn'],"roles");
 
-      // Add copy & cut functionality 
-      $actions = $this->parent->get_copypaste_action($val['dn'],"roles","role");
-
       // Create edit and remove icon buttons 
-      $actions.= "<input class='center' type='image'
+      $actions = "<input class='center' type='image'
         src='images/lists/edit.png' alt='"._("edit")."' 
         name='role_edit_%KEY%' title='"._("Edit this entry")."'>";
       $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module);
index 48c6c7570687702db120135210ac547c78bc1eb1..9fd6a3705834740e86a2b151f48ad4c516e170c1 100644 (file)
@@ -58,6 +58,7 @@ class roleGeneric extends plugin {
     $tmp = $this->allowedBasesToMoveTo();
     $smarty->assign("bases", $tmp);
     $smarty->assign("base_select",$this->base);
+    $smarty->assign("members",$this->convert_list());
     foreach($this->attributes as $attr){
       $smarty->assign($attr,$this->$attr);
     }
@@ -69,6 +70,20 @@ class roleGeneric extends plugin {
   }
 
 
+  function convert_list()
+  {
+    $temp= "";
+    foreach ($this->roleOccupant as $key => $value){
+      $temp.= "
+        <option title='".addslashes( $key)."' 
+        value=\"$key\" class=\"select\" 
+        >".$value['text']."</option>\n";
+    }
+
+    return ($temp);
+  }
+
+
   function save(){
     plugin::save();
 
index 598dcf80f5389ffedf68a3882d3bc5b7e1da4659..d3d9da484ce961cb43e7e9060f7e6d99849640a9 100644 (file)
@@ -68,7 +68,7 @@ class roleManagement extends plugin
     plugin::execute();
 
     /* Variables to restore after 'entry locked' warning was displayed */
-    session::set('LOCK_VARS_TO_USE',array('/^role_/'));
+    session::set('LOCK_VARS_TO_USE',array('/^role_/','/^act/','/^id/','/^menu_action/'));
 
     $smarty     = get_smarty();
     $s_action   = "";
@@ -113,7 +113,7 @@ class roleManagement extends plugin
      * New handling
      ***************/
 
-    if($s_action == "new"){
+    if($s_action == "new" && $this->dialog instanceOf tabs){
       $this->dialog = new roletabs($this->config, $this->config->data['TABS']['ROLETABS'], "new");
       $this->dialog->set_acl_base($this->DivListRoles->selectedBase);
     }
@@ -122,12 +122,28 @@ class roleManagement extends plugin
      * Edit handling
      ***************/
 
-    if($s_action == "edit"){
+    if($s_action == "edit" && !$this->dialog instanceOf tabs){
       if(!isset($this->roles[$s_entry])){
         trigger_error("Unknown entry!"); 
       }else{
+
         $entry = $this->roles[$s_entry];
-        $this->dialog = new roletabs($this->config, $this->config->data['TABS']['ROLETABS'], $entry['dn']);
+        $this->dn = $entry['dn'];
+
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($user= get_lock($this->dn)) != ""){
+          return(gen_locked_message ($user, $this->dn,TRUE));
+        }
+
+        /* Lock the current entry, so everyone will get the above dialog */
+        add_lock ($this->dn, $this->ui->dn);
+
+        /* Open the dialog */
+        $this->dialog = new roletabs($this->config, $this->config->data['TABS']['ROLETABS'], 
+            $entry['dn'], "roles");
+        $this->dialog->set_acl_base($this->dn);
+        set_object_info($this->dn);
       }
     }
 
@@ -135,25 +151,25 @@ class roleManagement extends plugin
      * Dialog handling
      ***************/
 
-    if (isset($_POST['edit_finish']) && $this->dialog instanceOf tabs){
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && $this->dialog instanceOf tabs){
       $this->dialog->save_object();
       $msgs = $this->dialog->check();
       if(count($msgs)){
         msg_dialog::displayChecks($msgs);
       }else{
         $this->dialog->save();
-        if(isset($this->grouptab->dn)){
+        if (!isset($_POST['edit_apply'])){
           $this->remove_lock();
+          $this->dialog= NULL;
+          set_object_info();
+        }else{
+          $this->dialog->re_init();
         }
-        $this->dialog= NULL;
-        set_object_info();
       }
     }
 
     if (isset($_POST['edit_cancel']) && $this->dialog instanceOf tabs){
-      if(isset($this->grouptab->dn)){
-        $this->remove_lock();
-      }
+      $this->remove_lock();
       $this->dialog= NULL;
       set_object_info();
     }
@@ -195,7 +211,7 @@ class roleManagement extends plugin
 
     // Add departments if subsearch is disabled 
     if(!$this->DivListRoles->SubSearch){
-      $this->DivListRoles->AddDepartments($this->DivListRoles->selectedBase,4,1);
+      $this->DivListRoles->AddDepartments($this->DivListRoles->selectedBase,3,1);
     }
     $this->reload ();
     $this->DivListRoles->setEntries($this->roles);
@@ -252,6 +268,14 @@ class roleManagement extends plugin
 
   function remove_lock()
   {
+    if (isset($this->dialog->dn)){
+      del_lock ($this->dialog->dn);
+    }elseif(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
+      del_lock($this->dn);
+    }
+    if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
+      del_lock($this->dns);
+    }
   }
 
 
index ca1fc0c226fbd7ef0e88dfc73f7b8a1f179e0a4f..f998551006936bd4d04656647be2d1186017a67c 100644 (file)
@@ -1,60 +1,93 @@
-<table>
-       <tr>
-               <td>{t}cn{/t}:</td>
-               <td>
-                       {render acl=$cnACL}
-                        <input type='text' value='{$cn}' name='cn'>
-                       {/render}
-               </td>
-       </tr>
-       <tr>
-               <td>{t}description{/t}:</td>
-               <td>
-                       {render acl=$descriptionACL}
-                        <input type='text' value='{$description}' name='description'>
-                       {/render}
-               </td>
-       </tr>
+<table style='width:100%;'>
   <tr>
-    <td>
-      <div style="height:10px;"></div>
-      <label for="base">{t}Base{/t}</label>
+    <td style='width:50%; vertical-align:top; border-right:1px solid #A0A0A0; padding-right:10px;'>
+
+      <h2><img src='plugins/roleManagement/images/role.png' alt='' class='center'>&nbsp;
+        {t}Generic{/t}
+      </h2>
+
+      <table style='width:100%;'>
+        <tr>
+          <td>{t}Name{/t}</td>
+          <td>
+            {render acl=$cnACL}
+             <input type='text' value='{$cn}' name='cn'>
+            {/render}
+          </td>
+        </tr>
+        <tr>
+          <td>{t}Description{/t}</td>
+          <td>
+            {render acl=$descriptionACL}
+             <input type='text' value='{$description}' name='description'>
+            {/render}
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <div style="height:10px;"></div>
+            <label for="base">{t}Base{/t}</label>
+          </td>
+          <td>
+            <div style="height:10px;"></div>
+      {render acl=$baseACL}
+            <select id="base" size="1" name="base" title="{t}Choose subtree to place user in{/t}">
+              {html_options options=$bases selected=$base_select}
+            </select>
+      {/render}
+      {render acl=$baseACL disable_picture='images/lists/folder_grey.png'}
+            <input type="image" name="chooseBase" src="images/lists/folder.png" class="center" 
+              title="{t}Select a base{/t}">
+      {/render}
+          </td>
+        </tr>
+        <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>
+            {render acl=$telephoneNumberACL}
+             <input type='text' value='{$telephoneNumber}' name='telephoneNumber'>
+            {/render}
+          </td>
+        </tr>
+        <tr>
+          <td>{t}Fax number{/t}</td>
+          <td>
+            {render acl=$facsimileTelephoneNumberACL}
+             <input type='text' value='{$facsimileTelephoneNumber}' name='facsimileTelephoneNumber'>
+            {/render}
+          </td>
+        </tr>
+      </table>
+
     </td>
-    <td>
-      <div style="height:10px;"></div>
-{render acl=$baseACL}
-      <select id="base" size="1" name="base" title="{t}Choose subtree to place user in{/t}">
-        {html_options options=$bases selected=$base_select}
+    <td style=' vertical-align:top; padding-left:10px;'>
+      <h2><img src='plugins/roleManagement/images/occupant.png' alt='' class='center'>&nbsp;
+        {t}Occupants{/t}
+      </h2>
+
+{render acl=$roleOccupantACL}
+      <select style="width:100%; height:450px;" id="members" name="members[]" size="15" multiple>
+        {$members}
       </select>
 {/render}
-{render acl=$baseACL disable_picture='images/lists/folder_grey.png'}
-      <input type="image" name="chooseBase" src="images/lists/folder.png" class="center" 
-        title="{t}Select a base{/t}">
+      <br>
+{render acl=$roleOccupantACL}
+      <input type=submit value="{msgPool type=addButton}" name="edit_membership">&nbsp;
+{/render}
+{render acl=$roleOccupantACL}
+      <input type=submit value="{msgPool type=delButton}" name="delete_membership">
 {/render}
     </td>
   </tr>
-       <tr>
-               <td>{t}x121Address{/t}:</td>
-               <td>
-                       {render acl=$x121AddressACL}
-                        <input type='text' value='{$x121Address}' name='x121Address'>
-                       {/render}
-               </td>
-       </tr>
-       <tr>
-               <td>{t}telephoneNumber{/t}:</td>
-               <td>
-                       {render acl=$telephoneNumberACL}
-                        <input type='text' value='{$telephoneNumber}' name='telephoneNumber'>
-                       {/render}
-               </td>
-       </tr>
-       <tr>
-               <td>{t}facsimileTelephoneNumber{/t}:</td>
-               <td>
-                       {render acl=$facsimileTelephoneNumberACL}
-                        <input type='text' value='{$facsimileTelephoneNumber}' name='facsimileTelephoneNumber'>
-                       {/render}
-               </td>
-       </tr>
-</table>
+</table>  
diff --git a/gosa-plugins/roleManagement/html/images/new.png b/gosa-plugins/roleManagement/html/images/new.png
new file mode 100644 (file)
index 0000000..318715a
Binary files /dev/null and b/gosa-plugins/roleManagement/html/images/new.png differ
diff --git a/gosa-plugins/roleManagement/html/images/occupant.png b/gosa-plugins/roleManagement/html/images/occupant.png
new file mode 100644 (file)
index 0000000..8f69e2b
Binary files /dev/null and b/gosa-plugins/roleManagement/html/images/occupant.png differ
diff --git a/gosa-plugins/roleManagement/html/images/plugin.png b/gosa-plugins/roleManagement/html/images/plugin.png
new file mode 100644 (file)
index 0000000..eb720b7
Binary files /dev/null and b/gosa-plugins/roleManagement/html/images/plugin.png differ
diff --git a/gosa-plugins/roleManagement/html/images/role.png b/gosa-plugins/roleManagement/html/images/role.png
new file mode 100644 (file)
index 0000000..3b82c19
Binary files /dev/null and b/gosa-plugins/roleManagement/html/images/role.png differ