Skip to content

Commit

Permalink
Merge branch 'staging' of https://github.com/joomla/joomla-cms into p…
Browse files Browse the repository at this point in the history
…atch-18

Conflicts:
	libraries/legacy/model/admin.php
  • Loading branch information
Hackwar committed Dec 6, 2014
2 parents 7e3dbad + 7adf67a commit b54ce74
Show file tree
Hide file tree
Showing 166 changed files with 4,970 additions and 13,811 deletions.
24 changes: 12 additions & 12 deletions administrator/components/com_installer/config.xml
Expand Up @@ -24,18 +24,18 @@
last="24"
step="1"
default="6" />
<field
name="minimum_stability"
type="list"
label="COM_INSTALLER_MINIMUM_STABILITY_LABEL"
description="COM_INSTALLER_MINIMUM_STABILITY_DESC"
default="4">
<option value="0">COM_INSTALLER_MINIMUM_STABILITY_DEV</option>
<option value="1">COM_INSTALLER_MINIMUM_STABILITY_ALPHA</option>
<option value="2">COM_INSTALLER_MINIMUM_STABILITY_BETA</option>
<option value="3">COM_INSTALLER_MINIMUM_STABILITY_RC</option>
<option value="4">COM_INSTALLER_MINIMUM_STABILITY_STABLE</option>
</field>
<field
name="minimum_stability"
type="list"
label="COM_INSTALLER_MINIMUM_STABILITY_LABEL"
description="COM_INSTALLER_MINIMUM_STABILITY_DESC"
default="4">
<option value="0">COM_INSTALLER_MINIMUM_STABILITY_DEV</option>
<option value="1">COM_INSTALLER_MINIMUM_STABILITY_ALPHA</option>
<option value="2">COM_INSTALLER_MINIMUM_STABILITY_BETA</option>
<option value="3">COM_INSTALLER_MINIMUM_STABILITY_RC</option>
<option value="4">COM_INSTALLER_MINIMUM_STABILITY_STABLE</option>
</field>
</fieldset>
<fieldset
name="permissions"
Expand Down
96 changes: 85 additions & 11 deletions administrator/components/com_installer/models/languages.php
Expand Up @@ -17,6 +17,18 @@
*/
class InstallerModelLanguages extends JModelList
{
/**
* @var integer Extension ID of the en-GB language pack.
* @since 3.4
*/
private $enGbExtensionId = 0;

/**
* @var integer Upate Site ID of the en-GB language pack.
* @since 3.4
*/
private $updateSiteId = 0;

/**
* Constructor override, defines a white list of column filters.
*
Expand All @@ -35,6 +47,43 @@ public function __construct($config = array())
}

parent::__construct($config);

// Get the extension_id of the en-GB package.
$db = $this->getDbo();
$extQuery = $db->getQuery(true);
$extType = 'language';
$extElem = 'en-GB';

$extQuery->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('type') . ' = ' . $db->quote($extType))
->where($db->quoteName('element') . ' = ' . $db->quote($extElem))
->where($db->quoteName('client_id') . ' = 0');

$db->setQuery($extQuery);

$extId = (int) $db->loadResult();

// Get the update_site_id for the en-GB package if extension_id found before.
if ($extId)
{
$this->enGbExtensionId = $extId;

$siteQuery = $db->getQuery(true);

$siteQuery->select($db->quoteName('update_site_id'))
->from($db->quoteName('#__update_sites_extensions'))
->where($db->quoteName('extension_id') . ' = ' . $extId);

$db->setQuery($siteQuery);

$siteId = (int) $db->loadResult();

if ($siteId)
{
$this->updateSiteId = $siteId;
}
}
}

/**
Expand All @@ -46,16 +95,30 @@ public function __construct($config = array())
*/
protected function _getListQuery()
{
$db = $this->getDbo();
$db = $this->getDbo();
$query = $db->getQuery(true);

// Select the required fields from the updates table.
$query->select('update_id, name, version, detailsurl, type')
$query->select($db->quoteName(array('update_id', 'name', 'version', 'detailsurl', 'type')))
->from($db->quoteName('#__updates'));

->from('#__updates');
/*
* This where clause will limit to language updates only.
* If no update site exists, set the where clause so
* no available languages will be found later with the
* query returned by this function here.
*/
if ($this->updateSiteId)
{
$query->where($db->quoteName('update_site_id') . ' = ' . $this->updateSiteId);
}
else
{
$query->where($db->quoteName('update_site_id') . ' = -1');
}

// This Where clause will avoid to list languages already installed.
$query->where('extension_id = 0');
// This where clause will avoid to list languages already installed.
$query->where($db->quoteName('extension_id') . ' = 0');

// Filter by search in title
$search = $this->getState('filter.search');
Expand Down Expand Up @@ -124,13 +187,18 @@ protected function populateState($ordering = 'name', $direction = 'asc')
*/
protected function enableUpdateSite()
{
$db = $this->getDbo();
$siteName = 'Accredited Joomla! Translations';
// If no update site, return false.
if (!$this->updateSiteId)
{
return false;
}

// Try to enable the update site, return false if some RuntimeException
$db = $this->getDbo();
$query = $db->getQuery(true)
->update('#__update_sites')
->set('enabled = 1')
->where('name = ' . $db->quote($siteName));
->where('update_site_id = ' . $this->updateSiteId);

$db->setQuery($query);

Expand Down Expand Up @@ -164,13 +232,19 @@ public function findLanguages($cache_timeout = 0)
return false;
}

if (!$this->enGbExtensionId)
{
return false;
}

$updater = JUpdater::getInstance();

/*
* The following function uses extension_id 600, that is the english language extension id.
* In #__update_sites_extensions you should have 600 linked to the Accredited Translations Repo
* The following function call uses the extension_id of the en-GB package.
* In #__update_sites_extensions you should have this extension_id linked
* to the Accredited Translations Repo.
*/
$updater->findUpdates(array(600), $cache_timeout);
$updater->findUpdates(array($this->enGbExtensionId), $cache_timeout);

return true;
}
Expand Down
1 change: 0 additions & 1 deletion language/en-GB/install.xml
Expand Up @@ -33,7 +33,6 @@
<filename>en-GB.lib_joomla.ini</filename>
<filename>en-GB.lib_joomla.sys.ini</filename>
<filename>en-GB.lib_phpass.sys.ini</filename>
<filename>en-GB.lib_phpmailer.sys.ini</filename>
<filename>en-GB.lib_phputf8.sys.ini</filename>
<filename>en-GB.lib_simplepie.sys.ini</filename>
<filename>en-GB.localise.php</filename>
Expand Down
2 changes: 1 addition & 1 deletion media/editors/codemirror/addon/comment/comment.js
Expand Up @@ -109,7 +109,7 @@
CodeMirror.defineExtension("uncomment", function(from, to, options) {
if (!options) options = noOptions;
var self = this, mode = self.getModeAt(from);
var end = Math.min(to.line, self.lastLine()), start = Math.min(from.line, end);
var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);

// Try finding line comments
var lineString = options.lineComment || mode.lineComment, lines = [];
Expand Down
5 changes: 4 additions & 1 deletion media/editors/codemirror/addon/dialog/dialog.js
Expand Up @@ -56,7 +56,10 @@

var inp = dialog.getElementsByTagName("input")[0], button;
if (inp) {
if (options.value) inp.value = options.value;
if (options.value) {
inp.value = options.value;
inp.select();
}

if (options.onInput)
CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);});
Expand Down
15 changes: 8 additions & 7 deletions media/editors/codemirror/addon/edit/closebrackets.js
Expand Up @@ -71,31 +71,32 @@
};
var closingBrackets = "";
for (var i = 0; i < pairs.length; i += 2) (function(left, right) {
if (left != right) closingBrackets += right;
closingBrackets += right;
map["'" + left + "'"] = function(cm) {
if (cm.getOption("disableInput")) return CodeMirror.Pass;
var ranges = cm.listSelections(), type, next;
for (var i = 0; i < ranges.length; i++) {
var range = ranges[i], cur = range.head, curType;
var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1));
if (!range.empty())
if (!range.empty()) {
curType = "surround";
else if (left == right && next == right) {
} else if (left == right && next == right) {
if (cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == left + left + left)
curType = "skipThree";
else
curType = "skip";
} else if (left == right && cur.ch > 1 &&
cm.getRange(Pos(cur.line, cur.ch - 2), cur) == left + left &&
(cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != left))
(cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != left)) {
curType = "addFour";
else if (left == '"' || left == "'") {
} else if (left == '"' || left == "'") {
if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, left)) curType = "both";
else return CodeMirror.Pass;
} else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.indexOf(next) >= 0 || SPACE_CHAR_REGEX.test(next))
} else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.indexOf(next) >= 0 || SPACE_CHAR_REGEX.test(next)) {
curType = "both";
else
} else {
return CodeMirror.Pass;
}
if (!type) type = curType;
else if (type != curType) return CodeMirror.Pass;
}
Expand Down
29 changes: 21 additions & 8 deletions media/editors/codemirror/addon/edit/continuelist.js
Expand Up @@ -11,26 +11,39 @@
})(function(CodeMirror) {
"use strict";

var listRE = /^(\s*)([*+-]|(\d+)\.)(\s+)/,
var listRE = /^(\s*)([> ]+|[*+-]|(\d+)\.)(\s+)/,
emptyListRE = /^(\s*)([> ]+|[*+-]|(\d+)\.)(\s*)$/,
unorderedBullets = "*+-";

CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
if (cm.getOption("disableInput")) return CodeMirror.Pass;
var ranges = cm.listSelections(), replacements = [];
for (var i = 0; i < ranges.length; i++) {
var pos = ranges[i].head, match;
var inList = cm.getStateAfter(pos.line).list !== false;
var eolState = cm.getStateAfter(pos.line);
var inList = eolState.list !== false;
var inQuote = eolState.quote !== false;

if (!ranges[i].empty() || !inList || !(match = cm.getLine(pos.line).match(listRE))) {
if (!ranges[i].empty() || (!inList && !inQuote) || !(match = cm.getLine(pos.line).match(listRE))) {
cm.execCommand("newlineAndIndent");
return;
}
var indent = match[1], after = match[4];
var bullet = unorderedBullets.indexOf(match[2]) >= 0
? match[2]
: (parseInt(match[3], 10) + 1) + ".";
if (cm.getLine(pos.line).match(emptyListRE)) {
cm.replaceRange("", {
line: pos.line, ch: 0
}, {
line: pos.line, ch: pos.ch + 1
});
replacements[i] = "\n";

replacements[i] = "\n" + indent + bullet + after;
} else {
var indent = match[1], after = match[4];
var bullet = unorderedBullets.indexOf(match[2]) >= 0 || match[2].indexOf(">") >= 0
? match[2]
: (parseInt(match[3], 10) + 1) + ".";

replacements[i] = "\n" + indent + bullet + after;
}
}

cm.replaceSelections(replacements);
Expand Down
18 changes: 9 additions & 9 deletions media/editors/codemirror/addon/hint/javascript-hint.js
Expand Up @@ -93,7 +93,7 @@
"if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");

function getCompletions(token, context, keywords, options) {
var found = [], start = token.string;
var found = [], start = token.string, global = options && options.globalScope || window;
function maybeAdd(str) {
if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str);
}
Expand All @@ -112,28 +112,28 @@
if (options && options.additionalContext)
base = options.additionalContext[obj.string];
if (!options || options.useGlobalScope !== false)
base = base || window[obj.string];
base = base || global[obj.string];
} else if (obj.type == "string") {
base = "";
} else if (obj.type == "atom") {
base = 1;
} else if (obj.type == "function") {
if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
(typeof window.jQuery == 'function'))
base = window.jQuery();
else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function'))
base = window._();
if (global.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
(typeof global.jQuery == 'function'))
base = global.jQuery();
else if (global._ != null && (obj.string == '_') && (typeof global._ == 'function'))
base = global._();
}
while (base != null && context.length)
base = base[context.pop().string];
if (base != null) gatherCompletions(base);
} else {
// If not, just look in the window object and any local scope
// If not, just look in the global object and any local scope
// (reading into JS mode internals to get at the local and global variables)
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name);
if (!options || options.useGlobalScope !== false)
gatherCompletions(window);
gatherCompletions(global);
forEach(keywords, maybeAdd);
}
return found;
Expand Down

0 comments on commit b54ce74

Please sign in to comment.