Allow to disable poll comments
This commit is contained in:
parent
8b781e46c6
commit
a5b9122e98
@ -18,3 +18,4 @@
|
|||||||
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
||||||
|
|
||||||
ALTER TABLE llx_bookmark ADD COLUMN entity integer DEFAULT 1 NOT NULL;
|
ALTER TABLE llx_bookmark ADD COLUMN entity integer DEFAULT 1 NOT NULL;
|
||||||
|
ALTER TABLE `llx_opensurvey_sondage` ADD `allow_comments` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT 1 AFTER `canedit` ;
|
||||||
@ -27,6 +27,7 @@ CREATE TABLE llx_opensurvey_sondage (
|
|||||||
mailsonde varchar(2) DEFAULT '0',
|
mailsonde varchar(2) DEFAULT '0',
|
||||||
survey_link_visible integer DEFAULT 1,
|
survey_link_visible integer DEFAULT 1,
|
||||||
canedit integer DEFAULT 0,
|
canedit integer DEFAULT 0,
|
||||||
|
allow_comments TINYINT(1) unsigned NOT NULL DEFAULT 1,
|
||||||
origin VARCHAR(64),
|
origin VARCHAR(64),
|
||||||
tms TIMESTAMP,
|
tms TIMESTAMP,
|
||||||
sujet TEXT
|
sujet TEXT
|
||||||
|
|||||||
@ -66,6 +66,7 @@ AddEndHour=Add end hour
|
|||||||
votes=vote(s)
|
votes=vote(s)
|
||||||
NoCommentYet=No comments have been posted for this poll yet
|
NoCommentYet=No comments have been posted for this poll yet
|
||||||
CanEditVotes=Can change vote of others
|
CanEditVotes=Can change vote of others
|
||||||
|
CanComment=Users can comment in the poll
|
||||||
SelectDayDesc=For each selected day, you can choose, or not, meeting hours in the following format :<br>- empty,<br>- "8h", "8H" or "8:00" to give a meeting's start hour,<br>- "8-11", "8h-11h", "8H-11H" or "8:00-11:00" to give a meeting's start and end hour,<br>- "8h15-11h15", "8H15-11H15" or "8:15-11:15" for the same thing but with minutes.
|
SelectDayDesc=For each selected day, you can choose, or not, meeting hours in the following format :<br>- empty,<br>- "8h", "8H" or "8:00" to give a meeting's start hour,<br>- "8-11", "8h-11h", "8H-11H" or "8:00-11:00" to give a meeting's start and end hour,<br>- "8h15-11h15", "8H15-11H15" or "8:15-11:15" for the same thing but with minutes.
|
||||||
BackToCurrentMonth=Back to current month
|
BackToCurrentMonth=Back to current month
|
||||||
PublicLinkToCreateSurvey=Public link to allow everybody to create a survey
|
PublicLinkToCreateSurvey=Public link to allow everybody to create a survey
|
||||||
|
|||||||
@ -89,6 +89,7 @@ if ($action == 'update')
|
|||||||
$object->date_fin = $expiredate;
|
$object->date_fin = $expiredate;
|
||||||
$object->survey_link_visible = GETPOST('survey_link_visible')=='on'?1:0;
|
$object->survey_link_visible = GETPOST('survey_link_visible')=='on'?1:0;
|
||||||
$object->canedit = GETPOST('canedit')=='on'?1:0;
|
$object->canedit = GETPOST('canedit')=='on'?1:0;
|
||||||
|
$object->allow_comments = GETPOST('cancomment') == 'on' ? true : false;
|
||||||
|
|
||||||
$res=$object->update($user);
|
$res=$object->update($user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
@ -231,6 +232,15 @@ if ($action == 'edit')
|
|||||||
else print yn($object->canedit);
|
else print yn($object->canedit);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Users can comment
|
||||||
|
print '<tr><td>'.$langs->trans('CanComment').'</td><td colspan="2">';
|
||||||
|
if ($action == 'edit')
|
||||||
|
{
|
||||||
|
print '<input type="checkbox" name="cancomment" size="40"'.($object->allow_comments?' checked="true"':'').'">';
|
||||||
|
}
|
||||||
|
else print yn($object->allow_comments);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Expire date
|
// Expire date
|
||||||
print '<tr><td>'.$langs->trans('ExpireDate').'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('ExpireDate').'</td><td colspan="2">';
|
||||||
if ($action == 'edit') print $form->select_date($expiredate?$expiredate:$object->date_fin,'expire');
|
if ($action == 'edit') print $form->select_date($expiredate?$expiredate:$object->date_fin,'expire');
|
||||||
@ -301,12 +311,14 @@ else
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Add comment
|
// Add comment
|
||||||
print $langs->trans("AddACommentForPoll") . '<br>';
|
if ($object->allow_comments) {
|
||||||
print '<textarea name="comment" rows="2" cols="80"></textarea><br>'."\n";
|
print $langs->trans("AddACommentForPoll") . '<br>';
|
||||||
print $langs->trans("Name") .': <input type="text" name="commentuser" value="'.$user->getFullName($langs).'"><br>'."\n";
|
print '<textarea name="comment" rows="2" cols="80"></textarea><br>'."\n";
|
||||||
print '<input type="submit" class="button" name="ajoutcomment" value="'.dol_escape_htmltag($langs->trans("AddComment")).'"><br>'."\n";
|
print $langs->trans("Name") .': <input type="text" name="commentuser" value="'.$user->getFullName($langs).'"><br>'."\n";
|
||||||
if (isset($erreur_commentaire_vide) && $erreur_commentaire_vide=="yes") {
|
print '<input type="submit" class="button" name="ajoutcomment" value="'.dol_escape_htmltag($langs->trans("AddComment")).'"><br>'."\n";
|
||||||
print "<font color=#FF0000>" . $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")) . "</font>";
|
if (isset($erreur_commentaire_vide) && $erreur_commentaire_vide=="yes") {
|
||||||
|
print "<font color=#FF0000>" . $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")) . "</font>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|||||||
@ -54,8 +54,11 @@ class Opensurveysondage extends CommonObject
|
|||||||
var $survey_link_visible;
|
var $survey_link_visible;
|
||||||
var $canedit;
|
var $canedit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow comments on this poll
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $allow_comments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -196,6 +199,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
$sql.= " t.mailsonde,";
|
$sql.= " t.mailsonde,";
|
||||||
$sql.= " t.survey_link_visible,";
|
$sql.= " t.survey_link_visible,";
|
||||||
$sql.= " t.canedit,";
|
$sql.= " t.canedit,";
|
||||||
|
$sql.= " t.allow_comments,";
|
||||||
$sql.= " t.sujet,";
|
$sql.= " t.sujet,";
|
||||||
$sql.= " t.tms";
|
$sql.= " t.tms";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as t";
|
||||||
@ -225,6 +229,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
$this->mailsonde = $obj->mailsonde;
|
$this->mailsonde = $obj->mailsonde;
|
||||||
$this->survey_link_visible = $obj->survey_link_visible;
|
$this->survey_link_visible = $obj->survey_link_visible;
|
||||||
$this->canedit = $obj->canedit;
|
$this->canedit = $obj->canedit;
|
||||||
|
$this->allow_comments = $obj->allow_comments;
|
||||||
$this->sujet = $obj->sujet;
|
$this->sujet = $obj->sujet;
|
||||||
|
|
||||||
$this->date_m = $this->db->jdate($obj->tls);
|
$this->date_m = $this->db->jdate($obj->tls);
|
||||||
@ -274,8 +279,8 @@ class Opensurveysondage extends CommonObject
|
|||||||
if (isset($this->format)) $this->format=trim($this->format);
|
if (isset($this->format)) $this->format=trim($this->format);
|
||||||
if (isset($this->mailsonde)) $this->mailsonde=trim($this->mailsonde);
|
if (isset($this->mailsonde)) $this->mailsonde=trim($this->mailsonde);
|
||||||
if (isset($this->survey_link_visible)) $this->survey_link_visible=trim($this->survey_link_visible);
|
if (isset($this->survey_link_visible)) $this->survey_link_visible=trim($this->survey_link_visible);
|
||||||
if (isset($this->canedit)) $this->canedit=trim($this->canedit);
|
$this->canedit = $this->canedit ? 1 : 0;
|
||||||
|
$this->allow_comments = $this->allow_comments ? 1 : 0;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add a control on parameters values
|
// Put here code to add a control on parameters values
|
||||||
@ -293,7 +298,8 @@ class Opensurveysondage extends CommonObject
|
|||||||
$sql.= " format=".(isset($this->format)?"'".$this->db->escape($this->format)."'":"null").",";
|
$sql.= " format=".(isset($this->format)?"'".$this->db->escape($this->format)."'":"null").",";
|
||||||
$sql.= " mailsonde=".(isset($this->mailsonde)?$this->db->escape($this->mailsonde):"null").",";
|
$sql.= " mailsonde=".(isset($this->mailsonde)?$this->db->escape($this->mailsonde):"null").",";
|
||||||
$sql.= " survey_link_visible=".(isset($this->survey_link_visible)?$this->db->escape($this->survey_link_visible):"null").",";
|
$sql.= " survey_link_visible=".(isset($this->survey_link_visible)?$this->db->escape($this->survey_link_visible):"null").",";
|
||||||
$sql.= " canedit=".(isset($this->canedit)?$this->db->escape($this->canedit):"null")."";
|
$sql.= " canedit=".$this->db->escape($this->canedit).",";
|
||||||
|
$sql.= " allow_comments=".$this->db->escape($this->allow_comments);
|
||||||
|
|
||||||
//$sql.= " WHERE rowid=".$this->id;
|
//$sql.= " WHERE rowid=".$this->id;
|
||||||
$sql.= " WHERE id_sondage_admin='".$this->db->escape($this->id_sondage_admin)."'";
|
$sql.= " WHERE id_sondage_admin='".$this->db->escape($this->id_sondage_admin)."'";
|
||||||
|
|||||||
@ -255,13 +255,14 @@ function ajouter_sondage($origin)
|
|||||||
$date_fin = time()+15552000;
|
$date_fin = time()+15552000;
|
||||||
}
|
}
|
||||||
$canedit=empty($_SESSION['formatcanedit'])?'0':'1';
|
$canedit=empty($_SESSION['formatcanedit'])?'0':'1';
|
||||||
|
$allow_comments = empty($_SESSION['allow_comments']) ? 0 : 1;
|
||||||
|
|
||||||
// Insert survey
|
// Insert survey
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_sondage';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_sondage';
|
||||||
$sql.= '(id_sondage, commentaires, mail_admin, nom_admin, titre, id_sondage_admin, date_fin, format, mailsonde, canedit, origin, sujet)';
|
$sql.= '(id_sondage, commentaires, mail_admin, nom_admin, titre, id_sondage_admin, date_fin, format, mailsonde, canedit, allow_comments, origin, sujet)';
|
||||||
$sql.= " VALUES ('".$db->escape($sondage)."', '".$db->escape($_SESSION['commentaires'])."', '".$db->escape($_SESSION['adresse'])."', '".$db->escape($_SESSION['nom'])."',";
|
$sql.= " VALUES ('".$db->escape($sondage)."', '".$db->escape($_SESSION['commentaires'])."', '".$db->escape($_SESSION['adresse'])."', '".$db->escape($_SESSION['nom'])."',";
|
||||||
$sql.= " '".$db->escape($_SESSION['titre'])."', '".$sondage_admin."', '".$db->idate($date_fin)."', '".$_SESSION['formatsondage']."', '".$db->escape($_SESSION['mailsonde'])."',";
|
$sql.= " '".$db->escape($_SESSION['titre'])."', '".$sondage_admin."', '".$db->idate($date_fin)."', '".$_SESSION['formatsondage']."', '".$db->escape($_SESSION['mailsonde'])."',";
|
||||||
$sql.= " '".$canedit."', '".$db->escape($origin)."',";
|
$sql.= " '".$canedit."', '".$allow_comments."', '".$db->escape($origin)."',";
|
||||||
$sql.= " '".$db->escape($_SESSION['toutchoix'])."'";
|
$sql.= " '".$db->escape($_SESSION['toutchoix'])."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
dol_syslog($sql);
|
dol_syslog($sql);
|
||||||
@ -288,6 +289,7 @@ function ajouter_sondage($origin)
|
|||||||
unset($_SESSION["commentaires"]);
|
unset($_SESSION["commentaires"]);
|
||||||
unset($_SESSION["canedit"]);
|
unset($_SESSION["canedit"]);
|
||||||
unset($_SESSION["mailsonde"]);
|
unset($_SESSION["mailsonde"]);
|
||||||
|
unset($_SESSION['allow_comments']);
|
||||||
|
|
||||||
header("Location: ".$urlback);
|
header("Location: ".$urlback);
|
||||||
exit();
|
exit();
|
||||||
|
|||||||
@ -75,6 +75,12 @@ if (GETPOST("creation_sondage_date") || GETPOST("creation_sondage_autre") || GET
|
|||||||
$_SESSION["mailsonde"] = false;
|
$_SESSION["mailsonde"] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GETPOST('allow_comments') == 'on') {
|
||||||
|
$_SESSION['allow_comments'] = true;
|
||||||
|
} else {
|
||||||
|
$_SESSION['allow_comments'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (! isValidEmail($adresse)) $erreur_adresse = true;
|
if (! isValidEmail($adresse)) $erreur_adresse = true;
|
||||||
|
|
||||||
//var_dump($titre.' - '.$nom.' - '.$adresse.' - '.!$erreur_adresse.' - '.! $erreur_injection_titre.' - '.! $erreur_injection_commentaires.' - '.! $erreur_injection_nom.' - '.$creation_sondage_date.' - '.$creation_sondage_autre); exit;
|
//var_dump($titre.' - '.$nom.' - '.$adresse.' - '.!$erreur_adresse.' - '.! $erreur_injection_titre.' - '.! $erreur_injection_commentaires.' - '.! $erreur_injection_nom.' - '.$creation_sondage_date.' - '.$creation_sondage_autre); exit;
|
||||||
@ -172,6 +178,10 @@ if ($_SESSION["mailsonde"]) $cochemail="checked";
|
|||||||
|
|
||||||
print '<input type="checkbox" name="mailsonde" '.$cochemail.'> '. $langs->trans("ToReceiveEMailForEachVote") .'<br>'."\n";
|
print '<input type="checkbox" name="mailsonde" '.$cochemail.'> '. $langs->trans("ToReceiveEMailForEachVote") .'<br>'."\n";
|
||||||
|
|
||||||
|
if ($_SESSION['allow_comments']) $allow_comments = "checked";
|
||||||
|
|
||||||
|
print '<input type="checkbox" name="allow_comments" '.$allow_comments.'> '.$langs->trans('CanComment').'<br />'."\n";
|
||||||
|
|
||||||
if (GETPOST('choix_sondage'))
|
if (GETPOST('choix_sondage'))
|
||||||
{
|
{
|
||||||
if (GETPOST('choix_sondage') == 'date') print '<input type="hidden" name="creation_sondage_date" value="date">';
|
if (GETPOST('choix_sondage') == 'date') print '<input type="hidden" name="creation_sondage_date" value="date">';
|
||||||
|
|||||||
@ -701,15 +701,17 @@ if ($comments)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Form to add comment
|
// Form to add comment
|
||||||
print '<div class="addcomment">' .$langs->trans("AddACommentForPoll") . "<br>\n";
|
if ($object->allow_comments) {
|
||||||
|
print '<div class="addcomment">' .$langs->trans("AddACommentForPoll") . "<br>\n";
|
||||||
|
|
||||||
print '<textarea name="comment" rows="2" cols="60"></textarea><br>'."\n";
|
print '<textarea name="comment" rows="2" cols="60"></textarea><br>'."\n";
|
||||||
print $langs->trans("Name") .' : ';
|
print $langs->trans("Name") .' : ';
|
||||||
print '<input type="text" name="commentuser" maxlength="64" /> '."\n";
|
print '<input type="text" name="commentuser" maxlength="64" /> '."\n";
|
||||||
print '<input type="submit" class="button" name="ajoutcomment" value="'.dol_escape_htmltag($langs->trans("AddComment")).'"><br>'."\n";
|
print '<input type="submit" class="button" name="ajoutcomment" value="'.dol_escape_htmltag($langs->trans("AddComment")).'"><br>'."\n";
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
|
|
||||||
print '</div>'."\n"; // div add comment
|
print '</div>'."\n"; // div add comment
|
||||||
|
}
|
||||||
|
|
||||||
print '<br><br>';
|
print '<br><br>';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user