From: quix0r Date: Wed, 23 Jun 2010 12:00:01 +0000 (+0000) Subject: Now CSS classes are being inserted by EL X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6f66e8a06ec1820eb9bbee8e0c3a788c62b49f71;p=mailer.git Now CSS classes are being inserted by EL --- diff --git a/inc/functions.php b/inc/functions.php index 887faea62a..59f6307c2d 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -871,24 +871,24 @@ function translateUserStatus ($status) { // "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']) { + switch ($content['visible']) { // Should be visible - case 'Y': $content[$prefix . 'visible_css'] = $prefix . 'menu_visible' ; break; - case 'N': $content[$prefix . 'visible_css'] = $prefix . 'menu_invisible'; break; + case 'Y': $content['visible_css'] = $prefix . 'menu_visible' ; break; + case 'N': $content['visible_css'] = $prefix . 'menu_invisible'; break; default: // Please report this - debug_report_bug(__FUNCTION__, __LINE__, 'Unsupported visible value detected. content=
'.print_r($content, true).'
'); + debug_report_bug(__FUNCTION__, __LINE__, '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']) { + switch ($content['locked']) { // Should be locked - case 'Y': $content[$prefix . 'locked_css'] = $prefix . 'menu_locked' ; break; - case 'N': $content[$prefix . 'locked_css'] = $prefix . 'menu_unlocked'; break; + case 'Y': $content['locked_css'] = $prefix . 'menu_locked' ; break; + case 'N': $content['locked_css'] = $prefix . 'menu_unlocked'; break; default: // Please report this - debug_report_bug(__FUNCTION__, __LINE__, 'Unsupported locked value detected. content=
'.print_r($content, true).'
'); + debug_report_bug(__FUNCTION__, __LINE__, 'Unsupported locked value detected. content=
' . print_r($content, true) . '
'); break; } // END - switch @@ -896,6 +896,25 @@ function translateMenuVisibleLocked ($content, $prefix = '') { return $content; } +// "Getter" for menu CSS classes, mainly used in templates +function getMenuCssClasses ($data) { + // $data needs to be converted into an array + $content = explode('|', $data); + + // Non-existent index 2 will happen in menu blocks + if (!isset($content[2])) $content[2] = ''; + + // Re-construct the array: 0=visible,1=locked,2=prefix + $content['visible'] = $content[0]; + $content['locked'] = $content[1]; + + // Call our "translator" function + $content = translateMenuVisibleLocked($content, $content[2]); + + // Return CSS classes + return ($content['visible_css'] . ' ' . $content['locked_css']); +} + // Generates an URL for the dereferer function generateDerefererUrl ($URL) { // Don't de-refer our own links! @@ -1106,7 +1125,7 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true if ($fuzzyFound === true) continue; // Take all string elements - if ((is_string($matches[4][$key])) && (!isset($matchesFound[$match])) && (!isset($matchesFound[$key."_" . $matches[4][$key]]))) { + if ((is_string($matches[4][$key])) && (!isset($matchesFound[$match])) && (!isset($matchesFound[$key.'_' . $matches[4][$key]]))) { // Replace it in the code //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "key={$key},match={$match}
"); $newMatch = str_replace('[', "['", str_replace(']', "']", $match)); @@ -1187,7 +1206,7 @@ function addSelectionBox ($type, $default, $prefix = '', $id = '0', $class = 're $OUT .= ''; diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 362fa1f780..e0f7837154 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -406,7 +406,15 @@ 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`, `visible`, `locked` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE (`what`='' OR `what` IS NULL)".$ADD." ORDER BY `sort` ASC", + $result_main = SQL_QUERY_ESC("SELECT + `title`, `what`, `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()."*
"); @@ -414,16 +422,28 @@ function addMenu ($mode, $action, $what) { // There are menus available, so we simply display them... :) $GLOBALS['rows'] = ''; while ($content = SQL_FETCHARRAY($result_main)) { - //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].':'.getWhat()."*
"); + //* DEBUG: */ print(__LINE__ . '/' . $main_cnt . '/' . $content['action'] . ':' . getWhat() . '*
'); // Init/"translate" variables enableBlockMode(false); - $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, `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", + $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__); // Do we have some entries? @@ -436,9 +456,6 @@ 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 = ''; @@ -477,11 +494,11 @@ function addMenu ($mode, $action, $what) { $cnt++; // Rewrite array - $content = array( - 'menu' => $OUT, - 'what' => $content['sub_what'], - 'visible_css' => $content['sub_visible_css'], - 'locked_css' => $content['sub_locked_css'] + $content = array( + 'menu' => $OUT, + 'what' => $content['sub_what'], + 'visible' => $content['sub_visible'], + 'locked' => $content['locked'], ); // Add regular menu row or bottom row? diff --git a/templates/de/html/guest/guest_menu_bottom.tpl b/templates/de/html/guest/guest_menu_bottom.tpl index bad295e3b8..19163042a1 100644 --- a/templates/de/html/guest/guest_menu_bottom.tpl +++ b/templates/de/html/guest/guest_menu_bottom.tpl @@ -1,5 +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 d4ed80413d..a6eec44420 100644 --- a/templates/de/html/guest/guest_menu_row.tpl +++ b/templates/de/html/guest/guest_menu_row.tpl @@ -1,5 +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 d927e5f7a7..2e2f578582 100644 --- a/templates/de/html/guest/guest_menu_title.tpl +++ b/templates/de/html/guest/guest_menu_title.tpl @@ -1,6 +1,6 @@ - - + + ::: $content[title] ::: diff --git a/templates/de/html/guest/guest_menu_whats.tpl b/templates/de/html/guest/guest_menu_whats.tpl index 7c33dfa9e8..9bf5b19391 100644 --- a/templates/de/html/guest/guest_menu_whats.tpl +++ b/templates/de/html/guest/guest_menu_whats.tpl @@ -1,6 +1,6 @@ - -
+ +
· $content
diff --git a/templates/de/html/member/member_menu_bottom.tpl b/templates/de/html/member/member_menu_bottom.tpl index b5111c0ff9..9bdd9bfe8b 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 c406aa7d9f..25d2bb2dbf 100644 --- a/templates/de/html/member/member_menu_row.tpl +++ b/templates/de/html/member/member_menu_row.tpl @@ -1,5 +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 3b8244aa0e..32873a1f5b 100644 --- a/templates/de/html/member/member_menu_title.tpl +++ b/templates/de/html/member/member_menu_title.tpl @@ -1,6 +1,6 @@ - - + + ::: $content[title] ::: diff --git a/templates/de/html/member/member_menu_whats.tpl b/templates/de/html/member/member_menu_whats.tpl index 5938b75652..68b8776a7a 100644 --- a/templates/de/html/member/member_menu_whats.tpl +++ b/templates/de/html/member/member_menu_whats.tpl @@ -1,6 +1,6 @@ - -
+ +
· $content