add js method and server side managment for licencemgr command (uncomplete)
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Wed, 27 Nov 2013 07:30:39 +0000 (08:30 +0100)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Wed, 27 Nov 2013 07:30:39 +0000 (08:30 +0100)
TODO.txt
web/Obj/user.phh
web/commons.js
web/index_wr.php

index e18ee0c..e67c498 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -6,9 +6,11 @@
    - AUTO-MAINTENANCE
      . policy acceptance
        . policy version
-       WIP . user policy acceptance (db field)
-       . show licence ([show me later, yes, no]/[yes, no])
-       . switch-off date
+       DONE . user policy acceptance (db field)
+       DONE . show licence ([show me later, yes, no]/[yes, no])
+       DONE . switch-off date
+       . checkbox for anonimous users with message when not checked
+       . disable user reason field
        . opt - button on when arrived to the bottom of the licence
        . opt - download licence
        . min - check licence version between config file and licence file
index c77f653..8ffeee8 100644 (file)
@@ -592,13 +592,18 @@ class User {
                           if ($curtime > $G_lice_dtsoft) {
                               // call notify soft
                               $ret .=  show_notify_document("Versione corrente: [".$this->rec->lice_vers_get()."] Versione sito: ".$G_lice_vers,
-                               0, array($mlang_indrd['btn_backtotab'][$G_lang],"pippo", "pluto"),
-                               400, 600, TRUE, 0);
-                              $ret .= "alert('RESULT: ' + g_nd.ret_get());";
+                                       0, array("Accetto.", "Rifiuto.", "Leggo poi.",  /* , "Scarico." */),
+                                       400, 600, TRUE, 0);
+                              $ret .= sprintf("act_licencemgr('soft', g_nd.ret_get(), '%s', '%s');", 
+                                              xcape($this->rec->lice_vers_get()), xcape($G_lice_vers));
                           }
                           else if ($curtime > $G_lice_dthard) {
                               // call notify hard
-                              ;
+                              $ret .=  show_notify_document("Versione corrente: [".$this->rec->lice_vers_get()."] Versione sito: ".$G_lice_vers,
+                                       0, array("Accetto.", "Rifiuto." /* , "Scarico." */),
+                                       400, 600, TRUE, 0);
+                              $ret .= sprintf("act_licencemgr('hard', g_nd.ret_get(), '%s', '%s');", 
+                                              xcape($this->rec->lice_vers_get()), xcape($G_lice_vers));
                           }
 
 
index fbcd23c..ad18da4 100644 (file)
@@ -473,6 +473,28 @@ function postact_logout()
     document.location.assign("index.php");
 }
 
+/*
+  type - 'hard' or 'soft'
+  code - if soft: accept (0), deny (1), after (2)
+         if hard: accept (0), deny (1)
+ */
+function act_licencemgr(type, code, lice_curr, lice_vers)
+{
+    if (type != "soft" && type != "hard") {
+        return false;
+    }
+    switch (code) {
+    case 0:
+    case 1:
+        send_mesg("licencemgr|"+type+"|"+code+"|"+lice_curr+"|"+lice_vers);
+        break;
+    case 2:
+        break;
+    default:
+        break;
+    }
+}
+
 /*
   function slowimg(img,x1,y1,deltat,free,action,srcend)
   img    - image to move
index a9d8906..2098036 100644 (file)
@@ -515,9 +515,7 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie)
             $user->step_inc();
             
         }
-        
         else if ($argz[0] == 'placing') {
-            
             require_once("briskin5/Obj/briskin5.phh");
             require_once("briskin5/Obj/placing.phh");
             
@@ -526,11 +524,7 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie)
             
             log_wr($user->comm[$user->step % COMM_N]);
             $user->step_inc();
-            
-            
         }
-        
-        
         else if ($argz[0] == 'roadmap') {
             $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ";
             $user->comm[$user->step % COMM_N] .=  show_notify(str_replace("\n", " ", $G_room_roadmap[$G_lang]), 0, $mlang_indwr['btn_backtotab'][$G_lang], 400, 200);
@@ -550,13 +544,20 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie)
         else if ($argz[0] == 'chatt') {
             $room->chatt_send(&$user, xcapemesg($mesg));
         }
+        else if ($argz[0] == 'licencemgr') {
+            $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ";
+
+            $user->comm[$user->step % COMM_N] .=  show_notify(xcape("FIN QUI |"."${argz[1]}"."|"."${argz[2]}"."|"."${argz[3]}"."|"."${argz[4]}"), 0, $mlang_indwr['btn_backtotab'][$G_lang], 400, 200);
+
+            log_wr($user->comm[$user->step % COMM_N]);
+            $user->step_inc();
+        }
         /**********************
          *                    *
          *   SUBST: standup   *
          *                    *
          **********************/
         else if ($user->subst == 'standup') {
-
             if ($argz[0] == 'sitdown') {
                 log_wr("SITDOWN command");