Author: ralfbecker
New Revision: 55679
URL: http://svn.stylite.de/viewvc/egroupware?rev=55679&view=rev
Log:
move egw_framework to api and refactor it
Added:
trunk/egroupware/api/src/Framework.php
- copied, changed from r55670, trunk/phpgwapi/inc/class.egw_framework.inc.php
trunk/egroupware/api/src/Framework/Bundle.php
- copied, changed from r55670, trunk/phpgwapi/inc/class.egw_framework.inc.php
trunk/egroupware/api/src/Framework/CssIncludes.php
- copied, changed from r55670, trunk/phpgwapi/inc/class.egw_framework.inc.php
trunk/egroupware/api/src/Framework/Extra.php
- copied, changed from r55670, trunk/phpgwapi/inc/class.egw_framework.inc.php
trunk/egroupware/api/src/Framework/Favorites.php
- copied, changed from r55670, trunk/phpgwapi/inc/class.egw_favorites.inc.php
trunk/egroupware/api/src/Framework/Login.php
- copied, changed from r55670, trunk/phpgwapi/inc/class.egw_framework.inc.php
trunk/egroupware/api/src/Framework/Updates.php
- copied, changed from r55670, trunk/phpgwapi/inc/class.egw_framework.inc.php
Modified:
trunk/egroupware/api/js/etemplate/test/test.php
trunk/egroupware/api/src/Accounts.php
trunk/egroupware/api/src/CalDAV/Hooks.php
trunk/egroupware/api/src/Categories.php
trunk/egroupware/api/src/Etemplate.php
trunk/egroupware/api/src/Etemplate/Request.php
trunk/egroupware/api/src/Etemplate/Widget/Nextmatch.php
trunk/egroupware/api/src/Etemplate/Widget/Template.php
trunk/egroupware/api/src/Etemplate/Widget/Tree.php
trunk/egroupware/api/src/Etemplate/Widget/Vfs.php
trunk/egroupware/api/src/Etemplate/WidgetBrowser.php
trunk/egroupware/api/src/Framework/IncludeMgr.php
trunk/egroupware/api/src/Html.php
trunk/egroupware/api/src/Json/Request.php
trunk/egroupware/api/src/Storage/Merge.php
trunk/egroupware/api/src/Vfs/Sharing.php
trunk/egroupware/doc/fix_api.php
trunk/egroupware/updateGruntfile.php
trunk/jdots/inc/class.jdots_framework.inc.php
trunk/phpgwapi/inc/class.egw.inc.php
trunk/phpgwapi/inc/class.egw_favorites.inc.php
trunk/phpgwapi/inc/class.egw_framework.inc.php
trunk/pixelegg/inc/class.pixelegg_framework.inc.php
— trunk/egroupware/api/js/etemplate/test/test.php (original)
+++ trunk/egroupware/api/js/etemplate/test/test.php Thu Apr 7 22:42:06 2016
@@ -14,22 +14,23 @@
);
include(’…/…/…/header.inc.php’);
- egw_framework::validate_file(’.’,‘etemplate2’,‘etemplate’);
- egw_framework::validate_file(‘jquery’,‘jquery.tools.min’,‘phpgwapi’); // Not needed once JS require works for files like this
- egw_framework::validate_file(‘jquery’,‘jquery.html5_upload’,‘phpgwapi’); // Not needed once JS require works for files like this
- egw_framework::includeCSS(’/etemplate/js/test/test.css’);
+use EGroupware\Api;
+Api\Framework::includeJS(’.’,‘etemplate2’,‘etemplate’);
+Api\Framework::includeJS(‘jquery’,‘jquery.tools.min’,‘phpgwapi’); // Not needed once JS require works for files like this
+Api\Framework::includeJS(‘jquery’,‘jquery.html5_upload’,‘phpgwapi’); // Not needed once JS require works for files like this
+Api\Framework::includeCSS(’/api/js/etemplate/test/test.css’);
/*
- Test using any actual template
*/
$template = ‘etemplate.et2_test_file_upload’;
if($template) {
- common::egw_header();
-// parse_navbar();
- echo $GLOBALS[‘egw’]->framework->header();
?>
@@ -58,6 +59,4 @@
}
<?php
-common::egw_footer();
-?>
+echo $GLOBALS[‘egw’]->framework->footer();
— trunk/egroupware/api/src/Accounts.php (original)
+++ trunk/egroupware/api/src/Accounts.php Thu Apr 7 22:42:06 2016
@@ -19,7 +19,7 @@
namespace EGroupware\Api;
// explicitly reference classes still in phpgwapi of old structure
-use egw;
+use egw; // invalidate_session_cache
/**
— trunk/egroupware/api/src/CalDAV/Hooks.php (original)
+++ trunk/egroupware/api/src/CalDAV/Hooks.php Thu Apr 7 22:42:06 2016
@@ -14,9 +14,6 @@
namespace EGroupware\Api\CalDAV;
use EGroupware\Api;
-// explicit import old non-namespaced api classes
-use egw; // link
/**
- GroupDAV hooks: eg. preferences
@@ -40,7 +37,7 @@
if ($location == ‘preferences’)
{
$file = array(
@@ -121,7 +118,7 @@
}
}
}
-
$link = Api\Framework::link('/index.php',array(
'menuaction' => 'api.'.__CLASS__.'.log',
'filename' => '',
));
— trunk/egroupware/api/src/Categories.php (original)
+++ trunk/egroupware/api/src/Categories.php Thu Apr 7 22:42:06 2016
@@ -18,8 +18,6 @@
*/
namespace EGroupware\Api;
-use egw_framework; // includeCSS
/**
- class to manage categories in eGroupWare
@@ -1040,7 +1038,7 @@
$last_mod = $cats->return_array(‘all’,0,1,’’,‘DESC’,‘last_mod’, $appname == self::GLOBAL_APPNAME);
$time = count($last_mod) ? $last_mod[0][‘last_mod’] : time();
$path = ‘/api/categories.php?app=’.$appname.’&’.$time;
— trunk/egroupware/api/src/Etemplate.php (original)
+++ trunk/egroupware/api/src/Etemplate.php Thu Apr 7 22:42:06 2016
@@ -13,10 +13,6 @@
namespace EGroupware\Api;
-// explicitly import old not yet ported classes
-use egw;
-use egw_framework;
/**
- New eTemplate serverside contains:
-
- main server methods like read, exec
@@ -71,7 +67,7 @@
*/
static function location($params=’’)
{
@@ -138,7 +134,7 @@
unset($hook_data);
// Include the etemplate2 javascript code
@@ -210,25 +206,25 @@
if (self::$response) // call is within an ajax event / form submit
{
//error_log("Ajax " . LINE);
-
self::$response->generic('et2_load', $load_array+egw_framework::get_extra());
-
egw_framework::clear_extra(); // to not send/set it twice for multiple etemplates (eg. CRM view)
-
self::$response->generic('et2_load', $load_array+Framework::get_extra());
-
Framework::clear_extra(); // to not send/set it twice for multiple etemplates (eg. CRM view)
}
else // first call
{
// missing dependency, thought egw:uses jquery.jquery.tools does NOT work, maybe we should rename it to jquery-tools
@@ -252,8 +248,8 @@
$content .= “\n”.$vars[‘page_generation_time’];
}
$GLOBALS[‘egw’]->framework->response->generic(“data”, array($content));
-
$GLOBALS['egw']->framework->response->generic('et2_load',$load_array+egw_framework::get_extra());
-
egw_framework::clear_extra(); // to not send/set it twice for multiple etemplates (eg. CRM view)
-
$GLOBALS['egw']->framework->response->generic('et2_load',$load_array+Framework::get_extra());
-
Framework::clear_extra(); // to not send/set it twice for multiple etemplates (eg. CRM view)
self::$request = null;
return;
}
— trunk/egroupware/api/src/Etemplate/Request.php (original)
+++ trunk/egroupware/api/src/Etemplate/Request.php Thu Apr 7 22:42:06 2016
@@ -14,9 +14,6 @@
namespace EGroupware\Api\Etemplate;
use EGroupware\Api;
-// explicitly import old not yet ported classes
-use egw_framework;
/**
- Class to represent the persitent information of an eTemplate request
@@ -212,7 +209,7 @@
}
else
{
— trunk/egroupware/api/src/Etemplate/Widget/Nextmatch.php (original)
+++ trunk/egroupware/api/src/Etemplate/Widget/Nextmatch.php Thu Apr 7 22:42:06 2016
@@ -15,10 +15,6 @@
use EGroupware\Api\Etemplate;
use EGroupware\Api;
-// explicitly import old not yet ported classes
-use egw;
-use egw_framework; // includeCSS
/**
-
eTemplate serverside implementation of the nextmatch widget
@@ -95,7 +91,7 @@
parent::__construct($xml);
// TODO: probably a better way to do this
@@ -863,7 +859,7 @@
// link or popup action
if ($action[‘url’])
{
-
$action['url'] = Api\Framework::link('/index.php',str_replace('$action',$id,$action['url']));
if ($action['popup'])
{
list($action['data']['width'],$action['data']['height']) = explode('x',$action['popup']);
— trunk/egroupware/api/src/Etemplate/Widget/Template.php (original)
+++ trunk/egroupware/api/src/Etemplate/Widget/Template.php Thu Apr 7 22:42:06 2016
@@ -17,9 +17,6 @@
use EGroupware\Api;
use XMLReader;
-// explicitly import old not yet ported classes
-use egw; // link
/* allow to call direct for tests (see end of class)
if (!isset($GLOBALS[‘egw_info’]))
{
@@ -211,7 +208,7 @@
{
$url = Api\Vfs::download_url($path);
— trunk/egroupware/api/src/Etemplate/Widget/Tree.php (original)
+++ trunk/egroupware/api/src/Etemplate/Widget/Tree.php Thu Apr 7 22:42:06 2016
@@ -16,10 +16,7 @@
use EGroupware\Api\Etemplate;
use EGroupware\Api;
-// explicitly import old not yet ported classes
-use egw_framework;
-egw_framework::includeCSS(’/api/js/dhtmlxtree/codebase/dhtmlXTree.css’);
+Api\Framework::includeCSS(’/api/js/dhtmlxtree/codebase/dhtmlXTree.css’);
/**
— trunk/egroupware/api/src/Etemplate/Widget/Vfs.php (original)
+++ trunk/egroupware/api/src/Etemplate/Widget/Vfs.php Thu Apr 7 22:42:06 2016
@@ -15,9 +15,6 @@
use EGroupware\Api\Etemplate;
use EGroupware\Api;
-// explicitly import old not yet ported classes
-use egw; // link
/**
- eTemplate VFS widget
@@ -165,7 +162,7 @@
$file = array(
“uploaded” => (int)empty($error),
“fileName” => Api\Html::htmlspecialchars($_FILES[‘upload’][‘name’]),
— trunk/egroupware/api/src/Etemplate/WidgetBrowser.php (original)
+++ trunk/egroupware/api/src/Etemplate/WidgetBrowser.php Thu Apr 7 22:42:06 2016
@@ -14,9 +14,6 @@
namespace EGroupware\Api\Etemplate;
use EGroupware\Api;
-// explicitly list not yet ported api classes
-use egw_framework;
/**
— trunk/phpgwapi/inc/class.egw_framework.inc.php (original)
+++ trunk/egroupware/api/src/Framework.php Thu Apr 7 22:42:06 2016
@@ -12,13 +12,16 @@
-use EGroupware\Api;
+namespace EGroupware\Api;
+
+// import not yet ported non-namespaced classes
+use jdots_framework;
/**
-
- eGW API - framework: virtual base class for all template sets
-
- Framework: virtual base class for all template sets
-
- This class creates / renders the eGW framework:
-
- a) Html header
- b) navbar
- c) sidebox menu
- d) main application area
@@ -38,7 +41,7 @@
- Copyright © 2000, 2001 Dan Kuykendall
- Copyright © 2003 Lars Kneschke
/
-abstract class egw_framework
+abstract class Framework extends Framework\Extra
{
/*
- Name of the template set, eg. ‘idots’
@@ -78,8 +81,6 @@
- Constructor
-
- The constructor instanciates the class in $GLOBALS[‘egw’]->framework, from where it should be used
-
// default to idots, if no template_set set, to eg. not stall installations if settings use self::link
if (empty($GLOBALS['egw_info']['server']['template_set'])) $GLOBALS['egw_info']['server']['template_set'] = 'idots';
// setup the new eGW framework (template sets)
$class = $GLOBALS['egw_info']['server']['template_set'].'_framework';
@@ -130,71 +131,17 @@
}
/**
-
- Set/get Content-Security-Policy attributes for script-src: ‘unsafe-eval’ and/or ‘unsafe-inline’
-
-
- Using CK-Editor currently requires both to be set
-
-
- Old pre-et2 apps might need to call egw_framework::csp_script_src_attrs(array(‘unsafe-eval’,‘unsafe-inline’))
-
-
- EGroupware itself currently still requires ‘unsafe-eval’!
-
-
-
@param string|array $set =null ‘unsafe-eval’ and/or ‘unsafe-inline’ (without quotes!) or URL (incl. protocol!)
-
-
@deprecated use Api\Header\ContentSecurityPolicy::add(‘script-src’, $set);
- */
- public static function csp_script_src_attrs($set=null)
- {
-
Api\Header\ContentSecurityPolicy::add('script-src', $set);
- }
-
- /**
-
- Set/get Content-Security-Policy attributes for style-src: ‘unsafe-inline’
-
-
- EGroupware itself currently still requires ‘unsafe-inline’!
-
-
-
@param string|array $set =null ‘unsafe-inline’ (without quotes!) and/or URL (incl. protocol!)
-
-
@deprecated use Api\Header\ContentSecurityPolicy::add(‘style-src’, $set);
- */
- public static function csp_style_src_attrs($set=null)
- {
-
Api\Header\ContentSecurityPolicy::add('style-src', $set);
- }
-
- /**
-
- Set/get Content-Security-Policy attributes for connect-src:
-
-
-
@param string|array $set =array() URL (incl. protocol!)
-
-
@deprecated use Api\Header\ContentSecurityPolicy::add(‘connect-src’, $set);
- */
- public static function csp_connect_src_attrs($set=null)
- {
-
Api\Header\ContentSecurityPolicy::add('connect-src', $set);
- }
-
- /**
-
- Set/get Content-Security-Policy attributes for frame-src:
-
-
- Calling this method with an empty array sets no frame-src, but “‘self’”!
-
-
-
@param string|array $set =null URL (incl. protocol!)
-
-
@deprecated use Api\Header\ContentSecurityPolicy::add(‘frame-src’, $set);
- */
- public static function csp_frame_src_attrs($set=null)
- {
-
Api\Header\ContentSecurityPolicy::add('frame-src', $set);
- }
-
- /**
- Send HTTP headers: Content-Type and Content-Security-Policy
*/
public function send_headers()
{
// add a content-type header to overwrite an existing default charset in apache (AddDefaultCharset directiv)
-
header('Content-type: text/html; charset='.translation::charset());
-
-
Api\Header\ContentSecurityPolicy::send();
@@ -203,8 +150,8 @@
*/
public static function init_static()
{
-
self::$js_include_mgr = new Api\Framework\IncludeMgr(array(
-
// We need LABjs, but putting it through Api\Framework\IncludeMgr causes it to re-load itself
-
self::$js_include_mgr = new Framework\IncludeMgr(array(
-
// We need LABjs, but putting it through Framework\IncludeMgr causes it to re-load itself
//'/api/js/labjs/LAB.src.js',
// allways load jquery (not -ui) first
@@ -216,18 +163,6 @@
}
/**
-
- Handles redirects under iis and apache, it does NOT return (calls exit)
-
-
- This function handles redirects under iis and apache it assumes that $phpgw->link() has already been called
-
-
-
@param string $url url to redirect to
-
-
@param string $link_app =null appname to redirect for, default currentapp
- */
- static function redirect($url, $link_app=null)
- {
-
// Determines whether the current output buffer should be flushed
-
$do_flush = true;
-
-
if (Json\Response::isJSONResponse() || Json\Request::isJSONRequest())
-
{
-
Json\Response::get()->redirect($url, false, $link_app);
-
-
// If we are in a json request, we should not flush the current output!
-
$do_flush = false;
-
}
-
else
-
{
-
$file = $line = null;
-
if (headers_sent($file,$line))
-
{
-
throw new Exception\AssertionFailed(__METHOD__."('".htmlspecialchars($url)."') can NOT redirect, output already started at $file line $line!");
-
}
-
if ($GLOBALS['egw']->framework instanceof jdots_framework && !empty($link_app))
-
{
-
self::set_extra('egw', 'redirect', array($url, $link_app));
-
$GLOBALS['egw']->framework->render('');
-
}
-
else
-
{
-
Header("Location: $url");
-
print("\n\n");
-
}
-
}
-
-
if ($do_flush)
-
{
-
@ob_flush(); flush();
-
}
-
-
// commit session (if existing), to fix timing problems sometimes preventing session creation ("Your session can not be verified")
-
if (isset($GLOBALS['egw']->session)) $GLOBALS['egw']->session->commit_session();
-
-
exit;
- }
-
- /**
- Redirects direct to a generated link
-
-
@param string $url The url the link is for
@@ -251,7 +236,7 @@
*/
static function redirect_link($url, $extravars=’’, $link_app=null)
{
-
self::redirect(self::link($url, $extravars), $link_app);
}
/**
@@ -259,7 +244,7 @@
*
- This is the (new) prefered way to render a page in eGW!
-
-
-
@param string $content html of the main application area
-
-
@param string $content Html of the main application area
-
@param string $app_header =null application header, default what’s set in $GLOBALS[‘egw_info’][‘flags’][‘app_header’]
-
@param string $navbar =null show the navigation, default !$GLOBALS[‘egw_info’][‘flags’][‘nonavbar’], false gives a typical popu
-
@@ -281,179 +266,19 @@
}
/**
-
- Extra values send as data attributes to script tag of egw.js
-
-
- */
- protected static $extra = array();
-
- /**
-
- Refresh given application $targetapp display of entry $app $id, incl. outputting $msg
-
-
- Calling egw_refresh and egw_message on opener in a content security save way
-
-
- To provide more information about necessary refresh an automatic 9th parameter is added
-
- containing an object with application-name as attributes containing an array of linked ids
-
- (adding happens in get_extras to give apps time to link new entries!).
-
-
-
@param string $msg message (already translated) to show, eg. ‘Entry deleted’
-
-
@param string $app application name
-
-
@param string|int $id =null id of entry to refresh
-
-
@param string $type =null either ‘update’, ‘edit’, ‘delete’, ‘add’ or null
-
-
- update: request just modified data from given rows.
-
- Sorting and filtering are not considered, so if the sort field is changed,
-
- the row will not be moved. If the current filtering could include or exclude
-
-
-
- edit: rows changed, but sorting or filtering may be affected. Requires full reload.
-
-
- delete: just delete the given rows clientside (no server interaction neccessary)
-
-
- add: requires full reload for proper sorting
-
-
-
@param string $targetapp =null which app’s window should be refreshed, default current
-
-
@param string|RegExp $replace =null regular expression to replace in url
-
-
@param string $with =null
-
-
@param string $msg_type =null ‘error’, ‘warning’ or ‘success’ (default)
- */
- public static function refresh_opener($msg, $app, $id=null, $type=null, $targetapp=null, $replace=null, $with=null, $msg_type=null)
- {
-
//error_log(__METHOD__.'('.array2string(func_get_args()).')');
-
self::$extra['refresh-opener'] = func_get_args();
-
-
unset($msg, $app, $id, $type, $targetapp, $replace, $with, $msg_type); // used only via func_get_args();
- }
-
- /**
-
- Display an error or regular message
-
-
- Calls egw_message on client-side in a content security save way
-
-
-
@param string $msg message to show
-
-
@param string $type =‘success’ ‘error’, ‘warning’ or ‘success’ (default)
- */
- public static function message($msg, $type=‘success’)
- {
-
self::$extra['message'] = func_get_args();
-
-
unset($msg, $type); // used only via func_get_args();
- }
-
- /**
-
- Open a popup independent if we run as json or regular request
-
-
-
-
- */
- public static function popup($link, $target=’_blank’, $popup=‘640x480’)
- {
-
// default params are not returned by func_get_args!
-
$args = func_get_args()+array(null, '_blank', '640x480');
-
-
unset($link, $target, $popup); // used only via func_get_args()
-
-
if (egw_json_request::isJSONRequest())
-
{
-
egw_json_response::get()->apply('egw.open_link', $args);
-
}
-
else
-
{
-
self::$extra['popup'] = $args;
-
}
- }
-
- /**
-
- Close (popup) window, use to replace egw_framework::onload(‘window.close()’) in a content security save way
-
-
-
@param string $alert_msg =’’ optional message to display as alert, before closing the window
- */
- public static function window_close($alert_msg=’’)
- {
-
//error_log(__METHOD__."()");
-
self::$extra['window-close'] = $alert_msg ? $alert_msg : true;
-
-
// are we in ajax_process_content -> just return extra data, with close instructions
-
if (preg_match('/etemplate(_new)?(::|\.)ajax_process_content/', $_GET['menuaction']))
-
{
-
$response = egw_json_response::get();
-
$response->generic('et2_load', egw_framework::get_extra());
-
}
-
else
-
{
-
$GLOBALS['egw']->framework->render('', false, false);
-
}
-
common::egw_exit();
- }
-
- /**
-
- Close (popup) window, use to replace egw_framework::onload(‘window.close()’) in a content security save way
- */
- public static function window_focus()
- {
-
//error_log(__METHOD__."()");
-
self::$extra['window-focus'] = true;
- }
-
- /**
-
- Allow app to store arbitray values in egw script tag
-
-
- Attribute name will be “data-$app-$name” and value will be json serialized, if not scalar.
-
-
-
-
- */
- public static function set_extra($app, $name, $value)
- {
-
self::$extra[$app.'-'.$name] = $value;
- }
-
- /**
-
- */
- public static function clear_extra()
- {
-
self::$extra = array();
- }
-
- /**
-
- Allow eg. ajax to query content set via refresh_opener or window_close
-
-
-
@return array content of egw_framework::$extra
- */
- public static function get_extra()
- {
-
// adding links of refreshed entry, to give others apps more information about necessity to refresh
-
if (isset(self::$extra['refresh-opener']) && count(self::$extra['refresh-opener']) <= 8 && // do not run twice
-
!empty(self::$extra['refresh-opener'][1]) && !empty(self::$extra['refresh-opener'][2])) // app/id given
-
{
-
$links = egw_link::get_links(self::$extra['refresh-opener'][1], self::$extra['refresh-opener'][2]);
-
$apps = array();
-
foreach($links as $link)
-
{
-
$apps[$link['app']][] = $link['id'];
-
}
-
while (count(self::$extra['refresh-opener']) < 8)
-
{
-
self::$extra['refresh-opener'][] = null;
-
}
-
self::$extra['refresh-opener'][] = $apps;
-
}
-
return self::$extra;
- }
-
- /**
- Returns the html-header incl. the opening body tag
-
-
-
-
@return string with Html
*/
abstract function header(array $extra=array());
/**
-
- Returns the html from the body-tag til the main application area (incl. opening div tag)
-
- Returns the Html from the body-tag til the main application area (incl. opening div tag)
-
- If header has NOT been called, also return header content!
- No need to manually call header, this allows to postpone header so navbar / sidebox can include JS or CSS.
-
-
-
@return string with Html
*/
abstract function navbar();
@@ -478,7 +303,7 @@
abstract function sidebox($appname,$menu_title,$file,$type=null);
/**
-
- Returns the html from the closing div of the main application area to the closing html-tag
-
- Returns the Html from the closing div of the main application area to the closing html-tag
-
-
@return string
*/
@@ -489,203 +314,18 @@
-
-
@param string $extra_vars for login url
-
@param string $change_passwd =null string with message to render input fields for password change
- */
function login_screen($extra_vars, $change_passwd=null)
{
-
self::csp_frame_src_attrs(array()); // array() no external frame-sources
-
-
//error_log(__METHOD__."() this->template=$this->template, this->template_dir=$this->template_dir, get_class(this)=".get_class($this));
-
$tmpl = new Template(EGW_SERVER_ROOT.$this->template_dir);
-
-
$tmpl->set_file(array('login_form' => html::$ua_mobile?'login_mobile.tpl':'login.tpl'));
-
-
$tmpl->set_var('lang_message',$GLOBALS['loginscreenmessage']);
-
-
// hide change-password fields, if not requested
-
if (!$change_passwd)
-
{
-
$tmpl->set_block('login_form','change_password');
-
$tmpl->set_var('change_password', '');
-
$tmpl->set_var('lang_password',lang('password'));
-
$tmpl->set_var('cd',check_logoutcode($_GET['cd']));
-
$tmpl->set_var('cd_class', isset($_GET['cd']) && $_GET['cd'] != 1 ? 'error' : '');
-
$last_loginid = $_COOKIE['last_loginid'];
-
$last_domain = $_COOKIE['last_domain'];
-
$tmpl->set_var('passwd', '');
-
$tmpl->set_var('autofocus_login', 'autofocus');
-
}
-
else
-
{
-
$tmpl->set_var('lang_password',lang('Old password'));
-
$tmpl->set_var('lang_new_password',lang('New password'));
-
$tmpl->set_var('lang_repeat_password',lang('Repeat password'));
-
$tmpl->set_var('cd', $change_passwd);
-
$tmpl->set_var('cd_class', 'error');
-
$last_loginid = $_POST['login'];
-
$last_domain = $_POST['domain'];
-
$tmpl->set_var('passwd', $_POST['passwd']);
-
$tmpl->set_var('autofocus_login', '');
-
$tmpl->set_var('autofocus_new_passwd', 'autofocus');
-
}
-
if($GLOBALS['egw_info']['server']['show_domain_selectbox'])
-
{
-
foreach(array_keys($GLOBALS['egw_domain']) as $domain)
-
{
-
$domains[$domain] = $domain;
-
}
-
$tmpl->set_var(array(
-
'lang_domain' => lang('domain'),
-
'select_domain' => html::select('logindomain',$last_domain,$domains,true,'tabindex="2"',0,false),
-
));
-
}
-
else
-
{
-
/* trick to make domain section disapear */
-
$tmpl->set_block('login_form','domain_selection');
-
$tmpl->set_var('domain_selection',$GLOBALS['egw_info']['user']['domain'] ?
-
html::input_hidden('logindomain',$GLOBALS['egw_info']['user']['domain']) : '');
-
-
if($last_loginid !== '')
-
{
-
reset($GLOBALS['egw_domain']);
-
list($default_domain) = each($GLOBALS['egw_domain']);
-
-
if(!empty ($last_domain) && $last_domain != $default_domain)
-
{
-
$last_loginid .= '@' . $last_domain;
-
}
-
}
-
}
-
-
$config_reg = config::read('registration');
-
-
if($config_reg['enable_registration'])
-
{
-
if ($config_reg['register_link'])
-
{
-
$reg_link=' <a href="'. egw::link('/registration/index.php','lang_code='.$_GET['lang']). '">'.lang('Not a user yet? Register now').'</a><br/>';
-
}
-
if ($config_reg['lostpassword_link'])
-
{
-
$lostpw_link=' <a href="'. egw::link('/registration/index.php','menuaction=registration.registration_ui.lost_password&lang_code='.$_GET['lang']). '">'.lang('Lost password').'</a><br/>';
-
}
-
if ($config_reg['lostid_link'])
-
{
-
$lostid_link=' <a href="'. egw::link('/registration/index.php'