From: hickert Date: Wed, 24 Aug 2005 09:34:16 +0000 (+0000) Subject: Environment Settings added X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c843c0438f6715b286dc29524848e3aa455f4a95;p=gosa.git Environment Settings added git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1216 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc new file mode 100644 index 000000000..7ea78499c --- /dev/null +++ b/plugins/personal/environment/class_environment.inc @@ -0,0 +1,183 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* attribute list for save action */ + var $ignore_account = FALSE; + var $plHeadline = "Environment"; + var $plDescription = "This does something"; + var $in_dialog = false; // Indicates that we are currently editing in an seperate dialog + + /* Attribute definition + */ + + /* profile managment */ + var $useProfile = false; // Specifies if we want to use a Server + var $goProfileServer = ""; // Specifies the selected profile server + var $goProfileServers = array();// Specifies all available and selectable servers + var $gotoProfileFlags = ""; // Flags enabled ? only used to set ACL and save + var $gotoProfileFlag_C = ""; // Flag is set to C if we have the profile caching fucntion enabled + + var $gotoXResolution = ""; // The selected resolution eg: 1024x768 + var $gotoXResolutions = array();// Contains all available resolutions for this account + var $gotoProfileFlag_L = ""; // Flag is set to L to enable runtime resolution change + + /* Login script section*/ + var $gotoLoginScripts = array();// Contains all available Login Scripts + var $gotoLoginScript = ""; // The selected Login Script + + /* Printer */ + var $gotoPrinters = array();// All available Printer + var $gotoPrinter = ""; // The selected Printer + + /* Share */ + var $gotoShares = array();// Currently Share Option + var $gotoShare = ""; // currently selected Share Option + var $gotoShareSelections= array();// Available Shares for this account + + /* Kiosk profile */ + var $gotoKioskProfile = ""; // The selected Kiosk Profile + var $gotoKioskProfiles = array();// All available Kiosk profiles + + /* Hotplug Devices */ + var $gotoHotplugDevice = ""; // Selected hotplug + var $gotoHotplugDevices = array();// Already configured hotplug devices + + + /* general settings */ + // Sets the attributes which will kept on page reload, which will be saved, ... + var $attributes = array("useProfile","goProfileServer","goProfileServers","gotoProfileFlags","gotoProfileFlag_C", + "gotoXResolution","gotoXResolutions","gotoProfileFlag_L", + "gotoLoginScripts","gotoLoginScript", + "gotoPrinters","gotoPrinter", + "gotoShares","gotoShare","gotoShareSelections", + "gotoKioskProfile","gotoKioskProfiles", + "gotoHotplugDevice","gotoHotplugDevices"); + var $objectclasses = array("whatever"); // Specifies the objectClass which contains the attributes edited here + + + + + + + function environment ($config, $dn= NULL) + { + plugin::plugin ($config, $dn); + } + + function execute() + { + /* Fill templating stuff */ + $smarty= get_smarty(); + $display= ""; + + /* Is accout enabled | are we editing from usermenu or admin menu + All these tab managment is done here + */ + + // 1. Account disabled . Editing from usermenu + if((!isset($this->parent))&&(!$this->is_account)){ + /* We are currently editing this tab from usermenu, but htis account is not enabled */ + $smarty->assign("is_account",$this->is_account); + /* Load template */ + $display .= $smarty->fetch(get_template_path('environment.tpl', TRUE)); + /* Avoid the "You are currently editing ...." message when you leave this tab */ + $display .= back_to_main(); + /* Display our message to the user */ + return $display; + + // Account is enabled + }else{ + /* Tell smarty that this accoutn is enabled */ + $smarty->assign("is_account","true"); + + /* Do we need to flip is_account state? */ + if (isset($_POST['modify_state'])){ + $this->is_account= !$this->is_account; + } + if(!isset($this->parent)){ + // 3. ? Account Enabled . Editing from usermenu + + }else{ + // 3. Account enabled . Editing from adminmenu + if ($this->is_account){ + $display= $this->show_header(_("Remove environment extension"), + _("This server has environment extension enabled. You can disable it by clicking below.")); + } else { + // 4. Account disabled . Editing from adminmenu + $display= $this->show_header(_("Add environment extension"), + _("This server has environment extension disabled. You can enable it by clicking below.")); + return $display; + } + } + } + /* Account is Account : is_accounbt=true. + * Else we won't reach this. + */ + + /* Prepare all variables for smarty */ + foreach($this->attributes as $s_attr){ + /* Set value*/ + $smarty->assign($s_attr,$this->$s_attr); + + /* Set checkbox state*/ + if(empty($this->$s_attr)){ + $smarty->assign($s_attr."CHK",""); + }else{ + $smarty->assign($s_attr."CHK"," checked "); + } + + /* Prepare ACL settings*/ + if(chkacl($this->acl,$s_attr)=="") { + $smarty->assign($s_attr."ACL",""); + }else{ + $smarty->assign($s_attr."ACL"," disabled "); + } + + } + + /* Als smarty vars are set. Get smarty template and generate output */ + $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__))); + return($display); + } + + function remove_from_parent() + { + /* This cannot be removed... */ + } + + + /* Save data to object */ + function save_object() + { + plugin::save_object(); + } + + + /* Check supplied data */ + function check() + { + $message= array(); + + return ($message); + } + + + /* Save to LDAP */ + function save() + { + plugin::save(); + + /* Optionally execute a command after we're done */ + #$this->handle_post_events($mode); + } + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/plugins/personal/environment/environment.tpl b/plugins/personal/environment/environment.tpl new file mode 100644 index 000000000..ee7d78b06 --- /dev/null +++ b/plugins/personal/environment/environment.tpl @@ -0,0 +1,181 @@ +{if $is_account ne 'true'} + + {t}The environment extension is currently disabled.{/t} +{else} + + + + + +
+

 {t}Profiles{/t}

+ + + + + + + + + +
+ + + {t}Use profile managment{/t} +
  + + + + + + + + + + +
+ {t}Profil server{/t} + + +
+ {t}Use local caching{/t} + + +
+
+ + + + + + + + + + + + + +
{t}Quota{/t} + + +
+ {t}Resolution{/t} + + +
+ + + {t}Resolution changeable on runtime {/t} +
+ +

 

+

 {t}Kiosk profile{/t}

+ + + + + + + + + +
+ {t}Kiosk profile{/t} + +
+   + + +
+

 

+

 {t}Login scripts{/t}

+ + + + +
+ + +
+ + + +
+
+

 {t}Attach share{/t}

+ + + + +
+ + +
+ + + + + +
+

 

+

 {t}Hotplug devices{/t}

+ + + + + + + +
+
+ + + +
+

 

+

 {t}Printer{/t}

+ + + + +
+ + +
+ + + +
+
+ + + + + + +{/if} diff --git a/plugins/personal/environment/main.inc b/plugins/personal/environment/main.inc new file mode 100644 index 000000000..91883ab78 --- /dev/null +++ b/plugins/personal/environment/main.inc @@ -0,0 +1,129 @@ +dn); + sess_del ('edit'); + sess_del ('environment'); + } + + /* Create mail object on demand */ + if (!isset($_SESSION['environment']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){ + $_SESSION['environment']= new environment ($config, $ui->dn); + } + $environment= $_SESSION['environment']; + + /* save changes back to object */ + if (isset($_SESSION['edit'])){ + $environment->save_object (); + } + + /* Enter edit mode? */ + if (isset($_POST['edit'])){ + + /* Check locking */ + if (($username= get_lock($ui->dn)) != ""){ + $_SESSION['back_plugin']= $plug; + gen_locked_message ($username, $ui->dn); + exit (); + } + + /* Lock the current entry */ + add_lock ($ui->dn, $ui->dn); + $_SESSION['dn']= $ui->dn; + $_SESSION['edit']= TRUE; + } + + /* Adjust acl's to mode */ + if (isset($_SESSION['edit'])){ + $acl= get_permissions ($ui->dn, $ui->subtreeACL); + $environment->acl= get_module_permission($acl, "environment", $ui->dn); + } else { + $acl= get_permissions ($ui->dn, $ui->subtreeACL); + $editacl= get_module_permission($acl, "environment",$ui->dn); + $environment->acl= "#none#"; + } + + /* save changes to LDAP and disable edit mode */ + if (isset($_POST['edit_finish'])){ + + /* Perform checks */ + $message= $environment->check (); + + /* No errors, save object */ + if (count ($message) == 0){ + $environment->save (); + gosa_log ("User/environment object'".$ui->dn."' has been saved"); + $environment->acl= "#none#"; + del_lock ($ui->dn); + sess_del ('edit'); + + /* Store object */ + $_SESSION['environment']= $environment; + } else { + /* Errors found, show message */ + show_errors ($message); + } + } + + /* Execute formular */ + $display= $environment->execute (); + + /* Store changes in session */ + if (isset ($_SESSION['edit'])){ + $_SESSION['environment']= $environment; + } + + $info= ""; + /* Show page footer depending on the mode */ + if (!$environment->in_dialog && $environment->is_account){ + $display.= "

"; + + /* Are we in edit mode? */ + if (isset($_SESSION['edit'])){ + $display.= "\n"; + $display.= " "; + $display.= "\n"; + $info= "\"\" ".$ui->dn." "; + } else { + $info= "\"\" ".$ui->dn." "; + if (isset($editacl) && $editacl != "#none#"){ + $info.= "\"\" "._("Click the 'Edit' button below to change informations in this dialog"); + $display.= "\n"; + } + + $display.= "\n"; + } + $display.= "

\n"; + } + + /* Page header*/ + $display= print_header(get_template_path('images/email.png'), _("User environment settings"), $info).$display; + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?>