From 7d67df3d7dc6e14bac5bd3e58276a6c1f09b63df Mon Sep 17 00:00:00 2001 From: laoneo Date: Wed, 9 Mar 2016 08:45:35 +0100 Subject: [PATCH 001/273] Adding com_fields and integrating it into com_content --- .../com_content/helpers/content.php | 9 + .../components/com_fields/access.xml | 33 + .../components/com_fields/controller.php | 69 ++ .../com_fields/controllers/field.php | 139 ++++ .../com_fields/controllers/fields.php | 43 + .../components/com_fields/fields.php | 24 + .../components/com_fields/fields.xml | 39 + .../components/com_fields/helpers/fields.php | 457 ++++++++++ .../com_fields/helpers/internal.php | 74 ++ .../libraries/Mustache/Autoloader.php | 74 ++ .../com_fields/libraries/Mustache/Cache.php | 36 + .../Mustache/Cache/AbstractCache.php | 60 ++ .../Mustache/Cache/FilesystemCache.php | 155 ++++ .../libraries/Mustache/Cache/NoopCache.php | 47 ++ .../libraries/Mustache/Compiler.php | 645 ++++++++++++++ .../com_fields/libraries/Mustache/Context.php | 206 +++++ .../com_fields/libraries/Mustache/Engine.php | 785 ++++++++++++++++++ .../libraries/Mustache/Exception.php | 18 + .../Exception/InvalidArgumentException.php | 18 + .../Mustache/Exception/LogicException.php | 18 + .../Mustache/Exception/RuntimeException.php | 18 + .../Mustache/Exception/SyntaxException.php | 36 + .../Exception/UnknownFilterException.php | 32 + .../Exception/UnknownHelperException.php | 32 + .../Exception/UnknownTemplateException.php | 32 + .../libraries/Mustache/HelperCollection.php | 172 ++++ .../libraries/Mustache/LambdaHelper.php | 49 ++ .../com_fields/libraries/Mustache/Loader.php | 27 + .../libraries/Mustache/Loader/ArrayLoader.php | 79 ++ .../Mustache/Loader/CascadingLoader.php | 69 ++ .../Mustache/Loader/FilesystemLoader.php | 124 +++ .../Mustache/Loader/InlineLoader.php | 123 +++ .../Mustache/Loader/MutableLoader.php | 31 + .../Mustache/Loader/StringLoader.php | 39 + .../com_fields/libraries/Mustache/Logger.php | 126 +++ .../Mustache/Logger/AbstractLogger.php | 121 +++ .../Mustache/Logger/StreamLogger.php | 194 +++++ .../com_fields/libraries/Mustache/Parser.php | 317 +++++++ .../libraries/Mustache/Template.php | 181 ++++ .../libraries/Mustache/Tokenizer.php | 322 +++++++ .../components/com_fields/models/field.php | 578 +++++++++++++ .../components/com_fields/models/fields.php | 301 +++++++ .../com_fields/models/fields/dprules.php | 405 +++++++++ .../com_fields/models/fields/modal/field.php | 168 ++++ .../com_fields/models/fields/section.php | 66 ++ .../com_fields/models/fields/type.php | 56 ++ .../com_fields/models/forms/field.xml | 140 ++++ .../com_fields/models/forms/filter_fields.xml | 50 ++ .../com_fields/models/types/base.php | 91 ++ .../com_fields/models/types/calendar.php | 14 + .../com_fields/models/types/captcha.php | 33 + .../com_fields/models/types/checkboxes.php | 14 + .../com_fields/models/types/color.php | 14 + .../com_fields/models/types/editor.php | 22 + .../com_fields/models/types/email.php | 21 + .../models/types/fields/gallery.php | 53 ++ .../models/types/forms/calendar.xml | 10 + .../models/types/forms/checkboxes.xml | 19 + .../com_fields/models/types/forms/editor.xml | 29 + .../com_fields/models/types/forms/gallery.xml | 28 + .../models/types/forms/imagelist.xml | 18 + .../com_fields/models/types/forms/integer.xml | 21 + .../com_fields/models/types/forms/list.xml | 25 + .../com_fields/models/types/forms/media.xml | 19 + .../com_fields/models/types/forms/radio.xml | 22 + .../com_fields/models/types/forms/sql.xml | 16 + .../models/types/forms/textarea.xml | 13 + .../com_fields/models/types/forms/url.xml | 22 + .../com_fields/models/types/forms/user.xml | 12 + .../models/types/forms/usergrouplist.xml | 12 + .../com_fields/models/types/forms/yesno.xml | 9 + .../com_fields/models/types/gallery.php | 22 + .../com_fields/models/types/imagelist.php | 21 + .../com_fields/models/types/integer.php | 14 + .../com_fields/models/types/list.php | 49 ++ .../com_fields/models/types/media.php | 21 + .../com_fields/models/types/modal_article.php | 19 + .../com_fields/models/types/radio.php | 14 + .../com_fields/models/types/sql.php | 27 + .../com_fields/models/types/tel.php | 21 + .../com_fields/models/types/text.php | 14 + .../com_fields/models/types/textarea.php | 21 + .../com_fields/models/types/timezone.php | 14 + .../com_fields/models/types/url.php | 25 + .../com_fields/models/types/user.php | 14 + .../com_fields/models/types/usergrouplist.php | 20 + .../com_fields/models/types/yesno.php | 58 ++ .../components/com_fields/tables/field.php | 156 ++++ .../com_fields/views/field/tmpl/edit.php | 120 +++ .../com_fields/views/field/tmpl/modal.php | 92 ++ .../views/field/tmpl/modal_options.php | 46 + .../com_fields/views/field/view.html.php | 190 +++++ .../com_fields/views/fields/tmpl/default.php | 222 +++++ .../views/fields/tmpl/default_batch_body.php | 39 + .../fields/tmpl/default_batch_footer.php | 16 + .../com_fields/views/fields/tmpl/modal.php | 184 ++++ .../com_fields/views/fields/view.html.php | 195 +++++ .../language/en-GB/en-GB.com_fields.ini | 164 ++++ .../language/en-GB/en-GB.com_fields.sys.ini | 2 + administrator/language/en-GB/en-GB.ini | 2 + .../en-GB/en-GB.plg_system_fields.ini | 11 + .../en-GB/en-GB.plg_system_fields.sys.ini | 2 + components/com_fields/controller.php | 12 + components/com_fields/controllers/field.php | 28 + components/com_fields/fields.php | 14 + .../com_fields/layouts/field/prepare/base.php | 26 + .../layouts/field/prepare/captcha.php | 10 + .../layouts/field/prepare/checkboxes.php | 33 + .../layouts/field/prepare/editor.php | 22 + .../layouts/field/prepare/gallery.php | 136 +++ .../layouts/field/prepare/imagelist.php | 34 + .../com_fields/layouts/field/prepare/list.php | 33 + .../layouts/field/prepare/media.php | 33 + .../layouts/field/prepare/modal_article.php | 44 + .../com_fields/layouts/field/prepare/sql.php | 61 ++ .../layouts/field/prepare/textarea.php | 22 + .../com_fields/layouts/field/prepare/url.php | 27 + .../com_fields/layouts/field/prepare/user.php | 42 + .../layouts/field/prepare/usergrouplist.php | 34 + .../layouts/field/prepare/yesno.php | 33 + .../com_fields/layouts/field/render.php | 29 + .../com_fields/layouts/fields/render.php | 89 ++ installation/sql/mysql/joomla.sql | 59 ++ language/en-GB/en-GB.ini | 1 + media/com_fields/css/fotorama.min.css | 4 + media/com_fields/css/fotorama.png | Bin 0 -> 3223 bytes media/com_fields/css/fotorama@2x.png | Bin 0 -> 7319 bytes media/com_fields/js/fotorama.min.js | 5 + plugins/system/fields/fields.php | 551 ++++++++++++ plugins/system/fields/fields.xml | 43 + 130 files changed, 10614 insertions(+) create mode 100644 administrator/components/com_fields/access.xml create mode 100644 administrator/components/com_fields/controller.php create mode 100644 administrator/components/com_fields/controllers/field.php create mode 100644 administrator/components/com_fields/controllers/fields.php create mode 100644 administrator/components/com_fields/fields.php create mode 100644 administrator/components/com_fields/fields.xml create mode 100644 administrator/components/com_fields/helpers/fields.php create mode 100644 administrator/components/com_fields/helpers/internal.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Autoloader.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Cache.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Cache/AbstractCache.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Cache/FilesystemCache.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Cache/NoopCache.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Compiler.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Context.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Engine.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Exception.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Exception/InvalidArgumentException.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Exception/LogicException.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Exception/RuntimeException.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Exception/SyntaxException.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Exception/UnknownFilterException.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Exception/UnknownHelperException.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Exception/UnknownTemplateException.php create mode 100644 administrator/components/com_fields/libraries/Mustache/HelperCollection.php create mode 100644 administrator/components/com_fields/libraries/Mustache/LambdaHelper.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Loader.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Loader/ArrayLoader.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Loader/CascadingLoader.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Loader/FilesystemLoader.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Loader/InlineLoader.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Loader/MutableLoader.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Loader/StringLoader.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Logger.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Logger/AbstractLogger.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Logger/StreamLogger.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Parser.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Template.php create mode 100644 administrator/components/com_fields/libraries/Mustache/Tokenizer.php create mode 100644 administrator/components/com_fields/models/field.php create mode 100644 administrator/components/com_fields/models/fields.php create mode 100644 administrator/components/com_fields/models/fields/dprules.php create mode 100644 administrator/components/com_fields/models/fields/modal/field.php create mode 100644 administrator/components/com_fields/models/fields/section.php create mode 100644 administrator/components/com_fields/models/fields/type.php create mode 100644 administrator/components/com_fields/models/forms/field.xml create mode 100644 administrator/components/com_fields/models/forms/filter_fields.xml create mode 100644 administrator/components/com_fields/models/types/base.php create mode 100644 administrator/components/com_fields/models/types/calendar.php create mode 100644 administrator/components/com_fields/models/types/captcha.php create mode 100644 administrator/components/com_fields/models/types/checkboxes.php create mode 100644 administrator/components/com_fields/models/types/color.php create mode 100644 administrator/components/com_fields/models/types/editor.php create mode 100644 administrator/components/com_fields/models/types/email.php create mode 100644 administrator/components/com_fields/models/types/fields/gallery.php create mode 100644 administrator/components/com_fields/models/types/forms/calendar.xml create mode 100644 administrator/components/com_fields/models/types/forms/checkboxes.xml create mode 100644 administrator/components/com_fields/models/types/forms/editor.xml create mode 100644 administrator/components/com_fields/models/types/forms/gallery.xml create mode 100644 administrator/components/com_fields/models/types/forms/imagelist.xml create mode 100644 administrator/components/com_fields/models/types/forms/integer.xml create mode 100644 administrator/components/com_fields/models/types/forms/list.xml create mode 100644 administrator/components/com_fields/models/types/forms/media.xml create mode 100644 administrator/components/com_fields/models/types/forms/radio.xml create mode 100644 administrator/components/com_fields/models/types/forms/sql.xml create mode 100644 administrator/components/com_fields/models/types/forms/textarea.xml create mode 100644 administrator/components/com_fields/models/types/forms/url.xml create mode 100644 administrator/components/com_fields/models/types/forms/user.xml create mode 100644 administrator/components/com_fields/models/types/forms/usergrouplist.xml create mode 100644 administrator/components/com_fields/models/types/forms/yesno.xml create mode 100644 administrator/components/com_fields/models/types/gallery.php create mode 100644 administrator/components/com_fields/models/types/imagelist.php create mode 100644 administrator/components/com_fields/models/types/integer.php create mode 100644 administrator/components/com_fields/models/types/list.php create mode 100644 administrator/components/com_fields/models/types/media.php create mode 100644 administrator/components/com_fields/models/types/modal_article.php create mode 100644 administrator/components/com_fields/models/types/radio.php create mode 100644 administrator/components/com_fields/models/types/sql.php create mode 100644 administrator/components/com_fields/models/types/tel.php create mode 100644 administrator/components/com_fields/models/types/text.php create mode 100644 administrator/components/com_fields/models/types/textarea.php create mode 100644 administrator/components/com_fields/models/types/timezone.php create mode 100644 administrator/components/com_fields/models/types/url.php create mode 100644 administrator/components/com_fields/models/types/user.php create mode 100644 administrator/components/com_fields/models/types/usergrouplist.php create mode 100644 administrator/components/com_fields/models/types/yesno.php create mode 100644 administrator/components/com_fields/tables/field.php create mode 100644 administrator/components/com_fields/views/field/tmpl/edit.php create mode 100644 administrator/components/com_fields/views/field/tmpl/modal.php create mode 100644 administrator/components/com_fields/views/field/tmpl/modal_options.php create mode 100644 administrator/components/com_fields/views/field/view.html.php create mode 100644 administrator/components/com_fields/views/fields/tmpl/default.php create mode 100644 administrator/components/com_fields/views/fields/tmpl/default_batch_body.php create mode 100644 administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php create mode 100644 administrator/components/com_fields/views/fields/tmpl/modal.php create mode 100644 administrator/components/com_fields/views/fields/view.html.php create mode 100644 administrator/language/en-GB/en-GB.com_fields.ini create mode 100644 administrator/language/en-GB/en-GB.com_fields.sys.ini create mode 100644 administrator/language/en-GB/en-GB.plg_system_fields.ini create mode 100644 administrator/language/en-GB/en-GB.plg_system_fields.sys.ini create mode 100644 components/com_fields/controller.php create mode 100644 components/com_fields/controllers/field.php create mode 100644 components/com_fields/fields.php create mode 100644 components/com_fields/layouts/field/prepare/base.php create mode 100644 components/com_fields/layouts/field/prepare/captcha.php create mode 100644 components/com_fields/layouts/field/prepare/checkboxes.php create mode 100644 components/com_fields/layouts/field/prepare/editor.php create mode 100644 components/com_fields/layouts/field/prepare/gallery.php create mode 100644 components/com_fields/layouts/field/prepare/imagelist.php create mode 100644 components/com_fields/layouts/field/prepare/list.php create mode 100644 components/com_fields/layouts/field/prepare/media.php create mode 100644 components/com_fields/layouts/field/prepare/modal_article.php create mode 100644 components/com_fields/layouts/field/prepare/sql.php create mode 100644 components/com_fields/layouts/field/prepare/textarea.php create mode 100644 components/com_fields/layouts/field/prepare/url.php create mode 100644 components/com_fields/layouts/field/prepare/user.php create mode 100644 components/com_fields/layouts/field/prepare/usergrouplist.php create mode 100644 components/com_fields/layouts/field/prepare/yesno.php create mode 100644 components/com_fields/layouts/field/render.php create mode 100644 components/com_fields/layouts/fields/render.php create mode 100644 media/com_fields/css/fotorama.min.css create mode 100644 media/com_fields/css/fotorama.png create mode 100644 media/com_fields/css/fotorama@2x.png create mode 100644 media/com_fields/js/fotorama.min.js create mode 100644 plugins/system/fields/fields.php create mode 100644 plugins/system/fields/fields.xml diff --git a/administrator/components/com_content/helpers/content.php b/administrator/components/com_content/helpers/content.php index 248ac85f78c81..e2ec83caba876 100644 --- a/administrator/components/com_content/helpers/content.php +++ b/administrator/components/com_content/helpers/content.php @@ -38,6 +38,15 @@ public static function addSubmenu($vName) JText::_('COM_CONTENT_SUBMENU_CATEGORIES'), 'index.php?option=com_categories&extension=com_content', $vName == 'categories'); + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELDS'), + 'index.php?option=com_fields&context=com_content.article', + $vName == 'fields.article' + ); + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELD_CATEGORIES'), + 'index.php?option=com_categories&extension=com_content.article.fields', + $vName == 'categories.article'); JHtmlSidebar::addEntry( JText::_('COM_CONTENT_SUBMENU_FEATURED'), 'index.php?option=com_content&view=featured', diff --git a/administrator/components/com_fields/access.xml b/administrator/components/com_fields/access.xml new file mode 100644 index 0000000000000..f893bf6ed7c7f --- /dev/null +++ b/administrator/components/com_fields/access.xml @@ -0,0 +1,33 @@ + + +
+ + + + + + + +
+
+ + + + + + +
+
\ No newline at end of file diff --git a/administrator/components/com_fields/controller.php b/administrator/components/com_fields/controller.php new file mode 100644 index 0000000000000..0ca9eba1c1a4a --- /dev/null +++ b/administrator/components/com_fields/controller.php @@ -0,0 +1,69 @@ +context)) + { + $this->context = $this->input->get('context', 'com_content'); + } + } + + public function display ($cachable = false, $urlparams = false) + { + // Get the document object. + $document = JFactory::getDocument(); + + // Set the default view name and format from the Request. + $vName = $this->input->get('view', 'fields'); + $vFormat = $document->getType(); + $lName = $this->input->get('layout', 'default', 'string'); + $id = $this->input->getInt('id'); + + // Check for edit form. + if ($vName == 'field' && $lName == 'edit' && ! $this->checkEditId('com_fields.edit.field', $id)) + { + // Somehow the person just went to the form - we don't allow that. + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setMessage($this->getError(), 'error'); + $this->setRedirect(JRoute::_('index.php?option=com_fields&view=fields&context=' . $this->context, false)); + + return false; + } + + // Get and render the view. + if ($view = $this->getView($vName, $vFormat)) + { + // Get the model for the view. + $model = $this->getModel($vName, 'FieldsModel', array( + 'name' => $vName . '.' . substr($this->context, 4) + )); + + // Push the model into the view (as default). + $view->setModel($model, true); + $view->setLayout($lName); + + // Push document object into the view. + $view->document = $document; + + FieldsHelperInternal::addSubmenu($model->getState('filter.context')); + $view->display(); + } + + return $this; + } +} diff --git a/administrator/components/com_fields/controllers/field.php b/administrator/components/com_fields/controllers/field.php new file mode 100644 index 0000000000000..8d1031c7a2502 --- /dev/null +++ b/administrator/components/com_fields/controllers/field.php @@ -0,0 +1,139 @@ +internalContext = $this->input->getCmd('context', 'com_content.article'); + $parts = FieldsHelper::extract($this->internalContext); + $this->component = $parts ? $parts[0] : null; + } + + public function catchange () + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + $app = JFactory::getApplication(); + $data = $this->input->get($this->input->get('formcontrol', 'jform'), array(), 'array'); + + $parts = FieldsHelper::extract($this->input->getCmd('context')); + if ($parts) + { + $app->setUserState($parts[0] . '.edit.' . $parts[1] . '.data', $data); + } + $app->redirect(base64_decode($this->input->get->getBase64('return'))); + $app->close(); + } + + protected function allowAdd ($data = array()) + { + return JFactory::getUser()->authorise('core.create', $this->component); + } + + protected function allowEdit ($data = array(), $key = 'parent_id') + { + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + $user = JFactory::getUser(); + $userId = $user->get('id'); + + // Check general edit permission first. + if ($user->authorise('core.edit', $this->component)) + { + return true; + } + + // Check specific edit permission. + if ($user->authorise('core.edit', $this->internalContext . '.field.' . $recordId)) + { + return true; + } + + // Fallback on edit.own. + // First test if the permission is available. + if ($user->authorise('core.edit.own', $this->internalContext . '.field.' . $recordId) || $user->authorise('core.edit.own', $this->component)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_user_id']) ? $data['created_user_id'] : 0; + + if (empty($ownerId) && $recordId) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + + $ownerId = $record->created_user_id; + } + + // If the owner matches 'me' then do the test. + if ($ownerId == $userId) + { + return true; + } + } + + return false; + } + + public function batch ($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Field'); + + // Preset the redirect + $this->setRedirect('index.php?option=com_fields&view=fields&context=' . $this->internalContext); + + return parent::batch($model); + } + + protected function getRedirectToItemAppend ($recordId = null, $urlVar = 'id') + { + $append = parent::getRedirectToItemAppend($recordId); + $append .= '&context=' . $this->internalContext; + + return $append; + } + + protected function getRedirectToListAppend () + { + $append = parent::getRedirectToListAppend(); + $append .= '&context=' . $this->internalContext; + + return $append; + } + + protected function postSaveHook (JModelLegacy $model, $validData = array()) + { + $item = $model->getItem(); + + if (isset($item->params) && is_array($item->params)) + { + $registry = new Registry(); + $registry->loadArray($item->params); + $item->params = (string) $registry; + } + + return; + } +} diff --git a/administrator/components/com_fields/controllers/fields.php b/administrator/components/com_fields/controllers/fields.php new file mode 100644 index 0000000000000..ac503db6dda60 --- /dev/null +++ b/administrator/components/com_fields/controllers/fields.php @@ -0,0 +1,43 @@ +setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list . '&context=' . + $this->input->getCmd('context', 'com_content.article'), false)); + + return $return; + } + + public function publish () + { + $return = parent::publish(); + + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list . '&context=' . + $this->input->getCmd('context', 'com_content.article'), false)); + + return $return; + } + + public function getModel ($name = 'Field', $prefix = 'FieldsModel', $config = array('ignore_request' => true)) + { + $model = parent::getModel($name, $prefix, $config); + + return $model; + } +} diff --git a/administrator/components/com_fields/fields.php b/administrator/components/com_fields/fields.php new file mode 100644 index 0000000000000..eb95c82d8beae --- /dev/null +++ b/administrator/components/com_fields/fields.php @@ -0,0 +1,24 @@ +input; + +$parts = explode('.', $input->get('context')); +$component = $parts[0]; + +if (! JFactory::getUser()->authorise('core.manage', $component)) +{ + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); +} + +JLoader::import('components.com_fields.helpers.internal', JPATH_ADMINISTRATOR); + +$controller = JControllerLegacy::getInstance('Fields'); +$controller->execute($input->get('task')); +$controller->redirect(); diff --git a/administrator/components/com_fields/fields.xml b/administrator/components/com_fields/fields.xml new file mode 100644 index 0000000000000..c0118d8ae47bd --- /dev/null +++ b/administrator/components/com_fields/fields.xml @@ -0,0 +1,39 @@ + + + com_fields + Joomla! Project + March 2016 + (C) 2005 - 2016 Open Source Matters. All rights reserved. + GNU General Public License version 2 or later; see LICENSE.txt + admin@joomla.org + www.joomla.org + 3.6.0 + COM_FIELDS_XML_DESCRIPTION + + + controller.php + fields.php + controllers + layouts + + + + access.xml + controller.php + fields.php + controllers + helpers + libraries + models + sql + tables + views + + + language/en-GB.com_fields.ini + language/en-GB.com_fields.sys.ini + + + + + diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php new file mode 100644 index 0000000000000..55eebe46d28a6 --- /dev/null +++ b/administrator/components/com_fields/helpers/fields.php @@ -0,0 +1,457 @@ + true + )); + self::$fieldsCache->setState('filter.published', 1); + self::$fieldsCache->setState('filter.language', isset($item->language) ? $item->language : JFactory::getLanguage()->getTag()); + self::$fieldsCache->setState('list.limit', 0); + } + self::$fieldsCache->setState('filter.context', $context); + + if (is_array($item)) + { + $item = (object) $item; + } + + // If item has assigned_cat_ids parameter display only fields which + // belong to the category + if ($item && (isset($item->catid) || isset($item->fieldscatid))) + { + $assignedCatIds = isset($item->catid) ? $item->catid : $item->fieldscatid; + self::$fieldsCache->setState('filter.assigned_cat_ids', is_array($assignedCatIds) ? $assignedCatIds : explode(',', $assignedCatIds)); + } + + $fields = self::$fieldsCache->getItems(); + if ($item && isset($item->id)) + { + if (self::$fieldCache === null) + { + self::$fieldCache = JModelLegacy::getInstance('Field', 'FieldsModel', array( + 'ignore_request' => true + )); + } + $new = array(); + foreach ($fields as $key => $original) + { + // Doing a clone, otherwise fields for different items will + // always reference to the same object + $field = clone $original; + $field->value = self::$fieldCache->getFieldValue($field->id, $field->context, $item->id); + if (! $field->value) + { + $field->value = $field->default_value; + } + $field->rawvalue = $field->value; + + if ($prepareValue) + { + $value = null; + + if ($output = $field->params->get('output')) + { + try + { + // Load the mustache engine + JLoader::import('components.com_fields.libraries.Mustache.Autoloader', JPATH_ADMINISTRATOR); + Mustache_Autoloader::register(); + + $m = new Mustache_Engine(); + $value = $m->render($output, $field); + } + catch (Exception $e) + { + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'warning'); + } + } + else + { + // Is deprecated + $type = self::loadTypeObject($field->type, $context); + if ($type) + { + $value = $type->prepareValueForDisplay($field->value, $field); + } + } + + if (! $value) + { + // Prepare the value from the type layout + $value = self::render($context, 'field.prepare.' . $field->type, array( + 'field' => $field + )); + } + + // If the value is empty, render the base layout + if (! $value) + { + $value = self::render($context, 'field.prepare.base', array( + 'field' => $field + )); + } + + $field->value = $value; + } + $new[$key] = $field; + } + $fields = $new; + } + return $fields; + } + + /** + * Renders the layout file and data on the context and does a fall back to + * Fields afterwards. + * + * @param string $context + * @param string $layoutFile + * @param array $displayData + * @return NULL|string + */ + public static function render ($context, $layoutFile, $displayData) + { + $value = null; + + /* + * Because the layout refreshes the paths before the render function is + * called, so there is no way to load the layout overrides in the order + * template -> context -> fields. + * If there is no override in the context then we need to call the + * layout + * from Fields. + */ + if ($parts = self::extract($context)) + { + // Trying to render the layout on the component fom the context + $value = JLayoutHelper::render($layoutFile, $displayData, null, array( + 'component' => $parts[0], + 'client' => 0 + )); + } + + if (! $value) + { + // Trying to render the layout on Fields itself + $value = JLayoutHelper::render($layoutFile, $displayData, null, array( + 'component' => 'com_fields', + 'client' => 0 + )); + } + + return $value; + } + + public static function prepareForm ($context, JForm $form, $data) + { + + // Extracting the component and section + $parts = self::extract($context); + if (! $parts) + { + return true; + } + + // When no fields available return here + $fields = FieldsHelper::getFields($parts[0] . '.' . $parts[1], new JObject()); + if (! $fields) + { + return true; + } + + $component = $parts[0]; + $section = $parts[1]; + + $assignedCatids = isset($data->catid) ? $data->catid : (isset($data->fieldscatid) ? $data->fieldscatid : null); + if (! $assignedCatids && $form->getField('assigned_cat_ids')) + { + // Choose the first category available + $xml = new DOMDocument(); + $xml->loadHTML($form->getField('assigned_cat_ids') + ->__get('input')); + $options = $xml->getElementsByTagName('option'); + if ($firstChoice = $options->item(0)) + { + $assignedCatids = $firstChoice->getAttribute('value'); + $data->fieldscatid = $assignedCatids; + } + } + + // If there is a catid field we need to reload the page when the catid + // is changed + if ($form->getField('catid') && $parts[0] != 'com_fields') + { + // The uri to submit to + $uri = clone JUri::getInstance('index.php'); + + // Removing the catid parameter from the actual url and set it as + // return + $returnUri = clone JUri::getInstance(); + $returnUri->setVar('catid', null); + $uri->setVar('return', base64_encode($returnUri->toString())); + + // Setting the options + $uri->setVar('option', 'com_fields'); + $uri->setVar('task', 'field.catchange'); + $uri->setVar('context', $parts[0] . '.' . $parts[1]); + $uri->setVar('formcontrol', $form->getFormControl()); + $uri->setVar('view', null); + $uri->setVar('layout', null); + + // Setting the onchange event to reload the page when the category + // has changed + $form->setFieldAttribute('catid', 'onchange', "categoryHasChanged(this);"); + JFactory::getDocument()->addScriptDeclaration( + "function categoryHasChanged(element){ + var cat = jQuery(element); + if (cat.val() == '" . $assignedCatids . "')return; + jQuery('input[name=task]').val('field.catchange'); + element.form.action='" . $uri . "'; + element.form.submit(); + } + jQuery( document ).ready(function() { + var formControl = '#" . $form->getFormControl() . "_catid'; + if (!jQuery(formControl).val() != '" . $assignedCatids . + "'){jQuery(formControl).val('" . $assignedCatids . "');} + });"); + } + + // Getting the fields + $fields = FieldsHelper::getFields($parts[0] . '.' . $parts[1], $data); + if (! $fields) + { + return true; + } + + // Creating the dom + $xml = new DOMDocument('1.0', 'UTF-8'); + $fieldsNode = $xml->appendChild(new DOMElement('form'))->appendChild(new DOMElement('fields')); + $fieldsNode->setAttribute('name', 'params'); + $fieldsNode->setAttribute('addfieldpath', '/administrator/components/com_fields/models/types/fields'); + $fieldsNode->setAttribute('addrulepath', '/administrator/components/com_fields/models/types/rules'); + + // Organizing the fields according to their category + $fieldsPerCategory = array( + 0 => array() + ); + foreach ($fields as $field) + { + if (! key_exists($field->catid, $fieldsPerCategory)) + { + $fieldsPerCategory[$field->catid] = array(); + } + $fieldsPerCategory[$field->catid][] = $field; + } + + // Looping trough the categories + foreach ($fieldsPerCategory as $catid => $catFields) + { + if (! $catFields) + { + continue; + } + + // Defining the field set + $fieldset = $fieldsNode->appendChild(new DOMElement('fieldset')); + $fieldset->setAttribute('name', 'fields-' . $catid); + $fieldset->setAttribute('addfieldpath', '/administrator/components/' . $component . '/models/fields'); + $fieldset->setAttribute('addrulepath', '/administrator/components/' . $component . '/models/rules'); + + $label = ''; + $description = ''; + if ($catid > 0) + { + // JCategories can't handle com_content with a section, going + // directly to the table + $category = JTable::getInstance('Category'); + $category->load($catid); + if ($category->id) + { + $label = $category->title; + $description = $category->description; + } + } + + if (! $label || ! $description) + { + $lang = JFactory::getLanguage(); + + if (! $label) + { + $key = strtoupper($component . '_FIELDS_' . $section . '_LABEL'); + if (! $lang->hasKey($key)) + { + $key = 'JGLOBAL_FIELDS'; + } + $label = JText::_($key); + } + + if (! $description) + { + $key = strtoupper($component . '_FIELDS_' . $section . '_DESC'); + if ($lang->hasKey($key)) + { + $description = JText::_($key); + } + } + } + + $fieldset->setAttribute('label', $label); + $fieldset->setAttribute('description', $description); + + // Looping trough the fields for that context + foreach ($catFields as $field) + { + // Creating the XML form data + $type = FieldsHelper::loadTypeObject($field->type, $field->context); + if ($type === false) + { + continue; + } + try + { + // Rendering the type + $node = $type->appendXMLFieldTag($field, $fieldset, $form); + + // If the field belongs to a assigned_cat_ids but the + // assigned_cat_ids in the data is not known, set the + // required + // flag to false on any circumstance + if (! $assignedCatids && $field->assigned_cat_ids) + { + $node->setAttribute('required', 'false'); + } + } + catch (Exception $e) + { + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); + } + } + } + // Loading the XML fields string into the form + $form->load($xml->saveXML()); + + $model = JModelLegacy::getInstance('Field', 'FieldsModel', array( + 'ignore_request' => true + )); + + if ((! isset($data->id) || ! $data->id) && JFactory::getApplication()->input->getCmd('controller') == 'config.display.modules' && JFactory::getApplication()->isSite()) + { + // Modules on front end editing don't have data and an id set + $data->id = $input->getInt('id'); + } + + // Looping trough the fields again to set the value + if (isset($data->id) && $data->id) + { + foreach ($fields as $field) + { + $value = $model->getFieldValue($field->id, $field->context, $data->id); + if ($value === null) + { + continue; + } + // Setting the value on the field + $form->setValue($field->alias, 'params', $value); + } + } + + return true; + } +} diff --git a/administrator/components/com_fields/helpers/internal.php b/administrator/components/com_fields/helpers/internal.php new file mode 100644 index 0000000000000..d9055af0497ae --- /dev/null +++ b/administrator/components/com_fields/helpers/internal.php @@ -0,0 +1,74 @@ +load($component, JPATH_BASE, null, false, true) || + $lang->load($component, JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component), null, false, true); + + call_user_func(array( + $cName, + 'addSubmenu' + ), 'fields' . (isset($section) ? '.' . $section : '')); + } + } + } + } + + public static function where () + { + $e = new Exception(); + $trace = '
' . $e->getTraceAsString() . '
'; + + echo $trace; + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Autoloader.php b/administrator/components/com_fields/libraries/Mustache/Autoloader.php new file mode 100644 index 0000000000000..d9b293531b225 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Autoloader.php @@ -0,0 +1,74 @@ +baseDir = $realDir; + } else { + $this->baseDir = $baseDir; + } + } + + /** + * Register a new instance as an SPL autoloader. + * + * @param string $baseDir Mustache library base directory (default: dirname(__FILE__).'/..') + * + * @return Mustache_Autoloader Registered Autoloader instance + */ + public static function register($baseDir = null) + { + $loader = new self($baseDir); + spl_autoload_register(array($loader, 'autoload')); + + return $loader; + } + + /** + * Autoload Mustache classes. + * + * @param string $class + */ + public function autoload($class) + { + if ($class[0] === '\\') { + $class = substr($class, 1); + } + + if (strpos($class, 'Mustache') !== 0) { + return; + } + + $file = sprintf('%s/%s.php', $this->baseDir, str_replace('_', '/', $class)); + if (is_file($file)) { + require $file; + } + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Cache.php b/administrator/components/com_fields/libraries/Mustache/Cache.php new file mode 100644 index 0000000000000..45c4e7e37086b --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Cache.php @@ -0,0 +1,36 @@ +logger; + } + + /** + * Set a logger instance. + * + * @param Mustache_Logger|Psr\Log\LoggerInterface $logger + */ + public function setLogger($logger = null) + { + if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) { + throw new Mustache_Exception_InvalidArgumentException('Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.'); + } + + $this->logger = $logger; + } + + /** + * Add a log record if logging is enabled. + * + * @param int $level The logging level + * @param string $message The log message + * @param array $context The log context + */ + protected function log($level, $message, array $context = array()) + { + if (isset($this->logger)) { + $this->logger->log($level, $message, $context); + } + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Cache/FilesystemCache.php b/administrator/components/com_fields/libraries/Mustache/Cache/FilesystemCache.php new file mode 100644 index 0000000000000..15bcb876085e6 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Cache/FilesystemCache.php @@ -0,0 +1,155 @@ +cache($className, $compiledSource); + * + * The FilesystemCache benefits from any opcode caching that may be setup in your environment. So do that, k? + */ +class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache +{ + private $baseDir; + private $fileMode; + + /** + * Filesystem cache constructor. + * + * @param string $baseDir Directory for compiled templates. + * @param int $fileMode Override default permissions for cache files. Defaults to using the system-defined umask. + */ + public function __construct($baseDir, $fileMode = null) + { + $this->baseDir = $baseDir; + $this->fileMode = $fileMode; + } + + /** + * Load the class from cache using `require_once`. + * + * @param string $key + * + * @return bool + */ + public function load($key) + { + $fileName = $this->getCacheFilename($key); + if (!is_file($fileName)) { + return false; + } + + require_once $fileName; + + return true; + } + + /** + * Cache and load the compiled class. + * + * @param string $key + * @param string $value + */ + public function cache($key, $value) + { + $fileName = $this->getCacheFilename($key); + + $this->log( + Mustache_Logger::DEBUG, + 'Writing to template cache: "{fileName}"', + array('fileName' => $fileName) + ); + + $this->writeFile($fileName, $value); + $this->load($key); + } + + /** + * Build the cache filename. + * Subclasses should override for custom cache directory structures. + * + * @param string $name + * + * @return string + */ + protected function getCacheFilename($name) + { + return sprintf('%s/%s.php', $this->baseDir, $name); + } + + /** + * Create cache directory. + * + * @throws Mustache_Exception_RuntimeException If unable to create directory + * + * @param string $fileName + * + * @return string + */ + private function buildDirectoryForFilename($fileName) + { + $dirName = dirname($fileName); + if (!is_dir($dirName)) { + $this->log( + Mustache_Logger::INFO, + 'Creating Mustache template cache directory: "{dirName}"', + array('dirName' => $dirName) + ); + + @mkdir($dirName, 0777, true); + if (!is_dir($dirName)) { + throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName)); + } + } + + return $dirName; + } + + /** + * Write cache file. + * + * @throws Mustache_Exception_RuntimeException If unable to write file + * + * @param string $fileName + * @param string $value + */ + private function writeFile($fileName, $value) + { + $dirName = $this->buildDirectoryForFilename($fileName); + + $this->log( + Mustache_Logger::DEBUG, + 'Caching compiled template to "{fileName}"', + array('fileName' => $fileName) + ); + + $tempFile = tempnam($dirName, basename($fileName)); + if (false !== @file_put_contents($tempFile, $value)) { + if (@rename($tempFile, $fileName)) { + $mode = isset($this->fileMode) ? $this->fileMode : (0666 & ~umask()); + @chmod($fileName, $mode); + + return; + } + + $this->log( + Mustache_Logger::ERROR, + 'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"', + array('tempName' => $tempFile, 'fileName' => $fileName) + ); + } + + throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName)); + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Cache/NoopCache.php b/administrator/components/com_fields/libraries/Mustache/Cache/NoopCache.php new file mode 100644 index 0000000000000..66787c7127202 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Cache/NoopCache.php @@ -0,0 +1,47 @@ +log( + Mustache_Logger::WARNING, + 'Template cache disabled, evaluating "{className}" class at runtime', + array('className' => $key) + ); + eval('?>' . $value); + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Compiler.php b/administrator/components/com_fields/libraries/Mustache/Compiler.php new file mode 100644 index 0000000000000..e25bd8caa1e6b --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Compiler.php @@ -0,0 +1,645 @@ +pragmas = $this->defaultPragmas; + $this->sections = array(); + $this->source = $source; + $this->indentNextLine = true; + $this->customEscape = $customEscape; + $this->entityFlags = $entityFlags; + $this->charset = $charset; + $this->strictCallables = $strictCallables; + + return $this->writeCode($tree, $name); + } + + /** + * Enable pragmas across all templates, regardless of the presence of pragma + * tags in the individual templates. + * + * @internal Users should set global pragmas in Mustache_Engine, not here :) + * + * @param string[] $pragmas + */ + public function setPragmas(array $pragmas) + { + $this->pragmas = array(); + foreach ($pragmas as $pragma) { + $this->pragmas[$pragma] = true; + } + $this->defaultPragmas = $this->pragmas; + } + + /** + * Helper function for walking the Mustache token parse tree. + * + * @throws Mustache_Exception_SyntaxException upon encountering unknown token types. + * + * @param array $tree Parse tree of Mustache tokens + * @param int $level (default: 0) + * + * @return string Generated PHP source code + */ + private function walk(array $tree, $level = 0) + { + $code = ''; + $level++; + foreach ($tree as $node) { + switch ($node[Mustache_Tokenizer::TYPE]) { + case Mustache_Tokenizer::T_PRAGMA: + $this->pragmas[$node[Mustache_Tokenizer::NAME]] = true; + break; + + case Mustache_Tokenizer::T_SECTION: + $code .= $this->section( + $node[Mustache_Tokenizer::NODES], + $node[Mustache_Tokenizer::NAME], + isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(), + $node[Mustache_Tokenizer::INDEX], + $node[Mustache_Tokenizer::END], + $node[Mustache_Tokenizer::OTAG], + $node[Mustache_Tokenizer::CTAG], + $level + ); + break; + + case Mustache_Tokenizer::T_INVERTED: + $code .= $this->invertedSection( + $node[Mustache_Tokenizer::NODES], + $node[Mustache_Tokenizer::NAME], + isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(), + $level + ); + break; + + case Mustache_Tokenizer::T_PARTIAL: + $code .= $this->partial( + $node[Mustache_Tokenizer::NAME], + isset($node[Mustache_Tokenizer::INDENT]) ? $node[Mustache_Tokenizer::INDENT] : '', + $level + ); + break; + + case Mustache_Tokenizer::T_PARENT: + $code .= $this->parent( + $node[Mustache_Tokenizer::NAME], + isset($node[Mustache_Tokenizer::INDENT]) ? $node[Mustache_Tokenizer::INDENT] : '', + $node[Mustache_Tokenizer::NODES], + $level + ); + break; + + case Mustache_Tokenizer::T_BLOCK_ARG: + $code .= $this->blockArg( + $node[Mustache_Tokenizer::NODES], + $node[Mustache_Tokenizer::NAME], + $node[Mustache_Tokenizer::INDEX], + $node[Mustache_Tokenizer::END], + $node[Mustache_Tokenizer::OTAG], + $node[Mustache_Tokenizer::CTAG], + $level + ); + break; + + case Mustache_Tokenizer::T_BLOCK_VAR: + $code .= $this->blockVar( + $node[Mustache_Tokenizer::NODES], + $node[Mustache_Tokenizer::NAME], + $node[Mustache_Tokenizer::INDEX], + $node[Mustache_Tokenizer::END], + $node[Mustache_Tokenizer::OTAG], + $node[Mustache_Tokenizer::CTAG], + $level + ); + break; + + case Mustache_Tokenizer::T_COMMENT: + break; + + case Mustache_Tokenizer::T_ESCAPED: + case Mustache_Tokenizer::T_UNESCAPED: + case Mustache_Tokenizer::T_UNESCAPED_2: + $code .= $this->variable( + $node[Mustache_Tokenizer::NAME], + isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(), + $node[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_ESCAPED, + $level + ); + break; + + case Mustache_Tokenizer::T_TEXT: + $code .= $this->text($node[Mustache_Tokenizer::VALUE], $level); + break; + + default: + throw new Mustache_Exception_SyntaxException(sprintf('Unknown token type: %s', $node[Mustache_Tokenizer::TYPE]), $node); + } + } + + return $code; + } + + const KLASS = 'lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context); + $buffer = \'\'; + $newContext = array(); + %s + + return $buffer; + } + %s + }'; + + const KLASS_NO_LAMBDAS = 'walk($tree); + $sections = implode("\n", $this->sections); + $klass = empty($this->sections) ? self::KLASS_NO_LAMBDAS : self::KLASS; + + $callable = $this->strictCallables ? $this->prepare(self::STRICT_CALLABLE) : ''; + + return sprintf($this->prepare($klass, 0, false, true), $name, $callable, $code, $sections); + } + + const BLOCK_VAR = ' + $value = $this->resolveValue($context->findInBlock(%s), $context, $indent); + if ($value && !is_array($value) && !is_object($value)) { + $buffer .= $value; + } else { + %s + } + '; + + /** + * Generate Mustache Template inheritance block variable PHP source. + * + * @param array $nodes Array of child tokens + * @param string $id Section name + * @param int $start Section start offset + * @param int $end Section end offset + * @param string $otag Current Mustache opening tag + * @param string $ctag Current Mustache closing tag + * @param int $level + * + * @return string Generated PHP source code + */ + private function blockVar($nodes, $id, $start, $end, $otag, $ctag, $level) + { + $id = var_export($id, true); + + return sprintf($this->prepare(self::BLOCK_VAR, $level), $id, $this->walk($nodes, 2)); + } + + const BLOCK_ARG = ' + // %s block_arg + $value = $this->section%s($context, \'\', true); + $newContext[%s] = %s$value; + '; + + /** + * Generate Mustache Template inheritance block argument PHP source. + * + * @param array $nodes Array of child tokens + * @param string $id Section name + * @param int $start Section start offset + * @param int $end Section end offset + * @param string $otag Current Mustache opening tag + * @param string $ctag Current Mustache closing tag + * @param int $level + * + * @return string Generated PHP source code + */ + private function blockArg($nodes, $id, $start, $end, $otag, $ctag, $level) + { + $key = $this->section($nodes, $id, array(), $start, $end, $otag, $ctag, $level, true); + $id = var_export($id, true); + + return sprintf($this->prepare(self::BLOCK_ARG, $level), $id, $key, $id, $this->flushIndent()); + } + + const SECTION_CALL = ' + // %s section + $value = $context->%s(%s);%s + $buffer .= $this->section%s($context, $indent, $value); + '; + + const SECTION = ' + private function section%s(Mustache_Context $context, $indent, $value) + { + $buffer = \'\'; + if (%s) { + $source = %s; + $result = call_user_func($value, $source, $this->lambdaHelper); + if (strpos($result, \'{{\') === false) { + $buffer .= $result; + } else { + $buffer .= $this->mustache + ->loadLambda((string) $result%s) + ->renderInternal($context); + } + } elseif (!empty($value)) { + $values = $this->isIterable($value) ? $value : array($value); + foreach ($values as $value) { + $context->push($value); + %s + $context->pop(); + } + } + + return $buffer; + }'; + + /** + * Generate Mustache Template section PHP source. + * + * @param array $nodes Array of child tokens + * @param string $id Section name + * @param string[] $filters Array of filters + * @param int $start Section start offset + * @param int $end Section end offset + * @param string $otag Current Mustache opening tag + * @param string $ctag Current Mustache closing tag + * @param int $level + * @param bool $arg (default: false) + * + * @return string Generated section PHP source code + */ + private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level, $arg = false) + { + $source = var_export(substr($this->source, $start, $end - $start), true); + $callable = $this->getCallable(); + + if ($otag !== '{{' || $ctag !== '}}') { + $delims = ', ' . var_export(sprintf('{{= %s %s =}}', $otag, $ctag), true); + } else { + $delims = ''; + } + + $key = ucfirst(md5($delims . "\n" . $source)); + + if (!isset($this->sections[$key])) { + $this->sections[$key] = sprintf($this->prepare(self::SECTION), $key, $callable, $source, $delims, $this->walk($nodes, 2)); + } + + if ($arg === true) { + return $key; + } else { + $method = $this->getFindMethod($id); + $id = var_export($id, true); + $filters = $this->getFilters($filters, $level); + + return sprintf($this->prepare(self::SECTION_CALL, $level), $id, $method, $id, $filters, $key); + } + } + + const INVERTED_SECTION = ' + // %s inverted section + $value = $context->%s(%s);%s + if (empty($value)) { + %s + }'; + + /** + * Generate Mustache Template inverted section PHP source. + * + * @param array $nodes Array of child tokens + * @param string $id Section name + * @param string[] $filters Array of filters + * @param int $level + * + * @return string Generated inverted section PHP source code + */ + private function invertedSection($nodes, $id, $filters, $level) + { + $method = $this->getFindMethod($id); + $id = var_export($id, true); + $filters = $this->getFilters($filters, $level); + + return sprintf($this->prepare(self::INVERTED_SECTION, $level), $id, $method, $id, $filters, $this->walk($nodes, $level)); + } + + const PARTIAL_INDENT = ', $indent . %s'; + const PARTIAL = ' + if ($partial = $this->mustache->loadPartial(%s)) { + $buffer .= $partial->renderInternal($context%s); + } + '; + + /** + * Generate Mustache Template partial call PHP source. + * + * @param string $id Partial name + * @param string $indent Whitespace indent to apply to partial + * @param int $level + * + * @return string Generated partial call PHP source code + */ + private function partial($id, $indent, $level) + { + if ($indent !== '') { + $indentParam = sprintf(self::PARTIAL_INDENT, var_export($indent, true)); + } else { + $indentParam = ''; + } + + return sprintf( + $this->prepare(self::PARTIAL, $level), + var_export($id, true), + $indentParam + ); + } + + const PARENT = ' + %s + + if ($parent = $this->mustache->LoadPartial(%s)) { + $context->pushBlockContext($newContext); + $buffer .= $parent->renderInternal($context, $indent); + $context->popBlockContext(); + } + '; + + /** + * Generate Mustache Template inheritance parent call PHP source. + * + * @param string $id Parent tag name + * @param string $indent Whitespace indent to apply to parent + * @param array $children Child nodes + * @param int $level + * + * @return string Generated PHP source code + */ + private function parent($id, $indent, array $children, $level) + { + $realChildren = array_filter($children, array(__CLASS__, 'onlyBlockArgs')); + + return sprintf( + $this->prepare(self::PARENT, $level), + $this->walk($realChildren, $level), + var_export($id, true), + var_export($indent, true) + ); + } + + /** + * Helper method for filtering out non-block-arg tokens. + * + * @param array $node + * + * @return bool True if $node is a block arg token. + */ + private static function onlyBlockArgs(array $node) + { + return $node[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_BLOCK_ARG; + } + + const VARIABLE = ' + $value = $this->resolveValue($context->%s(%s), $context, $indent);%s + $buffer .= %s%s; + '; + + /** + * Generate Mustache Template variable interpolation PHP source. + * + * @param string $id Variable name + * @param string[] $filters Array of filters + * @param bool $escape Escape the variable value for output? + * @param int $level + * + * @return string Generated variable interpolation PHP source + */ + private function variable($id, $filters, $escape, $level) + { + $method = $this->getFindMethod($id); + $id = ($method !== 'last') ? var_export($id, true) : ''; + $filters = $this->getFilters($filters, $level); + $value = $escape ? $this->getEscape() : '$value'; + + return sprintf($this->prepare(self::VARIABLE, $level), $method, $id, $filters, $this->flushIndent(), $value); + } + + const FILTER = ' + $filter = $context->%s(%s); + if (!(%s)) { + throw new Mustache_Exception_UnknownFilterException(%s); + } + $value = call_user_func($filter, $value);%s + '; + + /** + * Generate Mustache Template variable filtering PHP source. + * + * @param string[] $filters Array of filters + * @param int $level + * + * @return string Generated filter PHP source + */ + private function getFilters(array $filters, $level) + { + if (empty($filters)) { + return ''; + } + + $name = array_shift($filters); + $method = $this->getFindMethod($name); + $filter = ($method !== 'last') ? var_export($name, true) : ''; + $callable = $this->getCallable('$filter'); + $msg = var_export($name, true); + + return sprintf($this->prepare(self::FILTER, $level), $method, $filter, $callable, $msg, $this->getFilters($filters, $level)); + } + + const LINE = '$buffer .= "\n";'; + const TEXT = '$buffer .= %s%s;'; + + /** + * Generate Mustache Template output Buffer call PHP source. + * + * @param string $text + * @param int $level + * + * @return string Generated output Buffer call PHP source + */ + private function text($text, $level) + { + $indentNextLine = (substr($text, -1) === "\n"); + $code = sprintf($this->prepare(self::TEXT, $level), $this->flushIndent(), var_export($text, true)); + $this->indentNextLine = $indentNextLine; + + return $code; + } + + /** + * Prepare PHP source code snippet for output. + * + * @param string $text + * @param int $bonus Additional indent level (default: 0) + * @param bool $prependNewline Prepend a newline to the snippet? (default: true) + * @param bool $appendNewline Append a newline to the snippet? (default: false) + * + * @return string PHP source code snippet + */ + private function prepare($text, $bonus = 0, $prependNewline = true, $appendNewline = false) + { + $text = ($prependNewline ? "\n" : '') . trim($text); + if ($prependNewline) { + $bonus++; + } + if ($appendNewline) { + $text .= "\n"; + } + + return preg_replace("/\n( {8})?/", "\n" . str_repeat(' ', $bonus * 4), $text); + } + + const DEFAULT_ESCAPE = 'htmlspecialchars(%s, %s, %s)'; + const CUSTOM_ESCAPE = 'call_user_func($this->mustache->getEscape(), %s)'; + + /** + * Get the current escaper. + * + * @param string $value (default: '$value') + * + * @return string Either a custom callback, or an inline call to `htmlspecialchars` + */ + private function getEscape($value = '$value') + { + if ($this->customEscape) { + return sprintf(self::CUSTOM_ESCAPE, $value); + } + + return sprintf(self::DEFAULT_ESCAPE, $value, var_export($this->entityFlags, true), var_export($this->charset, true)); + } + + /** + * Select the appropriate Context `find` method for a given $id. + * + * The return value will be one of `find`, `findDot` or `last`. + * + * @see Mustache_Context::find + * @see Mustache_Context::findDot + * @see Mustache_Context::last + * + * @param string $id Variable name + * + * @return string `find` method name + */ + private function getFindMethod($id) + { + if ($id === '.') { + return 'last'; + } + + if (strpos($id, '.') === false) { + return 'find'; + } + + return 'findDot'; + } + + const IS_CALLABLE = '!is_string(%s) && is_callable(%s)'; + const STRICT_IS_CALLABLE = 'is_object(%s) && is_callable(%s)'; + + /** + * Helper function to compile strict vs lax "is callable" logic. + * + * @param string $variable (default: '$value') + * + * @return string "is callable" logic + */ + private function getCallable($variable = '$value') + { + $tpl = $this->strictCallables ? self::STRICT_IS_CALLABLE : self::IS_CALLABLE; + + return sprintf($tpl, $variable, $variable); + } + + const LINE_INDENT = '$indent . '; + + /** + * Get the current $indent prefix to write to the buffer. + * + * @return string "$indent . " or "" + */ + private function flushIndent() + { + if (!$this->indentNextLine) { + return ''; + } + + $this->indentNextLine = false; + + return self::LINE_INDENT; + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Context.php b/administrator/components/com_fields/libraries/Mustache/Context.php new file mode 100644 index 0000000000000..db03acc7e2651 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Context.php @@ -0,0 +1,206 @@ +stack = array($context); + } + } + + /** + * Push a new Context frame onto the stack. + * + * @param mixed $value Object or array to use for context + */ + public function push($value) + { + array_push($this->stack, $value); + } + + /** + * Push a new Context frame onto the block context stack. + * + * @param mixed $value Object or array to use for block context + */ + public function pushBlockContext($value) + { + array_push($this->blockStack, $value); + } + + /** + * Pop the last Context frame from the stack. + * + * @return mixed Last Context frame (object or array) + */ + public function pop() + { + return array_pop($this->stack); + } + + /** + * Pop the last block Context frame from the stack. + * + * @return mixed Last block Context frame (object or array) + */ + public function popBlockContext() + { + return array_pop($this->blockStack); + } + + /** + * Get the last Context frame. + * + * @return mixed Last Context frame (object or array) + */ + public function last() + { + return end($this->stack); + } + + /** + * Find a variable in the Context stack. + * + * Starting with the last Context frame (the context of the innermost section), and working back to the top-level + * rendering context, look for a variable with the given name: + * + * * If the Context frame is an associative array which contains the key $id, returns the value of that element. + * * If the Context frame is an object, this will check first for a public method, then a public property named + * $id. Failing both of these, it will try `__isset` and `__get` magic methods. + * * If a value named $id is not found in any Context frame, returns an empty string. + * + * @param string $id Variable name + * + * @return mixed Variable value, or '' if not found + */ + public function find($id) + { + return $this->findVariableInStack($id, $this->stack); + } + + /** + * Find a 'dot notation' variable in the Context stack. + * + * Note that dot notation traversal bubbles through scope differently than the regular find method. After finding + * the initial chunk of the dotted name, each subsequent chunk is searched for only within the value of the previous + * result. For example, given the following context stack: + * + * $data = array( + * 'name' => 'Fred', + * 'child' => array( + * 'name' => 'Bob' + * ), + * ); + * + * ... and the Mustache following template: + * + * {{ child.name }} + * + * ... the `name` value is only searched for within the `child` value of the global Context, not within parent + * Context frames. + * + * @param string $id Dotted variable selector + * + * @return mixed Variable value, or '' if not found + */ + public function findDot($id) + { + $chunks = explode('.', $id); + $first = array_shift($chunks); + $value = $this->findVariableInStack($first, $this->stack); + + foreach ($chunks as $chunk) { + if ($value === '') { + return $value; + } + + $value = $this->findVariableInStack($chunk, array($value)); + } + + return $value; + } + + /** + * Find an argument in the block context stack. + * + * @param string $id + * + * @return mixed Variable value, or '' if not found. + */ + public function findInBlock($id) + { + foreach ($this->blockStack as $context) { + if (array_key_exists($id, $context)) { + return $context[$id]; + } + } + + return ''; + } + + /** + * Helper function to find a variable in the Context stack. + * + * @see Mustache_Context::find + * + * @param string $id Variable name + * @param array $stack Context stack + * + * @return mixed Variable value, or '' if not found + */ + private function findVariableInStack($id, array $stack) + { + for ($i = count($stack) - 1; $i >= 0; $i--) { + $frame = &$stack[$i]; + + switch (gettype($frame)) { + case 'object': + if (!($frame instanceof Closure)) { + // Note that is_callable() *will not work here* + // See https://github.com/bobthecow/mustache.php/wiki/Magic-Methods + if (method_exists($frame, $id)) { + return $frame->$id(); + } + + if (isset($frame->$id)) { + return $frame->$id; + } + + if ($frame instanceof ArrayAccess && isset($frame[$id])) { + return $frame[$id]; + } + } + break; + + case 'array': + if (array_key_exists($id, $frame)) { + return $frame[$id]; + } + break; + } + } + + return ''; + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Engine.php b/administrator/components/com_fields/libraries/Mustache/Engine.php new file mode 100644 index 0000000000000..d13f1cb431244 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Engine.php @@ -0,0 +1,785 @@ + true, + self::PRAGMA_BLOCKS => true, + ); + + // Template cache + private $templates = array(); + + // Environment + private $templateClassPrefix = '__Mustache_'; + private $cache; + private $lambdaCache; + private $cacheLambdaTemplates = false; + private $loader; + private $partialsLoader; + private $helpers; + private $escape; + private $entityFlags = ENT_COMPAT; + private $charset = 'UTF-8'; + private $logger; + private $strictCallables = false; + private $pragmas = array(); + + // Services + private $tokenizer; + private $parser; + private $compiler; + + /** + * Mustache class constructor. + * + * Passing an $options array allows overriding certain Mustache options during instantiation: + * + * $options = array( + * // The class prefix for compiled templates. Defaults to '__Mustache_'. + * 'template_class_prefix' => '__MyTemplates_', + * + * // A Mustache cache instance or a cache directory string for compiled templates. + * // Mustache will not cache templates unless this is set. + * 'cache' => dirname(__FILE__).'/tmp/cache/mustache', + * + * // Override default permissions for cache files. Defaults to using the system-defined umask. It is + * // *strongly* recommended that you configure your umask properly rather than overriding permissions here. + * 'cache_file_mode' => 0666, + * + * // Optionally, enable caching for lambda section templates. This is generally not recommended, as lambda + * // sections are often too dynamic to benefit from caching. + * 'cache_lambda_templates' => true, + * + * // A Mustache template loader instance. Uses a StringLoader if not specified. + * 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'), + * + * // A Mustache loader instance for partials. + * 'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views/partials'), + * + * // An array of Mustache partials. Useful for quick-and-dirty string template loading, but not as + * // efficient or lazy as a Filesystem (or database) loader. + * 'partials' => array('foo' => file_get_contents(dirname(__FILE__).'/views/partials/foo.mustache')), + * + * // An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order + * // sections), or any other valid Mustache context value. They will be prepended to the context stack, + * // so they will be available in any template loaded by this Mustache instance. + * 'helpers' => array('i18n' => function ($text) { + * // do something translatey here... + * }), + * + * // An 'escape' callback, responsible for escaping double-mustache variables. + * 'escape' => function ($value) { + * return htmlspecialchars($buffer, ENT_COMPAT, 'UTF-8'); + * }, + * + * // Type argument for `htmlspecialchars`. Defaults to ENT_COMPAT. You may prefer ENT_QUOTES. + * 'entity_flags' => ENT_QUOTES, + * + * // Character set for `htmlspecialchars`. Defaults to 'UTF-8'. Use 'UTF-8'. + * 'charset' => 'ISO-8859-1', + * + * // A Mustache Logger instance. No logging will occur unless this is set. Using a PSR-3 compatible + * // logging library -- such as Monolog -- is highly recommended. A simple stream logger implementation is + * // available as well: + * 'logger' => new Mustache_Logger_StreamLogger('php://stderr'), + * + * // Only treat Closure instances and invokable classes as callable. If true, values like + * // `array('ClassName', 'methodName')` and `array($classInstance, 'methodName')`, which are traditionally + * // "callable" in PHP, are not called to resolve variables for interpolation or section contexts. This + * // helps protect against arbitrary code execution when user input is passed directly into the template. + * // This currently defaults to false, but will default to true in v3.0. + * 'strict_callables' => true, + * + * // Enable pragmas across all templates, regardless of the presence of pragma tags in the individual + * // templates. + * 'pragmas' => [Mustache_Engine::PRAGMA_FILTERS], + * ); + * + * @throws Mustache_Exception_InvalidArgumentException If `escape` option is not callable. + * + * @param array $options (default: array()) + */ + public function __construct(array $options = array()) + { + if (isset($options['template_class_prefix'])) { + $this->templateClassPrefix = $options['template_class_prefix']; + } + + if (isset($options['cache'])) { + $cache = $options['cache']; + + if (is_string($cache)) { + $mode = isset($options['cache_file_mode']) ? $options['cache_file_mode'] : null; + $cache = new Mustache_Cache_FilesystemCache($cache, $mode); + } + + $this->setCache($cache); + } + + if (isset($options['cache_lambda_templates'])) { + $this->cacheLambdaTemplates = (bool) $options['cache_lambda_templates']; + } + + if (isset($options['loader'])) { + $this->setLoader($options['loader']); + } + + if (isset($options['partials_loader'])) { + $this->setPartialsLoader($options['partials_loader']); + } + + if (isset($options['partials'])) { + $this->setPartials($options['partials']); + } + + if (isset($options['helpers'])) { + $this->setHelpers($options['helpers']); + } + + if (isset($options['escape'])) { + if (!is_callable($options['escape'])) { + throw new Mustache_Exception_InvalidArgumentException('Mustache Constructor "escape" option must be callable'); + } + + $this->escape = $options['escape']; + } + + if (isset($options['entity_flags'])) { + $this->entityFlags = $options['entity_flags']; + } + + if (isset($options['charset'])) { + $this->charset = $options['charset']; + } + + if (isset($options['logger'])) { + $this->setLogger($options['logger']); + } + + if (isset($options['strict_callables'])) { + $this->strictCallables = $options['strict_callables']; + } + + if (isset($options['pragmas'])) { + foreach ($options['pragmas'] as $pragma) { + if (!isset(self::$knownPragmas[$pragma])) { + throw new Mustache_Exception_InvalidArgumentException(sprintf('Unknown pragma: "%s".', $pragma)); + } + $this->pragmas[$pragma] = true; + } + } + } + + /** + * Shortcut 'render' invocation. + * + * Equivalent to calling `$mustache->loadTemplate($template)->render($context);` + * + * @see Mustache_Engine::loadTemplate + * @see Mustache_Template::render + * + * @param string $template + * @param mixed $context (default: array()) + * + * @return string Rendered template + */ + public function render($template, $context = array()) + { + return $this->loadTemplate($template)->render($context); + } + + /** + * Get the current Mustache escape callback. + * + * @return callable|null + */ + public function getEscape() + { + return $this->escape; + } + + /** + * Get the current Mustache entitity type to escape. + * + * @return int + */ + public function getEntityFlags() + { + return $this->entityFlags; + } + + /** + * Get the current Mustache character set. + * + * @return string + */ + public function getCharset() + { + return $this->charset; + } + + /** + * Get the current globally enabled pragmas. + * + * @return array + */ + public function getPragmas() + { + return array_keys($this->pragmas); + } + + /** + * Set the Mustache template Loader instance. + * + * @param Mustache_Loader $loader + */ + public function setLoader(Mustache_Loader $loader) + { + $this->loader = $loader; + } + + /** + * Get the current Mustache template Loader instance. + * + * If no Loader instance has been explicitly specified, this method will instantiate and return + * a StringLoader instance. + * + * @return Mustache_Loader + */ + public function getLoader() + { + if (!isset($this->loader)) { + $this->loader = new Mustache_Loader_StringLoader(); + } + + return $this->loader; + } + + /** + * Set the Mustache partials Loader instance. + * + * @param Mustache_Loader $partialsLoader + */ + public function setPartialsLoader(Mustache_Loader $partialsLoader) + { + $this->partialsLoader = $partialsLoader; + } + + /** + * Get the current Mustache partials Loader instance. + * + * If no Loader instance has been explicitly specified, this method will instantiate and return + * an ArrayLoader instance. + * + * @return Mustache_Loader + */ + public function getPartialsLoader() + { + if (!isset($this->partialsLoader)) { + $this->partialsLoader = new Mustache_Loader_ArrayLoader(); + } + + return $this->partialsLoader; + } + + /** + * Set partials for the current partials Loader instance. + * + * @throws Mustache_Exception_RuntimeException If the current Loader instance is immutable + * + * @param array $partials (default: array()) + */ + public function setPartials(array $partials = array()) + { + if (!isset($this->partialsLoader)) { + $this->partialsLoader = new Mustache_Loader_ArrayLoader(); + } + + if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) { + throw new Mustache_Exception_RuntimeException('Unable to set partials on an immutable Mustache Loader instance'); + } + + $this->partialsLoader->setTemplates($partials); + } + + /** + * Set an array of Mustache helpers. + * + * An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order sections), or + * any other valid Mustache context value. They will be prepended to the context stack, so they will be available in + * any template loaded by this Mustache instance. + * + * @throws Mustache_Exception_InvalidArgumentException if $helpers is not an array or Traversable + * + * @param array|Traversable $helpers + */ + public function setHelpers($helpers) + { + if (!is_array($helpers) && !$helpers instanceof Traversable) { + throw new Mustache_Exception_InvalidArgumentException('setHelpers expects an array of helpers'); + } + + $this->getHelpers()->clear(); + + foreach ($helpers as $name => $helper) { + $this->addHelper($name, $helper); + } + } + + /** + * Get the current set of Mustache helpers. + * + * @see Mustache_Engine::setHelpers + * + * @return Mustache_HelperCollection + */ + public function getHelpers() + { + if (!isset($this->helpers)) { + $this->helpers = new Mustache_HelperCollection(); + } + + return $this->helpers; + } + + /** + * Add a new Mustache helper. + * + * @see Mustache_Engine::setHelpers + * + * @param string $name + * @param mixed $helper + */ + public function addHelper($name, $helper) + { + $this->getHelpers()->add($name, $helper); + } + + /** + * Get a Mustache helper by name. + * + * @see Mustache_Engine::setHelpers + * + * @param string $name + * + * @return mixed Helper + */ + public function getHelper($name) + { + return $this->getHelpers()->get($name); + } + + /** + * Check whether this Mustache instance has a helper. + * + * @see Mustache_Engine::setHelpers + * + * @param string $name + * + * @return bool True if the helper is present + */ + public function hasHelper($name) + { + return $this->getHelpers()->has($name); + } + + /** + * Remove a helper by name. + * + * @see Mustache_Engine::setHelpers + * + * @param string $name + */ + public function removeHelper($name) + { + $this->getHelpers()->remove($name); + } + + /** + * Set the Mustache Logger instance. + * + * @throws Mustache_Exception_InvalidArgumentException If logger is not an instance of Mustache_Logger or Psr\Log\LoggerInterface. + * + * @param Mustache_Logger|Psr\Log\LoggerInterface $logger + */ + public function setLogger($logger = null) + { + if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) { + throw new Mustache_Exception_InvalidArgumentException('Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.'); + } + + if ($this->getCache()->getLogger() === null) { + $this->getCache()->setLogger($logger); + } + + $this->logger = $logger; + } + + /** + * Get the current Mustache Logger instance. + * + * @return Mustache_Logger|Psr\Log\LoggerInterface + */ + public function getLogger() + { + return $this->logger; + } + + /** + * Set the Mustache Tokenizer instance. + * + * @param Mustache_Tokenizer $tokenizer + */ + public function setTokenizer(Mustache_Tokenizer $tokenizer) + { + $this->tokenizer = $tokenizer; + } + + /** + * Get the current Mustache Tokenizer instance. + * + * If no Tokenizer instance has been explicitly specified, this method will instantiate and return a new one. + * + * @return Mustache_Tokenizer + */ + public function getTokenizer() + { + if (!isset($this->tokenizer)) { + $this->tokenizer = new Mustache_Tokenizer(); + } + + return $this->tokenizer; + } + + /** + * Set the Mustache Parser instance. + * + * @param Mustache_Parser $parser + */ + public function setParser(Mustache_Parser $parser) + { + $this->parser = $parser; + } + + /** + * Get the current Mustache Parser instance. + * + * If no Parser instance has been explicitly specified, this method will instantiate and return a new one. + * + * @return Mustache_Parser + */ + public function getParser() + { + if (!isset($this->parser)) { + $this->parser = new Mustache_Parser(); + } + + return $this->parser; + } + + /** + * Set the Mustache Compiler instance. + * + * @param Mustache_Compiler $compiler + */ + public function setCompiler(Mustache_Compiler $compiler) + { + $this->compiler = $compiler; + } + + /** + * Get the current Mustache Compiler instance. + * + * If no Compiler instance has been explicitly specified, this method will instantiate and return a new one. + * + * @return Mustache_Compiler + */ + public function getCompiler() + { + if (!isset($this->compiler)) { + $this->compiler = new Mustache_Compiler(); + } + + return $this->compiler; + } + + /** + * Set the Mustache Cache instance. + * + * @param Mustache_Cache $cache + */ + public function setCache(Mustache_Cache $cache) + { + if (isset($this->logger) && $cache->getLogger() === null) { + $cache->setLogger($this->getLogger()); + } + + $this->cache = $cache; + } + + /** + * Get the current Mustache Cache instance. + * + * If no Cache instance has been explicitly specified, this method will instantiate and return a new one. + * + * @return Mustache_Cache + */ + public function getCache() + { + if (!isset($this->cache)) { + $this->setCache(new Mustache_Cache_NoopCache()); + } + + return $this->cache; + } + + /** + * Get the current Lambda Cache instance. + * + * If 'cache_lambda_templates' is enabled, this is the default cache instance. Otherwise, it is a NoopCache. + * + * @see Mustache_Engine::getCache + * + * @return Mustache_Cache + */ + protected function getLambdaCache() + { + if ($this->cacheLambdaTemplates) { + return $this->getCache(); + } + + if (!isset($this->lambdaCache)) { + $this->lambdaCache = new Mustache_Cache_NoopCache(); + } + + return $this->lambdaCache; + } + + /** + * Helper method to generate a Mustache template class. + * + * @param string $source + * + * @return string Mustache Template class name + */ + public function getTemplateClassName($source) + { + return $this->templateClassPrefix . md5(sprintf( + 'version:%s,escape:%s,entity_flags:%i,charset:%s,strict_callables:%s,pragmas:%s,source:%s', + self::VERSION, + isset($this->escape) ? 'custom' : 'default', + $this->entityFlags, + $this->charset, + $this->strictCallables ? 'true' : 'false', + implode(' ', $this->getPragmas()), + $source + )); + } + + /** + * Load a Mustache Template by name. + * + * @param string $name + * + * @return Mustache_Template + */ + public function loadTemplate($name) + { + return $this->loadSource($this->getLoader()->load($name)); + } + + /** + * Load a Mustache partial Template by name. + * + * This is a helper method used internally by Template instances for loading partial templates. You can most likely + * ignore it completely. + * + * @param string $name + * + * @return Mustache_Template + */ + public function loadPartial($name) + { + try { + if (isset($this->partialsLoader)) { + $loader = $this->partialsLoader; + } elseif (isset($this->loader) && !$this->loader instanceof Mustache_Loader_StringLoader) { + $loader = $this->loader; + } else { + throw new Mustache_Exception_UnknownTemplateException($name); + } + + return $this->loadSource($loader->load($name)); + } catch (Mustache_Exception_UnknownTemplateException $e) { + // If the named partial cannot be found, log then return null. + $this->log( + Mustache_Logger::WARNING, + 'Partial not found: "{name}"', + array('name' => $e->getTemplateName()) + ); + } + } + + /** + * Load a Mustache lambda Template by source. + * + * This is a helper method used by Template instances to generate subtemplates for Lambda sections. You can most + * likely ignore it completely. + * + * @param string $source + * @param string $delims (default: null) + * + * @return Mustache_Template + */ + public function loadLambda($source, $delims = null) + { + if ($delims !== null) { + $source = $delims . "\n" . $source; + } + + return $this->loadSource($source, $this->getLambdaCache()); + } + + /** + * Instantiate and return a Mustache Template instance by source. + * + * Optionally provide a Mustache_Cache instance. This is used internally by Mustache_Engine::loadLambda to respect + * the 'cache_lambda_templates' configuration option. + * + * @see Mustache_Engine::loadTemplate + * @see Mustache_Engine::loadPartial + * @see Mustache_Engine::loadLambda + * + * @param string $source + * @param Mustache_Cache $cache (default: null) + * + * @return Mustache_Template + */ + private function loadSource($source, Mustache_Cache $cache = null) + { + $className = $this->getTemplateClassName($source); + + if (!isset($this->templates[$className])) { + if ($cache === null) { + $cache = $this->getCache(); + } + + if (!class_exists($className, false)) { + if (!$cache->load($className)) { + $compiled = $this->compile($source); + $cache->cache($className, $compiled); + } + } + + $this->log( + Mustache_Logger::DEBUG, + 'Instantiating template: "{className}"', + array('className' => $className) + ); + + $this->templates[$className] = new $className($this); + } + + return $this->templates[$className]; + } + + /** + * Helper method to tokenize a Mustache template. + * + * @see Mustache_Tokenizer::scan + * + * @param string $source + * + * @return array Tokens + */ + private function tokenize($source) + { + return $this->getTokenizer()->scan($source); + } + + /** + * Helper method to parse a Mustache template. + * + * @see Mustache_Parser::parse + * + * @param string $source + * + * @return array Token tree + */ + private function parse($source) + { + $parser = $this->getParser(); + $parser->setPragmas($this->getPragmas()); + + return $parser->parse($this->tokenize($source)); + } + + /** + * Helper method to compile a Mustache template. + * + * @see Mustache_Compiler::compile + * + * @param string $source + * + * @return string generated Mustache template class code + */ + private function compile($source) + { + $tree = $this->parse($source); + $name = $this->getTemplateClassName($source); + + $this->log( + Mustache_Logger::INFO, + 'Compiling template to "{className}" class', + array('className' => $name) + ); + + $compiler = $this->getCompiler(); + $compiler->setPragmas($this->getPragmas()); + + return $compiler->compile($source, $tree, $name, isset($this->escape), $this->charset, $this->strictCallables, $this->entityFlags); + } + + /** + * Add a log record if logging is enabled. + * + * @param int $level The logging level + * @param string $message The log message + * @param array $context The log context + */ + private function log($level, $message, array $context = array()) + { + if (isset($this->logger)) { + $this->logger->log($level, $message, $context); + } + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Exception.php b/administrator/components/com_fields/libraries/Mustache/Exception.php new file mode 100644 index 0000000000000..8a2b01c874da2 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Exception.php @@ -0,0 +1,18 @@ +token = $token; + parent::__construct($msg); + } + + /** + * @return array + */ + public function getToken() + { + return $this->token; + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Exception/UnknownFilterException.php b/administrator/components/com_fields/libraries/Mustache/Exception/UnknownFilterException.php new file mode 100644 index 0000000000000..b9a315a5cd802 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Exception/UnknownFilterException.php @@ -0,0 +1,32 @@ +filterName = $filterName; + parent::__construct(sprintf('Unknown filter: %s', $filterName)); + } + + public function getFilterName() + { + return $this->filterName; + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Exception/UnknownHelperException.php b/administrator/components/com_fields/libraries/Mustache/Exception/UnknownHelperException.php new file mode 100644 index 0000000000000..226d77428a1c6 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Exception/UnknownHelperException.php @@ -0,0 +1,32 @@ +helperName = $helperName; + parent::__construct(sprintf('Unknown helper: %s', $helperName)); + } + + public function getHelperName() + { + return $this->helperName; + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Exception/UnknownTemplateException.php b/administrator/components/com_fields/libraries/Mustache/Exception/UnknownTemplateException.php new file mode 100644 index 0000000000000..5dafe892edea7 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Exception/UnknownTemplateException.php @@ -0,0 +1,32 @@ +templateName = $templateName; + parent::__construct(sprintf('Unknown template: %s', $templateName)); + } + + public function getTemplateName() + { + return $this->templateName; + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/HelperCollection.php b/administrator/components/com_fields/libraries/Mustache/HelperCollection.php new file mode 100644 index 0000000000000..00a9b01e71e0f --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/HelperCollection.php @@ -0,0 +1,172 @@ + $helper` pairs. + * + * @throws Mustache_Exception_InvalidArgumentException if the $helpers argument isn't an array or Traversable + * + * @param array|Traversable $helpers (default: null) + */ + public function __construct($helpers = null) + { + if ($helpers === null) { + return; + } + + if (!is_array($helpers) && !$helpers instanceof Traversable) { + throw new Mustache_Exception_InvalidArgumentException('HelperCollection constructor expects an array of helpers'); + } + + foreach ($helpers as $name => $helper) { + $this->add($name, $helper); + } + } + + /** + * Magic mutator. + * + * @see Mustache_HelperCollection::add + * + * @param string $name + * @param mixed $helper + */ + public function __set($name, $helper) + { + $this->add($name, $helper); + } + + /** + * Add a helper to this collection. + * + * @param string $name + * @param mixed $helper + */ + public function add($name, $helper) + { + $this->helpers[$name] = $helper; + } + + /** + * Magic accessor. + * + * @see Mustache_HelperCollection::get + * + * @param string $name + * + * @return mixed Helper + */ + public function __get($name) + { + return $this->get($name); + } + + /** + * Get a helper by name. + * + * @throws Mustache_Exception_UnknownHelperException If helper does not exist. + * + * @param string $name + * + * @return mixed Helper + */ + public function get($name) + { + if (!$this->has($name)) { + throw new Mustache_Exception_UnknownHelperException($name); + } + + return $this->helpers[$name]; + } + + /** + * Magic isset(). + * + * @see Mustache_HelperCollection::has + * + * @param string $name + * + * @return bool True if helper is present + */ + public function __isset($name) + { + return $this->has($name); + } + + /** + * Check whether a given helper is present in the collection. + * + * @param string $name + * + * @return bool True if helper is present + */ + public function has($name) + { + return array_key_exists($name, $this->helpers); + } + + /** + * Magic unset(). + * + * @see Mustache_HelperCollection::remove + * + * @param string $name + */ + public function __unset($name) + { + $this->remove($name); + } + + /** + * Check whether a given helper is present in the collection. + * + * @throws Mustache_Exception_UnknownHelperException if the requested helper is not present. + * + * @param string $name + */ + public function remove($name) + { + if (!$this->has($name)) { + throw new Mustache_Exception_UnknownHelperException($name); + } + + unset($this->helpers[$name]); + } + + /** + * Clear the helper collection. + * + * Removes all helpers from this collection + */ + public function clear() + { + $this->helpers = array(); + } + + /** + * Check whether the helper collection is empty. + * + * @return bool True if the collection is empty + */ + public function isEmpty() + { + return empty($this->helpers); + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/LambdaHelper.php b/administrator/components/com_fields/libraries/Mustache/LambdaHelper.php new file mode 100644 index 0000000000000..7cd8092b6efd0 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/LambdaHelper.php @@ -0,0 +1,49 @@ +mustache = $mustache; + $this->context = $context; + } + + /** + * Render a string as a Mustache template with the current rendering context. + * + * @param string $string + * + * @return string Rendered template. + */ + public function render($string) + { + return $this->mustache + ->loadLambda((string) $string) + ->renderInternal($this->context); + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Loader.php b/administrator/components/com_fields/libraries/Mustache/Loader.php new file mode 100644 index 0000000000000..e75ee3fec0268 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Loader.php @@ -0,0 +1,27 @@ + '{{ bar }}', + * 'baz' => 'Hey {{ qux }}!' + * ); + * + * $tpl = $loader->load('foo'); // '{{ bar }}' + * + * The ArrayLoader is used internally as a partials loader by Mustache_Engine instance when an array of partials + * is set. It can also be used as a quick-and-dirty Template loader. + */ +class Mustache_Loader_ArrayLoader implements Mustache_Loader, Mustache_Loader_MutableLoader +{ + private $templates; + + /** + * ArrayLoader constructor. + * + * @param array $templates Associative array of Template source (default: array()) + */ + public function __construct(array $templates = array()) + { + $this->templates = $templates; + } + + /** + * Load a Template. + * + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found. + * + * @param string $name + * + * @return string Mustache Template source + */ + public function load($name) + { + if (!isset($this->templates[$name])) { + throw new Mustache_Exception_UnknownTemplateException($name); + } + + return $this->templates[$name]; + } + + /** + * Set an associative array of Template sources for this loader. + * + * @param array $templates + */ + public function setTemplates(array $templates) + { + $this->templates = $templates; + } + + /** + * Set a Template source by name. + * + * @param string $name + * @param string $template Mustache Template source + */ + public function setTemplate($name, $template) + { + $this->templates[$name] = $template; + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Loader/CascadingLoader.php b/administrator/components/com_fields/libraries/Mustache/Loader/CascadingLoader.php new file mode 100644 index 0000000000000..16505122112ab --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Loader/CascadingLoader.php @@ -0,0 +1,69 @@ +loaders = array(); + foreach ($loaders as $loader) { + $this->addLoader($loader); + } + } + + /** + * Add a Loader instance. + * + * @param Mustache_Loader $loader + */ + public function addLoader(Mustache_Loader $loader) + { + $this->loaders[] = $loader; + } + + /** + * Load a Template by name. + * + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found. + * + * @param string $name + * + * @return string Mustache Template source + */ + public function load($name) + { + foreach ($this->loaders as $loader) { + try { + return $loader->load($name); + } catch (Mustache_Exception_UnknownTemplateException $e) { + // do nothing, check the next loader. + } + } + + throw new Mustache_Exception_UnknownTemplateException($name); + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Loader/FilesystemLoader.php b/administrator/components/com_fields/libraries/Mustache/Loader/FilesystemLoader.php new file mode 100644 index 0000000000000..7cbf9cd7e3ee1 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Loader/FilesystemLoader.php @@ -0,0 +1,124 @@ +load('foo'); // equivalent to `file_get_contents(dirname(__FILE__).'/views/foo.mustache'); + * + * This is probably the most useful Mustache Loader implementation. It can be used for partials and normal Templates: + * + * $m = new Mustache(array( + * 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'), + * 'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views/partials'), + * )); + */ +class Mustache_Loader_FilesystemLoader implements Mustache_Loader +{ + private $baseDir; + private $extension = '.mustache'; + private $templates = array(); + + /** + * Mustache filesystem Loader constructor. + * + * Passing an $options array allows overriding certain Loader options during instantiation: + * + * $options = array( + * // The filename extension used for Mustache templates. Defaults to '.mustache' + * 'extension' => '.ms', + * ); + * + * @throws Mustache_Exception_RuntimeException if $baseDir does not exist. + * + * @param string $baseDir Base directory containing Mustache template files. + * @param array $options Array of Loader options (default: array()) + */ + public function __construct($baseDir, array $options = array()) + { + $this->baseDir = $baseDir; + + if (strpos($this->baseDir, '://') === false) { + $this->baseDir = realpath($this->baseDir); + } + + if (!is_dir($this->baseDir)) { + throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir)); + } + + if (array_key_exists('extension', $options)) { + if (empty($options['extension'])) { + $this->extension = ''; + } else { + $this->extension = '.' . ltrim($options['extension'], '.'); + } + } + } + + /** + * Load a Template by name. + * + * $loader = new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'); + * $loader->load('admin/dashboard'); // loads "./views/admin/dashboard.mustache"; + * + * @param string $name + * + * @return string Mustache Template source + */ + public function load($name) + { + if (!isset($this->templates[$name])) { + $this->templates[$name] = $this->loadFile($name); + } + + return $this->templates[$name]; + } + + /** + * Helper function for loading a Mustache file by name. + * + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found. + * + * @param string $name + * + * @return string Mustache Template source + */ + protected function loadFile($name) + { + $fileName = $this->getFileName($name); + + if (!file_exists($fileName)) { + throw new Mustache_Exception_UnknownTemplateException($name); + } + + return file_get_contents($fileName); + } + + /** + * Helper function for getting a Mustache template file name. + * + * @param string $name + * + * @return string Template file name + */ + protected function getFileName($name) + { + $fileName = $this->baseDir . '/' . $name; + if (substr($fileName, 0 - strlen($this->extension)) !== $this->extension) { + $fileName .= $this->extension; + } + + return $fileName; + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Loader/InlineLoader.php b/administrator/components/com_fields/libraries/Mustache/Loader/InlineLoader.php new file mode 100644 index 0000000000000..b1ed9ec826da2 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Loader/InlineLoader.php @@ -0,0 +1,123 @@ +load('hello'); + * $goodbye = $loader->load('goodbye'); + * + * __halt_compiler(); + * + * @@ hello + * Hello, {{ planet }}! + * + * @@ goodbye + * Goodbye, cruel {{ planet }} + * + * Templates are deliniated by lines containing only `@@ name`. + * + * The InlineLoader is well-suited to micro-frameworks such as Silex: + * + * $app->register(new MustacheServiceProvider, array( + * 'mustache.loader' => new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__) + * )); + * + * $app->get('/{name}', function ($name) use ($app) { + * return $app['mustache']->render('hello', compact('name')); + * }) + * ->value('name', 'world'); + * + * // ... + * + * __halt_compiler(); + * + * @@ hello + * Hello, {{ name }}! + */ +class Mustache_Loader_InlineLoader implements Mustache_Loader +{ + protected $fileName; + protected $offset; + protected $templates; + + /** + * The InlineLoader requires a filename and offset to process templates. + * + * The magic constants `__FILE__` and `__COMPILER_HALT_OFFSET__` are usually + * perfectly suited to the job: + * + * $loader = new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__); + * + * Note that this only works if the loader is instantiated inside the same + * file as the inline templates. If the templates are located in another + * file, it would be necessary to manually specify the filename and offset. + * + * @param string $fileName The file to parse for inline templates + * @param int $offset A string offset for the start of the templates. + * This usually coincides with the `__halt_compiler` + * call, and the `__COMPILER_HALT_OFFSET__`. + */ + public function __construct($fileName, $offset) + { + if (!is_file($fileName)) { + throw new Mustache_Exception_InvalidArgumentException('InlineLoader expects a valid filename.'); + } + + if (!is_int($offset) || $offset < 0) { + throw new Mustache_Exception_InvalidArgumentException('InlineLoader expects a valid file offset.'); + } + + $this->fileName = $fileName; + $this->offset = $offset; + } + + /** + * Load a Template by name. + * + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found. + * + * @param string $name + * + * @return string Mustache Template source + */ + public function load($name) + { + $this->loadTemplates(); + + if (!array_key_exists($name, $this->templates)) { + throw new Mustache_Exception_UnknownTemplateException($name); + } + + return $this->templates[$name]; + } + + /** + * Parse and load templates from the end of a source file. + */ + protected function loadTemplates() + { + if ($this->templates === null) { + $this->templates = array(); + $data = file_get_contents($this->fileName, false, null, $this->offset); + foreach (preg_split("/^@@(?= [\w\d\.]+$)/m", $data, -1) as $chunk) { + if (trim($chunk)) { + list($name, $content) = explode("\n", $chunk, 2); + $this->templates[trim($name)] = trim($content); + } + } + } + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Loader/MutableLoader.php b/administrator/components/com_fields/libraries/Mustache/Loader/MutableLoader.php new file mode 100644 index 0000000000000..1c4adc68b2f81 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Loader/MutableLoader.php @@ -0,0 +1,31 @@ +load('{{ foo }}'); // '{{ foo }}' + * + * This is the default Template Loader instance used by Mustache: + * + * $m = new Mustache; + * $tpl = $m->loadTemplate('{{ foo }}'); + * echo $tpl->render(array('foo' => 'bar')); // "bar" + */ +class Mustache_Loader_StringLoader implements Mustache_Loader +{ + /** + * Load a Template by source. + * + * @param string $name Mustache Template source + * + * @return string Mustache Template source + */ + public function load($name) + { + return $name; + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Logger.php b/administrator/components/com_fields/libraries/Mustache/Logger.php new file mode 100644 index 0000000000000..3af5049684c2b --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Logger.php @@ -0,0 +1,126 @@ +log(Mustache_Logger::EMERGENCY, $message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string $message + * @param array $context + */ + public function alert($message, array $context = array()) + { + $this->log(Mustache_Logger::ALERT, $message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string $message + * @param array $context + */ + public function critical($message, array $context = array()) + { + $this->log(Mustache_Logger::CRITICAL, $message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string $message + * @param array $context + */ + public function error($message, array $context = array()) + { + $this->log(Mustache_Logger::ERROR, $message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string $message + * @param array $context + */ + public function warning($message, array $context = array()) + { + $this->log(Mustache_Logger::WARNING, $message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param array $context + */ + public function notice($message, array $context = array()) + { + $this->log(Mustache_Logger::NOTICE, $message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string $message + * @param array $context + */ + public function info($message, array $context = array()) + { + $this->log(Mustache_Logger::INFO, $message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param array $context + */ + public function debug($message, array $context = array()) + { + $this->log(Mustache_Logger::DEBUG, $message, $context); + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Logger/StreamLogger.php b/administrator/components/com_fields/libraries/Mustache/Logger/StreamLogger.php new file mode 100644 index 0000000000000..7db52d618236e --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Logger/StreamLogger.php @@ -0,0 +1,194 @@ + 100, + self::INFO => 200, + self::NOTICE => 250, + self::WARNING => 300, + self::ERROR => 400, + self::CRITICAL => 500, + self::ALERT => 550, + self::EMERGENCY => 600, + ); + + protected $level; + protected $stream = null; + protected $url = null; + + /** + * @throws InvalidArgumentException if the logging level is unknown. + * + * @param resource|string $stream Resource instance or URL + * @param int $level The minimum logging level at which this handler will be triggered + */ + public function __construct($stream, $level = Mustache_Logger::ERROR) + { + $this->setLevel($level); + + if (is_resource($stream)) { + $this->stream = $stream; + } else { + $this->url = $stream; + } + } + + /** + * Close stream resources. + */ + public function __destruct() + { + if (is_resource($this->stream)) { + fclose($this->stream); + } + } + + /** + * Set the minimum logging level. + * + * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown. + * + * @param int $level The minimum logging level which will be written + */ + public function setLevel($level) + { + if (!array_key_exists($level, self::$levels)) { + throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected logging level: %s', $level)); + } + + $this->level = $level; + } + + /** + * Get the current minimum logging level. + * + * @return int + */ + public function getLevel() + { + return $this->level; + } + + /** + * Logs with an arbitrary level. + * + * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown. + * + * @param mixed $level + * @param string $message + * @param array $context + */ + public function log($level, $message, array $context = array()) + { + if (!array_key_exists($level, self::$levels)) { + throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected logging level: %s', $level)); + } + + if (self::$levels[$level] >= self::$levels[$this->level]) { + $this->writeLog($level, $message, $context); + } + } + + /** + * Write a record to the log. + * + * @throws Mustache_Exception_LogicException If neither a stream resource nor url is present. + * @throws Mustache_Exception_RuntimeException If the stream url cannot be opened. + * + * @param int $level The logging level + * @param string $message The log message + * @param array $context The log context + */ + protected function writeLog($level, $message, array $context = array()) + { + if (!is_resource($this->stream)) { + if (!isset($this->url)) { + throw new Mustache_Exception_LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().'); + } + + $this->stream = fopen($this->url, 'a'); + if (!is_resource($this->stream)) { + // @codeCoverageIgnoreStart + throw new Mustache_Exception_RuntimeException(sprintf('The stream or file "%s" could not be opened.', $this->url)); + // @codeCoverageIgnoreEnd + } + } + + fwrite($this->stream, self::formatLine($level, $message, $context)); + } + + /** + * Gets the name of the logging level. + * + * @throws InvalidArgumentException if the logging level is unknown. + * + * @param int $level + * + * @return string + */ + protected static function getLevelName($level) + { + return strtoupper($level); + } + + /** + * Format a log line for output. + * + * @param int $level The logging level + * @param string $message The log message + * @param array $context The log context + * + * @return string + */ + protected static function formatLine($level, $message, array $context = array()) + { + return sprintf( + "%s: %s\n", + self::getLevelName($level), + self::interpolateMessage($message, $context) + ); + } + + /** + * Interpolate context values into the message placeholders. + * + * @param string $message + * @param array $context + * + * @return string + */ + protected static function interpolateMessage($message, array $context = array()) + { + if (strpos($message, '{') === false) { + return $message; + } + + // build a replacement array with braces around the context keys + $replace = array(); + foreach ($context as $key => $val) { + $replace['{' . $key . '}'] = $val; + } + + // interpolate replacement values into the the message and return + return strtr($message, $replace); + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Parser.php b/administrator/components/com_fields/libraries/Mustache/Parser.php new file mode 100644 index 0000000000000..c60f5db1730bb --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Parser.php @@ -0,0 +1,317 @@ +lineNum = -1; + $this->lineTokens = 0; + $this->pragmas = $this->defaultPragmas; + + $this->pragmaFilters = isset($this->pragmas[Mustache_Engine::PRAGMA_FILTERS]); + $this->pragmaBlocks = isset($this->pragmas[Mustache_Engine::PRAGMA_BLOCKS]); + + return $this->buildTree($tokens); + } + + /** + * Enable pragmas across all templates, regardless of the presence of pragma + * tags in the individual templates. + * + * @internal Users should set global pragmas in Mustache_Engine, not here :) + * + * @param string[] $pragmas + */ + public function setPragmas(array $pragmas) + { + $this->pragmas = array(); + foreach ($pragmas as $pragma) { + $this->enablePragma($pragma); + } + $this->defaultPragmas = $this->pragmas; + } + + /** + * Helper method for recursively building a parse tree. + * + * @throws Mustache_Exception_SyntaxException when nesting errors or mismatched section tags are encountered. + * + * @param array &$tokens Set of Mustache tokens + * @param array $parent Parent token (default: null) + * + * @return array Mustache Token parse tree + */ + private function buildTree(array &$tokens, array $parent = null) + { + $nodes = array(); + + while (!empty($tokens)) { + $token = array_shift($tokens); + + if ($token[Mustache_Tokenizer::LINE] === $this->lineNum) { + $this->lineTokens++; + } else { + $this->lineNum = $token[Mustache_Tokenizer::LINE]; + $this->lineTokens = 0; + } + + if ($this->pragmaFilters && isset($token[Mustache_Tokenizer::NAME])) { + list($name, $filters) = $this->getNameAndFilters($token[Mustache_Tokenizer::NAME]); + if (!empty($filters)) { + $token[Mustache_Tokenizer::NAME] = $name; + $token[Mustache_Tokenizer::FILTERS] = $filters; + } + } + + switch ($token[Mustache_Tokenizer::TYPE]) { + case Mustache_Tokenizer::T_DELIM_CHANGE: + $this->checkIfTokenIsAllowedInParent($parent, $token); + $this->clearStandaloneLines($nodes, $tokens); + break; + + case Mustache_Tokenizer::T_SECTION: + case Mustache_Tokenizer::T_INVERTED: + $this->checkIfTokenIsAllowedInParent($parent, $token); + $this->clearStandaloneLines($nodes, $tokens); + $nodes[] = $this->buildTree($tokens, $token); + break; + + case Mustache_Tokenizer::T_END_SECTION: + if (!isset($parent)) { + $msg = sprintf( + 'Unexpected closing tag: /%s on line %d', + $token[Mustache_Tokenizer::NAME], + $token[Mustache_Tokenizer::LINE] + ); + throw new Mustache_Exception_SyntaxException($msg, $token); + } + + if ($token[Mustache_Tokenizer::NAME] !== $parent[Mustache_Tokenizer::NAME]) { + $msg = sprintf( + 'Nesting error: %s (on line %d) vs. %s (on line %d)', + $parent[Mustache_Tokenizer::NAME], + $parent[Mustache_Tokenizer::LINE], + $token[Mustache_Tokenizer::NAME], + $token[Mustache_Tokenizer::LINE] + ); + throw new Mustache_Exception_SyntaxException($msg, $token); + } + + $this->clearStandaloneLines($nodes, $tokens); + $parent[Mustache_Tokenizer::END] = $token[Mustache_Tokenizer::INDEX]; + $parent[Mustache_Tokenizer::NODES] = $nodes; + + return $parent; + + case Mustache_Tokenizer::T_PARTIAL: + $this->checkIfTokenIsAllowedInParent($parent, $token); + //store the whitespace prefix for laters! + if ($indent = $this->clearStandaloneLines($nodes, $tokens)) { + $token[Mustache_Tokenizer::INDENT] = $indent[Mustache_Tokenizer::VALUE]; + } + $nodes[] = $token; + break; + + case Mustache_Tokenizer::T_PARENT: + $this->checkIfTokenIsAllowedInParent($parent, $token); + $nodes[] = $this->buildTree($tokens, $token); + break; + + case Mustache_Tokenizer::T_BLOCK_VAR: + if ($this->pragmaBlocks) { + // BLOCKS pragma is enabled, let's do this! + if ($parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) { + $token[Mustache_Tokenizer::TYPE] = Mustache_Tokenizer::T_BLOCK_ARG; + } + $this->clearStandaloneLines($nodes, $tokens); + $nodes[] = $this->buildTree($tokens, $token); + } else { + // pretend this was just a normal "escaped" token... + $token[Mustache_Tokenizer::TYPE] = Mustache_Tokenizer::T_ESCAPED; + // TODO: figure out how to figure out if there was a space after this dollar: + $token[Mustache_Tokenizer::NAME] = '$' . $token[Mustache_Tokenizer::NAME]; + $nodes[] = $token; + } + break; + + case Mustache_Tokenizer::T_PRAGMA: + $this->enablePragma($token[Mustache_Tokenizer::NAME]); + // no break + + case Mustache_Tokenizer::T_COMMENT: + $this->clearStandaloneLines($nodes, $tokens); + $nodes[] = $token; + break; + + default: + $nodes[] = $token; + break; + } + } + + if (isset($parent)) { + $msg = sprintf( + 'Missing closing tag: %s opened on line %d', + $parent[Mustache_Tokenizer::NAME], + $parent[Mustache_Tokenizer::LINE] + ); + throw new Mustache_Exception_SyntaxException($msg, $parent); + } + + return $nodes; + } + + /** + * Clear standalone line tokens. + * + * Returns a whitespace token for indenting partials, if applicable. + * + * @param array $nodes Parsed nodes. + * @param array $tokens Tokens to be parsed. + * + * @return array|null Resulting indent token, if any. + */ + private function clearStandaloneLines(array &$nodes, array &$tokens) + { + if ($this->lineTokens > 1) { + // this is the third or later node on this line, so it can't be standalone + return; + } + + $prev = null; + if ($this->lineTokens === 1) { + // this is the second node on this line, so it can't be standalone + // unless the previous node is whitespace. + if ($prev = end($nodes)) { + if (!$this->tokenIsWhitespace($prev)) { + return; + } + } + } + + if ($next = reset($tokens)) { + // If we're on a new line, bail. + if ($next[Mustache_Tokenizer::LINE] !== $this->lineNum) { + return; + } + + // If the next token isn't whitespace, bail. + if (!$this->tokenIsWhitespace($next)) { + return; + } + + if (count($tokens) !== 1) { + // Unless it's the last token in the template, the next token + // must end in newline for this to be standalone. + if (substr($next[Mustache_Tokenizer::VALUE], -1) !== "\n") { + return; + } + } + + // Discard the whitespace suffix + array_shift($tokens); + } + + if ($prev) { + // Return the whitespace prefix, if any + return array_pop($nodes); + } + } + + /** + * Check whether token is a whitespace token. + * + * True if token type is T_TEXT and value is all whitespace characters. + * + * @param array $token + * + * @return bool True if token is a whitespace token + */ + private function tokenIsWhitespace(array $token) + { + if ($token[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_TEXT) { + return preg_match('/^\s*$/', $token[Mustache_Tokenizer::VALUE]); + } + + return false; + } + + /** + * Check whether a token is allowed inside a parent tag. + * + * @throws Mustache_Exception_SyntaxException if an invalid token is found inside a parent tag. + * + * @param array|null $parent + * @param array $token + */ + private function checkIfTokenIsAllowedInParent($parent, array $token) + { + if ($parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) { + throw new Mustache_Exception_SyntaxException('Illegal content in < parent tag', $token); + } + } + + /** + * Split a tag name into name and filters. + * + * @param string $name + * + * @return array [Tag name, Array of filters] + */ + private function getNameAndFilters($name) + { + $filters = array_map('trim', explode('|', $name)); + $name = array_shift($filters); + + return array($name, $filters); + } + + /** + * Enable a pragma. + * + * @param string $name + */ + private function enablePragma($name) + { + $this->pragmas[$name] = true; + + switch ($name) { + case Mustache_Engine::PRAGMA_BLOCKS: + $this->pragmaBlocks = true; + break; + + case Mustache_Engine::PRAGMA_FILTERS: + $this->pragmaFilters = true; + break; + } + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Template.php b/administrator/components/com_fields/libraries/Mustache/Template.php new file mode 100644 index 0000000000000..0648e2c608282 --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Template.php @@ -0,0 +1,181 @@ +mustache = $mustache; + } + + /** + * Mustache Template instances can be treated as a function and rendered by simply calling them. + * + * $m = new Mustache_Engine; + * $tpl = $m->loadTemplate('Hello, {{ name }}!'); + * echo $tpl(array('name' => 'World')); // "Hello, World!" + * + * @see Mustache_Template::render + * + * @param mixed $context Array or object rendering context (default: array()) + * + * @return string Rendered template + */ + public function __invoke($context = array()) + { + return $this->render($context); + } + + /** + * Render this template given the rendering context. + * + * @param mixed $context Array or object rendering context (default: array()) + * + * @return string Rendered template + */ + public function render($context = array()) + { + return $this->renderInternal( + $this->prepareContextStack($context) + ); + } + + /** + * Internal rendering method implemented by Mustache Template concrete subclasses. + * + * This is where the magic happens :) + * + * NOTE: This method is not part of the Mustache.php public API. + * + * @param Mustache_Context $context + * @param string $indent (default: '') + * + * @return string Rendered template + */ + abstract public function renderInternal(Mustache_Context $context, $indent = ''); + + /** + * Tests whether a value should be iterated over (e.g. in a section context). + * + * In most languages there are two distinct array types: list and hash (or whatever you want to call them). Lists + * should be iterated, hashes should be treated as objects. Mustache follows this paradigm for Ruby, Javascript, + * Java, Python, etc. + * + * PHP, however, treats lists and hashes as one primitive type: array. So Mustache.php needs a way to distinguish + * between between a list of things (numeric, normalized array) and a set of variables to be used as section context + * (associative array). In other words, this will be iterated over: + * + * $items = array( + * array('name' => 'foo'), + * array('name' => 'bar'), + * array('name' => 'baz'), + * ); + * + * ... but this will be used as a section context block: + * + * $items = array( + * 1 => array('name' => 'foo'), + * 'banana' => array('name' => 'bar'), + * 42 => array('name' => 'baz'), + * ); + * + * @param mixed $value + * + * @return bool True if the value is 'iterable' + */ + protected function isIterable($value) + { + switch (gettype($value)) { + case 'object': + return $value instanceof Traversable; + + case 'array': + $i = 0; + foreach ($value as $k => $v) { + if ($k !== $i++) { + return false; + } + } + + return true; + + default: + return false; + } + } + + /** + * Helper method to prepare the Context stack. + * + * Adds the Mustache HelperCollection to the stack's top context frame if helpers are present. + * + * @param mixed $context Optional first context frame (default: null) + * + * @return Mustache_Context + */ + protected function prepareContextStack($context = null) + { + $stack = new Mustache_Context(); + + $helpers = $this->mustache->getHelpers(); + if (!$helpers->isEmpty()) { + $stack->push($helpers); + } + + if (!empty($context)) { + $stack->push($context); + } + + return $stack; + } + + /** + * Resolve a context value. + * + * Invoke the value if it is callable, otherwise return the value. + * + * @param mixed $value + * @param Mustache_Context $context + * @param string $indent + * + * @return string + */ + protected function resolveValue($value, Mustache_Context $context, $indent = '') + { + if (($this->strictCallables ? is_object($value) : !is_string($value)) && is_callable($value)) { + return $this->mustache + ->loadLambda((string) call_user_func($value)) + ->renderInternal($context, $indent); + } + + return $value; + } +} diff --git a/administrator/components/com_fields/libraries/Mustache/Tokenizer.php b/administrator/components/com_fields/libraries/Mustache/Tokenizer.php new file mode 100644 index 0000000000000..dfbaa8aba5d2c --- /dev/null +++ b/administrator/components/com_fields/libraries/Mustache/Tokenizer.php @@ -0,0 +1,322 @@ +'; + const T_PARENT = '<'; + const T_DELIM_CHANGE = '='; + const T_ESCAPED = '_v'; + const T_UNESCAPED = '{'; + const T_UNESCAPED_2 = '&'; + const T_TEXT = '_t'; + const T_PRAGMA = '%'; + const T_BLOCK_VAR = '$'; + const T_BLOCK_ARG = '$arg'; + + // Valid token types + private static $tagTypes = array( + self::T_SECTION => true, + self::T_INVERTED => true, + self::T_END_SECTION => true, + self::T_COMMENT => true, + self::T_PARTIAL => true, + self::T_PARENT => true, + self::T_DELIM_CHANGE => true, + self::T_ESCAPED => true, + self::T_UNESCAPED => true, + self::T_UNESCAPED_2 => true, + self::T_PRAGMA => true, + self::T_BLOCK_VAR => true, + ); + + // Token properties + const TYPE = 'type'; + const NAME = 'name'; + const OTAG = 'otag'; + const CTAG = 'ctag'; + const LINE = 'line'; + const INDEX = 'index'; + const END = 'end'; + const INDENT = 'indent'; + const NODES = 'nodes'; + const VALUE = 'value'; + const FILTERS = 'filters'; + + private $state; + private $tagType; + private $buffer; + private $tokens; + private $seenTag; + private $line; + private $otag; + private $ctag; + private $otagLen; + private $ctagLen; + + /** + * Scan and tokenize template source. + * + * @throws Mustache_Exception_SyntaxException when mismatched section tags are encountered. + * + * @param string $text Mustache template source to tokenize + * @param string $delimiters Optionally, pass initial opening and closing delimiters (default: null) + * + * @return array Set of Mustache tokens + */ + public function scan($text, $delimiters = null) + { + // Setting mbstring.func_overload makes things *really* slow. + // Let's do everyone a favor and scan this string as ASCII instead. + $encoding = null; + if (function_exists('mb_internal_encoding') && ini_get('mbstring.func_overload') & 2) { + $encoding = mb_internal_encoding(); + mb_internal_encoding('ASCII'); + } + + $this->reset(); + + if ($delimiters = trim($delimiters)) { + $this->setDelimiters($delimiters); + } + + $len = strlen($text); + for ($i = 0; $i < $len; $i++) { + switch ($this->state) { + case self::IN_TEXT: + if ($this->tagChange($this->otag, $this->otagLen, $text, $i)) { + $i--; + $this->flushBuffer(); + $this->state = self::IN_TAG_TYPE; + } else { + $char = $text[$i]; + $this->buffer .= $char; + if ($char === "\n") { + $this->flushBuffer(); + $this->line++; + } + } + break; + + case self::IN_TAG_TYPE: + $i += $this->otagLen - 1; + $char = $text[$i + 1]; + if (isset(self::$tagTypes[$char])) { + $tag = $char; + $this->tagType = $tag; + } else { + $tag = null; + $this->tagType = self::T_ESCAPED; + } + + if ($this->tagType === self::T_DELIM_CHANGE) { + $i = $this->changeDelimiters($text, $i); + $this->state = self::IN_TEXT; + } elseif ($this->tagType === self::T_PRAGMA) { + $i = $this->addPragma($text, $i); + $this->state = self::IN_TEXT; + } else { + if ($tag !== null) { + $i++; + } + $this->state = self::IN_TAG; + } + $this->seenTag = $i; + break; + + default: + if ($this->tagChange($this->ctag, $this->ctagLen, $text, $i)) { + $token = array( + self::TYPE => $this->tagType, + self::NAME => trim($this->buffer), + self::OTAG => $this->otag, + self::CTAG => $this->ctag, + self::LINE => $this->line, + self::INDEX => ($this->tagType === self::T_END_SECTION) ? $this->seenTag - $this->otagLen : $i + $this->ctagLen, + ); + + if ($this->tagType === self::T_UNESCAPED) { + // Clean up `{{{ tripleStache }}}` style tokens. + if ($this->ctag === '}}') { + if (($i + 2 < $len) && $text[$i + 2] === '}') { + $i++; + } else { + $msg = sprintf( + 'Mismatched tag delimiters: %s on line %d', + $token[self::NAME], + $token[self::LINE] + ); + + throw new Mustache_Exception_SyntaxException($msg, $token); + } + } else { + $lastName = $token[self::NAME]; + if (substr($lastName, -1) === '}') { + $token[self::NAME] = trim(substr($lastName, 0, -1)); + } else { + $msg = sprintf( + 'Mismatched tag delimiters: %s on line %d', + $token[self::NAME], + $token[self::LINE] + ); + + throw new Mustache_Exception_SyntaxException($msg, $token); + } + } + } + + $this->buffer = ''; + $i += $this->ctagLen - 1; + $this->state = self::IN_TEXT; + $this->tokens[] = $token; + } else { + $this->buffer .= $text[$i]; + } + break; + } + } + + $this->flushBuffer(); + + // Restore the user's encoding... + if ($encoding) { + mb_internal_encoding($encoding); + } + + return $this->tokens; + } + + /** + * Helper function to reset tokenizer internal state. + */ + private function reset() + { + $this->state = self::IN_TEXT; + $this->tagType = null; + $this->buffer = ''; + $this->tokens = array(); + $this->seenTag = false; + $this->line = 0; + $this->otag = '{{'; + $this->ctag = '}}'; + $this->otagLen = 2; + $this->ctagLen = 2; + } + + /** + * Flush the current buffer to a token. + */ + private function flushBuffer() + { + if (strlen($this->buffer) > 0) { + $this->tokens[] = array( + self::TYPE => self::T_TEXT, + self::LINE => $this->line, + self::VALUE => $this->buffer, + ); + $this->buffer = ''; + } + } + + /** + * Change the current Mustache delimiters. Set new `otag` and `ctag` values. + * + * @param string $text Mustache template source + * @param int $index Current tokenizer index + * + * @return int New index value + */ + private function changeDelimiters($text, $index) + { + $startIndex = strpos($text, '=', $index) + 1; + $close = '=' . $this->ctag; + $closeIndex = strpos($text, $close, $index); + + $this->setDelimiters(trim(substr($text, $startIndex, $closeIndex - $startIndex))); + + $this->tokens[] = array( + self::TYPE => self::T_DELIM_CHANGE, + self::LINE => $this->line, + ); + + return $closeIndex + strlen($close) - 1; + } + + /** + * Set the current Mustache `otag` and `ctag` delimiters. + * + * @param string $delimiters + */ + private function setDelimiters($delimiters) + { + list($otag, $ctag) = explode(' ', $delimiters); + $this->otag = $otag; + $this->ctag = $ctag; + $this->otagLen = strlen($otag); + $this->ctagLen = strlen($ctag); + } + + /** + * Add pragma token. + * + * Pragmas are hoisted to the front of the template, so all pragma tokens + * will appear at the front of the token list. + * + * @param string $text + * @param int $index + * + * @return int New index value + */ + private function addPragma($text, $index) + { + $end = strpos($text, $this->ctag, $index); + $pragma = trim(substr($text, $index + 2, $end - $index - 2)); + + // Pragmas are hoisted to the front of the template. + array_unshift($this->tokens, array( + self::TYPE => self::T_PRAGMA, + self::NAME => $pragma, + self::LINE => 0, + )); + + return $end + $this->ctagLen - 1; + } + + /** + * Test whether it's time to change tags. + * + * @param string $tag Current tag name + * @param int $tagLen Current tag name length + * @param string $text Mustache template source + * @param int $index Current tokenizer index + * + * @return bool True if this is a closing section tag + */ + private function tagChange($tag, $tagLen, $text, $index) + { + return substr($text, $index, $tagLen) === $tag; + } +} diff --git a/administrator/components/com_fields/models/field.php b/administrator/components/com_fields/models/field.php new file mode 100644 index 0000000000000..51f2c8ec3f6d8 --- /dev/null +++ b/administrator/components/com_fields/models/field.php @@ -0,0 +1,578 @@ +input->getCmd('context', 'com_content.article'); + $this->typeAlias = $context . '.field'; + } + + protected function canDelete ($record) + { + if (! empty($record->id)) + { + if ($record->state != - 2) + { + return; + } + + $user = JFactory::getUser(); + + return $user->authorise('core.delete', $record->context . '.field.' . (int) $record->id); + } + } + + protected function canEditState ($record) + { + $user = JFactory::getUser(); + + // Check for existing field. + if (! empty($record->id)) + { + return $user->authorise('core.edit.state', $record->context . '.field.' . (int) $record->id); + } + else + { + return $user->authorise('core.edit.state', $record->context); + } + } + + public function save ($data) + { + $field = null; + if (isset($data['id']) && $data['id']) + { + $field = $this->getItem($data['id']); + } + + if (! isset($data['assigned_cat_ids'])) + { + $data['assigned_cat_ids'] = []; + } + $success = parent::save($data); + + // If the options have changed delete the values + if ($success && $field && isset($data['fieldparams']['options']) && isset($field->fieldparams['options'])) + { + $oldParams = json_decode($field->fieldparams['options']); + $newParams = json_decode($data['fieldparams']['options']); + if (count(array_intersect($oldParams->key, $newParams->key)) != count($oldParams->key)) + { + $this->_db->setQuery( + 'delete from #__fields_values where field_id = ' . (int) $field->id . ' and value not in (\'' . + implode("','", $newParams->key) . '\')'); + $this->_db->query(); + } + } + + return $success; + } + + public function delete (&$pks) + { + $success = parent::delete($pks); + if ($success) + { + $pks = (array) $pks; + JArrayHelper::toInteger($pks); + $this->_db->setQuery('delete from #__fields_values where field_id in (' . implode(',', $pks) . ')'); + $this->_db->query(); + } + return $success; + } + + public function getTable ($type = 'Field', $prefix = 'FieldsTable', $config = array()) + { + if (strpos(JPATH_COMPONENT, 'com_fields') === false) + { + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_fields/tables'); + } + return JTable::getInstance($type, $prefix, $config); + } + + protected function populateState () + { + $app = JFactory::getApplication('administrator'); + + // Load the User state. + $pk = $app->input->getInt('id'); + $this->setState($this->getName() . '.id', $pk); + + $context = $app->input->get('context', 'com_content.article'); + $this->setState('field.context', $context); + $parts = FieldsHelper::extract($context); + + // Extract the component name + $this->setState('field.component', $parts[0]); + + // Extract the optional section name + $this->setState('field.section', (count($parts) > 1) ? $parts[1] : null); + + // Load the parameters. + $params = JComponentHelper::getParams('com_fields'); + $this->setState('params', $params); + } + + public function getItem ($pk = null) + { + if ($result = parent::getItem($pk)) + { + // Prime required properties. + if (empty($result->id)) + { + $result->context = JFactory::getApplication()->input->getCmd('context', $this->getState('field.context')); + } + + if (property_exists($result, 'fieldparams')) + { + $registry = new Registry(); + $registry->loadString($result->fieldparams); + $result->fieldparams = $registry->toArray(); + } + + if ($result->assigned_cat_ids) + { + $result->assigned_cat_ids = explode(',', $result->assigned_cat_ids); + } + + // Convert the created and modified dates to local user time for + // display in the form. + $tz = new DateTimeZone(JFactory::getApplication()->get('offset')); + + if ((int) $result->created_time) + { + $date = new JDate($result->created_time); + $date->setTimezone($tz); + $result->created_time = $date->toSql(true); + } + else + { + $result->created_time = null; + } + + if ((int) $result->modified_time) + { + $date = new JDate($result->modified_time); + $date->setTimezone($tz); + $result->modified_time = $date->toSql(true); + } + else + { + $result->modified_time = null; + } + + if (! empty($result->id)) + { + $result->tags = new JHelperTags(); + $result->tags->getTagIds($result->id, 'com_fields.field'); + } + } + + return $result; + } + + public function getForm ($data = array(), $loadData = true) + { + $context = $this->getState('field.context'); + $jinput = JFactory::getApplication()->input; + + // A workaround to get the context into the model for save requests. + if (empty($context) && isset($data['context'])) + { + $context = $data['context']; + $parts = explode('.', $context); + + $this->setState('field.context', $context); + $this->setState('field.component', $parts[0]); + $this->setState('field.section', @$parts[1]); + } + + // Get the form. + $form = $this->loadForm('com_fields.field' . $context, 'field', array( + 'control' => 'jform', + 'load_data' => $loadData + )); + + if (empty($form)) + { + return false; + } + + // Modify the form based on Edit State access controls. + if (empty($data['context'])) + { + $data['context'] = $context; + } + + if (isset($data['type'])) + { + $parts = explode('.', JFactory::getApplication()->input->getCmd('context', $this->getState('field.context'))); + $component = $parts[0]; + $this->loadTypeForms($form, $data['type'], $component); + } + + if (! JFactory::getUser()->authorise('core.edit.state', $context . '.field.' . $jinput->get('id'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('state', 'disabled', 'true'); + + // Disable fields while saving. + // The controller has already verified this is a record you can + // edit. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('state', 'filter', 'unset'); + } + + return $form; + } + + protected function getReorderConditions ($table) + { + return 'context = ' . $this->_db->quote($table->context); + } + + protected function loadFormData () + { + // Check the session for previously entered form data. + $app = JFactory::getApplication(); + $data = $app->getUserState('com_fields.edit.' . $this->getName() . '.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + + // Pre-select some filters (Status, Language, Access) in edit form + // if those have been selected in Category Manager + if (! $data->id) + { + // Check for which context the Category Manager is used and + // get selected fields + $context = substr($app->getUserState('com_fields.fields.filter.context'), 4); + $component = FieldsHelper::extract($context); + $component = $component ? $component[0] : null; + $filters = (array) $app->getUserState('com_fields.fields.' . $component . '.filter'); + + $data->set('published', $app->input->getInt('published', (! empty($filters['published']) ? $filters['published'] : null))); + $data->set('language', $app->input->getString('language', (! empty($filters['language']) ? $filters['language'] : null))); + $data->set('access', + $app->input->getInt('access', (! empty($filters['access']) ? $filters['access'] : JFactory::getConfig()->get('access')))); + + // Set the type if available from the request + $data->set('type', $app->input->getWord('type', $data->get('type'))); + } + } + + $this->preprocessData('com_fields.field', $data); + + return $data; + } + + protected function preprocessForm (JForm $form, $data, $group = 'content') + { + $parts = FieldsHelper::extract(JFactory::getApplication()->input->getCmd('context', $this->getState('field.context'))); + + if ($parts) + { + $component = $parts[0]; + + if (isset($data->type)) + { + $this->loadTypeForms($form, $data->type, $component); + + $form->setFieldAttribute('type', 'component', $component); + + // Not alowed to change the type of an existing record + if ($data->id) + { + $form->setFieldAttribute('type', 'readonly', 'true'); + } + } + + // Setting the context for the category field + $cat = JCategories::getInstance(str_replace('com_', '', $component)); + if ($cat && $cat->get('root')->hasChildren()) + { + $form->setFieldAttribute('assigned_cat_ids', 'extension', $component); + } + else + { + $form->removeField('assigned_cat_ids'); + } + + $form->setFieldAttribute('type', 'component', $component); + $form->setFieldAttribute('catid', 'extension', $component . '.' . $parts[1] . '.fields'); + } + + // Trigger the default form events. + parent::preprocessForm($form, $data, $group); + } + + /** + * Returning the value for the given field id, context and item id. + * + * @param string $fieldId + * @param string $context + * @param string $itemId + * @return NULL|string + */ + public function getFieldValue ($fieldId, $context, $itemId) + { + $key = md5($fieldId . $context . $itemId); + if (! key_exists($key, $this->valueCache)) + { + $this->valueCache[$key] = null; + $db = $this->_db; + + $query = 'select value from #__fields_values '; + $query .= 'where field_id = ' . (int) $fieldId . ' and context = ' . $db->q($context) . ' and item_id = ' . $db->q($itemId) . ' '; + $db->setQuery($query); + $rows = $db->loadObjectList(); + if (count($rows) == 1) + { + $this->valueCache[$key] = $rows[0]->value; + } + else if (count($rows) > 1) + { + $data = array(); + foreach ($rows as $row) + { + $data[] = $row->value; + } + $this->valueCache[$key] = $data; + } + } + return $this->valueCache[$key]; + } + + /** + * Setting the value for the gven field id, context and item id. + * + * @param string $fieldId + * @param string $context + * @param string $itemId + * @param string $value + * @return boolean + */ + public function setFieldValue ($fieldId, $context, $itemId, $value) + { + $db = $this->_db; + $field = $this->getItem($fieldId); + $params = $field->params; + if (is_array($params)) + { + $params = new Registry($params); + } + + // Don't save the value when the field is disabled or the user is + // not authorized to change it + if (! $field || $params->get('disabled', 0) || ! JFactory::getUser()->authorise('edit.value', $context . '.field.' . (int) $field->id)) + { + return false; + } + + $needsDelete = false; + $needsInsert = false; + $needsUpdate = false; + if ($field->default_value == $value) + { + $needsDelete = true; + } + else + { + $oldValue = $this->getFieldValue($fieldId, $context, $itemId); + $value = (array) $value; + + if ($oldValue === null) + { + // No records available, doing normal insert + $needsInsert = true; + } + else if (count($value) == 1 && count((array) $oldValue) == 1) + { + // Only a one row value, update can be done + $needsUpdate = true; + } + else + { + // Multiple values, we need to purge the data and doing a new + // insert + $needsDelete = true; + $needsInsert = true; + } + } + + if ($needsDelete) + { + // Deleting the existing record as it is a reset + $query = 'delete from #__fields_values where '; + $query .= 'field_id =' . (int) $fieldId . ' and context = ' . $db->q($context) . ' and item_id = ' . $db->q($itemId); + + $db->setQuery($query); + $db->query(); + } + if ($needsInsert) + { + $query = 'insert into #__fields_values (field_id, context, item_id, value) values '; + + foreach ($value as $v) + { + $query .= '(' . (int) $fieldId . ', ' . $db->q($context) . ', ' . $db->q($itemId) . ', ' . $db->q($v) . '),'; + } + $query = trim($query, ','); + + $db->setQuery($query); + $db->query(); + } + if ($needsUpdate) + { + $query = 'update #__fields_values set value = ' . $db->q(reset($value)) . ' where '; + $query .= 'field_id =' . (int) $fieldId . ' and context = ' . $db->q($context) . ' and item_id = ' . $db->q($itemId); + + $db->setQuery($query); + $db->query(); + } + $this->valueCache = array(); + + return true; + } + + /** + * Cleaning up the values for the given item on the context. + * + * @param string $context + * @param string $itemId + */ + public function cleanupValues ($context, $itemId) + { + $db = $this->_db; + $db->setQuery('delete from #__fields_values where context = ' . $db->q($context) . ' and item_id = ' . $db->q($itemId)); + $db->query(); + } + + protected function batchTag ($value, $pks, $contexts) + { + // Set the variables + $user = JFactory::getUser(); + $table = $this->getTable(); + + foreach ($pks as $pk) + { + if ($user->authorise('core.edit', $contexts[$pk])) + { + $table->reset(); + $table->load($pk); + $tags = array( + $value + ); + + /** + * + * @var JTableObserverTags $tagsObserver + */ + $tagsObserver = $table->getObserverOfClass('JTableObserverTags'); + $result = $tagsObserver->setNewTags($tags, false); + + if (! $result) + { + $this->setError($table->getError()); + + return false; + } + } + else + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + protected function cleanCache ($group = null, $client_id = 0) + { + $context = JFactory::getApplication()->input->get('context'); + + switch ($context) + { + case 'com_content': + parent::cleanCache('com_content'); + parent::cleanCache('mod_articles_archive'); + parent::cleanCache('mod_articles_categories'); + parent::cleanCache('mod_articles_category'); + parent::cleanCache('mod_articles_latest'); + parent::cleanCache('mod_articles_news'); + parent::cleanCache('mod_articles_popular'); + break; + default: + parent::cleanCache($context); + break; + } + } + + protected function generateNewTitle ($category_id, $alias, $title) + { + // Alter the title & alias + $table = $this->getTable(); + + while ($table->load(array( + 'alias' => $alias + ))) + { + $title = JString::increment($title); + $alias = JString::increment($alias, 'dash'); + } + + return array( + $title, + $alias + ); + } + + private function loadTypeForms (JForm &$form, $type, $component) + { + // Loading type specific forms + $paths = array( + JPath::clean(JPATH_ADMINISTRATOR . '/components/com_fields/models/types/forms/' . $type . '.xml') + ); + if ($component) + { + $paths[] = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/models/types/forms/' . $type . '.xml'); + } + + foreach ($paths as $path) + { + if (file_exists($path)) + { + // Load all children that's why we need to define the xpath + if (! $form->loadFile($path, true, '/form/*')) + { + throw new Exception(JText::_('JERROR_LOADFILE_FAILED')); + } + } + } + } +} diff --git a/administrator/components/com_fields/models/fields.php b/administrator/components/com_fields/models/fields.php new file mode 100644 index 0000000000000..587ff3da8b4c4 --- /dev/null +++ b/administrator/components/com_fields/models/fields.php @@ -0,0 +1,301 @@ +context; + + $context = $app->getUserStateFromRequest('com_fields.fields.filter.context', 'context', 'com_content.article', 'cmd'); + + $this->setState('filter.context', $context); + $parts = explode('.', $context); + + // Extract the component name + $this->setState('filter.component', $parts[0]); + + // Extract the optional section name + $this->setState('filter.section', (count($parts) > 1) ? $parts[1] : null); + + $search = $this->getUserStateFromRequest($context . '.search', 'filter_search'); + $this->setState('filter.search', $search); + + $level = $this->getUserStateFromRequest($context . '.filter.level', 'filter_level'); + $this->setState('filter.level', $level); + + $access = $this->getUserStateFromRequest($context . '.filter.access', 'filter_access'); + $this->setState('filter.access', $access); + + $published = $this->getUserStateFromRequest($context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $language = $this->getUserStateFromRequest($context . '.filter.language', 'filter_language', ''); + $this->setState('filter.language', $language); + + $tag = $this->getUserStateFromRequest($this->context . '.filter.tag', 'filter_tag', ''); + $this->setState('filter.tag', $tag); + + // List state information. + parent::populateState('a.ordering', 'asc'); + + // Force a language + $forcedLanguage = $app->input->get('forcedLanguage'); + + if (! empty($forcedLanguage)) + { + $this->setState('filter.language', $forcedLanguage); + $this->setState('filter.forcedLanguage', $forcedLanguage); + } + } + + protected function getStoreId ($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.context'); + $id .= ':' . serialize($this->getState('filter.assigned_cat_ids')); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.language'); + + return parent::getStoreId($id); + } + + protected function getListQuery () + { + // Create a new query object. + $db = $this->getDbo(); + $query = $db->getQuery(true); + $user = JFactory::getUser(); + + // Select the required fields from the table. + $query->select($this->getState('list.select', 'a.*')); + $query->from('#__fields AS a'); + + // Join over the language + $query->select('l.title AS language_title')->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language'); + + // Join over the users for the checked out user. + $query->select('uc.name AS editor')->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); + + // Join over the asset groups. + $query->select('ag.title AS access_level')->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + + // Join over the users for the author. + $query->select('ua.name AS author_name')->join('LEFT', '#__users AS ua ON ua.id = a.created_user_id'); + + // Join over the categories. + $query->select('c.title as category_title')->join('LEFT', '#__categories AS c ON c.id = a.catid'); + + // Filter by context + if ($context = $this->getState('filter.context')) + { + $query->where('a.context = ' . $db->quote($context)); + } + + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + if (is_array($access)) + { + JArrayHelper::toInteger($access); + $query->where('a.access in (' . implode(',', $access) . ')'); + } + else + { + $query->where('a.access = ' . (int) $access); + } + } + if (($categories = $this->getState('filter.assigned_cat_ids')) && $context) + { + $categories = (array) $categories; + $condition = "a.assigned_cat_ids = '' or find_in_set(0, a.assigned_cat_ids) "; + $parts = FieldsHelper::extract($context); + if ($parts) + { + // Get the category + $cat = JCategories::getInstance(str_replace('com_', '', $parts[0])); + if ($cat) + { + foreach ($categories as $assignedCatIds) + { + // Check if we have the actual category + $parent = $cat->get($assignedCatIds); + if ($parent) + { + $condition .= 'or find_in_set(' . (int) $parent->id . ',a.assigned_cat_ids) '; + + // Traverse the tree up to get all the fields which + // are attached to a parent + while ($parent->getParent() && $parent->getParent()->id != 'root') + { + $parent = $parent->getParent(); + $condition .= 'or find_in_set(' . (int) $parent->id . ',a.assigned_cat_ids) '; + } + } + } + } + } + $query->where('(' . $condition . ')'); + } + + // Implement View Level Access + if (! $user->authorise('core.admin')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Filter by published state + $published = $this->getState('filter.published'); + + if (is_numeric($published)) + { + $query->where('a.state = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.state IN (0, 1))'); + } + + // Filter by search in title + $search = $this->getState('filter.search'); + + if (! empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + elseif (stripos($search, 'author:') === 0) + { + $search = $db->quote('%' . $db->escape(substr($search, 7), true) . '%'); + $query->where('(ua.name LIKE ' . $search . ' OR ua.username LIKE ' . $search . ')'); + } + else + { + $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); + $query->where('(a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search . ' OR a.note LIKE ' . $search . ')'); + } + } + + // Filter on the language. + if ($language = $this->getState('filter.language')) + { + $query->where('a.language in (' . $db->quote($language) . ',' . $db->quote('*') . ')'); + } + + // Filter by a single tag. + $tagId = $this->getState('filter.tag'); + + if (is_numeric($tagId)) + { + $query->where($db->quoteName('tagmap.tag_id') . ' = ' . (int) $tagId) + ->join('LEFT', + $db->quoteName('#__contentitem_tag_map', 'tagmap') . ' ON ' . $db->quoteName('tagmap.content_item_id') . ' = ' . + $db->quoteName('a.id') . ' AND ' . $db->quoteName('tagmap.type_alias') . ' = ' . $db->quote($context . '.field')); + } + + // Add the list ordering clause + $listOrdering = $this->getState('list.ordering', 'a.ordering'); + $listDirn = $db->escape($this->getState('list.direction', 'ASC')); + + if ($listOrdering == 'a.access') + { + $query->order('a.access ' . $listDirn); + } + else + { + $query->order($db->escape($listOrdering) . ' ' . $listDirn); + } + + // Echo nl2br(str_replace('#__', 'j_', $query)); //die(); + return $query; + } + + protected function _getList ($query, $limitstart = 0, $limit = 0) + { + $result = parent::_getList($query, $limitstart, $limit); + + if (is_array($result)) + { + foreach ($result as $field) + { + $field->fieldparams = new Registry($field->fieldparams); + $field->params = new Registry($field->params); + } + } + + return $result; + } + + public function getFilterForm ($data = array(), $loadData = true) + { + $form = parent::getFilterForm($data, $loadData); + if ($form) + { + $path = JPATH_ADMINISTRATOR . '/components/' . $this->getState('filter.component') . '/models/forms/filter_fields.xml'; + if (file_exists($path)) + { + // Load all children that's why we need to define the xpath + if (! $form->loadFile($path, true, '/form/*')) + { + throw new Exception(JText::_('JERROR_LOADFILE_FAILED')); + } + } + + // If the context has multiple sections, this is the input field + // to display them + $form->setValue('section', 'custom', JFactory::getApplication()->input->getCmd('context')); + } + return $form; + } +} diff --git a/administrator/components/com_fields/models/fields/dprules.php b/administrator/components/com_fields/models/fields/dprules.php new file mode 100644 index 0000000000000..7f91014f3c1b4 --- /dev/null +++ b/administrator/components/com_fields/models/fields/dprules.php @@ -0,0 +1,405 @@ +$name; + } + + return parent::__get($name); + } + + /** + * Method to set certain otherwise inaccessible properties of the form field object. + * + * @param string $name The property name for which to the the value. + * @param mixed $value The value of the property. + * + * @return void + * + * @since 3.2 + */ + public function __set($name, $value) + { + switch ($name) + { + case 'section': + case 'component': + case 'assetField': + $this->$name = (string) $value; + break; + + default: + parent::__set($name, $value); + } + } + + /** + * Method to attach a JForm object to the field. + * + * @param SimpleXMLElement $element The SimpleXMLElement object representing the tag for the form field object. + * @param mixed $value The form field value to validate. + * @param string $group The field name group control value. This acts as as an array container for the field. + * For example if the field has name="foo" and the group value is set to "bar" then the + * full field name would end up being "bar[foo]". + * + * @return boolean True on success. + * + * @see JFormField::setup() + * @since 3.2 + */ + public function setup(SimpleXMLElement $element, $value, $group = null) + { + $return = parent::setup($element, $value, $group); + + if ($return) + { + $this->section = $this->element['section'] ? (string) $this->element['section'] : ''; + $this->component = $this->element['component'] ? (string) $this->element['component'] : ''; + $this->assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id'; + } + + return $return; + } + + /** + * Method to get the field input markup for Access Control Lists. + * Optionally can be associated with a specific component and section. + * + * @return string The field input markup. + * + * @since 11.1 + * @todo: Add access check. + */ + protected function getInput() + { + JHtml::_('bootstrap.tooltip'); + + // Initialise some field attributes. + $section = $this->section; + $component = $this->component; + $assetField = $this->assetField; + + // Get the actions for the asset. + $actions = JAccess::getActions($component, $section); + + // Iterate over the children and add to the actions. + foreach ($this->element->children() as $el) + { + if ($el->getName() == 'action') + { + $actions[] = (object) array('name' => (string) $el['name'], 'title' => (string) $el['title'], + 'description' => (string) $el['description']); + } + } + + // Get the explicit rules for this asset. + if ($section == 'component') + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $assetId = (int) $db->loadResult(); + } + else + { + // Find the asset id of the content. + // Note that for global configuration, com_config injects asset_id = 1 into the form. + $assetId = $this->form->getValue($assetField); + } + + // Full width format. + + // Get the rules for just this asset (non-recursive). + $assetRules = JAccess::getAssetRules($assetId); + + // Get the available user groups. + $groups = $this->getUserGroups(); + + // Prepare output + $html = array(); + + // Description + $html[] = '

' . JText::_('JLIB_RULES_SETTINGS_DESC') . '

'; + + // Begin tabs + $html[] = '
'; + + // Building tab nav + $html[] = ''; + + $html[] = '
'; + + // Start a row for each user group. + foreach ($groups as $group) + { + // Initial Active Pane + $active = ""; + + if ($group->value == 1) + { + $active = " active"; + } + + $html[] = '
'; + $html[] = ''; + $html[] = ''; + $html[] = ''; + + $html[] = ''; + + $html[] = ''; + + // The calculated setting is not shown for the root group of global configuration. + $canCalculateSettings = ($group->parent_id || !empty($component)); + + if ($canCalculateSettings) + { + $html[] = ''; + } + + $html[] = ''; + $html[] = ''; + $html[] = ''; + + foreach ($actions as $action) + { + $html[] = ''; + $html[] = ''; + + $html[] = ''; + + // Build the Calculated Settings column. + // The inherited settings column is not displayed for the root group in global configuration. + if ($canCalculateSettings) + { + $html[] = ''; + } + + $html[] = ''; + } + + $html[] = ''; + $html[] = '
'; + $html[] = '' . JText::_('JLIB_RULES_ACTION') . ''; + $html[] = ''; + $html[] = '' . JText::_('JLIB_RULES_SELECT_SETTING') . ''; + $html[] = ''; + $html[] = '' . JText::_('JLIB_RULES_CALCULATED_SETTING') . ''; + $html[] = '
'; + $html[] = ''; + $html[] = ''; + + $html[] = '  '; + + // If this asset's rule is allowed, but the inherited rule is deny, we have a conflict. + if (($assetRule === true) && ($inheritedRule === false)) + { + $html[] = JText::_('JLIB_RULES_CONFLICT'); + } + + $html[] = ''; + + // This is where we show the current effective settings considering currrent group, path and cascade. + // Check whether this is a component or global. Change the text slightly. + + if (JAccess::checkGroup($group->value, 'core.admin', $assetId) !== true) + { + if ($inheritedRule === null) + { + $html[] = '' . JText::_('JLIB_RULES_NOT_ALLOWED') . ''; + } + elseif ($inheritedRule === true) + { + $html[] = '' . JText::_('JLIB_RULES_ALLOWED') . ''; + } + elseif ($inheritedRule === false) + { + if ($assetRule === false) + { + $html[] = '' . JText::_('JLIB_RULES_NOT_ALLOWED') . ''; + } + else + { + $html[] = ' ' . JText::_('JLIB_RULES_NOT_ALLOWED_LOCKED') + . ''; + } + } + } + elseif (!empty($component)) + { + $html[] = ' ' . JText::_('JLIB_RULES_ALLOWED_ADMIN') + . ''; + } + else + { + // Special handling for groups that have global admin because they can't be denied. + // The admin rights can be changed. + if ($action->name === 'core.admin') + { + $html[] = '' . JText::_('JLIB_RULES_ALLOWED') . ''; + } + elseif ($inheritedRule === false) + { + // Other actions cannot be changed. + $html[] = ' ' + . JText::_('JLIB_RULES_NOT_ALLOWED_ADMIN_CONFLICT') . ''; + } + else + { + $html[] = ' ' . JText::_('JLIB_RULES_ALLOWED_ADMIN') + . ''; + } + } + + $html[] = '
'; + } + + $html[] = '
'; + + $html[] = '
'; + + if ($section == 'component' || $section == null) + { + $html[] = JText::_('JLIB_RULES_SETTING_NOTES'); + } + else + { + $html[] = JText::_('JLIB_RULES_SETTING_NOTES_ITEM'); + } + + $html[] = '
'; + + return implode("\n", $html); + } + + /** + * Get a list of the user groups. + * + * @return array + * + * @since 11.1 + */ + protected function getUserGroups() + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level, a.parent_id') + ->from('#__usergroups AS a') + ->join('LEFT', $db->quoteName('#__usergroups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt') + ->group('a.id, a.title, a.lft, a.rgt, a.parent_id') + ->order('a.lft ASC'); + $db->setQuery($query); + $options = $db->loadObjectList(); + + return $options; + } +} diff --git a/administrator/components/com_fields/models/fields/modal/field.php b/administrator/components/com_fields/models/fields/modal/field.php new file mode 100644 index 0000000000000..92a7d3171bce0 --- /dev/null +++ b/administrator/components/com_fields/models/fields/modal/field.php @@ -0,0 +1,168 @@ +element['context']) + { + $context = (string) $this->element['context']; + } + else + { + $context = (string) JFactory::getApplication()->input->get('context', 'com_content'); + } + + $allowEdit = ((string) $this->element['edit'] == 'true') ? true : false; + $allowClear = ((string) $this->element['clear'] != 'false') ? true : false; + + // Load language + JFactory::getLanguage()->load('com_fields', JPATH_ADMINISTRATOR); + + // Build the script. + $script = array(); + + // Select button script + $script[] = ' function jSelectCategory_' . $this->id . '(id, title, object) {'; + $script[] = ' document.getElementById("' . $this->id . '_id").value = id;'; + $script[] = ' document.getElementById("' . $this->id . '_name").value = title;'; + + if ($allowEdit) + { + $script[] = ' jQuery("#' . $this->id . '_edit").removeClass("hidden");'; + } + + if ($allowClear) + { + $script[] = ' jQuery("#' . $this->id . '_clear").removeClass("hidden");'; + } + + $script[] = ' jQuery("#modalCategory-' . $this->id . '").modal("hide");'; + $script[] = ' }'; + + // Clear button script + static $scriptClear; + + if ($allowClear && ! $scriptClear) + { + $scriptClear = true; + + $script[] = ' function jClearCategory(id) {'; + $script[] = ' document.getElementById(id + "_id").value = "";'; + $script[] = ' document.getElementById(id + "_name").value = "' . + htmlspecialchars(JText::_('COM_FIELDS_SELECT_A_FIELD', true), ENT_COMPAT, 'UTF-8') . '";'; + $script[] = ' jQuery("#"+id + "_clear").addClass("hidden");'; + $script[] = ' if (document.getElementById(id + "_edit")) {'; + $script[] = ' jQuery("#"+id + "_edit").addClass("hidden");'; + $script[] = ' }'; + $script[] = ' return false;'; + $script[] = ' }'; + } + + // Add the script to the document head. + JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); + + // Setup variables for display. + $html = array(); + $link = 'index.php?option=com_fields&view=fields&layout=modal&tmpl=component&context=' . $context . + '&function=jSelectCategory_' . $this->id; + + if (isset($this->element['language'])) + { + $link .= '&forcedLanguage=' . $this->element['language']; + } + + if ((int) $this->value > 0) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('title')) + ->from($db->quoteName('#__fields')) + ->where($db->quoteName('id') . ' = ' . (int) $this->value); + $db->setQuery($query); + + try + { + $title = $db->loadResult(); + } + catch (RuntimeException $e) + { + JError::raiseWarning(500, $e->getMessage()); + } + } + + if (empty($title)) + { + $title = JText::_('COM_FIELDS_SELECT_A_FIELD'); + } + + $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); + + // The active field id field. + if (0 == (int) $this->value) + { + $value = ''; + } + else + { + $value = (int) $this->value; + } + + // The current field display field. + $html[] = ''; + $html[] = ''; + $html[] = '' . ' ' . JText::_('JSELECT') . ''; + + // Edit field button + if ($allowEdit) + { + $html[] = '' . '' . JText::_('JACTION_EDIT') . + ''; + + $html[] = JHtml::_('bootstrap.renderModal', 'modalCategory-' . $this->id, + array( + 'url' => $link . '&' . JSession::getFormToken() . '=1"', + 'title' => JText::_('COM_FIELDS_SELECT_A_FIELD'), + 'width' => '800px', + 'height' => '300px', + 'footer' => '' + )); + } + + // Clear field button + if ($allowClear) + { + $html[] = '' . '' . JText::_('JCLEAR') . + ''; + } + + $html[] = ''; + + // Note: class='required' for client side validation + $class = ''; + + if ($this->required) + { + $class = ' class="required modal-value"'; + } + + $html[] = ''; + + return implode("\n", $html); + } +} diff --git a/administrator/components/com_fields/models/fields/section.php b/administrator/components/com_fields/models/fields/section.php new file mode 100644 index 0000000000000..8592b2537eabd --- /dev/null +++ b/administrator/components/com_fields/models/fields/section.php @@ -0,0 +1,66 @@ +getVar('extension'); + + if ($extension) + { + $options[] = JHtml::_('select.option', $extension . '.category', JText::_('JCategory')); + } + } + + return $options; + } + + public function setup (SimpleXMLElement $element, $value, $group = null) + { + $return = parent::setup($element, $value, $group); + + // On change must always be the change context function + $this->onchange = 'fieldsChangeContext(jQuery(this).val());'; + + return $return; + } + + protected function getInput () + { + // Add the change context function to the document + JFactory::getDocument()->addScriptDeclaration( + "function fieldsChangeContext(context) +{ + var regex = new RegExp(\"([?;&])context[^&;]*[;&]?\"); + var url = window.location.href; + var query = url.replace(regex, \"$1\").replace(/&$/, ''); + + window.location.href = (query.length > 2 ? query + \"&\" : \"?\") + (context ? \"context=\" + context : ''); +}"); + + return parent::getInput(); + } +} diff --git a/administrator/components/com_fields/models/fields/type.php b/administrator/components/com_fields/models/fields/type.php new file mode 100644 index 0000000000000..219e1aa957637 --- /dev/null +++ b/administrator/components/com_fields/models/fields/type.php @@ -0,0 +1,56 @@ +element['component']) + { + $paths[] = JPATH_ADMINISTRATOR . '/components/' . $this->element['component'] . '/models/types'; + } + + foreach ($paths as $path) + { + if (! JFolder::exists($path)) + { + continue; + } + // Looping trough the types + foreach (JFolder::files($path, 'php', false, true) as $filePath) + { + $name = str_replace('.php', '', basename($filePath)); + if ($name == 'base') + { + continue; + } + + $label = 'COM_FIELDS_TYPE_' . strtoupper($name); + if (! JFactory::getLanguage()->hasKey($label)) + { + $label = JString::ucfirst($name); + } + $options[] = JHtml::_('select.option', $name, JText::_($label)); + } + } + + return $options; + } +} diff --git a/administrator/components/com_fields/models/forms/field.xml b/administrator/components/com_fields/models/forms/field.xml new file mode 100644 index 0000000000000..548391a5974a4 --- /dev/null +++ b/administrator/components/com_fields/models/forms/field.xml @@ -0,0 +1,140 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ diff --git a/administrator/components/com_fields/models/forms/filter_fields.xml b/administrator/components/com_fields/models/forms/filter_fields.xml new file mode 100644 index 0000000000000..ab5b894b7e1eb --- /dev/null +++ b/administrator/components/com_fields/models/forms/filter_fields.xml @@ -0,0 +1,50 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/administrator/components/com_fields/models/types/base.php b/administrator/components/com_fields/models/types/base.php new file mode 100644 index 0000000000000..0359cd5bb2214 --- /dev/null +++ b/administrator/components/com_fields/models/types/base.php @@ -0,0 +1,91 @@ +params->get('show_on') == 1 && $app->isAdmin()) + { + return; + } + else if ($field->params->get('show_on') == 2 && $app->isSite()) + { + return; + } + $node = $parent->appendChild(new DOMElement('field')); + + $node->setAttribute('name', $field->alias); + $node->setAttribute('type', $field->type); + $node->setAttribute('default', $field->default_value); + $node->setAttribute('label', $field->label); + $node->setAttribute('description', $field->description); + $node->setAttribute('class', $field->class); + $node->setAttribute('required', $field->required ? 'true' : 'false'); + $node->setAttribute('readonly', $field->params->get('readonly', 0) ? 'true' : 'false'); + + // Set the disabled state based on the parameter and the permission + $authorizedToEdit = JFactory::getUser()->authorise('edit.value', $field->context . '.field.' . (int) $field->id); + if ($field->params->get('disabled', 0) || ! $authorizedToEdit) + { + $node->setAttribute('disabled', 'true'); + } + + foreach ($field->fieldparams->toArray() as $key => $param) + { + if (is_array($param)) + { + $param = implode(',', $param); + } + $node->setAttribute($key, $param); + } + $this->postProcessDomNode($field, $node, $form); + + return $node; + } + + /** + * Prepares the given value to be ready to be displayed in a HTML context. + * + * @param stdClass $field + * @param mixed $value + * @return string + * + * @deprecated is replaced trough layouts + */ + public function prepareValueForDisplay ($value, $field) + { + return null; + } + + /** + * Function to manipulate the DOM node before it is returned to the form + * document. + * The form can be manipulated during preparation of the dom node. + * + * @param stdClass $field + * @param DOMElement $fieldNode + * @param JForm $form + */ + protected function postProcessDomNode ($field, DOMElement $fieldNode, JForm $form) + { + } +} \ No newline at end of file diff --git a/administrator/components/com_fields/models/types/calendar.php b/administrator/components/com_fields/models/types/calendar.php new file mode 100644 index 0000000000000..241badef13979 --- /dev/null +++ b/administrator/components/com_fields/models/types/calendar.php @@ -0,0 +1,14 @@ +input; + if (JFactory::getApplication()->isAdmin()) + { + $fieldNode->setAttribute('plugin', JFactory::getConfig()->get('captcha')); + } + else if ($input->get('option') == 'com_users' && $input->get('view') == 'profile' && $input->get('layout') != 'edit' && + $input->get('task') != 'save') + { + // The user profile page does show the values by creating the form + // and getting the values from it so we need to disable the field + $fieldNode->setAttribute('plugin', null); + } + $fieldNode->setAttribute('validate', 'captcha'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } +} diff --git a/administrator/components/com_fields/models/types/checkboxes.php b/administrator/components/com_fields/models/types/checkboxes.php new file mode 100644 index 0000000000000..4b8069e77866f --- /dev/null +++ b/administrator/components/com_fields/models/types/checkboxes.php @@ -0,0 +1,14 @@ +setAttribute('buttons', $field->fieldparams->get('buttons', 0) ? 'true' : 'false'); + $fieldNode->setAttribute('filter', 'JComponentHelper::filterText'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } +} diff --git a/administrator/components/com_fields/models/types/email.php b/administrator/components/com_fields/models/types/email.php new file mode 100644 index 0000000000000..ba2fb574e29cb --- /dev/null +++ b/administrator/components/com_fields/models/types/email.php @@ -0,0 +1,21 @@ +setAttribute('validate', 'email'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } +} diff --git a/administrator/components/com_fields/models/types/fields/gallery.php b/administrator/components/com_fields/models/types/fields/gallery.php new file mode 100644 index 0000000000000..28bfbddf5c85d --- /dev/null +++ b/administrator/components/com_fields/models/types/fields/gallery.php @@ -0,0 +1,53 @@ +required) + { + $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); + } + + $path = (string) $this->element['directory']; + + if (! is_dir($path)) + { + $path = JPATH_ROOT . '/' . $path; + } + + // Get a list of folders in the search path with the given filter. + $folders = JFolder::folders($path, '.', true, true); + + // Build the options list from the list of folders. + if (is_array($folders)) + { + foreach ($folders as $folder) + { + $relativePath = str_replace($path . '/', '', $folder); + + $options[] = JHtml::_('select.option', $relativePath, $relativePath); + } + } + + // Merge any additional options in the XML definition. + $options = array_merge(parent::getOptions(), $options); + + return $options; + } +} diff --git a/administrator/components/com_fields/models/types/forms/calendar.xml b/administrator/components/com_fields/models/types/forms/calendar.xml new file mode 100644 index 0000000000000..ccf8248e2bdef --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/calendar.xml @@ -0,0 +1,10 @@ + +
+ +
+ +
+
+
diff --git a/administrator/components/com_fields/models/types/forms/checkboxes.xml b/administrator/components/com_fields/models/types/forms/checkboxes.xml new file mode 100644 index 0000000000000..e1b4148951b73 --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/checkboxes.xml @@ -0,0 +1,19 @@ + +
+ +
+ + + +
+
+
diff --git a/administrator/components/com_fields/models/types/forms/editor.xml b/administrator/components/com_fields/models/types/forms/editor.xml new file mode 100644 index 0000000000000..e094aa65028a2 --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/editor.xml @@ -0,0 +1,29 @@ + +
+ +
+ + + + + + + + + + +
+
+
diff --git a/administrator/components/com_fields/models/types/forms/gallery.xml b/administrator/components/com_fields/models/types/forms/gallery.xml new file mode 100644 index 0000000000000..a730baa64e44f --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/gallery.xml @@ -0,0 +1,28 @@ + +
+ +
+ + + + + + + + + + + +
+
+
diff --git a/administrator/components/com_fields/models/types/forms/imagelist.xml b/administrator/components/com_fields/models/types/forms/imagelist.xml new file mode 100644 index 0000000000000..a5ab19c71b729 --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/imagelist.xml @@ -0,0 +1,18 @@ + +
+ +
+ + + + + + +
+
+
diff --git a/administrator/components/com_fields/models/types/forms/integer.xml b/administrator/components/com_fields/models/types/forms/integer.xml new file mode 100644 index 0000000000000..fe0aee0f4d555 --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/integer.xml @@ -0,0 +1,21 @@ + +
+ +
+ + + + + + + +
+
+
diff --git a/administrator/components/com_fields/models/types/forms/list.xml b/administrator/components/com_fields/models/types/forms/list.xml new file mode 100644 index 0000000000000..cda220cd3d489 --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/list.xml @@ -0,0 +1,25 @@ + +
+ +
+ + + + + + + + +
+
+
diff --git a/administrator/components/com_fields/models/types/forms/media.xml b/administrator/components/com_fields/models/types/forms/media.xml new file mode 100644 index 0000000000000..f50219faf0b13 --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/media.xml @@ -0,0 +1,19 @@ + +
+ +
+ + + + + + + +
+
+
diff --git a/administrator/components/com_fields/models/types/forms/radio.xml b/administrator/components/com_fields/models/types/forms/radio.xml new file mode 100644 index 0000000000000..14a12db511b10 --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/radio.xml @@ -0,0 +1,22 @@ + +
+ + +
+ + + +
+
+ diff --git a/administrator/components/com_fields/models/types/forms/sql.xml b/administrator/components/com_fields/models/types/forms/sql.xml new file mode 100644 index 0000000000000..3d6673163d669 --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/sql.xml @@ -0,0 +1,16 @@ + +
+ +
+ + + + + +
+
+
diff --git a/administrator/components/com_fields/models/types/forms/textarea.xml b/administrator/components/com_fields/models/types/forms/textarea.xml new file mode 100644 index 0000000000000..222c96a2f70af --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/textarea.xml @@ -0,0 +1,13 @@ + +
+ +
+ + +
+
+
diff --git a/administrator/components/com_fields/models/types/forms/url.xml b/administrator/components/com_fields/models/types/forms/url.xml new file mode 100644 index 0000000000000..f3e29dd1ceeb4 --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/url.xml @@ -0,0 +1,22 @@ + +
+ +
+ + + + + + + + + + + + + +
+
+
diff --git a/administrator/components/com_fields/models/types/forms/user.xml b/administrator/components/com_fields/models/types/forms/user.xml new file mode 100644 index 0000000000000..9c4a3b4a724bc --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/user.xml @@ -0,0 +1,12 @@ + +
+ +
+ + + + +
+
+
diff --git a/administrator/components/com_fields/models/types/forms/usergrouplist.xml b/administrator/components/com_fields/models/types/forms/usergrouplist.xml new file mode 100644 index 0000000000000..9c4a3b4a724bc --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/usergrouplist.xml @@ -0,0 +1,12 @@ + +
+ +
+ + + + +
+
+
diff --git a/administrator/components/com_fields/models/types/forms/yesno.xml b/administrator/components/com_fields/models/types/forms/yesno.xml new file mode 100644 index 0000000000000..0e471729ccb6a --- /dev/null +++ b/administrator/components/com_fields/models/types/forms/yesno.xml @@ -0,0 +1,9 @@ + +
+ + + diff --git a/administrator/components/com_fields/models/types/gallery.php b/administrator/components/com_fields/models/types/gallery.php new file mode 100644 index 0000000000000..46bee20d90a16 --- /dev/null +++ b/administrator/components/com_fields/models/types/gallery.php @@ -0,0 +1,22 @@ +setAttribute('type', 'gallery'); + $fieldNode->setAttribute('hide_default', 'true'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } +} diff --git a/administrator/components/com_fields/models/types/imagelist.php b/administrator/components/com_fields/models/types/imagelist.php new file mode 100644 index 0000000000000..a313574bc4934 --- /dev/null +++ b/administrator/components/com_fields/models/types/imagelist.php @@ -0,0 +1,21 @@ +setAttribute('hide_default', 'true'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } +} diff --git a/administrator/components/com_fields/models/types/integer.php b/administrator/components/com_fields/models/types/integer.php new file mode 100644 index 0000000000000..2844ad9e392a9 --- /dev/null +++ b/administrator/components/com_fields/models/types/integer.php @@ -0,0 +1,14 @@ +fieldparams->get('options', array()); + if (! is_array($options)) + { + $options = json_decode($options); + } + $data = array(); + if (isset($options->key)) + { + foreach ($options->key as $index => $key) + { + $data[$key] = $options->value[$index]; + } + } + return $data; + } + + protected function postProcessDomNode ($field, DOMElement $fieldNode, JForm $form) + { + foreach ($this->getOptions($field) as $index => $value) + { + $element = $fieldNode->appendChild(new DOMElement('option', $value)); + $element->setAttribute('value', $index); + } + + return parent::postProcessDomNode($field, $fieldNode, $form); + } +} diff --git a/administrator/components/com_fields/models/types/media.php b/administrator/components/com_fields/models/types/media.php new file mode 100644 index 0000000000000..1969cf5c5a006 --- /dev/null +++ b/administrator/components/com_fields/models/types/media.php @@ -0,0 +1,21 @@ +setAttribute('hide_default', 'true'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } +} diff --git a/administrator/components/com_fields/models/types/modal_article.php b/administrator/components/com_fields/models/types/modal_article.php new file mode 100644 index 0000000000000..feef086f5716c --- /dev/null +++ b/administrator/components/com_fields/models/types/modal_article.php @@ -0,0 +1,19 @@ +addFieldPath(JPATH_ADMINISTRATOR . '/components/com_content/models/fields'); + } +} diff --git a/administrator/components/com_fields/models/types/radio.php b/administrator/components/com_fields/models/types/radio.php new file mode 100644 index 0000000000000..c4e834ab29e5e --- /dev/null +++ b/administrator/components/com_fields/models/types/radio.php @@ -0,0 +1,14 @@ +setAttribute('value_field', 'text'); + $fieldNode->setAttribute('key_field', 'value'); + + if (! $fieldNode->getAttribute('query')) + { + $fieldNode->setAttribute('query', 'select id as value, name as text from #__users'); + } + + return parent::postProcessDomNode($field, $fieldNode, $form); + } +} diff --git a/administrator/components/com_fields/models/types/tel.php b/administrator/components/com_fields/models/types/tel.php new file mode 100644 index 0000000000000..0d99ee9ea6c2b --- /dev/null +++ b/administrator/components/com_fields/models/types/tel.php @@ -0,0 +1,21 @@ +setAttribute('validate', 'tel'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } +} diff --git a/administrator/components/com_fields/models/types/text.php b/administrator/components/com_fields/models/types/text.php new file mode 100644 index 0000000000000..51d6a24999ff1 --- /dev/null +++ b/administrator/components/com_fields/models/types/text.php @@ -0,0 +1,14 @@ +setAttribute('filter', 'JComponentHelper::filterText'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } +} diff --git a/administrator/components/com_fields/models/types/timezone.php b/administrator/components/com_fields/models/types/timezone.php new file mode 100644 index 0000000000000..f05c36c86f614 --- /dev/null +++ b/administrator/components/com_fields/models/types/timezone.php @@ -0,0 +1,14 @@ +setAttribute('validate', 'url'); + if (! $fieldNode->getAttribute('relative')) + { + $fieldNode->removeAttribute('relative'); + } + + return parent::postProcessDomNode($field, $fieldNode, $form); + } +} diff --git a/administrator/components/com_fields/models/types/user.php b/administrator/components/com_fields/models/types/user.php new file mode 100644 index 0000000000000..a0811522969da --- /dev/null +++ b/administrator/components/com_fields/models/types/user.php @@ -0,0 +1,14 @@ +setAttribute('type', 'radio'); + + // JFormField replaces invalid characters + $id = 'params_' . preg_replace('#\W#', '_', $fieldNode->getAttribute('name')); + + JFactory::getDocument()->addScriptDeclaration( + "jQuery( document ).ready(function() { + jQuery('#jform_" . $id . " input').bind('click', function(e) + { + jQuery('#jform_" . $id . " label').attr('class', 'btn'); + if (jQuery('#jform_" . $id . "0')[0].checked || (!jQuery('#jform_" . $id . "0')[0].checked && !jQuery('#jform_" . $id . "1')[0].checked)) + { + jQuery('#jform_" . $id . " label[for=\"jform_" . $id . "0\"]').attr('class', 'btn btn-success'); + } + else + { + jQuery('#jform_" . $id . " label[for=\"jform_" . $id . "1\"]').attr('class', 'btn btn-danger'); + } + }); + jQuery('#jform_" . $id . " label').attr('class', 'btn'); + if (jQuery('#jform_" . $id . "0')[0].checked || (!jQuery('#jform_" . $id . "0')[0].checked && !jQuery('#jform_" . $id . "1')[0].checked)) + { + jQuery('#jform_" . $id . " label[for=\"jform_" . $id . "0\"]').attr('class', 'btn btn-success'); + } + else + { + jQuery('#jform_" . $id . " label[for=\"jform_" . $id . "1\"]').attr('class', 'btn btn-danger'); + } +});"); + + return $return; + } + + public function getOptions ($field) + { + return array( + 1 => JText::_('JYES'), + 0 => JText::_('JNO') + ); + } +} diff --git a/administrator/components/com_fields/tables/field.php b/administrator/components/com_fields/tables/field.php new file mode 100644 index 0000000000000..fb257ac38f471 --- /dev/null +++ b/administrator/components/com_fields/tables/field.php @@ -0,0 +1,156 @@ +setColumnAlias('published', 'state'); + + JObserverMapper::addObserverClassToClass('JTableObserverTags', 'FieldsTableField', array( + 'typeAlias' => 'com_fields.field' + )); + JObserverMapper::addObserverClassToClass('JTableObserverContenthistory', 'FieldsTableField', + array( + 'typeAlias' => 'com_fields.field' + )); + } + + public function bind ($array, $ignore = '') + { + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new Registry(); + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + if (isset($array['fieldparams']) && is_array($array['fieldparams'])) + { + $registry = new Registry(); + $registry->loadArray($array['fieldparams']); + $array['fieldparams'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JRules($array['rules']); + $this->setRules($rules); + } + + return parent::bind($array, $ignore); + } + + public function check () + { + // Check for valid name + if (trim($this->title) == '') + { + $this->setError(JText::_('COM_FIELDS_LOCATION_ERR_TABLES_TITLE')); + return false; + } + + if (empty($this->alias)) + { + $this->alias = $this->title; + } + $this->alias = JApplication::stringURLSafe($this->alias); + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JString::increment($alias, 'dash'); + } + + $this->alias = str_replace(',', '-', $this->alias); + + if (empty($this->type)) + { + $this->type = 'text'; + } + + // Check the publish down date is not earlier than publish up. + if ($this->publish_down > $this->_db->getNullDate() && $this->publish_down < $this->publish_up) + { + $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH')); + return false; + } + if (is_array($this->assigned_cat_ids)) + { + $this->assigned_cat_ids = implode(',', $this->assigned_cat_ids); + } + + $date = JFactory::getDate(); + $user = JFactory::getUser(); + if ($this->id) + { + // Existing item + $this->modified_time = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + if (! (int) $this->created_time) + { + $this->created_time = $date->toSql(); + } + + if (empty($this->created_user_id)) + { + $this->created_user_id = $user->get('id'); + } + } + + return true; + } + + protected function _getAssetName () + { + $k = $this->_tbl_key; + return $this->context . '.field.' . (int) $this->$k; + } + + protected function _getAssetTitle () + { + return $this->title; + } + + protected function _getAssetParentId (JTable $table = null, $id = null) + { + $parts = FieldsHelper::extract($this->context); + $component = $parts ? $parts[0] : null; + + if ($component) + { + // Build the query to get the asset id for the parent category. + $query = $this->_db->getQuery(true) + ->select($this->_db->quoteName('id')) + ->from($this->_db->quoteName('#__assets')) + ->where($this->_db->quoteName('name') . ' = ' . $this->_db->quote($component)); + + // Get the asset id from the database. + $this->_db->setQuery($query); + + $assetId = null; + if ($result = $this->_db->loadResult()) + { + $assetId = (int) $result; + if ($assetId) + { + return $assetId; + } + } + } + + return parent::_getAssetParentId($table, $id); + } +} diff --git a/administrator/components/com_fields/views/field/tmpl/edit.php b/administrator/components/com_fields/views/field/tmpl/edit.php new file mode 100644 index 0000000000000..c75c73c7caaeb --- /dev/null +++ b/administrator/components/com_fields/views/field/tmpl/edit.php @@ -0,0 +1,120 @@ +input; + +JFactory::getDocument()->addScriptDeclaration(' + Joomla.submitbutton = function(task) + { + if (task == "field.cancel" || document.formvalidator.isValid(document.getElementById("item-form"))) + { + ' . $this->form->getField("description")->save() . ' + Joomla.submitform(task, document.getElementById("item-form")); + } + }; + jQuery(document).ready(function() { + jQuery("#jform_title").data("dp-old-value", jQuery("#jform_title").val()); + jQuery("#jform_title").change(function(data, handler) { + if(jQuery("#jform_title").data("dp-old-value") == jQuery("#jform_label").val()) { + jQuery("#jform_label").val(jQuery("#jform_title").val()); + } + + jQuery("#jform_title").data("dp-old-value", jQuery("#jform_title").val()); + }); + }); +'); + +?> + +
+ + + +
+ 'general')); ?> + + +
+
+ form->renderField('type'); + echo $this->form->renderField('label'); + echo $this->form->renderField('required'); + echo $this->form->renderField('default_value'); + echo $this->form->renderField('render_class'); + echo $this->form->renderField('class'); + + // rendering additional fields + foreach ($this->form->getFieldsets('fieldparams') as $name => $fieldSet) + { + foreach ($this->form->getFieldset($name) as $field) + { + echo $field->renderField(); + } + } + + echo $this->form->getLabel('description'); + echo $this->form->getInput('description'); + ?> +
+
+ set('fields', array( + array('published', 'state', 'enabled'), + 'catid', + 'assigned_cat_ids', + 'access', + 'language', + 'tags', + 'note' + )); + echo JLayoutHelper::render('joomla.edit.global', $this); + $this->set('fields', null); + ?> +
+
+ + + +
+
+ +
+
+
+
+ + + canDo->get('core.admin')) : ?> + + form->getInput('rules'); ?> + + + + set('ignore_fieldsets', array('fieldparams')); + echo JLayoutHelper::render('joomla.edit.params', $this); ?> + + + + form->getInput('context'); ?> + + +
+
diff --git a/administrator/components/com_fields/views/field/tmpl/modal.php b/administrator/components/com_fields/views/field/tmpl/modal.php new file mode 100644 index 0000000000000..8029385d5b9a4 --- /dev/null +++ b/administrator/components/com_fields/views/field/tmpl/modal.php @@ -0,0 +1,92 @@ +input; + +JFactory::getDocument()->addScriptDeclaration(" + Joomla.submitbutton = function(task) + { + if (task == 'field.cancel' || document.formvalidator.isValid(document.getElementById('item-form'))) + { + " . $this->form->getField('description')->save() . " + + if (window.opener && (task == 'field.save' || task == 'field.cancel')) + { + window.opener.document.closeEditWindow = self; + window.opener.setTimeout('window.document.closeEditWindow.close()', 1000); + } + + Joomla.submitform(task, document.getElementById('item-form')); + } + }; +"); +?> +
+ +
+ + + +
+ +
+
+ +
+ + +
+ 'general')); ?> + + +
+
+ form->getLabel('description'); ?> + form->getInput('description'); ?> +
+
+ +
+
+ + + +
+
+ +
+
+
+
+ + + canDo->get('core.admin')) : ?> + + form->getInput('rules'); ?> + + + + + + + + form->getInput('context'); ?> + + +
+
+
diff --git a/administrator/components/com_fields/views/field/tmpl/modal_options.php b/administrator/components/com_fields/views/field/tmpl/modal_options.php new file mode 100644 index 0000000000000..7d4002092917c --- /dev/null +++ b/administrator/components/com_fields/views/field/tmpl/modal_options.php @@ -0,0 +1,46 @@ + 'collapse0')); +$fieldSets = $this->form->getFieldsets('params'); +$i = 0; +?> + $fieldSet) : ?> + label) ? $fieldSet->label : 'COM_FIELDS_' . $name . '_FIELDSET_LABEL'; + echo JHtml::_('bootstrap.addSlide', 'fieldOptions', JText::_($label), 'collapse' . $i++); + if (isset($fieldSet->description) && trim($fieldSet->description)) + { + echo '

' . $this->escape(JText::_($fieldSet->description)) . '

'; + } + ?> + form->getFieldset($name) as $field) : ?> +
+
+ label; ?> +
+
+ input; ?> +
+
+ + + +
+
+ form->getLabel('note'); ?> +
+
+ form->getInput('note'); ?> +
+
+ + + + diff --git a/administrator/components/com_fields/views/field/view.html.php b/administrator/components/com_fields/views/field/view.html.php new file mode 100644 index 0000000000000..4cd17de4124e6 --- /dev/null +++ b/administrator/components/com_fields/views/field/view.html.php @@ -0,0 +1,190 @@ +form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->state = $this->get('State'); + $section = $this->state->get('field.section') ? $this->state->get('field.section') . '.' : ''; + $this->canDo = JHelperContent::getActions($this->state->get('field.component'), $section . 'field', $this->item->id); + + $input = JFactory::getApplication()->input; + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode("\n", $errors)); + + return false; + } + + // Check for tag type + $this->checkTags = JHelperTags::getTypes('objectList', array( + $this->state->get('field.context') . '.field' + ), true); + + $input->set('hidemainmenu', true); + + if ($this->getLayout() == 'modal') + { + $this->form->setFieldAttribute('language', 'readonly', 'true'); + $this->form->setFieldAttribute('parent_id', 'readonly', 'true'); + } + + $this->addToolbar(); + parent::display($tpl); + } + + protected function addToolbar () + { + $input = JFactory::getApplication()->input; + $context = $input->get('context'); + $user = JFactory::getUser(); + $userId = $user->get('id'); + + $isNew = ($this->item->id == 0); + $checkedOut = ! ($this->item->checked_out == 0 || $this->item->checked_out == $userId); + + // Check to see if the type exists + $ucmType = new JUcmType(); + $this->typeId = $ucmType->getTypeId($context . '.field'); + + // Avoid nonsense situation. + if ($context == 'com_fields') + { + return; + } + + // The context can be in the form com_foo.section + $parts = explode('.', $context); + $component = $parts[0]; + $section = (count($parts) > 1) ? $parts[1] : null; + $componentParams = JComponentHelper::getParams($component); + + // Need to load the menu language file as mod_menu hasn't been loaded + // yet. + $lang = JFactory::getLanguage(); + $lang->load($component, JPATH_BASE, null, false, true) || + $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, true); + + // Load the field helper. + require_once JPATH_COMPONENT . '/helpers/fields.php'; + + // Get the results for each action. + $canDo = $this->canDo; + + // If a component fields title string is present, let's use it. + if ($lang->hasKey( + $component_title_key = $component . '_FIELDS_' . ($section ? $section : '') . '_FIELD_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE')) + { + $title = JText::_($component_title_key); + } + // Else if the component section string exits, let's use it + else if ($lang->hasKey($component_section_key = $component . '_FIELDS_SECTION_' . ($section ? $section : ''))) + { + $title = JText::sprintf('COM_FIELDS_VIEW_FIELD_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE', + $this->escape(JText::_($component_section_key))); + } + // Else use the base title + else + { + $title = JText::_('COM_FIELDS_VIEW_FIELD_BASE_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE'); + } + + // Load specific css component + JHtml::_('stylesheet', $component . '/administrator/fields.css', array(), true); + + // Prepare the toolbar. + JToolbarHelper::title($title, + 'folder field-' . ($isNew ? 'add' : 'edit') . ' ' . substr($component, 4) . ($section ? "-$section" : '') . '-field-' . + ($isNew ? 'add' : 'edit')); + + // For new records, check the create permission. + if ($isNew) + { + JToolbarHelper::apply('field.apply'); + JToolbarHelper::save('field.save'); + JToolbarHelper::save2new('field.save2new'); + } + + // If not checked out, can save the item. + elseif (! $checkedOut && ($canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_user_id == $userId))) + { + JToolbarHelper::apply('field.apply'); + JToolbarHelper::save('field.save'); + + if ($canDo->get('core.create')) + { + JToolbarHelper::save2new('field.save2new'); + } + } + + // If an existing item, can save to a copy. + if (! $isNew && $canDo->get('core.create')) + { + JToolbarHelper::save2copy('field.save2copy'); + } + + if (empty($this->item->id)) + { + JToolbarHelper::cancel('field.cancel'); + } + else + { + if ($componentParams->get('save_history', 0) && $user->authorise('core.edit')) + { + $typeAlias = $context . '.field'; + JToolbarHelper::versions($typeAlias, $this->item->id); + } + + JToolbarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE'); + } + + JToolbarHelper::divider(); + + // Compute the ref_key if it does exist in the component + if (! $lang->hasKey($ref_key = strtoupper($component . ($section ? "_$section" : '')) . '_FIELD_' . ($isNew ? 'ADD' : 'EDIT') . '_HELP_KEY')) + { + $ref_key = 'JHELP_COMPONENTS_' . strtoupper(substr($component, 4) . ($section ? "_$section" : '')) . '_FIELD_' . ($isNew ? 'ADD' : 'EDIT'); + } + + /* + * Get help for the field/section view for the component by + * -remotely searching in a language defined dedicated URL: + * *component*_HELP_URL + * -locally searching in a component help file if helpURL param exists + * in the component and is set to '' + * -remotely searching in a component URL if helpURL param exists in the + * component and is NOT set to '' + */ + if ($lang->hasKey($lang_help_url = strtoupper($component) . '_HELP_URL')) + { + $debug = $lang->setDebug(false); + $url = JText::_($lang_help_url); + $lang->setDebug($debug); + } + else + { + $url = null; + } + + // JToolbarHelper::help($ref_key, $componentParams->exists('helpURL'), + // $url, $component); + } +} diff --git a/administrator/components/com_fields/views/fields/tmpl/default.php b/administrator/components/com_fields/views/fields/tmpl/default.php new file mode 100644 index 0000000000000..900f11e5ef59b --- /dev/null +++ b/administrator/components/com_fields/views/fields/tmpl/default.php @@ -0,0 +1,222 @@ +get('id'); +$context = $this->escape($this->state->get('filter.context')); +$listOrder = $this->escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); +$ordering = ($listOrder == 'a.ordering'); +$saveOrder = ($listOrder == 'a.ordering' && strtolower($listDirn) == 'asc'); + +if ($saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_fields&task=fields.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'fieldList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true); +} +?> + +
+
+ sidebar; ?> +
+
+
+ filterForm->getFieldsets('custom'); + foreach ($fieldSets as $name => $fieldSet) + { + foreach ($this->filterForm->getFieldset($name) as $field) + { + echo $field->input; + } + }?> +
 
+ $this)); + ?> + items)) : ?> +
+ +
+ + + + + + + + + + + + + + + + + + + + + + items as $i => $item) : ?> + authorise('core.edit', $context . '.field.' . $item->id); + $canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; + $canEditOwn = $user->authorise('core.edit.own', $context . '.field.' . $item->id) && $item->created_user_id == $userId; + $canChange = $user->authorise('core.edit.state', $context . '.field.' . $item->id) && $canCheckin; + ?> + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + state->get('list.direction'), $this->state->get('list.ordering')); ?> + + +
+ pagination->getListFooter(); ?> +
+ + + + + + + + + id); ?> + + state, $i, 'fields.', $canChange); ?> + + checked_out) : ?> + editor, $item->checked_out_time, 'fields.', $canCheckin); ?> + + + + escape($item->title); ?> + + escape($item->title); ?> + + + note)) : ?> + escape($item->alias)); ?> + + escape($item->alias), $this->escape($item->note)); ?> + + component)); + if ($category) + { + $buffer = JText::_('JCATEGORY') . ': '; + $cats = explode(',', $item->assigned_cat_ids); + foreach ($cats as $cat) + { + if (empty($cat)) + { + continue; + } + + $c = $category->get($cat); + if (!$c || $c->id == 'root') + { + continue; + } + $buffer .= ' ' . $c->title .','; + } + echo trim($buffer, ','); + } + ?> + + + type); + if (!JFactory::getLanguage()->hasKey($label)) + { + $label = JString::ucfirst($item->type); + } + echo $this->escape(JText::_($label)); ?> + + escape($item->category_title); ?> + + escape($item->access_level); ?> + + language == '*') : ?> + + + language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> + + + id; ?> +
+ + authorise('core.create', $context) + && $user->authorise('core.edit', $context) + && $user->authorise('core.edit.state', $context)) : ?> + JText::_('COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + + + + +
+
diff --git a/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php b/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php new file mode 100644 index 0000000000000..a62901e043dc1 --- /dev/null +++ b/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php @@ -0,0 +1,39 @@ +state->get('filter.published'); +$context = $this->escape($this->state->get('filter.context')); +?> + +
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php b/administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php new file mode 100644 index 0000000000000..9ae83380880b7 --- /dev/null +++ b/administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php @@ -0,0 +1,16 @@ + + + \ No newline at end of file diff --git a/administrator/components/com_fields/views/fields/tmpl/modal.php b/administrator/components/com_fields/views/fields/tmpl/modal.php new file mode 100644 index 0000000000000..7fdbb99791c1d --- /dev/null +++ b/administrator/components/com_fields/views/fields/tmpl/modal.php @@ -0,0 +1,184 @@ +isSite()) +{ + JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN')); +} + +JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +JHtml::_('bootstrap.tooltip'); +JHtml::_('behavior.framework', true); +JHtml::_('formbehavior.chosen', 'select'); + +$function = $app->input->getCmd('function', 'jSelectField'); +$listOrder = $this->escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); +?> +
+
+
+
+ +
+
+ +
+
+ + +
+
+
+
+ + + + + state->get('filter.forcedLanguage')) : ?> + + + + + +
+
+ + items)) : ?> +
+ +
+ + + + + + + + + + + + + + + + + + + items as $i => $item) + { + ?> + + + + + + + + + + +
+ + + + + + + + + + + +
+ pagination->getListFooter(); ?> +
+ state, $i, 'fields.', false); ?> + + + escape($item->title); ?> + + + note)) : ?> + escape($item->alias)); ?> + + escape($item->alias), $this->escape($item->note)); ?> + + component)); + if ($category) + { + $buffer = JText::_('JCATEGORY') . ': '; + $cats = explode(',', $item->assigned_cat_ids); + foreach ($cats as $cat) + { + if (empty($cat)) + { + continue; + } + + $c = $category->get($cat); + if (!$c || $c->id == 'root') + { + continue; + } + $buffer .= ' ' . $c->title .','; + } + echo trim($buffer, ','); + } + ?> + + + type); + if (!JFactory::getLanguage()->hasKey($label)) + { + $label = JString::ucfirst($item->type); + } + echo $this->escape(JText::_($label)); ?> + + escape($item->access_level); ?> + + language == '*'):?> + + + language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> + + + id; ?> +
+ + +
+ + + + + +
+
diff --git a/administrator/components/com_fields/views/fields/view.html.php b/administrator/components/com_fields/views/fields/view.html.php new file mode 100644 index 0000000000000..7d7cc7647761f --- /dev/null +++ b/administrator/components/com_fields/views/fields/view.html.php @@ -0,0 +1,195 @@ +state = $this->get('State'); + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->filterForm = $this->get('FilterForm'); + $this->activeFilters = $this->get('ActiveFilters'); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode("\n", $errors)); + + return false; + } + + $this->context = JFactory::getApplication()->input->getCmd('context'); + $parts = FieldsHelper::extract($this->context); + if (! $parts) + { + JError::raiseError(500, 'Invalid context!!'); + return; + } + $this->component = $parts[0]; + $this->section = $parts[1]; + + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + parent::display($tpl); + } + + protected function addToolbar () + { + $fieldId = $this->state->get('filter.field_id'); + $user = JFactory::getUser(); + $component = $this->component; + $section = $this->section; + + $canDo = new JObject(); + if (JFile::exists(JPATH_ADMINISTRATOR . '/components/' . $component . '/access.xml')) + { + $canDo = JHelperContent::getActions($component, 'field', $fieldId); + } + + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + + // Avoid nonsense situation. + if ($component == 'com_fields') + { + return; + } + + // Need to load the menu language file as mod_menu hasn't been loaded + // yet. + $lang = JFactory::getLanguage(); + $lang->load($component, JPATH_BASE, null, false, true) || + $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, true); + + // If a component categories title string is present, let's use it. + if ($lang->hasKey($component_title_key = strtoupper($component . '_FIELDS_' . ($section ? $section : '')) . '_FIELDS_TITLE')) + { + $title = JText::_($component_title_key); + } + else if ($lang->hasKey($component_section_key = strtoupper($component . '_FIELDS_SECTION_' . ($section ? $section : '')))) + { + // Else if the component section string exits, let's use it + $title = JText::sprintf('COM_FIELDS_VIEW_FIELDS_TITLE', $this->escape(JText::_($component_section_key))); + } + else + { + $title = JText::_('COM_FIELDS_VIEW_FIELDS_BASE_TITLE'); + } + + // Load specific css component + JHtml::_('stylesheet', $component . '/administrator/fields.css', array(), true); + + // Prepare the toolbar. + JToolbarHelper::title($title, 'folder fields ' . substr($component, 4) . ($section ? "-$section" : '') . '-fields'); + + if ($canDo->get('core.create')) + { + JToolbarHelper::addNew('field.add'); + } + + if ($canDo->get('core.edit') || $canDo->get('core.edit.own')) + { + JToolbarHelper::editList('field.edit'); + } + + if ($canDo->get('core.edit.state')) + { + JToolbarHelper::publish('fields.publish', 'JTOOLBAR_PUBLISH', true); + JToolbarHelper::unpublish('fields.unpublish', 'JTOOLBAR_UNPUBLISH', true); + JToolbarHelper::archiveList('fields.archive'); + } + + if (JFactory::getUser()->authorise('core.admin')) + { + JToolbarHelper::checkin('fields.checkin'); + } + + // Add a batch button + if ($user->authorise('core.create', $this->context) && $user->authorise('core.edit', $this->context) && + $user->authorise('core.edit.state', $this->context)) + { + $title = JText::_('JTOOLBAR_BATCH'); + + // Instantiate a new JLayoutFile instance and render the batch + // button + $layout = new JLayoutFile('joomla.toolbar.batch'); + + $dhtml = $layout->render(array( + 'title' => $title + )); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($canDo->get('core.admin') || $canDo->get('core.options')) + { + JToolbarHelper::preferences($component); + } + + if ($this->state->get('filter.published') == - 2 && $canDo->get('core.delete', $component)) + { + JToolbarHelper::deleteList('', 'fields.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($canDo->get('core.edit.state')) + { + JToolbarHelper::trash('fields.trash'); + } + + // Compute the ref_key if it does exist in the component + if (! $lang->hasKey($ref_key = strtoupper($component . ($section ? "_$section" : '')) . '_FIELDS_HELP_KEY')) + { + $ref_key = 'JHELP_COMPONENTS_' . strtoupper(substr($component, 4) . ($section ? "_$section" : '')) . '_FIELDS'; + } + + /* + * Get help for the fields view for the component by + * -remotely searching in a language defined dedicated URL: + * *component*_HELP_URL + * -locally searching in a component help file if helpURL param exists + * in the component and is set to '' + * -remotely searching in a component URL if helpURL param exists in the + * component and is NOT set to '' + */ + if ($lang->hasKey($lang_help_url = strtoupper($component) . '_HELP_URL')) + { + $debug = $lang->setDebug(false); + $url = JText::_($lang_help_url); + $lang->setDebug($debug); + } + else + { + $url = null; + } + + // JToolbarHelper::help($ref_key, + // JComponentHelper::getParams($component)->exists('helpURL'), $url); + } + + protected function getSortFields () + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.title' => JText::_('JGLOBAL_TITLE'), + 'a.type' => JText::_('COM_FIELDS_FIELD_FIELD_TYPE_LABEL'), + 'a.access' => JText::_('JGRID_HEADING_ACCESS'), + 'language' => JText::_('JGRID_HEADING_LANGUAGE'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/administrator/language/en-GB/en-GB.com_fields.ini b/administrator/language/en-GB/en-GB.com_fields.ini new file mode 100644 index 0000000000000..f565d0cbcf60d --- /dev/null +++ b/administrator/language/en-GB/en-GB.com_fields.ini @@ -0,0 +1,164 @@ +COM_FIELDS="Fields" +COM_FIELDS_XML_DESCRIPTION="Component to manage custom fields." + +; Types +COM_FIELDS_TYPE_CALENDAR="Calendar" +COM_FIELDS_TYPE_CAPTCHA="Captcha" +COM_FIELDS_TYPE_CHECKBOXES="Checkboxes" +COM_FIELDS_TYPE_COLOR="Color" +COM_FIELDS_TYPE_EDITOR="Editor" +COM_FIELDS_TYPE_EMAIL="Email" +COM_FIELDS_TYPE_GALLERY="Gallery" +COM_FIELDS_TYPE_IMAGELIST="Image" +COM_FIELDS_TYPE_INTEGER="Integer" +COM_FIELDS_TYPE_LIST="List" +COM_FIELDS_TYPE_MEDIA="Media" +COM_FIELDS_TYPE_MODAL_ARTICLE="Article" +COM_FIELDS_TYPE_RADIO="Radio" +COM_FIELDS_TYPE_SQL="Sql" +COM_FIELDS_TYPE_TEL="Telephone" +COM_FIELDS_TYPE_TEXT="Text" +COM_FIELDS_TYPE_TEXTAREA="Textarea" +COM_FIELDS_TYPE_TIMEZONE="Timezone" +COM_FIELDS_TYPE_URL="Url" +COM_FIELDS_TYPE_USER="User" +COM_FIELDS_TYPE_USERGROUPLIST="Usergroup" +COM_FIELDS_TYPE_YESNO="Yes No" + +; Views +COM_FIELDS_VIEW_FIELDS_TITLE="%s Fields" +COM_FIELDS_VIEW_FIELDS_BASE_TITLE="Fields" +COM_FIELDS_VIEW_FIELDS_SORT_TYPE_ASC="Type ascending" +COM_FIELDS_VIEW_FIELDS_SORT_TYPE_DESC="Type descending" +COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS="Batch process the selected fields." + +COM_FIELDS_VIEW_FIELD_ADD_TITLE="%s Fields: New" +COM_FIELDS_VIEW_FIELD_EDIT_TITLE="%s Fields: Edit" +COM_FIELDS_VIEW_FIELD_BASE_ADD_TITLE="Fields: New" +COM_FIELDS_VIEW_FIELD_BASE_EDIT_TITLE="Fields: Edit" +COM_FIELDS_VIEW_FIELD_FIELDSET_GENERAL="General" +COM_FIELDS_VIEW_FIELD_FIELDSET_PUBLISHING="Publishing" +COM_FIELDS_VIEW_FIELD_FIELDSET_RULES="Permissions" + +; Fields General +COM_FIELDS_FIELD_FIELD_TYPE_LABEL="Type" +COM_FIELDS_FIELD_FIELD_TYPE_DESC="The type of the field." +COM_FIELDS_FIELD_FIELD_LABEL_LABEL="Label" +COM_FIELDS_FIELD_FIELD_LABEL_DESC="The label of the field to display." +COM_FIELDS_FIELD_FIELD_REQUIRED_LABEL="Is Required" +COM_FIELDS_FIELD_FIELD_REQUIRED_DESC="Is this a mandatory field for the editor?" +COM_FIELDS_FIELD_FIELD_DISABLED_LABEL="Disabled" +COM_FIELDS_FIELD_FIELD_DISABLED_DESC="Is the field disabled in the edit form." +COM_FIELDS_FIELD_FIELD_SHOW_ON_LABEL="Show On" +COM_FIELDS_FIELD_FIELD_SHOW_ON_DESC="On which part of the site should the field be shown." +COM_FIELDS_FIELD_FIELD_SHOW_ON_SITE="Site" +COM_FIELDS_FIELD_FIELD_SHOW_ON_ADMIN="Admin" +COM_FIELDS_FIELD_FIELD_SHOW_ON_BOTH="Site and Admin" +COM_FIELDS_FIELD_FIELD_DISPLAY_LABEL="Automatic Display" +COM_FIELDS_FIELD_FIELD_DISPLAY_DESC="Joomla offers some content events which are triggered during content creation process. Here is the place to define how the custom fields should be integrated into content." +COM_FIELDS_FIELD_FIELD_DISPLAY_AFTER_TITLE="After Title" +COM_FIELDS_FIELD_FIELD_DISPLAY_BEFORE_DISPLAY="Before Display" +COM_FIELDS_FIELD_FIELD_DISPLAY_AFTER_DISPLAY="After Display" +COM_FIELDS_FIELD_FIELD_READONLY_LABEL="Read-Only" +COM_FIELDS_FIELD_FIELD_READONLY_DESC="Is the field read only in the edit form." +COM_FIELDS_FIELD_FIELD_DEFAULT_VALUE_LABEL="Default Value" +COM_FIELDS_FIELD_FIELD_DEFAULT_VALUE_DESC="The default value of the field." +COM_FIELDS_FIELD_FIELD_RENDER_CLASS_LABEL="Render Class" +COM_FIELDS_FIELD_FIELD_RENDER_CLASS_DESC="The class attributes of the field when the field is rendered. If different classes are needed, list them with spaces." +COM_FIELDS_FIELD_FIELD_CLASS_LABEL="Class" +COM_FIELDS_FIELD_FIELD_CLASS_DESC="The class attributes of the field in the edit form. If different classes are needed, list them with spaces." +COM_FIELDS_FIELD_FIELD_NOTE_LABEL="Note" +COM_FIELDS_FIELD_FIELD_NOTE_DESC="An optional note of the field." +COM_FIELDS_FIELD_FIELD_DESCRIPTION_DESC="The description of the field." +COM_FIELDS_FIELD_FIELD_LANGUAGE_DESC="Assign a language to this field." +COM_FIELDS_FIELD_FIELD_IMAGE_LABEL="Image" +COM_FIELDS_FIELD_FIELD_IMAGE_DESC="Image label." +COM_FIELDS_FIELD_FIELD_IMAGE_ALT_LABEL="Image Alternate Text" +COM_FIELDS_FIELD_FIELD_IMAGE_ALT_DESC="The alternate text for the image." +COM_FIELDS_FIELD_FIELD_PERMISSION_CREATE_DESC="New setting for create actions in this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_FIELD_PERMISSION_DELETE_DESC="New setting for delete actions on this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_FIELD_PERMISSION_EDIT_DESC="New setting for edit actions on this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_FIELD_PERMISSION_EDITOWN_DESC="New setting for edit own actions on this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_FIELD_PERMISSION_EDITSTATE_DESC="New setting for edit state actions on this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_FIELD_PERMISSION_EDIT_VALUE_LABEL="Edit Field Value" +COM_FIELDS_FIELD_FIELD_PERMISSION_EDIT_VALUE_DESC="Who can edit the field value in the form editor." +COM_FIELDS_FIELD_FIELD_CATEGORY_LABEL="Fields Category" +COM_FIELDS_FIELD_FIELD_CATEGORY_DESC="The fields category this field belongs to." +COM_FIELDS_FIELD_FIELD_OUTPUT_LABEL="Output" +COM_FIELDS_FIELD_FIELD_OUTPUT_DESC="The output of the field. If not empty then the field is rendered with the mustache codes." + +; Field Types +COM_FIELDS_FIELD_FIELD_TEXTAREA_ROWS_LABEL="Rows" +COM_FIELDS_FIELD_FIELD_TEXTAREA_ROWS_DESC="The amount of rows of the field." +COM_FIELDS_FIELD_FIELD_TEXTAREA_COLS_LABEL="Columns" +COM_FIELDS_FIELD_FIELD_TEXTAREA_COLS_DESC="The amount of columns of the field." + +COM_FIELDS_FIELD_FIELD_EDITOR_SHOW_BUTTONS_LABEL="Show buttons" +COM_FIELDS_FIELD_FIELD_EDITOR_SHOW_BUTTONS_DESC="Should the buttons being shown." +COM_FIELDS_FIELD_FIELD_EDITOR_BUTTONS_HIDE_LABEL="Hide Buttons" +COM_FIELDS_FIELD_FIELD_EDITOR_BUTTONS_HIDE_DESC="Hide the buttons in the comma separated list." +COM_FIELDS_FIELD_FIELD_EDITOR_WIDTH_LABEL="Width" +COM_FIELDS_FIELD_FIELD_EDITOR_WIDTH_DESC="Defines the width (in pixels) of the wysiwyg editor and defaults to 100%" +COM_FIELDS_FIELD_FIELD_EDITOR_HEIGHT_LABEL="Height" +COM_FIELDS_FIELD_FIELD_EDITOR_HEIGHT_DESC="Defines the height (in pixels) of the wysiwyg editor and defaults to 250px" + +COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_LABEL="Multiple" +COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_DESC="Allow multiple values to be selected." +COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_LABEL="Options" +COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_DESC="The options of the list." +COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_KEY_LABEL="Key" +COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_VALUE_LABEL="Value" + +COM_FIELDS_FIELD_FIELD_CALENDAR_FORMAT_LABEL="Format" +COM_FIELDS_FIELD_FIELD_CALENDAR_FORMAT_DESC="The date format to be used. This is in the format used by PHP to specify date string formats (see below). If no format argument is given, '%Y-%m-%d' is assumed (giving dates like '2008-04-16')." + +COM_FIELDS_FIELD_FIELD_INTEGER_FIRST_LABEL="First" +COM_FIELDS_FIELD_FIELD_INTEGER_FIRST_DESC="This value is the lowest on the list." +COM_FIELDS_FIELD_FIELD_INTEGER_LAST_LABEL="Last" +COM_FIELDS_FIELD_FIELD_INTEGER_LAST_DESC="This value is the highest on the list." +COM_FIELDS_FIELD_FIELD_INTEGER_STEP_LABEL="Step" +COM_FIELDS_FIELD_FIELD_INTEGER_STEP_DESC="Each option will be the previous option incremented by this integer, starting with the first value until the last value is reached." + +COM_FIELDS_FIELD_FIELD_IMAGELIST_DIRECTORY_LABEL="Directory" +COM_FIELDS_FIELD_FIELD_IMAGELIST_DIRECTORY_DESC="The filesystem path to the directory containing the image files to be listed." + +COM_FIELDS_FIELD_FIELD_SQL_QUERY_LABEL="Query" +COM_FIELDS_FIELD_FIELD_SQL_QUERY_DESC="The SQL query which will provide the data for the drop-down list. The query must return two columns; one called 'value' which will hold the values of the list items; the other called 'text' containing the text in the drop-down list." + +COM_FIELDS_FIELD_FIELD_URL_SCHEMES_LABEL="Schemes" +COM_FIELDS_FIELD_FIELD_URL_SCHEMES_DESC="The allowed schemes." +COM_FIELDS_FIELD_FIELD_URL_RELATIVE_LABEL="Relative" +COM_FIELDS_FIELD_FIELD_URL_RELATIVE_DESC="Are relative urls allowed." + +COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_LABEL="Preview" +COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_DESC="Shows or hides the preview of the currently chosen image." +COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_TOOLTIP="Tooltip" +COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_INLINE="Inline" +COM_FIELDS_FIELD_FIELD_MEDIA_IMAGE_CLASS_LABEL="Image Class" +COM_FIELDS_FIELD_FIELD_MEDIA_IMAGE_CLASS_DESC="The class which is added to the image (src tag)." + +COM_FIELDS_FIELD_FIELD_GALLERY_MAX_WIDTH_LABEL="Max Width" +COM_FIELDS_FIELD_FIELD_GALLERY_MAX_WIDTH_DESC="The max width of the image. The image will be resized on the fly." +COM_FIELDS_FIELD_FIELD_GALLERY_THUMBNAIL_WIDTH_LABEL="Thumbnail Width" +COM_FIELDS_FIELD_FIELD_GALLERY_THUMBNAIL_WIDTH_DESC="The width of the thumbnails. The thumbnails will be resized on the fly." +COM_FIELDS_FIELD_FIELD_GALLERY_RECURSIVE_LABEL="Recursive" +COM_FIELDS_FIELD_FIELD_GALLERY_RECURSIVE_DESC="Should the images from the subfolders also be included." + +; Actions +COM_FIELDS_N_ITEMS_ARCHIVED="%d fields successfully archived" +COM_FIELDS_N_ITEMS_ARCHIVED_1="%d field successfully archived" +COM_FIELDS_N_ITEMS_CHECKED_IN_0="No field successfully checked in" +COM_FIELDS_N_ITEMS_CHECKED_IN_1="%d field successfully checked in" +COM_FIELDS_N_ITEMS_CHECKED_IN_MORE="%d fields successfully checked in" +COM_FIELDS_N_ITEMS_DELETED="%d fields successfully deleted" +COM_FIELDS_N_ITEMS_DELETED_1="%d field successfully deleted" +COM_FIELDS_N_ITEMS_PUBLISHED="%d fields successfully published" +COM_FIELDS_N_ITEMS_PUBLISHED_1="%d field successfully published" +COM_FIELDS_N_ITEMS_TRASHED="%d fields successfully trashed" +COM_FIELDS_N_ITEMS_TRASHED_1="%d field successfully trashed" +COM_FIELDS_N_ITEMS_UNPUBLISHED="%d fields successfully unpublished" +COM_FIELDS_N_ITEMS_UNPUBLISHED_1="%d field successfully unpublished" +COM_FIELDS_N_ITEMS_CREATED="%d fields successfully created in calendar %s" +COM_FIELDS_N_ITEMS_UPDATED="%d fields successfully updated in calendar %s" + +COM_FIELDS_TYPE_GALLERY_IMAGE_ERROR="Error precessing the image %s: %s" diff --git a/administrator/language/en-GB/en-GB.com_fields.sys.ini b/administrator/language/en-GB/en-GB.com_fields.sys.ini new file mode 100644 index 0000000000000..de093bea5f06d --- /dev/null +++ b/administrator/language/en-GB/en-GB.com_fields.sys.ini @@ -0,0 +1,2 @@ +COM_FIELDS="Fields" +COM_FIELDS_XML_DESCRIPTION="Component to manage custom fields." diff --git a/administrator/language/en-GB/en-GB.ini b/administrator/language/en-GB/en-GB.ini index 50a62cc4cf621..e4875a9d959e0 100644 --- a/administrator/language/en-GB/en-GB.ini +++ b/administrator/language/en-GB/en-GB.ini @@ -257,6 +257,7 @@ JGLOBAL_ARTICLE_MANAGER_ORDER="Ordering" JGLOBAL_ARTICLE_ORDER_DESC="The order that articles will show in." JGLOBAL_ARTICLE_ORDER_LABEL="Article Order" JGLOBAL_ARTICLES="Articles" +JGLOBAL_FIELDS="Fields" JGLOBAL_AUTH_ACCESS_DENIED="Access Denied" JGLOBAL_AUTH_ACCESS_GRANTED="Access Granted" JGLOBAL_AUTH_BIND_FAILED="Failed binding to LDAP server" @@ -319,6 +320,7 @@ JGLOBAL_FEED_SHOW_READMORE_DESC="Displays a "Read More" link in the ne JGLOBAL_FEED_SHOW_READMORE_LABEL="Show "Read More"" JGLOBAL_FEED_SUMMARY_DESC="If set to Intro Text, only the Intro Text of each article will show in the news feed. If set to Full Text, the whole article will show in the news feed." JGLOBAL_FEED_SUMMARY_LABEL="For each feed item show" +JGLOBAL_FIELD_CATEGORIES="Field Categories" JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC="Categories that are within this category will be displayed." JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL="Select a Top Level Category" JGLOBAL_FIELD_CATEGORIES_DESC_DESC="If you enter some text in this field, it will override the Top Level Category Description, if it has one." diff --git a/administrator/language/en-GB/en-GB.plg_system_fields.ini b/administrator/language/en-GB/en-GB.plg_system_fields.ini new file mode 100644 index 0000000000000..cbade95b81c73 --- /dev/null +++ b/administrator/language/en-GB/en-GB.plg_system_fields.ini @@ -0,0 +1,11 @@ +PLG_SYSTEM_FIELDS="System - Fields" +PLG_SYSTEM_FIELDS_XML_DESCRIPTION="The system plugin for custom fields." + +; Configs +PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_LABEL="Automatic Display" +PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_DESC="Joomla offers some content events which are triggered during content creation process. Here is the place to generally define how the custom fields should be integrated into content." +PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_AFTER_TITLE="After Title" +PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_BEFORE_DISPLAY="Before Display" +PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_AFTER_DISPLAY="After Display" +PLG_SYSTEM_FIELDS_CONFIG_PREPARE_CONTENT_LABEL="Prepare Content" +PLG_SYSTEM_FIELDS_CONFIG_PREPARE_CONTENT_DESC="Should the content being parsed for commands like {{#fields}}?" \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.plg_system_fields.sys.ini b/administrator/language/en-GB/en-GB.plg_system_fields.sys.ini new file mode 100644 index 0000000000000..952dd036a7b4a --- /dev/null +++ b/administrator/language/en-GB/en-GB.plg_system_fields.sys.ini @@ -0,0 +1,2 @@ +PLG_SYSTEM_FIELDS="System - Fields" +PLG_SYSTEM_FIELDS_XML_DESCRIPTION="The system plugin for custom fields." \ No newline at end of file diff --git a/components/com_fields/controller.php b/components/com_fields/controller.php new file mode 100644 index 0000000000000..328f932b7a5d2 --- /dev/null +++ b/components/com_fields/controller.php @@ -0,0 +1,12 @@ +input->get($this->input->get('formcontrol', 'jform'), array(), 'array'); + + $parts = FieldsHelper::extract($this->input->getCmd('context')); + if ($parts) + { + $app->setUserState($parts[0] . '.edit.' . $parts[1] . '.data', $data); + } + $app->redirect(base64_decode($this->input->get->getBase64('return'))); + $app->close(); + } +} diff --git a/components/com_fields/fields.php b/components/com_fields/fields.php new file mode 100644 index 0000000000000..01cc72721d5fd --- /dev/null +++ b/components/com_fields/fields.php @@ -0,0 +1,14 @@ +execute(JFactory::getApplication()->input->get('task')); +$controller->redirect(); diff --git a/components/com_fields/layouts/field/prepare/base.php b/components/com_fields/layouts/field/prepare/base.php new file mode 100644 index 0000000000000..6ccec0040ce23 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/base.php @@ -0,0 +1,26 @@ +value; +if (! $value) +{ + return; +} + +if (is_array($value)) +{ + $value = implode(', ', $value); +} +echo htmlentities($value); diff --git a/components/com_fields/layouts/field/prepare/captcha.php b/components/com_fields/layouts/field/prepare/captcha.php new file mode 100644 index 0000000000000..ab020f88d3354 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/captcha.php @@ -0,0 +1,10 @@ +value; +if (! $value) +{ + return; +} + +$value = (array) $value; + +$texts = array(); +foreach (FieldsHelper::loadTypeObject($field->type, $field->context)->getOptions($field) as $index => $optionsValue) +{ + if (in_array($index, $value)) + { + $texts[] = $optionsValue; + } +} + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/editor.php b/components/com_fields/layouts/field/prepare/editor.php new file mode 100644 index 0000000000000..ec4147e7418de --- /dev/null +++ b/components/com_fields/layouts/field/prepare/editor.php @@ -0,0 +1,22 @@ +value; +if (! $value) +{ + return; +} + +echo JHTML::_('content.prepare', $value); diff --git a/components/com_fields/layouts/field/prepare/gallery.php b/components/com_fields/layouts/field/prepare/gallery.php new file mode 100644 index 0000000000000..3f85d4e1f4a32 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/gallery.php @@ -0,0 +1,136 @@ +value; +if (! $value) +{ + return; +} + +// Loading the language +JFactory::getLanguage()->load('com_fields', JPATH_ADMINISTRATOR . '/components/com_fields'); + +JHtml::_('jquery.framework'); + +$doc = JFactory::getDocument(); + +// Adding the javascript gallery library +$doc->addScript('media/com_fields/js/fotorama.min.js'); +$doc->addStyleSheet('media/com_fields/css/fotorama.min.css'); + +$value = (array) $value; + +$thumbWidth = $field->fieldparams->get('thumbnail_width', '64'); +$maxImageWidth = $field->fieldparams->get('max_width'); + +// Main container +$buffer = '
'; +foreach ($value as $path) +{ + // Only process valid paths + if (! $path) + { + continue; + } + + // The root folder + $root = $field->fieldparams->get('directory', 'images'); + foreach (JFolder::files(JPATH_ROOT . '/' . $root . '/' . $path, '.', $field->fieldparams->get('recursive', '1'), true) as $file) + { + // Skip none image files + if (! in_array(strtolower(JFile::getExt($file)), array( + 'jpg', + 'png', + 'bmp', + 'gif' + ))) + { + continue; + } + + // Relative path + $localPath = str_replace(JPATH_ROOT . '/' . $root . '/', '', $file); + $webImagePath = $root . '/' . $localPath; + + if ($maxImageWidth) + { + $resize = JPATH_CACHE . '/com_fields/gallery/' . $field->id . '/' . $maxImageWidth . '/' . $localPath; + if (! JFile::exists($resize)) + { + // Creating the folder structure for the max sized image + if (! JFolder::exists(dirname($resize))) + { + JFolder::create(dirname($resize)); + } + // Getting the properties of the image + $properties = JImage::getImageFileProperties($file); + if ($properties->width > $maxImageWidth) + { + // Creating the max sized image for the image + $imgObject = new JImage($file); + $imgObject->resize($maxImageWidth, 0, false, JImage::SCALE_INSIDE); + $imgObject->toFile($resize); + } + } + if (JFile::exists($resize)) + { + $webImagePath = JUri::base(true) . str_replace(JPATH_ROOT, '', $resize); + } + } + + // Thumbnail path for the image + $thumb = JPATH_CACHE . '/com_fields/gallery/' . $field->id . '/' . $thumbWidth . '/' . $localPath; + + if (! JFile::exists($thumb)) + { + try + { + // Creating the folder structure for the thumbnail + if (! JFolder::exists(dirname($thumb))) + { + JFolder::create(dirname($thumb)); + } + + // Getting the properties of the image + $properties = JImage::getImageFileProperties($file); + if ($properties->width > $thumbWidth) + { + // Creating the thumbnail for the image + $imgObject = new JImage($file); + $imgObject->resize($thumbWidth, 0, false, JImage::SCALE_INSIDE); + $imgObject->toFile($thumb); + } + } + catch (Exception $e) + { + JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_FIELDS_TYPE_GALLERY_IMAGE_ERROR', $file, $e->getMessage())); + } + } + + if (JFile::exists($thumb)) + { + // Linking to the real image and loading only the thumbnail + $buffer .= ''; + } + else + { + // Thumbnail doesn't exist, loading the full image + $buffer .= ''; + } + } +} +$buffer .= '
'; + +echo $buffer; diff --git a/components/com_fields/layouts/field/prepare/imagelist.php b/components/com_fields/layouts/field/prepare/imagelist.php new file mode 100644 index 0000000000000..d750ce354274c --- /dev/null +++ b/components/com_fields/layouts/field/prepare/imagelist.php @@ -0,0 +1,34 @@ +value; +if (! $value) +{ + return; +} + +$value = (array) $value; + +$buffer = ''; +foreach ($value as $path) +{ + if (! $path) + { + continue; + } + $buffer .= ''; +} +echo $buffer; diff --git a/components/com_fields/layouts/field/prepare/list.php b/components/com_fields/layouts/field/prepare/list.php new file mode 100644 index 0000000000000..e635b1054952d --- /dev/null +++ b/components/com_fields/layouts/field/prepare/list.php @@ -0,0 +1,33 @@ +value; +if (! $value) +{ + return; +} + +$value = (array) $value; + +$texts = array(); +foreach (FieldsHelper::loadTypeObject($field->type, $field->context)->getOptions($field) as $index => $optionsValue) +{ + if (in_array($index, $value)) + { + $texts[] = $optionsValue; + } +} + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/media.php b/components/com_fields/layouts/field/prepare/media.php new file mode 100644 index 0000000000000..8e4f3fbfab1ef --- /dev/null +++ b/components/com_fields/layouts/field/prepare/media.php @@ -0,0 +1,33 @@ +value; +if (! $value) +{ + return; +} + +$value = (array) $value; + +$buffer = ''; +foreach ($value as $path) +{ + if (! $path) + { + continue; + } + $buffer .= ''; +} +echo $buffer; diff --git a/components/com_fields/layouts/field/prepare/modal_article.php b/components/com_fields/layouts/field/prepare/modal_article.php new file mode 100644 index 0000000000000..ae38a622b7688 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/modal_article.php @@ -0,0 +1,44 @@ +value; +if (! $value) +{ + return; +} + +JLoader::import('joomla.application.component.model'); +JModelLegacy::addIncludePath(JPATH_BASE . '/components/com_content/models', 'ContentModel'); +$model = JModelLegacy::getInstance('Article', 'ContentModel'); + +// If the article is not found an error is thrown we need to hold the +// old error handler +$errorHandler = JError::getErrorHandling(E_ERROR); + +// Ignoring all errors +JError::setErrorHandling(E_ERROR, 'ignore'); + +// Fetching the article +$article = $model->getItem($value); + +// Restoreing the old error handler +JError::setErrorHandling(E_ERROR, $errorHandler['mode'], $errorHandler['options']); + +if ($article instanceof JException) +{ + return; +} + +echo htmlentities($article->title); diff --git a/components/com_fields/layouts/field/prepare/sql.php b/components/com_fields/layouts/field/prepare/sql.php new file mode 100644 index 0000000000000..8bf2aab8dba41 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/sql.php @@ -0,0 +1,61 @@ +value; +if (! $value) +{ + return; +} + +$db = JFactory::getDbo(); +$value = (array) $value; + +$condition = ''; +foreach ($value as $v) +{ + if (! $v) + { + continue; + } + $condition .= ', ' . $db->q($v); +} + +$query = $field->fieldparams->get('query', 'select id as value, name as text from #__users'); + +// Run the query with a having condition because it support aliases +$db->setQuery($query . ' having value in (' . trim($condition, ',') . ')'); + +$items = array(); +try +{ + $items = $db->loadObjectlist(); +} +catch (Exception $e) +{ + // If the query failed, we fetch all elements + $db->setQuery($query); + $items = $db->loadObjectlist(); +} + +$texts = array(); +foreach ($items as $item) +{ + if (in_array($item->value, $value)) + { + $texts[] = $item->text; + } +} + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/textarea.php b/components/com_fields/layouts/field/prepare/textarea.php new file mode 100644 index 0000000000000..ec4147e7418de --- /dev/null +++ b/components/com_fields/layouts/field/prepare/textarea.php @@ -0,0 +1,22 @@ +value; +if (! $value) +{ + return; +} + +echo JHTML::_('content.prepare', $value); diff --git a/components/com_fields/layouts/field/prepare/url.php b/components/com_fields/layouts/field/prepare/url.php new file mode 100644 index 0000000000000..648312ced1aa4 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/url.php @@ -0,0 +1,27 @@ +value; +if (! $value) +{ + return; +} + +$attributes = ''; +if (! JUri::isInternal($value)) +{ + $attributes = 'rel="nofollow" target="_blank"'; +} +echo '' . $value . ''; diff --git a/components/com_fields/layouts/field/prepare/user.php b/components/com_fields/layouts/field/prepare/user.php new file mode 100644 index 0000000000000..4d7c116b2c3f5 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/user.php @@ -0,0 +1,42 @@ +value; +if (! $value) +{ + return; +} + +$value = (array) $value; + +$texts = array(); +foreach ($value as $userId) +{ + if (! $userId) + { + continue; + } + $user = JFactory::getUser($userId); + if ($user) + { + $texts[] = $user->name; + } + else + { + $texts[] = $userId; + } +} + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/usergrouplist.php b/components/com_fields/layouts/field/prepare/usergrouplist.php new file mode 100644 index 0000000000000..fac9bd1a8cc3a --- /dev/null +++ b/components/com_fields/layouts/field/prepare/usergrouplist.php @@ -0,0 +1,34 @@ +value; +if (! $value) +{ + return; +} + +$value = (array) $value; +JLoader::register('UsersHelper', JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php'); + +$texts = array(); +foreach (UsersHelper::getGroups() as $group) +{ + if (in_array($group->value, $value)) + { + $texts[] = htmlentities(trim($group->text, '- ')); + } +} + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/yesno.php b/components/com_fields/layouts/field/prepare/yesno.php new file mode 100644 index 0000000000000..e635b1054952d --- /dev/null +++ b/components/com_fields/layouts/field/prepare/yesno.php @@ -0,0 +1,33 @@ +value; +if (! $value) +{ + return; +} + +$value = (array) $value; + +$texts = array(); +foreach (FieldsHelper::loadTypeObject($field->type, $field->context)->getOptions($field) as $index => $optionsValue) +{ + if (in_array($index, $value)) + { + $texts[] = $optionsValue; + } +} + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/render.php b/components/com_fields/layouts/field/render.php new file mode 100644 index 0000000000000..6e7a5ad3f293b --- /dev/null +++ b/components/com_fields/layouts/field/render.php @@ -0,0 +1,29 @@ +label; +$value = $field->value; +if (! $value) +{ + return; +} + +$class = $field->render_class; +?> + +
+ : + +
diff --git a/components/com_fields/layouts/fields/render.php b/components/com_fields/layouts/fields/render.php new file mode 100644 index 0000000000000..83ea80fb524b6 --- /dev/null +++ b/components/com_fields/layouts/fields/render.php @@ -0,0 +1,89 @@ +fields ? $item->fields : FieldsHelper::getFields($context, $item, true); +} + +if (! $fields) +{ + return; +} + +// Load some output definitions +$container = 'dl'; +if (key_exists('container', $displayData) && $displayData['container']) +{ + $container = $displayData['container']; +} +$class = 'article-info muted'; +if (key_exists('container-class', $displayData) && $displayData['container-class']) +{ + $class = $displayData['container-class']; +} + +// Print the container tag +echo '<' . $container . ' class="fields-container ' . $class . '">'; + +// Loop trough the fields and print them +foreach ($fields as $field) +{ + // If the value is empty dp nothing + if (! isset($field->value) || ! $field->value) + { + continue; + } + + echo FieldsHelper::render($context, 'field.render', + array( + 'field' => $field, + + // @deprecated use $field->label directly in the render + // layout of the field + 'label' => $field->label, + // @deprecated use $field->value directly in the render + // layout of the field + 'value' => $field->value, + // @deprecated use $field->render_class directly in the + // render layout of the field + 'class' => $field->render_class + )); +} + +// Close the container +echo ''; diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index 45b37744a63fb..bb2dcb4ad7df9 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -513,6 +513,7 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (30, 'com_contenthistory', 'component', 'com_contenthistory', '', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (31, 'com_ajax', 'component', 'com_ajax', '', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (32, 'com_postinstall', 'component', 'com_postinstall', '', 1, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(33, 'com_fields', 'component', 'com_fields', '', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (101, 'SimplePie', 'library', 'simplepie', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (102, 'phputf8', 'library', 'phputf8', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (103, 'Joomla! Platform', 'library', 'joomla', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), @@ -611,6 +612,7 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (452, 'plg_system_updatenotification', 'plugin', 'updatenotification', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (453, 'plg_editors-xtd_module', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (454, 'plg_system_stats', 'plugin', 'stats', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(455, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (503, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (504, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (506, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), @@ -1974,3 +1976,60 @@ INSERT INTO `#__viewlevels` (`id`, `title`, `ordering`, `rules`) VALUES (3, 'Special', 3, '[6,3,8]'), (5, 'Guest', 1, '[9]'), (6, 'Super Users', 4, '[8]'); + +CREATE TABLE IF NOT EXISTS `#__fields` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `asset_id` int(10) NOT NULL DEFAULT 0, + `context` varchar(255) NOT NULL DEFAULT '', + `catid` int(10) NOT NULL DEFAULT 0, + `assigned_cat_ids` varchar(255) NOT NULL DEFAULT '', + `title` varchar(255) NOT NULL DEFAULT '', + `alias` varchar(255) NOT NULL DEFAULT '', + `label` varchar(255) NOT NULL DEFAULT '', + `default_value` text NOT NULL DEFAULT '', + `type` varchar(255) NOT NULL DEFAULT 'text', + `render_class` varchar(255) NOT NULL DEFAULT '', + `class` varchar(255) NOT NULL DEFAULT '', + `options` varchar(255) NOT NULL DEFAULT '', + `note` varchar(255) NOT NULL DEFAULT '', + `description` text NOT NULL, + `state` tinyint(1) NOT NULL DEFAULT '0', + `required` tinyint(1) NOT NULL DEFAULT '0', + `checked_out` int(11) NOT NULL DEFAULT '0', + `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `ordering` int(11) NOT NULL DEFAULT '0', + `params` text NOT NULL, + `fieldparams` text NOT NULL, + `attributes` text NOT NULL, + `language` char(7) NOT NULL DEFAULT '', + `created_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created_user_id` int(10) unsigned NOT NULL DEFAULT '0', + `created_by_alias` varchar(255) NOT NULL DEFAULT '', + `version` int(10) unsigned NOT NULL DEFAULT '0', + `modified_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified_by` int(10) unsigned NOT NULL DEFAULT '0', + `publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `access` int(11) NOT NULL DEFAULT '1', + `hits` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_state` (`state`), + KEY `idx_created_user_id` (`created_user_id`), + KEY `idx_access` (`access`), + KEY `idx_context` (`context`), + KEY `idx_language` (`language`) +) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; + +CREATE TABLE IF NOT EXISTS `#__fields_values` ( + `field_id` int(10) unsigned NOT NULL, + `context` varchar(255) NOT NULL, + `item_id` varchar(255) NOT NULL, + `value` text NOT NULL DEFAULT '', + KEY (`field_id`), + KEY (`context`), + KEY (`item_id`) +) DEFAULT CHARSET=utf8 ; + +INSERT INTO `#__content_types` (`type_title`, `type_alias`, `table`, `rules`, `field_mappings`, `router`, `content_history_options`) VALUES +('Field', 'com_fields.field', '{"special":{"dbtable":"#__fields","key":"id","type":"Field","prefix":"FieldsTable","config":"array()"},"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Field","prefix":"FieldsTable","config":"array()"}}', '', '{"common":{"core_content_item_id":"id","core_title":"title","core_state":"state","core_alias":"alias","core_created_time":"created_time","core_modified_time":"modified_time","core_body":"description", "core_publish_up":"publish_up","core_publish_down":"publish_down","core_access":"access", "core_language":"language", "asset_id":"asset_id"}, "special":{}}', '', '{"formFile":"administrator\\/components\\/com_fields\\/models\\/forms\\/field.xml", "hideFields":["asset_id","checked_out", "checked_out_time"],"ignoreChanges":["modified_by", "modified_time", "checked_out", "checked_out_time"],"convertToInt":["publish_up", "publish_down"],"displayLookup":[{"sourceColumn":"created_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"},{"sourceColumn":"access","targetTable":"#__viewlevels","targetColumn":"id","displayColumn":"title"},{"sourceColumn":"modified_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"} ]}'); diff --git a/language/en-GB/en-GB.ini b/language/en-GB/en-GB.ini index bef1b624aa85a..27676670e25c3 100644 --- a/language/en-GB/en-GB.ini +++ b/language/en-GB/en-GB.ini @@ -149,6 +149,7 @@ JFIELD_PUBLISHED_DESC="Set publication status." JFIELD_TITLE_DESC="Title for the article." JGLOBAL_ARTICLES="Articles" +JGLOBAL_FIELDS="Fields" JGLOBAL_AUTH_ACCESS_DENIED="Access Denied" JGLOBAL_AUTH_ACCESS_GRANTED="Access Granted" JGLOBAL_AUTH_BIND_FAILED="Failed binding to LDAP server" diff --git a/media/com_fields/css/fotorama.min.css b/media/com_fields/css/fotorama.min.css new file mode 100644 index 0000000000000..8064fb729f216 --- /dev/null +++ b/media/com_fields/css/fotorama.min.css @@ -0,0 +1,4 @@ +/*! + * Fotorama 4.6.4 | http://fotorama.io/license/ + */ +.fotorama__arr:focus:after,.fotorama__fullscreen-icon:focus:after,.fotorama__html,.fotorama__img,.fotorama__nav__frame:focus .fotorama__dot:after,.fotorama__nav__frame:focus .fotorama__thumb:after,.fotorama__stage__frame,.fotorama__stage__shaft,.fotorama__video iframe{position:absolute;width:100%;height:100%;top:0;right:0;left:0;bottom:0}.fotorama--fullscreen,.fotorama__img{max-width:99999px!important;max-height:99999px!important;min-width:0!important;min-height:0!important;border-radius:0!important;box-shadow:none!important;padding:0!important}.fotorama__wrap .fotorama__grab{cursor:move;cursor:-webkit-grab;cursor:-o-grab;cursor:-ms-grab;cursor:grab}.fotorama__grabbing *{cursor:move;cursor:-webkit-grabbing;cursor:-o-grabbing;cursor:-ms-grabbing;cursor:grabbing}.fotorama__spinner{position:absolute!important;top:50%!important;left:50%!important}.fotorama__wrap--css3 .fotorama__arr,.fotorama__wrap--css3 .fotorama__fullscreen-icon,.fotorama__wrap--css3 .fotorama__nav__shaft,.fotorama__wrap--css3 .fotorama__stage__shaft,.fotorama__wrap--css3 .fotorama__thumb-border,.fotorama__wrap--css3 .fotorama__video-close,.fotorama__wrap--css3 .fotorama__video-play{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.fotorama__caption,.fotorama__nav:after,.fotorama__nav:before,.fotorama__stage:after,.fotorama__stage:before,.fotorama__wrap--css3 .fotorama__html,.fotorama__wrap--css3 .fotorama__nav,.fotorama__wrap--css3 .fotorama__spinner,.fotorama__wrap--css3 .fotorama__stage,.fotorama__wrap--css3 .fotorama__stage .fotorama__img,.fotorama__wrap--css3 .fotorama__stage__frame{-webkit-transform:translateZ(0);transform:translateZ(0)}.fotorama__arr:focus,.fotorama__fullscreen-icon:focus,.fotorama__nav__frame{outline:0}.fotorama__arr:focus:after,.fotorama__fullscreen-icon:focus:after,.fotorama__nav__frame:focus .fotorama__dot:after,.fotorama__nav__frame:focus .fotorama__thumb:after{content:'';border-radius:inherit;background-color:rgba(0,175,234,.5)}.fotorama__wrap--video .fotorama__stage,.fotorama__wrap--video .fotorama__stage__frame--video,.fotorama__wrap--video .fotorama__stage__frame--video .fotorama__html,.fotorama__wrap--video .fotorama__stage__frame--video .fotorama__img,.fotorama__wrap--video .fotorama__stage__shaft{-webkit-transform:none!important;transform:none!important}.fotorama__wrap--css3 .fotorama__nav__shaft,.fotorama__wrap--css3 .fotorama__stage__shaft,.fotorama__wrap--css3 .fotorama__thumb-border{transition-property:-webkit-transform,width;transition-property:transform,width;transition-timing-function:cubic-bezier(0.1,0,.25,1);transition-duration:0ms}.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__no-select,.fotorama__video-close,.fotorama__video-play,.fotorama__wrap{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fotorama__select{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.fotorama__nav,.fotorama__nav__frame{margin:auto;padding:0}.fotorama__caption__wrap,.fotorama__nav__frame,.fotorama__nav__shaft{-moz-box-orient:vertical;display:inline-block;vertical-align:middle;*display:inline;*zoom:1}.fotorama__nav__frame,.fotorama__thumb-border{box-sizing:content-box}.fotorama__caption__wrap{box-sizing:border-box}.fotorama--hidden,.fotorama__load{position:absolute;left:-99999px;top:-99999px;z-index:-1}.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__nav,.fotorama__nav__frame,.fotorama__nav__shaft,.fotorama__stage__frame,.fotorama__stage__shaft,.fotorama__video-close,.fotorama__video-play{-webkit-tap-highlight-color:transparent}.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__video-close,.fotorama__video-play{background:url(fotorama.png) no-repeat}@media (-webkit-min-device-pixel-ratio:1.5),(min-resolution:2dppx){.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__video-close,.fotorama__video-play{background:url(fotorama@2x.png) 0 0/96px 160px no-repeat}}.fotorama__thumb{background-color:#7f7f7f;background-color:rgba(127,127,127,.2)}@media print{.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__thumb-border,.fotorama__video-close,.fotorama__video-play{background:none!important}}.fotorama{min-width:1px;overflow:hidden}.fotorama:not(.fotorama--unobtrusive)>*:not(:first-child){display:none}.fullscreen{width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;margin:0!important;padding:0!important;overflow:hidden!important;background:#000}.fotorama--fullscreen{position:absolute!important;top:0!important;left:0!important;right:0!important;bottom:0!important;float:none!important;z-index:2147483647!important;background:#000;width:100%!important;height:100%!important;margin:0!important}.fotorama--fullscreen .fotorama__nav,.fotorama--fullscreen .fotorama__stage{background:#000}.fotorama__wrap{-webkit-text-size-adjust:100%;position:relative;direction:ltr;z-index:0}.fotorama__wrap--rtl .fotorama__stage__frame{direction:rtl}.fotorama__nav,.fotorama__stage{overflow:hidden;position:relative;max-width:100%}.fotorama__wrap--pan-y{-ms-touch-action:pan-y}.fotorama__wrap .fotorama__pointer{cursor:pointer}.fotorama__wrap--slide .fotorama__stage__frame{opacity:1!important}.fotorama__stage__frame{overflow:hidden}.fotorama__stage__frame.fotorama__active{z-index:8}.fotorama__wrap--fade .fotorama__stage__frame{display:none}.fotorama__wrap--fade .fotorama__fade-front,.fotorama__wrap--fade .fotorama__fade-rear,.fotorama__wrap--fade .fotorama__stage__frame.fotorama__active{display:block;left:0;top:0}.fotorama__wrap--fade .fotorama__fade-front{z-index:8}.fotorama__wrap--fade .fotorama__fade-rear{z-index:7}.fotorama__wrap--fade .fotorama__fade-rear.fotorama__active{z-index:9}.fotorama__wrap--fade .fotorama__stage .fotorama__shadow{display:none}.fotorama__img{-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0);opacity:0;border:none!important}.fotorama__error .fotorama__img,.fotorama__loaded .fotorama__img{-ms-filter:"alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1}.fotorama--fullscreen .fotorama__loaded--full .fotorama__img,.fotorama__img--full{display:none}.fotorama--fullscreen .fotorama__loaded--full .fotorama__img--full{display:block}.fotorama__wrap--only-active .fotorama__nav,.fotorama__wrap--only-active .fotorama__stage{max-width:99999px!important}.fotorama__wrap--only-active .fotorama__stage__frame{visibility:hidden}.fotorama__wrap--only-active .fotorama__stage__frame.fotorama__active{visibility:visible}.fotorama__nav{font-size:0;line-height:0;text-align:center;display:none;white-space:nowrap;z-index:5}.fotorama__nav__shaft{position:relative;left:0;top:0;text-align:left}.fotorama__nav__frame{position:relative;cursor:pointer}.fotorama__nav--dots{display:block}.fotorama__nav--dots .fotorama__nav__frame{width:18px;height:30px}.fotorama__nav--dots .fotorama__nav__frame--thumb,.fotorama__nav--dots .fotorama__thumb-border{display:none}.fotorama__nav--thumbs{display:block}.fotorama__nav--thumbs .fotorama__nav__frame{padding-left:0!important}.fotorama__nav--thumbs .fotorama__nav__frame:last-child{padding-right:0!important}.fotorama__nav--thumbs .fotorama__nav__frame--dot{display:none}.fotorama__dot{display:block;width:4px;height:4px;position:relative;top:12px;left:6px;border-radius:6px;border:1px solid #7f7f7f}.fotorama__nav__frame:focus .fotorama__dot:after{padding:1px;top:-1px;left:-1px}.fotorama__nav__frame.fotorama__active .fotorama__dot{width:0;height:0;border-width:3px}.fotorama__nav__frame.fotorama__active .fotorama__dot:after{padding:3px;top:-3px;left:-3px}.fotorama__thumb{overflow:hidden;position:relative;width:100%;height:100%}.fotorama__nav__frame:focus .fotorama__thumb{z-index:2}.fotorama__thumb-border{position:absolute;z-index:9;top:0;left:0;border-style:solid;border-color:#00afea;background-image:linear-gradient(to bottom right,rgba(255,255,255,.25),rgba(64,64,64,.1))}.fotorama__caption{position:absolute;z-index:12;bottom:0;left:0;right:0;font-family:'Helvetica Neue',Arial,sans-serif;font-size:14px;line-height:1.5;color:#000}.fotorama__caption a{text-decoration:none;color:#000;border-bottom:1px solid;border-color:rgba(0,0,0,.5)}.fotorama__caption a:hover{color:#333;border-color:rgba(51,51,51,.5)}.fotorama__wrap--rtl .fotorama__caption{left:auto;right:0}.fotorama__wrap--no-captions .fotorama__caption,.fotorama__wrap--video .fotorama__caption{display:none}.fotorama__caption__wrap{background-color:#fff;background-color:rgba(255,255,255,.9);padding:5px 10px}@-webkit-keyframes spinner{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spinner{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.fotorama__wrap--css3 .fotorama__spinner{-webkit-animation:spinner 24s infinite linear;animation:spinner 24s infinite linear}.fotorama__wrap--css3 .fotorama__html,.fotorama__wrap--css3 .fotorama__stage .fotorama__img{transition-property:opacity;transition-timing-function:linear;transition-duration:.3s}.fotorama__wrap--video .fotorama__stage__frame--video .fotorama__html,.fotorama__wrap--video .fotorama__stage__frame--video .fotorama__img{-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0);opacity:0}.fotorama__select{cursor:auto}.fotorama__video{top:32px;right:0;bottom:0;left:0;position:absolute;z-index:10}@-moz-document url-prefix(){.fotorama__active{box-shadow:0 0 0 transparent}}.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__video-close,.fotorama__video-play{position:absolute;z-index:11;cursor:pointer}.fotorama__arr{position:absolute;width:32px;height:32px;top:50%;margin-top:-16px}.fotorama__arr--prev{left:2px;background-position:0 0}.fotorama__arr--next{right:2px;background-position:-32px 0}.fotorama__arr--disabled{pointer-events:none;cursor:default;*display:none;opacity:.1}.fotorama__fullscreen-icon{width:32px;height:32px;top:2px;right:2px;background-position:0 -32px;z-index:20}.fotorama__arr:focus,.fotorama__fullscreen-icon:focus{border-radius:50%}.fotorama--fullscreen .fotorama__fullscreen-icon{background-position:-32px -32px}.fotorama__video-play{width:96px;height:96px;left:50%;top:50%;margin-left:-48px;margin-top:-48px;background-position:0 -64px;opacity:0}.fotorama__wrap--css2 .fotorama__video-play,.fotorama__wrap--video .fotorama__stage .fotorama__video-play{display:none}.fotorama__error .fotorama__video-play,.fotorama__loaded .fotorama__video-play,.fotorama__nav__frame .fotorama__video-play{opacity:1;display:block}.fotorama__nav__frame .fotorama__video-play{width:32px;height:32px;margin-left:-16px;margin-top:-16px;background-position:-64px -32px}.fotorama__video-close{width:32px;height:32px;top:0;right:0;background-position:-64px 0;z-index:20;opacity:0}.fotorama__wrap--css2 .fotorama__video-close{display:none}.fotorama__wrap--css3 .fotorama__video-close{-webkit-transform:translate3d(32px,-32px,0);transform:translate3d(32px,-32px,0)}.fotorama__wrap--video .fotorama__video-close{display:block;opacity:1}.fotorama__wrap--css3.fotorama__wrap--video .fotorama__video-close{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__arr,.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon{opacity:0}.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__arr:focus,.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon:focus{opacity:1}.fotorama__wrap--video .fotorama__arr,.fotorama__wrap--video .fotorama__fullscreen-icon{opacity:0!important}.fotorama__wrap--css2.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__arr,.fotorama__wrap--css2.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon{display:none}.fotorama__wrap--css2.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__arr:focus,.fotorama__wrap--css2.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon:focus{display:block}.fotorama__wrap--css2.fotorama__wrap--video .fotorama__arr,.fotorama__wrap--css2.fotorama__wrap--video .fotorama__fullscreen-icon{display:none!important}.fotorama__wrap--css3.fotorama__wrap--no-controls.fotorama__wrap--slide.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon:not(:focus){-webkit-transform:translate3d(32px,-32px,0);transform:translate3d(32px,-32px,0)}.fotorama__wrap--css3.fotorama__wrap--no-controls.fotorama__wrap--slide.fotorama__wrap--toggle-arrows .fotorama__arr--prev:not(:focus){-webkit-transform:translate3d(-48px,0,0);transform:translate3d(-48px,0,0)}.fotorama__wrap--css3.fotorama__wrap--no-controls.fotorama__wrap--slide.fotorama__wrap--toggle-arrows .fotorama__arr--next:not(:focus){-webkit-transform:translate3d(48px,0,0);transform:translate3d(48px,0,0)}.fotorama__wrap--css3.fotorama__wrap--video .fotorama__fullscreen-icon{-webkit-transform:translate3d(32px,-32px,0)!important;transform:translate3d(32px,-32px,0)!important}.fotorama__wrap--css3.fotorama__wrap--video .fotorama__arr--prev{-webkit-transform:translate3d(-48px,0,0)!important;transform:translate3d(-48px,0,0)!important}.fotorama__wrap--css3.fotorama__wrap--video .fotorama__arr--next{-webkit-transform:translate3d(48px,0,0)!important;transform:translate3d(48px,0,0)!important}.fotorama__wrap--css3 .fotorama__arr:not(:focus),.fotorama__wrap--css3 .fotorama__fullscreen-icon:not(:focus),.fotorama__wrap--css3 .fotorama__video-close:not(:focus),.fotorama__wrap--css3 .fotorama__video-play:not(:focus){transition-property:-webkit-transform,opacity;transition-property:transform,opacity;transition-duration:.3s}.fotorama__nav:after,.fotorama__nav:before,.fotorama__stage:after,.fotorama__stage:before{content:"";display:block;position:absolute;text-decoration:none;top:0;bottom:0;width:10px;height:auto;z-index:10;pointer-events:none;background-repeat:no-repeat;background-size:1px 100%,5px 100%}.fotorama__nav:before,.fotorama__stage:before{background-image:linear-gradient(transparent,rgba(0,0,0,.2) 25%,rgba(0,0,0,.3) 75%,transparent),radial-gradient(farthest-side at 0 50%,rgba(0,0,0,.4),transparent);background-position:0 0,0 0;left:-10px}.fotorama__nav.fotorama__shadows--left:before,.fotorama__stage.fotorama__shadows--left:before{left:0}.fotorama__nav:after,.fotorama__stage:after{background-image:linear-gradient(transparent,rgba(0,0,0,.2) 25%,rgba(0,0,0,.3) 75%,transparent),radial-gradient(farthest-side at 100% 50%,rgba(0,0,0,.4),transparent);background-position:100% 0,100% 0;right:-10px}.fotorama__nav.fotorama__shadows--right:after,.fotorama__stage.fotorama__shadows--right:after{right:0}.fotorama--fullscreen .fotorama__nav:after,.fotorama--fullscreen .fotorama__nav:before,.fotorama--fullscreen .fotorama__stage:after,.fotorama--fullscreen .fotorama__stage:before,.fotorama__wrap--fade .fotorama__stage:after,.fotorama__wrap--fade .fotorama__stage:before,.fotorama__wrap--no-shadows .fotorama__nav:after,.fotorama__wrap--no-shadows .fotorama__nav:before,.fotorama__wrap--no-shadows .fotorama__stage:after,.fotorama__wrap--no-shadows .fotorama__stage:before{display:none} \ No newline at end of file diff --git a/media/com_fields/css/fotorama.png b/media/com_fields/css/fotorama.png new file mode 100644 index 0000000000000000000000000000000000000000..b59419a93109ba6d3f60a223246cfa87f9c93b2b GIT binary patch literal 3223 zcmV;I3~2L-P)n&2PGd29UB)tD>FkQcPRFy-!)NjMUP+4J#A1h zwnIx}ZEFwxYT8JU>4tw@R$A3F;FXwWJ(d2sXRUlCamJ4c%`@zE?QZg-TY8^Kg~1uD zNw{bnb=MmcgxJjS+W-IxrAb6VRA}DpS?f~TP!Mhs5<;#dff|7#Eh06dI6xgyywFxF zVr{kK{nE~K=7jfug6X$4?h9rPp75y-V zesGUThHD3hyJb%@6UnHLrsS1(4+GmZBw0<3Dh1=P-vw}41{a(CWpsn{0^IlP=e6}k zvgH_p8nvMchO^*{@j(WvuMXCic@N+lMWa-i&#n*A0QikW7h! z(d~aCpEjmy)c!uGQxX4UMc=Pc_bEWurZxZ}PhM;UE(U<_vk;}`(js{{09jmWN+PwvQeYth*njCm zc#yww0;B-IwQ7(bJO_*AZ(J!#h>#+zpBIoNmZEVUvZ7bf{sx{yKk(=wkFQJZ>M1FwSuezAYbja3kPi=pHv|3dgx{OyOqRfdGV*rVD4RD^oOOQw0^6 zP|cg|Ip(E5q#W$`_-PAAVID)gp5#gXt<-lamDAHoWvBjo{vK1uztUe+HcuM)Fw8ej zHY*puxgDq|!&c_?v`_h#+pF{%1!pk$G5eH%NHd?tH7KQhVP!?aPof+V>#b zZUo=*9Z!L&f1kctwQaxKg{{N%dshvz*z45Q+pEo9r?*HNSA3R$V>ZiM^QF@KR+a6X z$ks8+g_UBh)r#mV*JQE1gUQ7^2tw>^E|TjC2LJ}D1%iTGbI3d*yVuH zLUb-kqr#P_Y}m!g7dOnsivlD;FQzrWMDe$4_8mZdlMLE*;Er42`{Sdc?`l{9d+h<) ztVioxHNik_JEQ=;rkCqMO!yuad*zi$xgJs zg|wju>w_?a80KwEQM5mxf}LDx5Ml%?HlD#SLucRAw0A?y1_1F|hZ_5KhB=DXx2D?w zFu+sXaxn!X{h>QP08oTN6{_g=2=b7NpQt4ys%lFnWG-JBt?wYn*4BYstrW@zmSMC% zEGw7G9+gU1#^vT+ADo7yortjSaCV_1i)|8~^7UQI27zze)h5y_)?lm$Q6I zza9j@*LPs+8cYI#jtag%=5w~AYnqa#`uG&_^&RL&8fV!J0b>18yXlWo&H?K%44FRe zkP+ag`iAlpaT;U8GXTT6>koKYjC@XsEmMqu!qfV;>GdZ$IwI~Ouspn+u?ONCjgkLo zeMbShEzq+5U=lwnr~xGZAjA6RXA}Z({Q(j;>=^m4Vj0r<7E>Gm>RT=rvdIx?Qe6;ucQyhGxL3WcAHm4scVB_Q%6lW^~!#clWv5^_>1;OP|pdR-*h3 zW28S~Xv-fGE?yl^y#66|e3B>mKLwfHos9cR4yKXViKa>Cktx!hnHmoWWsM^8I!RFs zDvBcE+85d2dc08Ul=XSK>)5yAxVlG2H^ul%^I+ZZT-(pRE@ml`d6&j1XB zc)WR0P8*tQ=bmTgKEIt^J;(zy9^?;JXWxFF%RJA)h6fTQ0>op@gY!7xD}FQdrJpZ4aVQAArDrAM~7TW@eiFR;Fh%S;u2v z3jf4?*UBucGH-VaOAF~gAvHA{-sXF{Ri1#-$pUlt zty~rgYNFhl9%^T&@UJOKH{yhStk-`qY6ZKA!$5Q^s-QqIII*1wP$HHU4NZl*QUi#J z3+<_gib}n&+6(*tU$B0YWxdg;aed*CWS(c<%P^jaQ0Iw4b;y;0Ec>>uu`7=IkgZYq zp*l|!l%RsQ`(^u)o-ON#_nX8BXg;t_)4!|J3Gi+RlWg|&UCWt{{0OdBFNkI}Vo@S5 zJ=pDW7GP-<>jik)80jXVkoooXi;QppZGphNRhkW+U+8!Q|G5KFK?wUK#VFT37tcR7 zw>Lt@tq>vl5y>7BRFYiaEz9w?b|4DuVcv}xsnhfQ*Q^x+?SLSvUD%G%&)^hC8Az(& zfa}(w4`cxV@v|MGODWNf;DK<87|#*sGIb<43f_qycZmUbA+SwS$~%$J#O@amz%wWaIl$K- zLXhwbDHeUip=l>uo+aGn0A2`Z22xoz&48XjQleWI_~3y9v_ZJK10P2eYf5-BfK-|y zdbL+pNK`EV93pjJ5fICIWiPx!Moj?w9#0@5q>*oa00(h<^Iyq`ga#Q+?7Q3qK%zi3 zv=hCH%T@pmv3vQK-7hbCVuuO|$$|mkH7HXb0AC-QKg8J!4FDhrMbR2|unhgvFxZH2 zAOV}o`&{cUVFtWki?A|)9}&M~|4jL!X{qpH2jx0iuC?KC%jBldV~Y-6JUa65%j3H) zAiP5963A<;F5(;|Xc)qAjs{X1sc|T%v8D#I8ZF<$@f>Bt`-5YGg8V6#!81uj)-=~( zo2bK>YD`3(YD`3$Y6Loea88yIJKa0DC#>;LxeuL11EXMQ0|3I4T$5)+Z9B&0)8YLFC=?(RQuloXH@7<%Z2 zA?MHkeb)PYc=wmP_dfTmbI$#8*IhSOM@xm2h@J=l08%woCB3^92>>8C0nQzp?+t%> zCuDUr43zKWe*gl3{+9ya|G|Id{~_$`?EiKCn-v%s$icyJ=ifQR#Kiw0caDL90RscW z9l7)M^z;Y`2@MSmZES4r-@pIh!2<*WVQg${WMrhJrRD4E>*nURy1II|K}JSqc6K%( zAYgoayt}*mdN)ir^YwmO>1tMw1Oa8n}ohUqTydcn(_wCAE*hDn#_ffg|sQ1 z(^tL~%ML@VeYVNNqZf2&^SV;7%kC%-d7Gy?I;|kjko7E)dZ=5*l;i%hk}TYC%}QZ8|zilZ zPvuz6)Ys>USRi^^-lXG*IPoHF)LJes9}RFa?I(Tpyr)og^b`|}2abD)uQGyIHrFzP-jL@W9}W%2x&cy&dfg#zIxJ<(}wt4@MIlFz}?U&_Y0% z8K|gSK?!E*rk&*@6exzkRj>?NNPu;;;mS1XR*V6r`Y$sQ_`8em6t$bo?kM*>-&f1{ zb2Z4ZcGu@+0zC<9oFL>WPO}IEBJfKx_?DOlM#qoBe0i7zjlPP$e7{jQ1o}N2JTRx- z+IFMMGRx0He|BvHui*jWA)1|H32-(Aw2CxDdQkkO0l^g^GKZ0d@~6P;`ytb6lq zMNoZ^2pH90_goHQHDFCoWEYGyF{K#nWAW2To6*1oGmpH4tCvIfI;M0@-3x|M>`F@TjX$6z1E_#@3L=)+xf*<_ zl2wpigkINIs{DM*?;ZpE#aV=fH@1)z?;oqU{EACC z|J=8ZZ;;YN99{%>Kkp)0iRRU#D?~od<_5_{*eq>CKbz zek?w0&gXVXk`e0I7%cLw#2&j~G$oB{z6S>4)B9xPF{4=)0CP@!vQJj(8>wzB&`Yk* zg@q}}2VRevkj!I#mC;6MO)Tl)3A}=xiPy%)c*6*n^cpjKs^38LZ()%TKbgAPj>$2{ z(gl8@*f|$rLRT3U>8N!p`BLKz@g~FLAN$G|Y*cfFvsy(N(?=xQ`%ggM9-v+gx_!imamvDIzIogaW;=@55Z5t)) z?#fqtXxn|9`uv&=zt&7UGkl_M*|h(;e}LiKJM9VIsZWI&n)N0(2=uGZ%jcp#@6{C& z!>k|2?`iPVe_3OVGyx5_`e`Q9rx=8SsB5?Vr&oTYP~R-gGc{k3lSyZ!{|EW(sk>L1 zz1h|m9ZaVAv`^8-ywPjX8^=y|)0IJAPfTpd#p{|)it(>Fh@Tb&9}qI6u=o%2MX&TC zEZmm`+%sIS6JA3x!M_zPVvY*EI+q9^M{wnL)QdsfW}hp}))U`K+RQe1ueXBN8`5@4 zPxKAKP2#_l7c)B2jRhy_s6N#zZ1?f!JHPPEs|iD7IGPtKZ|=4W$jJy96eny@hUDXG zT7f5S(r%tt<0IAn$wdjL_JTY7|5+o+2r~H=RY0Gq3#-al)+~j@03K)CPx2w3f`3a1 z&eb4RW2cIWoVacp(@d`;3MBIc)W^C1jp{%AJ7QHV|R8Fxs8@Z43)6gCh1qoEf(CPfb=?Cy)gbcXw`EO! zB8>SC6yG3j$X&HC)|fZBcDn4BZ0WKFg0*iAF<30f)@zS(HZrs)(6t~pWoXE|`SW?8 z@M1<3V-P?#jO4$!-MYh=&YrdW^XV0ov}S7lo5U3vft^9;@^wyI*L5eiXplx^XIh5z zi*GZ^X_~eaQo7oxOV=9Duwu`DgHc1@-yVwPjf*?IurT-_#bng!q~Z24==BX>xyzMz z=7>yGi0#gV!I5_FK927z$c5#lZVbf($-TJYhjX$1KzDhEmi<@mt&xpDr4T1V|3K}f z`QEEwEvCbrf0hI>dO5ZS%BN4JT((e`;u}S}i~0_FoSFm6bVpvM5ZyH* zuPFAAdnou%tjrZ2!ff$iu_7ci-=Y?wO~4CPkB0t4yh3xT(SMB z6v;%DXF`?1*1{?NG_}JF7nRP8jHGv2Ym*EM-&d^Os(_x2xsJe1N7=U_3bimiR>lI0(6xf07`~)*bhDgHNV!83m2YohUtKN> z6~*Ov0YppcX}BxJ3Qhuj51-~kF?&M@;-0Ivg|*gS)SpjNU{;YIDX@dK;G%M){f}Hn z=SE@#ii zlDN;?RKa3dd-D->dAr!E#!5@o$EuImtE(9M&^HYsUwk*F~of+KZ|P;guLNH z@n8^`mwB1FB-gyMU~tjcw6?X@UP>(~ISoSKDwR|*wBFu&tz7jMBY4@xegpr5$LGMN zb}ZL;_y`A45~K=16^>8&fN5PS9C++?d+q6A$a@{VKZ{-iAh zrX#vSBBw4NfMTwMSNDlA&ze6rP^sI64zd(E5bViuA-3^<%gu>2IB2XBbfW(rx9-Tg zH%D6C*0q8Ts{DFY-AbC2)FwBhHv=TzL5{dEJ&D5C4GY#3!olZGhv$||Fe>?1TACDI zqcwlX#i(^4fI9PXMbqFd^NP1y!td+%K$(@x$XMmOAVjy&Zom%VOAPi<`AMd9^Wfq$ z&#ez|7jKUbz^79jP?61`<+i!8cp2s3V))#3``X&(Gp|7z2OZ~H7J8s4f%fSMO%SbB z5~yZ1~y$GYYs=OD&7gJ?CO? zE;}D$K_ImA8BphGbz}={pM)E${bI`p@gAPz%-rUH7BAjxOB*ik-}OPm(cm?@2U% z1v@9rS`469X>bG%&a$x|OGIU7cNHH0Pnh#wtVD^VRcX%me54tYPM^XN%r zJYl4s;zN%a*|0z?EjmXcN2FFX9X5%~*A%EezOkgfmB5yXx_K#7eIF;g$(deDj5S@z zH`y8c{lEAaFL*G{u(!Y(?W*9q~W1^-s_qsd;GI= z*rKY;y|0$t#4!49__cI*hkv&1gm&*=ItgJRUshWpGEGp7cT@*O?%5`@uH2fb1bH|t zam9#WNfCooriTrhYo!n(ED1lHqtoaRRmX1?ZSjr%IPtGdVERhAwtCXeHCQ}-m0 zNPj`sctd6vY0O)_`vl1MXD>2po?Kim?YYMGtYOzy=DQ^q4UW{^L%>i=6=BD$VrR&# zZNI^Lwy2Ozjw0WeG+E7_@lO2ldX#M0Fq|bfh7McE=Zx+fk#+Ya=JhloXFq4XRckPT zK>oJCEK6V2<<(<>QpcTAj0F!WD1(37*&(MM3DclnL#cVp&)F)ynwQ?A?xp4K_(ylX zXgjUS8;%sxFfD)MCy%njKM%K^4O+Ec(+^B9_&pde0)8IqTb@KnR%jtEYmN-kYnxQr z{;C?%fZ(V;zCs^7e3w+$G57}S6JfGt=<;efeFw8-`FmfIw)jBid!2D%*3{oEWzLy^ zf(J*|hNjJOrc-0b%05fqY$)iHOSJ|@E+*Bs{AaSx3ggumj&B%td%Ta@YvMNeDTGF} zxe_u(Xo`)oE!S=S3;nIL3mjpvn%8a}9Fy^ptLR_r&nYU)AByy56Gf;JRYB!`o1?K< zoZ+2?;T=!yr!O_W>}3U&?6@CGAAkBcoZ#%xwsJ(>l(c~RF3O2)lbjbb9tpu|yZ1xf zbP_W+*SM4_3T72Qxi#fqSb3iMVa^kt_cv$qp$(C5#or$g>Pf*GoALRme!(d~Kfe|% zS=;>P`IjV9XEOyC)Xhq78K?B^l5$b+LutQ%(vI^s!$#mXr*6N*-q4{&5MCIdsDX28 zPSQny(%p=bcN@KN*LOi+PqxVRv!)~sBL_s1XAL5jN{(s*SA{0QJ1*^QrP0-Ia((Mn zS)lSq6T2*%r6*fSr((0^xNFMcQPs?iWPR3t*rWOKw3TvAxs!D=@)xgI6B)xQ@D)(2 z#3w43Co~!Srl_;GZWraI&yB6|3C-4?iCh1j46+=55#h2?c$)GQ2H{!@-|Hkj85tWg zjFi?V9o(O8`y_wL$16=#Vx1K8&B-a{$ZwJl7dXJdOG2>e0o0tFV5K5S`PXkEnmB&5_o}KTR3kg|ROVs9$e_d|-npE~iy1iq(_Myiyn$!~M||}GhVp^iqK^@$P>Rum515H;B!CXU&7 z_*1~It4-vZ!mT$ZV5%YJv}yDyo|G!bshIr>T!GRX{FmwheZ2%WhWEd0(oZl$z#t8Y zpki#}C!%wfWMm7;i8AA#a#*;GDg=muD^el@vT2??yB4m%^HECjdtOuh+xiUJ*|frcelb9*PgVSw0ZYwz4NeO&Um212Y)u&c<}?+&uvDG$ z$?0Kq@J?dLJ9BNk6%T|*Lfy$ZNeB@qpVQWgB(2dut#p`@H9x}`^On&QdGWMu2#LT7 z0Rk6FO?P&#UNi1`__fgr3;vi63Kq*oab$CF(xWP83~f)S{T_t+V0WZ{zfmKvDy#(L zJ%TfpWIo;IY&}Vqrt0V87C=smf6ir&T)W+kWhfX}I*fzJcVs#;V#EbP&(}VIb0rv1 zt*3B~5JbW>J6ipu_axbOGKIBYsG$HYl?QXiqlI4Td53Kb^_C7fg=mgHoA2l{p^6ewCu7ll{pER-u=A3em#8_}!_#Z(m$ zisxz?ET&{ja6H2>w8EyAK9Pl}<-TI6d>=(3kB6EqYhb_R9GG@K08!eow49JahhMJ+ z!4IJdRJ^~^N)oE{tHqgUWLw-$TA%yAY4-yr^mypOINZMZ)ec-e_oScZzI`NwR(|wM zPLidDmB5{@hGkMF?0jYBf3$96~Vku;$3?pA`olAa=r5V@HJ`_u+45f_`5i z$YN#DnxBifrSS>J@gsBoH9~*j6ABgRi}2+-_miu!e+-o$lzG<)z~~jwB)ai~tn`hK zUC2waw^A?1`9QSmV?PxMszx<`F`QBNeA0<8UekCW;QCFFNS}Zj=use`0w?q(5mV{k zqvLz_&Abu9_r)5jiV20FilFemOvT(LuoWj?3}v=H_4as$5^xCpVLMY{^aP7bk-pd5 zZGo9cr*ss%50{46e12H1B|+!?JLF5APrVFbz|_llSq_jmFNAhL=w_a(%Ypr;X=P*X zennP#G_B*4yPSxW;mGD3*~znhJl*b%Vu%&s3bmrhC+6|WNvvP`EMhzL04F9I+HxW- zQ(cL%fJY;w-aD>#?9(3;ybA$f%nID#LC(5)6&0P#T@OWT#^HMwoTOa-KuknRO5BDC zReGZj7oe&f>zSfXW%K{*wP0mN%T!fW9{^~-EBiGmR@D!dKtGgz$zjoi_rl5U!zEq1 z7tru&N$EAOI4ea6NmqyKYNtO-OR*pq)rV&@6nF`=@BjEJ(Snd%Y=A1%Ow?3L_Iio+ zpO)DC=>0eHb5;1LA4pO|OVh9bBYgKFn>bOc(@&}#)O4}`pp@?opIt#B$ur`;Xxmg253ue)FsJr4;o3N>AF?Y z4qWJ1Mpkg%`6y+O6CMk`mF6B%xp$};r}M?cW2mYnpgaY$BtP9^K=z=vgVpO`uz zve%L_b>-2UhCXWvdy~vVdRp@`DxLcmLRBHd1GFD;)4e(j4w@!i=f5Ux&wWV(HQK=6 z(x(jIopgY@+~i$NQxa%J_6h&oZfZAmb@&hGOSs=M;Fcn&QviUN`PJz3x-Q$@{}`aA Ltff?^fC&44O4i*W literal 0 HcmV?d00001 diff --git a/media/com_fields/js/fotorama.min.js b/media/com_fields/js/fotorama.min.js new file mode 100644 index 0000000000000..5081132a164ef --- /dev/null +++ b/media/com_fields/js/fotorama.min.js @@ -0,0 +1,5 @@ +/*! + * Fotorama 4.6.4 | http://fotorama.io/license/ + */ +fotoramaVersion="4.6.4",function(a,b,c,d,e){"use strict";function f(a){var b="bez_"+d.makeArray(arguments).join("_").replace(".","p");if("function"!=typeof d.easing[b]){var c=function(a,b){var c=[null,null],d=[null,null],e=[null,null],f=function(f,g){return e[g]=3*a[g],d[g]=3*(b[g]-a[g])-e[g],c[g]=1-e[g]-d[g],f*(e[g]+f*(d[g]+f*c[g]))},g=function(a){return e[0]+a*(2*d[0]+3*c[0]*a)},h=function(a){for(var b,c=a,d=0;++d<14&&(b=f(c,0)-a,!(Math.abs(b)<.001));)c-=b/g(c);return c};return function(a){return f(h(a),1)}};d.easing[b]=function(b,d,e,f,g){return f*c([a[0],a[1]],[a[2],a[3]])(d/g)+e}}return b}function g(){}function h(a,b,c){return Math.max(isNaN(b)?-1/0:b,Math.min(isNaN(c)?1/0:c,a))}function i(a){return a.match(/ma/)&&a.match(/-?\d+(?!d)/g)[a.match(/3d/)?12:4]}function j(a){return Ic?+i(a.css("transform")):+a.css("left").replace("px","")}function k(a){var b={};return Ic?b.transform="translate3d("+a+"px,0,0)":b.left=a,b}function l(a){return{"transition-duration":a+"ms"}}function m(a,b){return isNaN(a)?b:a}function n(a,b){return m(+String(a).replace(b||"px",""))}function o(a){return/%$/.test(a)?n(a,"%"):e}function p(a,b){return m(o(a)/100*b,n(a))}function q(a){return(!isNaN(n(a))||!isNaN(n(a,"%")))&&a}function r(a,b,c,d){return(a-(d||0))*(b+(c||0))}function s(a,b,c,d){return-Math.round(a/(b+(c||0))-(d||0))}function t(a){var b=a.data();if(!b.tEnd){var c=a[0],d={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",msTransition:"MSTransitionEnd",transition:"transitionend"};T(c,d[uc.prefixed("transition")],function(a){b.tProp&&a.propertyName.match(b.tProp)&&b.onEndFn()}),b.tEnd=!0}}function u(a,b,c,d){var e,f=a.data();f&&(f.onEndFn=function(){e||(e=!0,clearTimeout(f.tT),c())},f.tProp=b,clearTimeout(f.tT),f.tT=setTimeout(function(){f.onEndFn()},1.5*d),t(a))}function v(a,b){if(a.length){var c=a.data();Ic?(a.css(l(0)),c.onEndFn=g,clearTimeout(c.tT)):a.stop();var d=w(b,function(){return j(a)});return a.css(k(d)),d}}function w(){for(var a,b=0,c=arguments.length;c>b&&(a=b?arguments[b]():arguments[b],"number"!=typeof a);b++);return a}function x(a,b){return Math.round(a+(b-a)/1.5)}function y(){return y.p=y.p||("https:"===c.protocol?"https://":"http://"),y.p}function z(a){var c=b.createElement("a");return c.href=a,c}function A(a,b){if("string"!=typeof a)return a;a=z(a);var c,d;if(a.host.match(/youtube\.com/)&&a.search){if(c=a.search.split("v=")[1]){var e=c.indexOf("&");-1!==e&&(c=c.substring(0,e)),d="youtube"}}else a.host.match(/youtube\.com|youtu\.be/)?(c=a.pathname.replace(/^\/(embed\/|v\/)?/,"").replace(/\/.*/,""),d="youtube"):a.host.match(/vimeo\.com/)&&(d="vimeo",c=a.pathname.replace(/^\/(video\/)?/,"").replace(/\/.*/,""));return c&&d||!b||(c=a.href,d="custom"),c?{id:c,type:d,s:a.search.replace(/^\?/,""),p:y()}:!1}function B(a,b,c){var e,f,g=a.video;return"youtube"===g.type?(f=y()+"img.youtube.com/vi/"+g.id+"/default.jpg",e=f.replace(/\/default.jpg$/,"/hqdefault.jpg"),a.thumbsReady=!0):"vimeo"===g.type?d.ajax({url:y()+"vimeo.com/api/v2/video/"+g.id+".json",dataType:"jsonp",success:function(d){a.thumbsReady=!0,C(b,{img:d[0].thumbnail_large,thumb:d[0].thumbnail_small},a.i,c)}}):a.thumbsReady=!0,{img:e,thumb:f}}function C(a,b,c,e){for(var f=0,g=a.length;g>f;f++){var h=a[f];if(h.i===c&&h.thumbsReady){var i={videoReady:!0};i[Xc]=i[Zc]=i[Yc]=!1,e.splice(f,1,d.extend({},h,i,b));break}}}function D(a){function b(a,b,e){var f=a.children("img").eq(0),g=a.attr("href"),h=a.attr("src"),i=f.attr("src"),j=b.video,k=e?A(g,j===!0):!1;k?g=!1:k=j,c(a,f,d.extend(b,{video:k,img:b.img||g||h||i,thumb:b.thumb||i||h||g}))}function c(a,b,c){var e=c.thumb&&c.img!==c.thumb,f=n(c.width||a.attr("width")),g=n(c.height||a.attr("height"));d.extend(c,{width:f,height:g,thumbratio:S(c.thumbratio||n(c.thumbwidth||b&&b.attr("width")||e||f)/n(c.thumbheight||b&&b.attr("height")||e||g))})}var e=[];return a.children().each(function(){var a=d(this),f=R(d.extend(a.data(),{id:a.attr("id")}));if(a.is("a, img"))b(a,f,!0);else{if(a.is(":empty"))return;c(a,null,d.extend(f,{html:this,_html:a.html()}))}e.push(f)}),e}function E(a){return 0===a.offsetWidth&&0===a.offsetHeight}function F(a){return!d.contains(b.documentElement,a)}function G(a,b,c,d){return G.i||(G.i=1,G.ii=[!0]),d=d||G.i,"undefined"==typeof G.ii[d]&&(G.ii[d]=!0),a()?b():G.ii[d]&&setTimeout(function(){G.ii[d]&&G(a,b,c,d)},c||100),G.i++}function H(a){c.replace(c.protocol+"//"+c.host+c.pathname.replace(/^\/?/,"/")+c.search+"#"+a)}function I(a,b,c,d){var e=a.data(),f=e.measures;if(f&&(!e.l||e.l.W!==f.width||e.l.H!==f.height||e.l.r!==f.ratio||e.l.w!==b.w||e.l.h!==b.h||e.l.m!==c||e.l.p!==d)){var g=f.width,i=f.height,j=b.w/b.h,k=f.ratio>=j,l="scaledown"===c,m="contain"===c,n="cover"===c,o=$(d);k&&(l||m)||!k&&n?(g=h(b.w,0,l?g:1/0),i=g/f.ratio):(k&&n||!k&&(l||m))&&(i=h(b.h,0,l?i:1/0),g=i*f.ratio),a.css({width:g,height:i,left:p(o.x,b.w-g),top:p(o.y,b.h-i)}),e.l={W:f.width,H:f.height,r:f.ratio,w:b.w,h:b.h,m:c,p:d}}return!0}function J(a,b){var c=a[0];c.styleSheet?c.styleSheet.cssText=b:a.html(b)}function K(a,b,c){return b===c?!1:b>=a?"left":a>=c?"right":"left right"}function L(a,b,c,d){if(!c)return!1;if(!isNaN(a))return a-(d?0:1);for(var e,f=0,g=b.length;g>f;f++){var h=b[f];if(h.id===a){e=f;break}}return e}function M(a,b,c){c=c||{},a.each(function(){var a,e=d(this),f=e.data();f.clickOn||(f.clickOn=!0,d.extend(cb(e,{onStart:function(b){a=b,(c.onStart||g).call(this,b)},onMove:c.onMove||g,onTouchEnd:c.onTouchEnd||g,onEnd:function(c){c.moved||b.call(this,a)}}),{noMove:!0}))})}function N(a,b){return'
'+(b||"")+"
"}function O(a){for(var b=a.length;b;){var c=Math.floor(Math.random()*b--),d=a[b];a[b]=a[c],a[c]=d}return a}function P(a){return"[object Array]"==Object.prototype.toString.call(a)&&d.map(a,function(a){return d.extend({},a)})}function Q(a,b,c){a.scrollLeft(b||0).scrollTop(c||0)}function R(a){if(a){var b={};return d.each(a,function(a,c){b[a.toLowerCase()]=c}),b}}function S(a){if(a){var b=+a;return isNaN(b)?(b=a.split("/"),+b[0]/+b[1]||e):b}}function T(a,b,c,d){b&&(a.addEventListener?a.addEventListener(b,c,!!d):a.attachEvent("on"+b,c))}function U(a){return!!a.getAttribute("disabled")}function V(a){return{tabindex:-1*a+"",disabled:a}}function W(a,b){T(a,"keyup",function(c){U(a)||13==c.keyCode&&b.call(a,c)})}function X(a,b){T(a,"focus",a.onfocusin=function(c){b.call(a,c)},!0)}function Y(a,b){a.preventDefault?a.preventDefault():a.returnValue=!1,b&&a.stopPropagation&&a.stopPropagation()}function Z(a){return a?">":"<"}function $(a){return a=(a+"").split(/\s+/),{x:q(a[0])||bd,y:q(a[1])||bd}}function _(a,b){var c=a.data(),e=Math.round(b.pos),f=function(){c.sliding=!1,(b.onEnd||g)()};"undefined"!=typeof b.overPos&&b.overPos!==b.pos&&(e=b.overPos,f=function(){_(a,d.extend({},b,{overPos:b.pos,time:Math.max(Qc,b.time/2)}))});var h=d.extend(k(e),b.width&&{width:b.width});c.sliding=!0,Ic?(a.css(d.extend(l(b.time),h)),b.time>10?u(a,"transform",f,b.time):f()):a.stop().animate(h,b.time,_c,f)}function ab(a,b,c,e,f,h){var i="undefined"!=typeof h;if(i||(f.push(arguments),Array.prototype.push.call(arguments,f.length),!(f.length>1))){a=a||d(a),b=b||d(b);var j=a[0],k=b[0],l="crossfade"===e.method,m=function(){if(!m.done){m.done=!0;var a=(i||f.shift())&&f.shift();a&&ab.apply(this,a),(e.onEnd||g)(!!a)}},n=e.time/(h||1);c.removeClass(Rb+" "+Qb),a.stop().addClass(Rb),b.stop().addClass(Qb),l&&k&&a.fadeTo(0,0),a.fadeTo(l?n:0,1,l&&m),b.fadeTo(n,0,m),j&&l||k||m()}}function bb(a){var b=(a.touches||[])[0]||a;a._x=b.pageX,a._y=b.clientY,a._now=d.now()}function cb(a,c){function e(a){return m=d(a.target),u.checked=p=q=s=!1,k||u.flow||a.touches&&a.touches.length>1||a.which>1||ed&&ed.type!==a.type&&gd||(p=c.select&&m.is(c.select,t))?p:(o="touchstart"===a.type,q=m.is("a, a *",t),n=u.control,r=u.noMove||u.noSwipe||n?16:u.snap?0:4,bb(a),l=ed=a,fd=a.type.replace(/down|start/,"move").replace(/Down/,"Move"),(c.onStart||g).call(t,a,{control:n,$target:m}),k=u.flow=!0,void((!o||u.go)&&Y(a)))}function f(a){if(a.touches&&a.touches.length>1||Nc&&!a.isPrimary||fd!==a.type||!k)return k&&h(),void(c.onTouchEnd||g)();bb(a);var b=Math.abs(a._x-l._x),d=Math.abs(a._y-l._y),e=b-d,f=(u.go||u.x||e>=0)&&!u.noSwipe,i=0>e;o&&!u.checked?(k=f)&&Y(a):(Y(a),(c.onMove||g).call(t,a,{touch:o})),!s&&Math.sqrt(Math.pow(b,2)+Math.pow(d,2))>r&&(s=!0),u.checked=u.checked||f||i}function h(a){(c.onTouchEnd||g)();var b=k;u.control=k=!1,b&&(u.flow=!1),!b||q&&!u.checked||(a&&Y(a),gd=!0,clearTimeout(hd),hd=setTimeout(function(){gd=!1},1e3),(c.onEnd||g).call(t,{moved:s,$target:m,control:n,touch:o,startEvent:l,aborted:!a||"MSPointerCancel"===a.type}))}function i(){u.flow||setTimeout(function(){u.flow=!0},10)}function j(){u.flow&&setTimeout(function(){u.flow=!1},Pc)}var k,l,m,n,o,p,q,r,s,t=a[0],u={};return Nc?(T(t,"MSPointerDown",e),T(b,"MSPointerMove",f),T(b,"MSPointerCancel",h),T(b,"MSPointerUp",h)):(T(t,"touchstart",e),T(t,"touchmove",f),T(t,"touchend",h),T(b,"touchstart",i),T(b,"touchend",j),T(b,"touchcancel",j),Ec.on("scroll",j),a.on("mousedown",e),Fc.on("mousemove",f).on("mouseup",h)),a.on("click","a",function(a){u.checked&&Y(a)}),u}function db(a,b){function c(c,d){A=!0,j=l=c._x,q=c._now,p=[[q,j]],m=n=D.noMove||d?0:v(a,(b.getPos||g)()),(b.onStart||g).call(B,c)}function e(a,b){s=D.min,t=D.max,u=D.snap,w=a.altKey,A=z=!1,y=b.control,y||C.sliding||c(a)}function f(d,e){D.noSwipe||(A||c(d),l=d._x,p.push([d._now,l]),n=m-(j-l),o=K(n,s,t),s>=n?n=x(n,s):n>=t&&(n=x(n,t)),D.noMove||(a.css(k(n)),z||(z=!0,e.touch||Nc||a.addClass(ec)),(b.onMove||g).call(B,d,{pos:n,edge:o})))}function i(e){if(!D.noSwipe||!e.moved){A||c(e.startEvent,!0),e.touch||Nc||a.removeClass(ec),r=d.now();for(var f,i,j,k,o,q,v,x,y,z=r-Pc,C=null,E=Qc,F=b.friction,G=p.length-1;G>=0;G--){if(f=p[G][0],i=Math.abs(f-z),null===C||j>i)C=f,k=p[G][1];else if(C===z||i>j)break;j=i}v=h(n,s,t);var H=k-l,I=H>=0,J=r-C,K=J>Pc,L=!K&&n!==m&&v===n;u&&(v=h(Math[L?I?"floor":"ceil":"round"](n/u)*u,s,t),s=t=v),L&&(u||v===n)&&(y=-(H/J),E*=h(Math.abs(y),b.timeLow,b.timeHigh),o=Math.round(n+y*E/F),u||(v=o),(!I&&o>t||I&&s>o)&&(q=I?s:t,x=o-q,u||(v=q),x=h(v+.03*x,q-50,q+50),E=Math.abs((n-x)/(y/F)))),E*=w?10:1,(b.onEnd||g).call(B,d.extend(e,{moved:e.moved||K&&u,pos:n,newPos:v,overPos:x,time:E}))}}var j,l,m,n,o,p,q,r,s,t,u,w,y,z,A,B=a[0],C=a.data(),D={};return D=d.extend(cb(b.$wrap,d.extend({},b,{onStart:e,onMove:f,onEnd:i})),D)}function eb(a,b){var c,e,f,h=a[0],i={prevent:{}};return T(h,Oc,function(a){var h=a.wheelDeltaY||-1*a.deltaY||0,j=a.wheelDeltaX||-1*a.deltaX||0,k=Math.abs(j)&&!Math.abs(h),l=Z(0>j),m=e===l,n=d.now(),o=Pc>n-f;e=l,f=n,k&&i.ok&&(!i.prevent[l]||c)&&(Y(a,!0),c&&m&&o||(b.shift&&(c=!0,clearTimeout(i.t),i.t=setTimeout(function(){c=!1},Rc)),(b.onEnd||g)(a,b.shift?l:j)))}),i}function fb(){d.each(d.Fotorama.instances,function(a,b){b.index=a})}function gb(a){d.Fotorama.instances.push(a),fb()}function hb(a){d.Fotorama.instances.splice(a.index,1),fb()}var ib="fotorama",jb="fullscreen",kb=ib+"__wrap",lb=kb+"--css2",mb=kb+"--css3",nb=kb+"--video",ob=kb+"--fade",pb=kb+"--slide",qb=kb+"--no-controls",rb=kb+"--no-shadows",sb=kb+"--pan-y",tb=kb+"--rtl",ub=kb+"--only-active",vb=kb+"--no-captions",wb=kb+"--toggle-arrows",xb=ib+"__stage",yb=xb+"__frame",zb=yb+"--video",Ab=xb+"__shaft",Bb=ib+"__grab",Cb=ib+"__pointer",Db=ib+"__arr",Eb=Db+"--disabled",Fb=Db+"--prev",Gb=Db+"--next",Hb=ib+"__nav",Ib=Hb+"-wrap",Jb=Hb+"__shaft",Kb=Hb+"--dots",Lb=Hb+"--thumbs",Mb=Hb+"__frame",Nb=Mb+"--dot",Ob=Mb+"--thumb",Pb=ib+"__fade",Qb=Pb+"-front",Rb=Pb+"-rear",Sb=ib+"__shadow",Tb=Sb+"s",Ub=Tb+"--left",Vb=Tb+"--right",Wb=ib+"__active",Xb=ib+"__select",Yb=ib+"--hidden",Zb=ib+"--fullscreen",$b=ib+"__fullscreen-icon",_b=ib+"__error",ac=ib+"__loading",bc=ib+"__loaded",cc=bc+"--full",dc=bc+"--img",ec=ib+"__grabbing",fc=ib+"__img",gc=fc+"--full",hc=ib+"__dot",ic=ib+"__thumb",jc=ic+"-border",kc=ib+"__html",lc=ib+"__video",mc=lc+"-play",nc=lc+"-close",oc=ib+"__caption",pc=ib+"__caption__wrap",qc=ib+"__spinner",rc='" tabindex="0" role="button',sc=d&&d.fn.jquery.split(".");if(!sc||sc[0]<1||1==sc[0]&&sc[1]<8)throw"Fotorama requires jQuery 1.8 or later and will not run without it.";var tc={},uc=function(a,b,c){function d(a){r.cssText=a}function e(a,b){return typeof a===b}function f(a,b){return!!~(""+a).indexOf(b)}function g(a,b){for(var d in a){var e=a[d];if(!f(e,"-")&&r[e]!==c)return"pfx"==b?e:!0}return!1}function h(a,b,d){for(var f in a){var g=b[a[f]];if(g!==c)return d===!1?a[f]:e(g,"function")?g.bind(d||b):g}return!1}function i(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),f=(a+" "+u.join(d+" ")+d).split(" ");return e(b,"string")||e(b,"undefined")?g(f,b):(f=(a+" "+v.join(d+" ")+d).split(" "),h(f,b,c))}var j,k,l,m="2.6.2",n={},o=b.documentElement,p="modernizr",q=b.createElement(p),r=q.style,s=({}.toString," -webkit- -moz- -o- -ms- ".split(" ")),t="Webkit Moz O ms",u=t.split(" "),v=t.toLowerCase().split(" "),w={},x=[],y=x.slice,z=function(a,c,d,e){var f,g,h,i,j=b.createElement("div"),k=b.body,l=k||b.createElement("body");if(parseInt(d,10))for(;d--;)h=b.createElement("div"),h.id=e?e[d]:p+(d+1),j.appendChild(h);return f=["­",'"].join(""),j.id=p,(k?j:l).innerHTML+=f,l.appendChild(j),k||(l.style.background="",l.style.overflow="hidden",i=o.style.overflow,o.style.overflow="hidden",o.appendChild(l)),g=c(j,a),k?j.parentNode.removeChild(j):(l.parentNode.removeChild(l),o.style.overflow=i),!!g},A={}.hasOwnProperty;l=e(A,"undefined")||e(A.call,"undefined")?function(a,b){return b in a&&e(a.constructor.prototype[b],"undefined")}:function(a,b){return A.call(a,b)},Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError;var c=y.call(arguments,1),d=function(){if(this instanceof d){var e=function(){};e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(y.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(y.call(arguments)))};return d}),w.csstransforms3d=function(){var a=!!i("perspective");return a};for(var B in w)l(w,B)&&(k=B.toLowerCase(),n[k]=w[B](),x.push((n[k]?"":"no-")+k));return n.addTest=function(a,b){if("object"==typeof a)for(var d in a)l(a,d)&&n.addTest(d,a[d]);else{if(a=a.toLowerCase(),n[a]!==c)return n;b="function"==typeof b?b():b,"undefined"!=typeof enableClasses&&enableClasses&&(o.className+=" "+(b?"":"no-")+a),n[a]=b}return n},d(""),q=j=null,n._version=m,n._prefixes=s,n._domPrefixes=v,n._cssomPrefixes=u,n.testProp=function(a){return g([a])},n.testAllProps=i,n.testStyles=z,n.prefixed=function(a,b,c){return b?i(a,b,c):i(a,"pfx")},n}(a,b),vc={ok:!1,is:function(){return!1},request:function(){},cancel:function(){},event:"",prefix:""},wc="webkit moz o ms khtml".split(" ");if("undefined"!=typeof b.cancelFullScreen)vc.ok=!0;else for(var xc=0,yc=wc.length;yc>xc;xc++)if(vc.prefix=wc[xc],"undefined"!=typeof b[vc.prefix+"CancelFullScreen"]){vc.ok=!0;break}vc.ok&&(vc.event=vc.prefix+"fullscreenchange",vc.is=function(){switch(this.prefix){case"":return b.fullScreen;case"webkit":return b.webkitIsFullScreen;default:return b[this.prefix+"FullScreen"]}},vc.request=function(a){return""===this.prefix?a.requestFullScreen():a[this.prefix+"RequestFullScreen"]()},vc.cancel=function(){return""===this.prefix?b.cancelFullScreen():b[this.prefix+"CancelFullScreen"]()});var zc,Ac={lines:12,length:5,width:2,radius:7,corners:1,rotate:15,color:"rgba(128, 128, 128, .75)",hwaccel:!0},Bc={top:"auto",left:"auto",className:""};!function(a,b){zc=b()}(this,function(){function a(a,c){var d,e=b.createElement(a||"div");for(d in c)e[d]=c[d];return e}function c(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function d(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=m.substring(0,m.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return o[e]||(p.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",p.cssRules.length),o[e]=1),e}function f(a,b){var c,d,f=a.style;for(b=b.charAt(0).toUpperCase()+b.slice(1),d=0;d',c)}p.addRule(".spin-vml","behavior:url(#default#VML)"),k.prototype.lines=function(a,d){function e(){return g(b("group",{coordsize:k+" "+k,coordorigin:-i+" "+-i}),{width:k,height:k})}function f(a,f,h){c(m,c(g(e(),{rotation:360/d.lines*a+"deg",left:~~f}),c(g(b("roundrect",{arcsize:d.corners}),{width:i,height:d.width,left:d.radius,top:-d.width>>1,filter:h}),b("fill",{color:j(d.color,a),opacity:d.opacity}),b("stroke",{opacity:0}))))}var h,i=d.length+d.width,k=2*i,l=2*-(d.width+d.length)+"px",m=g(e(),{position:"absolute",top:l,left:l});if(d.shadow)for(h=1;h<=d.lines;h++)f(h,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(h=1;h<=d.lines;h++)f(h);return c(a,m)},k.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d>1):parseInt(f.left,10)+j)+"px",top:("auto"==f.top?d.y-c.y+(b.offsetHeight>>1):parseInt(f.top,10)+j)+"px"})),h.setAttribute("role","progressbar"),e.lines(h,e.opts),!m){var k,l=0,n=(f.lines-1)*(1-f.direction)/2,o=f.fps,p=o/f.speed,q=(1-f.opacity)/(p*f.trail/100),r=p/f.lines;!function s(){l++;for(var a=0;a>1)+"px"})}for(var h,i=0,k=(e.lines-1)*(1-e.direction)/2;i":36===a.keyCode&&g("home")?c="<<":35===a.keyCode&&g("end")&&(c=">>")),(b||c)&&Y(a),c&&ie.show({index:c,slow:a.altKey,user:!0})}),ie.index||Fc.off(b).on(b,"textarea, input, select",function(a){!Dc.hasClass(jb)&&a.stopPropagation()}),Ec.on(f,ie.resize)):(Fc.off(d),Ec.off(f))}function j(b){b!==j.f&&(b?(a.html("").addClass(ib+" "+ke).append(qe).before(oe).before(pe),gb(ie)):(qe.detach(),oe.detach(),pe.detach(),a.html(ne.urtext).removeClass(ke),hb(ie)),i(b),j.f=b)}function m(){yd=ie.data=yd||P(e.data)||D(a),zd=ie.size=yd.length,!xd.ok&&e.shuffle&&O(yd),f(),Je=y(Je),zd&&j(!0)}function o(){var a=2>zd&&!e.enableifsingleframe||Cd;Me.noMove=a||Sd,Me.noSwipe=a||!e.swipe,!Wd&&se.toggleClass(Bb,!e.click&&!Me.noMove&&!Me.noSwipe),Nc&&qe.toggleClass(sb,!Me.noSwipe)}function t(a){a===!0&&(a=""),e.autoplay=Math.max(+a||Sc,1.5*Vd)}function u(){function a(a,c){b[a?"add":"remove"].push(c)}ie.options=e=R(e),Sd="crossfade"===e.transition||"dissolve"===e.transition,Md=e.loop&&(zd>2||Sd&&(!Wd||"slide"!==Wd)),Vd=+e.transitionduration||Qc,Yd="rtl"===e.direction,Zd=d.extend({},e.keyboard&&dd,e.keyboard);var b={add:[],remove:[]};zd>1||e.enableifsingleframe?(Nd=e.nav,Pd="top"===e.navposition,b.remove.push(Xb),we.toggle(!!e.arrows)):(Nd=!1,we.hide()),Rb(),Bd=new zc(d.extend(Ac,e.spinner,Bc,{direction:Yd?-1:1})),Gc(),Hc(),e.autoplay&&t(e.autoplay),Td=n(e.thumbwidth)||Uc,Ud=n(e.thumbheight)||Uc,Ne.ok=Pe.ok=e.trackpad&&!Mc,o(),ed(e,[Le]),Od="thumbs"===Nd,Od?(lc(zd,"navThumb"),Ad=Be,he=Zc,J(oe,d.Fotorama.jst.style({w:Td,h:Ud,b:e.thumbborderwidth,m:e.thumbmargin,s:je,q:!Jc})),ye.addClass(Lb).removeClass(Kb)):"dots"===Nd?(lc(zd,"navDot"),Ad=Ae,he=Yc,ye.addClass(Kb).removeClass(Lb)):(Nd=!1,ye.removeClass(Lb+" "+Kb)),Nd&&(Pd?xe.insertBefore(re):xe.insertAfter(re),wc.nav=!1,wc(Ad,ze,"nav")),Qd=e.allowfullscreen,Qd?(De.prependTo(re),Rd=Kc&&"native"===Qd):(De.detach(),Rd=!1),a(Sd,ob),a(!Sd,pb),a(!e.captions,vb),a(Yd,tb),a("always"!==e.arrows,wb),Xd=e.shadows&&!Mc,a(!Xd,rb),qe.addClass(b.add.join(" ")).removeClass(b.remove.join(" ")),Ke=d.extend({},e)}function x(a){return 0>a?(zd+a%zd)%zd:a>=zd?a%zd:a}function y(a){return h(a,0,zd-1)}function z(a){return Md?x(a):y(a)}function E(a){return a>0||Md?a-1:!1}function U(a){return zd-1>a||Md?a+1:!1}function $(){Me.min=Md?-1/0:-r(zd-1,Le.w,e.margin,Fd),Me.max=Md?1/0:-r(0,Le.w,e.margin,Fd),Me.snap=Le.w+e.margin}function bb(){Oe.min=Math.min(0,Le.nw-ze.width()),Oe.max=0,ze.toggleClass(Bb,!(Oe.noMove=Oe.min===Oe.max))}function cb(a,b,c){if("number"==typeof a){a=new Array(a);var e=!0}return d.each(a,function(a,d){if(e&&(d=a),"number"==typeof d){var f=yd[x(d)];if(f){var g="$"+b+"Frame",h=f[g];c.call(this,a,d,f,h,g,h&&h.data())}}})}function fb(a,b,c,d){(!$d||"*"===$d&&d===Ld)&&(a=q(e.width)||q(a)||Vc,b=q(e.height)||q(b)||Wc,ie.resize({width:a,ratio:e.ratio||c||a/b},0,d!==Ld&&"*"))}function Pb(a,b,c,f,g,h){cb(a,b,function(a,i,j,k,l,m){function n(a){var b=x(i);fd(a,{index:b,src:w,frame:yd[b]})}function o(){t.remove(),d.Fotorama.cache[w]="error",j.html&&"stage"===b||!y||y===w?(!w||j.html||r?"stage"===b&&(k.trigger("f:load").removeClass(ac+" "+_b).addClass(bc),n("load"),fb()):(k.trigger("f:error").removeClass(ac).addClass(_b),n("error")),m.state="error",!(zd>1&&yd[i]===j)||j.html||j.deleted||j.video||r||(j.deleted=!0,ie.splice(i,1))):(j[v]=w=y,Pb([i],b,c,f,g,!0))}function p(){d.Fotorama.measures[w]=u.measures=d.Fotorama.measures[w]||{width:s.width,height:s.height,ratio:s.width/s.height},fb(u.measures.width,u.measures.height,u.measures.ratio,i),t.off("load error").addClass(fc+(r?" "+gc:"")).prependTo(k),I(t,(d.isFunction(c)?c():c)||Le,f||j.fit||e.fit,g||j.position||e.position),d.Fotorama.cache[w]=m.state="loaded",setTimeout(function(){k.trigger("f:load").removeClass(ac+" "+_b).addClass(bc+" "+(r?cc:dc)),"stage"===b?n("load"):(j.thumbratio===$c||!j.thumbratio&&e.thumbratio===$c)&&(j.thumbratio=u.measures.ratio,vd())},0)}function q(){var a=10;G(function(){return!fe||!a--&&!Mc},function(){p()})}if(k){var r=ie.fullScreen&&j.full&&j.full!==j.img&&!m.$full&&"stage"===b;if(!m.$img||h||r){var s=new Image,t=d(s),u=t.data();m[r?"$full":"$img"]=t;var v="stage"===b?r?"full":"img":"thumb",w=j[v],y=r?null:j["stage"===b?"thumb":"img"];if("navThumb"===b&&(k=m.$wrap),!w)return void o();d.Fotorama.cache[w]?!function z(){"error"===d.Fotorama.cache[w]?o():"loaded"===d.Fotorama.cache[w]?setTimeout(q,0):setTimeout(z,100)}():(d.Fotorama.cache[w]="*",t.on("load",q).on("error",o)),m.state="",s.src=w}}})}function Qb(a){Ie.append(Bd.spin().el).appendTo(a)}function Rb(){Ie.detach(),Bd&&Bd.stop()}function Sb(){var a=Dd[Xc];a&&!a.data().state&&(Qb(a),a.on("f:load f:error",function(){a.off("f:load f:error"),Rb()}))}function ec(a){W(a,sd),X(a,function(){setTimeout(function(){Q(ye)},0),Rc({time:Vd,guessIndex:d(this).data().eq,minMax:Oe})})}function lc(a,b){cb(a,b,function(a,c,e,f,g,h){if(!f){f=e[g]=qe[g].clone(),h=f.data(),h.data=e;var i=f[0];"stage"===b?(e.html&&d('
').append(e._html?d(e.html).removeAttr("id").html(e._html):e.html).appendTo(f),e.caption&&d(N(oc,N(pc,e.caption))).appendTo(f),e.video&&f.addClass(zb).append(Fe.clone()),X(i,function(){setTimeout(function(){Q(re)},0),pd({index:h.eq,user:!0})}),te=te.add(f)):"navDot"===b?(ec(i),Ae=Ae.add(f)):"navThumb"===b&&(ec(i),h.$wrap=f.children(":first"),Be=Be.add(f),e.video&&h.$wrap.append(Fe.clone()))}})}function sc(a,b,c,d){return a&&a.length&&I(a,b,c,d)}function tc(a){cb(a,"stage",function(a,b,c,f,g,h){if(f){var i=x(b),j=c.fit||e.fit,k=c.position||e.position;h.eq=i,Re[Xc][i]=f.css(d.extend({left:Sd?0:r(b,Le.w,e.margin,Fd)},Sd&&l(0))),F(f[0])&&(f.appendTo(se),md(c.$video)),sc(h.$img,Le,j,k),sc(h.$full,Le,j,k)}})}function uc(a,b){if("thumbs"===Nd&&!isNaN(a)){var c=-a,f=-a+Le.nw;Be.each(function(){var a=d(this),g=a.data(),h=g.eq,i=function(){return{h:Ud,w:g.w}},j=i(),k=yd[h]||{},l=k.thumbfit||e.thumbfit,m=k.thumbposition||e.thumbposition;j.w=g.w,g.l+g.wf||sc(g.$img,j,l,m)||b&&Pb([h],"navThumb",i,l,m)})}}function wc(a,b,c){if(!wc[c]){var f="nav"===c&&Od,g=0;b.append(a.filter(function(){for(var a,b=d(this),c=b.data(),e=0,f=yd.length;f>e;e++)if(c.data===yd[e]){a=!0,c.eq=e;break}return a||b.remove()&&!1}).sort(function(a,b){return d(a).data().eq-d(b).data().eq}).each(function(){if(f){var a=d(this),b=a.data(),c=Math.round(Ud*b.data.thumbratio)||Td;b.l=g,b.w=c,a.css({width:c}),g+=c+e.thumbmargin}})),wc[c]=!0}}function xc(a){return a-Se>Le.w/3}function yc(a){return!(Md||Je+a&&Je-zd+a||Cd)}function Gc(){var a=yc(0),b=yc(1);ue.toggleClass(Eb,a).attr(V(a)),ve.toggleClass(Eb,b).attr(V(b))}function Hc(){Ne.ok&&(Ne.prevent={"<":yc(0),">":yc(1)})}function Lc(a){var b,c,d=a.data();return Od?(b=d.l,c=d.w):(b=a.position().left,c=a.width()),{c:b+c/2,min:-b+10*e.thumbmargin,max:-b+Le.w-c-10*e.thumbmargin}}function Oc(a){var b=Dd[he].data();_(Ce,{time:1.2*a,pos:b.l,width:b.w-2*e.thumbborderwidth})}function Rc(a){var b=yd[a.guessIndex][he];if(b){var c=Oe.min!==Oe.max,d=a.minMax||c&&Lc(Dd[he]),e=c&&(a.keep&&Rc.l?Rc.l:h((a.coo||Le.nw/2)-Lc(b).c,d.min,d.max)),f=c&&h(e,Oe.min,Oe.max),g=1.1*a.time;_(ze,{time:g,pos:f||0,onEnd:function(){uc(f,!0)}}),ld(ye,K(f,Oe.min,Oe.max)),Rc.l=e}}function Tc(){_c(he),Qe[he].push(Dd[he].addClass(Wb))}function _c(a){for(var b=Qe[a];b.length;)b.shift().removeClass(Wb)}function bd(a){var b=Re[a];d.each(Ed,function(a,c){delete b[x(c)]}),d.each(b,function(a,c){delete b[a],c.detach()})}function cd(a){Fd=Gd=Je;var b=Dd[Xc];b&&(_c(Xc),Qe[Xc].push(b.addClass(Wb)),a||ie.show.onEnd(!0),v(se,0,!0),bd(Xc),tc(Ed),$(),bb())}function ed(a,b){a&&d.each(b,function(b,c){c&&d.extend(c,{width:a.width||c.width,height:a.height,minwidth:a.minwidth,maxwidth:a.maxwidth,minheight:a.minheight,maxheight:a.maxheight,ratio:S(a.ratio)})})}function fd(b,c){a.trigger(ib+":"+b,[ie,c])}function gd(){clearTimeout(hd.t),fe=1,e.stopautoplayontouch?ie.stopAutoplay():ce=!0}function hd(){fe&&(e.stopautoplayontouch||(id(),jd()),hd.t=setTimeout(function(){fe=0},Qc+Pc))}function id(){ce=!(!Cd&&!de)}function jd(){if(clearTimeout(jd.t),G.stop(jd.w),!e.autoplay||ce)return void(ie.autoplay&&(ie.autoplay=!1,fd("stopautoplay")));ie.autoplay||(ie.autoplay=!0,fd("startautoplay"));var a=Je,b=Dd[Xc].data();jd.w=G(function(){return b.state||a!==Je},function(){jd.t=setTimeout(function(){if(!ce&&a===Je){var b=Kd,c=yd[b][Xc].data();jd.w=G(function(){return c.state||b!==Kd},function(){ce||b!==Kd||ie.show(Md?Z(!Yd):Kd)})}},e.autoplay)})}function kd(){ie.fullScreen&&(ie.fullScreen=!1,Kc&&vc.cancel(le),Dc.removeClass(jb),Cc.removeClass(jb),a.removeClass(Zb).insertAfter(pe),Le=d.extend({},ee),md(Cd,!0,!0),rd("x",!1),ie.resize(),Pb(Ed,"stage"),Q(Ec,ae,_d),fd("fullscreenexit"))}function ld(a,b){Xd&&(a.removeClass(Ub+" "+Vb),b&&!Cd&&a.addClass(b.replace(/^|\s/g," "+Tb+"--")))}function md(a,b,c){b&&(qe.removeClass(nb),Cd=!1,o()),a&&a!==Cd&&(a.remove(),fd("unloadvideo")),c&&(id(),jd())}function nd(a){qe.toggleClass(qb,a)}function od(a){if(!Me.flow){var b=a?a.pageX:od.x,c=b&&!yc(xc(b))&&e.click;od.p!==c&&re.toggleClass(Cb,c)&&(od.p=c,od.x=b)}}function pd(a){clearTimeout(pd.t),e.clicktransition&&e.clicktransition!==e.transition?setTimeout(function(){var b=e.transition;ie.setOptions({transition:e.clicktransition}),Wd=b,pd.t=setTimeout(function(){ie.show(a)},10)},0):ie.show(a)}function qd(a,b){var c=a.target,f=d(c);f.hasClass(mc)?ie.playVideo():c===Ee?ie.toggleFullScreen():Cd?c===He&&md(Cd,!0,!0):b?nd():e.click&&pd({index:a.shiftKey||Z(xc(a._x)),slow:a.altKey,user:!0})}function rd(a,b){Me[a]=Oe[a]=b}function sd(a){var b=d(this).data().eq;pd({index:b,slow:a.altKey,user:!0,coo:a._x-ye.offset().left})}function td(a){pd({index:we.index(this)?">":"<",slow:a.altKey,user:!0})}function ud(a){X(a,function(){setTimeout(function(){Q(re)},0),nd(!1)})}function vd(){if(m(),u(),!vd.i){vd.i=!0;var a=e.startindex;(a||e.hash&&c.hash)&&(Ld=L(a||c.hash.replace(/^#/,""),yd,0===ie.index||a,a)),Je=Fd=Gd=Hd=Ld=z(Ld)||0}if(zd){if(wd())return;Cd&&md(Cd,!0),Ed=[],bd(Xc),vd.ok=!0,ie.show({index:Je,time:0}),ie.resize()}else ie.destroy()}function wd(){return!wd.f===Yd?(wd.f=Yd,Je=zd-1-Je,ie.reverse(),!0):void 0}function xd(){xd.ok||(xd.ok=!0,fd("ready"))}Cc=d("html"),Dc=d("body");var yd,zd,Ad,Bd,Cd,Dd,Ed,Fd,Gd,Hd,Id,Jd,Kd,Ld,Md,Nd,Od,Pd,Qd,Rd,Sd,Td,Ud,Vd,Wd,Xd,Yd,Zd,$d,_d,ae,be,ce,de,ee,fe,ge,he,ie=this,je=d.now(),ke=ib+je,le=a[0],me=1,ne=a.data(),oe=d(""),pe=d(N(Yb)),qe=d(N(kb)),re=d(N(xb)).appendTo(qe),se=(re[0],d(N(Ab)).appendTo(re)),te=d(),ue=d(N(Db+" "+Fb+rc)),ve=d(N(Db+" "+Gb+rc)),we=ue.add(ve).appendTo(re),xe=d(N(Ib)),ye=d(N(Hb)).appendTo(xe),ze=d(N(Jb)).appendTo(ye),Ae=d(),Be=d(),Ce=(se.data(),ze.data(),d(N(jc)).appendTo(ze)),De=d(N($b+rc)),Ee=De[0],Fe=d(N(mc)),Ge=d(N(nc)).appendTo(re),He=Ge[0],Ie=d(N(qc)),Je=!1,Ke={},Le={},Me={},Ne={},Oe={},Pe={},Qe={},Re={},Se=0,Te=[]; +qe[Xc]=d(N(yb)),qe[Zc]=d(N(Mb+" "+Ob+rc,N(ic))),qe[Yc]=d(N(Mb+" "+Nb+rc,N(hc))),Qe[Xc]=[],Qe[Zc]=[],Qe[Yc]=[],Re[Xc]={},qe.addClass(Ic?mb:lb).toggleClass(qb,!e.controlsonstart),ne.fotorama=this,ie.startAutoplay=function(a){return ie.autoplay?this:(ce=de=!1,t(a||e.autoplay),jd(),this)},ie.stopAutoplay=function(){return ie.autoplay&&(ce=de=!0,jd()),this},ie.show=function(a){var b;"object"!=typeof a?(b=a,a={}):b=a.index,b=">"===b?Gd+1:"<"===b?Gd-1:"<<"===b?0:">>"===b?zd-1:b,b=isNaN(b)?L(b,yd,!0):b,b="undefined"==typeof b?Je||0:b,ie.activeIndex=Je=z(b),Id=E(Je),Jd=U(Je),Kd=x(Je+(Yd?-1:1)),Ed=[Je,Id,Jd],Gd=Md?b:Je;var c=Math.abs(Hd-Gd),d=w(a.time,function(){return Math.min(Vd*(1+(c-1)/12),2*Vd)}),f=a.overPos;a.slow&&(d*=10);var g=Dd;ie.activeFrame=Dd=yd[Je];var i=g===Dd&&!a.user;md(Cd,Dd.i!==yd[x(Fd)].i),lc(Ed,"stage"),tc(Mc?[Gd]:[Gd,E(Gd),U(Gd)]),rd("go",!0),i||fd("show",{user:a.user,time:d}),ce=!0;var j=ie.show.onEnd=function(b){if(!j.ok){if(j.ok=!0,b||cd(!0),i||fd("showend",{user:a.user}),!b&&Wd&&Wd!==e.transition)return ie.setOptions({transition:Wd}),void(Wd=!1);Sb(),Pb(Ed,"stage"),rd("go",!1),Hc(),od(),id(),jd()}};if(Sd){var k=Dd[Xc],l=Je!==Hd?yd[Hd][Xc]:null;ab(k,l,te,{time:d,method:e.transition,onEnd:j},Te)}else _(se,{pos:-r(Gd,Le.w,e.margin,Fd),overPos:f,time:d,onEnd:j});if(Gc(),Nd){Tc();var m=y(Je+h(Gd-Hd,-1,1));Rc({time:d,coo:m!==Je&&a.coo,guessIndex:"undefined"!=typeof a.coo?m:Je,keep:i}),Od&&Oc(d)}return be="undefined"!=typeof Hd&&Hd!==Je,Hd=Je,e.hash&&be&&!ie.eq&&H(Dd.id||Je+1),this},ie.requestFullScreen=function(){return Qd&&!ie.fullScreen&&(_d=Ec.scrollTop(),ae=Ec.scrollLeft(),Q(Ec),rd("x",!0),ee=d.extend({},Le),a.addClass(Zb).appendTo(Dc.addClass(jb)),Cc.addClass(jb),md(Cd,!0,!0),ie.fullScreen=!0,Rd&&vc.request(le),ie.resize(),Pb(Ed,"stage"),Sb(),fd("fullscreenenter")),this},ie.cancelFullScreen=function(){return Rd&&vc.is()?vc.cancel(b):kd(),this},ie.toggleFullScreen=function(){return ie[(ie.fullScreen?"cancel":"request")+"FullScreen"]()},T(b,vc.event,function(){!yd||vc.is()||Cd||kd()}),ie.resize=function(a){if(!yd)return this;var b=arguments[1]||0,c=arguments[2];ed(ie.fullScreen?{width:"100%",maxwidth:null,minwidth:null,height:"100%",maxheight:null,minheight:null}:R(a),[Le,c||ie.fullScreen||e]);var d=Le.width,f=Le.height,g=Le.ratio,i=Ec.height()-(Nd?ye.height():0);return q(d)&&(qe.addClass(ub).css({width:d,minWidth:Le.minwidth||0,maxWidth:Le.maxwidth||ad}),d=Le.W=Le.w=qe.width(),Le.nw=Nd&&p(e.navwidth,d)||d,e.glimpse&&(Le.w-=Math.round(2*(p(e.glimpse,d)||0))),se.css({width:Le.w,marginLeft:(Le.W-Le.w)/2}),f=p(f,i),f=f||g&&d/g,f&&(d=Math.round(d),f=Le.h=Math.round(h(f,p(Le.minheight,i),p(Le.maxheight,i))),re.stop().animate({width:d,height:f},b,function(){qe.removeClass(ub)}),cd(),Nd&&(ye.stop().animate({width:Le.nw},b),Rc({guessIndex:Je,time:b,keep:!0}),Od&&wc.nav&&Oc(b)),$d=c||!0,xd())),Se=re.offset().left,this},ie.setOptions=function(a){return d.extend(e,a),vd(),this},ie.shuffle=function(){return yd&&O(yd)&&vd(),this},ie.destroy=function(){return ie.cancelFullScreen(),ie.stopAutoplay(),yd=ie.data=null,j(),Ed=[],bd(Xc),vd.ok=!1,this},ie.playVideo=function(){var a=Dd,b=a.video,c=Je;return"object"==typeof b&&a.videoReady&&(Rd&&ie.fullScreen&&ie.cancelFullScreen(),G(function(){return!vc.is()||c!==Je},function(){c===Je&&(a.$video=a.$video||d(d.Fotorama.jst.video(b)),a.$video.appendTo(a[Xc]),qe.addClass(nb),Cd=a.$video,o(),we.blur(),De.blur(),fd("loadvideo"))})),this},ie.stopVideo=function(){return md(Cd,!0,!0),this},re.on("mousemove",od),Me=db(se,{onStart:gd,onMove:function(a,b){ld(re,b.edge)},onTouchEnd:hd,onEnd:function(a){ld(re);var b=(Nc&&!ge||a.touch)&&e.arrows&&"always"!==e.arrows;if(a.moved||b&&a.pos!==a.newPos&&!a.control){var c=s(a.newPos,Le.w,e.margin,Fd);ie.show({index:c,time:Sd?Vd:a.time,overPos:a.overPos,user:!0})}else a.aborted||a.control||qd(a.startEvent,b)},timeLow:1,timeHigh:1,friction:2,select:"."+Xb+", ."+Xb+" *",$wrap:re}),Oe=db(ze,{onStart:gd,onMove:function(a,b){ld(ye,b.edge)},onTouchEnd:hd,onEnd:function(a){function b(){Rc.l=a.newPos,id(),jd(),uc(a.newPos,!0)}if(a.moved)a.pos!==a.newPos?(ce=!0,_(ze,{time:a.time,pos:a.newPos,overPos:a.overPos,onEnd:b}),uc(a.newPos),Xd&&ld(ye,K(a.newPos,Oe.min,Oe.max))):b();else{var c=a.$target.closest("."+Mb,ze)[0];c&&sd.call(c,a.startEvent)}},timeLow:.5,timeHigh:2,friction:5,$wrap:ye}),Ne=eb(re,{shift:!0,onEnd:function(a,b){gd(),hd(),ie.show({index:b,slow:a.altKey})}}),Pe=eb(ye,{onEnd:function(a,b){gd(),hd();var c=v(ze)+.25*b;ze.css(k(h(c,Oe.min,Oe.max))),Xd&&ld(ye,K(c,Oe.min,Oe.max)),Pe.prevent={"<":c>=Oe.max,">":c<=Oe.min},clearTimeout(Pe.t),Pe.t=setTimeout(function(){Rc.l=c,uc(c,!0)},Pc),uc(c)}}),qe.hover(function(){setTimeout(function(){fe||nd(!(ge=!0))},0)},function(){ge&&nd(!(ge=!1))}),M(we,function(a){Y(a),td.call(this,a)},{onStart:function(){gd(),Me.control=!0},onTouchEnd:hd}),we.each(function(){W(this,function(a){td.call(this,a)}),ud(this)}),W(Ee,ie.toggleFullScreen),ud(Ee),d.each("load push pop shift unshift reverse sort splice".split(" "),function(a,b){ie[b]=function(){return yd=yd||[],"load"!==b?Array.prototype[b].apply(yd,arguments):arguments[0]&&"object"==typeof arguments[0]&&arguments[0].length&&(yd=P(arguments[0])),vd(),ie}}),vd()},d.fn.fotorama=function(b){return this.each(function(){var c=this,e=d(this),f=e.data(),g=f.fotorama;g?g.setOptions(b,!0):G(function(){return!E(c)},function(){f.urtext=e.html(),new d.Fotorama(e,d.extend({},cd,a.fotoramaDefaults,b,f))})})},d.Fotorama.instances=[],d.Fotorama.cache={},d.Fotorama.measures={},d=d||{},d.Fotorama=d.Fotorama||{},d.Fotorama.jst=d.Fotorama.jst||{},d.Fotorama.jst.style=function(a){{var b,c="";tc.escape}return c+=".fotorama"+(null==(b=a.s)?"":b)+" .fotorama__nav--thumbs .fotorama__nav__frame{\npadding:"+(null==(b=a.m)?"":b)+"px;\nheight:"+(null==(b=a.h)?"":b)+"px}\n.fotorama"+(null==(b=a.s)?"":b)+" .fotorama__thumb-border{\nheight:"+(null==(b=a.h-a.b*(a.q?0:2))?"":b)+"px;\nborder-width:"+(null==(b=a.b)?"":b)+"px;\nmargin-top:"+(null==(b=a.m)?"":b)+"px}"},d.Fotorama.jst.video=function(a){function b(){c+=d.call(arguments,"")}var c="",d=(tc.escape,Array.prototype.join);return c+='
\n'},d(function(){d("."+ib+':not([data-auto="false"])').fotorama()})}(window,document,location,"undefined"!=typeof jQuery&&jQuery); \ No newline at end of file diff --git a/plugins/system/fields/fields.php b/plugins/system/fields/fields.php new file mode 100644 index 0000000000000..fb3cde1182825 --- /dev/null +++ b/plugins/system/fields/fields.php @@ -0,0 +1,551 @@ +input->getCmd('extension') . '.category'; + } + + $parts = $this->getParts($context); + if (! $parts) + { + return true; + } + $context = $parts[0] . '.' . $parts[1]; + + // Loading the fields + $fieldsObjects = FieldsHelper::getFields($context, $item); + if (! $fieldsObjects) + { + return true; + } + + $params = new Registry(); + + // Load the item params from the request + $data = JFactory::getApplication()->input->post->get('jform', array(), 'array'); + if (key_exists('params', $data)) + { + $params->loadArray($data['params']); + } + + // Load the params from the item itself + if (isset($item->params)) + { + $params->loadString($item->params); + } + $params = $params->toArray(); + + if (! $params) + { + return true; + } + + // Create the new internal fields field + $fields = array(); + foreach ($fieldsObjects as $field) + { + // Only safe the fields with the alias from the data + if (! key_exists($field->alias, $params)) + { + continue; + } + + // Set the param on the fields variable + $fields[$field->alias] = $params[$field->alias]; + + // Remove it from the params array + unset($params[$field->alias]); + } + + $item->_fields = $fields; + + // Update the cleaned up params + if (isset($item->params)) + { + $item->params = json_encode($params); + } + } + + public function onContentAfterSave ($context, $item, $isNew) + { + // Load the category context based on the extension + if ($context == 'com_categories.category') + { + $context = JFactory::getApplication()->input->getCmd('extension') . '.category'; + } + + $parts = $this->getParts($context); + if (! $parts) + { + return true; + } + $context = $parts[0] . '.' . $parts[1]; + + // Return if the item has no valid state + $fields = null; + if (isset($item->_fields)) + { + $fields = $item->_fields; + } + + if (! $fields) + { + return true; + } + + // Loading the fields + $fieldsObjects = FieldsHelper::getFields($context, $item); + if (! $fieldsObjects) + { + return true; + } + + // Loading the model + $model = JModelLegacy::getInstance('Field', 'FieldsModel', array( + 'ignore_request' => true + )); + foreach ($fieldsObjects as $field) + { + // Only safe the fields with the alias from the data + if (! key_exists($field->alias, $fields)) + { + continue; + } + + $id = null; + if (isset($item->id)) + { + $id = $item->id; + } + + if (! $id) + { + continue; + } + + // Setting the value for the field and the item + $model->setFieldValue($field->id, $context, $id, $fields[$field->alias]); + } + + return true; + } + + public function onExtensionBeforeSave ($context, $item, $isNew) + { + return $this->onContentBeforeSave($context, $item, $isNew); + } + + public function onExtensionAfterSave ($context, $item, $isNew) + { + return $this->onContentAfterSave($context, $item, $isNew); + } + + public function onUserAfterSave ($userData, $isNew, $success, $msg) + { + // It is not possible to manipulate the user during save events + // http://joomla.stackexchange.com/questions/10693/changing-user-group-in-onuserbeforesave-of-user-profile-plugin-doesnt-work + + // Check if data is valid or we are in a recursion + if (! $userData['id'] || ! $success) + { + return true; + } + + $user = JFactory::getUser($userData['id']); + $user->params = (string) $user->getParameters(); + + // Trigger the events with a real user + $this->onContentBeforeSave('com_users.user', $user, false); + $this->onContentAfterSave('com_users.user', $user, false); + + // Save the user with the modifed params + $db = JFactory::getDbo(); + $db->setQuery('update #__users set params = ' . $db->q($user->params)); + $db->query(); + + return true; + } + + public function onContentAfterDelete ($context, $item) + { + $parts = $this->getParts($context); + if (! $parts) + { + return true; + } + $context = $parts[0] . '.' . $parts[1]; + + JLoader::import('joomla.application.component.model'); + JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_fields/models', 'FieldsModel'); + $model = JModelLegacy::getInstance('Field', 'FieldsModel', array( + 'ignore_request' => true + )); + $model->cleanupValues($context, $item->id); + return true; + } + + public function onExtensionAfterDelete ($context, $item) + { + return $this->onContentAfterDelete($context, $item); + } + + public function onUserAfterDelete ($user, $succes, $msg) + { + $item = new stdClass(); + $item->id = $user['id']; + return $this->onContentAfterDelete('com_users.user', $item); + } + + public function onContentPrepareForm (JForm $form, $data) + { + $context = $form->getName(); + + // Transform categories form name to a valid context + if (strpos($context, 'com_categories.category') !== false) + { + $context = str_replace('com_categories.category', '', $context) . '.category'; + } + + // Extracting the component and section + $parts = $this->getParts($context); + if (! $parts) + { + return true; + } + + $input = JFactory::getApplication()->input; + + // If we are on the save command we need the actual data + $jformData = $input->get('jform', array(), 'array'); + if ($jformData && ! $data) + { + $data = $jformData; + } + + if (is_array($data)) + { + $data = (object) $data; + } + + if ((! isset($data->catid) || ! $data->catid) && JFactory::getApplication()->isSite() && $component = 'com_content') + { + $activeMenu = JFactory::getApplication()->getMenu()->getActive(); + $params = $activeMenu->params; + $data->catid = $params->get('catid'); + } + + FieldsHelper::prepareForm($parts[0] . '.' . $parts[1], $form, $data); + + return true; + } + + public function onContentPrepareData ($context, $data) + { + $parts = $this->getParts($context); + if (! $parts) + { + return; + } + + if (isset($data->params) && $data->params instanceof Registry) + { + $data->params = $data->params->toArray(); + } + } + + public function onContentAfterTitle ($context, $item, $params, $limitstart = 0) + { + return $this->display($context, $item, $params, 1); + } + + public function onContentBeforeDisplay ($context, $item, $params, $limitstart = 0) + { + return $this->display($context, $item, $params, 2); + } + + public function onContentAfterDisplay ($context, $item, $params, $limitstart = 0) + { + return $this->display($context, $item, $params, 3); + } + + private function display ($context, $item, $params, $displayType) + { + $parts = $this->getParts($context); + if (! $parts) + { + return ''; + } + $context = $parts[0] . '.' . $parts[1]; + + if (is_string($params)) + { + $params = new Registry($params); + } + + $fields = FieldsHelper::getFields($context, $item, true); + if ($fields) + { + foreach ($fields as $key => $field) + { + $fieldDisplayType = $field->params->get('display', '-1'); + if ($fieldDisplayType == '-1') + { + $fieldDisplayType = $this->params->get('display', '2'); + } + if ($fieldDisplayType == $displayType) + { + continue; + } + unset($fields[$key]); + } + } + + if ($fields) + { + return FieldsHelper::render($context, 'fields.render', + array( + 'item' => $item, + 'context' => $context, + 'fields' => $fields, + 'container' => $params->get('fields-container'), + 'container-class' => $params->get('fields-container-class') + )); + } + return ''; + } + + public function onContentPrepare ($context, $item) + { + $parts = $this->getParts($context); + if (! $parts) + { + return; + } + + $fields = FieldsHelper::getFields($parts[0] . '.' . $parts[1], $item, true); + + // Adding the fields to the object + $item->fields = array(); + foreach ($fields as $key => $field) + { + $item->fields[$field->id] = $field; + } + + // If we don't meet all the requirements return + if (! isset($item->id) || ! $item->id || ! isset($item->text) || ! $item->text || ! JString::strpos($item->text, 'fields') !== false || + ! $this->params->get('prepare_content', '1')) + { + return true; + } + + // Count how many times we need to process the fields + $count = substr_count($item->text, '{{#fields'); + for ($i = 0; $i < $count; $i ++) + { + // Check for parameters + preg_match('/{{#fields\s*.*?}}/i', $item->text, $starts, PREG_OFFSET_CAPTURE); + preg_match('/{{\/fields}}/i', $item->text, $ends, PREG_OFFSET_CAPTURE); + + // Extract the parameters + $start = $starts[0][1] + strlen($starts[0][0]); + $end = $ends[0][1]; + $params = explode(' ', str_replace(array( + '{{#fields', + '}}' + ), '', $starts[0][0])); + + // Clone the fields because we are manipulating the array and need + // it on the next iteration again + $contextFields = array_merge(array(), $fields); + + // Loop trough the params and set them on the model + foreach ($params as $string) + { + $string = trim($string); + if (! $string) + { + continue; + } + + $paramKey = null; + $paramValue = null; + $parts = explode('=', $string); + if (count($parts) > 0) + { + $paramKey = $parts[0]; + } + if (count($parts) > 1) + { + $paramValue = $parts[1]; + } + + if ($paramKey == 'id') + { + $paramValue = explode(',', $paramValue); + JArrayHelper::toInteger($paramValue); + foreach ($contextFields as $key => $field) + { + if (! in_array($field->id, $paramValue)) + { + unset($contextFields[$key]); + } + } + } + if ($paramKey == 'alias') + { + $paramValue = explode(',', $paramValue); + foreach ($contextFields as $key => $field) + { + if (! in_array($field->alias, $paramValue)) + { + unset($contextFields[$key]); + } + } + } + } + + // Mustache can't handle arrays with unsets properly + $contextFields = array_values($contextFields); + + try + { + // Load the mustache engine + JLoader::import('components.com_fields.libraries.Mustache.Autoloader', JPATH_ADMINISTRATOR); + Mustache_Autoloader::register(); + + $m = new Mustache_Engine(); + $output = $m->render('{{#fields}}' . substr($item->text, $start, $end - $start) . '{{/fields}}', + array( + 'fields' => $contextFields + )); + + // Set the output on the item + $item->text = substr_replace($item->text, $output, $starts[0][1], $end + 13 - $starts[0][1]); + } + catch (Exception $e) + { + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'warning'); + } + } + return true; + } + + public function onAfterCleanModuleList ($modules) + { + foreach ($modules as $module) + { + $module->text = $module->content; + $this->onContentPrepare('com_modules.module', $module); + $module->content = $module->text; + unset($module->text); + } + return true; + } + + public function onPrepareFinderContent ($item) + { + $section = strtolower($item->layout); + $tax = $item->getTaxonomy('Type'); + if ($tax) + { + foreach ($tax as $context => $value) + { + // This is only a guess, needs to be improved + $component = strtolower($context); + if (strpos($context, 'com_') !== 0) + { + $component = 'com_' . $component; + } + + // Transofrm com_article to com_content + if ($component == 'com_article') + { + $component = 'com_content'; + } + + // Create a dummy object with the required fields + $tmp = new stdClass(); + $tmp->id = $item->__get('id'); + if ($item->__get('catid')) + { + $tmp->catid = $item->__get('catid'); + } + + // Getting the fields for the constructed context + $fields = FieldsHelper::getFields($component . '.' . $section, $tmp, true); + if (is_array($fields)) + { + foreach ($fields as $field) + { + // Adding the instructions how to handle the text + $item->addInstruction(FinderIndexer::TEXT_CONTEXT, $field->alias); + + // Adding the field value as a field + $item->{$field->alias} = $field->value; + } + } + } + } + return true; + } + + private function getParts ($context) + { + $parts = FieldsHelper::extract($context); + if (! $parts) + { + return null; + } + + $component = $parts[0]; + + if ($component == 'com_config' && $parts[1] == 'modules') + { + // Modules on front end editing come with com_config + $component = 'com_modules'; + $parts[0] = $component; + $parts[1] = 'module'; + } + + if ($parts[1] == 'form') + { + // The context is not from a known one, we need to do a lookup + $db = JFactory::getDbo(); + $db->setQuery('select context from #__fields where context like ' . $db->q($parts[0] . '.%') . ' group by context'); + $tmp = $db->loadObjectList(); + + if (count($tmp) == 1) + { + $parts = FieldsHelper::extract($tmp[0]->context); + if (count($parts) < 2) + { + return null; + } + } + } + + return $parts; + } +} diff --git a/plugins/system/fields/fields.xml b/plugins/system/fields/fields.xml new file mode 100644 index 0000000000000..00a34d7ad908a --- /dev/null +++ b/plugins/system/fields/fields.xml @@ -0,0 +1,43 @@ + + + plg_system_fields + Joomla! Project + November 2011 + Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. + GNU General Public License version 2 or later; see LICENSE.txt + admin@joomla.org + www.joomla.org + 3.6.0 + PLG_SYSTEM_FIELDS_XML_DESCRIPTION + + fields.php + + + en-GB.plg_system_fields.ini + en-GB.plg_system_fields.sys.ini + + + +
+ + + + + + + + + + +
+
+
+
From 6e00f1c32d44aa420856ccc7deef30cd4f8a7d75 Mon Sep 17 00:00:00 2001 From: laoneo Date: Thu, 10 Mar 2016 08:53:46 +0100 Subject: [PATCH 002/273] Integrate com_fields into com_users --- administrator/components/com_users/helpers/users.php | 11 +++++++++++ components/com_users/models/profile.php | 4 ++++ components/com_users/views/profile/view.html.php | 5 +++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/administrator/components/com_users/helpers/users.php b/administrator/components/com_users/helpers/users.php index 145cf38ac1171..a97f6ca34bbd6 100644 --- a/administrator/components/com_users/helpers/users.php +++ b/administrator/components/com_users/helpers/users.php @@ -67,6 +67,17 @@ public static function addSubmenu($vName) $vName == 'categories' || $extension == 'com_users' ); } + + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELDS'), + 'index.php?option=com_fields&context=com_users.user', + $vName == 'fields.user' + ); + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELD_CATEGORIES'), + 'index.php?option=com_categories&extension=com_users.user.fields', + $vName == 'categories.user' + ); } /** diff --git a/components/com_users/models/profile.php b/components/com_users/models/profile.php index 667311de1950e..63be275f2fc3a 100644 --- a/components/com_users/models/profile.php +++ b/components/com_users/models/profile.php @@ -192,6 +192,10 @@ public function getForm($data = array(), $loadData = true) return false; } + // For com_fields the context is com_users.user + JLoader::import('components.com_fields.helpers.fields', JPATH_ADMINISTRATOR); + FieldsHelper::prepareForm('com_users.user', $form, $data); + // Check for username compliance and parameter set $isUsernameCompliant = true; diff --git a/components/com_users/views/profile/view.html.php b/components/com_users/views/profile/view.html.php index 9a33a90d9a2de..fae0f554bab92 100644 --- a/components/com_users/views/profile/view.html.php +++ b/components/com_users/views/profile/view.html.php @@ -35,9 +35,11 @@ class UsersViewProfile extends JViewLegacy */ public function display($tpl = null) { + $user = JFactory::getUser(); + // Get the view data. $this->data = $this->get('Data'); - $this->form = $this->get('Form'); + $this->form = $this->getModel()->getForm(new JObject(array('id' => $user->id))); $this->state = $this->get('State'); $this->params = $this->state->get('params'); $this->twofactorform = $this->get('Twofactorform'); @@ -53,7 +55,6 @@ public function display($tpl = null) } // View also takes responsibility for checking if the user logged in with remember me. - $user = JFactory::getUser(); $cookieLogin = $user->get('cookieLogin'); if (!empty($cookieLogin)) From e66e302c6b9bf44d65276531df027d99836f38b4 Mon Sep 17 00:00:00 2001 From: laoneo Date: Thu, 10 Mar 2016 08:59:48 +0100 Subject: [PATCH 003/273] Remove module support, legacy from DPFields --- .../com_fields/views/field/view.html.php | 2 +- .../com_fields/views/fields/view.html.php | 2 +- plugins/system/fields/fields.php | 35 ------------------- 3 files changed, 2 insertions(+), 37 deletions(-) diff --git a/administrator/components/com_fields/views/field/view.html.php b/administrator/components/com_fields/views/field/view.html.php index 4cd17de4124e6..d9310a3626d97 100644 --- a/administrator/components/com_fields/views/field/view.html.php +++ b/administrator/components/com_fields/views/field/view.html.php @@ -112,7 +112,7 @@ protected function addToolbar () // Prepare the toolbar. JToolbarHelper::title($title, - 'folder field-' . ($isNew ? 'add' : 'edit') . ' ' . substr($component, 4) . ($section ? "-$section" : '') . '-field-' . + 'puzzle field-' . ($isNew ? 'add' : 'edit') . ' ' . substr($component, 4) . ($section ? "-$section" : '') . '-field-' . ($isNew ? 'add' : 'edit')); // For new records, check the create permission. diff --git a/administrator/components/com_fields/views/fields/view.html.php b/administrator/components/com_fields/views/fields/view.html.php index 7d7cc7647761f..9115967b3e285 100644 --- a/administrator/components/com_fields/views/fields/view.html.php +++ b/administrator/components/com_fields/views/fields/view.html.php @@ -96,7 +96,7 @@ protected function addToolbar () JHtml::_('stylesheet', $component . '/administrator/fields.css', array(), true); // Prepare the toolbar. - JToolbarHelper::title($title, 'folder fields ' . substr($component, 4) . ($section ? "-$section" : '') . '-fields'); + JToolbarHelper::title($title, 'puzzle fields ' . substr($component, 4) . ($section ? "-$section" : '') . '-fields'); if ($canDo->get('core.create')) { diff --git a/plugins/system/fields/fields.php b/plugins/system/fields/fields.php index fb3cde1182825..7b4771ddf2ea6 100644 --- a/plugins/system/fields/fields.php +++ b/plugins/system/fields/fields.php @@ -152,16 +152,6 @@ public function onContentAfterSave ($context, $item, $isNew) return true; } - public function onExtensionBeforeSave ($context, $item, $isNew) - { - return $this->onContentBeforeSave($context, $item, $isNew); - } - - public function onExtensionAfterSave ($context, $item, $isNew) - { - return $this->onContentAfterSave($context, $item, $isNew); - } - public function onUserAfterSave ($userData, $isNew, $success, $msg) { // It is not possible to manipulate the user during save events @@ -206,11 +196,6 @@ public function onContentAfterDelete ($context, $item) return true; } - public function onExtensionAfterDelete ($context, $item) - { - return $this->onContentAfterDelete($context, $item); - } - public function onUserAfterDelete ($user, $succes, $msg) { $item = new stdClass(); @@ -452,18 +437,6 @@ public function onContentPrepare ($context, $item) return true; } - public function onAfterCleanModuleList ($modules) - { - foreach ($modules as $module) - { - $module->text = $module->content; - $this->onContentPrepare('com_modules.module', $module); - $module->content = $module->text; - unset($module->text); - } - return true; - } - public function onPrepareFinderContent ($item) { $section = strtolower($item->layout); @@ -521,14 +494,6 @@ private function getParts ($context) $component = $parts[0]; - if ($component == 'com_config' && $parts[1] == 'modules') - { - // Modules on front end editing come with com_config - $component = 'com_modules'; - $parts[0] = $component; - $parts[1] = 'module'; - } - if ($parts[1] == 'form') { // The context is not from a known one, we need to do a lookup From 0a66b5a0bc6bc6eb173019f7ccc679d79b35d146 Mon Sep 17 00:00:00 2001 From: laoneo Date: Thu, 17 Mar 2016 10:46:04 +0100 Subject: [PATCH 004/273] Add the missing update script and enables the system plugin by default --- .../sql/updates/mysql/3.6.0-2016-03-17.sql | 61 +++++++++++++++++++ installation/sql/mysql/joomla.sql | 2 +- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-03-17.sql diff --git a/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-03-17.sql b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-03-17.sql new file mode 100644 index 0000000000000..7e99c06459166 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-03-17.sql @@ -0,0 +1,61 @@ +CREATE TABLE IF NOT EXISTS `#__fields` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `asset_id` int(10) NOT NULL DEFAULT 0, + `context` varchar(255) NOT NULL DEFAULT '', + `catid` int(10) NOT NULL DEFAULT 0, + `assigned_cat_ids` varchar(255) NOT NULL DEFAULT '', + `title` varchar(255) NOT NULL DEFAULT '', + `alias` varchar(255) NOT NULL DEFAULT '', + `label` varchar(255) NOT NULL DEFAULT '', + `default_value` text NOT NULL DEFAULT '', + `type` varchar(255) NOT NULL DEFAULT 'text', + `render_class` varchar(255) NOT NULL DEFAULT '', + `class` varchar(255) NOT NULL DEFAULT '', + `options` varchar(255) NOT NULL DEFAULT '', + `note` varchar(255) NOT NULL DEFAULT '', + `description` text NOT NULL, + `state` tinyint(1) NOT NULL DEFAULT '0', + `required` tinyint(1) NOT NULL DEFAULT '0', + `checked_out` int(11) NOT NULL DEFAULT '0', + `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `ordering` int(11) NOT NULL DEFAULT '0', + `params` text NOT NULL, + `fieldparams` text NOT NULL, + `attributes` text NOT NULL, + `language` char(7) NOT NULL DEFAULT '', + `created_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created_user_id` int(10) unsigned NOT NULL DEFAULT '0', + `created_by_alias` varchar(255) NOT NULL DEFAULT '', + `version` int(10) unsigned NOT NULL DEFAULT '0', + `modified_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified_by` int(10) unsigned NOT NULL DEFAULT '0', + `publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `access` int(11) NOT NULL DEFAULT '1', + `hits` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_state` (`state`), + KEY `idx_created_user_id` (`created_user_id`), + KEY `idx_access` (`access`), + KEY `idx_context` (`context`), + KEY `idx_language` (`language`) +) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; + +CREATE TABLE IF NOT EXISTS `#__fields_values` ( + `field_id` int(10) unsigned NOT NULL, + `context` varchar(255) NOT NULL, + `item_id` varchar(255) NOT NULL, + `value` text NOT NULL DEFAULT '', + KEY (`field_id`), + KEY (`context`), + KEY (`item_id`) +) DEFAULT CHARSET=utf8 ; + +INSERT INTO `#__content_types` (`type_title`, `type_alias`, `table`, `rules`, `field_mappings`, `router`, `content_history_options`) VALUES +('Field', 'com_fields.field', '{"special":{"dbtable":"#__fields","key":"id","type":"Field","prefix":"FieldsTable","config":"array()"},"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Field","prefix":"FieldsTable","config":"array()"}}', '', '{"common":{"core_content_item_id":"id","core_title":"title","core_state":"state","core_alias":"alias","core_created_time":"created_time","core_modified_time":"modified_time","core_body":"description", "core_publish_up":"publish_up","core_publish_down":"publish_down","core_access":"access", "core_language":"language", "asset_id":"asset_id"}, "special":{}}', '', '{"formFile":"administrator\\/components\\/com_fields\\/models\\/forms\\/field.xml", "hideFields":["asset_id","checked_out", "checked_out_time"],"ignoreChanges":["modified_by", "modified_time", "checked_out", "checked_out_time"],"convertToInt":["publish_up", "publish_down"],"displayLookup":[{"sourceColumn":"created_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"},{"sourceColumn":"access","targetTable":"#__viewlevels","targetColumn":"id","displayColumn":"title"},{"sourceColumn":"modified_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"} ]}'); + +INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES +(33, 'com_fields', 'component', 'com_fields', '', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0); +INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES +(455, 'plg_system_fields', 'plugin', 'fields', 'system', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0); diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index bb2dcb4ad7df9..4998d26a6579c 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -612,7 +612,7 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (452, 'plg_system_updatenotification', 'plugin', 'updatenotification', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (453, 'plg_editors-xtd_module', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (454, 'plg_system_stats', 'plugin', 'stats', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), -(455, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(455, 'plg_system_fields', 'plugin', 'fields', 'system', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (503, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (504, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (506, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), From 268c3574351b733ee0a4bd7664dd4de9a9abe2fc Mon Sep 17 00:00:00 2001 From: laoneo Date: Fri, 18 Mar 2016 06:25:48 +0100 Subject: [PATCH 005/273] Changed class doc block --- administrator/components/com_fields/controller.php | 9 +++++---- .../components/com_fields/controllers/field.php | 9 +++++---- .../components/com_fields/controllers/fields.php | 9 +++++---- administrator/components/com_fields/fields.php | 9 +++++---- administrator/components/com_fields/helpers/fields.php | 9 +++++---- .../components/com_fields/helpers/internal.php | 9 +++++---- administrator/components/com_fields/models/field.php | 9 +++++---- administrator/components/com_fields/models/fields.php | 9 +++++---- .../components/com_fields/models/fields/dprules.php | 9 +++++---- .../com_fields/models/fields/modal/field.php | 9 +++++---- .../components/com_fields/models/fields/section.php | 9 +++++---- .../components/com_fields/models/fields/type.php | 9 +++++---- .../components/com_fields/models/types/base.php | 9 +++++---- .../components/com_fields/models/types/calendar.php | 9 +++++---- .../components/com_fields/models/types/captcha.php | 9 +++++---- .../components/com_fields/models/types/checkboxes.php | 9 +++++---- .../components/com_fields/models/types/color.php | 9 +++++---- .../components/com_fields/models/types/editor.php | 9 +++++---- .../components/com_fields/models/types/email.php | 9 +++++---- .../com_fields/models/types/fields/gallery.php | 9 +++++---- .../components/com_fields/models/types/gallery.php | 9 +++++---- .../components/com_fields/models/types/imagelist.php | 9 +++++---- .../components/com_fields/models/types/integer.php | 9 +++++---- .../components/com_fields/models/types/list.php | 9 +++++---- .../components/com_fields/models/types/media.php | 9 +++++---- .../com_fields/models/types/modal_article.php | 9 +++++---- .../components/com_fields/models/types/radio.php | 9 +++++---- .../components/com_fields/models/types/sql.php | 9 +++++---- .../components/com_fields/models/types/tel.php | 9 +++++---- .../components/com_fields/models/types/text.php | 9 +++++---- .../components/com_fields/models/types/textarea.php | 9 +++++---- .../components/com_fields/models/types/timezone.php | 9 +++++---- .../components/com_fields/models/types/url.php | 9 +++++---- .../components/com_fields/models/types/user.php | 9 +++++---- .../com_fields/models/types/usergrouplist.php | 9 +++++---- .../components/com_fields/models/types/yesno.php | 9 +++++---- administrator/components/com_fields/tables/field.php | 9 +++++---- .../components/com_fields/views/field/tmpl/edit.php | 9 +++++---- .../components/com_fields/views/field/tmpl/modal.php | 9 +++++---- .../com_fields/views/field/tmpl/modal_options.php | 9 +++++---- .../components/com_fields/views/field/view.html.php | 9 +++++---- .../com_fields/views/fields/tmpl/default.php | 9 +++++---- .../views/fields/tmpl/default_batch_body.php | 9 +++++---- .../views/fields/tmpl/default_batch_footer.php | 9 +++++---- .../components/com_fields/views/fields/tmpl/modal.php | 9 +++++---- .../components/com_fields/views/fields/view.html.php | 9 +++++---- components/com_fields/controller.php | 9 +++++---- components/com_fields/controllers/field.php | 9 +++++---- components/com_fields/fields.php | 9 +++++---- components/com_fields/layouts/field/prepare/base.php | 9 +++++---- .../com_fields/layouts/field/prepare/captcha.php | 9 +++++---- .../com_fields/layouts/field/prepare/checkboxes.php | 9 +++++---- components/com_fields/layouts/field/prepare/editor.php | 9 +++++---- .../com_fields/layouts/field/prepare/gallery.php | 9 +++++---- .../com_fields/layouts/field/prepare/imagelist.php | 9 +++++---- components/com_fields/layouts/field/prepare/list.php | 9 +++++---- components/com_fields/layouts/field/prepare/media.php | 9 +++++---- .../com_fields/layouts/field/prepare/modal_article.php | 9 +++++---- components/com_fields/layouts/field/prepare/sql.php | 9 +++++---- .../com_fields/layouts/field/prepare/textarea.php | 9 +++++---- components/com_fields/layouts/field/prepare/url.php | 9 +++++---- components/com_fields/layouts/field/prepare/user.php | 9 +++++---- .../com_fields/layouts/field/prepare/usergrouplist.php | 9 +++++---- components/com_fields/layouts/field/prepare/yesno.php | 9 +++++---- components/com_fields/layouts/field/render.php | 9 +++++---- components/com_fields/layouts/fields/render.php | 9 +++++---- plugins/system/fields/fields.php | 10 ++++++---- 67 files changed, 336 insertions(+), 268 deletions(-) diff --git a/administrator/components/com_fields/controller.php b/administrator/components/com_fields/controller.php index 0ca9eba1c1a4a..cccb853838309 100644 --- a/administrator/components/com_fields/controller.php +++ b/administrator/components/com_fields/controller.php @@ -1,9 +1,10 @@ Date: Thu, 31 Mar 2016 14:29:08 +0200 Subject: [PATCH 006/273] Updated readme file --- README.md | 110 ++++++++++++++++++------------------------------------ 1 file changed, 37 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index 6ade44bbbb16d..075a255e9d38a 100644 --- a/README.md +++ b/README.md @@ -8,80 +8,44 @@ Jenkins: [![Build Status](http://build.joomla.org/job/cms/badge/icon)](http://bu What is this? --------------------- -* This is a Joomla! 3.x installation/upgrade package. -* Joomla's [Official website](https://www.joomla.org). -* Joomla! 3.5 [version history](https://docs.joomla.org/Joomla_3.5_version_history). -* Detailed changes are in the [changelog](https://github.com/joomla/joomla-cms/commits/master). +This is the official custom fields repository for the Joomla 3.6 version. Please open here issues and pull requests for feedback. + +This repository adds custom fields functionality to the Joomla CMS, based on the code of [DPFields](https://github.com/Digital-Peak/DPFields). It will be integrated as a horizontal component. This means, loading of fields into JForm and displaying them on the front is controlled trough the _Fields_ system plugin. Field management is done trough the com_fields component and will be integrated similar to com_categories as a new _Fields_ menu item in the articles manager. + +#### Testing Instructions +Please keep in mind that this repository adds two new tables and new entries to the extension table. The following test instruction acts more as a getting started guide. How to get more information can be found at the end of this file. + +##### Create a custom field +1. Log in on the back end. +2. Navigate to Content -> Articles. +3. Click on the left sidebar on Fields. +4. Click on the New button on the top. +5. Define a title and label. +6. Click the Save & Close button on the top. + +##### Create an article +1. Log in on the back end. +2. Navigate to Content -> Articles. +3. Click on the New button on the top. +4. Define a title. +5. Open the Fields tab. +6. Add some text on the custom field. +7. Click the Save & Close button on the top. + +##### View it on the front +1. Log in on the back end. +2. Create an article menu item in the menu manager and select the new article. +3. Go to the front site of your Joomla installation. +4. Open the article. +5. Check if the custom field is displayed. + +A more detailed test instruction article with screenshots can be found on our [blog](https://joomla.digital-peak.com/blog/198-custom-fields-in-joomla-3-6). We scratched here only on the surface of com_fields. If you want to check out what is all possible with this PR should have a look on the [full documentation of DPFields](https://joomla.digital-peak.com/documentation/162-dpfields). There are many options like layout overrides, inline field rendering in the article description, categories per fields, permissions. What works for DPFields will also work for com_fields. + +#### Things to clear +As the current code is more or less a one to one copy of DPFields the following approaches do need clarification: +- Is the system plugin approach right? Or should it be integrated as Observer on JTable and JModelForm? +- com_fields uses a new permission, who can edit the value of a field? Should that be made as a new permission in core too, as at the moment a field can't inherit from the categories or even the global configuration? -What is Joomla? ---------------------- -* Joomla is a **Content Management System** (CMS) which enables you to build websites and powerful online applications. -* It is a simple and powerful web server application which requires a server with PHP and either MySQL, PostgreSQL or SQL Server to run. You can find more [details here](https://www.joomla.org/about-joomla.html). -* Joomla is **free and OpenSource software** distributed under the GNU General Public License version 2 or later. - -Is Joomla! for you? ---------------------- -* Joomla is [the right solution for most content web projects](https://docs.joomla.org/Joomla_Is_it_for_me%3F). -* View Joomla's core [features here](https://www.joomla.org/core-features.html). -* Try it out for yourself in our [online demo](https://demo.joomla.org). - -How to find a Joomla! translation? ---------------------- -* Repository of [accredited language packs](http://community.joomla.org/translations.html). -* You can also add languages directly to your website via your Joomla! administration panel. - -Learn Joomla! ---------------------- -* Read ['Getting Started with Joomla!'](https://docs.joomla.org/J3.x:Getting_Started_with_Joomla!) to learn the basics. -* Before installing, read the ['Beginners' Guide'](https://docs.joomla.org/Beginners). - -What are the benefits of Joomla? ---------------------- -* The functionality of a Joomla website can be extended by installing extensions that you can create (or download) to suit your needs. -* There are many ready-made extensions that you can download and install. -* Check out the [Joomla! Extensions Directory (JED)](http://extensions.joomla.org). - -Is it easy to change the layout display? ---------------------- -* The layout is controlled by templates that you can edit. -* There are a lot of ready-made professional templates that you can download. -* Template management information is [available here](https://docs.joomla.org/Portal:Administrators#Template_Management). - -Ready to install Joomla? ---------------------- -* Check the [minimum requirements](https://www.joomla.org/technical-requirements.html). -* How do you [install Joomla](https://docs.joomla.org/Installing_Joomla!)? -* You could start your Joomla! experience by [building your site on a local test server](https://docs.joomla.org/Installing_Joomla_locally). -When ready, it can be moved to an on-line hosting account of your choice. - -Updates are free! ---------------------- -* Always use the [latest version](https://www.joomla.org/download.html). - -Where can you get support and help? ---------------------- -* [The Joomla! Documentation](https://docs.joomla.org/Main_Page); -* [Frequently Asked Questions](https://docs.joomla.org/Category:FAQ) (FAQ); -* Find the [information you need](https://docs.joomla.org/Start_here); -* Find [help and other users](https://www.joomla.org/about-joomla/create-and-share.html); -* Post questions at [our forums](http://forum.joomla.org); -* [Joomla Resources Directory](http://resources.joomla.org/) (JRD). - -Do you already have a Joomla site that isn't built with Joomla 3.x? ---------------------- -* What's [new in Joomla! 3.x](https://www.joomla.org/3)? -* What are the [main differences between 2.5 and 3.x](https://docs.joomla.org/What_are_the_major_differences_between_Joomla!_2.5_and_3.x%3F)? -* How to [migrate from 2.5.x to 3.x](https://docs.joomla.org/Joomla_2.5_to_3.x_Step_by_Step_Migration). -* How to [migrate from 1.5.x to 3.x](https://docs.joomla.org/Joomla_1.5_to_3.x_Step_by_Step_Migration). -* How to [convert an existing website to Joomla](https://docs.joomla.org/How_to_Convert_an_existing_Web_site_to_a_Joomla!_Web_site). - -Do you want to improve Joomla? --------------------- -* How do you [request a feature](https://docs.joomla.org/How_do_you_request_a_feature%3F)? -* How do you [report a bug](https://docs.joomla.org/Filing_bugs_and_issues)? -* Get Involved: Joomla! is community developed software. [Join the community](https://volunteers.joomla.org/). -* Documentation for [Developers](https://docs.joomla.org/Developers). -* Documentation for [Web designers](https://docs.joomla.org/Web_designers). Copyright --------------------- From d5c8cfdfb45be82daabc194e67316cbb802b5113 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Thu, 31 Mar 2016 16:38:09 +0200 Subject: [PATCH 007/273] Language changes First pass at bringing the language file inline with the style guide --- .../language/en-GB/en-GB.com_fields.ini | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/administrator/language/en-GB/en-GB.com_fields.ini b/administrator/language/en-GB/en-GB.com_fields.ini index f565d0cbcf60d..9e30254499e4d 100644 --- a/administrator/language/en-GB/en-GB.com_fields.ini +++ b/administrator/language/en-GB/en-GB.com_fields.ini @@ -3,9 +3,9 @@ COM_FIELDS_XML_DESCRIPTION="Component to manage custom fields." ; Types COM_FIELDS_TYPE_CALENDAR="Calendar" -COM_FIELDS_TYPE_CAPTCHA="Captcha" -COM_FIELDS_TYPE_CHECKBOXES="Checkboxes" -COM_FIELDS_TYPE_COLOR="Color" +COM_FIELDS_TYPE_CAPTCHA="CAPTCHA" +COM_FIELDS_TYPE_CHECKBOXES="Checkbox" +COM_FIELDS_TYPE_COLOR="Colour" COM_FIELDS_TYPE_EDITOR="Editor" COM_FIELDS_TYPE_EMAIL="Email" COM_FIELDS_TYPE_GALLERY="Gallery" @@ -15,12 +15,12 @@ COM_FIELDS_TYPE_LIST="List" COM_FIELDS_TYPE_MEDIA="Media" COM_FIELDS_TYPE_MODAL_ARTICLE="Article" COM_FIELDS_TYPE_RADIO="Radio" -COM_FIELDS_TYPE_SQL="Sql" +COM_FIELDS_TYPE_SQL="SQL" COM_FIELDS_TYPE_TEL="Telephone" COM_FIELDS_TYPE_TEXT="Text" COM_FIELDS_TYPE_TEXTAREA="Textarea" COM_FIELDS_TYPE_TIMEZONE="Timezone" -COM_FIELDS_TYPE_URL="Url" +COM_FIELDS_TYPE_URL="URL" COM_FIELDS_TYPE_USER="User" COM_FIELDS_TYPE_USERGROUPLIST="Usergroup" COM_FIELDS_TYPE_YESNO="Yes No" @@ -52,10 +52,10 @@ COM_FIELDS_FIELD_FIELD_DISABLED_DESC="Is the field disabled in the edit form." COM_FIELDS_FIELD_FIELD_SHOW_ON_LABEL="Show On" COM_FIELDS_FIELD_FIELD_SHOW_ON_DESC="On which part of the site should the field be shown." COM_FIELDS_FIELD_FIELD_SHOW_ON_SITE="Site" -COM_FIELDS_FIELD_FIELD_SHOW_ON_ADMIN="Admin" -COM_FIELDS_FIELD_FIELD_SHOW_ON_BOTH="Site and Admin" +COM_FIELDS_FIELD_FIELD_SHOW_ON_ADMIN="Administrator" +COM_FIELDS_FIELD_FIELD_SHOW_ON_BOTH="Site and Administrator" COM_FIELDS_FIELD_FIELD_DISPLAY_LABEL="Automatic Display" -COM_FIELDS_FIELD_FIELD_DISPLAY_DESC="Joomla offers some content events which are triggered during content creation process. Here is the place to define how the custom fields should be integrated into content." +COM_FIELDS_FIELD_FIELD_DISPLAY_DESC="Joomla offers some content events which are triggered during the content creation process. This is the place to define how the custom fields should be integrated into content." COM_FIELDS_FIELD_FIELD_DISPLAY_AFTER_TITLE="After Title" COM_FIELDS_FIELD_FIELD_DISPLAY_BEFORE_DISPLAY="Before Display" COM_FIELDS_FIELD_FIELD_DISPLAY_AFTER_DISPLAY="After Display" @@ -68,7 +68,7 @@ COM_FIELDS_FIELD_FIELD_RENDER_CLASS_DESC="The class attributes of the field when COM_FIELDS_FIELD_FIELD_CLASS_LABEL="Class" COM_FIELDS_FIELD_FIELD_CLASS_DESC="The class attributes of the field in the edit form. If different classes are needed, list them with spaces." COM_FIELDS_FIELD_FIELD_NOTE_LABEL="Note" -COM_FIELDS_FIELD_FIELD_NOTE_DESC="An optional note of the field." +COM_FIELDS_FIELD_FIELD_NOTE_DESC="An optional note for the field." COM_FIELDS_FIELD_FIELD_DESCRIPTION_DESC="The description of the field." COM_FIELDS_FIELD_FIELD_LANGUAGE_DESC="Assign a language to this field." COM_FIELDS_FIELD_FIELD_IMAGE_LABEL="Image" @@ -83,24 +83,24 @@ COM_FIELDS_FIELD_FIELD_PERMISSION_EDITSTATE_DESC="New setting for edit s COM_FIELDS_FIELD_FIELD_PERMISSION_EDIT_VALUE_LABEL="Edit Field Value" COM_FIELDS_FIELD_FIELD_PERMISSION_EDIT_VALUE_DESC="Who can edit the field value in the form editor." COM_FIELDS_FIELD_FIELD_CATEGORY_LABEL="Fields Category" -COM_FIELDS_FIELD_FIELD_CATEGORY_DESC="The fields category this field belongs to." +COM_FIELDS_FIELD_FIELD_CATEGORY_DESC="The category this field belongs to." COM_FIELDS_FIELD_FIELD_OUTPUT_LABEL="Output" COM_FIELDS_FIELD_FIELD_OUTPUT_DESC="The output of the field. If not empty then the field is rendered with the mustache codes." ; Field Types COM_FIELDS_FIELD_FIELD_TEXTAREA_ROWS_LABEL="Rows" -COM_FIELDS_FIELD_FIELD_TEXTAREA_ROWS_DESC="The amount of rows of the field." +COM_FIELDS_FIELD_FIELD_TEXTAREA_ROWS_DESC="The number of rows of the field." COM_FIELDS_FIELD_FIELD_TEXTAREA_COLS_LABEL="Columns" -COM_FIELDS_FIELD_FIELD_TEXTAREA_COLS_DESC="The amount of columns of the field." +COM_FIELDS_FIELD_FIELD_TEXTAREA_COLS_DESC="The number of columns of the field." -COM_FIELDS_FIELD_FIELD_EDITOR_SHOW_BUTTONS_LABEL="Show buttons" +COM_FIELDS_FIELD_FIELD_EDITOR_SHOW_BUTTONS_LABEL="Show Buttons" COM_FIELDS_FIELD_FIELD_EDITOR_SHOW_BUTTONS_DESC="Should the buttons being shown." COM_FIELDS_FIELD_FIELD_EDITOR_BUTTONS_HIDE_LABEL="Hide Buttons" COM_FIELDS_FIELD_FIELD_EDITOR_BUTTONS_HIDE_DESC="Hide the buttons in the comma separated list." COM_FIELDS_FIELD_FIELD_EDITOR_WIDTH_LABEL="Width" -COM_FIELDS_FIELD_FIELD_EDITOR_WIDTH_DESC="Defines the width (in pixels) of the wysiwyg editor and defaults to 100%" +COM_FIELDS_FIELD_FIELD_EDITOR_WIDTH_DESC="Defines the width (in pixels) of the WYSIWYG editor and defaults to 100%" COM_FIELDS_FIELD_FIELD_EDITOR_HEIGHT_LABEL="Height" -COM_FIELDS_FIELD_FIELD_EDITOR_HEIGHT_DESC="Defines the height (in pixels) of the wysiwyg editor and defaults to 250px" +COM_FIELDS_FIELD_FIELD_EDITOR_HEIGHT_DESC="Defines the height (in pixels) of the WYSIWYG editor and defaults to 250px" COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_LABEL="Multiple" COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_DESC="Allow multiple values to be selected." @@ -128,10 +128,10 @@ COM_FIELDS_FIELD_FIELD_SQL_QUERY_DESC="The SQL query which will provide the data COM_FIELDS_FIELD_FIELD_URL_SCHEMES_LABEL="Schemes" COM_FIELDS_FIELD_FIELD_URL_SCHEMES_DESC="The allowed schemes." COM_FIELDS_FIELD_FIELD_URL_RELATIVE_LABEL="Relative" -COM_FIELDS_FIELD_FIELD_URL_RELATIVE_DESC="Are relative urls allowed." +COM_FIELDS_FIELD_FIELD_URL_RELATIVE_DESC="Are relative URLs allowed." COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_LABEL="Preview" -COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_DESC="Shows or hides the preview of the currently chosen image." +COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_DESC="Shows or hides the preview of the selected image." COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_TOOLTIP="Tooltip" COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_INLINE="Inline" COM_FIELDS_FIELD_FIELD_MEDIA_IMAGE_CLASS_LABEL="Image Class" From 84d6460c7d614d752e766ce8477626a96b43b929 Mon Sep 17 00:00:00 2001 From: Allon Moritz Date: Thu, 31 Mar 2016 17:27:30 +0200 Subject: [PATCH 008/273] Fixes installer Closes #2. --- installation/sql/mysql/joomla.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index b99ee238bd45a..095c1be335f86 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -612,7 +612,7 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (452, 'plg_system_updatenotification', 'plugin', 'updatenotification', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (453, 'plg_editors-xtd_module', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (454, 'plg_system_stats', 'plugin', 'stats', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), -(455, 'plg_system_fields', 'plugin', 'fields', 'system', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(455, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (503, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (504, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (506, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), From d8a15da047839b0e9685941d23bcf0a032ffded2 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Thu, 31 Mar 2016 17:36:51 +0200 Subject: [PATCH 009/273] Alpha sort language file Simple PR to alpha sort the language files BUT keep the existing groups etc --- .../language/en-GB/en-GB.com_fields.ini | 164 +++++++++--------- 1 file changed, 81 insertions(+), 83 deletions(-) diff --git a/administrator/language/en-GB/en-GB.com_fields.ini b/administrator/language/en-GB/en-GB.com_fields.ini index 9e30254499e4d..f274524e5c6e0 100644 --- a/administrator/language/en-GB/en-GB.com_fields.ini +++ b/administrator/language/en-GB/en-GB.com_fields.ini @@ -26,123 +26,121 @@ COM_FIELDS_TYPE_USERGROUPLIST="Usergroup" COM_FIELDS_TYPE_YESNO="Yes No" ; Views -COM_FIELDS_VIEW_FIELDS_TITLE="%s Fields" COM_FIELDS_VIEW_FIELDS_BASE_TITLE="Fields" +COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS="Batch process the selected fields." COM_FIELDS_VIEW_FIELDS_SORT_TYPE_ASC="Type ascending" COM_FIELDS_VIEW_FIELDS_SORT_TYPE_DESC="Type descending" -COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS="Batch process the selected fields." - +COM_FIELDS_VIEW_FIELDS_TITLE="%s Fields" COM_FIELDS_VIEW_FIELD_ADD_TITLE="%s Fields: New" -COM_FIELDS_VIEW_FIELD_EDIT_TITLE="%s Fields: Edit" COM_FIELDS_VIEW_FIELD_BASE_ADD_TITLE="Fields: New" COM_FIELDS_VIEW_FIELD_BASE_EDIT_TITLE="Fields: Edit" +COM_FIELDS_VIEW_FIELD_EDIT_TITLE="%s Fields: Edit" COM_FIELDS_VIEW_FIELD_FIELDSET_GENERAL="General" COM_FIELDS_VIEW_FIELD_FIELDSET_PUBLISHING="Publishing" COM_FIELDS_VIEW_FIELD_FIELDSET_RULES="Permissions" ; Fields General -COM_FIELDS_FIELD_FIELD_TYPE_LABEL="Type" -COM_FIELDS_FIELD_FIELD_TYPE_DESC="The type of the field." -COM_FIELDS_FIELD_FIELD_LABEL_LABEL="Label" -COM_FIELDS_FIELD_FIELD_LABEL_DESC="The label of the field to display." -COM_FIELDS_FIELD_FIELD_REQUIRED_LABEL="Is Required" -COM_FIELDS_FIELD_FIELD_REQUIRED_DESC="Is this a mandatory field for the editor?" -COM_FIELDS_FIELD_FIELD_DISABLED_LABEL="Disabled" +COM_FIELDS_FIELD_FIELD_CATEGORY_DESC="The category this field belongs to." +COM_FIELDS_FIELD_FIELD_CATEGORY_LABEL="Fields Category" +COM_FIELDS_FIELD_FIELD_CLASS_DESC="The class attributes of the field in the edit form. If different classes are needed, list them with spaces." +COM_FIELDS_FIELD_FIELD_CLASS_LABEL="Class" +COM_FIELDS_FIELD_FIELD_DEFAULT_VALUE_DESC="The default value of the field." +COM_FIELDS_FIELD_FIELD_DEFAULT_VALUE_LABEL="Default Value" +COM_FIELDS_FIELD_FIELD_DESCRIPTION_DESC="The description of the field." COM_FIELDS_FIELD_FIELD_DISABLED_DESC="Is the field disabled in the edit form." -COM_FIELDS_FIELD_FIELD_SHOW_ON_LABEL="Show On" -COM_FIELDS_FIELD_FIELD_SHOW_ON_DESC="On which part of the site should the field be shown." -COM_FIELDS_FIELD_FIELD_SHOW_ON_SITE="Site" -COM_FIELDS_FIELD_FIELD_SHOW_ON_ADMIN="Administrator" -COM_FIELDS_FIELD_FIELD_SHOW_ON_BOTH="Site and Administrator" -COM_FIELDS_FIELD_FIELD_DISPLAY_LABEL="Automatic Display" -COM_FIELDS_FIELD_FIELD_DISPLAY_DESC="Joomla offers some content events which are triggered during the content creation process. This is the place to define how the custom fields should be integrated into content." +COM_FIELDS_FIELD_FIELD_DISABLED_LABEL="Disabled" +COM_FIELDS_FIELD_FIELD_DISPLAY_AFTER_DISPLAY="After Display" COM_FIELDS_FIELD_FIELD_DISPLAY_AFTER_TITLE="After Title" COM_FIELDS_FIELD_FIELD_DISPLAY_BEFORE_DISPLAY="Before Display" -COM_FIELDS_FIELD_FIELD_DISPLAY_AFTER_DISPLAY="After Display" -COM_FIELDS_FIELD_FIELD_READONLY_LABEL="Read-Only" -COM_FIELDS_FIELD_FIELD_READONLY_DESC="Is the field read only in the edit form." -COM_FIELDS_FIELD_FIELD_DEFAULT_VALUE_LABEL="Default Value" -COM_FIELDS_FIELD_FIELD_DEFAULT_VALUE_DESC="The default value of the field." -COM_FIELDS_FIELD_FIELD_RENDER_CLASS_LABEL="Render Class" -COM_FIELDS_FIELD_FIELD_RENDER_CLASS_DESC="The class attributes of the field when the field is rendered. If different classes are needed, list them with spaces." -COM_FIELDS_FIELD_FIELD_CLASS_LABEL="Class" -COM_FIELDS_FIELD_FIELD_CLASS_DESC="The class attributes of the field in the edit form. If different classes are needed, list them with spaces." -COM_FIELDS_FIELD_FIELD_NOTE_LABEL="Note" -COM_FIELDS_FIELD_FIELD_NOTE_DESC="An optional note for the field." -COM_FIELDS_FIELD_FIELD_DESCRIPTION_DESC="The description of the field." -COM_FIELDS_FIELD_FIELD_LANGUAGE_DESC="Assign a language to this field." -COM_FIELDS_FIELD_FIELD_IMAGE_LABEL="Image" -COM_FIELDS_FIELD_FIELD_IMAGE_DESC="Image label." -COM_FIELDS_FIELD_FIELD_IMAGE_ALT_LABEL="Image Alternate Text" +COM_FIELDS_FIELD_FIELD_DISPLAY_DESC="Joomla offers some content events which are triggered during the content creation process. This is the place to define how the custom fields should be integrated into content." +COM_FIELDS_FIELD_FIELD_DISPLAY_LABEL="Automatic Display" COM_FIELDS_FIELD_FIELD_IMAGE_ALT_DESC="The alternate text for the image." +COM_FIELDS_FIELD_FIELD_IMAGE_ALT_LABEL="Image Alternate Text" +COM_FIELDS_FIELD_FIELD_IMAGE_DESC="Image label." +COM_FIELDS_FIELD_FIELD_IMAGE_LABEL="Image" +COM_FIELDS_FIELD_FIELD_LABEL_DESC="The label of the field to display." +COM_FIELDS_FIELD_FIELD_LABEL_LABEL="Label" +COM_FIELDS_FIELD_FIELD_LANGUAGE_DESC="Assign a language to this field." +COM_FIELDS_FIELD_FIELD_NOTE_DESC="An optional note for the field." +COM_FIELDS_FIELD_FIELD_NOTE_LABEL="Note" +COM_FIELDS_FIELD_FIELD_OUTPUT_DESC="The output of the field. If not empty then the field is rendered with the mustache codes." +COM_FIELDS_FIELD_FIELD_OUTPUT_LABEL="Output" COM_FIELDS_FIELD_FIELD_PERMISSION_CREATE_DESC="New setting for create actions in this field and the calculated setting based on the parent extension and group permissions." COM_FIELDS_FIELD_FIELD_PERMISSION_DELETE_DESC="New setting for delete actions on this field and the calculated setting based on the parent extension and group permissions." -COM_FIELDS_FIELD_FIELD_PERMISSION_EDIT_DESC="New setting for edit actions on this field and the calculated setting based on the parent extension and group permissions." COM_FIELDS_FIELD_FIELD_PERMISSION_EDITOWN_DESC="New setting for edit own actions on this field and the calculated setting based on the parent extension and group permissions." COM_FIELDS_FIELD_FIELD_PERMISSION_EDITSTATE_DESC="New setting for edit state actions on this field and the calculated setting based on the parent extension and group permissions." -COM_FIELDS_FIELD_FIELD_PERMISSION_EDIT_VALUE_LABEL="Edit Field Value" +COM_FIELDS_FIELD_FIELD_PERMISSION_EDIT_DESC="New setting for edit actions on this field and the calculated setting based on the parent extension and group permissions." COM_FIELDS_FIELD_FIELD_PERMISSION_EDIT_VALUE_DESC="Who can edit the field value in the form editor." -COM_FIELDS_FIELD_FIELD_CATEGORY_LABEL="Fields Category" -COM_FIELDS_FIELD_FIELD_CATEGORY_DESC="The category this field belongs to." -COM_FIELDS_FIELD_FIELD_OUTPUT_LABEL="Output" -COM_FIELDS_FIELD_FIELD_OUTPUT_DESC="The output of the field. If not empty then the field is rendered with the mustache codes." +COM_FIELDS_FIELD_FIELD_PERMISSION_EDIT_VALUE_LABEL="Edit Field Value" +COM_FIELDS_FIELD_FIELD_READONLY_DESC="Is the field read only in the edit form." +COM_FIELDS_FIELD_FIELD_READONLY_LABEL="Read-Only" +COM_FIELDS_FIELD_FIELD_RENDER_CLASS_DESC="The class attributes of the field when the field is rendered. If different classes are needed, list them with spaces." +COM_FIELDS_FIELD_FIELD_RENDER_CLASS_LABEL="Render Class" +COM_FIELDS_FIELD_FIELD_REQUIRED_DESC="Is this a mandatory field for the editor?" +COM_FIELDS_FIELD_FIELD_REQUIRED_LABEL="Is Required" +COM_FIELDS_FIELD_FIELD_SHOW_ON_ADMIN="Administrator" +COM_FIELDS_FIELD_FIELD_SHOW_ON_BOTH="Site and Administrator" +COM_FIELDS_FIELD_FIELD_SHOW_ON_DESC="On which part of the site should the field be shown." +COM_FIELDS_FIELD_FIELD_SHOW_ON_LABEL="Show On" +COM_FIELDS_FIELD_FIELD_SHOW_ON_SITE="Site" +COM_FIELDS_FIELD_FIELD_TYPE_DESC="The type of the field." +COM_FIELDS_FIELD_FIELD_TYPE_LABEL="Type" ; Field Types -COM_FIELDS_FIELD_FIELD_TEXTAREA_ROWS_LABEL="Rows" -COM_FIELDS_FIELD_FIELD_TEXTAREA_ROWS_DESC="The number of rows of the field." -COM_FIELDS_FIELD_FIELD_TEXTAREA_COLS_LABEL="Columns" -COM_FIELDS_FIELD_FIELD_TEXTAREA_COLS_DESC="The number of columns of the field." +COM_FIELDS_FIELD_FIELD_CALENDAR_FORMAT_DESC="The date format to be used. This is in the format used by PHP to specify date string formats (see below). If no format argument is given, '%Y-%m-%d' is assumed (giving dates like '2008-04-16')." +COM_FIELDS_FIELD_FIELD_CALENDAR_FORMAT_LABEL="Format" -COM_FIELDS_FIELD_FIELD_EDITOR_SHOW_BUTTONS_LABEL="Show Buttons" -COM_FIELDS_FIELD_FIELD_EDITOR_SHOW_BUTTONS_DESC="Should the buttons being shown." -COM_FIELDS_FIELD_FIELD_EDITOR_BUTTONS_HIDE_LABEL="Hide Buttons" COM_FIELDS_FIELD_FIELD_EDITOR_BUTTONS_HIDE_DESC="Hide the buttons in the comma separated list." -COM_FIELDS_FIELD_FIELD_EDITOR_WIDTH_LABEL="Width" -COM_FIELDS_FIELD_FIELD_EDITOR_WIDTH_DESC="Defines the width (in pixels) of the WYSIWYG editor and defaults to 100%" -COM_FIELDS_FIELD_FIELD_EDITOR_HEIGHT_LABEL="Height" +COM_FIELDS_FIELD_FIELD_EDITOR_BUTTONS_HIDE_LABEL="Hide Buttons" COM_FIELDS_FIELD_FIELD_EDITOR_HEIGHT_DESC="Defines the height (in pixels) of the WYSIWYG editor and defaults to 250px" +COM_FIELDS_FIELD_FIELD_EDITOR_HEIGHT_LABEL="Height" +COM_FIELDS_FIELD_FIELD_EDITOR_SHOW_BUTTONS_DESC="Should the buttons being shown." +COM_FIELDS_FIELD_FIELD_EDITOR_SHOW_BUTTONS_LABEL="Show Buttons" +COM_FIELDS_FIELD_FIELD_EDITOR_WIDTH_DESC="Defines the width (in pixels) of the WYSIWYG editor and defaults to 100%" +COM_FIELDS_FIELD_FIELD_EDITOR_WIDTH_LABEL="Width" -COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_LABEL="Multiple" -COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_DESC="Allow multiple values to be selected." -COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_LABEL="Options" -COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_DESC="The options of the list." -COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_KEY_LABEL="Key" -COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_VALUE_LABEL="Value" - -COM_FIELDS_FIELD_FIELD_CALENDAR_FORMAT_LABEL="Format" -COM_FIELDS_FIELD_FIELD_CALENDAR_FORMAT_DESC="The date format to be used. This is in the format used by PHP to specify date string formats (see below). If no format argument is given, '%Y-%m-%d' is assumed (giving dates like '2008-04-16')." +COM_FIELDS_FIELD_FIELD_GALLERY_MAX_WIDTH_DESC="The max width of the image. The image will be resized on the fly." +COM_FIELDS_FIELD_FIELD_GALLERY_MAX_WIDTH_LABEL="Max Width" +COM_FIELDS_FIELD_FIELD_GALLERY_RECURSIVE_DESC="Should the images from the subfolders also be included." +COM_FIELDS_FIELD_FIELD_GALLERY_RECURSIVE_LABEL="Recursive" +COM_FIELDS_FIELD_FIELD_GALLERY_THUMBNAIL_WIDTH_DESC="The width of the thumbnails. The thumbnails will be resized on the fly." +COM_FIELDS_FIELD_FIELD_GALLERY_THUMBNAIL_WIDTH_LABEL="Thumbnail Width" -COM_FIELDS_FIELD_FIELD_INTEGER_FIRST_LABEL="First" +COM_FIELDS_FIELD_FIELD_IMAGELIST_DIRECTORY_DESC="The filesystem path to the directory containing the image files to be listed." +COM_FIELDS_FIELD_FIELD_IMAGELIST_DIRECTORY_LABEL="Directory" COM_FIELDS_FIELD_FIELD_INTEGER_FIRST_DESC="This value is the lowest on the list." -COM_FIELDS_FIELD_FIELD_INTEGER_LAST_LABEL="Last" +COM_FIELDS_FIELD_FIELD_INTEGER_FIRST_LABEL="First" COM_FIELDS_FIELD_FIELD_INTEGER_LAST_DESC="This value is the highest on the list." -COM_FIELDS_FIELD_FIELD_INTEGER_STEP_LABEL="Step" +COM_FIELDS_FIELD_FIELD_INTEGER_LAST_LABEL="Last" COM_FIELDS_FIELD_FIELD_INTEGER_STEP_DESC="Each option will be the previous option incremented by this integer, starting with the first value until the last value is reached." +COM_FIELDS_FIELD_FIELD_INTEGER_STEP_LABEL="Step" -COM_FIELDS_FIELD_FIELD_IMAGELIST_DIRECTORY_LABEL="Directory" -COM_FIELDS_FIELD_FIELD_IMAGELIST_DIRECTORY_DESC="The filesystem path to the directory containing the image files to be listed." - -COM_FIELDS_FIELD_FIELD_SQL_QUERY_LABEL="Query" -COM_FIELDS_FIELD_FIELD_SQL_QUERY_DESC="The SQL query which will provide the data for the drop-down list. The query must return two columns; one called 'value' which will hold the values of the list items; the other called 'text' containing the text in the drop-down list." - -COM_FIELDS_FIELD_FIELD_URL_SCHEMES_LABEL="Schemes" -COM_FIELDS_FIELD_FIELD_URL_SCHEMES_DESC="The allowed schemes." -COM_FIELDS_FIELD_FIELD_URL_RELATIVE_LABEL="Relative" -COM_FIELDS_FIELD_FIELD_URL_RELATIVE_DESC="Are relative URLs allowed." +COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_DESC="Allow multiple values to be selected." +COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_LABEL="Multiple" +COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_DESC="The options of the list." +COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_KEY_LABEL="Key" +COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_LABEL="Options" +COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_VALUE_LABEL="Value" -COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_LABEL="Preview" +COM_FIELDS_FIELD_FIELD_MEDIA_IMAGE_CLASS_DESC="The class which is added to the image (src tag)." +COM_FIELDS_FIELD_FIELD_MEDIA_IMAGE_CLASS_LABEL="Image Class" COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_DESC="Shows or hides the preview of the selected image." -COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_TOOLTIP="Tooltip" COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_INLINE="Inline" -COM_FIELDS_FIELD_FIELD_MEDIA_IMAGE_CLASS_LABEL="Image Class" -COM_FIELDS_FIELD_FIELD_MEDIA_IMAGE_CLASS_DESC="The class which is added to the image (src tag)." +COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_LABEL="Preview" +COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_TOOLTIP="Tooltip" -COM_FIELDS_FIELD_FIELD_GALLERY_MAX_WIDTH_LABEL="Max Width" -COM_FIELDS_FIELD_FIELD_GALLERY_MAX_WIDTH_DESC="The max width of the image. The image will be resized on the fly." -COM_FIELDS_FIELD_FIELD_GALLERY_THUMBNAIL_WIDTH_LABEL="Thumbnail Width" -COM_FIELDS_FIELD_FIELD_GALLERY_THUMBNAIL_WIDTH_DESC="The width of the thumbnails. The thumbnails will be resized on the fly." -COM_FIELDS_FIELD_FIELD_GALLERY_RECURSIVE_LABEL="Recursive" -COM_FIELDS_FIELD_FIELD_GALLERY_RECURSIVE_DESC="Should the images from the subfolders also be included." +COM_FIELDS_FIELD_FIELD_SQL_QUERY_DESC="The SQL query which will provide the data for the drop-down list. The query must return two columns; one called 'value' which will hold the values of the list items; the other called 'text' containing the text in the drop-down list." +COM_FIELDS_FIELD_FIELD_SQL_QUERY_LABEL="Query" + +COM_FIELDS_FIELD_FIELD_TEXTAREA_COLS_DESC="The number of columns of the field." +COM_FIELDS_FIELD_FIELD_TEXTAREA_COLS_LABEL="Columns" +COM_FIELDS_FIELD_FIELD_TEXTAREA_ROWS_DESC="The number of rows of the field." +COM_FIELDS_FIELD_FIELD_TEXTAREA_ROWS_LABEL="Rows" + +COM_FIELDS_FIELD_FIELD_URL_RELATIVE_DESC="Are relative URLs allowed." +COM_FIELDS_FIELD_FIELD_URL_RELATIVE_LABEL="Relative" +COM_FIELDS_FIELD_FIELD_URL_SCHEMES_DESC="The allowed schemes." +COM_FIELDS_FIELD_FIELD_URL_SCHEMES_LABEL="Schemes" ; Actions COM_FIELDS_N_ITEMS_ARCHIVED="%d fields successfully archived" @@ -150,6 +148,7 @@ COM_FIELDS_N_ITEMS_ARCHIVED_1="%d field successfully archived" COM_FIELDS_N_ITEMS_CHECKED_IN_0="No field successfully checked in" COM_FIELDS_N_ITEMS_CHECKED_IN_1="%d field successfully checked in" COM_FIELDS_N_ITEMS_CHECKED_IN_MORE="%d fields successfully checked in" +COM_FIELDS_N_ITEMS_CREATED="%d fields successfully created in calendar %s" COM_FIELDS_N_ITEMS_DELETED="%d fields successfully deleted" COM_FIELDS_N_ITEMS_DELETED_1="%d field successfully deleted" COM_FIELDS_N_ITEMS_PUBLISHED="%d fields successfully published" @@ -158,7 +157,6 @@ COM_FIELDS_N_ITEMS_TRASHED="%d fields successfully trashed" COM_FIELDS_N_ITEMS_TRASHED_1="%d field successfully trashed" COM_FIELDS_N_ITEMS_UNPUBLISHED="%d fields successfully unpublished" COM_FIELDS_N_ITEMS_UNPUBLISHED_1="%d field successfully unpublished" -COM_FIELDS_N_ITEMS_CREATED="%d fields successfully created in calendar %s" COM_FIELDS_N_ITEMS_UPDATED="%d fields successfully updated in calendar %s" COM_FIELDS_TYPE_GALLERY_IMAGE_ERROR="Error precessing the image %s: %s" From 09286b88d705776e41d09ebb96deec81731ee360 Mon Sep 17 00:00:00 2001 From: zero-24 Date: Thu, 31 Mar 2016 20:26:33 +0200 Subject: [PATCH 010/273] Update fields.php --- plugins/system/fields/fields.php | 181 ++++++++++++++++++++----------- 1 file changed, 117 insertions(+), 64 deletions(-) diff --git a/plugins/system/fields/fields.php b/plugins/system/fields/fields.php index c5b83cdac466a..b5a767b14122c 100644 --- a/plugins/system/fields/fields.php +++ b/plugins/system/fields/fields.php @@ -7,21 +7,30 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; use Joomla\Registry\Registry; JLoader::import('joomla.filesystem.folder'); JLoader::import('joomla.filesystem.file'); - JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php'); +/** + * Fields Plugin + * + * @since 3.6 + */ class PlgSystemFields extends JPlugin { - + /** + * Load the language file on instantiation. + * + * @var boolean + * @since 3.6 + */ protected $autoloadLanguage = true; - public function onContentBeforeSave ($context, $item, $isNew) + public function onContentBeforeSave($context, $item, $isNew) { // Load the category context based on the extension if ($context == 'com_categories.category') @@ -30,15 +39,18 @@ public function onContentBeforeSave ($context, $item, $isNew) } $parts = $this->getParts($context); - if (! $parts) + + if (!$parts) { return true; } + $context = $parts[0] . '.' . $parts[1]; // Loading the fields $fieldsObjects = FieldsHelper::getFields($context, $item); - if (! $fieldsObjects) + + if (!$fieldsObjects) { return true; } @@ -47,6 +59,7 @@ public function onContentBeforeSave ($context, $item, $isNew) // Load the item params from the request $data = JFactory::getApplication()->input->post->get('jform', array(), 'array'); + if (key_exists('params', $data)) { $params->loadArray($data['params']); @@ -57,19 +70,21 @@ public function onContentBeforeSave ($context, $item, $isNew) { $params->loadString($item->params); } + $params = $params->toArray(); - if (! $params) + if (!$params) { return true; } // Create the new internal fields field $fields = array(); + foreach ($fieldsObjects as $field) { // Only safe the fields with the alias from the data - if (! key_exists($field->alias, $params)) + if (!key_exists($field->alias, $params)) { continue; } @@ -90,7 +105,7 @@ public function onContentBeforeSave ($context, $item, $isNew) } } - public function onContentAfterSave ($context, $item, $isNew) + public function onContentAfterSave($context, $item, $isNew) { // Load the category context based on the extension if ($context == 'com_categories.category') @@ -99,50 +114,54 @@ public function onContentAfterSave ($context, $item, $isNew) } $parts = $this->getParts($context); - if (! $parts) + + if (!$parts) { return true; } + $context = $parts[0] . '.' . $parts[1]; // Return if the item has no valid state $fields = null; + if (isset($item->_fields)) { $fields = $item->_fields; } - if (! $fields) + if (!$fields) { return true; } // Loading the fields $fieldsObjects = FieldsHelper::getFields($context, $item); - if (! $fieldsObjects) + + if (!$fieldsObjects) { return true; } // Loading the model - $model = JModelLegacy::getInstance('Field', 'FieldsModel', array( - 'ignore_request' => true - )); + $model = JModelLegacy::getInstance('Field', 'FieldsModel', array('ignore_request' => true)); + foreach ($fieldsObjects as $field) { // Only safe the fields with the alias from the data - if (! key_exists($field->alias, $fields)) + if (!key_exists($field->alias, $fields)) { continue; } $id = null; + if (isset($item->id)) { $id = $item->id; } - if (! $id) + if (!$id) { continue; } @@ -154,13 +173,13 @@ public function onContentAfterSave ($context, $item, $isNew) return true; } - public function onUserAfterSave ($userData, $isNew, $success, $msg) + public function onUserAfterSave($userData, $isNew, $success, $msg) { // It is not possible to manipulate the user during save events // http://joomla.stackexchange.com/questions/10693/changing-user-group-in-onuserbeforesave-of-user-profile-plugin-doesnt-work // Check if data is valid or we are in a recursion - if (! $userData['id'] || ! $success) + if (!$userData['id'] || !$success) { return true; } @@ -175,37 +194,40 @@ public function onUserAfterSave ($userData, $isNew, $success, $msg) // Save the user with the modifed params $db = JFactory::getDbo(); $db->setQuery('update #__users set params = ' . $db->q($user->params)); - $db->query(); + $db->execute(); return true; } - public function onContentAfterDelete ($context, $item) + public function onContentAfterDelete($context, $item) { $parts = $this->getParts($context); - if (! $parts) + + if (!$parts) { return true; } + $context = $parts[0] . '.' . $parts[1]; JLoader::import('joomla.application.component.model'); JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_fields/models', 'FieldsModel'); - $model = JModelLegacy::getInstance('Field', 'FieldsModel', array( - 'ignore_request' => true - )); + + $model = JModelLegacy::getInstance('Field', 'FieldsModel', array('ignore_request' => true)); $model->cleanupValues($context, $item->id); + return true; } - public function onUserAfterDelete ($user, $succes, $msg) + public function onUserAfterDelete($user, $succes, $msg) { - $item = new stdClass(); + $item = new stdClass(); $item->id = $user['id']; + return $this->onContentAfterDelete('com_users.user', $item); } - public function onContentPrepareForm (JForm $form, $data) + public function onContentPrepareForm(JForm $form, $data) { $context = $form->getName(); @@ -217,7 +239,8 @@ public function onContentPrepareForm (JForm $form, $data) // Extracting the component and section $parts = $this->getParts($context); - if (! $parts) + + if (!$parts) { return true; } @@ -226,7 +249,8 @@ public function onContentPrepareForm (JForm $form, $data) // If we are on the save command we need the actual data $jformData = $input->get('jform', array(), 'array'); - if ($jformData && ! $data) + + if ($jformData && !$data) { $data = $jformData; } @@ -236,11 +260,9 @@ public function onContentPrepareForm (JForm $form, $data) $data = (object) $data; } - if ((! isset($data->catid) || ! $data->catid) && JFactory::getApplication()->isSite() && $component = 'com_content') + if ((!isset($data->catid) || !$data->catid) && JFactory::getApplication()->isSite() && $component = 'com_content') { - $activeMenu = JFactory::getApplication()->getMenu()->getActive(); - $params = $activeMenu->params; - $data->catid = $params->get('catid'); + $data->catid = JFactory::getApplication()->getMenu()->getActive()->params->get('catid'); } FieldsHelper::prepareForm($parts[0] . '.' . $parts[1], $form, $data); @@ -248,9 +270,10 @@ public function onContentPrepareForm (JForm $form, $data) return true; } - public function onContentPrepareData ($context, $data) + public function onContentPrepareData($context, $data) { $parts = $this->getParts($context); + if (! $parts) { return; @@ -262,28 +285,30 @@ public function onContentPrepareData ($context, $data) } } - public function onContentAfterTitle ($context, $item, $params, $limitstart = 0) + public function onContentAfterTitle($context, $item, $params, $limitstart = 0) { return $this->display($context, $item, $params, 1); } - public function onContentBeforeDisplay ($context, $item, $params, $limitstart = 0) + public function onContentBeforeDisplay($context, $item, $params, $limitstart = 0) { return $this->display($context, $item, $params, 2); } - public function onContentAfterDisplay ($context, $item, $params, $limitstart = 0) + public function onContentAfterDisplay($context, $item, $params, $limitstart = 0) { return $this->display($context, $item, $params, 3); } - private function display ($context, $item, $params, $displayType) + private function display($context, $item, $params, $displayType) { $parts = $this->getParts($context); - if (! $parts) + + if (!$parts) { return ''; } + $context = $parts[0] . '.' . $parts[1]; if (is_string($params)) @@ -292,41 +317,50 @@ private function display ($context, $item, $params, $displayType) } $fields = FieldsHelper::getFields($context, $item, true); + if ($fields) { foreach ($fields as $key => $field) { $fieldDisplayType = $field->params->get('display', '-1'); + if ($fieldDisplayType == '-1') { $fieldDisplayType = $this->params->get('display', '2'); } + if ($fieldDisplayType == $displayType) { continue; } + unset($fields[$key]); } } if ($fields) { - return FieldsHelper::render($context, 'fields.render', - array( - 'item' => $item, - 'context' => $context, - 'fields' => $fields, - 'container' => $params->get('fields-container'), - 'container-class' => $params->get('fields-container-class') - )); + return FieldsHelper::render( + $context, + 'fields.render', + array( + 'item' => $item, + 'context' => $context, + 'fields' => $fields, + 'container' => $params->get('fields-container'), + 'container-class' => $params->get('fields-container-class') + ) + ); } + return ''; } public function onContentPrepare ($context, $item) { $parts = $this->getParts($context); - if (! $parts) + + if (!$parts) { return; } @@ -335,20 +369,24 @@ public function onContentPrepare ($context, $item) // Adding the fields to the object $item->fields = array(); + foreach ($fields as $key => $field) { $item->fields[$field->id] = $field; } // If we don't meet all the requirements return - if (! isset($item->id) || ! $item->id || ! isset($item->text) || ! $item->text || ! JString::strpos($item->text, 'fields') !== false || - ! $this->params->get('prepare_content', '1')) + if (!isset($item->id) || !$item->id || !isset($item->text) + || !$item->text || !JString::strpos($item->text, 'fields') !== false + || !$this->params->get('prepare_content', '1') + ) { return true; } // Count how many times we need to process the fields $count = substr_count($item->text, '{{#fields'); + for ($i = 0; $i < $count; $i ++) { // Check for parameters @@ -356,11 +394,12 @@ public function onContentPrepare ($context, $item) preg_match('/{{\/fields}}/i', $item->text, $ends, PREG_OFFSET_CAPTURE); // Extract the parameters - $start = $starts[0][1] + strlen($starts[0][0]); - $end = $ends[0][1]; + $start = $starts[0][1] + strlen($starts[0][0]); + $end = $ends[0][1]; + $params = explode(' ', str_replace(array( '{{#fields', - '}}' + '}}', ), '', $starts[0][0])); // Clone the fields because we are manipulating the array and need @@ -371,18 +410,21 @@ public function onContentPrepare ($context, $item) foreach ($params as $string) { $string = trim($string); - if (! $string) + + if (!$string) { continue; } - $paramKey = null; + $paramKey = null; $paramValue = null; - $parts = explode('=', $string); + $parts = explode('=', $string); + if (count($parts) > 0) { $paramKey = $parts[0]; } + if (count($parts) > 1) { $paramValue = $parts[1]; @@ -392,20 +434,23 @@ public function onContentPrepare ($context, $item) { $paramValue = explode(',', $paramValue); JArrayHelper::toInteger($paramValue); + foreach ($contextFields as $key => $field) { - if (! in_array($field->id, $paramValue)) + if (!in_array($field->id, $paramValue)) { unset($contextFields[$key]); } } } + if ($paramKey == 'alias') { $paramValue = explode(',', $paramValue); + foreach ($contextFields as $key => $field) { - if (! in_array($field->alias, $paramValue)) + if (!in_array($field->alias, $paramValue)) { unset($contextFields[$key]); } @@ -436,19 +481,22 @@ public function onContentPrepare ($context, $item) JFactory::getApplication()->enqueueMessage($e->getMessage(), 'warning'); } } + return true; } - public function onPrepareFinderContent ($item) + public function onPrepareFinderContent($item) { $section = strtolower($item->layout); - $tax = $item->getTaxonomy('Type'); + $tax = $item->getTaxonomy('Type'); + if ($tax) { foreach ($tax as $context => $value) { // This is only a guess, needs to be improved $component = strtolower($context); + if (strpos($context, 'com_') !== 0) { $component = 'com_' . $component; @@ -461,8 +509,9 @@ public function onPrepareFinderContent ($item) } // Create a dummy object with the required fields - $tmp = new stdClass(); + $tmp = new stdClass(); $tmp->id = $item->__get('id'); + if ($item->__get('catid')) { $tmp->catid = $item->__get('catid'); @@ -470,6 +519,7 @@ public function onPrepareFinderContent ($item) // Getting the fields for the constructed context $fields = FieldsHelper::getFields($component . '.' . $section, $tmp, true); + if (is_array($fields)) { foreach ($fields as $field) @@ -483,13 +533,15 @@ public function onPrepareFinderContent ($item) } } } + return true; } - private function getParts ($context) + private function getParts($context) { $parts = FieldsHelper::extract($context); - if (! $parts) + + if (!$parts) { return null; } @@ -506,6 +558,7 @@ private function getParts ($context) if (count($tmp) == 1) { $parts = FieldsHelper::extract($tmp[0]->context); + if (count($parts) < 2) { return null; From b9d15675a92a2d5ffbc199a37222bcf4713f583c Mon Sep 17 00:00:00 2001 From: zero-24 Date: Thu, 31 Mar 2016 20:29:45 +0200 Subject: [PATCH 011/273] Update fields.xml --- plugins/system/fields/fields.xml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/plugins/system/fields/fields.xml b/plugins/system/fields/fields.xml index 00a34d7ad908a..169746f84196b 100644 --- a/plugins/system/fields/fields.xml +++ b/plugins/system/fields/fields.xml @@ -19,18 +19,21 @@
- - - - + + + - From 339e48f06489bbbac99d29c5065850d049e28df9 Mon Sep 17 00:00:00 2001 From: zero-24 Date: Thu, 31 Mar 2016 22:02:29 +0200 Subject: [PATCH 012/273] fix access check --- administrator/components/com_fields/controller.php | 2 +- administrator/components/com_fields/controllers/field.php | 2 +- administrator/components/com_fields/controllers/fields.php | 2 +- administrator/components/com_fields/fields.php | 2 +- administrator/components/com_fields/helpers/fields.php | 2 +- administrator/components/com_fields/helpers/internal.php | 2 +- administrator/components/com_fields/models/field.php | 2 +- administrator/components/com_fields/models/fields.php | 2 +- administrator/components/com_fields/models/fields/dprules.php | 2 +- .../components/com_fields/models/fields/modal/field.php | 2 +- administrator/components/com_fields/models/fields/section.php | 2 +- administrator/components/com_fields/models/fields/type.php | 2 +- administrator/components/com_fields/models/types/base.php | 2 +- administrator/components/com_fields/models/types/calendar.php | 2 +- administrator/components/com_fields/models/types/captcha.php | 2 +- administrator/components/com_fields/models/types/checkboxes.php | 2 +- administrator/components/com_fields/models/types/color.php | 2 +- administrator/components/com_fields/models/types/editor.php | 2 +- administrator/components/com_fields/models/types/email.php | 2 +- .../components/com_fields/models/types/fields/gallery.php | 2 +- administrator/components/com_fields/models/types/gallery.php | 2 +- administrator/components/com_fields/models/types/imagelist.php | 2 +- administrator/components/com_fields/models/types/integer.php | 2 +- administrator/components/com_fields/models/types/list.php | 2 +- administrator/components/com_fields/models/types/media.php | 2 +- .../components/com_fields/models/types/modal_article.php | 2 +- administrator/components/com_fields/models/types/radio.php | 2 +- administrator/components/com_fields/models/types/sql.php | 2 +- administrator/components/com_fields/models/types/tel.php | 2 +- administrator/components/com_fields/models/types/text.php | 2 +- administrator/components/com_fields/models/types/textarea.php | 2 +- administrator/components/com_fields/models/types/timezone.php | 2 +- administrator/components/com_fields/models/types/url.php | 2 +- administrator/components/com_fields/models/types/user.php | 2 +- .../components/com_fields/models/types/usergrouplist.php | 2 +- administrator/components/com_fields/models/types/yesno.php | 2 +- administrator/components/com_fields/tables/field.php | 2 +- administrator/components/com_fields/views/field/tmpl/edit.php | 2 +- administrator/components/com_fields/views/field/tmpl/modal.php | 2 +- .../components/com_fields/views/field/tmpl/modal_options.php | 2 +- administrator/components/com_fields/views/field/view.html.php | 2 +- .../components/com_fields/views/fields/tmpl/default.php | 2 +- .../com_fields/views/fields/tmpl/default_batch_body.php | 2 +- .../com_fields/views/fields/tmpl/default_batch_footer.php | 2 +- administrator/components/com_fields/views/fields/tmpl/modal.php | 2 +- administrator/components/com_fields/views/fields/view.html.php | 2 +- 46 files changed, 46 insertions(+), 46 deletions(-) diff --git a/administrator/components/com_fields/controller.php b/administrator/components/com_fields/controller.php index cccb853838309..5b215d52d9e33 100644 --- a/administrator/components/com_fields/controller.php +++ b/administrator/components/com_fields/controller.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; class FieldsController extends JControllerLegacy { diff --git a/administrator/components/com_fields/controllers/field.php b/administrator/components/com_fields/controllers/field.php index 6024bb084aef4..b50b44e5ed33c 100644 --- a/administrator/components/com_fields/controllers/field.php +++ b/administrator/components/com_fields/controllers/field.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; use Joomla\Registry\Registry; diff --git a/administrator/components/com_fields/controllers/fields.php b/administrator/components/com_fields/controllers/fields.php index 8fae09b9a0057..d0a07c778bdfa 100644 --- a/administrator/components/com_fields/controllers/fields.php +++ b/administrator/components/com_fields/controllers/fields.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; class FieldsControllerFields extends JControllerAdmin { diff --git a/administrator/components/com_fields/fields.php b/administrator/components/com_fields/fields.php index 9ee6a37ad5c3c..2549546434451 100644 --- a/administrator/components/com_fields/fields.php +++ b/administrator/components/com_fields/fields.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; $input = JFactory::getApplication()->input; diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php index f93fb839ee359..c4ad031ad786a 100644 --- a/administrator/components/com_fields/helpers/fields.php +++ b/administrator/components/com_fields/helpers/fields.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; class FieldsHelper { diff --git a/administrator/components/com_fields/helpers/internal.php b/administrator/components/com_fields/helpers/internal.php index 5bfe7ce7a0571..9627daf4b2fd4 100644 --- a/administrator/components/com_fields/helpers/internal.php +++ b/administrator/components/com_fields/helpers/internal.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php'); diff --git a/administrator/components/com_fields/models/field.php b/administrator/components/com_fields/models/field.php index fa9ff8ad887ab..62a7975844f48 100644 --- a/administrator/components/com_fields/models/field.php +++ b/administrator/components/com_fields/models/field.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; use Joomla\Registry\Registry; diff --git a/administrator/components/com_fields/models/fields.php b/administrator/components/com_fields/models/fields.php index 31479bc2f5d19..f873372296617 100644 --- a/administrator/components/com_fields/models/fields.php +++ b/administrator/components/com_fields/models/fields.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; use Joomla\Registry\Registry; diff --git a/administrator/components/com_fields/models/fields/dprules.php b/administrator/components/com_fields/models/fields/dprules.php index 1580843776570..74d41bb0a376a 100644 --- a/administrator/components/com_fields/models/fields/dprules.php +++ b/administrator/components/com_fields/models/fields/dprules.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; /** * We need to handle the edit.value rule specially as it is not acore rule. diff --git a/administrator/components/com_fields/models/fields/modal/field.php b/administrator/components/com_fields/models/fields/modal/field.php index 2b8b9dc7368b7..1dbc62d95528d 100644 --- a/administrator/components/com_fields/models/fields/modal/field.php +++ b/administrator/components/com_fields/models/fields/modal/field.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; class JFormFieldModal_Field extends JFormField { diff --git a/administrator/components/com_fields/models/fields/section.php b/administrator/components/com_fields/models/fields/section.php index e59435b194552..68752b3e64853 100644 --- a/administrator/components/com_fields/models/fields/section.php +++ b/administrator/components/com_fields/models/fields/section.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JFormHelper::loadFieldClass('list'); JLoader::import('joomla.filesystem.folder'); diff --git a/administrator/components/com_fields/models/fields/type.php b/administrator/components/com_fields/models/fields/type.php index c01e5925b3e0e..3992c6e7303a2 100644 --- a/administrator/components/com_fields/models/fields/type.php +++ b/administrator/components/com_fields/models/fields/type.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JFormHelper::loadFieldClass('list'); JLoader::import('joomla.filesystem.folder'); diff --git a/administrator/components/com_fields/models/types/base.php b/administrator/components/com_fields/models/types/base.php index 47d5af99b6905..5639f5bc2d29d 100644 --- a/administrator/components/com_fields/models/types/base.php +++ b/administrator/components/com_fields/models/types/base.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; class FieldsTypeBase { diff --git a/administrator/components/com_fields/models/types/calendar.php b/administrator/components/com_fields/models/types/calendar.php index 6972b8abe006c..ace62b68d285f 100644 --- a/administrator/components/com_fields/models/types/calendar.php +++ b/administrator/components/com_fields/models/types/calendar.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/captcha.php b/administrator/components/com_fields/models/types/captcha.php index 27509fa56c864..1267c066a473a 100644 --- a/administrator/components/com_fields/models/types/captcha.php +++ b/administrator/components/com_fields/models/types/captcha.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/checkboxes.php b/administrator/components/com_fields/models/types/checkboxes.php index 3d34aad5fc483..c65eddbf59aba 100644 --- a/administrator/components/com_fields/models/types/checkboxes.php +++ b/administrator/components/com_fields/models/types/checkboxes.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.list', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/color.php b/administrator/components/com_fields/models/types/color.php index b767d9488bef6..188869ff2ee1f 100644 --- a/administrator/components/com_fields/models/types/color.php +++ b/administrator/components/com_fields/models/types/color.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/editor.php b/administrator/components/com_fields/models/types/editor.php index 6b2a520d59271..bf440c0332aed 100644 --- a/administrator/components/com_fields/models/types/editor.php +++ b/administrator/components/com_fields/models/types/editor.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/email.php b/administrator/components/com_fields/models/types/email.php index 795c3d3559931..9658909db46cd 100644 --- a/administrator/components/com_fields/models/types/email.php +++ b/administrator/components/com_fields/models/types/email.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/fields/gallery.php b/administrator/components/com_fields/models/types/fields/gallery.php index fa41d67b9e943..29ceafd50b363 100644 --- a/administrator/components/com_fields/models/types/fields/gallery.php +++ b/administrator/components/com_fields/models/types/fields/gallery.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('joomla.filesystem.folder'); JFormHelper::loadFieldClass('list'); diff --git a/administrator/components/com_fields/models/types/gallery.php b/administrator/components/com_fields/models/types/gallery.php index ec8a161761d32..e254fc53fd5e0 100644 --- a/administrator/components/com_fields/models/types/gallery.php +++ b/administrator/components/com_fields/models/types/gallery.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/imagelist.php b/administrator/components/com_fields/models/types/imagelist.php index 3f771dbc9c8b2..c885991ef614b 100644 --- a/administrator/components/com_fields/models/types/imagelist.php +++ b/administrator/components/com_fields/models/types/imagelist.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/integer.php b/administrator/components/com_fields/models/types/integer.php index 17205652ece86..a251872fc2ec3 100644 --- a/administrator/components/com_fields/models/types/integer.php +++ b/administrator/components/com_fields/models/types/integer.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/list.php b/administrator/components/com_fields/models/types/list.php index 63a5c1086b2cf..00c5cc930b84d 100644 --- a/administrator/components/com_fields/models/types/list.php +++ b/administrator/components/com_fields/models/types/list.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/media.php b/administrator/components/com_fields/models/types/media.php index e86d9d3726831..c2efff10155dd 100644 --- a/administrator/components/com_fields/models/types/media.php +++ b/administrator/components/com_fields/models/types/media.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/modal_article.php b/administrator/components/com_fields/models/types/modal_article.php index e16cc7cfa89ac..071eb228c7e4e 100644 --- a/administrator/components/com_fields/models/types/modal_article.php +++ b/administrator/components/com_fields/models/types/modal_article.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/radio.php b/administrator/components/com_fields/models/types/radio.php index 978d482ae4adf..917dc7e3bc639 100644 --- a/administrator/components/com_fields/models/types/radio.php +++ b/administrator/components/com_fields/models/types/radio.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.list', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/sql.php b/administrator/components/com_fields/models/types/sql.php index c3d7ec73d3f32..fa721a94d3cf3 100644 --- a/administrator/components/com_fields/models/types/sql.php +++ b/administrator/components/com_fields/models/types/sql.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/tel.php b/administrator/components/com_fields/models/types/tel.php index 1b8a86f37adc8..8f54eca5970a4 100644 --- a/administrator/components/com_fields/models/types/tel.php +++ b/administrator/components/com_fields/models/types/tel.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/text.php b/administrator/components/com_fields/models/types/text.php index 1c09da41a181b..b28b465203a7a 100644 --- a/administrator/components/com_fields/models/types/text.php +++ b/administrator/components/com_fields/models/types/text.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/textarea.php b/administrator/components/com_fields/models/types/textarea.php index e320bdced7506..48f546025654c 100644 --- a/administrator/components/com_fields/models/types/textarea.php +++ b/administrator/components/com_fields/models/types/textarea.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/timezone.php b/administrator/components/com_fields/models/types/timezone.php index 07bc233c75db3..211978c53abbd 100644 --- a/administrator/components/com_fields/models/types/timezone.php +++ b/administrator/components/com_fields/models/types/timezone.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/url.php b/administrator/components/com_fields/models/types/url.php index 4356a68d3a45e..50207104acd2a 100644 --- a/administrator/components/com_fields/models/types/url.php +++ b/administrator/components/com_fields/models/types/url.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/user.php b/administrator/components/com_fields/models/types/user.php index 3fcefb0a95c9b..7103f54aad7c7 100644 --- a/administrator/components/com_fields/models/types/user.php +++ b/administrator/components/com_fields/models/types/user.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/usergrouplist.php b/administrator/components/com_fields/models/types/usergrouplist.php index 1166870872d1d..0eb53f6dead0d 100644 --- a/administrator/components/com_fields/models/types/usergrouplist.php +++ b/administrator/components/com_fields/models/types/usergrouplist.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/models/types/yesno.php b/administrator/components/com_fields/models/types/yesno.php index d609432b96ee7..345359de0c287 100644 --- a/administrator/components/com_fields/models/types/yesno.php +++ b/administrator/components/com_fields/models/types/yesno.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::import('components.com_fields.models.types.list', JPATH_ADMINISTRATOR); diff --git a/administrator/components/com_fields/tables/field.php b/administrator/components/com_fields/tables/field.php index a2b45fb831ba0..bac4c21f22474 100644 --- a/administrator/components/com_fields/tables/field.php +++ b/administrator/components/com_fields/tables/field.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; use Joomla\Registry\Registry; diff --git a/administrator/components/com_fields/views/field/tmpl/edit.php b/administrator/components/com_fields/views/field/tmpl/edit.php index 17fef0838400b..09e308bc2119b 100644 --- a/administrator/components/com_fields/views/field/tmpl/edit.php +++ b/administrator/components/com_fields/views/field/tmpl/edit.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); diff --git a/administrator/components/com_fields/views/field/tmpl/modal.php b/administrator/components/com_fields/views/field/tmpl/modal.php index d8e7d1cadab8b..8f222fbbab6f1 100644 --- a/administrator/components/com_fields/views/field/tmpl/modal.php +++ b/administrator/components/com_fields/views/field/tmpl/modal.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); diff --git a/administrator/components/com_fields/views/field/tmpl/modal_options.php b/administrator/components/com_fields/views/field/tmpl/modal_options.php index a0da45f5d64d6..2d2a34e8a4626 100644 --- a/administrator/components/com_fields/views/field/tmpl/modal_options.php +++ b/administrator/components/com_fields/views/field/tmpl/modal_options.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; echo JHtml::_('bootstrap.startAccordion', 'fieldOptions', array('active' => 'collapse0')); $fieldSets = $this->form->getFieldsets('params'); diff --git a/administrator/components/com_fields/views/field/view.html.php b/administrator/components/com_fields/views/field/view.html.php index 442eea06c0346..35aa806cb9f1e 100644 --- a/administrator/components/com_fields/views/field/view.html.php +++ b/administrator/components/com_fields/views/field/view.html.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; class FieldsViewField extends JViewLegacy { diff --git a/administrator/components/com_fields/views/fields/tmpl/default.php b/administrator/components/com_fields/views/fields/tmpl/default.php index b4bd5ddc55bf3..85081ec15155e 100644 --- a/administrator/components/com_fields/views/fields/tmpl/default.php +++ b/administrator/components/com_fields/views/fields/tmpl/default.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); diff --git a/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php b/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php index e1d68efcc5487..3bfe2f93539f4 100644 --- a/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php +++ b/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JHtml::_('formbehavior.chosen', 'select'); diff --git a/administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php b/administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php index 8c992421e9fec..d7865e9ec4543 100644 --- a/administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php +++ b/administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; ?>
From abc005674e09a609803e051af1a5e330d569ed7c Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Fri, 1 Apr 2016 16:43:39 +0200 Subject: [PATCH 019/273] Code style Close options on the same line - consistency --- .../components/com_fields/models/forms/field.xml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/administrator/components/com_fields/models/forms/field.xml b/administrator/components/com_fields/models/forms/field.xml index 548391a5974a4..c4e533d88b77f 100644 --- a/administrator/components/com_fields/models/forms/field.xml +++ b/administrator/components/com_fields/models/forms/field.xml @@ -124,12 +124,9 @@ - - - + + + From 58cd0c96069114d193a8ca76fd90ec6953db92d8 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Fri, 1 Apr 2016 16:54:29 +0200 Subject: [PATCH 020/273] Code style --- .../components/com_fields/access.xml | 37 ++++++------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/administrator/components/com_fields/access.xml b/administrator/components/com_fields/access.xml index f893bf6ed7c7f..dfc1c98de1ac1 100644 --- a/administrator/components/com_fields/access.xml +++ b/administrator/components/com_fields/access.xml @@ -2,32 +2,19 @@
- - - + + + - - + +
- - - - - - + + + + + +
-
\ No newline at end of file + From 4c5716971b7f8fc968e0bc2a0a4a19d490948bdf Mon Sep 17 00:00:00 2001 From: laoneo Date: Fri, 1 Apr 2016 16:59:17 +0200 Subject: [PATCH 021/273] Move render and edit class to the options tab Closes #25 --- .../components/com_fields/models/forms/field.xml | 15 ++++++--------- .../com_fields/views/field/tmpl/edit.php | 8 +++----- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/administrator/components/com_fields/models/forms/field.xml b/administrator/components/com_fields/models/forms/field.xml index c4e533d88b77f..32471124faa13 100644 --- a/administrator/components/com_fields/models/forms/field.xml +++ b/administrator/components/com_fields/models/forms/field.xml @@ -38,12 +38,6 @@ - - @@ -97,14 +91,17 @@
- + + diff --git a/administrator/components/com_fields/views/field/tmpl/edit.php b/administrator/components/com_fields/views/field/tmpl/edit.php index 8b16b9066c46e..3cc4f77b27f5b 100644 --- a/administrator/components/com_fields/views/field/tmpl/edit.php +++ b/administrator/components/com_fields/views/field/tmpl/edit.php @@ -2,7 +2,7 @@ /** * @package Joomla.Administrator * @subpackage com_fields - * + * * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -57,8 +57,6 @@ echo $this->form->renderField('label'); echo $this->form->renderField('required'); echo $this->form->renderField('default_value'); - echo $this->form->renderField('render_class'); - echo $this->form->renderField('class'); // rendering additional fields foreach ($this->form->getFieldsets('fieldparams') as $name => $fieldSet) @@ -101,11 +99,11 @@ - + set('ignore_fieldsets', array('fieldparams')); echo JLayoutHelper::render('joomla.edit.params', $this); ?> - + canDo->get('core.admin')) : ?> form->getInput('rules'); ?> From 49f7652d63d6407c025ba9505cb1ae7ebf9f01c9 Mon Sep 17 00:00:00 2001 From: laoneo Date: Fri, 1 Apr 2016 17:05:37 +0200 Subject: [PATCH 022/273] Don't reference the wrong variable Closes #17 --- .../com_fields/models/types/usergrouplist.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/administrator/components/com_fields/models/types/usergrouplist.php b/administrator/components/com_fields/models/types/usergrouplist.php index 0eb53f6dead0d..68f82568321d7 100644 --- a/administrator/components/com_fields/models/types/usergrouplist.php +++ b/administrator/components/com_fields/models/types/usergrouplist.php @@ -2,20 +2,14 @@ /** * @package Joomla.Administrator * @subpackage com_fields - * + * * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +defined('_JEXEC') or die(); JLoader::import('components.com_fields.models.types.base', JPATH_ADMINISTRATOR); class FieldsTypeUsergrouplist extends FieldsTypeBase { - - public function prepareValueForDisplay ($value, $field) - { - - return parent::prepareValueForDisplay($texts, $field); - } } From 692397e3e67e3e97e8e3c131b9637475806e1a61 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Fri, 1 Apr 2016 17:29:01 +0200 Subject: [PATCH 023/273] Filter ordering The filter ordering needs to match the oder the columns are displayed in --- .../components/com_fields/models/forms/filter_fields.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/administrator/components/com_fields/models/forms/filter_fields.xml b/administrator/components/com_fields/models/forms/filter_fields.xml index ab5b894b7e1eb..30eae7adcfe72 100644 --- a/administrator/components/com_fields/models/forms/filter_fields.xml +++ b/administrator/components/com_fields/models/forms/filter_fields.xml @@ -34,14 +34,14 @@ + + - - Date: Fri, 1 Apr 2016 17:52:37 +0200 Subject: [PATCH 024/273] Batch modal fields Re-order the fields in the batch modal so that they match the article batch modal --- .../com_fields/views/fields/tmpl/default_batch_body.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php b/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php index 3bfe2f93539f4..c62986c669846 100644 --- a/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php +++ b/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php @@ -29,12 +29,12 @@
- +
- +
-
\ No newline at end of file + From bb87eec4541666804c6b054b33c15cd6c49e7811 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Fri, 1 Apr 2016 18:00:04 +0200 Subject: [PATCH 025/273] Correct Date Update creation date - matches fields.xml in component --- plugins/system/fields/fields.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/system/fields/fields.xml b/plugins/system/fields/fields.xml index 169746f84196b..2b80819bdfd1f 100644 --- a/plugins/system/fields/fields.xml +++ b/plugins/system/fields/fields.xml @@ -2,7 +2,7 @@ plg_system_fields Joomla! Project - November 2011 + March 2016 Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt admin@joomla.org From 8b185b4fa940811f06ba5c37d67bba2e13529058 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Fri, 1 Apr 2016 18:51:37 +0200 Subject: [PATCH 026/273] Add language flags --- administrator/components/com_fields/models/fields.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_fields/models/fields.php b/administrator/components/com_fields/models/fields.php index 31479bc2f5d19..e402b33c1322d 100644 --- a/administrator/components/com_fields/models/fields.php +++ b/administrator/components/com_fields/models/fields.php @@ -122,7 +122,7 @@ protected function getListQuery () $query->from('#__fields AS a'); // Join over the language - $query->select('l.title AS language_title')->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language'); + $query->select('l.title AS language_title, l.image AS language_image')->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language'); // Join over the users for the checked out user. $query->select('uc.name AS editor')->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); From 59e9f9abda93a74b7cf736d3e5418139125fd3e5 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Fri, 1 Apr 2016 18:52:18 +0200 Subject: [PATCH 027/273] Update default.php --- .../components/com_fields/views/fields/tmpl/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_fields/views/fields/tmpl/default.php b/administrator/components/com_fields/views/fields/tmpl/default.php index b4bd5ddc55bf3..17b05528ab539 100644 --- a/administrator/components/com_fields/views/fields/tmpl/default.php +++ b/administrator/components/com_fields/views/fields/tmpl/default.php @@ -189,7 +189,7 @@ language == '*') : ?> - language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> + language_title ? JHtml::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, array('title' => $item->language_title), true) . ' ' . $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> From 880ae881c26b42a7e4d8bb2f11c1a476c725dd23 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Fri, 1 Apr 2016 21:11:32 +0100 Subject: [PATCH 028/273] Move moustache to be loaded through composer --- .gitignore | 13 +++ .../components/com_fields/helpers/fields.php | 4 - composer.json | 3 +- composer.lock | 96 ++++++++++++++----- .../vendor/composer/autoload_namespaces.php | 1 + libraries/vendor/composer/installed.json | 48 ++++++++++ .../mustache/src}/Mustache/Autoloader.php | 0 .../mustache/mustache/src}/Mustache/Cache.php | 0 .../src}/Mustache/Cache/AbstractCache.php | 0 .../src}/Mustache/Cache/FilesystemCache.php | 0 .../src}/Mustache/Cache/NoopCache.php | 0 .../mustache/src}/Mustache/Compiler.php | 0 .../mustache/src}/Mustache/Context.php | 0 .../mustache/src}/Mustache/Engine.php | 0 .../mustache/src}/Mustache/Exception.php | 0 .../Exception/InvalidArgumentException.php | 0 .../Mustache/Exception/LogicException.php | 0 .../Mustache/Exception/RuntimeException.php | 0 .../Mustache/Exception/SyntaxException.php | 0 .../Exception/UnknownFilterException.php | 0 .../Exception/UnknownHelperException.php | 0 .../Exception/UnknownTemplateException.php | 0 .../src}/Mustache/HelperCollection.php | 0 .../mustache/src}/Mustache/LambdaHelper.php | 0 .../mustache/src}/Mustache/Loader.php | 0 .../src}/Mustache/Loader/ArrayLoader.php | 0 .../src}/Mustache/Loader/CascadingLoader.php | 0 .../src}/Mustache/Loader/FilesystemLoader.php | 0 .../src}/Mustache/Loader/InlineLoader.php | 0 .../src}/Mustache/Loader/MutableLoader.php | 0 .../src}/Mustache/Loader/StringLoader.php | 0 .../mustache/src}/Mustache/Logger.php | 0 .../src}/Mustache/Logger/AbstractLogger.php | 0 .../src}/Mustache/Logger/StreamLogger.php | 0 .../mustache/src}/Mustache/Parser.php | 0 .../mustache/src}/Mustache/Template.php | 0 .../mustache/src}/Mustache/Tokenizer.php | 0 plugins/system/fields/fields.php | 4 - 38 files changed, 136 insertions(+), 33 deletions(-) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Autoloader.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Cache.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Cache/AbstractCache.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Cache/FilesystemCache.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Cache/NoopCache.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Compiler.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Context.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Engine.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Exception.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Exception/InvalidArgumentException.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Exception/LogicException.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Exception/RuntimeException.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Exception/SyntaxException.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Exception/UnknownFilterException.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Exception/UnknownHelperException.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Exception/UnknownTemplateException.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/HelperCollection.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/LambdaHelper.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Loader.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Loader/ArrayLoader.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Loader/CascadingLoader.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Loader/FilesystemLoader.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Loader/InlineLoader.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Loader/MutableLoader.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Loader/StringLoader.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Logger.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Logger/AbstractLogger.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Logger/StreamLogger.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Parser.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Template.php (100%) rename {administrator/components/com_fields/libraries => libraries/vendor/mustache/mustache/src}/Mustache/Tokenizer.php (100%) diff --git a/.gitignore b/.gitignore index 062c89aeebc92..c4e09c7ec2b71 100644 --- a/.gitignore +++ b/.gitignore @@ -126,3 +126,16 @@ Desktop.ini /libraries/vendor/symfony/yaml/composer.json /libraries/vendor/symfony/yaml/phpunit.xml.dist /libraries/vendor/symfony/yaml/README.md +/libraries/vendor/mustache/mustache/.gitignore +/libraries/vendor/mustache/mustache/bin +/libraries/vendor/mustache/mustache/vendor +/libraries/vendor/mustache/mustache/.gitmodules +/libraries/vendor/mustache/mustache/.styleci.yml +/libraries/vendor/mustache/mustache/.travis.yml +/libraries/vendor/mustache/mustache/.php_cs +/libraries/vendor/mustache/mustache/CONTRIBUTING.md +/libraries/vendor/mustache/mustache/README.md +/libraries/vendor/mustache/mustache/LICENSE +/libraries/vendor/mustache/mustache/phpunit.xml.dist +/libraries/vendor/mustache/mustache/test +/libraries/vendor/mustache/mustache/composer.json diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php index f12b5d059b1bc..9e23e0c3770b8 100644 --- a/administrator/components/com_fields/helpers/fields.php +++ b/administrator/components/com_fields/helpers/fields.php @@ -150,10 +150,6 @@ public static function getFields ($context, $item = null, $prepareValue = false) { try { - // Load the mustache engine - JLoader::import('components.com_fields.libraries.Mustache.Autoloader', JPATH_ADMINISTRATOR); - Mustache_Autoloader::register(); - $m = new Mustache_Engine(); $value = $m->render($output, $field); } diff --git a/composer.json b/composer.json index ba4e4930ec1d9..bd835891a86ae 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,8 @@ "paragonie/random_compat": "~1.0", "phpmailer/phpmailer": "5.2.14", "symfony/polyfill-php56": "~1.0", - "symfony/yaml": "2.*" + "symfony/yaml": "2.*", + "mustache/mustache": "2.8.0" }, "require-dev": { "phpunit/phpunit": "4.*", diff --git a/composer.lock b/composer.lock index 766a5b1d60d81..215f85454f8b8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "e4a0c44baa97f2acbd3ef1fe14f63200", - "content-hash": "800b07fe877fd7416bf7c046ad42a55a", + "hash": "9fcbcddf241b4394e6acfb176025dcbd", + "content-hash": "75a7fe49537d3610e91aa61a9697262d", "packages": [ { "name": "ircmaxell/password-compat", @@ -602,6 +602,52 @@ "homepage": "http://leafo.net/lessphp/", "time": "2014-11-24 18:39:20" }, + { + "name": "mustache/mustache", + "version": "v2.8.0", + "source": { + "type": "git", + "url": "https://github.com/bobthecow/mustache.php.git", + "reference": "64c28cc73e01d5edcef7de8cb2b16782615f648a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/64c28cc73e01d5edcef7de8cb2b16782615f648a", + "reference": "64c28cc73e01d5edcef7de8cb2b16782615f648a", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "require-dev": { + "fabpot/php-cs-fixer": "~1.6", + "phpunit/phpunit": "~3.7|~4.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Mustache": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "description": "A Mustache implementation in PHP.", + "homepage": "https://github.com/bobthecow/mustache.php", + "keywords": [ + "mustache", + "templating" + ], + "time": "2015-04-01 06:37:33" + }, { "name": "paragonie/random_compat", "version": "v1.2.1", @@ -929,7 +975,7 @@ "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "4.*", + "phpunit/phpunit": "~4.0", "squizlabs/php_codesniffer": "~2.0" }, "type": "library", @@ -1030,7 +1076,7 @@ "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "~4.0" }, "suggest": { "dflydev/markdown": "~1.0", @@ -1063,22 +1109,24 @@ }, { "name": "phpspec/prophecy", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" + "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3c91bdf81797d725b14cb62906f9a4ce44235972", + "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1" + "sebastian/comparator": "~1.1", + "sebastian/recursion-context": "~1.0" }, "require-dev": { "phpspec/phpspec": "~2.0" @@ -1086,7 +1134,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.5.x-dev" } }, "autoload": { @@ -1119,7 +1167,7 @@ "spy", "stub" ], - "time": "2015-08-13 10:07:40" + "time": "2016-02-15 07:46:21" }, { "name": "phpunit/dbunit", @@ -1390,7 +1438,7 @@ "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.2" }, "type": "library", "extra": { @@ -1490,7 +1538,7 @@ "testing", "xunit" ], - "time": "2015-10-07 10:39:46" + "time": "2016-02-11 14:56:33" }, { "name": "phpunit/phpunit-mock-objects", @@ -1513,7 +1561,7 @@ "sebastian/exporter": "~1.2" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.4" }, "suggest": { "ext-soap": "*" @@ -1568,7 +1616,7 @@ "sebastian/exporter": "~1.2" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { @@ -1666,23 +1714,23 @@ }, { "name": "sebastian/environment", - "version": "1.3.3", + "version": "1.3.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6e7133793a8e5a5714a551a8324337374be209df" + "reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df", - "reference": "6e7133793a8e5a5714a551a8324337374be209df", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf", + "reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { @@ -1712,7 +1760,7 @@ "environment", "hhvm" ], - "time": "2015-12-02 08:37:27" + "time": "2016-02-26 18:40:46" }, { "name": "sebastian/exporter", @@ -1733,7 +1781,7 @@ "sebastian/recursion-context": "~1.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { @@ -1798,7 +1846,7 @@ "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.2" }, "suggest": { "ext-uopz": "*" @@ -1849,7 +1897,7 @@ "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { diff --git a/libraries/vendor/composer/autoload_namespaces.php b/libraries/vendor/composer/autoload_namespaces.php index 470a67457683c..0556520dd40db 100644 --- a/libraries/vendor/composer/autoload_namespaces.php +++ b/libraries/vendor/composer/autoload_namespaces.php @@ -7,5 +7,6 @@ return array( 'Psr\\Log\\' => array($vendorDir . '/psr/log'), + 'Mustache' => array($vendorDir . '/mustache/mustache/src'), 'Joomla\\Session' => array($vendorDir . '/joomla/session'), ); diff --git a/libraries/vendor/composer/installed.json b/libraries/vendor/composer/installed.json index 9c0a03f45baf4..bee88550095f4 100644 --- a/libraries/vendor/composer/installed.json +++ b/libraries/vendor/composer/installed.json @@ -935,5 +935,53 @@ "pseudorandom", "random" ] + }, + { + "name": "mustache/mustache", + "version": "v2.8.0", + "version_normalized": "2.8.0.0", + "source": { + "type": "git", + "url": "https://github.com/bobthecow/mustache.php.git", + "reference": "64c28cc73e01d5edcef7de8cb2b16782615f648a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/64c28cc73e01d5edcef7de8cb2b16782615f648a", + "reference": "64c28cc73e01d5edcef7de8cb2b16782615f648a", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "require-dev": { + "fabpot/php-cs-fixer": "~1.6", + "phpunit/phpunit": "~3.7|~4.0" + }, + "time": "2015-04-01 06:37:33", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Mustache": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "description": "A Mustache implementation in PHP.", + "homepage": "https://github.com/bobthecow/mustache.php", + "keywords": [ + "mustache", + "templating" + ] } ] diff --git a/administrator/components/com_fields/libraries/Mustache/Autoloader.php b/libraries/vendor/mustache/mustache/src/Mustache/Autoloader.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Autoloader.php rename to libraries/vendor/mustache/mustache/src/Mustache/Autoloader.php diff --git a/administrator/components/com_fields/libraries/Mustache/Cache.php b/libraries/vendor/mustache/mustache/src/Mustache/Cache.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Cache.php rename to libraries/vendor/mustache/mustache/src/Mustache/Cache.php diff --git a/administrator/components/com_fields/libraries/Mustache/Cache/AbstractCache.php b/libraries/vendor/mustache/mustache/src/Mustache/Cache/AbstractCache.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Cache/AbstractCache.php rename to libraries/vendor/mustache/mustache/src/Mustache/Cache/AbstractCache.php diff --git a/administrator/components/com_fields/libraries/Mustache/Cache/FilesystemCache.php b/libraries/vendor/mustache/mustache/src/Mustache/Cache/FilesystemCache.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Cache/FilesystemCache.php rename to libraries/vendor/mustache/mustache/src/Mustache/Cache/FilesystemCache.php diff --git a/administrator/components/com_fields/libraries/Mustache/Cache/NoopCache.php b/libraries/vendor/mustache/mustache/src/Mustache/Cache/NoopCache.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Cache/NoopCache.php rename to libraries/vendor/mustache/mustache/src/Mustache/Cache/NoopCache.php diff --git a/administrator/components/com_fields/libraries/Mustache/Compiler.php b/libraries/vendor/mustache/mustache/src/Mustache/Compiler.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Compiler.php rename to libraries/vendor/mustache/mustache/src/Mustache/Compiler.php diff --git a/administrator/components/com_fields/libraries/Mustache/Context.php b/libraries/vendor/mustache/mustache/src/Mustache/Context.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Context.php rename to libraries/vendor/mustache/mustache/src/Mustache/Context.php diff --git a/administrator/components/com_fields/libraries/Mustache/Engine.php b/libraries/vendor/mustache/mustache/src/Mustache/Engine.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Engine.php rename to libraries/vendor/mustache/mustache/src/Mustache/Engine.php diff --git a/administrator/components/com_fields/libraries/Mustache/Exception.php b/libraries/vendor/mustache/mustache/src/Mustache/Exception.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Exception.php rename to libraries/vendor/mustache/mustache/src/Mustache/Exception.php diff --git a/administrator/components/com_fields/libraries/Mustache/Exception/InvalidArgumentException.php b/libraries/vendor/mustache/mustache/src/Mustache/Exception/InvalidArgumentException.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Exception/InvalidArgumentException.php rename to libraries/vendor/mustache/mustache/src/Mustache/Exception/InvalidArgumentException.php diff --git a/administrator/components/com_fields/libraries/Mustache/Exception/LogicException.php b/libraries/vendor/mustache/mustache/src/Mustache/Exception/LogicException.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Exception/LogicException.php rename to libraries/vendor/mustache/mustache/src/Mustache/Exception/LogicException.php diff --git a/administrator/components/com_fields/libraries/Mustache/Exception/RuntimeException.php b/libraries/vendor/mustache/mustache/src/Mustache/Exception/RuntimeException.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Exception/RuntimeException.php rename to libraries/vendor/mustache/mustache/src/Mustache/Exception/RuntimeException.php diff --git a/administrator/components/com_fields/libraries/Mustache/Exception/SyntaxException.php b/libraries/vendor/mustache/mustache/src/Mustache/Exception/SyntaxException.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Exception/SyntaxException.php rename to libraries/vendor/mustache/mustache/src/Mustache/Exception/SyntaxException.php diff --git a/administrator/components/com_fields/libraries/Mustache/Exception/UnknownFilterException.php b/libraries/vendor/mustache/mustache/src/Mustache/Exception/UnknownFilterException.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Exception/UnknownFilterException.php rename to libraries/vendor/mustache/mustache/src/Mustache/Exception/UnknownFilterException.php diff --git a/administrator/components/com_fields/libraries/Mustache/Exception/UnknownHelperException.php b/libraries/vendor/mustache/mustache/src/Mustache/Exception/UnknownHelperException.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Exception/UnknownHelperException.php rename to libraries/vendor/mustache/mustache/src/Mustache/Exception/UnknownHelperException.php diff --git a/administrator/components/com_fields/libraries/Mustache/Exception/UnknownTemplateException.php b/libraries/vendor/mustache/mustache/src/Mustache/Exception/UnknownTemplateException.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Exception/UnknownTemplateException.php rename to libraries/vendor/mustache/mustache/src/Mustache/Exception/UnknownTemplateException.php diff --git a/administrator/components/com_fields/libraries/Mustache/HelperCollection.php b/libraries/vendor/mustache/mustache/src/Mustache/HelperCollection.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/HelperCollection.php rename to libraries/vendor/mustache/mustache/src/Mustache/HelperCollection.php diff --git a/administrator/components/com_fields/libraries/Mustache/LambdaHelper.php b/libraries/vendor/mustache/mustache/src/Mustache/LambdaHelper.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/LambdaHelper.php rename to libraries/vendor/mustache/mustache/src/Mustache/LambdaHelper.php diff --git a/administrator/components/com_fields/libraries/Mustache/Loader.php b/libraries/vendor/mustache/mustache/src/Mustache/Loader.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Loader.php rename to libraries/vendor/mustache/mustache/src/Mustache/Loader.php diff --git a/administrator/components/com_fields/libraries/Mustache/Loader/ArrayLoader.php b/libraries/vendor/mustache/mustache/src/Mustache/Loader/ArrayLoader.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Loader/ArrayLoader.php rename to libraries/vendor/mustache/mustache/src/Mustache/Loader/ArrayLoader.php diff --git a/administrator/components/com_fields/libraries/Mustache/Loader/CascadingLoader.php b/libraries/vendor/mustache/mustache/src/Mustache/Loader/CascadingLoader.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Loader/CascadingLoader.php rename to libraries/vendor/mustache/mustache/src/Mustache/Loader/CascadingLoader.php diff --git a/administrator/components/com_fields/libraries/Mustache/Loader/FilesystemLoader.php b/libraries/vendor/mustache/mustache/src/Mustache/Loader/FilesystemLoader.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Loader/FilesystemLoader.php rename to libraries/vendor/mustache/mustache/src/Mustache/Loader/FilesystemLoader.php diff --git a/administrator/components/com_fields/libraries/Mustache/Loader/InlineLoader.php b/libraries/vendor/mustache/mustache/src/Mustache/Loader/InlineLoader.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Loader/InlineLoader.php rename to libraries/vendor/mustache/mustache/src/Mustache/Loader/InlineLoader.php diff --git a/administrator/components/com_fields/libraries/Mustache/Loader/MutableLoader.php b/libraries/vendor/mustache/mustache/src/Mustache/Loader/MutableLoader.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Loader/MutableLoader.php rename to libraries/vendor/mustache/mustache/src/Mustache/Loader/MutableLoader.php diff --git a/administrator/components/com_fields/libraries/Mustache/Loader/StringLoader.php b/libraries/vendor/mustache/mustache/src/Mustache/Loader/StringLoader.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Loader/StringLoader.php rename to libraries/vendor/mustache/mustache/src/Mustache/Loader/StringLoader.php diff --git a/administrator/components/com_fields/libraries/Mustache/Logger.php b/libraries/vendor/mustache/mustache/src/Mustache/Logger.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Logger.php rename to libraries/vendor/mustache/mustache/src/Mustache/Logger.php diff --git a/administrator/components/com_fields/libraries/Mustache/Logger/AbstractLogger.php b/libraries/vendor/mustache/mustache/src/Mustache/Logger/AbstractLogger.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Logger/AbstractLogger.php rename to libraries/vendor/mustache/mustache/src/Mustache/Logger/AbstractLogger.php diff --git a/administrator/components/com_fields/libraries/Mustache/Logger/StreamLogger.php b/libraries/vendor/mustache/mustache/src/Mustache/Logger/StreamLogger.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Logger/StreamLogger.php rename to libraries/vendor/mustache/mustache/src/Mustache/Logger/StreamLogger.php diff --git a/administrator/components/com_fields/libraries/Mustache/Parser.php b/libraries/vendor/mustache/mustache/src/Mustache/Parser.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Parser.php rename to libraries/vendor/mustache/mustache/src/Mustache/Parser.php diff --git a/administrator/components/com_fields/libraries/Mustache/Template.php b/libraries/vendor/mustache/mustache/src/Mustache/Template.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Template.php rename to libraries/vendor/mustache/mustache/src/Mustache/Template.php diff --git a/administrator/components/com_fields/libraries/Mustache/Tokenizer.php b/libraries/vendor/mustache/mustache/src/Mustache/Tokenizer.php similarity index 100% rename from administrator/components/com_fields/libraries/Mustache/Tokenizer.php rename to libraries/vendor/mustache/mustache/src/Mustache/Tokenizer.php diff --git a/plugins/system/fields/fields.php b/plugins/system/fields/fields.php index b5a767b14122c..6f27b53a48aa7 100644 --- a/plugins/system/fields/fields.php +++ b/plugins/system/fields/fields.php @@ -463,10 +463,6 @@ public function onContentPrepare ($context, $item) try { - // Load the mustache engine - JLoader::import('components.com_fields.libraries.Mustache.Autoloader', JPATH_ADMINISTRATOR); - Mustache_Autoloader::register(); - $m = new Mustache_Engine(); $output = $m->render('{{#fields}}' . substr($item->text, $start, $end - $start) . '{{/fields}}', array( From 98408d646ac2dad5f3ac21decac3922d9ad3af05 Mon Sep 17 00:00:00 2001 From: zero-24 Date: Thu, 31 Mar 2016 18:58:05 +0200 Subject: [PATCH 029/273] Update fields.php --- components/com_fields/controller.php | 7 ++- components/com_fields/controllers/field.php | 17 +++--- components/com_fields/fields.php | 2 +- .../com_fields/layouts/field/prepare/base.php | 8 +-- .../layouts/field/prepare/captcha.php | 2 +- .../layouts/field/prepare/checkboxes.php | 14 ++--- .../layouts/field/prepare/editor.php | 7 +-- .../layouts/field/prepare/gallery.php | 36 +++++++------ .../layouts/field/prepare/imagelist.php | 19 ++++--- .../com_fields/layouts/field/prepare/list.php | 14 ++--- .../layouts/field/prepare/media.php | 15 +++--- .../layouts/field/prepare/modal_article.php | 7 +-- .../com_fields/layouts/field/prepare/sql.php | 18 ++++--- .../layouts/field/prepare/textarea.php | 7 +-- .../com_fields/layouts/field/prepare/url.php | 11 ++-- .../com_fields/layouts/field/prepare/user.php | 22 ++++---- .../layouts/field/prepare/usergrouplist.php | 15 +++--- .../layouts/field/prepare/yesno.php | 14 ++--- .../com_fields/layouts/field/render.php | 15 +++--- .../com_fields/layouts/fields/render.php | 53 +++++++++++-------- 20 files changed, 178 insertions(+), 125 deletions(-) diff --git a/components/com_fields/controller.php b/components/com_fields/controller.php index ad24fd1236206..8046342f624f0 100644 --- a/components/com_fields/controller.php +++ b/components/com_fields/controller.php @@ -6,8 +6,13 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; +/** + * Base controller class for Fields Component. + * + * @since 3.6 + */ class FieldsController extends JControllerLegacy { } diff --git a/components/com_fields/controllers/field.php b/components/com_fields/controllers/field.php index 4201689a7ebbb..011869eb4ad09 100644 --- a/components/com_fields/controllers/field.php +++ b/components/com_fields/controllers/field.php @@ -6,23 +6,28 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; +/** + * Fields controller class for Fields Component. + * + * @since 3.6 + */ class FieldsControllerField extends JControllerLegacy { - - public function catchange () + public function catchange() { JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - $app = JFactory::getApplication(); - $data = $this->input->get($this->input->get('formcontrol', 'jform'), array(), 'array'); - + $app = JFactory::getApplication(); + $data = $this->input->get($this->input->get('formcontrol', 'jform'), array(), 'array'); $parts = FieldsHelper::extract($this->input->getCmd('context')); + if ($parts) { $app->setUserState($parts[0] . '.edit.' . $parts[1] . '.data', $data); } + $app->redirect(base64_decode($this->input->get->getBase64('return'))); $app->close(); } diff --git a/components/com_fields/fields.php b/components/com_fields/fields.php index fa0a15a418b6e..9226ce51142f4 100644 --- a/components/com_fields/fields.php +++ b/components/com_fields/fields.php @@ -6,7 +6,7 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php'); diff --git a/components/com_fields/layouts/field/prepare/base.php b/components/com_fields/layouts/field/prepare/base.php index e6920913574c3..6af8b844a2d0c 100644 --- a/components/com_fields/layouts/field/prepare/base.php +++ b/components/com_fields/layouts/field/prepare/base.php @@ -6,16 +6,17 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } @@ -24,4 +25,5 @@ { $value = implode(', ', $value); } + echo htmlentities($value); diff --git a/components/com_fields/layouts/field/prepare/captcha.php b/components/com_fields/layouts/field/prepare/captcha.php index 466851e948552..331fb288d1e18 100644 --- a/components/com_fields/layouts/field/prepare/captcha.php +++ b/components/com_fields/layouts/field/prepare/captcha.php @@ -6,6 +6,6 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; return; diff --git a/components/com_fields/layouts/field/prepare/checkboxes.php b/components/com_fields/layouts/field/prepare/checkboxes.php index 5a46497b795d3..a8f2ad8144038 100644 --- a/components/com_fields/layouts/field/prepare/checkboxes.php +++ b/components/com_fields/layouts/field/prepare/checkboxes.php @@ -6,24 +6,26 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } -$value = (array) $value; +$value = (array) $value; +$texts = array(); +$options = FieldsHelper::loadTypeObject($field->type, $field->context)->getOptions($field); -$texts = array(); -foreach (FieldsHelper::loadTypeObject($field->type, $field->context)->getOptions($field) as $index => $optionsValue) +foreach ($options as $index => $optionsValue) { if (in_array($index, $value)) { diff --git a/components/com_fields/layouts/field/prepare/editor.php b/components/com_fields/layouts/field/prepare/editor.php index 77d8b562c5848..5a68253c2a72c 100644 --- a/components/com_fields/layouts/field/prepare/editor.php +++ b/components/com_fields/layouts/field/prepare/editor.php @@ -6,16 +6,17 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } diff --git a/components/com_fields/layouts/field/prepare/gallery.php b/components/com_fields/layouts/field/prepare/gallery.php index 6aaf4ab94b91e..72e0d6ece3134 100644 --- a/components/com_fields/layouts/field/prepare/gallery.php +++ b/components/com_fields/layouts/field/prepare/gallery.php @@ -6,16 +6,17 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } @@ -33,50 +34,50 @@ $value = (array) $value; -$thumbWidth = $field->fieldparams->get('thumbnail_width', '64'); +$thumbWidth = $field->fieldparams->get('thumbnail_width', '64'); $maxImageWidth = $field->fieldparams->get('max_width'); // Main container $buffer = '
'; + foreach ($value as $path) { // Only process valid paths - if (! $path) + if (!$path) { continue; } // The root folder $root = $field->fieldparams->get('directory', 'images'); + foreach (JFolder::files(JPATH_ROOT . '/' . $root . '/' . $path, '.', $field->fieldparams->get('recursive', '1'), true) as $file) { // Skip none image files - if (! in_array(strtolower(JFile::getExt($file)), array( - 'jpg', - 'png', - 'bmp', - 'gif' - ))) + if (!in_array(strtolower(JFile::getExt($file)), array('jpg','png','bmp','gif'))) { continue; } // Relative path - $localPath = str_replace(JPATH_ROOT . '/' . $root . '/', '', $file); + $localPath = str_replace(JPATH_ROOT . '/' . $root . '/', '', $file); $webImagePath = $root . '/' . $localPath; if ($maxImageWidth) { $resize = JPATH_CACHE . '/com_fields/gallery/' . $field->id . '/' . $maxImageWidth . '/' . $localPath; - if (! JFile::exists($resize)) + + if (!JFile::exists($resize)) { // Creating the folder structure for the max sized image - if (! JFolder::exists(dirname($resize))) + if (!JFolder::exists(dirname($resize))) { JFolder::create(dirname($resize)); } + // Getting the properties of the image $properties = JImage::getImageFileProperties($file); + if ($properties->width > $maxImageWidth) { // Creating the max sized image for the image @@ -85,6 +86,7 @@ $imgObject->toFile($resize); } } + if (JFile::exists($resize)) { $webImagePath = JUri::base(true) . str_replace(JPATH_ROOT, '', $resize); @@ -94,18 +96,19 @@ // Thumbnail path for the image $thumb = JPATH_CACHE . '/com_fields/gallery/' . $field->id . '/' . $thumbWidth . '/' . $localPath; - if (! JFile::exists($thumb)) + if (!JFile::exists($thumb)) { try { // Creating the folder structure for the thumbnail - if (! JFolder::exists(dirname($thumb))) + if (!JFolder::exists(dirname($thumb))) { JFolder::create(dirname($thumb)); } // Getting the properties of the image $properties = JImage::getImageFileProperties($file); + if ($properties->width > $thumbWidth) { // Creating the thumbnail for the image @@ -132,6 +135,7 @@ } } } + $buffer .= '
'; echo $buffer; diff --git a/components/com_fields/layouts/field/prepare/imagelist.php b/components/com_fields/layouts/field/prepare/imagelist.php index f3e2181b15deb..cc9e751bff9a7 100644 --- a/components/com_fields/layouts/field/prepare/imagelist.php +++ b/components/com_fields/layouts/field/prepare/imagelist.php @@ -6,30 +6,33 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } -$value = (array) $value; - +$value = (array) $value; $buffer = ''; + foreach ($value as $path) { - if (! $path) + if (!$path) { continue; } - $buffer .= ''; + + $buffer .= ''; } + echo $buffer; diff --git a/components/com_fields/layouts/field/prepare/list.php b/components/com_fields/layouts/field/prepare/list.php index 5a46497b795d3..a8f2ad8144038 100644 --- a/components/com_fields/layouts/field/prepare/list.php +++ b/components/com_fields/layouts/field/prepare/list.php @@ -6,24 +6,26 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } -$value = (array) $value; +$value = (array) $value; +$texts = array(); +$options = FieldsHelper::loadTypeObject($field->type, $field->context)->getOptions($field); -$texts = array(); -foreach (FieldsHelper::loadTypeObject($field->type, $field->context)->getOptions($field) as $index => $optionsValue) +foreach ($options as $index => $optionsValue) { if (in_array($index, $value)) { diff --git a/components/com_fields/layouts/field/prepare/media.php b/components/com_fields/layouts/field/prepare/media.php index fa4f482ef4efe..a758a21f653f2 100644 --- a/components/com_fields/layouts/field/prepare/media.php +++ b/components/com_fields/layouts/field/prepare/media.php @@ -6,29 +6,32 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } -$value = (array) $value; - +$value = (array) $value; $buffer = ''; + foreach ($value as $path) { - if (! $path) + if (!$path) { continue; } + $buffer .= ''; } + echo $buffer; diff --git a/components/com_fields/layouts/field/prepare/modal_article.php b/components/com_fields/layouts/field/prepare/modal_article.php index 5ffe4f9605c7f..f3257ebcead30 100644 --- a/components/com_fields/layouts/field/prepare/modal_article.php +++ b/components/com_fields/layouts/field/prepare/modal_article.php @@ -6,16 +6,17 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } diff --git a/components/com_fields/layouts/field/prepare/sql.php b/components/com_fields/layouts/field/prepare/sql.php index 1aae51ef7c341..8e2fcfad13511 100644 --- a/components/com_fields/layouts/field/prepare/sql.php +++ b/components/com_fields/layouts/field/prepare/sql.php @@ -6,30 +6,32 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } -$db = JFactory::getDbo(); -$value = (array) $value; - +$db = JFactory::getDbo(); +$value = (array) $value; $condition = ''; + foreach ($value as $v) { - if (! $v) + if (!$v) { continue; } + $condition .= ', ' . $db->q($v); } @@ -38,7 +40,6 @@ // Run the query with a having condition because it support aliases $db->setQuery($query . ' having value in (' . trim($condition, ',') . ')'); -$items = array(); try { $items = $db->loadObjectlist(); @@ -51,6 +52,7 @@ } $texts = array(); + foreach ($items as $item) { if (in_array($item->value, $value)) diff --git a/components/com_fields/layouts/field/prepare/textarea.php b/components/com_fields/layouts/field/prepare/textarea.php index 77d8b562c5848..5a68253c2a72c 100644 --- a/components/com_fields/layouts/field/prepare/textarea.php +++ b/components/com_fields/layouts/field/prepare/textarea.php @@ -6,16 +6,17 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } diff --git a/components/com_fields/layouts/field/prepare/url.php b/components/com_fields/layouts/field/prepare/url.php index 2e0245fe3633a..32ab25cda21cf 100644 --- a/components/com_fields/layouts/field/prepare/url.php +++ b/components/com_fields/layouts/field/prepare/url.php @@ -6,23 +6,26 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } $attributes = ''; -if (! JUri::isInternal($value)) + +if (!JUri::isInternal($value)) { $attributes = 'rel="nofollow" target="_blank"'; } + echo '' . $value . ''; diff --git a/components/com_fields/layouts/field/prepare/user.php b/components/com_fields/layouts/field/prepare/user.php index 539b88834d5d0..27047ee6f3f6b 100644 --- a/components/com_fields/layouts/field/prepare/user.php +++ b/components/com_fields/layouts/field/prepare/user.php @@ -6,38 +6,42 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } $value = (array) $value; - $texts = array(); + foreach ($value as $userId) { - if (! $userId) + if (!$userId) { continue; } + $user = JFactory::getUser($userId); + if ($user) { + // Use the Username $texts[] = $user->name; + continue; } - else - { - $texts[] = $userId; - } + + // Fallback and add the User ID if we get no JUser Object + $texts[] = $userId; } echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/usergrouplist.php b/components/com_fields/layouts/field/prepare/usergrouplist.php index 8e50164be6fb0..925343ba5066e 100644 --- a/components/com_fields/layouts/field/prepare/usergrouplist.php +++ b/components/com_fields/layouts/field/prepare/usergrouplist.php @@ -6,25 +6,28 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } -$value = (array) $value; JLoader::register('UsersHelper', JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php'); -$texts = array(); -foreach (UsersHelper::getGroups() as $group) +$value = (array) $value; +$texts = array(); +$groups = UsersHelper::getGroups(); + +foreach ($groups as $group) { if (in_array($group->value, $value)) { diff --git a/components/com_fields/layouts/field/prepare/yesno.php b/components/com_fields/layouts/field/prepare/yesno.php index 5a46497b795d3..a8f2ad8144038 100644 --- a/components/com_fields/layouts/field/prepare/yesno.php +++ b/components/com_fields/layouts/field/prepare/yesno.php @@ -6,24 +6,26 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } $field = $displayData['field']; $value = $field->value; -if (! $value) + +if (!$value) { return; } -$value = (array) $value; +$value = (array) $value; +$texts = array(); +$options = FieldsHelper::loadTypeObject($field->type, $field->context)->getOptions($field); -$texts = array(); -foreach (FieldsHelper::loadTypeObject($field->type, $field->context)->getOptions($field) as $index => $optionsValue) +foreach ($options as $index => $optionsValue) { if (in_array($index, $value)) { diff --git a/components/com_fields/layouts/field/render.php b/components/com_fields/layouts/field/render.php index dfa1ec641a5df..4be0008f83cd2 100644 --- a/components/com_fields/layouts/field/render.php +++ b/components/com_fields/layouts/field/render.php @@ -6,9 +6,9 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; -if (! key_exists('field', $displayData)) +if (!key_exists('field', $displayData)) { return; } @@ -16,15 +16,16 @@ $field = $displayData['field']; $label = $field->label; $value = $field->value; -if (! $value) +$class = $field->render_class; + +if (!$value) { return; } -$class = $field->render_class; ?> -
- : - +
+ : +
diff --git a/components/com_fields/layouts/fields/render.php b/components/com_fields/layouts/fields/render.php index e049f0e9cc883..9ae1c577a854c 100644 --- a/components/com_fields/layouts/fields/render.php +++ b/components/com_fields/layouts/fields/render.php @@ -6,32 +6,35 @@ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die(); +defined('_JEXEC') or die; // Check if we have all data -if (! key_exists('item', $displayData) || ! key_exists('context', $displayData)) +if (!key_exists('item', $displayData) || !key_exists('context', $displayData)) { return; } // Setting up for display $item = $displayData['item']; -if (! $item) + +if (!$item) { return; } + $context = $displayData['context']; -if (! $context) + +if (!$context) { return; } JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php'); -$parts = explode('.', $context); +$parts = explode('.', $context); $component = $parts[0]; +$fields = null; -$fields = null; if (key_exists('fields', $displayData)) { $fields = $displayData['fields']; @@ -41,18 +44,21 @@ $fields = $item->fields ? $item->fields : FieldsHelper::getFields($context, $item, true); } -if (! $fields) +if (!$fields) { return; } // Load some output definitions $container = 'dl'; + if (key_exists('container', $displayData) && $displayData['container']) { $container = $displayData['container']; } + $class = 'article-info muted'; + if (key_exists('container-class', $displayData) && $displayData['container-class']) { $class = $displayData['container-class']; @@ -65,25 +71,28 @@ foreach ($fields as $field) { // If the value is empty dp nothing - if (! isset($field->value) || ! $field->value) + if (!isset($field->value) || !$field->value) { continue; } - echo FieldsHelper::render($context, 'field.render', - array( - 'field' => $field, - - // @deprecated use $field->label directly in the render - // layout of the field - 'label' => $field->label, - // @deprecated use $field->value directly in the render - // layout of the field - 'value' => $field->value, - // @deprecated use $field->render_class directly in the - // render layout of the field - 'class' => $field->render_class - )); + echo FieldsHelper::render( + $context, + 'field.render', + array( + 'field' => $field, + + // @deprecated use $field->label directly in the render + // layout of the field + 'label' => $field->label, + // @deprecated use $field->value directly in the render + // layout of the field + 'value' => $field->value, + // @deprecated use $field->render_class directly in the + // render layout of the field + 'class' => $field->render_class + ) + ); } // Close the container From 1d713081a2a379932e6db131fa6659022007aade Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Sat, 2 Apr 2016 11:09:25 +0200 Subject: [PATCH 030/273] Remove versions --- .../components/com_fields/views/field/view.html.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/administrator/components/com_fields/views/field/view.html.php b/administrator/components/com_fields/views/field/view.html.php index 442eea06c0346..f9af1a17bcaa7 100644 --- a/administrator/components/com_fields/views/field/view.html.php +++ b/administrator/components/com_fields/views/field/view.html.php @@ -148,12 +148,6 @@ protected function addToolbar () } else { - if ($componentParams->get('save_history', 0) && $user->authorise('core.edit')) - { - $typeAlias = $context . '.field'; - JToolbarHelper::versions($typeAlias, $this->item->id); - } - JToolbarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE'); } From 579ddf81929538071b81396e06bc8a2ba49157b1 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Sat, 2 Apr 2016 11:20:18 +0200 Subject: [PATCH 031/273] Changed inherited Changes Inherited to Use Global --- administrator/components/com_fields/models/forms/field.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_fields/models/forms/field.xml b/administrator/components/com_fields/models/forms/field.xml index 32471124faa13..7be267e95a064 100644 --- a/administrator/components/com_fields/models/forms/field.xml +++ b/administrator/components/com_fields/models/forms/field.xml @@ -125,7 +125,7 @@ - +
From 015d5cd61050f2969eaa3551ebbbdad5e69be58d Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Sat, 2 Apr 2016 22:33:12 +0200 Subject: [PATCH 032/273] grammar --- administrator/language/en-GB/en-GB.plg_system_fields.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/administrator/language/en-GB/en-GB.plg_system_fields.ini b/administrator/language/en-GB/en-GB.plg_system_fields.ini index cbade95b81c73..973799d5dabde 100644 --- a/administrator/language/en-GB/en-GB.plg_system_fields.ini +++ b/administrator/language/en-GB/en-GB.plg_system_fields.ini @@ -3,9 +3,9 @@ PLG_SYSTEM_FIELDS_XML_DESCRIPTION="The system plugin for custom fields." ; Configs PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_LABEL="Automatic Display" -PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_DESC="Joomla offers some content events which are triggered during content creation process. Here is the place to generally define how the custom fields should be integrated into content." +PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_DESC="Joomla offers several content events which are triggered during content creation process. Here you can define how the custom fields should be integrated into content." PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_AFTER_TITLE="After Title" PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_BEFORE_DISPLAY="Before Display" PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_AFTER_DISPLAY="After Display" PLG_SYSTEM_FIELDS_CONFIG_PREPARE_CONTENT_LABEL="Prepare Content" -PLG_SYSTEM_FIELDS_CONFIG_PREPARE_CONTENT_DESC="Should the content being parsed for commands like {{#fields}}?" \ No newline at end of file +PLG_SYSTEM_FIELDS_CONFIG_PREPARE_CONTENT_DESC="Should the content be parsed for commands like {{#fields}}?" From 8cfd5f08a3600cbe4ae30c96b2bb21e3ab404656 Mon Sep 17 00:00:00 2001 From: pratikpatel Date: Mon, 4 Apr 2016 12:37:55 +0530 Subject: [PATCH 033/273] #14 fixed Joomla Coding Standards --- .../components/com_fields/tables/field.php | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/administrator/components/com_fields/tables/field.php b/administrator/components/com_fields/tables/field.php index bac4c21f22474..a7a17366a96e0 100644 --- a/administrator/components/com_fields/tables/field.php +++ b/administrator/components/com_fields/tables/field.php @@ -2,7 +2,7 @@ /** * @package Joomla.Administrator * @subpackage com_fields - * + * * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -19,26 +19,22 @@ public function __construct (&$db = null) $this->setColumnAlias('published', 'state'); - JObserverMapper::addObserverClassToClass('JTableObserverTags', 'FieldsTableField', array( - 'typeAlias' => 'com_fields.field' - )); - JObserverMapper::addObserverClassToClass('JTableObserverContenthistory', 'FieldsTableField', - array( - 'typeAlias' => 'com_fields.field' - )); + JObserverMapper::addObserverClassToClass('JTableObserverTags', 'FieldsTableField', array('typeAlias' => 'com_fields.field')); + JObserverMapper::addObserverClassToClass('JTableObserverContenthistory', 'FieldsTableField', array('typeAlias' => 'com_fields.field')); } public function bind ($array, $ignore = '') { if (isset($array['params']) && is_array($array['params'])) { - $registry = new Registry(); + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } + if (isset($array['fieldparams']) && is_array($array['fieldparams'])) { - $registry = new Registry(); + $registry = new Registry; $registry->loadArray($array['fieldparams']); $array['fieldparams'] = (string) $registry; } @@ -59,6 +55,7 @@ public function check () if (trim($this->title) == '') { $this->setError(JText::_('COM_FIELDS_LOCATION_ERR_TABLES_TITLE')); + return false; } @@ -66,7 +63,9 @@ public function check () { $this->alias = $this->title; } + $this->alias = JApplication::stringURLSafe($this->alias); + if (trim(str_replace('-', '', $this->alias)) == '') { $this->alias = JString::increment($alias, 'dash'); @@ -83,8 +82,10 @@ public function check () if ($this->publish_down > $this->_db->getNullDate() && $this->publish_down < $this->publish_up) { $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH')); + return false; } + if (is_array($this->assigned_cat_ids)) { $this->assigned_cat_ids = implode(',', $this->assigned_cat_ids); @@ -92,6 +93,7 @@ public function check () $date = JFactory::getDate(); $user = JFactory::getUser(); + if ($this->id) { // Existing item @@ -117,6 +119,7 @@ public function check () protected function _getAssetName () { $k = $this->_tbl_key; + return $this->context . '.field.' . (int) $this->$k; } @@ -142,9 +145,11 @@ protected function _getAssetParentId (JTable $table = null, $id = null) $this->_db->setQuery($query); $assetId = null; + if ($result = $this->_db->loadResult()) { $assetId = (int) $result; + if ($assetId) { return $assetId; From 1fefc5f8baff005e801efba4fe94bcdce72090b2 Mon Sep 17 00:00:00 2001 From: laoneo Date: Mon, 4 Apr 2016 10:03:25 +0200 Subject: [PATCH 034/273] Removing the double FIELD key Closes #3 --- .../components/com_fields/access.xml | 10 +- .../com_fields/models/forms/field.xml | 58 +++--- .../com_fields/models/forms/filter_fields.xml | 4 +- .../models/types/forms/calendar.xml | 2 +- .../models/types/forms/checkboxes.xml | 8 +- .../com_fields/models/types/forms/editor.xml | 16 +- .../com_fields/models/types/forms/gallery.xml | 18 +- .../models/types/forms/imagelist.xml | 8 +- .../com_fields/models/types/forms/integer.xml | 8 +- .../com_fields/models/types/forms/list.xml | 10 +- .../com_fields/models/types/forms/media.xml | 12 +- .../com_fields/models/types/forms/radio.xml | 12 +- .../com_fields/models/types/forms/sql.xml | 6 +- .../models/types/forms/textarea.xml | 4 +- .../com_fields/models/types/forms/url.xml | 4 +- .../com_fields/models/types/forms/user.xml | 2 +- .../models/types/forms/usergrouplist.xml | 2 +- .../com_fields/models/types/forms/yesno.xml | 6 +- .../com_fields/views/fields/tmpl/default.php | 4 +- .../com_fields/views/fields/tmpl/modal.php | 2 +- .../com_fields/views/fields/view.html.php | 2 +- .../language/en-GB/en-GB.com_fields.ini | 182 +++++++++--------- 22 files changed, 190 insertions(+), 190 deletions(-) diff --git a/administrator/components/com_fields/access.xml b/administrator/components/com_fields/access.xml index dfc1c98de1ac1..0d529baf47598 100644 --- a/administrator/components/com_fields/access.xml +++ b/administrator/components/com_fields/access.xml @@ -11,10 +11,10 @@
- - - - - + + + + +
diff --git a/administrator/components/com_fields/models/forms/field.xml b/administrator/components/com_fields/models/forms/field.xml index 7be267e95a064..6c48221087044 100644 --- a/administrator/components/com_fields/models/forms/field.xml +++ b/administrator/components/com_fields/models/forms/field.xml @@ -7,8 +7,8 @@ + label="COM_FIELDS_FIELD_CATEGORY_LABEL" extension="com_fields" + description="COM_FIELDS_FIELD_CATEGORY_DESC" class=""> - - + label="COM_FIELDS_FIELD_REQUIRED_LABEL" description="COM_FIELDS_FIELD_REQUIRED_DESC"> + description="COM_FIELDS_FIELD_LANGUAGE_DESC"> - +
- + - + label="COM_FIELDS_FIELD_DISABLED_LABEL" description="COM_FIELDS_FIELD_DISABLED_DESC"> + label="COM_FIELDS_FIELD_READONLY_LABEL" description="COM_FIELDS_FIELD_READONLY_DESC"> - - - + label="COM_FIELDS_FIELD_SHOW_ON_LABEL" description="COM_FIELDS_FIELD_SHOW_ON_LABEL"> + + + - - - + + + + label="COM_FIELDS_FIELD_OUTPUT_LABEL" description="COM_FIELDS_FIELD_OUTPUT_DESC" />
diff --git a/administrator/components/com_fields/models/forms/filter_fields.xml b/administrator/components/com_fields/models/forms/filter_fields.xml index 30eae7adcfe72..588311f5bae6e 100644 --- a/administrator/components/com_fields/models/forms/filter_fields.xml +++ b/administrator/components/com_fields/models/forms/filter_fields.xml @@ -34,8 +34,8 @@ - - + + diff --git a/administrator/components/com_fields/models/types/forms/calendar.xml b/administrator/components/com_fields/models/types/forms/calendar.xml index ccf8248e2bdef..59205f7a3f504 100644 --- a/administrator/components/com_fields/models/types/forms/calendar.xml +++ b/administrator/components/com_fields/models/types/forms/calendar.xml @@ -3,7 +3,7 @@
diff --git a/administrator/components/com_fields/models/types/forms/checkboxes.xml b/administrator/components/com_fields/models/types/forms/checkboxes.xml index e1b4148951b73..d53818adf765c 100644 --- a/administrator/components/com_fields/models/types/forms/checkboxes.xml +++ b/administrator/components/com_fields/models/types/forms/checkboxes.xml @@ -3,14 +3,14 @@
+ description="COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_DESC" + label="COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_LABEL"> diff --git a/administrator/components/com_fields/models/types/forms/editor.xml b/administrator/components/com_fields/models/types/forms/editor.xml index e094aa65028a2..36e3435b1e773 100644 --- a/administrator/components/com_fields/models/types/forms/editor.xml +++ b/administrator/components/com_fields/models/types/forms/editor.xml @@ -3,26 +3,26 @@
+ label="COM_FIELDS_FIELD_EDITOR_SHOW_BUTTONS_LABEL" + description="COM_FIELDS_FIELD_EDITOR_SHOW_BUTTONS_DESC"> + class="input-xxlarge" label="COM_FIELDS_FIELD_EDITOR_BUTTONS_HIDE_LABEL" + description="COM_FIELDS_FIELD_EDITOR_BUTTONS_HIDE_DESC" />
diff --git a/administrator/components/com_fields/models/types/forms/gallery.xml b/administrator/components/com_fields/models/types/forms/gallery.xml index a730baa64e44f..bfb9aa787a55a 100644 --- a/administrator/components/com_fields/models/types/forms/gallery.xml +++ b/administrator/components/com_fields/models/types/forms/gallery.xml @@ -3,26 +3,26 @@
+ label="COM_FIELDS_FIELD_GALLERY_MAX_WIDTH_LABEL" + description="COM_FIELDS_FIELD_GALLERY_MAX_WIDTH_DESC" size="5" /> + label="COM_FIELDS_FIELD_GALLERY_RECURSIVE_LABEL" + description="COM_FIELDS_FIELD_GALLERY_RECURSIVE_DESC"> + label="COM_FIELDS_FIELD_LIST_MULTIPLE_LABEL" description="COM_FIELDS_FIELD_LIST_MULTIPLE_DESC"> + label="COM_FIELDS_FIELD_IMAGELIST_DIRECTORY_LABEL" + description="COM_FIELDS_FIELD_IMAGELIST_DIRECTORY_DESC" />
diff --git a/administrator/components/com_fields/models/types/forms/imagelist.xml b/administrator/components/com_fields/models/types/forms/imagelist.xml index a5ab19c71b729..dc0afad06e0e4 100644 --- a/administrator/components/com_fields/models/types/forms/imagelist.xml +++ b/administrator/components/com_fields/models/types/forms/imagelist.xml @@ -3,15 +3,15 @@
+ label="COM_FIELDS_FIELD_LIST_MULTIPLE_LABEL" description="COM_FIELDS_FIELD_LIST_MULTIPLE_DESC"> + label="COM_FIELDS_FIELD_IMAGELIST_DIRECTORY_LABEL" + description="COM_FIELDS_FIELD_IMAGELIST_DIRECTORY_DESC" />
diff --git a/administrator/components/com_fields/models/types/forms/integer.xml b/administrator/components/com_fields/models/types/forms/integer.xml index bf64539d5fdad..9fc3cd6a0dbbb 100644 --- a/administrator/components/com_fields/models/types/forms/integer.xml +++ b/administrator/components/com_fields/models/types/forms/integer.xml @@ -3,18 +3,18 @@
+ label="COM_FIELDS_FIELD_LIST_MULTIPLE_LABEL" description="COM_FIELDS_FIELD_LIST_MULTIPLE_DESC">
diff --git a/administrator/components/com_fields/models/types/forms/list.xml b/administrator/components/com_fields/models/types/forms/list.xml index cda220cd3d489..33dfb951ac77d 100644 --- a/administrator/components/com_fields/models/types/forms/list.xml +++ b/administrator/components/com_fields/models/types/forms/list.xml @@ -3,20 +3,20 @@
+ label="COM_FIELDS_FIELD_LIST_MULTIPLE_LABEL" description="COM_FIELDS_FIELD_LIST_MULTIPLE_DESC"> + description="COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_DESC" + label="COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_LABEL"> diff --git a/administrator/components/com_fields/models/types/forms/media.xml b/administrator/components/com_fields/models/types/forms/media.xml index f50219faf0b13..6cae879dadd6e 100644 --- a/administrator/components/com_fields/models/types/forms/media.xml +++ b/administrator/components/com_fields/models/types/forms/media.xml @@ -3,16 +3,16 @@
+ label="COM_FIELDS_FIELD_IMAGELIST_DIRECTORY_LABEL" + description="COM_FIELDS_FIELD_IMAGELIST_DIRECTORY_DESC" /> - - + label="COM_FIELDS_FIELD_MEDIA_PREVIEW_LABEL" description="COM_FIELDS_FIELD_MEDIA_PREVIEW_DESC"> + +
diff --git a/administrator/components/com_fields/models/types/forms/radio.xml b/administrator/components/com_fields/models/types/forms/radio.xml index 14a12db511b10..ab790dc6da530 100644 --- a/administrator/components/com_fields/models/types/forms/radio.xml +++ b/administrator/components/com_fields/models/types/forms/radio.xml @@ -1,19 +1,19 @@
-
+ description="COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_DESC" + label="COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_LABEL"> diff --git a/administrator/components/com_fields/models/types/forms/sql.xml b/administrator/components/com_fields/models/types/forms/sql.xml index 3d6673163d669..6eba856ef3c5b 100644 --- a/administrator/components/com_fields/models/types/forms/sql.xml +++ b/administrator/components/com_fields/models/types/forms/sql.xml @@ -3,13 +3,13 @@
+ label="COM_FIELDS_FIELD_LIST_MULTIPLE_LABEL" description="COM_FIELDS_FIELD_LIST_MULTIPLE_DESC">
diff --git a/administrator/components/com_fields/models/types/forms/textarea.xml b/administrator/components/com_fields/models/types/forms/textarea.xml index 222c96a2f70af..9d351092dd978 100644 --- a/administrator/components/com_fields/models/types/forms/textarea.xml +++ b/administrator/components/com_fields/models/types/forms/textarea.xml @@ -3,10 +3,10 @@
diff --git a/administrator/components/com_fields/models/types/forms/url.xml b/administrator/components/com_fields/models/types/forms/url.xml index f3e29dd1ceeb4..f31bb07ac5c66 100644 --- a/administrator/components/com_fields/models/types/forms/url.xml +++ b/administrator/components/com_fields/models/types/forms/url.xml @@ -3,7 +3,7 @@
+ label="COM_FIELDS_FIELD_URL_SCHEMES_LABEL" description="COM_FIELDS_FIELD_URL_SCHEMES_DESC"> @@ -13,7 +13,7 @@ + label="COM_FIELDS_FIELD_URL_RELATIVE_LABEL" description="COM_FIELDS_FIELD_URL_RELATIVE_DESC"> diff --git a/administrator/components/com_fields/models/types/forms/user.xml b/administrator/components/com_fields/models/types/forms/user.xml index 9c4a3b4a724bc..685a8e833f052 100644 --- a/administrator/components/com_fields/models/types/forms/user.xml +++ b/administrator/components/com_fields/models/types/forms/user.xml @@ -3,7 +3,7 @@
+ label="COM_FIELDS_FIELD_LIST_MULTIPLE_LABEL" description="COM_FIELDS_FIELD_LIST_MULTIPLE_DESC"> diff --git a/administrator/components/com_fields/models/types/forms/usergrouplist.xml b/administrator/components/com_fields/models/types/forms/usergrouplist.xml index 9c4a3b4a724bc..685a8e833f052 100644 --- a/administrator/components/com_fields/models/types/forms/usergrouplist.xml +++ b/administrator/components/com_fields/models/types/forms/usergrouplist.xml @@ -3,7 +3,7 @@
+ label="COM_FIELDS_FIELD_LIST_MULTIPLE_LABEL" description="COM_FIELDS_FIELD_LIST_MULTIPLE_DESC"> diff --git a/administrator/components/com_fields/models/types/forms/yesno.xml b/administrator/components/com_fields/models/types/forms/yesno.xml index 0e471729ccb6a..946afdcc5e03d 100644 --- a/administrator/components/com_fields/models/types/forms/yesno.xml +++ b/administrator/components/com_fields/models/types/forms/yesno.xml @@ -1,9 +1,9 @@ - diff --git a/administrator/components/com_fields/views/fields/tmpl/default.php b/administrator/components/com_fields/views/fields/tmpl/default.php index 7d48e380bc08c..c35df6140995e 100644 --- a/administrator/components/com_fields/views/fields/tmpl/default.php +++ b/administrator/components/com_fields/views/fields/tmpl/default.php @@ -71,10 +71,10 @@ - + - + diff --git a/administrator/components/com_fields/views/fields/tmpl/modal.php b/administrator/components/com_fields/views/fields/tmpl/modal.php index 5488d9ab4399c..db5897ec83c1d 100644 --- a/administrator/components/com_fields/views/fields/tmpl/modal.php +++ b/administrator/components/com_fields/views/fields/tmpl/modal.php @@ -82,7 +82,7 @@ - + diff --git a/administrator/components/com_fields/views/fields/view.html.php b/administrator/components/com_fields/views/fields/view.html.php index 11868e451ff83..e347a193743c8 100644 --- a/administrator/components/com_fields/views/fields/view.html.php +++ b/administrator/components/com_fields/views/fields/view.html.php @@ -187,7 +187,7 @@ protected function getSortFields () 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.title' => JText::_('JGLOBAL_TITLE'), - 'a.type' => JText::_('COM_FIELDS_FIELD_FIELD_TYPE_LABEL'), + 'a.type' => JText::_('COM_FIELDS_FIELD_TYPE_LABEL'), 'a.access' => JText::_('JGRID_HEADING_ACCESS'), 'language' => JText::_('JGRID_HEADING_LANGUAGE'), 'a.id' => JText::_('JGRID_HEADING_ID') diff --git a/administrator/language/en-GB/en-GB.com_fields.ini b/administrator/language/en-GB/en-GB.com_fields.ini index 2b3bfe95f529d..eb816025a7a97 100644 --- a/administrator/language/en-GB/en-GB.com_fields.ini +++ b/administrator/language/en-GB/en-GB.com_fields.ini @@ -40,107 +40,107 @@ COM_FIELDS_VIEW_FIELD_FIELDSET_PUBLISHING="Publishing" COM_FIELDS_VIEW_FIELD_FIELDSET_RULES="Permissions" ; Fields General -COM_FIELDS_FIELD_FIELD_CATEGORY_DESC="The category this field belongs to." -COM_FIELDS_FIELD_FIELD_CATEGORY_LABEL="Fields Category" -COM_FIELDS_FIELD_FIELD_CLASS_DESC="The class attributes of the field in the edit form. If different classes are needed, list them with spaces." -COM_FIELDS_FIELD_FIELD_CLASS_LABEL="Class" -COM_FIELDS_FIELD_FIELD_DEFAULT_VALUE_DESC="The default value of the field." -COM_FIELDS_FIELD_FIELD_DEFAULT_VALUE_LABEL="Default Value" -COM_FIELDS_FIELD_FIELD_DESCRIPTION_DESC="The description of the field." -COM_FIELDS_FIELD_FIELD_DISABLED_DESC="Is the field disabled in the edit form." -COM_FIELDS_FIELD_FIELD_DISABLED_LABEL="Disabled" -COM_FIELDS_FIELD_FIELD_DISPLAY_AFTER_DISPLAY="After Display" -COM_FIELDS_FIELD_FIELD_DISPLAY_AFTER_TITLE="After Title" -COM_FIELDS_FIELD_FIELD_DISPLAY_BEFORE_DISPLAY="Before Display" -COM_FIELDS_FIELD_FIELD_DISPLAY_DESC="Joomla offers some content events which are triggered during the content creation process. This is the place to define how the custom fields should be integrated into content." -COM_FIELDS_FIELD_FIELD_DISPLAY_LABEL="Automatic Display" -COM_FIELDS_FIELD_FIELD_IMAGE_ALT_DESC="The alternate text for the image." -COM_FIELDS_FIELD_FIELD_IMAGE_ALT_LABEL="Image Alternate Text" -COM_FIELDS_FIELD_FIELD_IMAGE_DESC="Image label." -COM_FIELDS_FIELD_FIELD_IMAGE_LABEL="Image" -COM_FIELDS_FIELD_FIELD_LABEL_DESC="The label of the field to display." -COM_FIELDS_FIELD_FIELD_LABEL_LABEL="Label" -COM_FIELDS_FIELD_FIELD_LANGUAGE_DESC="Assign a language to this field." -COM_FIELDS_FIELD_FIELD_NOTE_DESC="An optional note for the field." -COM_FIELDS_FIELD_FIELD_NOTE_LABEL="Note" -COM_FIELDS_FIELD_FIELD_OUTPUT_DESC="The output of the field. If not empty then the field is rendered with the mustache codes." -COM_FIELDS_FIELD_FIELD_OUTPUT_LABEL="Output" -COM_FIELDS_FIELD_FIELD_PERMISSION_CREATE_DESC="New setting for create actions in this field and the calculated setting based on the parent extension and group permissions." -COM_FIELDS_FIELD_FIELD_PERMISSION_DELETE_DESC="New setting for delete actions on this field and the calculated setting based on the parent extension and group permissions." -COM_FIELDS_FIELD_FIELD_PERMISSION_EDITOWN_DESC="New setting for edit own actions on this field and the calculated setting based on the parent extension and group permissions." -COM_FIELDS_FIELD_FIELD_PERMISSION_EDITSTATE_DESC="New setting for edit state actions on this field and the calculated setting based on the parent extension and group permissions." -COM_FIELDS_FIELD_FIELD_PERMISSION_EDIT_DESC="New setting for edit actions on this field and the calculated setting based on the parent extension and group permissions." -COM_FIELDS_FIELD_FIELD_PERMISSION_EDIT_VALUE_DESC="Who can edit the field value in the form editor." -COM_FIELDS_FIELD_FIELD_PERMISSION_EDIT_VALUE_LABEL="Edit Field Value" -COM_FIELDS_FIELD_FIELD_READONLY_DESC="Is the field read only in the edit form." -COM_FIELDS_FIELD_FIELD_READONLY_LABEL="Read-Only" -COM_FIELDS_FIELD_FIELD_RENDER_CLASS_DESC="The class attributes of the field when the field is rendered. If different classes are needed, list them with spaces." -COM_FIELDS_FIELD_FIELD_RENDER_CLASS_LABEL="Render Class" -COM_FIELDS_FIELD_FIELD_REQUIRED_DESC="Is this a mandatory field for the editor?" -COM_FIELDS_FIELD_FIELD_REQUIRED_LABEL="Required" -COM_FIELDS_FIELD_FIELD_SHOW_ON_ADMIN="Administrator" -COM_FIELDS_FIELD_FIELD_SHOW_ON_BOTH="Both" -COM_FIELDS_FIELD_FIELD_SHOW_ON_DESC="On which part of the site should the field be shown." -COM_FIELDS_FIELD_FIELD_SHOW_ON_LABEL="Show On" -COM_FIELDS_FIELD_FIELD_SHOW_ON_SITE="Site" -COM_FIELDS_FIELD_FIELD_TYPE_DESC="The type of the field." -COM_FIELDS_FIELD_FIELD_TYPE_LABEL="Type" +COM_FIELDS_FIELD_CATEGORY_DESC="The category this field belongs to." +COM_FIELDS_FIELD_CATEGORY_LABEL="Fields Category" +COM_FIELDS_FIELD_CLASS_DESC="The class attributes of the field in the edit form. If different classes are needed, list them with spaces." +COM_FIELDS_FIELD_CLASS_LABEL="Class" +COM_FIELDS_FIELD_DEFAULT_VALUE_DESC="The default value of the field." +COM_FIELDS_FIELD_DEFAULT_VALUE_LABEL="Default Value" +COM_FIELDS_FIELD_DESCRIPTION_DESC="The description of the field." +COM_FIELDS_FIELD_DISABLED_DESC="Is the field disabled in the edit form." +COM_FIELDS_FIELD_DISABLED_LABEL="Disabled" +COM_FIELDS_FIELD_DISPLAY_AFTER_DISPLAY="After Display" +COM_FIELDS_FIELD_DISPLAY_AFTER_TITLE="After Title" +COM_FIELDS_FIELD_DISPLAY_BEFORE_DISPLAY="Before Display" +COM_FIELDS_FIELD_DISPLAY_DESC="Joomla offers some content events which are triggered during the content creation process. This is the place to define how the custom fields should be integrated into content." +COM_FIELDS_FIELD_DISPLAY_LABEL="Automatic Display" +COM_FIELDS_FIELD_IMAGE_ALT_DESC="The alternate text for the image." +COM_FIELDS_FIELD_IMAGE_ALT_LABEL="Image Alternate Text" +COM_FIELDS_FIELD_IMAGE_DESC="Image label." +COM_FIELDS_FIELD_IMAGE_LABEL="Image" +COM_FIELDS_FIELD_LABEL_DESC="The label of the field to display." +COM_FIELDS_FIELD_LABEL_LABEL="Label" +COM_FIELDS_FIELD_LANGUAGE_DESC="Assign a language to this field." +COM_FIELDS_FIELD_NOTE_DESC="An optional note for the field." +COM_FIELDS_FIELD_NOTE_LABEL="Note" +COM_FIELDS_FIELD_OUTPUT_DESC="The output of the field. If not empty then the field is rendered with the mustache codes." +COM_FIELDS_FIELD_OUTPUT_LABEL="Output" +COM_FIELDS_FIELD_PERMISSION_CREATE_DESC="New setting for create actions in this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_PERMISSION_DELETE_DESC="New setting for delete actions on this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_PERMISSION_EDITOWN_DESC="New setting for edit own actions on this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_PERMISSION_EDITSTATE_DESC="New setting for edit state actions on this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_PERMISSION_EDIT_DESC="New setting for edit actions on this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_PERMISSION_EDIT_VALUE_DESC="Who can edit the field value in the form editor." +COM_FIELDS_FIELD_PERMISSION_EDIT_VALUE_LABEL="Edit Field Value" +COM_FIELDS_FIELD_READONLY_DESC="Is the field read only in the edit form." +COM_FIELDS_FIELD_READONLY_LABEL="Read-Only" +COM_FIELDS_FIELD_RENDER_CLASS_DESC="The class attributes of the field when the field is rendered. If different classes are needed, list them with spaces." +COM_FIELDS_FIELD_RENDER_CLASS_LABEL="Render Class" +COM_FIELDS_FIELD_REQUIRED_DESC="Is this a mandatory field for the editor?" +COM_FIELDS_FIELD_REQUIRED_LABEL="Required" +COM_FIELDS_FIELD_SHOW_ON_ADMIN="Administrator" +COM_FIELDS_FIELD_SHOW_ON_BOTH="Both" +COM_FIELDS_FIELD_SHOW_ON_DESC="On which part of the site should the field be shown." +COM_FIELDS_FIELD_SHOW_ON_LABEL="Show On" +COM_FIELDS_FIELD_SHOW_ON_SITE="Site" +COM_FIELDS_FIELD_TYPE_DESC="The type of the field." +COM_FIELDS_FIELD_TYPE_LABEL="Type" ; Field Types -COM_FIELDS_FIELD_FIELD_CALENDAR_FORMAT_DESC="The date format to be used. This is in the format used by PHP to specify date string formats (see below). If no format argument is given, '%Y-%m-%d' is assumed (giving dates like '2008-04-16')." -COM_FIELDS_FIELD_FIELD_CALENDAR_FORMAT_LABEL="Format" +COM_FIELDS_FIELD_CALENDAR_FORMAT_DESC="The date format to be used. This is in the format used by PHP to specify date string formats (see below). If no format argument is given, '%Y-%m-%d' is assumed (giving dates like '2008-04-16')." +COM_FIELDS_FIELD_CALENDAR_FORMAT_LABEL="Format" -COM_FIELDS_FIELD_FIELD_EDITOR_BUTTONS_HIDE_DESC="Hide the buttons in the comma separated list." -COM_FIELDS_FIELD_FIELD_EDITOR_BUTTONS_HIDE_LABEL="Hide Buttons" -COM_FIELDS_FIELD_FIELD_EDITOR_HEIGHT_DESC="Defines the height (in pixels) of the WYSIWYG editor and defaults to 250px" -COM_FIELDS_FIELD_FIELD_EDITOR_HEIGHT_LABEL="Height" -COM_FIELDS_FIELD_FIELD_EDITOR_SHOW_BUTTONS_DESC="Should the buttons being shown." -COM_FIELDS_FIELD_FIELD_EDITOR_SHOW_BUTTONS_LABEL="Show Buttons" -COM_FIELDS_FIELD_FIELD_EDITOR_WIDTH_DESC="Defines the width (in pixels) of the WYSIWYG editor and defaults to 100%" -COM_FIELDS_FIELD_FIELD_EDITOR_WIDTH_LABEL="Width" +COM_FIELDS_FIELD_EDITOR_BUTTONS_HIDE_DESC="Hide the buttons in the comma separated list." +COM_FIELDS_FIELD_EDITOR_BUTTONS_HIDE_LABEL="Hide Buttons" +COM_FIELDS_FIELD_EDITOR_HEIGHT_DESC="Defines the height (in pixels) of the WYSIWYG editor and defaults to 250px" +COM_FIELDS_FIELD_EDITOR_HEIGHT_LABEL="Height" +COM_FIELDS_FIELD_EDITOR_SHOW_BUTTONS_DESC="Should the buttons being shown." +COM_FIELDS_FIELD_EDITOR_SHOW_BUTTONS_LABEL="Show Buttons" +COM_FIELDS_FIELD_EDITOR_WIDTH_DESC="Defines the width (in pixels) of the WYSIWYG editor and defaults to 100%" +COM_FIELDS_FIELD_EDITOR_WIDTH_LABEL="Width" -COM_FIELDS_FIELD_FIELD_GALLERY_MAX_WIDTH_DESC="The max width of the image. The image will be resized on the fly." -COM_FIELDS_FIELD_FIELD_GALLERY_MAX_WIDTH_LABEL="Max Width" -COM_FIELDS_FIELD_FIELD_GALLERY_RECURSIVE_DESC="Should the images from the subfolders also be included." -COM_FIELDS_FIELD_FIELD_GALLERY_RECURSIVE_LABEL="Recursive" -COM_FIELDS_FIELD_FIELD_GALLERY_THUMBNAIL_WIDTH_DESC="The width of the thumbnails. The thumbnails will be resized on the fly." -COM_FIELDS_FIELD_FIELD_GALLERY_THUMBNAIL_WIDTH_LABEL="Thumbnail Width" +COM_FIELDS_FIELD_GALLERY_MAX_WIDTH_DESC="The max width of the image. The image will be resized on the fly." +COM_FIELDS_FIELD_GALLERY_MAX_WIDTH_LABEL="Max Width" +COM_FIELDS_FIELD_GALLERY_RECURSIVE_DESC="Should the images from the subfolders also be included." +COM_FIELDS_FIELD_GALLERY_RECURSIVE_LABEL="Recursive" +COM_FIELDS_FIELD_GALLERY_THUMBNAIL_WIDTH_DESC="The width of the thumbnails. The thumbnails will be resized on the fly." +COM_FIELDS_FIELD_GALLERY_THUMBNAIL_WIDTH_LABEL="Thumbnail Width" -COM_FIELDS_FIELD_FIELD_IMAGELIST_DIRECTORY_DESC="The filesystem path to the directory containing the image files to be listed." -COM_FIELDS_FIELD_FIELD_IMAGELIST_DIRECTORY_LABEL="Directory" -COM_FIELDS_FIELD_FIELD_INTEGER_FIRST_DESC="This value is the lowest on the list." -COM_FIELDS_FIELD_FIELD_INTEGER_FIRST_LABEL="First" -COM_FIELDS_FIELD_FIELD_INTEGER_LAST_DESC="This value is the highest on the list." -COM_FIELDS_FIELD_FIELD_INTEGER_LAST_LABEL="Last" -COM_FIELDS_FIELD_FIELD_INTEGER_STEP_DESC="Each option will be the previous option incremented by this integer, starting with the first value until the last value is reached." -COM_FIELDS_FIELD_FIELD_INTEGER_STEP_LABEL="Step" +COM_FIELDS_FIELD_IMAGELIST_DIRECTORY_DESC="The filesystem path to the directory containing the image files to be listed." +COM_FIELDS_FIELD_IMAGELIST_DIRECTORY_LABEL="Directory" +COM_FIELDS_FIELD_INTEGER_FIRST_DESC="This value is the lowest on the list." +COM_FIELDS_FIELD_INTEGER_FIRST_LABEL="First" +COM_FIELDS_FIELD_INTEGER_LAST_DESC="This value is the highest on the list." +COM_FIELDS_FIELD_INTEGER_LAST_LABEL="Last" +COM_FIELDS_FIELD_INTEGER_STEP_DESC="Each option will be the previous option incremented by this integer, starting with the first value until the last value is reached." +COM_FIELDS_FIELD_INTEGER_STEP_LABEL="Step" -COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_DESC="Allow multiple values to be selected." -COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_LABEL="Multiple" -COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_DESC="The options of the list." -COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_KEY_LABEL="Key" -COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_LABEL="Options" -COM_FIELDS_FIELD_FIELD_LIST_MULTIPLE_OPTIONS_VALUE_LABEL="Value" +COM_FIELDS_FIELD_LIST_MULTIPLE_DESC="Allow multiple values to be selected." +COM_FIELDS_FIELD_LIST_MULTIPLE_LABEL="Multiple" +COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_DESC="The options of the list." +COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_KEY_LABEL="Key" +COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_LABEL="Options" +COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_VALUE_LABEL="Value" -COM_FIELDS_FIELD_FIELD_MEDIA_IMAGE_CLASS_DESC="The class which is added to the image (src tag)." -COM_FIELDS_FIELD_FIELD_MEDIA_IMAGE_CLASS_LABEL="Image Class" -COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_DESC="Shows or hides the preview of the selected image." -COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_INLINE="Inline" -COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_LABEL="Preview" -COM_FIELDS_FIELD_FIELD_MEDIA_PREVIEW_TOOLTIP="Tooltip" +COM_FIELDS_FIELD_MEDIA_IMAGE_CLASS_DESC="The class which is added to the image (src tag)." +COM_FIELDS_FIELD_MEDIA_IMAGE_CLASS_LABEL="Image Class" +COM_FIELDS_FIELD_MEDIA_PREVIEW_DESC="Shows or hides the preview of the selected image." +COM_FIELDS_FIELD_MEDIA_PREVIEW_INLINE="Inline" +COM_FIELDS_FIELD_MEDIA_PREVIEW_LABEL="Preview" +COM_FIELDS_FIELD_MEDIA_PREVIEW_TOOLTIP="Tooltip" -COM_FIELDS_FIELD_FIELD_SQL_QUERY_DESC="The SQL query which will provide the data for the drop-down list. The query must return two columns; one called 'value' which will hold the values of the list items; the other called 'text' containing the text in the drop-down list." -COM_FIELDS_FIELD_FIELD_SQL_QUERY_LABEL="Query" +COM_FIELDS_FIELD_SQL_QUERY_DESC="The SQL query which will provide the data for the drop-down list. The query must return two columns; one called 'value' which will hold the values of the list items; the other called 'text' containing the text in the drop-down list." +COM_FIELDS_FIELD_SQL_QUERY_LABEL="Query" -COM_FIELDS_FIELD_FIELD_TEXTAREA_COLS_DESC="The number of columns of the field." -COM_FIELDS_FIELD_FIELD_TEXTAREA_COLS_LABEL="Columns" -COM_FIELDS_FIELD_FIELD_TEXTAREA_ROWS_DESC="The number of rows of the field." -COM_FIELDS_FIELD_FIELD_TEXTAREA_ROWS_LABEL="Rows" +COM_FIELDS_FIELD_TEXTAREA_COLS_DESC="The number of columns of the field." +COM_FIELDS_FIELD_TEXTAREA_COLS_LABEL="Columns" +COM_FIELDS_FIELD_TEXTAREA_ROWS_DESC="The number of rows of the field." +COM_FIELDS_FIELD_TEXTAREA_ROWS_LABEL="Rows" -COM_FIELDS_FIELD_FIELD_URL_RELATIVE_DESC="Are relative URLs allowed." -COM_FIELDS_FIELD_FIELD_URL_RELATIVE_LABEL="Relative" -COM_FIELDS_FIELD_FIELD_URL_SCHEMES_DESC="The allowed schemes." -COM_FIELDS_FIELD_FIELD_URL_SCHEMES_LABEL="Schemes" +COM_FIELDS_FIELD_URL_RELATIVE_DESC="Are relative URLs allowed." +COM_FIELDS_FIELD_URL_RELATIVE_LABEL="Relative" +COM_FIELDS_FIELD_URL_SCHEMES_DESC="The allowed schemes." +COM_FIELDS_FIELD_URL_SCHEMES_LABEL="Schemes" ; Actions COM_FIELDS_N_ITEMS_ARCHIVED="%d fields successfully archived" From 32ebf5ae3754b503a07e81fb842e88e0c1c72dec Mon Sep 17 00:00:00 2001 From: laoneo Date: Mon, 4 Apr 2016 10:09:14 +0200 Subject: [PATCH 035/273] Sort the fields based on their text attribute Closes #7 --- administrator/components/com_fields/models/fields/type.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/administrator/components/com_fields/models/fields/type.php b/administrator/components/com_fields/models/fields/type.php index 3992c6e7303a2..37ce0175b4213 100644 --- a/administrator/components/com_fields/models/fields/type.php +++ b/administrator/components/com_fields/models/fields/type.php @@ -52,6 +52,11 @@ protected function getOptions () } } + // Sorting the fields based on the text which is displayed + usort($options, function ($a, $b) { + return strcmp($a->text, $b->text); + }); + return $options; } } From 407333bd499f952e01805f2d932df51990fe0cee Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Mon, 4 Apr 2016 11:08:43 +0100 Subject: [PATCH 036/273] Remove publish_date check The publish date is never used so removing the check from the codebase --- administrator/components/com_fields/tables/field.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/administrator/components/com_fields/tables/field.php b/administrator/components/com_fields/tables/field.php index a7a17366a96e0..d2f546b708e0f 100644 --- a/administrator/components/com_fields/tables/field.php +++ b/administrator/components/com_fields/tables/field.php @@ -78,14 +78,6 @@ public function check () $this->type = 'text'; } - // Check the publish down date is not earlier than publish up. - if ($this->publish_down > $this->_db->getNullDate() && $this->publish_down < $this->publish_up) - { - $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH')); - - return false; - } - if (is_array($this->assigned_cat_ids)) { $this->assigned_cat_ids = implode(',', $this->assigned_cat_ids); From 6493edd228e12f7de8eafc882ef64a855bf09f66 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Mon, 4 Apr 2016 11:46:31 +0100 Subject: [PATCH 037/273] Move directory to top --- .../components/com_fields/models/types/forms/gallery.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/administrator/components/com_fields/models/types/forms/gallery.xml b/administrator/components/com_fields/models/types/forms/gallery.xml index bfb9aa787a55a..4193f8c3d1509 100644 --- a/administrator/components/com_fields/models/types/forms/gallery.xml +++ b/administrator/components/com_fields/models/types/forms/gallery.xml @@ -2,6 +2,9 @@
+ JYES -
From ff0157a3f2497ddb30c841a8d7ffbaa120f153dc Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Mon, 4 Apr 2016 11:48:57 +0100 Subject: [PATCH 038/273] Move directory to top and make required --- .../components/com_fields/models/types/forms/imagelist.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/administrator/components/com_fields/models/types/forms/imagelist.xml b/administrator/components/com_fields/models/types/forms/imagelist.xml index dc0afad06e0e4..ba19d0ec5de3f 100644 --- a/administrator/components/com_fields/models/types/forms/imagelist.xml +++ b/administrator/components/com_fields/models/types/forms/imagelist.xml @@ -2,14 +2,15 @@
+ - From 053ebdd36b473e3841db76178255f4c57ade2b8a Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Mon, 4 Apr 2016 11:49:20 +0100 Subject: [PATCH 039/273] required --- .../components/com_fields/models/types/forms/gallery.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/administrator/components/com_fields/models/types/forms/gallery.xml b/administrator/components/com_fields/models/types/forms/gallery.xml index 4193f8c3d1509..e310e9b96ead3 100644 --- a/administrator/components/com_fields/models/types/forms/gallery.xml +++ b/administrator/components/com_fields/models/types/forms/gallery.xml @@ -3,6 +3,7 @@
Date: Mon, 4 Apr 2016 11:51:00 +0100 Subject: [PATCH 040/273] required --- administrator/components/com_fields/models/types/forms/media.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/administrator/components/com_fields/models/types/forms/media.xml b/administrator/components/com_fields/models/types/forms/media.xml index 6cae879dadd6e..cfb71c11f9a3a 100644 --- a/administrator/components/com_fields/models/types/forms/media.xml +++ b/administrator/components/com_fields/models/types/forms/media.xml @@ -3,6 +3,7 @@
Date: Mon, 4 Apr 2016 11:52:12 +0100 Subject: [PATCH 041/273] order --- .../components/com_fields/models/types/forms/sql.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/administrator/components/com_fields/models/types/forms/sql.xml b/administrator/components/com_fields/models/types/forms/sql.xml index 6eba856ef3c5b..d55b0d0bbfa5f 100644 --- a/administrator/components/com_fields/models/types/forms/sql.xml +++ b/administrator/components/com_fields/models/types/forms/sql.xml @@ -2,15 +2,15 @@
+ -
From 37e8f8b1f14fff5ba0bd47ade73516cda8fd6a69 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Mon, 4 Apr 2016 11:59:15 +0100 Subject: [PATCH 042/273] Add unique strings for Radio --- administrator/language/en-GB/en-GB.com_fields.ini | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/administrator/language/en-GB/en-GB.com_fields.ini b/administrator/language/en-GB/en-GB.com_fields.ini index eb816025a7a97..70afd923dd205 100644 --- a/administrator/language/en-GB/en-GB.com_fields.ini +++ b/administrator/language/en-GB/en-GB.com_fields.ini @@ -119,7 +119,7 @@ COM_FIELDS_FIELD_LIST_MULTIPLE_DESC="Allow multiple values to be selected." COM_FIELDS_FIELD_LIST_MULTIPLE_LABEL="Multiple" COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_DESC="The options of the list." COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_KEY_LABEL="Key" -COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_LABEL="Options" +COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_LABEL="List Values" COM_FIELDS_FIELD_LIST_MULTIPLE_OPTIONS_VALUE_LABEL="Value" COM_FIELDS_FIELD_MEDIA_IMAGE_CLASS_DESC="The class which is added to the image (src tag)." @@ -129,6 +129,13 @@ COM_FIELDS_FIELD_MEDIA_PREVIEW_INLINE="Inline" COM_FIELDS_FIELD_MEDIA_PREVIEW_LABEL="Preview" COM_FIELDS_FIELD_MEDIA_PREVIEW_TOOLTIP="Tooltip" +COM_FIELDS_FIELD_RADIO_MULTIPLE_DESC="Allow multiple values to be selected." +COM_FIELDS_FIELD_RADIO_MULTIPLE_LABEL="Multiple" +COM_FIELDS_FIELD_RADIO_MULTIPLE_OPTIONS_DESC="The options of the list." +COM_FIELDS_FIELD_RADIO_MULTIPLE_OPTIONS_KEY_LABEL="Key" +COM_FIELDS_FIELD_RADIO_MULTIPLE_OPTIONS_LABEL="Radio Values" +COM_FIELDS_FIELD_RADIO_MULTIPLE_OPTIONS_VALUE_LABEL="Value" + COM_FIELDS_FIELD_SQL_QUERY_DESC="The SQL query which will provide the data for the drop-down list. The query must return two columns; one called 'value' which will hold the values of the list items; the other called 'text' containing the text in the drop-down list." COM_FIELDS_FIELD_SQL_QUERY_LABEL="Query" From b8613c54d9dc1a655e844a601f2bd79484d549ed Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Mon, 4 Apr 2016 12:00:34 +0100 Subject: [PATCH 043/273] Unique strings for radio --- .../components/com_fields/models/types/forms/radio.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/administrator/components/com_fields/models/types/forms/radio.xml b/administrator/components/com_fields/models/types/forms/radio.xml index ab790dc6da530..f4e16b93b9606 100644 --- a/administrator/components/com_fields/models/types/forms/radio.xml +++ b/administrator/components/com_fields/models/types/forms/radio.xml @@ -6,14 +6,14 @@
+ description="COM_FIELDS_FIELD_RADIO_MULTIPLE_OPTIONS_DESC" + label="COM_FIELDS_FIELD_RADIO_MULTIPLE_OPTIONS_LABEL"> From d000f6e671dac37b1c0503da95f40b8d1c37cce9 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Mon, 4 Apr 2016 12:01:33 +0100 Subject: [PATCH 044/273] Move class to bottom --- .../components/com_fields/models/types/forms/radio.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/administrator/components/com_fields/models/types/forms/radio.xml b/administrator/components/com_fields/models/types/forms/radio.xml index f4e16b93b9606..302d39ac5db74 100644 --- a/administrator/components/com_fields/models/types/forms/radio.xml +++ b/administrator/components/com_fields/models/types/forms/radio.xml @@ -1,8 +1,5 @@
-
+ From b510e57aa555ed0184eb1470be237235b3193f61 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Mon, 4 Apr 2016 12:02:30 +0100 Subject: [PATCH 045/273] Move multiple to bottom --- .../components/com_fields/models/types/forms/list.xml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/administrator/components/com_fields/models/types/forms/list.xml b/administrator/components/com_fields/models/types/forms/list.xml index 33dfb951ac77d..9ffb8af51cc45 100644 --- a/administrator/components/com_fields/models/types/forms/list.xml +++ b/administrator/components/com_fields/models/types/forms/list.xml @@ -2,12 +2,6 @@
- - - - - @@ -20,6 +14,11 @@ size="30" type="text" />
+ + + +
From d16bf57b0265c47766467f0cd9b218f800fb1d30 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Mon, 4 Apr 2016 12:05:24 +0100 Subject: [PATCH 046/273] Unique strings for checkbox --- .../com_fields/models/types/forms/checkboxes.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/administrator/components/com_fields/models/types/forms/checkboxes.xml b/administrator/components/com_fields/models/types/forms/checkboxes.xml index d53818adf765c..8350a7967edcb 100644 --- a/administrator/components/com_fields/models/types/forms/checkboxes.xml +++ b/administrator/components/com_fields/models/types/forms/checkboxes.xml @@ -3,14 +3,14 @@
+ description="COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_OPTIONS_DESC" + label="COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_OPTIONS_LABEL"> From e2d42137efe358b3e757c6f8220224deb9794d92 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Mon, 4 Apr 2016 12:06:32 +0100 Subject: [PATCH 047/273] Unique strings for checkbox --- administrator/language/en-GB/en-GB.com_fields.ini | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/administrator/language/en-GB/en-GB.com_fields.ini b/administrator/language/en-GB/en-GB.com_fields.ini index 70afd923dd205..eb092a35af0f4 100644 --- a/administrator/language/en-GB/en-GB.com_fields.ini +++ b/administrator/language/en-GB/en-GB.com_fields.ini @@ -90,6 +90,13 @@ COM_FIELDS_FIELD_TYPE_LABEL="Type" COM_FIELDS_FIELD_CALENDAR_FORMAT_DESC="The date format to be used. This is in the format used by PHP to specify date string formats (see below). If no format argument is given, '%Y-%m-%d' is assumed (giving dates like '2008-04-16')." COM_FIELDS_FIELD_CALENDAR_FORMAT_LABEL="Format" +COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_DESC="Allow multiple values to be selected." +COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_LABEL="Multiple" +COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_OPTIONS_DESC="The options of the list." +COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_OPTIONS_KEY_LABEL="Key" +COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_OPTIONS_LABEL="Chexkbox Values" +COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_OPTIONS_VALUE_LABEL="Value" + COM_FIELDS_FIELD_EDITOR_BUTTONS_HIDE_DESC="Hide the buttons in the comma separated list." COM_FIELDS_FIELD_EDITOR_BUTTONS_HIDE_LABEL="Hide Buttons" COM_FIELDS_FIELD_EDITOR_HEIGHT_DESC="Defines the height (in pixels) of the WYSIWYG editor and defaults to 250px" From c00323b196c8eba950415946e3872be7b4f86291 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Mon, 4 Apr 2016 12:09:10 +0100 Subject: [PATCH 048/273] typo --- administrator/language/en-GB/en-GB.com_fields.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/language/en-GB/en-GB.com_fields.ini b/administrator/language/en-GB/en-GB.com_fields.ini index eb092a35af0f4..071226dd2f8f5 100644 --- a/administrator/language/en-GB/en-GB.com_fields.ini +++ b/administrator/language/en-GB/en-GB.com_fields.ini @@ -94,7 +94,7 @@ COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_DESC="Allow multiple values to be selected." COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_LABEL="Multiple" COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_OPTIONS_DESC="The options of the list." COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_OPTIONS_KEY_LABEL="Key" -COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_OPTIONS_LABEL="Chexkbox Values" +COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_OPTIONS_LABEL="Checkbox Values" COM_FIELDS_FIELD_CHECKBOX_MULTIPLE_OPTIONS_VALUE_LABEL="Value" COM_FIELDS_FIELD_EDITOR_BUTTONS_HIDE_DESC="Hide the buttons in the comma separated list." From daadb57ecfc9cc82f3d623a7997be4bbc8387241 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Mon, 4 Apr 2016 12:15:22 +0100 Subject: [PATCH 049/273] Add travis --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 075a255e9d38a..2465db7d36728 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,7 @@ Joomla! CMS™ [![Analytics](https://ga-beacon.appspot.com/UA-544070-3/joomla-cm Build Status --------------------- -Travis-CI: [![Build Status](https://travis-ci.org/joomla/joomla-cms.svg?branch=staging)](https://travis-ci.org/joomla/joomla-cms) -Jenkins: [![Build Status](http://build.joomla.org/job/cms/badge/icon)](http://build.joomla.org/job/cms/) +Travis-CI: [![Build Status](https://travis-ci.org/joomla-projects/custom-fields.svg?branch=custom-fields)](https://travis-ci.org/joomla/joomla-cms) What is this? --------------------- From 8aa4311244df4836d3fe9ccb968d804571f21ddc Mon Sep 17 00:00:00 2001 From: George Wilson Date: Mon, 4 Apr 2016 12:15:56 +0100 Subject: [PATCH 050/273] Wrong link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2465db7d36728..346208101d315 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Joomla! CMS™ [![Analytics](https://ga-beacon.appspot.com/UA-544070-3/joomla-cm Build Status --------------------- -Travis-CI: [![Build Status](https://travis-ci.org/joomla-projects/custom-fields.svg?branch=custom-fields)](https://travis-ci.org/joomla/joomla-cms) +Travis-CI: [![Build Status](https://travis-ci.org/joomla-projects/custom-fields.svg?branch=custom-fields)](https://travis-ci.org/joomla-projects/custom-fields) What is this? --------------------- From 07b1418b99b96c9d8f06a32b222d3502434038bb Mon Sep 17 00:00:00 2001 From: Allon Moritz Date: Mon, 4 Apr 2016 15:38:56 +0200 Subject: [PATCH 051/273] Rename the dpfield legacy classes to field Closes #48 --- components/com_fields/layouts/field/render.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/com_fields/layouts/field/render.php b/components/com_fields/layouts/field/render.php index 4be0008f83cd2..2521f710d0e0e 100644 --- a/components/com_fields/layouts/field/render.php +++ b/components/com_fields/layouts/field/render.php @@ -25,7 +25,7 @@ ?> -
- : - +
+ : +
From 0cdda78ed66f4f4639d0b1743d7689f8504b5e93 Mon Sep 17 00:00:00 2001 From: laoneo Date: Tue, 5 Apr 2016 08:25:36 +0200 Subject: [PATCH 052/273] Made options required --- .../components/com_fields/models/types/forms/checkboxes.xml | 2 +- administrator/components/com_fields/models/types/forms/list.xml | 2 +- .../components/com_fields/models/types/forms/radio.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/administrator/components/com_fields/models/types/forms/checkboxes.xml b/administrator/components/com_fields/models/types/forms/checkboxes.xml index d53818adf765c..d8879ce98918c 100644 --- a/administrator/components/com_fields/models/types/forms/checkboxes.xml +++ b/administrator/components/com_fields/models/types/forms/checkboxes.xml @@ -2,7 +2,7 @@
-