diff --git a/ChangeLog b/ChangeLog index 4618529b009..504bd8b5e52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,7 +46,8 @@ For developers: - Add hook getFormMail. - Function plimit of databases drivers accept -1 as value (it means default value set into conf->liste_limit). -- New: Add option dol_hide_topmenu and dol_hide_leftmenu onto login page. +- New: Add option dol_hide_topmenu, dol_hide_leftmenu, dol_optimize_smallscreen, + dol_no_mouse_hover and dol_use_jmobile onto login page (to support different terminal). - New: dol_syslog method accept a suffix to use different log files for log. - New: Type of fields are received by export format handlers. - New: when adding an action, we can define a free code to tag it for a specific need. diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 75b17a6776e..9b83acc0bbd 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -88,8 +88,7 @@ $var=!$var; print ''.$langs->trans("CurrentTheme").''.$conf->theme.''."\n"; $var=!$var; print ''.$langs->trans("CurrentMenuHandler").''; -if (preg_match('/^smartphone/',$conf->smart_menu) && ! empty($conf->browser->phone)) print $conf->smart_menu; -else print $conf->standard_menu; +print $conf->standard_menu; print ''."\n"; print ''; print '
'; diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index fcecbf0a552..76e0068fbd4 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -196,7 +196,7 @@ if ($id > 0) $object->next_prev_filter="te.client in (1,3)"; print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','',''); print ''; - + // Prospect/Customer print ''.$langs->trans('ProspectCustomer').''; print $object->getLibCustProspStatut(); @@ -384,7 +384,7 @@ if ($id > 0) print ''.$object->price_level.""; print ''; } - + // Level of prospect if ($object->client == 2 || $object->client == 3) { @@ -401,7 +401,7 @@ if ($id > 0) print $object->getLibProspLevel(); print ""; print ''; - + // Status print ''.$langs->trans("StatusProsp").''.$object->getLibProspCommStatut(4).''; print ''; @@ -500,8 +500,8 @@ if ($id > 0) while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); - print ""; - print ''.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.''."\n"; + print ""; + print ''.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.''."\n"; if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) { print " ".img_warning(); @@ -751,7 +751,7 @@ if ($id > 0) $objp = $db->fetch_object($resql); $var=!$var; print ""; - print ''; + print ''; $facturestatic->id=$objp->facid; $facturestatic->ref=$objp->facnumber; $facturestatic->type=$objp->type; @@ -790,30 +790,30 @@ if ($id > 0) /* * Barre d'actions */ - print '
'; + print '
'; if (! empty($conf->propal->enabled) && $user->rights->propal->creer) { $langs->load("propal"); - print ''.$langs->trans("AddProp").''; + print ''; } if (! empty($conf->commande->enabled) && $user->rights->commande->creer) { $langs->load("orders"); - print ''.$langs->trans("AddOrder").''; + print ''; } if ($user->rights->contrat->creer) { $langs->load("contracts"); - print ''.$langs->trans("AddContract").''; + print ''; } if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer) { $langs->load("fichinter"); - print ''.$langs->trans("AddIntervention").''; + print ''; } // Add invoice @@ -822,7 +822,7 @@ if ($id > 0) if (! empty($conf->deplacement->enabled)) { $langs->load("trips"); - print ''.$langs->trans("AddTrip").''; + print ''; } if (! empty($conf->facture->enabled)) @@ -834,17 +834,17 @@ if ($id > 0) if (! empty($conf->commande->enabled)) { - if($orders2invoice > 0) print ''.$langs->trans("CreateInvoiceForThisCustomer").''; - else print ''.$langs->trans("CreateInvoiceForThisCustomer").''; + if($orders2invoice > 0) print ''; + else print ''; } - if ($object->client != 0) print ''.$langs->trans("AddBill").''; - else print ''.$langs->trans("AddBill").''; + if ($object->client != 0) print ''; + else print ''; } else { - print ''.$langs->trans("AddBill").''; + print ''; } } } @@ -854,11 +854,11 @@ if ($id > 0) { if ($user->rights->agenda->myactions->create) { - print ''.$langs->trans("AddAction").''; + print ''; } else { - print ''.$langs->trans("AddAction").''; + print ''; } } diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 7ca1b1dd4a2..2bd51b87f98 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -164,7 +164,7 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty" { print ''; // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object - print img_picto($langs->trans("MoveBox",$this->box_id),'grip','class="boxhandle" style="cursor:move;"'); + print img_picto($langs->trans("MoveBox",$this->box_id),'grip','class="boxhandle hideonsmartphone" style="cursor:move;"'); print img_picto($langs->trans("Close",$this->box_id),'close','class="boxclose" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); print ''; } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 2ea053062b0..764438a273c 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -47,9 +47,8 @@ class Conf //! Used to store current css (from theme) public $theme; // Contains current theme ("eldy", "auguria", ...) public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...) - //! Used to store current menu handlers + //! Used to store current menu handler public $standard_menu; - public $smart_menu; public $modules = array(); // List of activated modules public $modules_parts = array('css'=>array(),'js'=>array(),'tabs'=>array(),'triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'sms'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array(),'societe'=>array(),'hooks'=>array(),'dir'=>array()); @@ -64,6 +63,11 @@ class Conf //! Used to store list of entities to use for each element public $entities = array(); + public $dol_hide_topmenu; // Set if we force param dol_hide_topmenu into login url + public $dol_hide_leftmenu; // Set if we force param dol_hide_leftmenu into login url + public $dol_optimize_smallscreen; // Set if we force param dol_optimize_smallscreen into login url or if browser is smartphone + public $dol_no_mouse_hover; // Set if we force param dol_no_mouse_hover into login url or if browser is smartphone + public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url /** diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7d7713b297c..f251df08cb7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -422,8 +422,9 @@ class Form $htmltext = ''; } } - // If info or help with smartphone, show only text - if (! empty($conf->browser->phone)) + + // If info or help with smartphone, show only text (tooltip can't works) + if (! empty($conf->dol_no_mouse_hover)) { if ($type == 'info' || $type == 'help') return $text; } diff --git a/htdocs/core/getmenu_jmobile.php b/htdocs/core/get_menudiv.php similarity index 77% rename from htdocs/core/getmenu_jmobile.php rename to htdocs/core/get_menudiv.php index 988dec4339a..0d9e3c0a54b 100644 --- a/htdocs/core/getmenu_jmobile.php +++ b/htdocs/core/get_menudiv.php @@ -19,8 +19,8 @@ */ /** - * \file htdocs/core/getmenu_jmobile.php - * \brief File to return menu + * \file htdocs/core/get_menudiv.php + * \brief File to return menu into a div tree */ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language @@ -50,26 +50,24 @@ $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); * View */ -// URL http://mydolibarr/core/getmenu_jmobile?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'); +// URL http://mydolibarr/core/get_menudiv.php?dol_use_jmobile=1 can be used for tests +$arrayofjs=array(); +$arrayofcss=array(); top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); print ''."\n"; -if (empty($user->societe_id)) // If internal user or not defined +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 +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; +$file_menu=$conf->standard_menu; if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php if (! class_exists('MenuManager')) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0ade0a627a3..91636c795a8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -321,14 +321,14 @@ function dol_clone($object) * * @param int $size Size we want * @param string $type Type of optimizing: - * '' = function used to define a size for truncation - * 'width' = function is used to define a width + * '' = function used to define a size for truncation + * 'width' = function is used to define a width * @return int New size after optimizing */ function dol_size($size,$type='') { global $conf; - if (empty($conf->browser->phone)) return $size; + if (empty($conf->dol_optimize_smallscreen)) return $size; if ($type == 'width' && $size > 250) return 250; else return 10; } @@ -594,7 +594,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p // Show title $showtitle=1; - if (! empty($conf->browser->phone)) $showtitle=0; + if (! empty($conf->dol_optimize_smallscreen)) $showtitle=0; if (! empty($title) && $showtitle) { $limittitle=30; @@ -767,6 +767,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e { global $conf,$langs; + // Clean parameters $to_gmt=false; $offsettz=$offsetdst=0; if ($tzoutput) @@ -792,36 +793,32 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e } } } - if (! is_object($outputlangs)) $outputlangs=$langs; - - // Si format non defini, on prend $conf->format_date_text_short sinon %Y-%m-%d %H:%M:%S - if (! $format) $format=(isset($conf->format_date_text_short) ? $conf->format_date_text_short : '%Y-%m-%d %H:%M:%S'); + if (! $format) $format='daytextshort'; // Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default. - if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short); - else if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short); - else if ($format == 'hourduration') $format=($outputlangs->trans("FormatHourShortDuration")!="FormatHourShortDuration"?$outputlangs->trans("FormatHourShortDuration"):$conf->format_hour_short_duration); - else if ($format == 'daytext') $format=($outputlangs->trans("FormatDateText")!="FormatDateText"?$outputlangs->trans("FormatDateText"):$conf->format_date_text); - else if ($format == 'daytextshort') $format=($outputlangs->trans("FormatDateTextShort")!="FormatDateTextShort"?$outputlangs->trans("FormatDateTextShort"):$conf->format_date_text_short); - else if ($format == 'dayhour') $format=($outputlangs->trans("FormatDateHourShort")!="FormatDateHourShort"?$outputlangs->trans("FormatDateHourShort"):$conf->format_date_hour_short); - else if ($format == 'dayhoursec') $format=($outputlangs->trans("FormatDateHourSecShort")!="FormatDateHourSecShort"?$outputlangs->trans("FormatDateHourSecShort"):$conf->format_date_hour_sec_short); - else if ($format == 'dayhourtext') $format=($outputlangs->trans("FormatDateHourText")!="FormatDateHourText"?$outputlangs->trans("FormatDateHourText"):$conf->format_date_hour_text); - else if ($format == 'dayhourtextshort') $format=($outputlangs->trans("FormatDateHourTextShort")!="FormatDateHourTextShort"?$outputlangs->trans("FormatDateHourTextShort"):$conf->format_date_hour_text_short); - + if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short); + else if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short); + else if ($format == 'hourduration') $format=($outputlangs->trans("FormatHourShortDuration")!="FormatHourShortDuration"?$outputlangs->trans("FormatHourShortDuration"):$conf->format_hour_short_duration); + else if ($format == 'daytext') $format=($outputlangs->trans("FormatDateText")!="FormatDateText"?$outputlangs->trans("FormatDateText"):$conf->format_date_text); + else if ($format == 'daytextshort') $format=($outputlangs->trans("FormatDateTextShort")!="FormatDateTextShort"?$outputlangs->trans("FormatDateTextShort"):$conf->format_date_text_short); + else if ($format == 'dayhour') $format=($outputlangs->trans("FormatDateHourShort")!="FormatDateHourShort"?$outputlangs->trans("FormatDateHourShort"):$conf->format_date_hour_short); + else if ($format == 'dayhoursec') $format=($outputlangs->trans("FormatDateHourSecShort")!="FormatDateHourSecShort"?$outputlangs->trans("FormatDateHourSecShort"):$conf->format_date_hour_sec_short); + else if ($format == 'dayhourtext') $format=($outputlangs->trans("FormatDateHourText")!="FormatDateHourText"?$outputlangs->trans("FormatDateHourText"):$conf->format_date_hour_text); + else if ($format == 'dayhourtextshort') $format=($outputlangs->trans("FormatDateHourTextShort")!="FormatDateHourTextShort"?$outputlangs->trans("FormatDateHourTextShort"):$conf->format_date_hour_text_short); // Format not sensitive to language - else if ($format == 'dayhourlog') $format='%Y%m%d%H%M%S'; - else if ($format == 'dayhourldap') $format='%Y%m%d%H%M%SZ'; - else if ($format == 'dayhourxcard') $format='%Y%m%dT%H%M%SZ'; - else if ($format == 'dayxcard') $format='%Y%m%d'; - else if ($format == 'dayrfc') $format='%Y-%m-%d'; // DATE_RFC3339 - else if ($format == 'dayhourrfc') $format='%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339 + else if ($format == 'dayhourlog') $format='%Y%m%d%H%M%S'; + else if ($format == 'dayhourldap') $format='%Y%m%d%H%M%SZ'; + else if ($format == 'dayhourxcard') $format='%Y%m%dT%H%M%SZ'; + else if ($format == 'dayxcard') $format='%Y%m%d'; + else if ($format == 'dayrfc') $format='%Y-%m-%d'; // DATE_RFC3339 + else if ($format == 'dayhourrfc') $format='%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339 + else if ($format == 'standard') $format='%Y-%m-%d %H:%M:%S'; // If date undefined or "", we return "" if (dol_strlen($time) == 0) return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) - //print 'x'.$time; - + // Clean format if (preg_match('/%b/i',$format)) // There is some text to translate { // We inhibate translation to text made by strftime functions. We will use trans instead later. @@ -2477,7 +2474,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so } else { - if (empty($conf->browser->phone) && $picto && $titre) print ''.img_picto('',$picto, '', $pictoisfullpath).''; + if (empty($conf->dol_optimize_smallscreen) && $picto && $titre) print ''.img_picto('',$picto, '', $pictoisfullpath).''; print ''; print '
'.$titre.'
'; $pagelist.= $langs->trans('Page').' '.($page+1); @@ -2486,7 +2483,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so } else { - if (empty($conf->browser->phone) && $picto && $titre) print ''.img_picto('',$picto, '', $pictoisfullpath).''; + if (empty($conf->dol_optimize_smallscreen) && $picto && $titre) print ''.img_picto('',$picto, '', $pictoisfullpath).''; print '
'.$titre.'
'; } diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 3a71a1939b2..dcb94bd084a 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -168,25 +168,18 @@ function dol_loginfunction($langs,$conf,$mysoc) $conf_css = $themepath."?lang=".$langs->defaultlang; // Select templates - if (! empty($conf->browser->phone) && preg_match('/^smartphone/',$conf->smart_menu)) + if (! empty($conf->modules_parts['tpl'])) // Using this feature slow down application { - $template_dir = DOL_DOCUMENT_ROOT.'/theme/phones/smartphone/tpl/'; + $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl/')); + foreach($dirtpls as $reldir) + { + $tmp=dol_buildpath($reldir.'login.tpl.php'); + if (file_exists($tmp)) { $template_dir=preg_replace('/login\.tpl\.php$/','',$tmp); break; } + } } else { - if (! empty($conf->modules_parts['tpl'])) // Using this feature slow down application - { - $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl/')); - foreach($dirtpls as $reldir) - { - $tmp=dol_buildpath($reldir.'login.tpl.php'); - if (file_exists($tmp)) { $template_dir=preg_replace('/login\.tpl\.php$/','',$tmp); break; } - } - } - else - { - $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/"; - } + $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/"; } // Set cookie for timeout management @@ -295,9 +288,12 @@ function dol_loginfunction($langs,$conf,$mysoc) $jquerytheme = 'smoothness'; if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; - // Set dol_hide_topmenu and dol_hide_leftmenu + // Set dol_hide_topmenu, dol_hide_leftmenu, dol_optimize_smallscreen, dol_nomousehover $dol_hide_topmenu=GETPOST('dol_hide_topmenu'); $dol_hide_leftmenu=GETPOST('dol_hide_leftmenu'); + $dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen'); + $dol_no_mouse_hover=GETPOST('dol_no_mouse_hover'); + $dol_use_jmobile=GETPOST('dol_use_jmobile'); // Include login page template include $template_dir.'login.tpl.php'; diff --git a/htdocs/core/search_jmobile.php b/htdocs/core/search_page.php similarity index 96% rename from htdocs/core/search_jmobile.php rename to htdocs/core/search_page.php index e5604ddcc75..cf8be7ddb12 100644 --- a/htdocs/core/search_jmobile.php +++ b/htdocs/core/search_page.php @@ -19,7 +19,7 @@ */ /** - * \file htdocs/core/search_jmobile.php + * \file htdocs/core/search_page.php * \brief File to return search box */ @@ -50,7 +50,7 @@ $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); * View */ -// URL http://mydolibarr/core/getmenu_jmobime?mainmenu=mainmenu&leftmenu=leftmenu can be used for tests +// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index b8b297b775d..6ec50bb1d23 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -89,6 +89,9 @@ $(document).ready(function () { + + + diff --git a/htdocs/index.php b/htdocs/index.php index 294443adff1..8c2f009cb4a 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -52,13 +52,6 @@ if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_IN * View */ -// 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)) -{ - include_once DOL_DOCUMENT_ROOT.'/theme/phones/smartphone/tpl/menu.tpl.php'; - exit; -} - llxHeader('',$langs->trans("HomeArea")); print_fiche_titre($langs->trans("HomeArea")); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 99a60857e3d..28de6467cbb 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -571,7 +571,7 @@ ThisLimitIsDefinedInSetup=Dolibarr limit (Menu home-setup-security): %s Kb, PHP NoFileFound=No documents saved in this directory CurrentUserLanguage=Current language CurrentTheme=Current theme -CurrentMenuManager=current menu manager +CurrentMenuManager=Current menu manager DisabledModules=Disabled modules For=For ForCustomer=For customer diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index bae7f0de7f2..f772df7420b 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -418,6 +418,11 @@ if (! defined('NOLOGIN')) $dol_dst_second=$_POST["dst_second"]; $dol_screenwidth=$_POST["screenwidth"]; $dol_screenheight=$_POST["screenheight"]; + $dol_hide_topmenu=$_POST['dol_hide_topmenu']; + $dol_hide_leftmenu=$_POST['dol_hide_leftmenu']; + $dol_optimize_smallscreen=$_POST['dol_optimize_smallscreen']; + $dol_no_mouse_hover=$_POST['dol_no_mouse_hover']; + $dol_use_jmobile=$_POST['dol_use_jmobile']; } if (! $login) @@ -526,8 +531,8 @@ if (! defined('NOLOGIN')) exit; } else - { - if (! empty($conf->global->MAIN_ACTIVATE_UPDATESESSIONTRIGGER)) // We do not execute such trigger at each page load by default + { + if (! empty($conf->global->MAIN_ACTIVATE_UPDATESESSIONTRIGGER)) // We do not execute such trigger at each page load by default (triggers are time consuming) { // Call triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; @@ -545,9 +550,10 @@ if (! defined('NOLOGIN')) // If we are here, this means authentication was successfull. if (! isset($_SESSION["dol_login"])) { - $error=0; + // New session for this login. + $error=0; - // New session for this login + // Store value into session (values always stored) $_SESSION["dol_login"]=$user->login; $_SESSION["dol_authmode"]=isset($dol_authmode)?$dol_authmode:''; $_SESSION["dol_tz"]=isset($dol_tz)?$dol_tz:''; @@ -560,8 +566,13 @@ if (! defined('NOLOGIN')) $_SESSION["dol_screenheight"]=isset($dol_screenheight)?$dol_screenheight:''; $_SESSION["dol_company"]=$conf->global->MAIN_INFO_SOCIETE_NOM; $_SESSION["dol_entity"]=$conf->entity; - if (GETPOST('dol_hide_topmenu')) $_SESSION['dol_hide_topmenu']=1; - if (GETPOST('dol_hide_leftmenu')) $_SESSION['dol_hide_leftmenu']=1; + // Store value into session (values stored only if defined) + if (! empty($dol_hide_topmenu)) $_SESSION['dol_hide_topmenu']=$dol_hide_topmenu; + if (! empty($dol_hide_leftmenu)) $_SESSION['dol_hide_leftmenu']=$dol_hide_leftmenu; + if (! empty($dol_optimize_smallscreen)) $_SESSION['dol_optimize_smallscreen']=$dol_optimize_smallscreen; + if (! empty($dol_no_mouse_hover)) $_SESSION['dol_no_mouse_hover']=$dol_no_mouse_hover; + if (! empty($dol_use_jmobile)) $_SESSION['dol_use_jmobile']=$dol_use_jmobile; + dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id()); $db->begin(); @@ -630,32 +641,47 @@ if (! defined('NOLOGIN')) /* * Overwrite configs global by personal configs - */ + */ + // Set liste_limit - if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) // Can be 0 - { - $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT; - } - if (isset($user->conf->PRODUIT_LIMIT_SIZE)) // Can be 0 - { - $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE; - } + if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT; // Can be 0 + if (isset($user->conf->PRODUIT_LIMIT_SIZE)) $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE; // Can be 0 + // Replace conf->css by personalized value if (isset($user->conf->MAIN_THEME) && $user->conf->MAIN_THEME) { $conf->theme=$user->conf->MAIN_THEME; $conf->css = "/theme/".$conf->theme."/style.css.php"; } +} - // Set javascript option - if (! GETPOST('nojs')) // If javascript was not disabled on URL - { - if (! empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) - { - $conf->use_javascript_ajax=! $user->conf->MAIN_DISABLE_JAVASCRIPT; - } - } - else $conf->use_javascript_ajax=0; +// Case forcing style from url +if (GETPOST('theme')) +{ + $conf->theme=GETPOST('theme','alpha',1); + $conf->css = "/theme/".$conf->theme."/style.css.php"; +} + +// Set javascript option +if (! GETPOST('nojs')) // If javascript was not disabled on URL +{ + if (! empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) + { + $conf->use_javascript_ajax=! $user->conf->MAIN_DISABLE_JAVASCRIPT; + } +} +else $conf->use_javascript_ajax=0; + +// Set terminal output option +if (GETPOST('dol_hide_leftmenu') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1; +if (GETPOST('dol_hide_topmenu') || ! empty($_SESSION['dol_hide_topmenu'])) $conf->dol_hide_topmenu=1; +if (GETPOST('dol_optimize_smallscreen') || ! empty($_SESSION['dol_optimize_smallscreen'])) $conf->dol_optimize_smallscreen=1; +if (GETPOST('dol_no_mouse_hover') || ! empty($_SESSION['dol_no_mouse_hover'])) $conf->dol_no_mouse_hover=1; +if (GETPOST('dol_use_jmobile') || ! empty($_SESSION['dol_use_jmobile'])) $conf->dol_use_jmobile=1; +if (! empty($conf->browser->phone)) +{ + $conf->dol_optimize_smallscreen=1; + $conf->dol_no_mouse_hover=1; } if (! defined('NOREQUIRETRAN')) @@ -673,20 +699,8 @@ if (! defined('NOREQUIRETRAN')) } } } -/* else // If language was forced on URL - { - $langs->setDefaultLang(GETPOST('lang','alpha',1)); - }*/ } -// Case forcing style from url -if (GETPOST('theme')) -{ - $conf->theme=GETPOST('theme','alpha',1); - $conf->css = "/theme/".$conf->theme."/style.css.php"; -} - - if (! defined('NOLOGIN')) { // If the login is not recovered, it is identified with an account that does not exist. @@ -775,16 +789,14 @@ 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->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; + $file_menu=$conf->standard_menu; if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php if (! class_exists('MenuManager')) { @@ -947,7 +959,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; } // jQuery jMobile - if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || GETPOST('jmobile')) + if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || ! empty($conf->dol_use_jmobile)) { print ''."\n"; } @@ -971,8 +983,11 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs } $themeparam='?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss')?'&optioncss='.GETPOST('optioncss','alpha',1):'').'&userid='.$user->id.'&entity='.$conf->entity; if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&dol_resetcache='.$_SESSION['dol_resetcache']; - if (GETPOST('dol_hide_topmenu')) $themeparam.='&dol_hide_topmenu=1'; - if (GETPOST('dol_hide_leftmenu')) $themeparam.='&dol_hide_leftmenu=1'; + if (GETPOST('dol_hide_topmenu')) $themeparam.='&dol_hide_topmenu=1'; + if (GETPOST('dol_hide_leftmenu')) $themeparam.='&dol_hide_leftmenu=1'; + if (GETPOST('dol_optimize_smallscreen')) $themeparam.='&dol_optimize_smallscreen=1'; + if (GETPOST('dol_no_mouse_hover')) $themeparam.='&dol_no_mouse_hover=1'; + if (GETPOST('dol_use_jmobile')) $themeparam.='&dol_use_jmobile=1'; //print 'themepath='.$themepath.' themeparam='.$themeparam;exit; print ''."\n"; @@ -1112,7 +1127,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; } // jQuery jMobile - if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || GETPOST('jmobile')) + if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || ! empty($conf->dol_use_jmobile)) { print ''."\n"; } @@ -1247,7 +1262,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a //togglerLength_open: 0, // effect defaults - overridden on some panes //slideTrigger_open: "mouseover", - initClosed: '.(empty($conf->browser->phone)?'false':'true').', + initClosed: '.(empty($conf->dol_optimize_smallscreen)?'false':'true').', fxName: "drop", fxSpeed: "fast", fxSettings: { easing: "" } @@ -1630,21 +1645,6 @@ function main_area($title='') print "\n"; print '
'."\n"; - if (preg_match('/^smartphone/',$conf->smart_menu) && ! empty($conf->browser->phone)) - { - print '
'; - - print '
'; - print '
'."\n"; - $appli='Dolibarr'; - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE; - print $appli; - print '
'."\n"; - print '
'."\n"; - print "\n"; - - print '
'."\n"; - } if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) print info_admin($langs->trans("WarningYouAreInMaintenanceMode",$conf->global->MAIN_ONLY_LOGIN_ALLOWED)); } @@ -1762,11 +1762,6 @@ if (! function_exists("llxFooter")) } print "\n\n"; - if (preg_match('/^smartphone/',$conf->smart_menu) && ! empty($conf->browser->phone)) - { - print '
'."\n"; - print '
'."\n"; - } print '
'."\n"; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 17892d4631d..cb4ade0e46e 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -171,7 +171,7 @@ if (empty($reshook)) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); - + if (GETPOST('deletephoto')) $object->logo = ''; else if (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']); @@ -223,7 +223,7 @@ if (empty($reshook)) } $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - + if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) { $langs->load("errors"); @@ -1309,12 +1309,12 @@ else print "}\n"; print ''; print "\n"; - $s.=''.$langs->trans("VATIntraCheck").''; + $s.=''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); } else { - $s.='country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; + $s.='country_id).'" class="hideonsmartphone" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; } } print $s; @@ -1368,7 +1368,7 @@ else print ''; // Capital - print ''; + print ''; // Default language if (! empty($conf->global->MAIN_MULTILANGS)) @@ -1378,6 +1378,7 @@ else print ''; print ''; } + // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -1385,8 +1386,9 @@ else { print $object->showOptionals($extrafields,'edit'); } + // Logo - print ''; + print ''; print ''; print '