Merge branch 'develop' of git://github.com/Dolibarr/dolibarr into develop

This commit is contained in:
Grand Philippe 2013-02-24 10:10:52 +01:00
commit 9175f241ff
6 changed files with 114 additions and 49 deletions

View File

@ -218,10 +218,10 @@ class Conf
$this->bank->cheque = new stdClass(); $this->bank->cheque = new stdClass();
// Clean some variables // Clean some variables
if (empty($this->global->MAIN_MENU_STANDARD)) $this->global->MAIN_MENU_STANDARD="eldy_backoffice.php"; if (empty($this->global->MAIN_MENU_STANDARD)) $this->global->MAIN_MENU_STANDARD="eldy_menu.php";
if (empty($this->global->MAIN_MENUFRONT_STANDARD)) $this->global->MAIN_MENUFRONT_STANDARD="eldy_frontoffice.php"; if (empty($this->global->MAIN_MENUFRONT_STANDARD)) $this->global->MAIN_MENUFRONT_STANDARD="eldy_menu.php";
if (empty($this->global->MAIN_MENU_SMARTPHONE)) $this->global->MAIN_MENU_SMARTPHONE="eldy_backoffice.php"; // Use eldy by default because smartphone does not work on all phones if (empty($this->global->MAIN_MENU_SMARTPHONE)) $this->global->MAIN_MENU_SMARTPHONE="eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE="eldy_frontoffice.php"; // Ue eldy by default because smartphone does not work on all phones if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE="eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
// Variable globales LDAP // Variable globales LDAP
if (empty($this->global->LDAP_FIELD_FULLNAME)) $this->global->LDAP_FIELD_FULLNAME=''; if (empty($this->global->LDAP_FIELD_FULLNAME)) $this->global->LDAP_FIELD_FULLNAME='';

View File

@ -494,7 +494,7 @@ class Menubase
/** /**
* Load entries found in database into variable $tabMenu. Note that only "database menu entries" are loaded here, hardcoded will not be present into output. * Load entries found in database into variable $tabMenu. Note that only "database menu entries" are loaded here, hardcoded will not be present into output.
* *
* @param string $mymainmenu Value for left that defined mainmenu * @param string $mymainmenu Value for mainmenu that defined mainmenu
* @param string $myleftmenu Value for left that defined leftmenu * @param string $myleftmenu Value for left that defined leftmenu
* @param int $type_user Looks for menu entry for 0=Internal users, 1=External users * @param int $type_user Looks for menu entry for 0=Internal users, 1=External users
* @param string $menu_handler Name of menu_handler used ('auguria', 'eldy'...) * @param string $menu_handler Name of menu_handler used ('auguria', 'eldy'...)

View File

@ -61,7 +61,7 @@ class Translate
/** /**
* Set accessor for this->defaultlang * Set accessor for this->defaultlang
* *
* @param string $srclang Language to use * @param string $srclang Language to use. If '' or 'auto', we use browser lang.
* @return void * @return void
*/ */
function setDefaultLang($srclang='en_US') function setDefaultLang($srclang='en_US')

View File

@ -0,0 +1,62 @@
<?php
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This file is a modified version of datepicker.php from phpBSM to fix some
* bugs, to add new features and to dramatically increase speed.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/getmenu_jmobile.php
* \brief File to return menu
*/
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
require_once '../main.inc.php';
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php
$langs->load("main");
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
//var_dump($langs->defaultlang);
//var_dump($conf->format_date_short_java);
//var_dump($langs->trans("FormatDateShortJava"));
/*
* View
*/
// URL http://mydolibarr/core/getmenu_jmobime?mainmenu=mainmenu&leftmenu=leftmenu can be used for tests
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
print '<body>'."\n";
print 'zzz'."\n";
print '</body></html>'."\n";
?>

View File

@ -190,9 +190,9 @@ if ($forgetpasslink || $helpcenterlink) {
<?php if (! empty($_SESSION['dol_loginmesg'])) <?php if (! empty($_SESSION['dol_loginmesg']))
{ {
?> ?>
<center><table width="60%"><tr><td align="center"><div class="error"> <center><div align="center" style="max-width: 500px; margin-left: 10px; margin-right: 10px;"><div class="error">
<?php echo $_SESSION['dol_loginmesg']; ?> <?php echo $_SESSION['dol_loginmesg']; ?>
</div></td></tr></table></center> </div></div></center>
<?php <?php
} }
?> ?>
@ -200,10 +200,9 @@ if ($forgetpasslink || $helpcenterlink) {
<?php if ($main_home) <?php if ($main_home)
{ {
?> ?>
<center><table summary="info" cellpadding="0" cellspacing="0" border="0" align="center" width="750"> <center><div align="center" style="max-width: 80%">
<tr><td align="center">
<?php echo $main_home; ?> <?php echo $main_home; ?>
</td></tr></table></center><br> </div></center><br>
<?php <?php
} }
?> ?>

View File

@ -301,7 +301,7 @@ if (! empty($_SESSION["disablemodules"]))
/* /*
* Phase authentication / login * Phase authentication / login
*/ */
$login=''; $login='';
if (! defined('NOLOGIN')) if (! defined('NOLOGIN'))
{ {
@ -384,6 +384,14 @@ if (! defined('NOLOGIN'))
if ($dolibarr_main_authentication == 'forceuser' && ! empty($dolibarr_auto_user)) $goontestloop=true; if ($dolibarr_main_authentication == 'forceuser' && ! empty($dolibarr_auto_user)) $goontestloop=true;
if (GETPOST("username","alpha",2) || ! empty($_COOKIE['login_dolibarr']) || GETPOST('openid_mode','alpha',1)) $goontestloop=true; if (GETPOST("username","alpha",2) || ! empty($_COOKIE['login_dolibarr']) || GETPOST('openid_mode','alpha',1)) $goontestloop=true;
$langcode=(GETPOST('lang')?((is_object($langs)&&$langs->defaultlang)?$langs->defaultlang:'auto'):GETPOST('lang'));
if (! is_object($langs)) // This can occurs when calling page with NOREQUIRETRAN defined, however we need lang for error messages.
{
include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
$langs=new Translate("",$conf);
}
$langs->setDefaultLang($langcode);
if ($test && $goontestloop) if ($test && $goontestloop)
{ {
$login = checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmode); $login = checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmode);
@ -434,11 +442,6 @@ if (! defined('NOLOGIN'))
if (! $login) if (! $login)
{ {
// We show login page // We show login page
if (! is_object($langs)) // This can occurs when calling page with NOREQUIRETRAN defined
{
include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
$langs=new Translate("",$conf);
}
dol_loginfunction($langs,$conf,(! empty($mysoc)?$mysoc:'')); dol_loginfunction($langs,$conf,(! empty($mysoc)?$mysoc:''));
exit; exit;
} }
@ -765,25 +768,26 @@ if (! empty($conf->multicompany->enabled) && GETPOST('action') == 'switchentity'
} }
} }
//print 'eee'.$conf->standard_menu;
// Init menu manager // Init menu manager
if (empty($user->societe_id)) // If internal user or not defined if (! defined('NOREQUIREMENU'))
{ {
if (empty($user->societe_id)) // If internal user or not defined
{
$conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED); $conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED);
$conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENU_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENU_SMARTPHONE):$conf->global->MAIN_MENU_SMARTPHONE_FORCED); $conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENU_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENU_SMARTPHONE):$conf->global->MAIN_MENU_SMARTPHONE_FORCED);
} }
else // If external user else // If external user
{ {
$conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED); $conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
$conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENUFRONT_SMARTPHONE):$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED); $conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENUFRONT_SMARTPHONE):$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED);
} }
// Load the menu manager (only if not already done) // Load the menu manager (only if not already done)
$file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu; $file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu;
if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php
if (! class_exists('MenuManager')) if (! class_exists('MenuManager'))
{ {
$menufound=0; $menufound=0;
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']); $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
foreach($dirmenus as $dirmenu) foreach($dirmenus as $dirmenu)
@ -797,9 +801,9 @@ if (! class_exists('MenuManager'))
$file_menu='eldy_menu.php'; $file_menu='eldy_menu.php';
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu; include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
} }
}
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
} }
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);