From 90657255199f19517421bfaed42a1177b964df9b Mon Sep 17 00:00:00 2001 From: Khanh Le Date: Wed, 4 Jun 2014 17:51:12 +0700 Subject: [PATCH] New feature: isolate user settings & customization Update commit e52f6e2 --- .../includes/joomla25/layout/file.php | 3 +++ source/plg_system_t3/includes/joomla25/view.php | 6 +++++- .../plg_system_t3/includes/joomla30/viewlegacy.php | 5 ++++- source/plg_system_t3/t3.php | 14 +++++++++----- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/source/plg_system_t3/includes/joomla25/layout/file.php b/source/plg_system_t3/includes/joomla25/layout/file.php index 2d9be9f781..29c59d5bb0 100644 --- a/source/plg_system_t3/includes/joomla25/layout/file.php +++ b/source/plg_system_t3/includes/joomla25/layout/file.php @@ -372,6 +372,9 @@ protected function refreshIncludePaths() // (2) Standard Joomla! layouts overriden $this->addIncludePaths(JPATH_THEMES . '/' . JFactory::getApplication()->getTemplate() . '/html/layouts'); + // (2.1) - user custom layout overridden + $this->addIncludePaths(T3_CUSTOM_PATH . '/html/layouts'); + // Component layouts & overrides if exist $component = $this->options->get('component', null); diff --git a/source/plg_system_t3/includes/joomla25/view.php b/source/plg_system_t3/includes/joomla25/view.php index 0dffda1b6b..81c5f7619e 100644 --- a/source/plg_system_t3/includes/joomla25/view.php +++ b/source/plg_system_t3/includes/joomla25/view.php @@ -717,10 +717,14 @@ protected function _setPath($type, $path) $component = preg_replace('/[^A-Z0-9_\.-]/i', '', $component); //if it is T3 template, update search path for template - $this->_addPath('template', T3_PATH.'/html/' . $component . '/' . $this->getName()); + $this->_addPath('template', T3_PATH . '/html/' . $component . '/' . $this->getName()); $fallback = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . $this->getName(); $this->_addPath('template', $fallback); + + //search path for user custom folder + $this->_addPath('template', T3_CUSTOM_PATH . '/html/' . $component . '/' . $this->getName()); + } break; } diff --git a/source/plg_system_t3/includes/joomla30/viewlegacy.php b/source/plg_system_t3/includes/joomla30/viewlegacy.php index f3134306eb..9eece58f72 100644 --- a/source/plg_system_t3/includes/joomla30/viewlegacy.php +++ b/source/plg_system_t3/includes/joomla30/viewlegacy.php @@ -729,10 +729,13 @@ protected function _setPath($type, $path) $component = preg_replace('/[^A-Z0-9_\.-]/i', '', $component); //if it is T3 template, update search path for template - $this->_addPath('template', T3_PATH.'/html/' . $component . '/' . $this->getName()); + $this->_addPath('template', T3_PATH . '/html/' . $component . '/' . $this->getName()); $fallback = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . $this->getName(); $this->_addPath('template', $fallback); + + //search path for user custom folder + $this->_addPath('template', T3_CUSTOM_PATH . '/html/' . $component . '/' . $this->getName()); } break; } diff --git a/source/plg_system_t3/t3.php b/source/plg_system_t3/t3.php index 5a61734896..788e15a1ea 100644 --- a/source/plg_system_t3/t3.php +++ b/source/plg_system_t3/t3.php @@ -190,8 +190,13 @@ function onContentPrepareForm($form, $data) $form->getName() == 'com_templates.style' || $form->getName() == 'com_config.templates' )) { - JForm::addFormPath(T3_PATH . '/params'); - $form->loadFile('template', false); + + $_form = clone $form; + $_form->loadFile(T3_PATH . '/params/template.xml', false); + //custom config in custom/etc/assets.xml + $cusXml = T3_CUSTOM_PATH . '/etc/assets.xml'; + if (file_exists($cusXml)) + $_form->loadFile($cusXml, true, '//config'); // extend parameters T3Bot::prepareForm($form); @@ -199,12 +204,11 @@ function onContentPrepareForm($form, $data) //search for global parameters and store in user state $app = JFactory::getApplication(); $gparams = array(); - foreach($form->getGroup('params') as $param){ - if($form->getFieldAttribute($param->fieldname, 'global', 0, 'params')){ + foreach($_form->getGroup('params') as $param){ + if($_form->getFieldAttribute($param->fieldname, 'global', 0, 'params')){ $gparams[] = $param->fieldname; } } - $app->setUserState('gparams', $gparams); $this->gparams = $gparams; }