From: www-data Date: Thu, 11 Dec 2014 13:23:45 +0000 (+0100) Subject: New version. X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=a3febf29e180b800ef4b1a9a9d259474a906057d;p=logicplayer.git New version. --- diff --git a/public_html/login.css b/public_html/login.css index dc4f5da..1b0c1c9 100755 --- a/public_html/login.css +++ b/public_html/login.css @@ -1,16 +1,69 @@ #login +{ + display: inline-block; + padding: 15px; + border-radius: 5px; + background-color: darkgray; + margin:15%; + border: solid 1px; + border-color: darkslateblue; +} + +#esTable { + display: inline-block; + padding: 5px; + border-radius: 5px; + background-color: darkgray; + vertical-align:top; +} +#tabella +{ + display: inline-block; + padding: 5px; + border-radius: 5px; + background-color: lightgray; + vertical-align:top; +} +#esTa{ + display: inline-block; + padding: 5px; + border-radius: 5px; + background-color: darkgray; + vertical-align:top; +} +#tab +{ + display: inline-block; + padding: 5px; + border-radius: 5px; + background-color: lightgray; + vertical-align:top; +} +#corpo { width:100%; display:inline-block; text-align:center; } -#esTable +#upload { - display:block; - float:left; + border-radius: 5px; + background-color: cadetblue; + display: inline-block; + padding: 10px; + margin: 5px; } -#tabella +body +{ + background: lightslategrey; + text-align:center; +} +input +{ + border-radius: 5px; +} +button { - display:block; - float:left; + border-radius: 5px; } + diff --git a/public_html/login.js b/public_html/login.js index e9afdc4..f3a29f4 100755 --- a/public_html/login.js +++ b/public_html/login.js @@ -1,8 +1,8 @@ function change() { -/*Quando viene chiamata, modifica il campo "location" di document*/ -/*effettuando un redirect sulla pagina main.php*/ -document.location.href="./main.php"; + /*Quando viene chiamata, modifica il campo "location" di document*/ + /*effettuando un redirect sulla pagina main.php*/ + document.location.href="./main.php"; } @@ -31,7 +31,7 @@ function login() $("#errlogin").fadeIn(); setTimeout(function(){$("#errlogin").fadeOut()}, 2000); - } + }, }); } diff --git a/public_html/login.php b/public_html/login.php index adadff4..e3a96c8 100755 --- a/public_html/login.php +++ b/public_html/login.php @@ -1,8 +1,10 @@ "errore nella connessione al database"); @@ -12,7 +14,7 @@ } else { - $str="SELECT * FROM admin WHERE username='".$result->username."' AND password='".$result->password."';"; + $str="SELECT * FROM ".$DATA['tbWebAdmin']." WHERE ".$DATA['clUser']."='".$result->username."' AND ".$DATA['clPass']."='".$result->password."';"; $exists= mysqli_query($con,$str); if (!($exists)) { diff --git a/public_html/main.php b/public_html/main.php index 2866325..d88e8ca 100755 --- a/public_html/main.php +++ b/public_html/main.php @@ -17,8 +17,8 @@ - -
+ + Select file to upload: @@ -34,8 +34,24 @@ Nome Esercizio Studente - click - + voto + + + +
+
+ + + + +
Lista studenti
+ + + + + + +
StudenteNome Eserciziovoto
diff --git a/public_html/printEs.php b/public_html/printEs.php index 6c4b6e8..3a25c9e 100755 --- a/public_html/printEs.php +++ b/public_html/printEs.php @@ -1,5 +1,5 @@ "; diff --git a/public_html/prova.js b/public_html/prova.js index 62d03ef..454156b 100755 --- a/public_html/prova.js +++ b/public_html/prova.js @@ -21,20 +21,71 @@ function update(event) success:function(val) { $("#tabella").empty(); - $("#tabella").append("Nome EsercizioStudenteClick"); + $("#tabella").append("Nome EsercizioStudentevoto"); $.each(val.esercizi, function(i, item) { var id="es"+i; - for(j=0;j').attr('id',id_i)); - id_i="#"+id_i; - $(id_i).append($('').text(item.esercizio)); - $(id_i).append($('').text(item.risultati[j].utente)); - $(id_i).append($('').text(item.risultati[j].click)); - $(id_i).append($('').attr('risultato',item.risultati[j].click)); + for(j=0;j'; + $("#tabella").append($('').attr('id',id_i)); + id_i="#"+id_i; + $(id_i).append($('').text(item.esercizio)); + $(id_i).append($('').text(item.risultati[j].utente)); + $(id_i).append($('').text(item.risultati[j].click)); + $(id_i).append($('').append(tmpel)); + } } }); + $(".elimina").click(function(event){elimina(event);}); + }, + }); +} + +function updateUsr(event) +{ + var str; + if (event==null) + str='all'; + else{ + var object=event.target; + str=object.getAttribute("utente"); + } + var query="./esForUsr.php"; + var request=new Object(); + request.name=str; + var sendstr=JSON.stringify(request); + $.ajax({ + url:query, + type:"POST", + async: "true", + dataType: "json", + data:sendstr, + contentType: "application/json; charset=utf-8", + success:function(val) + { + $("#tab").empty(); + $("#tab").append("StudenteNome Eserciziovoto"); + $.each(val.esercizi, function(i, item) { + var id="ut"+i; + if(item.risultati[0].id!=null) + { + for(j=0;j'; + $("#tab").append($('').attr('id',id_i)); + id_i="#"+id_i; + $(id_i).append($('').text(item.risultati[j].utente)); + $(id_i).append($('').text(item.esercizio)); + $(id_i).append($('').text(item.risultati[j].click)); + $(id_i).append($('').append(tmpel)); + } + } + }); + $(".elimina").click(function(event){elimina(event);}); }, }); } @@ -50,23 +101,97 @@ function esList() accepts: {json:"application/json"}, success:function(val) { + var ok=0; $("#esTable").empty(); $("#esTable").append("Nome Esercizio"); $.each(val.esercizi, function(i, item) { - var id="ex"+i; - $("#esTable").append($('').attr('id',id)); - $("#ex"+i).append($('').text(item)); - $("#ex"+i).append($('').attr('esercizio',item)); - $("#ex"+i).append($('').attr('esercizio',item)); + if(item!=null) + { + ok=1; + var id="ex"+i; + var tmpel=''; + var tmpsel=''; + $("#esTable").append($('').attr('id',id)); + $("#ex"+i).append($('').text(item)); + $("#ex"+i).append($('').append(tmpsel)); + $("#ex"+i).append($('').append(tmpel)); + } }); - $("#esTable").append(''); + if(ok==1) + $("#esTable").append(''); $(".seleziona").click(function(event){update(event);}); + $(".elimina").click(function(event){elimina(event);}); + }, + }); +} + +function usrList() +{ + var query="./utenti.php"; + $.ajax({ + url:query, + type:"GET", + async: "true", + dataType: "json", + accepts: {json:"application/json"}, + success:function(val) + { + var ok=0; + $("#esTa").empty(); + $("#esTa").append("Nome Studente"); + $.each(val.utenti, function(i, item) { + if(item!=null) + { + ok=1; + var id="ut"+i; + var tmpel=''; + var tmpsel=''; + $("#esTa").append($('').attr('id',id)); + $("#ut"+i).append($('').text(item)); + $("#ut"+i).append($('').append(tmpsel)); + $("#ut"+i).append($('').append(tmpel)); + } + }); + if(ok==1) + $("#esTa").append(''); + $(".selezionaUT").click(function(event){updateUsr(event);}); + $(".elimina").click(function(event){elimina(event);}); }, }); } +function elimina(event) +{ + var object=event.target; + var query="./elimina_esercizio.php"; + var request=new Object(); + request.id=object.getAttribute("risultato"); + if(request.id==0) + request.esercizio=object.getAttribute("esercizio"); + else if(request.id<0) + request.utente=object.getAttribute("utente"); + var sendstr=JSON.stringify(request); + $.ajax({ + url:query, + type:"POST", + async: "true", + dataType: "json", + data:sendstr, + contentType: "application/json; charset=utf-8", + success:function(val) + { + esList(); + update(); + usrList(); + updateUsr(); + } + }); +} + $(document).ready(function(){ esList(); + usrList(); update(); + updateUsr(); $(".seleziona").click(function(event){update(event);}); }); diff --git a/public_html/serverRequest.php b/public_html/serverRequest.php index 9f7a781..2303440 100755 --- a/public_html/serverRequest.php +++ b/public_html/serverRequest.php @@ -1,8 +1,9 @@ "errore nella connessione al database"); @@ -11,9 +12,9 @@ die; } if($result->name=='all') - $str="SELECT * FROM esercizi;"; + $str="SELECT * FROM ".$DATA['tbEsercizi'].";"; else - $str="SELECT * FROM esercizi WHERE esercizio='".$result->name."' ORDER BY esercizio;"; + $str="SELECT * FROM ".$DATA['tbEsercizi']." WHERE ".$DATA['clEsercizio']."='".$result->name."' ORDER BY ".$DATA['clEsercizio'].";"; $str=mysqli_query($con,$str); if (!$str) { @@ -25,13 +26,13 @@ $esercizi; $risp=mysqli_fetch_array($str); $risultati; - $esercizio['esercizio']=$risp['esercizio']; + $esercizio['esercizio']=$risp[$DATA['clEsercizio']]; do { - if($esercizio['esercizio']==$risp['esercizio']) + if($esercizio['esercizio']==$risp[$DATA['clEsercizio']]) { //aggiungo utenti e click ell'es corrente - $risultati[]=array('id'=>$risp['id'],'utente'=>$risp['utente'],'click'=>$risp['click']); + $risultati[]=array('id'=>$risp[$DATA['clId']],'utente'=>$risp[$DATA['clUser']],'click'=>$risp[$DATA['clVoto']]); } else { @@ -40,8 +41,8 @@ $esercizi[]=$esercizio; unset($esercizio); unset($risultati); - $esercizio['esercizio']=$risp['esercizio']; - $risultati[]=array('id'=>$risp['id'],'utente'=>$risp['utente'],'click'=>$risp['click']); + $esercizio['esercizio']=$risp[$DATA['clEsercizio']]; + $risultati[]=array('id'=>$risp[$DATA['clId']],'utente'=>$risp[$DATA['clUser']],'click'=>$risp[$DATA['clVoto']]); } }while($risp=mysqli_fetch_array($str)); $esercizio['risultati']=$risultati; diff --git a/public_html/upload.php b/public_html/upload.php index 67c3a7a..c0446c6 100755 --- a/public_html/upload.php +++ b/public_html/upload.php @@ -1,4 +1,5 @@ esercizio as $esercizio) + { + if($esercizio==basename( $_FILES["fileToUpload"]["name"])) + { + echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded."; + die; + } + } } + echo "Sorry, there was an error uploading your file."; } ?> diff --git a/public_html/xmlPharse.php b/public_html/xmlPharse.php index 6dbe115..7cfcce3 100755 --- a/public_html/xmlPharse.php +++ b/public_html/xmlPharse.php @@ -1,6 +1,7 @@ esercizio as $esercizio) {