New: a specialized menu is now used when using smartphones

This commit is contained in:
Laurent Destailleur 2011-02-16 19:59:16 +00:00
parent a903d9c9c7
commit a8f9a9d0c6
22 changed files with 288 additions and 242 deletions

View File

@ -5,6 +5,7 @@ $Id$
***** ChangeLog for 3.1 compared to 3.0 *****
For users:
- New: A specialized menu is now used when using smartphones.
- New: Can add information on current user on odt generation
- New: Prefix on third party is not used by default. Hidden option
SOCIETE_USEPREFIX can restore old feature.

View File

@ -164,18 +164,15 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
print '</tr>';
// Menu smartphone
if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
{
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMenuSmartphoneManager").'</td>';
print '<td>';
print $htmladmin->select_menu(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED, 'main_menu_smartphone', $dirsmartphone, empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?'':' disabled="disabled"');
print '</td>';
print '<td>';
print $htmladmin->select_menu(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED, 'main_menufront_smartphone', $dirsmartphone, empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?'':' disabled="disabled"');
print '</td>';
print '</tr>';
}
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMenuSmartphoneManager").'</td>';
print '<td>';
print $htmladmin->select_menu(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED, 'main_menu_smartphone', array($dirtop,$dirsmartphone), empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?'':' disabled="disabled"');
print '</td>';
print '<td>';
print $htmladmin->select_menu(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED, 'main_menufront_smartphone', array($dirtop,$dirsmartphone), empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?'':' disabled="disabled"');
print '</td>';
print '</tr>';
print '</table>';

View File

@ -31,7 +31,7 @@
/**
* \class Conf
* \brief Classe de stockage de la config courante
* \brief Class to stock current configuration
*/
class Conf
{
@ -207,8 +207,8 @@ class Conf
// 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="iphone_backoffice.php";
if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE="iphone_frontoffice.php";
if (empty($this->global->MAIN_MENU_SMARTPHONE)) $this->global->MAIN_MENU_SMARTPHONE="smartphone_backoffice.php";
if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE="smartphone_frontoffice.php";
// Variable globales LDAP
if (empty($this->global->LDAP_FIELD_FULLNAME)) $this->global->LDAP_FIELD_FULLNAME='';
@ -426,8 +426,26 @@ class Conf
// For backward compatibility
$this->produit=$this->product;
}
// Define menu manager in setup
if (empty($user->societe_id)) // If internal user or not defined
{
$this->top_menu=(empty($this->global->MAIN_MENU_STANDARD_FORCED)?$this->global->MAIN_MENU_STANDARD:$this->global->MAIN_MENU_STANDARD_FORCED);
$this->smart_menu=(empty($this->global->MAIN_MENU_SMARTPHONE_FORCED)?$this->global->MAIN_MENU_SMARTPHONE:$this->global->MAIN_MENU_SMARTPHONE_FORCED);
// For backward compatibility
if ($this->top_menu == 'eldy.php') $this->top_menu='eldy_backoffice.php';
if ($this->top_menu == 'rodolphe.php') $this->top_menu='eldy_backoffice.php';
}
else // If external user
{
$this->top_menu=(empty($this->global->MAIN_MENUFRONT_STANDARD_FORCED)?$this->global->MAIN_MENUFRONT_STANDARD:$this->global->MAIN_MENUFRONT_STANDARD_FORCED);
$this->smart_menu=(empty($this->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$this->global->MAIN_MENUFRONT_SMARTPHONE:$this->global->MAIN_MENUFRONT_SMARTPHONE_FORCED);
// For backward compatibility
if ($this->top_menu == 'eldy.php') $this->top_menu='eldy_frontoffice.php';
if ($this->top_menu == 'rodolphe.php') $this->top_menu='eldy_frontoffice.php';
}
}
}
?>

View File

@ -126,7 +126,7 @@ class FormAdmin
* Return list of available menus (eldy_backoffice, ...)
* @param selected Preselected menu value
* @param htmlname Name of html select
* @param dirmenu Directory to scan
* @param dirmenu Directory to scan or array of directories to scan
* @param moreattrib More attributes on html select tag
*/
function select_menu($selected='', $htmlname, $dirmenu, $moreattrib='')
@ -138,39 +138,44 @@ class FormAdmin
$menuarray=array();
foreach ($conf->file->dol_document_root as $dirroot)
{
$dir=$dirroot.$dirmenu;
if (is_dir($dir))
if (is_array($dirmenu)) $dirmenus=$dirmenu;
else $dirmenus=array($dirmenu);
foreach($dirmenus as $dirtoscan)
{
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
if (preg_match('/lib\.php$/i',$file)) continue; // We exclude library files
$filelib=preg_replace('/\.php$/i','',$file);
$prefix='';
if (preg_match('/^eldy|^iphone/i',$file)) $prefix='0'; // 0=Recommanded, 1=Experimental, 2=Other
else $prefix='2';
$dir=$dirroot.$dirtoscan;
if (is_dir($dir))
{
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
if (preg_match('/lib\.php$/i',$file)) continue; // We exclude library files
$filelib=preg_replace('/\.php$/i','',$file);
$prefix='';
if (preg_match('/^eldy|^smartphone/i',$file)) $prefix='0'; // 0=Recommanded, 1=Experimental, 2=Other
else $prefix='2';
if ($file == $selected)
{
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'" selected="selected">'.$filelib.'</option>';
}
else
{
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'">'.$filelib.'</option>';
}
}
}
closedir($handle);
}
if ($file == $selected)
{
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'" selected="selected">'.$filelib.'</option>';
}
else
{
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'">'.$filelib.'</option>';
}
}
}
closedir($handle);
}
}
}
}
ksort($menuarray);
// Affichage liste deroulante des menus
// Output combo list of menus
print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
$oldprefix='';
foreach ($menuarray as $key => $val)
@ -202,7 +207,8 @@ class FormAdmin
{
global $langs,$conf;
$expdevmenu=array('iphone_backoffice.php','iphone_frontoffice.php'); // Menu to disable if $conf->global->MAIN_FEATURES_LEVEL is not set
//$expdevmenu=array('smartphone_backoffice.php','smartphone_frontoffice.php'); // Menu to disable if $conf->global->MAIN_FEATURES_LEVEL is not set
$expdevmenu=array();
$menuarray=array();

View File

@ -26,7 +26,7 @@
/**
* \class Smartphone
* \brief Classe de gestion des smartphones
* \brief Class to manage Smartphones
*/
class Smartphone {
@ -41,52 +41,25 @@ class Smartphone {
* Constructor for class
* @param DB Handler acces base de donnees
*/
function Smartphone($DB)
function Smartphone($DB,$phone)
{
$this->db = $DB;
}
/**
* Get template directory
*/
function getTemplateDir()
{
// iWebKit template
if (preg_match('/android|blackberry|iphone|maemo/i',$this->phone))
{
$this->theme = 'default';
$this->template_dir=DOL_DOCUMENT_ROOT."/theme/phones/smartphone/tpl/";
}
// Special template
elseif (file_exists(DOL_DOCUMENT_ROOT."/theme/phones/".$this->phone))
{
$this->theme = 'default';
$this->template_dir=DOL_DOCUMENT_ROOT."/theme/phones/".$this->phone."/tpl/";
}
// Default template
else
{
$this->template_dir=DOL_DOCUMENT_ROOT."/theme/phones/others/tpl/";
}
}
$dirt='others'; // default
/**
* Show HTML header
* @param title Web page title
*/
function smartheader($type='default')
{
global $conf;
if (preg_match('/android|blackberry|iphone|maemo/i',$phone)) // iWebKit template
{
$this->theme = 'default';
$dirt='smartphone';
}
elseif (file_exists(DOL_DOCUMENT_ROOT."/theme/phones/".$phone)) // Special template
{
$this->theme = 'default';
$dirt=$phone;
}
if ($type == 'default') include_once($this->template_dir.'header.tpl.php');
}
/**
* Show HTML footer
*/
function smartfooter()
{
include_once($this->template_dir.'footer.tpl.php');
$this->phone=$phone;
$this->template_dir=DOL_DOCUMENT_ROOT.'/theme/phones/'.$dirt.'/tpl/';
}
/**
@ -96,7 +69,7 @@ class Smartphone {
{
global $conf, $langs;
if (! $conf->smart_menu) $conf->smart_menu ='iphone_backoffice.php';
if (! $conf->smart_menu) $conf->smart_menu ='smartphone_backoffice.php';
$smart_menu=$conf->smart_menu;
if (GETPOST('top_menu')) $smart_menu=GETPOST('top_menu');
@ -104,7 +77,7 @@ class Smartphone {
$result=@include_once(DOL_DOCUMENT_ROOT ."/includes/menus/smartphone/".$smart_menu);
if (! $result) // If failed to include, we try with standard
{
$conf->smart_menu='iphone_backoffice.php';
$conf->smart_menu='smartphone_backoffice.php';
include_once(DOL_DOCUMENT_ROOT ."/includes/menus/smartphone/".$smart_menu);
}
$menusmart = new MenuSmart($this->db);

View File

@ -92,7 +92,7 @@ function donnefocus() {
<?php if ($captcha) { ?>
<tr><td valign="middle" nowrap="nowrap"> &nbsp; <b><?php echo $langs->trans('SecurityCode'); ?></b></td>
<td valign="top" nowrap="nowrap" align="left" class="none">
<td valign="middle" nowrap="nowrap" align="left" class="none">
<table style="width: 100px;"><tr>
<td><input id="securitycode" class="flat" type="text" size="6" maxlength="5" name="code" tabindex="3"></td>

View File

@ -19,30 +19,30 @@
*/
/**
* \file htdocs/includes/menus/smartphone/iphone.lib.php
* \brief Library for file iphone menus
* \file htdocs/includes/menus/smartphone/smartphone.lib.php
* \brief Library for file smartphone menus
* \version $Id$
*/
/**
* Core function to output top menu iphone
* Core function to output top menu smartphone
*
* @param $db
* @param $atarget
* @param $type_user 0=Internal,1=External,2=All
*/
function print_iphone_menu($db,$atarget,$type_user)
function print_smartphone_menu($db,$atarget,$type_user)
{
require_once(DOL_DOCUMENT_ROOT."/core/class/menubase.class.php");
global $user,$conf,$langs,$dolibarr_main_db_name;
$submenus='';
$menutop = new Menubase($db,'iphone','top');
$menuleft = new Menubase($db,'iphone','left');
$tabMenu = $menutop->menuTopCharger($type_user, '', 'iphone');
$menutop = new Menubase($db,'smartphone','top');
$menuleft = new Menubase($db,'smartphone','left');
$tabMenu = $menutop->menuTopCharger($type_user, '', 'smartphone');
$numTabMenu = count($tabMenu);
print_start_menu_array();
@ -64,12 +64,12 @@ function print_iphone_menu($db,$atarget,$type_user)
$title=$tabMenu[$i]['titre'];
// To remove & and special chars: $title=dol_string_unaccent(dol_string_nospecial(dol_html_entity_decode($tabMenu[$i]['titre'],ENT_QUOTES,'UTF-8'),'',array('&')));
print_text_menu_entry($title);
$newmenu = new Menu();
$leftmenu = $menuleft->menuLeftCharger($newmenu,$tabMenu[$i]['mainmenu'],'',($user->societe_id?1:0),'iphone');
$leftmenu = $menuleft->menuLeftCharger($newmenu,$tabMenu[$i]['mainmenu'],'',($user->societe_id?1:0),'smartphone');
$menus = $leftmenu->liste;
//var_dump($menus);
print '<ul>';
if (is_array($menus) && !empty($menus))
{
@ -89,11 +89,11 @@ function print_iphone_menu($db,$atarget,$type_user)
print_text_menu_entry($title);
if (empty($menus[$j+1]['level'])) print '</a>';
}
if ($menus[$j]['level'] > 0)
{
if ($menus[$j-1]['level'] == 0) print_start_submenu_array();
$url=dol_buildpath($menus[$j]['url'],1);
$url=preg_replace('/&amp.*/i','',$url);
print_start_menu_entry();
@ -103,10 +103,10 @@ function print_iphone_menu($db,$atarget,$type_user)
print_text_menu_entry($title);
print '</a>';
print_end_menu_entry();
if (empty($menus[$j+1]['level'])) print_end_menu();
}
if (empty($menus[$j+1]['level'])) print_end_menu_entry();
}
}
@ -115,7 +115,7 @@ function print_iphone_menu($db,$atarget,$type_user)
}
}
}
print_end_menu();
print "\n";
}

View File

@ -18,19 +18,19 @@
*/
/**
* \file htdocs/includes/menus/smartphone/iphone_backoffice.php
* \brief Gestionnaire nomme iphone du menu smartphone
* \file htdocs/includes/menus/smartphone/smartphone_backoffice.php
* \brief Gestionnaire nomme smartphone du menu smartphone
* \version $Id$
*/
/**
* \class MenuSmart
* \brief Class to manage smartphone menu Iphone (for internal users)
* \brief Class to manage smartphone menu smartphone (for internal users)
*/
class MenuSmart {
var $require_left=array("iphone_backoffice"); // Si doit etre en phase avec un gestionnaire de menu particulier
var $require_left=array("smartphone_backoffice"); // Si doit etre en phase avec un gestionnaire de menu particulier
var $hideifnotallowed=0; // Put 0 for back office menu, 1 for front office menu
var $atarget=""; // Valeur du target a utiliser dans les liens
@ -50,9 +50,9 @@ class MenuSmart {
*/
function showmenu()
{
require_once(DOL_DOCUMENT_ROOT.'/includes/menus/smartphone/iphone.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/menus/smartphone/smartphone.lib.php');
print_iphone_menu($this->db,$this->atarget,$this->hideifnotallowed);
print_smartphone_menu($this->db,$this->atarget,$this->hideifnotallowed);
}
}

View File

@ -18,19 +18,19 @@
*/
/**
* \file htdocs/includes/menus/smartphone/iphone_frontoffice.php
* \brief Gestionnaire nomme iphone du menu smartphone
* \file htdocs/includes/menus/smartphone/smartphone_frontoffice.php
* \brief Gestionnaire nomme smartphone du menu smartphone
* \version $Id$
*/
/**
* \class MenuSmart
* \brief Class to manage smartphone menu Iphone (for external users)
* \brief Class to manage smartphone menu smartphone (for external users)
*/
class MenuSmart {
var $require_left=array("iphone_frontoffice"); // Si doit etre en phase avec un gestionnaire de menu particulier
var $require_left=array("smartphone_frontoffice"); // Si doit etre en phase avec un gestionnaire de menu particulier
var $hideifnotallowed=1; // Put 0 for back office menu, 1 for front office menu
var $atarget=""; // Valeur du target a utiliser dans les liens
@ -50,9 +50,9 @@ class MenuSmart {
*/
function showmenu()
{
require_once(DOL_DOCUMENT_ROOT.'/includes/menus/smartphone/iphone.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/menus/smartphone/smartphone.lib.php');
print_iphone_menu($this->db,$this->atarget,$this->hideifnotallowed);
print_smartphone_menu($this->db,$this->atarget,$this->hideifnotallowed);
}
}

View File

@ -46,16 +46,6 @@ if (! isset($_GET["mainmenu"])) $_GET["mainmenu"]="home";
* View
*/
// Smartphone
if (class_exists('Smartphone'))
{
// Template directory
$smartphone->getTemplateDir();
$smartphone->title = $langs->trans("Home");
$smartphone->smartmenu();
exit;
}
// Check if company name is defined (first install)
if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_NOM))
{
@ -63,6 +53,18 @@ if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_IN
exit;
}
// If smartphone mode, we do no show main page, we show only menu
if (preg_match('/^smartphone/',$conf->smart_menu) && isset($conf->browser->phone))
{
include_once(DOL_DOCUMENT_ROOT.'/core/class/smartphone.class.php');
$smartphone = new Smartphone($db,$conf->browser->phone); // This class is only to know template dir according to phone type
$smartphone->title = $langs->trans("Home");
$smartphone->smartmenu();
exit;
}
llxHeader();
print_fiche_titre($langs->trans("HomeArea"));

View File

@ -62,8 +62,8 @@ insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_S
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENU_STANDARD','eldy_backoffice.php','chaine','Module de gestion de la barre de menu pour utilisateurs internes',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENUFRONT_STANDARD','eldy_frontoffice.php','chaine','Module de gestion de la barre de menu pour utilisateurs externes',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENU_SMARTPHONE','iphone_backoffice.php','chaine','Module de gestion de la barre de menu smartphone pour utilisateurs internes',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENUFRONT_SMARTPHONE','iphone_frontoffice.php','chaine','Module de gestion de la barre de menu smartphone pour utilisateurs externes',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENU_SMARTPHONE','eldy_backoffice.php','chaine','Module de gestion de la barre de menu smartphone pour utilisateurs internes',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENUFRONT_SMARTPHONE','eldy_frontoffice.php','chaine','Module de gestion de la barre de menu smartphone pour utilisateurs externes',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_THEME','eldy','chaine','Default theme',0);

View File

@ -57,10 +57,11 @@ function dol_loginfunction($langs,$conf,$mysoc)
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
// Select templates
if (class_exists('Smartphone'))
if (preg_match('/^smartphone/',$conf->smart_menu) && isset($conf->browser->phone))
{
// Template directory
$smartphone->getTemplateDir();
include_once(DOL_DOCUMENT_ROOT.'/core/class/smartphone.class.php');
$smartphone = new Smartphone($db,$conf->browser->phone); // This class is only to know template dir according to phone type
$smartphone->title = $title;
$template_dir = $smartphone->template_dir;
}

View File

@ -264,14 +264,6 @@ if (sizeof($conf->need_smarty) > 0)
}
}
// Init Smartphone (for dev only)
if ($conf->global->MAIN_FEATURES_LEVEL == 2 && isset($conf->browser->phone))
{
include_once(DOL_DOCUMENT_ROOT."/core/class/smartphone.class.php");
$smartphone = new Smartphone($db);
$smartphone->phone = $conf->browser->phone;
}
/*
* Phase authentication / login
@ -666,23 +658,6 @@ if (! empty($_GET["theme"]))
$conf->css = "/theme/".$conf->theme."/style.css.php";
}
// Define menu manager to use
if (empty($user->societe_id)) // If internal user or not defined
{
$conf->top_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED);
$conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED);
// For backward compatibility
if ($conf->top_menu == 'eldy.php') $conf->top_menu='eldy_backoffice.php';
if ($conf->top_menu == 'rodolphe.php') $conf->top_menu='eldy_backoffice.php';
}
else // If external user
{
$conf->top_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
$conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED);
// For backward compatibility
if ($conf->top_menu == 'eldy.php') $conf->top_menu='eldy_frontoffice.php';
if ($conf->top_menu == 'rodolphe.php') $conf->top_menu='eldy_frontoffice.php';
}
if (! defined('NOLOGIN'))
{
@ -704,6 +679,7 @@ if (! defined('NOLOGIN'))
$user->getrights();
}
dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]);
//Another call for easy debugg
//dol_syslog("Access to ".$_SERVER["PHP_SELF"].' GET='.join(',',array_keys($_GET)).'->'.join(',',$_GET).' POST:'.join(',',array_keys($_POST)).'->'.join(',',$_POST));
@ -770,8 +746,8 @@ if (! function_exists("llxHeader"))
{
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring);
left_menu('', $help_url, '', '', 1);
main_area();
left_menu('', $help_url, '', '', 1, $title);
main_area($title);
}
}
@ -1075,9 +1051,9 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
// Show menu
$menutop = new MenuTop($db);
$menutop->atarget=$target;
$menutop->showmenu();
$menutop->showmenu(); // This contains a \n
print "\n</div>\n";
print "</div>\n";
// Link to login card
$loginhtmltext=''; $logintext='';
@ -1180,6 +1156,8 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
print "<!-- End top horizontal menu -->\n";
if (! $conf->use_javascript_ajax || ! $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) print '<table width="100%" class="notopnoleftnoright" summary="leftmenutable" id="undertopmenu"><tr>';
}
@ -1192,16 +1170,15 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
* @param moresearchform Search Form Permanent Supplemental
* @param menu_array_after Table of menu entries to show after entries of menu handler
* @param leftmenuwithoutmainarea Must be set to 1. 0 by default for backward compatibility with old modules.
* @param title Title of web page
*/
function left_menu($menu_array_before, $helppagename='', $moresearchform='', $menu_array_after='', $leftmenuwithoutmainarea=0)
function left_menu($menu_array_before, $helppagename='', $moresearchform='', $menu_array_after='', $leftmenuwithoutmainarea=0, $title='')
{
global $user, $conf, $langs, $db;
$searchform='';
$bookmarks='';
// print '<div class="vmenuplusfiche">'."\n";
if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) print "\n".'<div class="ui-layout-west"> <!-- Begin left layout -->'."\n";
else print '<td class="vmenu" valign="top">';
@ -1262,7 +1239,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
}
// Left column
print '<!-- Begin left vertical menu '.$left_menu.' -->'."\n";
print '<!-- Begin left area - menu '.$left_menu.' -->'."\n";
print '<div class="vmenu">'."\n";
@ -1351,17 +1328,19 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) print '</div> <!-- End left layout -->'."\n";
else print '</td>';
print "\n".'<!-- End of left column, begin right area -->'."\n\n";
// print '</div>'."\n";
// print '<div class="vmenuplusfiche">'."\n";
print "\n";
print '<!-- End of left area -->'."\n";
print "\n";
print '<!-- Begin right area -->'."\n";
if (empty($leftmenuwithoutmainarea)) main_area();
if (empty($leftmenuwithoutmainarea)) main_area($title);
}
/**
* Begin main area
*/
function main_area()
function main_area($title='')
{
global $conf, $langs;
@ -1371,12 +1350,26 @@ function main_area()
print '<table width="100%" class="notopnoleftnoright" summary="centermenutable" id="undertopmenu"><tr>';
}
print '<td valign="top"><!-- Begin right area --> '."\n";
print '<td valign="top">'."\n";
print "\n";
print '<div class="fiche"> <!-- begin div class="fiche" -->'."\n";
if (preg_match('/^smartphone/',$conf->smart_menu) && isset($conf->browser->phone))
{
print '<div data-role="page"> <!-- begin div data-role="page" -->';
print '<div data-role="header" data-nobackbtn="false" data-theme="b">';
print '<div id="dol-homeheader">'."\n";
$appli='Dolibarr';
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
print $appli;
print '</div>'."\n";
print '</div>'."\n";
print "\n";
print '<div data-role="content"> <!-- begin div data-role="content" -->'."\n";
}
if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) print info_admin($langs->trans("WarningYouAreInMaintenanceMode",$conf->global->MAIN_ONLY_LOGIN_ALLOWED));
}
@ -1420,12 +1413,12 @@ function getHelpParamFor($helppagename,$langs)
/**
* \brief Show a search area
* \param urlaction Url post
* \param urlobject Url of the link under the search box
* \param title Title search area
* \param htmlmodesearch 'search'
* \param htmlinputname Field Name input form
* Show a search area
* @param urlaction Url post
* @param urlobject Url of the link under the search box
* @param title Title search area
* @param htmlmodesearch 'search'
* @param htmlinputname Field Name input form
*/
function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch='search',$htmlinputname)
{
@ -1448,6 +1441,7 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch='search',$
/**
* Return list of login method of third party module.
* @return array
* TODO Move this into security.lib.php
*/
function getLoginMethod()
{
@ -1500,9 +1494,9 @@ function getLoginMethod()
}
/**
* \brief Show HTML footer DIV + BODY + HTML
* \remarks Close 2 div
* \param foot A text to add in HTML generated page
* Show HTML footer
* Close div /DIV data-role=page + /DIV class=fiche + /DIV /DIV main layout + /BODY + /HTML
* @param foot A text to add in HTML generated page
*/
if (! function_exists("llxFooter"))
{
@ -1529,12 +1523,19 @@ if (! function_exists("llxFooter"))
define("MAIN_CORE_ERROR",0);
}
print "\n\n".'</div> <!-- end div class="fiche" -->'."\n";
print "\n\n";
if (preg_match('/^smartphone/',$conf->smart_menu) && isset($conf->browser->phone))
{
print '</div> <!-- end div data-role="content" -->'."\n";
print '</div> <!-- end div data-role="page" -->'."\n";
}
print '</div> <!-- end div class="fiche" -->'."\n";
// print "\n".'</div> <!-- end div class="vmenuplusfiche" -->'."\n";
print "\n".'</td></tr></table> <!-- end right area -->'."\n";
if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) print '</div></div> <!-- end main layout -->'."\n";
if (! empty($_SERVER['DOL_TUNING']))
{
$micro_end_time=dol_microtime_float(true);
@ -1562,6 +1563,7 @@ if (! function_exists("llxFooter"))
if (defined('XDEBUGCOVERAGE')) { var_dump(xdebug_get_code_coverage()); }
}
// If there is some logs in buffer to show
if (sizeof($conf->logbuffer))
{
@ -1581,6 +1583,7 @@ if (! function_exists("llxFooter"))
if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER."\n";
print "</body>\n";
print "</html>\n";
}

View File

@ -5,6 +5,16 @@
</head>
<body>
<div data-role="page">
<!-- <div data-role="header" data-theme="b">
<h1>Introduction</h1>
<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
</div>
-->
<div data-role="content">
<h1>Error</h1>
<br>
@ -14,5 +24,9 @@
<?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.$_SERVER["HTTP_REFERER"].'.':''; ?>
<hr>
</div>
</div>
</body>
</html>

View File

@ -5,6 +5,16 @@
</head>
<body>
<div data-role="page">
<!-- <div data-role="header" data-theme="b">
<h1>Introduction</h1>
<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
</div>
-->
<div data-role="content">
<h2>Error</h2>
<br>
@ -14,5 +24,9 @@
<?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.$_SERVER["HTTP_REFERER"].'.':''; ?>
<hr>
</div>
</div>
</body>
</html>

View File

@ -43,9 +43,12 @@ else header('Cache-Control: no-cache');
?>
#dol-homeheader { height: 40px; font-size: 16px; }
.ui-header { height: 40px; font-size: 16px; }
/*.ui-mobile #dol-home { background: #e5e5e5 url(<?php echo DOL_URL_ROOT.'/theme/phones/smartphone/theme/default/menu/pinstripes.png'; ?>) top center repeat-x; }*/
.ui-mobile #dol-home { background: #e5e5e5 }
.ui-mobile #dol-homeheader { padding: 5px 5px 0; text-align: center }
.ui-mobile #dol-homeheader { padding: 10px 5px 0; text-align: center }
.ui-mobile #dol-homeheader h1 { margin: 0 0 10px; }
.ui-mobile #dol-homeheader p { margin: 0; }

View File

@ -17,21 +17,15 @@
*
* $Id$
*/
header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client);
?>
<!DOCTYPE html>
<!-- BEGIN HEADER SMARTPHONE TEMPLATE -->
<html>
<head>
<title><?php echo $this->title; ?></title>
<title><?php echo $title; ?></title>
<meta name="robots" content="noindex,nofollow" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="apple-touch-icon" href="<?php echo DOL_URL_ROOT.'/theme/phones/smartphone/theme/'.$this->theme.'/thumbs/homescreen.png'; ?>" />
<link rel="apple-touch-icon" href="<?php echo DOL_URL_ROOT.'/theme/phones/smartphone/theme/'.$conf->theme.'/img/homescreen.png'; ?>" />
<link rel="stylesheet" href="<?php echo DOL_URL_ROOT.'/includes/jquery/mobile/jquery.mobile-latest.min.css'; ?>" />
<link rel="stylesheet" href="<?php echo DOL_URL_ROOT.'/theme/phones/smartphone/theme/default/default.css.php'; ?>" />
<script type="text/javascript" src="<?php echo DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min.js'; ?>"></script>
@ -40,4 +34,4 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client);
<body>
<!-- END HEADER SMARTPHONE TEMPLATE -->
<!-- END HEADER SMARTPHONE TEMPLATE -->

View File

@ -17,67 +17,71 @@
*
* $Id$
*/
$smartphone->smartheader();
include('header.tpl.php');
?>
<!-- START LOGIN SMARTPHONE TEMPLATE -->
<div data-role="page" id="dol-home" data-theme="b">
<div data-role="header" data-nobackbtn="true" data-theme="b">
<div id="dol-homeheader">
<img src="<?php echo $dol_url_root.'/theme/phones/smartphone/theme/'.$smartphone->theme.'/img/dolibarr.png'; ?>">
</div>
<div id="dol-homeheader">
<?php
$appli='Dolibarr';
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
print $appli;
?>
</div>
</div>
<div data-role="content">
<form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<input type="hidden" name="loginfunction" value="loginfunction" />
<div data-role="fieldcontain">
<label for="username"><?php echo $langs->trans('Login'); ?></label>
<input type="text" name="username" id="username" value="<?php echo $login; ?>" />
<br><label for="password"><?php echo $langs->trans('Password'); ?></label>
<input type="password" name="password" id="password" value="<?php echo $password; ?>" />
<?php if ($select_entity) { ?>
<br><label for="entity" class="select"><?php echo $langs->trans('Entity'); ?></label>
<?php echo $select_entity; ?>
<?php } ?>
<?php if ($captcha) { ?>
<label for="securitycode"><?php echo $langs->trans('SecurityCode'); ?></label>
<input type="text" id="securitycode" name="securitycode" />
<div align="center"><img src="<?php echo $dol_url_root.'/lib/antispamimage.php'; ?>" border="0" width="128" height="36" /></div>
<?php } ?>
</div>
<input type="submit" data-theme="b" value="<?php echo $langs->trans('Connection'); ?>" />
</form><br>
</div><!-- /content -->
<?php if ($forgetpasslink || $helpcenterlink) { ?>
<div data-role="footer" data-id="foo1" data-theme="b">
<div data-role="navbar">
<ul>
<li>
<?php if ($forgetpasslink) { ?>
<li><a href="<?php echo 'user/passwordforgotten.php'; ?>" data-icon="gear"><?php echo $langs->trans('PasswordForgotten'); ?></a></li>
<a href="<?php echo $dol_url_root.'/user/passwordforgotten.php'; ?>" data-icon="gear"><?php echo $langs->trans('PasswordForgotten'); ?></a>
<?php } ?>
<?php if ($helpcenterlink) { ?>
<li><a href="<?php echo 'support/index.php'; ?>" data-icon="info"><?php echo $langs->trans('NeedHelpCenter'); ?></a></li>
<?php } ?>
</ul>
</div><!-- /navbar -->
</div><!-- /footer -->
</li>
<li>
<?php if ($helpcenterlink && 1 == 2) { ?>
<a href="<?php echo $dol_url_root.'/support/index.php'; ?>" data-icon="info"><?php echo $langs->trans('NeedHelpCenter'); ?></a>
<?php } ?>
</li>
</ul>
</div>
</div>
<?php } ?>
</div><!-- /page -->
<?php if ($dol_loginmesg) { ?>
@ -85,7 +89,8 @@ $smartphone->smartheader();
alert('<?php echo $dol_loginmesg; ?>');
</script>
<?php } ?>
<!-- END LOGIN SMARTPHONE TEMPLATE -->
<?php $smartphone->smartfooter(); ?>
<?php
include('footer.tpl.php');
?>

View File

@ -17,25 +17,33 @@
*
* $Id$
*/
$this->smartheader();
require('header.tpl.php');
?>
<div data-role="page" data-theme="b" id="dol-home">
<!-- START MENU SMARTPHONE TEMPLATE -->
<div data-role="page" id="dol-home">
<div data-role="header" data-nobackbtn="true" data-theme="b">
<div id="dol-homeheader">
<img src="<?php echo DOL_URL_ROOT.'/theme/phones/smartphone/theme/'.$this->theme.'/img/dolibarr.png'; ?>">
<?php
$appli='Dolibarr';
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
print $appli;
?>
</div>
</div>
<div data-role="content">
<div data-role="content">
<!--
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
<li data-role="list-divider">Overview</li>
<li><a href="http://jquerymobile.com/test/docs/about/intro.html">Intro to jQuery Mobile</a></li>
<li><a href="http://localhost/dolibarrnew/public/error-401.php">Features</a></li>
</ul>
-->
<?php $menusmart->showmenu(); ?>
</div><!-- /content -->
<div data-role="footer" data-theme="b">
<div data-role="navbar">
<ul>
@ -44,9 +52,12 @@ $this->smartheader();
</ul>
</div><!-- /navbar -->
</div><!-- /footer -->
</div><!-- /page -->
<!-- END MENU SMARTPHONE TEMPLATE -->
<?php $this->smartfooter(); ?>
<?php
require('footer.tpl.php');
// $this->smartfooter();
?>

View File

@ -17,7 +17,7 @@
*
* $Id$
*/
$smartphone->smartheader();
include('header.tpl.php');
?>
<!-- BEGIN SMARTPHONE TEMPLATE -->
@ -25,37 +25,39 @@ $smartphone->smartheader();
<div data-role="page" id="dol-home" data-theme="b">
<div data-role="header" data-theme="b" data-position="inline">
<h1><?php echo $langs->trans('Identification'); ?></h1>
<div id="dol-homeheader">
<?php echo $langs->trans('Identification'); ?>
</div>
</div>
<div data-role="content">
<form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<input type="hidden" name="loginfunction" value="buildnewpassword" />
<div data-role="fieldcontain">
<label for="username"><?php echo $langs->trans('Login'); ?></label>
<input type="text" name="username" id="username" value="<?php echo $login; ?>" />
<?php if ($select_entity) { ?>
<label for="entity" class="select"><?php echo $langs->trans('Entity'); ?></label>
<?php echo $select_entity; ?>
<?php } ?>
<?php if ($captcha) { ?>
<label for="securitycode"><?php echo $langs->trans('SecurityCode'); ?></label>
<input type="text" id="securitycode" name="securitycode" />
<div align="center"><img src="<?php echo $dol_url_root.'/lib/antispamimage.php'; ?>" border="0" width="256" height="48" /></div>
<?php } ?>
</div>
<input type="submit" data-theme="b" value="<?php echo $langs->trans('SendByMail'); ?>" />
</form>
</div><!-- /content -->
<div data-role="footer" data-theme="b">
<?php if ($mode == 'dolibarr' || ! $disabled) {
echo $langs->trans('SendNewPasswordDesc');
@ -74,4 +76,6 @@ $smartphone->smartheader();
<!-- END SMARTPHONE TEMPLATE -->
<?php $smartphone->smartfooter(); ?>
<?php
include('footer.tpl.php');
?>

View File

@ -151,10 +151,10 @@ $title='Dolibarr '.DOL_VERSION;
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
// Select templates
if (class_exists('Smartphone'))
if (preg_match('/^smartphone/',$conf->smart_menu) && isset($conf->browser->phone))
{
// Template directory
$smartphone->getTemplateDir();
include_once(DOL_DOCUMENT_ROOT.'/core/class/smartphone.class.php');
$smartphone = new Smartphone($db,$conf->browser->phone); // This class is only to know template dir according to phone type
$smartphone->title = $title;
$template_dir = $smartphone->template_dir;
}
@ -215,7 +215,7 @@ if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $rowspan++;
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY) && ! $disabled)
{
global $db;
$res=dol_include_once('/multicompany/class/actions_multicompany.class.php');
if ($res)
{