Skip to content

Commit

Permalink
Merge branch 'staging' into 3.8-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonge committed Feb 4, 2017
2 parents e884405 + 5c9df7b commit 2f2d083
Show file tree
Hide file tree
Showing 99 changed files with 1,843 additions and 662 deletions.
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -4,4 +4,8 @@ Pull Request for Issue # .

### Testing Instructions

### Expected result

### Actual result

### Documentation Changes Required
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -4,7 +4,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)
AppVeyor: [![Build status](https://ci.appveyor.com/api/projects/status/bpcxulw6nnxlv8kb?svg=true)](https://ci.appveyor.com/project/joomla/joomla-cms)
AppVeyor: [![Build status](https://ci.appveyor.com/api/projects/status/bpcxulw6nnxlv8kb/branch/staging?svg=true)](https://ci.appveyor.com/project/joomla/joomla-cms)
Jenkins: [![Build Status](http://build.joomla.org/job/cms/badge/icon)](http://build.joomla.org/job/cms/)

What is this?
Expand Down
1 change: 1 addition & 0 deletions administrator/components/com_admin/script.php
Expand Up @@ -504,6 +504,7 @@ protected function updateManifestCaches()
array('plugin', 'url', 'fields', 0),
array('plugin', 'user', 'fields', 0),
array('plugin', 'usergrouplist', 'fields', 0),
array('plugin', 'fields', 'content', 0),

// Templates
array('template', 'beez3', '', 0),
Expand Down
@@ -0,0 +1,2 @@
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
(478, 'plg_content_fields', 'plugin', 'fields', 'content', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0);
@@ -0,0 +1,2 @@
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
(478, 'plg_content_fields', 'plugin', 'fields', 'content', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0);
@@ -0,0 +1,6 @@
SET IDENTITY_INSERT #__extensions ON;

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])
SELECT 478, 'plg_content_fields', 'plugin', 'fields', 'content', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0;

SET IDENTITY_INSERT #__extensions OFF;
Expand Up @@ -489,7 +489,7 @@ public static function allowAdd($extensionName, $typeName)
*
* @return boolean True if item is checked out.
*
* @since __DEPLOY_VERSION__
* @since 3.7.0
*/
public static function isCheckoutItem($extensionName, $typeName, $itemId)
{
Expand Down Expand Up @@ -527,7 +527,7 @@ public static function isCheckoutItem($extensionName, $typeName, $itemId)
*
* @return boolean True on allowed.
*
* @since __DEPLOY_VERSION__
* @since 3.7.0
*/
public static function canCheckinItem($extensionName, $typeName, $itemId)
{
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_categories/models/category.php
Expand Up @@ -549,7 +549,7 @@ public function save($data)
}

// Trigger the before save event.
$result = $dispatcher->trigger($this->event_before_save, array($context, &$table, $isNew));
$result = $dispatcher->trigger($this->event_before_save, array($context, &$table, $isNew, $data));

if (in_array(false, $result, true))
{
Expand Down Expand Up @@ -664,7 +664,7 @@ public function save($data)
}

// Trigger the after save event.
$dispatcher->trigger($this->event_after_save, array($context, &$table, $isNew));
$dispatcher->trigger($this->event_after_save, array($context, &$table, $isNew, $data));

// Rebuild the path for the category:
if (!$table->rebuildPath($table->id))
Expand Down
Expand Up @@ -9,11 +9,13 @@
<fields name="request">
<field
name="extension"
type="components"
type="componentscategory"
label="COM_CATEGORIES_CHOOSE_COMPONENT_LABEL"
description="COM_CATEGORIES_CHOOSE_COMPONENT_DESC"
required="true"
/>
>
<option value="">COM_MENUS_OPTION_SELECT_COMPONENT</option>
</field>
</fields>
</fieldset>
</metadata>
Expand Up @@ -9,11 +9,13 @@
<fields name="request">
<field
name="extension"
type="components"
type="componentscategory"
label="COM_CATEGORIES_CHOOSE_COMPONENT_LABEL"
description="COM_CATEGORIES_CHOOSE_COMPONENT_DESC"
required="true"
/>
>
<option value="">COM_MENUS_OPTION_SELECT_COMPONENT</option>
</field>
<field
name="id"
type="hidden"
Expand Down
5 changes: 3 additions & 2 deletions administrator/components/com_contact/helpers/contact.php
Expand Up @@ -215,8 +215,9 @@ public static function getContexts()
JFactory::getLanguage()->load('com_contact', JPATH_ADMINISTRATOR);

$contexts = array(
'com_contact.contact' => JText::_('COM_CONTACT_FIELDS_CONTEXT_CONTACT'),
'com_contact.mail' => JText::_('COM_CONTACT_FIELDS_CONTEXT_MAIL'),
'com_contact.contact' => JText::_('COM_CONTACT_FIELDS_CONTEXT_CONTACT'),
'com_contact.mail' => JText::_('COM_CONTACT_FIELDS_CONTEXT_MAIL'),
'com_contact.categories' => JText::_('JCATEGORY')
);

return $contexts;
Expand Down
4 changes: 3 additions & 1 deletion administrator/components/com_content/helpers/content.php
Expand Up @@ -225,6 +225,7 @@ public static function validateSection($section)
case 'form':

// Category list view
case 'featured':
case 'category':
$section = 'article';
}
Expand All @@ -251,7 +252,8 @@ public static function getContexts()
JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR);

$contexts = array(
'com_content.article' => JText::_('COM_CONTENT'),
'com_content.article' => JText::_('COM_CONTENT'),
'com_content.categories' => JText::_('JCATEGORY')
);

return $contexts;
Expand Down
4 changes: 1 addition & 3 deletions administrator/components/com_fields/helpers/fields.php
Expand Up @@ -141,9 +141,7 @@ public static function getFields($context, $item = null, $prepareValue = false,
{
if (self::$fieldCache === null)
{
self::$fieldCache = JModelLegacy::getInstance('Field', 'FieldsModel', array(
'ignore_request' => true)
);
self::$fieldCache = JModelLegacy::getInstance('Field', 'FieldsModel', array('ignore_request' => true));
}

$new = array();
Expand Down
12 changes: 12 additions & 0 deletions administrator/components/com_fields/models/forms/field.xml
Expand Up @@ -248,6 +248,18 @@
class="input-xxlarge"
size="40"
/>

<field
name="showlabel"
type="radio"
class="btn-group btn-group-yesno"
default="1"
label="COM_FIELDS_FIELD_SHOWLABEL_LABEL"
description="COM_FIELDS_FIELD_SHOWLABEL_DESC"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>

<field
name="disabled"
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_finder/models/index.php
Expand Up @@ -215,7 +215,7 @@ protected function getListQuery()
// Filter by indexdate only if $search doesn't contains non-ascii characters
if (!preg_match('/[^\x00-\x7F]/', $search))
{
$orSearchSql .= ' OR ' . $db->quoteName('l.indexdate') . ' LIKE ' . $search;
$orSearchSql .= ' OR ' . $query->castAsChar($db->quoteName('l.indexdate')) . ' LIKE ' . $search;
}

$query->where('(' . $orSearchSql . ')');
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_menus/controllers/item.php
Expand Up @@ -70,7 +70,7 @@ protected function allowEdit($data = array(), $key = 'id')
if (!empty($item->menutype))
{
// Protected menutype, do not allow edit
if ($item->menutype == 'main' || $item->menutype == 'menu')
if ($item->menutype == 'main')
{
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_menus/controllers/menu.php
Expand Up @@ -52,8 +52,8 @@ public function save($key = null, $urlVar = null)
$task = $this->getTask();
$recordId = $this->input->getInt('id');

// Prevent using 'menu' or 'main' as menutype as this is reserved for backend menus
if (strtolower($data['menutype']) == 'menu' || strtolower($data['menutype']) == 'main')
// Prevent using 'main' as menutype as this is reserved for backend menus
if (strtolower($data['menutype']) == 'main')
{
$msg = JText::_('COM_MENUS_ERROR_MENUTYPE');
JFactory::getApplication()->enqueueMessage($msg, 'error');
Expand Down
47 changes: 34 additions & 13 deletions administrator/components/com_menus/helpers/menus.php
Expand Up @@ -116,16 +116,24 @@ public static function getLinkKey($request)
/**
* Get the menu list for create a menu module
*
* @return array The menu array list
* @param int $clientId Optional client id - viz 0 = site, 1 = administrator, can be NULL for all
*
* @return array The menu array list
*
* @since 1.6
*/
public static function getMenuTypes()
public static function getMenuTypes($clientId = 0)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.menutype')
->from('#__menu_types AS a');

if (isset($clientId))
{
$query->where('a.client_id = ' . (int) $clientId);
}

$db->setQuery($query);

return $db->loadColumn();
Expand All @@ -134,17 +142,19 @@ public static function getMenuTypes()
/**
* Get a list of menu links for one or all menus.
*
* @param string $menuType An option menu to filter the list on, otherwise all menu links are returned as a grouped array.
* @param string $menuType An option menu to filter the list on, otherwise all menu with given client id links
* are returned as a grouped array.
* @param integer $parentId An optional parent ID to pivot results around.
* @param integer $mode An optional mode. If parent ID is set and mode=2, the parent and children are excluded from the list.
* @param array $published An optional array of states
* @param array $languages Optional array of specify which languages we want to filter
* @param int $clientId Optional client id - viz 0 = site, 1 = administrator, can be NULL for all (used only if menutype not givein)
*
* @return array
*
* @since 1.6
*/
public static function getMenuLinks($menuType = null, $parentId = 0, $mode = 0, $published = array(), $languages = array())
public static function getMenuLinks($menuType = null, $parentId = 0, $mode = 0, $published = array(), $languages = array(), $clientId = 0)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
Expand All @@ -153,6 +163,7 @@ public static function getMenuLinks($menuType = null, $parentId = 0, $mode = 0,
a.alias,
a.level,
a.menutype,
a.client_id,
a.type,
a.published,
a.template_style_id,
Expand All @@ -161,26 +172,30 @@ public static function getMenuLinks($menuType = null, $parentId = 0, $mode = 0,
a.lft')
->from('#__menu AS a');

$query->select('e.name as componentname')
->join('left', '#__extensions e ON e.extension_id = a.component_id');

if (JLanguageMultilang::isEnabled())
{
$query->select('l.title AS language_title, l.image AS language_image, l.sef AS language_sef')
->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language');
}

// Filter by the type
// Filter by the type if given, this is more specific than client id
if ($menuType)
{
$query->where('(a.menutype = ' . $db->quote($menuType) . ' OR a.parent_id = 0)');
}
elseif (isset($clientId))
{
$query->where('a.client_id = ' . (int) $clientId);
}

if ($parentId)
// Prevent the parent and children from showing if requested.
if ($parentId && $mode == 2)
{
if ($mode == 2)
{
// Prevent the parent and children from showing.
$query->join('LEFT', '#__menu AS p ON p.id = ' . (int) $parentId)
->where('(a.lft <= p.lft OR a.rgt >= p.rgt)');
}
$query->join('LEFT', '#__menu AS p ON p.id = ' . (int) $parentId)
->where('(a.lft <= p.lft OR a.rgt >= p.rgt)');
}

if (!empty($languages))
Expand Down Expand Up @@ -228,6 +243,12 @@ public static function getMenuLinks($menuType = null, $parentId = 0, $mode = 0,
->from('#__menu_types')
->where('menutype <> ' . $db->quote(''))
->order('title, menutype');

if (isset($clientId))
{
$query->where('client_id = ' . (int) $clientId);
}

$db->setQuery($query);

try
Expand Down Expand Up @@ -282,7 +303,7 @@ public static function getMenuLinks($menuType = null, $parentId = 0, $mode = 0,
public static function getAssociations($pk)
{
$langAssociations = JLanguageAssociations::getAssociations('com_menus', '#__menu', 'com_menus.item', $pk, 'id', '', '');
$associations = array();
$associations = array();

foreach ($langAssociations as $langAssociation)
{
Expand Down
@@ -0,0 +1,76 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('JPATH_BASE') or die;

use Joomla\Utilities\ArrayHelper;

JFormHelper::loadFieldClass('list');

/**
* Form Field class for the Joomla Framework.
*
* @since 1.6
*/
class JFormFieldComponentsCategory extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 3.7.0
*/
protected $type = 'ComponentsCategory';

/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*
* @since 3.7.0
*/
protected function getOptions()
{
// Initialise variable.
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('DISTINCT a.name AS text, a.element AS value')
->from('#__extensions as a')
->where('a.enabled >= 1')
->where('a.type =' . $db->quote('component'))
->join('INNER', '#__categories as b ON a.element=b.extension');

$items = $db->setQuery($query)->loadObjectList();

if (count($items))
{
$lang = JFactory::getLanguage();

foreach ($items as &$item)
{
// Load language
$extension = $item->value;
$source = JPATH_ADMINISTRATOR . '/components/' . $extension;
$lang->load("$extension.sys", JPATH_ADMINISTRATOR, null, false, true)
|| $lang->load("$extension.sys", $source, null, false, true);

// Translate component name
$item->text = JText::_($item->text);
}

// Sort by component name
$items = ArrayHelper::sortObjects($items, 'text', 1, true, true);
}

// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $items);

return $options;
}
}

0 comments on commit 2f2d083

Please sign in to comment.