iflrandevu/doc/code/js/GeneralFunctions.html
2015-01-28 23:54:11 +01:00

1895 lines
No EOL
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>
<h4 class="name" id=".EXCEPTIONS_TITLE"><span class="type-signature">(static) </span>EXCEPTIONS_TITLE<span class="type-signature"></span></h4>
<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>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".centerElementOnPage"><span class="type-signature">(static) </span>centerElementOnPage<span class="signature">(elementHandle)</span><span class="type-signature"></span></h4>
<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#line78">line 78</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".clone"><span class="type-signature">(static) </span>clone<span class="signature">(originalObject)</span><span class="type-signature"> &rarr; {object}</span></h4>
<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#line142">line 142</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>
<h4 class="name" id=".displayMessageBox"><span class="type-signature">(static) </span>displayMessageBox<span class="signature">(title, message, messageButtons)</span><span class="type-signature"></span></h4>
<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>
<h4 class="name" id=".enableLanguageSelection"><span class="type-signature">(static) </span>enableLanguageSelection<span class="signature">($element)</span><span class="type-signature"></span></h4>
<div class="description">
Enables the language selection functionality. Must be called on every page has a
language selection button. This method requires the global variable 'availableLanguages'
to be initialized before the execution.
</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>$element</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Selected element button for the language selection.</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#line280">line 280</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".exceptionsToHtml"><span class="type-signature">(static) </span>exceptionsToHtml<span class="signature">(exceptions)</span><span class="type-signature"> &rarr; {string}</span></h4>
<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#line196">line 196</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>
<h4 class="name" id=".getUrlParameter"><span class="type-signature">(static) </span>getUrlParameter<span class="signature">(url, name)</span><span class="type-signature"> &rarr; {String}</span></h4>
<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#line103">line 103</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>
<h4 class="name" id=".handleAjaxExceptions"><span class="type-signature">(static) </span>handleAjaxExceptions<span class="signature">(response)</span><span class="type-signature"> &rarr; {bool}</span></h4>
<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#line256">line 256</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>
<h4 class="name" id=".ISODateString"><span class="type-signature">(static) </span>ISODateString<span class="signature">(dt)</span><span class="type-signature"> &rarr; {String}</span></h4>
<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#line121">line 121</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>
<h4 class="name" id=".parseExceptions"><span class="type-signature">(static) </span>parseExceptions<span class="signature">(exceptions)</span><span class="type-signature"> &rarr; {array}</span></h4>
<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#line227">line 227</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>
<h4 class="name" id=".ucaseFirstLetter"><span class="type-signature">(static) </span>ucaseFirstLetter<span class="signature">(str)</span><span class="type-signature"> &rarr; {string}</span></h4>
<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#line243">line 243</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>
<h4 class="name" id=".validateEmail"><span class="type-signature">(static) </span>validateEmail<span class="signature">(email)</span><span class="type-signature"> &rarr; {bool}</span></h4>
<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#line183">line 183</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>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</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 class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha13</a> on Wed Jan 28 2015 23:12:50 GMT+0100 (CET)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>