New: Improved Opensurvey module: Description of survey use wysiwig

editor, More information shown on result tab, Renamed "survey" into
"poll" (better translation).
This commit is contained in:
Laurent Destailleur
2014-03-17 12:40:12 +01:00
parent 81b8961dab
commit 14d8bfef3a
11 changed files with 159 additions and 117 deletions

View File

@@ -17,8 +17,13 @@ For users:
- New: Add option MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES and MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES
to automatically add timestamp and user line into edition field when editing a note.
- New: Add button cancel into edition of notes.
- New: Improved Opensurvey module and added options to disable comments and disable
public votes.
- New: Improved Opensurvey module:
Added options to disable comments and disable public votes.
Limit dates use calendar popup.
Description of survey use wysiwig editor.
More information shown on result tab.
Renamed "survey" into "poll" (better translation).
- New: Add filter on text and status into survey list. Can also sort on id, text and date end.
- New: The box "balance of bank accounts" show all opened accounts.
- New: Add option MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE to add sale represnative into public
note of generated documents.
@@ -26,7 +31,6 @@ For users:
- New: Increase length of url into bookmark module.
- New: Automatic events sending mails add info about linked objects into email content.
- New: Price management enhancement (multiprice level, price by customer, if MAIN_FEATURES_LEVEL=2 Price by qty).
- New: Add filter on text and status into survey list. Can also sort on id, text and date end.
- New: Add option MAIN_FAVICON_URL.
- New: Created {line_price_ht_locale}, {line_price_vat_locale} and {line_price_ttc_locale} ODT tags.
- New: Add filter on project status into task list. By default, only "opened" project are visible.

View File

@@ -512,8 +512,8 @@ Module50200Name= Paypal
Module50200Desc= Module to offer an online payment page by credit card with Paypal
Module54000Name=PrintIPP
Module54000Desc=Print via Cups IPP Printer.
Module55000Name=Open Survey
Module55000Desc=Module to make online surveys (like Doodle, Studs, Rdvz, ...)
Module55000Name=Open Poll
Module55000Desc=Module to make online polls (like Doodle, Studs, Rdvz, ...)
Module59000Name=Margins
Module59000Desc=Module to manage margins
Module60000Name=Commissions
@@ -732,8 +732,8 @@ Permission50101=Use Point of sales
Permission50201=Read transactions
Permission50202=Import transactions
Permission54001=Print
Permission55001=Read surveys
Permission55002=Create/modify surveys
Permission55001=Read polls
Permission55002=Create/modify polls
Permission59001=Read commercial margins
Permission59002=Define commercial margins
DictionaryCompanyType=Thirdparties type

View File

@@ -225,8 +225,6 @@ DispenseMontantLettres=The written invoices through mecanographic procedures are
NonPercuRecuperable=Non-recoverable
SetConditions=Set payment terms
SetMode=Set payment mode
SetDate= Set date
SelectDate=Select a date
Billed=Billed
RepeatableInvoice=Pre-defined invoice
RepeatableInvoices=Pre-defined invoices

View File

@@ -60,6 +60,8 @@ ErrorNoSocialContributionForSellerCountry=Error, no social contribution type def
ErrorFailedToSaveFile=Error, failed to save file.
ErrorOnlyPngJpgSupported=Error, only .png and .jpg image format file are supported.
ErrorImageFormatNotSupported=Your PHP does not support functions to convert images of this format.
SetDate=Set date
SelectDate=Select a date
SeeAlso=See also %s
BackgroundColorByDefault=Default background color
FileWasNotUploaded=A file is selected for attachment but was not yet uploaded. Click on "Attach file" for this.

View File

@@ -1,18 +1,18 @@
# Dolibarr language file - Source file is en_US - opensurvey
Survey=Survey
Surveys=Surveys
OrganizeYourMeetingEasily=Organize your meetings and surveys easily. First select type of survey...
NewSurvey=New survey
NoSurveysInDatabase=%s survey(s) into database.
OpenSurveyArea=Surveys area
AddACommentForPoll=You can add a comment into survey...
Survey=Poll
Surveys=Polls
OrganizeYourMeetingEasily=Organize your meetings and polls easily. First select type of poll...
NewSurvey=New poll
NoSurveysInDatabase=%s poll(s) into database.
OpenSurveyArea=Polls area
AddACommentForPoll=You can add a comment into poll...
AddComment=Add comment
CreatePoll=Create poll
PollTitle=Poll title
ToReceiveEMailForEachVote=To receive an email for each vote
ToReceiveEMailForEachVote=Receive an email for each vote
TypeDate=Type date
TypeClassic=Type standard
OpenSurveyStep2=Select your dates amoung the free days (green). The selected days are in blue. You can unselect a day previously selected by clicking again on it
OpenSurveyStep2=Select your dates amoung the free days (grey). The selected days are green. You can unselect a day previously selected by clicking again on it
RemoveAllDays=Remove all days
CopyHoursOfFirstDay=Copy hours of first day
RemoveAllHours=Remove all hours
@@ -24,10 +24,10 @@ OpenSurveyHowTo=If you agree to vote in this poll, you have to give your name, c
CommentsOfVoters=Comments of voters
ConfirmRemovalOfPoll=Are you sure you want to remove this poll (and all votes)
RemovePoll=Remove poll
UrlForSurvey=URL to communicate to get a direct access to survey
UrlForSurvey=URL to communicate to get a direct access to poll
PollOnChoice=You are creating a poll to make a multi-choice for a poll. First enter all possible choices for your poll:
CreateSurveyDate=Create a date survey
CreateSurveyStandard=Create a standard survey
CreateSurveyDate=Create a date poll
CreateSurveyStandard=Create a standard poll
CheckBox=Simple checkbox
YesNoList=List (empty/yes/no)
PourContreList=List (empty/for/against)
@@ -35,7 +35,7 @@ AddNewColumn=Add new column
TitleChoice=Choice label
ExportSpreadsheet=Export result spreadsheet
ExpireDate=Limit date
NbOfSurveys=Number of surveys
NbOfSurveys=Number of polls
NbOfVoters=Nb of voters
SurveyResults=Results
PollAdminDesc=You are allowed to change all vote lines of this poll with button "Edit". You can, as well, remove a column or a line with %s. You can also add a new column with %s.

View File

@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -25,6 +25,7 @@
require_once('../main.inc.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
require_once(DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php");
require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php");
@@ -216,23 +217,22 @@ if ($action == 'edit')
else print dol_htmlentities($object->titre);
print '</td></tr>';
// Author
print '<tr><td>';
print $langs->trans("Author") .'</td><td colspan="2">';
if ($object->fk_user_creat) {
print $userstatic->getLoginUrl(1);
} else {
print dol_htmlentities($object->nom_admin);
}
print '</td></tr>';
// Description
print '<tr><td>'.$langs->trans("Description") .'</td><td colspan="2">';
print '<tr><td valign="top">'.$langs->trans("Description") .'</td><td colspan="2">';
if ($action == 'edit')
{
print '<textarea name="nouveauxcommentaires" rows="7" cols="80">'. dol_htmlentities($object->commentaires).'</textarea>'."\n";
$doleditor=new DolEditor('nouveauxcommentaires', dol_htmlentities($object->commentaires),'',120,'dolibarr_notes','In',1,1,1,ROWS_7,120);
$doleditor->Create(0,'');
}
else
{
if (empty($conf->fckeditor->enabled)) print dol_htmlentitiesbr($object->commentaires);
else
{
$doleditor=new DolEditor('nouveauxcommentaires', dol_htmlentities($object->commentaires),'',120,'dolibarr_notes','In',1,1,1,ROWS_7,120,1);
$doleditor->Create(0,'');
}
}
else print dol_nl2br(dol_htmlentities($object->commentaires));
print '</td></tr>';
// EMail
@@ -289,6 +289,15 @@ if ($action == 'edit') print $form->select_date($expiredate?$expiredate:$object-
else print dol_print_date($object->date_fin,'day');
print '</td></tr>';
// Author
print '<tr><td>';
print $langs->trans("Author") .'</td><td colspan="2">';
if ($object->fk_user_creat) {
print $userstatic->getLoginUrl(1);
} else {
print dol_htmlentities($object->nom_admin);
}
print '</td></tr>';
// Link
print '<tr><td>'.img_picto('','object_globe.png').' '.$langs->trans("UrlForSurvey",'').'</td><td colspan="2">';

View File

@@ -181,7 +181,7 @@ class Opensurveysondage extends CommonObject
{
$sql = "SELECT";
$sql.= " t.id_sondage,";
$sql.= " t.commentaires,";
$sql.= " t.commentaires as description,";
$sql.= " t.mail_admin,";
$sql.= " t.nom_admin,";
$sql.= " t.fk_user_creat,";
@@ -208,7 +208,8 @@ class Opensurveysondage extends CommonObject
//For compatibility
$this->ref = $this->id_sondage;
$this->commentaires = $obj->commentaires;
$this->commentaires = $obj->description; // deprecated
$this->description = $obj->description;
$this->mail_admin = $obj->mail_admin;
$this->nom_admin = $obj->nom_admin;
$this->titre = $obj->titre;

View File

@@ -192,11 +192,11 @@ if ($testmodifier)
for ($i=0;$i<$nbcolonnes;$i++)
{
//var_dump($_POST["choix$i"]);
if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1')
if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '1')
{
$nouveauchoix.="1";
}
else if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2')
else if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '2')
{
$nouveauchoix.="2";
}
@@ -257,13 +257,12 @@ print '<div class="corps"> '."\n";
//affichage du titre du sondage
$titre=str_replace("\\","",$object->titre);
print '<strong>'.dol_htmlentities($titre).'</strong><br>'."\n";
print '<strong>'.dol_htmlentities($titre).'</strong><br><br>'."\n";
//affichage des commentaires du sondage
if ($object->commentaires)
{
$commentaires=dol_nl2br(dol_htmlentities($object->commentaires));
print $commentaires;
print dol_htmlentitiesbr($object->commentaires);
print '<br>'."\n";
}

View File

@@ -395,6 +395,11 @@ for ($i = 0; $i < $nbcolonnes; $i++)
* View
*/
if ($object->fk_user_creat) {
$userstatic = new User($db);
$userstatic->fetch($object->fk_user_creat);
}
$form=new Form($db);
$result=$object->fetch(0,$numsondage);
@@ -435,7 +440,7 @@ $linkback = '<a href="'.dol_buildpath('/opensurvey/list.php',1).(! empty($socid)
// Ref
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
print $form->showrefnav($object, 'sondage', $linkback, 1, 'id_sondage', 'id_sondage');
print $form->showrefnav($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage');
print '</td>';
print '</tr>';
@@ -445,6 +450,33 @@ print '<tr><td>'.$langs->trans("Type").'</td><td colspan="2">';
print img_picto('',dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'),1),'width="16"',1);
print ' '.$langs->trans($type=='classic'?"TypeClassic":"TypeDate").'</td></tr>';
// Title
print '<tr><td>';
$adresseadmin=$object->mail_admin;
print $langs->trans("Title") .'</td><td colspan="2">';
if ($action == 'edit')
{
print '<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag(dol_htmlentities($object->titre)).'">';
}
else print dol_htmlentities($object->titre);
print '</td></tr>';
// Expire date
print '<tr><td>'.$langs->trans('ExpireDate').'</td><td colspan="2">';
if ($action == 'edit') print $form->select_date($expiredate?$expiredate:$object->date_fin,'expire');
else print dol_print_date($object->date_fin,'day');
print '</td></tr>';
// Author
print '<tr><td>';
print $langs->trans("Author") .'</td><td colspan="2">';
if ($object->fk_user_creat) {
print $userstatic->getLoginUrl(1);
} else {
print dol_htmlentities($object->nom_admin);
}
print '</td></tr>';
// Link
print '<tr><td>'.img_picto('','object_globe.png').' '.$langs->trans("UrlForSurvey",'').'</td><td>';

View File

@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -25,6 +25,7 @@
require_once('../../main.inc.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php");
// Security check
@@ -76,25 +77,25 @@ if (GETPOST("creation_sondage_date") || GETPOST("creation_sondage_autre"))
}
$testdate = false;
$champdatefin = dol_mktime(0,0,0,GETPOST('champdatefinmonth'),GETPOST('champdatefinday'),GETPOST('champdatefinyear'));
if (GETPOST('champdatefin'))
if (GETPOST('champdatefin') && $champdatefin) // A date was provided
{
// Expire date is not before today
if ($champdatefin - dol_now() > 0)
{
$registredate=explode("/",$_POST["champdatefin"]);
if (is_array($registredate) && count($registredate) === 3) {
$time = mktime(0,0,0,$registredate[1],$registredate[0],$registredate[2]);
if ($time !== false && date('d/m/Y', $time) === $_POST["champdatefin"]) {
//Expire date is not before today
if ($time - dol_now() > 0) {
$testdate = true;
$_SESSION['champdatefin'] = $time;
}
$_SESSION['champdatefin'] = dol_print_date($champdatefin,'dayrfc');
}
else
{
$testdate = true;
//setEventMessage($langs->trans('ExpiredDate'),'errors');
}
}
if (!$testdate) {
setEventMessage($langs->trans('ErrorOpenSurveyDateFormat'), 'errors');
if (! $testdate) {
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("ExpireDate")), 'errors');
}
if ($titre && $testdate)
@@ -141,19 +142,15 @@ if (! $_SESSION["titre"] && (GETPOST('creation_sondage_date') || GETPOST('creati
}
print '</tr>'."\n";
print '<tr><td>'. $langs->trans("Description") .'</td><td><textarea name="commentaires" rows="7" cols="40">'.$_SESSION["commentaires"].'</textarea></td>'."\n";
print '<tr><td>'. $langs->trans("Description") .'</td><td>';
$doleditor=new DolEditor('commentaires', $_SESSION["commentaires"],'',120,'dolibarr_notes','In',1,1,1,ROWS_7,120);
$doleditor->Create(0,'');
print '</td>'."\n";
print '</tr>'."\n";
print '<tr><td class="fieldrequired">'. $langs->trans("ExpireDate") .'</td><td>';
if (!GETPOST('champdatefin')) {
//172800 = 48 hours
$champdatefin = time() + 172800;
} else {
$champdatefin = -1;
}
print $form->select_date($champdatefin,'champdatefin','','','',"add",1,0);
print $form->select_date($champdatefin?$champdatefin:-1,'champdatefin','','','',"add",1,0);
print '</tr>'."\n";
print '</table>'."\n";
@@ -171,12 +168,12 @@ if ($_SESSION["mailsonde"]) $cochemail="checked";
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 ($_SESSION['allow_spy']) $allow_spy = "checked";
if ($_SESSION['allow_comments']) $allow_comments = 'checked="checked"';
if (isset($_POST['allow_comments'])) $allow_comments=GETPOST('allow_comments')?'checked="checked"':'';
print '<input type="checkbox" name="allow_comments" '.$allow_comments.'"> '.$langs->trans('CanComment').'<br />'."\n";
if ($_SESSION['allow_spy']) $allow_spy = 'checed="checked"';
if (isset($_POST['allow_spy'])) $allow_spy=GETPOST('allow_spy')?'checked="checked"':'';
print '<input type="checkbox" name="allow_spy" '.$allow_spy.'> '.$langs->trans('CanSeeOthersVote').'<br />'."\n";
if (GETPOST('choix_sondage'))