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

This commit is contained in:
Grand Philippe 2013-02-25 08:16:43 +01:00
commit d27568d3d0
17 changed files with 1308 additions and 1324 deletions

View File

@ -36,7 +36,7 @@ jQuery blockUI 2.43 GPL and MIT Licence Yes JS libra
jQuery jPicker 1.1.00 GPL and MIT Licence Yes JS library for color picker with not defined list of colors jQuery jPicker 1.1.00 GPL and MIT Licence Yes JS library for color picker with not defined list of colors
jQuery Layout 1.3.0 GPL and MIT Licence Yes JS library plugin Layout (RC-29.15) jQuery Layout 1.3.0 GPL and MIT Licence Yes JS library plugin Layout (RC-29.15)
jQuery TableDnD 0.5 GPL and MIT Licence Yes JS library plugin TableDnD (to reorder table rows) jQuery TableDnD 0.5 GPL and MIT Licence Yes JS library plugin TableDnD (to reorder table rows)
jQuery Mobile 1.0rc2 GPL and MIT Licence Yes JS library for smartphone (not used) jQuery Mobile 1.3 GPL and MIT Licence Yes JS library for smartphone (not used)
jQuery Tiptip 1.3 GPL and MIT Licence Yes JS library for tooltips jQuery Tiptip 1.3 GPL and MIT Licence Yes JS library for tooltips
JSGantt 1.2 BSD Licence Yes JS library (to build Gantt reports) JSGantt 1.2 BSD Licence Yes JS library (to build Gantt reports)

View File

@ -28,6 +28,7 @@ For developers:
- Renamed some database fields, code variables and parameters from french to english. - Renamed some database fields, code variables and parameters from french to english.
- First change to manage margins on contracts. - First change to manage margins on contracts.
- Add hook getFormMail. - Add hook getFormMail.
- New: Add option dol_hide_topmenu and dol_hide_leftmenu onto login page.
For translators: For translators:
- Update language files. - Update language files.

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -200,7 +200,6 @@ if (function_exists("imagecreatefrompng"))
} }
else else
{ {
$form = new Form($db);
$desc = $form->textwithpicto('',$langs->transnoentities("EnableGDLibraryDesc"),1,'warning'); $desc = $form->textwithpicto('',$langs->transnoentities("EnableGDLibraryDesc"),1,'warning');
print $desc; print $desc;
} }

View File

@ -385,19 +385,16 @@ class Menubase
*/ */
function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu) function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
{ {
global $langs, $user, $conf; global $langs, $user, $conf; // To export to dol_eval function
global $mainmenu,$leftmenu; // To export to dol_eval function global $mainmenu,$leftmenu; // To export to dol_eval function
$mainmenu=$mymainmenu; // To export to dol_eval function $mainmenu=$mymainmenu; // To export to dol_eval function
$leftmenu=$myleftmenu; // To export to dol_eval function $leftmenu=$myleftmenu; // To export to dol_eval function
$newTabMenu=array(); $newTabMenu=array();
if (is_array($tabMenu)) foreach($tabMenu as $val)
{ {
foreach($tabMenu as $val) if ($val['type']=='top') $newTabMenu[]=$val;
{
if ($val['type']=='top') $newTabMenu[]=$val;
}
} }
return $newTabMenu; return $newTabMenu;
@ -411,80 +408,78 @@ class Menubase
* @param string $myleftmenu Value for leftmenu to filter menu to load (always '') * @param string $myleftmenu Value for leftmenu to filter menu to load (always '')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...) * @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...)
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param array &$tabMenu Array with menu entries already loaded
* @return array Menu array for particular mainmenu value or full tabArray * @return array Menu array for particular mainmenu value or full tabArray
*/ */
function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu) function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
{ {
global $langs, $user, $conf; // To export to dol_eval function global $langs, $user, $conf; // To export to dol_eval function
global $mainmenu,$leftmenu; // To export to dol_eval function global $mainmenu,$leftmenu; // To export to dol_eval function
// We initialize newmenu with first already found menu entries
$this->newmenu = $newmenu;
$mainmenu=$mymainmenu; // To export to dol_eval function $mainmenu=$mymainmenu; // To export to dol_eval function
$leftmenu=$myleftmenu; // To export to dol_eval function $leftmenu=$myleftmenu; // To export to dol_eval function
if (is_array($tabMenu)) // Detect what is top mainmenu id
$menutopid='';
foreach($tabMenu as $key => $val)
{ {
$menutopid=''; // Define menutopid of mainmenu
foreach($tabMenu as $key => $val) if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu)
{ {
// Define menutopid of mainmenu $menutopid=$val['rowid'];
if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu) break;
{ }
$menutopid=$val['rowid']; }
break;
}
}
// Now edit this->newmenu->list to add entries found into tabMenu that are childs of mainmenu claimed, using the fk_menu link (old method) // We initialize newmenu with first already found menu entries
$this->recur($tabMenu, $menutopid, 1); $this->newmenu = $newmenu;
// Now update this->newmenu->list when fk_menu value is -1 (left menu added by modules with no top menu) // Now edit this->newmenu->list to add entries found into tabMenu that are childs of mainmenu claimed, using the fk_menu link (old method)
foreach($tabMenu as $key => $val) $this->recur($tabMenu, $menutopid, 1);
{
//var_dump($tabMenu);
if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu) // We found a menu entry not linked to parent with good mainmenu
{
//print 'Try to add menu (current is mainmenu='.$mainmenu.' leftmenu='.$leftmenu.') for '.join(',',$val).' fk_mainmenu='.$val['fk_mainmenu'].' fk_leftmenu='.$val['fk_leftmenu'].'<br>';
//var_dump($this->newmenu->liste);exit;
if (empty($val['fk_leftmenu'])) // Now update this->newmenu->list when fk_menu value is -1 (left menu added by modules with no top menu)
{ foreach($tabMenu as $key => $val)
$this->newmenu->add($val['url'], $val['titre'], 0, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu']); // TODO Add position {
//var_dump($this->newmenu->liste); //var_dump($tabMenu);
} if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu) // We found a menu entry not linked to parent with good mainmenu
else {
{ //print 'Try to add menu (current is mainmenu='.$mainmenu.' leftmenu='.$leftmenu.') for '.join(',',$val).' fk_mainmenu='.$val['fk_mainmenu'].' fk_leftmenu='.$val['fk_leftmenu'].'<br>';
// Search first menu with this couple (mainmenu,leftmenu)=(fk_mainmenu,fk_leftmenu) //var_dump($this->newmenu->liste);exit;
$searchlastsub=0;$lastid=0;$nextid=0;$found=0;
foreach($this->newmenu->liste as $keyparent => $valparent) if (empty($val['fk_leftmenu']))
{ {
//var_dump($valparent); $this->newmenu->add($val['url'], $val['titre'], 0, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu']); // TODO Add position
if ($searchlastsub) // If we started to search for last submenu //var_dump($this->newmenu->liste);
{ }
if ($valparent['level'] >= $searchlastsub) $lastid=$keyparent; else
if ($valparent['level'] < $searchlastsub) {
{ // Search first menu with this couple (mainmenu,leftmenu)=(fk_mainmenu,fk_leftmenu)
$nextid=$keyparent; $searchlastsub=0;$lastid=0;$nextid=0;$found=0;
break; foreach($this->newmenu->liste as $keyparent => $valparent)
} {
} //var_dump($valparent);
if ($valparent['mainmenu'] == $val['fk_mainmenu'] && $valparent['leftmenu'] == $val['fk_leftmenu']) if ($searchlastsub) // If we started to search for last submenu
{ {
//print "We found parent: keyparent='.$keyparent.' - level=".$valparent['level'].' - '.join(',',$valparent).'<br>'; if ($valparent['level'] >= $searchlastsub) $lastid=$keyparent;
// Now we look to find last subelement of this parent (we add at end) if ($valparent['level'] < $searchlastsub)
$searchlastsub=($valparent['level']+1); {
$lastid=$keyparent; $nextid=$keyparent;
$found=1; break;
} }
} }
//print 'We must insert menu entry between entry '.$lastid.' and '.$nextid.'<br>'; if ($valparent['mainmenu'] == $val['fk_mainmenu'] && $valparent['leftmenu'] == $val['fk_leftmenu'])
if ($found) $this->newmenu->insert($lastid, $val['url'], $val['titre'], $searchlastsub, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu']); {
} //print "We found parent: keyparent='.$keyparent.' - level=".$valparent['level'].' - '.join(',',$valparent).'<br>';
} // Now we look to find last subelement of this parent (we add at end)
} $searchlastsub=($valparent['level']+1);
$lastid=$keyparent;
$found=1;
}
}
//print 'We must insert menu entry between entry '.$lastid.' and '.$nextid.'<br>';
if ($found) $this->newmenu->insert($lastid, $val['url'], $val['titre'], $searchlastsub, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu']);
}
}
} }
return $this->newmenu; return $this->newmenu;

View File

@ -51,12 +51,47 @@ $left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
*/ */
// URL http://mydolibarr/core/getmenu_jmobime?mainmenu=mainmenu&leftmenu=leftmenu can be used for tests // URL http://mydolibarr/core/getmenu_jmobime?mainmenu=mainmenu&leftmenu=leftmenu can be used for tests
$arrayofjs=array('/includes/jquery/plugins/mobile/jquery.mobile-latest.min.js');
$arrayofcss=array('/includes/jquery/plugins/mobile/jquery.mobile-latest.min.css');
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
print '<body>'."\n"; print '<body>'."\n";
print 'zzz'."\n"; 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->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)
{
$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);
$menumanager->showmenu('jmobile');
print '</body></html>'."\n"; print '</body></html>'."\n";
$db->close();
?> ?>

View File

@ -364,7 +364,8 @@ function ajax_constantonoff($code, $input=array(), $entity=false)
$entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
$out= '<script type="text/javascript"> $out= "\n<!-- Ajax code to switch constant ".$code." -->".'
<script type="text/javascript">
$(function() { $(function() {
var input = '.json_encode($input).'; var input = '.json_encode($input).';
var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\'; var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\';
@ -376,11 +377,8 @@ function ajax_constantonoff($code, $input=array(), $entity=false)
// Set constant // Set constant
$("#set_" + code).click(function() { $("#set_" + code).click(function() {
if (input.alert && input.alert.set) { if (input.alert && input.alert.set) {
// Posibility to force label of buttons if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton;
if (input.alert.set.yesButton) if (input.alert.set.noButton) noButton = input.alert.set.noButton;
yesButton = input.alert.set.yesButton;
if (input.alert.set.noButton)
noButton = input.alert.set.noButton;
confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton); confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton);
} else { } else {
setConstant(url, code, input, entity); setConstant(url, code, input, entity);
@ -390,22 +388,20 @@ function ajax_constantonoff($code, $input=array(), $entity=false)
// Del constant // Del constant
$("#del_" + code).click(function() { $("#del_" + code).click(function() {
if (input.alert && input.alert.del) { if (input.alert && input.alert.del) {
// Posibility to force label of buttons if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton;
if (input.alert.del.yesButton) if (input.alert.del.noButton) noButton = input.alert.del.noButton;
yesButton = input.alert.del.yesButton;
if (input.alert.del.noButton)
noButton = input.alert.del.noButton;
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton); confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton);
} else { } else {
delConstant(url, code, input, entity); delConstant(url, code, input, entity);
} }
}); });
}); });
</script>'; </script>'."\n";
$out.= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>'; $out.= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
$out.= '<span id="set_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'hideobject':'').'">'.img_picto($langs->trans("Disabled"),'switch_off').'</span>'; $out.= '<span id="set_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'hideobject':'').'">'.img_picto($langs->trans("Disabled"),'switch_off').'</span>';
$out.= '<span id="del_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'':'hideobject').'">'.img_picto($langs->trans("Enabled"),'switch_on').'</span>'; $out.= '<span id="del_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'':'hideobject').'">'.img_picto($langs->trans("Enabled"),'switch_on').'</span>';
$out.="\n";
return $out; return $out;
} }

View File

@ -292,13 +292,18 @@ function dol_loginfunction($langs,$conf,$mysoc)
// Google AD // Google AD
$main_google_ad_client = ((! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))?1:0); $main_google_ad_client = ((! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))?1:0);
// Set jquery theme
$dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:''); $dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:'');
$favicon=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/favicon.ico'; $favicon=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/favicon.ico';
$jquerytheme = 'smoothness'; $jquerytheme = 'smoothness';
if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
// Set dol_hide_topmenu and dol_hide_leftmenu
$dol_hide_topmenu=GETPOST('dol_hide_topmenu');
$dol_hide_leftmenu=GETPOST('dol_hide_leftmenu');
include $template_dir.'login.tpl.php'; // To use native PHP // Include login page template
include $template_dir.'login.tpl.php';
$_SESSION["dol_loginmesg"] = ''; $_SESSION["dol_loginmesg"] = '';

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2010-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -55,7 +55,6 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu)
$idsel=(empty($newTabMenu[$i]['mainmenu'])?'none':$newTabMenu[$i]['mainmenu']); $idsel=(empty($newTabMenu[$i]['mainmenu'])?'none':$newTabMenu[$i]['mainmenu']);
$showmode=dol_auguria_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal); $showmode=dol_auguria_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal);
if ($showmode == 1) if ($showmode == 1)
{ {
// Define url // Define url
@ -163,7 +162,7 @@ function print_end_menu_entry_auguria()
function print_end_menu_array_auguria() function print_end_menu_array_auguria()
{ {
print '</ul>'; print '</ul>';
print '</div>'; print '</div>';
print "\n"; print "\n";
} }
@ -180,135 +179,133 @@ function print_end_menu_array_auguria()
*/ */
function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu) function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu)
{ {
global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc; global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc;
$overwritemenufor = array(); $overwritemenufor = array();
$newmenu = new Menu(); $newmenu = new Menu();
$mainmenu=$_SESSION["mainmenu"]; $mainmenu=$_SESSION["mainmenu"];
$leftmenu=$_SESSION["leftmenu"]; $leftmenu=$_SESSION["leftmenu"];
// Show logo company // Show logo company
if (! empty($conf->global->MAIN_SHOW_LOGO)) if (! empty($conf->global->MAIN_SHOW_LOGO))
{ {
$mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; $mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI;
if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
{ {
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file='.urlencode('thumbs/'.$mysoc->logo_mini); $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file='.urlencode('thumbs/'.$mysoc->logo_mini);
print "\n".'<!-- Show logo on menu -->'."\n"; print "\n".'<!-- Show logo on menu -->'."\n";
print '<div class="blockvmenuimpair">'."\n"; print '<div class="blockvmenuimpair">'."\n";
print '<div class="menu_titre" id="menu_titre_logo"></div>'; print '<div class="menu_titre" id="menu_titre_logo"></div>';
print '<div class="menu_top" id="menu_top_logo"></div>'; print '<div class="menu_top" id="menu_top_logo"></div>';
print '<div class="menu_contenu" id="menu_contenu_logo">'; print '<div class="menu_contenu" id="menu_contenu_logo">';
print '<center><img title="" src="'.$urllogo.'"></center>'."\n"; print '<center><img title="" src="'.$urllogo.'"></center>'."\n";
print '</div>'; print '</div>';
print '<div class="menu_end" id="menu_end_logo"></div>'; print '<div class="menu_end" id="menu_end_logo"></div>';
print '</div>'."\n"; print '</div>'."\n";
} }
} }
/** /**
* We update newmenu with entries found into database * We update newmenu with entries found into database
* -------------------------------------------------- * --------------------------------------------------
*/ */
$menuArbo = new Menubase($db,'auguria'); $menuArbo = new Menubase($db,'auguria');
$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu); $newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu);
//var_dump($menu_array_before);exit; //var_dump($menu_array_before);exit;
//var_dump($menu_array_after);exit; //var_dump($menu_array_after);exit;
$menu_array=$newmenu->liste; $menu_array=$newmenu->liste;
if (is_array($menu_array_before)) $menu_array=array_merge($menu_array_before, $menu_array); if (is_array($menu_array_before)) $menu_array=array_merge($menu_array_before, $menu_array);
if (is_array($menu_array_after)) $menu_array=array_merge($menu_array, $menu_array_after); if (is_array($menu_array_after)) $menu_array=array_merge($menu_array, $menu_array_after);
//var_dump($menu_array);exit; //var_dump($menu_array);exit;
if (! is_array($menu_array)) return 0;
// Show menu // Show menu
$alt=0; $alt=0;
if (is_array($menu_array)) $num=count($menu_array);
{ for ($i = 0; $i < $num; $i++)
$num=count($menu_array); {
for ($i = 0; $i < $num; $i++) $alt++;
{ if (empty($menu_array[$i]['level']))
$alt++; {
if (empty($menu_array[$i]['level'])) if (($alt%2==0))
{ {
if (($alt%2==0)) if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION))
{ {
if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION)) print '<div class="blockvmenupair">'."\n";
{ }
print '<div class="blockvmenupair">'."\n"; else
} {
else print '<div class="blockvmenuimpair">'."\n";
{ }
print '<div class="blockvmenuimpair">'."\n"; }
} else
} {
else print '<div class="blockvmenupair">'."\n";
{ }
print '<div class="blockvmenupair">'."\n"; }
}
}
// Place tabulation // Place tabulation
$tabstring=''; $tabstring='';
$tabul=($menu_array[$i]['level'] - 1); $tabul=($menu_array[$i]['level'] - 1);
if ($tabul > 0) if ($tabul > 0)
{ {
for ($j=0; $j < $tabul; $j++) for ($j=0; $j < $tabul; $j++)
{ {
$tabstring.='&nbsp; &nbsp;'; $tabstring.='&nbsp; &nbsp;';
} }
} }
// Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser. // Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser.
$url=dol_buildpath($menu_array[$i]['url'],1); $url=dol_buildpath($menu_array[$i]['url'],1);
if (! preg_match('/mainmenu=/i',$menu_array[$i]['url'])) if (! preg_match('/mainmenu=/i',$menu_array[$i]['url']))
{ {
if (! preg_match('/\?/',$url)) $url.='?'; if (! preg_match('/\?/',$url)) $url.='?';
else $url.='&'; else $url.='&';
$url.='mainmenu='.$mainmenu; $url.='mainmenu='.$mainmenu;
} }
print '<!-- Add menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['mainmenu'].' -->'."\n"; print '<!-- Add menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['mainmenu'].' -->'."\n";
// Menu niveau 0 // Menu niveau 0
if ($menu_array[$i]['level'] == 0) if ($menu_array[$i]['level'] == 0)
{ {
if ($menu_array[$i]['enabled']) if ($menu_array[$i]['enabled'])
{ {
print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'.$menu_array[$i]['titre'].'</a></div>'; print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'.$menu_array[$i]['titre'].'</a></div>';
} }
else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED))
{ {
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$menu_array[$i]['titre'].'</font></div>'; print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$menu_array[$i]['titre'].'</font></div>';
} }
print "\n".'<div id="section_content_'.$i.'">'."\n"; print "\n".'<div id="section_content_'.$i.'">'."\n";
print '<div class="menu_top"></div>'."\n"; print '<div class="menu_top"></div>'."\n";
} }
// Menu niveau > 0 // Menu niveau > 0
if ($menu_array[$i]['level'] > 0) if ($menu_array[$i]['level'] > 0)
{ {
if ($menu_array[$i]['enabled']) if ($menu_array[$i]['enabled'])
{ {
print '<div class="menu_contenu">'.$tabstring.'<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'.$menu_array[$i]['titre'].'</a></div>'; print '<div class="menu_contenu">'.$tabstring.'<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'.$menu_array[$i]['titre'].'</a></div>';
} }
else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED))
{ {
print '<div class="menu_contenu">'.$tabstring.'<font class="vsmenudisabled">'.$menu_array[$i]['titre'].'</font></div>'; print '<div class="menu_contenu">'.$tabstring.'<font class="vsmenudisabled">'.$menu_array[$i]['titre'].'</font></div>';
} }
} }
// If next is a new block or end // If next is a new block or end
if (empty($menu_array[$i+1]['level'])) if (empty($menu_array[$i+1]['level']))
{ {
print '<div class="menu_end"></div>'."\n"; print '<div class="menu_end"></div>'."\n";
print "</div><!-- end section content -->\n"; print "</div><!-- end section content -->\n";
print "</div><!-- end blockvmenu pair/impair -->\n"; print "</div><!-- end blockvmenu pair/impair -->\n";
} }
} }
}
return count($menu_array); return count($menu_array);
} }
@ -332,7 +329,9 @@ function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexterna
$found=0; $found=0;
foreach($tmploops as $tmploop) foreach($tmploops as $tmploop)
{ {
if (in_array($tmploop, $listofmodulesforexternal)) { $found++; break; } if (in_array($tmploop, $listofmodulesforexternal)) {
$found++; break;
}
} }
if (! $found) return 0; // Entry is for menus all excluded to external users if (! $found) return 0; // Entry is for menus all excluded to external users
} }

File diff suppressed because it is too large Load Diff

View File

@ -98,7 +98,7 @@ class MenuManager
/** /**
* Show menu * Show menu
* *
* @param string $mode 'top' or 'left' * @param string $mode 'top', 'left', 'jmobile'
* @return int Number of menu entries shown * @return int Number of menu entries shown
*/ */
function showmenu($mode) function showmenu($mode)
@ -116,6 +116,7 @@ class MenuManager
$res='ErrorBadParameterForMode'; $res='ErrorBadParameterForMode';
if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu); if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu);
if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu); if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu);
if ($mode == 'jmobile') $res=print_jmobile_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu);
return $res; return $res;
} }

View File

@ -0,0 +1,110 @@
<?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/search_jmobile.php
* \brief File to return search box
*/
//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 style="margin: 40px; text-align: center">'."\n";
print '<center>';
// Define $searchform
if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire)
{
$langs->load("companies");
$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname');
}
if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire)
{
$langs->load("companies");
$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'contactname');
}
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
&& ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE))
{
$langs->load("products");
$searchform.=printSearchForm(DOL_URL_ROOT.'/product/liste.php', DOL_URL_ROOT.'/product/liste.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall');
}
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
&& ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE))
{
$langs->load("products");
$searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/liste.php', DOL_URL_ROOT.'/fourn/product/liste.php', img_object('','product').' '.$langs->trans("SupplierRef"), 'products', 'srefsupplier');
}
if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire)
{
$langs->load("members");
$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/liste.php', DOL_URL_ROOT.'/adherents/liste.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall');
}
// Execute hook printSearchForm
$parameters=array();
$searchform.=$hookmanager->executeHooks('printSearchForm',$parameters); // Note that $action and $object may have been modified by some hooks
print "\n";
print "<!-- Begin SearchForm -->\n";
print '<div id="blockvmenusearch" class="blockvmenusearch">'."\n";
print $searchform;
print '</div>'."\n";
print "<!-- End SearchForm -->\n";
print '</center>';
print '</body></html>'."\n";
$db->close();
?>

View File

@ -89,8 +89,8 @@ $(document).ready(function () {
<input type="hidden" name="dst_second" id="dst_second" value="" /> <input type="hidden" name="dst_second" id="dst_second" value="" />
<input type="hidden" name="screenwidth" id="screenwidth" value="" /> <input type="hidden" name="screenwidth" id="screenwidth" value="" />
<input type="hidden" name="screenheight" id="screenheight" value="" /> <input type="hidden" name="screenheight" id="screenheight" value="" />
<input type="hidden" name="dol_hide_topmenu" id="dol_hide_topmenu" value="" /> <input type="hidden" name="dol_hide_topmenu" id="dol_hide_topmenu" value="<?php echo $dol_hide_topmenu; ?>" />
<input type="hidden" name="dol_hide_leftmenu" id="dol_hide_leftmenu" value="" /> <input type="hidden" name="dol_hide_leftmenu" id="dol_hide_leftmenu" value="<?php echo $dol_hide_leftmenu; ?>" />
<table class="login_table_title" summary="<?php echo dol_escape_htmltag($title); ?>" cellpadding="0" cellspacing="0" border="0" align="center"> <table class="login_table_title" summary="<?php echo dol_escape_htmltag($title); ?>" cellpadding="0" cellspacing="0" border="0" align="center">
<tr class="vmenu"><td align="center"><?php echo $title; ?></td></tr> <tr class="vmenu"><td align="center"><?php echo $title; ?></td></tr>

File diff suppressed because one or more lines are too long

View File

@ -28,12 +28,10 @@ define('NOCSRFCHECK',1); // This is login page. We must be able to go on it from
require 'main.inc.php'; require 'main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// If not defined, we select menu "home" // If not defined, we select menu "home"
$_GET['mainmenu']=GETPOST('mainmenu', 'alpha')?GETPOST('mainmenu', 'alpha'):'home'; $_GET['mainmenu']=GETPOST('mainmenu', 'alpha')?GETPOST('mainmenu', 'alpha'):'home';
$action=GETPOST('action'); $action=GETPOST('action');
$hookmanager->initHooks(array('index')); $hookmanager->initHooks(array('index'));
@ -54,28 +52,14 @@ if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_IN
* View * View
*/ */
// If smartphone mode, we do not show main page, we show only menu // If smartphone mode, we do not show main page, we show only menu. TODO Remove this
if (preg_match('/^smartphone/',$conf->smart_menu) && ! empty($conf->browser->phone)) if (preg_match('/^smartphone/',$conf->smart_menu) && ! empty($conf->browser->phone))
{ {
$limitmenuto=GETPOST('limitmenuto')?GETPOST('limitmenuto'):0;
$limitmenuto=1; // A virer
// Load the smartphone menu manager
$result=@include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu;
if (! $result) // If failed to include, we try with standard
{
$conf->smart_menu='smartphone_backoffice.php';
include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu;
}
$menusmart = new MenuSmart($db, $user->societe_id?1:0);
include_once DOL_DOCUMENT_ROOT.'/theme/phones/smartphone/tpl/menu.tpl.php'; include_once DOL_DOCUMENT_ROOT.'/theme/phones/smartphone/tpl/menu.tpl.php';
exit; exit;
} }
llxHeader('',$langs->trans("HomeArea"));
llxHeader();
print_fiche_titre($langs->trans("HomeArea")); print_fiche_titre($langs->trans("HomeArea"));

View File

@ -920,7 +920,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
if (! defined('DISABLE_JQUERY') && ! $disablejs && $conf->use_javascript_ajax) if (! defined('DISABLE_JQUERY') && ! $disablejs && $conf->use_javascript_ajax)
{ {
print '<!-- Includes for JQuery (Ajax library) -->'."\n"; print '<!-- Includes CSS for JQuery (Ajax library) -->'."\n";
$jquerytheme = 'smoothness'; $jquerytheme = 'smoothness';
if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
if (constant('JS_JQUERY_UI')) print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery if (constant('JS_JQUERY_UI')) print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
@ -951,7 +951,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
} }
} }
print '<!-- Includes for Dolibarr, modules or specific pages-->'."\n"; print '<!-- Includes CSS for Dolibarr theme -->'."\n";
// Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php' // Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
$themepath=dol_buildpath((empty($conf->global->MAIN_FORCETHEMEDIR)?'':$conf->global->MAIN_FORCETHEMEDIR).$conf->css,1); $themepath=dol_buildpath((empty($conf->global->MAIN_FORCETHEMEDIR)?'':$conf->global->MAIN_FORCETHEMEDIR).$conf->css,1);
$themesubdir=''; $themesubdir='';
@ -982,7 +982,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
foreach($filescss as $cssfile) foreach($filescss as $cssfile)
{ {
// cssfile is a relative path // cssfile is a relative path
print '<!-- Added by module '.$modcss. '-->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1); print '<!-- Includes CSS added by module '.$modcss. '-->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used. // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam; if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
print '">'."\n"; print '">'."\n";
@ -994,7 +994,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
{ {
foreach($arrayofcss as $cssfile) foreach($arrayofcss as $cssfile)
{ {
print '<!-- Added by page -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1); print '<!-- Includes CSS added by page -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters and browser cache is not used. // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters and browser cache is not used.
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam; if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
print '">'."\n"; print '">'."\n";
@ -1142,14 +1142,14 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
foreach($filesjs as $jsfile) foreach($filesjs as $jsfile)
{ {
// jsfile is a relative path // jsfile is a relative path
print '<!-- Added by module '.$modjs. '-->'."\n".'<script type="text/javascript" src="'.dol_buildpath($jsfile,1).'"></script>'."\n"; print '<!-- Include JS added by module '.$modjs. '-->'."\n".'<script type="text/javascript" src="'.dol_buildpath($jsfile,1).'"></script>'."\n";
} }
} }
} }
// JS forced by page in top_htmlhead (relative url starting with /) // JS forced by page in top_htmlhead (relative url starting with /)
if (is_array($arrayofjs)) if (is_array($arrayofjs))
{ {
print '<!-- Includes JS specific to page -->'."\n"; print '<!-- Includes JS added by page -->'."\n";
foreach($arrayofjs as $jsfile) foreach($arrayofjs as $jsfile)
{ {
if (preg_match('/^http/i',$jsfile)) if (preg_match('/^http/i',$jsfile))

View File

@ -188,7 +188,7 @@ print '*/'."\n";
/* ============================================================================== */ /* ============================================================================== */
body { body {
<?php if (GETPOST("optioncss") == 'print') { ?> <?php if (GETPOST("optioncss") == 'print' || ! empty($conf->browser->phone)) { ?>
background-color: #FFFFFF; background-color: #FFFFFF;
<?php } else { ?> <?php } else { ?>
background: <?php print $colorbackbody; ?>; background: <?php print $colorbackbody; ?>;

View File

@ -13,8 +13,18 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Load the smartphone menu manager
$result=@include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu;
if (! $result) // If failed to include, we try with standard
{
$conf->smart_menu='smartphone_menu.php';
include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu;
}
$menusmart = new MenuSmart($db, $user->societe_id?1:0);
top_httphead(); top_httphead();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@ -50,7 +60,7 @@ jQuery(document).bind("mobileinit", function(){
</ul> </ul>
--> -->
<?php $menusmart->showmenu($limitmenuto); ?> <?php $menusmart->showmenu(1); ?>
</div><!-- /content --> </div><!-- /content -->