Links reorganized

This commit is contained in:
boyska 2013-11-26 14:04:33 +01:00
parent 36eae35528
commit 816d923d02
5 changed files with 60 additions and 61 deletions

View file

@ -5,10 +5,10 @@
<title> TechREC </title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="/static/css/style.css">
<script src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/reclibrary.js"></script>
<script src="/static/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/static/js/reclibrary.js"></script>
<script>
@ -35,7 +35,7 @@ $(document).ready(function(){
<h2>
<a href="#" id="newlink">+ nuova registrazione</a> <br />
<a href="tempo.html"> macchina del tempo</a>
<a href="/tempo.html"> macchina del tempo</a>
</h2>
<div id="buttonscontainer"> </div>

View file

@ -9,52 +9,7 @@
<script src="/static/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/static/js/reclibrary.js"></script>
<script>
/*
TODO:
prendere lo stato !!!
*/
$(document).ready(function(){
$("#searchform").submit(
function (event) {
event.preventDefault();
dataString = $(this).serialize();
var request = RecAjax("search", dataString);
$("#searchresult").html(" ");
request.done( function(data) {
$.each(data, function(key, val) {
console.log("Extract " + key );
var divstring = "<div class=\"searchresult\" id=\""+ rs_trxarea(key) +"\"> </div>";
$("#searchresult").append( divstring );
// var str = newformstr( key ); // new form
var str = "";
str += "<div class=\"namevalues\">"+val.name+" - <a href=\"\">Scarica</a> <a href=\"\" id=\"delete-"+val.id+"\">Cancella</a></div>";
str += "<div class=\"namevalues\">RECID: "+val.recid+" ID: "+ val.id + " Active " + val.active + "</div>";
str += "<div class=\"timevalues\">["+val.starttime+" >>> "+val.endtime+"]</div>"
$("#"+rs_trxarea(key)).html(str);
$("#delete-"+val.id).click(function(evt) {
evt.preventDefault();
recDelete(val.recid, rs_trxarea(key) );
}
); // End of delete link handler
});
});
});
$("#searchform").submit();
});
</script>
<script type="text/javascript" src="/static/js/tempo.js"> </script>
</head>
<body>
@ -63,7 +18,7 @@ $(document).ready(function(){
<h1> techr*c </h1>
<h2> <a href="index.html"> Nuova registrazione</a> </h2>
<h2> <a href="/new.html"> Nuova registrazione</a> </h2>
<div id="buttonscontainer">
<form action="#" method="POST" id="searchform">

View file

@ -2,7 +2,7 @@
import datetime
import logging
from bottle import Bottle, hook, response, request,static_file
from bottle import Bottle, hook, response, request,static_file, redirect
from techrec import Rec, RecDB
@ -46,9 +46,10 @@ class RecServer:
callback= lambda f: static_file(f, root='static/css/'))
self._app.route('/img/<f>',
callback= lambda f: static_file(f, root='static/img/'))
self._app.route('/', callback=lambda: static_file('index.html',
self._app.route('/', callback=lambda: redirect('/new.html'))
self._app.route('/new.html', callback=lambda: static_file('new.html',
root='pages/'))
self._app.route('/tempo', callback=lambda: static_file('tempo.html',
self._app.route('/tempo.html', callback=lambda: static_file('tempo.html',
root='pages/'))
def extsearch( self, args ):

43
server/static/js/tempo.js Normal file
View file

@ -0,0 +1,43 @@
/*
TODO:
prendere lo stato !!!
*/
$(document).ready(function(){
$("#searchform").submit(
function (event) {
event.preventDefault();
dataString = $(this).serialize();
var request = RecAjax("search", dataString);
$("#searchresult").html(" ");
request.done( function(data) {
$.each(data, function(key, val) {
console.log("Extract " + key );
var divstring = "<div class=\"searchresult\" id=\""+ rs_trxarea(key) +"\"> </div>";
$("#searchresult").append( divstring );
// var str = newformstr( key ); // new form
var str = "";
str += "<div class=\"namevalues\">"+val.name+" - <a href=\"\">Scarica</a> <a href=\"\" id=\"delete-"+val.id+"\">Cancella</a></div>";
str += "<div class=\"namevalues\">RECID: "+val.recid+" ID: "+ val.id + " Active " + val.active + "</div>";
str += "<div class=\"timevalues\">["+val.starttime+" >>> "+val.endtime+"]</div>"
$("#"+rs_trxarea(key)).html(str);
$("#delete-"+val.id).click(function(evt) {
evt.preventDefault();
recDelete(val.recid, rs_trxarea(key) );
}
); // End of delete link handler
});
});
});
$("#searchform").submit();
});
// vim: set ts=4 sw=4 noet: