easyappointments/doc/code/js/GeneralFunctions.html

1615 lines
22 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Namespace: GeneralFunctions</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">Namespace: GeneralFunctions</h1>
<section>
<header>
<h2>
GeneralFunctions
</h2>
</header>
<article>
<div class="container-overview">
<div class="description">This file contains the General Functions javascript namespace.
It contains functions that apply both on the front and back
end of the application.</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="general_functions.js.html">general_functions.js</a>, <a href="general_functions.js.html#line1">line 1</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<dl>
<dt>
<h4 class="name" id="EXCEPTIONS_TITLE"><span class="type-signature">&lt;static> </span>EXCEPTIONS_TITLE<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
General Functions Constants
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="general_functions.js.html">general_functions.js</a>, <a href="general_functions.js.html#line12">line 12</a>
</li></ul></dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="centerElementOnPage"><span class="type-signature">&lt;static> </span>centerElementOnPage<span class="signature">(elementHandle)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
This method centers a DOM element vertically and horizontally
on the page.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>elementHandle</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">The object that is going to be
centered.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="general_functions.js.html">general_functions.js</a>, <a href="general_functions.js.html#line79">line 79</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="clone"><span class="type-signature">&lt;static> </span>clone<span class="signature">(originalObject)</span><span class="type-signature"> &rarr; {object}</span></h4>
</dt>
<dd>
<div class="description">
This method creates and returns an exact copy of the provided object.
It is very usefull whenever changes need to be made to an object without
modyfing the original data.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>originalObject</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Object to be copied.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="general_functions.js.html">general_functions.js</a>, <a href="general_functions.js.html#line143">line 143</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Returns an exact copy of the provided element.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="displayMessageBox"><span class="type-signature">&lt;static> </span>displayMessageBox<span class="signature">(title, message, messageButtons)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
This functions displays a message box in
the admin array. It is usefull when user
decisions or verifications are needed.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>title</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The title of the message box.</td>
</tr>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The message of the dialog.</td>
</tr>
<tr>
<td class="name"><code>messageButtons</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last">Contains the dialog
buttons along with their functions.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="general_functions.js.html">general_functions.js</a>, <a href="general_functions.js.html#line27">line 27</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="exceptionsToHtml"><span class="type-signature">&lt;static> </span>exceptionsToHtml<span class="signature">(exceptions)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
This method returns the exception html display for javascript ajax calls.
It uses the Bootstrap collapse module to show exception messages when the
user opens the "Details" collapse component.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>exceptions</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last">Contains the exceptions to be displayed.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="general_functions.js.html">general_functions.js</a>, <a href="general_functions.js.html#line197">line 197</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Returns the html markup for the exceptions.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getUrlParameter"><span class="type-signature">&lt;static> </span>getUrlParameter<span class="signature">(url, name)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
This function retrieves a parameter from a "GET" formed url.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>url</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The selected url.</td>
</tr>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The parameter name.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="general_functions.js.html">general_functions.js</a>, <a href="general_functions.js.html#line104">line 104</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Returns the parameter value.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="handleAjaxExceptions"><span class="type-signature">&lt;static> </span>handleAjaxExceptions<span class="signature">(response)</span><span class="type-signature"> &rarr; {bool}</span></h4>
</dt>
<dd>
<div class="description">
All backend js code has the same way of dislaying exceptions that are raised on the
server during an ajax call.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>response</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Contains the server response. If exceptions or warnings are
found, user friendly messages are going to be displayed to the user.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="general_functions.js.html">general_functions.js</a>, <a href="general_functions.js.html#line257">line 257</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Returns whether the the ajax callback should continue the execution or
stop, due to critical server exceptions.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">bool</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="ISODateString"><span class="type-signature">&lt;static> </span>ISODateString<span class="signature">(dt)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
This function creates a RFC 3339 date string. This string is needed
by the Google Calendar API in order to pass dates as parameters.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>dt</code></td>
<td class="type">
<span class="param-type">date</span>
</td>
<td class="description last">The given date that will be transformed</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="general_functions.js.html">general_functions.js</a>, <a href="general_functions.js.html#line122">line 122</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Returns the transformed string.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseExceptions"><span class="type-signature">&lt;static> </span>parseExceptions<span class="signature">(exceptions)</span><span class="type-signature"> &rarr; {Array}</span></h4>
</dt>
<dd>
<div class="description">
This method parse the json encoded strings that are fetched by ajax calls.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>exceptions</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last">Exception array returned by an ajax call.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="general_functions.js.html">general_functions.js</a>, <a href="general_functions.js.html#line228">line 228</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Returns the parsed js objects.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="ucaseFirstLetter"><span class="type-signature">&lt;static> </span>ucaseFirstLetter<span class="signature">(str)</span><span class="type-signature"> &rarr; {string}</span></h4>
</dt>
<dd>
<div class="description">
Makes the first letter of the string upper case.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>str</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The string to be converted.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="general_functions.js.html">general_functions.js</a>, <a href="general_functions.js.html#line244">line 244</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Returns the capitalized string.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="validateEmail"><span class="type-signature">&lt;static> </span>validateEmail<span class="signature">(email)</span><span class="type-signature"> &rarr; {bool}</span></h4>
</dt>
<dd>
<div class="description">
This method validates an email address. If the address is not on the proper
form then the result is FALSE.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>email</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The email address to be checked.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="general_functions.js.html">general_functions.js</a>, <a href="general_functions.js.html#line184">line 184</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Returns the validation result.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">bool</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<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="CustomersHelper.html">CustomersHelper</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><li><a href="SystemSettings.html">SystemSettings</a></li><li><a href="UserSettings.html">UserSettings</a></li><li><a href="WorkingPlan.html">WorkingPlan</a></li></ul><h3>Namespaces</h3><ul><li><a href="Backend.html">Backend</a></li><li><a href="BackendCalendar.html">BackendCalendar</a></li><li><a href="BackendCustomers.html">BackendCustomers</a></li><li><a href="BackendServices.html">BackendServices</a></li><li><a href="BackendSettings.html">BackendSettings</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><h3>Global</h3><ul><li><a href="global.html#enableCancel">enableCancel</a></li><li><a href="global.html#enableSubmit">enableSubmit</a></li></ul>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.0-dev</a> on Sat Oct 19 2013 11:58:42 GMT+0300 (EEST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>