translations for product registration dialog close (#330)
[openemr.git] / interface / login / login.php
bloba0c82004fb1f947244680287616a2372ae35703b
1 <?php
2 /**
3 * Login screen.
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
16 * @package OpenEMR
17 * @author Rod Roark <rod@sunsetsystems.com>
18 * @author Brady Miller <brady@sparmy.com>
19 * @author Kevin Yeh <kevin.y@integralemr.com>
20 * @author Scott Wakefield <scott.wakefield@gmail.com>
21 * @author ViCarePlus <visolve_emr@visolve.com>
22 * @author Julia Longtin <julialongtin@diasp.org>
23 * @author cfapress
24 * @author markleeds
25 * @link http://www.open-emr.org
28 $fake_register_globals=false;
29 $sanitize_all_escapes=true;
31 $ignoreAuth=true;
32 include_once("../globals.php");
33 include_once("$srcdir/sql.inc");
35 <html>
36 <head>
37 <?php html_header_show();?>
38 <title><?php echo text($openemr_name) . " " . xlt('Login'); ?></title>
39 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
40 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-ui-1-11-4/themes/ui-darkness/jquery-ui.min.css" />
41 <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
42 <link rel=stylesheet href="../themes/login.css" type="text/css">
43 <link rel="shortcut icon" href="<?php echo $webroot; ?>/interface/pic/favicon.ico" />
45 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-min-2-2-0/index.js"></script>
46 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-ui-1-11-4/jquery-ui.min.js"></script>
48 <script type="text/javascript">
49 var registrationTranslations = <?php echo json_encode(array(
50 'title' => xla('OpenEMR Product Registration'),
51 'pleaseProvideValidEmail' => xla('Please provide a valid email address'),
52 'success' => xla('Success'),
53 'registeredSuccess' => xla('Your installation of OpenEMR has been registered'),
54 'submit' => xla('Submit'),
55 'noThanks' => xla('No Thanks'),
56 'registeredEmail' => xla('Registered email'),
57 'registeredId' => xla('Registered id'),
58 'genericError' => xla('Error. Try again later'),
59 'closeTooltip' => xla('Close')
60 ));
61 ?>;
63 var registrationConstants = <?php echo json_encode(array(
64 'webroot' => $GLOBALS['webroot']
66 ?>;
67 </script>
69 <script type="text/javascript" src="<?php echo $webroot ?>/interface/product_registration/product_registration_service.js?v=<?php echo $v_js_includes; ?>"></script>
70 <script type="text/javascript" src="<?php echo $webroot ?>/interface/product_registration/product_registration_controller.js?v=<?php echo $v_js_includes; ?>"></script>
72 <script type="text/javascript">
73 jQuery(document).ready(function() {
74 var productRegistrationController = new ProductRegistrationController();
75 productRegistrationController.getProductRegistrationStatus(function(err, data) {
76 if (err) { return; }
78 if (data.status === 'UNREGISTERED') {
79 productRegistrationController.showProductRegistrationModal();
81 });
82 });
83 </script>
85 <script language='JavaScript'>
86 function transmit_form()
88 document.forms[0].submit();
90 function imsubmitted() {
91 <?php if (!empty($GLOBALS['restore_sessions'])) { ?>
92 // Delete the session cookie by setting its expiration date in the past.
93 // This forces the server to create a new session ID.
94 var olddate = new Date();
95 olddate.setFullYear(olddate.getFullYear() - 1);
96 document.cookie = '<?php echo session_name() . '=' . session_id() ?>; path=/; expires=' + olddate.toGMTString();
97 <?php } ?>
98 return false; //Currently the submit action is handled by the encrypt_form().
100 </script>
102 </head>
103 <body onload="javascript:document.login_form.authUser.focus();" class="body_image">
104 <span class="text"></span>
105 <center>
107 <form method="POST"
108 action="../main/main_screen.php?auth=login&site=<?php echo attr($_SESSION['site_id']); ?>"
109 target="_top" name="login_form" onsubmit="return imsubmitted();">
111 <input type='hidden' name='new_login_session_management' value='1' />
113 <?php
114 // collect groups
115 $res = sqlStatement("select distinct name from groups");
116 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
117 $result[$iter] = $row;
118 if (count($result) == 1) {
119 $resvalue = $result[0]{"name"};
120 echo "<input type='hidden' name='authProvider' value='" . attr($resvalue) . "' />\n";
122 // collect default language id
123 $res2 = sqlStatement("select * from lang_languages where lang_description = ?",array($GLOBALS['language_default']));
124 for ($iter = 0;$row = sqlFetchArray($res2);$iter++)
125 $result2[$iter] = $row;
126 if (count($result2) == 1) {
127 $defaultLangID = $result2[0]{"lang_id"};
128 $defaultLangName = $result2[0]{"lang_description"};
130 else {
131 //default to english if any problems
132 $defaultLangID = 1;
133 $defaultLangName = "English";
135 // set session variable to default so login information appears in default language
136 $_SESSION['language_choice'] = $defaultLangID;
137 // collect languages if showing language menu
138 if ($GLOBALS['language_menu_login']) {
140 // sorting order of language titles depends on language translation options.
141 $mainLangID = empty($_SESSION['language_choice']) ? '1' : $_SESSION['language_choice'];
142 if ($mainLangID == '1' && !empty($GLOBALS['skip_english_translation']))
144 $sql = "SELECT *,lang_description as trans_lang_description FROM lang_languages ORDER BY lang_description, lang_id";
145 $res3=SqlStatement($sql);
147 else {
148 // Use and sort by the translated language name.
149 $sql = "SELECT ll.lang_id, " .
150 "IF(LENGTH(ld.definition),ld.definition,ll.lang_description) AS trans_lang_description, " .
151 "ll.lang_description " .
152 "FROM lang_languages AS ll " .
153 "LEFT JOIN lang_constants AS lc ON lc.constant_name = ll.lang_description " .
154 "LEFT JOIN lang_definitions AS ld ON ld.cons_id = lc.cons_id AND " .
155 "ld.lang_id = ? " .
156 "ORDER BY IF(LENGTH(ld.definition),ld.definition,ll.lang_description), ll.lang_id";
157 $res3=SqlStatement($sql, array($mainLangID));
160 for ($iter = 0;$row = sqlFetchArray($res3);$iter++)
161 $result3[$iter] = $row;
162 if (count($result3) == 1) {
163 //default to english if only return one language
164 echo "<input type='hidden' name='languageChoice' value='1' />\n";
167 else {
168 echo "<input type='hidden' name='languageChoice' value='".attr($defaultLangID)."' />\n";
172 <table width="100%" height="99%">
173 <td align='center' valign='middle' width='34%'>
174 <div class="login-box" <?php if ($GLOBALS['extra_logo_login']) echo "style='width: 600px;'"; //enlarge width larger to fix the extra logo ?> >
175 <img class="logo-image" src="<?php echo $GLOBALS['webroot']?>/interface/pic/logo.png" />
177 <?php if ($GLOBALS['tiny_logo_1'] || $GLOBALS['tiny_logo_2']) { ?>
178 <div id='tinylogocontainer' class='tinylogocontainer'>
179 <?php if ($GLOBALS['tiny_logo_1']) {echo $tinylogocode1;} if ($GLOBALS['tiny_logo_2']) {echo $tinylogocode2;} ?>
180 </div>
181 <?php } ?>
183 <div class="title_name">
184 <?php if ($GLOBALS['show_label_login']) { ?>
185 <?php echo text($openemr_name); ?>
186 <?php } ?>
187 </div>
189 <?php if ($GLOBALS['extra_logo_login']) { ?>
190 <div class="logo-left"><?php echo $logocode;?></div>
191 <?php } ?>
193 <div class="table-right" <?php if ($GLOBALS['extra_logo_login']) echo "style='padding: 20px 20px;'"; //make room for the extra logo ?> >
194 <table width="100%">
195 <?php if (count($result) != 1) { ?>
196 <tr>
197 <td><span class="text"><?php echo xlt('Group:'); ?></span></td>
198 <td>
199 <select name=authProvider>
200 <?php
201 foreach ($result as $iter) {
202 echo "<option value='".attr($iter{"name"})."'>".text($iter{"name"})."</option>\n";
205 </select>
206 </td></tr>
207 <?php } ?>
209 <?php if (isset($_SESSION['loginfailure']) && ($_SESSION['loginfailure'] == 1)): ?>
210 <tr><td colspan='2' class='text' style='color:red'>
211 <?php echo xlt('Invalid username or password'); ?>
212 </td></tr>
213 <?php endif; ?>
215 <?php if (isset($_SESSION['relogin']) && ($_SESSION['relogin'] == 1)): ?>
216 <tr><td colspan='2' class='text' style='color:red;background-color:#dfdfdf;border:solid 1px #bfbfbf;text-align:center'>
217 <b><?php echo xlt('Password security has recently been upgraded.'); ?><br>
218 <?php echo xlt('Please login again.'); ?></b>
219 <?php unset($_SESSION['relogin']); ?>
220 </td></tr>
221 <?php endif; ?>
223 <tr>
224 <td><span class="text"><?php echo xlt('Username:'); ?></span></td>
225 <td>
226 <input class="entryfield" size="22" name="authUser">
227 </td></tr><tr>
228 <td><span class="text"><?php echo xlt('Password:'); ?></span></td>
229 <td>
230 <input class="entryfield" type="password" size="22" name="clearPass">
231 </td></tr>
233 <?php
234 if ($GLOBALS['language_menu_login']) {
235 if (count($result3) != 1) { ?>
236 <tr>
237 <td><span class="text"><?php echo xlt('Language'); ?>:</span></td>
238 <td>
239 <select class="entryfield" name=languageChoice size="1">
240 <?php
241 echo "<option selected='selected' value='" . attr($defaultLangID) . "'>" . xlt('Default') . " - " . xlt($defaultLangName) . "</option>\n";
242 foreach ($result3 as $iter) {
243 if ($GLOBALS['language_menu_showall']) {
244 if ( !$GLOBALS['allow_debug_language'] && $iter['lang_description'] == 'dummy') continue; // skip the dummy language
245 echo "<option value='".attr($iter['lang_id'])."'>".text($iter['trans_lang_description'])."</option>\n";
247 else {
248 if (in_array($iter['lang_description'], $GLOBALS['language_menu_show'])) {
249 if ( !$GLOBALS['allow_debug_language'] && $iter['lang_description'] == 'dummy') continue; // skip the dummy language
250 echo "<option value='".attr($iter['lang_id'])."'>" . text($iter['trans_lang_description']) . "</option>\n";
255 </select>
256 </td></tr>
257 <?php }} ?>
259 <tr><td>&nbsp;</td><td>
260 <input class="button large" type="submit" onClick="transmit_form()" value="<?php echo xla('Login');?>">
262 </td></tr>
263 <tr><td colspan='2' class='text' style='color:red'>
264 <?php
265 $ip=$_SERVER['REMOTE_ADDR'];
267 </div>
268 </td></tr>
269 </table>
271 </div>
272 <div style="clear: both;"> </div>
273 <div class="version">
274 <a href="../../acknowledge_license_cert.html" target="main"><?php echo xlt('Acknowledgments, Licensing and Certification'); ?></a>
275 </div>
276 </div>
278 <div class="product-registration-modal" style="display: none">
279 <p class="context"><?php echo xlt("Register your installation with OEMR 501(c)(3) to receive important notifications, such as security fixes and new release announcements."); ?></p>
280 <input placeholder="<?php echo xlt('email'); ?>" type="email" class="email" style="width: 100%; color: black" />
281 <p class="message" style="font-style: italic"></p>
282 </div>
284 <div class="demo">
285 <!-- Uncomment this for the OpenEMR demo installation
286 <p><center>login = admin
287 <br>password = pass
289 </div>
290 </td>
291 </tr>
292 </table>
293 </form>
294 </center>
295 </body>
296 </html>