Fix: Add a test to avoid the non stable and experimental fuc...

feature "MAIN_MENU_USE_JQUERY_LAYOUT" to make application hang.
This commit is contained in:
Laurent Destailleur 2014-02-26 16:51:38 +01:00
parent df2eb95882
commit 0c2ca119d7
2 changed files with 14 additions and 20 deletions

View File

@ -547,15 +547,12 @@ class Menubase
$tmpcond=$menu['enabled'];
if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/','1==1',$tmpcond); // Force part of condition to true
$enabled = verifCond($tmpcond);
if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION) && preg_match('/^\$leftmenu/',$menu['enabled'])) $enabled=1;
//print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$enabled."<br>\n";
//if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION) && empty($conf->dol_use_jmobile) && preg_match('/^\$leftmenu/',$menu['enabled'])) $enabled=1;
}
// Define $title
if ($enabled)
{
//$tmp3=dol_microtime_float();
//print '>>> 2 '.($tmp3 - $tmp1).'<br>';
$title = $langs->trans($menu['titre']);
if ($title == $menu['titre']) // Translation not found
{

View File

@ -261,7 +261,7 @@ if (! empty($conf->file->main_force_https))
}
// Loading of additional presentation includes
// Loading of additional presentation includes
if (! defined('NOREQUIREHTML')) require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2)
if (! defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; // Need 22ko memory
@ -1084,7 +1084,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/tiptip/jquery.tipTip.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
// jQuery Layout
if (! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) || defined('REQUIRE_JQUERY_LAYOUT'))
if (empty($conf->dol_use_jmobile) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) || defined('REQUIRE_JQUERY_LAYOUT'))
{
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/layout/jquery.layout-latest.js'.($ext?'?'.$ext:'').'"></script>'."\n";
}
@ -1293,7 +1293,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
if ($conf->use_javascript_ajax)
{
if (! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT))
if (empty($conf->dol_use_jmobile) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT))
{
print '<script type="text/javascript">
jQuery(document).ready(function () {
@ -1347,7 +1347,8 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
</script>';
}
if (! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION))
/* This make menu bugged
if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION) && empty($conf->dol_use_jmobile))
{
print "\n".'<script type="text/javascript">
jQuery(document).ready(function () {
@ -1360,7 +1361,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
});
});
</script>';
}
} */
// Wrapper to show tooltips
print "\n".'<script type="text/javascript">
@ -1377,7 +1378,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
*/
print "\n".'<!-- Start top horizontal -->'."\n";
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '<div class="ui-layout-north"> <!-- Begin top layout -->'."\n";
if (empty($conf->dol_use_jmobile) && ! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '<div class="ui-layout-north"> <!-- Begin top layout -->'."\n";
if (empty($conf->dol_hide_topmenu))
{
@ -1496,11 +1497,11 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
unset($form);
}
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "</div><!-- End top layout -->\n";
if (empty($conf->dol_use_jmobile) && ! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "</div><!-- End top layout -->\n";
print '<div style="clear: both;"></div>';
print "<!-- End top horizontal menu -->\n\n";
if (empty($conf->dol_hide_leftmenu) && (empty($conf->use_javascript_ajax) || empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT))) print '<div id="id-container">';
if (empty($conf->dol_hide_leftmenu) && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile) || empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT))) print '<div id="id-container">';
}
@ -1530,7 +1531,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
// Instantiate hooks of thirdparty module
$hookmanager->initHooks(array('searchform','leftblock'));
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "\n".'<div class="ui-layout-west"> <!-- Begin left layout -->'."\n";
if (empty($conf->dol_use_jmobile) && ! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "\n".'<div class="ui-layout-west"> <!-- Begin left layout -->'."\n";
else print '<div id="id-left">';
print "\n";
@ -1708,8 +1709,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
$leftblock=$hookmanager->executeHooks('printLeftBlock',$parameters); // Note that $action and $object may have been modified by some hooks
print $leftblock;
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '</div> <!-- End left layout -->'."\n";
//XXX else print '</td>';
if (empty($conf->dol_use_jmobile) && ! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '</div> <!-- End left layout -->'."\n";
else print '</div>'; // End div id="id-left"
}
@ -1731,12 +1731,10 @@ function main_area($title='')
{
global $conf, $langs;
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT))
if (empty($conf->dol_use_jmobile) && ! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT))
{
print '<div id="mainContent"><div class="ui-layout-center"> <!-- begin main layout -->'."\n";
//print '<table width="100%" class="notopnoleftnoright" summary="centermenutable" id="undertopmenu"><tr>';
}
//XXX print '<td valign="top">'."\n";
if (empty($conf->dol_hide_leftmenu)) print '<div id="id-right">';
print "\n";
@ -1864,8 +1862,7 @@ if (! function_exists("llxFooter"))
print '</div> <!-- end div class="fiche" -->'."\n";
if (! empty($conf->dol_use_jmobile)) print '</div>'; // end data-role="page"
//XXX print "\n".'</td></tr></table> <!-- end right area -->'."\n";
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '</div></div> <!-- end main layout -->'."\n";
if (empty($conf->dol_use_jmobile) && ! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '</div></div> <!-- end main layout -->'."\n";
if (empty($conf->dol_hide_leftmenu)) print '</div>'; // End div id-right
print "\n";