]> dev.renevier.net Git - syp.git/blob - inc/templates_admin.php
1f28e7999a3ea4837f893b2ac9e348affda804a1
[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             UnknownError: "<?php ptrans('There was an unknown error.')?>",
71             DelSucces: "<?php ptrans('Removal took place correctly.')?>",
72             UpdateSucces: "<?php ptrans('Save took place correctly.')?>"
73         };
74
75         var sypSettings =  {
76             loggedUser: <?php printf ($logged ? "\"$user\"": "null")?>
77         };
78
79       </script>
80       <script src="./js/jquery-1.3.2.js" type="text/javascript"></script>
81       <script src="./openlayers/OpenLayers.js" type="text/javascript"></script>
82       <script src="./js/admin.js" type="text/javascript"></script>
83
84     <noscript>
85     <style type="text/css">
86         #map, #editor, #admin, #login_area {
87             display: none;
88         }
89     </style>
90     </noscript>
91
92 </head>
93
94 <body>
95
96     <noscript>
97     <p><?php ptrans('SYP needs javascript. Please activate scripts in your browser.')?></p>
98     </noscript>
99
100     <div id="header">
101     <?php other_languages($lang) ?>
102     <p id="logout"><a href="logout.php"><?php ptrans('Logout')?></a></p>
103     </div>
104
105
106     <div id="map"></div>
107
108     <div id="admin" class="center">
109         <input id="newfeature_button" type="button" value="<?php ptrans('add a place')?>">
110         <p id="server_comm"></p>
111         <p id="instructions"></p>
112     </div>
113
114     <div id="editor" class="center">
115         <input id="editor_close" type="image" src="openlayers/theme/default/img/close.gif"
116              title="<?php ptrans('close without saving')?>" alt="<?php ptrans('close')?>">
117         <form id="feature_update" method="post" enctype="multipart/form-data">
118             <label for="title"><?php ptrans('title:')?></label><br>
119             <input id="title" name="title"><br>
120             <label for="description"><?php ptrans('description:')?></label><br>
121             <textarea id="description" name="description" rows="4"></textarea><br>
122             <div><img id="img"></div>
123             <input id="image_delete" type="button" value="<?php ptrans('delete image')?>">
124             <div>
125                 <label for="image_file"><?php ptrans('add an image:')?></label>
126                 <input id="image_file" type="file" name="image_file">
127             </div>
128             <br>
129             <div class="center">
130             <input id="validate_editor" type="submit" value="<?php ptrans('Validate changes')?>">
131             </div>
132             <input type="hidden" name="request">
133             <input type="hidden" name="lon">
134             <input type="hidden" name="lat">
135             <input type="hidden" name="fid">
136             <input type="hidden" name="keep_img">
137         </form>
138         <form id="feature_delete" method="post">
139             <input id="delete" type="submit" value="<?php ptrans('Delete item')?>">
140             <input type="hidden" name="request" value="del">
141             <input type="hidden" name="fid">
142         </form>
143         <p id="editor_throbber" class="throbber center">
144             <?php ptrans('Connecting')?>
145             <img src="media/editor-throbber.gif">
146         </p>
147     </div>
148
149       <div id="login_area"
150         <?php 
151         if ($logged) {
152             echo ' class="hidden"';
153         }
154       ?>>
155      <div id="login_transparency"></div>
156      <div id="login_padding"></div>
157      <div id="login_content">
158         <form id="login_form" method="post">
159         <div id="cookie_warning" class="center warn"><?php ptrans('You need to have cookies enabled to administrate SYP')?></div>
160             <table>
161                 <tr>
162                     <td><label for="user"><?php ptrans('user')?></label></td>
163                     <td style="width: 100%"><input id="user" name="user"></td>
164                 </tr>
165                 <tr>
166                     <td><label for="password"><?php ptrans('password')?></label></td>
167                     <td style="width: 100%"><input id="password" name="password" type="password"></td>
168                 </tr>
169             </table>
170             <p class="center">
171                 <input id="login_submit" type="submit" value="<?php ptrans('Connection')?>">
172                 <input type="hidden" name="request" value="auth">
173             </p>
174             <p id="pwd_throbber" class="throbber center">
175                 <?php ptrans('Connecting')?>
176                 <img src="media/pwd-throbber.gif" alt="throbber">
177             </p>
178             <p class="error center" id="login_error"></p>
179         </form>
180      </div>
181      </div>
182
183      <iframe id="api_frame" name="api_frame" src="" frameborder="0" width="0" height="0"></iframe>
184
185 </body>
186 </html>