Skip to content

Commit

Permalink
Dev: limereplacementfields.js replaced tabs by spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Feb 17, 2016
1 parent 0a68fe3 commit d016fcd
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 80 deletions.
1 change: 1 addition & 0 deletions application/views/admin/htmleditor/pop_editor_view.php
Expand Up @@ -34,6 +34,7 @@ function closeme()
var sReplacementFieldTitle = '<?php eT('LimeSurvey replacement field properties','js');?>';
var sReplacementFieldButton = '<?php eT('Insert/edit LimeSurvey replacement field','js');?>';
$(document).ready(function(){
console.log('iGroupId: '+iGroupId);
CKEDITOR.on('instanceReady',CKeditor_OnComplete);
var oCKeditor = CKEDITOR.replace( 'MyTextarea' , { height : '350',
width : '98%',
Expand Down
@@ -1,11 +1,7 @@
<?php PrepareEditorScript(true, $this); ?>
<?php $this->renderPartial("./survey/Question/question_subviews/_ajax_variables", $ajaxDatas); ?>


<?php if(isset($qTypeOutput)): ?>
<script type='text/javascript'><?php echo $qTypeOutput; ?></script>
<?php PrepareEditorScript(true, $this); ?>
<?php endif; ?>


<div class="side-body" id="edit-question-body">

Expand Down
Expand Up @@ -39,6 +39,7 @@ function find_popup_editor(fieldname)

function start_popup_editor(fieldname, fieldtext, sid, gid, qid, fieldtype, action)
{
console.log('gid'+gid);
controlidena = fieldname + '_popupctrlena';
controliddis = fieldname + '_popupctrldis';
numwindows = editorwindowsHash.length;
Expand Down
150 changes: 75 additions & 75 deletions scripts/admin/limereplacementfields/dialogs/limereplacementfields.js
Expand Up @@ -5,81 +5,81 @@

(function()
{
function limereplacementfieldsDialog( editor, isEdit )
{
var lang = editor.lang.limereplacementfields,
generalLabel = editor.lang.common.generalTab;
return {
title : lang.title,
minWidth : 300,
minHeight : 80,
height : 260,
resizable : CKEDITOR.DIALOG_RESIZE_NONE,
contents :
[
{
id : 'info',
label : generalLabel,
title : generalLabel,
elements :
[
{
id : 'text',
type : 'html',
label : lang.title,
html : CKEDITOR.ajax.load(editor.config.LimeReplacementFieldsPath + '/fieldtype/' +
editor.config.LimeReplacementFieldsType + '/action/' +
editor.config.LimeReplacementFieldsAction + '/surveyid/' +
editor.config.LimeReplacementFieldsSID + '/gid/' +
editor.config.LimeReplacementFieldsGID + '/qid/' +
editor.config.LimeReplacementFieldsQID
),
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 );
function limereplacementfieldsDialog( editor, isEdit )
{
var lang = editor.lang.limereplacementfields,
generalLabel = editor.lang.common.generalTab;
return {
title : lang.title,
minWidth : 300,
minHeight : 80,
height : 260,
resizable : CKEDITOR.DIALOG_RESIZE_NONE,
contents :
[
{
id : 'info',
label : generalLabel,
title : generalLabel,
elements :
[
{
id : 'text',
type : 'html',
label : lang.title,
html : CKEDITOR.ajax.load(editor.config.LimeReplacementFieldsPath + '/fieldtype/' +
editor.config.LimeReplacementFieldsType + '/action/' +
editor.config.LimeReplacementFieldsAction + '/surveyid/' +
editor.config.LimeReplacementFieldsSID + '/gid/' +
editor.config.LimeReplacementFieldsGID + '/qid/' +
editor.config.LimeReplacementFieldsQID
),
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 );

this.setupContent( this._element );

if($('#cquestions').parent().width() == 0) { // IE7 hack
var maxW = 0;
$('#cquestions option').wrapInner('<span />').each(function(i){
if($('span', this).outerWidth() > maxW){
maxW = $('span', this).outerWidth();
}
});
$('#cquestions').width(maxW + 60);
}
},
onOk : function()
{
this.commitContent( this._element );
delete this._element;
}
};
}
this.setupContent( this._element );

CKEDITOR.dialog.add( 'createlimereplacementfields', function( editor )
{
return limereplacementfieldsDialog( editor );
});
CKEDITOR.dialog.add( 'editlimereplacementfields', function( editor )
{
return limereplacementfieldsDialog( editor, 1 );
});
if($('#cquestions').parent().width() == 0) { // IE7 hack
var maxW = 0;
$('#cquestions option').wrapInner('<span />').each(function(i){
if($('span', this).outerWidth() > maxW){
maxW = $('span', this).outerWidth();
}
});
$('#cquestions').width(maxW + 60);
}
},
onOk : function()
{
this.commitContent( this._element );
delete this._element;
}
};
}

CKEDITOR.dialog.add( 'createlimereplacementfields', function( editor )
{
return limereplacementfieldsDialog( editor );
});
CKEDITOR.dialog.add( 'editlimereplacementfields', function( editor )
{
return limereplacementfieldsDialog( editor, 1 );
});
} )();

0 comments on commit d016fcd

Please sign in to comment.