Commit 997ee871 authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Benoit Mortier
Browse files

Fixes: #2408 Rework menu html code

Showing with 67 additions and 64 deletions
+67 -64
...@@ -188,6 +188,28 @@ border-right:1px solid #B0B0B0; ...@@ -188,6 +188,28 @@ border-right:1px solid #B0B0B0;
} }
/* Main menu */ /* Main menu */
.iconmenu_section
{
border-top:1px solid #AAAAAA;
clear:both;
}
.iconmenu_section + br
{
clear:both;
}
.iconmenu_section:first-child
{
border-top:none;
}
.iconmenu img
{
border:none;
vertical-align:middle;
}
table.plugin_window table.plugin_window
{ {
vertical-align:top; vertical-align:top;
...@@ -213,6 +235,7 @@ display:inline-block; ...@@ -213,6 +235,7 @@ display:inline-block;
border-bottom:1px solid #AAAAAA; border-bottom:1px solid #AAAAAA;
border-right:1px solid #AAAAAA; border-right:1px solid #AAAAAA;
background-color:#DBE6C6; background-color:#DBE6C6;
float:left;
} }
div.copynotice { div.copynotice {
...@@ -255,28 +278,33 @@ text-decoration:none; ...@@ -255,28 +278,33 @@ text-decoration:none;
background-color:#F0F0F0; background-color:#F0F0F0;
} }
td.iconmenu { .iconmenu {
cursor:pointer; cursor:pointer;
display:inline-block;
float:left;
width:18%;
margin:3px;
padding:3px;
} }
a.iconmenu:link { .iconmenu:nth-child(2)
text-decoration:none; {
color:#00008f; clear:left;
}
td.iconmenu:hover {
background-color:#F0F0F0;
} }
a.iconmenu:visited { .iconmenu > a:link, .iconmenu > a:visited {
text-decoration:none; text-decoration:none;
color:#00008f; color:#00008f;
} }
a.iconmenu:hover { .iconmenu > a:hover {
text-decoration:none; text-decoration:none;
} }
div.iconmenu:hover {
background-color:#F0F0F0;
}
h1.plugtop { h1.plugtop {
width:100%; width:100%;
padding-bottom:6px; padding-bottom:6px;
......
...@@ -96,7 +96,7 @@ class pluglist { ...@@ -96,7 +96,7 @@ class pluglist {
} }
$infos['INDEX'] = $index; $infos['INDEX'] = $index;
$this->info[$cname] = $infos; $this->info[$cname] = $infos;
$this->dirlist[$index++] = $cname; $this->dirlist[$index++] = $cname;
} }
} }
...@@ -260,8 +260,8 @@ class pluglist { ...@@ -260,8 +260,8 @@ class pluglist {
} else { } else {
$style = "style='border-top:1px solid #AAA; margin-top:0.8em;'"; $style = "style='border-top:1px solid #AAA; margin-top:0.8em;'";
} }
$menu = "<p class=\"menuheader\" $style>".$section_infos['NAME']."</p>\n"; $menu = "<p class=\"menuheader\" $style>".$section_infos['NAME']."</p>\n";
$entries = ""; $entries = "";
/* Parse sub-plugins */ /* Parse sub-plugins */
foreach ($this->config->data['MENU'][$section] as $info) { foreach ($this->config->data['MENU'][$section] as $info) {
...@@ -334,27 +334,23 @@ class pluglist { ...@@ -334,27 +334,23 @@ class pluglist {
list($x, $y) = explode("x", $this->config->get_cfg_value("iconsize")); list($x, $y) = explode("x", $this->config->get_cfg_value("iconsize"));
$isize = "width=\"$x\" height=\"$y\""; $isize = "width=\"$x\" height=\"$y\"";
} else { } else {
$isize = ""; $isize = 'width="48" height="48"';
} }
/* Parse headlines */ /* Parse headlines */
foreach ($this->config->data['SECTIONS'] as $section => $section_infos) { foreach ($this->config->data['SECTIONS'] as $section => $section_infos) {
$col = 1; $entries = '';
if ($this->iconmenu == "") { $menu = '';
$menu = "<h1 class=\"menuheader\" style=\"border-top:none;\">"; $menu = '<div class="iconmenu_section"><h1 class="menuheader">';
} else { $menu .= $section_infos['NAME']."</h1>\n";
$menu = "</td></tr>\n<tr><td>\n<h1 class=\"menuheader\">";
}
$menu .=
$section_infos['NAME']."</h1>\n<table summary=\"\" style=\"width:100%;".
"font-size: 14px;\" cellpadding=7 border=0>\n<tr>\n";
$entries = "";
foreach ($this->config->data['MENU'][$section] as $info) { foreach ($this->config->data['MENU'][$section] as $info) {
if (!plugin_available($info['CLASS'])) { if (!plugin_available($info['CLASS'])) {
continue; continue;
} }
if (!$this->check_access($info['ACL'])) {
continue;
}
/* Read information from class variable */ /* Read information from class variable */
$infos = $this->get_infos($info['CLASS']); $infos = $this->get_infos($info['CLASS']);
...@@ -363,58 +359,37 @@ class pluglist { ...@@ -363,58 +359,37 @@ class pluglist {
$index = $this->get_index($info['CLASS']); $index = $this->get_index($info['CLASS']);
$href = "main.php?plug=".$index."&amp;reset=1"; $href = "main.php?plug=".$index."&amp;reset=1";
} else { } else {
/* Check if class is available. If the class doesn't exists display error symbol /* If the class doesn't exists display error symbol
to avoid that a user clicks on a non existing plugin */ to avoid that a user clicks on a non existing plugin */
$plHeadline = $plDescription = _("Unknown"); $plHeadline = $plDescription = _("Unknown");
$info['ICON'] = "error.png"; $info['ICON'] = "error.png";
$href = "main.php?reset=1"; $href = "main.php?reset=1";
} }
if ($this->check_access($info['ACL'])) { /* Load icon */
/* Load icon */ if (isset($info['ICON'])) {
if (isset($info['ICON'])) { $image = get_template_path('images/'.$info['ICON']);
$image = get_template_path('images/'.$info['ICON']); } else {
} else { if (!preg_match("/\//", $plIcon)) {
if (!preg_match("/\//", $plIcon)) { $image = get_template_path("plugins/".preg_replace('%^.*/([^/]+)/[^/]+$%', '\1', $class_mapping[$info['CLASS']])."/images/$plIcon");
$image = get_template_path("plugins/".preg_replace('%^.*/([^/]+)/[^/]+$%', '\1', $class_mapping[$info['CLASS']])."/images/$plIcon");
} else {
$image = $plIcon;
}
}
if ($col > 5) {
$entries = $entries."</tr><tr>";
$col = 1;
}
$entries .= "<td class=\"iconmenu\" style=\"width:20%;\" onClick='location.href=\"".$href."\"'>";
if (session::global_get('js')) {
$entries .= "<img $isize border=0 align=middle src=\"$image\" alt=\"*\">&nbsp;$plHeadline";
} else { } else {
$entries .= "<a class=\"iconmenu\" href=\"".$href."\">". $image = $plIcon;
"<img $isize border=0 align=middle src=\"$image\" alt=\"*\">&nbsp;$plHeadline</a>";
} }
$entries .= "</td>\n";
$col++;
} }
$entries .= '<div class="iconmenu" onClick=\'location.href="'.$href.'"\' title="'.$plDescription.'">';
$item = "<img $isize src=\"$image\" alt=\"$plHeadline icon\">&nbsp;$plHeadline";
if (!session::global_get('js')) {
$item = "<a href=\"".$href."\">$item</a>";
}
$entries .= $item."</div>\n";
} }
/* Append to menu */ /* Append to menu */
if ($entries != "") { if ($entries != "") {
$this->iconmenu .= $menu.$entries; $this->iconmenu .= $menu.$entries."</div>\n";
/* Fill up remaining columns */
if ($col != 1) {
$col--;
while ($col % 5) {
$this->iconmenu = $this->iconmenu."<td style=\"width:20%\">&nbsp;</td>\n";
$col++;
}
}
/* close table */
$this->iconmenu = $this->iconmenu."</tr>\n</table>\n";
} }
} }
} }
/* Write menu output */ /* Write menu output */
......
  • bmortier @bmortier

    mentioned in issue #809

    By Côme Chilliet on 2017-09-02T15:00:05 (imported from GitLab)

    ·

    mentioned in issue #809

    By Côme Chilliet on 2017-09-02T15:00:05 (imported from GitLab)

    Toggle commit list
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment