diff --git a/oth/img/leftArrow.xcf b/oth/img/leftArrow.xcf new file mode 100644 index 0000000..f153bae Binary files /dev/null and b/oth/img/leftArrow.xcf differ 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/dao/models/UserModel.php b/private/lib/dao/models/UserModel.php index 0ddfed3..d6747cc 100644 --- a/private/lib/dao/models/UserModel.php +++ b/private/lib/dao/models/UserModel.php @@ -16,6 +16,14 @@ class UserModel extends Model{ if (!$this->hasProperty("email")){ throw new CoreException("Impossible to create a user without a mail address"); } + + if (!$this->hasProperty("username")){ + throw new CoreException("Impossible to create a user without a username"); + } + + if(!$this->hasProperty("password")){ + new CoreException("Impossible to create a user without a password"); + } } public static function getCollectionName(){ diff --git a/private/lib/gui/GUIHandler.php b/private/lib/gui/GUIHandler.php index bf6f1cc..585ee9a 100644 --- a/private/lib/gui/GUIHandler.php +++ b/private/lib/gui/GUIHandler.php @@ -154,10 +154,11 @@ class GUIHandler { $day = date("d"); ?> +
- Aggiornato alle
- +
@@ -167,9 +168,9 @@ class GUIHandler {
-
+
BANNER
-
+
BANNER
@@ -279,5 +280,54 @@ class GUIHandler { $url = self::getBaseUrl()."fbMetadata.php?id=".$notizia->id; return 'window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))'; } + + public static function generateRightBannerBlock(){ + $lastsNews = GlobalVariables::get("dao")->query("NotiziaModel", + array("status"=>NotiziaModel::STATUS_ACCEPTED), + array("sort"=>array("about.data"=>-1),"limit"=>5) + ); + if (sizeof($lastsNews)>0){ + $lastsNews = array_map(function($ele){$ele->testo = strip_tags($ele->testo);$ele->sottotitolo = strip_tags($ele->sottotitolo); return $ele; }, $lastsNews); + } + + $mesi = array(1=>'Gennaio', 'Febbraio', 'Marzo', 'Aprile', + 'Maggio', 'Giugno', 'Luglio', 'Agosto', + 'Settembre', 'Ottobre', 'Novembre','Dicembre'); + + ?> +
+
+
Guarda anche
+
BANNER
+
BANNER
+
+
+
+
+
Più Letti
+
+
+ 0){ + foreach($lastsNews as $last){ + $data = $mesi[date("n",$last->about->data->sec)]." ".date("Y",$last->about->data->sec); + $string = (strlen($last->titolo) > 103) ? substr($last->titolo,0,100).'...' : $last->titolo;?> +
+
+
+ +
+ +
+
+
+
Guarda anche
+
BANNER
+
BANNER
+
+
+ + \ No newline at end of file +?> diff --git a/public/articolo.php b/public/articolo.php index 19d5925..df10b4a 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'); @@ -51,6 +52,7 @@ try { $mediaMetaInfo = 'itemprop="image"'; $additionalHeaders[] = ''; } + }catch(GUIException $ex){ $error = $ex->getMessage(); }catch (Exception $exec){ @@ -77,7 +79,7 @@ GUIHandler::generateHtmlHeaders(array("additionalHeaders"=>$additionalHeaders));
> renderMedia(array("size"=>MediaRenderer::SIZE_BIG)); + $media->renderMedia(array("size"=>MediaRenderer::SIZE_MEDIUM)); } ?>
@@ -119,21 +121,25 @@ GUIHandler::generateHtmlHeaders(array("additionalHeaders"=>$additionalHeaders));
- -
-
- - +
+ +
+ +
Titolo commento:
+ +
Commento:
+ +
+ Invia +
- +
TUTTI I COMMENTI
-
Riquadro Banner Rotanti
-
Più Letti
-
Riquadro Banner Non Rotanti
+
$additionalHeaders)); // 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/categorySummary.php b/public/categorySummary.php new file mode 100644 index 0000000..48fb448 --- /dev/null +++ b/public/categorySummary.php @@ -0,0 +1,73 @@ +query("NotiziaModel", + array('$and'=>array(array("status"=>NotiziaModel::STATUS_ACCEPTED),array("category"=>$category))), + array("sort"=>array("about.data"=>-1),"limit"=>10) + ); + } + else{ + GUIHandler::redirect("index.php"); + } + + +}catch(GUIException $ex){ + $error = $ex->getMessage(); +}catch (Exception $exec){ + $msg = LogModel::fromException($exec); + GlobalVariables::get("dao")->save($msg); + + GUIHandler::redirect("index.php"); +} +?> +
+ +
+ titolo) > 103) ? substr($notizia->titolo,0,100).'...' : $notizia->titolo; + $stringSottotitolo = (strlen($notizia->sottotitolo) > 73) ? substr($notizia->sottotitolo,0,70).'...' : $notizia->sottotitolo; + $stringTesto = (strlen($notizia->testo) > 33) ? substr($notizia->testo,0,30).'...' : $notizia->testo; + $media = DaoMediaHandler::getMainMediaFromModel($notizia); + ?> +
+
renderMedia(array("size"=>MediaRenderer::SIZE_SMALL)):"" ;?>
+
+
+
+
+
+
+ + +
+
+ +
+ + +
\ No newline at end of file diff --git a/public/index.php b/public/index.php index 93d9845..f1fbd96 100644 --- a/public/index.php +++ b/public/index.php @@ -275,7 +275,7 @@ catch (Exception $ex){ 0){ foreach($lastsNews as $last){ - $data = $mesi[date("n",$last->data->sec)]." ".date("Y",$last->about->data->sec); + $data = $mesi[date("n",$last->about->data->sec)]." ".date("Y",$last->about->data->sec); $string = (strlen($last->titolo) > 103) ? substr($last->titolo,0,100).'...' : $last->titolo;?>
diff --git a/public/js/functions.js b/public/js/functions.js index bbd8319..f21e087 100644 --- a/public/js/functions.js +++ b/public/js/functions.js @@ -11,3 +11,34 @@ 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(){ + $.ajax({ + method:'POST', + url:'sendRegistrationBackend.php', + dataType:'html', + data:$('#regForm').serialize(), + success: function(data){ +// $("#regForm").remove(); + $(".modalResponse").html(data); + /* Verificare se si possa eliminare la form in caso di registrazione avvenuta con successo assegnando un parametro + * allo span di avvenuta registrazione*/ +// $(".modalError").html(""); + } + }); +} \ No newline at end of file diff --git a/public/registration.php b/public/registration.php new file mode 100644 index 0000000..1b59bcb --- /dev/null +++ b/public/registration.php @@ -0,0 +1,26 @@ + +
x
+
+
+
+
Email:
+
Username:
+
Password:
+
Conferma password:
+
Vuoi iscriverti alla newsletter?
+ +
+
+ + 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..2695cb8 --- /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 = strip_tags($titolo); + $commento->testo = strip_tags($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/sendRegistrationBackend.php b/public/sendRegistrationBackend.php new file mode 100644 index 0000000..f7481b4 --- /dev/null +++ b/public/sendRegistrationBackend.php @@ -0,0 +1,56 @@ +getFirst("UserModel",array("email"=>$email)); + $notUser = GlobalVariables::get("dao")->getFirst("UserModel",array("username"=>$userName)); + + if(is_null($notEmail) || strcmp($email, $notEmail)!=0){ + if(is_null($notUser) || strcmp($userName, $notUser)!=0){ + if(strcmp($pass, $confPass)==0){ + + // GlobalVariables::get("dao")->getFirst("UserModel",array("username"=>$userName)); + // GlobalVariables::get("dao")->getFirst("UserModel",array("email"=>$email)); + // GlobalVariables::get("dao")->getFirst("UserModel",array("username"=>$userName)); + $user = new stdClass(); + $user->email = $email; + $user->password = sha1($pass); + $user->username = $userName; + $user->newsletter = $newsletter; + + + $userModel = new UserModel($user); + // GlobalVariables::get("dao")->save($userModel); + echo 'Registrazione avvenuta con successo.A breve riceverai una mail per confermare la tua registrazione'; + } + else{ +// trigger_error("Le due password non coincidono (trigger)"); + echo 'Le due password non coincidono'; + } + } + else{ + + echo 'Questo username è già in uso da un altro utente.'; + } + } + else{ + echo 'Questa email risulta già in utilizzo.'; + } + +}catch(Exception $exec){ + $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..e10e5f6 100644 --- a/public/style/public.css +++ b/public/style/public.css @@ -76,6 +76,49 @@ body{font-family:lato, arial;} margin-left: 1px; } + +/* + __ __ _ _ +| \/ | ___ __| | __ _| | +| |\/| |/ _ \ / _` |/ _` | | +| | | | (_) | (_| | (_| | | +|_| |_|\___/ \__,_|\__,_|_| + +*/ + +#floating{ + background-color:#ceecf4; + z-index:4; + padding:5px 10px; +} + +.topReg{text-align:right;} +.topReg > div{display:inline-block;} +.topReg > span,a{vertical-align:top;} +.close{vertical-align:top;color:white;} + +.modalBody{text-align:right;} +.regMe{text-align:left;} +.modalResponse{text-align:center;color:aqua;font-weight:bold;} +#modalBlock{}/* + margin-left:auto; + margin-right:auto; + background-color:green; + width:500px; + height:500px; + opacity:0; +} */ + + + + + + + + + + + /* _ _ | | | | ___ _ __ ___ ___ _ __ __ _ __ _ ___ @@ -188,12 +231,12 @@ body{font-family:lato, arial;} .middleRightBanner{width:220px;overflow:hidden;} .middleRightBanner > img{max-width:220px; max-heigth:200px;} -.lastContainer{max-height:120px;margin-top:5px;margin-bottom:5px;border-bottom:dotted #C1B4B4 1px;} -.lastContainer:last-child {border-bottom: none;} -.lastData{font-size:12px;} -.lastTitle{font-size:12px;font-weight:bold;} -.lastContinua{text-align:right; font-size:12px;font-weight:bold;padding-bottom:5px;} -.lastContinua a{color:#64bff0;} +.reader > .lastContainer, .lastContainer{max-height:120px;margin-top:5px;margin-bottom:5px;border-bottom:dotted #C1B4B4 1px;} +.reader > .lastContainer:last-child, .lastContainer:last-child {border-bottom: none;} +.reader > .lastData, .lastData{font-size:12px;} +.reader > .lastTitle, .lastTitle{font-size:12px;font-weight:bold;} +.reader > .lastContinua, .lastContinua{text-align:right; font-size:12px;font-weight:bold;padding-bottom:5px;} +.reader > .lastContinua a, .lastContinua a{color:#64bff0;} .gossipContainer{max-height:120px;margin-top:5px;margin-bottom:5px;border-bottom:dotted #C1B4B4 1px;cursor:pointer;} .gossipContainer#gossip_2{border-bottom:none;} @@ -231,7 +274,7 @@ body{font-family:lato, arial;} .headArticolo{margin-bottom:25px;} -.articoloMainMedia{display:inline-block;vertical-align:top;width:400px;} +.articoloMainMedia{display:inline-block;vertical-align:top;width:400px;text-align:center;} .articoloTitle{display:inline-block;width:550px;padding:0px 20px;vertical-align:top;} .articoloTitle > .title{font-size:20px;font-weight:bold;text-transform:uppercase;font-family:"Arial Bold";} @@ -276,6 +319,36 @@ body{font-family:lato, arial;} .articoloRightBar{vertical-align:top;} -.rotoBanner{} -.reader{} -.notRotoBanner{} + +.categorySummaryContainer{width:600px;padding:5px 10px 5px 0px;vertical-align:top;display:inline-block;} +.categorySummaryContainer > .notiziaContainer{border:solid #d6d6d6 1px;margin-bottom:5px;padding:5px;} +.notiziaContainer > .notiziaImage{display:inline-block;vertical-align:middle;text-align:center;} +.notiziaContainer > .notiziaInfo{display:inline-block;width:430px;padding:10px;vertical-align:middle;cursor:pointer;} +.notiziaInfo > .notiziaTitolo{font-weight:bold;padding:5px;} +.notiziaInfo > .notiziaSottotitolo{padding:5px;} +.notiziaInfo > .notiziaTesto{padding:5px;color:#1a9ee9;font-weight:bold;} + +.summaryRightBar{width:370px;padding:5px;vertical-align:top;display:inline-block;} +.rightBarContainer{width:100%;height:100%;} + + + + + + +.bannerContainer{width:45%;padding:5px;display:inline-block;} + +/* + ____ +| __ ) __ _ _ __ _ __ ___ _ __ +| _ \ / _` | '_ \| '_ \ / _ \ '__| +| |_) | (_| | | | | | | | __/ | +|____/ \__,_|_| |_|_| |_|\___|_| + +*/ + + +.rotoBanner{border:solid #d6d6d6 1px;padding:5px;margin-bottom:5px;} +.reader{border:solid #d6d6d6 1px;padding:5px;margin-bottom:5px;} +.rotoBanner .not{} +