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();
// Clean some variables
if (empty($this->global->MAIN_MENU_STANDARD)) $this->global->MAIN_MENU_STANDARD="eldy_backoffice.php";
if (empty($this->global->MAIN_MENUFRONT_STANDARD)) $this->global->MAIN_MENUFRONT_STANDARD="eldy_frontoffice.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_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_MENU_STANDARD)) $this->global->MAIN_MENU_STANDARD="eldy_menu.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_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_menu.php"; // Use eldy by default because smartphone does not work on all phones
// Variable globales LDAP
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.
*
* @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 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'...)
@ -584,7 +584,7 @@ class Menubase
}
//$tmp4=dol_microtime_float();
//print '>>> 3 '.($tmp4 - $tmp3).'<br>';
// We complete tabMenu
$tabMenu[$b]['rowid'] = $menu['rowid'];
$tabMenu[$b]['module'] = $menu['module'];
@ -606,10 +606,10 @@ class Menubase
$tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu'];
$tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu'];
$tabMenu[$b]['position'] = $menu['position'];
$b++;
}
$a++;
}
$this->db->free($resql);

View File

@ -61,7 +61,7 @@ class Translate
/**
* 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
*/
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']))
{
?>
<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']; ?>
</div></td></tr></table></center>
</div></div></center>
<?php
}
?>
@ -200,10 +200,9 @@ if ($forgetpasslink || $helpcenterlink) {
<?php if ($main_home)
{
?>
<center><table summary="info" cellpadding="0" cellspacing="0" border="0" align="center" width="750">
<tr><td align="center">
<center><div align="center" style="max-width: 80%">
<?php echo $main_home; ?>
</td></tr></table></center><br>
</div></center><br>
<?php
}
?>

View File

@ -301,7 +301,7 @@ if (! empty($_SESSION["disablemodules"]))
/*
* Phase authentication / login
*/
*/
$login='';
if (! defined('NOLOGIN'))
{
@ -384,10 +384,18 @@ if (! defined('NOLOGIN'))
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;
$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)
{
$login = checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmode);
if ($login)
$login = checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmode);
if ($login)
{
$dol_authmode=$conf->authmode; // This properties is defined only when logged to say what mode was successfully used
$dol_tz=$_POST["tz"];
@ -434,11 +442,6 @@ if (! defined('NOLOGIN'))
if (! $login)
{
// 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:''));
exit;
}
@ -765,41 +768,42 @@ if (! empty($conf->multicompany->enabled) && GETPOST('action') == 'switchentity'
}
}
//print 'eee'.$conf->standard_menu;
// Init menu manager
if (empty($user->societe_id)) // If internal user or not defined
if (! defined('NOREQUIREMENU'))
{
$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);
}
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->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)
$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 (! class_exists('MenuManager'))
{
$menufound=0;
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
foreach($dirmenus as $dirmenu)
if (empty($user->societe_id)) // If internal user or not defined
{
$menufound=dol_include_once($dirmenu."standard/".$file_menu);
if ($menufound) break;
$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);
}
if (! $menufound) // If failed to include, we try with standard
else // If external user
{
dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
$file_menu='eldy_menu.php';
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
$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);
}
}
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
// Load the menu manager (only if not already done)
$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 (! class_exists('MenuManager'))
{
$menufound=0;
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
foreach($dirmenus as $dirmenu)
{
$menufound=dol_include_once($dirmenu."standard/".$file_menu);
if ($menufound) break;
}
if (! $menufound) // If failed to include, we try with standard
{
dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
$file_menu='eldy_menu.php';
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
}
}
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
}