summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 775d4a1)
raw | patch | inline | side by side (parent: 775d4a1)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 14 Jun 2010 12:37:42 +0000 (12:37 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 14 Jun 2010 12:37:42 +0000 (12:37 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18860 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/personal/uniBonnSoFS/accountSoFS.tpl | [new file with mode: 0644] | patch | blob |
gosa-core/plugins/personal/uniBonnSoFS/class_accountSoFS.inc | [new file with mode: 0644] | patch | blob |
gosa-core/plugins/personal/uniBonnSoFS/main.inc | [new file with mode: 0644] | patch | blob |
diff --git a/gosa-core/plugins/personal/uniBonnSoFS/accountSoFS.tpl b/gosa-core/plugins/personal/uniBonnSoFS/accountSoFS.tpl
--- /dev/null
@@ -0,0 +1 @@
+test
diff --git a/gosa-core/plugins/personal/uniBonnSoFS/class_accountSoFS.inc b/gosa-core/plugins/personal/uniBonnSoFS/class_accountSoFS.inc
--- /dev/null
@@ -0,0 +1,109 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id: class_account.inc 9975 2008-03-25 14:09:30Z hickert $$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class accountSoFS extends uniPlugin
+{
+ /* Definitions */
+ var $plHeadline= "SoFS-Disk space";
+ var $plDescription= "SoFS-Disk space plugin";
+
+
+ function __construct(&$config,$dn)
+ {
+ plugin::plugin($config,$dn);
+
+ }
+
+
+ function execute()
+ {
+ $smarty = get_smarty();
+
+ return($display.$smarty->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
--- /dev/null
@@ -0,0 +1,150 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id: main.inc 13288 2008-12-12 14:54:13Z hickert $$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+/* Remove locks created by this plugin
+*/
+$lock_msg="";
+if ($remove_lock || isset($_POST['edit_cancel'])){
+ if(session::is_set('accountSoFS') && session::is_set('edit')){
+ del_lock($ui->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.= "<p class=\"plugbottom\">";
+
+ /* Are we in edit mode? */
+ if (session::is_set('edit')){
+ $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
+ $display.= " ";
+ $display.= "<input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
+ $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/locked.png').
+ "\"> ".$ui->dn." ";
+ } else {
+ $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/unlocked.png').
+ "\"> ".$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.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/on.png')."\"> ".
+ msgPool::clickEditToChange();
+
+ $display.= "<input type=submit name=\"edit\" value=\"".msgPool::editButton()."\">\n";
+ }
+ $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+ }
+ $display.= "</p>\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:
+?>