]> git.wh0rd.org Git - tt-rss.git/blob - include/login_form.php
upd: default css url if no theme
[tt-rss.git] / include / login_form.php
1 <?php startup_gettext(); ?>
2 <html>
3 <head>
4         <title>Tiny Tiny RSS : Login</title>
5         <?php echo stylesheet_tag("lib/dijit/themes/claro/claro.css") ?>
6         <?php echo stylesheet_tag("css/default.css") ?>
7         <link rel="shortcut icon" type="image/png" href="images/favicon.png">
8         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
9         <?php
10         foreach (array("lib/prototype.js",
11                                 "lib/dojo/dojo.js",
12                                 "lib/dojo/tt-rss-layer.js",
13                                 "js/functions.js",
14                                 "errors.php?mode=js") as $jsfile) {
15
16                 echo javascript_tag($jsfile);
17
18         } ?>
19
20         <script type="text/javascript">
21                 require({cache:{}});
22                 Event.observe(window, 'load', function() {
23                         init();
24                 });
25         </script>
26         <style type="text/css">
27         body#ttrssLogin {
28                 padding : 2em;
29                 font-size : 14px;
30         }
31
32         fieldset {
33                 margin-left : auto;
34                 margin-right : auto;
35                 display : block;
36                 width : 400px;
37                 border-width : 0px;
38         }
39
40         /*input.input {
41                 font-family : sans-serif;
42                 font-size : medium;
43                 border-spacing : 2px;
44                 border : 1px solid #b5bcc7;
45                 padding : 2px;
46         }*/
47
48         label {
49                 width : 120px;
50                 margin-right : 20px;
51                 display : inline-block;
52                 text-align : right;
53                 color : gray;
54         }
55
56         div.header {
57                 border-width : 0px 0px 1px 0px;
58                 border-style : solid;
59                 border-color : #0088cc;
60                 margin-bottom : 1em;
61                 padding-bottom : 5px;
62         }
63
64         div.footer {
65                 margin-top : 1em;
66                 padding-top : 5px;
67                 border-width : 1px 0px 0px 0px;
68                 border-style : solid;
69                 border-color : #0088cc;
70                 text-align : center;
71                 color : gray;
72                 font-size : 12px;
73         }
74
75         a.forgotpass {
76                 text-align : right;
77                 font-size : 11px;
78                 display : inline-block;
79         }
80
81         a {
82                 color : #0088cc;
83         }
84
85         a {
86                 color: #0088cc;
87                 text-decoration: none;
88         }
89
90         a:hover,
91         a:focus {
92                 color: #005580;
93                 text-decoration: underline;
94         }
95
96         div.footer a {
97                 color : gray;
98         }
99
100         div.footer a:hover {
101                 color : #0088cc;
102         }
103
104         div.row {
105                 padding : 0px 0px 5px 0px;
106         }
107
108         div.row-error {
109                 color : red;
110                 text-align : center;
111                 padding : 0px 0px 5px 0px;
112         }
113
114         </style>
115 </head>
116
117 <body id="ttrssLogin" class="claro">
118
119 <script type="text/javascript">
120 function init() {
121
122         require(['dojo/parser','dijit/form/Button','dijit/form/CheckBox','dijit/form/Form',
123         'dijit/form/Select','dijit/form/TextBox','dijit/form/ValidationTextBox'],function(parser){
124                 parser.parse();
125                 //show tooltip node only after this widget is instaniated.
126                 dojo.query('div[dojoType="dijit.Tooltip"]').style({
127                         display:''
128                 });
129                 fetchProfiles();
130                 dijit.byId("bw_limit").attr("checked", getCookie("ttrss_bwlimit") == 'true');
131                 document.forms.loginForm.login.focus();
132         });
133
134 }
135
136 function fetchProfiles() {
137         try {
138                 var query = "op=getProfiles&login=" + param_escape(document.forms["loginForm"].login.value);
139
140                 if (query) {
141                         new Ajax.Request("public.php",  {
142                                 parameters: query,
143                                 onComplete: function(transport) {
144                                         if (transport.responseText.match("select")) {
145                                                 $('profile_box').innerHTML = transport.responseText;
146                                                 //dojo.parser.parse('profile_box');
147                                         }
148                         } });
149                 }
150
151         } catch (e) {
152                 exception_error("fetchProfiles", e);
153         }
154 }
155
156
157 function gotoRegForm() {
158         window.location.href = "register.php";
159         return false;
160 }
161
162 function bwLimitChange(elem) {
163         try {
164                 var limit_set = elem.checked;
165
166                 setCookie("ttrss_bwlimit", limit_set,
167                         <?php print SESSION_COOKIE_LIFETIME ?>);
168
169         } catch (e) {
170                 exception_error("bwLimitChange", e);
171         }
172 }
173 </script>
174
175 <?php $return = urlencode($_SERVER["REQUEST_URI"]) ?>
176
177 <form action="public.php?return=<?php echo $return ?>"
178         dojoType="dijit.form.Form" method="POST" id="loginForm" name="loginForm">
179
180 <input dojoType="dijit.form.TextBox" style="display : none" name="op" value="login">
181
182 <div class='header'>
183         <img src="images/logo_wide.png">
184 </div>
185
186 <div class='form'>
187
188         <fieldset>
189                 <?php if ($_SESSION["login_error_msg"]) { ?>
190                 <div class="row-error">
191                         <?php echo $_SESSION["login_error_msg"] ?>
192                 </div>
193                         <?php $_SESSION["login_error_msg"] = ""; ?>
194                 <?php } ?>
195                 <div class="row">
196                         <label><?php echo __("Login:") ?></label>
197                         <input name="login" class="input input-text" type="text"
198                                 onchange="fetchProfiles()" onfocus="fetchProfiles()" onblur="fetchProfiles()"
199                                 style="width : 220px"
200                                 required="1"
201                                 value="<?php echo $_SESSION["fake_login"] ?>" />
202                 </div>
203
204
205                 <div class="row">
206                         <label><?php echo __("Password:") ?></label>
207                         <input type="password" name="password" required="1"
208                                         style="width : 220px" class="input input-text"
209                                         value="<?php echo $_SESSION["fake_password"] ?>"/>
210                         <label></label>
211                 <?php if (strpos(PLUGINS, "auth_internal") !== FALSE) { ?>
212                         <a class='forgotpass' href="public.php?op=forgotpass"><?php echo __("I forgot my password") ?></a>
213                 <?php } ?>
214                 </div>
215
216
217                 <div class="row">
218                         <label><?php echo __("Profile:") ?></label>
219
220                         <span id='profile_box'><select disabled='disabled' dojoType='dijit.form.Select'
221                                 style='width : 220px; margin : 0px'>
222                                 <option><?php echo __("Default profile") ?></option></select></span>
223
224                 </div>
225
226                 <div class="row">
227                         <label>&nbsp;</label>
228                         <input dojoType="dijit.form.CheckBox" name="bw_limit" id="bw_limit" type="checkbox"
229                                 onchange="bwLimitChange(this)">
230                         <label id="bw_limit_label" style='display : inline' for="bw_limit"><?php echo __("Use less traffic") ?></label>
231                 </div>
232
233                 <div dojoType="dijit.Tooltip" connectId="bw_limit_label" position="below" style="display:none">
234 <?php echo __("Does not display images in articles, reduces automatic refreshes."); ?>
235                 </div>
236
237                 <?php if (SESSION_COOKIE_LIFETIME > 0) { ?>
238
239                 <div class="row">
240                         <label>&nbsp;</label>
241                         <input dojoType="dijit.form.CheckBox" name="remember_me" id="remember_me" type="checkbox">
242                         <label style='display : inline' for="remember_me"><?php echo __("Remember me") ?></label>
243                 </div>
244
245                 <?php } ?>
246
247                 <div class="row" style='text-align : right'>
248                         <button dojoType="dijit.form.Button" type="submit"><?php echo __('Log in') ?></button>
249                         <?php if (defined('ENABLE_REGISTRATION') && ENABLE_REGISTRATION) { ?>
250                                 <button onclick="return gotoRegForm()" dojoType="dijit.form.Button">
251                                         <?php echo __("Create new account") ?></button>
252                         <?php } ?>
253                 </div>
254
255         </fieldset>
256
257
258 </div>
259
260 <div class='footer'>
261         <a href="http://tt-rss.org/">Tiny Tiny RSS</a>
262         &copy; 2005&ndash;<?php echo date('Y') ?> <a href="http://fakecake.org/">Andrew Dolgov</a>
263 </div>
264
265 </form>
266
267 </body></html>