From 17f21e8b0d10062b8d27e4f367995f5ab2dba6a6 Mon Sep 17 00:00:00 2001 From: Lorenzo Giacomelli Date: Mon, 7 Mar 2016 16:08:40 +0100 Subject: [PATCH] Aggiornato testo CommentoModel; Guihandeler::generateHeadPublic link registrami crea una piccola finestra; articolo da finire backend per inviare commento --- oth/img/leftArrow.xcf | Bin 0 -> 4021 bytes private/lib/dao/models/CommentoModel.php | 2 +- private/lib/gui/GUIHandler.php | 3 +- public/articolo.php | 53 ++++++++++++++++++++--- public/js/functions.js | 19 ++++++++ public/registration.php | 19 ++++++++ public/sendCommentoBackend.php | 41 ++++++++++++++++++ public/style/public.css | 34 +++++++++++++++ 8 files changed, 162 insertions(+), 9 deletions(-) create mode 100644 oth/img/leftArrow.xcf create mode 100644 public/registration.php create mode 100644 public/sendCommentoBackend.php diff --git a/oth/img/leftArrow.xcf b/oth/img/leftArrow.xcf new file mode 100644 index 0000000000000000000000000000000000000000..f153baecdbac10fa7e3303e80968fe12c293c971 GIT binary patch literal 4021 zcmchayKf^^6vpq2J${Yt+3?r}ft1g|06Qdb%>c{7?FsNK*r5l-Hyh#x-{|p4P}urFDFWA1APcU6 zi(1pTOG??_prtDZs&|_GhYi0!*lqfAFS41Y(azSgh>);Xxr3Vb&UCv=URrg4eg$9LmoFR8~o$aoVuTkG4#_2k@o0? zHjY!Rv)gDlYwi8c4h_VfwA9k@;6bnH4+p)@&T?s~)!rWT2K)XJH?{rt-G;w@eVwl< zVncT=W9r>0Q>EYkXF*f%5BD0|oqpTj5MMApm}b)Oq}4F5^}+^67s>4GARU$N+<>kN+<>M%ES$>Dxn8d>O>Uz z@oA(>encIKB0sa#T_!*1ex1~F$!s?s{gf3sK2DtTIvh|b9{pZSjPQM$gw9d$>lEYB zqnX4A`L!i-+)Z-8Z^n5kupceqhttY=xuhy6Jqsv(iz$jIn?eEQRLG;un&eQ11qbC> z$f9hUWKh-xJ6JBp4fOt>~N~ljJMbs~$fVw8+QSVH0sE2}sIw@pPKTR^I zv4R~T7L64l76TO_9vsXPiiJrL#Y8Be$Ow59ACnx4li;9e30V{~lMD);V26lDV}*#v zK!p|BLiw1s9si8j{in&{;d8(TD#trRBzA_D*cp5t`E0RrcxPydoxw+(PbRA@??5f# zhYJLsYgQTdBNBeJgdeUnTq{`F>_h$@;zI)rnU;r( zw;Mxz)$TX^osK_j_L>hngFgTNmG3^u%pq3zH{YC9jH9`f;R`^&m3%&uSzq2g2zf!+ Zz4yV#x>MV|4`KU=Z2WR~A;`&#`~|#)U=IKQ literal 0 HcmV?d00001 diff --git a/private/lib/dao/models/CommentoModel.php b/private/lib/dao/models/CommentoModel.php index e444812..a3c120a 100644 --- a/private/lib/dao/models/CommentoModel.php +++ b/private/lib/dao/models/CommentoModel.php @@ -13,7 +13,7 @@ class CommentoModel extends Model{ ); /** - * saveableObject deve avere alemeno il campo notizia = notiziaId; + * saveableObject deve avere alemeno il campo notizia = notiziaId e il campo user = userId; * @param stdClass $saveableObject * @throws CoreException */ diff --git a/private/lib/gui/GUIHandler.php b/private/lib/gui/GUIHandler.php index 808b6e5..ce89427 100644 --- a/private/lib/gui/GUIHandler.php +++ b/private/lib/gui/GUIHandler.php @@ -150,10 +150,11 @@ class GUIHandler { $day = date("d"); ?> +
- Aggiornato alle
- +
diff --git a/public/articolo.php b/public/articolo.php index 00062d2..79b1fcc 100644 --- a/public/articolo.php +++ b/public/articolo.php @@ -7,6 +7,7 @@ Creation Date: 05/feb/2016 require_once(dirname(__FILE__)."/load.php"); try { + $sendComment = false; $articolo = null; if (array_key_exists("id", $_GET)){ $articolo = GlobalVariables::get("dao")->getFirst("NotiziaModel",array("id"=>$_GET["id"],"status"=>NotiziaModel::STATUS_ACCEPTED)); @@ -22,7 +23,7 @@ try { $media = DaoMediaHandler::getMainMediaFromModel($articolo); $medias = DaoMediaHandler::getMedias($articolo); // echo $articolo->titolo; - var_dump($medias); +// var_dump($medias); $mesi = array(1=>'Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre','Dicembre'); @@ -36,6 +37,7 @@ try { else if ($media->mediaType == MediaModel::TYPE_IMAGE){ $mediaMetaInfo = 'itemprop="image"'; } + }catch(GUIException $ex){ $error = $ex->getMessage(); }catch (Exception $exec){ @@ -102,14 +104,20 @@ try {
- -
-
- - +
+ +
+ +
Titolo commento:
+ +
Commento:
+ +
+ Invia +
- +
TUTTI I COMMENTI
@@ -149,5 +157,36 @@ try { // alert(actualLeft); } }); + + $("#submit").click(function (){ +// $("form#commentoForm").submit(function (){ + $.ajax({ + method:'POST', + url:'sendCommentoBackend.php', + dataType:'html', + data:$("#commentoForm").serialize(), + success: function(data){ + $("#commentoArea").remove(); + $("#sentMessage").html(data); + } + }); +// }); + }); + + +// $("form#commentoForm").on('submit',function (){ +// $.ajax({ +// type:'post', +// url:'sendCommentoBackend.php', +// dataType:'html', +// data:$("#commentoForm").serialize(), +// target: '#sentMessage', +// complete: function(){ +// $("#commentoArea").remove(); + +// } +// }); +// }); + }); \ No newline at end of file diff --git a/public/js/functions.js b/public/js/functions.js index bbd8319..2157ff7 100644 --- a/public/js/functions.js +++ b/public/js/functions.js @@ -11,3 +11,22 @@ function bannerClick(banner, link){ $.ajax({url: "stats/bannerClick.php", method: "POST", data: { "banner": banner, "source": window.location.href }, dataType: "html" }); window.open(link); } + +function openRegistrationModal(){ + $.ajax({ + method:"POST", + url:'registration.php', + dataType:'html', + success: function(data){ + $("#floating").html(data); + var off = $("#regButton").offset(); + var right = $(document).width()-off.left - $("#regButton").outerWidth(); + $("#floating").css("position","absolute").css("right",right).css("top",off.top+25); + $("#floating").show(); + } + }); +} + +function sendRegistration(){ + +} \ No newline at end of file diff --git a/public/registration.php b/public/registration.php new file mode 100644 index 0000000..c633af2 --- /dev/null +++ b/public/registration.php @@ -0,0 +1,19 @@ + +
+
Email:
+
Password:
+
Conferma password:
+ Registrami +
+ save($msg); +} +echo "zzzzzzzzzzzzzzzzzzzzzz"; +?> \ No newline at end of file diff --git a/public/sendCommentoBackend.php b/public/sendCommentoBackend.php new file mode 100644 index 0000000..84746ff --- /dev/null +++ b/public/sendCommentoBackend.php @@ -0,0 +1,41 @@ +getFirst("NotiziaModel",array("id"=>$id,"status"=>NotiziaModel::STATUS_ACCEPTED)); + if(!is_null($articolo)){ + + $news = new stdClass(); + $news->notizia = $articolo->id; + $news->user = UserLoginManager::getLogged(); + + $commento = new CommentoModel($news); + $commento->titolo = $titolo; + $commento->testo = $testo; + $commento->status = CommentoModel::STATUS_PENDING; + + GlobalVariables::get("dao")->save($commento); + echo '
Il tuo commento è stato inviato ed è in attesa di apporvazione.
'; + } + } +// } + else{ + echo '
Un errore ha impedito l\'invio del commento.
'; + } + +}catch (Exception $exec){ + var_dump($exec); +// echo '
Un errore ha impedito l\'invio del commento.(Ex)
'; + $msg = LogModel::fromException($exec); + GlobalVariables::get("dao")->save($msg); +} +?> \ No newline at end of file diff --git a/public/style/public.css b/public/style/public.css index 31f17c3..01d5ce4 100644 --- a/public/style/public.css +++ b/public/style/public.css @@ -76,6 +76,40 @@ body{font-family:lato, arial;} margin-left: 1px; } + +/* + __ __ _ _ +| \/ | ___ __| | __ _| | +| |\/| |/ _ \ / _` |/ _` | | +| | | | (_) | (_| | (_| | | +|_| |_|\___/ \__,_|\__,_|_| + +*/ + +#floating{ + background-color:green; + z-index:4; +} + +#modalBlock{}/* + margin-left:auto; + margin-right:auto; + background-color:green; + width:500px; + height:500px; + opacity:0; +} */ + + + + + + + + + + + /* _ _ | | | | ___ _ __ ___ ___ _ __ __ _ __ _ ___