]> dev.renevier.net Git - syp.git/blob - inc/templates_admin.php
7702b949b7408fd720eaf0f140b042af2e7e3fb1
[syp.git] / inc / templates_admin.php
1 <?php
2 /* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
3    license. */
4
5 $error = false;
6
7 if (!@include_once ("./inc/settings.php")) {
8     $error = true;
9 }
10 require_once ("./inc/db/mysql.php");
11 require_once ("./inc/utils.php");
12
13 try {
14     $connection->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX);
15     $usrtblexists = $connection->users_table_exists ();
16     $itemstblexists = $connection->items_table_exists ();
17 } catch (Exception $e) {
18     $error = true;
19 }
20 if (!$usrtblexists || !$itemstblexists) {
21     $error = true;
22 }
23     if ($error) {
24 ?>
25 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
26        "http://www.w3.org/TR/html4/loose.dtd">  
27 <html lang="<?php echo $lang?>">
28 <head>
29       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
30       <title><?php ptrans('SYP admin')?></title>
31       <link rel="stylesheet" href="./media/admin.css" type="text/css">
32 </head>
33 <body>
34     <p class="error center"><?php ptrans('SYP is not correctly installed. Please follow README.txt instructions
35        and go to <a href="install.en.php">wizard</a>.')?></p>
36 </body>
37 </html>
38 <?php
39     exit ();
40     } // if ($error)
41
42     $user = $_COOKIE [sprintf ("%suser", DBPREFIX)];
43     $pwd = $_COOKIE [sprintf ("%sauth", DBPREFIX)];
44     $logged = ($connection->checkpwdmd5 ($user, $pwd));
45 ?>
46 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
47        "http://www.w3.org/TR/html4/loose.dtd">  
48 <html lang="<?php echo $lang?>">
49 <head>
50       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
51       <title><?php ptrans('SYP admin');?></title>
52
53       <link rel="stylesheet" href="./media/admin.css" type="text/css">
54       <link rel="stylesheet" href="./openlayers/theme/default/style.css" type="text/css">
55
56       <script type="text/javascript">
57         var SypStrings = {
58             AddItem: "<?php ptrans('add a place')?>",
59             DragDropHowto: "<?php ptrans('You can move an item by drag & droping it.')?>",
60             SelectHowto: "<?php ptrans('To modify an item data, select matching marker.')?>",
61             AddHowto: "<?php ptrans('Click on the map to add a marker.')?>",
62             ServerError: "<?php ptrans('There was a server error.')?>",
63             UnreferencedError: "<?php ptrans('Item was not registered on the server.')?>",
64             NochangeError: "<?php ptrans('No change was made.')?>",
65             RequestError: "<?php ptrans('Server did not understood request. That\'s probably caused by a bug in SYP.')?>",
66             ToobigError: "<?php ptrans('Image was too big and was not accepted by server.')?>",
67             UnauthorizedError: "<?php ptrans('Password is not correct.')?>",
68             NotimageError: "<?php ptrans('File does not look like an image.')?>",
69             UnconsistentError: "<?php ptrans('Server reply was inconsistent.')?>",
70             DelSucces: "<?php ptrans('Removal took place correctly.')?>",
71             UpdateSucces: "<?php ptrans('Save took place correctly.')?>",
72             userPasswordmatchError: "<?php ptrans('Passwords do not match.')?>",
73             changeSamePass: "<?php ptrans('New password is the same as old password.')?>",
74             changePassBadPass: "<?php ptrans('Bad password.')?>",
75             changePassSuccess: "<?php ptrans('Password changed correctly.')?>",
76             newUserNonameError: "<?php ptrans('User name has not been set.')?>",
77             newUserExistsError: "<?php ptrans('User already exists in database.')?>",
78             newUserSuccess: "<?php ptrans('User added correctly.')?>"
79         };
80
81         var sypSettings =  {
82             loggedUser: <?php printf ($logged ? "\"$user\"": "null")?>
83         };
84
85       </script>
86       <script src="./js/jquery-1.3.2.js" type="text/javascript"></script>
87       <script src="./openlayers/OpenLayers.js" type="text/javascript"></script>
88       <script src="./js/admin.js" type="text/javascript"></script>
89
90     <noscript>
91     <style type="text/css">
92         #map, #editor, #admin, #login_area {
93             display: none;
94         }
95     </style>
96     </noscript>
97
98 </head>
99
100 <body>
101
102     <noscript>
103     <p><?php ptrans('SYP needs javascript. Please activate scripts in your browser.')?></p>
104     </noscript>
105
106     <div id="header">
107     <?php other_languages($lang) ?>
108     <div id="user_management">
109         <p id="logout" class="user_link"><a href="logout.php"><?php ptrans('Logout')?></a></p>
110         <p id="change_pass" class="user_link"><a href=""><?php ptrans('Change my password')?></a></p>
111         <p id="add_user" class="user_link"><a href=""><?php ptrans('Add a co-administrator')?></a></p>
112     </div>
113         <div id="user_area">
114             <input id="user_close" type="image" src="openlayers/theme/default/img/close.gif"
115                         title="<?php ptrans('close without saving')?>" alt="<?php ptrans('close')?>">
116             <form id="changepass" method="post">
117                 <label for="pass_current"><?php ptrans('current password:')?></label>
118                 <br>
119                 <input id="pass_current" name="pass_current" type="password">
120                 <br>
121                 <label for="pass_new"><?php ptrans('new password:')?></label>
122                 <br>
123                 <input id="pass_new" name="pass_new" type="password">
124                 <br>
125                 <label for="pass_new_confirm"><?php ptrans('confirm new password:')?></label>
126                 <br>
127                 <input id="pass_new_confirm" name="pass_new_confirm" type="password">
128                 <br>
129                 <input id="pass_submit" name="pass_submit" type="submit" value="<?php ptrans('Validate password')?>">
130                 <input type="hidden" name="request" value="changepass">
131             </form>
132             <form id="newuser" method="post">
133                 <label for="newuser_name"><?php ptrans('user name:')?></label>
134                 <br>
135                 <input id="newuser_name" name="newuser_name">
136                 <br>
137                 <label for="newuser_password"><?php ptrans('user password:')?></label>
138                 <br>
139                 <input id="newuser_password" name="newuser_password" type="password" value="">
140                 <br>
141                 <label for="newuser_password_confirm"><?php ptrans('confirm password:')?></label>
142                 <br>
143                 <input id="newuser_password_confirm" name="newuser_password_confirm" type="password">
144                 <br>
145                 <input id="newuser_submit" name="newuser_submit" type="submit" value="<?php ptrans('Validate user')?>">
146                 <input type="hidden" name="request" value="newuser">
147                 </form>
148                 <p id="user_comm" class="center"></p>
149                 <p id="user_throbber" class="throbber center">
150                     <?php ptrans('Connecting')?>
151                     <img src="media/newuser-throbber.gif" alt="<?php ptrans('throbber')?>">
152                 </p>
153         </div>
154     </div>
155
156
157     <div id="map"></div>
158
159     <div id="admin" class="center">
160         <input id="newfeature_button" type="button" value="<?php ptrans('add a place')?>">
161         <p id="server_comm"></p>
162         <p id="instructions"></p>
163     </div>
164
165     <div id="editor" class="center">
166         <input id="editor_close" type="image" src="openlayers/theme/default/img/close.gif"
167              title="<?php ptrans('close without saving')?>" alt="<?php ptrans('close')?>">
168         <form id="feature_update" method="post" enctype="multipart/form-data">
169             <label for="title"><?php ptrans('title:')?></label><br>
170             <input id="title" name="title"><br>
171             <label for="description"><?php ptrans('description:')?></label><br>
172             <textarea id="description" name="description" rows="4"></textarea><br>
173             <div><img id="img"></div>
174             <input id="image_delete" type="button" value="<?php ptrans('delete image')?>">
175             <div>
176                 <label for="image_file"><?php ptrans('add an image:')?></label>
177                 <input id="image_file" type="file" name="image_file">
178             </div>
179             <br>
180             <div class="center">
181             <input id="validate_editor" type="submit" value="<?php ptrans('Validate changes')?>">
182             </div>
183             <input type="hidden" name="request">
184             <input type="hidden" name="lon">
185             <input type="hidden" name="lat">
186             <input type="hidden" name="fid">
187             <input type="hidden" name="keep_img">
188         </form>
189         <form id="feature_delete" method="post">
190             <input id="delete" type="submit" value="<?php ptrans('Delete item')?>">
191             <input type="hidden" name="request" value="del">
192             <input type="hidden" name="fid">
193         </form>
194         <p id="editor_throbber" class="throbber center">
195             <?php ptrans('Connecting')?>
196             <img src="media/editor-throbber.gif" alt="<?php ptrans('throbber')?>">
197         </p>
198     </div>
199
200       <div id="login_area"
201         <?php 
202         if ($logged) {
203             echo ' class="hidden"';
204         }
205       ?>>
206      <div id="login_transparency"></div>
207      <div id="login_padding"></div>
208      <div id="login_content">
209         <form id="login_form" method="post">
210         <div id="cookie_warning" class="center warn"><?php ptrans('You need to have cookies enabled to administrate SYP')?></div>
211             <table>
212                 <tr>
213                     <td><label for="user"><?php ptrans('user')?></label></td>
214                     <td style="width: 100%"><input id="user" name="user"></td>
215                 </tr>
216                 <tr>
217                     <td><label for="password"><?php ptrans('password')?></label></td>
218                     <td style="width: 100%"><input id="password" name="password" type="password"></td>
219                 </tr>
220             </table>
221             <p class="center">
222                 <input id="login_submit" type="submit" value="<?php ptrans('Connection')?>">
223                 <input type="hidden" name="request" value="auth">
224             </p>
225             <p id="pwd_throbber" class="throbber center">
226                 <?php ptrans('Connecting')?>
227                 <img src="media/pwd-throbber.gif" alt="<?php ptrans('throbber')?>">
228             </p>
229             <p class="error center" id="login_error"></p>
230         </form>
231      </div>
232      </div>
233
234      <iframe id="api_frame" name="api_frame" src="" frameborder="0" width="0" height="0"></iframe>
235
236 </body>
237 </html>