From a092b3b0d28cb60db3500d8e1b0e149aea051bc1 Mon Sep 17 00:00:00 2001 From: quix0r Date: Sun, 25 Nov 2012 20:18:24 +0000 Subject: [PATCH] New function getMenuModeFromModule() introduced: - Introduced getMenuModeFromModule() which determines the "menu mode" from given module. This value can also be used for template names - Old template removed (listed.tp) - TODOs.txt updated --- .gitattributes | 3 ++- DOCS/TODOs.txt | 25 ++++++++++---------- inc/filters.php | 6 ++--- inc/functions.php | 1 - inc/module-functions.php | 27 ++++++++++++++++++++++ inc/template-functions.php | 13 ++--------- templates/de/html/admin/admin_metadata.tpl | 1 + templates/de/html/guest/guest_metadata.tpl | 4 ++++ templates/de/html/listed.tp | 0 templates/de/html/metadata.tpl | 5 +--- 10 files changed, 53 insertions(+), 32 deletions(-) create mode 100644 templates/de/html/admin/admin_metadata.tpl create mode 100644 templates/de/html/guest/guest_metadata.tpl delete mode 100644 templates/de/html/listed.tp diff --git a/.gitattributes b/.gitattributes index d6c907e9aa..51d3c4e59d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1569,6 +1569,7 @@ templates/de/html/admin/admin_menu_hints.tpl svneol=native#text/plain templates/de/html/admin/admin_menu_hints_row.tpl svneol=native#text/plain templates/de/html/admin/admin_menu_overview_row.tpl svneol=native#text/plain templates/de/html/admin/admin_menu_status_row.tpl svneol=native#text/plain +templates/de/html/admin/admin_metadata.tpl svneol=native#text/plain templates/de/html/admin/admin_mini_online.tpl svneol=native#text/plain templates/de/html/admin/admin_mods_footer_edit.tpl svneol=native#text/plain templates/de/html/admin/admin_mods_footer_list.tpl svneol=native#text/plain @@ -1800,6 +1801,7 @@ templates/de/html/guest/guest_menu_content.tpl svneol=native#text/plain templates/de/html/guest/guest_menu_row.tpl svneol=native#text/plain templates/de/html/guest/guest_menu_td.tpl svneol=native#text/plain templates/de/html/guest/guest_menu_title.tpl svneol=native#text/plain +templates/de/html/guest/guest_metadata.tpl svneol=native#text/plain templates/de/html/guest/guest_nickname_login.tpl svneol=native#text/plain templates/de/html/guest/guest_paidlinks_register.tpl svneol=native#text/plain templates/de/html/guest/guest_paidlinks_register_header.tpl svneol=native#text/plain @@ -1873,7 +1875,6 @@ templates/de/html/js/js_surfbar_member_edit.tpl svneol=native#text/plain templates/de/html/js/js_surfbar_stopped.tpl svneol=native#text/plain templates/de/html/js/js_uberwach.tpl svneol=native#text/plain templates/de/html/lead_code.tpl svneol=native#text/plain -templates/de/html/listed.tp -text templates/de/html/loader.tpl svneol=native#text/plain templates/de/html/login_failed_js.tpl svneol=native#text/plain templates/de/html/login_failures.tpl svneol=native#text/plain diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index a00ba05614..ba1aef8f21 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -53,13 +53,13 @@ ./inc/filter/cache_filter.php:94: // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal. ./inc/filter/forced_filter.php:73: // @TODO This part is unfinished ./inc/filters.php:1320: // @TODO No banner found, output some default banner -./inc/functions.php:1102: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ? -./inc/functions.php:1188: // @TODO Are these convertions still required? -./inc/functions.php:1209:// @TODO Rewrite this function to use readFromFile() and writeToFile() -./inc/functions.php:1814: // @TODO Find a way to cache this -./inc/functions.php:1919: // @TODO This is still very static, rewrite it somehow -./inc/functions.php:2123: // @TODO Rename column data_type to e.g. mail_status -./inc/functions.php:2473:// @TODO cacheFiles is not yet supported +./inc/functions.php:1104: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ? +./inc/functions.php:1190: // @TODO Are these convertions still required? +./inc/functions.php:1211:// @TODO Rewrite this function to use readFromFile() and writeToFile() +./inc/functions.php:1816: // @TODO Find a way to cache this +./inc/functions.php:1921: // @TODO This is still very static, rewrite it somehow +./inc/functions.php:2125: // @TODO Rename column data_type to e.g. mail_status +./inc/functions.php:2475:// @TODO cacheFiles is not yet supported ./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter ./inc/header.php:66:// @TODO Find a way to not use direct module comparison ./inc/install-functions.php:402: // @TODO Comparing with DEFAULT_MAIN_TITLE doesn't work @@ -134,7 +134,7 @@ ./inc/modules/admin/what-holiday_list.php:46:// @TODO Unused at the moment ./inc/modules/admin/what-list_admins_acls.php:126: // @TODO Rewrite this to filter 'run_sqls' ./inc/modules/admin/what-list_autopurge.php:47:// @TODO Rewrite those lines to filter -./inc/modules/admin/what-list_bonus.php:137: // @TODO Can't this be moved into our expression language? +./inc/modules/admin/what-list_bonus.php:136: // @TODO Can't this be moved into our expression language? ./inc/modules/admin/what-list_links.php:96: // @TODO Rewrite this to includes/filter ./inc/modules/admin/what-list_mods.php:55: // @TODO This can be moved into mysql-function.php, see checkModulePermissions() function ./inc/modules/admin/what-list_rallye_prices.php:222: // @TODO Rewrite these two constants @@ -194,14 +194,14 @@ ./inc/template-functions.php:1145: // @TODO Deprecate this thing ./inc/template-functions.php:1252: // @TODO This can be easily moved out after the merge from EL branch to this is complete ./inc/template-functions.php:1301: // @TODO Add a little more infos here -./inc/template-functions.php:1676:// @TODO Lame description for this function -./inc/template-functions.php:1698: // @TODO Move this in a filter +./inc/template-functions.php:1667:// @TODO Lame description for this function +./inc/template-functions.php:1689: // @TODO Move this in a filter ./inc/template-functions.php:200: * @TODO On some pages this is buggy -./inc/template-functions.php:2313: // @TODO Is this needed for e.g. $GLOBALS['template_content'] ? $this->setRawTemplateData($compactedContent); +./inc/template-functions.php:2323: // @TODO Is this needed for e.g. $GLOBALS['template_content'] ? $this->setRawTemplateData($compactedContent); ./inc/template-functions.php:288: // @TODO Remove these sanity checks if all is fine ./inc/template-functions.php:625:// @TODO $simple/$constants are deprecated ./inc/template-functions.php:723: // @TODO $userid is deprecated and should be removed from loadEmailTemplate() and replaced with $content[userid] in all templates -./inc/wrapper-functions.php:3008: // @TODO Find a way to not use direct module comparison +./inc/wrapper-functions.php:3020: // @TODO Find a way to not use direct module comparison ./inc/wrapper-functions.php:512:// @TODO Do some more sanity check here ./inc/xml-functions.php:240: // @TODO Handle characters ./mailid.php:102: // @TODO Rewrite this to a filter @@ -323,6 +323,7 @@ ./templates/de/html/guest/guest_paidlinks_register_header.tpl:1: ./templates/de/html/guest/guest_paidlinks_register.tpl:1: ./templates/de/html/install/install_header.tpl:1: +./templates/de/html/metadata.tpl:1: ./templates/de/html/theme_one.tpl:1: ./templates/de/html/theme_select_box.tpl:1: ./templates/de/html/theme_select_form.tpl:1: diff --git a/inc/filters.php b/inc/filters.php index ceaaa50cec..bd804baf9b 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -1094,12 +1094,12 @@ function FILTER_LOAD_PAGE_HEADER () { $GLOBALS['__page_header'] = loadTemplate('page_header', TRUE); // Include meta data in 'guest' module - if ((isModuleSet()) && (getModule() == 'index')) { + if (isModuleSet()) { // Load meta data template - $GLOBALS['__page_header'] .= loadTemplate('metadata', TRUE); + $GLOBALS['__page_header'] .= loadTemplate(getMenuModeFromModule() . '_metadata', TRUE); // Add meta description to header - if ((isInstalled()) && (isAdminRegistered()) && (SQL_IS_LINK_UP())) { + if ((isInstalled()) && (isAdminRegistered()) && (SQL_IS_LINK_UP()) && (getModule() == 'index')) { // Add meta description not in admin and login module and when the script is installed generateMetaDescriptionCode(); } // END - if diff --git a/inc/functions.php b/inc/functions.php index 4ff81b5d8d..1935e2a8cc 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1828,7 +1828,6 @@ function mapModuleToTable ($moduleName) { case 'login': // ... and 'login' the member's menu $moduleName = 'member'; break; - // Anything else will not be mapped, silently. } // END - switch diff --git a/inc/module-functions.php b/inc/module-functions.php index 9c9fafac9d..cf0ea0d049 100644 --- a/inc/module-functions.php +++ b/inc/module-functions.php @@ -525,5 +525,32 @@ function doIncludeModule () { loadIncludeOnce('inc/footer.php'); } +// "Getter" for menu mode from given module +function getMenuModeFromModule () { + // Is cache set? + if (!isset($GLOBALS[__FUNCTION__])) { + // Default is NULL + $GLOBALS[__FUNCTION__] = NULL; + + // Determine it hard-coded + if (getModule() == 'login') { + // Is member area + $GLOBALS[__FUNCTION__] = 'member'; + } elseif (getModule() == 'index') { + // Is guest area + $GLOBALS[__FUNCTION__] = 'guest'; + } elseif (getModule() == 'admin') { + // Is admin area + $GLOBALS[__FUNCTION__] = 'admin'; + } else { + // Get it from filter + $GLOBALS[__FUNCTION__] = runFilterChain('determine_menu_mode'); + } + } // END - if + + // Return it + return $GLOBALS[__FUNCTION__]; +} + // [EOF] ?> diff --git a/inc/template-functions.php b/inc/template-functions.php index e2cb87becc..a4c4d6f0a9 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -1549,17 +1549,8 @@ function determinePageTitle () { $pageTitle .= ' {%config,trim=title_middle%} {DQUOTE} . getModuleTitle(getModule()) . {DQUOTE}'; } // END - if - // Add title from what file - $menuMode = ''; - if (getModule() == 'login') { - $menuMode = 'member'; - } elseif (getModule() == 'index') { - $menuMode = 'guest'; - } elseif (getModule() == 'admin') { - $menuMode = 'admin'; - } elseif (getModule() == 'sponsor') { - $menuMode = 'sponsor'; - } + // Get menu mode from module + $menuMode = getMenuModeFromModule(); // Add middle part (always in admin area!) if ((!empty($menuMode)) && ((isWhatTitleEnabled()) || ($menuMode == 'admin'))) { diff --git a/templates/de/html/admin/admin_metadata.tpl b/templates/de/html/admin/admin_metadata.tpl new file mode 100644 index 0000000000..fddd9683c3 --- /dev/null +++ b/templates/de/html/admin/admin_metadata.tpl @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/templates/de/html/guest/guest_metadata.tpl b/templates/de/html/guest/guest_metadata.tpl new file mode 100644 index 0000000000..a7eb109c89 --- /dev/null +++ b/templates/de/html/guest/guest_metadata.tpl @@ -0,0 +1,4 @@ + + + + diff --git a/templates/de/html/listed.tp b/templates/de/html/listed.tp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/templates/de/html/metadata.tpl b/templates/de/html/metadata.tpl index a7eb109c89..11f5d85d80 100644 --- a/templates/de/html/metadata.tpl +++ b/templates/de/html/metadata.tpl @@ -1,4 +1 @@ - - - - + -- 2.39.2