]> 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>
Thu, 20 Aug 2009 13:38:07 +0000 (15:38 +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 ac49d76665ca7cec11da77cad84d1b03c3bc3181..c3405e8ec6259c53ee5598b1348ab718083fe40e 100644 (file)
--- a/api.php
+++ b/api.php
@@ -255,6 +255,7 @@ function main ($con) {
             if ($_POST ["keep_img"] == "yes") {
                 $imgpath = $feature->imgpath;
             } else {
             if ($_POST ["keep_img"] == "yes") {
                 $imgpath = $feature->imgpath;
             } else {
+                error_request ();
                 $imgpath = save_uploaded_file ($_FILES ["image_file"], $con);
             }
 
                 $imgpath = save_uploaded_file ($_FILES ["image_file"], $con);
             }
 
@@ -295,6 +296,7 @@ function main ($con) {
             success_feature ($new_feature, "update");
         break;
         case "add":
             success_feature ($new_feature, "update");
         break;
         case "add":
+            error_request ();
             $imgpath = save_uploaded_file ($_FILES ["image_file"], $con);
 
             $lon = $_POST ["lon"];
             $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":
             success_feature ($feature, "add");
         break;
         case "del":
+            error_request ();
             $id = $_POST ["fid"];
             $feature = $con->getfeature ($id);
             if (!isset ($feature)) {
             $id = $_POST ["fid"];
             $feature = $con->getfeature ($id);
             if (!isset ($feature)) {
@@ -336,6 +339,7 @@ function main ($con) {
 
             success_delete_feature ($feature);
         case "changepass":
 
             success_delete_feature ($feature);
         case "changepass":
+            error_request ();
             $currpass = unquote ($_POST ["pass_current"]);
             if (!$con->checkpwdmd5 ($user, md5 ($currpass))) {
                 error_wrongpass ();
             $currpass = unquote ($_POST ["pass_current"]);
             if (!$con->checkpwdmd5 ($user, md5 ($currpass))) {
                 error_wrongpass ();
@@ -350,6 +354,7 @@ function main ($con) {
             success_changepass ($user);
         break;
         case "newuser":
             success_changepass ($user);
         break;
         case "newuser":
+            error_request ();
             if ($user != "admin") {
                 error_unauthorized ();
             }
             if ($user != "admin") {
                 error_unauthorized ();
             }
index 7702b949b7408fd720eaf0f140b042af2e7e3fb1..9f2fbd18e8d1ca86f2a748e892f8e9407bf0084f 100644 (file)
@@ -75,7 +75,8 @@ if (!$usrtblexists || !$itemstblexists) {
             changePassSuccess: "<?php ptrans('Password changed correctly.')?>",
             newUserNonameError: "<?php ptrans('User name has not been set.')?>",
             newUserExistsError: "<?php ptrans('User already exists in database.')?>",
             changePassSuccess: "<?php ptrans('Password changed correctly.')?>",
             newUserNonameError: "<?php ptrans('User name has not been set.')?>",
             newUserExistsError: "<?php ptrans('User already exists in database.')?>",
-            newUserSuccess: "<?php ptrans('User added correctly.')?>"
+            newUserSuccess: "<?php ptrans('User added correctly.')?>",
+            DisabledForDemo: "<?php ptrans('This feature is not enabled on demo site')?>"
         };
 
         var sypSettings =  {
         };
 
         var sypSettings =  {
index 85a28ddca09ee94712d9ba3e547bd01a6745a30f..5b27b9d7615cf94e2444214508cb11f88adeaa07 100644 (file)
@@ -268,8 +268,9 @@ var Admin = {
     },
 
     addNewFeature: function () {
     },
 
     addNewFeature: function () {
+        alert (SypStrings.DisabledForDemo);
+        return;
         userMgr.close();
         userMgr.close();
-
         function cancel() {
             $(document).unbind("keydown");
             Admin.reset()
         function cancel() {
             $(document).unbind("keydown");
             Admin.reset()
@@ -429,6 +430,8 @@ var FeatureMgr = {
     },
 
     del: function (feature) {
     },
 
     del: function (feature) {
+        alert (SypStrings.DisabledForDemo);
+        return;
         var form = $("#feature_delete");
         form.find('input[name="fid"]').val(feature.fid);
         AjaxMgr.add({
         var form = $("#feature_delete");
         form.find('input[name="fid"]').val(feature.fid);
         AjaxMgr.add({
@@ -932,6 +935,10 @@ var userMgr = {
 
         this.commError("");
 
 
         this.commError("");
 
+        this.disableForms();
+        alert (SypStrings.DisabledForDemo);
+        return;
+
         AjaxMgr.add({
             form: $("#changepass"),
             oncomplete: OpenLayers.Function.bind(this.ajaxReply, this),
         AjaxMgr.add({
             form: $("#changepass"),
             oncomplete: OpenLayers.Function.bind(this.ajaxReply, this),
@@ -1009,6 +1016,9 @@ var userMgr = {
         }
 
         this.commError("");
         }
 
         this.commError("");
+        this.disableForms();
+        alert (SypStrings.DisabledForDemo);
+        return;
 
         AjaxMgr.add({
             form: $("#newuser"),
 
         AjaxMgr.add({
             form: $("#newuser"),
@@ -1167,6 +1177,8 @@ $(window).load(function () {
         return false;
     });
     $("#image_delete").click(function() {
         return false;
     });
     $("#image_delete").click(function() {
+            alert (SypStrings.DisabledForDemo);
+            return;
             $("#img").removeAttr('src');
             // needs to rebuild element otherwise some browsers still
             // display image.
             $("#img").removeAttr('src');
             // needs to rebuild element otherwise some browsers still
             // display image.