2016-03-16 05:18:16 +00:00
|
|
|
/**
|
|
|
|
* Patch testing component for the Joomla! CMS
|
|
|
|
*
|
|
|
|
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2016 Open Source Matters, Inc. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later
|
|
|
|
*/
|
2015-12-05 18:08:38 +00:00
|
|
|
|
2016-03-16 05:18:16 +00:00
|
|
|
if (typeof Joomla === 'undefined') {
|
|
|
|
throw new Error('PatchTester JavaScript requires the Joomla core JavaScript API')
|
|
|
|
}
|
2015-12-05 18:08:38 +00:00
|
|
|
|
2016-03-16 05:18:16 +00:00
|
|
|
!function (Joomla, window, document) {
|
|
|
|
'use strict';
|
2015-12-05 18:08:38 +00:00
|
|
|
|
2016-03-16 05:18:16 +00:00
|
|
|
window.PatchTester = {
|
|
|
|
/**
|
|
|
|
* Re-order the pull request list table
|
|
|
|
*/
|
|
|
|
orderTable: function () {
|
|
|
|
var table = document.getElementById('sortTable'),
|
|
|
|
direction = document.getElementById('directionTable'),
|
|
|
|
order = table.options[table.selectedIndex].value,
|
|
|
|
currentOrder = document.getElementById('adminForm').getAttribute('data-order').valueOf();
|
|
|
|
|
|
|
|
if (order != currentOrder) {
|
|
|
|
var dirn = 'asc';
|
|
|
|
} else {
|
|
|
|
var dirn = direction.options[direction.selectedIndex].value;
|
|
|
|
}
|
|
|
|
|
|
|
|
Joomla.tableOrdering(order, dirn, '');
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Process the patch action
|
|
|
|
*
|
|
|
|
* @param {String} task The task to perform
|
|
|
|
* @param {Number} id The item ID
|
|
|
|
*/
|
|
|
|
submitpatch: function (task, id) {
|
|
|
|
var idField = document.getElementById('pull_id');
|
|
|
|
idField.value = id;
|
|
|
|
|
|
|
|
Joomla.submitform(task);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-03-26 22:08:01 +00:00
|
|
|
Joomla.submitbutton = function (task) {
|
|
|
|
if (task != 'reset' || confirm(Joomla.JText._('COM_PATCHTESTER_CONFIRM_RESET'))) {
|
|
|
|
Joomla.submitform(task);
|
|
|
|
}
|
|
|
|
};
|
2016-03-16 05:18:16 +00:00
|
|
|
}(Joomla, window, document);
|