PageRenderTime 114ms CodeModel.GetById 40ms app.highlight 32ms RepoModel.GetById 28ms app.codeStats 8ms

/htdocs/core/tpl/login.tpl.php

https://bitbucket.org/speedealing/speedealing
PHP | 367 lines | 261 code | 46 blank | 60 comment | 26 complexity | 554c08e4fc0c61aac7fe7ed85411d916 MD5 | raw file
  1<?php
  2/* Copyright (C) 2009-2013 Regis Houssin 		<regis.houssin@capnetworks.com>
  3 * Copyright (C) 2011-2012 Laurent Destailleur 	<eldy@users.sourceforge.net>
  4 * Copyright (C) 2011-2013 Herve Prot			<herve.prot@symeos.com>
  5 *
  6 * This program is free software; you can redistribute it and/or modify
  7 * it under the terms of the GNU General Public License as published by
  8 * the Free Software Foundation; either version 3 of the License, or
  9 * (at your option) any later version.
 10 *
 11 * This program is distributed in the hope that it will be useful,
 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 14 * GNU General Public License for more details.
 15 *
 16 * You should have received a copy of the GNU General Public License
 17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 18 *
 19 */
 20
 21header('Cache-Control: Public, must-revalidate');
 22header("Content-type: text/html; charset=" . $conf->file->character_set_client);
 23?>
 24<!DOCTYPE html>
 25
 26<!--[if IEMobile 7]><html class="no-js iem7 oldie linen"><![endif]-->
 27<!--[if (IE 7)&!(IEMobile)]><html class="no-js ie7 oldie linen" lang="en"><![endif]-->
 28<!--[if (IE 8)&!(IEMobile)]><html class="no-js ie8 oldie linen" lang="en"><![endif]-->
 29<!--[if (IE 9)&!(IEMobile)]><html class="no-js ie9 linen" lang="en"><![endif]-->
 30<!--[if (gt IE 9)|(gt IEMobile 7)]><!--><html class="no-js linen" lang="en"><!--<![endif]-->
 31
 32	<head>
 33		<meta charset="utf-8" />
 34		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
 35		<meta name="robots" content="noindex,nofollow" />
 36		<meta name="author" content="Speedealing Development Team" />
 37		<base href="http://<?php echo $_SERVER['HTTP_HOST'] . DOL_URL_ROOT; ?>/" />
 38
 39		<title><?php echo $langs->trans('Login') . ' ' . $title; ?></title>
 40		<meta name="description" content="">
 41
 42		<!-- http://davidbcalhoun.com/2010/viewport-metatag -->
 43		<meta name="HandheldFriendly" content="True" />
 44		<meta name="MobileOptimized" content="320" />
 45		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
 46
 47		<!-- For all browsers -->
 48		<link rel="stylesheet" href="theme/symeos/css/reset.css?v=1">
 49		<link rel="stylesheet" href="theme/symeos/css/style.css?v=1">
 50		<link rel="stylesheet" href="theme/symeos/css/colors.css?v=1">
 51		<link rel="stylesheet" media="print" href="theme/symeos/css/print.css?v=1">
 52		<!-- For progressively larger displays -->
 53		<link rel="stylesheet" media="only all and (min-width: 480px)" href="theme/symeos/css/480.css?v=1">
 54		<link rel="stylesheet" media="only all and (min-width: 768px)" href="theme/symeos/css/768.css?v=1">
 55		<link rel="stylesheet" media="only all and (min-width: 992px)" href="theme/symeos/css/992.css?v=1">
 56		<link rel="stylesheet" media="only all and (min-width: 1200px)" href="theme/symeos/css/1200.css?v=1">
 57		<!-- For Retina displays -->
 58		<link rel="stylesheet" media="only all and (-webkit-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (min-device-pixel-ratio: 1.5)" href="theme/symeos/css/2x.css?v=1">
 59
 60		<!-- Additional styles -->
 61		<link rel="stylesheet" href="theme/symeos/css/styles/form.css?v=1">
 62		<link rel="stylesheet" href="theme/symeos/css/styles/switches.css?v=1">
 63
 64		<!-- Login pages styles -->
 65		<link rel="stylesheet" media="screen" href="theme/symeos/css/login.css?v=1">
 66
 67		<!-- JavaScript at bottom except for Modernizr -->
 68		<script src="includes/js/modernizr.custom.js"></script>
 69
 70		<!-- For Modern Browsers -->
 71		<link rel="shortcut icon" href="favicon.png">
 72		<!-- For everything else -->
 73		<link rel="shortcut icon" href="favicon.ico">
 74		<!-- For retina screens -->
 75		<link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-retina.png">
 76		<!-- For iPad 1-->
 77		<link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-ipad.png">
 78		<!-- For iPhone 3G, iPod Touch and Android -->
 79		<link rel="apple-touch-icon-precomposed" href="apple-touch-icon.png">
 80
 81		<!-- iOS web-app metas -->
 82		<meta name="apple-mobile-web-app-capable" content="yes" />
 83		<meta name="apple-mobile-web-app-status-bar-style" content="black" />
 84
 85		<!-- Startup image for web apps -->
 86		<!--<link rel="apple-touch-startup-image" href="theme/developr/html/img/splash/ipad-landscape.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)">
 87		<link rel="apple-touch-startup-image" href="theme/developr/html/img/splash/ipad-portrait.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)">
 88		<link rel="apple-touch-startup-image" href="theme/developr/html/img/splash/iphone.png" media="screen and (max-device-width: 320px)">-->
 89
 90		<!-- Microsoft clear type rendering -->
 91		<meta http-equiv="cleartype" content="on" />
 92
 93		<!-- IE9 Pinned Sites: http://msdn.microsoft.com/en-us/library/gg131029.aspx -->
 94		<meta name="application-name" content="Developr Admin Skin" />
 95		<meta name="msapplication-tooltip" content="Cross-platform admin template.">
 96		<meta name="msapplication-starturl" content="http://www.display-inline.fr/demo/developr" />
 97		<!-- These custom tasks are examples, you need to edit them to show actual pages -->
 98		<meta name="msapplication-task" content="name=Agenda;action-uri=http://www.display-inline.fr/demo/developr/agenda.html;icon-uri=http://www.display-inline.fr/demo/developr/img/favicons/favicon.ico" />
 99		<meta name="msapplication-task" content="name=My profile;action-uri=http://www.display-inline.fr/demo/developr/profile.html;icon-uri=http://www.display-inline.fr/demo/developr/img/favicons/favicon.ico" />
100
101		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
102
103		<!-- main styles -->
104		<?php
105		if (!empty($conf->global->MAIN_HTML_HEADER))
106			echo $conf->global->MAIN_HTML_HEADER;
107		?>
108		<!-- HTTP_USER_AGENT = <?php echo $_SERVER['HTTP_USER_AGENT']; ?> -->
109
110	</head>
111	<body>
112		<div id="container">
113			<hgroup id="login-title" class="large-margin-bottom">
114				<h1 class="login-title-image">Speedealing</h1>
115				<h5><?php
116					if (!empty($conf->main_resolver)) {
117						echo $langs->trans("Entity") . " : " . substr($_SERVER["HTTP_HOST"], 0, strpos($_SERVER["HTTP_HOST"], "."));
118						if (substr($_SERVER["HTTP_HOST"], 0, strpos($_SERVER["HTTP_HOST"], ".")) == "demo") {
119							echo '<p class="icon-user orange">login : demo / password : demo</p';
120						}
121					}
122					?></h5>
123			</hgroup>
124			<form name="login" action="<?php echo $php_self; ?>" method="post" id="form-login">
125				<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
126				<input type="hidden" name="loginfunction" value="loginfunction" />
127				<!-- Add fields to send local user information -->
128				<input type="hidden" name="tz" id="tz" value="" />
129				<input type="hidden" name="dst_observed" id="dst_observed" value="" />
130				<input type="hidden" name="dst_first" id="dst_first" value="" />
131				<input type="hidden" name="dst_second" id="dst_second" value="" />
132				<input type="hidden" name="screenwidth" id="screenwidth" value="" />
133				<input type="hidden" name="screenheight" id="screenheight" value="" />
134				<div class="elVal">
135					<ul class="inputs black-input large">
136						<!-- The autocomplete="off" attributes is the only way to prevent webkit browsers from filling the inputs with yellow -->
137						<li>
138							<span class="icon-user mid-margin-right"></span>
139							<input type="text" name="username" id="login" value="<?php echo (!empty($login) ? $login : ''); ?>" class="input-unstyled" placeholder="<?php echo $langs->trans('EMail'); ?>" autocomplete="off" />
140						</li>
141						<li>
142							<span class="icon-lock mid-margin-right"></span>
143							<input type="password" name="password" id="pass" value="" class="input-unstyled" placeholder="<?php echo $langs->trans('Password'); ?>" autocomplete="off" />
144						</li>
145					</ul>
146					<button type="submit" class="button glossy full-width huge"><?php echo $langs->trans('Connection'); ?></button>
147				</div>
148			</form>
149		</div>
150
151	<?php if (!empty($main_home)) { ?>
152		<center>
153			<table summary="info" cellpadding="0" cellspacing="0" border="0" align="center" width="750">
154				<tr>
155					<td align="center"><?php echo $main_home; ?></td>
156				</tr>
157			</table>
158		</center>
159	<?php } ?>
160
161	<?php if (!empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) { ?>
162		<div align="center"><br>
163			<script type="text/javascript"><!--
164				google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
165				google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";
166				google_ad_width = <?php echo $conf->global->MAIN_GOOGLE_AD_WIDTH ?>;
167				google_ad_height = <?php echo $conf->global->MAIN_GOOGLE_AD_HEIGHT ?>;
168				//-->
169			</script>
170			<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
171		</div>
172	<?php } ?>
173
174	<!-- authentication mode = <?php echo $main_authentication ?> -->
175	<!-- cookie name used for this session = <?php echo $session_name ?> -->
176	<!-- urlfrom in this session = <?php echo $_SESSION["urlfrom"] ?> -->
177
178	<?php if (!empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER; ?>
179
180	<script src="includes/jquery/js/jquery-latest.min.js"></script>
181	<script src="includes/lib/validate/jquery.validate.min.js"></script>
182	<script src="theme/symeos/js/setup.min.js"></script>
183
184	<!-- Template functions -->
185	<script src="theme/symeos/js/developr.input.min.js"></script>
186	<script src="theme/symeos/js/developr.message.min.js"></script>
187	<script src="theme/symeos/js/developr.notify.min.js"></script>
188	<script src="theme/symeos/js/developr.tooltip.min.js"></script>
189
190	<?php
191	if (!empty($_SESSION['dol_loginmesg']))
192		dol_htmloutput_errors($_SESSION['dol_loginmesg']);
193	?>
194
195	<script>
196		$(document).ready(function() {
197			// Elements
198			var doc = $('html').addClass('js-login'),
199					container = $('#container'),
200					formLogin = $('#form-login'),
201					// If layout is centered
202					centered;
203
204			formLogin.submit(function(event) {
205				// Values
206				var login = $.trim($('#login').val()).toLowerCase(),
207						pass = $.trim($('#pass').val());
208
209				// Check inputs
210				if (login.length === 0) {
211					// Display message
212					displayError('Please check your login');
213					return false;
214				} else if (pass.length === 0) {
215					// Remove empty login message if displayed
216					formLogin.clearMessages();
217					// Display message
218					displayError('Please fill in your password');
219					return false;
220				} else {
221					// Remove previous messages
222					formLogin.clearMessages();
223					// Show progress
224					displayLoading('Checking credentials...');
225					event.preventDefault();
226
227					var urlPrefix;
228
229					if (this.urlPrefix === undefined)
230						urlPrefix = "";
231					else
232						urlPrefix = this.urlPrefix + "";
233
234					// Stop normal behavior
235					event.preventDefault();
236					$.ajax({
237						type: "POST", url: urlPrefix + "/db/_session", dataType: "json",
238						data: {name: login, password: pass},
239						beforeSend: function(xhr) {
240							xhr.setRequestHeader('Accept', 'application/json');
241						},
242						complete: function(req) {
243							var resp = $.parseJSON(req.responseText);
244							if (req.status == 200) {
245								document.location.href = 'index.php';
246							} else {
247								formLogin.clearMessages();
248								displayError('Invalid user/password, please try again');
249							}
250						},
251						error: function() {
252							formLogin.clearMessages();
253							displayError('Error while contacting server, contact the support');
254						}
255					});
256				}
257			});
258
259			// Handle resizing (mostly for debugging)
260			function handleLoginResize() {
261				// Detect mode
262				centered = (container.css('position') === 'absolute');
263
264				// Set min-height for mobile layout
265				if (!centered) {
266					container.css('margin-top', '');
267				} else {
268					if (parseInt(container.css('margin-top'), 10) === 0)
269						centerForm(false);
270				}
271			}
272			;
273
274			// Register and first call
275			$(window).bind('normalized-resize', handleLoginResize);
276			handleLoginResize();
277
278			/*
279			 * Center function
280			 * @param boolean animate whether or not to animate the position change
281			 * @param string|element|array any jQuery selector, DOM element or set of DOM elements which should be ignored
282			 * @return void
283			 */
284			function centerForm(animate, ignore) {
285				// If layout is centered
286				if (centered) {
287					var siblings = formLogin.siblings(),
288							finalSize = formLogin.outerHeight();
289
290					// Ignored elements
291					if (ignore)
292						siblings = siblings.not(ignore);
293
294					// Get other elements height
295					siblings.each(function(i) {
296						finalSize += $(this).outerHeight(true);
297					});
298
299					// Setup
300					container[animate ? 'animate' : 'css']({marginTop: -Math.round(finalSize / 2) + 'px'});
301				}
302			}
303			;
304
305			// Initial vertical adjust
306			centerForm(false);
307
308			/**
309			 * Function to display error messages
310			 * @param string message the error to display
311			 */
312			function displayError(message) {
313				// Show message
314				var message = formLogin.message(message, {
315					append: false,
316					arrow: 'bottom',
317					classes: ['red-gradient'],
318					animate: false					// We'll do animation later, we need to know the message height first
319				});
320
321				// Vertical centering (where we need the message height)
322				centerForm(true, 'fast');
323
324				// Watch for closing and show with effect
325				message.bind('endfade', function(event) {
326					// This will be called once the message has faded away and is removed
327					centerForm(true, message.get(0));
328				}).hide().slideDown('fast');
329			}
330
331			/**
332			 * Function to display loading messages
333			 * @param string message the message to display
334			 */
335			function displayLoading(message) {
336				// Show message
337				var message = formLogin.message('<strong>' + message + '</strong>', {
338					append: false,
339					arrow: 'bottom',
340					classes: ['blue-gradient', 'align-center'],
341					stripes: true,
342					darkStripes: false,
343					closable: false,
344					animate: false					// We'll do animation later, we need to know the message height first
345				});
346
347				// Vertical centering (where we need the message height)
348				centerForm(true, 'fast');
349
350				// Watch for closing and show with effect
351				message.bind('endfade', function(event) {
352					// This will be called once the message has faded away and is removed
353					centerForm(true, message.get(0));
354				}).hide().slideDown('fast');
355			}
356
357			$(".sl_link").click(function(event) {
358				$('.l_pane').slideToggle('normal').toggleClass('dn');
359				$('.sl_link,.lb_ribbon').children('span').toggle();
360				event.preventDefault();
361			});
362
363		});
364	</script>
365</body>
366</html>
367<!-- END PHP TEMPLATE -->