diff --git a/administrator/components/com_banners/models/banner.php b/administrator/components/com_banners/models/banner.php
index be1048ac9672c..a0c18f25fdb41 100644
--- a/administrator/components/com_banners/models/banner.php
+++ b/administrator/components/com_banners/models/banner.php
@@ -486,6 +486,31 @@ public function save($data)
{
$input = JFactory::getApplication()->input;
+ JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php');
+
+ // Cast catid to integer for comparison
+ $catid = (int) $data['catid'];
+
+ // Check if New Category exists
+ if ($catid > 0)
+ {
+ $catid = CategoriesHelper::validateCategoryId($data['catid'], 'com_banners');
+ }
+
+ // Save New Category
+ if ($catid == 0)
+ {
+ $table = array();
+ $table['title'] = $data['catid'];
+ $table['parent_id'] = 1;
+ $table['extension'] = 'com_banners';
+ $table['language'] = $data['language'];
+ $table['published'] = 1;
+
+ // Create new category and get catid back
+ $data['catid'] = CategoriesHelper::createCategory($table);
+ }
+
// Alter the name for save as copy
if ($input->get('task') == 'save2copy')
{
diff --git a/administrator/components/com_banners/models/forms/banner.xml b/administrator/components/com_banners/models/forms/banner.xml
index b4d5607f64044..be3f732e511be 100644
--- a/administrator/components/com_banners/models/forms/banner.xml
+++ b/administrator/components/com_banners/models/forms/banner.xml
@@ -20,7 +20,10 @@
+ addfieldpath="/administrator/components/com_categories/models/fields"
+ allowAdd="true"
+ default=""
+ />
0 ));
JFactory::getDocument()->addScriptDeclaration('
Joomla.submitbutton = function(task)
diff --git a/administrator/components/com_cache/views/purge/tmpl/default.php b/administrator/components/com_cache/views/purge/tmpl/default.php
index e66384ed14931..00599d9539068 100644
--- a/administrator/components/com_cache/views/purge/tmpl/default.php
+++ b/administrator/components/com_cache/views/purge/tmpl/default.php
@@ -15,14 +15,15 @@
sidebar; ?>
-
-
-
-
+
+
+
+
+
diff --git a/administrator/components/com_categories/helpers/categories.php b/administrator/components/com_categories/helpers/categories.php
index 60c74bcbc9420..e4589f6704bbd 100644
--- a/administrator/components/com_categories/helpers/categories.php
+++ b/administrator/components/com_categories/helpers/categories.php
@@ -109,4 +109,50 @@ public static function getAssociations($pk, $extension = 'com_content')
return $associations;
}
+
+ /**
+ * Check if Category ID exists otherwise assign to ROOT category.
+ *
+ * @param mixed $catid Name or ID of category.
+ * @param string $extension Extension that triggers this function
+ *
+ * @return int $catid Category ID.
+ */
+ public static function validateCategoryId($catid, $extension)
+ {
+ JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_categories/tables');
+
+ $categoryTable = JTable::getInstance('Category');
+
+ $data = array();
+ $data['id'] = $catid;
+ $data['extension'] = $extension;
+
+ if (!$categoryTable->load($data))
+ {
+ $catid = 0;
+ }
+
+ return (int) $catid;
+ }
+
+ /**
+ * Create new Category from within item view.
+ *
+ * @param array $data Array of data for new category.
+ *
+ * @return integer.
+ */
+ public static function createCategory($data)
+ {
+ JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_categories/models');
+ JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_categories/tables');
+
+ $categoryModel = JModelLegacy::getInstance('Category', 'CategoriesModel');
+ $categoryModel->save($data);
+
+ $catid = $categoryModel->getState('category.id');
+
+ return $catid;
+ }
}
diff --git a/administrator/components/com_categories/models/fields/categoryedit.php b/administrator/components/com_categories/models/fields/categoryedit.php
index 19de4d275a555..0e792e9a20b57 100644
--- a/administrator/components/com_categories/models/fields/categoryedit.php
+++ b/administrator/components/com_categories/models/fields/categoryedit.php
@@ -20,6 +20,14 @@
*/
class JFormFieldCategoryEdit extends JFormFieldList
{
+ /**
+ * To allow creation of new categories.
+ *
+ * @var int
+ * @since 3.6
+ */
+ protected $allowAdd;
+
/**
* A flexible category list that respects access controls
*
@@ -28,6 +36,77 @@ class JFormFieldCategoryEdit extends JFormFieldList
*/
public $type = 'CategoryEdit';
+ /**
+ * 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->allowAdd = isset($this->element['allowAdd']) ? $this->element['allowAdd'] : '';
+ }
+
+ return $return;
+ }
+
+ /**
+ * Method to get certain otherwise inaccessible properties from the form field object.
+ *
+ * @param string $name The property name for which to the the value.
+ *
+ * @return mixed The property value or null.
+ *
+ * @since 3.6
+ */
+ public function __get($name)
+ {
+ switch ($name)
+ {
+ case 'allowAdd':
+ return $this->$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.6
+ */
+ public function __set($name, $value)
+ {
+ $value = (string) $value;
+
+ switch ($name)
+ {
+ case 'allowAdd':
+ $value = (string) $value;
+ $this->$name = ($value === 'true' || $value === $name || $value === '1');
+ break;
+ default:
+ parent::__set($name, $value);
+ }
+ }
+
/**
* Method to get a list of categories that respects access controls and can be used for
* either category assignment or parent category assignment in edit screens.
@@ -229,4 +308,85 @@ protected function getOptions()
// Merge any additional options in the XML definition.
return array_merge(parent::getOptions(), $options);
}
+
+ /**
+ * Method to get the field input markup for a generic list.
+ * Use the multiple attribute to enable multiselect.
+ *
+ * @return string The field input markup.
+ *
+ * @since 3.6
+ */
+ protected function getInput()
+ {
+ $html = array();
+ $class = array();
+ $attr = '';
+
+ // Initialize some field attributes.
+ $class[] = !empty($this->class) ? $this->class : '';
+
+ if ($this->allowAdd)
+ {
+ $customGroupText = JText::_('JGLOBAL_CUSTOM_CATEGORY');
+
+ $class[] = 'chzn-custom-value';
+ $attr .= ' data-custom_group_text="' . $customGroupText . '" '
+ . 'data-no_results_text="' . JText::_('JGLOBAL_ADD_CUSTOM_CATEGORY') . '" '
+ . 'data-placeholder="' . JText::_('JGLOBAL_TYPE_OR_SELECT_CATEGORY') . '" ';
+ }
+
+ if ($class)
+ {
+ $attr .= 'class="' . implode(' ', $class) . '"';
+ }
+
+ $attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
+ $attr .= $this->multiple ? ' multiple' : '';
+ $attr .= $this->required ? ' required aria-required="true"' : '';
+ $attr .= $this->autofocus ? ' autofocus' : '';
+
+ // To avoid user's confusion, readonly="true" should imply disabled="true".
+ if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1'|| (string) $this->disabled == 'true')
+ {
+ $attr .= ' disabled="disabled"';
+ }
+
+ // Initialize JavaScript field attributes.
+ $attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : '';
+
+ // Get the field options.
+ $options = (array) $this->getOptions();
+
+ // Create a read-only list (no name) with hidden input(s) to store the value(s).
+ if ((string) $this->readonly == '1' || (string) $this->readonly == 'true')
+ {
+ $html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id);
+
+ // E.g. form field type tag sends $this->value as array
+ if ($this->multiple && is_array($this->value))
+ {
+ if (!count($this->value))
+ {
+ $this->value[] = '';
+ }
+
+ foreach ($this->value as $value)
+ {
+ $html[] = '';
+ }
+ }
+ else
+ {
+ $html[] = '';
+ }
+ }
+ else
+ // Create a regular list.
+ {
+ $html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
+ }
+
+ return implode($html);
+ }
}
diff --git a/administrator/components/com_contact/config.xml b/administrator/components/com_contact/config.xml
index 6a571a8d529b2..b8938dbadccdd 100644
--- a/administrator/components/com_contact/config.xml
+++ b/administrator/components/com_contact/config.xml
@@ -815,6 +815,18 @@
+
+
+
+
+