From: hickert
Date: Thu, 28 Jul 2005 05:58:02 +0000 (+0000)
Subject: Applied planned layout modifications
X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=721c5fa0836cba0f00488aaeaa6e0cd8f48385ea;p=gosa.git
Applied planned layout modifications
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1017 594d385d-05f5-0310-b6e9-bd551577e9d8
---
diff --git a/Changelog b/Changelog
index d14928372..a527a0d8b 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ GOsa2 changelog
===============
* gosa 2.4beta3
+ - Updated layout
- Fixed application removal
- Improved accessibility for disabled persons
- Added intranet account to list of connectivity plugins
diff --git a/TODO b/TODO
index ae928bb1c..132fb0da6 100644
--- a/TODO
+++ b/TODO
@@ -3,8 +3,38 @@ Things to fix before 2.4:
* Finish kolab integration
- shared folders
+
* Fix problem with winstation and invalid structural object class chain (inetOrgPerson/device)
+* Deparment dialog
+ - adapt base when creating a new department
+ - show different symbol when the department contains subdepartments
+
+* User dialog
+ - adapt base when creating a new user/template
+ - Add button for template created users
+
+* Group dialog
+ - Add properties
+ - tooltips
+ - Check strings
+
+* Systems dialog
+ - Add buttons for all system types
+
+* All dialogs
+ - adapt base when creating a new entity
+ - sorting
+ - cleanup, remove not used code fragments
+ - between pictures ... if needed (convert_list ? )
+ - ALT tags are partly wrong and not translated
+
+* include/class_mail-methods-kolab.inc -> gosaMailQuota not defined when opening "cajus"
+
+* Autofs entries cannot be removed
+
+* Minimize "reload" calls during post of depselect in all plugins
+
Target for 2.5:
===============
diff --git a/html/main.php b/html/main.php
index bb9ad7c16..859e8d123 100644
--- a/html/main.php
+++ b/html/main.php
@@ -289,7 +289,7 @@ if (isset($config->data['MAIN']['W3CTEST']) && preg_match('/true/i', $config->da
tidy_clean_repair($display);
$cnt = (tidy_error_count($display))+(tidy_warning_count($display));
if($cnt != 0){
- echo " "._("Generating this page caused the W3C conformance checker to raise some errors!")." "._("Toggle information")."
";
+ echo "
"._("Generating this page caused the W3C conformance checker to raise some errors!")." "._("Toggle information")."
";
echo nl2br(htmlentities($display->errorBuffer))."
";
}
diff --git a/html/themes/default/style.css b/html/themes/default/style.css
index e95c79f30..893abd3c6 100644
--- a/html/themes/default/style.css
+++ b/html/themes/default/style.css
@@ -1,3 +1,31 @@
+table.listframe {
+ width:600px;
+ background:#F3F3F3;
+}
+
+tr.listrow {
+ background:#EAEAEA;
+}
+
+td.listheader {
+ background:#E5E5E5;
+ font-weight:bold;
+ border-right:1px solid #C0C0C0;
+ padding:3px;
+}
+
+td.list0 {
+ background:#F0F0F0;
+ border-right:1px solid #C0C0C0;
+ padding:3px;
+}
+
+td.list1 {
+ background:white;
+ border-right:1px solid #C0C0C0;
+ padding:3px;
+}
+
body
{
margin-left: 0px;
diff --git a/include/class_config.inc b/include/class_config.inc
index bda66489d..5721b58aa 100644
--- a/include/class_config.inc
+++ b/include/class_config.inc
@@ -435,7 +435,7 @@ class config {
}
}
- function make_idepartments($max_size= 40)
+ function make_idepartments($max_size= 28)
{
$this->idepartments= array();
foreach ($this->departments as $key => $val){
diff --git a/include/class_divlist.inc b/include/class_divlist.inc
index 49e671e26..d94da0bfe 100644
--- a/include/class_divlist.inc
+++ b/include/class_divlist.inc
@@ -117,9 +117,7 @@ class divlist {
$appendempty = ($this->_numentries() -$start);
-
-
- for($i = $start ; $i <= $stop;$i++){
+ for($i = $start ; $i < $stop;$i++){
if(isset($this->a_entries[$i])){
diff --git a/plugins/addons/addressbook/class_addressbook.inc b/plugins/addons/addressbook/class_addressbook.inc
index 77ada8f46..6a964bfdc 100644
--- a/plugins/addons/addressbook/class_addressbook.inc
+++ b/plugins/addons/addressbook/class_addressbook.inc
@@ -402,6 +402,7 @@ $this->telephone_list[$attrs['sn'][0].$attrs['dn']]=
$smarty->assign("global", $phonefilter['global']);
$smarty->assign("organizational", $phonefilter['organizational']);
$smarty->assign("search_image", get_template_path('images/search.png'));
+ $smarty->assign("obj_image", get_template_path('images/list_ogroup.png'));
$smarty->assign("tree_image", get_template_path('images/tree.png'));
$smarty->assign("infoimage", get_template_path('images/info.png'));
$smarty->assign("actionimage", get_template_path('images/action.png'));
diff --git a/plugins/addons/addressbook/contents.tpl b/plugins/addons/addressbook/contents.tpl
index b4248bf76..6be1965f3 100644
--- a/plugins/addons/addressbook/contents.tpl
+++ b/plugins/addons/addressbook/contents.tpl
@@ -74,40 +74,36 @@
-
- {t}Display results for department{/t}
+
-
+
{html_options options=$deplist selected=$depselect}
-
-
{$apply}
diff --git a/plugins/admin/applications/class_applicationManagement.inc b/plugins/admin/applications/class_applicationManagement.inc
index 7142121b6..e52646bd9 100644
--- a/plugins/admin/applications/class_applicationManagement.inc
+++ b/plugins/admin/applications/class_applicationManagement.inc
@@ -48,72 +48,144 @@ class applicationManagement extends plugin
function execute()
{
- /* Save data */
- $appfilter= get_global("appfilter");
- foreach( array("depselect", "regex") as $type){
- if (isset($_POST[$type])){
- $appfilter[$type]= $_POST[$type];
- }
- }
- if (isset($_GET['search'])){
- $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
- if ($s == "**"){
- $s= "*";
- }
- $appfilter['regex']= $s;
- }
- register_global("appfilter", $appfilter);
-
- /* Check sorting variable */
- if (!isset($this->apptabs) &&
- !isset($_POST['new_app']) &&
- !isset($_POST['delete_app']) &&
- !isset($_POST['select_app'])){
- $this->reload();
- }
- $smarty= get_smarty();
-
- /* Check for exeeded sizelimit */
- if (($message= check_sizelimit()) != ""){
- return($message);
- }
-
- /* New application? */
- if (isset($_POST['new_app'])){
-
- /* By default we set 'dn' to 'new', all relevant plugins will
- react on this. */
- $this->dn= "new";
-
- /* Create new usertab object */
- $this->apptabs= new apptabs($this->config,
- $this->config->data['TABS']['APPSTABS'], $this->dn);
- $this->apptabs->set_acl(array(':all'));
- }
-
- /* Cancel dialogs */
- if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
- del_lock ($this->apptabs->dn);
- unset ($this->apptabs);
- $this->apptabs= NULL;
- unset ($_SESSION['objectinfo']);
- }
-
- /* Finish apps edit is triggered by the tabulator dialog, so
- the user wants to save edited data. Check and save at this
- point. */
- if (isset($_POST['edit_finish'])){
-
- /* Check tabs, will feed message array */
- $this->apptabs->last= $this->apptabs->current;
- $this->apptabs->save_object();
- $message= $this->apptabs->check();
-
- /* Save, or display error message? */
- if (count($message) == 0){
-
- /* Save data data to ldap */
- $this->apptabs->save();
+ /* Save data */
+ $appfilter = get_global("appfilter");
+ $smarty = get_smarty(); // Smarty instance
+ $s_action = ""; // Contains the action to proceed
+ $s_entry = ""; // The value for s_action
+ $base_back = ""; // The Link for Backbutton
+
+ /* Start for New List Managment */
+ if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
+ $s_action="open";
+ $s_entry = base64_decode($_GET['dep_id']);
+ $appfilter['depselect']= "".$this->config->departments[trim($s_entry)];
+ $this->reload();
+ }
+
+ /* Test Posts */
+ foreach($_POST as $key => $val){
+ // Post for delete
+ if(preg_match("/appl_del.*/",$key)){
+ $s_action = "del";
+ $s_entry = preg_replace("/appl_".$s_action."_/i","",$key);
+ // Post for edit
+ }elseif(preg_match("/appl_edit_.*/",$key)){
+ $s_action="edit";
+ $s_entry = preg_replace("/appl_".$s_action."_/i","",$key);
+ // Post for new
+ }elseif(preg_match("/dep_back.*/i",$key)){
+ $s_action="back";
+ }elseif(preg_match("/appl_new.*/",$key)){
+ $s_action="new";
+ }elseif(preg_match("/dep_home.*/i",$key)){
+ $s_action="home";
+ }elseif(preg_match("/dep_root.*/i",$key)){
+ $s_action="root";
+ }
+ }
+
+ if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+ $s_action ="edit";
+ $s_entry = $_GET['id'];
+ }
+
+ $s_entry = preg_replace("/_.$/","",$s_entry);
+
+ /* Department changed? */
+ if(isset($_POST['depselect']) && $_POST['depselect']){
+ $appfilter['depselect']= $_POST['depselect'];
+ $this->reload();
+ }
+
+ /* Homebutton is posted */
+ if($s_action=="home"){
+ $appfilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
+ $appfilter['depselect']=(preg_replace("/^[^,]+,/","",$appfilter['depselect']));
+ $this->reload();
+ }
+
+ if($s_action=="root"){
+ $appfilter['depselect']=($this->config->current['BASE']);
+ $this->reload();
+ }
+
+ /* If Backbutton is Posted */
+ if($s_action=="back"){
+ $base_back = preg_replace("/^[^,]+,/","",$appfilter['depselect']);
+ $base_back = convert_department_dn($base_back);
+
+ if(isset($this->config->departments[trim($base_back)])){
+ $appfilter['depselect']= $this->config->departments[trim($base_back)];
+ }else{
+ $appfilter['depselect']= $this->config->departments["/"];
+ }
+ $this->reload();
+ }
+
+ if (isset($_POST['regex'])){
+ $appfilter['regex']= $_POST['regex'];
+ }
+ if (isset($_GET['search'])){
+ $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+ if ($s == "**"){
+ $s= "*";
+ }
+ $appfilter['regex']= $s;
+ }
+ register_global("appfilter", $appfilter);
+
+ /* Check sorting variable */
+ if (!isset($this->apptabs) &&
+ !isset($_POST['new_app']) &&
+ !isset($_POST['delete_app']) &&
+ !isset($_POST['select_app'])){
+ $this->reload();
+ }
+ $smarty= get_smarty();
+
+ /* Check for exeeded sizelimit */
+ if (($message= check_sizelimit()) != ""){
+ return($message);
+ }
+
+
+ /* New application? */
+ if ($s_action=="new"){
+
+ /* By default we set 'dn' to 'new', all relevant plugins will
+ react on this. */
+ $this->dn= "new";
+
+ /* Create new usertab object */
+ $this->apptabs= new apptabs($this->config,
+ $this->config->data['TABS']['APPSTABS'], $this->dn);
+ $this->apptabs->set_acl(array(':all'));
+ }
+
+ /* Cancel dialogs */
+ if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
+ del_lock ($this->apptabs->dn);
+ unset ($this->apptabs);
+ $this->apptabs= NULL;
+ unset ($_SESSION['objectinfo']);
+ }
+
+ /* Finish apps edit is triggered by the tabulator dialog, so
+ the user wants to save edited data. Check and save at this
+ point. */
+ if (isset($_POST['edit_finish'])){
+
+ /* Check tabs, will feed message array */
+ $this->apptabs->last= $this->apptabs->current;
+ $this->apptabs->save_object();
+ $message= $this->apptabs->check();
+
+ /* Save, or display error message? */
+ if (count($message) == 0){
+
+ /* Save data data to ldap */
+ $this->apptabs->save();
gosa_log ("Application object'".$this->dn."' has been saved");
/* Application has been saved successfully, remove lock from
@@ -136,10 +208,10 @@ class applicationManagement extends plugin
}
/* User wants to edit data? */
- if ((isset($_POST['select_app']) || (isset($_POST['edit_helper']) && $_POST['edit_helper'] == "1")) && isset($_POST['applist']) && $_POST['applist'] != ""){
+ if ($s_action=="edit"){
/* Get 'dn' from posted 'applist', must be unique */
- $this->dn= trim($_POST['applist']);
+ $this->dn= $this->applications[$s_entry]['dn'];
/* Check locking, save current plugin in 'back_plugin', so
the dialog knows where to return. */
@@ -162,10 +234,10 @@ class applicationManagement extends plugin
}
/* Remove user was requested */
- if (isset($_POST['delete_app']) && isset($_POST['applist'])){
+ if ($s_action == "del"){
/* Get 'dn' from posted 'uid' */
- $this->dn= trim($_POST['applist']);
+ $this->dn= $this->applications[$s_entry]['dn'];
/* Load permissions for selected 'dn' and check if
we're allowed to remove this 'dn' */
@@ -244,22 +316,97 @@ class applicationManagement extends plugin
return ($display);
}
- /* Show main page */
- $smarty->assign("applications", $this->applications);
- $smarty->assign("search_image", get_template_path('images/search.png'));
- $smarty->assign("tree_image", get_template_path('images/tree.png'));
- $smarty->assign("infoimage", get_template_path('images/info.png'));
- $smarty->assign("launchimage", get_template_path('images/launch.png'));
- $smarty->assign("deplist", $this->config->idepartments);
- foreach( array("depselect", "regex") as $type){
- $smarty->assign("$type", $appfilter[$type]);
+ /* Show main page */
+
+ /* Prepare departments */
+ $options= "";
+ foreach ($this->config->idepartments as $key => $value){
+ if ($appfilter['depselect'] == $key){
+ $options.= "
$value ";
+ } else {
+ $options.= "
$value ";
+ }
}
- /* Extend if we are not using javascript */
+ // Managment
+ $listhead = "
";
+
+
+ $actions = "
";
+ $actions.= "
";
+
+ // Defining Links
+ $linkopen = "
%s ";
+
+ // image Buttons
+ $editlink = "
%s ";
+ $userimg = "
";
+
+ // Extension images
+ $applimg = "
";
+
+ // Space
+ $empty = "
";
+
+
+ $divlist = new divlist();
+ $divlist->SetHeader(array(
+ array("string" => ""),
+ array("string" => _("Application name")." / "._("Department")),
+ array("string" => _("Actions") ,"attach"=>"style='border:none;width:40px;'")
+ ));
+
+
+ $divlist->SetSummary(_("This table displays all groups, in the selected tree."));
+ $divlist->SetEntriesPerPage(20);
+
+ foreach($this->departments as $key=> $val){
+
+ $field1 = array("string" => "
");
+ $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val));
+ $field3 = array("string" => " ","attach"=>"style='text-align:right;border:none'");
+
+ $divlist->AddEntry(array($field1,$field2,$field3));
+ }
+
+ foreach($this->applications as $key => $val){
+ $title = "title='gid : ".$key." - dn : ".$val['dn']."'";
+
+ if(!isset($val['description'][0])){
+ $desc = "";
+ }else{
+ $desc = " - [ ".$val['description'][0]." ]";
+ }
+ $field1 = array("string" => sprintf($applimg,$val['dn']),"attach"=>"style='width:20px;align:middle;'");
+ $field2 = array("string" => sprintf($editlink,$key,($val['cn']['0'].$desc)),"attach"=>$title);
+ $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions),"attach"=>"style='text-align:right;border:none'");
+
+ $divlist->AddEntry(array($field1,$field2,$field3));
+ }
+
+ $smarty->assign("applicationshead", $listhead);
+ $smarty->assign("applications", $divlist->DrawList());
+ $smarty->assign("search_image", get_template_path('images/search.png'));
+ $smarty->assign("tree_image", get_template_path('images/tree.png'));
+ $smarty->assign("infoimage", get_template_path('images/info.png'));
+ $smarty->assign("launchimage", get_template_path('images/launch.png'));
+ $smarty->assign("deplist", $this->config->idepartments);
+ $smarty->assign("regex", $appfilter['regex']);
+
+ /* Extend if we are not using javascript */
$smarty->assign("apply", apply_filter());
$smarty->assign("alphabet", generate_alphabet());
- $smarty->assign("hint", print_sizelimit_warning());
-
+ $smarty->assign("hint", print_sizelimit_warning());
+
return($smarty->fetch(get_template_path('headpage.tpl', TRUE)));
}
@@ -278,19 +425,39 @@ class applicationManagement extends plugin
} else {
$regex= "*";
}
-
- /* Generate application list */
- $res= get_list($this->ui->subtreeACL, "(&(cn=$regex)(objectClass=gosaApplication))", TRUE, $base, array("cn", "description"), TRUE);
- $this->applications= array();
- foreach ($res as $value){
- $this->applications[$value["dn"]]= $value["cn"][0];
- if (isset($value["description"][0])){
- $this->applications[$value["dn"]]= $value["cn"][0]." (".
- $value["description"][0].")";
- }
- }
- natcasesort ($this->applications);
- reset ($this->applications);
+
+ /* Generate application list */
+ $res= get_list($this->ui->subtreeACL, "(&(cn=$regex)(objectClass=gosaApplication))", TRUE, $base, array("*"), TRUE);
+ $this->applications= array();
+ foreach ($res as $value){
+ $this->applications[]= $value;
+ }
+ reset ($this->applications);
+
+
+
+ /* NEW LIST MANAGMENT
+ * We also need to search for the departments
+ * So we are able to navigate like in konquerer
+ */
+ $base2 = preg_replace("/ou=people,/i","",$base);
+
+ $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+ TRUE, $base2, array("ou", "description"), TRUE);
+
+ $this->departments= array();
+ foreach ($res3 as $value){
+ if($value["description"][0]!=".."){
+ $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+ }else{
+ $this->departments[$value['dn']]=$value["description"][0];
+ }
+ }
+
+ /* END NEW LIST MANAGMENT
+ */
+
+
}
function remove_from_parent()
@@ -339,5 +506,5 @@ class applicationManagement extends plugin
}
}
-
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
diff --git a/plugins/admin/applications/headpage.tpl b/plugins/admin/applications/headpage.tpl
index 8daa16fe8..65f69d467 100644
--- a/plugins/admin/applications/headpage.tpl
+++ b/plugins/admin/applications/headpage.tpl
@@ -7,17 +7,12 @@
+
+
+ {$applications}
-
@@ -28,9 +23,6 @@
{t}This menu allows you to add, edit and remove selected applications. You may want to use the range selector on top of the application listbox, when working with a large number of applications.{/t}
-
- {t}-Edit- and -New...- will execute an assistant to aid you in editing properties. -Delete- will ask for confirmation before removing applications.{/t}
-
@@ -43,22 +35,10 @@
- {t}Display applications of department{/t}
-
-
-
- {html_options options=$deplist selected=$depselect}
-
-
-
-
-
diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc
index 8e34de931..38753f4b1 100644
--- a/plugins/admin/departments/class_departmentManagement.inc
+++ b/plugins/admin/departments/class_departmentManagement.inc
@@ -1,293 +1,440 @@
"Eins ist toll", "zwei" => "Zwei ist noch besser");
-
- /* Headpage attributes */
- var $last_dep_sorting= "invalid";
- var $departments= array();
- var $deptabs= NULL;
-
- /* attribute list for save action */
- var $attributes= array();
- var $objectclasses= array();
-
- function departmentManagement ($config, $ui)
- {
- $this->ui= $ui;
- $this->dn= "";
- $this->config= $config;
-
- /* Get global filter config */
- if (!is_global("depfilter")){
- $base= get_base_from_people($ui->dn);
- $depfilter= array("depselect" => $base,
- "regex" => "*");
- register_global("depfilter", $depfilter);
- }
- }
-
- function execute()
- {
- /* Reload departments */
- $this->config->departments= get_departments();
- $this->config->make_idepartments();
- $smarty= get_smarty();
-
- /* Save data */
- $depfilter= get_global("depfilter");
- foreach( array("depselect", "regex") as $type){
- if (isset($_POST[$type])){
- $depfilter[$type]= $_POST[$type];
- }
- }
- if (isset($_GET['search'])){
- $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
- if ($s == "**"){
- $s= "*";
- }
- $depfilter['regex']= $s;
- }
- register_global("depfilter", $depfilter);
-
-
- /* Create new department? */
- if (isset($_POST['new_department'])){
- $this->acl= array(":all");
- $this->dn= "new";
-
- /* Register deptabs to trigger edit dialog */
- $this->deptabs= new deptabs($this->config,
- $this->config->data['TABS']['DEPTABS'], $this->dn);
- $this->deptabs->set_acl($this->acl);
+ /* Definitions */
+ var $plHeadline= "Departments";
+ var $plDescription= "This does something";
+
+ /* CLI vars */
+ var $cli_summary= "Handling of LDAP subtrees";
+ var $cli_description= "Some longer text\nfor help";
+ var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ /* Headpage attributes */
+ var $last_dep_sorting= "invalid";
+ var $departments= array();
+ var $deptabs= NULL;
+
+ /* attribute list for save action */
+ var $attributes= array();
+ var $objectclasses= array();
+
+ function departmentManagement ($config, $ui)
+ {
+ $this->ui= $ui;
+ $this->dn= "";
+ $this->config= $config;
+
+ /* Get global filter config */
+ if (!is_global("depfilter")){
+ $base= get_base_from_people($ui->dn);
+ $depfilter= array("depselect" => $base,
+ "regex" => "*");
+ register_global("depfilter", $depfilter);
+ }
}
- /* Edit existing department */
- if ((isset($_POST['select_department']) || (isset($_POST['edit_helper']) && $_POST['edit_helper'] == "1")) && isset($_POST['deplist']) != ""){
- $this->dn= $this->config->departments[trim($_POST['deplist'])];
+ function execute()
+ {
+ /* Reload departments */
+ $this->config->departments = get_departments();
+ $smarty = get_smarty();
+ $display = "";
+ $depfilter = get_global("depfilter");
+ $s_action = ""; // Will contain an action, like del or edit
+ $s_entry = ""; // The entry name for edit delete -...
+
+ $this->config->make_idepartments();
- /* 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));
+ if (isset($_POST['regex'])){
+ $depfilter['regex']= $_POST['regex'];
}
- /* Lock the current entry, so everyone will get the
- above dialog */
- add_lock ($this->dn, $this->ui->dn);
+ // 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);
+ // Post for edit
+ }elseif(preg_match("/dep_edit_.*/",$key)){
+ $s_action="edit";
+ $s_entry = preg_replace("/dep_".$s_action."_/i","",$key);
+ // Post for new
+ }elseif(preg_match("/dep_new.*/",$key)){
+ $s_action="new";
+ }elseif(preg_match("/dep_back.*/i",$key)){
+ $s_action="back";
+ }elseif(preg_match("/dep_home.*/i",$key)){
+ $s_action="home";
+ }elseif(preg_match("/dep_root.*/i",$key)){
+ $s_action="root";
+ }
+ }
- /* Set up the users ACL's for this 'dn' */
- $this->acl= get_permissions ($this->dn, $this->ui->subtreeACL);
+ if(isset($_POST['depselect']) && $_POST['depselect']){
+ $depfilter['depselect']= $_POST['depselect'];
+ $this->reload();
+ }
+
+ if($s_action=="root"){
+ $depfilter['depselect']=($this->config->current['BASE']);
+ $this->reload();
+ }
- /* Register deptabs to trigger edit dialog */
- $this->deptabs= new deptabs($this->config,
- $this->config->data['TABS']['DEPTABS'], $this->dn);
- $this->deptabs->set_acl($this->acl);
- $_SESSION['objectinfo']= $this->dn;
- }
+ if($s_action=="home"){
+ $depfilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
+ $depfilter['depselect']=(preg_replace("/^[^,]+,/","",$depfilter['depselect']));
+ $this->reload();
+ }
+ if($s_action=="back"){
+ $base_back = preg_replace("/^[^,]+,/","",$depfilter['depselect']);
+ $base_back = convert_department_dn($base_back);
+
+ if(isset($this->config->departments[trim($base_back)])){
+ $depfilter['depselect']= $this->config->departments[trim($base_back)];
+ }else{
+ $depfilter['depselect']= $this->config->departments["/"];
+ }
+ $this->reload();
+ }
- /* Delete requested department */
- $display= "";
- if (isset($_POST['delete_department']) && isset($_POST['deplist'])){
- $this->dn= $this->config->departments[trim($_POST['deplist'])];
+ if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
+ $s_action="open";
+ $s_entry = base64_decode($_GET['dep_id']);
+ $depfilter['depselect']= $this->config->departments[trim($s_entry)];
+ $this->reload();
+ }
- /* Check locking */
- if (($user= get_lock($this->dn)) != ""){
- $_SESSION['dn']= $this->dn;
- return(gen_locked_message($user, $this->dn));
- } else {
- # Lock this dn for editing
- add_lock ($this->dn, $this->ui->dn);
- $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), $this->dn));
- $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE));
- return ($display);
+ $s_entry = preg_replace("/_.*/","",$s_entry);
+
+ if (isset($_GET['search'])){
+ $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+ if ($s == "**"){
+ $s= "*";
+ }
+ $depfilter['regex']= $s;
}
- }
+ register_global("depfilter", $depfilter);
- /* Finally delete department */
- if (isset($_POST['delete_department_confirm'])){
- $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
- $acl= get_module_permission($acl, "department", $this->dn);
- if (chkacl($acl, "all") == ""){
- $this->remove_from_parent();
- gosa_log ("Department object'".$this->dn."' has been removed");
- $this->reload ();
- } else {
- print_red (_("You have no permission to remove this department."));
+ /* New Entry if Posted action (s_action) == new
+ */
+ if ($s_action=="new"){
+ $this->acl= array(":all");
+ $this->dn= "new";
+
+ $this->deptabs= new deptabs($this->config,
+ $this->config->data['TABS']['DEPTABS'], $this->dn);
+ $this->deptabs->set_acl($this->acl);
}
- }
- /* Finish request */
- if (isset($_POST['edit_finish'])){
+ /* Edit Entry if Posted action (s_action) == edit
+ * The entry which will be edited is defined in $s_entry
+ */
+ if ($s_action=="edit"){
- /* Check tabs, will feed message array */
- $message= $this->deptabs->check();
+ $this->dn= $this->config->departments[trim($s_entry)];
- /* Save, or display error message? */
- if (count($message) == 0){
+ if (($user= get_lock($this->dn)) != ""){
+ return(gen_locked_message ($user, $this->dn));
+ }
- /* Save user data to ldap */
- $this->deptabs->save();
- gosa_log ("Department object'".$this->dn."' has been saved");
+ /* Lock the current entry, so everyone will get the above dialog */
+ add_lock ($this->dn, $this->ui->dn);
- /* Group has been saved successfully, remove lock from
- LDAP. */
- if ($this->dn != "new"){
- del_lock ($this->dn);
- }
+ /* Set up the users ACL's for this 'dn' */
+ $this->acl= get_permissions ($this->dn, $this->ui->subtreeACL);
- /* There's no page reload so we have to read new users at
- this point. */
- $this->reload ();
- unset ($this->deptabs);
- $this->deptabs= NULL;
- unset ($_SESSION['objectinfo']);
+ /* Register deptabs to trigger edit dialog */
+ $this->deptabs= new deptabs($this->config,$this->config->data['TABS']['DEPTABS'], $this->dn);
+ $this->deptabs->set_acl($this->acl);
+ $_SESSION['objectinfo']= $this->dn;
+ }
- } else {
- /* Ok. There seem to be errors regarding to the tab data,
- show message and continue as usual. */
- show_errors($message);
- }
- }
+ /* Delete Entry if Posted action (s_action) == del
+ * The entry which will be deleted is defined in $s_entry
+ */
+ if ($s_action =="del"){
+ $this->dn= $this->config->departments[trim($s_entry)];
+
+ /* Check locking */
+ if (($user= get_lock($this->dn)) != ""){
+ $_SESSION['dn']= $this->dn;
+ return(gen_locked_message($user, $this->dn));
+ } else {
+ add_lock ($this->dn, $this->ui->dn);
+ $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), $this->dn));
+ $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE));
+ return ($display);
+ }
+ }
+ /* If department deletion is accepted ...
+ * Finally delete department
+ */
+ if (isset($_POST['delete_department_confirm'])){
+ $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
+ $acl= get_module_permission($acl, "department", $this->dn);
+ if (chkacl($acl, "all") == ""){
+ $this->remove_from_parent();
+ gosa_log ("Department object'".$this->dn."' has been removed");
+ $this->reload ();
+ } else {
+ print_red (_("You have no permission to remove this department."));
+ }
+ }
- /* Cancel dialog */
- if (isset($_POST['edit_cancel']) || isset($_POST['delete_cancel']) ||
- isset($_POST['delete_department_confirm']) || isset($_POST['delete_lock'])){
+ /* Edit Complete ...
+ * Finish request
+ */
+ if (isset($_POST['edit_finish'])){
+
+ /* Check tabs, will feed message array */
+ $message= $this->deptabs->check();
+
+ /* Save, or display error message? */
+ if (count($message) == 0){
+
+ /* Save user data to ldap */
+ $this->deptabs->save();
+ gosa_log ("Department object'".$this->dn."' has been saved");
+
+ /* Group has been saved successfully, remove lock from
+ LDAP. */
+ if ($this->dn != "new"){
+ del_lock ($this->dn);
+ }
+
+ /* There's no page reload so we have to read new users at
+ this point. */
+ $this->reload ();
+ unset ($this->deptabs);
+ $this->deptabs= NULL;
+ unset ($_SESSION['objectinfo']);
+
+ } else {
+ /* Ok. There seem to be errors regarding to the tab data,
+ show message and continue as usual. */
+ show_errors($message);
+ }
+ }
- del_lock ($this->dn);
- unset($this->depdabs);
- $this->deptabs= NULL;
- unset ($_SESSION['objectinfo']);
- }
+
+ /* User cancelt edit oder delete
+ * Cancel dialog
+ */
+ if (isset($_POST['edit_cancel']) || isset($_POST['delete_cancel']) ||
+ isset($_POST['delete_department_confirm']) || isset($_POST['delete_lock'])){
+
+ del_lock ($this->dn);
+ unset($this->depdabs);
+ $this->deptabs= NULL;
+ unset ($_SESSION['objectinfo']);
+ }
- /* Headpage or normal plugin screen? */
- if ($this->deptabs == NULL){
- /* Check sorting variable */
- $this->reload();
-
- /* Check for exeeded sizelimit */
- if (($message= check_sizelimit()) != ""){
- return($message);
- }
-
- /* Show main page */
- $smarty->assign("departments", $this->departments);
- $smarty->assign("search_image", get_template_path('images/search.png'));
- $smarty->assign("tree_image", get_template_path('images/tree.png'));
- $smarty->assign("infoimage", get_template_path('images/info.png'));
- $smarty->assign("launchimage", get_template_path('images/launch.png'));
- $smarty->assign("deplist", $this->config->idepartments);
- foreach( array("depselect", "regex") as $type){
- $smarty->assign("$type", $depfilter[$type]);
+ /* Headpage or normal plugin screen? */
+ if ($this->deptabs == NULL){
+ /* Check sorting variable */
+ $this->reload();
+
+ /* Check for exeeded sizelimit */
+ if (($message= check_sizelimit()) != ""){
+ return($message);
+ }
+
+ /* Prepare departments */
+ $options= "";
+ foreach ($this->config->idepartments as $key => $value){
+ if ($depfilter['depselect'] == $key){
+ $options.= "
$value ";
+ } else {
+ $options.= "
$value ";
+ }
+ }
+
+ /* Generate list head */
+ $listhead = "
";
+
+ /* Show main page */
+ $divlist = new divlist();
+ $divlist->SetSummary(_("This table displays all departments, in the selected tree."));
+ $divlist->SetEntriesPerPage(20);
+ $actions= "
";
+ $actions.= "
";
+
+ $linkopen = "
%s ";
+
+ $divlist->SetHeader(array(array("string" => " "),
+ array("string"=>_("Department name")),
+ array("string" =>_("Actions"), "attach" => "style='text-align: right;border:none'")));
+
+ foreach($this->departments as $key => $val) {
+ if(!isset($this->config->departments[trim($key)])){
+ $this->config->departments[trim($key)]="";
+ }
+ $field0 = array("string" => "
","attach"=>"style='width:20px;'");
+ $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "width='100%'");
+ $field2 = array("string" => preg_replace("/%KEY%/", $key, $actions),"attach"=>"style='text-align:right;border:none'");
+
+ $divlist->AddEntry( array($field0,$field1,$field2));
+
+ }
+ $smarty->assign("departments",$divlist->DrawList() );
+ $smarty->assign("departmentshead",$listhead);
+ $smarty->assign("search_image", get_template_path('images/search.png'));
+ $smarty->assign("tree_image", get_template_path('images/tree.png'));
+ $smarty->assign("infoimage", get_template_path('images/info.png'));
+ $smarty->assign("launchimage", get_template_path('images/launch.png'));
+ $smarty->assign("deplist", $this->config->idepartments);
+
+ foreach( array("depselect", "regex") as $type){
+ $smarty->assign("$type", $depfilter[$type]);
+ }
+
+ /* Extend if we are not using javascript */
+ $smarty->assign("apply", apply_filter());
+ $smarty->assign("alphabet", generate_alphabet());
+ $smarty->assign("hint", print_sizelimit_warning());
+
+ $display= $smarty->fetch(get_template_path('headpage.tpl', TRUE));
+ return($display);
}
- /* Extend if we are not using javascript */
- $smarty->assign("apply", apply_filter());
- $smarty->assign("alphabet", generate_alphabet());
- $smarty->assign("hint", print_sizelimit_warning());
+ /* Show main page (tabs) */
+ $display= $this->deptabs->execute();
+
+ $display.= "
\n";
+ $display.= " \n";
+ $display.= " \n";
+ $display.= " \n";
+ $display.= "
";
- $display= $smarty->fetch(get_template_path('headpage.tpl', TRUE));
- return($display);
+ return ($display);
}
- /* Show main page (tabs) */
- $display= $this->deptabs->execute();
- $display.= "
\n";
- $display.= " \n";
- $display.= " \n";
- $display.= " \n";
- $display.= "
";
+ function reload()
+ {
+ /* Get config */
+ $depfilter= get_global('depfilter');
+ // Added for dirlist function...
+
+ if(isset($_POST['deplist'])){
+ $depfilter= get_global("depfilter");
+ $depfilter['depselect']= $this->config->departments[trim($_POST['deplist'])];
+ register_global("depfilter", $depfilter);
+ }
+
+ /* Set base for all searches */
+ $base= $depfilter['depselect'];
+
+ /* Regex filter? */
+ if ($depfilter['regex'] != ""){
+ $regex= $depfilter['regex'];
+ } else {
+ $regex= "*";
+ }
- return ($display);
- }
+ // Configure Back Address
+ $base_back = preg_replace("/^[^,]+,/","",$base);
+ // Create Array to Test if we have a valid back button
+ $tmp = array_flip($_SESSION['config']->departments);
- function reload()
- {
- /* Get config */
- $depfilter= get_global('depfilter');
+ // In case of a valid back button create entry
+ if(isset($tmp[$base_back])){
+ $tmp2 ['dn'] = convert_department_dn($base_back);
- /* Set base for all searches */
- $base= $depfilter['depselect'];
+ // If empty always go to top
+ if(empty($tmp2['dn'])){
+ $tmp2['dn']="/";
+ }
+ $tmp2 ['description'][0] = _("..");
+ $result[$tmp[$base_back]]=$tmp2;
+ }
- /* Regex filter? */
- if ($depfilter['regex'] != ""){
- $regex= $depfilter['regex'];
- } else {
- $regex= "*";
- }
+ $res= get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+ TRUE, $base, array("ou", "description"), TRUE);
+
+ //hickert Replaced Block
+ // $this->departments= array();
+ // foreach ($res as $value){
+ // $title= convert_department_dn($value["dn"]);
+ // $this->departments[$title]= "$title [".$value["description"][0]."]";
+ // $this->departments[$value['dn']]= "[".$value["description"][0]."]";
+ // }
+
+ $this->departments= array();
+ foreach ($res as $value){
+ if($value["description"][0]!=".."){
+ $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+ }else{
+ $this->departments[$value['dn']]=$value["description"][0];
+ }
+ }
+ natcasesort ($this->departments);
+ reset ($this->departments);
+ }
- /*Get all gosaDepartments */
- $res= get_list($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", TRUE, $base, array("ou", "description"), TRUE);
+ 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=".$this->dn."))", array("cn"));
+ while ($ldap->fetch()){
+ $og= new ogroup($this->config, $ldap->getDN());
+ unset($og->member[$this->dn]);
+ $og->save ();
+ }
- $this->departments= array();
- foreach ($res as $value){
- $title= convert_department_dn($value["dn"]);
- $this->departments[$title]= "$title [".$value["description"][0]."]";
}
- natcasesort ($this->departments);
- reset ($this->departments);
- }
-
- 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=".$this->dn."))", array("cn"));
- while ($ldap->fetch()){
- $og= new ogroup($this->config, $ldap->getDN());
- unset($og->member[$this->dn]);
- $og->save ();
- }
-
- }
-
- function remove_lock()
- {
- if (isset($this->dn)){
- del_lock ($this->dn);
+
+ function remove_lock()
+ {
+ if (isset($this->dn)){
+ del_lock ($this->dn);
+ }
}
- }
-}
+ }
-?>
+ ?>
diff --git a/plugins/admin/departments/headpage.tpl b/plugins/admin/departments/headpage.tpl
index 6366a594c..e5672bca5 100644
--- a/plugins/admin/departments/headpage.tpl
+++ b/plugins/admin/departments/headpage.tpl
@@ -1,23 +1,18 @@
-
+
{t}List of departments{/t} {$hint}
+
+
+ {$departments}
-
@@ -28,9 +23,6 @@
{t}This menu allows you to create, delete and edit selected departments. Having a large size of departments, you might prefer the range selectors on top of the department list.{/t}
-
- {t}-Edit- and -New...- will provide an assistant to aid you when performing changes on your departments. -Delete- will ask for confirmation before deleting departments.{/t}
-
@@ -42,20 +34,10 @@
- {t}Display subdepartments of{/t}
-
-
- {html_options options=$deplist selected=$depselect}
-
-
-
-
-
-
-
- {t}Display departments matching{/t}
+
+
-
diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc
index d9463cc1e..680d36a3c 100644
--- a/plugins/admin/groups/class_groupManagement.inc
+++ b/plugins/admin/groups/class_groupManagement.inc
@@ -24,6 +24,7 @@ class groupManagement extends plugin
/* Definitions */
var $plHeadline= "Groups";
var $plDescription= "This does something";
+ var $departments = array();
/* Dialog attributes */
var $grouptab= NULL;
@@ -57,13 +58,17 @@ class groupManagement extends plugin
{
/* Save data */
$groupfilter= get_global("groupfilter");
+ $s_action = "";
+ $s_entry = "";
+
+
if (!isset($this->grouptab)){
foreach( array("depselect", "guser", "regex") as $type){
if (isset($_POST[$type])){
$groupfilter[$type]= $_POST[$type];
}
}
- if (isset($_POST['depselect'])){
+ if (isset($_POST['regex'])){
foreach( array("primarygroups", "sambagroups", "mailgroups", "appgroups",
"functionalgroups", "subsearch") as $type){
@@ -84,6 +89,81 @@ class groupManagement extends plugin
register_global("groupfilter", $groupfilter);
}
+
+ /* Test Posts */
+ foreach($_POST as $key => $val){
+ // Post for delete
+ if(preg_match("/group_del.*/",$key)){
+ $s_action = "del";
+ $s_entry = preg_replace("/group_".$s_action."_/i","",$key);
+ // Post for edit
+ }elseif(preg_match("/group_edit_.*/",$key)){
+ $s_action="edit";
+ $s_entry = preg_replace("/group_".$s_action."_/i","",$key);
+ // Post for new
+ }elseif(preg_match("/dep_back.*/i",$key)){
+ $s_action="back";
+ }elseif(preg_match("/group_new.*/",$key)){
+ $s_action="new";
+ }elseif(preg_match("/dep_home.*/i",$key)){
+ $s_action="home";
+ }elseif(preg_match("/group_tplnew.*/i",$key)){
+ $s_action="new_tpl";
+ }elseif(preg_match("/group_chgpw.*/i",$key)){
+ $s_action="change_pw";
+ $s_entry = preg_replace("/group_chgpw_/i","",$key);
+ }elseif(preg_match("/dep_root.*/i",$key)){
+ $s_action="root";
+ }
+ }
+ $s_entry = preg_replace("/_.$/","",$s_entry);
+
+ /* Start for New List Managment */
+ if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
+ $s_action="open";
+ $s_entry = base64_decode($_GET['dep_id']);
+ $groupfilter['depselect']= "".$this->config->departments[trim($s_entry)];
+ $this->reload();
+ }
+
+ // Edit if
+ if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+ $s_action ="edit";
+ $s_entry = $_GET['id'];
+ }
+
+ /* Department changed? */
+ if(isset($_POST['depselect']) && $_POST['depselect']){
+ $groupfilter['depselect']= $_POST['depselect'];
+ $this->reload();
+ }
+
+ /* Homebutton is posted */
+ if($s_action=="home"){
+ $groupfilter['depselect']= (preg_replace("/^[^,]+,/","",$this->ui->dn));
+ $groupfilter['depselect']= (preg_replace("/^[^,]+,/","",$groupfilter['depselect']));
+ $this->reload();
+ }
+
+ if($s_action=="root"){
+ $groupfilter['depselect']=($this->config->current['BASE']);
+ $this->reload();
+ }
+
+ /* If Backbutton is Posted */
+ if($s_action == "back"){
+ $base_back= preg_replace("/^[^,]+,/","",$groupfilter['depselect']);
+ $base_back= convert_department_dn($base_back);
+
+ if(isset($this->config->departments[trim($base_back)])){
+ $groupfilter['depselect']= $this->config->departments[trim($base_back)];
+ }else{
+ $groupfilter['depselect']= $this->config->departments["/"];
+ }
+ $this->reload();
+ }
+ register_global("groupfilter", $groupfilter);
+
$smarty= get_smarty();
/* Prepare formular */
@@ -100,7 +180,7 @@ class groupManagement extends plugin
}
/* New group? */
- if (isset($_POST['new_group'])){
+ if ($s_action=="new"){
/* By default we set 'dn' to 'new', all relevant plugins will
react on this. */
@@ -156,10 +236,10 @@ class groupManagement extends plugin
}
/* User wants to edit data? */
- if ((isset($_POST['select_group']) || (isset($_POST['edit_helper']) && $_POST['edit_helper'] == "1")) && isset($_POST['grouplist']) && $_POST['grouplist'] != ""){
+ if ($s_action=="edit"){
/* Get 'dn' from posted 'uid', must be unique */
- $this->dn= trim($_POST['grouplist']);
+ $this->dn= $this->grouplist[trim($s_entry)]['dn'];
/* Check locking, save current plugin in 'back_plugin', so
the dialog knows where to return. */
@@ -182,10 +262,9 @@ class groupManagement extends plugin
}
/* Remove user was requested */
- if (isset($_POST['delete_group']) && isset($_POST['grouplist'])){
-
+ if ($s_action=="del"){
/* Get 'dn' from posted 'uid' */
- $this->dn= trim($_POST['grouplist']);
+ $this->dn= $this->grouplist[trim($s_entry)]['dn'];
/* Load permissions for selected 'dn' and check if
we're allowed to remove this 'dn' */
@@ -264,16 +343,109 @@ class groupManagement extends plugin
return ($display);
}
+ /* Prepare departments */
+ $options= "";
+ foreach ($this->config->idepartments as $key => $value){
+ if ($groupfilter['depselect'] == $key){
+ $options.= "$value ";
+ } else {
+ $options.= "$value ";
+ }
+ }
+
+ // Managment
+ $listhead = "";
+
+
+ $actions = " ";
+ $actions.= " ";
+
+ // Defining Links
+ $linkopen = "%s ";
+
+ // image Buttons
+ $editlink = "%s ";
+ $userimg = " ";
+
+ // Extension images
+ $posiximg = " ";
+ $mailimg = " ";
+ $sambaimg = " ";
+ $applimg = " ";
+ $phoneimg = " ";
+ // Space
+ $empty = " ";
+
+
+ $divlist = new divlist();
+ $divlist->SetHeader(array(
+ array("string" => " "),
+ array("string" => _("Groupname")." / "._("Department")),
+ array("string" => _("Properties"), "attach" => "style='width:100px;'"),
+ array("string" => _("Actions") ,"attach" => "style='border:none'")
+ ));
+
+
+ $divlist->SetSummary(_("This table displays all groups, in the selected tree."));
+ $divlist->SetEntriesPerPage(20);
+
+ foreach($this->departments as $key=> $val){
+
+ $field1 = array("string" => " ");
+ $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val));
+ $field3 = array("string" => " ");
+ $field4 = array("string" => " ","attach"=>"style='text-align:right;border:none'");
+
+ $divlist->AddEntry(array($field1,$field2,$field3,$field4));
+ }
+
+ foreach($this->grouplist as $key => $val){
+
+ if(isset($val['objectClass'])){
+ if(in_array("posixGroup", $val['objectClass'])) $posix = $posiximg; else $posix = $empty;
+ if(in_array("gosaMailAccount", $val['objectClass'])) $mail = $mailimg; else $mail = $empty;
+ if(in_array("sambaGroupMapping", $val['objectClass'])) $samba = $sambaimg; else $samba = $empty;
+ if(in_array("gosaApplicationGroup", $val['objectClass'])) $appl = $applimg; else $appl = $empty;
+ if(in_array("goFonPickupGroup", $val['objectClass'])) $phone = $phoneimg; else $phone = $empty;
+ }else{
+ $posix=$mail=$samba=$appl=$phone=$empty;
+ }
+
+ $title = "title='gid : ".$key." - dn : ".$val['dn']."'";
+
+ if(!isset($val['description'][0])){
+ $desc = "";
+ }else{
+ $desc = " - [ ".$val['description'][0]." ]";
+ }
+ $field1 = array("string" => sprintf($userimg,$val['dn']),"attach"=>"style='width:20px;align:middle;'");
+ $field2 = array("string" => sprintf($editlink,$key,($val['cn']['0'].$desc)),"attach"=>$title);
+ $field3 = array("string" => $posix." ".$mail." ".$samba." ".$appl." ".$phone);
+ $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions),"attach"=>"style='text-align:right;border:none;width:32px;'");
+
+ $divlist->AddEntry(array($field1,$field2,$field3,$field4));
+ }
+
/* Show main page */
- $smarty->assign("grouplist", $this->grouplist);
+ $smarty->assign("grouplisthead", $listhead);
+ $smarty->assign("grouplist", $divlist->DrawList());
$smarty->assign("search_image", get_template_path('images/search.png'));
$smarty->assign("tree_image", get_template_path('images/tree.png'));
$smarty->assign("infoimage", get_template_path('images/info.png'));
$smarty->assign("launchimage", get_template_path('images/launch.png'));
$smarty->assign("deplist", $this->config->idepartments);
- foreach( array("depselect", "guser", "regex", "primarygroups", "mailgroups",
- "appgroups", "sambagroups", "functionalgroups", "subsearch") as $type){
-
+ foreach( array("depselect", "guser", "regex", "primarygroups", "mailgroups","appgroups", "sambagroups", "functionalgroups", "subsearch") as $type){
$smarty->assign("$type", $groupfilter[$type]);
}
@@ -355,16 +527,36 @@ class groupManagement extends plugin
$error2= $ldap->error;
while ($attrs= $ldap->fetch()){
if (!isset($primaries[$attrs['gidNumber'][0]])){
- if (isset($attrs["description"][0])){
- $this->grouplist[$attrs["dn"]]= $attrs["cn"][0]." [".
- $attrs["description"][0]."]";
- } else {
- $this->grouplist[$attrs["dn"]]= $attrs["cn"][0];
- }
+ $this->grouplist[$attrs['gidNumber'][0]]= $attrs;
}
}
}
+ /* NEW LIST MANAGMENT
+ * We also need to search for the departments
+ * So we are able to navigate like in konquerer
+ */
+ $base2 = preg_replace("/ou=people,/i","",$base);
+
+ $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+ TRUE, $base2, array("ou", "description"), TRUE);
+
+ $this->departments= array();
+ foreach ($res3 as $value){
+ if($value["description"][0]!=".."){
+ $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+ }else{
+ $this->departments[$value['dn']]=$value["description"][0];
+ }
+ }
+
+ /* END NEW LIST MANAGMENT
+ */
+
+
+
+
+
/* Generate grouplist */
if ($filter != ""){
$filter= "(&(cn=$regex)(objectClass=posixGroup)(|$filter))";
@@ -383,15 +575,9 @@ class groupManagement extends plugin
}
foreach ($res as $value){
- if (isset($value["description"][0])){
- $this->grouplist[$value["dn"]]= $value["cn"][0]." [".
- $value["description"][0]."]";
- } else {
- $this->grouplist[$value["dn"]]= $value["cn"][0];
- }
+ $this->grouplist[$value['gidNumber'][0]]= $value;
}
- natcasesort ($this->grouplist);
reset ($this->grouplist);
}
diff --git a/plugins/admin/groups/headpage.tpl b/plugins/admin/groups/headpage.tpl
index b82835499..c9612094e 100644
--- a/plugins/admin/groups/headpage.tpl
+++ b/plugins/admin/groups/headpage.tpl
@@ -7,17 +7,12 @@
+
+
+ {$grouplist}
-
@@ -29,9 +24,6 @@
{t}This menu allows you to add, edit and remove selected groups. You may want to use the range selector on top of the group listbox, when working with a large number of groups.{/t}
-
- {t}-Edit- and -New...- will execute an assistant to aid you in editing group properties. -Delete- will ask for confirmation before removing groups.{/t}
-
@@ -68,29 +60,6 @@
-
-
-
-
-
-
-
- {t}Display groups of department{/t}
-
-
-
- {html_options options=$deplist selected=$depselect}
-
-
-
-
diff --git a/plugins/admin/ogroups/class_ogroupManagement.inc b/plugins/admin/ogroups/class_ogroupManagement.inc
index 15eb4b506..17d0c1004 100644
--- a/plugins/admin/ogroups/class_ogroupManagement.inc
+++ b/plugins/admin/ogroups/class_ogroupManagement.inc
@@ -73,15 +73,16 @@ class ogroupManagement extends plugin
/* Prepare template */
$smarty= get_smarty();
- /* Save data */
$ogroupfilter= get_global("ogroupfilter");
+ $s_action = "";
+ $s_entry = "";
foreach( array("depselect", "regex") as $type){
if (isset($_POST[$type])){
$ogroupfilter[$type]= $_POST[$type];
}
}
- if (isset($_POST['depselect'])){
+ if (isset($_POST['regex'])){
foreach( array("usergroups", "groupgroups", "appgroups", "depgroups",
"servergroups", "wsgroups", "prtgroups", "tcgroups", "fongroups") as $type){
@@ -99,6 +100,82 @@ class ogroupManagement extends plugin
}
$ogroupfilter['regex']= $s;
}
+
+ /* Test Posts */
+ foreach($_POST as $key => $val){
+ // Post for delete
+ if(preg_match("/group_del.*/",$key)){
+ $s_action = "del";
+ $s_entry = preg_replace("/group_".$s_action."_/i","",$key);
+ // Post for edit
+ }elseif(preg_match("/group_edit_.*/",$key)){
+ $s_action="edit";
+ $s_entry = preg_replace("/group_".$s_action."_/i","",$key);
+ // Post for new
+ }elseif(preg_match("/dep_back.*/i",$key)){
+ $s_action="back";
+ }elseif(preg_match("/group_new.*/",$key)){
+ $s_action="new";
+ }elseif(preg_match("/dep_home.*/i",$key)){
+ $s_action="home";
+ }elseif(preg_match("/group_tplnew.*/i",$key)){
+ $s_action="new_tpl";
+ }elseif(preg_match("/group_chgpw.*/i",$key)){
+ $s_action="change_pw";
+ $s_entry = preg_replace("/group_chgpw_/i","",$key);
+ }elseif(preg_match("/dep_root.*/i",$key)){
+ $s_action="root";
+ }
+ }
+ $s_entry = preg_replace("/_.$/","",$s_entry);
+
+ /* Department changed? */
+ if(isset($_POST['depselect']) && $_POST['depselect']){
+ $ogroupfilter['depselect']= $_POST['depselect'];
+ $this->reload();
+ }
+
+ /* Start for New List Managment */
+ if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
+ $s_action="open";
+ $s_entry = base64_decode($_GET['dep_id']);
+ $ogroupfilter['depselect']= "".$this->config->departments[trim($s_entry)];
+ $this->reload();
+ }
+
+ /* If Backbutton is Posted */
+ if($s_action=="back"){
+ $base_back = preg_replace("/^[^,]+,/","",$ogroupfilter['depselect']);
+ $base_back = convert_department_dn($base_back);
+
+ if(isset($this->config->departments[trim($base_back)])){
+ $ogroupfilter['depselect']= $this->config->departments[trim($base_back)];
+ }else{
+ $ogroupfilter['depselect']= $this->config->departments["/"];
+ }
+ register_global("ogroupfilter", $ogroupfilter);
+ $this->reload();
+ }
+
+ /* Homebutton is posted */
+ if($s_action=="home"){
+ $ogroupfilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
+ $ogroupfilter['depselect']=(preg_replace("/^[^,]+,/","",$ogroupfilter['depselect']));
+ $this->reload();
+ }
+
+ /* root posted */
+ if($s_action=="root"){
+ $ogroupfilter['depselect']=($this->config->current['BASE']);
+ $this->reload();
+ }
+
+ // Edit if
+ if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+ $s_action ="edit";
+ $s_entry = $_GET['id'];
+ }
+
register_global("ogroupfilter", $ogroupfilter);
/* Prepare formular */
@@ -115,7 +192,7 @@ class ogroupManagement extends plugin
}
/* New group? */
- if (isset($_POST['new_group'])){
+ if ($s_action=="new"){
/* By default we set 'dn' to 'new', all relevant plugins will
react on this. */
@@ -127,10 +204,10 @@ class ogroupManagement extends plugin
$this->ogroup->set_acl(array(':all'));
}
- if (isset($_POST['delete_group']) && isset($_POST['grouplist'])){
+ if ($s_action=="del"){
/* Get 'dn' from posted 'uid' */
- $this->dn= trim($_POST['grouplist']);
+ $this->dn= $this->ogrouplist[$s_entry]['dn'];
/* Load permissions for selected 'dn' and check if
we're allowed to remove this 'dn' */
@@ -194,10 +271,10 @@ class ogroupManagement extends plugin
unset($_SESSION['objectinfo']);
}
- if ((isset($_POST['select_group']) || (isset($_POST['edit_helper']) && $_POST['edit_helper'] == "1")) && isset($_POST['grouplist']) && $_POST['grouplist'] != ""){
+ if ($s_action=="edit"){
/* Get 'dn' from posted 'uid', must be unique */
- $this->dn= trim($_POST['grouplist']);
+ $this->dn= $this->ogrouplist[$s_entry]['dn'];
/* Check locking, save current plugin in 'back_plugin', so
the dialog knows where to return. */
@@ -275,6 +352,99 @@ class ogroupManagement extends plugin
return ($display);
}
+ /* Prepare departments */
+ $options= "";
+ foreach ($this->config->idepartments as $key => $value){
+ if ($ogroupfilter['depselect'] == $key){
+ $options.= "$value ";
+ } else {
+ $options.= "$value ";
+ }
+ }
+
+ // Managment
+ $listhead = "";
+
+
+ $actions = " ";
+ $actions.= " ";
+
+ // Defining Links
+ $linkopen = "%s ";
+
+ // image Buttons
+ $editlink = "%s ";
+ $userimg = " ";
+
+ // Extension images
+ $mailimg = " ";
+
+ // Space
+ $empty = " ";
+
+ // List Setup
+ $divlist = new divlist();
+ $divlist->SetHeader(array(
+ array("string" => " ","attach"=>"style='width:20px;'"),
+ array("string" => _("Name of object groups")." / "._("Departments")),
+ array("string" => _("Properties") ,"attach"=>"style='width:50px;'"),
+ array("string" => _("Actions") ,"attach"=>"style='width:50px;border:none;'")
+ ));
+
+
+ $divlist->SetSummary(_("This table displays all groups, in the selected tree."));
+ $divlist->SetEntriesPerPage(20);
+
+ foreach($this->departments as $key=> $val){
+
+ $field1 = array("string" => " ");
+ $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val));
+ $field3 = array("string" => " ");
+ $field4 = array("string" => " ","attach"=>"style='text-align:right;border:none'");
+
+ $divlist->AddEntry(array($field1,$field2,$field3,$field4));
+ }
+
+ // Assigning ogroups
+ foreach($this->ogrouplist as $key => $val){
+
+ if(isset($val['mail'])){
+ $mail = $mailimg;
+ }else{
+ $mail = $empty;
+ }
+
+ $title = "title='gid : ".$key." - dn : ".$val['dn']."'";
+
+ if(!isset($val['description'][0])){
+ $desc = "";
+ }else{
+ $desc = " - [ ".$val['description'][0]." ]";
+ }
+ $field1 = array("string" => " ");
+ $field2 = array("string" => sprintf($editlink,$key,($val['cn']['0'].$desc)),"attach"=>$title);
+ $field3 = array("string" => $this->convert_list($val)." ".$mail);
+ $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions),"attach"=>"style='text-align:right;border:none'");
+
+ $divlist->AddEntry(array($field1,$field2,$field3,$field4));
+ }
+
+
+
+
+
+
/* Show main page */
$smarty->assign("search_image", get_template_path('images/search.png'));
$smarty->assign("tree_image", get_template_path('images/tree.png'));
@@ -282,7 +452,8 @@ class ogroupManagement extends plugin
$smarty->assign("launchimage", get_template_path('images/launch.png'));
$smarty->assign("deplist", $this->config->idepartments);
- $smarty->assign("groups", $this->convert_list($this->grouplist));
+ $smarty->assign("groupshead", $listhead);
+ $smarty->assign("groups", $divlist->DrawList());
foreach( array("usergroups", "groupgroups", "appgroups", "depgroups",
"servergroups", "wsgroups", "prtgroups", "tcgroups", "fongroups", "regex", "depselect") as $type){
@@ -299,6 +470,8 @@ class ogroupManagement extends plugin
function convert_list($input)
{
$temp= "";
+
+
$conv= array( "U" => "select_user.png",
"G" => "select_groups.png",
"A" => "select_application.png",
@@ -309,25 +482,25 @@ class ogroupManagement extends plugin
"T" => "select_terminal.png",
"P" => "select_printer.png");
- foreach ($input as $key => $value){
-
- /* Assemble picture */
- $type= $value['type'];
- if (isset($type[0])){
- $p1= $conv[$type[0]];
- } else {
- $p1= "empty.png";
- }
- if (isset($type[1])){
- $p2= $conv[$type[1]];
- } else {
- $p2= "empty.png";
- }
-
- /* Generate output */
- $temp= "".$value['text']." \n".$temp;
+ /* Assemble picture */
+ $type= $input['gosaGroupObjects'][0];
+ $type= preg_replace("/[^A-Z]/i","",$type);
+ if (isset($type[0])){
+ $p1['pic']= $conv[$type[0]];
+ $p1['alt']= $type[0];
+ } else {
+ $p1['pic']= "empty.png";
+ $p1['alt']= "";
}
-
+ if (isset($type[1])){
+ $p2['pic']= $conv[$type[1]];
+ $p2['alt']= $type[1];
+ } else {
+ $p2['pic']= "empty.png";
+ $p2['alt']= "";
+ }
+ $temp = " ";
+ $temp.= " ";
return ($temp);
}
@@ -348,9 +521,9 @@ class ogroupManagement extends plugin
}
/* User filter? */
- $this->grouplist= array();
+ $this->oogrouplist= array();
- /* Generate grouplist filter */
+ /* Generate oogrouplist filter */
$filter= "";
if ($ogroupfilter['usergroups'] == "checked"){
@@ -386,22 +559,36 @@ class ogroupManagement extends plugin
} else {
$filter= "(&(cn=$regex)(objectClass=gosaGroupOfNames))";
}
- $res= get_list($this->ui->subtreeACL, "$filter", TRUE, $base, array("cn", "description", "gosaGroupObjects"), TRUE);
- foreach ($res as $value){
- $pictype= preg_replace('/[\[\]]/', '', $value["gosaGroupObjects"][0]);
- $sortstring= preg_split('//', $pictype, -1, PREG_SPLIT_NO_EMPTY);
- sort($sortstring);
- $pictype= implode("", $sortstring);
- if (isset($value["description"][0])){
- $this->grouplist[$value["dn"]]= array("text" => $value["cn"][0]." [".
- $value["description"][0]."]", "type" => $pictype);
- } else {
- $this->grouplist[$value["dn"]]= array("text" => $value["cn"][0],
- "type" => $pictype);
+ $res= get_list($this->ui->subtreeACL, "$filter", TRUE, $base, array("*"), TRUE);
+ $this->ogrouplist= $res;
+ ksort ($this->ogrouplist);
+ reset ($this->ogrouplist);
+
+
+ /* NEW LIST MANAGMENT
+ * We also need to search for the departments
+ * So we are able to navigate like in konquerer
+ */
+ $base2 = preg_replace("/ou=people,/i","",$base);
+
+ $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+ TRUE, $base2, array("ou", "description"), TRUE);
+
+ $this->departments= array();
+ foreach ($res3 as $value){
+ if($value["description"][0]!=".."){
+ $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+ }else{
+ $this->departments[$value['dn']]=$value["description"][0];
}
}
- ksort ($this->grouplist);
- reset ($this->grouplist);
+
+ /* END NEW LIST MANAGMENT
+ */
+
+
+
+
}
}
diff --git a/plugins/admin/ogroups/headpage.tpl b/plugins/admin/ogroups/headpage.tpl
index fb31c5b5d..6c18ce833 100644
--- a/plugins/admin/ogroups/headpage.tpl
+++ b/plugins/admin/ogroups/headpage.tpl
@@ -7,17 +7,11 @@
+
+
{$groups}
-
-
-
-
-
-
-
-
@@ -29,9 +23,6 @@
{t}This menu allows you to add, edit or remove selected groups. You may want to use the range selector on top of the group listbox, when working with a large number of groups.{/t}
-
- {t}-Edit- and -New...- will execute an assistant to aid you in editing group properties. -Delete- will ask for confirmation before removing groups.{/t}
-
@@ -57,12 +48,8 @@
-
{t}Display groups of department{/t}
-
- {html_options options=$deplist selected=$depselect}
-
-
+
{$apply}
diff --git a/plugins/admin/systems/class_systemManagement.inc b/plugins/admin/systems/class_systemManagement.inc
index 4020c6b1a..e553b9206 100644
--- a/plugins/admin/systems/class_systemManagement.inc
+++ b/plugins/admin/systems/class_systemManagement.inc
@@ -31,6 +31,7 @@ class systems extends plugin
/* Definitions */
var $plHeadline= "Systems";
var $plDescription= "This does something";
+ var $departments=array();
/* Dialog attributes */
var $systab= NULL;
@@ -88,17 +89,85 @@ class systems extends plugin
}
$terminalfilter['regex']= $s;
}
- register_global("terminalfilter", $terminalfilter);
- /* Check sorting variable */
- if (!isset($this->systab) &&
- !isset($_POST['new_terminal']) &&
- !isset($_POST['delete_terminal']) &&
- !isset($_POST['set_password']) &&
- !isset($_POST['select_terminal'])){
- $this->reload();
+ $terminalfilter = get_global("terminalfilter"); // contains Filter Settings
+ $s_action = ""; // Contains the action to proceed
+ $s_entry = ""; // The value for s_action
+ $base_back = ""; // The Link for Backbutton
+ $smarty = get_smarty();
+
+ /* Start for New List Managment */
+ if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
+ $s_action="open";
+ $s_entry = base64_decode($_GET['dep_id']);
+ $terminalfilter['depselect']= "".$this->config->departments[trim($s_entry)];
+ $this->reload();
+ }
+
+ /* Test Posts */
+ foreach($_POST as $key => $val){
+ // Post for delete
+ if(preg_match("/user_del.*/",$key)){
+ $s_action = "del";
+ $s_entry = preg_replace("/user_".$s_action."_/i","",$key);
+ // Post for edit
+ }elseif(preg_match("/user_edit_.*/",$key)){
+ $s_action="edit";
+ $s_entry = preg_replace("/user_".$s_action."_/i","",$key);
+ // Post for new
+ }elseif(preg_match("/dep_back.*/i",$key)){
+ $s_action="back";
+ }elseif(preg_match("/user_new.*/",$key)){
+ $s_action="new";
+ }elseif(preg_match("/dep_home.*/i",$key)){
+ $s_action="home";
+ }elseif(preg_match("/user_tplnew.*/i",$key)){
+ $s_action="new_tpl";
+ }elseif(preg_match("/user_setpwd_.*/i",$key)){
+ $s_action="change_pw";
+ $s_entry = preg_replace("/user_setpwd_/i","",$key);
+ }elseif(preg_match("/dep_root.*/i",$key)){
+ $s_action="root";
+ }
+ }
+
+ if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+ $s_action ="edit";
+ $s_entry = $_GET['id'];
+ }
+
+ $s_entry = preg_replace("/_.$/","",$s_entry);
+
+ /* Department changed? */
+ if(isset($_POST['depselect']) && $_POST['depselect']){
+ $terminalfilter['depselect']= $_POST['depselect'];
+ }
+
+ /* Homebutton is posted */
+ if($s_action=="home"){
+ $terminalfilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
+ $terminalfilter['depselect']=(preg_replace("/^[^,]+,/","",$terminalfilter['depselect']));
+ }
+
+ if($s_action=="root"){
+ $terminalfilter['depselect']=($this->config->current['BASE']);
+ }
+
+
+ /* If Backbutton is Posted */
+ if($s_action=="back"){
+ $base_back = preg_replace("/^[^,]+,/","",$terminalfilter['depselect']);
+ $base_back = convert_department_dn($base_back);
+
+ if(isset($this->config->departments[trim($base_back)])){
+ $terminalfilter['depselect']= $this->config->departments[trim($base_back)];
+ }else{
+ $terminalfilter['depselect']= $this->config->departments["/"];
+ }
}
- $smarty= get_smarty();
+
+ register_global("terminalfilter", $terminalfilter);
+ $this->reload();
/* Check for exeeded sizelimit */
if (($message= check_sizelimit()) != ""){
@@ -106,7 +175,7 @@ class systems extends plugin
}
/* Try to get informations about what kind of system to create */
- if (isset($_POST['new_terminal'])) {
+ if ($s_action=="new") {
return ($smarty->fetch(get_template_path('chooser.tpl', TRUE)));
}
@@ -159,11 +228,10 @@ class systems extends plugin
}
/* User wants to edit data? */
- if ((isset($_POST['select_terminal']) || (isset($_POST['edit_helper']) && $_POST['edit_helper'] == "1")) && isset($_POST['termlist']) &&
- $_POST['termlist'] != ""){
+ if ($s_action == "edit"){
/* Get 'dn' from posted 'cn', must be unique */
- $this->dn= trim($_POST['termlist']);
+ $this->dn= $this->terminals[$s_entry]['dn'];
/* Check locking, save current plugin in 'back_plugin', so
the dialog knows where to return. */
@@ -250,8 +318,8 @@ class systems extends plugin
}
/* Set terminals root password */
- if (isset($_POST['set_password']) && isset($_POST['termlist'])){
- $this->dn= trim($_POST['termlist']);
+ if ($s_action=="change_pw"){
+ $this->dn= $this->terminals[$s_entry]['dn'];
$_SESSION['objectinfo']= $this->dn;
return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
}
@@ -297,10 +365,10 @@ class systems extends plugin
}
/* Remove terminal was requested */
- if (isset($_POST['delete_terminal']) && isset($_POST['termlist'])){
+ if ($s_action=="del"){
/* Get 'dn' from posted termlinst */
- $this->dn= $_POST['termlist'];
+ $this->dn= $this->terminals[$s_entry]['dn'];
/* Load permissions for selected 'dn' and check if
we're allowed to remove this 'dn' */
@@ -445,8 +513,127 @@ class systems extends plugin
return ($display);
}
+
+
+
+
+
+ /* Prepare departments */
+ $options= "";
+ foreach ($this->config->idepartments as $key => $value){
+ if ($terminalfilter['depselect'] == $key){
+ $options.= "$value ";
+ } else {
+ $options.= "$value ";
+ }
+ }
+
+
+ /* NEW LIST MANAGMENT */
+ $listhead = "";
+
+
+
+ $action= " ";
+ $action.= " ";
+
+
+ $divlist = new divlist();
+ $divlist->SetHeader(array(
+ array("string" => " "),
+ array("string" => _("System")." / "._("Department")),
+ array("string" => _("Actions"), "attach" => "style='border:none'" )));
+
+
+ $divlist->SetSummary(_("This table displays all users, in the selected tree."));
+ $divlist->SetEntriesPerPage(20);
+
+ // Defining Links
+ $linkopen = "%s ";
+
+ foreach($this->departments as $key=> $val){
+ $field1 = array("string" => " ");
+ $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val));
+ $field3 = array("string" => " ", "attach" => "style='border:none'");
+ $divlist->AddEntry(array($field1,$field2,$field3));
+ }
+
+ // Space
+ $empty ="";//= " ";
+
+ // User and Template Images
+ $editlink = "%s ";
+
+ // Pictures for Extensions
+ $img1 = " ";
+ $img2 = " ";
+ $img3 = " ";
+ $img4 = " ";
+ $img5 = " ";
+ $img6 = " ";
+ $img7 = " ";
+ $img8 = " ";
+ $img9 = " ";
+ $img10 = " ";
+
+ // Test Every Entry and generate divlist Array
+ foreach($this->terminals as $key => $val){
+ // Specify Pics for Extensions
+ if(in_array("goCupsServer" ,$val['objectClass'])) $cups = $img1; else $cups =$empty;
+ if(in_array("goLogDBServer" ,$val['objectClass'])) $logdb = $img2; else $logdb =$empty;
+ if(in_array("goSyslogServer" ,$val['objectClass'])) $syslog = $img3; else $syslog=$empty;
+ if(in_array("goImapServer" ,$val['objectClass'])) $imap = $img4; else $imap =$empty;
+ if(in_array("sambaSamAccount" ,$val['objectClass'])) $samba = $img5; else $samba =$empty;
+ if(in_array("goNfsServer" ,$val['objectClass'])) $nfs = $img6; else $nfs =$empty;
+ if(in_array("goKrbServer" ,$val['objectClass'])) $krb = $img7; else $krb =$empty;
+ if(in_array("goFonServer" ,$val['objectClass'])) $fon = $img8; else $fon =$empty;
+ if(in_array("goFaxServer" ,$val['objectClass'])) $fax = $img9; else $fax =$empty;
+ if(in_array("goLdapServer" ,$val['objectClass'])) $ldap = $img10; else $ldap =$empty;
+
+ $pics = $cups.$logdb.$syslog.$imap.$samba.$nfs.$krb.$fon.$fax.$ldap;
+ $pics = "";
+ // Generate Array to Add
+ if((isset($val['is_new']))&&(!empty($val['is_new']))){
+ $display= "".$val["cn"][0]." ".$val['is_new'];
+ }else{
+ $display= "".$val["cn"][0]."";
+ }
+
+ if(in_array("gotoTerminal",$val['objectClass'])){
+ $action2 = " ";
+ }else{
+ $action2 = "";
+ }
+
+
+ if(isset($val['message'])){
+ $display.= " (".$val['message']." '".$this->config->idepartments[$terminalfilter['depselect']]."' )";
+ }
+
+ $img=$this->convert_list($val);
+
+ $field1 = array("string" => sprintf($img['img'],$val['dn']),"attach"=>"style='width:20px;align:middle;'");
+ $field2 = array("string" => sprintf($editlink,$key,$display),"attach"=>"title='".$val['dn']."'");
+ $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action),"attach" => "style='border:none; text-align:right;width:48px'");
+ $divlist->AddEntry( array($field1,$field2,$field3));
+ }
+
+
+
+
+
/* Show main page */
- $smarty->assign("terminals", $this->convert_list($this->terminals));
+ $smarty->assign("terminalshead", $listhead);
+ $smarty->assign("terminals", $divlist->DrawList());
$smarty->assign("search_image", get_template_path('images/search.png'));
$smarty->assign("tree_image", get_template_path('images/tree.png'));
$smarty->assign("infoimage", get_template_path('images/info.png'));
@@ -471,7 +658,9 @@ class systems extends plugin
{
$temp= "";
$conv= array( "D" => "select_default.png",
- "T" => "select_terminal.png",
+
+
+ "T" => "select_terminal.png",
"L" => "select_workstation.png",
"F" => "select_phone.png",
"S" => "select_server.png",
@@ -481,22 +670,16 @@ class systems extends plugin
"C" => "select_component.png",
"P" => "select_printer.png");
- foreach ($input as $key => $value){
- $mode= preg_replace('/^.*(.)$/', '\\1', $value);
- if ($mode == "D"){
- $temp= "".preg_replace('/.$/', '', $value)." \n".$temp;
- } else {
- if (preg_match('/^\+/', $value)){
- $value= preg_replace('/^\+ /', '', $value);
- $new= "N";
- } else {
- $new= "";
- }
- $temp.= "".preg_replace('/.$/', '', $value)." \n";
+ if((isset($input['is_new']))&&(!empty($input['is_new']))){
+ $input['type']="N".$input['type'];
+ }
+ foreach ($conv as $key => $value){
+ if($input['type']==$key){
+ $tmp['img'] =" ";
+ $tmp['class']=$key;
+ return $tmp;
}
}
-
- return ($temp);
}
function remove_from_parent()
@@ -611,6 +794,35 @@ class systems extends plugin
$this->terminals= array();
$res= get_list($this->ui->subtreeACL, "(|$termfilter$workfilter$winfilter$printfilter$phonefilter$serverfilter$netfilter)", TRUE, $base, array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), TRUE);
+
+
+ /* NEW LIST MANAGMENT
+ * We also need to search for the departments
+ * So we are able to navigate like in konquerer
+ */
+ $base2 = preg_replace("/ou=people,/i","",$base);
+
+ $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+ TRUE, $base2, array("ou", "description"), TRUE);
+
+ $this->departments= array();
+ $tmp = array();
+ foreach ($res3 as $value){
+ $tmp[strtolower($value['dn']).$value['dn']]=$value;
+ }
+ ksort($tmp);
+ foreach($tmp as $value){
+ if($value["description"][0]!=".."){
+ $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+ }else{
+ $this->departments[$value['dn']]=$value["description"][0];
+ }
+ }
+
+ /* END NEW LIST MANAGMENT
+ */
+
+
foreach ($res as $value){
/* Look for new terminals and mark them with '+' */
@@ -650,57 +862,42 @@ class systems extends plugin
$add= "";
}
+ $terminal = array();
+
if (in_array ($tmp, $responsible) || $add != ""){
if (in_array('gotoTerminal', $value["objectClass"])){
- if (isset($value["macAddress"][0]) &&
- $value["macAddress"][0] != "-"){
-
- $this->terminals[$value["dn"]]= $add." ".
- $value["cn"][0].
- " [".$value["macAddress"][0]."]T";
+ if (isset($value["macAddress"][0]) && $value["macAddress"][0] != "-"){
+ $terminal = $value;
+ $terminal['type'] = "T";
+ $terminal['is_new'] = $add;
} else {
- $location= array_search($tmp, $this->config->departments);
- $this->terminals[$value["dn"]]= _("Thin client template for").
- " $location"."D";
+ $terminal = $value;
+ $terminal['type'] = "D";
+ $terminal['message'] = _("Terminal template for");
+ $terminal['location'] = array_search($tmp, $this->config->departments);
}
} elseif (in_array('gotoWorkstation', $value["objectClass"])){
- if (isset($value["macAddress"][0]) &&
- $value["macAddress"][0] != "-"){
-
- $this->terminals[$value["dn"]]= $add." ".
- $value["cn"][0].
- " [".$value["macAddress"][0]."]L";
+ if (isset($value["macAddress"][0]) && $value["macAddress"][0] != "-"){
+ $terminal = $value;
+ $terminal['type'] = "L";
} else {
- $location= array_search($tmp, $this->config->departments);
- $this->terminals[$value["dn"]]= _("Workstation template for").
- " $location"."D";
+ $terminal = $value;
+ $terminal['type'] = "D";
+ $terminal['location'] = array_search($tmp, $this->config->departments);
+ $terminal['message'] = _("Workstation template for");
}
} elseif (in_array('gotoPrinter', $value["objectClass"])){
- if (isset($value['description'][0])){
- $this->terminals[$value['dn']]= $value['cn'][0]." [".$value['description'][0]."]P";
- } else {
- $this->terminals[$value['dn']]= $value['cn'][0]."P";
- }
+ $terminal = $value;
+ $terminal['type'] = "P";
} elseif (in_array('goServer', $value["objectClass"])){
- if (isset($value['description'][0])){
- $this->terminals[$value['dn']]= $value['cn'][0]." [".$value['description'][0]."]S";
- } else {
- $this->terminals[$value['dn']]= $value['cn'][0]."S";
- }
+ $terminal = $value;
+ $terminal['type'] = "S";
} elseif (in_array('goFonHardware', $value["objectClass"])){
-
- if (isset($value['description'][0])){
- $this->terminals[$value['dn']]= $value['cn'][0]." [".$value['description'][0]."]F";
- } else {
- $this->terminals[$value['dn']]= $value['cn'][0]."F";
- }
+ $terminal = $value;
+ $terminal['type'] = "F";
} elseif (in_array('ieee802Device', $value["objectClass"])){
-
- if (isset($value['description'][0])){
- $this->terminals[$value['dn']]= $value['cn'][0]." [".$value['description'][0]."]C";
- } else {
- $this->terminals[$value['dn']]= $value['cn'][0]."C";
- }
+ $terminal = $value;
+ $terminal['type'] = "C";
} else{
$name= preg_replace('/\$$/', '', $value['cn'][0]);
if (isset($value['sambaDomainName'])){
@@ -708,11 +905,23 @@ class systems extends plugin
} else {
$domain= "";
}
- $this->terminals[$value['dn']]= $name.$domain."W";
+ $terminal=$value;
+ $terminal['type'] ="W";
+ $terminal['domain'] = $name.$domain;
}
+ $this->terminals[]=$terminal;
}
}
- natcasesort ($this->terminals);
+
+ $tmp=array();
+ foreach($this->terminals as $tkey => $val ){
+ $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+ }
+ ksort($tmp);
+ $this->terminals=array();
+ foreach($tmp as $val){
+ $this->terminals[]=$val;
+ }
reset ($this->terminals);
}
diff --git a/plugins/admin/systems/headpage.tpl b/plugins/admin/systems/headpage.tpl
index c374e1854..62fff7c38 100644
--- a/plugins/admin/systems/headpage.tpl
+++ b/plugins/admin/systems/headpage.tpl
@@ -7,17 +7,12 @@
+
+
{$terminals}
-
-
-
-
-
-
-
@@ -28,9 +23,6 @@
{t}This menu allows you to add, remove and change the properties of specific systems. You can only add systems which have already been started once.{/t}
-
- {t}-Edit- will execute an assistant to aid you in changing the system properties. -Delete- will ask for confirmation before deleting systems.{/t}
-
@@ -53,18 +45,6 @@
-
-
-
- {t}Display systems of department{/t}
-
-
-
- {html_options options=$deplist selected=$depselect}
-
-
-
-
diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc
index a2a65bcf6..6e8c5d124 100644
--- a/plugins/admin/users/class_userManagement.inc
+++ b/plugins/admin/users/class_userManagement.inc
@@ -32,6 +32,7 @@ class userManagement extends plugin
var $acl= "";
var $templates= array();
var $got_uid= false;
+ var $departments=array();
function userManagement ($config, $ui)
{
@@ -58,45 +59,124 @@ class userManagement extends plugin
function execute()
{
- $smarty= get_smarty();
- $userfilter= get_global("userfilter");
+ $smarty = get_smarty(); // Smarty instance
+ $userfilter = get_global("userfilter"); // contains Filter Settings
+ $s_action = ""; // Contains the action to proceed
+ $s_entry = ""; // The value for s_action
+ $base_back = ""; // The Link for Backbutton
+
+ /* Start for New List Managment */
+ if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
+ $s_action="open";
+ $s_entry = base64_decode($_GET['dep_id']);
+ $userfilter['depselect']= "".$this->config->departments[trim($s_entry)];
+ $this->reload();
+ }
+
+ /* Test Posts */
+ foreach($_POST as $key => $val){
+ // Post for delete
+ if(preg_match("/user_del.*/",$key)){
+ $s_action = "del";
+ $s_entry = preg_replace("/user_".$s_action."_/i","",$key);
+ // Post for edit
+ }elseif(preg_match("/user_edit_.*/",$key)){
+ $s_action="edit";
+ $s_entry = preg_replace("/user_".$s_action."_/i","",$key);
+ // Post for new
+ }elseif(preg_match("/dep_back.*/i",$key)){
+ $s_action="back";
+ }elseif(preg_match("/user_new.*/",$key)){
+ $s_action="new";
+ }elseif(preg_match("/dep_home.*/i",$key)){
+ $s_action="home";
+ }elseif(preg_match("/user_tplnew.*/i",$key)){
+ $s_action="new_tpl";
+ }elseif(preg_match("/user_chgpw.*/i",$key)){
+ $s_action="change_pw";
+ $s_entry = preg_replace("/user_chgpw_/i","",$key);
+ }elseif(preg_match("/dep_root.*/i",$key)){
+ $s_action="root";
+ }
+ }
+
+ if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+ $s_action ="edit";
+ $s_entry = $_GET['id'];
+ }
+
+ $s_entry = preg_replace("/_.$/","",$s_entry);
+
+ /* Department changed? */
+ if(isset($_POST['depselect']) && $_POST['depselect']){
+ $userfilter['depselect']= $_POST['depselect'];
+ $this->reload();
+ }
+
+ /* Homebutton is posted */
+ if($s_action=="home"){
+ $userfilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
+ $userfilter['depselect']=(preg_replace("/^[^,]+,/","",$userfilter['depselect']));
+ $this->reload();
+ }
+
+ if($s_action=="root"){
+ $userfilter['depselect']=($this->config->current['BASE']);
+ $this->reload();
+ }
+
+
+ /* If Backbutton is Posted */
+ if($s_action=="back"){
+ $base_back = preg_replace("/^[^,]+,/","",$userfilter['depselect']);
+ $base_back = convert_department_dn($base_back);
+
+ if(isset($this->config->departments[trim($base_back)])){
+ $userfilter['depselect']= $this->config->departments[trim($base_back)];
+ }else{
+ $userfilter['depselect']= $this->config->departments["/"];
+ }
+ $this->reload();
+ }
+
+ /* End for new List Managment */
/* Save filter data if we are in the headpage */
if (!isset($this->usertab)){
- foreach( array("depselect", "regex") as $type){
+ foreach( array("regex") as $type){
if (isset($_POST[$type])){
$userfilter[$type]= $_POST[$type];
}
}
- if (isset($_POST['depselect'])){
- foreach( array("functionalusers", "unixusers", "mailusers",
- "sambausers", "proxyusers", "faxusers", "templates", "subsearch") as $type){
-
- if (isset($_POST[$type])) {
- $userfilter[$type]= "checked";
- } else {
- $userfilter[$type]= "";
- }
+ }
+ if(isset($_POST['regex'])){
+ foreach( array("functionalusers", "unixusers", "mailusers","sambausers", "proxyusers", "faxusers", "templates", "subsearch") as $type){
+ if (isset($_POST[$type])) {
+ $userfilter[$type]= "checked";
+ } else {
+ $userfilter[$type]= "";
}
}
- if (isset($_GET['search'])){
- $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
- if ($s == "**"){
- $s= "*";
- }
- $userfilter['regex']= $s;
+ }
+ if (isset($_GET['search'])){
+ $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+ if ($s == "**"){
+ $s= "*";
}
- register_global("userfilter", $userfilter);
+ $userfilter['regex']= $s;
}
+ register_global("userfilter", $userfilter);
+
/* React on user interaction here */
- if ($_SERVER["REQUEST_METHOD"] == "POST"){
+ if (($_SERVER["REQUEST_METHOD"] == "POST")||($_SERVER["REQUEST_METHOD"]== "GET")){
/* User wants to edit data? */
- if ( (isset($_POST['select_user']) || (isset($_POST['edit_helper']) && $_POST['edit_helper'] == "1")) && isset($_POST['userlist']) && $_POST['userlist'] != ""){
+ if ($s_action=="edit"){
/* Get 'dn' from posted 'uid', must be unique */
- $this->dn= trim($_POST['userlist']);
+
+ $this->dn= $this->list[trim($s_entry)]['dn'];
/* Check locking, save current plugin in 'back_plugin', so
the dialog knows where to return. */
@@ -135,10 +215,10 @@ class userManagement extends plugin
}
/* Password change requested */
- if (isset($_POST['setpass_user']) && isset($_POST['userlist'])){
+ if ($s_action=="change_pw"){
/* Get 'dn' from posted 'uid' */
- $this->dn= trim($_POST['userlist']);
+ $this->dn= $this->list[trim($s_entry)]['dn'];
/* Load permissions for selected 'dn' and check if
we're allowed to remove this 'dn' */
@@ -222,10 +302,10 @@ class userManagement extends plugin
/* Remove user was requested */
- if (isset($_POST['delete_user']) && isset($_POST['userlist'])){
+ if ($s_action=="del"){
/* Get 'dn' from posted 'uid' */
- $this->dn= trim($_POST['userlist']);
+ $this->dn= $this->list[trim($s_entry)]['dn'];
/* Load permissions for selected 'dn' and check if
we're allowed to remove this 'dn' */
@@ -350,7 +430,7 @@ class userManagement extends plugin
}
/* Generate template list */
- if (isset($_POST['new_user'])){
+ if ($s_action=="new"){
$this->templates= array();
$ldap= $this->config->get_ldap_link();
foreach ($this->config->departments as $key => $value){
@@ -374,8 +454,7 @@ class userManagement extends plugin
}
/* New user/template request */
- if (isset($_POST['new_user']) || isset($_POST['new_template'])){
-
+ if (($s_action=="new") || ($s_action=="new_tpl")){
/* By default we set 'dn' to 'new', all relevant plugins will
react on this. */
$this->dn= "new";
@@ -391,7 +470,7 @@ class userManagement extends plugin
$this->usertab->set_acl(array(':all'));
/* Take care about templates */
- if (isset($_POST['new_template'])){
+ if ($s_action=="new_tpl"){
$this->is_template= TRUE;
$this->usertab->set_template_mode ();
} else {
@@ -529,8 +608,133 @@ class userManagement extends plugin
return($message);
}
+ /* Prepare departments */
+ $options= "";
+ foreach ($this->config->idepartments as $key => $value){
+ if ($userfilter['depselect'] == $key){
+ $options.= "$value ";
+ } else {
+ $options.= "$value ";
+ }
+ }
+
+ /* NEW LIST MANAGMENT */
+ $listhead = "";
+
+ $action= " ";
+ $action.= " ";
+ $action.= " ";
+
+
+
+ $divlist = new divlist();
+ $divlist->SetHeader(array(
+ array("string" => " "),
+ array("string" => _("Username")." / "._("Department")),
+ array("string" => _("Properties")),
+ array("string" => _("Actions"), "attach" => "style='border:none'" )));
+
+
+ $divlist->SetSummary(_("This table displays all users, in the selected tree."));
+ $divlist->SetEntriesPerPage(20);
+
+ // Defining Links
+ $linkopen = "%s ";
+
+ foreach($this->departments as $key=> $val){
+
+ $field1 = array("string" => " ");
+ $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val));
+ $field3 = array("string" => " ");
+ $field4 = array("string" => " ", "attach" => "style='border:none'");
+
+
+ $divlist->AddEntry(array($field1,$field2,$field3,$field4));
+ }
+
+ // Pictures for Extensions
+ $usrimg = " ";
+ $posiximg = " ";
+ $mailimg = " ";
+ $fonimg = " ";
+ $faximg = " ";
+ $sambaimg = " ";
+
+ // Space
+ $empty = " ";
+
+ // User and Template Images
+ $userimg = " ";
+ $tplimg = " ";
+
+ $editlink = "%s ";
+
+ // Defines Arrays to save User and Templates
+ $tpls = array();
+ $users= array();
+
+ // Test Every Entry and generate divlist Array
+ foreach($this->list as $key => $val){
+
+ // Specify Pics for Extensions
+ if(in_array("posixAccount" ,$val['objectClass'])) $posix = $posiximg; else $posix=$empty;
+ if(in_array("gosaMailAccount" ,$val['objectClass'])) $maila = $mailimg; else $maila=$empty;
+ if(in_array("goFonAccount" ,$val['objectClass'])) $fonac = $fonimg; else $fonac=$empty;
+ if(in_array("goFaxAccount" ,$val['objectClass'])) $faxac = $faximg; else $faxac=$empty;
+ if(in_array("sambaSamAccount" ,$val['objectClass'])) $samba = $sambaimg; else $samba=$empty;
+ if(in_array("gosaUserTemplate",$val['objectClass'])) $tpl = $tplimg; else $tpl=$userimg;
+
+ // Generate Array to Add
+ if (isset($val["sn"]) && isset($val["givenName"])){
+ $display= $val["sn"][0].", ".$val["givenName"][0]." [".$val["uid"][0]."]";
+ } else {
+ $display= "[".$val["uid"][0]."]";
+ }
+
+ $field1 = array("string" => sprintf($tpl,$val['dn']),"attach"=>"style='width:20px;align:middle;'");
+ $field2 = array("string" => sprintf($editlink,$key,$display),"attach"=>"title='".$val['dn']."'");
+ $field3 = array("string" => $usrimg." ".$posix." ".$maila." ".$fonac." ".$faxac." ".$samba,"attach" => "style='width:118px;'");
+ $field4 = array("string" => preg_replace("/%KEY%/", "$key", $action),"attach" => "style='border:none; text-align:right;width:48px'");
+
+ $add = array($field1,$field2,$field3,$field4);
+
+ // Template or User
+ if(in_array("gosaUserTemplate",$val['objectClass'])){
+ $tpls[strtolower( $val['sn']['0'].$val['uid']['0'])]=$add;
+ }else{
+ $users[strtolower( $val['sn']['0'].$val['uid']['0'])]=$add;
+ }
+ }
+
+ // Sort Entries
+ ksort($users);
+ ksort($tpls);
+
+ // Append Templates
+ foreach($tpls as $key => $val){
+ $divlist->AddEntry( $val, array(""));
+ }
+ // Append Users
+ foreach($users as $key => $val){
+ $divlist->AddEntry( $val, array(""));
+ }
/* Show main page */
- $smarty->assign("userlist", $this->userlist);
+ //$smarty->assign("userlist", nl2br(htmlentities($divlist->DrawList())));
+ $smarty->assign("userlist", $divlist->DrawList());
+ $smarty->assign("userlisthead", $listhead);
+
+ /* END NEW LIST MANAGMENT
+ */
$smarty->assign("search_image", get_template_path('images/search.png'));
$smarty->assign("tree_image", get_template_path('images/tree.png'));
$smarty->assign("infoimage", get_template_path('images/info.png'));
@@ -610,6 +814,30 @@ class userManagement extends plugin
$this->list= get_list($this->ui->subtreeACL, "$filter", FALSE, $base, array("uid", "givenName", "sn", "objectClass"), TRUE);
}
+
+
+ /* NEW LIST MANAGMENT
+ * We also need to search for the departments
+ * So we are able to navigate like in konquerer
+ */
+ $base2 = preg_replace("/ou=people,/i","",$base);
+
+ $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+ TRUE, $base2, array("ou", "description"), TRUE);
+
+ $this->departments= array();
+ foreach ($res3 as $value){
+ if($value["description"][0]!=".."){
+ $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+ }else{
+ $this->departments[$value['dn']]=$value["description"][0];
+ }
+ }
+
+ /* END NEW LIST MANAGMENT
+ */
+
+
$this->userlist= array();
foreach ($this->list as $value){
@@ -627,6 +855,7 @@ class userManagement extends plugin
}
}
}
+
natcasesort ($this->userlist);
reset ($this->userlist);
}
diff --git a/plugins/admin/users/headpage.tpl b/plugins/admin/users/headpage.tpl
index 8ad51c846..d46e4a2a8 100644
--- a/plugins/admin/users/headpage.tpl
+++ b/plugins/admin/users/headpage.tpl
@@ -1,25 +1,18 @@
-
+
{t}List of users{/t} {$hint}
+
+
+ {$userlist}
-
@@ -30,9 +23,6 @@
{t}This menu allows you to create, edit and delete selected users. Having a great number of users, you may want to use the range selectors on top of the user list.{/t}
-
- {t}-Edit- and -New...- execute an assistant to aid you in managing your account informations. -Delete- will ask for confirmation before deleting users.{/t}
-
@@ -55,21 +45,8 @@
-
-
- {t}Display users of department{/t}
-
- {html_options options=$deplist selected=$depselect}
-
-
+
{$apply}
diff --git a/plugins/gofax/blocklists/class_blocklistManagement.inc b/plugins/gofax/blocklists/class_blocklistManagement.inc
index bc9bd46ea..f9a4533ae 100644
--- a/plugins/gofax/blocklists/class_blocklistManagement.inc
+++ b/plugins/gofax/blocklists/class_blocklistManagement.inc
@@ -26,423 +26,574 @@ class blocklist extends plugin
function blocklist ($config, $ui)
{
- $this->ui= $ui;
- $this->dn= "";
- $this->config= $config;
-
- /* Get global filter config */
- if (!is_global("blockfilter")){
- $ui= get_userinfo();
- $base= get_base_from_people($ui->dn);
- $blockfilter= array("sendlists" => "checked",
- "receivelists" => "checked",
- "entry" => "*",
- "depselect" => $base,
- "regex" => "*");
- register_global("blockfilter", $blockfilter);
- }
+ $this->ui= $ui;
+ $this->dn= "";
+ $this->config= $config;
+
+ /* Get global filter config */
+ if (!is_global("blockfilter")){
+ $ui= get_userinfo();
+ $base= get_base_from_people($ui->dn);
+ $blockfilter= array("sendlists" => "checked",
+ "receivelists" => "checked",
+ "entry" => "*",
+ "depselect" => $base,
+ "regex" => "*");
+ register_global("blockfilter", $blockfilter);
+ }
}
function execute()
{
- /* Get global smarty instance */
- $smarty= get_smarty();
-
- /* Save data */
- $blockfilter= get_global("blockfilter");
- foreach( array("depselect", "entry", "regex") as $type){
- if (isset($_POST[$type])){
- $blockfilter[$type]= $_POST[$type];
- }
+ /* Get global smarty instance */
+ $smarty= get_smarty();
+ $blockfilter = get_global("blockfilter"); // contains Filter Settings
+ $s_action = ""; // Contains the action to proceed
+ $s_entry = ""; // The value for s_action
+ $base_back = ""; // The Link for Backbutton
+
+ /* Start for New List Managment */
+ if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
+ $s_action="open";
+ $s_entry = base64_decode($_GET['dep_id']);
+ $blockfilter['depselect']= "".$this->config->departments[trim($s_entry)];
+ $this->reload();
+ }
+
+ /* Test Posts */
+ foreach($_POST as $key => $val){
+ // Post for delete
+ if(preg_match("/user_del.*/",$key)){
+ $s_action = "del";
+ $s_entry = preg_replace("/user_".$s_action."_/i","",$key);
+ // Post for edit
+ }elseif(preg_match("/user_edit_.*/",$key)){
+ $s_action="edit";
+ $s_entry = preg_replace("/user_".$s_action."_/i","",$key);
+ // Post for new
+ }elseif(preg_match("/dep_back.*/i",$key)){
+ $s_action="back";
+ }elseif(preg_match("/user_new.*/",$key)){
+ $s_action="new";
+ }elseif(preg_match("/dep_home.*/i",$key)){
+ $s_action="home";
+ }elseif(preg_match("/user_tplnew.*/i",$key)){
+ $s_action="new_tpl";
+ }elseif(preg_match("/user_chgpw.*/i",$key)){
+ $s_action="change_pw";
+ $s_entry = preg_replace("/user_chgpw_/i","",$key);
+ }elseif(preg_match("/dep_root.*/i",$key)){
+ $s_action="root";
+ }
+ }
+
+
+
+ if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+ $s_action ="edit";
+ $s_entry = $_GET['id'];
+ }
+
+ $s_entry = preg_replace("/_.$/","",$s_entry);
+
+ /* Department changed? */
+ if(isset($_POST['depselect']) && $_POST['depselect']){
+ $blockfilter['depselect']= $_POST['depselect'];
+ $this->reload();
+ }
+
+ /* Homebutton is posted */
+ if($s_action=="home"){
+ $blockfilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
+ $blockfilter['depselect']=(preg_replace("/^[^,]+,/","",$blockfilter['depselect']));
+ $this->reload();
+ }
+
+ if($s_action=="root"){
+ $blockfilter['depselect']=($this->config->current['BASE']);
+ $this->reload();
+ }
+
+ /* If Backbutton is Posted */
+ if($s_action=="back"){
+ $base_back = preg_replace("/^[^,]+,/","",$blockfilter['depselect']);
+ $base_back = convert_department_dn($base_back);
+
+ if(isset($this->config->departments[trim($base_back)])){
+ $blockfilter['depselect']= $this->config->departments[trim($base_back)];
+ }else{
+ $blockfilter['depselect']= $this->config->departments["/"];
+ }
+ $this->reload();
+ }
+
+ register_global("blockfilter", $blockfilter);
+
+ /* Save data */
+ $blockfilter= get_global("blockfilter");
+ foreach( array( "entry", "regex") as $type){
+ if (isset($_POST[$type])){
+ $blockfilter[$type]= $_POST[$type];
+ }
+ }
+ if (isset($_POST['depselect'])){
+ foreach( array("sendlists", "receivelists") as $type){
+
+ if (isset($_POST[$type])) {
+ $blockfilter[$type]= "checked";
+ } else {
+ $blockfilter[$type]= "";
}
- if (isset($_POST['depselect'])){
- foreach( array("sendlists", "receivelists") as $type){
-
- if (isset($_POST[$type])) {
- $blockfilter[$type]= "checked";
- } else {
- $blockfilter[$type]= "";
- }
- }
+ }
+ }
+ if (isset($_GET['search'])){
+ $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+ if ($s == "**"){
+ $s= "*";
+ }
+ $blockfilter['regex']= $s;
+ }
+ register_global("blockfilter", $blockfilter);
+
+ /* Create new blocklist? */
+ if ($s_action=="new"){
+ $this->clear_fields();
+ $this->acl= "#all#";
+ $this->dn= "new";
+ plugin::plugin ($this->config, $this->dn);
+ }
+
+ /* Edit selected blocklist? */
+ if ($s_action=="edit"){
+ $this->clear_fields();
+ $this->dn=$this->blocklists[$s_entry]['dn'];
+ $this->acl= get_permissions ($this->dn, $this->ui->subtreeACL);
+ $this->acl= get_module_permission($this->acl, "blocklists", $this->dn);
+ plugin::plugin ($this->config, $this->dn);
+
+ /* Load missing lists */
+ if (isset($this->attrs["goFaxSBlocklist"])){
+ for ($i= 0; $i<$this->attrs["goFaxSBlocklist"]["count"]; $i++){
+ $this->goFaxBlocklist[]= $this->attrs["goFaxSBlocklist"][$i];
}
- if (isset($_GET['search'])){
- $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
- if ($s == "**"){
- $s= "*";
- }
- $blockfilter['regex']= $s;
+ $this->type= 0;
+ } elseif (isset($this->attrs["goFaxRBlocklist"])){
+ for ($i= 0; $i<$this->attrs["goFaxRBlocklist"]["count"]; $i++){
+ $this->goFaxBlocklist[]= $this->attrs["goFaxRBlocklist"][$i];
}
- register_global("blockfilter", $blockfilter);
-
- /* Create new blocklist? */
- if (isset($_POST['new_blocklist'])){
- $this->clear_fields();
- $this->acl= "#all#";
- $this->dn= "new";
- plugin::plugin ($this->config, $this->dn);
- }
-
- /* Edit selected blocklist? */
- if ((isset($_POST['select_blocklist']) || (isset($_POST['edit_helper']) && $_POST['edit_helper'] == "1")) && isset($_POST['blocklist']) != ""){
- $this->clear_fields();
- $this->dn= trim($_POST['blocklist']);
- $this->acl= get_permissions ($this->dn, $this->ui->subtreeACL);
- $this->acl= get_module_permission($this->acl, "blocklists", $this->dn);
- plugin::plugin ($this->config, $this->dn);
-
- /* Load missing lists */
- if (isset($this->attrs["goFaxSBlocklist"])){
- for ($i= 0; $i<$this->attrs["goFaxSBlocklist"]["count"]; $i++){
- $this->goFaxBlocklist[]= $this->attrs["goFaxSBlocklist"][$i];
- }
- $this->type= 0;
- } elseif (isset($this->attrs["goFaxRBlocklist"])){
- for ($i= 0; $i<$this->attrs["goFaxRBlocklist"]["count"]; $i++){
- $this->goFaxBlocklist[]= $this->attrs["goFaxRBlocklist"][$i];
- }
- $this->type= 1;
- }
- $_SESSION['objectinfo']= trim($this->dn);
- }
-
- /* Delete blocklist requested */
- if (isset($_POST['delete_blocklist']) && isset($_POST['blocklist'])){
- $this->dn= trim($_POST['blocklist']);
-
- /* Check locking */
- if (($user= get_lock($this->dn)) != ""){
- $_SESSION['dn']= $this->dn;
- return(gen_locked_message($user, $this->dn));
- } else {
- # Lock this dn for editing
- add_lock ($this->dn, $this->ui->dn);
-
- $smarty->assign("info", sprintf(_("You're about to delete the blocklist '%s'."), $this->dn));
- return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
- }
- }
-
- /* Finally delete blocklist */
- if (isset($_POST['delete_blocklist_confirm'])){
- $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
- $acl= get_module_permission($acl, "blocklists", $this->dn);
- if (chkacl($acl, "all") == ""){
- $this->remove_from_parent();
- gosa_log ("Blocklist object'".$this->dn."' has been removed");
- $this->reload ();
- } else {
- print_red (_("You have no permission to remove this blocklist."));
- }
- }
-
- /* Cancel dialog */
- if (isset($_POST['edit_cancel']) || isset($_POST['delete_blocklist_cancel']) ||
- isset($_POST['delete_blocklist_confirm']) || isset($_POST['delete_lock'])){
-
- del_lock ($this->dn);
- $this->clear_fields();
- unset($_SESSION['objectinfo']);
- }
-
- /* Handle interactions: add */
- if (isset($_POST['add_number']) && $_POST['number'] != ""){
- if (is_phone_nr($_POST['number'])){
- $this->addNumber ($_POST['number']);
- } else {
- print_red (_("Please specify a valid phone number."));
- }
- }
-
- /* Handle interactions: delete */
- if (isset($_POST['delete_number']) && count($_POST['numbers']) > 0){
- $this->delNumber ($_POST['numbers']);
- }
-
- /* What about finish? */
- if (isset($_POST['edit_finish'])){
- $message= $this->check();
-
- /* No errors, save object */
- if (count ($message) == 0){
-
- /* Perpare 'dn' in case of new entries */
- if ($this->dn == "new"){
- $this->dn= "cn=$this->cn,ou=gofax,ou=systems,".$this->base;
- }
-
- $this->save ();
- gosa_log ("Blocklist object'".$this->dn."' has been saved");
- $this->acl= "#none#";
- $this->dn= "";
- del_lock ($this->ui->dn);
- unset($_SESSION['objectinfo']);
- } else {
- /* Errors found, show message */
- show_errors ($message);
- }
- }
-
- /* Headpage or normal plugin screen? */
- if ($this->dn == ""){
- /* Check sorting variable */
- $this->reload();
-
- /* Check for exeeded sizelimit */
- if (($message= check_sizelimit()) != ""){
- return($message);
- }
-
- /* Show main page */
- $smarty->assign("blocklists", $this->blocklists);
- $smarty->assign("search_image", get_template_path('images/search.png'));
- $smarty->assign("tree_image", get_template_path('images/tree.png'));
- $smarty->assign("infoimage", get_template_path('images/info.png'));
- $smarty->assign("launchimage", get_template_path('images/launch.png'));
- $smarty->assign("apply", apply_filter());
- foreach( array("depselect", "entry", "regex", "sendlists", "receivelists") as $type){
- $smarty->assign("$type", $blockfilter[$type]);
- }
- $smarty->assign("deplist", $this->config->idepartments);
- $smarty->assign("alphabet", generate_alphabet());
- $smarty->assign("hint", print_sizelimit_warning());
-
- return($smarty->fetch(get_template_path('headpage.tpl', TRUE)));
- }
-
- /* Set base */
- if ($this->base == ""){
- if ($this->dn == "new"){
- $ui= get_userinfo();
- $this->base= dn2base($ui->dn);
- } else {
- $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
- }
- }
-
- /* Fill templating stuff */
- $smarty->assign("bases", $this->config->idepartments);
- $smarty->assign("base_select", $this->base);
- $smarty->assign("types", array(0 => _("send"), 1 => _("receive")));
- if ($this->dn == "new" || preg_match ("/,ou=incoming,/", $this->dn)){
- $smarty->assign("selectmode", "");
- $smarty->assign("mode", "");
- } else {
- $smarty->assign("selectmode", "disabled");
- $smarty->assign("mode", "readonly");
+ $this->type= 1;
+ }
+ $_SESSION['objectinfo']= trim($this->dn);
+ }
+
+ /* Delete blocklist requested */
+ if ($s_action=="del"){
+ $this->dn=$this->blocklists[$s_entry]['dn'];
+ /* Check locking */
+ if (($user= get_lock($this->dn)) != ""){
+ $_SESSION['dn']= $this->dn;
+ return(gen_locked_message($user, $this->dn));
+ } else {
+# Lock this dn for editing
+ add_lock ($this->dn, $this->ui->dn);
+
+ $smarty->assign("info", sprintf(_("You're about to delete the blocklist '%s'."), $this->dn));
+ return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ }
+ }
+
+ /* Finally delete blocklist */
+ if (isset($_POST['delete_blocklist_confirm'])){
+ $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
+ $acl= get_module_permission($acl, "blocklists", $this->dn);
+ if (chkacl($acl, "all") == ""){
+ $this->remove_from_parent();
+ gosa_log ("Blocklist object'".$this->dn."' has been removed");
+ $this->reload ();
+ } else {
+ print_red (_("You have no permission to remove this blocklist."));
+ }
+ }
+
+ /* Cancel dialog */
+ if (isset($_POST['edit_cancel']) || isset($_POST['delete_blocklist_cancel']) ||
+ isset($_POST['delete_blocklist_confirm']) || isset($_POST['delete_lock'])){
+
+ del_lock ($this->dn);
+ $this->clear_fields();
+ unset($_SESSION['objectinfo']);
+ }
+
+ /* Handle interactions: add */
+ if (isset($_POST['add_number']) && $_POST['number'] != ""){
+ if (is_phone_nr($_POST['number'])){
+ $this->addNumber ($_POST['number']);
+ } else {
+ print_red (_("Please specify a valid phone number."));
+ }
+ }
+
+ /* Handle interactions: delete */
+ if (isset($_POST['delete_number']) && count($_POST['numbers']) > 0){
+ $this->delNumber ($_POST['numbers']);
+ }
+
+ /* What about finish? */
+ if (isset($_POST['edit_finish'])){
+ $message= $this->check();
+
+ /* No errors, save object */
+ if (count ($message) == 0){
+
+ /* Perpare 'dn' in case of new entries */
+ if ($this->dn == "new"){
+ $this->dn= "cn=$this->cn,ou=gofax,ou=systems,".$this->base;
}
- foreach(array("cn", "description", "type", "goFaxBlocklist") as $val){
- $smarty->assign("$val", $this->$val);
- $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
- }
-
- /* Lock blocklist type for non new entries */
- if ($this->dn != "new"){
- $smarty->assign('typeACL', "disabled");
- }
-
- /* Show main page */
- return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
+
+ $this->save ();
+ gosa_log ("Blocklist object'".$this->dn."' has been saved");
+ $this->acl= "#none#";
+ $this->dn= "";
+ del_lock ($this->ui->dn);
+ unset($_SESSION['objectinfo']);
+ } else {
+ /* Errors found, show message */
+ show_errors ($message);
+ }
+ }
+
+ /* Headpage or normal plugin screen? */
+ if ($this->dn == ""){
+ /* Check sorting variable */
+ $this->reload();
+
+ /* Check for exeeded sizelimit */
+ if (($message= check_sizelimit()) != ""){
+ return($message);
+ }
+
+ $options= "";
+ foreach ($this->config->idepartments as $key => $value){
+ if ($blockfilter['depselect'] == $key){
+ $options.= "$value ";
+ } else {
+ $options.= "$value ";
+ }
+ }
+
+
+
+ /* NEW LIST MANAGMENT */
+ $listhead = "";
+
+ $action= " ";
+ $action.= " ";
+
+
+ $divlist = new divlist();
+ $divlist->SetHeader(array(
+ array("string" => " "),
+ array("string" => _("Blocklist name")." / "._("Department")),
+ array("string" => _("Actions"), "attach" => "style='border:none'" )));
+
+
+ $divlist->SetSummary(_("This table displays faxblocklists for the selected tree."));
+ $divlist->SetEntriesPerPage(20);
+
+ // Defining Links
+ $linkopen = "%s ";
+ foreach($this->departments as $key=> $val){
+ $field1 = array("string" => " ");
+ $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val));
+ $field3 = array("string" => " ", "attach" => "style='border:none'");
+ $divlist->AddEntry(array($field1,$field2,$field3));
+ }
+
+ // User and Template Images
+ $blockimg = " ";
+ $editlink = "%s ";
+
+ foreach($this->blocklists as $key => $val){
+ // Generate Array to Add
+ $display= "[".$val["cn"][0]."]";
+ $field1 = array("string" => sprintf($blockimg,$val['dn']),"attach"=>"style='width:20px;align:middle;'");
+ $field2 = array("string" => sprintf($editlink,$key,$display),"attach"=>"title='".$val['dn']."'");
+ $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action),"attach" => "style='border:none; text-align:right;width:40px'");
+ $divlist->AddEntry( array($field1,$field2,$field3));
+ }
+
+ /* Show main page */
+ $smarty->assign("blocklistshead", $listhead);
+ $smarty->assign("blocklists", $divlist->DrawList());
+ $smarty->assign("search_image", get_template_path('images/search.png'));
+ $smarty->assign("tree_image", get_template_path('images/tree.png'));
+ $smarty->assign("infoimage", get_template_path('images/info.png'));
+ $smarty->assign("launchimage", get_template_path('images/launch.png'));
+ $smarty->assign("apply", apply_filter());
+ foreach( array("depselect", "entry", "regex", "sendlists", "receivelists") as $type){
+ $smarty->assign("$type", $blockfilter[$type]);
+ }
+ $smarty->assign("deplist", $this->config->idepartments);
+ $smarty->assign("alphabet", generate_alphabet());
+ $smarty->assign("hint", print_sizelimit_warning());
+
+ return($smarty->fetch(get_template_path('headpage.tpl', TRUE)));
+ }
+
+ /* Set base */
+ if ($this->base == ""){
+ if ($this->dn == "new"){
+ $ui= get_userinfo();
+ $this->base= dn2base($ui->dn);
+ } else {
+ $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
+ }
+ }
+
+ /* Fill templating stuff */
+ $smarty->assign("bases", $this->config->idepartments);
+ $smarty->assign("base_select", $this->base);
+ $smarty->assign("types", array(0 => _("send"), 1 => _("receive")));
+ if ($this->dn == "new" || preg_match ("/,ou=incoming,/", $this->dn)){
+ $smarty->assign("selectmode", "");
+ $smarty->assign("mode", "");
+ } else {
+ $smarty->assign("selectmode", "disabled");
+ $smarty->assign("mode", "readonly");
+ }
+ foreach(array("cn", "description", "type", "goFaxBlocklist") as $val){
+ $smarty->assign("$val", $this->$val);
+ $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
+ }
+
+ /* Lock blocklist type for non new entries */
+ if ($this->dn != "new"){
+ $smarty->assign('typeACL', "disabled");
+ }
+
+ /* Show main page */
+ return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
}
function clear_fields()
{
- $this->dn= "";
- $this->description= "";
- $this->cn= "";
- $this->base= "";
- $this->goFaxBlocklist= array();
- $this->acl= "#none#";
+ $this->dn= "";
+ $this->description= "";
+ $this->cn= "";
+ $this->base= "";
+ $this->goFaxBlocklist= array();
+ $this->acl= "#none#";
}
function reload()
{
- /* Get config */
- $blockfilter= get_global('blockfilter');
-
- /* Set base for all searches */
- $base= $blockfilter['depselect'];
- $filter= "";
-
- /* Regex filter? */
- if ($blockfilter['regex'] != ""){
- $regex= $blockfilter['regex'];
- } else {
- $regex= "*";
- }
-
- /* Entry filter? */
- /* Get list of blocklists to be shown */
- if ($blockfilter['sendlists'] == "checked"){
- $filter.= "(objectClass=goFaxSBlock)";
- }
- if ($blockfilter['receivelists'] == "checked"){
- $filter.= "(objectClass=goFaxRBlock)";
- }
- if ($filter != ""){
- $filter= "(|$filter)";
- }
-
- if ($blockfilter['entry'] != "" && $blockfilter['entry'] != "*"){
- $filter.= "(|(goFaxSBlocklist=".$blockfilter['entry'].")(goFaxRBlocklist=".$blockfilter['entry']."))";
- }
-
- /* Generate blocklists */
- $res= get_list($this->ui->subtreeACL, "(&(cn=$regex)$filter)", TRUE, $base, array("cn", "description"));
-
- $this->blocklists= array();
- foreach ($res as $value){
-
- /* Unwanted? */
- $this->blocklists[$value["dn"]]= $value["cn"][0];
- if (isset($value["description"][0])){
- $this->blocklists[$value["dn"]]= $value["cn"][0]." (".
- $value["description"][0].")";
- }
- }
- natcasesort ($this->blocklists);
- reset ($this->blocklists);
+ /* Get config */
+ $blockfilter= get_global('blockfilter');
+
+ /* Set base for all searches */
+ $base= $blockfilter['depselect'];
+ $filter= "";
+
+ /* Regex filter? */
+ if ($blockfilter['regex'] != ""){
+ $regex= $blockfilter['regex'];
+ } else {
+ $regex= "*";
+ }
+
+ /* Entry filter? */
+ /* Get list of blocklists to be shown */
+ if ($blockfilter['sendlists'] == "checked"){
+ $filter.= "(objectClass=goFaxSBlock)";
+ }
+ if ($blockfilter['receivelists'] == "checked"){
+ $filter.= "(objectClass=goFaxRBlock)";
+ }
+ if ($filter != ""){
+ $filter= "(|$filter)";
+ }
+
+ if ($blockfilter['entry'] != "" && $blockfilter['entry'] != "*"){
+ $filter.= "(|(goFaxSBlocklist=".$blockfilter['entry'].")(goFaxRBlocklist=".$blockfilter['entry']."))";
+ }
+
+ /* Generate blocklists */
+ $res= get_list($this->ui->subtreeACL, "(&(cn=$regex)$filter)", TRUE, $base, array("*"));
+
+ $this->blocklists=$res;
+
+ /* NEW LIST MANAGMENT
+ * We also need to search for the departments
+ * So we are able to navigate like in konquerer
+ */
+ $base2 = preg_replace("/ou=people,/i","",$base);
+
+ $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+ TRUE, $base2, array("ou", "description"), TRUE);
+
+ $this->departments= array();
+ foreach ($res3 as $value){
+ if($value["description"][0]!=".."){
+ $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+ }else{
+ $this->departments[$value['dn']]=$value["description"][0];
+ }
+ }
+
+ /* END NEW LIST MANAGMENT
+ */
+
+ reset ($this->blocklists);
}
function remove_from_parent()
{
- $ldap= $this->config->get_ldap_link();
- $ldap->rmDir($this->dn);
- $this->handle_post_events("remove");
+ $ldap= $this->config->get_ldap_link();
+ $ldap->rmDir($this->dn);
+ $this->handle_post_events("remove");
}
/* Save data to object */
function save_object()
{
- plugin::save_object();
-
- /* Save type, needed to detect objectClass */
- if (isset($_POST['type']) && chkacl($this->acl, "cn") == ""){
- $this->type= $_POST['type'];
- }
-
- /* Save base, since this is no LDAP attribute */
- if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
- $this->base= $_POST['base'];
- }
+ plugin::save_object();
+
+ /* Save type, needed to detect objectClass */
+ if (isset($_POST['type']) && chkacl($this->acl, "cn") == ""){
+ $this->type= $_POST['type'];
+ }
+
+ /* Save base, since this is no LDAP attribute */
+ if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
+ $this->base= $_POST['base'];
+ }
}
/* Check values */
function check()
{
- $message= array();
-
- /* Permissions for that base? */
- if ($this->base != ""){
- $new_dn= "cn=".$this->cn.",ou=gofax,ou=systems,".$this->base;
- } else {
- $new_dn= $this->dn;
- }
-
- $ui= get_userinfo();
- $acl= get_permissions ($new_dn, $ui->subtreeACL);
- $acl= get_module_permission($acl, "blocklist", $new_dn);
- if (chkacl($acl, "create") != ""){
- $message[]= _("You have no permissions to create a blocklist on this 'Base'.");
- }
-
-
- /* check syntax: must cn */
- if ($this->cn == ""){
- $message[]= _("Required field 'Name' is not set.");
- } else {
- if (!is_uid($this->cn)){
- $message[]= _("Required field 'Name' contains invalid characters");
- }
- if ($this->dn == 'new'){
- $ldap= $this->config->get_ldap_link();
- $ldap->cd ("ou=gofax,ou=systems,".$this->config->current["BASE"]);
- $ldap->search ("(&(|(objectClass=goFaxSBlock)(objectClass=goFaxRBlock))".
- "(cn=".$this->cn."))", array("cn"));
- if ($ldap->count() != 0){
- $message[]= _("Specified name is already used.");
- }
- }
- }
-
- /* Is user allowed to create in 'base'? */
- if (chkacl($this->acl, "create") != ""){
- $message[]= _("No permission to create a blocklist on this base.");
- }
-
- return $message;
+ $message= array();
+
+ /* Permissions for that base? */
+ if ($this->base != ""){
+ $new_dn= "cn=".$this->cn.",ou=gofax,ou=systems,".$this->base;
+ } else {
+ $new_dn= $this->dn;
+ }
+
+ $ui= get_userinfo();
+ $acl= get_permissions ($new_dn, $ui->subtreeACL);
+ $acl= get_module_permission($acl, "blocklist", $new_dn);
+ if (chkacl($acl, "create") != ""){
+ $message[]= _("You have no permissions to create a blocklist on this 'Base'.");
+ }
+
+
+ /* check syntax: must cn */
+ if ($this->cn == ""){
+ $message[]= _("Required field 'Name' is not set.");
+ } else {
+ if (!is_uid($this->cn)){
+ $message[]= _("Required field 'Name' contains invalid characters");
+ }
+ if ($this->dn == 'new'){
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd ("ou=gofax,ou=systems,".$this->config->current["BASE"]);
+ $ldap->search ("(&(|(objectClass=goFaxSBlock)(objectClass=goFaxRBlock))".
+ "(cn=".$this->cn."))", array("cn"));
+ if ($ldap->count() != 0){
+ $message[]= _("Specified name is already used.");
+ }
+ }
+ }
+
+ /* Is user allowed to create in 'base'? */
+ if (chkacl($this->acl, "create") != ""){
+ $message[]= _("No permission to create a blocklist on this base.");
+ }
+
+ return $message;
}
/* Save to LDAP */
function save()
{
- plugin::save();
-
- /* Type selection */
- if ($this->type == 0){
- $type= "goFaxSBlock";
- } else {
- $type= "goFaxRBlock";
- }
-
- /* Add list */
- $this->attrs['objectClass']= $type;
- if (count($this->goFaxBlocklist)){
- $this->attrs["$type"."list"]= $this->goFaxBlocklist;
- }
-
- /* Write back to ldap */
- $ldap= $this->config->get_ldap_link();
- $ldap->cd($ldap->getParentDir($this->dn));
- $ldap->search("cn=$this->cn");
- $a= $ldap->fetch();
- if (count($a)){
- if (!isset($this->attrs["$type"."list"])){
- $this->attrs["$type"."list"]= array();
- }
- $ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- $this->handle_post_events("modify");
- } else {
- $ldap->cd($this->config->current['BASE']);
- $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
- $ldap->cd($this->dn);
- $ldap->add($this->attrs);
- $this->handle_post_events("add");
- }
- show_ldap_error($ldap->get_error());
+ plugin::save();
+
+ /* Type selection */
+ if ($this->type == 0){
+ $type= "goFaxSBlock";
+ } else {
+ $type= "goFaxRBlock";
+ }
+
+ /* Add list */
+ $this->attrs['objectClass']= $type;
+ if (count($this->goFaxBlocklist)){
+ $this->attrs["$type"."list"]= $this->goFaxBlocklist;
+ }
+
+ /* Write back to ldap */
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd($ldap->getParentDir($this->dn));
+ $ldap->search("cn=$this->cn");
+ $a= $ldap->fetch();
+ if (count($a)){
+ if (!isset($this->attrs["$type"."list"])){
+ $this->attrs["$type"."list"]= array();
+ }
+ $ldap->cd($this->dn);
+ $ldap->modify($this->attrs);
+ $this->handle_post_events("modify");
+ } else {
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+ $ldap->cd($this->dn);
+ $ldap->add($this->attrs);
+ $this->handle_post_events("add");
+ }
+ show_ldap_error($ldap->get_error());
}
function addNumber($number)
{
- if (!in_array($number, $this->goFaxBlocklist)){
- $this->goFaxBlocklist[]= $number;
- sort($this->goFaxBlocklist);
- }
+ if (!in_array($number, $this->goFaxBlocklist)){
+ $this->goFaxBlocklist[]= $number;
+ sort($this->goFaxBlocklist);
+ }
}
function delNumber($numbers)
{
- $tmp= array();
- foreach ($this->goFaxBlocklist as $val){
- if (!in_array($val, $numbers)){
- $tmp[]= $val;
- }
- }
- $this->goFaxBlocklist= $tmp;
+ $tmp= array();
+ foreach ($this->goFaxBlocklist as $val){
+ if (!in_array($val, $numbers)){
+ $tmp[]= $val;
+ }
+ }
+ $this->goFaxBlocklist= $tmp;
}
function remove_lock()
{
- if (isset($this->dn)){
- del_lock ($this->dn);
- }
+ if (isset($this->dn)){
+ del_lock ($this->dn);
+ }
}
}
-
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
diff --git a/plugins/gofax/blocklists/headpage.tpl b/plugins/gofax/blocklists/headpage.tpl
index 0168b7ecc..835a6ad07 100644
--- a/plugins/gofax/blocklists/headpage.tpl
+++ b/plugins/gofax/blocklists/headpage.tpl
@@ -7,17 +7,12 @@
+
+
+ {$blocklists}
-
@@ -28,9 +23,6 @@
{t}This menu allows you to create, delete and edit selected blocklists. Having a large size of lists, you might prefer the range selectors on top of the select box.{/t}
-
- {t}-Edit- and -New...- will execute an assistant to aid you when performing changes on your blocklist. -Delete- will ask you for confirmation before really deleting anything.{/t}
-
@@ -48,21 +40,6 @@
-
-
-
-
- {t}Display lists of department{/t}
-
-
-
- {html_options options=$deplist selected=$depselect}
-
-
-
-
-
-
@@ -76,8 +53,8 @@
-
- {t}Display lists containing{/t}
+
+ {t}Display lists containing{/t}
diff --git a/plugins/gofon/macro/class_gofonMacroManagement.inc b/plugins/gofon/macro/class_gofonMacroManagement.inc
index ba19f05af..53281d0c5 100755
--- a/plugins/gofon/macro/class_gofonMacroManagement.inc
+++ b/plugins/gofon/macro/class_gofonMacroManagement.inc
@@ -61,17 +61,79 @@ class gofonMacro extends plugin
}
$macrofilter['regex']= $s;
}
- /* Save (new) Filter */
- register_global("macrofilter", $macrofilter);
- /* Check sorting variable */
- if (!isset($this->macrotabs) &&
- !isset($_POST['new_mac']) &&
- !isset($_POST['delete_mac']) &&
- !isset($_POST['select_mac'])){
- $this->reload();
+ $s_action = ""; // Contains the action to proceed
+ $s_entry = ""; // The value for s_action
+ $base_back = ""; // The Link for Backbutton
+
+ /* Start for New List Managment */
+ if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
+ $s_action="open";
+ $s_entry = base64_decode($_GET['dep_id']);
+ $macrofilter['depselect']= "".$this->config->departments[trim($s_entry)];
}
-
+
+ /* Test Posts */
+ foreach($_POST as $key => $val){
+ // Post for delete
+ if(preg_match("/user_del.*/",$key)){
+ $s_action = "del";
+ $s_entry = preg_replace("/user_".$s_action."_/i","",$key);
+ // Post for edit
+ }elseif(preg_match("/user_edit_.*/",$key)){
+ $s_action="edit";
+ $s_entry = preg_replace("/user_".$s_action."_/i","",$key);
+ // Post for new
+ }elseif(preg_match("/dep_back.*/i",$key)){
+ $s_action="back";
+ }elseif(preg_match("/user_new.*/",$key)){
+ $s_action="new";
+ }elseif(preg_match("/dep_home.*/i",$key)){
+ $s_action="home";
+ }elseif(preg_match("/user_chgpw.*/i",$key)){
+ $s_action="change_pw";
+ $s_entry = preg_replace("/user_chgpw_/i","",$key);
+ }elseif(preg_match("/dep_root.*/i",$key)){
+ $s_action="root";
+ }
+ }
+ if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+ $s_action ="edit";
+ $s_entry = $_GET['id'];
+ }
+
+ $s_entry = preg_replace("/_.$/","",$s_entry);
+
+ /* Department changed? */
+ if(isset($_POST['depselect']) && $_POST['depselect']){
+ $macrofilter['depselect']= $_POST['depselect'];
+ }
+
+ /* Homebutton is posted */
+ if($s_action=="home"){
+ $macrofilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
+ $macrofilter['depselect']=(preg_replace("/^[^,]+,/","",$macrofilter['depselect']));
+ }
+
+ if($s_action=="root"){
+ $macrofilter['depselect']=($this->config->current['BASE']);
+ }
+
+
+ /* If Backbutton is Posted */
+ if($s_action=="back"){
+ $base_back = preg_replace("/^[^,]+,/","",$macrofilter['depselect']);
+ $base_back = convert_department_dn($base_back);
+
+ if(isset($this->config->departments[trim($base_back)])){
+ $macrofilter['depselect']= $this->config->departments[trim($base_back)];
+ }else{
+ $macrofilter['depselect']= $this->config->departments["/"];
+ }
+ }
+
+ register_global("macrofilter", $macrofilter);
+ $this->reload();
$smarty= get_smarty();
@@ -81,7 +143,7 @@ class gofonMacro extends plugin
}
/* New macro? */
- if (isset($_POST['new_mac'])){
+ if ($s_action=="new"){
/* By default we set 'dn' to 'new', all relevant plugins will
react on this. */
@@ -137,10 +199,10 @@ class gofonMacro extends plugin
}
/* User wants to edit data? */
- if ((isset($_POST['select_mac']) || (isset($_POST['edit_helper']) && $_POST['edit_helper'] == "1")) && isset($_POST['macrolists']) && $_POST['macrolists'] != ""){
+ if ($s_action=="edit"){
/* Get 'dn' from posted 'macrolists', must be unique */
- $this->dn= trim($_POST['macrolists']);
+ $this->dn= $this->macros[$s_entry]['dn'];
/* Check locking, save current plugin in 'back_plugin', so
the dialog knows where to return. */
@@ -163,10 +225,10 @@ class gofonMacro extends plugin
}
/* Remove user was requested */
- if (isset($_POST['delete_mac']) && isset($_POST['macrolists'])){
+ if ($s_action=="del"){
/* Get 'dn' from posted 'uid' */
- $this->dn= trim($_POST['macrolists']);
+ $this->dn= $this->macros[$s_entry]['dn'];
/* Load permissions for selected 'dn' and check if
we're allowed to remove this 'dn' */
@@ -243,8 +305,93 @@ class gofonMacro extends plugin
return ($display);
}
+
+
+
+ /* Prepare departments */
+ $options= "";
+ foreach ($this->config->idepartments as $key => $value){
+ if ($macrofilter['depselect'] == $key){
+ $options.= "$value ";
+ } else {
+ $options.= "$value ";
+ }
+ }
+
+
+ /* NEW LIST MANAGMENT */
+ $listhead = "";
+
+
+ /* Options */
+ $action= " ";
+ $action.= " ";
+
+ $divlist = new divlist();
+ $divlist->SetHeader(array(
+ array("string" => " "),
+ array("string" => _("Username")." / "._("Department")),
+ array("string" => _("Visible"), "attach" => "style='width:30px;'"),
+ array("string" => _("Actions"), "attach" => "style='border:none'" )));
+
+
+ $divlist->SetSummary(_("This table displays all phone macros, in the selected tree."));
+ $divlist->SetEntriesPerPage(20);
+
+ // Defining Links
+ $linkopen = "%s ";
+
+ foreach($this->departments as $key=> $val){
+ $field1 = array("string" => " ");
+ $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val));
+ $field3 = array("string" => " ");
+ $field4 = array("string" => " ", "attach" => "style='border:none'");
+ $divlist->AddEntry(array($field1,$field2,$field3,$field4));
+ }
+
+ // Pictures for Extensions
+ $empty = " ";
+
+ // User and Template Images
+ $macroimg = " ";
+ $visible = " ";
+ $invisible = " ";
+
+ // Link for edit
+ $editlink = "%s ";
+
+ // Test Every Entry and generate divlist Array
+ foreach($this->macros as $key => $val){
+ // Generate Array to Add
+ $display= $val["displayName"][0];
+
+
+ if(isset($val['goFonMacroVisible']['0'])&&($val['goFonMacroVisible']['0'] == "1")){
+ $pic1 = $visible;
+ }else{
+ $pic1 = $invisible;
+ }
+
+ $field1 = array("string" => sprintf($macroimg,$val['dn']),"attach"=>"style='width:20px;align:middle;'");
+ $field2 = array("string" => sprintf($editlink,$key,$display),"attach"=>"title='".$val['dn']."'");
+ $field3 = array("string" => $pic1, "attach" => "style='width:20px;text-align:right;'");
+ $field4 = array("string" => preg_replace("/%KEY%/", "$key", $action),"attach" => "style='border:none;text-align:right;width:48px'");
+
+ $divlist->AddEntry(array($field1,$field2,$field3,$field4));
+ }
+
/* Show main page */
- $smarty->assign("macros", $this->macros);
+ $smarty->assign("macroshead", $listhead);
+ $smarty->assign("macros", $divlist->DrawList());
$smarty->assign("search_image", get_template_path('images/search.png'));
$smarty->assign("tree_image", get_template_path('images/tree.png'));
$smarty->assign("infoimage", get_template_path('images/info.png'));
@@ -279,16 +426,31 @@ class gofonMacro extends plugin
}
/* Generate macro list */
- $res= get_list($this->ui->subtreeACL, "(&(cn=$regex)(objectClass=goFonMacro))", TRUE, $base, array("cn", "description"), TRUE);
- $this->macros= array();
- foreach ($res as $value){
- $this->macros[$value["dn"]]= $value["cn"][0];
- if (isset($value["description"][0])){
- $this->macros[$value["dn"]]= $value["cn"][0]." (".
- $value["description"][0].")";
+ $res= get_list($this->ui->subtreeACL, "(&(cn=$regex)(objectClass=goFonMacro))", TRUE, $base, array("*"), TRUE);
+ $this->macros= $res;
+
+ /* NEW LIST MANAGMENT
+ * We also need to search for the departments
+ * So we are able to navigate like in konquerer
+ */
+ $base2 = preg_replace("/ou=people,/i","",$base);
+
+ $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+ TRUE, $base2, array("ou", "description"), TRUE);
+
+ $this->departments= array();
+ foreach ($res3 as $value){
+ if($value["description"][0]!=".."){
+ $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+ }else{
+ $this->departments[$value['dn']]=$value["description"][0];
}
}
- natcasesort ($this->macros);
+
+ /* END NEW LIST MANAGMENT
+ */
+
+
reset ($this->macros);
}
diff --git a/plugins/gofon/macro/headpage.tpl b/plugins/gofon/macro/headpage.tpl
index 13660ad2e..b7d055b6b 100755
--- a/plugins/gofon/macro/headpage.tpl
+++ b/plugins/gofon/macro/headpage.tpl
@@ -7,17 +7,12 @@
+
+
+ {$macros}
-
@@ -28,9 +23,6 @@
{t}This menu allows you to add, edit and remove selected macros. You may want to use the range selector on top of the macro listbox, when working with a large number of macros.{/t}
-
- {t}-Edit- and -New...- will execute an assistant to aid you in editing properties. -Delete- will ask for confirmation before removing macros.{/t}
-
@@ -43,23 +35,10 @@
- {t}Display macros of department{/t}
-
-
-
- {html_options options=$deplist selected=$depselect}
-
-
-
-
-
-