2013-06-13 19:25:34 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>JSDoc: Source: backend.js</title>
|
|
|
|
|
|
|
|
<script src="scripts/prettify/prettify.js"> </script>
|
|
|
|
<script src="scripts/prettify/lang-css.js"> </script>
|
|
|
|
<!--[if lt IE 9]>
|
|
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
|
|
<![endif]-->
|
|
|
|
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
|
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="main">
|
|
|
|
|
|
|
|
<h1 class="page-title">Source: backend.js</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<article>
|
|
|
|
<pre class="prettyprint source"><code>/**
|
2013-09-13 16:21:03 +03:00
|
|
|
* Main javascript code for the backend of Easy!Appointments.
|
2013-06-13 19:25:34 +03:00
|
|
|
*/
|
|
|
|
$(document).ready(function() {
|
|
|
|
$(window).resize(function() {
|
|
|
|
Backend.placeFooterToBottom();
|
|
|
|
}).trigger('resize');
|
2013-09-13 16:21:03 +03:00
|
|
|
|
|
|
|
$(document).ajaxStart(function() {
|
|
|
|
$('#loading').show();
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).ajaxStop(function() {
|
|
|
|
$('#loading').hide();
|
|
|
|
});
|
2013-06-13 19:25:34 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This namespace contains functions that are used in the backend section of
|
|
|
|
* the applications.
|
|
|
|
*
|
|
|
|
* @namespace Backend
|
|
|
|
*/
|
|
|
|
var Backend = {
|
2013-09-13 16:21:03 +03:00
|
|
|
/**
|
|
|
|
* Backend Constants
|
|
|
|
*/
|
|
|
|
EXCEPTIONS_TITLE: 'Unexpected Issues',
|
|
|
|
EXCEPTIONS_MESSAGE: 'The operation could not complete due to unexpected issues. ',
|
|
|
|
WARNINGS_TITLE: 'Unexpected Warnings',
|
|
|
|
WARNINGS_MESSAGE: 'The operation completed but some warnings appeared. ',
|
|
|
|
|
2013-06-13 19:25:34 +03:00
|
|
|
/**
|
|
|
|
* Place the backend footer always on the bottom of the page.
|
|
|
|
*/
|
|
|
|
placeFooterToBottom: function() {
|
2013-09-13 16:21:03 +03:00
|
|
|
var $footer = $('#footer');
|
2013-06-13 19:25:34 +03:00
|
|
|
|
|
|
|
if (window.innerHeight > $('body').height()) {
|
2013-09-13 16:21:03 +03:00
|
|
|
$footer.css({
|
|
|
|
'position': 'absolute',
|
|
|
|
'width': '100%',
|
|
|
|
'bottom': '0px'
|
2013-06-13 19:25:34 +03:00
|
|
|
});
|
|
|
|
} else {
|
2013-09-13 16:21:03 +03:00
|
|
|
$footer.css({
|
|
|
|
'position': 'static'
|
2013-06-13 19:25:34 +03:00
|
|
|
});
|
|
|
|
}
|
2013-09-13 16:21:03 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display backend notifications to user.
|
|
|
|
*
|
|
|
|
* Using this method you can display notifications to the use with custom
|
|
|
|
* messages. If the 'actions' array is provided then an action link will
|
|
|
|
* be displayed too.
|
|
|
|
*
|
|
|
|
* @param {string} message Notification message
|
|
|
|
* @param {array} actions An array with custom actions that will be available
|
|
|
|
* to the user. Every array item is an object that contains the 'label' and
|
|
|
|
* 'function' key values.
|
|
|
|
*/
|
|
|
|
displayNotification: function(message, actions) {
|
|
|
|
if (message === undefined) {
|
|
|
|
message = 'NO MESSAGE PROVIDED FOR THIS NOTIFICATION';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (actions === undefined) {
|
|
|
|
actions = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
var notificationHtml =
|
|
|
|
'<div class="notification alert">' +
|
|
|
|
'<strong>' + message + '</strong>';
|
|
|
|
|
|
|
|
$.each(actions, function(index, action) {
|
|
|
|
var actionId = action['label'].toLowerCase().replace(' ', '-');
|
|
|
|
notificationHtml += '<button id="' + actionId + '" class="btn">'
|
|
|
|
+ action['label'] + '</button>';
|
|
|
|
|
|
|
|
$(document).off('click', '#' + actionId);
|
|
|
|
$(document).on('click', '#' + actionId, action['function']);
|
|
|
|
});
|
|
|
|
|
|
|
|
notificationHtml += '</div>';
|
|
|
|
|
|
|
|
$('#notification').html(notificationHtml);
|
|
|
|
$('#notification').show('blind');
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* All backend js code has the same way of dislaying exceptions that are raised on the
|
|
|
|
* server during an ajax call.
|
|
|
|
*
|
|
|
|
* @param {object} response Contains the server response. If exceptions or warnings are
|
|
|
|
* found, user friendly messages are going to be displayed to the user.
|
|
|
|
* @returns {bool} Returns whether the the ajax callback should continue the execution or
|
|
|
|
* stop, due to critical server exceptions.
|
|
|
|
*/
|
|
|
|
handleAjaxExceptions: function(response) {
|
|
|
|
if (response.exceptions) {
|
|
|
|
response.exceptions = GeneralFunctions.parseExceptions(response.exceptions);
|
|
|
|
GeneralFunctions.displayMessageBox(Backend.EXCEPTIONS_TITLE, Backend.EXCEPTIONS_MESSAGE);
|
|
|
|
$('#message_box').append(GeneralFunctions.exceptionsToHtml(response.exceptions));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (response.warnings) {
|
|
|
|
response.warnings = GeneralFunctions.parseExceptions(response.warnings);
|
|
|
|
GeneralFunctions.displayMessageBox(Backend.WARNINGS_TITLE, Backend.WARNINGS_MESSAGE);
|
|
|
|
$('#message_box').append(GeneralFunctions.exceptionsToHtml(response.warnings));
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2013-06-13 19:25:34 +03:00
|
|
|
}
|
2013-09-13 16:21:03 +03:00
|
|
|
};</code></pre>
|
2013-06-13 19:25:34 +03:00
|
|
|
</article>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<nav>
|
2013-09-13 16:21:03 +03:00
|
|
|
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="AdminsHelper.html">AdminsHelper</a></li><li><a href="CategoriesHelper.html">CategoriesHelper</a></li><li><a href="ProvidersHelper.html">ProvidersHelper</a></li><li><a href="SecretariesHelper.html">SecretariesHelper</a></li><li><a href="ServicesHelper.html">ServicesHelper</a></li></ul><h3>Namespaces</h3><ul><li><a href="Backend.html">Backend</a></li><li><a href="Customers.html">Backend Customers</a></li><li><a href="BackendCalendar.html">BackendCalendar</a></li><li><a href="BackendServices.html">BackendServices</a></li><li><a href="BackendUsers..html">BackendUsers.</a></li><li><a href="FrontendBook.html">FrontendBook</a></li><li><a href="GeneralFunctions.html">GeneralFunctions</a></li></ul>
|
2013-06-13 19:25:34 +03:00
|
|
|
</nav>
|
|
|
|
|
|
|
|
<br clear="both">
|
|
|
|
|
|
|
|
<footer>
|
2013-09-13 16:21:03 +03:00
|
|
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.0-dev</a> on Fri Sep 13 2013 11:50:16 GMT+0300 (EEST)
|
2013-06-13 19:25:34 +03:00
|
|
|
</footer>
|
|
|
|
|
|
|
|
<script> prettyPrint(); </script>
|
|
|
|
<script src="scripts/linenumber.js"> </script>
|
|
|
|
</body>
|
|
|
|
</html>
|