diff --git a/private/common/config.local.php b/private/common/config.local.php
index 3ab3a73..baaf679 100644
--- a/private/common/config.local.php
+++ b/private/common/config.local.php
@@ -28,7 +28,7 @@ $currentSystem->apache->user = "var-www";
$currentSystem->apache->group = "var-www";
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
-$currentSystem->remoteLocationPath = "/fdn2/";
+$currentSystem->remoteLocationPath = "http://localhost/fdn2/";
$backupSystem = new stdClass();
$backupSystem->account = "40a911e14db8ad6faf0a0e7385e7c267";
diff --git a/private/common/config.prod.php b/private/common/config.prod.php
index 078878f..4d685bb 100644
--- a/private/common/config.prod.php
+++ b/private/common/config.prod.php
@@ -30,7 +30,7 @@ $currentSystem->apache->user = "var-www";
$currentSystem->apache->group = "var-www";
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
-$currentSystem->remoteLocationPath = "/";
+$currentSystem->remoteLocationPath = "http://www.ifattidinapoli.com/fdn2/";
$backupSystem = new stdClass();
$backupSystem->account = "1582528f056a7ea7f391149fddc75553";
diff --git a/private/common/config.test.php b/private/common/config.test.php
index dbd3c84..8ea9d35 100644
--- a/private/common/config.test.php
+++ b/private/common/config.test.php
@@ -29,8 +29,7 @@ $currentSystem->apache->user = "var-www";
$currentSystem->apache->group = "var-www";
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
-$currentSystem->remoteLocationPath = "/";
-
+$currentSystem->remoteLocationPath = "http://fdn2.asdynamics.com/fdn2/";
$backupSystem = new stdClass();
$backupSystem->account = "40a911e14db8ad6faf0a0e7385e7c267";
diff --git a/private/crontab/core.minute.php b/private/crontab/core.minute.php
index 4586e99..5d5b7cf 100644
--- a/private/crontab/core.minute.php
+++ b/private/crontab/core.minute.php
@@ -7,7 +7,7 @@ Creation Date: 12/gen/2016
require_once(dirname(__FILE__). "/../load.php");
-$tasks = array("MailSendTask");
+$tasks = array("MailSendTask","GenerateAdminActivationMailTask");
if (sizeof($tasks)>0){
foreach ($tasks as $taskName){
diff --git a/private/lib/AnalyticsHelper.php b/private/lib/AnalyticsHelper.php
index e74c92f..596171a 100644
--- a/private/lib/AnalyticsHelper.php
+++ b/private/lib/AnalyticsHelper.php
@@ -7,7 +7,8 @@ Creation Date: 27/gen/2016
class AnalyticsHelper {
private static $COOKIE_NAME = "FDN_STAT_NUM";
//TODO: Switch this value to +1 year in production environment
- private static $COOKIE_TIME = "+5 minutes";
+// private static $COOKIE_TIME = "+5 minutes";
+ private static $COOKIE_TIME = "+1 year";
public static function savePageImpression($ip, $content, $source){
$tmp = new stdClass();
diff --git a/private/lib/dao/lib.inclusion.php b/private/lib/dao/lib.inclusion.php
index 8b7cd2c..a989814 100644
--- a/private/lib/dao/lib.inclusion.php
+++ b/private/lib/dao/lib.inclusion.php
@@ -24,7 +24,7 @@ require_once(dirname(__FILE__)."/models/NotiziaModel.php");
require_once(dirname(__FILE__)."/models/AdminModel.php");
require_once(dirname(__FILE__)."/models/UserModel.php");
-require_once(dirname(__FILE__)."/models/CommentiModel.php");
+require_once(dirname(__FILE__)."/models/CommentoModel.php");
require_once(dirname(__FILE__)."/models/MailModel.php");
require_once(dirname(__FILE__)."/models/MailTemplateModel.php");
diff --git a/private/lib/dao/mediaModels/MediaModel.php b/private/lib/dao/mediaModels/MediaModel.php
index af50038..b8641ca 100644
--- a/private/lib/dao/mediaModels/MediaModel.php
+++ b/private/lib/dao/mediaModels/MediaModel.php
@@ -9,10 +9,10 @@ class MediaModel extends Model implements MediaInterface{
public static $MEDIA_TYPES = array(
self::TYPE_YOUTUBE=>array("label"=>"Youtube"),
- self::TYPE_IMAGE=>array("label"=>"Image"),
+ self::TYPE_IMAGE=>array("label"=>"Immagine"),
self::TYPE_HTML5=>array("label"=>"Html5"),
self::TYPE_PDF=>array("label"=>"Pdf"),
- self::TYPE_LOCALVIDEO=>array("label"=>"Local Video")
+ self::TYPE_LOCALVIDEO=>array("label"=>"Video")
);
diff --git a/private/lib/dao/models/CommentiModel.php b/private/lib/dao/models/CommentiModel.php
deleted file mode 100644
index dabf013..0000000
--- a/private/lib/dao/models/CommentiModel.php
+++ /dev/null
@@ -1,28 +0,0 @@
-hasProperty("notizia") || strcmp($this->notizia,"")==0){
- throw new CoreException("Impossible to build CommentiModel without field notizia");
- }
-
- if (!$this->hasProperty("date")){
- $this->date = new MongoDate();
- }
-
- }
-
- public static function getCollectionName(){
- return "commenti";
- }
-}
-?>
\ No newline at end of file
diff --git a/private/lib/dao/models/CommentoModel.php b/private/lib/dao/models/CommentoModel.php
new file mode 100644
index 0000000..df1851f
--- /dev/null
+++ b/private/lib/dao/models/CommentoModel.php
@@ -0,0 +1,45 @@
+array("label"=>"Valutazione"),
+ self::STATUS_ACCEPTED=>array("label"=>"Accettata"),
+ self::STATUS_REJECTED=>array("label"=>"Respinta")
+ );
+
+ /**
+ * saveableObject deve avere alemeno il campo notizia = notiziaId;
+ * @param stdClass $saveableObject
+ * @throws CoreException
+ */
+ public function __construct($saveableObject){
+ parent::__construct($saveableObject);
+
+ if (!$this->hasProperty("notizia") || strcmp($this->notizia,"")==0){
+ throw new CoreException("Impossible to build CommentoModel without field notizia");
+ }
+
+ if (!$this->hasProperty("user") || strcmp($this->user,"")==0){
+ throw new CoreException("Impossible to build CommentoModel without field user");
+ }
+
+ if (!$this->hasProperty("status") || strcmp($this->status,"")==0){
+ $this->status = self::STATUS_PENDING;
+ }
+
+ if (!$this->hasProperty("date")){
+ $this->date = new MongoDate();
+ }
+
+ }
+
+ public static function getCollectionName(){
+ return "commenti";
+ }
+}
+?>
\ No newline at end of file
diff --git a/private/lib/dao/models/NotiziaModel.php b/private/lib/dao/models/NotiziaModel.php
index ea6dd79..224f251 100644
--- a/private/lib/dao/models/NotiziaModel.php
+++ b/private/lib/dao/models/NotiziaModel.php
@@ -22,7 +22,7 @@ class NotiziaModel extends HasMediaModel{
const STATUS_REJECTED = 3;
public static $NOTIZIA_STATUS = array(
- self::STATUS_PENDING=>array("label"=>"In attesa"),
+ self::STATUS_PENDING=>array("label"=>"Valutazione"),
self::STATUS_ACCEPTED=>array("label"=>"Accettata"),
self::STATUS_REJECTED=>array("label"=>"Respinta")
);
diff --git a/private/lib/gui/FDN2Components.php b/private/lib/gui/FDN2Components.php
new file mode 100644
index 0000000..cbd9827
--- /dev/null
+++ b/private/lib/gui/FDN2Components.php
@@ -0,0 +1,83 @@
+notizia = $notizia;
+ }
+
+ public function __toString(){
+ $mainMedia = DaoMediaHandler::getMainMediaFromModel($this->notizia);
+ $mediaText = "";
+ if (!is_null($mainMedia)){
+ $mediaText = $mainMedia->asText();
+ }
+ $rval = '
';
+ $rval.= '
'.$mediaText.'
';
+ $rval.= '
'.$this->notizia->titolo.'
';
+ $rval.= '
'.$this->notizia->sottotitolo.'
';
+ $rval.= '
'.$this->notizia->testo.'
';
+ $rval.= "
";
+ return $rval;
+ }
+}
+
+
+class NotiziaCommentiList {
+ private $notizia;
+
+ public function __construct(NotiziaModel $notizia){
+ $this->notizia = $notizia;
+ }
+
+ public function __toString(){
+ $rval = '";
+ return $rval;
+ }
+}
+
+
+class CommentoBlock {
+ private $commento;
+
+ public function __construct(CommentoModel $commento){
+ $this->commento = $commento;
+ }
+
+ public function __toString(){
+ $userModel = GlobalVariables::get("dao")->getFirst("UserModel",array("id"=>$this->commento->user));
+ $userString = "Utente cancellato";
+ if (!is_null($userModel)){
+ $userString = $userModel->nome." ".$userModel->cognome;
+ }
+
+ $rval = '";
+ return $rval;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/private/lib/gui/GUIHandler.php b/private/lib/gui/GUIHandler.php
index 39dc675..1cddda0 100644
--- a/private/lib/gui/GUIHandler.php
+++ b/private/lib/gui/GUIHandler.php
@@ -123,7 +123,7 @@ class GUIHandler {
public static function getBaseUrl(){
$conf = GlobalVariables::get("config");
- return "http://$_SERVER[HTTP_HOST]".$conf->pages->remoteLocationPath;
+ return $conf->pages->remoteLocationPath;
}
public static function getImagesUrl(){
diff --git a/private/lib/gui/lib.inclusion.php b/private/lib/gui/lib.inclusion.php
index fa9bcb8..ec2b01c 100644
--- a/private/lib/gui/lib.inclusion.php
+++ b/private/lib/gui/lib.inclusion.php
@@ -32,4 +32,6 @@ require_once(dirname(__FILE__)."/html.inclusion.php");
require_once(dirname(__FILE__)."/HTMLHelper.php");
require_once(dirname(__FILE__)."/DatatablesHelper.php");
+
+require_once(dirname(__FILE__)."/FDN2Components.php");
?>
\ No newline at end of file
diff --git a/private/lib/task/GenerateAdminActivationMailTask.php b/private/lib/task/GenerateAdminActivationMailTask.php
new file mode 100644
index 0000000..3553b74
--- /dev/null
+++ b/private/lib/task/GenerateAdminActivationMailTask.php
@@ -0,0 +1,28 @@
+query("AdminModel",array("activationSent"=>false),array("limit"=>10));
+ if(sizeof($admins)>0){
+ foreach ($admins as $admin){
+ $mail = FDN_MailHelper::getAdminConfirmMail($admin);
+ GlobalVariables::get("dao")->save($mail);
+ }
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/private/lib/task/lib.inclusion.php b/private/lib/task/lib.inclusion.php
index 60925c7..98ad145 100644
--- a/private/lib/task/lib.inclusion.php
+++ b/private/lib/task/lib.inclusion.php
@@ -10,4 +10,6 @@ require_once(dirname(__FILE__)."/MailSendTask.php");
require_once(dirname(__FILE__)."/NewsletterCheckTask.php");
require_once(dirname(__FILE__)."/SendBackupTask.php");
+
+require_once(dirname(__FILE__)."/GenerateAdminActivationMailTask.php");
?>
\ No newline at end of file
diff --git a/public/admin/confirmAdmin.php b/public/admin/confirmAdmin.php
index fb63e40..7935e5f 100644
--- a/public/admin/confirmAdmin.php
+++ b/public/admin/confirmAdmin.php
@@ -42,17 +42,17 @@ try{
$err = true;
$exc->addMessage("Inserire un nome utente per accedere all'applicazione");
}
- if (GlobalVariables::get("dao")->count("AdminModel",array("username"=>$giornalista->username)) > 0 ){
+ if (GlobalVariables::get("dao")->count("AdminModel",array("username"=>$giornalista->username,"id"=>array('$ne'=>new MongoId($giornalista->id) ) ) ) > 0 ){
$err = true;
$exc->addMessage("Il nome utente '".$giornalista->username."' è già in uso");
}
// Validate Password
+ $pass = trim(PostHandler::get("password"));
if (strcmp($pass,"")==0){
$err = true;
$exc->addMessage("Inserire una password per accedere all'applicazione");
}
- $pass = trim(PostHandler::get("password"));
if (strcmp($pass,PostHandler::get("password_confirm"))!=0){
$err = true;
$exc->addMessage("Le password inserite non coincidono");
diff --git a/public/admin/editBanner.php b/public/admin/editBanner.php
index 7143d12..f77b09b 100644
--- a/public/admin/editBanner.php
+++ b/public/admin/editBanner.php
@@ -97,17 +97,13 @@ try{
// }
// GUIHandler::redirect("admin/listBanner.php");
// }
+ $formFile = '
+ Seleziona file';
if($edit && !is_null($newMedia)){
- $formFile = '
- ';
-
- $formHtml = 'Inserire html: ';
+ $formHtml = 'Inserire html:';
}
else{
- $formFile = '
- ';
-
- $formHtml = 'Inserire html: ';
+ $formHtml = 'Inserire html:';
}
}catch(GUIException $ex){
@@ -129,17 +125,18 @@ try{
?>
+
+
+ Questa notizia è ancora in stato di valutazione.
+
+ status==NotiziaModel::STATUS_REJECTED){
+ ?>
+
+ Questa notizia è stata respinta!
+
+
+
-
titolo;?>
- sottotitolo;?>
- testo;?>
+
-
-
- hasProperty("sondaggio") && !is_null($notizia->sondaggio)){?>
-
-
Votanti: sondaggio->votanti as $votante){ echo ($i++==0?"":", ").$votante;}?>
-
+
+
+
\ No newline at end of file
diff --git a/public/js/functions.js b/public/js/functions.js
index 39aa1ad..4dba2a2 100644
--- a/public/js/functions.js
+++ b/public/js/functions.js
@@ -1,7 +1,7 @@
-function openPagePost(page, request){
+function openPagePost(page, request, blank = false){
var inputs = '';
request.forEach(function(element, index, array){
inputs += '';
});
- $('').appendTo("body").submit();
+ $('').appendTo("body").submit();
}
\ No newline at end of file
diff --git a/public/style/admin.css b/public/style/admin.css
index 5acbd10..a82406f 100644
--- a/public/style/admin.css
+++ b/public/style/admin.css
@@ -47,7 +47,8 @@ span.label{display:inline-block; width:210px; text-align:right; padding:5px;}
div.formBtns{padding:15px 165px;}
div.formBtns a{text-decoration:none; color:rgb(51, 102, 255); font-weight:bold; margin-right:5px; padding:5px;}
div.formBtns a:hover{background-color:rgb(204, 217, 255);}
-
+form input[type="text"], form textarea{padding:6px 5px;}
+form > div{margin:5px 0;}
/*
@@ -61,10 +62,16 @@ div.formBtns a:hover{background-color:rgb(204, 217, 255);}
.notiziaContainer{margin-right:280px;background-color:#f2f2f2;overflow:auto;}
.notiziaContainer h1,.notiziaContainer h2,.notiziaContainer h3{padding:10px;}
-.notiziaMenu{display:inline-block;background-color:#33ccff;position:absolute; width:250px;right:20px;top:20px;}
-.notiziaMenu a{text-decoration:none;color:black;cursor:pointer;}
-.notiziaMenu a:hover{text-decoration:underline;}
+.notiziaMenu{background-color:#CCC;position:absolute; width:250px;right:20px;top:20px; padding: 10px 0 15px; border-radius:10px;border: 1px solid #A5A5A5;}
+.notiziaMenu a{text-decoration:none;color:#5656C3;cursor:pointer;}
+.notiziaMenu a:hover{color:#8484F1;}
+.notiziaMenu ul {list-style:none; display:inline-block; padding:0 20px;}
+.notiziaMenu ul li{margin: 10px 0px;display: block; clear:both;}
+div.notiziaAcceptance{text-align: center; background-color: #ffd677; padding: 20px; border: 1px solid grey; border-radius: 10px;}
+div.notiziaAcceptance > a{text-decoration:none; color:rgb(51, 102, 255); font-weight:bold; margin-right:5px; padding:5px; display:inline-block;}
+div.notiziaAcceptance > a.green:hover{background-color:#7EFF83;}
+div.notiziaAcceptance > a.red:hover{background-color:#FF8DA6;}
/*
__ __ _ _
| \/ | ___ __| (_) __ _
@@ -73,7 +80,7 @@ div.formBtns a:hover{background-color:rgb(204, 217, 255);}
|_| |_|\___|\__,_|_|\__,_|
*/
-.mediaElement.selected > img{opacity:0.4;}
+.mediaElement.selected > img{opacity:0.4;background-color:orange;}
/*
____ _ _
@@ -86,4 +93,17 @@ div.formBtns a:hover{background-color:rgb(204, 217, 255);}
.commentoContainer{border:2px solid black; border-left:0px; border-right:0px; border-top:0px; padding: 5px; margin: 15px 5px}
+div.commentoAcceptance{text-align: left; background-color: #ffd677; padding: 20px 50px; border: 1px solid grey; border-radius: 10px; margin-bottom:20px;}
+
+div.commentoAcceptance .commentoTitolo{font-size:18px;font-weight:bold;}
+div.commentoAcceptance .commentoTesto{margin-left:15px;}
+div.commentoAcceptance .commentoUser{display:inline-block; font-style:italic; font-size:12px; margin-top:15px;margin-left:15px;}
+div.commentoAcceptance .commentoDate{display:inline-block; font-style:italic; font-size:12px;}
+
+div.commentoAcceptance > .buttons {text-align:center;}
+div.commentoAcceptance > .buttons a{text-decoration:none; color:rgb(51, 102, 255); font-weight:bold; margin-right:5px; padding:5px; display:inline-block;}
+div.commentoAcceptance > .buttons a.green:hover{background-color:#7EFF83;}
+div.commentoAcceptance > .buttons a.red:hover{background-color:#FF8DA6;}
+div.commentoAcceptance > .buttons a.yellow:hover{background-color:#FF8DA6;}
+
"; + foreach ($commenti as $commento){ + $commentoBlock = new CommentoBlock($commento); + $rval.= "- ".$commentoBlock."
";
+ }
+ $rval.= "
"; + } + + $rval.= "