From 68e68a995748bf8bb71cf4d611c64ead379ab1f9 Mon Sep 17 00:00:00 2001 From: cajus Date: Thu, 8 Jun 2006 09:16:02 +0000 Subject: [PATCH] Added apply button git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3709 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_applicationManagement.inc | 24 ++++++++------ .../class_departmentManagement.inc | 2 +- plugins/admin/fai/class_faiManagement.inc | 25 +++++++++------ .../admin/groups/class_groupManagement.inc | 29 ++++++++++------- .../admin/ogroups/class_ogroupManagement.inc | 27 +++++++++------- .../admin/systems/class_systemManagement.inc | 26 +++++++++------ plugins/admin/users/class_userManagement.inc | 32 +++++++++++-------- .../blocklists/class_blocklistManagement.inc | 13 +++++--- plugins/gofax/blocklists/generic.tpl | 6 +++- plugins/gofax/faxaccount/main.inc | 2 +- .../class_phoneConferenceManagment.inc | 14 +++++--- .../macro/class_gofonMacroManagement.inc | 26 +++++++++------ plugins/gofon/phoneaccount/main.inc | 2 +- plugins/personal/connectivity/main.inc | 2 +- plugins/personal/environment/main.inc | 2 +- plugins/personal/generic/main.inc | 2 +- plugins/personal/mail/main.inc | 2 +- plugins/personal/nagios/main.inc | 2 +- plugins/personal/netatalk/main.inc | 2 +- plugins/personal/posix/main.inc | 2 +- plugins/personal/samba/main.inc | 2 +- 21 files changed, 150 insertions(+), 94 deletions(-) diff --git a/plugins/admin/applications/class_applicationManagement.inc b/plugins/admin/applications/class_applicationManagement.inc index e71dee316..4563f4fd7 100644 --- a/plugins/admin/applications/class_applicationManagement.inc +++ b/plugins/admin/applications/class_applicationManagement.inc @@ -197,7 +197,7 @@ class applicationManagement extends plugin /* 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'])) && (isset($this->apptabs->config))){ + if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->apptabs->config))){ /* Check tabs, will feed message array */ $this->apptabs->last= $this->apptabs->current; @@ -212,14 +212,16 @@ class applicationManagement extends plugin $this->apptabs->save(); gosa_log ("Application object'".$this->dn."' has been saved"); - /* Application has been saved successfully, remove lock from - LDAP. */ - if ($this->dn != "new"){ - del_lock ($this->dn); + if (!isset($_POST['edit_apply'])){ + /* Application has been saved successfully, remove lock from + LDAP. */ + if ($this->dn != "new"){ + del_lock ($this->dn); + } + unset ($this->apptabs); + $this->apptabs= NULL; + unset ($_SESSION['objectinfo']); } - unset ($this->apptabs); - $this->apptabs= NULL; - unset ($_SESSION['objectinfo']); } else { /* Ok. There seem to be errors regarding to the tab data, show message and continue as usual. */ @@ -345,8 +347,12 @@ class applicationManagement extends plugin /* Don't show buttons if tab dialog requests this */ if (!$this->apptabs->by_object[$this->apptabs->current]->dialog){ $display.= "

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

"; } diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index 9856fed42..b095805fb 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -295,7 +295,7 @@ class departmentManagement extends plugin $display= $this->deptabs->execute(); if (!$this->deptabs->by_object[$this->deptabs->current]->dialog){ $display.= "

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

"; diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc index 0fac333fa..b0b48dbbc 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -502,19 +502,22 @@ class faiManagement extends plugin * If it was possible to save it, remove dialog object. * If it wasn't possible, show errors and keep dialog. */ - if((isset($_POST['edit_finish'])) && (isset($this->dialog->config))){ + if((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->dialog->config))){ $this->dialog->save_object(); - if(count($this->dialog->check())!=0){ - foreach($this->dialog->check() as $msg){ + $msgs= $this->dialog->check(); + if(count($msgs)!=0){ + foreach($msgs as $msg){ print_red($msg); } }else{ - del_lock ($this->dn); $this->dialog->save(); - unset($this->dialog); - $this->dialog=NULL; - $this->is_dialog=false; - unset($_SESSION['objectinfo']); + if (!isset($_POST['edit_apply'])){ + del_lock ($this->dn); + unset($this->dialog); + $this->dialog=NULL; + $this->is_dialog=false; + unset($_SESSION['objectinfo']); + } } } @@ -536,8 +539,12 @@ class faiManagement extends plugin }elseif(((isset($this->dialog->current))&&(!$this->dialog->by_object[$this->dialog->current]->is_dialog))){ $display.= "

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

"; }elseif(!isset($this->dialog->current)){ diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc index ed891cc59..30309740d 100644 --- a/plugins/admin/groups/class_groupManagement.inc +++ b/plugins/admin/groups/class_groupManagement.inc @@ -160,7 +160,7 @@ class groupManagement extends plugin /* Finish group 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'])) && (isset($this->grouptab->config)) ){ + if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->grouptab->config)) ){ /* Check tabs, will feed message array Save, or display error message? */ @@ -171,17 +171,18 @@ class groupManagement extends plugin $this->grouptab->save(); gosa_log ("Group object'".$this->dn."' has been saved"); - /* Group has been saved successfully, remove lock from LDAP. */ - if ($this->dn != "new"){ - del_lock ($this->dn); + if (!isset($_POST['edit_apply'])){ + /* 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->grouptab); + $this->grouptab= NULL; + unset ($_SESSION['objectinfo']); } - - /* There's no page reload so we have to read new users at this point. */ - //$this->reload (); - unset ($this->grouptab); - $this->grouptab= NULL; - unset ($_SESSION['objectinfo']); - } else { /* Ok. There seem to be errors regarding to the tab data, show message and continue as usual. */ @@ -323,8 +324,12 @@ class groupManagement extends plugin /* Don't show buttons if tab dialog requests this */ if (!$this->grouptab->by_object[$this->grouptab->current]->dialog){ $display.= "

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

"; } diff --git a/plugins/admin/ogroups/class_ogroupManagement.inc b/plugins/admin/ogroups/class_ogroupManagement.inc index ebc120a7a..ced638067 100644 --- a/plugins/admin/ogroups/class_ogroupManagement.inc +++ b/plugins/admin/ogroups/class_ogroupManagement.inc @@ -274,7 +274,7 @@ class ogroupManagement extends plugin ****************/ /* Finish button has been pressed */ - if ((isset($_POST['edit_finish'])) && (isset($this->ogroup->config)) ){ + if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->ogroup->config)) ){ /* Check tabs, will feed message array */ $message= $this->ogroup->check(); @@ -286,16 +286,17 @@ class ogroupManagement extends plugin $this->ogroup->save(); gosa_log ("Object group'".$this->dn."' has been saved"); - /* Group has been saved successfully, remove lock from - LDAP. */ - if ($this->dn != "new"){ - del_lock ($this->dn); - } - - unset ($this->ogroup); - $this->ogroup= NULL; - unset ($_SESSION['objectinfo']); + if (!isset($_POST['edit_apply'])){ + /* Group has been saved successfully, remove lock from + LDAP. */ + if ($this->dn != "new"){ + del_lock ($this->dn); + } + unset ($this->ogroup); + $this->ogroup= NULL; + unset ($_SESSION['objectinfo']); + } } else { /* Ok. There seem to be errors regarding to the tab data, show message and continue as usual. */ @@ -328,8 +329,12 @@ class ogroupManagement extends plugin /* Don't show buttons if tab dialog requests this */ if (!$this->ogroup->by_object[$this->ogroup->current]->dialog){ $display.= "

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

"; } diff --git a/plugins/admin/systems/class_systemManagement.inc b/plugins/admin/systems/class_systemManagement.inc index 5c37d6b90..697ec135c 100644 --- a/plugins/admin/systems/class_systemManagement.inc +++ b/plugins/admin/systems/class_systemManagement.inc @@ -386,7 +386,7 @@ class systems extends plugin /* Finish user 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'])) && (isset($this->systab->config))){ + if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->systab->config))){ /* Check tabs, will feed message array */ $message= $this->systab->check(); @@ -428,15 +428,17 @@ class systems extends plugin $ldap->cd($this->config->current['BASE']); } - /* Terminal has been saved successfully, remove lock from - LDAP. */ - if ($this->dn != "new"){ - del_lock ($this->dn); - } + if (!isset($_POST['edit_apply'])){ + /* Terminal has been saved successfully, remove lock from + LDAP. */ + if ($this->dn != "new"){ + del_lock ($this->dn); + } - unset ($this->systab); - $this->systab= NULL; - unset($_SESSION['objectinfo']); + unset ($this->systab); + $this->systab= NULL; + unset($_SESSION['objectinfo']); + } } else { /* Ok. There seem to be errors regarding to the tab data, show message and continue as usual. */ @@ -473,8 +475,12 @@ class systems extends plugin /* Don't show buttons if tab dialog requests this */ if ((isset($this->systab->by_object))&&(!$this->systab->by_object[$this->systab->current]->dialog)){ $display.= "

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

"; } diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index c03c08937..5b5c81162 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -371,7 +371,7 @@ class userManagement extends plugin /* Finish user 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'])) && (isset($this->usertab->config))){ + if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->usertab->config))){ /* Check tabs, will feed message array */ $this->usertab->last= $this->usertab->current; @@ -397,19 +397,21 @@ class userManagement extends plugin } gosa_log ("User object '".$this->dn."' has been saved"); - /* User has been saved successfully, remove lock from LDAP. */ - if ($this->dn != "new"){ - del_lock ($this->dn); - } + if (!isset($_POST['edit_apply'])){ + /* User has been saved successfully, remove lock from LDAP. */ + if ($this->dn != "new"){ + del_lock ($this->dn); + } - /* In case of new users, ask for a password, skip this for templates */ - if (($set_pass || $this->usertab->password_change_needed()) && !$this->is_template){ - return($smarty->fetch(get_template_path('password.tpl', TRUE))); - } + /* In case of new users, ask for a password, skip this for templates */ + if (($set_pass || $this->usertab->password_change_needed()) && !$this->is_template){ + return($smarty->fetch(get_template_path('password.tpl', TRUE))); + } - unset ($this->usertab); - $this->usertab= NULL; - unset ($_SESSION['objectinfo']); + unset ($this->usertab); + $this->usertab= NULL; + unset ($_SESSION['objectinfo']); + } } else { /* Ok. There seem to be errors regarding to the tab data, show message and continue as usual. */ @@ -620,8 +622,12 @@ class userManagement extends plugin /* Don't show buttons if tab dialog requests this */ if (!$this->usertab->by_object[$this->usertab->current]->dialog){ $display.= "

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

"; } diff --git a/plugins/gofax/blocklists/class_blocklistManagement.inc b/plugins/gofax/blocklists/class_blocklistManagement.inc index f5f523e8e..660a82954 100644 --- a/plugins/gofax/blocklists/class_blocklistManagement.inc +++ b/plugins/gofax/blocklists/class_blocklistManagement.inc @@ -221,7 +221,7 @@ class blocklist extends plugin ***************/ /* What about finish? */ - if ((isset($_POST['edit_finish'])) && (!empty($this->dn))){ + if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (!empty($this->dn))){ $message= $this->check(); $this->remove_lock(); @@ -235,9 +235,12 @@ class blocklist extends plugin $this->save (); gosa_log ("Blocklist object'".$this->dn."' has been saved"); - $this->dn= ""; - del_lock ($this->ui->dn); - unset($_SESSION['objectinfo']); + + if (!isset($_POST['edit_apply'])){ + $this->dn= ""; + del_lock ($this->ui->dn); + unset($_SESSION['objectinfo']); + } } else { /* Errors found, show message */ show_errors ($message); @@ -293,9 +296,11 @@ class blocklist extends plugin if ($this->dn == "new" || preg_match ("/,ou=incoming,/", $this->dn)){ $smarty->assign("selectmode", ""); $smarty->assign("mode", ""); + $smarty->assign("apply", "0"); } else { $smarty->assign("selectmode", "disabled"); $smarty->assign("mode", "readonly"); + $smarty->assign("apply", "1"); } foreach(array("cn", "description", "type", "goFaxBlocklist") as $val){ $smarty->assign("$val", $this->$val); diff --git a/plugins/gofax/blocklists/generic.tpl b/plugins/gofax/blocklists/generic.tpl index 00e945a53..c6330add1 100644 --- a/plugins/gofax/blocklists/generic.tpl +++ b/plugins/gofax/blocklists/generic.tpl @@ -82,8 +82,12 @@

- +   + {if $apply eq "1"} + +   + {/if}

diff --git a/plugins/gofax/faxaccount/main.inc b/plugins/gofax/faxaccount/main.inc index 24e0550b0..1227dd74b 100644 --- a/plugins/gofax/faxaccount/main.inc +++ b/plugins/gofax/faxaccount/main.inc @@ -86,7 +86,7 @@ if (!$remove_lock){ /* Are we in edit mode? */ if (isset($_SESSION['edit'])){ - $display.= "\n"; + $display.= "\n"; $display.= " \n"; $display.= "\n"; $info= " ".$ui->dn." "; diff --git a/plugins/gofon/conference/class_phoneConferenceManagment.inc b/plugins/gofon/conference/class_phoneConferenceManagment.inc index 5bf53a119..c7902f8f2 100644 --- a/plugins/gofon/conference/class_phoneConferenceManagment.inc +++ b/plugins/gofon/conference/class_phoneConferenceManagment.inc @@ -197,7 +197,7 @@ class phoneConferenceManagment extends plugin ***************/ /* Edit finished, check and save changes */ - if ((isset($_POST['edit_finish'])) && (isset($this->conftab->config))){ + if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->conftab->config))){ /* Check tabs, will feed message array */ $this->conftab->last= $this->conftab->current; $this->conftab->save_object(); @@ -210,8 +210,10 @@ class phoneConferenceManagment extends plugin } gosa_log ("goFonConference object '".$this->dn."' has been saved"); - if ($this->dn != "new"){ - del_lock ($this->dn); + if (!isset($_POST['edit_apply'])){ + if ($this->dn != "new"){ + del_lock ($this->dn); + } } $this->conftab->save (); @@ -236,8 +238,12 @@ class phoneConferenceManagment extends plugin /* Don't show buttons if tab dialog requests this */ if (!$this->conftab->by_object[$this->conftab->current]->dialog){ $display.= "

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

"; } diff --git a/plugins/gofon/macro/class_gofonMacroManagement.inc b/plugins/gofon/macro/class_gofonMacroManagement.inc index 23b1720b3..859131b0b 100755 --- a/plugins/gofon/macro/class_gofonMacroManagement.inc +++ b/plugins/gofon/macro/class_gofonMacroManagement.inc @@ -124,7 +124,7 @@ class gofonMacro extends plugin /* Finish mac 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'])) && (isset($this->macrotabs->config))){ + if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->macrotabs->config))){ /* Check tabs, will feed message array */ $this->macrotabs->last= $this->macrotabs->current; @@ -138,15 +138,17 @@ class gofonMacro extends plugin $this->macrotabs->save(); gosa_log ("Macro object'".$this->dn."' has been saved"); - /* macro has been saved successfully, remove lock from - LDAP. */ - if ($this->dn != "new"){ - del_lock ($this->dn); - } + if (!isset($_POST['edit_apply'])){ + /* macro has been saved successfully, remove lock from + LDAP. */ + if ($this->dn != "new"){ + del_lock ($this->dn); + } - unset ($this->macrotabs); - $this->macrotabs= NULL; - unset ($_SESSION['objectinfo']); + unset ($this->macrotabs); + $this->macrotabs= NULL; + unset ($_SESSION['objectinfo']); + } } else { /* Ok. There seem to be errors regarding to the tab data, show message and continue as usual. */ @@ -258,8 +260,12 @@ class gofonMacro extends plugin /* Don't show buttons if tab dialog requests this */ if (!$this->macrotabs->by_object[$this->macrotabs->current]->dialog){ $display.= "

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

"; } diff --git a/plugins/gofon/phoneaccount/main.inc b/plugins/gofon/phoneaccount/main.inc index c81fbea4c..62675fd74 100644 --- a/plugins/gofon/phoneaccount/main.inc +++ b/plugins/gofon/phoneaccount/main.inc @@ -102,7 +102,7 @@ if (!$remove_lock){ /* Are we in edit mode? */ if (isset($_SESSION['edit'])){ - $display.= "\n"; + $display.= "\n"; $display.= " "; $display.= "\n"; $info= "\"\" ".$ui->dn." "; diff --git a/plugins/personal/connectivity/main.inc b/plugins/personal/connectivity/main.inc index 644bd9839..3b41137e5 100644 --- a/plugins/personal/connectivity/main.inc +++ b/plugins/personal/connectivity/main.inc @@ -115,7 +115,7 @@ if (!$remove_lock){ if ($in_edit_mode){ $display.="
"; if (isset($_SESSION['edit'])){ - $display.= "\n"; + $display.= "\n"; $display.= " "; $display.= "\n"; $info= "\"\"dialog==NULL)){ - $display.= "\n"; + $display.= "\n"; $display.= " "; $display.= "\n"; $info= "\"\"\n"; + $display.= "\n"; $display.= " "; $display.= "\n"; $display.="