From: hickert Date: Thu, 20 Dec 2007 13:55:43 +0000 (+0000) Subject: Added pureftpd multiple edit X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=945750a65ce60f00252ad67d83ed2d88834af231;p=gosa.git Added pureftpd multiple edit git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8159 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index ceb49f2bf..fea28591a 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -1775,11 +1775,13 @@ class plugin /* Save values to object */ $this->multi_boxes = array(); foreach ($this->attributes as $val){ - if ($this->acl_is_writeable($val) && isset ($_POST["$val"])){ + + /* Get selected checkboxes from multiple edit */ + if(isset($_POST["use_".$val])){ + $this->multi_boxes[] = $val; + } - if(isset($_POST["use_".$val])){ - $this->multi_boxes[] = $val; - } + if ($this->acl_is_writeable($val) && isset ($_POST["$val"])){ /* Check for modifications */ if (get_magic_quotes_gpc()) { diff --git a/gosa-core/plugins/personal/connectivity/class_pureftpdAccount.inc b/gosa-core/plugins/personal/connectivity/class_pureftpdAccount.inc index 68de2e881..04474ae70 100644 --- a/gosa-core/plugins/personal/connectivity/class_pureftpdAccount.inc +++ b/gosa-core/plugins/personal/connectivity/class_pureftpdAccount.inc @@ -26,6 +26,8 @@ class pureftpdAccount extends plugin var $ReadOnly; var $view_logged = FALSE; + var $multiple_support=TRUE; + function pureftpdAccount (&$config, $dn= NULL, $parent= NULL) { plugin::plugin ($config, $dn, $parent); @@ -58,38 +60,58 @@ class pureftpdAccount extends plugin $tmp = $this->plInfo(); $changeState = ""; - foreach($tmp['plProvidedAcls'] as $key => $desc){ - $smarty->assign($key."ACL", $this->getacl($key,$this->ReadOnly)); - $smarty->assign($key."_W", $this->acl_is_writeable($key,$this->ReadOnly)); - - if($this->acl_is_writeable($key)){ - $changeState.= " changeState('".$key."'); \n"; + if($this->multiple_support_active){ + + /* We do not need the attribute grey out in multiple edit */ + foreach($tmp['plProvidedAcls'] as $key => $desc){ + $smarty->assign($key."ACL", $this->getacl($key,$this->ReadOnly)); } - } - $smarty->assign("changeState",$changeState); + if ($this->is_account){ + $smarty->assign("pureftpdState", "checked"); + }else{ + $smarty->assign("pureftpdState", ""); + } + $smarty->assign("fstate", ""); + $smarty->assign("changeState",""); + + }else{ + foreach($tmp['plProvidedAcls'] as $key => $desc){ + $smarty->assign($key."ACL", $this->getacl($key,$this->ReadOnly)); + $smarty->assign($key."_W", $this->acl_is_writeable($key,$this->ReadOnly)); + + if($this->acl_is_writeable($key)){ + $changeState.= " changeState('".$key."'); \n"; + } + } + $smarty->assign("changeState",$changeState); - $smarty->assign("fstate", ""); - if ($this->is_account){ - $smarty->assign("pureftpdState", "checked"); $smarty->assign("fstate", ""); - } else { - $smarty->assign("pureftpdState", ""); - if($_SESSION['js']==1){ - if($this->acl!="#none#") - $smarty->assign("fstate", "disabled"); - }else{ + if ($this->is_account){ + $smarty->assign("pureftpdState", "checked"); $smarty->assign("fstate", ""); + } else { + $smarty->assign("pureftpdState", ""); + if($_SESSION['js']==1){ + if($this->acl!="#none#") + $smarty->assign("fstate", "disabled"); + }else{ + $smarty->assign("fstate", ""); + } } } - $smarty->assign("use_FTPStatus", ($this->FTPStatus == "disabled") ? "checked" : ""); - - if((!$this->ReadOnly)&&(($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable())) ){ - $smarty->assign('pureftpdACL', ""); - }else{ - $smarty->assign('pureftpdACL', " disabled "); - } + foreach($this->attributes as $attr){ + if(in_array($attr,$this->multi_boxes)){ + $smarty->assign("use_".$attr,TRUE); + }else{ + $smarty->assign("use_".$attr,FALSE); + } + } + $smarty->assign("use_pureftpd",in_array("pureftpd",$this->multi_boxes)); + $smarty->assign("multiple_support",$this->multiple_support_active); + $smarty->assign("FTPStatus", ($this->FTPStatus == "disabled") ? "checked" : ""); + $smarty->assign('pureftpdACL', $this->getacl("",$this->ReadOnly)); $display.= $smarty->fetch (get_template_path('pureftpd.tpl', TRUE, dirname(__FILE__))); return ($display); } @@ -250,6 +272,51 @@ class pureftpdAccount extends plugin "FTPStatus" => _("Status")) )); } + + function multiple_save_object() + { + if (isset($_POST['connectivityTab'])){ + plugin::multiple_save_object(); + if(isset($_POST['use_pureftpd'])){ + $this->multi_boxes[] = "pureftpd"; + } + $this->save_object(); + } + } + + function get_multi_init_values() + { + $ret = plugin::get_multi_init_values(); + $ret['is_account'] = $this->is_account; + return($ret); + } + + function init_multiple_support($attrs,$attr) + { + plugin::init_multiple_support($attrs,$attr); + + if(isset($attrs['is_account'])){ + $this->is_account = $attrs['is_account']; + } + } + + function get_multi_edit_values() + { + $ret = plugin::get_multi_edit_values(); + if(in_array("pureftpd",$this->multi_boxes)){ + $ret['is_account'] = $this->is_account; + } + return($ret); + } + + function set_multi_edit_values($values) + { + plugin::set_multi_edit_values($values); + if(isset($values['is_account'])){ + $this->is_account = $values['is_account']; + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/gosa-core/plugins/personal/connectivity/pureftpd.tpl b/gosa-core/plugins/personal/connectivity/pureftpd.tpl index 714ef787b..5558f54ad 100644 --- a/gosa-core/plugins/personal/connectivity/pureftpd.tpl +++ b/gosa-core/plugins/personal/connectivity/pureftpd.tpl @@ -1,6 +1,8 @@

- + {render acl=$pureftpdACL checkbox=$multiple_support checked=$use_pureftpd} + + {/render} {t}FTP account{/t}

@@ -18,7 +20,7 @@ {t}Upload bandwidth{/t} -{render acl=$FTPUploadBandwidthACL} +{render acl=$FTPUploadBandwidthACL checkbox=$multiple_support checked=$use_FTPUploadBandwidth} {/render} {t}kb/s{/t} @@ -26,7 +28,7 @@ {t}Download bandwidth{/t} -{render acl=$FTPDownloadBandwidthACL} +{render acl=$FTPDownloadBandwidthACL checkbox=$multiple_support checked=$use_FTPDownloadBandwidth} {/render} {t}kb/s{/t} @@ -46,7 +48,7 @@ {t}Files{/t} -{render acl=$FTPQuotaFilesACL} +{render acl=$FTPQuotaFilesACL checkbox=$multiple_support checked=$use_FTPQuotaFiles} {/render} @@ -54,7 +56,7 @@ {t}Size{/t} -{render acl=$FTPQuotaMBytesACL} +{render acl=$FTPQuotaMBytesACL checkbox=$multiple_support checked=$use_FTPQuotaMBytes} {/render} {t}MB{/t} @@ -75,11 +77,11 @@ {t}Uploaded / downloaded files{/t} -{render acl=$FTPUploadRatioACL} +{render acl=$FTPUploadRatioACL checkbox=$multiple_support checked=$use_FTPUploadRatio} {/render} / -{render acl=$FTPDownloadRatioACL} +{render acl=$FTPDownloadRatioACL checkbox=$multiple_support checked=$use_FTPDownloadRatio} {/render} @@ -94,8 +96,8 @@ -{render acl=$FTPStatusACL} - +{render acl=$FTPStatusACL checkbox=$multiple_support checked=$use_FTPStatus} + {/render} {t}Temporary disable FTP access{/t}