From: cajus Date: Thu, 17 Jan 2008 14:37:40 +0000 (+0000) Subject: Moved connectivity stuff X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d01be48f2e391578e84cabc1caf1e4c989f89d8a;p=gosa.git Moved connectivity stuff git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8465 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/personal/connectivity/class_connectivity.inc b/gosa-core/plugins/personal/connectivity/class_connectivity.inc deleted file mode 100644 index a27690471..000000000 --- a/gosa-core/plugins/personal/connectivity/class_connectivity.inc +++ /dev/null @@ -1,264 +0,0 @@ - - \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= "\"\" ". - _("This account has no connectivity extensions.").""; - $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.= '

 

'; - } else { - $is_first= false; - } - $display.= $this->plugin[$name]->execute(); - } - - /* Mark me as connectivity tab */ - $display.= ""; - 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 deleted file mode 100644 index e1c9ffca9..000000000 --- a/gosa-core/plugins/personal/connectivity/class_intranetAccount.inc +++ /dev/null @@ -1,257 +0,0 @@ - - \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 - \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 - \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 - \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 - \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 - \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")." : "._("Connectivity addon")."", - "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 deleted file mode 100644 index 303c0fbca..000000000 --- a/gosa-core/plugins/personal/connectivity/intranet.tpl +++ /dev/null @@ -1,6 +0,0 @@ -

- {render acl=$gosaIntranetACL checkbox=$multiple_support checked=$use_intranet} - - {t}Intranet account{/t} - {/render} -

diff --git a/gosa-core/plugins/personal/connectivity/main.inc b/gosa-core/plugins/personal/connectivity/main.inc deleted file mode 100644 index 76c0de2cf..000000000 --- a/gosa-core/plugins/personal/connectivity/main.inc +++ /dev/null @@ -1,125 +0,0 @@ -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.="
"; - if (session::is_set('edit')){ - $display.= "\n"; - $display.= " "; - $display.= "\n"; - $info= "\"\" ".$ui->dn." "; - } else { - $info= "\"\" ".$ui->dn." "; - - $info.= "\"\""._("Click the 'Edit' button below to change informations in this dialog"); - $display.= "\n"; - $display.= "\n"; - } - $display.="
"; - - /* 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 new file mode 100644 index 000000000..a27690471 --- /dev/null +++ b/gosa-plugins/connectivity/personal/connectivity/class_connectivity.inc @@ -0,0 +1,264 @@ + + \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= "\"\" ". + _("This account has no connectivity extensions.").""; + $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.= '

 

'; + } else { + $is_first= false; + } + $display.= $this->plugin[$name]->execute(); + } + + /* Mark me as connectivity tab */ + $display.= ""; + 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 new file mode 100644 index 000000000..e1c9ffca9 --- /dev/null +++ b/gosa-plugins/connectivity/personal/connectivity/class_intranetAccount.inc @@ -0,0 +1,257 @@ + + \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 + \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 + \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 + \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 + \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 + \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")." : "._("Connectivity addon")."", + "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 new file mode 100644 index 000000000..303c0fbca --- /dev/null +++ b/gosa-plugins/connectivity/personal/connectivity/intranet.tpl @@ -0,0 +1,6 @@ +

+ {render acl=$gosaIntranetACL checkbox=$multiple_support checked=$use_intranet} + + {t}Intranet account{/t} + {/render} +

diff --git a/gosa-plugins/connectivity/personal/connectivity/main.inc b/gosa-plugins/connectivity/personal/connectivity/main.inc new file mode 100644 index 000000000..76c0de2cf --- /dev/null +++ b/gosa-plugins/connectivity/personal/connectivity/main.inc @@ -0,0 +1,125 @@ +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.="
"; + if (session::is_set('edit')){ + $display.= "\n"; + $display.= " "; + $display.= "\n"; + $info= "\"\" ".$ui->dn." "; + } else { + $info= "\"\" ".$ui->dn." "; + + $info.= "\"\""._("Click the 'Edit' button below to change informations in this dialog"); + $display.= "\n"; + $display.= "\n"; + } + $display.="
"; + + /* Page header*/ + $display= print_header(get_template_path('images/proxy.png'), + _("Connectivity"), $info).$display; + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?>