Code

Updated department listing
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 Oct 2009 15:53:53 +0000 (15:53 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 Oct 2009 15:53:53 +0000 (15:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14675 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/departments/class_departmentManagement.inc
gosa-core/plugins/admin/departments/dep-filter.tpl [new file with mode: 0644]
gosa-core/plugins/admin/departments/dep-filter.xml [new file with mode: 0644]
gosa-core/plugins/admin/departments/dep-list.tpl [new file with mode: 0644]
gosa-core/plugins/admin/departments/dep-list.xml [new file with mode: 0644]
gosa-core/plugins/admin/departments/main.inc

index 5b50389e7a0c56b963d73b236819b47d98813b7a..170c562f4e1e6db38a8b696ff3392b174ba04180 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-class departmentManagement extends plugin
+class departmentManagement extends management
 {
-  /* Definitions */
-  var $plHeadline= "Departments";
-  var $plDescription= "Manage Departments";
+  var $plHeadline     = "Departments";
+  var $plDescription  = "Manage departmentw";
 
-  /* Headpage attributes */
-  var $last_dep_sorting= "invalid";
-  var $departments= array();
-  var $deptabs= NULL;
+  // Tab definition 
+  protected $tabClass = "deptabs";
+  protected $tabType = "DEPTABS";
+  protected $aclCategory = "departement";
+  protected $aclPlugin   = "generic";
+  protected $objectName   = "department";
 
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-
-  /* Vars to handle operations after saving the department 
-     Recursive move && tagging   */
-  var $ObjectInSaveMode         = false;    // Is true, if current object wasn't saved right now
-  var $dns = array();
-
-  var $acl_module = array("department");
-
-  function departmentManagement (&$config, &$ui)
-  {
-    $this->ui= &$ui;
-    $this->dn= "";
-    $this->config= &$config;
-    $this->DivListDepartment = new divListDepartment($this->config,$this);
-  }
-
-  function execute()
+  function __construct($config,$ui)
   {
-    global $config;
-    /* Call parent execute */
-    plugin::execute();
-
-    /***************
-      Var init 
-     ***************/
-
-    session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^dep_edit_.*/","/^dep_del_.*/","/^item_selected/","/^remove_multiple_departments/","/^menu_action/"));
-
-    /* Reload departments */
-    $smarty                                            = get_smarty();
-    $display                                   = "";
-    $s_action                                  = "";  // Will contain an action, like del or edit
-    $s_entry                                   = "";  // The entry name for edit delete -...
-
-
-    /***************
-      Check posts  
-     ***************/
-
-    // Check Post action
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/dep_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/dep_".$s_action."_/i","",$key);
-        $s_entry  = preg_replace("/_.*$/","",$s_entry);
-        // Post for edit
-      }elseif(preg_match("/dep_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/dep_".$s_action."_/i","",$key);
-        $s_entry  = preg_replace("/_.*$/","",$s_entry);
-        // Post for new
-      }elseif(preg_match("/^remove_multiple_departments/",$key)){
-        $s_action="del_multiple";
-      }
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && preg_match("/^dep_new_/",$_POST['menu_action'])){
-      $s_action = "new";
-      $s_entry  = preg_replace("/^dep_new_([a-z]*)/","\\1",$_POST['menu_action']);
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-
-    /***************
-      Create a new department
-     ***************/
-
-    /* New Entry if Posted action (s_action) == new
-     */
-    if ($s_action=="new"){
-      $this->dn= "new";
-
-      $types = $this->get_support_departments();
-      $type = "";
-      foreach($types as $key => $data){
-        if($data['OC'] == $s_entry){
-          $type = $key;
-          break;
-        }
-      }
-
-      if(isset($types[$type])){
-        $tab = $types[$type]['TAB'];
-        $acl = $types[$type]['ACL'];
-        $this->deptabs= new deptabs($this->config, $this->config->data['TABS'][$tab], $this->dn, "department");
-        $this->deptabs->set_acl_base($this->DivListDepartment->selectedBase);
-      }else{
-        trigger_error("Invalid / Not implemented countainer type.");
-      }
-    }
-
-
-    /***************
-      Edit entry
-     ***************/
-
-    /* Edit Entry if Posted action (s_action) == edit 
-     * The entry which will be edited is defined in $s_entry
-     */
-    if (( $s_action=="edit") && (!isset($this->deptabs->config))){
-
-      $types = $this->get_support_departments();
-
-      $this->dn= $this->departments[trim($s_entry)]['dn'];
-      $entry   = $this->departments[trim($s_entry)];
-
-      /* Detect department type 
-       */ 
-      $data = array();
-      foreach($types as $oc => $type){
-        if(in_array($oc,$entry['objectClass'])){
-          $data = $type;
-          break;
-        }
-      }
-
-      /* Check if the department type was editable 
-       */
-      if(!count($data)){
-        trigger_error("Unknown department type skipped '".$this->dn."'.");
-      }elseif(empty($data['TAB'])){
-        // Do nothing, this object is currently not editable
-      }else{
-
-        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);
-
-        /* Register deptabs to trigger edit dialog */
-        $this->deptabs= new deptabs($this->config,$this->config->data['TABS'][$data['TAB']], $this->dn,"department");
-        $this->deptabs->set_acl_base($this->dn);
-
-        set_object_info($this->dn);
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple" || $s_action == "del"){
-
-      if($s_action == "del"){
-        $ids = array($s_entry);
-      }else{
-        $ids = $this->list_get_selected_items();
-      }
-
-      if(count($ids)){
-        $this->dns = array();
-        foreach($ids as $id){
-          $this->dns[$id] = $dn = $this->departments[$id]['dn'];
-        }
-
-        /* Check locks */
-        if ($user= get_multiple_locks($this->dns)){
-          return(gen_locked_message($user,$this->dns));
-        }
-
-        $dns_names = array();
-        foreach($this->dns as $dn){
-          $dns_names[] = LDAP::fix($dn);
-        }
-        add_lock ($this->dns, $this->ui->dn);
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        $smarty->assign("info", msgPool::deleteInfo($dns_names));
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
+    $this->config = $config;
+    $this->ui = $ui;
    
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_department_confirm'])){
-
-      /* Do not remove departments that will already be deleted by its parents 
-       */
-      foreach($this->dns as $key => $dn){
-        foreach($this->dns as $key2 => $dn2){
-          if($dn == $dn2) continue;
-          if(preg_match("/".preg_quote($dn,'/')."$/",$dn2)){
-            unset($this->dns[$key2]);
-          }
-        }
-      }
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-        $acl = $this->ui->get_permissions($dn,"department/department");
-        if (preg_match('/d/', $acl)){
-
-         /* Delete request is permitted, perform LDAP action */
-          $this->deptabs= new deptabs($this->config,$this->config->data['TABS']['DEPTABS'], $dn,"department");
-          $this->deptabs->set_acl_base();
-          $this->deptabs->delete ();
-          $this->deptabs = NULL;
-        } else {
-          msg_dialog::display(_("Permission error"), msgPool::permDelete(), WARNING_DIALOG);
-        }
-      }
-
-      /* Remove lock file after successfull deletion */
-      $this->remove_lock();
-      $this->dns = array();
-    }
-
+    $this->storagePoints = array("");
  
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
+    // Build filter
+    #if (session::global_is_set(get_class($this)."_filter")){
+      $filter= session::global_get(get_class($this)."_filter");
+#    } else {
+      $filter = new filter(get_template_path("dep-filter.xml", true));
+ #     $filter->setObjectStorage($this->storagePoints);
+ #   }
+    $this->setFilter($filter);
 
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_department_cancel'])){
+    // Build headpage
+    $headpage = new listing(get_template_path("dep-list.xml", true));
+    $headpage->registerElementFilter("depLabel", "departmentManagement::filterDepLabel");
+    $headpage->setFilter($filter);
 
-      /* Remove lock file after successfull deletion */
-      $this->remove_lock();
-      $this->dns = array();
+    // Add copy&paste and snapshot handler.
+    if ($this->config->boolValueIsTrue("main", "copyPaste")){
+      $this->cpHandler = new CopyPasteHandler($this->config);
     }
-
-
-    /***************
-      Handle tagging/recursive move (Return output for an iframe)
-     ***************/
-
-    /* initiate recursive remove  (Is called from iframe, generates output)*/
-    if(isset($_GET['PerformRecMove'])){
-      $this->deptabs->move_me();
-      $this->DivListDepartment->selectedBase = $this->deptabs->by_object['department']->dn;  
-      exit();
-    }
-
-    /* This department must be tagged (Is called from iframe, generates output)*/
-    if(isset($_GET['TagDepartment'])){
-      $base_name = $this->deptabs->base_name;
-      $this->deptabs->by_object[$base_name]->tag_objects();
-      exit();  
-    }
-
-
-    /***************
-      Edit department finished 
-     ***************/
-
-    if (is_object($this->deptabs) &&          // Ensure we have a valid deptab here 
-        (isset($_POST['edit_finish']) ||      // If 'Save' button is pressed in the edit dialog.
-         isset($_POST['dep_move_confirm']) || // The move(rename) confirmation was given
-         $this->deptabs->move_done())){       // The move(rename) is done, we have to save the rest now.
-
-      /* Check tabs, will feed message array.
-         This call will also initiate a sav_object() call.
-          So don't move it below the moved check !.
-       */
-      $message= $this->deptabs->check();
-
-      /*************
-        MOVED ? 
-         Check if this department has to be moved 
-       *************/  
-      if(!isset($_POST['dep_move_confirm']) && $this->deptabs->am_i_moved()){
-        return($smarty->fetch(get_template_path("dep_move_confirm.tpl",TRUE)));
-      }elseif(isset($_POST['dep_move_confirm']) && $this->deptabs->am_i_moved()){
-        $smarty = get_smarty();
-        $smarty->assign("src","?plug=".$_GET['plug']."&amp;PerformRecMove&no_output_compression");
-        $smarty->assign("message",_("As soon as the move operation has finished, you can scroll down to end of the page and press the 'Continue' button to continue with the department management dialog."));
-        return($smarty->fetch(get_template_path("dep_iframe.tpl",TRUE)));
-      }
-
-      /* Save, or display error message? */
-      if (count($message) == 0){
-        global $config;
-
-        $this->deptabs->save();
-        $config->get_departments();
-        $config->make_idepartments();
-        $this->config = $config;
-
-        /* This var indicated that there is an object which isn't saved right now. */
-        $this->ObjectInSaveMode = true;
-
-        /* This object must be tagged, so set ObjectTaggingRequested to true */
-        if($this->deptabs->by_object[$this->deptabs->base_name]->must_be_tagged()){
-          $smarty = get_smarty();
-          $smarty->assign("src","?plug=".$_GET['plug']."&TagDepartment&no_output_compression");
-          $smarty->assign("message",_("As soon as the tag operation has finished, you can scroll down to end of the page and press the 'Continue' button to continue with the department management dialog."));
-          return($smarty->fetch(get_template_path("dep_iframe.tpl",TRUE)));
-        }              
-
-      } else {
-        /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        msg_dialog::displayChecks($message);
-      }
-    }
-
-
-   /***************
-     In case of tagging/moving the object wasn't deleted, do it know
-    ***************/
-
-   /* If there is an unsaved object and all operations are done
-      remove locks & save object tab & unset current object */
-   if($this->ObjectInSaveMode){
-     $this->config->get_departments();
-     $this->ObjectInSaveMode = false;
-     if ($this->dn != "new"){
-       $this->remove_lock();
-     }
-     unset ($this->deptabs);
-     $this->deptabs= NULL;
-     set_object_info();
-   }
-
-
-   /***************
-      Dialog canceled  
-     ***************/
-
-    /* User canceled edit oder delete
-     * Cancel dialog 
-     */
-    if (isset($_POST['edit_cancel']) || isset($_POST['delete_cancel']) || isset($_POST['delete_department_confirm'])){
-      $this->remove_lock();
-      $this->deptabs= NULL;
-      set_object_info();
-    }
-
-    /* Headpage or normal plugin screen? */
-    if ($this->deptabs !== NULL){
-
-      /* Show main page (tabs) */
-      $display= $this->deptabs->execute();
-      if(($this->deptabs instanceOf tabs || $this->deptabs instanceOf plugin) && $this->deptabs->read_only == TRUE){
-        $display.= "<p style=\"text-align:right\">
-          <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
-          </p>";
-      }elseif (!$this->deptabs->by_object[$this->deptabs->current]->dialog){
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=submit name=\"edit_finish\" value=\"".msgPool::okButton()."\">\n";
-        $display.= "&nbsp;\n";
-        $display.= "<input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
-        $display.= "</p>";
-      }
-      return ($display);
-    }else{
-      /* Display dialog with group list */
-      $this->DivListDepartment->parent = $this;
-      $this->DivListDepartment->execute();
-      $this->reload();
-      $this->DivListDepartment->DepartmentsAdded = true;
-      $this->DivListDepartment->setEntries($this->departments);
-      return($this->DivListDepartment->Draw());
-    }
-  }
-
-
-  function reload()
-  {
-    /* Vairaible init */
-    $base         = $this->DivListDepartment->selectedBase;
-    $base_back    = preg_replace("/^[^,]+,/","",$base);
-    $Regex        = $this->DivListDepartment->Regex;
-  
-    // Create Array to Test if we have a valid back button
-    $config = session::get('config');
-    $tmp = $config->idepartments;
-
-    $types = $this->get_support_departments();
-
-    /* Create search filter for each department type
-     */
-
-    /* Get all departments within this subtree */
-    $s_filter = "";
-    $s_attrs  = array("description","objectClass");
-    $s_acls   = array();
-    foreach($types as $oc => $data){
-      $s_filter.= "(&(objectClass=gosaDepartment)(objectClass=".$data['OC'].")".
-        "(|(".$data['ATTR']."=".$Regex.")(description=".$Regex.")))";
-      $s_attrs[]= $data['ATTR'];
-      $s_acls[] = "department/".$data['ACL'];
-    }
-
-    if($this->DivListDepartment->SubSearch){
-      $res = get_list("(|".$s_filter.")",$s_acls,$base,$s_attrs,GL_SIZELIMIT | GL_SUBSEARCH);
-    }else{
-      $res = get_list("(|".$s_filter.")",$s_acls,$base,$s_attrs,GL_SIZELIMIT);
-    }
-
-    /* Prepare list (sortable index) 
-     */
-    $deps = array();
-    $this->departments = array();
-    foreach($res as $attr){
-
-      /* Don't display base as entry on subsearch */
-      if(($attr['dn'] == $base) && ($this->DivListDepartment->SubSearch)){
-        continue;
-      }
-
-      /* Detect type and create sortable index 
-       */
-      $found =FALSE;
-      foreach($types as $oc => $data){
-        if(in_array($data['OC'],$attr['objectClass']) && isset($attr[$data['ATTR']][0])){
-          $name = $attr[$data['ATTR']][0]."-".$attr['dn'];
-          $deps[$name] = $attr;
-          $found =TRUE;
-          break;
-        }
-      }
-    }
-    uksort($deps, 'strnatcasecmp');
-
-    /* In case of a valid back button create entry 
-     */
-    if(isset($tmp[$base])){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->cat($base );
-      $attr = $ldap->fetch();
-      foreach($types as $oc => $type){
-        if(in_array($oc,$attr['objectClass'])){
-          $attr[$type['ATTR']][0] = ".";
-        }
-      }
-      if(isset($attr['description'])){
-         unset($attr['description']);
-      }
-      $deps= array_merge(array($attr),$deps);
+    if($this->config->get_cfg_value("enableSnapshots") == "true"){
+      $this->snapHandler = new SnapshotHandler($this->config);
     }
 
-    $this->departments = array_values($deps);
-  }
-
-  function remove_from_parent()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-    $ldap->recursive_remove();
-
-    /* Optionally execute a command after we're done */
-    $this->postremove();
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-    }
+    parent::__construct($config, $ui, "departments", $headpage);
 
+    $this->registerAction("open","openEntry");
   }
 
-
-  function list_get_selected_items()
+  function openEntry($action,$entry)
   {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[a-z0-9\\/\=]*$/i",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
+    $this->headpage->setBase(array_pop($entry));
   }
 
 
-  function remove_lock()
+  static function filterDepLabel($row,$dn,$params,$ou,$pid,$base)
   {
-    if(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);
+    $ou = $ou[0];
+    if($dn == $base){
+      $ou =".";
     }
+    $dn= LDAP::fix(func_get_arg(1));
+    return("<a href='?plug=".$_GET['plug']."&amp;PID=$pid&amp;act=listing_open_$row' title='$dn'>$ou</a>");
   }
 
-  function save_object()
-  {
-    /* reload department */
-#    $this->config->get_departments();
-#    $this->config->make_idepartments();
-    $this->DivListDepartment->config= $this->config;
-    $this->DivListDepartment->save_object();
-  }
 
 
   /*! \brief  Returns information about all container types that GOsa con handle.
@@ -616,7 +162,6 @@ class departmentManagement extends plugin
     $types['organizationalUnit']['TITLE']   = _("Department");
     $types['organizationalUnit']['TPL']     = "generic.tpl";
 
-
 #  /* Alias
 #   */
 #  $types['alias']['ACL']     = "alias";
@@ -643,6 +188,6 @@ class departmentManagement extends plugin
 
     return($types);
   }
-}
+} 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
diff --git a/gosa-core/plugins/admin/departments/dep-filter.tpl b/gosa-core/plugins/admin/departments/dep-filter.tpl
new file mode 100644 (file)
index 0000000..e356485
--- /dev/null
@@ -0,0 +1,31 @@
+<div class="contentboxh">
+ <p class="contentboxh">
+  <img src="images/launch.png" align="right" alt="[F]">{t}Filter{/t}
+ </p>
+</div>
+
+<div class="contentboxb">
+
+<div style="border-top:1px solid #AAAAAA"></div>
+
+ <div style="border-top:1px solid #AAAAAA"></div>
+ {$SCOPE}
+
+ <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+  <tr>
+   <td>
+    <label for="NAME">
+     <img src="images/lists/search.png" align=middle>&nbsp;Name
+    </label>
+   </td>
+  </tr>
+ </table>
+
+ <table summary=""  width="100%"  style="background:#EEEEEE;border-top:1px solid #B0B0B0;">
+  <tr>
+   <td width="100%" align="right">
+    {$APPLY}
+   </td>
+  </tr>
+ </table>
+</div>
diff --git a/gosa-core/plugins/admin/departments/dep-filter.xml b/gosa-core/plugins/admin/departments/dep-filter.xml
new file mode 100644 (file)
index 0000000..398218d
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<filterdef>
+  <definition>
+    <category>users</category>
+    <template>dep-filter.tpl</template>
+    <initial>true</initial>
+  </definition>
+
+  <search>
+    <query>
+      <backend>LDAP</backend>
+      <filter>(objectClass=gosaDepartment)</filter>
+      <attribute>dn</attribute>
+      <attribute>objectClass</attribute>
+      <attribute>ou</attribute>
+      <attribute>description</attribute>
+    </query>
+    <scope>auto</scope>
+  </search>
+
+</filterdef>
diff --git a/gosa-core/plugins/admin/departments/dep-list.tpl b/gosa-core/plugins/admin/departments/dep-list.tpl
new file mode 100644 (file)
index 0000000..cacf0d9
--- /dev/null
@@ -0,0 +1,30 @@
+<input type='image' src='images/empty.png' name='no_action_posted' value='do_nothing' alt='' style='width:2px;height:2px;'>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=2>
+  <tr>
+    <td style="vertical-align:top; width:50%;">
+      <div class="contentboxh">
+        <p class="contentboxh">&nbsp;{$HEADLINE}&nbsp;{$SIZELIMIT}</p>
+      </div>
+      
+      <div class="contentboxb">
+       <div style='background:white;padding:0px;padding:3px;'>
+        <table><tr>
+          <td>{$ROOT}&nbsp;</td><td>{$BACK}&nbsp;</td><td>{$HOME}&nbsp;</td><td>{$RELOAD}&nbsp;</td><td>{$SEPARATOR}&nbsp;</td><td>{t}Base{/t} {$BASE}&nbsp;<input class='center' type='image' src='images/lists/submit.png' align='middle' title='{t}Update{/t}' name='submit_department' alt='{t}Submit{/t}'>&nbsp;</td><td>{$SEPARATOR}&nbsp;</td><td><img src='images/rocket.png' alt='' class='center'></td><td> {$ACTIONS}</td>
+        </tr></table>
+       </div>
+      </div>
+      
+      <div style='height:4px;'>
+      </div>
+      
+      <input type="hidden" id="d_save" value="490">
+      {$LIST}
+    </td>
+    <td style='vertical-align:top'>
+      {$FILTER}
+    </td>
+  </tr>
+</table>
+
+<input type="hidden" name="ignore">
diff --git a/gosa-core/plugins/admin/departments/dep-list.xml b/gosa-core/plugins/admin/departments/dep-list.xml
new file mode 100644 (file)
index 0000000..7a0b568
--- /dev/null
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<list>
+  <definition>
+    <departmentBrowser>false</departmentBrowser>
+    <departmentRootVisible>false</departmentRootVisible>
+    <baseMode>true</baseMode>
+    <multiSelect>true</multiSelect>
+    <template>dep-list.tpl</template>
+    <module>departments</module>
+    <label>List of departments</label>
+    <defaultSortColumn>1</defaultSortColumn>
+
+    <objectType>
+      <label>Domain</label>
+      <objectClass>domain</objectClass>
+      <category>department</category>
+      <class>domain</class>
+      <image>plugins/departments/images/domain.png</image>
+    </objectType>
+
+    <objectType>
+      <label>Domain component</label>
+      <objectClass>dcObject</objectClass>
+      <category>department</category>
+      <class>dcObject</class>
+      <image>plugins/departments/images/dc.png</image>
+    </objectType>
+
+    <objectType>
+      <label>Country</label>
+      <objectClass>country</objectClass>
+      <category>department</category>
+      <class>country</class>
+      <image>plugins/departments/images/country.png</image>
+    </objectType>
+
+    <objectType>
+      <label>Locality</label>
+      <objectClass>locality</objectClass>
+      <category>department</category>
+      <class>locality</class>
+      <image>plugins/departments/images/organization.png</image>
+    </objectType>
+
+    <objectType>
+      <label>Department</label>
+      <objectClass>department</objectClass>
+      <category>department</category>
+      <class>department</class>
+      <image>images/lists/folder.png</image>
+    </objectType>
+  </definition>
+
+  <table>
+    <layout>|20px||120px|170px;r|</layout>
+
+    <column>
+      <value>%{filter:objectType(dn,objectClass)}</value>
+    </column>
+
+    <column>
+      <label>ou</label>
+      <sortAttribute>ou</sortAttribute>
+      <sortType>string</sortType>
+      <value>%{filter:depLabel(row,dn,"%s",ou,pid,base)}</value>
+      <export>true</export>
+    </column>
+
+    <column>
+      <label>description</label>
+      <sortAttribute>description</sortAttribute>
+      <sortType>string</sortType>
+      <value>%{filter:link(row,dn,"%s",description)}</value>
+      <export>true</export>
+    </column>
+
+    <column>
+      <label>Actions</label>
+      <value>%{filter:actions(dn,row,objectClass)}</value>
+    </column>
+
+  </table>
+
+  <actionmenu>
+
+    <action>
+     <type>sub</type>
+     <image>images/lists/new.png</image>
+     <label>Create</label>
+
+     <action>
+      <name>new</name>
+      <type>entry</type>
+      <image>plugins/users/images/list_new_user.png</image>
+      <label>User</label>
+     </action>
+
+    </action>
+
+    <action>
+      <type>separator</type>
+    </action>
+
+    <action>
+      <name>edit</name>
+      <type>entry</type>
+      <image>images/lists/edit.png</image>
+      <label>Edit</label>
+    </action>
+
+    <action>
+      <name>remove</name>
+      <type>entry</type>
+      <image>images/lists/trash.png</image>
+      <label>Remove</label>
+    </action>
+
+  </actionmenu>
+
+  <actiontriggers snapshot="false" copypaste="false">
+
+    <action>
+      <name>edit</name>
+      <type>entry</type>
+      <nospan></nospan>
+      <image>images/lists/edit.png</image>
+      <label>Edit</label>
+    </action>
+
+    <action>
+      <name>remove_organizationalUnit</name>
+      <type>entry</type>
+      <nospan></nospan>
+      <image>images/lists/trash.png</image>
+      <acl>department[d]</acl>
+      <label>Remove</label>
+    </action>
+
+  </actiontriggers>
+
+</list>
index 2cf55f74569fe2fd51f749096ca3de6d0519b574..da3b8bd15de6b220faae9c3addc6dfbc44994176 100644 (file)
@@ -23,8 +23,8 @@
 /* Remove locks created by this plugin
 */
 if ($remove_lock){
-  if(session::is_set('department')){
-      $macl = session::get('department');
+  if(session::is_set('departmentManagement')){
+      $macl = session::get('departmentManagement');
       $macl->remove_lock();
   }
 }
@@ -32,34 +32,25 @@ if ($remove_lock){
 /* Remove this plugin from session
 */
 if ( $cleanup ){
-  session::un_set('department');
+  session::un_set('departmentManagement');
 }else{
 
-       /* Create usermanagement object on demand */
-       if (!session::is_set('department')){
-               session::set('department',new departmentManagement($config, $ui));
-       }
-       $department = session::get('department');
-       
-       /* Show and save dialog */
-       $department->save_object();
-       $output= $department->execute();
-
-       /* Page header*/
-       if (get_object_info() != ""){
-               $display= print_header(get_template_path('plugins/departments/images/plugin.png'), _("Department management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/locked.png')."\"> ".LDAP::fix(get_object_info()));
-       } else {
-               $display= print_header(get_template_path('plugins/departments/images/plugin.png'), _("Department management"));
-       }
+  /* Create usermanagement object on demand */
+  if (!session::is_set('departmentManagement')){
+    $departmentManagement= new departmentManagement ($config, $ui);
+    session::set('departmentManagement',$departmentManagement);
+  }
+  $departmentManagement = session::get('departmentManagement');
+  $display= $departmentManagement->execute();
 
-       /* Reset requested? */
-       if (isset($_GET['reset']) && $_GET['reset'] == 1){
-               session::un_set ('department');
-       }
+  /* Reset requested? */
+  if (isset($_GET['reset']) && $_GET['reset'] == 1){
+    session::un_set ('departmentManagement');
+  }
 
-       $display.= $output;
-       session::set('department',$department);
-       $config = $department->config;
+  /* Show and save dialog */
+  session::set('departmentManagement',$departmentManagement);
 }
 
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>