Clean code for top menu
This commit is contained in:
parent
b7106b1731
commit
5dfd38c8f9
@ -231,22 +231,31 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
|
$classnameimg = str_replace('class="', 'class="tmenuimage ', $classname);
|
||||||
|
$classnametxt = str_replace('class="', 'class="tmenulabel ', $classname);
|
||||||
|
|
||||||
if ($showmode == 1) {
|
if ($showmode == 1) {
|
||||||
print '<a class="tmenuimage" tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
|
print '<a '.$classnametxt.' tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
|
||||||
print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
|
print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
|
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
|
||||||
print '<span class="mainmenuaspan">';
|
print '<a '.$classnameimg.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
|
||||||
print $text;
|
print '<span class="mainmenuaspan">';
|
||||||
print '</span>';
|
print $text;
|
||||||
print '</a>';
|
print '</span>';
|
||||||
|
print '</a>';
|
||||||
|
}
|
||||||
} elseif ($showmode == 2) {
|
} elseif ($showmode == 2) {
|
||||||
|
print '<span '.$classnameimg.' title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
|
||||||
print '<div class="'.$id.' '.$idsel.' topmenuimage tmenudisabled"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
|
print '<div class="'.$id.' '.$idsel.' topmenuimage tmenudisabled"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
|
||||||
print '<a class="tmenudisabled" id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">';
|
|
||||||
print '<span class="mainmenuaspan">';
|
|
||||||
print $text;
|
|
||||||
print '</span>';
|
print '</span>';
|
||||||
print '</a>';
|
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
|
||||||
|
print '<span '.$classnametxt.' id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
|
||||||
|
print '<span class="mainmenuaspan">';
|
||||||
|
print $text;
|
||||||
|
print '</span>';
|
||||||
|
print '</span>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -626,26 +626,31 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname,
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$classnameimg = str_replace('class="', 'class="tmenuimage ', $classname);
|
||||||
|
$classnametxt = str_replace('class="', 'class="tmenulabel ', $classname);
|
||||||
|
|
||||||
//$conf->global->THEME_TOPMENU_DISABLE_TEXT=1;
|
//$conf->global->THEME_TOPMENU_DISABLE_TEXT=1;
|
||||||
if ($showmode == 1) {
|
if ($showmode == 1) {
|
||||||
print '<a class="tmenuimage" tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
|
print '<a '.$classnameimg.' tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
|
||||||
print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
|
print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
|
||||||
print '</a>';
|
print '</a>';
|
||||||
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
|
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
|
||||||
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
|
print '<a '.$classnametxt.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
|
||||||
print '<span class="mainmenuaspan">';
|
print '<span class="mainmenuaspan">';
|
||||||
print $text;
|
print $text;
|
||||||
print '</span>';
|
print '</span>';
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
} elseif ($showmode == 2) {
|
} elseif ($showmode == 2) {
|
||||||
print '<div class="'.$id.' '.$idsel.' topmenuimage tmenudisabled"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
|
print '<span '.$classnameimg.' title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
|
||||||
|
print '<div class="'.$id.' '.$idsel.' topmenuimage tmenudisabled"><span class="'.$id.' tmenuimage tmenudisabled" id="mainmenuspan_'.$idsel.'"></span></div>';
|
||||||
|
print '</span>';
|
||||||
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
|
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
|
||||||
print '<a class="tmenudisabled" id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">';
|
print '<span '.$classnametxt.' id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
|
||||||
print '<span class="mainmenuaspan">';
|
print '<span class="mainmenuaspan tmenudisabled">';
|
||||||
print $text;
|
print $text;
|
||||||
print '</span>';
|
print '</span>';
|
||||||
print '</a>';
|
print '</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -513,19 +513,32 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$classnameimg = str_replace('class="', 'class="tmenuimage ', $classname);
|
||||||
|
$classnametxt = str_replace('class="', 'class="tmenulabel ', $classname);
|
||||||
|
|
||||||
if ($showmode == 1) {
|
if ($showmode == 1) {
|
||||||
print '<a class="tmenuimage" tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').'>';
|
print '<a '.$classnameimg.' tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').'>';
|
||||||
print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
|
print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').'>';
|
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
|
||||||
print '<span class="mainmenuaspan">';
|
print '<a '.$classnametxt.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').'>';
|
||||||
print $text;
|
print '<span class="mainmenuaspan">';
|
||||||
print '</span>';
|
print $text;
|
||||||
print '</a>';
|
print '</span>';
|
||||||
|
print '</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($showmode == 2) {
|
if ($showmode == 2) {
|
||||||
|
print '<span '.$classnameimg.' title="'.dol_escape_htmltag($text).'">';
|
||||||
print '<div class="'.$id.' '.$idsel.' tmenudisabled"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
|
print '<div class="'.$id.' '.$idsel.' tmenudisabled"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
|
||||||
print '<a class="tmenudisabled" id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">';
|
print '</span>';
|
||||||
|
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
|
||||||
|
print '<a '.$classnametxt.' id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">';
|
||||||
|
print '<span class="mainmenuaspan">';
|
||||||
|
print $text;
|
||||||
|
print '</span>';
|
||||||
|
print '</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -199,7 +199,7 @@ if (is_array($results)) {
|
|||||||
$text .= ' - <strong>'.$mysoc->name.'</strong>';
|
$text .= ' - <strong>'.$mysoc->name.'</strong>';
|
||||||
$text .= ' - <span class="nowraponall"><span class="fa fa-calendar secondary"></span> '.dol_print_date($object->date_creation).'</span>';
|
$text .= ' - <span class="nowraponall"><span class="fa fa-calendar secondary"></span> '.dol_print_date($object->date_creation).'</span>';
|
||||||
$text .= '</td></tr>'."\n";
|
$text .= '</td></tr>'."\n";
|
||||||
$text .= '<tr><td class="textpublicpayment"><h1>'.$object->label.'</h1></td></tr>'."\n";
|
$text .= '<tr><td class="textpublicpayment"><h1 class="paddingleft paddingright">'.$object->label.'</h1></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
print $text;
|
print $text;
|
||||||
|
|
||||||
|
|||||||
@ -250,7 +250,7 @@ if (empty($text)) {
|
|||||||
$text .= ' - <strong>'.$mysoc->name.'</strong>';
|
$text .= ' - <strong>'.$mysoc->name.'</strong>';
|
||||||
$text .= ' - <span class="nowraponall"><span class="fa fa-calendar secondary"></span> '.dol_print_date($object->date_creation).'</span>';
|
$text .= ' - <span class="nowraponall"><span class="fa fa-calendar secondary"></span> '.dol_print_date($object->date_creation).'</span>';
|
||||||
$text .= '</td></tr>'."\n";
|
$text .= '</td></tr>'."\n";
|
||||||
$text .= '<tr><td class="textpublicpayment"><h1>'.$object->label.'</h1><br></td></tr>'."\n";
|
$text .= '<tr><td class="textpublicpayment"><h1 class="paddingleft paddingright">'.$object->label.'</h1><br></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
print $text;
|
print $text;
|
||||||
|
|
||||||
|
|||||||
@ -125,11 +125,10 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
|||||||
|
|
||||||
// Default sort order (if not yet defined by previous GETPOST)
|
// Default sort order (if not yet defined by previous GETPOST)
|
||||||
if (!$sortfield) {
|
if (!$sortfield) {
|
||||||
reset($object->fields); // Reset is required to avoid key() to return null.
|
$sortfield = "t.ref";
|
||||||
$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
|
||||||
}
|
}
|
||||||
if (!$sortorder) {
|
if (!$sortorder) {
|
||||||
$sortorder = "ASC";
|
$sortorder = "DESC";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize array of search criterias
|
// Initialize array of search criterias
|
||||||
|
|||||||
@ -2601,8 +2601,20 @@ a.tmenuimage:hover{
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
.tmenulabel:not(.menuhider), .tmenulabel:not(.menuhider):before {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.tmenuimage:not(.menuhider), .tmenuimage:not(.menuhider):before {
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
.tmenudiv:hover .tmenulabel:not(.menuhider), .tmenudiv:hover .tmenulabel:not(.menuhider):before {
|
||||||
|
display: initial !important;
|
||||||
|
}
|
||||||
|
.tmenudiv:hover .tmenuimage:not(.menuhider), .tmenudiv:hover .tmenulabel:not(.menuhider):before {
|
||||||
|
font-size: 1.1em !important;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/* Do not load menu img for other if hidden to save bandwidth */
|
/* Do not load menu img for other if hidden to save bandwidth */
|
||||||
|
|
||||||
|
|||||||
@ -201,7 +201,7 @@ button.dropdown-item.global-search-item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div#topmenu-global-search-dropdown, div#topmenu-quickadd-dropdown, div#topmenu-bookmark-dropdown {
|
div#topmenu-global-search-dropdown, div#topmenu-quickadd-dropdown, div#topmenu-bookmark-dropdown {
|
||||||
line-height: 46px;
|
line-height: <?php echo (empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE) ? '46' : '35' ); ?>px;
|
||||||
}
|
}
|
||||||
a.top-menu-dropdown-link {
|
a.top-menu-dropdown-link {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user