X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fpersonal%2Fconnectivity%2Fclass_proxyAccount.inc;h=cddd05d9b3c7bad1f1a7f983642d069ee0abcaf5;hb=e7b70ce242b052c5e0d0dfd45dfac5e6f9f36ba3;hp=5e97daa8dd5be8ae48baa406007f46716eade90e;hpb=95c57cc6665198e4aa42df5f1acfdc86a066e958;p=gosa.git diff --git a/plugins/personal/connectivity/class_proxyAccount.inc b/plugins/personal/connectivity/class_proxyAccount.inc index 5e97daa8d..cddd05d9b 100644 --- a/plugins/personal/connectivity/class_proxyAccount.inc +++ b/plugins/personal/connectivity/class_proxyAccount.inc @@ -5,11 +5,6 @@ class proxyAccount extends plugin var $plHeadline= "Proxy"; var $plDescription= "This does something"; - /* CLI vars */ - var $cli_summary= "Manage users proxy account"; - var $cli_description= "Some longer text\nfor help"; - var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser"); - /* Proxy attributes */ var $gosaProxyAcctFlags= "[N ]"; var $gosaProxyID= ""; @@ -30,26 +25,36 @@ class proxyAccount extends plugin function execute() { + /* Call parent execute */ +// plugin::execute(); + $display= ""; /* Prepare templating */ $smarty= get_smarty(); - $smarty->assign("gosaProxyAcctFlagsACL", chkacl($this->acl, "gosaProxyAcctFlags")); + $smarty->assign("proxyAccountACL", chkacl($this->acl, "proxyAccount")); + $smarty->assign("gosaProxyAcctFlagsACL", chkacl($this->acl, "gosaProxyAcctFlags")); $smarty->assign("gosaProxyWorkingStartACL", chkacl($this->acl, "gosaProxyWorkingStart")); - $smarty->assign("gosaProxyWorkingStopACL", chkacl($this->acl, "gosaProxyWorkingStop")); - $smarty->assign("gosaProxyQuotaACL", chkacl($this->acl, "gosaProxyQuota")); - - /* Show checkbox? */ - if ($this->parent != NULL){ - $smarty->assign("tabbed", "1"); - } + $smarty->assign("gosaProxyWorkingStopACL", chkacl($this->acl, "gosaProxyWorkingStop")); + $smarty->assign("gosaProxyQuotaACL", chkacl($this->acl, "gosaProxyQuota")); /* Assign radio boxes */ foreach (array("F", "T", "B", "N") as $val){ if (is_integer(strpos($this->gosaProxyAcctFlags, "$val"))) { $smarty->assign("filter$val", "checked"); + + /* Add state variables for on-the-fly state-changing of checkboxes */ + $smarty->assign($val."state", ""); + } else { $smarty->assign("filter$val", ""); + + /* Same as above */ + if($_SESSION['js']==1){ + $smarty->assign($val."state", "disabled"); + }else{ + $smarty->assign($val."state", ""); + } } } @@ -84,6 +89,44 @@ class proxyAccount extends plugin $smarty->assign("pstate", ""); } + $changeA = ""; + + if(chkacl($this->acl,"gosaProxyAcctFlags")==""){ + $changeA .="changeState('filterF');\n"; + } + $smarty->assign("Working_allowedACL","disabled"); + if((chkacl($this->acl,"gosaProxyWorkingStart")=="")||(chkacl($this->acl,"gosaProxyWorkingStop")=="")){ + $smarty->assign("Working_allowedACL",""); + $changeA .= "changeState('filterT');\n"; + } + + $ProxyWorkingStateChange =""; + if(chkacl($this->acl,"gosaProxyWorkingStart")==""){ + $ProxyWorkingStateChange.= "changeState('startHour');\n"; + $ProxyWorkingStateChange.= "changeState('startMinute');\n"; + } + + if(chkacl($this->acl,"gosaProxyWorkingStop")=="") { + $ProxyWorkingStateChange.= "changeState('stopHour');\n"; + $ProxyWorkingStateChange.= "changeState('stopMinute');\n"; + } + + $changeA .= $ProxyWorkingStateChange; + + $smarty->assign("ProxyWorkingStateChange",$ProxyWorkingStateChange); + + $changeB = ""; + if(chkacl($this->acl,"gosaProxyQuota")==""){ + $changeA .= "changeState('filterB');"; + $changeB = + "changeSubselectState('filterB', 'quota_size'); + changeSubselectState('filterB', 'quota_unit'); + changeSubselectState('filterB', 'gosaProxyQuotaPeriod');"; + } + + $smarty->assign("changeB",$changeB); + $smarty->assign("changeA",$changeA); + /* Show main page */ $display.= $smarty->fetch(get_template_path('proxy.tpl', TRUE, dirname(__FILE__))); return($display); @@ -102,8 +145,10 @@ class proxyAccount extends plugin @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save"); $ldap->cd($this->dn); - $ldap->modify($this->attrs); - show_ldap_error($ldap->get_error()); + $this->cleanup(); + $ldap->modify ($this->attrs); + + show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/proxy account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ $this->handle_post_events("remove"); @@ -112,7 +157,8 @@ class proxyAccount extends plugin /* Check values */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* We've got only one value to check for positive integer or emtpy field */ if ($this->is_account){ @@ -145,6 +191,12 @@ class proxyAccount extends plugin } } + if(isset($_POST['proxy'])){ + $this->is_account = TRUE; + }else{ + $this->is_account = FALSE; + } + /* Save flag value */ if ($this->is_account){ if (chkacl ($this->acl, "gosaProxyAcctFlags") == ""){ @@ -161,10 +213,13 @@ class proxyAccount extends plugin } /* Save time values */ - if (chkacl ($this->acl, "gosaProxyWorkingTime") == "" && isset($_POST['startMinute'])){ + if ((chkacl ($this->acl, "gosaProxyWorkingStart") == "")&&(isset($_POST['startMinute']))){ $old= $this->gosaProxyWorkingStart; $this->gosaProxyWorkingStart= $_POST["startHour"] * 60 + $_POST["startMinute"]; $this->is_modified= ($old != $this->gosaProxyWorkingStart)?TRUE:$this->is_modified; + } + + if ((chkacl ($this->acl, "gosaProxyWorkingStop") == "")&&(isset($_POST['stopMinute']))){ $old= $this->gosaProxyWorkingStop; $this->gosaProxyWorkingStop = $_POST["stopHour"] * 60 + $_POST["stopMinute"]; $this->is_modified= ($old != $this->gosaProxyWorkingStop)?TRUE:$this->is_modified; @@ -173,10 +228,14 @@ class proxyAccount extends plugin /* Save quota values */ if (chkacl ($this->acl, "gosaProxyQuota") == ""){ $old= $this->gosaProxyQuota; - $this->gosaProxyQuota= $_POST["quota_size"].$_POST["quota_unit"]; + if(isset($_POST["quota_size"]) && isset($_POST["quota_unit"])){ + $this->gosaProxyQuota= $_POST["quota_size"].$_POST["quota_unit"]; + } $this->is_modified= ($old != $this->gosaProxyQuota)?TRUE:$this->is_modified; $old= $this->gosaProxyQuotaPeriod; - $this->gosaProxyQuotaPeriod = $_POST["gosaProxyQuotaPeriod"]; + if(isset($_POST["gosaProxyQuotaPeriod"])){ + $this->gosaProxyQuotaPeriod = $_POST["gosaProxyQuotaPeriod"]; + } $this->is_modified= ($old != $this->gosaProxyQuotaPeriod)?TRUE:$this->is_modified; } } @@ -192,9 +251,10 @@ class proxyAccount extends plugin /* Write back to ldap */ $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); - $ldap->modify($this->attrs); + $this->cleanup(); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/proxy account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ @@ -207,6 +267,26 @@ class proxyAccount extends plugin } + /* Return plugin informations for acl handling + #FIME There possibly some attributes that can be combined to one acl. */ + function plInfo() + { + return (array( "plDescription" => _("Intranet account settings"), + "plSelfModify" => TRUE, + "plDepends" => array("objectClass" => "gosaAccount"), + + "gosaProxyID" => "!!! FIXME "._("gosaProxyID"), + + "gosaProxyFlag_F" => _("Filter unwanted content"), + "gosaProxyFlag_T" => _("Limit proxy access"), + "gosaProxyFlag_B" => _("Restrict proxy usage by quota"), + + "gosaProxyWorkingTime" => _("Limit proxy access"), + "gosaProxyQuota" => _("Limit quota"), + "gosaProxyQuotaPeriod" => _("Quota limit period"))); + } + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: