add throbber when modifying something in admin editor + rename pwd throbber image
[syp.git] / inc / templates_admin.php
1 <?php
2 /* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
3    license. */
4
5 require_once ("./inc/settings.php");
6 require_once ("./inc/db/mysql.php");
7 require_once ("./inc/utils.php");
8
9 $error = false;
10 try {
11     $connection->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX);
12     $usrtblexists = $connection->users_table_exists ();
13     $itemstblexists = $connection->items_table_exists ();
14 } catch (Exception $e) {
15     $error = true;
16 }
17 if (!$usrtblexists || !$itemstblexists) {
18     $error = true;
19 }
20     if ($error) {
21 ?>
22 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
23        "http://www.w3.org/TR/html4/loose.dtd">  
24 <html lang="<?php echo $lang?>">
25 <head>
26       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
27       <title><?php ptrans('SYP admin')?></title>
28       <link rel="stylesheet" href="./media/admin.css" type="text/css">
29 </head>
30 <body>
31     <p class="error center"><?php ptrans('SYP is not correctly installed. Please follow README.txt instructions
32        and go to <a href="wizard.en.php">wizard</a>.')?></p>
33 </body>
34 </html>
35 <?php
36     exit ();
37     } // if ($error)
38 ?>
39 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
40        "http://www.w3.org/TR/html4/loose.dtd">  
41 <html lang="<?php echo $lang?>">
42 <head>
43       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
44       <title><?php ptrans('SYP admin');?></title>
45
46       <link rel="stylesheet" href="./media/admin.css" type="text/css">
47       <link rel="stylesheet" href="./openlayers/theme/default/style.css" type="text/css">
48
49       <script type="text/javascript">
50         var SypStrings = {
51             AddItem: "<?php ptrans('add a place')?>",
52             DragDropHowto: "<?php ptrans('You can move an item by drag & droping it.')?>",
53             SelectHowto: "<?php ptrans('To modify an item data, select matching marker.')?>",
54             AddHowto: "<?php ptrans('Click on the map to add a marker.')?>",
55             ServerError: "<?php ptrans('There was a server error.')?>",
56             UnreferencedError: "<?php ptrans('Item was not registered on the server.')?>",
57             NochangeError: "<?php ptrans('No change was made.')?>",
58             RequestError: "<?php ptrans('Server did not understood request. That\'s probably caused by a bug in SYP.')?>",
59             ToobigError: "<?php ptrans('Image was too big and was not accepted by server.')?>",
60             UnauthorizedError: "<?php ptrans('Password is not correct.')?>",
61             NotimageError: "<?php ptrans('File does not look like an image.')?>",
62             UnconsistentError: "<?php ptrans('Server reply was inconsistent.')?>",
63             UnknownError: "<?php ptrans('There was an unknown error.')?>",
64             DelSucces: "<?php ptrans('Removal took place correctly.')?>",
65             UpdateSucces: "<?php ptrans('Save took place correctly.')?>"
66         };
67
68         <?php 
69             $bbox = $connection->mbr ();
70             printf ("var sypOrig = [%.18F, %.18F, %.18F, %.18F];\n",
71                     $bbox [0], $bbox [1], $bbox [2], $bbox [3]); 
72         ?>
73
74       </script>
75       <script src="./js/jquery-1.3.2.js" type="text/javascript"></script>
76       <script src="./openlayers/OpenLayers.js" type="text/javascript"></script>
77       <script src="./js/admin.js" type="text/javascript"></script>
78
79     <noscript>
80     <style type="text/css">
81         #map, #editor, #admin, #login_area {
82             display: none;
83         }
84     </style>
85     </noscript>
86
87 </head>
88
89 <body>
90
91     <noscript>
92     <p><?php ptrans('SYP needs javascript. Please activate scripts in your browser.')?></p>
93     </noscript>
94
95     <div id="header">
96     <?php other_languages($lang) ?>
97     <p id="logout"><a href="logout.php"><?php ptrans('Logout')?></a></p>
98     </div>
99
100
101     <div id="map"></div>
102
103     <div id="admin" class="center">
104         <input id="newfeature_button" type="button" value="<?php ptrans('add a place')?>">
105         <p id="server_comm"></p>
106         <p id="instructions"></p>
107     </div>
108
109     <div id="editor" class="center">
110         <input id="editor_close" type="image" src="openlayers/theme/default/img/close.gif"
111              title="<?php ptrans('close without saving')?>" alt="<?php ptrans('close')?>">
112         <form id="feature_update" method="post" enctype="multipart/form-data">
113             <label for="title"><?php ptrans('title:')?></label><br>
114             <input id="title" name="title"><br>
115             <label for="description"><?php ptrans('description:')?></label><br>
116             <textarea id="description" name="description" rows="4"></textarea><br>
117             <div><img id="img"></div>
118             <input id="image_delete" type="button" value="<?php ptrans('delete image')?>">
119             <div>
120                 <label for="image_file"><?php ptrans('add an image:')?></label>
121                 <input id="image_file" type="file" name="image_file">
122             </div>
123             <br>
124             <div class="center">
125             <input id="validate_editor" type="submit" value="<?php ptrans('Validate changes')?>">
126             </div>
127             <input type="hidden" name="request">
128             <input type="hidden" name="lon">
129             <input type="hidden" name="lat">
130             <input type="hidden" name="fid">
131             <input type="hidden" name="keep_img">
132         </form>
133         <form id="feature_delete" method="post">
134             <input id="delete" type="submit" value="<?php ptrans('Delete item')?>">
135             <input type="hidden" name="request" value="del">
136             <input type="hidden" name="fid">
137         </form>
138         <p id="editor_throbber" class="throbber center">
139             <?php ptrans('Connecting')?>
140             <img src="media/editor-throbber.gif">
141         </p>
142     </div>
143
144       <div id="login_area"
145         <?php 
146         if ($connection->checkpwdmd5 ("admin", 
147                                $_COOKIE [sprintf ("%sauth", DBPREFIX)])) {
148             echo ' class="hidden"';
149         }
150       ?>>
151      <div id="login_transparency"></div>
152      <div id="login_padding"></div>
153      <div id="login_content">
154         <form id="login_form" method="post">
155         <div id="cookie_warning" class="center warn"><?php ptrans('You need to have cookies enabled to administrate SYP')?></div>
156             <table>
157                 <tr>
158                     <td><label for="password"><?php ptrans('password')?></label></td>
159                     <td style="width: 100%"><input id="password" name="password" type="password"></td>
160                 </tr>
161             </table>
162             <p class="center">
163                 <input id="login_submit" type="submit" value="<?php ptrans('Connection')?>">
164                 <input type="hidden" name="request" value="auth">
165             </p>
166             <p id="pwd_throbber" class="throbber center">
167                 <?php ptrans('Connecting')?>
168                 <img src="media/pwd-throbber.gif" alt="throbber">
169             </p>
170             <p class="error center" id="login_error"></p>
171         </form>
172      </div>
173      </div>
174
175      <iframe id="api_frame" name="api_frame" src="" frameborder="0" width="0" height="0"></iframe>
176
177 </body>
178 </html>