summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 67e6064)
raw | patch | inline | side by side (parent: 67e6064)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 17 Jan 2008 14:37:40 +0000 (14:37 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 17 Jan 2008 14:37:40 +0000 (14:37 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8465 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/personal/connectivity/class_connectivity.inc | [deleted file] | patch | blob | history |
gosa-core/plugins/personal/connectivity/class_intranetAccount.inc | [deleted file] | patch | blob | history |
gosa-core/plugins/personal/connectivity/intranet.tpl | [deleted file] | patch | blob | history |
gosa-core/plugins/personal/connectivity/main.inc | [deleted file] | patch | blob | history |
gosa-plugins/connectivity/personal/connectivity/class_connectivity.inc | [new file with mode: 0644] | patch | blob |
gosa-plugins/connectivity/personal/connectivity/class_intranetAccount.inc | [new file with mode: 0644] | patch | blob |
gosa-plugins/connectivity/personal/connectivity/intranet.tpl | [new file with mode: 0644] | patch | blob |
gosa-plugins/connectivity/personal/connectivity/main.inc | [new file with mode: 0644] | patch | blob |
diff --git a/gosa-core/plugins/personal/connectivity/class_connectivity.inc b/gosa-core/plugins/personal/connectivity/class_connectivity.inc
+++ /dev/null
@@ -1,264 +0,0 @@
-<?php
-/*! \brief connectivity plugin
- \author Cajus Pollmeier <pollmeier@gonicus.de>
- \version 2.30
- \date 29.03.2005
-
- This class provides the functionality to read and write all attributes
- relevant for connectivity settings from/to the LDAP. It does syntax checking
- and displays the formulars required.
- */
-
-class connectivity extends plugin
-{
- /* Definitions */
- var $plHeadline= "Connectivity";
- var $plDescription= "This does something";
-
- /* attribute list for save action */
- var $attributes= array();
- var $objectclasses= array();
-
- var $ignore_account= TRUE;
- var $plugin= array();
- var $plugin_name= array();
- var $CopyPasteVars = array("plugin","plugin_name");
-
- var $multiple_support = TRUE;
-
- function connectivity (&$config, $dn= NULL,$parent =NULL)
- {
- /* Preseed permissions */
- $this->dn= $dn;
- $ui= get_userinfo();
-
- $this->config = $config;
-
- /* Load accounts */
- foreach ($config->data['TABS']['CONNECTIVITY'] as $plug){
- if (!plugin_available($plug['CLASS'])) {
- continue;
- }
- $name= $plug['CLASS'];
- $this->plugin_name[]= $name;
- $this->plugin[$name]= new $name($config, $dn,$parent);
-
- /* Acl base && category configuration,
- these settings will be overloaded in main.inc,
- if we are editing ourself */
- $this->plugin[$name]-> set_acl_category("users");
- $this->plugin[$name]-> set_acl_base($this->dn);
- }
- }
-
- function execute()
- {
- /* Call parent execute */
- plugin::execute();
-
- $display= "";
-
- /* Prepare templating */
- $smarty= get_smarty();
-
- /* Do we represent a valid account? */
- if ($this->parent === NULL){
- $enabled= true;
- foreach ($this->plugin_name as $name){
- if ($this->plugin[$name]->is_account){
- $enabled= true;
- break;
- }
- }
- if (!$enabled){
- $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
- _("This account has no connectivity extensions.")."</b>";
- $display.= back_to_main();
- return ($display);
- }
- }
-
- /* Remove checkboxes in single edit mode */
- if ($this->parent !== NULL){
- foreach ($this->plugin_name as $name){
- $this->plugin[$name]->parent= $this->parent;
- }
- }
-
- /* Execude objects */
- $is_first= true;
-
- $ReadOnly = (!isset($this->parent) || !$this->parent) && !session::is_set('edit');
-
- foreach ($this->plugin_name as $name){
- $this->plugin[$name]->ReadOnly = $ReadOnly;
- if (!$is_first){
- $display.= '<p class="seperator"> </p>';
- } else {
- $is_first= false;
- }
- $display.= $this->plugin[$name]->execute();
- }
-
- /* Mark me as connectivity tab */
- $display.= "<input type='hidden' name='connectivityTab'>";
- return($display);
- }
-
-
- /* Save data to object */
- function save_object()
- {
- if (isset($_POST['connectivityTab'])){
- foreach ($this->plugin_name as $name){
- $this->plugin[$name]->save_object();
- }
- }
- }
-
- function check()
- {
- $message= plugin::check();
-
- foreach ($this->plugin_name as $name){
- $tmp= $this->plugin[$name]->check();
-
- $message= array_merge($message, $tmp);
- }
-
- return ($message);
- }
-
- function set_acl_category($cat)
- {
- plugin::set_acl_category($cat);
- foreach ($this->plugin_name as $name){
- $this->plugin[$name]->set_acl_category( $cat);
- }
- }
-
- function set_acl_base($base)
- {
- plugin::set_acl_base($base);
- foreach ($this->plugin_name as $name){
- $this->plugin[$name]->set_acl_base( $base);
- }
- }
-
- /* Save to LDAP */
- function save()
- {
- /* Save objects */
- foreach ($this->plugin_name as $name){
- $this->plugin[$name]->dn= $this->dn;
-
- if ($this->plugin[$name]->is_account){
- $this->plugin[$name]->save();
- } else {
- $this->plugin[$name]->remove_from_parent();
- }
- }
- }
-
- function remove_from_parent()
- {
- /* Remove objects */
- foreach ($this->plugin_name as $name){
- $this->plugin[$name]->dn= $this->dn;
- $this->plugin[$name]->remove_from_parent();
- }
- }
-
- function adapt_from_template($dn)
- {
- /* Adapt objects */
- foreach ($this->plugin_name as $name){
- $this->plugin[$name]->dn= $this->dn;
- $this->plugin[$name]->adapt_from_template($dn);
- }
- }
-
- /* Prepare the connectivity obj
- */
- function PrepareForCopyPaste($obj)
- {
- $tmp = $this->plugin;
- plugin::PrepareForCopyPaste($obj);
- $this->plugin = $tmp;
- foreach( $this->plugin as $key => $plug){
- $this->plugin[$key]->PrepareForCopyPaste($obj);
- }
- }
-
-
- function enable_multiple_support()
- {
- plugin::enable_multiple_support();
-
- foreach($this->plugin_name as $key => $name){
- if($this->plugin[$name]->multiple_support){
- $this->plugin[$name]->enable_multiple_support();
- }else{
- unset($this->plugin_name[$key]);
- unset($this->plugin[$name]);
- }
- }
- }
-
-
- function multiple_execute()
- {
- return($this->execute());
- }
-
- /* Save data to object */
- function multiple_save_object()
- {
- if (isset($_POST['connectivityTab'])){
- foreach ($this->plugin_name as $name){
- $this->plugin[$name]->multiple_save_object();
- }
- }
- }
-
- function multiple_check()
- {
- $message = plugin::multiple_check();
- foreach ($this->plugin_name as $name){
- $message = array_merge($message,$this->plugin[$name]->multiple_check());
- }
- return($message);
- }
-
- function get_multi_init_values()
- {
- $ret = array();
- foreach($this->plugin as $name => $plugin){
- $ret = array_merge($ret,$plugin->get_multi_init_values());
- }
- return($ret);
- }
-
- function init_multiple_support($attrs,$attr)
- {
- foreach($this->plugin as $name => $plugin){
- $this->plugin[$name]->init_multiple_support($attrs,$attr);
- }
- }
-
- function get_multi_edit_values()
- {
- $ret['plugin'] = &$this->plugin;
- return($ret);
- }
-
- function set_multi_edit_values($values)
- {
- foreach($values['plugin'] as $name => $plugin){
- $this->plugin[$name]->set_multi_edit_values($plugin->get_multi_edit_values());
- }
- }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/personal/connectivity/class_intranetAccount.inc b/gosa-core/plugins/personal/connectivity/class_intranetAccount.inc
+++ /dev/null
@@ -1,257 +0,0 @@
-<?php
-
-
-
-/*!
- \author Harald Falk <hf@doellken-weimar.de>
- \version 1.00
- \date 1.07.2005
-
- \brief Enables Apache authentification for Intranet through openldap with .htaccess files
- */
-
-class intranetAccount extends plugin
-{
- /*! Definitions */
- var $plHeadline= "Intranet";
- /*! Definitions */
- var $plDescription= "This does something";
-
- /* attribute list for save action */
- var $attributes= array();
- /* ObjectClasses list for save action */
- var $objectclasses= array("gosaIntranetAccount");
- var $ReadOnly = false;
-
- var $uid ="";
-
- var $view_logged = FALSE;
- var $multiple_support = TRUE;
-
- /*! \brief Konstructor
-
- \param $config The Config Object used to initialise plugin
- \param $dn The DN of the currently edited entry
- \author Harald Falk <hf@doellken-weimar.de>
- \version 1.00
- \date 1.07.2005
- */
- function intranetAccount (&$config, $dn= NULL, $parent=NULL)
- {
- plugin::plugin ($config, $dn,$parent);
-
- /* Setting uid to default */
- if(isset($this->attrs['uid'][0])){
- $this->uid = $this->attrs['uid'][0];
- }
- }
-
- /*!
- \brief General execution
- \author Harald Falk <hf@doellken-weimar.de>
- \version 1.00
- \date 1.07.2005
-
- Load smarty Template and assign needed smarty vars
- */
-
-
- function execute()
- {
- /* Call parent execute */
- // plugin::execute();
-
- /* Log view */
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","users/".get_class($this),$this->dn);
- }
-
- $display= "";
-
- $smarty= get_smarty();
-
- if ($this->is_account){
- $smarty->assign("intranetState", "checked");
- $smarty->assign("wstate", "");
- } else {
- $smarty->assign("wstate", "disabled");
- $smarty->assign("intranetState", "");
- }
-
- //! Ever assign vars to smarty in both cases, to avoid php errors (missing variable aso. )
- if ($this->parent !== NULL){
- $smarty->assign("tabbed", 1);
- }else{
- $smarty->assign("tabbed", 0);
- }
-
- $smarty->assign('gosaIntranetACL', $this->getacl("",$this->ReadOnly));
- $smarty->assign("use_intranet",in_array("intranet",$this->multi_boxes));
- $smarty->assign("multiple_support",$this->multiple_support_active);
- $display.= $smarty->fetch (get_template_path('intranet.tpl', TRUE, dirname(__FILE__)));
- return ($display);
- }
-
- /*!
- \brief Delete ext from User
- \author Harald Falk <hf@doellken-weimar.de>
- \version 1.00
- \date 1.07.2005
- Handles deletion of this object
- */
- function remove_from_parent()
- {
- if($this->acl_is_removeable() && $this->initially_was_account){
- plugin::remove_from_parent();
- $ldap= $this->config->get_ldap_link();
-
- $ldap->cd($this->dn);
- @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
- $this->attributes, "Save");
- $this->cleanup();
- $ldap->modify ($this->attrs);
-
- /* Log last action */
- new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
- show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/intranet account with dn '%s' failed."),$this->dn));
-
- /* Optionally execute a command after we're done */
- $this->postremove(array("uid"=>$this->uid));
- }
- }
-
-
- /*!
- \brief handles Post data
- \author Harald Falk <hf@doellken-weimar.de>
- \version 1.00
- \date 1.07.2005
- Save data to object
- */
- function save_object()
- {
- /* Do we need to flip is_account state? */
- if (isset($_POST['connectivityTab'])){
- if (isset($_POST['intranet'])){
- if (!$this->is_account && $_POST['intranet'] == "B"){
- if($this->acl_is_createable()){
- $this->is_account= TRUE;
- }
- }
- } else {
- if($this->acl_is_removeable()){
- $this->is_account= FALSE;
- }
- }
- }
-
- plugin::save_object();
- if (isset($_POST["INTRANETStatus"])){
- $this->INTRANETStatus = "disabled";
- } else {
- $this->INTRANETStatus = "enabled";
- }
- }
-
-
- /*! \brief Handles LDAP saves
- \author Harald Falk <hf@doellken-weimar.de>
- \version 1.00
- \date 1.07.2005
- Save objectClass for User in LDAP
-
- */
- function save()
- {
- plugin::save();
-
- /* Write back to ldap */
- $ldap= $this->config->get_ldap_link();
- $ldap->cd($this->dn);
- $this->cleanup();
- $ldap->modify ($this->attrs);
-
- /* Log last action */
- if($this->initially_was_account){
- new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- }else{
- new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- }
-
- show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/intranet account with dn '%s' failed."),$this->dn));
-
- /* Optionally execute a command after we're done */
- $this->postcreate(array("uid" => $this->uid));
- }
-
-
- /* Return plugin informations for acl handling */
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Intranet"),
- "plDepends" => array("user"),
- "plPriority" => 25, // Position in tabs
- "plSection" => array("personal" => _("My account")),
- "plCategory" => array("users"),
- "plOptions" => array(),
-
- "plDescription" => _("Intranet account settings")." : <u>"._("Connectivity addon")."</u>",
- "plSelfModify" => TRUE,
-
- "plProvidedAcls" => array()
- ));
- }
-
-
- function multiple_save_object()
- {
- if (isset($_POST['connectivityTab'])){
- plugin::multiple_save_object();
- if(isset($_POST['use_intranet'])){
- $this->multi_boxes[] = "intranet";
- if (isset($_POST['intranet'])){
- if (!$this->is_account && $_POST['intranet'] == "B"){
- if($this->acl_is_createable()){
- $this->is_account= TRUE;
- }
- }
- } else {
- if($this->acl_is_removeable()){
- $this->is_account= FALSE;
- }
- }
- }
- }
- }
-
- function get_multi_edit_values()
- {
- $ret = plugin::get_multi_edit_values();
- if(in_array("intranet",$this->multi_boxes)){
- $ret['is_account'] = $this->is_account;
- }
- return($ret);
- }
-
- function set_multi_edit_values($values)
- {
- plugin::set_multi_edit_values($values);
- if(isset($values['is_account'])){
- $this->is_account = $values['is_account'];
- }
- }
-
- function init_multiple_support($attrs,$all)
- {
- plugin::init_multiple_support($attrs,$all);
- if(isset($attrs['objectClass']) && in_array("gosaIntranetAccount",$attrs['objectClass'])){
- $this->is_account = TRUE;
- }
- }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/personal/connectivity/intranet.tpl b/gosa-core/plugins/personal/connectivity/intranet.tpl
+++ /dev/null
@@ -1,6 +0,0 @@
-<h2>
- {render acl=$gosaIntranetACL checkbox=$multiple_support checked=$use_intranet}
- <input type="checkbox" name="intranet" value="B" {$intranetState} class="center">
- {t}Intranet account{/t}
- {/render}
-</h2>
diff --git a/gosa-core/plugins/personal/connectivity/main.inc b/gosa-core/plugins/personal/connectivity/main.inc
+++ /dev/null
@@ -1,125 +0,0 @@
-<?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);
- session::un_set ('edit');
- session::un_set ('connectivity');
- }
-
- /* Create connectivity object on demand */
- if (!session::is_set('connectivity') || (isset($_GET['reset']) &&
- $_GET['reset'] == 1)){
- $connectivity= new connectivity ($config, $ui->dn);
- $connectivity->enable_CSN_check();
- $connectivity->set_acl_base($ui->dn);
- $connectivity->set_acl_category("users");
-
- /* Adjust acl's to mode */
- foreach ($connectivity->plugin_name as $name){
- $connectivity->plugin[$name]->set_acl_category( "users");
- $connectivity->plugin[$name]->set_acl_base($ui->dn);
- }
- session::set('connectivity',$connectivity);
- }
- $connectivity = session::get('connectivity');
-
- /* save changes back to object */
- if (session::is_set('edit')){
- $connectivity->save_object ();
- }
-
- /* Enter edit mode? */
- if (isset($_POST['edit'])){
-
- /* Check locking */
- if ((($username= get_lock($ui->dn)) != "") && (!session::is_set('edit'))){
- session::set('back_plugin',$plug);
- gen_locked_message ($username, $ui->dn);
- exit ();
- }
-
-
- /* Lock the current entry */
- add_lock ($ui->dn, $ui->dn);
- session::set('dn',$ui->dn);
- session::set('edit',TRUE);
- }
-
- /* save changes to LDAP and disable edit mode */
- if (isset($_POST['edit_finish'])){
-
- /* Perform checks */
- $message= $connectivity->check ();
-
- /* No errors, save object */
- if (count ($message) == 0){
- $connectivity->save ();
- del_lock ($ui->dn);
- session::un_set ('edit');
-
- /* Remove from session */
- session::un_set ('connectivity');
- } else {
- /* Errors found, show message */
- show_errors ($message);
- }
- }
-
- /* Execute formular */
- $display= $connectivity->execute ();
-
- /* Store changes in session */
- if (session::is_set('edit')){
- session::set('connectivity',$connectivity);
- }
-
- $info= "";
-
- $display.="<div align='right'>";
- if (session::is_set('edit')){
- $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
- $display.= " ";
- $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
- $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
- "\"> ".$ui->dn." ";
- } else {
- $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
- "\"> ".$ui->dn." ";
-
- $info.= "<img class=\"center\" 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.="</div>";
-
- /* Page header*/
- $display= print_header(get_template_path('images/proxy.png'),
- _("Connectivity"), $info).$display;
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/connectivity/personal/connectivity/class_connectivity.inc b/gosa-plugins/connectivity/personal/connectivity/class_connectivity.inc
--- /dev/null
@@ -0,0 +1,264 @@
+<?php
+/*! \brief connectivity plugin
+ \author Cajus Pollmeier <pollmeier@gonicus.de>
+ \version 2.30
+ \date 29.03.2005
+
+ This class provides the functionality to read and write all attributes
+ relevant for connectivity settings from/to the LDAP. It does syntax checking
+ and displays the formulars required.
+ */
+
+class connectivity extends plugin
+{
+ /* Definitions */
+ var $plHeadline= "Connectivity";
+ var $plDescription= "This does something";
+
+ /* attribute list for save action */
+ var $attributes= array();
+ var $objectclasses= array();
+
+ var $ignore_account= TRUE;
+ var $plugin= array();
+ var $plugin_name= array();
+ var $CopyPasteVars = array("plugin","plugin_name");
+
+ var $multiple_support = TRUE;
+
+ function connectivity (&$config, $dn= NULL,$parent =NULL)
+ {
+ /* Preseed permissions */
+ $this->dn= $dn;
+ $ui= get_userinfo();
+
+ $this->config = $config;
+
+ /* Load accounts */
+ foreach ($config->data['TABS']['CONNECTIVITY'] as $plug){
+ if (!plugin_available($plug['CLASS'])) {
+ continue;
+ }
+ $name= $plug['CLASS'];
+ $this->plugin_name[]= $name;
+ $this->plugin[$name]= new $name($config, $dn,$parent);
+
+ /* Acl base && category configuration,
+ these settings will be overloaded in main.inc,
+ if we are editing ourself */
+ $this->plugin[$name]-> set_acl_category("users");
+ $this->plugin[$name]-> set_acl_base($this->dn);
+ }
+ }
+
+ function execute()
+ {
+ /* Call parent execute */
+ plugin::execute();
+
+ $display= "";
+
+ /* Prepare templating */
+ $smarty= get_smarty();
+
+ /* Do we represent a valid account? */
+ if ($this->parent === NULL){
+ $enabled= true;
+ foreach ($this->plugin_name as $name){
+ if ($this->plugin[$name]->is_account){
+ $enabled= true;
+ break;
+ }
+ }
+ if (!$enabled){
+ $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
+ _("This account has no connectivity extensions.")."</b>";
+ $display.= back_to_main();
+ return ($display);
+ }
+ }
+
+ /* Remove checkboxes in single edit mode */
+ if ($this->parent !== NULL){
+ foreach ($this->plugin_name as $name){
+ $this->plugin[$name]->parent= $this->parent;
+ }
+ }
+
+ /* Execude objects */
+ $is_first= true;
+
+ $ReadOnly = (!isset($this->parent) || !$this->parent) && !session::is_set('edit');
+
+ foreach ($this->plugin_name as $name){
+ $this->plugin[$name]->ReadOnly = $ReadOnly;
+ if (!$is_first){
+ $display.= '<p class="seperator"> </p>';
+ } else {
+ $is_first= false;
+ }
+ $display.= $this->plugin[$name]->execute();
+ }
+
+ /* Mark me as connectivity tab */
+ $display.= "<input type='hidden' name='connectivityTab'>";
+ return($display);
+ }
+
+
+ /* Save data to object */
+ function save_object()
+ {
+ if (isset($_POST['connectivityTab'])){
+ foreach ($this->plugin_name as $name){
+ $this->plugin[$name]->save_object();
+ }
+ }
+ }
+
+ function check()
+ {
+ $message= plugin::check();
+
+ foreach ($this->plugin_name as $name){
+ $tmp= $this->plugin[$name]->check();
+
+ $message= array_merge($message, $tmp);
+ }
+
+ return ($message);
+ }
+
+ function set_acl_category($cat)
+ {
+ plugin::set_acl_category($cat);
+ foreach ($this->plugin_name as $name){
+ $this->plugin[$name]->set_acl_category( $cat);
+ }
+ }
+
+ function set_acl_base($base)
+ {
+ plugin::set_acl_base($base);
+ foreach ($this->plugin_name as $name){
+ $this->plugin[$name]->set_acl_base( $base);
+ }
+ }
+
+ /* Save to LDAP */
+ function save()
+ {
+ /* Save objects */
+ foreach ($this->plugin_name as $name){
+ $this->plugin[$name]->dn= $this->dn;
+
+ if ($this->plugin[$name]->is_account){
+ $this->plugin[$name]->save();
+ } else {
+ $this->plugin[$name]->remove_from_parent();
+ }
+ }
+ }
+
+ function remove_from_parent()
+ {
+ /* Remove objects */
+ foreach ($this->plugin_name as $name){
+ $this->plugin[$name]->dn= $this->dn;
+ $this->plugin[$name]->remove_from_parent();
+ }
+ }
+
+ function adapt_from_template($dn)
+ {
+ /* Adapt objects */
+ foreach ($this->plugin_name as $name){
+ $this->plugin[$name]->dn= $this->dn;
+ $this->plugin[$name]->adapt_from_template($dn);
+ }
+ }
+
+ /* Prepare the connectivity obj
+ */
+ function PrepareForCopyPaste($obj)
+ {
+ $tmp = $this->plugin;
+ plugin::PrepareForCopyPaste($obj);
+ $this->plugin = $tmp;
+ foreach( $this->plugin as $key => $plug){
+ $this->plugin[$key]->PrepareForCopyPaste($obj);
+ }
+ }
+
+
+ function enable_multiple_support()
+ {
+ plugin::enable_multiple_support();
+
+ foreach($this->plugin_name as $key => $name){
+ if($this->plugin[$name]->multiple_support){
+ $this->plugin[$name]->enable_multiple_support();
+ }else{
+ unset($this->plugin_name[$key]);
+ unset($this->plugin[$name]);
+ }
+ }
+ }
+
+
+ function multiple_execute()
+ {
+ return($this->execute());
+ }
+
+ /* Save data to object */
+ function multiple_save_object()
+ {
+ if (isset($_POST['connectivityTab'])){
+ foreach ($this->plugin_name as $name){
+ $this->plugin[$name]->multiple_save_object();
+ }
+ }
+ }
+
+ function multiple_check()
+ {
+ $message = plugin::multiple_check();
+ foreach ($this->plugin_name as $name){
+ $message = array_merge($message,$this->plugin[$name]->multiple_check());
+ }
+ return($message);
+ }
+
+ function get_multi_init_values()
+ {
+ $ret = array();
+ foreach($this->plugin as $name => $plugin){
+ $ret = array_merge($ret,$plugin->get_multi_init_values());
+ }
+ return($ret);
+ }
+
+ function init_multiple_support($attrs,$attr)
+ {
+ foreach($this->plugin as $name => $plugin){
+ $this->plugin[$name]->init_multiple_support($attrs,$attr);
+ }
+ }
+
+ function get_multi_edit_values()
+ {
+ $ret['plugin'] = &$this->plugin;
+ return($ret);
+ }
+
+ function set_multi_edit_values($values)
+ {
+ foreach($values['plugin'] as $name => $plugin){
+ $this->plugin[$name]->set_multi_edit_values($plugin->get_multi_edit_values());
+ }
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/connectivity/personal/connectivity/class_intranetAccount.inc b/gosa-plugins/connectivity/personal/connectivity/class_intranetAccount.inc
--- /dev/null
@@ -0,0 +1,257 @@
+<?php
+
+
+
+/*!
+ \author Harald Falk <hf@doellken-weimar.de>
+ \version 1.00
+ \date 1.07.2005
+
+ \brief Enables Apache authentification for Intranet through openldap with .htaccess files
+ */
+
+class intranetAccount extends plugin
+{
+ /*! Definitions */
+ var $plHeadline= "Intranet";
+ /*! Definitions */
+ var $plDescription= "This does something";
+
+ /* attribute list for save action */
+ var $attributes= array();
+ /* ObjectClasses list for save action */
+ var $objectclasses= array("gosaIntranetAccount");
+ var $ReadOnly = false;
+
+ var $uid ="";
+
+ var $view_logged = FALSE;
+ var $multiple_support = TRUE;
+
+ /*! \brief Konstructor
+
+ \param $config The Config Object used to initialise plugin
+ \param $dn The DN of the currently edited entry
+ \author Harald Falk <hf@doellken-weimar.de>
+ \version 1.00
+ \date 1.07.2005
+ */
+ function intranetAccount (&$config, $dn= NULL, $parent=NULL)
+ {
+ plugin::plugin ($config, $dn,$parent);
+
+ /* Setting uid to default */
+ if(isset($this->attrs['uid'][0])){
+ $this->uid = $this->attrs['uid'][0];
+ }
+ }
+
+ /*!
+ \brief General execution
+ \author Harald Falk <hf@doellken-weimar.de>
+ \version 1.00
+ \date 1.07.2005
+
+ Load smarty Template and assign needed smarty vars
+ */
+
+
+ function execute()
+ {
+ /* Call parent execute */
+ // plugin::execute();
+
+ /* Log view */
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","users/".get_class($this),$this->dn);
+ }
+
+ $display= "";
+
+ $smarty= get_smarty();
+
+ if ($this->is_account){
+ $smarty->assign("intranetState", "checked");
+ $smarty->assign("wstate", "");
+ } else {
+ $smarty->assign("wstate", "disabled");
+ $smarty->assign("intranetState", "");
+ }
+
+ //! Ever assign vars to smarty in both cases, to avoid php errors (missing variable aso. )
+ if ($this->parent !== NULL){
+ $smarty->assign("tabbed", 1);
+ }else{
+ $smarty->assign("tabbed", 0);
+ }
+
+ $smarty->assign('gosaIntranetACL', $this->getacl("",$this->ReadOnly));
+ $smarty->assign("use_intranet",in_array("intranet",$this->multi_boxes));
+ $smarty->assign("multiple_support",$this->multiple_support_active);
+ $display.= $smarty->fetch (get_template_path('intranet.tpl', TRUE, dirname(__FILE__)));
+ return ($display);
+ }
+
+ /*!
+ \brief Delete ext from User
+ \author Harald Falk <hf@doellken-weimar.de>
+ \version 1.00
+ \date 1.07.2005
+ Handles deletion of this object
+ */
+ function remove_from_parent()
+ {
+ if($this->acl_is_removeable() && $this->initially_was_account){
+ plugin::remove_from_parent();
+ $ldap= $this->config->get_ldap_link();
+
+ $ldap->cd($this->dn);
+ @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+ $this->attributes, "Save");
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
+
+ /* Log last action */
+ new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/intranet account with dn '%s' failed."),$this->dn));
+
+ /* Optionally execute a command after we're done */
+ $this->postremove(array("uid"=>$this->uid));
+ }
+ }
+
+
+ /*!
+ \brief handles Post data
+ \author Harald Falk <hf@doellken-weimar.de>
+ \version 1.00
+ \date 1.07.2005
+ Save data to object
+ */
+ function save_object()
+ {
+ /* Do we need to flip is_account state? */
+ if (isset($_POST['connectivityTab'])){
+ if (isset($_POST['intranet'])){
+ if (!$this->is_account && $_POST['intranet'] == "B"){
+ if($this->acl_is_createable()){
+ $this->is_account= TRUE;
+ }
+ }
+ } else {
+ if($this->acl_is_removeable()){
+ $this->is_account= FALSE;
+ }
+ }
+ }
+
+ plugin::save_object();
+ if (isset($_POST["INTRANETStatus"])){
+ $this->INTRANETStatus = "disabled";
+ } else {
+ $this->INTRANETStatus = "enabled";
+ }
+ }
+
+
+ /*! \brief Handles LDAP saves
+ \author Harald Falk <hf@doellken-weimar.de>
+ \version 1.00
+ \date 1.07.2005
+ Save objectClass for User in LDAP
+
+ */
+ function save()
+ {
+ plugin::save();
+
+ /* Write back to ldap */
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd($this->dn);
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
+
+ /* Log last action */
+ if($this->initially_was_account){
+ new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }else{
+ new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }
+
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/intranet account with dn '%s' failed."),$this->dn));
+
+ /* Optionally execute a command after we're done */
+ $this->postcreate(array("uid" => $this->uid));
+ }
+
+
+ /* Return plugin informations for acl handling */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Intranet"),
+ "plDepends" => array("user"),
+ "plPriority" => 25, // Position in tabs
+ "plSection" => array("personal" => _("My account")),
+ "plCategory" => array("users"),
+ "plOptions" => array(),
+
+ "plDescription" => _("Intranet account settings")." : <u>"._("Connectivity addon")."</u>",
+ "plSelfModify" => TRUE,
+
+ "plProvidedAcls" => array()
+ ));
+ }
+
+
+ function multiple_save_object()
+ {
+ if (isset($_POST['connectivityTab'])){
+ plugin::multiple_save_object();
+ if(isset($_POST['use_intranet'])){
+ $this->multi_boxes[] = "intranet";
+ if (isset($_POST['intranet'])){
+ if (!$this->is_account && $_POST['intranet'] == "B"){
+ if($this->acl_is_createable()){
+ $this->is_account= TRUE;
+ }
+ }
+ } else {
+ if($this->acl_is_removeable()){
+ $this->is_account= FALSE;
+ }
+ }
+ }
+ }
+ }
+
+ function get_multi_edit_values()
+ {
+ $ret = plugin::get_multi_edit_values();
+ if(in_array("intranet",$this->multi_boxes)){
+ $ret['is_account'] = $this->is_account;
+ }
+ return($ret);
+ }
+
+ function set_multi_edit_values($values)
+ {
+ plugin::set_multi_edit_values($values);
+ if(isset($values['is_account'])){
+ $this->is_account = $values['is_account'];
+ }
+ }
+
+ function init_multiple_support($attrs,$all)
+ {
+ plugin::init_multiple_support($attrs,$all);
+ if(isset($attrs['objectClass']) && in_array("gosaIntranetAccount",$attrs['objectClass'])){
+ $this->is_account = TRUE;
+ }
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/connectivity/personal/connectivity/intranet.tpl b/gosa-plugins/connectivity/personal/connectivity/intranet.tpl
--- /dev/null
@@ -0,0 +1,6 @@
+<h2>
+ {render acl=$gosaIntranetACL checkbox=$multiple_support checked=$use_intranet}
+ <input type="checkbox" name="intranet" value="B" {$intranetState} class="center">
+ {t}Intranet account{/t}
+ {/render}
+</h2>
diff --git a/gosa-plugins/connectivity/personal/connectivity/main.inc b/gosa-plugins/connectivity/personal/connectivity/main.inc
--- /dev/null
@@ -0,0 +1,125 @@
+<?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);
+ session::un_set ('edit');
+ session::un_set ('connectivity');
+ }
+
+ /* Create connectivity object on demand */
+ if (!session::is_set('connectivity') || (isset($_GET['reset']) &&
+ $_GET['reset'] == 1)){
+ $connectivity= new connectivity ($config, $ui->dn);
+ $connectivity->enable_CSN_check();
+ $connectivity->set_acl_base($ui->dn);
+ $connectivity->set_acl_category("users");
+
+ /* Adjust acl's to mode */
+ foreach ($connectivity->plugin_name as $name){
+ $connectivity->plugin[$name]->set_acl_category( "users");
+ $connectivity->plugin[$name]->set_acl_base($ui->dn);
+ }
+ session::set('connectivity',$connectivity);
+ }
+ $connectivity = session::get('connectivity');
+
+ /* save changes back to object */
+ if (session::is_set('edit')){
+ $connectivity->save_object ();
+ }
+
+ /* Enter edit mode? */
+ if (isset($_POST['edit'])){
+
+ /* Check locking */
+ if ((($username= get_lock($ui->dn)) != "") && (!session::is_set('edit'))){
+ session::set('back_plugin',$plug);
+ gen_locked_message ($username, $ui->dn);
+ exit ();
+ }
+
+
+ /* Lock the current entry */
+ add_lock ($ui->dn, $ui->dn);
+ session::set('dn',$ui->dn);
+ session::set('edit',TRUE);
+ }
+
+ /* save changes to LDAP and disable edit mode */
+ if (isset($_POST['edit_finish'])){
+
+ /* Perform checks */
+ $message= $connectivity->check ();
+
+ /* No errors, save object */
+ if (count ($message) == 0){
+ $connectivity->save ();
+ del_lock ($ui->dn);
+ session::un_set ('edit');
+
+ /* Remove from session */
+ session::un_set ('connectivity');
+ } else {
+ /* Errors found, show message */
+ show_errors ($message);
+ }
+ }
+
+ /* Execute formular */
+ $display= $connectivity->execute ();
+
+ /* Store changes in session */
+ if (session::is_set('edit')){
+ session::set('connectivity',$connectivity);
+ }
+
+ $info= "";
+
+ $display.="<div align='right'>";
+ if (session::is_set('edit')){
+ $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+ $display.= " ";
+ $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+ $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+ "\"> ".$ui->dn." ";
+ } else {
+ $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+ "\"> ".$ui->dn." ";
+
+ $info.= "<img class=\"center\" 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.="</div>";
+
+ /* Page header*/
+ $display= print_header(get_template_path('images/proxy.png'),
+ _("Connectivity"), $info).$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>