summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e505eae)
raw | patch | inline | side by side (parent: e505eae)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 24 Aug 2005 09:34:16 +0000 (09:34 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 24 Aug 2005 09:34:16 +0000 (09:34 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1216 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/personal/environment/class_environment.inc | [new file with mode: 0644] | patch | blob |
plugins/personal/environment/environment.tpl | [new file with mode: 0644] | patch | blob |
plugins/personal/environment/main.inc | [new file with mode: 0644] | patch | blob |
diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc
--- /dev/null
@@ -0,0 +1,183 @@
+<?php
+
+class environment extends plugin
+{
+ /* CLI vars */
+ var $cli_summary = "Manage server basic objects";
+ var $cli_description = "Some longer text\nfor help";
+ var $cli_parameters = array("eins" => "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
--- /dev/null
@@ -0,0 +1,181 @@
+{if $is_account ne 'true'}
+ <img alt="" src="images/stop.png" align="middle">
+ {t}The environment extension is currently disabled.{/t}
+{else}
+<table summary="" width="100%">
+ <tr>
+ <td valign="top" width="50%">
+ <h2><img alt="" src="images/banana.png" align="middle"> {t}Profiles{/t}</h2>
+ <table summary="">
+ <tr>
+ <td>
+ <input type="checkbox" value="1" {$useProfileCHK} name="useProfile">
+ </td>
+ <td valign="top">
+ {t}Use profile managment{/t}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ </td>
+ <td>
+ <table summary="">
+ <tr>
+ <td>
+ {t}Profil server{/t}
+ </td>
+ <td>
+ <select style="width:350px;" name="goProfileServer">
+ {html_options values=$goProfileServers output=$goProfileServer}
+ <option disabled> </option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ {t}Use local caching{/t}
+ </td>
+ <td>
+ <input type="checkbox" name="gotoProfileFlag_C" value="C" {$gotoProfileFlagsACL} {$gotoProfileFlag_CCHK}>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <table>
+ <tr>
+ <td>{t}Quota{/t}
+ </td>
+ <td>
+ <input type="text" name="gotoIDon'tKnow">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ {t}Resolution{/t}
+ </td>
+ <td>
+ <select name="gotoXResolution" {$gotoXResolutionACL}>
+ {html_options values=$gotoXResolutions output=$gotoXResolutions}
+ <option disabled> </option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="checkbox" name="gotoProfileFlag_L" {$gotoProfileFlagsACL} {$gotoProfileFlag_LCHK}>
+ </td>
+ <td>
+ {t}Resolution changeable on runtime {/t}
+ </td>
+ </tr>
+ </table>
+
+ <p class="seperator"> </p>
+ <h2><img alt="" src="images/banana.png" align="middle"> {t}Kiosk profile{/t}</h2>
+ <table summary="">
+ <tr>
+ <td>
+ {t}Kiosk profile{/t}
+ </td>
+ <td>
+ <select name="gotoKioskProfile" {$gotoKioskProfileACL}>
+ {html_options values=$gotoKioskProfiles output=$gotoKioskProfiles}
+ <option disabled> </option>
+ </td>
+ </tr>
+ <tr>
+ <td>
+
+ </td>
+ <td>
+ <input type="submit" name="KioskManagementDialog" value="{t}Profile management{/t}">
+ </td>
+ </tr>
+ </table>
+ <p class="seperator"> </p>
+ <h2><img alt="" src="images/banana.png" align="middle"> {t}Login scripts{/t}</h2>
+ <table summary="">
+ <tr>
+ <td>
+ <select style="width:350px;" name="gotoLoginScript" multiple size=4 {$gotoLoginScriptACL}>
+ {html_options values=$gotoLoginScripts output=$gotoLoginScripts}
+ <option disabled> </option>
+ </select>
+
+ <br>
+ <input type="submit" {gotoLoginScriptACL} name="gotoLoginScriptNew" value="{t}Add{/t}">
+ <input type="submit" {gotoLoginScriptACL} name="gotoLoginScriptDel" value="{t}Delete{/t}">
+ <input type="submit" {gotoLoginScriptACL} name="gotoLoginScriptEditl" value="{t}Edit{/t}">
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td style="border-left: 1px solid rgb(160, 160, 160);" valign="top">
+ <h2><img alt="" src="images/banana.png" align="middle"> {t}Attach share{/t}</h2>
+ <table summary="">
+ <tr>
+ <td>
+ <select style="width:350px;" name="gotoShare" multiple size=4 {$gotoShareACL}>
+ {html_options values=$gotoShares output=$gotoShares}
+ <option disabled> </option>
+ </select>
+
+ <br>
+
+ <select name="gotoShareSelection" {$gotoShareACL}>
+ {html_options values=$gotoShareSelections output=$gotoShareSelections}
+ <option disabled> </option>
+ </select>
+ <input type="text" {$gotoShareACL} name="gotoShareMountPoint" value="">
+ <input type="submit" {$gotoShareACL} name="gotoShareAdd" value="+">
+ <input type="submit" {$gotoShareACL} name="gotoShareDel" value="-">
+ </td>
+ </tr>
+ </table>
+ <p class="seperator"> </p>
+ <h2><img alt="" src="images/banana.png" align="middle"> {t}Hotplug devices{/t}</h2>
+ <table summary="">
+ <tr>
+ <td>
+ <select name="gotoHotplugDevice" {$gotoHotplugDeviceACL} size=4 style="width:350px;">
+ {html_options values=$gotoHotplugDevices output=$gotoHotplugDevices}
+ <option disabled> </option>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="submit" {$gotoHotplugDeviceACL} name="gotoHotplugDeviceNew" value="{t}New{/t}">
+ <input type="submit" {$gotoHotplugDeviceACL} name="gotoHotplugDeviceUse" value="{t}Existing{/t}">
+ <input type="submit" {$gotoHotplugDeviceACL} name="gotoHotplugDeviceDel" value="{t}Delete{/t}">
+ </td>
+ </tr>
+ </table>
+ <p class="seperator"> </p>
+ <h2><img alt="" src="images/banana.png" align="middle"> {t}Printer{/t}</h2>
+ <table summary="">
+ <tr>
+ <td>
+ <select style="width:350px;" name="gotoPrinter" multiple size=4 {$gotoPrinterACL}>
+ {html_options values=$gotoPrinters output=$gotoPrinters}
+ <option disabled> </option>
+ </select>
+
+ <br>
+ <input type="submit" {$gotoLoginScriptACL} name="gotoLoginScriptNew" value="{t}Add{/t}">
+ <input type="submit" {$gotoLoginScriptACL} name="gotoLoginScriptDel" value="{t}Delete{/t}">
+ <input type="submit" {$gotoLoginScriptACL} name="gotoLoginScriptEditl" value="{t}Admin Toggle{/t}">
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+
+
+
+
+
+{/if}
diff --git a/plugins/personal/environment/main.inc b/plugins/personal/environment/main.inc
--- /dev/null
@@ -0,0 +1,129 @@
+<?php
+/*
+ This code is part of GOsa (https://gosa.gonicus.de)
+ Copyright (C) 2003 Cajus Pollmeier
+
+ 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
+ */
+
+if (!$remove_lock){
+ /* Reset requested? */
+ if (isset($_POST['edit_cancel']) ||
+ (isset($_GET['reset']) && $_GET['reset'] == 1)){
+ del_lock ($ui->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.= "<p class=\"plugbottom\">";
+
+ /* Are we in edit mode? */
+ if (isset($_SESSION['edit'])){
+ $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+ $display.= " ";
+ $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+ $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+ "\"> ".$ui->dn." ";
+ } else {
+ $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+ "\"> ".$ui->dn." ";
+ if (isset($editacl) && $editacl != "#none#"){
+ $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
+ "\"> "._("Click the 'Edit' button below to change informations in this dialog");
+ $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
+ }
+
+ $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+ }
+ $display.= "</p>\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:
+?>