Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/upstream/staging' into cf/conta…
Browse files Browse the repository at this point in the history
…ct-no-default-users
  • Loading branch information
laoneo committed Mar 27, 2017
2 parents d140e0f + 1c52ed3 commit 691b8cf
Show file tree
Hide file tree
Showing 674 changed files with 9,462 additions and 8,323 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.settings
.DS_Store
.idea
.vscode

# Local System Files (i.e. cache, logs, etc.) #
/administrator/cache
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Where can you get support and help?
* 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](https://forum.joomla.org);
* [Joomla Resources Directory](http://resources.joomla.org/) (JRD).
* [Joomla Resources Directory](https://resources.joomla.org/) (JRD).

Do you already have a Joomla! site that isn't built with Joomla! 3.x?
---------------------
Expand Down
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* 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: https://forum.joomla.org
* Joomla! Resources Directory (JRD): http://resources.joomla.org/
* Joomla! Resources Directory (JRD): https://resources.joomla.org/

11- Do you already have a Joomla! site that's not built with Joomla! 3.x ?
* What's new in Joomla! 3.x: https://www.joomla.org/3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,9 @@ CREATE TABLE IF NOT EXISTS `#__fields_groups` (

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 COMMENT 'Allow references to items which have strings as ids, eg. none db systems.',
`value` text NOT NULL DEFAULT '',
KEY (`field_id`),
KEY (`context`),
KEY (`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE `#__languages` MODIFY `asset_id` int(10) unsigned NOT NULL DEFAULT 0;
ALTER TABLE `#__menu_types` MODIFY `asset_id` int(10) unsigned NOT NULL DEFAULT 0;

ALTER TABLE `#__content` MODIFY `xreference` varchar(50) NOT NULL DEFAULT '';
ALTER TABLE `#__newsfeeds` MODIFY `xreference` varchar(50) NOT NULL DEFAULT '';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `#__finder_links` MODIFY `description` text;
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ CREATE INDEX "#__fields_idx_language" ON "#__fields_groups" ("language");
CREATE TABLE "#__fields_values" (
"field_id" bigint DEFAULT 0 NOT NULL,
"item_id" varchar(255) DEFAULT '' NOT NULL,
"context" varchar(255) DEFAULT '' NOT NULL,
"value" text DEFAULT '' NOT NULL
"value" text DEFAULT '' NOT NULL
);
CREATE INDEX "#__fields_values_idx_field_id" ON "#__fields_values" ("field_id");
CREATE INDEX "#__fields_values_idx_context" ON "#__fields_values" ("context");
CREATE INDEX "#__fields_values_idx_item_id" ON "#__fields_values" ("item_id");

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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE "#__extensions" ALTER COLUMN "custom_data" DROP DEFAULT;
ALTER TABLE "#__extensions" ALTER COLUMN "system_data" DROP DEFAULT;
ALTER TABLE "#__updates" ALTER COLUMN "data" DROP DEFAULT;

ALTER TABLE "#__newsfeeds" ALTER COLUMN "xreference" SET DEFAULT '';
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ SET QUOTED_IDENTIFIER ON;

CREATE TABLE [#__fields_values] (
[field_id] [bigint] NOT NULL DEFAULT 1,
[context] [nvarchar](255) NOT NULL DEFAULT '',
[item_id] [nvarchar](255) NOT NULL DEFAULT '',
[value] [nvarchar](max) NOT NULL DEFAULT '',
) ON [PRIMARY];
Expand All @@ -130,10 +129,6 @@ CREATE NONCLUSTERED INDEX [idx_field_id] ON [#__fields_values](
[field_id] ASC)
WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);

CREATE NONCLUSTERED INDEX [idx_context] ON [#__fields_values](
[context] ASC)
WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);

CREATE NONCLUSTERED INDEX [idx_item_id] ON [#__fields_values](
[item_id] ASC)
WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
CREATE PROCEDURE "#removeDefault"
(
@table NVARCHAR(100),
@column NVARCHAR(100)
)
AS
BEGIN
DECLARE @constraintName AS nvarchar(100)
DECLARE @constraintQuery AS nvarchar(1000)
SELECT @constraintName = name FROM sys.default_constraints
WHERE parent_object_id = object_id(@table)
AND parent_column_id = columnproperty(object_id(@table), @column, 'ColumnId')
SET @constraintQuery = 'ALTER TABLE [' + @table + '] DROP CONSTRAINT [' + @constraintName + ']'
EXECUTE sp_executesql @constraintQuery
END;

EXECUTE "#removeDefault" "#__extensions", 'system_data';
EXECUTE "#removeDefault" "#__updates", 'data';

ALTER TABLE "#__content" ADD DEFAULT ('') FOR "xreference";
ALTER TABLE "#__newsfeeds" ADD DEFAULT ('') FOR "xreference";

-- Delete wrong unique index
DROP INDEX "idx_access" ON "#__languages";

-- Add missing unique index
ALTER TABLE "#__languages" ADD CONSTRAINT "#__languages$idx_langcode" UNIQUE ("lang_code") ON [PRIMARY];

-- Add missing index keys
CREATE INDEX "idx_access" ON "#__languages" ("access");
CREATE INDEX "idx_ordering" ON "#__languages" ("ordering");
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<ul class="nav nav-list">
<li><?php echo JHtml::_('link', JHelp::createUrl('JHELP_START_HERE'), JText::_('COM_ADMIN_START_HERE'), array('target' => 'helpFrame')); ?></li>
<li><?php echo JHtml::_('link', $this->latest_version_check, JText::_('COM_ADMIN_LATEST_VERSION_CHECK'), array('target' => 'helpFrame')); ?></li>
<li><?php echo JHtml::_('link', 'http://www.gnu.org/licenses/gpl-2.0.html', JText::_('COM_ADMIN_LICENSE'), array('target' => 'helpFrame')); ?></li>
<li><?php echo JHtml::_('link', 'https://www.gnu.org/licenses/gpl-2.0.html', JText::_('COM_ADMIN_LICENSE'), array('target' => 'helpFrame')); ?></li>
<li><?php echo JHtml::_('link', JHelp::createUrl('JHELP_GLOSSARY'), JText::_('COM_ADMIN_GLOSSARY'), array('target' => 'helpFrame')); ?></li>
<hr class="hr-condensed" />
<li class="nav-header"><?php echo JText::_('COM_ADMIN_ALPHABETICAL_INDEX'); ?></li>
Expand Down
81 changes: 58 additions & 23 deletions administrator/components/com_associations/helpers/associations.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,18 @@ private static function getExtensionRealName($extensionName)
/**
* Get the associated language edit links Html.
*
* @param string $extensionName Extension Name
* @param string $typeName ItemType
* @param integer $itemId Item id.
* @param string $itemLanguage Item language code.
* @param boolean $addLink True for adding edit links. False for just text.
* @param boolean $allLanguages True for showing all content languages. False only languages with associations.
* @param string $extensionName Extension Name
* @param string $typeName ItemType
* @param integer $itemId Item id.
* @param string $itemLanguage Item language code.
* @param boolean $addLink True for adding edit links. False for just text.
* @param boolean $assocLanguages True for showing non associated content languages. False only languages with associations.
*
* @return string The language HTML
*
* @since 3.7.0
*/
public static function getAssociationHtmlList($extensionName, $typeName, $itemId, $itemLanguage, $addLink = true, $allLanguages = true)
public static function getAssociationHtmlList($extensionName, $typeName, $itemId, $itemLanguage, $addLink = true, $assocLanguages = true)
{
// Get the associations list for this item.
$items = self::getAssociationList($extensionName, $typeName, $itemId);
Expand All @@ -191,42 +191,71 @@ public static function getAssociationHtmlList($extensionName, $typeName, $itemId
continue;
}

// Don't show languages with associations, if we don't want to show them.
if ($assocLanguages && isset($items[$langCode]))
{
unset($items[$langCode]);
continue;
}

// Don't show languages without associations, if we don't want to show them.
if (!$allLanguages && !isset($items[$langCode]))
if (!$assocLanguages && !isset($items[$langCode]))
{
continue;
}

// Get html parameters.
if (isset($items[$langCode]))
{
$title = '<br/><br/>' . $items[$langCode][$titleFieldName];
$title = $items[$langCode][$titleFieldName];
$additional = '';

if (isset($items[$langCode]['category_title']))
if (isset($items[$langCode]['catid']))
{
$additional = '<br/>' . JText::_('JCATEGORY') . ': ' . $items[$langCode]['category_title'];
$db = JFactory::getDbo();

// Get the category name
$query = $db->getQuery(true)
->select($db->quoteName('title'))
->from($db->quoteName('#__categories'))
->where($db->quoteName('id') . ' = ' . $db->quote($items[$langCode]['catid']));

$db->setQuery($query);
$category_title = $db->loadResult();

$additional = '<strong>' . JText::sprintf('JCATEGORY_SPRINTF', $category_title) . '</strong> <br />';
}
elseif (isset($items[$langCode]['menu_title']))
elseif (isset($items[$langCode]['menutype']))
{
$additional = '<br/>' . JText::_('COM_ASSOCIATIONS_HEADING_MENUTYPE') . ': ' . $items[$langCode]['menu_title'];
$db = JFactory::getDbo();

// Get the menutype name
$query = $db->getQuery(true)
->select($db->quoteName('title'))
->from($db->quoteName('#__menu_types'))
->where($db->quoteName('menutype') . ' = ' . $db->quote($items[$langCode]['menutype']));

$db->setQuery($query);
$menutype_title = $db->loadResult();

$additional = '<strong>' . JText::sprintf('COM_MENUS_MENU_SPRINTF', $menutype_title) . '</strong><br />';
}

$labelClass = 'label';
$labelClass = '';
$target = $langCode . ':' . $items[$langCode]['id'] . ':edit';
$allow = $canEditReference
&& self::allowEdit($extensionName, $typeName, $items[$langCode]['id'])
&& self::canCheckinItem($extensionName, $typeName, $items[$langCode]['id']);

$additional .= $addLink && $allow ? '<br/><br/>' . JText::_('COM_ASSOCIATIONS_EDIT_ASSOCIATION') : '';
$additional .= $addLink && $allow ? JText::_('COM_ASSOCIATIONS_EDIT_ASSOCIATION') : '';
}
else
{
$items[$langCode] = array();

$title = '<br/><br/>' . JText::_('COM_ASSOCIATIONS_NO_ASSOCIATION');
$additional = $addLink ? '<br/><br/>' . JText::_('COM_ASSOCIATIONS_ADD_NEW_ASSOCIATION') : '';
$labelClass = 'label label-warning';
$title = JText::_('COM_ASSOCIATIONS_NO_ASSOCIATION');
$additional = $addLink ? JText::_('COM_ASSOCIATIONS_ADD_NEW_ASSOCIATION') : '';
$labelClass = 'label-warning';
$target = $langCode . ':0:add';
$allow = $canCreate;
}
Expand All @@ -242,14 +271,19 @@ public static function getAssociationHtmlList($extensionName, $typeName, $itemId
'target' => $target,
);

$url = JRoute::_('index.php?' . http_build_query($options));
$text = strtoupper($language->sef);
$langImage = JHtml::_('image', 'mod_languages/' . $language->image . '.gif', $language->title, array('title' => $language->title), true);
$tooltip = implode(' ', array($langImage, $language->title, $title, $additional));
$url = JRoute::_('index.php?' . http_build_query($options));
$url = $allow && $addLink ? $url : '';
$text = strtoupper($language->sef);

$tooltip = htmlspecialchars($title, ENT_QUOTES, 'UTF-8') . '<br /><br />' . $additional;
$classes = 'hasPopover label ' . $labelClass . ' label-' . $language->sef;

$items[$langCode]['link'] = JHtml::_('tooltip', $tooltip, null, null, $text, $allow && $addLink ? $url : '', null, 'hasTooltip ' . $labelClass);
$items[$langCode]['link'] = '<a href="' . $url . '" title="' . $language->title . '" class="' . $classes
. '" data-content="' . $tooltip . '" data-placement="top">'
. $text . '</a>';
}

JHtml::_('bootstrap.popover');
return JLayoutHelper::render('joomla.content.associations', $items);
}

Expand Down Expand Up @@ -416,6 +450,7 @@ public static function getContentLanguages()
$query = $db->getQuery(true)
->select($db->quoteName(array('sef', 'lang_code', 'image', 'title', 'published')))
->from($db->quoteName('#__languages'))
->where($db->quoteName('published') . ' != -2')
->order($db->quoteName('ordering') . ' ASC');

$db->setQuery($query);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ protected function getStoreId($id = '')
*/
protected function getListQuery()
{
$type = null;
$type = null;
$listOrdering = $this->getState('list.fullordering');

list($extensionName, $typeName) = explode('.', $this->state->get('itemtype'));

Expand Down Expand Up @@ -369,8 +370,7 @@ protected function getListQuery()
// Filter on the level.
if ($level = $this->getState('filter.level'))
{
$tableAlias = in_array($extensionName, array('com_menus', 'com_categories')) ? 'a' : 'c';
$query->where($db->qn($tableAlias . '.level') . ' <= ' . ((int) $level + (int) $baselevel - 1));
$query->where($db->qn('a.level') . ' <= ' . ((int) $level + (int) $baselevel - 1));
}

// Filter by menu type.
Expand Down Expand Up @@ -404,7 +404,10 @@ protected function getListQuery()
$query->group($db->qn($groupby));

// Add the list ordering clause.
$query->order($db->escape($this->getState('list.ordering') . ' ' . $this->getState('list.direction')));
if (!empty($listOrdering))
{
$query->order($db->escape($listOrdering));
}

return $query;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<field
name="fullordering"
type="list"
default="ordering ASC"
default="id ASC"
onchange="this.form.submit();"
>
<option value="">JGLOBAL_SORT_BY</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,21 @@ protected function addToolbar()
$bar = JToolbar::getInstance('toolbar');

$bar->appendButton(
'Custom', '<button onclick="Joomla.submitbutton(\'reference\')"'
'Custom', '<button onclick="Joomla.submitbutton(\'reference\')" '
. 'class="btn btn-small btn-success"><span class="icon-apply icon-white"></span>'
. JText::_('COM_ASSOCIATIONS_SAVE_REFERENCE') . '</button>', 'reference'
);

$bar->appendButton(
'Custom', '<button onclick="Joomla.submitbutton(\'target\')"'
'Custom', '<button onclick="Joomla.submitbutton(\'target\')" '
. 'class="btn btn-small btn-success"><span class="icon-apply icon-white"></span>'
. JText::_('COM_ASSOCIATIONS_SAVE_TARGET') . '</button>', 'target'
);

JToolBarHelper::custom('copy', 'copy.png', '', 'COM_ASSOCIATIONS_COPY_REFERENCE', false);

JToolbarHelper::cancel('association.cancel', 'JTOOLBAR_CLOSE');
JToolbarHelper::help('JGLOBAL_HELP');
JToolbarHelper::help('JHELP_COMPONENTS_ASSOCIATIONS_EDIT');

JHtmlSidebar::setAction('index.php?option=com_associations');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');

$listOrder = $this->escape($this->state->get('list.ordering'));
$listOrder = $this->escape($this->state->get('list.fullordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$canManageCheckin = JFactory::getUser()->authorise('core.manage', 'com_checkin');
$colSpan = 5;
Expand Down Expand Up @@ -81,7 +81,10 @@
<?php echo JText::_('JGRID_HEADING_LANGUAGE'); ?>
</th>
<th width="5%" class="nowrap">
<?php echo JHtml::_('searchtools.sort', 'COM_ASSOCIATIONS_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
<?php echo JText::_('COM_ASSOCIATIONS_HEADING_ASSOCIATION'); ?>
</th>
<th width="15%" class="nowrap">
<?php echo JText::_('COM_ASSOCIATIONS_HEADING_NO_ASSOCIATION'); ?>
</th>
<?php if (!empty($this->typeFields['menutype'])) : ?>
<th width="10%" class="nowrap">
Expand Down Expand Up @@ -143,10 +146,13 @@
<?php endif; ?>
</td>
<td class="small">
<?php echo $item->language_title ? JHtml::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, array('title' => $item->language_title), true) . '&nbsp;' . $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
<?php echo JLayoutHelper::render('joomla.content.language', $item); ?>
</td>
<td>
<?php echo AssociationsHelper::getAssociationHtmlList($this->extensionName, $this->typeName, (int) $item->id, $item->language, !$isCheckout, false); ?>
</td>
<td>
<?php echo AssociationsHelper::getAssociationHtmlList($this->extensionName, $this->typeName, (int) $item->id, $item->language, !$isCheckout); ?>
<?php echo AssociationsHelper::getAssociationHtmlList($this->extensionName, $this->typeName, (int) $item->id, $item->language, !$isCheckout, true); ?>
</td>
<?php if (!empty($this->typeFields['menutype'])) : ?>
<td class="small">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@
<?php endif; ?>
</td>
<td class="small">
<?php echo $item->language_title ? JHtml::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, array('title' => $item->language_title), true) . '&nbsp;' . $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
<?php echo JLayoutHelper::render('joomla.content.language', $item); ?>
</td>
<td>
<?php if (true || $item->association) : ?>
<?php echo AssociationsHelper::getAssociationHtmlList($this->extensionName, $this->typeName, (int) $item->id, $item->language, false); ?>
<?php echo AssociationsHelper::getAssociationHtmlList($this->extensionName, $this->typeName, (int) $item->id, $item->language, false, false); ?>
<?php endif; ?>
</td>
<?php if (!empty($this->typeFields['menutype'])) : ?>
Expand Down
Loading

0 comments on commit 691b8cf

Please sign in to comment.