From 3ac8a9227f7ad73bd3d567d25c8d30cf666b578e Mon Sep 17 00:00:00 2001 From: Ashan Fernando Date: Sun, 21 Jul 2013 10:20:57 +0530 Subject: [PATCH 1/6] Task:MediaCore Including a new file to keep corejs media file changes, and including it and its dependencies in behavior.php TODO: Implement jQuery version in that file --- libraries/cms/html/behavior.php | 4 +- media/system/js/core-jquery-uncompressed.js | 421 ++++++++++++++++++++ 2 files changed, 424 insertions(+), 1 deletion(-) create mode 100644 media/system/js/core-jquery-uncompressed.js diff --git a/libraries/cms/html/behavior.php b/libraries/cms/html/behavior.php index f8453e03fdf0c..6f0972c98c490 100644 --- a/libraries/cms/html/behavior.php +++ b/libraries/cms/html/behavior.php @@ -61,7 +61,9 @@ public static function framework($extras = false, $debug = null) } JHtml::_('script', 'system/mootools-' . $type . '.js', false, true, false, false, $debug); - JHtml::_('script', 'system/core.js', false, true); + // Include jQuery + JHtml::_('jquery.framework'); + JHtml::_('script', 'system/core-jquery-uncompressed.js', false, true); static::$loaded[__METHOD__][$type] = true; return; diff --git a/media/system/js/core-jquery-uncompressed.js b/media/system/js/core-jquery-uncompressed.js new file mode 100644 index 0000000000000..4278e2df1f516 --- /dev/null +++ b/media/system/js/core-jquery-uncompressed.js @@ -0,0 +1,421 @@ +/** + * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// Only define the Joomla namespace if not defined. +Joomla = Joomla || {} + +Joomla.editors = {}; +// An object to hold each editor instance on page +Joomla.editors.instances = {}; + +/** + * Generic submit form + */ +Joomla.submitform = function(task, form) { + alert('dd') + if (typeof(form) === 'undefined') { + form = document.getElementById('adminForm'); + } + + if (typeof(task) !== 'undefined') { + form.task.value = task; + } + + // Submit the form. + if (typeof form.onsubmit == 'function') { + form.onsubmit(); + } + if (typeof form.fireEvent == "function") { + form.fireEvent('submit'); + } + form.submit(); +}; + +/** + * Default function. Usually would be overriden by the component + */ +Joomla.submitbutton = function(pressbutton) { + Joomla.submitform(pressbutton); +} + +/** + * Custom behavior for JavaScript I18N in Joomla! 1.6 + * + * Allows you to call Joomla.JText._() to get a translated JavaScript string pushed in with JText::script() in Joomla. + */ +Joomla.JText = { + strings: {}, + '_': function(key, def) { + return typeof this.strings[key.toUpperCase()] !== 'undefined' ? this.strings[key.toUpperCase()] : def; + }, + load: function(object) { + for (var key in object) { + this.strings[key.toUpperCase()] = object[key]; + } + return this; + } +}; + +/** + * Method to replace all request tokens on the page with a new one. + */ +Joomla.replaceTokens = function(n) { + var els = document.getElementsByTagName('input'); + for (var i = 0; i < els.length; i++) { + if ((els[i].type == 'hidden') && (els[i].name.length == 32) && els[i].value == '1') { + els[i].name = n; + } + } +}; + +/** + * USED IN: administrator/components/com_banners/views/client/tmpl/default.php + * + * Verifies if the string is in a valid email format + * + * @param string + * @return boolean + */ +Joomla.isEmail = function(text) { + var regex = new RegExp("^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$"); + return regex.test(text); +}; + +/** + * USED IN: all list forms. + * + * Toggles the check state of a group of boxes + * + * Checkboxes must have an id attribute in the form cb0, cb1... + * + * @param mixed The number of box to 'check', for a checkbox element + * @param string An alternative field name + */ +Joomla.checkAll = function(checkbox, stub) { + if (!stub) { + stub = 'cb'; + } + if (checkbox.form) { + var c = 0; + for (var i = 0, n = checkbox.form.elements.length; i < n; i++) { + var e = checkbox.form.elements[i]; + if (e.type == checkbox.type) { + if ((stub && e.id.indexOf(stub) == 0) || !stub) { + e.checked = checkbox.checked; + c += (e.checked == true ? 1 : 0); + } + } + } + if (checkbox.form.boxchecked) { + checkbox.form.boxchecked.value = c; + } + return true; + } + return false; +} + +/** + * Render messages send via JSON + * + * @param object messages JavaScript object containing the messages to render + * @return void + */ +Joomla.renderMessages = function(messages) { + Joomla.removeMessages(); + var container = document.id('system-message-container'); + + Object.each(messages, function (item, type) { + var div = new Element('div', { + id: 'system-message', + 'class': 'alert alert-' + type + }); + div.inject(container); + var h4 = new Element('h4', { + 'class' : 'alert-heading', + html: Joomla.JText._(type) + }); + h4.inject(div); + var divList = new Element('div'); + Array.each(item, function (item, index, object) { + var p = new Element('p', { + html: item + }); + p.inject(divList); + }, this); + divList.inject(div); + }, this); +}; + + +/** + * Remove messages + * + * @return void + */ +Joomla.removeMessages = function() { + var children = $$('#system-message-container > *'); + children.destroy(); +} + +/** + * USED IN: administrator/components/com_cache/views/cache/tmpl/default.php + * administrator/components/com_installer/views/discover/tmpl/default_item.php + * administrator/components/com_installer/views/update/tmpl/default_item.php + * administrator/components/com_languages/helpers/html/languages.php + * libraries/joomla/html/html/grid.php + * + * @param isitchecked + * @param form + * @return + */ +Joomla.isChecked = function(isitchecked, form) { + if (typeof(form) === 'undefined') { + form = document.getElementById('adminForm'); + } + + if (isitchecked == true) { + form.boxchecked.value++; + } else { + form.boxchecked.value--; + } +} + +/** + * USED IN: libraries/joomla/html/toolbar/button/help.php + * + * Pops up a new window in the middle of the screen + */ +Joomla.popupWindow = function(mypage, myname, w, h, scroll) { + var winl = (screen.width - w) / 2; + var wint = (screen.height - h) / 2; + var winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl + + ',scrollbars=' + scroll + ',resizable' + var win = window.open(mypage, myname, winprops) + win.window.focus(); +} + +/** + * USED IN: libraries/joomla/html/html/grid.php + */ +Joomla.tableOrdering = function(order, dir, task, form) { + if (typeof(form) === 'undefined') { + form = document.getElementById('adminForm'); + } + + form.filter_order.value = order; + form.filter_order_Dir.value = dir; + Joomla.submitform(task, form); +} + +/** + * USED IN: administrator/components/com_modules/views/module/tmpl/default.php + * + * Writes a dynamically generated list + * + * @param string + * The parameters to insert into the '; + var i = 0; + for (x in source) { + if (source[x][0] == key) { + var selected = ''; + if ((orig_key == key && orig_val == source[x][1]) + || (i == 0 && orig_key != key)) { + selected = 'selected="selected"'; + } + html += '\n '; + } + i++; + } + html += '\n '; + + document.writeln(html); +} + +/** + * USED IN: administrator/components/com_content/views/article/view.html.php + * + * Changes a dynamically generated list + * + * @param string + * The name of the list to change + * @param array + * A javascript array of list options in the form [key,value,text] + * @param string + * The key to display + * @param string + * The original key that was selected + * @param string + * The original item value that was selected + */ +function changeDynaList(listname, source, key, orig_key, orig_val) { + var list = document.adminForm[listname]; + + // empty the list + for (i in list.options.length) { + list.options[i] = null; + } + i = 0; + for (x in source) { + if (source[x][0] == key) { + opt = new Option(); + opt.value = source[x][1]; + opt.text = source[x][2]; + + if ((orig_key == key && orig_val == opt.value) || i == 0) { + opt.selected = true; + } + list.options[i++] = opt; + } + } + list.length = i; +} + +/** + * USED IN: administrator/components/com_menus/views/menus/tmpl/default.php + * + * @param radioObj + * @return + */ +// return the value of the radio button that is checked +// return an empty string if none are checked, or +// there are no radio buttons +function radioGetCheckedValue(radioObj) { + if (!radioObj) { + return ''; + } + var n = radioObj.length; + if (n == undefined) { + if (radioObj.checked) { + return radioObj.value; + } else { + return ''; + } + } + for ( var i = 0; i < n; i++) { + if (radioObj[i].checked) { + return radioObj[i].value; + } + } + return ''; +} + +/** + * USED IN: administrator/components/com_banners/views/banner/tmpl/default/php + * administrator/components/com_categories/views/category/tmpl/default.php + * administrator/components/com_categories/views/copyselect/tmpl/default.php + * administrator/components/com_content/views/copyselect/tmpl/default.php + * administrator/components/com_massmail/views/massmail/tmpl/default.php + * administrator/components/com_menus/views/list/tmpl/copy.php + * administrator/components/com_menus/views/list/tmpl/move.php + * administrator/components/com_messages/views/message/tmpl/default_form.php + * administrator/components/com_newsfeeds/views/newsfeed/tmpl/default.php + * components/com_content/views/article/tmpl/form.php + * templates/beez/html/com_content/article/form.php + * + * @param frmName + * @param srcListName + * @return + */ +function getSelectedValue(frmName, srcListName) { + var form = document[frmName]; + var srcList = form[srcListName]; + + i = srcList.selectedIndex; + if (i != null && i > -1) { + return srcList.options[i].value; + } else { + return null; + } +} + +/** + * USED IN: all over :) + * + * @param id + * @param task + * @return + */ +function listItemTask(id, task) { + var f = document.adminForm; + var cb = f[id]; + if (cb) { + for (var i = 0; true; i++) { + var cbx = f['cb'+i]; + if (!cbx) + break; + cbx.checked = false; + } // for + cb.checked = true; + f.boxchecked.value = 1; + submitbutton(task); + } + return false; +} + +/** + * Default function. Usually would be overriden by the component + * + * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitbutton() instead. + */ +function submitbutton(pressbutton) { + submitform(pressbutton); +} + +/** + * Submit the admin form + * + * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitform() instead. + */ +function submitform(pressbutton) { + if (pressbutton) { + document.adminForm.task.value = pressbutton; + } + if (typeof document.adminForm.onsubmit == "function") { + document.adminForm.onsubmit(); + } + if (typeof document.adminForm.fireEvent == "function") { + document.adminForm.fireEvent('submit'); + } + document.adminForm.submit(); +} + +// needed for Table Column ordering +/** + * USED IN: libraries/joomla/html/html/grid.php + */ +function saveorder(n, task) { + checkAll_button(n, task); +} + +function checkAll_button(n, task) { + if (!task) { + task = 'saveorder'; + } + + for (var j = 0; j <= n; j++) { + var box = document.adminForm['cb'+j]; + if (box) { + if (box.checked == false) { + box.checked = true; + } + } else { + alert("You cannot change the order of items, as an item in the list is `Checked Out`"); + return; + } + } + submitform(task); +} From 6635df88e85af9dcb7a5106b4532ef36a27b3229 Mon Sep 17 00:00:00 2001 From: Ashan Fernando Date: Thu, 25 Jul 2013 08:40:57 +0530 Subject: [PATCH 2/6] Task:Core implementing mootools dependency removed core.js as a new file core-jquery-uncompressed.js Modified functions: Joomla.renderMessages, Joomla.removeMessages --- media/system/js/core-jquery-uncompressed.js | 40 +++++++++++---------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/media/system/js/core-jquery-uncompressed.js b/media/system/js/core-jquery-uncompressed.js index 4278e2df1f516..64e023d53e8d5 100644 --- a/media/system/js/core-jquery-uncompressed.js +++ b/media/system/js/core-jquery-uncompressed.js @@ -123,29 +123,32 @@ Joomla.checkAll = function(checkbox, stub) { * @return void */ Joomla.renderMessages = function(messages) { + var $ = jQuery.noConflict(); Joomla.removeMessages(); - var container = document.id('system-message-container'); + var $container = $('#system-message-container'); - Object.each(messages, function (item, type) { - var div = new Element('div', { - id: 'system-message', - 'class': 'alert alert-' + type + $.each(messages, function(type, item) { + var $div = $('
', { + 'id' : 'system-message', + 'class' : 'alert alert-' + type }); - div.inject(container); - var h4 = new Element('h4', { + $container.append($div) + + var $h4 = $('

', { 'class' : 'alert-heading', - html: Joomla.JText._(type) + 'text' : Joomla.JText._(type) }); - h4.inject(div); - var divList = new Element('div'); - Array.each(item, function (item, index, object) { - var p = new Element('p', { - html: item + $div.append($h4); + + var $divList = $('
'); + $.each(item, function(index, item) { + var $p = $('

', { + text : item }); - p.inject(divList); - }, this); - divList.inject(div); - }, this); + $divList.append($p); + }); + $div.append($divList); + }); }; @@ -155,8 +158,7 @@ Joomla.renderMessages = function(messages) { * @return void */ Joomla.removeMessages = function() { - var children = $$('#system-message-container > *'); - children.destroy(); + jQuery('#system-message-container').empty(); } /** From c0192aad59e5525c9913c2789a8eebe2aa86079f Mon Sep 17 00:00:00 2001 From: Ashan Fernando Date: Tue, 6 Aug 2013 06:54:57 +0530 Subject: [PATCH 3/6] Task:Core Removed new JS file for the jQuery version of core.js and replacing the core-uncompressed.js with jQuery version, Fixing "Joomla" object not found error --- libraries/cms/html/behavior.php | 2 +- media/system/js/core-jquery-uncompressed.js | 423 ------------------ media/system/js/core-uncompressed.js | 456 ++++++++++---------- 3 files changed, 229 insertions(+), 652 deletions(-) delete mode 100644 media/system/js/core-jquery-uncompressed.js diff --git a/libraries/cms/html/behavior.php b/libraries/cms/html/behavior.php index 6f0972c98c490..5d1b094849014 100644 --- a/libraries/cms/html/behavior.php +++ b/libraries/cms/html/behavior.php @@ -63,7 +63,7 @@ public static function framework($extras = false, $debug = null) JHtml::_('script', 'system/mootools-' . $type . '.js', false, true, false, false, $debug); // Include jQuery JHtml::_('jquery.framework'); - JHtml::_('script', 'system/core-jquery-uncompressed.js', false, true); + JHtml::_('script', 'system/core-uncompressed.js', false, true); static::$loaded[__METHOD__][$type] = true; return; diff --git a/media/system/js/core-jquery-uncompressed.js b/media/system/js/core-jquery-uncompressed.js deleted file mode 100644 index 64e023d53e8d5..0000000000000 --- a/media/system/js/core-jquery-uncompressed.js +++ /dev/null @@ -1,423 +0,0 @@ -/** - * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -// Only define the Joomla namespace if not defined. -Joomla = Joomla || {} - -Joomla.editors = {}; -// An object to hold each editor instance on page -Joomla.editors.instances = {}; - -/** - * Generic submit form - */ -Joomla.submitform = function(task, form) { - alert('dd') - if (typeof(form) === 'undefined') { - form = document.getElementById('adminForm'); - } - - if (typeof(task) !== 'undefined') { - form.task.value = task; - } - - // Submit the form. - if (typeof form.onsubmit == 'function') { - form.onsubmit(); - } - if (typeof form.fireEvent == "function") { - form.fireEvent('submit'); - } - form.submit(); -}; - -/** - * Default function. Usually would be overriden by the component - */ -Joomla.submitbutton = function(pressbutton) { - Joomla.submitform(pressbutton); -} - -/** - * Custom behavior for JavaScript I18N in Joomla! 1.6 - * - * Allows you to call Joomla.JText._() to get a translated JavaScript string pushed in with JText::script() in Joomla. - */ -Joomla.JText = { - strings: {}, - '_': function(key, def) { - return typeof this.strings[key.toUpperCase()] !== 'undefined' ? this.strings[key.toUpperCase()] : def; - }, - load: function(object) { - for (var key in object) { - this.strings[key.toUpperCase()] = object[key]; - } - return this; - } -}; - -/** - * Method to replace all request tokens on the page with a new one. - */ -Joomla.replaceTokens = function(n) { - var els = document.getElementsByTagName('input'); - for (var i = 0; i < els.length; i++) { - if ((els[i].type == 'hidden') && (els[i].name.length == 32) && els[i].value == '1') { - els[i].name = n; - } - } -}; - -/** - * USED IN: administrator/components/com_banners/views/client/tmpl/default.php - * - * Verifies if the string is in a valid email format - * - * @param string - * @return boolean - */ -Joomla.isEmail = function(text) { - var regex = new RegExp("^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$"); - return regex.test(text); -}; - -/** - * USED IN: all list forms. - * - * Toggles the check state of a group of boxes - * - * Checkboxes must have an id attribute in the form cb0, cb1... - * - * @param mixed The number of box to 'check', for a checkbox element - * @param string An alternative field name - */ -Joomla.checkAll = function(checkbox, stub) { - if (!stub) { - stub = 'cb'; - } - if (checkbox.form) { - var c = 0; - for (var i = 0, n = checkbox.form.elements.length; i < n; i++) { - var e = checkbox.form.elements[i]; - if (e.type == checkbox.type) { - if ((stub && e.id.indexOf(stub) == 0) || !stub) { - e.checked = checkbox.checked; - c += (e.checked == true ? 1 : 0); - } - } - } - if (checkbox.form.boxchecked) { - checkbox.form.boxchecked.value = c; - } - return true; - } - return false; -} - -/** - * Render messages send via JSON - * - * @param object messages JavaScript object containing the messages to render - * @return void - */ -Joomla.renderMessages = function(messages) { - var $ = jQuery.noConflict(); - Joomla.removeMessages(); - var $container = $('#system-message-container'); - - $.each(messages, function(type, item) { - var $div = $('

', { - 'id' : 'system-message', - 'class' : 'alert alert-' + type - }); - $container.append($div) - - var $h4 = $('

', { - 'class' : 'alert-heading', - 'text' : Joomla.JText._(type) - }); - $div.append($h4); - - var $divList = $('
'); - $.each(item, function(index, item) { - var $p = $('

', { - text : item - }); - $divList.append($p); - }); - $div.append($divList); - }); -}; - - -/** - * Remove messages - * - * @return void - */ -Joomla.removeMessages = function() { - jQuery('#system-message-container').empty(); -} - -/** - * USED IN: administrator/components/com_cache/views/cache/tmpl/default.php - * administrator/components/com_installer/views/discover/tmpl/default_item.php - * administrator/components/com_installer/views/update/tmpl/default_item.php - * administrator/components/com_languages/helpers/html/languages.php - * libraries/joomla/html/html/grid.php - * - * @param isitchecked - * @param form - * @return - */ -Joomla.isChecked = function(isitchecked, form) { - if (typeof(form) === 'undefined') { - form = document.getElementById('adminForm'); - } - - if (isitchecked == true) { - form.boxchecked.value++; - } else { - form.boxchecked.value--; - } -} - -/** - * USED IN: libraries/joomla/html/toolbar/button/help.php - * - * Pops up a new window in the middle of the screen - */ -Joomla.popupWindow = function(mypage, myname, w, h, scroll) { - var winl = (screen.width - w) / 2; - var wint = (screen.height - h) / 2; - var winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl - + ',scrollbars=' + scroll + ',resizable' - var win = window.open(mypage, myname, winprops) - win.window.focus(); -} - -/** - * USED IN: libraries/joomla/html/html/grid.php - */ -Joomla.tableOrdering = function(order, dir, task, form) { - if (typeof(form) === 'undefined') { - form = document.getElementById('adminForm'); - } - - form.filter_order.value = order; - form.filter_order_Dir.value = dir; - Joomla.submitform(task, form); -} - -/** - * USED IN: administrator/components/com_modules/views/module/tmpl/default.php - * - * Writes a dynamically generated list - * - * @param string - * The parameters to insert into the '; - var i = 0; - for (x in source) { - if (source[x][0] == key) { - var selected = ''; - if ((orig_key == key && orig_val == source[x][1]) - || (i == 0 && orig_key != key)) { - selected = 'selected="selected"'; - } - html += '\n '; - } - i++; - } - html += '\n '; - - document.writeln(html); -} - -/** - * USED IN: administrator/components/com_content/views/article/view.html.php - * - * Changes a dynamically generated list - * - * @param string - * The name of the list to change - * @param array - * A javascript array of list options in the form [key,value,text] - * @param string - * The key to display - * @param string - * The original key that was selected - * @param string - * The original item value that was selected - */ -function changeDynaList(listname, source, key, orig_key, orig_val) { - var list = document.adminForm[listname]; - - // empty the list - for (i in list.options.length) { - list.options[i] = null; - } - i = 0; - for (x in source) { - if (source[x][0] == key) { - opt = new Option(); - opt.value = source[x][1]; - opt.text = source[x][2]; - - if ((orig_key == key && orig_val == opt.value) || i == 0) { - opt.selected = true; - } - list.options[i++] = opt; - } - } - list.length = i; -} - -/** - * USED IN: administrator/components/com_menus/views/menus/tmpl/default.php - * - * @param radioObj - * @return - */ -// return the value of the radio button that is checked -// return an empty string if none are checked, or -// there are no radio buttons -function radioGetCheckedValue(radioObj) { - if (!radioObj) { - return ''; - } - var n = radioObj.length; - if (n == undefined) { - if (radioObj.checked) { - return radioObj.value; - } else { - return ''; - } - } - for ( var i = 0; i < n; i++) { - if (radioObj[i].checked) { - return radioObj[i].value; - } - } - return ''; -} - -/** - * USED IN: administrator/components/com_banners/views/banner/tmpl/default/php - * administrator/components/com_categories/views/category/tmpl/default.php - * administrator/components/com_categories/views/copyselect/tmpl/default.php - * administrator/components/com_content/views/copyselect/tmpl/default.php - * administrator/components/com_massmail/views/massmail/tmpl/default.php - * administrator/components/com_menus/views/list/tmpl/copy.php - * administrator/components/com_menus/views/list/tmpl/move.php - * administrator/components/com_messages/views/message/tmpl/default_form.php - * administrator/components/com_newsfeeds/views/newsfeed/tmpl/default.php - * components/com_content/views/article/tmpl/form.php - * templates/beez/html/com_content/article/form.php - * - * @param frmName - * @param srcListName - * @return - */ -function getSelectedValue(frmName, srcListName) { - var form = document[frmName]; - var srcList = form[srcListName]; - - i = srcList.selectedIndex; - if (i != null && i > -1) { - return srcList.options[i].value; - } else { - return null; - } -} - -/** - * USED IN: all over :) - * - * @param id - * @param task - * @return - */ -function listItemTask(id, task) { - var f = document.adminForm; - var cb = f[id]; - if (cb) { - for (var i = 0; true; i++) { - var cbx = f['cb'+i]; - if (!cbx) - break; - cbx.checked = false; - } // for - cb.checked = true; - f.boxchecked.value = 1; - submitbutton(task); - } - return false; -} - -/** - * Default function. Usually would be overriden by the component - * - * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitbutton() instead. - */ -function submitbutton(pressbutton) { - submitform(pressbutton); -} - -/** - * Submit the admin form - * - * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitform() instead. - */ -function submitform(pressbutton) { - if (pressbutton) { - document.adminForm.task.value = pressbutton; - } - if (typeof document.adminForm.onsubmit == "function") { - document.adminForm.onsubmit(); - } - if (typeof document.adminForm.fireEvent == "function") { - document.adminForm.fireEvent('submit'); - } - document.adminForm.submit(); -} - -// needed for Table Column ordering -/** - * USED IN: libraries/joomla/html/html/grid.php - */ -function saveorder(n, task) { - checkAll_button(n, task); -} - -function checkAll_button(n, task) { - if (!task) { - task = 'saveorder'; - } - - for (var j = 0; j <= n; j++) { - var box = document.adminForm['cb'+j]; - if (box) { - if (box.checked == false) { - box.checked = true; - } - } else { - alert("You cannot change the order of items, as an item in the list is `Checked Out`"); - return; - } - } - submitform(task); -} diff --git a/media/system/js/core-uncompressed.js b/media/system/js/core-uncompressed.js index f7840d3affbc5..340498e052dc0 100644 --- a/media/system/js/core-uncompressed.js +++ b/media/system/js/core-uncompressed.js @@ -1,12 +1,10 @@ /** - * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt + * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt */ // Only define the Joomla namespace if not defined. -if (typeof(Joomla) === 'undefined') { - var Joomla = {}; -} +Joomla = window.Joomla || {}; Joomla.editors = {}; // An object to hold each editor instance on page @@ -16,29 +14,29 @@ Joomla.editors.instances = {}; * Generic submit form */ Joomla.submitform = function(task, form) { - if (typeof(form) === 'undefined') { - form = document.getElementById('adminForm'); - } - - if (typeof(task) !== 'undefined') { - form.task.value = task; - } - - // Submit the form. - if (typeof form.onsubmit == 'function') { - form.onsubmit(); - } - if (typeof form.fireEvent == "function") { - form.fireEvent('submit'); - } - form.submit(); + if (typeof(form) === 'undefined') { + form = document.getElementById('adminForm'); + } + + if (typeof(task) !== 'undefined') { + form.task.value = task; + } + + // Submit the form. + if (typeof form.onsubmit == 'function') { + form.onsubmit(); + } + if (typeof form.fireEvent == "function") { + form.fireEvent('submit'); + } + form.submit(); }; /** * Default function. Usually would be overriden by the component */ Joomla.submitbutton = function(pressbutton) { - Joomla.submitform(pressbutton); + Joomla.submitform(pressbutton); } /** @@ -47,28 +45,28 @@ Joomla.submitbutton = function(pressbutton) { * Allows you to call Joomla.JText._() to get a translated JavaScript string pushed in with JText::script() in Joomla. */ Joomla.JText = { - strings: {}, - '_': function(key, def) { - return typeof this.strings[key.toUpperCase()] !== 'undefined' ? this.strings[key.toUpperCase()] : def; - }, - load: function(object) { - for (var key in object) { - this.strings[key.toUpperCase()] = object[key]; - } - return this; - } + strings: {}, + '_': function(key, def) { + return typeof this.strings[key.toUpperCase()] !== 'undefined' ? this.strings[key.toUpperCase()] : def; + }, + load: function(object) { + for (var key in object) { + this.strings[key.toUpperCase()] = object[key]; + } + return this; + } }; /** * Method to replace all request tokens on the page with a new one. */ Joomla.replaceTokens = function(n) { - var els = document.getElementsByTagName('input'); - for (var i = 0; i < els.length; i++) { - if ((els[i].type == 'hidden') && (els[i].name.length == 32) && els[i].value == '1') { - els[i].name = n; - } - } + var els = document.getElementsByTagName('input'); + for (var i = 0; i < els.length; i++) { + if ((els[i].type == 'hidden') && (els[i].name.length == 32) && els[i].value == '1') { + els[i].name = n; + } + } }; /** @@ -80,8 +78,8 @@ Joomla.replaceTokens = function(n) { * @return boolean */ Joomla.isEmail = function(text) { - var regex = new RegExp("^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$"); - return regex.test(text); + var regex = new RegExp("^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$"); + return regex.test(text); }; /** @@ -91,73 +89,75 @@ Joomla.isEmail = function(text) { * * Checkboxes must have an id attribute in the form cb0, cb1... * - * @param mixed The number of box to 'check', for a checkbox element - * @param string An alternative field name + * @param mixed The number of box to 'check', for a checkbox element + * @param string An alternative field name */ Joomla.checkAll = function(checkbox, stub) { - if (!stub) { - stub = 'cb'; - } - if (checkbox.form) { - var c = 0; - for (var i = 0, n = checkbox.form.elements.length; i < n; i++) { - var e = checkbox.form.elements[i]; - if (e.type == checkbox.type) { - if ((stub && e.id.indexOf(stub) == 0) || !stub) { - e.checked = checkbox.checked; - c += (e.checked == true ? 1 : 0); - } - } - } - if (checkbox.form.boxchecked) { - checkbox.form.boxchecked.value = c; - } - return true; - } - return false; + if (!stub) { + stub = 'cb'; + } + if (checkbox.form) { + var c = 0; + for (var i = 0, n = checkbox.form.elements.length; i < n; i++) { + var e = checkbox.form.elements[i]; + if (e.type == checkbox.type) { + if ((stub && e.id.indexOf(stub) == 0) || !stub) { + e.checked = checkbox.checked; + c += (e.checked == true ? 1 : 0); + } + } + } + if (checkbox.form.boxchecked) { + checkbox.form.boxchecked.value = c; + } + return true; + } + return false; } /** * Render messages send via JSON * - * @param object messages JavaScript object containing the messages to render - * @return void + * @param object messages JavaScript object containing the messages to render + * @return void */ Joomla.renderMessages = function(messages) { - Joomla.removeMessages(); - var container = document.id('system-message-container'); - - Object.each(messages, function (item, type) { - var div = new Element('div', { - id: 'system-message', - 'class': 'alert alert-' + type - }); - div.inject(container); - var h4 = new Element('h4', { - 'class' : 'alert-heading', - html: Joomla.JText._(type) - }); - h4.inject(div); - var divList = new Element('div'); - Array.each(item, function (item, index, object) { - var p = new Element('p', { - html: item - }); - p.inject(divList); - }, this); - divList.inject(div); - }, this); + var $ = jQuery.noConflict(); + Joomla.removeMessages(); + var $container = $('#system-message-container'); + + $.each(messages, function(type, item) { + var $div = $('

', { + 'id' : 'system-message', + 'class' : 'alert alert-' + type + }); + $container.append($div) + + var $h4 = $('

', { + 'class' : 'alert-heading', + 'text' : Joomla.JText._(type) + }); + $div.append($h4); + + var $divList = $('
'); + $.each(item, function(index, item) { + var $p = $('

', { + text : item + }); + $divList.append($p); + }); + $div.append($divList); + }); }; /** * Remove messages * - * @return void + * @return void */ Joomla.removeMessages = function() { - var children = $$('#system-message-container > *'); - children.destroy(); + jQuery('#system-message-container').empty(); } /** @@ -172,15 +172,15 @@ Joomla.removeMessages = function() { * @return */ Joomla.isChecked = function(isitchecked, form) { - if (typeof(form) === 'undefined') { - form = document.getElementById('adminForm'); - } - - if (isitchecked == true) { - form.boxchecked.value++; - } else { - form.boxchecked.value--; - } + if (typeof(form) === 'undefined') { + form = document.getElementById('adminForm'); + } + + if (isitchecked == true) { + form.boxchecked.value++; + } else { + form.boxchecked.value--; + } } /** @@ -189,25 +189,25 @@ Joomla.isChecked = function(isitchecked, form) { * Pops up a new window in the middle of the screen */ Joomla.popupWindow = function(mypage, myname, w, h, scroll) { - var winl = (screen.width - w) / 2; - var wint = (screen.height - h) / 2; - var winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl - + ',scrollbars=' + scroll + ',resizable' - var win = window.open(mypage, myname, winprops) - win.window.focus(); + var winl = (screen.width - w) / 2; + var wint = (screen.height - h) / 2; + var winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl + + ',scrollbars=' + scroll + ',resizable' + var win = window.open(mypage, myname, winprops) + win.window.focus(); } /** * USED IN: libraries/joomla/html/html/grid.php */ Joomla.tableOrdering = function(order, dir, task, form) { - if (typeof(form) === 'undefined') { - form = document.getElementById('adminForm'); - } + if (typeof(form) === 'undefined') { + form = document.getElementById('adminForm'); + } - form.filter_order.value = order; - form.filter_order_Dir.value = dir; - Joomla.submitform(task, form); + form.filter_order.value = order; + form.filter_order_Dir.value = dir; + Joomla.submitform(task, form); } /** @@ -216,34 +216,34 @@ Joomla.tableOrdering = function(order, dir, task, form) { * Writes a dynamically generated list * * @param string - * The parameters to insert into the tag * @param array - * A javascript array of list options in the form [key,value,text] + * A javascript array of list options in the form [key,value,text] * @param string - * The key to display for the initial state of the list + * The key to display for the initial state of the list * @param string - * The original key that was selected + * The original key that was selected * @param string - * The original item value that was selected + * The original item value that was selected */ function writeDynaList(selectParams, source, key, orig_key, orig_val) { - var html = '\n '; - - document.writeln(html); + var html = '\n '; + + document.writeln(html); } /** @@ -252,37 +252,37 @@ function writeDynaList(selectParams, source, key, orig_key, orig_val) { * Changes a dynamically generated list * * @param string - * The name of the list to change + * The name of the list to change * @param array - * A javascript array of list options in the form [key,value,text] + * A javascript array of list options in the form [key,value,text] * @param string - * The key to display + * The key to display * @param string - * The original key that was selected + * The original key that was selected * @param string - * The original item value that was selected + * The original item value that was selected */ function changeDynaList(listname, source, key, orig_key, orig_val) { - var list = document.adminForm[listname]; - - // empty the list - for (i in list.options.length) { - list.options[i] = null; - } - i = 0; - for (x in source) { - if (source[x][0] == key) { - opt = new Option(); - opt.value = source[x][1]; - opt.text = source[x][2]; - - if ((orig_key == key && orig_val == opt.value) || i == 0) { - opt.selected = true; - } - list.options[i++] = opt; - } - } - list.length = i; + var list = document.adminForm[listname]; + + // empty the list + for (i in list.options.length) { + list.options[i] = null; + } + i = 0; + for (x in source) { + if (source[x][0] == key) { + opt = new Option(); + opt.value = source[x][1]; + opt.text = source[x][2]; + + if ((orig_key == key && orig_val == opt.value) || i == 0) { + opt.selected = true; + } + list.options[i++] = opt; + } + } + list.length = i; } /** @@ -295,23 +295,23 @@ function changeDynaList(listname, source, key, orig_key, orig_val) { // return an empty string if none are checked, or // there are no radio buttons function radioGetCheckedValue(radioObj) { - if (!radioObj) { - return ''; - } - var n = radioObj.length; - if (n == undefined) { - if (radioObj.checked) { - return radioObj.value; - } else { - return ''; - } - } - for ( var i = 0; i < n; i++) { - if (radioObj[i].checked) { - return radioObj[i].value; - } - } - return ''; + if (!radioObj) { + return ''; + } + var n = radioObj.length; + if (n == undefined) { + if (radioObj.checked) { + return radioObj.value; + } else { + return ''; + } + } + for ( var i = 0; i < n; i++) { + if (radioObj[i].checked) { + return radioObj[i].value; + } + } + return ''; } /** @@ -332,15 +332,15 @@ function radioGetCheckedValue(radioObj) { * @return */ function getSelectedValue(frmName, srcListName) { - var form = document[frmName]; - var srcList = form[srcListName]; - - i = srcList.selectedIndex; - if (i != null && i > -1) { - return srcList.options[i].value; - } else { - return null; - } + var form = document[frmName]; + var srcList = form[srcListName]; + + i = srcList.selectedIndex; + if (i != null && i > -1) { + return srcList.options[i].value; + } else { + return null; + } } /** @@ -351,47 +351,47 @@ function getSelectedValue(frmName, srcListName) { * @return */ function listItemTask(id, task) { - var f = document.adminForm; - var cb = f[id]; - if (cb) { - for (var i = 0; true; i++) { - var cbx = f['cb'+i]; - if (!cbx) - break; - cbx.checked = false; - } // for - cb.checked = true; - f.boxchecked.value = 1; - submitbutton(task); - } - return false; + var f = document.adminForm; + var cb = f[id]; + if (cb) { + for (var i = 0; true; i++) { + var cbx = f['cb'+i]; + if (!cbx) + break; + cbx.checked = false; + } // for + cb.checked = true; + f.boxchecked.value = 1; + submitbutton(task); + } + return false; } /** * Default function. Usually would be overriden by the component * - * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitbutton() instead. + * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitbutton() instead. */ function submitbutton(pressbutton) { - submitform(pressbutton); + submitform(pressbutton); } /** * Submit the admin form * - * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitform() instead. + * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitform() instead. */ function submitform(pressbutton) { - if (pressbutton) { - document.adminForm.task.value = pressbutton; - } - if (typeof document.adminForm.onsubmit == "function") { - document.adminForm.onsubmit(); - } - if (typeof document.adminForm.fireEvent == "function") { - document.adminForm.fireEvent('submit'); - } - document.adminForm.submit(); + if (pressbutton) { + document.adminForm.task.value = pressbutton; + } + if (typeof document.adminForm.onsubmit == "function") { + document.adminForm.onsubmit(); + } + if (typeof document.adminForm.fireEvent == "function") { + document.adminForm.fireEvent('submit'); + } + document.adminForm.submit(); } // needed for Table Column ordering @@ -399,24 +399,24 @@ function submitform(pressbutton) { * USED IN: libraries/joomla/html/html/grid.php */ function saveorder(n, task) { - checkAll_button(n, task); + checkAll_button(n, task); } function checkAll_button(n, task) { - if (!task) { - task = 'saveorder'; - } - - for (var j = 0; j <= n; j++) { - var box = document.adminForm['cb'+j]; - if (box) { - if (box.checked == false) { - box.checked = true; - } - } else { - alert("You cannot change the order of items, as an item in the list is `Checked Out`"); - return; - } - } - submitform(task); + if (!task) { + task = 'saveorder'; + } + + for (var j = 0; j <= n; j++) { + var box = document.adminForm['cb'+j]; + if (box) { + if (box.checked == false) { + box.checked = true; + } + } else { + alert("You cannot change the order of items, as an item in the list is `Checked Out`"); + return; + } + } + submitform(task); } From 588235babf940d7eb694ef8468b89eaa75d0f9f3 Mon Sep 17 00:00:00 2001 From: Ashan Fernando Date: Fri, 9 Aug 2013 06:22:06 +0530 Subject: [PATCH 4/6] Task:Core Including the compressed version of core.js and improving js code style --- libraries/cms/html/behavior.php | 2 +- media/system/js/core-uncompressed.js | 58 ++++++++++++++-------------- media/system/js/core.js | 11 +----- 3 files changed, 31 insertions(+), 40 deletions(-) diff --git a/libraries/cms/html/behavior.php b/libraries/cms/html/behavior.php index 5d1b094849014..cabe16a7f61e1 100644 --- a/libraries/cms/html/behavior.php +++ b/libraries/cms/html/behavior.php @@ -63,7 +63,7 @@ public static function framework($extras = false, $debug = null) JHtml::_('script', 'system/mootools-' . $type . '.js', false, true, false, false, $debug); // Include jQuery JHtml::_('jquery.framework'); - JHtml::_('script', 'system/core-uncompressed.js', false, true); + JHtml::_('script', 'system/core.js', false, true); static::$loaded[__METHOD__][$type] = true; return; diff --git a/media/system/js/core-uncompressed.js b/media/system/js/core-uncompressed.js index 340498e052dc0..857a0a7ff618e 100644 --- a/media/system/js/core-uncompressed.js +++ b/media/system/js/core-uncompressed.js @@ -61,8 +61,8 @@ Joomla.JText = { * Method to replace all request tokens on the page with a new one. */ Joomla.replaceTokens = function(n) { - var els = document.getElementsByTagName('input'); - for (var i = 0; i < els.length; i++) { + var els = document.getElementsByTagName('input'), i; + for (i = 0; i < els.length; i++) { if ((els[i].type == 'hidden') && (els[i].name.length == 32) && els[i].value == '1') { els[i].name = n; } @@ -97,9 +97,9 @@ Joomla.checkAll = function(checkbox, stub) { stub = 'cb'; } if (checkbox.form) { - var c = 0; - for (var i = 0, n = checkbox.form.elements.length; i < n; i++) { - var e = checkbox.form.elements[i]; + var c = 0, i, e; + for (i = 0, n = checkbox.form.elements.length; i < n; i++) { + e = checkbox.form.elements[i]; if (e.type == checkbox.type) { if ((stub && e.id.indexOf(stub) == 0) || !stub) { e.checked = checkbox.checked; @@ -122,26 +122,26 @@ Joomla.checkAll = function(checkbox, stub) { * @return void */ Joomla.renderMessages = function(messages) { - var $ = jQuery.noConflict(); + var $ = jQuery.noConflict(), $container, $div, $h4, $divList, $p; Joomla.removeMessages(); - var $container = $('#system-message-container'); + $container = $('#system-message-container'); $.each(messages, function(type, item) { - var $div = $('

', { + $div = $('
', { 'id' : 'system-message', 'class' : 'alert alert-' + type }); $container.append($div) - var $h4 = $('

', { + $h4 = $('

', { 'class' : 'alert-heading', 'text' : Joomla.JText._(type) }); $div.append($h4); - var $divList = $('
'); + $divList = $('
'); $.each(item, function(index, item) { - var $p = $('

', { + $p = $('

', { text : item }); $divList.append($p); @@ -189,11 +189,11 @@ Joomla.isChecked = function(isitchecked, form) { * Pops up a new window in the middle of the screen */ Joomla.popupWindow = function(mypage, myname, w, h, scroll) { - var winl = (screen.width - w) / 2; - var wint = (screen.height - h) / 2; - var winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl + var winl = (screen.width - w) / 2, wint, winprops, win; + wint = (screen.height - h) / 2; + winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl + ',scrollbars=' + scroll + ',resizable' - var win = window.open(mypage, myname, winprops) + win = window.open(mypage, myname, winprops) win.window.focus(); } @@ -227,11 +227,11 @@ Joomla.tableOrdering = function(order, dir, task, form) { * The original item value that was selected */ function writeDynaList(selectParams, source, key, orig_key, orig_val) { - var html = '\n ', i, selected; + i = 0; for (x in source) { if (source[x][0] == key) { - var selected = ''; + selected = ''; if ((orig_key == key && orig_val == source[x][1]) || (i == 0 && orig_key != key)) { selected = 'selected="selected"'; @@ -298,7 +298,7 @@ function radioGetCheckedValue(radioObj) { if (!radioObj) { return ''; } - var n = radioObj.length; + var n = radioObj.length, i; if (n == undefined) { if (radioObj.checked) { return radioObj.value; @@ -306,7 +306,7 @@ function radioGetCheckedValue(radioObj) { return ''; } } - for ( var i = 0; i < n; i++) { + for (i = 0; i < n; i++) { if (radioObj[i].checked) { return radioObj[i].value; } @@ -332,8 +332,8 @@ function radioGetCheckedValue(radioObj) { * @return */ function getSelectedValue(frmName, srcListName) { - var form = document[frmName]; - var srcList = form[srcListName]; + var form = document[frmName], + srcList = form[srcListName]; i = srcList.selectedIndex; if (i != null && i > -1) { @@ -351,11 +351,11 @@ function getSelectedValue(frmName, srcListName) { * @return */ function listItemTask(id, task) { - var f = document.adminForm; - var cb = f[id]; + var f = document.adminForm, i, cbx, + cb = f[id]; if (cb) { - for (var i = 0; true; i++) { - var cbx = f['cb'+i]; + for (i = 0; true; i++) { + cbx = f['cb'+i]; if (!cbx) break; cbx.checked = false; @@ -406,9 +406,9 @@ function checkAll_button(n, task) { if (!task) { task = 'saveorder'; } - - for (var j = 0; j <= n; j++) { - var box = document.adminForm['cb'+j]; + var j, box; + for (j = 0; j <= n; j++) { + box = document.adminForm['cb'+j]; if (box) { if (box.checked == false) { box.checked = true; diff --git a/media/system/js/core.js b/media/system/js/core.js index 11ad35b13a809..af7bab5aa60a3 100644 --- a/media/system/js/core.js +++ b/media/system/js/core.js @@ -1,13 +1,4 @@ /* GNU General Public License version 2 or later; see LICENSE.txt */ -if("undefined"===typeof Joomla)var Joomla={};Joomla.editors={};Joomla.editors.instances={};Joomla.submitform=function(a,b){"undefined"===typeof b&&(b=document.getElementById("adminForm"));"undefined"!==typeof a&&(b.task.value=a);if("function"==typeof b.onsubmit)b.onsubmit();"function"==typeof b.fireEvent&&b.fireEvent("submit");b.submit()};Joomla.submitbutton=function(a){Joomla.submitform(a)}; -Joomla.JText={strings:{},_:function(a,b){return"undefined"!==typeof this.strings[a.toUpperCase()]?this.strings[a.toUpperCase()]:b},load:function(a){for(var b in a)this.strings[b.toUpperCase()]=a[b];return this}};Joomla.replaceTokens=function(a){for(var b=document.getElementsByTagName("input"),c=0;c *").destroy()}; -Joomla.isChecked=function(a,b){"undefined"===typeof b&&(b=document.getElementById("adminForm"));!0==a?b.boxchecked.value++:b.boxchecked.value--};Joomla.popupWindow=function(a,b,c,d,f){window.open(a,b,"height="+d+",width="+c+",top="+(screen.height-d)/2+",left="+(screen.width-c)/2+",scrollbars="+f+",resizable").window.focus()}; -Joomla.tableOrdering=function(a,b,c,d){"undefined"===typeof d&&(d=document.getElementById("adminForm"));d.filter_order.value=a;d.filter_order_Dir.value=b;Joomla.submitform(c,d)};function writeDynaList(a,b,c,d,f){var a="\n\t")} -function changeDynaList(a,b,c,d,f){a=document.adminForm[a];for(i in a.options.length)a.options[i]=null;i=0;for(x in b)if(b[x][0]==c){opt=new Option;opt.value=b[x][1];opt.text=b[x][2];if(d==c&&f==opt.value||0==i)opt.selected=!0;a.options[i++]=opt}a.length=i}function radioGetCheckedValue(a){if(!a)return"";var b=a.length;if(void 0==b)return a.checked?a.value:"";for(var c=0;c",{id:"system-message","class":"alert alert-"+h});g.append(b);a=e("

",{"class":"alert-heading",text:Joomla.JText._(h)});b.append(a);f=e("
");e.each(j,function(k,l){c=e("

",{text:l});f.append(c)});b.append(f)})};Joomla.removeMessages=function(){jQuery("#system-message-container").empty()};Joomla.isChecked=function(a,b){if(typeof(b)==="undefined"){b=document.getElementById("adminForm")}if(a==true){b.boxchecked.value++}else{b.boxchecked.value--}};Joomla.popupWindow=function(e,k,j,c,f){var g=(screen.width-j)/2,b,a,d;b=(screen.height-c)/2;a="height="+c+",width="+j+",top="+b+",left="+g+",scrollbars="+f+",resizable";d=window.open(e,k,a);d.window.focus()};Joomla.tableOrdering=function(a,c,b,d){if(typeof(d)==="undefined"){d=document.getElementById("adminForm")}d.filter_order.value=a;d.filter_order_Dir.value=c;Joomla.submitform(b,d)};function writeDynaList(e,g,d,h,a){var c="\n ";document.writeln(c)}function changeDynaList(c,e,b,f,a){var d=document.adminForm[c];for(i in d.options.length){d.options[i]=null}i=0;for(x in e){if(e[x][0]==b){opt=new Option();opt.value=e[x][1];opt.text=e[x][2];if((f==b&&a==opt.value)||i==0){opt.selected=true}d.options[i++]=opt}}d.length=i}function radioGetCheckedValue(b){if(!b){return""}var c=b.length,a;if(c==undefined){if(b.checked){return b.value}else{return""}}for(a=0;a-1){return d.options[i].value}else{return null}}function listItemTask(g,b){var d=document.adminForm,c,e,a=d[g];if(a){for(c=0;true;c++){e=d["cb"+c];if(!e){break}e.checked=false}a.checked=true;d.boxchecked.value=1;submitbutton(b)}return false}function submitbutton(a){submitform(a)}function submitform(a){if(a){document.adminForm.task.value=a}if(typeof document.adminForm.onsubmit=="function"){document.adminForm.onsubmit()}if(typeof document.adminForm.fireEvent=="function"){document.adminForm.fireEvent("submit")}document.adminForm.submit()}function saveorder(b,a){checkAll_button(b,a)}function checkAll_button(d,a){if(!a){a="saveorder"}var b,c;for(b=0;b<=d;b++){c=document.adminForm["cb"+b];if(c){if(c.checked==false){c.checked=true}}else{alert("You cannot change the order of items, as an item in the list is `Checked Out`");return}}submitform(a)}; \ No newline at end of file From 94aee522a80dfae30e1ad67cb1ac5c1b3f94e9fd Mon Sep 17 00:00:00 2001 From: Ashan Fernando Date: Mon, 23 Sep 2013 07:48:35 +0530 Subject: [PATCH 5/6] Task:Core Adding new line ending and convert to unix line delimiters --- media/system/js/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/system/js/core.js b/media/system/js/core.js index af7bab5aa60a3..d6f79067000e4 100644 --- a/media/system/js/core.js +++ b/media/system/js/core.js @@ -1,4 +1,4 @@ /* GNU General Public License version 2 or later; see LICENSE.txt */ -Joomla=window.Joomla||{};Joomla.editors={};Joomla.editors.instances={};Joomla.submitform=function(a,b){if(typeof(b)==="undefined"){b=document.getElementById("adminForm")}if(typeof(a)!=="undefined"){b.task.value=a}if(typeof b.onsubmit=="function"){b.onsubmit()}if(typeof b.fireEvent=="function"){b.fireEvent("submit")}b.submit()};Joomla.submitbutton=function(a){Joomla.submitform(a)};Joomla.JText={strings:{},_:function(a,b){return typeof this.strings[a.toUpperCase()]!=="undefined"?this.strings[a.toUpperCase()]:b},load:function(a){for(var b in a){this.strings[b.toUpperCase()]=a[b]}return this}};Joomla.replaceTokens=function(c){var b=document.getElementsByTagName("input"),a;for(a=0;a",{id:"system-message","class":"alert alert-"+h});g.append(b);a=e("

",{"class":"alert-heading",text:Joomla.JText._(h)});b.append(a);f=e("
");e.each(j,function(k,l){c=e("

",{text:l});f.append(c)});b.append(f)})};Joomla.removeMessages=function(){jQuery("#system-message-container").empty()};Joomla.isChecked=function(a,b){if(typeof(b)==="undefined"){b=document.getElementById("adminForm")}if(a==true){b.boxchecked.value++}else{b.boxchecked.value--}};Joomla.popupWindow=function(e,k,j,c,f){var g=(screen.width-j)/2,b,a,d;b=(screen.height-c)/2;a="height="+c+",width="+j+",top="+b+",left="+g+",scrollbars="+f+",resizable";d=window.open(e,k,a);d.window.focus()};Joomla.tableOrdering=function(a,c,b,d){if(typeof(d)==="undefined"){d=document.getElementById("adminForm")}d.filter_order.value=a;d.filter_order_Dir.value=c;Joomla.submitform(b,d)};function writeDynaList(e,g,d,h,a){var c="\n ";document.writeln(c)}function changeDynaList(c,e,b,f,a){var d=document.adminForm[c];for(i in d.options.length){d.options[i]=null}i=0;for(x in e){if(e[x][0]==b){opt=new Option();opt.value=e[x][1];opt.text=e[x][2];if((f==b&&a==opt.value)||i==0){opt.selected=true}d.options[i++]=opt}}d.length=i}function radioGetCheckedValue(b){if(!b){return""}var c=b.length,a;if(c==undefined){if(b.checked){return b.value}else{return""}}for(a=0;a-1){return d.options[i].value}else{return null}}function listItemTask(g,b){var d=document.adminForm,c,e,a=d[g];if(a){for(c=0;true;c++){e=d["cb"+c];if(!e){break}e.checked=false}a.checked=true;d.boxchecked.value=1;submitbutton(b)}return false}function submitbutton(a){submitform(a)}function submitform(a){if(a){document.adminForm.task.value=a}if(typeof document.adminForm.onsubmit=="function"){document.adminForm.onsubmit()}if(typeof document.adminForm.fireEvent=="function"){document.adminForm.fireEvent("submit")}document.adminForm.submit()}function saveorder(b,a){checkAll_button(b,a)}function checkAll_button(d,a){if(!a){a="saveorder"}var b,c;for(b=0;b<=d;b++){c=document.adminForm["cb"+b];if(c){if(c.checked==false){c.checked=true}}else{alert("You cannot change the order of items, as an item in the list is `Checked Out`");return}}submitform(a)}; \ No newline at end of file +Joomla=window.Joomla||{};Joomla.editors={};Joomla.editors.instances={};Joomla.submitform=function(a,b){if(typeof(b)==="undefined"){b=document.getElementById("adminForm")}if(typeof(a)!=="undefined"){b.task.value=a}if(typeof b.onsubmit=="function"){b.onsubmit()}if(typeof b.fireEvent=="function"){b.fireEvent("submit")}b.submit()};Joomla.submitbutton=function(a){Joomla.submitform(a)};Joomla.JText={strings:{},_:function(a,b){return typeof this.strings[a.toUpperCase()]!=="undefined"?this.strings[a.toUpperCase()]:b},load:function(a){for(var b in a){this.strings[b.toUpperCase()]=a[b]}return this}};Joomla.replaceTokens=function(c){var b=document.getElementsByTagName("input"),a;for(a=0;a",{id:"system-message","class":"alert alert-"+h});g.append(b);a=e("

",{"class":"alert-heading",text:Joomla.JText._(h)});b.append(a);f=e("
");e.each(j,function(k,l){c=e("

",{text:l});f.append(c)});b.append(f)})};Joomla.removeMessages=function(){jQuery("#system-message-container").empty()};Joomla.isChecked=function(a,b){if(typeof(b)==="undefined"){b=document.getElementById("adminForm")}if(a==true){b.boxchecked.value++}else{b.boxchecked.value--}};Joomla.popupWindow=function(e,k,j,c,f){var g=(screen.width-j)/2,b,a,d;b=(screen.height-c)/2;a="height="+c+",width="+j+",top="+b+",left="+g+",scrollbars="+f+",resizable";d=window.open(e,k,a);d.window.focus()};Joomla.tableOrdering=function(a,c,b,d){if(typeof(d)==="undefined"){d=document.getElementById("adminForm")}d.filter_order.value=a;d.filter_order_Dir.value=c;Joomla.submitform(b,d)};function writeDynaList(e,g,d,h,a){var c="\n ";document.writeln(c)}function changeDynaList(c,e,b,f,a){var d=document.adminForm[c];for(i in d.options.length){d.options[i]=null}i=0;for(x in e){if(e[x][0]==b){opt=new Option();opt.value=e[x][1];opt.text=e[x][2];if((f==b&&a==opt.value)||i==0){opt.selected=true}d.options[i++]=opt}}d.length=i}function radioGetCheckedValue(b){if(!b){return""}var c=b.length,a;if(c==undefined){if(b.checked){return b.value}else{return""}}for(a=0;a-1){return d.options[i].value}else{return null}}function listItemTask(g,b){var d=document.adminForm,c,e,a=d[g];if(a){for(c=0;true;c++){e=d["cb"+c];if(!e){break}e.checked=false}a.checked=true;d.boxchecked.value=1;submitbutton(b)}return false}function submitbutton(a){submitform(a)}function submitform(a){if(a){document.adminForm.task.value=a}if(typeof document.adminForm.onsubmit=="function"){document.adminForm.onsubmit()}if(typeof document.adminForm.fireEvent=="function"){document.adminForm.fireEvent("submit")}document.adminForm.submit()}function saveorder(b,a){checkAll_button(b,a)}function checkAll_button(d,a){if(!a){a="saveorder"}var b,c;for(b=0;b<=d;b++){c=document.adminForm["cb"+b];if(c){if(c.checked==false){c.checked=true}}else{alert("You cannot change the order of items, as an item in the list is `Checked Out`");return}}submitform(a)}; From a47c1fe6b775da9b590a299faa5df4020c269775 Mon Sep 17 00:00:00 2001 From: Ashan Fernando Date: Tue, 24 Sep 2013 02:12:20 +0530 Subject: [PATCH 6/6] Task:Core Fix issue with invalid characters in validation message --- media/system/js/core-uncompressed.js | 2 +- media/system/js/core.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/media/system/js/core-uncompressed.js b/media/system/js/core-uncompressed.js index 857a0a7ff618e..5db2334a285b2 100644 --- a/media/system/js/core-uncompressed.js +++ b/media/system/js/core-uncompressed.js @@ -142,7 +142,7 @@ Joomla.renderMessages = function(messages) { $divList = $('

'); $.each(item, function(index, item) { $p = $('

', { - text : item + html : item }); $divList.append($p); }); diff --git a/media/system/js/core.js b/media/system/js/core.js index d6f79067000e4..c708a00e586aa 100644 --- a/media/system/js/core.js +++ b/media/system/js/core.js @@ -1,4 +1,4 @@ /* GNU General Public License version 2 or later; see LICENSE.txt */ -Joomla=window.Joomla||{};Joomla.editors={};Joomla.editors.instances={};Joomla.submitform=function(a,b){if(typeof(b)==="undefined"){b=document.getElementById("adminForm")}if(typeof(a)!=="undefined"){b.task.value=a}if(typeof b.onsubmit=="function"){b.onsubmit()}if(typeof b.fireEvent=="function"){b.fireEvent("submit")}b.submit()};Joomla.submitbutton=function(a){Joomla.submitform(a)};Joomla.JText={strings:{},_:function(a,b){return typeof this.strings[a.toUpperCase()]!=="undefined"?this.strings[a.toUpperCase()]:b},load:function(a){for(var b in a){this.strings[b.toUpperCase()]=a[b]}return this}};Joomla.replaceTokens=function(c){var b=document.getElementsByTagName("input"),a;for(a=0;a",{id:"system-message","class":"alert alert-"+h});g.append(b);a=e("

",{"class":"alert-heading",text:Joomla.JText._(h)});b.append(a);f=e("
");e.each(j,function(k,l){c=e("

",{text:l});f.append(c)});b.append(f)})};Joomla.removeMessages=function(){jQuery("#system-message-container").empty()};Joomla.isChecked=function(a,b){if(typeof(b)==="undefined"){b=document.getElementById("adminForm")}if(a==true){b.boxchecked.value++}else{b.boxchecked.value--}};Joomla.popupWindow=function(e,k,j,c,f){var g=(screen.width-j)/2,b,a,d;b=(screen.height-c)/2;a="height="+c+",width="+j+",top="+b+",left="+g+",scrollbars="+f+",resizable";d=window.open(e,k,a);d.window.focus()};Joomla.tableOrdering=function(a,c,b,d){if(typeof(d)==="undefined"){d=document.getElementById("adminForm")}d.filter_order.value=a;d.filter_order_Dir.value=c;Joomla.submitform(b,d)};function writeDynaList(e,g,d,h,a){var c="\n ";document.writeln(c)}function changeDynaList(c,e,b,f,a){var d=document.adminForm[c];for(i in d.options.length){d.options[i]=null}i=0;for(x in e){if(e[x][0]==b){opt=new Option();opt.value=e[x][1];opt.text=e[x][2];if((f==b&&a==opt.value)||i==0){opt.selected=true}d.options[i++]=opt}}d.length=i}function radioGetCheckedValue(b){if(!b){return""}var c=b.length,a;if(c==undefined){if(b.checked){return b.value}else{return""}}for(a=0;a-1){return d.options[i].value}else{return null}}function listItemTask(g,b){var d=document.adminForm,c,e,a=d[g];if(a){for(c=0;true;c++){e=d["cb"+c];if(!e){break}e.checked=false}a.checked=true;d.boxchecked.value=1;submitbutton(b)}return false}function submitbutton(a){submitform(a)}function submitform(a){if(a){document.adminForm.task.value=a}if(typeof document.adminForm.onsubmit=="function"){document.adminForm.onsubmit()}if(typeof document.adminForm.fireEvent=="function"){document.adminForm.fireEvent("submit")}document.adminForm.submit()}function saveorder(b,a){checkAll_button(b,a)}function checkAll_button(d,a){if(!a){a="saveorder"}var b,c;for(b=0;b<=d;b++){c=document.adminForm["cb"+b];if(c){if(c.checked==false){c.checked=true}}else{alert("You cannot change the order of items, as an item in the list is `Checked Out`");return}}submitform(a)}; +Joomla=window.Joomla||{};Joomla.editors={};Joomla.editors.instances={};Joomla.submitform=function(a,b){if(typeof(b)==="undefined"){b=document.getElementById("adminForm")}if(typeof(a)!=="undefined"){b.task.value=a}if(typeof b.onsubmit=="function"){b.onsubmit()}if(typeof b.fireEvent=="function"){b.fireEvent("submit")}b.submit()};Joomla.submitbutton=function(a){Joomla.submitform(a)};Joomla.JText={strings:{},_:function(a,b){return typeof this.strings[a.toUpperCase()]!=="undefined"?this.strings[a.toUpperCase()]:b},load:function(a){for(var b in a){this.strings[b.toUpperCase()]=a[b]}return this}};Joomla.replaceTokens=function(c){var b=document.getElementsByTagName("input"),a;for(a=0;a",{id:"system-message","class":"alert alert-"+h});g.append(b);a=e("

",{"class":"alert-heading",text:Joomla.JText._(h)});b.append(a);f=e("
");e.each(j,function(k,l){c=e("

",{html:l});f.append(c)});b.append(f)})};Joomla.removeMessages=function(){jQuery("#system-message-container").empty()};Joomla.isChecked=function(a,b){if(typeof(b)==="undefined"){b=document.getElementById("adminForm")}if(a==true){b.boxchecked.value++}else{b.boxchecked.value--}};Joomla.popupWindow=function(e,k,j,c,f){var g=(screen.width-j)/2,b,a,d;b=(screen.height-c)/2;a="height="+c+",width="+j+",top="+b+",left="+g+",scrollbars="+f+",resizable";d=window.open(e,k,a);d.window.focus()};Joomla.tableOrdering=function(a,c,b,d){if(typeof(d)==="undefined"){d=document.getElementById("adminForm")}d.filter_order.value=a;d.filter_order_Dir.value=c;Joomla.submitform(b,d)};function writeDynaList(e,g,d,h,a){var c="\n ";document.writeln(c)}function changeDynaList(c,e,b,f,a){var d=document.adminForm[c];for(i in d.options.length){d.options[i]=null}i=0;for(x in e){if(e[x][0]==b){opt=new Option();opt.value=e[x][1];opt.text=e[x][2];if((f==b&&a==opt.value)||i==0){opt.selected=true}d.options[i++]=opt}}d.length=i}function radioGetCheckedValue(b){if(!b){return""}var c=b.length,a;if(c==undefined){if(b.checked){return b.value}else{return""}}for(a=0;a-1){return d.options[i].value}else{return null}}function listItemTask(g,b){var d=document.adminForm,c,e,a=d[g];if(a){for(c=0;true;c++){e=d["cb"+c];if(!e){break}e.checked=false}a.checked=true;d.boxchecked.value=1;submitbutton(b)}return false}function submitbutton(a){submitform(a)}function submitform(a){if(a){document.adminForm.task.value=a}if(typeof document.adminForm.onsubmit=="function"){document.adminForm.onsubmit()}if(typeof document.adminForm.fireEvent=="function"){document.adminForm.fireEvent("submit")}document.adminForm.submit()}function saveorder(b,a){checkAll_button(b,a)}function checkAll_button(d,a){if(!a){a="saveorder"}var b,c;for(b=0;b<=d;b++){c=document.adminForm["cb"+b];if(c){if(c.checked==false){c.checked=true}}else{alert("You cannot change the order of items, as an item in the list is `Checked Out`");return}}submitform(a)};