From beba17e871265bd4926012479bf71d24cb6dbadf Mon Sep 17 00:00:00 2001 From: antifaz Date: Mon, 25 Nov 2013 00:29:24 +0100 Subject: [PATCH] Add roadmap and fix some bugs on delte --- README.md | 5 +++-- client/js/reclibrary.js | 35 +++++++++++++++++++++++++++++++---- client/tempo.html | 20 +------------------- server/server.py | 6 +++--- server/techrec.db | Bin 5120 -> 2048 bytes server/techrec.py | 4 ++-- 6 files changed, 40 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index b67d9bc..a17bc28 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ techrec ========================================== +BUG and roadmap +See roadmap for details -------- Client @@ -56,6 +58,5 @@ JSON = { 'op': 'delete' } -BUG -Da Salva button lo stato non va. Per il resto sembra funzionare. + diff --git a/client/js/reclibrary.js b/client/js/reclibrary.js index fcd6bd3..8bba1c3 100644 --- a/client/js/reclibrary.js +++ b/client/js/reclibrary.js @@ -129,14 +129,14 @@ function rec_new( ) // Bind the Delete Links $("#"+rs_dellink(recid)).click(function(){ console.log("Remove " + rs_trxarea(recid) + "[ID"+recid+"]"); - $("#"+rs_trxarea(recid)).remove(); - alert("Premuto del link. Invio al server ?"); + // $("#"+rs_trxarea(recid)).remove(); + recDelete (recid,rs_trxarea(recid)); }); // FORM SUBMIT: THE REC IS STOPPEND AND MUST BE PROCESSED $("#"+formid).submit(function(event){ // Immediately, mark the end time (stop action) - ChangeState(recid, trx_stopbut(recid) , trx_downbut(recid)); + ChangeState(recid, trx_downbut(recid) , trx_endbut(recid)); // Force a Name while (true) { @@ -180,6 +180,32 @@ function rec_new( ) console.log("New form has been built."); } +/* Delete Record */ +function recDelete ( recid, targetarea ) { + var formid = rs_formid( recid ); + var dataString = "recid="+recid + + console.log("Del rec: "+dataString); + var req_del = RecAjax("delete", dataString); + + req_del.done (function(data) { + $.each(data, function(del_key, del_val) { + console.log("K:V " + del_key +":"+del_val ); + + if (del_key == "message") { + $("#"+targetarea).fadeOut( 200, function() { $(this).remove(); }); + console.log("delete area "+rs_trxarea(key)); + + } + + if (del_key == "error") { + alert("Impossibile cancellare elemento:\n" + del_val ); + } + + }); + }); +} + /* New Record */ function recNew ( recid ) { var formid = rs_formid( recid ); @@ -187,7 +213,6 @@ function recNew ( recid ) { console.log("New rec: "+dataString); - var request = RecAjax("create", dataString); request.done( function(data) { @@ -309,3 +334,5 @@ function ChangeState(recid, from, to) { console.log("ChangeState: set '"+rs_inputend(recid)+ "' to "+ displayDate ); } } // End function ChangeState + + diff --git a/client/tempo.html b/client/tempo.html index 62c254b..f3d73ab 100644 --- a/client/tempo.html +++ b/client/tempo.html @@ -42,26 +42,8 @@ $(document).ready(function(){ $("#"+rs_trxarea(key)).html(str); $("#delete-"+val.id).click(function(evt) { evt.preventDefault(); - console.log("Delete request for ID "+ val.id); - var dataString = "id="+val.id - var req_del = RecAjax("delete", dataString); + recDelete(val.recid, rs_trxarea(key) ); - req_del.done (function(data) { - $.each(data, function(del_key, del_val) { - console.log("K:V " + del_key +":"+del_val ); - - if (del_key == "message") { - $("#"+rs_trxarea(key)).fadeOut( 500, function() { $(this).remove(); }); - console.log("delete area "+rs_trxarea(key)); - - } - - if (del_key == "error") { - alert("Impossibile cancellare elemento"); - } - - }); - }); } ); // End of delete link handler diff --git a/server/server.py b/server/server.py index 9c13e01..7adb8ab 100644 --- a/server/server.py +++ b/server/server.py @@ -85,11 +85,11 @@ class RecServer: def delete( self, recid = None ): self.enable_cors() req = dict( request.POST.allitems() ) - if not req.has_key( "id" ): + logging.info("Server: request delete %s " % ( req ) ) + if not req.has_key( "recid" ): return self.rec_err("No valid ID") - print "Server request delete for id %s " % ( req["id"] ) - if self.db.delete( req["id"] ): + if self.db.delete( req["recid"] ): return self.rec_msg("DELETE OK") else: return self.rec_err("DELETE error: %s" % (self.db.get_err())) diff --git a/server/techrec.db b/server/techrec.db index 2288cab917eb15f94f6b81b0f2129d2bbc4c5c6c..b08a6cea4f064a6b0c952dbcb5e24188a62c437d 100644 GIT binary patch delta 42 v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