mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-07 01:58:09 +01:00
natural search in list pages
This commit is contained in:
@@ -1,118 +1,118 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'button', function( editor )
|
||||
{
|
||||
function commitAttributes( element )
|
||||
{
|
||||
var val = this.getValue();
|
||||
if ( val )
|
||||
{
|
||||
element.attributes[ this.id ] = val;
|
||||
if ( this.id == 'name' )
|
||||
element.attributes[ 'data-cke-saved-name' ] = val;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete element.attributes[ this.id ];
|
||||
if ( this.id == 'name' )
|
||||
delete element.attributes[ 'data-cke-saved-name' ];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
title : editor.lang.button.title,
|
||||
minWidth : 350,
|
||||
minHeight : 150,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.button;
|
||||
var element = this.getParentEditor().getSelection().getSelectedElement();
|
||||
if ( element && element.is( 'input' ) )
|
||||
{
|
||||
var type = element.getAttribute( 'type' );
|
||||
if ( type in { button:1, reset:1, submit:1 } )
|
||||
{
|
||||
this.button = element;
|
||||
this.setupContent( element );
|
||||
}
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var editor = this.getParentEditor(),
|
||||
element = this.button,
|
||||
isInsertMode = !element;
|
||||
|
||||
var fake = element ? CKEDITOR.htmlParser.fragment.fromHtml( element.getOuterHtml() ).children[ 0 ]
|
||||
: new CKEDITOR.htmlParser.element( 'input' );
|
||||
this.commitContent( fake );
|
||||
|
||||
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||
fake.writeHtml( writer );
|
||||
var newElement = CKEDITOR.dom.element.createFromHtml( writer.getHtml(), editor.document );
|
||||
|
||||
if ( isInsertMode )
|
||||
editor.insertElement( newElement );
|
||||
else
|
||||
{
|
||||
newElement.replace( element );
|
||||
editor.getSelection().selectElement( newElement );
|
||||
}
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.button.title,
|
||||
title : editor.lang.button.title,
|
||||
elements : [
|
||||
{
|
||||
id : 'name',
|
||||
type : 'text',
|
||||
label : editor.lang.common.name,
|
||||
'default' : '',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue(
|
||||
element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : commitAttributes
|
||||
},
|
||||
{
|
||||
id : 'value',
|
||||
type : 'text',
|
||||
label : editor.lang.button.text,
|
||||
accessKey : 'V',
|
||||
'default' : '',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'value' ) || '' );
|
||||
},
|
||||
commit : commitAttributes
|
||||
},
|
||||
{
|
||||
id : 'type',
|
||||
type : 'select',
|
||||
label : editor.lang.button.type,
|
||||
'default' : 'button',
|
||||
accessKey : 'T',
|
||||
items :
|
||||
[
|
||||
[ editor.lang.button.typeBtn, 'button' ],
|
||||
[ editor.lang.button.typeSbm, 'submit' ],
|
||||
[ editor.lang.button.typeRst, 'reset' ]
|
||||
],
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'type' ) || '' );
|
||||
},
|
||||
commit : commitAttributes
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'button', function( editor )
|
||||
{
|
||||
function commitAttributes( element )
|
||||
{
|
||||
var val = this.getValue();
|
||||
if ( val )
|
||||
{
|
||||
element.attributes[ this.id ] = val;
|
||||
if ( this.id == 'name' )
|
||||
element.attributes[ 'data-cke-saved-name' ] = val;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete element.attributes[ this.id ];
|
||||
if ( this.id == 'name' )
|
||||
delete element.attributes[ 'data-cke-saved-name' ];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
title : editor.lang.button.title,
|
||||
minWidth : 350,
|
||||
minHeight : 150,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.button;
|
||||
var element = this.getParentEditor().getSelection().getSelectedElement();
|
||||
if ( element && element.is( 'input' ) )
|
||||
{
|
||||
var type = element.getAttribute( 'type' );
|
||||
if ( type in { button:1, reset:1, submit:1 } )
|
||||
{
|
||||
this.button = element;
|
||||
this.setupContent( element );
|
||||
}
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var editor = this.getParentEditor(),
|
||||
element = this.button,
|
||||
isInsertMode = !element;
|
||||
|
||||
var fake = element ? CKEDITOR.htmlParser.fragment.fromHtml( element.getOuterHtml() ).children[ 0 ]
|
||||
: new CKEDITOR.htmlParser.element( 'input' );
|
||||
this.commitContent( fake );
|
||||
|
||||
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||
fake.writeHtml( writer );
|
||||
var newElement = CKEDITOR.dom.element.createFromHtml( writer.getHtml(), editor.document );
|
||||
|
||||
if ( isInsertMode )
|
||||
editor.insertElement( newElement );
|
||||
else
|
||||
{
|
||||
newElement.replace( element );
|
||||
editor.getSelection().selectElement( newElement );
|
||||
}
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.button.title,
|
||||
title : editor.lang.button.title,
|
||||
elements : [
|
||||
{
|
||||
id : 'name',
|
||||
type : 'text',
|
||||
label : editor.lang.common.name,
|
||||
'default' : '',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue(
|
||||
element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : commitAttributes
|
||||
},
|
||||
{
|
||||
id : 'value',
|
||||
type : 'text',
|
||||
label : editor.lang.button.text,
|
||||
accessKey : 'V',
|
||||
'default' : '',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'value' ) || '' );
|
||||
},
|
||||
commit : commitAttributes
|
||||
},
|
||||
{
|
||||
id : 'type',
|
||||
type : 'select',
|
||||
label : editor.lang.button.type,
|
||||
'default' : 'button',
|
||||
accessKey : 'T',
|
||||
items :
|
||||
[
|
||||
[ editor.lang.button.typeBtn, 'button' ],
|
||||
[ editor.lang.button.typeSbm, 'submit' ],
|
||||
[ editor.lang.button.typeRst, 'reset' ]
|
||||
],
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'type' ) || '' );
|
||||
},
|
||||
commit : commitAttributes
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,153 +1,153 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'checkbox', function( editor )
|
||||
{
|
||||
return {
|
||||
title : editor.lang.checkboxAndRadio.checkboxTitle,
|
||||
minWidth : 350,
|
||||
minHeight : 140,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.checkbox;
|
||||
|
||||
var element = this.getParentEditor().getSelection().getSelectedElement();
|
||||
|
||||
if ( element && element.getAttribute( 'type' ) == 'checkbox' )
|
||||
{
|
||||
this.checkbox = element;
|
||||
this.setupContent( element );
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var editor,
|
||||
element = this.checkbox,
|
||||
isInsertMode = !element;
|
||||
|
||||
if ( isInsertMode )
|
||||
{
|
||||
editor = this.getParentEditor();
|
||||
element = editor.document.createElement( 'input' );
|
||||
element.setAttribute( 'type', 'checkbox' );
|
||||
editor.insertElement( element );
|
||||
}
|
||||
this.commitContent( { element : element } );
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.checkboxAndRadio.checkboxTitle,
|
||||
title : editor.lang.checkboxAndRadio.checkboxTitle,
|
||||
startupFocus : 'txtName',
|
||||
elements : [
|
||||
{
|
||||
id : 'txtName',
|
||||
type : 'text',
|
||||
label : editor.lang.common.name,
|
||||
'default' : '',
|
||||
accessKey : 'N',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue(
|
||||
element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
// IE failed to update 'name' property on input elements, protect it now.
|
||||
if ( this.getValue() )
|
||||
element.data( 'cke-saved-name', this.getValue() );
|
||||
else
|
||||
{
|
||||
element.data( 'cke-saved-name', false );
|
||||
element.removeAttribute( 'name' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'txtValue',
|
||||
type : 'text',
|
||||
label : editor.lang.checkboxAndRadio.value,
|
||||
'default' : '',
|
||||
accessKey : 'V',
|
||||
setup : function( element )
|
||||
{
|
||||
var value = element.getAttribute( 'value' );
|
||||
// IE Return 'on' as default attr value.
|
||||
this.setValue( CKEDITOR.env.ie && value == 'on' ? '' : value );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element,
|
||||
value = this.getValue();
|
||||
|
||||
if ( value && !( CKEDITOR.env.ie && value == 'on' ) )
|
||||
element.setAttribute( 'value', value );
|
||||
else
|
||||
{
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
// Remove attribute 'value' of checkbox (#4721).
|
||||
var checkbox = new CKEDITOR.dom.element( 'input', element.getDocument() );
|
||||
element.copyAttributes( checkbox, { value: 1 } );
|
||||
checkbox.replace( element );
|
||||
editor.getSelection().selectElement( checkbox );
|
||||
data.element = checkbox;
|
||||
}
|
||||
else
|
||||
element.removeAttribute( 'value' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'cmbSelected',
|
||||
type : 'checkbox',
|
||||
label : editor.lang.checkboxAndRadio.selected,
|
||||
'default' : '',
|
||||
accessKey : 'S',
|
||||
value : "checked",
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'checked' ) );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
var isElementChecked = !!element.getAttribute( 'checked' ),
|
||||
isChecked = !!this.getValue();
|
||||
|
||||
if ( isElementChecked != isChecked )
|
||||
{
|
||||
var replace = CKEDITOR.dom.element.createFromHtml( '<input type="checkbox"'
|
||||
+ ( isChecked ? ' checked="checked"' : '' )
|
||||
+ '/>', editor.document );
|
||||
|
||||
element.copyAttributes( replace, { type : 1, checked : 1 } );
|
||||
replace.replace( element );
|
||||
editor.getSelection().selectElement( replace );
|
||||
data.element = replace;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var value = this.getValue();
|
||||
if ( value )
|
||||
element.setAttribute( 'checked', 'checked' );
|
||||
else
|
||||
element.removeAttribute( 'checked' );
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'checkbox', function( editor )
|
||||
{
|
||||
return {
|
||||
title : editor.lang.checkboxAndRadio.checkboxTitle,
|
||||
minWidth : 350,
|
||||
minHeight : 140,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.checkbox;
|
||||
|
||||
var element = this.getParentEditor().getSelection().getSelectedElement();
|
||||
|
||||
if ( element && element.getAttribute( 'type' ) == 'checkbox' )
|
||||
{
|
||||
this.checkbox = element;
|
||||
this.setupContent( element );
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var editor,
|
||||
element = this.checkbox,
|
||||
isInsertMode = !element;
|
||||
|
||||
if ( isInsertMode )
|
||||
{
|
||||
editor = this.getParentEditor();
|
||||
element = editor.document.createElement( 'input' );
|
||||
element.setAttribute( 'type', 'checkbox' );
|
||||
editor.insertElement( element );
|
||||
}
|
||||
this.commitContent( { element : element } );
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.checkboxAndRadio.checkboxTitle,
|
||||
title : editor.lang.checkboxAndRadio.checkboxTitle,
|
||||
startupFocus : 'txtName',
|
||||
elements : [
|
||||
{
|
||||
id : 'txtName',
|
||||
type : 'text',
|
||||
label : editor.lang.common.name,
|
||||
'default' : '',
|
||||
accessKey : 'N',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue(
|
||||
element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
// IE failed to update 'name' property on input elements, protect it now.
|
||||
if ( this.getValue() )
|
||||
element.data( 'cke-saved-name', this.getValue() );
|
||||
else
|
||||
{
|
||||
element.data( 'cke-saved-name', false );
|
||||
element.removeAttribute( 'name' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'txtValue',
|
||||
type : 'text',
|
||||
label : editor.lang.checkboxAndRadio.value,
|
||||
'default' : '',
|
||||
accessKey : 'V',
|
||||
setup : function( element )
|
||||
{
|
||||
var value = element.getAttribute( 'value' );
|
||||
// IE Return 'on' as default attr value.
|
||||
this.setValue( CKEDITOR.env.ie && value == 'on' ? '' : value );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element,
|
||||
value = this.getValue();
|
||||
|
||||
if ( value && !( CKEDITOR.env.ie && value == 'on' ) )
|
||||
element.setAttribute( 'value', value );
|
||||
else
|
||||
{
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
// Remove attribute 'value' of checkbox (#4721).
|
||||
var checkbox = new CKEDITOR.dom.element( 'input', element.getDocument() );
|
||||
element.copyAttributes( checkbox, { value: 1 } );
|
||||
checkbox.replace( element );
|
||||
editor.getSelection().selectElement( checkbox );
|
||||
data.element = checkbox;
|
||||
}
|
||||
else
|
||||
element.removeAttribute( 'value' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'cmbSelected',
|
||||
type : 'checkbox',
|
||||
label : editor.lang.checkboxAndRadio.selected,
|
||||
'default' : '',
|
||||
accessKey : 'S',
|
||||
value : "checked",
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'checked' ) );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
var isElementChecked = !!element.getAttribute( 'checked' ),
|
||||
isChecked = !!this.getValue();
|
||||
|
||||
if ( isElementChecked != isChecked )
|
||||
{
|
||||
var replace = CKEDITOR.dom.element.createFromHtml( '<input type="checkbox"'
|
||||
+ ( isChecked ? ' checked="checked"' : '' )
|
||||
+ '/>', editor.document );
|
||||
|
||||
element.copyAttributes( replace, { type : 1, checked : 1 } );
|
||||
replace.replace( element );
|
||||
editor.getSelection().selectElement( replace );
|
||||
data.element = replace;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var value = this.getValue();
|
||||
if ( value )
|
||||
element.setAttribute( 'checked', 'checked' );
|
||||
else
|
||||
element.removeAttribute( 'checked' );
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,177 +1,177 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'form', function( editor )
|
||||
{
|
||||
var autoAttributes =
|
||||
{
|
||||
action : 1,
|
||||
id : 1,
|
||||
method : 1,
|
||||
enctype : 1,
|
||||
target : 1
|
||||
};
|
||||
|
||||
return {
|
||||
title : editor.lang.form.title,
|
||||
minWidth : 350,
|
||||
minHeight : 200,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.form;
|
||||
|
||||
var element = this.getParentEditor().getSelection().getStartElement();
|
||||
var form = element && element.getAscendant( 'form', true );
|
||||
if ( form )
|
||||
{
|
||||
this.form = form;
|
||||
this.setupContent( form );
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var editor,
|
||||
element = this.form,
|
||||
isInsertMode = !element;
|
||||
|
||||
if ( isInsertMode )
|
||||
{
|
||||
editor = this.getParentEditor();
|
||||
element = editor.document.createElement( 'form' );
|
||||
!CKEDITOR.env.ie && element.append( editor.document.createElement( 'br' ) );
|
||||
}
|
||||
|
||||
if ( isInsertMode )
|
||||
editor.insertElement( element );
|
||||
this.commitContent( element );
|
||||
},
|
||||
onLoad : function()
|
||||
{
|
||||
function autoSetup( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( this.id ) || '' );
|
||||
}
|
||||
|
||||
function autoCommit( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( this.id, this.getValue() );
|
||||
else
|
||||
element.removeAttribute( this.id );
|
||||
}
|
||||
|
||||
this.foreach( function( contentObj )
|
||||
{
|
||||
if ( autoAttributes[ contentObj.id ] )
|
||||
{
|
||||
contentObj.setup = autoSetup;
|
||||
contentObj.commit = autoCommit;
|
||||
}
|
||||
} );
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.form.title,
|
||||
title : editor.lang.form.title,
|
||||
elements : [
|
||||
{
|
||||
id : 'txtName',
|
||||
type : 'text',
|
||||
label : editor.lang.common.name,
|
||||
'default' : '',
|
||||
accessKey : 'N',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.data( 'cke-saved-name', this.getValue() );
|
||||
else
|
||||
{
|
||||
element.data( 'cke-saved-name', false );
|
||||
element.removeAttribute( 'name' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'action',
|
||||
type : 'text',
|
||||
label : editor.lang.form.action,
|
||||
'default' : '',
|
||||
accessKey : 'T'
|
||||
},
|
||||
{
|
||||
type : 'hbox',
|
||||
widths : [ '45%', '55%' ],
|
||||
children :
|
||||
[
|
||||
{
|
||||
id : 'id',
|
||||
type : 'text',
|
||||
label : editor.lang.common.id,
|
||||
'default' : '',
|
||||
accessKey : 'I'
|
||||
},
|
||||
{
|
||||
id : 'enctype',
|
||||
type : 'select',
|
||||
label : editor.lang.form.encoding,
|
||||
style : 'width:100%',
|
||||
accessKey : 'E',
|
||||
'default' : '',
|
||||
items :
|
||||
[
|
||||
[ '' ],
|
||||
[ 'text/plain' ],
|
||||
[ 'multipart/form-data' ],
|
||||
[ 'application/x-www-form-urlencoded' ]
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type : 'hbox',
|
||||
widths : [ '45%', '55%' ],
|
||||
children :
|
||||
[
|
||||
{
|
||||
id : 'target',
|
||||
type : 'select',
|
||||
label : editor.lang.common.target,
|
||||
style : 'width:100%',
|
||||
accessKey : 'M',
|
||||
'default' : '',
|
||||
items :
|
||||
[
|
||||
[ editor.lang.common.notSet, '' ],
|
||||
[ editor.lang.common.targetNew, '_blank' ],
|
||||
[ editor.lang.common.targetTop, '_top' ],
|
||||
[ editor.lang.common.targetSelf, '_self' ],
|
||||
[ editor.lang.common.targetParent, '_parent' ]
|
||||
]
|
||||
},
|
||||
{
|
||||
id : 'method',
|
||||
type : 'select',
|
||||
label : editor.lang.form.method,
|
||||
accessKey : 'M',
|
||||
'default' : 'GET',
|
||||
items :
|
||||
[
|
||||
[ 'GET', 'get' ],
|
||||
[ 'POST', 'post' ]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'form', function( editor )
|
||||
{
|
||||
var autoAttributes =
|
||||
{
|
||||
action : 1,
|
||||
id : 1,
|
||||
method : 1,
|
||||
enctype : 1,
|
||||
target : 1
|
||||
};
|
||||
|
||||
return {
|
||||
title : editor.lang.form.title,
|
||||
minWidth : 350,
|
||||
minHeight : 200,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.form;
|
||||
|
||||
var element = this.getParentEditor().getSelection().getStartElement();
|
||||
var form = element && element.getAscendant( 'form', true );
|
||||
if ( form )
|
||||
{
|
||||
this.form = form;
|
||||
this.setupContent( form );
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var editor,
|
||||
element = this.form,
|
||||
isInsertMode = !element;
|
||||
|
||||
if ( isInsertMode )
|
||||
{
|
||||
editor = this.getParentEditor();
|
||||
element = editor.document.createElement( 'form' );
|
||||
!CKEDITOR.env.ie && element.append( editor.document.createElement( 'br' ) );
|
||||
}
|
||||
|
||||
if ( isInsertMode )
|
||||
editor.insertElement( element );
|
||||
this.commitContent( element );
|
||||
},
|
||||
onLoad : function()
|
||||
{
|
||||
function autoSetup( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( this.id ) || '' );
|
||||
}
|
||||
|
||||
function autoCommit( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( this.id, this.getValue() );
|
||||
else
|
||||
element.removeAttribute( this.id );
|
||||
}
|
||||
|
||||
this.foreach( function( contentObj )
|
||||
{
|
||||
if ( autoAttributes[ contentObj.id ] )
|
||||
{
|
||||
contentObj.setup = autoSetup;
|
||||
contentObj.commit = autoCommit;
|
||||
}
|
||||
} );
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.form.title,
|
||||
title : editor.lang.form.title,
|
||||
elements : [
|
||||
{
|
||||
id : 'txtName',
|
||||
type : 'text',
|
||||
label : editor.lang.common.name,
|
||||
'default' : '',
|
||||
accessKey : 'N',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.data( 'cke-saved-name', this.getValue() );
|
||||
else
|
||||
{
|
||||
element.data( 'cke-saved-name', false );
|
||||
element.removeAttribute( 'name' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'action',
|
||||
type : 'text',
|
||||
label : editor.lang.form.action,
|
||||
'default' : '',
|
||||
accessKey : 'T'
|
||||
},
|
||||
{
|
||||
type : 'hbox',
|
||||
widths : [ '45%', '55%' ],
|
||||
children :
|
||||
[
|
||||
{
|
||||
id : 'id',
|
||||
type : 'text',
|
||||
label : editor.lang.common.id,
|
||||
'default' : '',
|
||||
accessKey : 'I'
|
||||
},
|
||||
{
|
||||
id : 'enctype',
|
||||
type : 'select',
|
||||
label : editor.lang.form.encoding,
|
||||
style : 'width:100%',
|
||||
accessKey : 'E',
|
||||
'default' : '',
|
||||
items :
|
||||
[
|
||||
[ '' ],
|
||||
[ 'text/plain' ],
|
||||
[ 'multipart/form-data' ],
|
||||
[ 'application/x-www-form-urlencoded' ]
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type : 'hbox',
|
||||
widths : [ '45%', '55%' ],
|
||||
children :
|
||||
[
|
||||
{
|
||||
id : 'target',
|
||||
type : 'select',
|
||||
label : editor.lang.common.target,
|
||||
style : 'width:100%',
|
||||
accessKey : 'M',
|
||||
'default' : '',
|
||||
items :
|
||||
[
|
||||
[ editor.lang.common.notSet, '' ],
|
||||
[ editor.lang.common.targetNew, '_blank' ],
|
||||
[ editor.lang.common.targetTop, '_top' ],
|
||||
[ editor.lang.common.targetSelf, '_self' ],
|
||||
[ editor.lang.common.targetParent, '_parent' ]
|
||||
]
|
||||
},
|
||||
{
|
||||
id : 'method',
|
||||
type : 'select',
|
||||
label : editor.lang.form.method,
|
||||
accessKey : 'M',
|
||||
'default' : 'GET',
|
||||
items :
|
||||
[
|
||||
[ 'GET', 'get' ],
|
||||
[ 'POST', 'post' ]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,100 +1,100 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'hiddenfield', function( editor )
|
||||
{
|
||||
return {
|
||||
title : editor.lang.hidden.title,
|
||||
hiddenField : null,
|
||||
minWidth : 350,
|
||||
minHeight : 110,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.hiddenField;
|
||||
|
||||
var editor = this.getParentEditor(),
|
||||
selection = editor.getSelection(),
|
||||
element = selection.getSelectedElement();
|
||||
|
||||
if ( element && element.data( 'cke-real-element-type' ) && element.data( 'cke-real-element-type' ) == 'hiddenfield' )
|
||||
{
|
||||
this.hiddenField = element;
|
||||
element = editor.restoreRealElement( this.hiddenField );
|
||||
this.setupContent( element );
|
||||
selection.selectElement( this.hiddenField );
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var name = this.getValueOf( 'info', '_cke_saved_name' ),
|
||||
value = this.getValueOf( 'info', 'value' ),
|
||||
editor = this.getParentEditor(),
|
||||
element = CKEDITOR.env.ie && !( CKEDITOR.document.$.documentMode >= 8 ) ?
|
||||
editor.document.createElement( '<input name="' + CKEDITOR.tools.htmlEncode( name ) + '">' )
|
||||
: editor.document.createElement( 'input' );
|
||||
|
||||
element.setAttribute( 'type', 'hidden' );
|
||||
this.commitContent( element );
|
||||
var fakeElement = editor.createFakeElement( element, 'cke_hidden', 'hiddenfield' );
|
||||
if ( !this.hiddenField )
|
||||
editor.insertElement( fakeElement );
|
||||
else
|
||||
{
|
||||
fakeElement.replace( this.hiddenField );
|
||||
editor.getSelection().selectElement( fakeElement );
|
||||
}
|
||||
return true;
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.hidden.title,
|
||||
title : editor.lang.hidden.title,
|
||||
elements : [
|
||||
{
|
||||
id : '_cke_saved_name',
|
||||
type : 'text',
|
||||
label : editor.lang.hidden.name,
|
||||
'default' : '',
|
||||
accessKey : 'N',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue(
|
||||
element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( 'name', this.getValue() );
|
||||
else
|
||||
{
|
||||
element.removeAttribute( 'name' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'value',
|
||||
type : 'text',
|
||||
label : editor.lang.hidden.value,
|
||||
'default' : '',
|
||||
accessKey : 'V',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'value' ) || '' );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( 'value', this.getValue() );
|
||||
else
|
||||
element.removeAttribute( 'value' );
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'hiddenfield', function( editor )
|
||||
{
|
||||
return {
|
||||
title : editor.lang.hidden.title,
|
||||
hiddenField : null,
|
||||
minWidth : 350,
|
||||
minHeight : 110,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.hiddenField;
|
||||
|
||||
var editor = this.getParentEditor(),
|
||||
selection = editor.getSelection(),
|
||||
element = selection.getSelectedElement();
|
||||
|
||||
if ( element && element.data( 'cke-real-element-type' ) && element.data( 'cke-real-element-type' ) == 'hiddenfield' )
|
||||
{
|
||||
this.hiddenField = element;
|
||||
element = editor.restoreRealElement( this.hiddenField );
|
||||
this.setupContent( element );
|
||||
selection.selectElement( this.hiddenField );
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var name = this.getValueOf( 'info', '_cke_saved_name' ),
|
||||
value = this.getValueOf( 'info', 'value' ),
|
||||
editor = this.getParentEditor(),
|
||||
element = CKEDITOR.env.ie && !( CKEDITOR.document.$.documentMode >= 8 ) ?
|
||||
editor.document.createElement( '<input name="' + CKEDITOR.tools.htmlEncode( name ) + '">' )
|
||||
: editor.document.createElement( 'input' );
|
||||
|
||||
element.setAttribute( 'type', 'hidden' );
|
||||
this.commitContent( element );
|
||||
var fakeElement = editor.createFakeElement( element, 'cke_hidden', 'hiddenfield' );
|
||||
if ( !this.hiddenField )
|
||||
editor.insertElement( fakeElement );
|
||||
else
|
||||
{
|
||||
fakeElement.replace( this.hiddenField );
|
||||
editor.getSelection().selectElement( fakeElement );
|
||||
}
|
||||
return true;
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.hidden.title,
|
||||
title : editor.lang.hidden.title,
|
||||
elements : [
|
||||
{
|
||||
id : '_cke_saved_name',
|
||||
type : 'text',
|
||||
label : editor.lang.hidden.name,
|
||||
'default' : '',
|
||||
accessKey : 'N',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue(
|
||||
element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( 'name', this.getValue() );
|
||||
else
|
||||
{
|
||||
element.removeAttribute( 'name' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'value',
|
||||
type : 'text',
|
||||
label : editor.lang.hidden.value,
|
||||
'default' : '',
|
||||
accessKey : 'V',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'value' ) || '' );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( 'value', this.getValue() );
|
||||
else
|
||||
element.removeAttribute( 'value' );
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,135 +1,135 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'radio', function( editor )
|
||||
{
|
||||
return {
|
||||
title : editor.lang.checkboxAndRadio.radioTitle,
|
||||
minWidth : 350,
|
||||
minHeight : 140,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.radioButton;
|
||||
|
||||
var element = this.getParentEditor().getSelection().getSelectedElement();
|
||||
if ( element && element.getName() == 'input' && element.getAttribute( 'type' ) == 'radio' )
|
||||
{
|
||||
this.radioButton = element;
|
||||
this.setupContent( element );
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var editor,
|
||||
element = this.radioButton,
|
||||
isInsertMode = !element;
|
||||
|
||||
if ( isInsertMode )
|
||||
{
|
||||
editor = this.getParentEditor();
|
||||
element = editor.document.createElement( 'input' );
|
||||
element.setAttribute( 'type', 'radio' );
|
||||
}
|
||||
|
||||
if ( isInsertMode )
|
||||
editor.insertElement( element );
|
||||
this.commitContent( { element : element } );
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.checkboxAndRadio.radioTitle,
|
||||
title : editor.lang.checkboxAndRadio.radioTitle,
|
||||
elements : [
|
||||
{
|
||||
id : 'name',
|
||||
type : 'text',
|
||||
label : editor.lang.common.name,
|
||||
'default' : '',
|
||||
accessKey : 'N',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue(
|
||||
element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
if ( this.getValue() )
|
||||
element.data( 'cke-saved-name', this.getValue() );
|
||||
else
|
||||
{
|
||||
element.data( 'cke-saved-name', false );
|
||||
element.removeAttribute( 'name' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'value',
|
||||
type : 'text',
|
||||
label : editor.lang.checkboxAndRadio.value,
|
||||
'default' : '',
|
||||
accessKey : 'V',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'value' ) || '' );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( 'value', this.getValue() );
|
||||
else
|
||||
element.removeAttribute( 'value' );
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'checked',
|
||||
type : 'checkbox',
|
||||
label : editor.lang.checkboxAndRadio.selected,
|
||||
'default' : '',
|
||||
accessKey : 'S',
|
||||
value : "checked",
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'checked' ) );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
if ( !( CKEDITOR.env.ie || CKEDITOR.env.opera ) )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( 'checked', 'checked' );
|
||||
else
|
||||
element.removeAttribute( 'checked' );
|
||||
}
|
||||
else
|
||||
{
|
||||
var isElementChecked = element.getAttribute( 'checked' );
|
||||
var isChecked = !!this.getValue();
|
||||
|
||||
if ( isElementChecked != isChecked )
|
||||
{
|
||||
var replace = CKEDITOR.dom.element.createFromHtml( '<input type="radio"'
|
||||
+ ( isChecked ? ' checked="checked"' : '' )
|
||||
+ '></input>', editor.document );
|
||||
element.copyAttributes( replace, { type : 1, checked : 1 } );
|
||||
replace.replace( element );
|
||||
editor.getSelection().selectElement( replace );
|
||||
data.element = replace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'radio', function( editor )
|
||||
{
|
||||
return {
|
||||
title : editor.lang.checkboxAndRadio.radioTitle,
|
||||
minWidth : 350,
|
||||
minHeight : 140,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.radioButton;
|
||||
|
||||
var element = this.getParentEditor().getSelection().getSelectedElement();
|
||||
if ( element && element.getName() == 'input' && element.getAttribute( 'type' ) == 'radio' )
|
||||
{
|
||||
this.radioButton = element;
|
||||
this.setupContent( element );
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var editor,
|
||||
element = this.radioButton,
|
||||
isInsertMode = !element;
|
||||
|
||||
if ( isInsertMode )
|
||||
{
|
||||
editor = this.getParentEditor();
|
||||
element = editor.document.createElement( 'input' );
|
||||
element.setAttribute( 'type', 'radio' );
|
||||
}
|
||||
|
||||
if ( isInsertMode )
|
||||
editor.insertElement( element );
|
||||
this.commitContent( { element : element } );
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.checkboxAndRadio.radioTitle,
|
||||
title : editor.lang.checkboxAndRadio.radioTitle,
|
||||
elements : [
|
||||
{
|
||||
id : 'name',
|
||||
type : 'text',
|
||||
label : editor.lang.common.name,
|
||||
'default' : '',
|
||||
accessKey : 'N',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue(
|
||||
element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
if ( this.getValue() )
|
||||
element.data( 'cke-saved-name', this.getValue() );
|
||||
else
|
||||
{
|
||||
element.data( 'cke-saved-name', false );
|
||||
element.removeAttribute( 'name' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'value',
|
||||
type : 'text',
|
||||
label : editor.lang.checkboxAndRadio.value,
|
||||
'default' : '',
|
||||
accessKey : 'V',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'value' ) || '' );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( 'value', this.getValue() );
|
||||
else
|
||||
element.removeAttribute( 'value' );
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'checked',
|
||||
type : 'checkbox',
|
||||
label : editor.lang.checkboxAndRadio.selected,
|
||||
'default' : '',
|
||||
accessKey : 'S',
|
||||
value : "checked",
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'checked' ) );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
if ( !( CKEDITOR.env.ie || CKEDITOR.env.opera ) )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( 'checked', 'checked' );
|
||||
else
|
||||
element.removeAttribute( 'checked' );
|
||||
}
|
||||
else
|
||||
{
|
||||
var isElementChecked = element.getAttribute( 'checked' );
|
||||
var isChecked = !!this.getValue();
|
||||
|
||||
if ( isElementChecked != isChecked )
|
||||
{
|
||||
var replace = CKEDITOR.dom.element.createFromHtml( '<input type="radio"'
|
||||
+ ( isChecked ? ' checked="checked"' : '' )
|
||||
+ '></input>', editor.document );
|
||||
element.copyAttributes( replace, { type : 1, checked : 1 } );
|
||||
replace.replace( element );
|
||||
editor.getSelection().selectElement( replace );
|
||||
data.element = replace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,135 +1,135 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'textarea', function( editor )
|
||||
{
|
||||
return {
|
||||
title : editor.lang.textarea.title,
|
||||
minWidth : 350,
|
||||
minHeight : 220,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.textarea;
|
||||
|
||||
var element = this.getParentEditor().getSelection().getSelectedElement();
|
||||
if ( element && element.getName() == "textarea" )
|
||||
{
|
||||
this.textarea = element;
|
||||
this.setupContent( element );
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var editor,
|
||||
element = this.textarea,
|
||||
isInsertMode = !element;
|
||||
|
||||
if ( isInsertMode )
|
||||
{
|
||||
editor = this.getParentEditor();
|
||||
element = editor.document.createElement( 'textarea' );
|
||||
}
|
||||
this.commitContent( element );
|
||||
|
||||
if ( isInsertMode )
|
||||
editor.insertElement( element );
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.textarea.title,
|
||||
title : editor.lang.textarea.title,
|
||||
elements : [
|
||||
{
|
||||
id : '_cke_saved_name',
|
||||
type : 'text',
|
||||
label : editor.lang.common.name,
|
||||
'default' : '',
|
||||
accessKey : 'N',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue(
|
||||
element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.data( 'cke-saved-name', this.getValue() );
|
||||
else
|
||||
{
|
||||
element.data( 'cke-saved-name', false );
|
||||
element.removeAttribute( 'name' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type : 'hbox',
|
||||
widths:['50%','50%'],
|
||||
children:[
|
||||
{
|
||||
id : 'cols',
|
||||
type : 'text',
|
||||
label : editor.lang.textarea.cols,
|
||||
'default' : '',
|
||||
accessKey : 'C',
|
||||
style : 'width:50px',
|
||||
validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed ),
|
||||
setup : function( element )
|
||||
{
|
||||
var value = element.hasAttribute( 'cols' ) && element.getAttribute( 'cols' );
|
||||
this.setValue( value || '' );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( 'cols', this.getValue() );
|
||||
else
|
||||
element.removeAttribute( 'cols' );
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'rows',
|
||||
type : 'text',
|
||||
label : editor.lang.textarea.rows,
|
||||
'default' : '',
|
||||
accessKey : 'R',
|
||||
style : 'width:50px',
|
||||
validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed ),
|
||||
setup : function( element )
|
||||
{
|
||||
var value = element.hasAttribute( 'rows' ) && element.getAttribute( 'rows' );
|
||||
this.setValue( value || '' );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( 'rows', this.getValue() );
|
||||
else
|
||||
element.removeAttribute( 'rows' );
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id : 'value',
|
||||
type : 'textarea',
|
||||
label : editor.lang.textfield.value,
|
||||
'default' : '',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.$.defaultValue );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
element.$.value = element.$.defaultValue = this.getValue() ;
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'textarea', function( editor )
|
||||
{
|
||||
return {
|
||||
title : editor.lang.textarea.title,
|
||||
minWidth : 350,
|
||||
minHeight : 220,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.textarea;
|
||||
|
||||
var element = this.getParentEditor().getSelection().getSelectedElement();
|
||||
if ( element && element.getName() == "textarea" )
|
||||
{
|
||||
this.textarea = element;
|
||||
this.setupContent( element );
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var editor,
|
||||
element = this.textarea,
|
||||
isInsertMode = !element;
|
||||
|
||||
if ( isInsertMode )
|
||||
{
|
||||
editor = this.getParentEditor();
|
||||
element = editor.document.createElement( 'textarea' );
|
||||
}
|
||||
this.commitContent( element );
|
||||
|
||||
if ( isInsertMode )
|
||||
editor.insertElement( element );
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.textarea.title,
|
||||
title : editor.lang.textarea.title,
|
||||
elements : [
|
||||
{
|
||||
id : '_cke_saved_name',
|
||||
type : 'text',
|
||||
label : editor.lang.common.name,
|
||||
'default' : '',
|
||||
accessKey : 'N',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue(
|
||||
element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.data( 'cke-saved-name', this.getValue() );
|
||||
else
|
||||
{
|
||||
element.data( 'cke-saved-name', false );
|
||||
element.removeAttribute( 'name' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type : 'hbox',
|
||||
widths:['50%','50%'],
|
||||
children:[
|
||||
{
|
||||
id : 'cols',
|
||||
type : 'text',
|
||||
label : editor.lang.textarea.cols,
|
||||
'default' : '',
|
||||
accessKey : 'C',
|
||||
style : 'width:50px',
|
||||
validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed ),
|
||||
setup : function( element )
|
||||
{
|
||||
var value = element.hasAttribute( 'cols' ) && element.getAttribute( 'cols' );
|
||||
this.setValue( value || '' );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( 'cols', this.getValue() );
|
||||
else
|
||||
element.removeAttribute( 'cols' );
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'rows',
|
||||
type : 'text',
|
||||
label : editor.lang.textarea.rows,
|
||||
'default' : '',
|
||||
accessKey : 'R',
|
||||
style : 'width:50px',
|
||||
validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed ),
|
||||
setup : function( element )
|
||||
{
|
||||
var value = element.hasAttribute( 'rows' ) && element.getAttribute( 'rows' );
|
||||
this.setValue( value || '' );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
if ( this.getValue() )
|
||||
element.setAttribute( 'rows', this.getValue() );
|
||||
else
|
||||
element.removeAttribute( 'rows' );
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id : 'value',
|
||||
type : 'textarea',
|
||||
label : editor.lang.textfield.value,
|
||||
'default' : '',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.$.defaultValue );
|
||||
},
|
||||
commit : function( element )
|
||||
{
|
||||
element.$.value = element.$.defaultValue = this.getValue() ;
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,199 +1,199 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'textfield', function( editor )
|
||||
{
|
||||
var autoAttributes =
|
||||
{
|
||||
value : 1,
|
||||
size : 1,
|
||||
maxLength : 1
|
||||
};
|
||||
|
||||
var acceptedTypes =
|
||||
{
|
||||
text : 1,
|
||||
password : 1
|
||||
};
|
||||
|
||||
return {
|
||||
title : editor.lang.textfield.title,
|
||||
minWidth : 350,
|
||||
minHeight : 150,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.textField;
|
||||
|
||||
var element = this.getParentEditor().getSelection().getSelectedElement();
|
||||
if ( element && element.getName() == "input" &&
|
||||
( acceptedTypes[ element.getAttribute( 'type' ) ] || !element.getAttribute( 'type' ) ) )
|
||||
{
|
||||
this.textField = element;
|
||||
this.setupContent( element );
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var editor,
|
||||
element = this.textField,
|
||||
isInsertMode = !element;
|
||||
|
||||
if ( isInsertMode )
|
||||
{
|
||||
editor = this.getParentEditor();
|
||||
element = editor.document.createElement( 'input' );
|
||||
element.setAttribute( 'type', 'text' );
|
||||
}
|
||||
|
||||
if ( isInsertMode )
|
||||
editor.insertElement( element );
|
||||
this.commitContent( { element : element } );
|
||||
},
|
||||
onLoad : function()
|
||||
{
|
||||
var autoSetup = function( element )
|
||||
{
|
||||
var value = element.hasAttribute( this.id ) && element.getAttribute( this.id );
|
||||
this.setValue( value || '' );
|
||||
};
|
||||
|
||||
var autoCommit = function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
var value = this.getValue();
|
||||
|
||||
if ( value )
|
||||
element.setAttribute( this.id, value );
|
||||
else
|
||||
element.removeAttribute( this.id );
|
||||
};
|
||||
|
||||
this.foreach( function( contentObj )
|
||||
{
|
||||
if ( autoAttributes[ contentObj.id ] )
|
||||
{
|
||||
contentObj.setup = autoSetup;
|
||||
contentObj.commit = autoCommit;
|
||||
}
|
||||
} );
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.textfield.title,
|
||||
title : editor.lang.textfield.title,
|
||||
elements : [
|
||||
{
|
||||
type : 'hbox',
|
||||
widths : [ '50%', '50%' ],
|
||||
children :
|
||||
[
|
||||
{
|
||||
id : '_cke_saved_name',
|
||||
type : 'text',
|
||||
label : editor.lang.textfield.name,
|
||||
'default' : '',
|
||||
accessKey : 'N',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue(
|
||||
element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
if ( this.getValue() )
|
||||
element.data( 'cke-saved-name', this.getValue() );
|
||||
else
|
||||
{
|
||||
element.data( 'cke-saved-name', false );
|
||||
element.removeAttribute( 'name' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'value',
|
||||
type : 'text',
|
||||
label : editor.lang.textfield.value,
|
||||
'default' : '',
|
||||
accessKey : 'V'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type : 'hbox',
|
||||
widths : [ '50%', '50%' ],
|
||||
children :
|
||||
[
|
||||
{
|
||||
id : 'size',
|
||||
type : 'text',
|
||||
label : editor.lang.textfield.charWidth,
|
||||
'default' : '',
|
||||
accessKey : 'C',
|
||||
style : 'width:50px',
|
||||
validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed )
|
||||
},
|
||||
{
|
||||
id : 'maxLength',
|
||||
type : 'text',
|
||||
label : editor.lang.textfield.maxChars,
|
||||
'default' : '',
|
||||
accessKey : 'M',
|
||||
style : 'width:50px',
|
||||
validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed )
|
||||
}
|
||||
],
|
||||
onLoad : function()
|
||||
{
|
||||
// Repaint the style for IE7 (#6068)
|
||||
if ( CKEDITOR.env.ie7Compat )
|
||||
this.getElement().setStyle( 'zoom', '100%' );
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'type',
|
||||
type : 'select',
|
||||
label : editor.lang.textfield.type,
|
||||
'default' : 'text',
|
||||
accessKey : 'M',
|
||||
items :
|
||||
[
|
||||
[ editor.lang.textfield.typeText, 'text' ],
|
||||
[ editor.lang.textfield.typePass, 'password' ]
|
||||
],
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'type' ) );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
var elementType = element.getAttribute( 'type' );
|
||||
var myType = this.getValue();
|
||||
|
||||
if ( elementType != myType )
|
||||
{
|
||||
var replace = CKEDITOR.dom.element.createFromHtml( '<input type="' + myType + '"></input>', editor.document );
|
||||
element.copyAttributes( replace, { type : 1 } );
|
||||
replace.replace( element );
|
||||
editor.getSelection().selectElement( replace );
|
||||
data.element = replace;
|
||||
}
|
||||
}
|
||||
else
|
||||
element.setAttribute( 'type', this.getValue() );
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'textfield', function( editor )
|
||||
{
|
||||
var autoAttributes =
|
||||
{
|
||||
value : 1,
|
||||
size : 1,
|
||||
maxLength : 1
|
||||
};
|
||||
|
||||
var acceptedTypes =
|
||||
{
|
||||
text : 1,
|
||||
password : 1
|
||||
};
|
||||
|
||||
return {
|
||||
title : editor.lang.textfield.title,
|
||||
minWidth : 350,
|
||||
minHeight : 150,
|
||||
onShow : function()
|
||||
{
|
||||
delete this.textField;
|
||||
|
||||
var element = this.getParentEditor().getSelection().getSelectedElement();
|
||||
if ( element && element.getName() == "input" &&
|
||||
( acceptedTypes[ element.getAttribute( 'type' ) ] || !element.getAttribute( 'type' ) ) )
|
||||
{
|
||||
this.textField = element;
|
||||
this.setupContent( element );
|
||||
}
|
||||
},
|
||||
onOk : function()
|
||||
{
|
||||
var editor,
|
||||
element = this.textField,
|
||||
isInsertMode = !element;
|
||||
|
||||
if ( isInsertMode )
|
||||
{
|
||||
editor = this.getParentEditor();
|
||||
element = editor.document.createElement( 'input' );
|
||||
element.setAttribute( 'type', 'text' );
|
||||
}
|
||||
|
||||
if ( isInsertMode )
|
||||
editor.insertElement( element );
|
||||
this.commitContent( { element : element } );
|
||||
},
|
||||
onLoad : function()
|
||||
{
|
||||
var autoSetup = function( element )
|
||||
{
|
||||
var value = element.hasAttribute( this.id ) && element.getAttribute( this.id );
|
||||
this.setValue( value || '' );
|
||||
};
|
||||
|
||||
var autoCommit = function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
var value = this.getValue();
|
||||
|
||||
if ( value )
|
||||
element.setAttribute( this.id, value );
|
||||
else
|
||||
element.removeAttribute( this.id );
|
||||
};
|
||||
|
||||
this.foreach( function( contentObj )
|
||||
{
|
||||
if ( autoAttributes[ contentObj.id ] )
|
||||
{
|
||||
contentObj.setup = autoSetup;
|
||||
contentObj.commit = autoCommit;
|
||||
}
|
||||
} );
|
||||
},
|
||||
contents : [
|
||||
{
|
||||
id : 'info',
|
||||
label : editor.lang.textfield.title,
|
||||
title : editor.lang.textfield.title,
|
||||
elements : [
|
||||
{
|
||||
type : 'hbox',
|
||||
widths : [ '50%', '50%' ],
|
||||
children :
|
||||
[
|
||||
{
|
||||
id : '_cke_saved_name',
|
||||
type : 'text',
|
||||
label : editor.lang.textfield.name,
|
||||
'default' : '',
|
||||
accessKey : 'N',
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue(
|
||||
element.data( 'cke-saved-name' ) ||
|
||||
element.getAttribute( 'name' ) ||
|
||||
'' );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
if ( this.getValue() )
|
||||
element.data( 'cke-saved-name', this.getValue() );
|
||||
else
|
||||
{
|
||||
element.data( 'cke-saved-name', false );
|
||||
element.removeAttribute( 'name' );
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'value',
|
||||
type : 'text',
|
||||
label : editor.lang.textfield.value,
|
||||
'default' : '',
|
||||
accessKey : 'V'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type : 'hbox',
|
||||
widths : [ '50%', '50%' ],
|
||||
children :
|
||||
[
|
||||
{
|
||||
id : 'size',
|
||||
type : 'text',
|
||||
label : editor.lang.textfield.charWidth,
|
||||
'default' : '',
|
||||
accessKey : 'C',
|
||||
style : 'width:50px',
|
||||
validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed )
|
||||
},
|
||||
{
|
||||
id : 'maxLength',
|
||||
type : 'text',
|
||||
label : editor.lang.textfield.maxChars,
|
||||
'default' : '',
|
||||
accessKey : 'M',
|
||||
style : 'width:50px',
|
||||
validate : CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed )
|
||||
}
|
||||
],
|
||||
onLoad : function()
|
||||
{
|
||||
// Repaint the style for IE7 (#6068)
|
||||
if ( CKEDITOR.env.ie7Compat )
|
||||
this.getElement().setStyle( 'zoom', '100%' );
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'type',
|
||||
type : 'select',
|
||||
label : editor.lang.textfield.type,
|
||||
'default' : 'text',
|
||||
accessKey : 'M',
|
||||
items :
|
||||
[
|
||||
[ editor.lang.textfield.typeText, 'text' ],
|
||||
[ editor.lang.textfield.typePass, 'password' ]
|
||||
],
|
||||
setup : function( element )
|
||||
{
|
||||
this.setValue( element.getAttribute( 'type' ) );
|
||||
},
|
||||
commit : function( data )
|
||||
{
|
||||
var element = data.element;
|
||||
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
var elementType = element.getAttribute( 'type' );
|
||||
var myType = this.getValue();
|
||||
|
||||
if ( elementType != myType )
|
||||
{
|
||||
var replace = CKEDITOR.dom.element.createFromHtml( '<input type="' + myType + '"></input>', editor.document );
|
||||
element.copyAttributes( replace, { type : 1 } );
|
||||
replace.replace( element );
|
||||
editor.getSelection().selectElement( replace );
|
||||
data.element = replace;
|
||||
}
|
||||
}
|
||||
else
|
||||
element.setAttribute( 'type', this.getValue() );
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,289 +1,289 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file Forms Plugin
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.add( 'forms',
|
||||
{
|
||||
requires : [ 'dialog' ],
|
||||
init : function( editor )
|
||||
{
|
||||
var lang = editor.lang;
|
||||
|
||||
editor.addCss(
|
||||
'form' +
|
||||
'{' +
|
||||
'border: 1px dotted #FF0000;' +
|
||||
'padding: 2px;' +
|
||||
'}\n' );
|
||||
|
||||
editor.addCss(
|
||||
'img.cke_hidden' +
|
||||
'{' +
|
||||
'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/hiddenfield.gif' ) + ');' +
|
||||
'background-position: center center;' +
|
||||
'background-repeat: no-repeat;' +
|
||||
'border: 1px solid #a9a9a9;' +
|
||||
'width: 16px !important;' +
|
||||
'height: 16px !important;' +
|
||||
'}' );
|
||||
|
||||
// All buttons use the same code to register. So, to avoid
|
||||
// duplications, let's use this tool function.
|
||||
var addButtonCommand = function( buttonName, commandName, dialogFile )
|
||||
{
|
||||
editor.addCommand( commandName, new CKEDITOR.dialogCommand( commandName ) );
|
||||
|
||||
editor.ui.addButton( buttonName,
|
||||
{
|
||||
label : lang.common[ buttonName.charAt(0).toLowerCase() + buttonName.slice(1) ],
|
||||
command : commandName
|
||||
});
|
||||
CKEDITOR.dialog.add( commandName, dialogFile );
|
||||
};
|
||||
|
||||
var dialogPath = this.path + 'dialogs/';
|
||||
addButtonCommand( 'Form', 'form', dialogPath + 'form.js' );
|
||||
addButtonCommand( 'Checkbox', 'checkbox', dialogPath + 'checkbox.js' );
|
||||
addButtonCommand( 'Radio', 'radio', dialogPath + 'radio.js' );
|
||||
addButtonCommand( 'TextField', 'textfield', dialogPath + 'textfield.js' );
|
||||
addButtonCommand( 'Textarea', 'textarea', dialogPath + 'textarea.js' );
|
||||
addButtonCommand( 'Select', 'select', dialogPath + 'select.js' );
|
||||
addButtonCommand( 'Button', 'button', dialogPath + 'button.js' );
|
||||
addButtonCommand( 'ImageButton', 'imagebutton', CKEDITOR.plugins.getPath('image') + 'dialogs/image.js' );
|
||||
addButtonCommand( 'HiddenField', 'hiddenfield', dialogPath + 'hiddenfield.js' );
|
||||
|
||||
// If the "menu" plugin is loaded, register the menu items.
|
||||
if ( editor.addMenuItems )
|
||||
{
|
||||
editor.addMenuItems(
|
||||
{
|
||||
form :
|
||||
{
|
||||
label : lang.form.menu,
|
||||
command : 'form',
|
||||
group : 'form'
|
||||
},
|
||||
|
||||
checkbox :
|
||||
{
|
||||
label : lang.checkboxAndRadio.checkboxTitle,
|
||||
command : 'checkbox',
|
||||
group : 'checkbox'
|
||||
},
|
||||
|
||||
radio :
|
||||
{
|
||||
label : lang.checkboxAndRadio.radioTitle,
|
||||
command : 'radio',
|
||||
group : 'radio'
|
||||
},
|
||||
|
||||
textfield :
|
||||
{
|
||||
label : lang.textfield.title,
|
||||
command : 'textfield',
|
||||
group : 'textfield'
|
||||
},
|
||||
|
||||
hiddenfield :
|
||||
{
|
||||
label : lang.hidden.title,
|
||||
command : 'hiddenfield',
|
||||
group : 'hiddenfield'
|
||||
},
|
||||
|
||||
imagebutton :
|
||||
{
|
||||
label : lang.image.titleButton,
|
||||
command : 'imagebutton',
|
||||
group : 'imagebutton'
|
||||
},
|
||||
|
||||
button :
|
||||
{
|
||||
label : lang.button.title,
|
||||
command : 'button',
|
||||
group : 'button'
|
||||
},
|
||||
|
||||
select :
|
||||
{
|
||||
label : lang.select.title,
|
||||
command : 'select',
|
||||
group : 'select'
|
||||
},
|
||||
|
||||
textarea :
|
||||
{
|
||||
label : lang.textarea.title,
|
||||
command : 'textarea',
|
||||
group : 'textarea'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// If the "contextmenu" plugin is loaded, register the listeners.
|
||||
if ( editor.contextMenu )
|
||||
{
|
||||
editor.contextMenu.addListener( function( element )
|
||||
{
|
||||
if ( element && element.hasAscendant( 'form', true ) && !element.isReadOnly() )
|
||||
return { form : CKEDITOR.TRISTATE_OFF };
|
||||
});
|
||||
|
||||
editor.contextMenu.addListener( function( element )
|
||||
{
|
||||
if ( element && !element.isReadOnly() )
|
||||
{
|
||||
var name = element.getName();
|
||||
|
||||
if ( name == 'select' )
|
||||
return { select : CKEDITOR.TRISTATE_OFF };
|
||||
|
||||
if ( name == 'textarea' )
|
||||
return { textarea : CKEDITOR.TRISTATE_OFF };
|
||||
|
||||
if ( name == 'input' )
|
||||
{
|
||||
switch( element.getAttribute( 'type' ) )
|
||||
{
|
||||
case 'button' :
|
||||
case 'submit' :
|
||||
case 'reset' :
|
||||
return { button : CKEDITOR.TRISTATE_OFF };
|
||||
|
||||
case 'checkbox' :
|
||||
return { checkbox : CKEDITOR.TRISTATE_OFF };
|
||||
|
||||
case 'radio' :
|
||||
return { radio : CKEDITOR.TRISTATE_OFF };
|
||||
|
||||
case 'image' :
|
||||
return { imagebutton : CKEDITOR.TRISTATE_OFF };
|
||||
|
||||
default :
|
||||
return { textfield : CKEDITOR.TRISTATE_OFF };
|
||||
}
|
||||
}
|
||||
|
||||
if ( name == 'img' && element.data( 'cke-real-element-type' ) == 'hiddenfield' )
|
||||
return { hiddenfield : CKEDITOR.TRISTATE_OFF };
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
editor.on( 'doubleclick', function( evt )
|
||||
{
|
||||
var element = evt.data.element;
|
||||
|
||||
if ( element.is( 'form' ) )
|
||||
evt.data.dialog = 'form';
|
||||
else if ( element.is( 'select' ) )
|
||||
evt.data.dialog = 'select';
|
||||
else if ( element.is( 'textarea' ) )
|
||||
evt.data.dialog = 'textarea';
|
||||
else if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'hiddenfield' )
|
||||
evt.data.dialog = 'hiddenfield';
|
||||
else if ( element.is( 'input' ) )
|
||||
{
|
||||
switch ( element.getAttribute( 'type' ) )
|
||||
{
|
||||
case 'button' :
|
||||
case 'submit' :
|
||||
case 'reset' :
|
||||
evt.data.dialog = 'button';
|
||||
break;
|
||||
case 'checkbox' :
|
||||
evt.data.dialog = 'checkbox';
|
||||
break;
|
||||
case 'radio' :
|
||||
evt.data.dialog = 'radio';
|
||||
break;
|
||||
case 'image' :
|
||||
evt.data.dialog = 'imagebutton';
|
||||
break;
|
||||
default :
|
||||
evt.data.dialog = 'textfield';
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
afterInit : function( editor )
|
||||
{
|
||||
var dataProcessor = editor.dataProcessor,
|
||||
htmlFilter = dataProcessor && dataProcessor.htmlFilter,
|
||||
dataFilter = dataProcessor && dataProcessor.dataFilter;
|
||||
|
||||
// Cleanup certain IE form elements default values.
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
htmlFilter && htmlFilter.addRules(
|
||||
{
|
||||
elements :
|
||||
{
|
||||
input : function( input )
|
||||
{
|
||||
var attrs = input.attributes,
|
||||
type = attrs.type;
|
||||
// Old IEs don't provide type for Text inputs #5522
|
||||
if ( !type )
|
||||
attrs.type = 'text';
|
||||
if ( type == 'checkbox' || type == 'radio' )
|
||||
attrs.value == 'on' && delete attrs.value;
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
if ( dataFilter )
|
||||
{
|
||||
dataFilter.addRules(
|
||||
{
|
||||
elements :
|
||||
{
|
||||
input : function( element )
|
||||
{
|
||||
if ( element.attributes.type == 'hidden' )
|
||||
return editor.createFakeParserElement( element, 'cke_hidden', 'hiddenfield' );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
},
|
||||
requires : [ 'image', 'fakeobjects' ]
|
||||
} );
|
||||
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
CKEDITOR.dom.element.prototype.hasAttribute = CKEDITOR.tools.override( CKEDITOR.dom.element.prototype.hasAttribute,
|
||||
function( original )
|
||||
{
|
||||
return function( name )
|
||||
{
|
||||
var $attr = this.$.attributes.getNamedItem( name );
|
||||
|
||||
if ( this.getName() == 'input' )
|
||||
{
|
||||
switch ( name )
|
||||
{
|
||||
case 'class' :
|
||||
return this.$.className.length > 0;
|
||||
case 'checked' :
|
||||
return !!this.$.checked;
|
||||
case 'value' :
|
||||
var type = this.getAttribute( 'type' );
|
||||
return type == 'checkbox' || type == 'radio' ? this.$.value != 'on' : this.$.value;
|
||||
}
|
||||
}
|
||||
|
||||
return original.apply( this, arguments );
|
||||
};
|
||||
});
|
||||
}
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file Forms Plugin
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.add( 'forms',
|
||||
{
|
||||
requires : [ 'dialog' ],
|
||||
init : function( editor )
|
||||
{
|
||||
var lang = editor.lang;
|
||||
|
||||
editor.addCss(
|
||||
'form' +
|
||||
'{' +
|
||||
'border: 1px dotted #FF0000;' +
|
||||
'padding: 2px;' +
|
||||
'}\n' );
|
||||
|
||||
editor.addCss(
|
||||
'img.cke_hidden' +
|
||||
'{' +
|
||||
'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/hiddenfield.gif' ) + ');' +
|
||||
'background-position: center center;' +
|
||||
'background-repeat: no-repeat;' +
|
||||
'border: 1px solid #a9a9a9;' +
|
||||
'width: 16px !important;' +
|
||||
'height: 16px !important;' +
|
||||
'}' );
|
||||
|
||||
// All buttons use the same code to register. So, to avoid
|
||||
// duplications, let's use this tool function.
|
||||
var addButtonCommand = function( buttonName, commandName, dialogFile )
|
||||
{
|
||||
editor.addCommand( commandName, new CKEDITOR.dialogCommand( commandName ) );
|
||||
|
||||
editor.ui.addButton( buttonName,
|
||||
{
|
||||
label : lang.common[ buttonName.charAt(0).toLowerCase() + buttonName.slice(1) ],
|
||||
command : commandName
|
||||
});
|
||||
CKEDITOR.dialog.add( commandName, dialogFile );
|
||||
};
|
||||
|
||||
var dialogPath = this.path + 'dialogs/';
|
||||
addButtonCommand( 'Form', 'form', dialogPath + 'form.js' );
|
||||
addButtonCommand( 'Checkbox', 'checkbox', dialogPath + 'checkbox.js' );
|
||||
addButtonCommand( 'Radio', 'radio', dialogPath + 'radio.js' );
|
||||
addButtonCommand( 'TextField', 'textfield', dialogPath + 'textfield.js' );
|
||||
addButtonCommand( 'Textarea', 'textarea', dialogPath + 'textarea.js' );
|
||||
addButtonCommand( 'Select', 'select', dialogPath + 'select.js' );
|
||||
addButtonCommand( 'Button', 'button', dialogPath + 'button.js' );
|
||||
addButtonCommand( 'ImageButton', 'imagebutton', CKEDITOR.plugins.getPath('image') + 'dialogs/image.js' );
|
||||
addButtonCommand( 'HiddenField', 'hiddenfield', dialogPath + 'hiddenfield.js' );
|
||||
|
||||
// If the "menu" plugin is loaded, register the menu items.
|
||||
if ( editor.addMenuItems )
|
||||
{
|
||||
editor.addMenuItems(
|
||||
{
|
||||
form :
|
||||
{
|
||||
label : lang.form.menu,
|
||||
command : 'form',
|
||||
group : 'form'
|
||||
},
|
||||
|
||||
checkbox :
|
||||
{
|
||||
label : lang.checkboxAndRadio.checkboxTitle,
|
||||
command : 'checkbox',
|
||||
group : 'checkbox'
|
||||
},
|
||||
|
||||
radio :
|
||||
{
|
||||
label : lang.checkboxAndRadio.radioTitle,
|
||||
command : 'radio',
|
||||
group : 'radio'
|
||||
},
|
||||
|
||||
textfield :
|
||||
{
|
||||
label : lang.textfield.title,
|
||||
command : 'textfield',
|
||||
group : 'textfield'
|
||||
},
|
||||
|
||||
hiddenfield :
|
||||
{
|
||||
label : lang.hidden.title,
|
||||
command : 'hiddenfield',
|
||||
group : 'hiddenfield'
|
||||
},
|
||||
|
||||
imagebutton :
|
||||
{
|
||||
label : lang.image.titleButton,
|
||||
command : 'imagebutton',
|
||||
group : 'imagebutton'
|
||||
},
|
||||
|
||||
button :
|
||||
{
|
||||
label : lang.button.title,
|
||||
command : 'button',
|
||||
group : 'button'
|
||||
},
|
||||
|
||||
select :
|
||||
{
|
||||
label : lang.select.title,
|
||||
command : 'select',
|
||||
group : 'select'
|
||||
},
|
||||
|
||||
textarea :
|
||||
{
|
||||
label : lang.textarea.title,
|
||||
command : 'textarea',
|
||||
group : 'textarea'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// If the "contextmenu" plugin is loaded, register the listeners.
|
||||
if ( editor.contextMenu )
|
||||
{
|
||||
editor.contextMenu.addListener( function( element )
|
||||
{
|
||||
if ( element && element.hasAscendant( 'form', true ) && !element.isReadOnly() )
|
||||
return { form : CKEDITOR.TRISTATE_OFF };
|
||||
});
|
||||
|
||||
editor.contextMenu.addListener( function( element )
|
||||
{
|
||||
if ( element && !element.isReadOnly() )
|
||||
{
|
||||
var name = element.getName();
|
||||
|
||||
if ( name == 'select' )
|
||||
return { select : CKEDITOR.TRISTATE_OFF };
|
||||
|
||||
if ( name == 'textarea' )
|
||||
return { textarea : CKEDITOR.TRISTATE_OFF };
|
||||
|
||||
if ( name == 'input' )
|
||||
{
|
||||
switch( element.getAttribute( 'type' ) )
|
||||
{
|
||||
case 'button' :
|
||||
case 'submit' :
|
||||
case 'reset' :
|
||||
return { button : CKEDITOR.TRISTATE_OFF };
|
||||
|
||||
case 'checkbox' :
|
||||
return { checkbox : CKEDITOR.TRISTATE_OFF };
|
||||
|
||||
case 'radio' :
|
||||
return { radio : CKEDITOR.TRISTATE_OFF };
|
||||
|
||||
case 'image' :
|
||||
return { imagebutton : CKEDITOR.TRISTATE_OFF };
|
||||
|
||||
default :
|
||||
return { textfield : CKEDITOR.TRISTATE_OFF };
|
||||
}
|
||||
}
|
||||
|
||||
if ( name == 'img' && element.data( 'cke-real-element-type' ) == 'hiddenfield' )
|
||||
return { hiddenfield : CKEDITOR.TRISTATE_OFF };
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
editor.on( 'doubleclick', function( evt )
|
||||
{
|
||||
var element = evt.data.element;
|
||||
|
||||
if ( element.is( 'form' ) )
|
||||
evt.data.dialog = 'form';
|
||||
else if ( element.is( 'select' ) )
|
||||
evt.data.dialog = 'select';
|
||||
else if ( element.is( 'textarea' ) )
|
||||
evt.data.dialog = 'textarea';
|
||||
else if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'hiddenfield' )
|
||||
evt.data.dialog = 'hiddenfield';
|
||||
else if ( element.is( 'input' ) )
|
||||
{
|
||||
switch ( element.getAttribute( 'type' ) )
|
||||
{
|
||||
case 'button' :
|
||||
case 'submit' :
|
||||
case 'reset' :
|
||||
evt.data.dialog = 'button';
|
||||
break;
|
||||
case 'checkbox' :
|
||||
evt.data.dialog = 'checkbox';
|
||||
break;
|
||||
case 'radio' :
|
||||
evt.data.dialog = 'radio';
|
||||
break;
|
||||
case 'image' :
|
||||
evt.data.dialog = 'imagebutton';
|
||||
break;
|
||||
default :
|
||||
evt.data.dialog = 'textfield';
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
afterInit : function( editor )
|
||||
{
|
||||
var dataProcessor = editor.dataProcessor,
|
||||
htmlFilter = dataProcessor && dataProcessor.htmlFilter,
|
||||
dataFilter = dataProcessor && dataProcessor.dataFilter;
|
||||
|
||||
// Cleanup certain IE form elements default values.
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
htmlFilter && htmlFilter.addRules(
|
||||
{
|
||||
elements :
|
||||
{
|
||||
input : function( input )
|
||||
{
|
||||
var attrs = input.attributes,
|
||||
type = attrs.type;
|
||||
// Old IEs don't provide type for Text inputs #5522
|
||||
if ( !type )
|
||||
attrs.type = 'text';
|
||||
if ( type == 'checkbox' || type == 'radio' )
|
||||
attrs.value == 'on' && delete attrs.value;
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
if ( dataFilter )
|
||||
{
|
||||
dataFilter.addRules(
|
||||
{
|
||||
elements :
|
||||
{
|
||||
input : function( element )
|
||||
{
|
||||
if ( element.attributes.type == 'hidden' )
|
||||
return editor.createFakeParserElement( element, 'cke_hidden', 'hiddenfield' );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
},
|
||||
requires : [ 'image', 'fakeobjects' ]
|
||||
} );
|
||||
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
CKEDITOR.dom.element.prototype.hasAttribute = CKEDITOR.tools.override( CKEDITOR.dom.element.prototype.hasAttribute,
|
||||
function( original )
|
||||
{
|
||||
return function( name )
|
||||
{
|
||||
var $attr = this.$.attributes.getNamedItem( name );
|
||||
|
||||
if ( this.getName() == 'input' )
|
||||
{
|
||||
switch ( name )
|
||||
{
|
||||
case 'class' :
|
||||
return this.$.className.length > 0;
|
||||
case 'checked' :
|
||||
return !!this.$.checked;
|
||||
case 'value' :
|
||||
var type = this.getAttribute( 'type' );
|
||||
return type == 'checkbox' || type == 'radio' ? this.$.value != 'on' : this.$.value;
|
||||
}
|
||||
}
|
||||
|
||||
return original.apply( this, arguments );
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user