Force logged user to create surveys and applied Dolibarr style to poll creation wizard
This commit is contained in:
parent
c86130e813
commit
8d96675607
@ -157,12 +157,12 @@ class modOpenSurvey extends DolibarrModules
|
||||
'titre'=>'NewSurvey',
|
||||
'mainmenu'=>'opensurvey',
|
||||
'leftmenu'=>'opensurvey_new',
|
||||
'url'=>'/opensurvey/public/index.php?origin=dolibarr',
|
||||
'url'=>'/opensurvey/public/index.php',
|
||||
'langs'=>'opensurvey',
|
||||
'position'=>210,
|
||||
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'',
|
||||
'target'=>'_blank',
|
||||
'perms'=>'$user->rights->opensurvey->write',
|
||||
'target'=>'',
|
||||
'user'=>0);
|
||||
$r++;
|
||||
|
||||
|
||||
@ -23,4 +23,5 @@ ALTER TABLE `llx_opensurvey_sondage` DROP COLUMN `survey_link_visible` ;
|
||||
ALTER TABLE `llx_opensurvey_sondage` DROP INDEX `idx_id_sondage_admin` ;
|
||||
ALTER TABLE `llx_opensurvey_sondage` DROP COLUMN `id_sondage_admin` ;
|
||||
ALTER TABLE `llx_opensurvey_sondage` DROP COLUMN `canedit` ;
|
||||
ALTER TABLE `llx_opensurvey_sondage` ADD COLUMN `allow_spy` TINYINT( 1 ) UNSIGNED NOT NULL AFTER `allow_comments` ;
|
||||
ALTER TABLE `llx_opensurvey_sondage` ADD COLUMN `allow_spy` TINYINT( 1 ) UNSIGNED NOT NULL AFTER `allow_comments` ;
|
||||
ALTER TABLE `llx_opensurvey_sondage` DROP `origin` ;
|
||||
@ -26,7 +26,6 @@ CREATE TABLE llx_opensurvey_sondage (
|
||||
mailsonde varchar(2) DEFAULT '0',
|
||||
allow_comments TINYINT(1) unsigned NOT NULL DEFAULT 1,
|
||||
allow_spy TINYINT(1) unsigned NOT NULL DEFAULT 1,
|
||||
origin VARCHAR(64),
|
||||
tms TIMESTAMP,
|
||||
sujet TEXT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
@ -51,7 +51,6 @@ class Opensurveysondage extends CommonObject
|
||||
var $format;
|
||||
var $mailsonde;
|
||||
|
||||
public $origin;
|
||||
public $sujet;
|
||||
|
||||
/**
|
||||
@ -108,7 +107,6 @@ class Opensurveysondage extends CommonObject
|
||||
$sql.= "mailsonde,";
|
||||
$sql.= "allow_comments,";
|
||||
$sql.= "allow_spy,";
|
||||
$sql.= "origin,";
|
||||
$sql.= "sujet";
|
||||
$sql.= ") VALUES (";
|
||||
|
||||
@ -122,7 +120,6 @@ class Opensurveysondage extends CommonObject
|
||||
$sql.= " ".$this->db->escape($this->mailsonde).",";
|
||||
$sql.= " ".$this->db->escape($this->allow_comments).",";
|
||||
$sql.= " ".$this->db->escape($this->allow_spy).",";
|
||||
$sql.= " '".$this->db->escape($this->origin)."',";
|
||||
$sql.= " '".$this->db->escape($this->sujet)."'";
|
||||
|
||||
$sql.= ")";
|
||||
@ -497,7 +494,6 @@ class Opensurveysondage extends CommonObject
|
||||
$this->mailsonde = ($this->mailsonde ? 1 : 0);
|
||||
$this->allow_comments = ($this->allow_comments ? 1 : 0);
|
||||
$this->allow_spy = ($this->allow_spy ? 1 : 0);
|
||||
$this->origin = trim($this->origin);
|
||||
$this->sujet = trim($this->sujet);
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,7 +218,6 @@ function dol_survey_random($car)
|
||||
/**
|
||||
* Add a poll
|
||||
*
|
||||
* @param string $origin Origin of poll creation
|
||||
* @return void
|
||||
*/
|
||||
function ajouter_sondage($origin)
|
||||
@ -264,24 +263,10 @@ function ajouter_sondage($origin)
|
||||
$opensurveysondage->mailsonde = $_SESSION['mailsonde'];
|
||||
$opensurveysondage->allow_comments = $allow_comments;
|
||||
$opensurveysondage->allow_spy = $allow_spy;
|
||||
$opensurveysondage->origin = $origin;
|
||||
$opensurveysondage->sujet = $_SESSION['toutchoix'];
|
||||
|
||||
$opensurveysondage->create(null);
|
||||
|
||||
if ($origin == 'dolibarr') $urlback=dol_buildpath('/opensurvey/results.php',1).'?id='.$sondage;
|
||||
else
|
||||
{
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/studs.php',1).'?sondage='.$sondage;
|
||||
|
||||
$urlback=$url;
|
||||
}
|
||||
|
||||
unset($_SESSION["titre"]);
|
||||
unset($_SESSION["nom"]);
|
||||
unset($_SESSION["adresse"]);
|
||||
@ -292,6 +277,8 @@ function ajouter_sondage($origin)
|
||||
unset($_SESSION['toutchoix']);
|
||||
unset($_SESSION['totalchoixjour']);
|
||||
unset($_SESSION['champdatefin']);
|
||||
|
||||
$urlback=dol_buildpath('/opensurvey/card.php',1).'?id='.$sondage;
|
||||
|
||||
header("Location: ".$urlback);
|
||||
exit();
|
||||
|
||||
@ -22,8 +22,6 @@
|
||||
* \brief Page to create a new survey (choice selection)
|
||||
*/
|
||||
|
||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||
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");
|
||||
@ -33,9 +31,6 @@ $erreur = false;
|
||||
$testdate = true;
|
||||
$date_selected = '';
|
||||
|
||||
$origin=GETPOST('origin','alpha');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
@ -103,7 +98,7 @@ if (isset($_POST["confirmecreation"]) || isset($_POST["confirmecreation_x"]))
|
||||
$_SESSION["formatsondage"]="A";
|
||||
|
||||
// Add into database
|
||||
ajouter_sondage($origin);
|
||||
ajouter_sondage();
|
||||
} else {
|
||||
$_POST["fin_sondage_autre"] = 'ok';
|
||||
}
|
||||
@ -120,7 +115,7 @@ $form=new Form($db);
|
||||
|
||||
$arrayofjs=array();
|
||||
$arrayofcss=array('/opensurvey/css/style.css');
|
||||
llxHeaderSurvey($langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||
llxHeader('', $langs->trans("OpenSurvey"), "", '', 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
if (empty($_SESSION['titre']) || empty($_SESSION['nom']) || empty($_SESSION['adresse']))
|
||||
{
|
||||
@ -134,9 +129,8 @@ if (empty($_SESSION['titre']) || empty($_SESSION['nom']) || empty($_SESSION['adr
|
||||
//On prépare les données pour les inserer dans la base
|
||||
|
||||
print '<form name="formulaire" action="#bas" method="POST" onkeypress="javascript:process_keypress(event)">'."\n";
|
||||
print '<input type="hidden" name="origin" value="'.dol_escape_htmltag($origin).'">';
|
||||
|
||||
print '<div class="bandeautitre">'. $langs->trans("CreatePoll")." (2 / 2)" .'</div>'."\n";
|
||||
print_fiche_titre($langs->trans("CreatePoll").' (2 / 2)');
|
||||
|
||||
print '<div class=corps>'."\n";
|
||||
print '<br>'. $langs->trans("PollOnChoice") .'<br><br>'."\n";
|
||||
@ -211,7 +205,7 @@ print '<a name=bas></a>'."\n";
|
||||
print '<br><br><br>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
llxFooterSurvey();
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
@ -22,15 +22,11 @@
|
||||
* \brief Page to create a new survey (date selection)
|
||||
*/
|
||||
|
||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||
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."/opensurvey/fonctions.php");
|
||||
|
||||
$origin=GETPOST('origin','alpha');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -63,7 +59,7 @@ if (GETPOST('confirmation') || GETPOST('confirmation_x'))
|
||||
else dol_print_error('','array not defined');
|
||||
|
||||
$_SESSION["toutchoix"]=substr("$choixdate",1);
|
||||
ajouter_sondage($origin);
|
||||
ajouter_sondage();
|
||||
}
|
||||
|
||||
// Reset days
|
||||
@ -93,7 +89,7 @@ if (! isset($_SESSION['nom']) && ! isset($_SESSION['adresse']) && ! isset($_SESS
|
||||
|
||||
$arrayofjs=array();
|
||||
$arrayofcss=array('/opensurvey/css/style.css');
|
||||
llxHeaderSurvey($langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||
llxHeader('', $langs->trans("OpenSurvey"), "", '', 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
//nombre de cases par défaut
|
||||
if (! isset($_SESSION["nbrecaseshoraires"]))
|
||||
@ -221,9 +217,8 @@ else
|
||||
|
||||
//Debut du formulaire et bandeaux de tete
|
||||
print '<form name="formulaire" action="choix_date.php" method="POST" onkeypress="javascript:process_keypress(event)">'."\n";
|
||||
print '<input type="hidden" name="origin" value="'.dol_escape_htmltag($origin).'">';
|
||||
|
||||
print '<div class="bandeautitre">'. $langs->trans("CreatePoll")." (2 / 2)" .'</div>'."\n";
|
||||
print_fiche_titre($langs->trans("CreatePoll").' (2 / 2)');
|
||||
|
||||
//affichage de l'aide pour les jours
|
||||
print '<div class="bodydate">'."\n";
|
||||
@ -594,7 +589,7 @@ print '</form>'."\n";
|
||||
print '<br><br><br><br>'."\n";
|
||||
print '</center></div>'."\n";
|
||||
|
||||
llxFooterSurvey();
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
@ -22,8 +22,6 @@
|
||||
* \brief Page to create a new survey
|
||||
*/
|
||||
|
||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||
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");
|
||||
@ -108,21 +106,18 @@ if (GETPOST("creation_sondage_date") || GETPOST("creation_sondage_autre") || GET
|
||||
|
||||
$arrayofjs=array();
|
||||
$arrayofcss=array('/opensurvey/css/style.css');
|
||||
llxHeaderSurvey($langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
|
||||
print '<div class="bandeautitre">'. $langs->trans("CreatePoll").' (1 / 2)' .'</div>'."\n";
|
||||
llxHeader('', $langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
print_fiche_titre($langs->trans("CreatePoll").' (1 / 2)');
|
||||
|
||||
//debut du formulaire
|
||||
print '<form name="formulaire" action="create_survey.php" method="POST" onkeypress="javascript:process_keypress(event)">'."\n";
|
||||
print '<input type="hidden" name="origin" value="'.dol_escape_htmltag($origin).'">';
|
||||
|
||||
print '<div class=corps>'."\n";
|
||||
print '<br>'. $langs->trans("YouAreInPollCreateArea") .'<br><br>'."\n";
|
||||
|
||||
//Affichage des différents champs textes a remplir
|
||||
print '<table>'."\n";
|
||||
print '<table class="border" width="100%">'."\n";
|
||||
|
||||
print '<tr><td class="fieldrequired">'. $langs->trans("PollTitle") .'</td><td><input type="text" name="titre" size="40" maxlength="80" value="'.$_SESSION["titre"].'"></td>'."\n";
|
||||
if (! $_SESSION["titre"] && (GETPOST('creation_sondage_date') || GETPOST('creation_sondage_autre') || GETPOST('creation_sondage_date_x') || GETPOST('creation_sondage_autre_x')))
|
||||
@ -201,7 +196,7 @@ print '<br><br><br>'."\n";
|
||||
print '</div>'."\n";
|
||||
print '</form>'."\n";
|
||||
|
||||
llxFooterSurvey();
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -22,11 +22,7 @@
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||
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");
|
||||
@ -43,7 +39,7 @@ $langs->load("opensurvey");
|
||||
|
||||
$arrayofjs=array();
|
||||
$arrayofcss=array('/opensurvey/css/style.css');
|
||||
llxHeaderSurvey($langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||
llxHeader('', $langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
print '<center>
|
||||
<form name="formulaire" action="create_survey.php" method="POST">
|
||||
@ -56,7 +52,7 @@ print '<p>'.$langs->trans("OrganizeYourMeetingEasily").'</p>
|
||||
</div>
|
||||
</form></center>';
|
||||
|
||||
llxFooterSurvey();
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user