From d68aec49c3a53ac0f04b20c67914ffd753108bbb Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 18 Dec 2007 14:02:42 +0000 Subject: [PATCH] Multiple edit -Samba partily implemented git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8138 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../personal/samba/class_sambaAccount.inc | 204 ++++++++++++++++-- gosa-core/plugins/personal/samba/samba3.tpl | 105 ++++----- 2 files changed, 242 insertions(+), 67 deletions(-) diff --git a/gosa-core/plugins/personal/samba/class_sambaAccount.inc b/gosa-core/plugins/personal/samba/class_sambaAccount.inc index bd71c8f7a..61fc54a52 100644 --- a/gosa-core/plugins/personal/samba/class_sambaAccount.inc +++ b/gosa-core/plugins/personal/samba/class_sambaAccount.inc @@ -91,6 +91,8 @@ class sambaAccount extends plugin var $uid= ""; var $CopyPasteVars = array("kickoff_time_set","logoff_time_set","logon_time_set","mungedObject","orig_sambaDomainName"); + var $multiple_support = TRUE; + function sambaAccount (&$config, $dn= NULL) { /* Load attributes depending on the samba version */ @@ -213,28 +215,31 @@ class sambaAccount extends plugin return ($display); } - /* Show tab dialog headers */ - $display= ""; - if ($this->parent !== NULL){ - if ($this->is_account){ - $display= $this->show_disable_header(_("Remove samba account"), - _("This account has samba features enabled. You can disable them by clicking below.")); - } else { - $obj= $this->parent->by_object['posixAccount']; - - /* Samba3 dependency on posix accounts are enabled - in the moment, because I need to rely on unique - uidNumbers. There'll be a better solution later - on. */ - if ($obj->is_account){ + $display =""; + if(!$this->multiple_support_active){ - $display= $this->show_enable_header(_("Create samba account"), - _("This account has samba features disabled. You can enable them by clicking below.")); + /* Show tab dialog headers */ + $display= ""; + if ($this->parent !== NULL){ + if ($this->is_account){ + $display= $this->show_disable_header(_("Remove samba account"), + _("This account has samba features enabled. You can disable them by clicking below.")); } else { - $display= $this->show_enable_header(_("Create samba account"), - _("This account has samba features disabled. Posix features are needed for samba accounts, enable them first."), TRUE); + $obj= $this->parent->by_object['posixAccount']; + + /* Samba3 dependency on posix accounts are enabled + in the moment, because I need to rely on unique + uidNumbers. There'll be a better solution later + on. */ + if ($obj->is_account){ + $display= $this->show_enable_header(_("Create samba account"), + _("This account has samba features disabled. You can enable them by clicking below.")); + } else { + $display= $this->show_enable_header(_("Create samba account"), + _("This account has samba features disabled. Posix features are needed for samba accounts, enable them first."), TRUE); + } + return ($display); } - return ($display); } } @@ -626,7 +631,30 @@ class sambaAccount extends plugin } } + + foreach($this->attributes as $attr){ + if(in_array($attr,$this->multi_boxes)){ + $smarty->assign("use_".$attr,TRUE); + }else{ + $smarty->assign("use_".$attr,FALSE); + } + } + foreach(array("allow_pwchange","tslogin","CtxWFHomeDir","CtxWFHomeDirDrive","CtxWFProfilePath", + "inherit","CtxWorkDirectory","CtxInitialProgram","CtxMaxConnectionTimeF","CtxMaxConnectionTime","CtxMaxDisconnectionTimeF", + "CtxMaxDisconnectionTime","CtxMaxIdleTimeF","CtxMaxIdleTime","connectclientdrives", + "onnectclientprinters","defaultprinter","shadow","brokenconn", + "reconn","allow_pwchange","connectclientprinters","no_password_required","temporary_disable", + "password_expires","logon_time_set","logoff_time_set","kickoff_time_set","SetSambaLogonHours", + "workstation_list") as $attr){ + if(in_array($attr,$this->multi_boxes)){ + $smarty->assign("use_".$attr,TRUE); + }else{ + $smarty->assign("use_".$attr,FALSE); + } + } + /* Show main page */ + $smarty->assign("multiple_support",$this->multiple_support_active); if ($this->samba3){ $display.= $smarty->fetch (get_template_path('samba3.tpl', TRUE, dirname(__FILE__))); } else { @@ -1136,6 +1164,144 @@ class sambaAccount extends plugin "sambaUserWorkstations" => _("Allow connection from"))) ); } + + function enable_multiple_support() + { + plugin::enable_multiple_support(); + if($this->samba3){ + $this->multiple_support_active = TRUE; + }else{ + $this->multiple_support_active = FALSE; + } + } + + function multiple_save_object() + { + $this->save_object(); + plugin::multiple_save_object(); + foreach(array("allow_pwchange","tslogin","CtxWFHomeDir","CtxWFHomeDirDrive","CtxWFProfilePath", + "inherit","CtxWorkDirectory","CtxInitialProgram","CtxMaxConnectionTimeF","CtxMaxConnectionTime","CtxMaxDisconnectionTimeF", + "CtxMaxDisconnectionTime","CtxMaxIdleTimeF","CtxMaxIdleTime","connectclientdrives", + "onnectclientprinters","defaultprinter","shadow","brokenconn", + "reconn","allow_pwchange","connectclientprinters","no_password_required","temporary_disable", + "password_expires","logon_time_set","logoff_time_set","kickoff_time_set","SetSambaLogonHours", + "workstation_list") as $attr){ + if(isset($_POST["use_".$attr])){ + $this->multi_boxes[] = $attr; + } + } + } + + function multiple_execute() + { + return($this->execute()); + } + + function get_multi_edit_values() + { + $ret = plugin::get_multi_edit_values(); + + /* Terminal Server */ + if(in_array("tslogin",$this->multi_boxes)){ + $ret['tslogin'] = $this->mungedObject->getTsLogin(); + } + if(in_array("CtxWFHomeDirDrive",$this->multi_boxes)){ + $ret['CtxWFHomeDirDrive'] = $this->mungedObject->ctx['CtxWFHomeDirDrive']; + } + if(in_array("CtxWFHomeDir",$this->multi_boxes)){ + $ret['CtxWFHomeDir'] = $this->mungedObject->ctx['CtxWFHomeDir']; + } + if(in_array("CtxWFProfilePath",$this->multi_boxes)){ + $ret['CtxWFProfilePath'] = $this->mungedObject->ctx['CtxWFProfilePath']; + } + + if(in_array("inherit",$this->multi_boxes)){ + $ret['inherit'] = $this->mungedObject->getInheritMode(); + } + if(in_array("CtxInitialProgram",$this->multi_boxes)){ + $ret['CtxInitialProgram'] = $this->mungedObject->ctx['CtxInitialProgram']; + } + if(in_array("CtxWorkDirectory",$this->multi_boxes)){ + $ret['CtxWorkDirectory'] = $this->mungedObject->ctx['CtxWorkDirectory']; + } + + /* Time Limits. Be careful here, there are some negations */ + if(in_array("CtxMaxConnectionTimeF",$this->multi_boxes)){ + $ret["CtxMaxConnectionTimeF"] = !$this->mungedObject->getCtxMaxConnectionTimeF(); + if(!$ret["CtxMaxConnectionTimeF"]){ + $ret["CtxMaxConnectionTime"] = $this->mungedObject->ctx['CtxMaxConnectionTime']; + } + } + if(in_array("CtxMaxDisconnectionTimeF",$this->multi_boxes)){ + $ret["CtxMaxDisconnectionTimeF"]= !$this->mungedObject->getCtxMaxDisconnectionTimeF(); + if(!$ret["CtxMaxDisconnectionTimeF"]){ + $ret["CtxMaxDisconnectionTime"]= $this->mungedObject->ctx['CtxMaxDisconnectionTime']; + } + } + if(in_array("CtxMaxIdleTimeF",$this->multi_boxes)){ + $ret["CtxMaxIdleTimeF"] = !$this->mungedObject->getCtxMaxIdleTimeF(); + if(!$ret["CtxMaxIdleTimeF"]){ + $ret["CtxMaxIdleTime"] = $this->mungedObject->ctx['CtxMaxIdleTime']; + } + } + + /* Client Devices */ + if(in_array("connectclientdrives",$this->multi_boxes)){ + $ret["connectclientdrives"] = $this->mungedObject->getConnectClientDrives(); + } + if(in_array("connectclientprinters",$this->multi_boxes)){ + $ret["connectclientprinters"] = $this->mungedObject->getConnectClientPrinters(); + } + if(in_array("defaultprinter",$this->multi_boxes)){ + $ret["defaultprinter"] = $this->mungedObject->getDefaultPrinter(); + } + + /* Misc */ + if(in_array("shadow",$this->multi_boxes)){ + $ret["shadow"] =$this->mungedObject->getShadow(); + } + if(in_array("brokenconn",$this->multi_boxes)){ + $ret["brokenconn"]=$this->mungedObject->getBrokenConn(); + } + if(in_array("reconn",$this->multi_boxes)){ + $ret["reconn"] =$this->mungedObject->getReConn(); + } + + print_a($ret); + return($ret); + } + + function set_multi_edit_values($values) + { + plugin::set_multi_edit_values($values); + + /* Enable disabled terminal login, this is inverted somehow */ + if(isset($values['tslogin'])) $this->mungedObject->setTsLogin(!$values['tslogin']); + + /* Imherit client configuration */ + if(isset($values['inherit'])) $this->mungedObject->setInheritMode($values['inherit']); + + /* Get all ctx values posted */ + $ctx = array("CtxWFHomeDirDrive","CtxWFHomeDir","CtxWFProfilePath","CtxInitialProgram","CtxWorkDirectory", + "CtxMaxConnectionTime","CtxMaxDisconnectionTime","CtxMaxIdleTime"); + foreach($ctx as $attr){ + if(isset($values[$attr])){ + $this->mungedObject->ctx[$attr] = $values[$attr] ; + } + } + + if(isset($values['CtxMaxConnectionTimeF'])) $this->mungedObject->setCtxMaxConnectionTimeF($values['CtxMaxConnectionTimeF']); + if(isset($values['CtxMaxDisconnectionTimeF']))$this->mungedObject->setCtxMaxDisconnectionTimeF($values['CtxMaxDisconnectionTimeF']); + if(isset($values['CtxMaxIdleTimeF'])) $this->mungedObject->setCtxMaxIdleTimeF($values['CtxMaxIdleTimeF']); + + if(isset($values['connectclientdrives'])) $this->mungedObject->setConnectClientDrives($values['connectclientdrives']); + if(isset($values['connectclientprinters'])) $this->mungedObject->setConnectClientPrinters($values['connectclientprinters']); + if(isset($values['defaultprinter'])) $this->mungedObject->setDefaultPrinter($values['defaultprinter']); + + if(isset($values['shadow'])) $this->mungedObject->setShadow($values['shadow'],$values['shadow']); + if(isset($values['brokenconn'])) $this->mungedObject->setBrokenConn($values['brokenconn'],$values['brokenconn']); + if(isset($values['reconn'])) $this->mungedObject->setReConn($values['reconn'],$values['reconn']); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/gosa-core/plugins/personal/samba/samba3.tpl b/gosa-core/plugins/personal/samba/samba3.tpl index 251cf5354..6dbd266d4 100644 --- a/gosa-core/plugins/personal/samba/samba3.tpl +++ b/gosa-core/plugins/personal/samba/samba3.tpl @@ -12,10 +12,10 @@ -{render acl=$sambaHomePathACL} +{render acl=$sambaHomePathACL checkbox=$multiple_support checked=$use_sambaHomePath} {/render} -{render acl=$sambaHomeDriveACL} +{render acl=$sambaHomeDriveACL checkbox=$multiple_support checked=$use_sambaHomeDrive} {html_options values=$domains output=$domains selected=$sambaDomainName} @@ -43,7 +43,7 @@ -{render acl=$sambaLogonScriptACL} +{render acl=$sambaLogonScriptACL checkbox=$multiple_support checked=$use_sambaLogonScript} {/render} @@ -51,8 +51,8 @@ -{render acl=$sambaProfilePathACL} - +{render acl=$sambaProfilePathACL checkbox=$multiple_support checked=$use_sambaProfilePath} + {/render} @@ -68,8 +68,8 @@ @@ -121,8 +121,8 @@   @@ -141,7 +141,7 @@ @@ -160,8 +160,12 @@
-{render acl=$AllowLoginOnTerminalServerACL} - {t}Home directory{/t} -{render acl=$AllowLoginOnTerminalServerACL} +{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxWFHomeDir} {/render} -{render acl=$AllowLoginOnTerminalServerACL} +{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxWFHomeDirDrive}
-{render acl=$AllowLoginOnTerminalServerACL} +{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxWFProfilePath} {/render} -{render acl=$AllowLoginOnTerminalServerACL} - -{render acl=$AllowLoginOnTerminalServerACL} +{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxInitialProgram} {/render}
-{render acl=$AllowLoginOnTerminalServerACL} +{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxWorkDirectory} {/render}
@@ -191,8 +195,8 @@ @@ -214,24 +218,24 @@
+ {render acl=$AllowLoginOnTerminalServerACL} - {/render} @@ -177,8 +181,8 @@
-{render acl=$AllowLoginOnTerminalServerACL} - +{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxMaxDisconnectionTimeF} + {/render}
-{render acl=$AllowLoginOnTerminalServerACL} - +{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_CtxMaxIdleTimeF} + {/render}
@@ -250,7 +254,7 @@
-{render acl=$AllowLoginOnTerminalServerACL} - +{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_connectclientdrives} + {/render}
-{render acl=$AllowLoginOnTerminalServerACL} - +{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_connectclientprinters} + {/render}
-{render acl=$AllowLoginOnTerminalServerACL} - +{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_defaultprinter} + {/render} -{render acl=$AllowLoginOnTerminalServerACL} +{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_shadow} @@ -260,7 +264,7 @@
-{render acl=$AllowLoginOnTerminalServerACL} +{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_brokenconn} @@ -270,7 +274,7 @@
-{render acl=$AllowLoginOnTerminalServerACL} +{render acl=$AllowLoginOnTerminalServerACL checkbox=$multiple_support checked=$use_reconn} @@ -290,43 +294,43 @@
-{render acl=$sambaPwdCanChangeACL} - +{render acl=$sambaPwdCanChangeACL checkbox=$multiple_support checked=$use_allow_pwchange} + {/render}
-{render acl=$sambaAcctFlagsNACL} - +{render acl=$sambaAcctFlagsNACL checkbox=$multiple_support checked=$use_no_password_required} + {/render}
-{render acl=$sambaAcctFlagsLACL} - +{render acl=$sambaAcctFlagsLACL checkbox=$multiple_support checked=$use_temporary_disable} + {/render}
-{render acl=$sambaPwdMustChangeACL} - +{render acl=$sambaPwdMustChangeACL checkbox=$multiple_support checked=$use_password_expires} + {/render} -{render acl=$sambaPwdMustChangeACL} +{render acl=$sambaPwdMustChangeACL} {/render} -{render acl=$sambaPwdMustChangeACL} +{render acl=$sambaPwdMustChangeACL} {/render} -{render acl=$sambaPwdMustChangeACL} +{render acl=$sambaPwdMustChangeACL} {/render}
-{render acl=$sambaLogonTimeACL} - +{render acl=$sambaLogonTimeACL checkbox=$multiple_support checked=$use_logon_time_set} + {/render} {render acl=$sambaLogonTimeACL} @@ -345,8 +349,8 @@ {/render}
-{render acl=$sambaLogoffTimeACL} - +{render acl=$sambaLogoffTimeACL checkbox=$multiple_support checked=$use_logoff_time_set} + {/render} {render acl=$sambaLogoffTimeACL} @@ -366,8 +370,8 @@ {/render}
-{render acl=$sambaKickoffTimeACL} - +{render acl=$sambaKickoffTimeACL checkbox=$multiple_support checked=$use_kickoff_time_set} + {/render} {render acl=$sambaKickoffTimeACL} @@ -391,7 +395,7 @@
-{render acl=$sambaLogonHoursACL mode=read_active} +{render acl=$sambaLogonHoursACL mode=read_active checkbox=$multiple_support checked=$use_SetSambaLogonHours} {t}Samba logon times{/t}  {/render} @@ -402,8 +406,13 @@

+ +{if $multiple_support} + +{/if} {render acl=$sambaUserWorkstationsACL} - {html_options values=$workstations output=$workstations} {/render} -- 2.30.2