]> git.mxchange.org Git - mailer.git/commitdiff
Invisible/locked menus are now styleable with CSS classes (sub_)menu_[in]visible_css...
authorRoland Häder <roland@mxchange.org>
Tue, 8 Jun 2010 00:00:47 +0000 (00:00 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 8 Jun 2010 00:00:47 +0000 (00:00 +0000)
14 files changed:
inc/functions.php
inc/mysql-manager.php
templates/de/html/guest/guest_menu_bottom.tpl
templates/de/html/guest/guest_menu_row.tpl
templates/de/html/guest/guest_menu_title.tpl
templates/de/html/guest/guest_menu_whats.tpl
templates/de/html/member/member_menu_bottom.tpl
templates/de/html/member/member_menu_row.tpl
templates/de/html/member/member_menu_title.tpl
templates/de/html/member/member_menu_whats.tpl
theme/business/css/general.css
theme/default/css/general.css
theme/desert/css/general.css
theme/org/css/general.css

index 864e26f9678eda20f32524877b8129e96053070e..5a5507bab8f13d8c8a12b519fba444de03eaf2f8 100644 (file)
@@ -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=<pre>'.print_r($content, true).'</pre>');
+                       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=<pre>'.print_r($content, true).'</pre>');
+                       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!
index c74bf46c3c002136db1c27d6aa9008a0e244306d..b988afb7d9c5c954af4ddd788e896a79d349a5c8 100644 (file)
@@ -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()."*<br />");
@@ -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()."*<br />");
-                       // 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']."!!!<br />");
+                                       //* DEBUG: */ print(__LINE__ . ':!!!!' . $content['sub_what'] . '!!!<br />');
                                        $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()."*<br />");
                        }
 
+                       // Free result
+                       SQL_FREERESULT($result_sub);
+
+                       // Count one up
                        $main_cnt++;
 
                        //* DEBUG: */ print(__LINE__.'/'.$main_cnt.':'.getWhat()."*<br />");
index cff0c9a227bee710c3718cb3468c89abf83666e8..bad295e3b8cafe2df3ee1fa81a25f53847805e3b 100644 (file)
@@ -1,3 +1,5 @@
 <tr>
-       <td class="guest_menu_bottom" id="guest_menu_what_$content[what]">$content[menu]</td>
+       <td class="guest_menu_bottom $content[visible_css] $content[locked_css]" id="guest_menu_what_$content[what]">
+               <div class="$content[visible_css] $content[locked_css]">$content[menu]</div>
+       </td>
 </tr>
index 856c660ab2c8b8c3826bdd84cf9f04be80da0c85..d4ed80413d5766f1f47fb59cddcaf0efd6118234 100644 (file)
@@ -1,3 +1,5 @@
 <tr>
-       <td class="guest_menu_row" id="guest_menu_what_$content[what]">$content[menu]</td>
+       <td class="guest_menu_row $content[visible_css] $content[locked_css]" id="guest_menu_what_$content[what]">
+               <div class="$content[visible_css] $content[locked_css]">$content[menu]</div>
+       </td>
 </tr>
index d245d39e288e392e8b7c14764bf3058bb86b6271..d927e5f7a7b1b269cc03489308d5eca71811d166 100644 (file)
@@ -1,5 +1,7 @@
 <tr>
-       <td align="center" colspan="2" class="guest_menu_title" id="guest_menu_action_$content[action]">
-               <strong>:::$content[title]:::</strong>
+       <td align="center" colspan="2" class="guest_menu_title visible_css locked_css" id="guest_menu_action_$content[action]">
+               <strong class="$content[visible_css] $content[locked_css]">
+                       ::: $content[title] :::
+               </strong>
        </td>
 </tr>
index 34255aa676f2be4ed58c8e0e9018d0066ceec537..7c33dfa9e882bd7a2d7246398af42031be370772 100644 (file)
@@ -1,6 +1,8 @@
 <tr>
-       <td class="guest_menu_whats">
-               <strong><big>&middot;</big></strong>
-               $content
+       <td class="guest_menu_whats $content[visible_css] $content[locked_css]">
+               <div class="$content[visible_css] $content[locked_css]">
+                       <strong><big>&middot;</big></strong>
+                       $content
+               </div>
        </td>
 </tr>
index 8b42c0f6ed79b25d4c42a204a726a039e56fc58e..b5111c0ff98ed7bfe0b96a257859da671e1b6062 100644 (file)
@@ -1,5 +1,5 @@
 <tr>
-       <td class="member_menu_bottom" id="member_menu_what_$content[what]">
-               $content[menu]
+       <td class="member_menu_bottom $content[visible_css] $content[locked_css]" id="member_menu_what_$content[what]">
+               <div class="$content[visible_css] $content[locked_css]">$content[menu]</div>
        </td>
 </tr>
index 9dc45d750be5d36eb382217acc9e2682f9e2ff72..c406aa7d9f2dabc09dff0e053d527626ddfc7042 100644 (file)
@@ -1,3 +1,5 @@
 <tr>
-       <td class="member_menu_row" id="member_menu_what_$content[what]">$content[menu]</td>
+       <td class="member_menu_row $content[visible_css] $content[locked_css]" id="member_menu_what_$content[what]">
+               <div class="$content[visible_css] $content[locked_css]">$content[menu]</div>
+       </td>
 </tr>
index db1d0fd7a2cc6e16141db5f9ac8e95ce75f85c50..3b8244aa0e94f4b5d51aba026f06abda9f3a8bab 100644 (file)
@@ -1,5 +1,7 @@
 <tr>
-       <td align="center" colspan="2" class="member_menu_title" id="member_menu_action_$content[action]">
-               <strong>:::&nbsp;$content[title]&nbsp;:::</strong>
+       <td align="center" colspan="2" class="member_menu_title visible_css locked_css" id="member_menu_action_$content[action]">
+               <strong class="$content[visible_css] $content[locked_css]">
+                       ::: $content[title] :::
+               </strong>
        </td>
 </tr>
index 8295fcb4dd0700f6fe6ac99f6b872a389f0f2205..5938b75652a0b17af0824a729b32609a6e46db8c 100644 (file)
@@ -1,6 +1,8 @@
 <tr>
-       <td class="member_menu_whats">
-               <strong><big>&middot;</big></strong>
-               $content
+       <td class="member_menu_whats $content[visible_css] $content[locked_css]">
+               <div class="$content[visible_css] $content[locked_css]">
+                       <strong><big>&middot;</big></strong>
+                       $content
+               </div>
        </td>
 </tr>
index a02a1bf07b95288de636a1e6e866cef891950860..486f5c58289cb6c693fd42b5a49c08f5e1444faf 100644 (file)
@@ -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;
+}
index 90cb5f7fba7f9137fc21f3b866c2f14f042fc74a..e16d8fe3bf16cc1b1704b434b50a0451541cebaf 100644 (file)
@@ -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;
+}
index d52c68f004f8709f835634330a45b5ae53834cf7..1aa982cf4dda0de831deced1cb2efd97fed0603f 100644 (file)
@@ -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;
+}
index dde4d1ee487bfb8efb63eee0a7466587a48d3425..14542836e91f7b789808bd4828a6a2a280ec67fd 100644 (file)
@@ -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;
+}