From: quix0r Date: Tue, 8 Jun 2010 00:00:47 +0000 (+0000) Subject: Invisible/locked menus are now styleable with CSS classes (sub_)menu_[in]visible_css... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6fdff977cb2b22ccfbde309684b8d7109a2ab186;p=mailer.git Invisible/locked menus are now styleable with CSS classes (sub_)menu_[in]visible_css and (sub_)menu_[un]locked_css :-) --- diff --git a/inc/functions.php b/inc/functions.php index 864e26f967..5a5507bab8 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -872,6 +872,34 @@ function translateUserStatus ($status) { return $ret; } +// "Translates" 'visible' and 'locked' to a CSS class +function translateMenuVisibleLocked ($content, $prefix = '') { + // Translate 'visible' and keep an eye on the prefix + switch ($content[$prefix . 'visible']) { + // Should be visible + case 'Y': $content[$prefix . 'visible_css'] = $prefix . 'menu_visible_css' ; break; + case 'N': $content[$prefix . 'visible_css'] = $prefix . 'menu_invisible_css'; break; + default: + // Please report this + debug_report_bug('Unsupported visible value detected. content=
'.print_r($content, true).'
'); + break; + } // END - switch + + // Translate 'locked' and keep an eye on the prefix + switch ($content[$prefix . 'locked']) { + // Should be locked + case 'Y': $content[$prefix . 'locked_css'] = $prefix . 'menu_locked_css' ; break; + case 'N': $content[$prefix . 'locked_css'] = $prefix . 'menu_unlocked_css'; break; + default: + // Please report this + debug_report_bug('Unsupported locked value detected. content=
'.print_r($content, true).'
'); + break; + } // END - switch + + // Return the resulting array + return $content; +} + // Generates an URL for the dereferer function generateDerefererUrl ($URL) { // Don't de-refer our own links! diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index c74bf46c3c..b988afb7d9 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -406,7 +406,7 @@ function addMenu ($mode, $action, $what) { } // END - if // Load SQL data and add the menu to the output stream... - $result_main = SQL_QUERY_ESC("SELECT `title`, `action` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE (`what`='' OR `what` IS NULL)".$ADD." ORDER BY `sort` ASC", + $result_main = SQL_QUERY_ESC("SELECT `title`, `action`, `visible`, `locked` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE (`what`='' OR `what` IS NULL)".$ADD." ORDER BY `sort` ASC", array($mode), __FUNCTION__, __LINE__); //* DEBUG: */ print(__LINE__.'/'.$main_cnt.':'.getWhat()."*
"); @@ -415,22 +415,19 @@ function addMenu ($mode, $action, $what) { $GLOBALS['rows'] = ''; while ($content = SQL_FETCHARRAY($result_main)) { //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].':'.getWhat()."*
"); - // Init variables + // Init/"translate" variables enableBlockMode(false); - $action = $content['action']; + $content = translateMenuVisibleLocked($content); // Load menu header template $GLOBALS['rows'] .= loadTemplate($mode . '_menu_title', true, $content); // Sub menu - $result_sub = SQL_QUERY_ESC("SELECT `title` AS sub_title, `what` AS sub_what FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ".$ADD." ORDER BY `sort`", + $result_sub = SQL_QUERY_ESC("SELECT `title` AS sub_title, `what` AS sub_what, `visible` AS sub_visible, `locked` AS sub_locked FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ".$ADD." ORDER BY `sort` ASC", array($mode, $content['action']), __FUNCTION__, __LINE__); - // Get number of rows - $totalWhats = SQL_NUMROWS($result_sub); - // Do we have some entries? - if ($totalWhats > 0) { + if (SQL_NUMROWS($result_sub) > 0) { // Init counter $cnt = '0'; @@ -439,11 +436,14 @@ function addMenu ($mode, $action, $what) { // Merge both arrays in one $content = merge_array($content, $content2); + // Translate visible/locked again + $content = translateMenuVisibleLocked($content, 'sub_'); + // Init content $OUT = ''; // Full file name for checking menu - //* DEBUG: */ print(__LINE__.":!!!!".$content['sub_what']."!!!
"); + //* DEBUG: */ print(__LINE__ . ':!!!!' . $content['sub_what'] . '!!!
'); $inc = sprintf("inc/modules/%s/what-%s.php", $mode, $content['sub_what']); if (isIncludeReadable($inc)) { // Mark currently selected menu - open @@ -478,17 +478,19 @@ function addMenu ($mode, $action, $what) { // Rewrite array $content = array( - 'menu' => $OUT, - 'what' => $content['sub_what'] + 'menu' => $OUT, + 'what' => $content['sub_what'], + 'visible_css' => $content['sub_visible_css'], + 'locked_css' => $content['sub_locked_css'] ); // Add regular menu row or bottom row? - if ($cnt < $totalWhats) { + if ($cnt < SQL_NUMROWS($result_sub)) { $GLOBALS['rows'] .= loadTemplate($mode . '_menu_row', true, $content); } else { $GLOBALS['rows'] .= loadTemplate($mode . '_menu_bottom', true, $content); } - } + } // END - while } else { // This is a menu block... ;-) enableBlockMode(); @@ -506,6 +508,10 @@ function addMenu ($mode, $action, $what) { //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*
"); } + // Free result + SQL_FREERESULT($result_sub); + + // Count one up $main_cnt++; //* DEBUG: */ print(__LINE__.'/'.$main_cnt.':'.getWhat()."*
"); diff --git a/templates/de/html/guest/guest_menu_bottom.tpl b/templates/de/html/guest/guest_menu_bottom.tpl index cff0c9a227..bad295e3b8 100644 --- a/templates/de/html/guest/guest_menu_bottom.tpl +++ b/templates/de/html/guest/guest_menu_bottom.tpl @@ -1,3 +1,5 @@ - $content[menu] + +
$content[menu]
+ diff --git a/templates/de/html/guest/guest_menu_row.tpl b/templates/de/html/guest/guest_menu_row.tpl index 856c660ab2..d4ed80413d 100644 --- a/templates/de/html/guest/guest_menu_row.tpl +++ b/templates/de/html/guest/guest_menu_row.tpl @@ -1,3 +1,5 @@ - $content[menu] + +
$content[menu]
+ diff --git a/templates/de/html/guest/guest_menu_title.tpl b/templates/de/html/guest/guest_menu_title.tpl index d245d39e28..d927e5f7a7 100644 --- a/templates/de/html/guest/guest_menu_title.tpl +++ b/templates/de/html/guest/guest_menu_title.tpl @@ -1,5 +1,7 @@ - - :::$content[title]::: + + + ::: $content[title] ::: + diff --git a/templates/de/html/guest/guest_menu_whats.tpl b/templates/de/html/guest/guest_menu_whats.tpl index 34255aa676..7c33dfa9e8 100644 --- a/templates/de/html/guest/guest_menu_whats.tpl +++ b/templates/de/html/guest/guest_menu_whats.tpl @@ -1,6 +1,8 @@ - - · - $content + +
+ · + $content +
diff --git a/templates/de/html/member/member_menu_bottom.tpl b/templates/de/html/member/member_menu_bottom.tpl index 8b42c0f6ed..b5111c0ff9 100644 --- a/templates/de/html/member/member_menu_bottom.tpl +++ b/templates/de/html/member/member_menu_bottom.tpl @@ -1,5 +1,5 @@ - - $content[menu] + +
$content[menu]
diff --git a/templates/de/html/member/member_menu_row.tpl b/templates/de/html/member/member_menu_row.tpl index 9dc45d750b..c406aa7d9f 100644 --- a/templates/de/html/member/member_menu_row.tpl +++ b/templates/de/html/member/member_menu_row.tpl @@ -1,3 +1,5 @@ - $content[menu] + +
$content[menu]
+ diff --git a/templates/de/html/member/member_menu_title.tpl b/templates/de/html/member/member_menu_title.tpl index db1d0fd7a2..3b8244aa0e 100644 --- a/templates/de/html/member/member_menu_title.tpl +++ b/templates/de/html/member/member_menu_title.tpl @@ -1,5 +1,7 @@ - - ::: $content[title] ::: + + + ::: $content[title] ::: + diff --git a/templates/de/html/member/member_menu_whats.tpl b/templates/de/html/member/member_menu_whats.tpl index 8295fcb4dd..5938b75652 100644 --- a/templates/de/html/member/member_menu_whats.tpl +++ b/templates/de/html/member/member_menu_whats.tpl @@ -1,6 +1,8 @@ - - · - $content + +
+ · + $content +
diff --git a/theme/business/css/general.css b/theme/business/css/general.css index a02a1bf07b..486f5c5828 100644 --- a/theme/business/css/general.css +++ b/theme/business/css/general.css @@ -700,7 +700,7 @@ ul.admin_menu_main,ul.admin_menu_sub { } .pre { - display : block; + display: block; } td { @@ -709,3 +709,17 @@ td { padding-top: 2px; padding-bottom: 2px; } + +div.menu_invisible_css, div.sub_menu_invisible_css, td.menu_invisible_css, td.sub_menu_invisible_css { + background-color: #dddddd; + font-style: italic; +} + +strong.menu_invisible_css, strong.sub_menu_invisible_css { + color: #999999; + font-style: italic; +} + +.menu_locked_css, .sub_menu_locked_css { + color: #ffeeee; +} diff --git a/theme/default/css/general.css b/theme/default/css/general.css index 90cb5f7fba..e16d8fe3bf 100644 --- a/theme/default/css/general.css +++ b/theme/default/css/general.css @@ -752,7 +752,7 @@ ul.admin_menu_main,ul.admin_menu_sub { } .pre { - display : block; + display: block; } td { @@ -768,3 +768,17 @@ td { color: #009900; text-align: center; } + +div.menu_invisible_css, div.sub_menu_invisible_css, td.menu_invisible_css, td.sub_menu_invisible_css { + background-color: #dddddd; + font-style: italic; +} + +strong.menu_invisible_css, strong.sub_menu_invisible_css { + color: #999999; + font-style: italic; +} + +.menu_locked_css, .sub_menu_locked_css { + color: #ffeeee; +} diff --git a/theme/desert/css/general.css b/theme/desert/css/general.css index d52c68f004..1aa982cf4d 100644 --- a/theme/desert/css/general.css +++ b/theme/desert/css/general.css @@ -693,3 +693,17 @@ td { padding-top: 2px; padding-bottom: 2px; } + +div.menu_invisible_css, div.sub_menu_invisible_css, td.menu_invisible_css, td.sub_menu_invisible_css { + background-color: #dddddd; + font-style: italic; +} + +strong.menu_invisible_css, strong.sub_menu_invisible_css { + color: #999999; + font-style: italic; +} + +.menu_locked_css, .sub_menu_locked_css { + color: #ffeeee; +} diff --git a/theme/org/css/general.css b/theme/org/css/general.css index dde4d1ee48..14542836e9 100644 --- a/theme/org/css/general.css +++ b/theme/org/css/general.css @@ -580,3 +580,17 @@ ul, ol { padding-top : 2px; padding-bottom : 2px; } + +div.menu_invisible_css, div.sub_menu_invisible_css, td.menu_invisible_css, td.sub_menu_invisible_css { + background-color: #dddddd; + font-style: italic; +} + +strong.menu_invisible_css, strong.sub_menu_invisible_css { + color: #999999; + font-style: italic; +} + +.menu_locked_css, .sub_menu_locked_css { + color: #ffeeee; +}