diff --git a/admin/new.php b/admin/new.php index add4bff5..daab6d46 100644 --- a/admin/new.php +++ b/admin/new.php @@ -1,231 +1,378 @@ - - * @copyright Deakin University 2007,2008 - * @package queXS - * @subpackage admin - * @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility - * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 - * - */ - -/** - * Configuration file - */ -include ("../config.inc.php"); - -/** - * Database file - */ -include ("../db.inc.php"); - -/** - * XHTML functions - */ -include ("../functions/functions.xhtml.php"); - -/** - * Input functions - */ -include("../functions/functions.input.php"); - -/** - * CKEditor - */ -include("../include/ckeditor/ckeditor.php"); - -global $db; - -xhtml_head(T_("New: Create new questionnaire"),true,false,array("../js/new.js")); - -if (isset($_POST['import_file'])) -{ - //file has been submitted - global $db; - - $ras =0; - $rws = 0; - $testing = 0; - $referral = 0; - $rs = 0; - $lime_sid = 0; - $respsc = 0; - $lime_rs_sid = "NULL"; - if (isset($_POST['ras'])) $ras = 1; - if (isset($_POST['rws'])) $rws = 1; - if (isset($_POST['testing'])) $testing = 1; - if (isset($_POST['respsc'])) $respsc = 1; - if (isset($_POST['referral'])) $respsc = 1; - if ($_POST['selectrs'] != "none") $rs = 1; - - $name = $db->qstr($_POST['description']); - $rs_intro = $db->qstr(html_entity_decode($_POST['rs_intro'],ENT_QUOTES,'UTF-8')); - $rs_project_intro = $db->qstr(html_entity_decode($_POST['rs_project_intro'],ENT_QUOTES,'UTF-8')); - $rs_project_end = $db->qstr(html_entity_decode($_POST['rs_project_end'],ENT_QUOTES,'UTF-8')); - $rs_callback = $db->qstr(html_entity_decode($_POST['rs_callback'],ENT_QUOTES,'UTF-8')); - $rs_answeringmachine = $db->qstr(html_entity_decode($_POST['rs_answeringmachine'],ENT_QUOTES,'UTF-8')); - $info = $db->qstr(html_entity_decode($_POST['info'],ENT_QUOTES,'UTF-8')); - - //use existing lime instrument - $lime_sid = bigintval($_POST['select']); - - - if (is_numeric($_POST['selectrs'])) - { - $lime_rs_sid = bigintval($_POST['selectrs']); - } - - $sql = "INSERT INTO questionnaire (questionnaire_id,description,lime_sid,restrict_appointments_shifts,restrict_work_shifts,respondent_selection,rs_intro,rs_project_intro,rs_project_end,rs_callback,rs_answeringmachine,testing,lime_rs_sid,info,self_complete,referral) - VALUES (NULL,$name,'$lime_sid','$ras','$rws','$rs',$rs_intro,$rs_project_intro,$rs_project_end,$rs_callback,$rs_answeringmachine,'$testing',$lime_rs_sid,$info,$respsc,$referral)"; - - $rs = $db->Execute($sql); - - if ($rs) - { - $qid = $db->Insert_ID(); - if ($respsc == 1) - { - $lime_mode = $db->qstr($_POST['lime_mode']); - $lime_template = $db->qstr($_POST['lime_template']); - $lime_endurl = $db->qstr($_POST['lime_endurl']); - - $sql = "UPDATE questionnaire - SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl - WHERE questionnaire_id = $qid"; - - $db->Execute($sql); - } - print "

" . T_("Successfully inserted") . " $name " . T_("as questionnaire") . " $qid, " . T_("linked to") . " $lime_sid

"; - }else - { - print "

" . T_("Error: Failed to insert questionnaire") . "

"; - } - - -} - - -//create new questionnaire -?> -
-

-

-

GetAll($sql); - -if (!empty($surveys)) -{ - print ""; -} -else -{ - print "" . T_("Create an instrument in Limesurvey") .""; -} -?>

-

-

-

-

-

-

-

- - -

editor("rs_project_end","",$ckeditorConfig); ?>

-

editor("info","",$ckeditorConfig);?>

-

"/>

-
- +qstr($_POST['description']); + $rs_intro = $db->qstr(html_entity_decode($_POST['rs_intro'],ENT_QUOTES,'UTF-8')); + $rs_project_intro = $db->qstr(html_entity_decode($_POST['rs_project_intro'],ENT_QUOTES,'UTF-8')); + $rs_project_end = $db->qstr(html_entity_decode($_POST['rs_project_end'],ENT_QUOTES,'UTF-8')); + $rs_callback = $db->qstr(html_entity_decode($_POST['rs_callback'],ENT_QUOTES,'UTF-8')); + $rs_answeringmachine = $db->qstr(html_entity_decode($_POST['rs_answeringmachine'],ENT_QUOTES,'UTF-8')); + $info = $db->qstr(html_entity_decode($_POST['info'],ENT_QUOTES,'UTF-8')); + + //use existing lime instrument + $lime_sid = bigintval($_POST['select']); + + + if (is_numeric($_POST['selectrs'])) + { + $lime_rs_sid = bigintval($_POST['selectrs']); + } + + $sql = "INSERT INTO questionnaire (questionnaire_id,description,lime_sid,restrict_appointments_shifts,restrict_work_shifts,respondent_selection,rs_intro,rs_project_intro,rs_project_end,rs_callback,rs_answeringmachine,testing,lime_rs_sid,info,self_complete,referral) + VALUES (NULL,$name,'$lime_sid','$ras','$rws','$rs',$rs_intro,$rs_project_intro,$rs_project_end,$rs_callback,$rs_answeringmachine,'$testing',$lime_rs_sid,$info,$respsc,$referral)"; + + $rs = $db->Execute($sql); + + if ($rs) + { + $qid = $db->Insert_ID(); + if ($respsc == 1) + { + $lime_mode = $db->qstr($_POST['lime_mode']); + $lime_template = $db->qstr($_POST['lime_template']); + $lime_endurl = $db->qstr($_POST['lime_endurl']); + + $sql = "UPDATE questionnaire + SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl + WHERE questionnaire_id = $qid"; + + $db->Execute($sql); + } + $cl = info; + $message = T_("Successfully inserted") . " " . T_("with ID") . "  $qid,

" . T_("linked to survey") . "  $lime_sid "; + + } + else{ + $cl = danger; + $message = T_("Error: Failed to insert questionnaire"); + } + + +?> + + + + + + + + + + + + + + + +
+ + +
+ +
+ " title="" /> +
+
+ +GetAll($sql); +?> +
+ +
+ + + + +
+
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ " data-off="" data-width="80" /> +
+
+ +
+ +
+ " data-off="" data-width="80"/> +
+
+ +
+ +
+ " data-off="" data-onstyle="danger" data-width="80" /> +
+
+ +
+ +
+ " data-off="" data-width="80"/> +
+
+ +
+ +
+ " data-off="" data-width="80"/> +
+
+ + + + +basePath = "../include/ckeditor/"; + +$ckeditorConfig = array("toolbar" => array(array("tokens","-","Source"), + array("Cut","Copy","Paste","PasteText","PasteFromWord","-","Print","SpellChecker"), + array("Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"), + array('Link','Unlink','Anchor'), + array('Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'), + array('About'), + "/", + array("Bold","Italic","Underline","Strike","-","Subscript","Superscript"), + array("NumberedList","BulletedList","-","Outdent","Indent","Blockquote"), + array('JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'), + array('BidiLtr', 'BidiRtl'), + array('Styles','Format','Font','FontSize'), + array('TextColor','BGColor')), + "extraPlugins" => "tokens"); +?> + +
+ +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_intro","",$ckeditorConfig);?> +
+
+ +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_project_intro","",$ckeditorConfig);?> +
+
+ +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_callback","",$ckeditorConfig);?> +
+
+ +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_answeringmachine","",$ckeditorConfig);?> +
+
+
+ + +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_project_end","",$ckeditorConfig); ?> +
+
+ +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("info","",$ckeditorConfig);?> +
+
+ +
+
+ +
+
+ +
+
+
+ + \ No newline at end of file diff --git a/admin/questionnairelist.php b/admin/questionnairelist.php index 53c7d97c..f98786b8 100644 --- a/admin/questionnairelist.php +++ b/admin/questionnairelist.php @@ -339,29 +339,29 @@ if (isset($_GET['modify']))
 " . T_("Edit instrument in Limesurvey") . " "; ?>
-
+
-
"/>
+
"/>
-
data-toggle="toggle" data-on="" data-off=""/>
+
data-toggle="toggle" data-on="" data-off="" data-width="80"/>
-
data-toggle="toggle" data-on="" data-off=""/>
+
data-toggle="toggle" data-on="" data-off="" data-width="80"/>
-
" data-off="" data-onstyle="danger" />
+
" data-off="" data-onstyle="danger" data-width="80"/>
-
data-toggle="toggle" data-on="" data-off=""/>
+
data-toggle="toggle" data-on="" data-off="" data-width="80"/>
-
onchange="if(this.checked==true) show(this,'limesc'); else hide(this,'limesc');" data-toggle="toggle" data-on="" data-off=""/>
+
onchange="if(this.checked==true) show(this,'limesc'); else hide(this,'limesc');" data-toggle="toggle" data-on="" data-off="" data-width="80"/>
>
@@ -396,23 +396,82 @@ if (isset($_GET['modify']))
- +

" . T_("Respondent selection introduction:") . "

"; echo $CKEditor->editor("rs_intro",$rs['rs_intro'],$ckeditorConfig); - echo "

" . T_("Respondent selection project introduction:") . "

"; echo $CKEditor->editor("rs_project_intro",$rs['rs_project_intro'],$ckeditorConfig); - echo "

" . T_("Respondent selection callback (already started questionnaire):") . "

"; echo $CKEditor->editor("rs_callback",$rs['rs_callback'],$ckeditorConfig); - echo "

" . T_("Message to leave on an answering machine:") . "

"; echo $CKEditor->editor("rs_answeringmachine",$rs['rs_answeringmachine'],$ckeditorConfig); - echo "

"; } -else if (!empty($rs['lime_rs_sid'])) { echo "

" . T_("Edit respondent selection instrument in Limesurvey") . "

"; } - echo "

" . T_("Project end text (thank you screen):") . "

"; echo $CKEditor->editor("rs_project_end",$rs['rs_project_end'],$ckeditorConfig); - echo "

" . T_("Project information for interviewers/operators:") . "

"; echo $CKEditor->editor("info",$rs['info'],$ckeditorConfig); - echo "

"; +if ($rs['respondent_selection'] == 1 && empty($rs['lime_rs_sid'])) { ?> + +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_intro",$rs['rs_intro'],$ckeditorConfig);?> +
+
+ +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_project_intro",$rs['rs_project_intro'],$ckeditorConfig);?> +
+
+ +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_callback",$rs['rs_callback'],$ckeditorConfig);?> +
+
+ +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_answeringmachine",$rs['rs_answeringmachine'],$ckeditorConfig);?> +
+
+ + " . T_("Edit respondent selection instrument in Limesurvey") . "
"; } ?> -

"/>

+ +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_project_end",$rs['rs_project_end'],$ckeditorConfig);?> +
+
+ +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("info",$rs['info'],$ckeditorConfig);?> +
+
+ + + "/> +