diff --git a/html/class/template.php b/html/class/template.php index 76ddbd5a4..68923f299 100644 --- a/html/class/template.php +++ b/html/class/template.php @@ -11,7 +11,6 @@ * @license GPL 2.0 */ - if (!defined('SMARTY_DIR')) { exit(); } @@ -41,7 +40,8 @@ public function __construct() if (1 == $xoopsConfig['theme_fromfile']) { $this->_canUpdateFromFile = true; $this->compile_check = false; /* This should be set to false on an active site*/ - $this->force_compile = true; + $this->force_compile = true; /* This setting overrides $compile_check. By default this is FALSE. + This is handy for development and debugging. It should never be used in a production environment.*/ } else { $this->_canUpdateFromFile = false; $this->compile_check = false; @@ -52,13 +52,27 @@ public function __construct() $this->template_dir = XOOPS_THEME_PATH; $this->cache_dir = XOOPS_CACHE_PATH; $this->compile_dir = XOOPS_COMPILE_PATH; - //loading under root_path for compatibility with XCL2.1 + //Loading under root_path for compatibility with XCL2.1 //$this->plugins_dir = [SMARTY_DIR . 'plugins', XOOPS_ROOT_PATH . '/class/smarty/plugins']; $this->plugins_dir = [SMARTY_DIR . 'plugins']; - + // Legacy_RenderSystem // $this->default_template_handler_func = 'xoops_template_create'; $this->use_sub_dirs = false; - + + // Legacy compatility requirement for development and debugging of templates + // Because D3 modules can use XoopsTpl class without Cube's boot + if (isset($GLOBALS['xoopsUserIsAdmin'])) { + $isadmin['xoops_isadmin']=$GLOBALS['xoopsUserIsAdmin']; + }else{ + $isadmin['xoops_isadmin']=false; + } + // Render System - get config preferences e.g. logotype, favicon + // for D3 modules who don't delegate XoopsTpl.New + $moduleHandler = xoops_gethandler('module'); + $legacyRender =& $moduleHandler->getByDirname('legacyRender'); + $configHandler = xoops_gethandler('config'); + $configs =& $configHandler->getConfigsByCat(0, $legacyRender->get('mid')); + $this->assign( [ 'xoops_url' => XOOPS_URL, @@ -66,7 +80,10 @@ public function __construct() 'xoops_langcode' => _LANGCODE, 'xoops_charset' => _CHARSET, 'xoops_version' => XOOPS_VERSION, - 'xoops_upload_url' => XOOPS_UPLOAD_URL + 'xoops_upload_url' => XOOPS_UPLOAD_URL, + 'xoops_isadmin' => $isadmin, + 'logotype' => $configs['logotype'], + 'favicon' => $configs['favicon'] ] ); @@ -191,7 +208,7 @@ public function xoops_fetchFromData(&$data) } /** - * + * _canUpdateFromFile **/ public function xoops_canUpdateFromFile() { diff --git a/html/modules/legacy/admin/theme/site.webmanifest b/html/modules/legacy/admin/theme/site.webmanifest deleted file mode 100644 index 40ffdb90a..000000000 --- a/html/modules/legacy/admin/theme/site.webmanifest +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "XCL App", - "short_name": "XCL App", - "icons": [ - { - "src": "./design/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "./design/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "#212527", - "background_color": "#212527", - "start_url": "./index.php?utm_source=homescreen", - "display": "standalone" -} diff --git a/html/modules/legacy/kernel/Legacy_Controller.class.php b/html/modules/legacy/kernel/Legacy_Controller.class.php index 88487037b..cd92308a0 100644 --- a/html/modules/legacy/kernel/Legacy_Controller.class.php +++ b/html/modules/legacy/kernel/Legacy_Controller.class.php @@ -1,11 +1,11 @@ isEnableCache() && $this->existActiveCacheFile($filepath, $blockProcedure->getCacheTime())) { $content = $this->loadCache($filepath); if ($blockProcedure->isDisplay() && !empty($content)) { @@ -434,7 +434,7 @@ public function _processBlock() if ($blockProcedure->isDisplay()) { $renderBuffer =& $blockProcedure->getRenderTarget(); // Note : version 2.3.0 - // @gigamaster added 'getTemplate' for block link in theme + // @gigamaster added 'getTemplate' to link block in front theme $context->mAttributes['legacy_BlockShowFlags'][$blockProcedure->getEntryIndex()] = true; $context->mAttributes['legacy_BlockContents'][$blockProcedure->getEntryIndex()][] = [ 'name' => $blockProcedure->getName(), @@ -1218,7 +1218,7 @@ public function executeRedirect($url, $time = 1, $message = null, $addRedirect = // @TODO test XOOPS2 Compatibility $addredirect = true -// TODO uncomment line 1195 + // TODO uncomment to test // $addRedirect = $addredirect = true; if ($addRedirect && strpos($url, 'user.php') !== false) { @@ -1246,13 +1246,8 @@ public function executeRedirect($url, $time = 1, $message = null, $addRedirect = /* XCL 2.3.x * @gigamaster added theme_set, theme_url and theme_css (custom templates from theme) - * @gigamaster added logotype, use $configs for LegacyRender + * also Render configs for X2 and D3 compatibility, refer to /class/template.php */ - $moduleHandler = xoops_gethandler('module'); - $legacyRender =& $moduleHandler->getByDirname('legacyRender'); - $configHandler = xoops_gethandler('config'); - $configs =& $configHandler->getConfigsByCat(0, $legacyRender->get('mid')); - if (!defined('XOOPS_CPFUNC_LOADED')) { require_once XOOPS_ROOT_PATH.'/class/template.php'; $xoopsTpl = new XoopsTpl(); @@ -1263,7 +1258,6 @@ public function executeRedirect($url, $time = 1, $message = null, $addRedirect = 'theme_set' =>htmlspecialchars($xoopsConfig['theme_set'], ENT_QUOTES), 'theme_url' =>XOOPS_THEME_URL . '/' . $xoopsConfig['theme_set'], 'theme_css' =>getcss(), - 'logotype' =>$configs['logotype'], 'langcode' =>_LANGCODE, 'charset' =>_CHARSET, 'time' =>$time, @@ -1274,7 +1268,7 @@ public function executeRedirect($url, $time = 1, $message = null, $addRedirect = ); $GLOBALS['xoopsModuleUpdate'] = 1; - $xoopsTpl->display('db:system_redirect.html'); // TODO gigamaster + $xoopsTpl->display('db:system_redirect.html'); // Legacy compatibility } else { @@ -1501,7 +1495,7 @@ public function setupModuleContext(&$context, $dirname) if (!is_object($module)) { XCube_DelegateUtils::call('Legacy.Event.Exception.XoopsModuleNotFound', $dirname); - $this->mController->executeRedirect(XOOPS_URL . '/', 1, 'You can\'t access this URL.'); // TODO need message catalog. + $this->mController->executeRedirect(XOOPS_URL . '/', 1, 'You can\'t access this URL.'); // TODO need message catalog. die(); } diff --git a/html/modules/legacy/preload/Primary/SiteClose.class.php b/html/modules/legacy/preload/Primary/SiteClose.class.php index 37361e83c..55f8d2747 100644 --- a/html/modules/legacy/preload/Primary/SiteClose.class.php +++ b/html/modules/legacy/preload/Primary/SiteClose.class.php @@ -56,6 +56,9 @@ public static function callbackSetupUser(&$principal, &$controller, &$context) /* XCL 2.3.x * @gigamaster added theme_set, theme_url and theme_css (custom templates from theme) * @gigamaster added logotype, use $configs for LegacyRender + * + * Render System - get config preferences e.g. logotype, footer + * for D3 modules who don't delegate XoopsTpl.New */ $moduleHandler = xoops_gethandler('module'); $legacyRender =& $moduleHandler->getByDirname('legacyRender'); @@ -78,6 +81,7 @@ public static function callbackSetupUser(&$principal, &$controller, &$context) 'lang_password' => _PASSWORD, 'lang_siteclosemsg' => $xoopsConfig['closesite_text'], 'logotype' => $configs['logotype'], + 'favicon' => $configs['favicon'], 'footer' => $configs['footer'] ] ); diff --git a/html/modules/legacyRender/admin/actions/AdminRenderAction.class.php b/html/modules/legacyRender/admin/actions/AdminRenderAction.class.php index be1ac32f8..c0e97f896 100644 --- a/html/modules/legacyRender/admin/actions/AdminRenderAction.class.php +++ b/html/modules/legacyRender/admin/actions/AdminRenderAction.class.php @@ -25,7 +25,8 @@ public function executeViewSuccess(&$controller, &$xoopsUser, &$render) $xoopsConfig = $controller->mRoot->mContext->getXoopsConfig(); $mRoot = $controller->mRoot; $mContext = $mRoot->mContext; - + + // Render System - get configurations categories $moduleHandler = xoops_gethandler('module'); $legacyRender =& $moduleHandler->getByDirname('legacyRender'); $configHandler = xoops_gethandler('config'); diff --git a/html/modules/legacyRender/admin/templates/admin_render.html b/html/modules/legacyRender/admin/templates/admin_render.html index b32a7afcc..001c5fe35 100644 --- a/html/modules/legacyRender/admin/templates/admin_render.html +++ b/html/modules/legacyRender/admin/templates/admin_render.html @@ -99,12 +99,11 @@
The Web Application Platform Renderer uses Smarty Template Engine to provide data to FrontEnd and BackEnd.
- You can edit both, FrontEnd and BackEnd theme and templates with HTML, CSS, JavaScript and of course some
+
The Web Application Platform Renderer uses Smarty Template Engine for the Frontend and Backend.
+ You can edit both, Frontend and Backend themes and templates with HTML, CSS, JavaScript and of course some
Smarty code to add logic, dynamic data, and personalization rules to your templates.
This overview provides basic information of the Render syntax built on Smarty
- to help you get started with Smarty theme and template files.
+
This overview provides basic information to help you get started with the Render syntax built on Smarty.
The system default theme for the frontend uses the suffix _default
- While the default admin theme for the backend uses a prefix admin_
The default theme for the frontend uses the suffix _default _default
+ While the default backend admin theme uses a prefix admin_
A custom theme can inherit the functionality, features, and style of the default theme and default template-set.
- You can copy to your custom theme only the templates you need to customize without making any changes to default set.
Custom themes can save time and effort, they are also a safer solution because of the automatic fallback to default settings.
The Smarty tags defined here are needed for the Core Render and components to work properly!
- When making a custom theme, you should base it on the following Smarty Engine variables.
Each installed module has a number of templates. These templates are automatically added to the default template set. +
A custom theme inherits the functionality, features, and style of the default set.
+ +It is recommended to duplicate the default template set before any customization. You can do it from the Admin using the following modules:
+
In order to customize modules templates or blocks templates (prefix block_)
+Custom themes can save time and effort, they are also a safer solution because of the automatic fallback to default settings.
+ +.tpl
is used for email templates by convention.
You can put a copy of default templates in the theme directory e.g.: /themes/theme_name/templates/module_name/
it was /theme_name/modules/templates/ prior to version 2.3.x
Smarty uses a markup-like syntax which is similar to HTML tags.
+ The tags are shorter and more readable than embedding plain PHP on pages.
All Smarty tags, variables and functions start with a left delimiter curly bracket { and end with a right curly bracket } within <> like HTML.
+ +The Render engine will handle the delimiters present in Theme and templates to generate valid HTML. +
+
-// XCube module directory tree
+// XCube module admin directory tree
module-name
├── admin
@@ -174,23 +207,22 @@ Default Templates
└── components [optional]
- Smarty uses a markup-like syntax which is similar to HTML tags.
- The tags are shorter and more readable than embedding plain PHP on pages.
+// D3 in module TRUST_PATH directory
- Tag delimiters
+module-name *
+└── templates
+ ├── blocks
+ ├── components [optional]
+ └── stylesheets [optional]
- All Smarty tags, variables and functions start with a left delimiter curly bracket { and end with a right curly bracket } within <> like HTML.
+* D3 duplicatable modules D4Forum, Pico
+
+
- The Render engine will handle the delimiters present in Theme and templates to generate valid HTML. -
X2 Themes | -XCL Themes | +X2 / XCL Themes | +XRENDER V3 | Output |
---|---|---|---|---|
- |
|
- <{$favicon}> | -||
+ |
|
|
<{$logotype}> | |
|
+
|
+ <{$favicon}> | +||
|
- + |
|
CSS style and JavaScript added by module header | |
|
- + |
|
CSS style and JavaScript added by block | |
|
|
- <{$app_version}> | +<{$xoops_version}> | |
|
|
- <{$upload_url}> | +<{$xoops_upload_url}> | |
|
@@ -387,6 +419,9 @@