From 11351a969a05274d75e84160b0b584e4e4901d1f Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Wed, 27 Nov 2013 08:30:39 +0100 Subject: [PATCH] add js method and server side managment for licencemgr command (uncomplete) --- TODO.txt | 8 +++++--- web/Obj/user.phh | 13 +++++++++---- web/commons.js | 22 ++++++++++++++++++++++ web/index_wr.php | 15 ++++++++------- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/TODO.txt b/TODO.txt index e18ee0c..e67c498 100644 --- 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 diff --git a/web/Obj/user.phh b/web/Obj/user.phh index c77f653..8ffeee8 100644 --- a/web/Obj/user.phh +++ b/web/Obj/user.phh @@ -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)); } diff --git a/web/commons.js b/web/commons.js index fbcd23c..ad18da4 100644 --- a/web/commons.js +++ b/web/commons.js @@ -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 diff --git a/web/index_wr.php b/web/index_wr.php index a9d8906..2098036 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -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"); -- 2.17.1