From 4b6fc5bb2deec5ee152042c0177f7b6df773b460 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 14 Jun 2010 12:37:42 +0000 Subject: [PATCH] Added SoFS dummy git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18860 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../personal/uniBonnSoFS/accountSoFS.tpl | 1 + .../uniBonnSoFS/class_accountSoFS.inc | 109 +++++++++++++ .../plugins/personal/uniBonnSoFS/main.inc | 150 ++++++++++++++++++ 3 files changed, 260 insertions(+) create mode 100644 gosa-core/plugins/personal/uniBonnSoFS/accountSoFS.tpl create mode 100644 gosa-core/plugins/personal/uniBonnSoFS/class_accountSoFS.inc create mode 100644 gosa-core/plugins/personal/uniBonnSoFS/main.inc diff --git a/gosa-core/plugins/personal/uniBonnSoFS/accountSoFS.tpl b/gosa-core/plugins/personal/uniBonnSoFS/accountSoFS.tpl new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/gosa-core/plugins/personal/uniBonnSoFS/accountSoFS.tpl @@ -0,0 +1 @@ +test diff --git a/gosa-core/plugins/personal/uniBonnSoFS/class_accountSoFS.inc b/gosa-core/plugins/personal/uniBonnSoFS/class_accountSoFS.inc new file mode 100644 index 000000000..c7e6e33e4 --- /dev/null +++ b/gosa-core/plugins/personal/uniBonnSoFS/class_accountSoFS.inc @@ -0,0 +1,109 @@ +fetch(get_template_path('accountQuota.tpl',TRUE,dirname(__FILE__)))); + } + + + function save_object() + { + plugin::save_object(); + } + + + function check() + { + $messages = plugin::check(); + return($messages); + } + + + function save() + { + plugin::save(); + $this->cleanup(); + } + + + /* remove object from parent */ + function remove_from_parent() + { + $ui=get_userinfo(); + + /* Remove and write to LDAP */ + if(!$this->initially_was_account) return(false); + + plugin::remove_from_parent(); + + @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save"); + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + + new log("remove","uniBonnAccount/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class())); + }else{ + $this->handle_post_events("remove",array("uid" => $uid, "userdn" => $ui->dn)); + } + } + + function multiple_execute(){ return($this->execute()); } + + static function plInfo() + { + return (array( + "plDescription" => _("SoFS-Disk space"), + "plSelfModify" => TRUE, + "plDepends" => array("user"), + "plPriority" => 2, + "plSection" => array("personal" => _("My account")), + "plCategory" => array("uniBonnAccount"), + "plOptions" => array(), + + "plProvidedAcls" => array( + "test" => _("Test")) + )); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/personal/uniBonnSoFS/main.inc b/gosa-core/plugins/personal/uniBonnSoFS/main.inc new file mode 100644 index 000000000..dfc54c630 --- /dev/null +++ b/gosa-core/plugins/personal/uniBonnSoFS/main.inc @@ -0,0 +1,150 @@ +dn); + } +} + +/* Remove this plugin from session +*/ +if ( $cleanup ){ + session::un_set('accountSoFS'); + session::un_set('edit'); + +}else{ + + /* Reset requested? */ + if (isset($_POST['edit_cancel'])){ + session::un_set ('edit'); + session::un_set ('accountSoFS'); + } + + /* Create accountSoFS object on demand */ + if (!session::is_set('accountSoFS') || (isset($_GET['reset']) && $_GET['reset'] == 1)){ + $accountSoFS= new accountSoFS ($config, $ui->dn); + $accountSoFS->enable_CSN_check(); + $accountSoFS->set_acl_base($ui->dn); + $accountSoFS->set_acl_category("uniBonnAccount"); + + uniBonnAccount::propagateRoleAttributes($config, NULL, $accountSoFS, NULL); + + session::set('accountSoFS',$accountSoFS); + } + $accountSoFS = session::get('accountSoFS'); + + /* save changes back to object */ + if (session::is_set('edit')){ + $accountSoFS->save_object (); + } + + /* Enter edit mode? */ + if ((isset($_POST['edit'])) && (!session::is_set('edit'))){ + + /* Check locking */ + if (($username= get_lock($ui->dn)) != ""){ + session::set('back_plugin',$plug); + session::set('LOCK_VARS_TO_USE',array("/^edit$/","/^plug$/")); + $lock_msg = gen_locked_message ($username, $ui->dn); + + }else{ + + /* Lock the current entry */ + add_lock ($ui->dn, $ui->dn); + session::set('edit',TRUE); + } + } + + /* save changes to LDAP and disable edit mode */ + $info= ""; + if (isset($_POST['edit_finish'])){ + + /* Perform checks */ + $message= $accountSoFS->check (); + + /* No errors, save object */ + if (count ($message) == 0){ + $accountSoFS->save (); + del_lock ($ui->dn); + session::un_set ('edit'); + + /* Remove from session */ + session::un_set ('accountSoFS'); + } else { + /* Errors found, show message */ + msg_dialog::displayChecks($message); + } + } + + /* Execute formular */ + if($lock_msg){ + $display = $lock_msg; + }else{ + $display.= $accountSoFS->execute (); + } + + /* Store changes in session */ + if (session::is_set('edit')){ + session::set('accountSoFS',$accountSoFS); + } + + /* Show page footer depending on the mode */ + if ($accountSoFS->initially_was_account && empty($lock_msg)){ + + $display.= "

"; + + /* Are we in edit mode? */ + if (session::is_set('edit')){ + $display.= "\n"; + $display.= " "; + $display.= "\n"; + $info= "\"\" ".$ui->dn." "; + } else { + $info= "\"\" ".$ui->dn." "; + + /* Only display edit button if there is at least one attribute editable */ + if(preg_match("/w/",$ui->get_permissions($ui->dn,"uniBonnAccount/accountSoFS"))){ + $info.= "\"\" ". + msgPool::clickEditToChange(); + + $display.= "\n"; + } + $display.= "\n"; + } + $display.= "

\n"; + } + + /* Page header*/ + $display= print_header(get_template_path('plugins/uniBonnSoFS/images/plugin.png'), + _("Disk space"), $info).$display; + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> -- 2.30.2