Commit e9f40581 authored by alexeyomelchenko's avatar alexeyomelchenko Committed by Robert Lyon

BUG:1660808 Remove MochiKit libraries from Mahara

* remove mochikit libraries
* remove refs to these libraries
* fix code where still referencing to mochikit

Change-Id: I7bc78e4dade362035c3a7fe482ff66b30200f003
behatnotneeded: same functionality
Signed-off-by: default avataralexeyomelchenko <alexeyomelchenko@catalyst.net.nz>
parent dacb2049
......@@ -303,7 +303,7 @@ foreach ($all as $k => $v) {
'class' => 'last with-text-input',
'title' => $v['title'],
'defaultvalue' => in_array($k, $active),
'onclick' => "getElement('footerlinks_{$k}_link').disabled = !this.checked;",
'onclick' => "jQuery('#footerlinks_{$k}_link')[0].disabled = !this.checked;",
);
$footerelements[$k . '_link'] = array(
'type' => 'text',
......
......@@ -98,7 +98,7 @@ var FileBrowser = (function($) {
$('#' + self.id+'_upload_messages').append($('<div>', {'class':'error'}), get_string('youmustagreetothecopyrightnotice'));
return false;
}
return !isEmpty($('#' + self.id + '_userfile').val());
return !$.isEmptyObject($('#' + self.id + '_userfile').val());
};
this.upload_presubmit_dropzone = function (e) {
......@@ -811,7 +811,7 @@ var FileBrowser = (function($) {
filelink = self.filedata[id].title;
}
else {
filelink = A({'href':self.config.wwwroot + 'artefact/file/download.php?file=' + id}, self.filedata[id].title);
filelink = $('<a>', {'href':self.config.wwwroot + 'artefact/file/download.php?file=' + id}).append(self.filedata[id].title);
}
fileIconImg = '';
......
......@@ -175,7 +175,7 @@ jQuery(function($) {
$(form).find('input.checkbox').each(function () {
var id = $(this).prop('name').match(/\d+/)[0];
if ($(this).prop('checked')) {
var counts = $(this).prop('value').value.split(',', 3);
var counts = $(this).prop('value').split(',', 3);
var warn = '';
if (counts[0] > 0) {
warn += {$profileiconattachedtoportfolioitems} + ' ';
......
......@@ -210,7 +210,7 @@ jQuery('#chooseartefactlink').on('click', function(e) {
// if the artefact chooser is hidden, use paginator p to populate it, then toggle its visibility
if (jQuery('#instconf_artefactid_container').hasClass('hidden')) {
var queryData = [];
queryData.extradata = serializeJSON(p.extraData);
queryData.extradata = JSON.stringify(p.extraData);
p.sendQuery(queryData, true);
}
jQuery('#instconf_artefactid_container').toggleClass('hidden');
......@@ -245,7 +245,7 @@ if (jQuery('#instconf_license').length) {
jQuery('#instconf_license').removeClass('hidden');
}
if (jQuery('#instconf_license_advanced_container').length) {
removeElementClass(getFirstElementByTagAndClassName('div', null, 'instconf_license_advanced_container'), 'hidden');
jQuery('#instconf_license_advanced_container div').first().removeClass('hidden');
}
jQuery(function() {
jQuery('#instconf_tags').on('change', function() {
......
......@@ -15,7 +15,7 @@
and add it to window scope.*/
if (typeof pieform_element_checkboxes_update === 'undefined') {
window.pieform_element_checkboxes_update = function (p, v) {
forEach(getElementsByTagAndClassName('input', 'checkboxes', p), function(e) {
jQuery(p).find('input.checkboxes').each(function(i, e) {
if (!e.disabled) {
e.checked = v;
}
......
......@@ -34,7 +34,7 @@ if ($USER->is_logged_in()) {
$javascript = array('paginator');
$blocktype_js = $view->get_all_blocktype_javascript();
$javascript = array_merge($javascript, $blocktype_js['jsfiles']);
$inlinejs = "addLoadEvent( function() {\n" . join("\n", $blocktype_js['initjs']) . "\n});";
$inlinejs = "jQuery( function() {\n" . join("\n", $blocktype_js['initjs']) . "\n});";
$stylesheets = array();
$stylesheets = array_merge($stylesheets, $view->get_all_blocktype_css());
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/***
MochiKit.DateTime 1.4.2
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2005 Bob Ippolito. All rights Reserved.
***/
MochiKit.Base._deps('DateTime', ['Base']);
MochiKit.DateTime.NAME = "MochiKit.DateTime";
MochiKit.DateTime.VERSION = "1.4.2";
MochiKit.DateTime.__repr__ = function () {
return "[" + this.NAME + " " + this.VERSION + "]";
};
MochiKit.DateTime.toString = function () {
return this.__repr__();
};
/** @id MochiKit.DateTime.isoDate */
MochiKit.DateTime.isoDate = function (str) {
str = str + "";
if (typeof(str) != "string" || str.length === 0) {
return null;
}
var iso = str.split('-');
if (iso.length === 0) {
return null;
}
var date = new Date(iso[0], iso[1] - 1, iso[2]);
date.setFullYear(iso[0]);
date.setMonth(iso[1] - 1);
date.setDate(iso[2]);
return date;
};
MochiKit.DateTime._isoRegexp = /(\d{4,})(?:-(\d{1,2})(?:-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?(?:(Z)|([+-])(\d{1,2})(?::(\d{1,2}))?)?)?)?)?/;
/** @id MochiKit.DateTime.isoTimestamp */
MochiKit.DateTime.isoTimestamp = function (str) {
str = str + "";
if (typeof(str) != "string" || str.length === 0) {
return null;
}
var res = str.match(MochiKit.DateTime._isoRegexp);
if (typeof(res) == "undefined" || res === null) {
return null;
}
var year, month, day, hour, min, sec, msec;
year = parseInt(res[1], 10);
if (typeof(res[2]) == "undefined" || res[2] === '') {
return new Date(year);
}
month = parseInt(res[2], 10) - 1;
day = parseInt(res[3], 10);
if (typeof(res[4]) == "undefined" || res[4] === '') {
return new Date(year, month, day);
}
hour = parseInt(res[4], 10);
min = parseInt(res[5], 10);
sec = (typeof(res[6]) != "undefined" && res[6] !== '') ? parseInt(res[6], 10) : 0;
if (typeof(res[7]) != "undefined" && res[7] !== '') {
msec = Math.round(1000.0 * parseFloat("0." + res[7]));
} else {
msec = 0;
}
if ((typeof(res[8]) == "undefined" || res[8] === '') && (typeof(res[9]) == "undefined" || res[9] === '')) {
return new Date(year, month, day, hour, min, sec, msec);
}
var ofs;
if (typeof(res[9]) != "undefined" && res[9] !== '') {
ofs = parseInt(res[10], 10) * 3600000;
if (typeof(res[11]) != "undefined" && res[11] !== '') {
ofs += parseInt(res[11], 10) * 60000;
}
if (res[9] == "-") {
ofs = -ofs;
}
} else {
ofs = 0;
}
return new Date(Date.UTC(year, month, day, hour, min, sec, msec) - ofs);
};
/** @id MochiKit.DateTime.toISOTime */
MochiKit.DateTime.toISOTime = function (date, realISO/* = false */) {
if (typeof(date) == "undefined" || date === null) {
return null;
}
var hh = date.getHours();
var mm = date.getMinutes();
var ss = date.getSeconds();
var lst = [
((realISO && (hh < 10)) ? "0" + hh : hh),
((mm < 10) ? "0" + mm : mm),
((ss < 10) ? "0" + ss : ss)
];
return lst.join(":");
};
/** @id MochiKit.DateTime.toISOTimeStamp */
MochiKit.DateTime.toISOTimestamp = function (date, realISO/* = false*/) {
if (typeof(date) == "undefined" || date === null) {
return null;
}
var sep = realISO ? "T" : " ";
var foot = realISO ? "Z" : "";
if (realISO) {
date = new Date(date.getTime() + (date.getTimezoneOffset() * 60000));
}
return MochiKit.DateTime.toISODate(date) + sep + MochiKit.DateTime.toISOTime(date, realISO) + foot;
};
/** @id MochiKit.DateTime.toISODate */
MochiKit.DateTime.toISODate = function (date) {
if (typeof(date) == "undefined" || date === null) {
return null;
}
var _padTwo = MochiKit.DateTime._padTwo;
var _padFour = MochiKit.DateTime._padFour;
return [
_padFour(date.getFullYear()),
_padTwo(date.getMonth() + 1),
_padTwo(date.getDate())
].join("-");
};
/** @id MochiKit.DateTime.americanDate */
MochiKit.DateTime.americanDate = function (d) {
d = d + "";
if (typeof(d) != "string" || d.length === 0) {
return null;
}
var a = d.split('/');
return new Date(a[2], a[0] - 1, a[1]);
};
MochiKit.DateTime._padTwo = function (n) {
return (n > 9) ? n : "0" + n;
};
MochiKit.DateTime._padFour = function(n) {
switch(n.toString().length) {
case 1: return "000" + n; break;
case 2: return "00" + n; break;
case 3: return "0" + n; break;
case 4:
default:
return n;
}
};
/** @id MochiKit.DateTime.toPaddedAmericanDate */
MochiKit.DateTime.toPaddedAmericanDate = function (d) {
if (typeof(d) == "undefined" || d === null) {
return null;
}
var _padTwo = MochiKit.DateTime._padTwo;
return [
_padTwo(d.getMonth() + 1),
_padTwo(d.getDate()),
d.getFullYear()
].join('/');
};
/** @id MochiKit.DateTime.toAmericanDate */
MochiKit.DateTime.toAmericanDate = function (d) {
if (typeof(d) == "undefined" || d === null) {
return null;
}
return [d.getMonth() + 1, d.getDate(), d.getFullYear()].join('/');
};
MochiKit.DateTime.EXPORT = [
"isoDate",
"isoTimestamp",
"toISOTime",
"toISOTimestamp",
"toISODate",
"americanDate",
"toPaddedAmericanDate",
"toAmericanDate"
];
MochiKit.DateTime.EXPORT_OK = [];
MochiKit.DateTime.EXPORT_TAGS = {
":common": MochiKit.DateTime.EXPORT,
":all": MochiKit.DateTime.EXPORT
};
MochiKit.DateTime.__new__ = function () {
// MochiKit.Base.nameFunctions(this);
var base = this.NAME + ".";
for (var k in this) {
var o = this[k];
if (typeof(o) == 'function' && typeof(o.NAME) == 'undefined') {
try {
o.NAME = base + k;
} catch (e) {
// pass
}
}
}
};
MochiKit.DateTime.__new__();
if (typeof(MochiKit.Base) != "undefined") {
MochiKit.Base._exportSymbols(this, MochiKit.DateTime);
} else {
(function (globals, module) {
if ((typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined')
|| (MochiKit.__export__ === false)) {
var all = module.EXPORT_TAGS[":all"];
for (var i = 0; i < all.length; i++) {
globals[all[i]] = module[all[i]];
}
}
})(this, MochiKit.DateTime);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/***
MochiKit.MochiKit 1.4.2
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2005 Bob Ippolito. All rights Reserved.
***/
if (typeof(MochiKit) == 'undefined') {
MochiKit = {};
}
if (typeof(MochiKit.MochiKit) == 'undefined') {
/** @id MochiKit.MochiKit */
MochiKit.MochiKit = {};
}
MochiKit.MochiKit.NAME = "MochiKit.MochiKit";
MochiKit.MochiKit.VERSION = "1.4.2";
MochiKit.MochiKit.__repr__ = function () {
return "[" + this.NAME + " " + this.VERSION + "]";
};
/** @id MochiKit.MochiKit.toString */
MochiKit.MochiKit.toString = function () {
return this.__repr__();
};
/** @id MochiKit.MochiKit.SUBMODULES */
MochiKit.MochiKit.SUBMODULES = [
"Base",
"Iter",
"Logging",
"DateTime",
"Format",
"Async",
"DOM",
"Selector",
"Style",
"LoggingPane",
"Color",
"Signal",
"Position",
"Visual",
"DragAndDrop",
"Sortable"
];
if (typeof(JSAN) != 'undefined' || typeof(dojo) != 'undefined') {
if (typeof(dojo) != 'undefined') {
dojo.provide('MochiKit.MochiKit');
(function (lst) {
for (var i = 0; i < lst.length; i++) {
dojo.require("MochiKit." + lst[i]);
}
})(MochiKit.MochiKit.SUBMODULES);
}
if (typeof(JSAN) != 'undefined') {
(function (lst) {
for (var i = 0; i < lst.length; i++) {
JSAN.use("MochiKit." + lst[i], []);
}
})(MochiKit.MochiKit.SUBMODULES);
}
(function () {
var extend = MochiKit.Base.extend;
var self = MochiKit.MochiKit;
var modules = self.SUBMODULES;
var EXPORT = [];
var EXPORT_OK = [];
var EXPORT_TAGS = {};
var i, k, m, all;
for (i = 0; i < modules.length; i++) {
m = MochiKit[modules[i]];
extend(EXPORT, m.EXPORT);
extend(EXPORT_OK, m.EXPORT_OK);
for (k in m.EXPORT_TAGS) {
EXPORT_TAGS[k] = extend(EXPORT_TAGS[k], m.EXPORT_TAGS[k]);
}
all = m.EXPORT_TAGS[":all"];
if (!all) {
all = extend(null, m.EXPORT, m.EXPORT_OK);
}
var j;
for (j = 0; j < all.length; j++) {
k = all[j];
self[k] = m[k];
}
}
self.EXPORT = EXPORT;
self.EXPORT_OK = EXPORT_OK;
self.EXPORT_TAGS = EXPORT_TAGS;
}());
} else {
if (typeof(MochiKit.__compat__) == 'undefined') {
MochiKit.__compat__ = true;
}
(function () {
if (typeof(document) == "undefined") {
return;
}
var scripts = document.getElementsByTagName("script");
var kXHTMLNSURI = "http://www.w3.org/1999/xhtml";
var kSVGNSURI = "http://www.w3.org/2000/svg";
var kXLINKNSURI = "http://www.w3.org/1999/xlink";
var kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var base = null;
var baseElem = null;
var allScripts = {};
var i;
var src;
for (i = 0; i < scripts.length; i++) {
src = null;
switch (scripts[i].namespaceURI) {
case kSVGNSURI:
src = scripts[i].getAttributeNS(kXLINKNSURI, "href");
break;
/*
case null: // HTML
case '': // HTML
case kXHTMLNSURI:
case kXULNSURI:
*/
default:
src = scripts[i].getAttribute("src");
break;
}
if (!src) {
continue;
}
allScripts[src] = true;
if (src.match(/MochiKit.js(\?.*)?$/)) {
base = src.substring(0, src.lastIndexOf('MochiKit.js'));
baseElem = scripts[i];
}
}
if (base === null) {
return;
}
var modules = MochiKit.MochiKit.SUBMODULES;
for (var i = 0; i < modules.length; i++) {
if (MochiKit[modules[i]]) {
continue;
}
var uri = base + modules[i] + '.js';
if (uri in allScripts) {
continue;
}
if (baseElem.namespaceURI == kSVGNSURI ||
baseElem.namespaceURI == kXULNSURI) {
// SVG, XUL
/*
SVG does not support document.write, so if Safari wants to
support SVG tests it should fix its deferred loading bug
(see following below).
*/
var s = document.createElementNS(baseElem.namespaceURI, 'script');
s.setAttribute("id", "MochiKit_" + base + modules[i]);
if (baseElem.namespaceURI == kSVGNSURI) {
s.setAttributeNS(kXLINKNSURI, 'href', uri);
} else {
s.setAttribute('src', uri);
}
s.setAttribute("type", "application/x-javascript");
baseElem.parentNode.appendChild(s);
} else {
// HTML, XHTML
/*
DOM can not be used here because Safari does
deferred loading of scripts unless they are
in the document or inserted with document.write
This is not XHTML compliant. If you want XHTML
compliance then you must use the packed version of MochiKit
or include each script individually (basically unroll
these document.write calls into your XHTML source)
*/
document.write('<' + baseElem.nodeName + ' src="' + uri +
'" type="application/javascript"></script>');
}
};
})();
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
MochiKit in Mahara
==================
Website: http://mochikit.com/
Version: 1.4.2
MochiKit is used throughout the Mahara codebase to provide a standard
javascript library for all javascript-based code.
MochiKit modules we use:
* Base
* Format
* Iter
* Async
* Color
* DOM
* Logging
* Signal
* Style
* Position
* Visual
* DragAndDrop
Changes:
* [nigel] Patched hasElementClass to not cause an error if it is passed a text
node - http://trac.mochikit.com/ticket/330
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
dojo.kwCompoundRequire({
"common": [
"MochiKit.Base",
"MochiKit.Iter",
"MochiKit.Logging",
"MochiKit.DateTime",
"MochiKit.Format",
"MochiKit.Async",
"MochiKit.DOM",
"MochiKit.Style",
"MochiKit.LoggingPane",
"MochiKit.Color",
"MochiKit.Signal",
"MochiKit.Position",
"MochiKit.Visual"
]
});
dojo.provide("MochiKit.*");
......@@ -958,3 +958,47 @@ function createNodesFromList(node, list) {
return jQuery(node).html(text);
});
}
function parseQueryString(encodedString, useArrays) {
// strip a leading '?' from the encoded string
var qstr = (encodedString.charAt(0) == "?")
? encodedString.substring(1)
: encodedString;
var pairs = qstr.replace(/\+/g, "%20").split(/\&amp\;|\&\#38\;|\&#x26;|\&/);
var o = {};
var decode;
if (typeof(decodeURIComponent) != "undefined") {
decode = decodeURIComponent;
}
else
{
decode = unescape;
}
if (useArrays) {
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split("=");
var name = decode(pair.shift());
if (!name) {
continue;
}
var arr = o[name];
if (!(arr instanceof Array)) {
arr = [];
o[name] = arr;
}
arr.push(decode(pair.join("=")));
}
}
<