src/ztfy/myams/resources/js/myams.js
changeset 17 847adb5d49b1
parent 13 1d3b54126eb5
child 19 dc18d0700e39
equal deleted inserted replaced
16:0aff8587343b 17:847adb5d49b1
    58 
    58 
    59 	/**
    59 	/**
    60 	 * JQuery 'econtains' expression
    60 	 * JQuery 'econtains' expression
    61 	 * Case insensitive contains expression
    61 	 * Case insensitive contains expression
    62 	 */
    62 	 */
    63 	$.expr[":"].econtains = function(obj, index, meta, stack) {
    63 	$.expr[":"].econtains = function(obj, index, meta /*, stack*/) {
    64 		return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() == meta[3].toLowerCase();
    64 		return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() == meta[3].toLowerCase();
    65 	};
    65 	};
    66 
    66 
    67 
    67 
    68 	/**
    68 	/**
    69 	 * JQuery 'withtext' expression
    69 	 * JQuery 'withtext' expression
    70 	 * Case sensitive exact search expression
    70 	 * Case sensitive exact search expression
    71 	 */
    71 	 */
    72 	$.expr[":"].withtext = function(obj, index, meta, stack) {
    72 	$.expr[":"].withtext = function(obj, index, meta /*, stack*/) {
    73 		return (obj.textContent || obj.innerText || $(obj).text() || "") == meta[3];
    73 		return (obj.textContent || obj.innerText || $(obj).text() || "") == meta[3];
    74 	};
    74 	};
    75 
    75 
    76 
    76 
    77 	/**
    77 	/**
    78 	 * JQuery filter on parents class
    78 	 * JQuery filter on parents class
    79 	 */
    79 	 */
    80 	$.expr[':'].parents = function(obj, index, meta, stack) {
    80 	$.expr[':'].parents = function(obj, index, meta /*, stack*/) {
    81 		return $(obj).parents(meta[3]).length > 0;
    81 		return $(obj).parents(meta[3]).length > 0;
    82 	};
    82 	};
    83 
    83 
    84 
    84 
    85 	/**
    85 	/**
   281 		},
   281 		},
   282 
   282 
   283 		// public method for url decoding
   283 		// public method for url decoding
   284 		decode : function (utftext) {
   284 		decode : function (utftext) {
   285 			var string = "";
   285 			var string = "";
   286 			var i = 0;
   286 			var i = 0,
   287 			var c = c1 = c2 = 0;
   287 				c = 0,
       
   288 				c2 = 0,
       
   289 				c3 = 0;
   288 
   290 
   289 			while ( i < utftext.length ) {
   291 			while ( i < utftext.length ) {
   290 
   292 
   291 				c = utftext.charCodeAt(i);
   293 				c = utftext.charCodeAt(i);
   292 
   294 
   313 
   315 
   314 	/**
   316 	/**
   315 	 * MyAMS extensions to JQuery
   317 	 * MyAMS extensions to JQuery
   316 	 */
   318 	 */
   317 	if (window.MyAMS === undefined) {
   319 	if (window.MyAMS === undefined) {
   318 		MyAMS = {
   320 		window.MyAMS = {
   319 			devmode: true,
   321 			devmode: true,
   320 			throttle_delay: 350,
   322 			throttle_delay: 350,
   321 			menu_speed: 235,
   323 			menu_speed: 235,
   322 			navbar_height: 49,
   324 			navbar_height: 49,
   323 			ajax_nav: true,
   325 			ajax_nav: true,
   367 		}).join('');
   369 		}).join('');
   368 	};
   370 	};
   369 
   371 
   370 
   372 
   371 	/**
   373 	/**
       
   374 	 * Generate a random ID
       
   375 	 *
       
   376 	 * @param length
       
   377 	 */
       
   378 	MyAMS.generateId = function() {
       
   379 		function s4() {
       
   380 			return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
       
   381 		}
       
   382 		return s4() + s4() + s4() + s4();
       
   383 	};
       
   384 
       
   385 
       
   386 	/**
   372 	 * Get and execute a function given by name
   387 	 * Get and execute a function given by name
   373 	 * Small piece of code by Jason Bunting
   388 	 * Small piece of code by Jason Bunting
   374 	 */
   389 	 */
   375 	MyAMS.getFunctionByName = function(functionName, context) {
   390 	MyAMS.getFunctionByName = function(functionName, context) {
   376 		if (functionName === undefined)
   391 		if (functionName === undefined)
   377 			return undefined;
   392 			return undefined;
   378 		else if (typeof(functionName) == 'function')
   393 		else if (typeof(functionName) == 'function')
   379 			return functionName;
   394 			return functionName;
   380 		var namespaces = functionName.split(".");
   395 		var namespaces = functionName.split(".");
   381 		var func = namespaces.pop();
   396 		var func = namespaces.pop();
   382 		var context = (context === undefined || context === null) ? window : context;
   397 		context = (context === undefined || context === null) ? window : context;
   383 		for (var i=0; i < namespaces.length; i++) {
   398 		for (var i=0; i < namespaces.length; i++) {
   384 			try {
   399 			try {
   385 				context = context[namespaces[i]];
   400 				context = context[namespaces[i]];
   386 			} catch (e) {
   401 			} catch (e) {
   387 				return undefined;
   402 				return undefined;
   407 	 * Get script or CSS file using browser cache
   422 	 * Get script or CSS file using browser cache
   408 	 * Script or CSS URLs can include variable names, given between braces, as in
   423 	 * Script or CSS URLs can include variable names, given between braces, as in
   409 	 * {MyAMS.baseURL}
   424 	 * {MyAMS.baseURL}
   410 	 */
   425 	 */
   411 	MyAMS.getSource = function(url) {
   426 	MyAMS.getSource = function(url) {
   412 		var src = url.replace(/{[^{}]*}/g, function(match) {
   427 		return url.replace(/{[^{}]*}/g, function(match) {
   413 			return ams.getFunctionByName(match.substr(1, match.length-2));
   428 			return ams.getFunctionByName(match.substr(1, match.length-2));
   414 		});
   429 		});
   415 		return src;
       
   416 	};
   430 	};
   417 
   431 
   418 	MyAMS.getScript = function(url, callback, options) {
   432 	MyAMS.getScript = function(url, callback, options) {
   419 		var defaults = {
   433 		var defaults = {
   420 			dataType: 'script',
   434 			dataType: 'script',
   446 	 */
   460 	 */
   447 	MyAMS.event = {
   461 	MyAMS.event = {
   448 
   462 
   449 		stop: function(event) {
   463 		stop: function(event) {
   450 			if (!event) {
   464 			if (!event) {
   451 				var event = window.event;
   465 				event = window.event;
   452 			}
   466 			}
   453 			if (event) {
   467 			if (event) {
   454 				if (event.stopPropagation) {
   468 				if (event.stopPropagation) {
   455 					event.stopPropagation();
   469 					event.stopPropagation();
   456 					event.preventDefault();
   470 					event.preventDefault();
   511 	MyAMS.error = {
   525 	MyAMS.error = {
   512 
   526 
   513 		/**
   527 		/**
   514 		 * Default JQuery AJAX error handler
   528 		 * Default JQuery AJAX error handler
   515 		 */
   529 		 */
   516 		ajax: function(event, request, settings) {
   530 		ajax: function(event, request /*, settings*/) {
   517 			if (request.statusText == 'OK')
   531 			if (request.statusText == 'OK')
   518 				return;
   532 				return;
   519 			ams.skin.messageBox('error', {
   533 			ams.skin.messageBox('error', {
   520 				title: ams.i18n.ERROR_OCCURED,
   534 				title: ams.i18n.ERROR_OCCURED,
   521 				content: '<h4>' + event.type + '</h4><p>' + request.statusText + '</p>',
   535 				content: '<h4>' + event.type + '</h4><p>' + request.statusText + '</p>',
   563 		 *   or if the requested object was already loaded (false)
   577 		 *   or if the requested object was already loaded (false)
   564 		 * @options: callback options
   578 		 * @options: callback options
   565 		 */
   579 		 */
   566 		check: function(checker, source, callback, options) {
   580 		check: function(checker, source, callback, options) {
   567 			if (typeof(callback) == 'object') {
   581 			if (typeof(callback) == 'object') {
   568 				var options = callback;
   582 				options = callback;
   569 				var callback = undefined;
   583 				callback = undefined;
   570 			}
   584 			}
   571 			var defaults = {
   585 			var defaults = {
   572 				async: typeof(callback) == 'function'
   586 				async: typeof(callback) == 'function'
   573 			};
   587 			};
   574 			var settings = $.extend({}, defaults, options);
   588 			var settings = $.extend({}, defaults, options);
   609 				callback = options.callback;
   623 				callback = options.callback;
   610 			if (typeof(callback) == 'string')
   624 			if (typeof(callback) == 'string')
   611 				callback = ams.getFunctionByName(callback);
   625 				callback = ams.getFunctionByName(callback);
   612 			delete options.callback;
   626 			delete options.callback;
   613 
   627 
   614 			var result;
   628 			var result = undefined;
   615 			var defaults = {
   629 			var defaults = {
   616 				url: addr,
   630 				url: addr,
   617 				type: 'post',
   631 				type: 'post',
   618 				cache: false,
   632 				cache: false,
   619 				async: typeof(callback) == 'function',
   633 				async: typeof(callback) == 'function',
   620 				data: $.param(data, true),
   634 				data: $.param(data, true),
   621 				dataType: 'json',
   635 				dataType: 'json',
   622 				success: callback || function(data, status) {
   636 				success: callback || function(data /*, status*/) {
   623 					result = data.result;
   637 					result = data.result;
   624 				},
   638 				},
   625 				error: ams.error.show
   639 				error: ams.error.show
   626 			};
   640 			};
   627 			var settings = $.extend({}, defaults, options);
   641 			var settings = $.extend({}, defaults, options);
   631 
   645 
   632 		/**
   646 		/**
   633 		 * Extract data type and result from response
   647 		 * Extract data type and result from response
   634 		 */
   648 		 */
   635 		getResponse: function(request) {
   649 		getResponse: function(request) {
   636 			var content_type = request.getResponseHeader('content-type');
   650 			var content_type = request.getResponseHeader('content-type'),
       
   651 				data_type,
       
   652 				result;
   637 			if (content_type.startsWith('application/javascript')) {
   653 			if (content_type.startsWith('application/javascript')) {
   638 				data_type = 'script';
   654 				data_type = 'script';
   639 				result = request.responseText;
   655 				result = request.responseText;
   640 			} else if (content_type.startsWith('text/html')) {
   656 			} else if (content_type.startsWith('text/html')) {
   641 				data_type = 'html';
   657 				data_type = 'html';
   681 		 *
   697 		 *
   682 		 * For errors data structure, please see MyAMS.form.showErrors function
   698 		 * For errors data structure, please see MyAMS.form.showErrors function
   683 		 */
   699 		 */
   684 		handleJSON: function(result, form) {
   700 		handleJSON: function(result, form) {
   685 			var status = result.status;
   701 			var status = result.status;
       
   702 			var url;
   686 			switch (status) {
   703 			switch (status) {
   687 				case 'error':
   704 				case 'error':
   688 					ams.form.showErrors(form, result);
   705 					ams.form.showErrors(form, result);
   689 					break;
   706 					break;
   690 				case 'success':
   707 				case 'success':
   703 					ams.dialog.open(result.location);
   720 					ams.dialog.open(result.location);
   704 					break;
   721 					break;
   705 				case 'reload':
   722 				case 'reload':
   706 					if (result.close_form != false)
   723 					if (result.close_form != false)
   707 						ams.dialog.close(form);
   724 						ams.dialog.close(form);
   708 					var url = result.location;
   725 					url = result.location;
   709 					if (url.startsWith('#'))
   726 					if (url.startsWith('#'))
   710 						ams.skin.loadURL(url.substr(1), result.target || '#content');
   727 						ams.skin.loadURL(url.substr(1), result.target || '#content');
   711 					else
   728 					else
   712 						ams.skin.loadURL(url, result.target || '#content');
   729 						ams.skin.loadURL(url, result.target || '#content');
   713 					break;
   730 					break;
   714 				case 'redirect':
   731 				case 'redirect':
   715 					var url = result.location;
   732 					url = result.location;
   716 					if (result.window) {
   733 					if (result.window) {
   717 						window.open(url, result.window, result.options);
   734 						window.open(url, result.window, result.options);
   718 					} else {
   735 					} else {
   719 						window.location.href = url;
   736 						window.location.href = url;
   720 					}
   737 					}
   887 		/**
   904 		/**
   888 		 * Submit given form
   905 		 * Submit given form
   889 		 */
   906 		 */
   890 		submit: function(form, handler, submit_options) {
   907 		submit: function(form, handler, submit_options) {
   891 			// Check params
   908 			// Check params
   892 			var form = $(form);
   909 			form = $(form);
   893 			if (!form.exists())
   910 			if (!form.exists())
   894 				return false;
   911 				return false;
   895 			if (typeof(handler) == 'object') {
   912 			if (typeof(handler) == 'object') {
   896 				submit_options = handler;
   913 				submit_options = handler;
   897 				handler = undefined;
   914 				handler = undefined;
   972 										url: url,
   989 										url: url,
   973 										type: 'post',
   990 										type: 'post',
   974 										cache: false,
   991 										cache: false,
   975 										data: form_data,
   992 										data: form_data,
   976 										dataType: data.amsFormDatatype,
   993 										dataType: data.amsFormDatatype,
   977 										beforeSerialize: function(form, options) {
   994 										beforeSerialize: function(/*form, options*/) {
   978 											if (typeof(tinyMCE) != 'undefined')
   995 											if (typeof(tinyMCE) != 'undefined')
   979 												tinyMCE.triggerSave();
   996 												tinyMCE.triggerSave();
   980 										},
   997 										},
   981 										beforeSubmit: function(data, form, options) {
   998 										beforeSubmit: function(data, form /*, options*/) {
   982 											form.data('submitted', true);
   999 											form.data('submitted', true);
   983 										},
  1000 										},
   984 										error: function(request, status, error) {
  1001 										error: function(request, status, error) {
   985 											ams.error.show(request, status, error);
  1002 											ams.error.show(request, status, error);
   986 											if (form.is(':visible')) {
  1003 											if (form.is(':visible')) {
  1219 				var header = errors.length == 1 ? ams.i18n.ERROR_OCCURED : ams.i18n.ERRORS_OCCURED;
  1236 				var header = errors.length == 1 ? ams.i18n.ERROR_OCCURED : ams.i18n.ERRORS_OCCURED;
  1220 				ams.skin.alert(form, 'error', header, errors);
  1237 				ams.skin.alert(form, 'error', header, errors);
  1221 			} else {
  1238 			} else {
  1222 				header = errors.widgets && (errors.widgets.length > 1) ? ams.i18n.ERRORS_OCCURED : ams.i18n.ERROR_OCCURED;
  1239 				header = errors.widgets && (errors.widgets.length > 1) ? ams.i18n.ERRORS_OCCURED : ams.i18n.ERROR_OCCURED;
  1223 				var message = new Array();
  1240 				var message = new Array();
  1224 				for (var index in errors.messages) {
  1241 				var index;
       
  1242 				for (index in errors.messages) {
  1225 					if (!$.isNumeric(index))
  1243 					if (!$.isNumeric(index))
  1226 						continue;
  1244 						continue;
  1227 					message.push(errors.messages[index])
  1245 					message.push(errors.messages[index].message || errors.messages[index]);
  1228 				}
  1246 				}
  1229 				for (index in errors.widgets) {
  1247 				for (index in errors.widgets) {
  1230 					if (!$.isNumeric(index))
  1248 					if (!$.isNumeric(index))
  1231 						continue;
  1249 						continue;
  1232 					var widget = errors.widgets[index];
  1250 					var widget = errors.widgets[index];
  1491 				if (typeof(plugin) == 'function')
  1509 				if (typeof(plugin) == 'function')
  1492 					plugin(element);
  1510 					plugin(element);
  1493 			}
  1511 			}
  1494 
  1512 
  1495 			// Load, run and register new plug-ins
  1513 			// Load, run and register new plug-ins
       
  1514 			var name;
  1496 			$('[data-ams-plugins]', element).each(function() {
  1515 			$('[data-ams-plugins]', element).each(function() {
  1497 				var source = $(this);
  1516 				var source = $(this);
  1498 				var plugins = {}
  1517 				var plugins = {}
  1499 				if (typeof(source.data('ams-plugins')) === 'string') {
  1518 				if (typeof(source.data('ams-plugins')) === 'string') {
  1500 					var names = source.data('ams-plugins').split(/\s+/);
  1519 					var names = source.data('ams-plugins').split(/\s+/);
  1501 					for (var index in names) {
  1520 					for (var index in names) {
  1502 						var name = names[index];
  1521 						name = names[index];
  1503 						var plugin_options = {
  1522 						var plugin_options = {
  1504 							src: source.data('ams-plugin-' + name + '-src'),
  1523 							src: source.data('ams-plugin-' + name + '-src'),
  1505 							css: source.data('ams-plugin-' + name + '-css'),
  1524 							css: source.data('ams-plugin-' + name + '-css'),
  1506 							callback: source.data('ams-plugin-' + name + '-callback'),
  1525 							callback: source.data('ams-plugin-' + name + '-callback'),
  1507 							register: source.data('ams-plugin-' + name + '-register'),
  1526 							register: source.data('ams-plugin-' + name + '-register'),
  1510 						plugins[name] = plugin_options;
  1529 						plugins[name] = plugin_options;
  1511 					}
  1530 					}
  1512 				} else {
  1531 				} else {
  1513 					plugins = source.data('ams-plugins');
  1532 					plugins = source.data('ams-plugins');
  1514 				}
  1533 				}
  1515 				for (var name in plugins) {
  1534 				for (name in plugins) {
  1516 					if (ams.plugins.enabled[name] === undefined) {
  1535 					if (ams.plugins.enabled[name] === undefined) {
  1517 						var plugin = plugins[name];
  1536 						var plugin = plugins[name];
  1518 						ams.getScript(plugin.src, function() {
  1537 						ams.getScript(plugin.src, function() {
  1519 							var callback = plugin.callback;
  1538 							var callback = plugin.callback;
  1520 							if (callback) {
  1539 							if (callback) {
  1651 					var data = legend.data();
  1670 					var data = legend.data();
  1652 					if (!data.amsChecker) {
  1671 					if (!data.amsChecker) {
  1653 						var checker = $('<label class="checkbox"></label>');
  1672 						var checker = $('<label class="checkbox"></label>');
  1654 						var input = $('<input type="checkbox">').attr('name', data.amsCheckerFieldname)
  1673 						var input = $('<input type="checkbox">').attr('name', data.amsCheckerFieldname)
  1655 																.attr('id', (data.amsCheckerFieldname ||
  1674 																.attr('id', (data.amsCheckerFieldname ||
  1656 																			 ('checker_'+(+new Date()).toString())).replace(/\./, '_'))
  1675 																			 ('checker_'+ams.generateId())).replace(/\./, '_'))
  1657 																.val(data.amsCheckerState == 'on')
  1676 																.val(data.amsCheckerState == 'on')
  1658 																.on('change', function(e) {
  1677 																.on('change', function(e) {
       
  1678 																	e.preventDefault();
       
  1679 																	var veto = {};
       
  1680 																	legend.trigger('ams.checker.before-switch', [legend, veto]);
       
  1681 																	if (veto.veto)
       
  1682 																		return;
  1659 																	if ($(this).is(':checked')) {
  1683 																	if ($(this).is(':checked')) {
  1660 																		if (data.amsCheckerMode == 'disable')
  1684 																		if (data.amsCheckerMode == 'disable')
  1661 																			fieldset.removeAttr('disabled')
  1685 																			fieldset.removeAttr('disabled')
  1662 																		else
  1686 																		else
  1663 																			fieldset.removeClass('switched')
  1687 																			fieldset.removeClass('switched');
       
  1688 																		legend.trigger('ams.checker.opened', [legend]);
  1664 																	} else {
  1689 																	} else {
  1665 																		if (data.amsCheckerMode == 'disable')
  1690 																		if (data.amsCheckerMode == 'disable')
  1666 																			fieldset.attr('disabled', 'disabled');
  1691 																			fieldset.attr('disabled', 'disabled');
  1667 																		else
  1692 																		else
  1668 																			fieldset.addClass('switched');
  1693 																			fieldset.addClass('switched');
       
  1694 																		legend.trigger('ams.checker.closed', [legend]);
  1669 																	}
  1695 																	}
  1670 																})
  1696 																})
  1671 																.appendTo(checker);
  1697 																.appendTo(checker);
  1672 						$('.legend', legend).attr('for', input.attr('id'));
  1698 						$('.legend', legend).attr('for', input.attr('id'));
  1673 						checker.append('<i></i>')
  1699 						checker.append('<i></i>')
  2062 													$('.ColVis_Button').addClass('btn btn-default btn-sm')
  2088 													$('.ColVis_Button').addClass('btn btn-default btn-sm')
  2063 																	   .html((ams.plugins.i18n.datatables.sColumns || "Columns") + ' <i class="fa fa-fw fa-caret-down"></i>');
  2089 																	   .html((ams.plugins.i18n.datatables.sColumns || "Columns") + ' <i class="fa fa-fw fa-caret-down"></i>');
  2064 												}
  2090 												}
  2065 											};
  2091 											};
  2066 											var settings = $.extend({}, data_options, data.amsDatatableOptions);
  2092 											var settings = $.extend({}, data_options, data.amsDatatableOptions);
       
  2093 											var index;
  2067 											if (extensions.length > 0) {
  2094 											if (extensions.length > 0) {
  2068 												for (var index in extensions) {
  2095 												for (index in extensions) {
  2069 													switch (extensions[index]) {
  2096 													switch (extensions[index]) {
  2070 														case 'autofill':
  2097 														case 'autofill':
  2071 															ams.ajax.check($.fn.dataTable.AutoFill,
  2098 															ams.ajax.check($.fn.dataTable.AutoFill,
  2072 																		   ams.baseURL + 'ext/jquery-dataTables-autoFill' + (ams.devmode ? '.js' : '.min.js'));
  2099 																		   ams.baseURL + 'ext/jquery-dataTables-autoFill' + (ams.devmode ? '.js' : '.min.js'));
  2073 															break;
  2100 															break;
  2123 											}
  2150 											}
  2124 											settings = ams.executeFunctionByName(data.amsDatatableInitCallback, table, settings) || settings;
  2151 											settings = ams.executeFunctionByName(data.amsDatatableInitCallback, table, settings) || settings;
  2125 											var plugin = table.dataTable(settings);
  2152 											var plugin = table.dataTable(settings);
  2126 											ams.executeFunctionByName(data.amsDatatableAfterInitCallback, table, plugin, settings);
  2153 											ams.executeFunctionByName(data.amsDatatableAfterInitCallback, table, plugin, settings);
  2127 											if (extensions.length > 0) {
  2154 											if (extensions.length > 0) {
  2128 												for (var index in extensions) {
  2155 												for (index in extensions) {
  2129 													switch(extensions[index]) {
  2156 													switch(extensions[index]) {
  2130 														case 'autofill':
  2157 														case 'autofill':
  2131 															var af_settings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill);
  2158 															var af_settings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill);
  2132 															af_settings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, af_settings) || af_settings;
  2159 															af_settings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, af_settings) || af_settings;
  2133 															table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined
  2160 															table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined
  2490 		 * @margin: if true, a margin will be displayed around alert
  2517 		 * @margin: if true, a margin will be displayed around alert
  2491 		 */
  2518 		 */
  2492 		alert: function(parent, status, header, message, subtitle, margin) {
  2519 		alert: function(parent, status, header, message, subtitle, margin) {
  2493 			$('.alert', parent).remove();
  2520 			$('.alert', parent).remove();
  2494 			if (status == 'error')
  2521 			if (status == 'error')
  2495 				var status = 'danger';
  2522 				status = 'danger';
  2496 			var content = '<div class="' + (margin ? 'margin-10' : '') + ' alert alert-block alert-' + status + ' fade in">' +
  2523 			var content = '<div class="' + (margin ? 'margin-10' : '') + ' alert alert-block alert-' + status + ' fade in">' +
  2497 							'<a class="close" data-dismiss="alert"><i class="fa fa-check"></i></a>' +
  2524 							'<a class="close" data-dismiss="alert"><i class="fa fa-check"></i></a>' +
  2498 							'<h4 class="alert-heading">' +
  2525 							'<h4 class="alert-heading">' +
  2499 								'<i class="fa fa-fw fa-warning"></i> ' + header +
  2526 								'<i class="fa fa-fw fa-warning"></i> ' + header +
  2500 							'</h4>' +
  2527 							'</h4>' +
  2534 		/**
  2561 		/**
  2535 		 * Medium notification message box, displayed on page's bottom right
  2562 		 * Medium notification message box, displayed on page's bottom right
  2536 		 */
  2563 		 */
  2537 		messageBox: function(status, options, callback) {
  2564 		messageBox: function(status, options, callback) {
  2538 			if (typeof(status) == 'object') {
  2565 			if (typeof(status) == 'object') {
  2539 				var callback = options;
  2566 				callback = options;
  2540 				var options = status || {};
  2567 				options = status || {};
  2541 				var status = 'info';
  2568 				status = 'info';
  2542 			}
  2569 			}
  2543 			ams.ajax.check(ams.notify,
  2570 			ams.ajax.check(ams.notify,
  2544 						   ams.baseURL + 'myams-notify' + (ams.devmode ? '.js' : '.min.js'),
  2571 						   ams.baseURL + 'myams-notify' + (ams.devmode ? '.js' : '.min.js'),
  2545 						   function() {
  2572 						   function() {
  2546 								switch (status) {
  2573 								switch (status) {
  2565 		/**
  2592 		/**
  2566 		 * Small notification message box, displayed on page's top right
  2593 		 * Small notification message box, displayed on page's top right
  2567 		 */
  2594 		 */
  2568 		smallBox: function(status, options, callback) {
  2595 		smallBox: function(status, options, callback) {
  2569 			if (typeof(status) == 'object') {
  2596 			if (typeof(status) == 'object') {
  2570 				var callback = options;
  2597 				callback = options;
  2571 				var options = status || {};
  2598 				options = status || {};
  2572 				var status = 'info';
  2599 				status = 'info';
  2573 			}
  2600 			}
  2574 			ams.ajax.check(ams.notify,
  2601 			ams.ajax.check(ams.notify,
  2575 						   ams.baseURL + 'myams-notify' + (ams.devmode ? '.js' : '.min.js'),
  2602 						   ams.baseURL + 'myams-notify' + (ams.devmode ? '.js' : '.min.js'),
  2576 						   function() {
  2603 						   function() {
  2577 								switch (status) {
  2604 								switch (status) {
  2672 			}
  2699 			}
  2673 			if (typeof(options) == 'function') {
  2700 			if (typeof(options) == 'function') {
  2674 				callback = options;
  2701 				callback = options;
  2675 				options = {};
  2702 				options = {};
  2676 			}
  2703 			}
  2677 			var container = $(container);
  2704 			container = $(container);
  2678 			var defaults = {
  2705 			var defaults = {
  2679 				type: 'GET',
  2706 				type: 'GET',
  2680 				url: url,
  2707 				url: url,
  2681 				dataType: 'html',
  2708 				dataType: 'html',
  2682 				cache: false,
  2709 				cache: false,