mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Merging the Limesurvey 1.91+ branch of queXS in to the trunk
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* LimeSurvey
|
||||
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
|
||||
* All rights reserved.
|
||||
* License: GNU/GPL License v2 or later, see LICENSE.php
|
||||
* LimeSurvey is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*
|
||||
* $Id: htmleditor-popup.php 6853 2009-05-15 12:51:09Z c_schmitz $
|
||||
*/
|
||||
* LimeSurvey
|
||||
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
|
||||
* All rights reserved.
|
||||
* License: GNU/GPL License v2 or later, see LICENSE.php
|
||||
* LimeSurvey is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*
|
||||
* $Id: htmleditor-popup.php 10925 2011-09-02 14:12:02Z c_schmitz $
|
||||
*/
|
||||
|
||||
//Ensure script is not run directly, avoid path disclosure
|
||||
//include_once("login_check.php");
|
||||
@@ -21,16 +21,16 @@ require_once(dirname(__FILE__).'/../common.php');
|
||||
|
||||
if (!isset($_GET['lang']))
|
||||
{
|
||||
$clang = new limesurvey_lang("en");
|
||||
$clang = new limesurvey_lang("en");
|
||||
}
|
||||
else
|
||||
{
|
||||
$clang = new limesurvey_lang($_GET['lang']);
|
||||
$clang = new limesurvey_lang($_GET['lang']);
|
||||
}
|
||||
|
||||
if (!isset($_GET['fieldname']) || !isset($_GET['fieldtext']))
|
||||
{
|
||||
$output = '
|
||||
$output = '
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
@@ -39,7 +39,7 @@ if (!isset($_GET['fieldname']) || !isset($_GET['fieldtext']))
|
||||
<meta name="robots" content="noindex, nofollow" />
|
||||
</head>'
|
||||
|
||||
. '
|
||||
. '
|
||||
<body>
|
||||
<div class="maintitle">
|
||||
LimeSurvey '.$clang->gT("HTML Editor").'
|
||||
@@ -57,40 +57,42 @@ if (!isset($_GET['fieldname']) || !isset($_GET['fieldtext']))
|
||||
</html>';
|
||||
}
|
||||
else {
|
||||
$fieldname=$_GET['fieldname'];
|
||||
$fieldtext=$_GET['fieldtext'];
|
||||
$controlidena=$_GET['fieldname'].'_popupctrlena';
|
||||
$controliddis=$_GET['fieldname'].'_popupctrldis';
|
||||
$fieldname=$_GET['fieldname'];
|
||||
$fieldtext=$_GET['fieldtext'];
|
||||
if (get_magic_quotes_gpc()) $fieldtext = stripslashes($fieldtext);
|
||||
$controlidena=$_GET['fieldname'].'_popupctrlena';
|
||||
$controliddis=$_GET['fieldname'].'_popupctrldis';
|
||||
|
||||
$sid=sanitize_int($_GET['sid']);
|
||||
$gid=sanitize_int($_GET['gid']);
|
||||
$qid=sanitize_int($_GET['qid']);
|
||||
$fieldtype=preg_replace("/[^_.a-zA-Z0-9-]/", "",$_GET['fieldtype']);
|
||||
$action=preg_replace("/[^_.a-zA-Z0-9-]/", "",$_GET['action']);
|
||||
$sid=sanitize_int($_GET['sid']);
|
||||
$gid=sanitize_int($_GET['gid']);
|
||||
$qid=sanitize_int($_GET['qid']);
|
||||
$fieldtype=preg_replace("/[^_.a-zA-Z0-9-]/", "",$_GET['fieldtype']);
|
||||
$action=preg_replace("/[^_.a-zA-Z0-9-]/", "",$_GET['action']);
|
||||
|
||||
$toolbarname='LimeSurveyToolbarfullPopup';
|
||||
$htmlformatoption='';
|
||||
$toolbarname='popup';
|
||||
$htmlformatoption='';
|
||||
|
||||
if ( $fieldtype == 'email-inv' ||
|
||||
$fieldtype == 'email-reg' ||
|
||||
$fieldtype == 'email-conf' ||
|
||||
$fieldtype == 'email-rem' )
|
||||
{
|
||||
$htmlformatoption = "oFCKeditor.Config[\"FullPage\"]=true;";
|
||||
}
|
||||
if ( $fieldtype == 'email-inv' ||
|
||||
$fieldtype == 'email-reg' ||
|
||||
$fieldtype == 'email-conf' ||
|
||||
$fieldtype == 'email-rem' )
|
||||
{
|
||||
$htmlformatoption = ",fullPage:true";
|
||||
}
|
||||
|
||||
$output = '
|
||||
$output = '
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>'.$clang->gT("Editing").' '.$fieldtext.'</title>
|
||||
<title>'.sprintf($clang->gT("Editing %s"), $fieldtext).'</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="robots" content="noindex, nofollow" />
|
||||
<script type="text/javascript" src="'.$fckeditordir.'/fckeditor.js"></script>
|
||||
<script type="text/javascript" src="'.$rooturl.'/scripts/jquery/jquery.js"></script>
|
||||
<script type="text/javascript" src="'.$sCKEditorURL.'/ckeditor.js"></script>
|
||||
</head>';
|
||||
|
||||
|
||||
$output .= "
|
||||
$output .= "
|
||||
<body>
|
||||
<form method='post' onsubmit='saveChanges=true;'>
|
||||
|
||||
@@ -99,7 +101,7 @@ else {
|
||||
<!--
|
||||
function closeme()
|
||||
{
|
||||
window.onbeforeunload = new Function('return true;');
|
||||
window.onbeforeunload = new Function('var a = 1;');
|
||||
self.close();
|
||||
}
|
||||
|
||||
@@ -110,70 +112,60 @@ else {
|
||||
|
||||
|
||||
var saveChanges = false;
|
||||
$(document).ready(function(){
|
||||
CKEDITOR.on('instanceReady',CKeditor_OnComplete);
|
||||
var oCKeditor = CKEDITOR.replace( 'MyTextarea' , { height : '350',
|
||||
width : '98%',
|
||||
customConfig : \"".$sCKEditorURL."/limesurvey-config.js\",
|
||||
toolbarStartupExpanded : true,
|
||||
ToolbarCanCollapse : false,
|
||||
toolbar : '".$toolbarname."',
|
||||
LimeReplacementFieldsSID : \"".$sid."\",
|
||||
LimeReplacementFieldsGID : \"".$gid."\",
|
||||
LimeReplacementFieldsQID : \"".$qid."\",
|
||||
LimeReplacementFieldsType: \"".$fieldtype."\",
|
||||
LimeReplacementFieldsAction: \"".$action."\",
|
||||
smiley_path: \"".$rooturl."/upload/images/smiley/msn/\"
|
||||
{$htmlformatoption} });
|
||||
});
|
||||
|
||||
var oFCKeditor = new FCKeditor( 'MyTextarea' );
|
||||
oFCKeditor.BasePath = '".$fckeditordir."/';
|
||||
oFCKeditor.Height = '350';
|
||||
oFCKeditor.Width = '98%';
|
||||
oFCKeditor.Value = window.opener.document.getElementsByName(\"".$fieldname."\")[0].value;
|
||||
oFCKeditor.Config[\"CustomConfigurationsPath\"] = \"".$fckeditordir."/limesurvey-config.js\";
|
||||
oFCKeditor.Config[\"ToolbarStartExpanded\"] = true;
|
||||
oFCKeditor.Config[\"ToolbarCanCollapse\"] = false;
|
||||
oFCKeditor.ToolbarSet = '".$toolbarname."';
|
||||
oFCKeditor.Config[\"LimeReplacementFieldsSID\"] = \"".$sid."\";
|
||||
oFCKeditor.Config[\"LimeReplacementFieldsGID\"] = \"".$gid."\";
|
||||
oFCKeditor.Config[\"LimeReplacementFieldsQID\"] = \"".$qid."\";
|
||||
oFCKeditor.Config[\"LimeReplacementFieldsType\"] = \"".$fieldtype."\";
|
||||
oFCKeditor.Config[\"LimeReplacementFieldsAction\"] = \"".$action."\";
|
||||
oFCKeditor.Config[\"SmileyPath\"] = \"".$rooturl."/upload/images/smiley/msn/\";
|
||||
$htmlformatoption
|
||||
oFCKeditor.Create();
|
||||
|
||||
function FCKeditor_OnComplete( editorInstance )
|
||||
function CKeditor_OnComplete( evt )
|
||||
{
|
||||
//editorInstance.Events.AttachEvent( 'OnSelectionChange', DoSomething ) ;
|
||||
editorInstance.ToolbarSet.CurrentInstance.Commands.GetCommand('FitWindow').Execute();
|
||||
var editor = evt.editor;
|
||||
editor.setData(window.opener.document.getElementsByName(\"".$fieldname."\")[0].value);
|
||||
editor.execCommand('maximize');
|
||||
window.status='LimeSurvey ".$clang->gT("Editing", "js")." ".javascript_escape($fieldtext,true)."';
|
||||
}
|
||||
|
||||
function html_transfert()
|
||||
{
|
||||
var oEditor = FCKeditorAPI.GetInstance('MyTextarea');\n";
|
||||
var oEditor = CKEDITOR.instances['MyTextarea'];\n";
|
||||
|
||||
if ($fieldtype == 'editanswer' ||
|
||||
if ($fieldtype == 'editanswer' ||
|
||||
$fieldtype == 'addanswer' ||
|
||||
$fieldtype == 'editlabel' ||
|
||||
$fieldtype == 'addlabel')
|
||||
{
|
||||
$output .= "\t\tvar editedtext = oEditor.GetXHTML().replace(new RegExp( \"\\n\", \"g\" ),'');\n";
|
||||
$output .= "\t\tvar editedtext = oEditor.GetXHTML().replace(new RegExp( \"\\r\", \"g\" ),'');\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
//$output .= "\t\tvar editedtext = oEditor.GetXHTML();\n";
|
||||
$output .= "\t\tvar editedtext = oEditor.GetXHTML('no strip new line');\n"; // adding a parameter avoids stripping \n
|
||||
}
|
||||
{
|
||||
$output .= "\t\tvar editedtext = oEditor.getData().replace(new RegExp( \"\\n\", \"g\" ),'');\n";
|
||||
$output .= "\t\tvar editedtext = oEditor.getData().replace(new RegExp( \"\\r\", \"g\" ),'');\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
//$output .= "\t\tvar editedtext = oEditor.GetXHTML();\n";
|
||||
$output .= "\t\tvar editedtext = oEditor.getData('no strip new line');\n"; // adding a parameter avoids stripping \n
|
||||
}
|
||||
|
||||
|
||||
|
||||
$output .= "
|
||||
|
||||
window.opener.document.getElementsByName('".$fieldname."')[0].value = editedtext;
|
||||
}
|
||||
|
||||
|
||||
function close_editor()
|
||||
{
|
||||
if (saveChanges == false)
|
||||
{
|
||||
if (confirm('".$clang->gT("Do you want to save your changes ?", "js")."'))
|
||||
{
|
||||
html_transfert();
|
||||
}
|
||||
}
|
||||
|
||||
if (saveChanges == true)
|
||||
{
|
||||
html_transfert();
|
||||
}
|
||||
|
||||
window.opener.document.getElementsByName('".$fieldname."')[0].readOnly= false;
|
||||
window.opener.document.getElementsByName('".$fieldname."')[0].className='htmlinput';
|
||||
@@ -184,11 +176,11 @@ else
|
||||
}
|
||||
|
||||
//-->
|
||||
</script>
|
||||
</form>";
|
||||
</script>";
|
||||
|
||||
//$output .= "<textarea id='MyTextarea' name='MyTextarea'></textarea>";
|
||||
$output .= "
|
||||
$output .= "<textarea id='MyTextarea' name='MyTextarea'></textarea>";
|
||||
$output .= "
|
||||
</form>
|
||||
</body>
|
||||
</html>";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user