PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 1ms

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