Skip to content

Commit

Permalink
Dev LimeReplacementFields mostly working
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_ck@10129 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed May 27, 2011
1 parent bc27273 commit 77d11fa
Show file tree
Hide file tree
Showing 8 changed files with 252 additions and 89 deletions.
22 changes: 3 additions & 19 deletions admin/fck_LimeReplacementFields.php
Expand Up @@ -32,22 +32,9 @@
$replFields=Array();
$isInstertansEnabled=false;

$limereplacementoutput="<html>\n"
. "\t<head>\n"
. "\t\t<title>LimeReplacementFields</title>\n"
. "\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"
. "\t\t<meta content=\"noindex, nofollow\" name=\"robots\">\n"
. "\t\t<script src=\"$sCKEditorURL/editor/dialog/common/fck_dialog_common.js\" type=\"text/javascript\"></script>\n"
. "\t\t<script src=\"$rooturl/scripts/jquery/jquery.js\" type=\"text/javascript\"></script>\n"
. "\t\t<script language=\"javascript\">\n"
. "\t\t\tvar mydialog = window.parent ;\n"
. "\t\t\tvar oEditor = mydialog.InnerDialogLoaded() ;\n"
. "\t\t\tvar dialog = oEditor.FCK ;\n"
. "\t\t\tvar FCKLang = oEditor.FCKLang ;\n"
. "\t\t\tvar FCKLimeReplacementFieldss = oEditor.FCKLimeReplacementFieldss ;\n"
$limereplacementoutput="\t\t<script language=\"javascript\">\n"
. "\t\t\$(document).ready(function ()\n"
. "\t\t\t{\n"
. "\t\t\t\toEditor.FCKLanguageManager.TranslatePage( document ) ;\n"
. "\t\t\t\tLoadSelected() ;\n"
. "\t\t\t\tmydialog.SetOkButton( true ) ;\n"
. "\n"
Expand Down Expand Up @@ -224,7 +211,7 @@
$previouspagequestion = true;
//Go through each question until we reach the current one
//error_log(print_r($qrows,true));
$questionlist=array();
$questionlist=array();
foreach ($fieldmap as $field)
{
if (empty($field['qid'])) continue;
Expand Down Expand Up @@ -334,7 +321,6 @@
// Now I´ll add a hack to add the questions before as option
// if they are date type

//$limereplacementoutput .="\t<div style='overflow-x:scroll; width:100%; overflow: -moz-scrollbars-horizontal; overflow-y:scroll; height: 100px;'>\n"
}

if (count($replFields) > 0 || isset($cquestions) )
Expand Down Expand Up @@ -417,10 +403,8 @@
}
}

$limereplacementoutput .= "</table>\n"
. "\t</body>\n"
. "</html>";

$limereplacementoutput .= "</table>\n";
echo $limereplacementoutput;
exit;
?>
2 changes: 1 addition & 1 deletion admin/html.php
Expand Up @@ -344,7 +344,7 @@
{
if ($sumcount6 > 0) {
$surveysummary .= "<li><a href=\"#\" onclick=\"".get2post("{$scriptname}?action=resetsurveylogic&amp;sid=$surveyid")."\">"
. "<img src='{$imageurl}/resetsurveylogic_30.png' name='ResetSurveyLogic'> ".$clang->gT("Reset conditions")."</a></li>\n";
. "<img src='{$imageurl}/resetsurveylogic_30.png' name='ResetSurveyLogic'/> ".$clang->gT("Reset conditions")."</a></li>\n";
}
else
{
Expand Down
6 changes: 1 addition & 5 deletions admin/htmleditor-functions.php
Expand Up @@ -245,11 +245,7 @@ function getInlineEditor($fieldtype,$fieldname,$fieldtext, $surveyID=null,$gID=n
$fieldtype == 'email-admin-resp'||
$fieldtype == 'email-rem' )
{ // do nothing
$htmlcode.= "CKEDITOR.replace('$fieldname') ;\n";
}
else
{
$htmlcode.= "CKEDITOR.replace('$fieldname') ;\n";
$htmlcode.= "$(document).ready(function(){ var $oCKeditorVarName = CKEDITOR.replace('$fieldname');});\n";
}
$htmlcode.= '</script>';

Expand Down
7 changes: 3 additions & 4 deletions admin/scripts/ckeditor.36/limesurvey-config.js
Expand Up @@ -14,7 +14,7 @@ CKEDITOR.editorConfig = function( config )

config.toolbar_popup =
[
['Save','LimeReplacementFields'],
['Save','Createlimereplacementfields'],
['Cut','Copy','Paste','PasteText','PasteFromWord'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat','Source'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'],
Expand All @@ -32,7 +32,7 @@ CKEDITOR.editorConfig = function( config )

config.toolbar_inline =
[
['Maximize','LimeReplacementFields'],
['Maximize','Createlimereplacementfields'],
['Cut','Copy','Paste','PasteText','PasteFromWord'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat','Source'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'],
Expand Down Expand Up @@ -62,7 +62,6 @@ CKEDITOR.editorConfig = function( config )
];*/


CKEDITOR.plugins.addExternal( 'LimeReplacementFields', CKEDITOR.basePath + 'plugins/limereplacementfields/' );
config.extraPlugins = "LimeReplacementFields,ajax";
config.extraPlugins = "limereplacementfields,ajax";

};
@@ -1,48 +1,74 @@
CKEDITOR.dialog.add( 'LimeReplacementFieldsDlg', function( editor ) {
return {
// title: editor.lang.limereplacementfields.title,
title: 'Sometitle',
/*
* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*/

minWidth: 200,
minHeight: 80,
(function()
{
function limereplacementfieldsDialog( editor, isEdit )
{

var lang = editor.lang.limereplacementfields,
generalLabel = editor.lang.common.generalTab;
return {
title : lang.title,
minWidth : 300,
minHeight : 80,
contents :
[
{
id : 'info',
label : generalLabel,
title : generalLabel,
elements :
[
{
id : 'text',
type : 'html',
label : lang.title,
html : CKEDITOR.ajax.load(editor.basePath + '../../admin.php?sid=' +
editor.config.LimeReplacementFieldsSID +
'&gid=' + editor.config.LimeReplacementFieldsGID +
'&qid=' + editor.config.LimeReplacementFieldsQID +
'&fieldtype=' + editor.config.LimeReplacementFieldsType +
'&action=replacementfields' +
'&editedaction=' + editor.config.LimeReplacementFieldsAction),
setup : function( element )
{
if ( isEdit )
$('#cquestions').val( element.getText().slice( 1, -1 ) );
},
commit : function( element )
{
var text = '{' + $('#cquestions').val() + '}';
// The limereplacementfields must be recreated.
CKEDITOR.plugins.limereplacementfields.createlimereplacementfields( editor, element, text );
}
}
]
}
],
onShow : function()
{
if ( isEdit )
this._element = CKEDITOR.plugins.limereplacementfields.getSelectedPlaceHoder( editor );

contents : [
{
id : 'tab1',
label : '',
title : '',
elements :
[
{
type : 'html',
html : CKEDITOR.ajax.load(CKEDITOR.basePath + '../../admin.php?sid=' +
CKEDITOR.config.LimeReplacementFieldsSID +
'&gid=' + CKEDITOR.config.LimeReplacementFieldsGID +
'&qid=' + CKEDITOR.config.LimeReplacementFieldsQID +
'&fieldtype=' + CKEDITOR.config.LimeReplacementFieldsType +
'&action=replacementfields' +
'&editedaction=' + CKEDITOR.config.LimeReplacementFieldsAction)
},
]
}
],
this.setupContent( this._element );
},
onOk : function()
{
this.commitContent( this._element );
delete this._element;
}
};
}


onOk: function() {
var color = this.getContentElement('tab1', 'mycolor').getValue();
var numColor;
if (color == 'rot') numColor = '#F00';
else if (color == 'grün') numColor = '#0F0';
else if (color == 'blau') numColor = '#00F';

var element = CKEDITOR.dom.element.createFromHtml(
'<span style="color:' + numColor + ';">' +
this.getContentElement('tab1', 'mytext').getValue() +
'</span>');
editor.insertElement(element);
}

};

} );
CKEDITOR.dialog.add( 'createlimereplacementfields', function( editor )
{
return limereplacementfieldsDialog( editor );
});
CKEDITOR.dialog.add( 'editlimereplacementfields', function( editor )
{
return limereplacementfieldsDialog( editor, 1 );
});
} )();
Expand Up @@ -20,5 +20,10 @@
*
* Placholder English language file.
*/
FCKLang.LimeReplacementFieldsBtn = 'Einfügen/Bearbeiten eines LimeSurvey Ersetzungsfelds' ;
FCKLang.LimeReplacementFieldsDlgTitle = 'LimeSurvey Ersetzungsfeldeigenschaften' ;

CKEDITOR.plugins.setLang('limereplacementfields','de', {
limereplacementfields: { title:'LimeSurvey Ersetzungsfeldeigenschaften',
button:'Einfügen/Bearbeiten eines LimeSurvey Ersetzungsfelds'
}
}
);
Expand Up @@ -21,8 +21,8 @@
* Placeholder English language file.
*/

CKEDITOR.plugins.setLang('limereplacementsfields','en', {
limereplacementsfields: { title:'LimeSurvey replacement field properties',
CKEDITOR.plugins.setLang('limereplacementfields','en', {
limereplacementfields: { title:'LimeSurvey replacement field properties',
button:'Insert/edit LimeSurvey replacement field'
}
}
Expand Down

0 comments on commit 77d11fa

Please sign in to comment.