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