diff --git a/administrator/components/com_content/config.xml b/administrator/components/com_content/config.xml index 21f34112cb57b..4efe192a541e7 100644 --- a/administrator/components/com_content/config.xml +++ b/administrator/components/com_content/config.xml @@ -1026,6 +1026,21 @@ + + + + + + +
get('custom_fields_enable', 1)) + { + return null; + } + if (JFactory::getApplication()->isClient('site')) { + $customFieldsEnabledContexts = $compParams->get('custom_fields_enabled_contexts', array()); + + if (is_array($customFieldsEnabledContexts)) + { + // Always show in form + $customFieldsEnabledContexts[] = "form"; + if (!in_array($section, $customFieldsEnabledContexts)) + { + // We have no contexts within which to show custom fields + return null; + } + } + // On the front end we need to map some sections switch ($section) { diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php index aedb4666112b0..1c68753eeb9c7 100644 --- a/administrator/components/com_fields/helpers/fields.php +++ b/administrator/components/com_fields/helpers/fields.php @@ -60,6 +60,11 @@ public static function extract($contextString, $item = null) { $parts[1] = $section; } + else + { + // Should not display here since its not a valid context - must not fall back to the default $parts array + return null; + } } } @@ -95,7 +100,7 @@ public static function getFields($context, $item = null, $prepareValue = false, JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_fields/models', 'FieldsModel'); self::$fieldsCache = JModelLegacy::getInstance('Fields', 'FieldsModel', array( - 'ignore_request' => true) + 'ignore_request' => true) ); self::$fieldsCache->setState('filter.state', 1); @@ -148,7 +153,7 @@ public static function getFields($context, $item = null, $prepareValue = false, $fieldIds = array_map( function($f) { - return $f->id; + return $f->id; }, $fields ); @@ -318,7 +323,7 @@ public static function prepareForm($context, JForm $form, $data) /* * 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())); @@ -334,7 +339,7 @@ public static function prepareForm($context, JForm $form, $data) /* * Setting the onchange event to reload the page when the category * has changed - */ + */ $form->setFieldAttribute('catid', 'onchange', 'categoryHasChanged(this);'); // Preload spindle-wheel when we need to submit form due to category selector changed @@ -583,7 +588,7 @@ public static function countItems(&$items) $fields = $db->loadObjectList(); $states = array( - '-2' => 'count_trashed', + '-2' => 'count_trashed', '0' => 'count_unpublished', '1' => 'count_published', '2' => 'count_archived', @@ -621,9 +626,9 @@ public static function getAssignedCategoriesTitles($fieldId) $query = $db->getQuery(true); $query->select($db->quoteName('c.title')) - ->from($db->quoteName('#__fields_categories', 'a')) - ->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON a.category_id = c.id') - ->where('field_id = ' . $fieldId); + ->from($db->quoteName('#__fields_categories', 'a')) + ->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON a.category_id = c.id') + ->where('field_id = ' . $fieldId); $db->setQuery($query); @@ -641,10 +646,10 @@ public static function getFieldsPluginId() { $db = JFactory::getDbo(); $query = $db->getQuery(true) - ->select($db->quoteName('extension_id')) - ->from($db->quoteName('#__extensions')) - ->where($db->quoteName('folder') . ' = ' . $db->quote('system')) - ->where($db->quoteName('element') . ' = ' . $db->quote('fields')); + ->select($db->quoteName('extension_id')) + ->from($db->quoteName('#__extensions')) + ->where($db->quoteName('folder') . ' = ' . $db->quote('system')) + ->where($db->quoteName('element') . ' = ' . $db->quote('fields')); $db->setQuery($query); try diff --git a/administrator/language/en-GB/en-GB.com_content.ini b/administrator/language/en-GB/en-GB.com_content.ini index a70b8bf957976..513848aa59419 100644 --- a/administrator/language/en-GB/en-GB.com_content.ini +++ b/administrator/language/en-GB/en-GB.com_content.ini @@ -7,8 +7,10 @@ COM_CONTENT="Articles" COM_CONTENT_ACCESS_DELETE_DESC="New setting for delete actions on this article and the calculated setting based on the parent category and group permissions." COM_CONTENT_ACCESS_EDIT_DESC="New setting for edit actions on this article and the calculated setting based on the parent category and group permissions." COM_CONTENT_ACCESS_EDITSTATE_DESC="New setting for edit state actions on this article and the calculated setting based on the parent category and group permissions." +COM_CONTENT_ARCHIVE_VIEW="Archive view" COM_CONTENT_ARTICLE_CONTENT="Content" COM_CONTENT_ARTICLE_DETAILS="Article Details" +COM_CONTENT_ARTICLE_VIEW="Single Article view" COM_CONTENT_ARTICLES_TITLE="Articles" COM_CONTENT_ATTRIBS_ARTICLE_SETTINGS_LABEL="Options" COM_CONTENT_ATTRIBS_FIELDSET_LABEL="Options" @@ -16,6 +18,7 @@ COM_CONTENT_ATTRIBS_FIELDSET_LABEL="Options" COM_CONTENT_BATCH_MENU_LABEL="To Move or Copy your selection please select a Category." COM_CONTENT_BATCH_OPTIONS="Batch process the selected articles" COM_CONTENT_BATCH_TIP="If a category is selected for move/copy, any actions selected will be applied to the copied or moved articles. Otherwise, all actions are applied to the selected articles." +COM_CONTENT_CATEGORY_VIEW="Category view" COM_CONTENT_CHANGE_ARTICLE="Select or Change article" COM_CONTENT_CHANGE_ARTICLE_BUTTON="Select/Change" COM_CONTENT_CHOOSE_CATEGORY_DESC="Select a parent category." @@ -45,6 +48,7 @@ COM_CONTENT_FEATURED_CATEGORIES_DESC="Optional list of categories. If selected, COM_CONTENT_FEATURED_CATEGORIES_LABEL="Select Categories" COM_CONTENT_FEATURED_ORDER="Featured Articles Order" COM_CONTENT_FEATURED_TITLE="Articles: Featured" +COM_CONTENT_FEATURED_VIEW="Featured Articles view" COM_CONTENT_FIELD_BROWSER_PAGE_TITLE_DESC="Optional text for the "Browser page title" element to be used when the article is viewed with a non-article menu item. If blank, the article's title is used instead." COM_CONTENT_FIELD_BROWSER_PAGE_TITLE_LABEL="Browser Page Title" COM_CONTENT_FIELD_ARTICLETEXT_DESC="Enter the article content in the text area." diff --git a/administrator/language/en-GB/en-GB.ini b/administrator/language/en-GB/en-GB.ini index 938cb19fa75a2..9a377cc50c479 100644 --- a/administrator/language/en-GB/en-GB.ini +++ b/administrator/language/en-GB/en-GB.ini @@ -324,6 +324,8 @@ JGLOBAL_CREATED_DATE="Created Date" JGLOBAL_CUSTOM_CATEGORY="New Categories" JGLOBAL_CUSTOM_FIELDS_ENABLE_DESC="Enable the creation of custom fields." JGLOBAL_CUSTOM_FIELDS_ENABLE_LABEL="Enable Custom Fields" +JGLOBAL_CUSTOM_FIELDS_ENABLED_CONTEXTS_LABEL="Where should custom fields appear" +JGLOBAL_CUSTOM_FIELDS_ENABLED_CONTEXTS_DESC="Select one or more output views where custom fields should appear" JGLOBAL_DATE_FORMAT_DESC="Optional format string for showing the date. For example, D M Y for day month year or you can use d-m-y for a short version eg. 28-12-16. See http://www.php.net/manual/en/function.date.php. If left blank, it uses DATE_FORMAT_LC1 from your language file." JGLOBAL_DATE_FORMAT_LABEL="Date Format" JGLOBAL_DESCRIPTION="Description" diff --git a/administrator/templates/isis/error-gwe.php b/administrator/templates/isis/error-gwe.php new file mode 100644 index 0000000000000..bad47047186c7 --- /dev/null +++ b/administrator/templates/isis/error-gwe.php @@ -0,0 +1,294 @@ +getTemplate(true)->params; + +$app = JFactory::getApplication(); +$lang = JFactory::getLanguage(); +$input = $app->input; +$user = JFactory::getUser(); + +// Gets the FrontEnd Main page Uri +$frontEndUri = JUri::getInstance(JUri::root()); +$frontEndUri->setScheme(((int) $app->get('force_ssl', 0) === 2) ? 'https' : 'http'); +$mainPageUri = $frontEndUri->toString(); + +// Detecting Active Variables +$option = $input->get('option', ''); +$view = $input->get('view', ''); +$layout = $input->get('layout', ''); +$task = $input->get('task', ''); +$itemid = $input->get('Itemid', ''); +$sitename = $app->get('sitename'); + +$cpanel = ($option === 'com_cpanel'); + +$showSubmenu = false; +$this->submenumodules = JModuleHelper::getModules('submenu'); +foreach ($this->submenumodules as $submenumodule) +{ + $output = JModuleHelper::renderModule($submenumodule); + if (strlen($output)) + { + $showSubmenu = true; + break; + } +} + +// Logo file +if ($params->get('logoFile')) +{ + $logo = JUri::root() . $params->get('logoFile'); +} +else +{ + $logo = $this->baseurl . '/templates/' . $this->template . '/images/logo.png'; +} + +// Template Parameters +$displayHeader = $params->get('displayHeader', '1'); +$statusFixed = $params->get('statusFixed', '1'); +$stickyToolbar = $params->get('stickyToolbar', '1'); +?> + + + + + + + <?php echo $this->title; ?> <?php echo htmlspecialchars($this->error->getMessage(), ENT_QUOTES, 'UTF-8'); ?> + get('debug_lang', '0') == '1' || $app->get('debug', '0') == '1') : ?> + + + + + direction == 'rtl') : ?> + + + + getTag() . '/' . $lang->getTag() . '.css'; ?> + + + + + + + get('templateColor')) : ?> + + + + get('headerColor')) : ?> + + + + get('sidebarColor')) : ?> + + + + + + + + + + + + +
+ + + +
+

+
+
+ getInstance()->countModules('status'))) : ?> + + + + +
+ +
+
+ +
+
+ +

+
+ error->getCode(); ?> error->getMessage(), ENT_QUOTES, 'UTF-8');?> + +
+
+ +
+
+
+ + + diff --git a/libraries/joomla/form/fields/list.php b/libraries/joomla/form/fields/list.php index d28832dacffa9..05b46c9b1868e 100644 --- a/libraries/joomla/form/fields/list.php +++ b/libraries/joomla/form/fields/list.php @@ -83,7 +83,16 @@ protected function getInput() else // Create a regular list. { - $html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); + $listoptions = array(); + $listoptions['option.key'] = 'value'; + $listoptions['option.text'] = 'text'; + $listoptions['list.select'] = $this->value; + $listoptions['id'] = $this->id; + $listoptions['list.translate'] = false; + $listoptions['option.attr'] = 'optionattr'; + $listoptions['list.attr'] = trim($attr); + + $html[] = JHtml::_('select.genericlist', $options, $this->name, $listoptions); } return implode($html); @@ -144,7 +153,10 @@ protected function getOptions() // Set some event handler attributes. But really, should be using unobtrusive js. $tmp['onclick'] = (string) $option['onclick']; $tmp['onchange'] = (string) $option['onchange']; - + + if ((string) $option['showon']){ + $tmp['optionattr'] = " data-showon = '".json_encode(JFormHelper::parseShowOnConditions((string) $option['showon'], $this->formControl, $this->group))."'"; + } // Add the option object to the result set. $options[] = (object) $tmp; } diff --git a/media/jui/js/cms-uncompressed.js b/media/jui/js/cms-uncompressed.js index 5b50f85b33749..f15bbce3514a6 100644 --- a/media/jui/js/cms-uncompressed.js +++ b/media/jui/js/cms-uncompressed.js @@ -155,9 +155,18 @@ if (!Array.prototype.indexOf) } // If conditions are satisfied show the target field(s), else hide - if (animate) { + // Note that we cannot animate select list options anywhere other than chrome so disable this + if (animate && !target.is('option')) { (showfield) ? target.slideDown() : target.slideUp(); - } else { + } else if (target.is('option')) { + target.toggle(showfield); + target.attr('disabled' ,showfield? false : true); + // if chosen active for the target select list then update it + if ($('#'+target.parent().attr('id')+'_chzn').length){ + target.parent().trigger("liszt:updated"); + target.parent().trigger("chosen:updated"); + } + } else { target.toggle(showfield); } } diff --git a/media/jui/js/cms.js b/media/jui/js/cms.js index ef2014994a49b..5bd720ce6a8f5 100644 --- a/media/jui/js/cms.js +++ b/media/jui/js/cms.js @@ -1 +1 @@ -if("undefined"==typeof Joomla)var Joomla={};!function(e,a){"use strict";a.setcollapse=function(a,n,o){e.getElementById("collapse-"+n)||(e.getElementById("container-collapse").innerHTML='
')},Array.prototype.indexOf||(Array.prototype.indexOf=function(e){var a=this.length>>>0,n=Number(arguments[1])||0;for(n=0>n?Math.ceil(n):Math.floor(n),0>n&&(n+=a);a>n;n++)if(n in this&&this[n]===e)return n;return-1}),window.jQuery&&function(a){function n(e,n){for(var o,t,i,r,l=!0,d=e.data("showon")||[],f=0,s=d.length;s>f;f++)t=d[f]||{},i=t.field,r=a('[name="'+i+'"], [name="'+i+'[]"]'),t.valid=0,r.each(function(){var e=a(this);if(-1!==["checkbox","radio"].indexOf(e.attr("type"))){if(!e.prop("checked"))return;o=e.val()}else o=e.val(),null==o&&"select"==e.prop("tagName").toLowerCase()&&(o=[]);"object"!=typeof o&&(o=JSON.parse('["'+o+'"]'));for(var n in o)o.propertyIsEnumerable(n)&&("="==d[f].sign&&-1!==d[f].values.indexOf(o[n])&&(d[f].valid=1),"!="==d[f].sign&&-1===d[f].values.indexOf(o[n])&&(d[f].valid=1))}),""===t.op?0===t.valid&&(l=!1):("AND"===t.op&&t.valid+d[f-1].valid<2&&(l=!1),"OR"===t.op&&t.valid+d[f-1].valid>0&&(l=!0));n?l?e.slideDown():e.slideUp():e.toggle(l)}function o(o){o=o||e;for(var t=a(o).find("[data-showon]"),i=0,r=t.length;r>i;i++)!function(){for(var e,o=a(t[i]),r=o.data("showon")||[],l=a(),d=0,f=r.length;f>d;d++)e=r[d].field,l=l.add(a('[name="'+e+'"], [name="'+e+'[]"]'));n(o),l.on("change",function(){n(o,!0)})}()}a(e).ready(function(){o(),a(e).on("subform-row-add",function(e,n){for(var t,i,r=a(n),l=r.find("[data-showon]"),d=r.data("baseName"),f=r.data("group"),s=new RegExp("\\["+d+"\\]\\["+d+"X\\]","g"),c="["+d+"]["+f+"]",u=0,p=l.length;p>u;u++)t=a(l[u]),i=t.attr("data-showon").replace(s,c),t.attr("data-showon",i);o(n)})})}(jQuery)}(document,Joomla); \ No newline at end of file +if("undefined"==typeof Joomla)var Joomla={};!function(e,a){"use strict";a.setcollapse=function(a,t,n){e.getElementById("collapse-"+t)||(e.getElementById("container-collapse").innerHTML='
')},Array.prototype.indexOf||(Array.prototype.indexOf=function(e){var a=this.length>>>0,t=Number(arguments[1])||0;for(t=0>t?Math.ceil(t):Math.floor(t),0>t&&(t+=a);a>t;t++)if(t in this&&this[t]===e)return t;return-1}),window.jQuery&&function(a){function t(e,t){for(var n,o,i,r,d=!0,l=e.data("showon")||[],s=0,f=l.length;f>s;s++)o=l[s]||{},i=o.field,r=a('[name="'+i+'"], [name="'+i+'[]"]'),o.valid=0,r.each(function(){var e=a(this);if(-1!==["checkbox","radio"].indexOf(e.attr("type"))){if(!e.prop("checked"))return;n=e.val()}else n=e.val(),null==n&&"select"==e.prop("tagName").toLowerCase()&&(n=[]);"object"!=typeof n&&(n=JSON.parse('["'+n+'"]'));for(var t in n)n.propertyIsEnumerable(t)&&("="==l[s].sign&&-1!==l[s].values.indexOf(n[t])&&(l[s].valid=1),"!="==l[s].sign&&-1===l[s].values.indexOf(n[t])&&(l[s].valid=1))}),""===o.op?0===o.valid&&(d=!1):("AND"===o.op&&o.valid+l[s-1].valid<2&&(d=!1),"OR"===o.op&&o.valid+l[s-1].valid>0&&(d=!0));t&&!e.is("option")?d?e.slideDown():e.slideUp():e.is("option")?(e.toggle(d),e.attr("disabled",d?!1:!0),a("#"+e.parent().attr("id")+"_chzn").length&&(e.parent().trigger("liszt:updated"),e.parent().trigger("chosen:updated"))):e.toggle(d)}function n(n){n=n||e;for(var o=a(n).find("[data-showon]"),i=0,r=o.length;r>i;i++)!function(){for(var e,n=a(o[i]),r=n.data("showon")||[],d=a(),l=0,s=r.length;s>l;l++)e=r[l].field,d=d.add(a('[name="'+e+'"], [name="'+e+'[]"]'));t(n),d.on("change",function(){t(n,!0)})}()}a(e).ready(function(){n(),a(e).on("subform-row-add",function(e,t){for(var o,i,r=a(t),d=r.find("[data-showon]"),l=r.data("baseName"),s=r.data("group"),f=new RegExp("\\["+l+"\\]\\["+l+"X\\]","g"),c="["+l+"]["+s+"]",p=0,u=d.length;u>p;p++)o=a(d[p]),i=o.attr("data-showon").replace(f,c),o.attr("data-showon",i);n(t)})})}(jQuery)}(document,Joomla); \ No newline at end of file diff --git a/templates/protostar/html/layouts/gwe-com_content/fields/render.php b/templates/protostar/html/layouts/gwe-com_content/fields/render.php new file mode 100644 index 0000000000000..fc71b9a01cea1 --- /dev/null +++ b/templates/protostar/html/layouts/gwe-com_content/fields/render.php @@ -0,0 +1,71 @@ +fields ?: FieldsHelper::getFields($context, $item, true); +} + +if (!$fields) +{ + return; +} + +// Print the container tag +echo '
'; + +// Loop through the fields and print them +foreach ($fields as $field) +{ + // If the value is empty do nothing + if (!isset($field->value) || $field->value == '') + { + continue; + } + + echo FieldsHelper::render($context, 'field.render', array('field' => $field)); +} + +// Close the container +echo '
'; + +echo "
com_content template override of layout
"; diff --git a/templates/protostar/html/layouts/gwe-com_fields/fields/render.php b/templates/protostar/html/layouts/gwe-com_fields/fields/render.php new file mode 100644 index 0000000000000..8ca4e3907decc --- /dev/null +++ b/templates/protostar/html/layouts/gwe-com_fields/fields/render.php @@ -0,0 +1,70 @@ +fields ?: FieldsHelper::getFields($context, $item, true); +} + +if (!$fields) +{ + return; +} + +// Print the container tag +echo '
'; + +// Loop through the fields and print them +foreach ($fields as $field) +{ + // If the value is empty do nothing + if (!isset($field->value) || $field->value == '') + { + continue; + } + + echo FieldsHelper::render($context, 'field.render', array('field' => $field)); +} + +// Close the container +echo '
'; + +echo "
com_fields template override of layout
";