From 078fb64e34bdafe1899836a449c4835a63b706cc Mon Sep 17 00:00:00 2001 From: Christoph Bleiweis Date: Tue, 21 Nov 2017 15:07:22 +0100 Subject: [PATCH] Pagetree output vars (#315) * Added page tree and backend JS as output vars (#312), (#313) and (#314) --- wbce/admin/pages/index.php | 40 +++++++++++++------ .../argos_theme_reloaded/templates/pages.htt | 3 ++ .../wbce_flat_theme/templates/pages.htt | 4 +- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/wbce/admin/pages/index.php b/wbce/admin/pages/index.php index c22688296..76c104f9f 100644 --- a/wbce/admin/pages/index.php +++ b/wbce/admin/pages/index.php @@ -19,23 +19,29 @@ // Include the WB functions file require_once(WB_PATH.'/framework/functions.php'); -/** - * Include PageTree script - * -*/ -if (file_exists(THEME_PATH.'/patch/page_tree.php')) : +// Include page tree and define output +ob_start(); +if (file_exists(THEME_PATH.'/patch/page_tree.php')) { require_once(THEME_PATH.'/patch/page_tree.php'); -else : +} else { require_once(dirname(__FILE__).'/page_tree/page_tree.php'); -endif; +} +$pageTreeOutput = ob_get_clean(); // Setup template object $template = new Template(dirname($admin->correct_theme_source('pages.htt'))); +// Disable removing of unknown vars +$template->set_unknowns('keep'); + $template->set_file('page', 'pages.htt'); $template->set_block('page', 'main_block', 'main'); $template->set_var('FTAN', $admin->getFTAN()); +// Set page tree as var +$template->set_var('PAGE_TREE', $pageTreeOutput); + + /** * Insert values into the add page form * @@ -238,6 +244,7 @@ function parent_list($parent){ ); // Insert language text and messages $template->set_var(array( + 'TEXT_PAGES' => $MENU['PAGES'], 'TEXT_TITLE' => $TEXT['TITLE'], 'TEXT_TYPE' => $TEXT['TYPE'], 'TEXT_PARENT' => $TEXT['PARENT'], @@ -267,17 +274,24 @@ function parent_list($parent){ $template->set_var('DISPLAY_INTRO', 'hide'); } +// Include JavaScript backend includes and define output +ob_start(); +$jsadminFile = WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php'; +if(is_file($jsadminFile)) { + include($jsadminFile); +} +$jsAdminOutput = ob_get_clean(); + +// Oadd eggsurplus Javascript to output +$jsAdminOutput .= PHP_EOL . ''; + +// Set JavaScript backend as var +$template->set_var('JS_ADMIN', $jsAdminOutput); // Parse template object $template->parse('main', 'main_block', false); $template->pparse('output', 'page'); -// include the required file for Javascript admin -$jsadmin_file = WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php'; -if($jsadmin_file) include($jsadmin_file); -?> - -print_footer(); ?> diff --git a/wbce/templates/argos_theme_reloaded/templates/pages.htt b/wbce/templates/argos_theme_reloaded/templates/pages.htt index 41b83d5fd..01f531ffd 100644 --- a/wbce/templates/argos_theme_reloaded/templates/pages.htt +++ b/wbce/templates/argos_theme_reloaded/templates/pages.htt @@ -1,4 +1,5 @@ +{PAGE_TREE}
@@ -132,4 +133,6 @@ } }); + +{JS_ADMIN} diff --git a/wbce/templates/wbce_flat_theme/templates/pages.htt b/wbce/templates/wbce_flat_theme/templates/pages.htt index 7a91b17b4..43bb96c71 100644 --- a/wbce/templates/wbce_flat_theme/templates/pages.htt +++ b/wbce/templates/wbce_flat_theme/templates/pages.htt @@ -1,5 +1,5 @@ - +{PAGE_TREE}

{PAGES}

@@ -276,4 +276,6 @@ } + +{JS_ADMIN}