+++ /dev/null
-/*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
-For licensing, see LICENSE.html or http://ckeditor.com/license\r
-*/\r
-CKEDITOR.dialog.add( 'form', function( editor )\r
-{\r
- var autoAttributes =\r
- {\r
- action : 1,\r
- id : 1,\r
- method : 1,\r
- enctype : 1,\r
- target : 1\r
- };\r
-\r
- return {\r
- title : editor.lang.form.title,\r
- minWidth : 350,\r
- minHeight : 200,\r
- onShow : function()\r
- {\r
- delete this.form;\r
-\r
- var element = this.getParentEditor().getSelection().getStartElement();\r
- var form = element && element.getAscendant( 'form', true );\r
- if ( form )\r
- {\r
- this.form = form;\r
- this.setupContent( form );\r
- }\r
- },\r
- onOk : function()\r
- {\r
- var editor,\r
- element = this.form,\r
- isInsertMode = !element;\r
-\r
- if ( isInsertMode )\r
- {\r
- editor = this.getParentEditor();\r
- element = editor.document.createElement( 'form' );\r
- !CKEDITOR.env.ie && element.append( editor.document.createElement( 'br' ) );\r
- }\r
-\r
- if ( isInsertMode )\r
- editor.insertElement( element );\r
- this.commitContent( element );\r
- },\r
- onLoad : function()\r
- {\r
- function autoSetup( element )\r
- {\r
- this.setValue( element.getAttribute( this.id ) || '' );\r
- }\r
-\r
- function autoCommit( element )\r
- {\r
- if ( this.getValue() )\r
- element.setAttribute( this.id, this.getValue() );\r
- else\r
- element.removeAttribute( this.id );\r
- }\r
-\r
- this.foreach( function( contentObj )\r
- {\r
- if ( autoAttributes[ contentObj.id ] )\r
- {\r
- contentObj.setup = autoSetup;\r
- contentObj.commit = autoCommit;\r
- }\r
- } );\r
- },\r
- contents : [\r
- {\r
- id : 'info',\r
- label : editor.lang.form.title,\r
- title : editor.lang.form.title,\r
- elements : [\r
- {\r
- id : 'txtName',\r
- type : 'text',\r
- label : editor.lang.common.name,\r
- 'default' : '',\r
- accessKey : 'N',\r
- setup : function( element )\r
- {\r
- this.setValue( element.data( 'cke-saved-name' ) ||\r
- element.getAttribute( 'name' ) ||\r
- '' );\r
- },\r
- commit : function( element )\r
- {\r
- if ( this.getValue() )\r
- element.data( 'cke-saved-name', this.getValue() );\r
- else\r
- {\r
- element.data( 'cke-saved-name', false );\r
- element.removeAttribute( 'name' );\r
- }\r
- }\r
- },\r
- {\r
- id : 'action',\r
- type : 'text',\r
- label : editor.lang.form.action,\r
- 'default' : '',\r
- accessKey : 'T'\r
- },\r
- {\r
- type : 'hbox',\r
- widths : [ '45%', '55%' ],\r
- children :\r
- [\r
- {\r
- id : 'id',\r
- type : 'text',\r
- label : editor.lang.common.id,\r
- 'default' : '',\r
- accessKey : 'I'\r
- },\r
- {\r
- id : 'enctype',\r
- type : 'select',\r
- label : editor.lang.form.encoding,\r
- style : 'width:100%',\r
- accessKey : 'E',\r
- 'default' : '',\r
- items :\r
- [\r
- [ '' ],\r
- [ 'text/plain' ],\r
- [ 'multipart/form-data' ],\r
- [ 'application/x-www-form-urlencoded' ]\r
- ]\r
- }\r
- ]\r
- },\r
- {\r
- type : 'hbox',\r
- widths : [ '45%', '55%' ],\r
- children :\r
- [\r
- {\r
- id : 'target',\r
- type : 'select',\r
- label : editor.lang.common.target,\r
- style : 'width:100%',\r
- accessKey : 'M',\r
- 'default' : '',\r
- items :\r
- [\r
- [ editor.lang.common.notSet, '' ],\r
- [ editor.lang.common.targetNew, '_blank' ],\r
- [ editor.lang.common.targetTop, '_top' ],\r
- [ editor.lang.common.targetSelf, '_self' ],\r
- [ editor.lang.common.targetParent, '_parent' ]\r
- ]\r
- },\r
- {\r
- id : 'method',\r
- type : 'select',\r
- label : editor.lang.form.method,\r
- accessKey : 'M',\r
- 'default' : 'GET',\r
- items :\r
- [\r
- [ 'GET', 'get' ],\r
- [ 'POST', 'post' ]\r
- ]\r
- }\r
- ]\r
- }\r
- ]\r
- }\r
- ]\r
- };\r
-});\r