]> dev.renevier.net Git - syp.git/commitdiff
demo restrictions
authorarno <arenevier@fdn.fr>
Sun, 26 Jul 2009 16:40:31 +0000 (18:40 +0200)
committerarno <arenevier@fdn.fr>
Wed, 26 Aug 2009 19:27:05 +0000 (21:27 +0200)
forbirds creation or deletion of item
forbirds adding or deleting an image
forbirds adding an user
forbids changing password

api.php
inc/html/admin.php
js/admin.js

diff --git a/api.php b/api.php
index e74f3b46ff1e0d873f486053ae8f47f0aa157bbb..7895dadec249500bbd5cea178bd76c3421bdc5d4 100644 (file)
--- a/api.php
+++ b/api.php
@@ -255,6 +255,7 @@ function main ($con) {
             if ($_POST ["keep_img"] == "yes") {
                 $imgpath = $feature->imgpath;
             } else {
+                error_request ();
                 $imgpath = save_uploaded_file ($_FILES ["image_file"], $con);
             }
 
@@ -295,6 +296,7 @@ function main ($con) {
             success_feature ($new_feature, "update");
         break;
         case "add":
+            error_request ();
             $imgpath = save_uploaded_file ($_FILES ["image_file"], $con);
 
             $lon = $_POST ["lon"];
@@ -314,6 +316,7 @@ function main ($con) {
             success_feature ($feature, "add");
         break;
         case "del":
+            error_request ();
             $id = $_POST ["fid"];
             $feature = $con->getfeature ($id);
             if (!isset ($feature)) {
@@ -336,6 +339,7 @@ function main ($con) {
 
             success_delete_feature ($feature);
         case "changepass":
+            error_request ();
             $currpass = unquote ($_POST ["pass_current"]);
             if (!$con->checkpwdmd5 ($user, md5 ($currpass))) {
                 error_wrongpass ();
@@ -353,6 +357,7 @@ function main ($con) {
             success_changepass ($user);
         break;
         case "newuser":
+            error_request ();
             if ($user != "admin") {
                 error_unauthorized ();
             }
index ca2dd4dcd204bca2755f3cdde29212e4519b5c80..56ac0a90feaaa207da0889893ec4d520ab2854ab 100644 (file)
@@ -77,7 +77,8 @@ if (!$usrtblexists || !$itemstblexists) {
             changePassSuccess: "<?php ptrans('Password successfully changed.')?>",
             newUserNonameError: "<?php ptrans('User name has not been set.')?>",
             newUserExistsError: "<?php ptrans('User already exists in database.')?>",
-            newUserSuccess: "<?php ptrans('User successfully added.')?>"
+            newUserSuccess: "<?php ptrans('User successfully added.')?>",
+            DisabledForDemo: "<?php ptrans('This feature is not enabled on demo site')?>"
         };
 
         var sypSettings =  {
index abce8a52ef93ee15b24df7ed9f5702e383e852e4..d1bd22e5f0d19bd17bd670d170c7962fca0002e7 100644 (file)
@@ -269,7 +269,6 @@ var Admin = {
 
     addNewFeature: function () {
         userMgr.close();
-
         function cancel() {
             $(document).unbind("keydown");
             Admin.reset()
@@ -398,6 +397,10 @@ var FeatureMgr = {
     },
 
     add: function(evt) {
+        alert (SypStrings.DisabledForDemo);
+        $(document).unbind("keydown");
+        Admin.reset()
+        return;
         var map = Admin.map;
         var pos = map.getLonLatFromViewPortPx(evt.xy);
         feature = this.update (null, pos, "", "", "");
@@ -429,6 +432,8 @@ var FeatureMgr = {
     },
 
     del: function (feature) {
+        alert (SypStrings.DisabledForDemo);
+        return;
         var form = $("#feature_delete");
         form.find('input[name="fid"]').val(feature.fid);
         AjaxMgr.add({
@@ -938,6 +943,10 @@ var userMgr = {
 
         this.commError("");
 
+        this.disableForms();
+        alert (SypStrings.DisabledForDemo);
+        return;
+
         AjaxMgr.add({
             form: $("#changepass"),
             oncomplete: OpenLayers.Function.bind(this.ajaxReply, this),
@@ -1021,6 +1030,9 @@ var userMgr = {
         }
 
         this.commError("");
+        this.disableForms();
+        alert (SypStrings.DisabledForDemo);
+        return;
 
         AjaxMgr.add({
             form: $("#newuser"),
@@ -1179,6 +1191,8 @@ $(window).load(function () {
         return false;
     });
     $("#image_delete").click(function() {
+            alert (SypStrings.DisabledForDemo);
+            return;
             $("#img").removeAttr('src');
             // needs to rebuild element otherwise some browsers still
             // display image.