Changeset 2919
- Timestamp:
- 01/17/09 16:18:55 (4 years ago)
- Location:
- CKEditor/branches/prototype/_source/plugins/forms
- Files:
-
- 9 edited
-
dialogs/button.js (modified) (4 diffs)
-
dialogs/checkbox.js (modified) (5 diffs)
-
dialogs/form.js (modified) (7 diffs)
-
dialogs/hiddenfield.js (modified) (5 diffs)
-
dialogs/radio.js (modified) (5 diffs)
-
dialogs/select.js (modified) (17 diffs)
-
dialogs/textarea.js (modified) (4 diffs)
-
dialogs/textfield.js (modified) (5 diffs)
-
plugin.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CKEditor/branches/prototype/_source/plugins/forms/dialogs/button.js
r2875 r2919 32 32 33 33 // Function called in onShow to load selected element. 34 var loadLink = function( editor, selection, ranges, element ){ 35 34 var loadSelection = function( editor, selection, ranges, element ){ 36 35 // Read attributes. 37 36 var type = element.getAttribute( 'type' ); … … 56 55 minWidth : 400, 57 56 minHeight : 230, 58 onOk : function( data )59 {60 this.editObj.setAttributes( this.changedAttibutes );61 62 if ( this.editMode == false )63 {64 // Doesn't work with IE.65 this.restoreSelection();66 this.clearSavedSelection();67 editor.insertElement( this.editObj );68 }69 return true;70 },71 57 onShow : function() 72 58 { … … 93 79 if ( type == "button" || type == "reset" || type == "submit" ) 94 80 { 95 load Link.apply( this, [ editor, selection, ranges, element ] );81 loadSelection.apply( this, [ editor, selection, ranges, element ] ); 96 82 selection.selectElement( element ); 97 83 } … … 100 86 101 87 if ( this.editMode == false ) //New object. 102 {103 88 this.editObj = editor.document.createElement( 'input' ); 104 }105 89 this.getContentElement( 'info', 'txtName' ).focus(); 106 90 107 91 this.changedAttibutes = new Array(); 92 }, 93 onOk : function() 94 { 95 this.editObj.setAttributes( this.changedAttibutes ); 96 97 if ( this.editMode == false ) 98 { 99 this.restoreSelection(); 100 this.clearSavedSelection(); 101 editor.insertElement( this.editObj ); 102 } 103 return true; 108 104 }, 109 105 contents : [ -
CKEditor/branches/prototype/_source/plugins/forms/dialogs/checkbox.js
r2829 r2919 32 32 33 33 // Function called in onShow to load selected element. 34 var load Link= function( editor, selection, ranges, element )34 var loadSelection = function( editor, selection, ranges, element ) 35 35 { 36 36 this.saveSelection(); … … 39 39 40 40 // Fill out all fields. 41 readAttribute.apply( this, [ 'info', 'name', 'txtName'] );42 readAttribute.apply( this, [ 'info', 'value', 'txtValue'] );43 readAttribute.apply( this, [ 'info', 'checked', 'cmbSelected'] );41 readAttribute.apply( this, [ this.editObj, 'info', 'name', 'txtName', true ] ); 42 readAttribute.apply( this, [ this.editObj, 'info', 'value', 'txtValue', true ] ); 43 readAttribute.apply( this, [ this.editObj, 'info', 'checked', 'cmbSelected', true ] ); 44 44 45 45 return false; 46 46 }; 47 47 48 var readAttribute = function( page, attribute, input)48 var readAttribute = function( object, page, attribute, input, setIfNull ) 49 49 { 50 var attributeValue = this.editObj.getAttribute( attribute ); 51 this.setValueOf( page, input, attributeValue ); 52 50 var attributeValue = object.getAttribute( attribute ); 51 if ( attributeValue == null ) 52 if ( setIfNull ) 53 this.setValueOf( page, input, "" ); 54 else 55 this.setValueOf( page, input, attributeValue ); 53 56 return attributeValue; 54 57 } … … 59 62 minWidth : 400, 60 63 minHeight : 230, 61 onOk : function()62 {63 this.changedAttibutes[ 'type' ] = 'checkbox';64 65 this.editObj.setAttributes( this.changedAttibutes );66 67 if ( this.editMode == false )68 {69 // It doesn't work with IE.70 this.restoreSelection();71 this.clearSavedSelection();72 editor.insertElement( this.editObj );73 }74 return true;75 },76 64 onShow : function() 77 65 { 78 66 // Default: create a new element. 79 67 this.editMode = false; 68 this.changedAttibutes = new Array(); 80 69 81 70 // IE BUG: Selection must be in the editor for getSelection() to work. … … 95 84 if ( element && element.getAttribute( 'type' ) == "checkbox" ) 96 85 { 97 load Link.apply( this, [ editor, selection, ranges, element ] );86 loadSelection.apply( this, [ editor, selection, ranges, element ] ); 98 87 selection.selectElement( element ); 99 88 } … … 104 93 105 94 this.getContentElement( 'info', 'txtName' ).focus(); 106 this.changedAttibutes = new Array(); 95 }, 96 onOk : function() 97 { 98 this.changedAttibutes[ 'type' ] = 'checkbox'; 99 100 this.editObj.setAttributes( this.changedAttibutes ); 101 102 if ( this.editMode == false ) 103 { 104 this.restoreSelection(); 105 this.clearSavedSelection(); 106 editor.insertElement( this.editObj ); 107 } 108 return true; 107 109 }, 108 110 contents : [ -
CKEditor/branches/prototype/_source/plugins/forms/dialogs/form.js
r2875 r2919 32 32 33 33 // Function called in onShow to load selected element. 34 var load Link= function( editor, selection, ranges, element )34 var loadSelection = function( editor, selection, ranges, element ) 35 35 { 36 36 this.saveSelection(); … … 39 39 40 40 // Fill out all fields. 41 readAttribute.apply( this, [ 'info', 'name', 'txtName'] );42 readAttribute.apply( this, [ 'info', 'action', 'txtAction'] );43 readAttribute.apply( this, [ 'info', 'method', 'cmbMethod'] );44 readAttribute.apply( this, [ 'info', 'encoding', 'cmbEncoding'] );45 readAttribute.apply( this, [ 'info', 'target', 'cmbTarget'] );46 readAttribute.apply( this, [ 'info', 'id', 'txtId'] );41 readAttribute.apply( this, [ this.editObj, 'info', 'name', 'txtName', true ] ); 42 readAttribute.apply( this, [ this.editObj, 'info', 'action', 'txtAction', true ] ); 43 readAttribute.apply( this, [ this.editObj, 'info', 'method', 'cmbMethod', true ] ); 44 readAttribute.apply( this, [ this.editObj, 'info', 'encoding', 'cmbEncoding', true ] ); 45 readAttribute.apply( this, [ this.editObj, 'info', 'target', 'cmbTarget', true ] ); 46 readAttribute.apply( this, [ this.editObj, 'info', 'id', 'txtId', true ] ); 47 47 48 48 return false; 49 49 }; 50 50 51 var readAttribute = function( page, attribute, input)51 var readAttribute = function( object, page, attribute, input, setIfNull ) 52 52 { 53 var attributeValue = this.editObj.getAttribute( attribute ); 54 this.setValueOf( page, input, attributeValue ); 55 53 var attributeValue = object.getAttribute( attribute ); 54 if ( attributeValue == null ) 55 if ( setIfNull ) 56 this.setValueOf( page, input, "" ); 57 else 58 this.setValueOf( page, input, attributeValue ); 56 59 return attributeValue; 57 60 } … … 62 65 minWidth : 400, 63 66 minHeight : 270, 64 onOk : function( data)67 onOk : function() 65 68 { 66 69 this.editObj.setAttributes( this.changedAttibutes ); … … 68 71 if ( this.editMode == false ) 69 72 { 70 // It doesn't work with IE.71 73 this.restoreSelection(); 72 74 this.clearSavedSelection(); … … 79 81 // Default: create a new element. 80 82 this.editMode = false; 83 this.changedAttibutes = new Array(); 81 84 82 85 // IE BUG: Selection must be in the editor for getSelection() to work. … … 96 99 if ( element ) 97 100 { 98 load Link.apply( this, [ editor, selection, ranges, element ] );101 loadSelection.apply( this, [ editor, selection, ranges, element ] ); 99 102 selection.selectElement( element ); 100 103 } … … 105 108 106 109 this.getContentElement( 'info', 'txtName' ).focus(); 107 this.changedAttibutes = new Array();108 110 }, 109 111 contents : [ -
CKEditor/branches/prototype/_source/plugins/forms/dialogs/hiddenfield.js
r2832 r2919 32 32 33 33 // Function called in onShow to load selected element. 34 var load Link= function( editor, selection, ranges, element )34 var loadSelection = function( editor, selection, ranges, element ) 35 35 { 36 36 this.saveSelection(); … … 39 39 40 40 // Fill out all fields. 41 readAttribute.apply( this, [ 'info', 'name', 'txtName' ] ); 42 readAttribute.apply( this, [ 'info', 'value', 'txtValue' ] ); 41 var name = element.getAttribute( 'name' ); 42 var value = element.getAttribute( 'value' ); 43 44 this.setValueOf( 'info', 'txtName', name ); 45 this.setValueOf( 'info', 'txtValue', value ); 43 46 44 47 return false; 45 48 }; 46 47 var readAttribute = function( page, attribute, input )48 {49 var attributeValue = this.editObj.getAttribute( attribute );50 this.setValueOf( page, input, attributeValue );51 52 return attributeValue;53 }54 55 49 return { 56 50 title : editor.lang.hidden.title, … … 58 52 minWidth : 400, 59 53 minHeight : 200, 60 onOk : function()61 {62 this.changedAttibutes[ 'type' ] = 'hidden';63 64 this.editObj.setAttributes( this.changedAttibutes );65 66 if ( this.editMode == false )67 {68 // It doesn't work with IE.69 this.restoreSelection();70 this.clearSavedSelection();71 editor.insertElement( this.editObj );72 }73 return true;74 },75 54 onShow : function() 76 55 { 77 56 // Default: create a new element. 78 57 this.editMode = false; 79 58 this.changedAttibutes = new Array(); 59 80 60 // IE BUG: Selection must be in the editor for getSelection() to work. 81 61 this.restoreSelection(); … … 94 74 if ( element && element.getAttribute( 'type' ) == "hidden" ) 95 75 { 96 load Link.apply( this, [ editor, selection, ranges, element ] );76 loadSelection.apply( this, [ editor, selection, ranges, element ] ); 97 77 selection.selectElement( element ); 98 78 } … … 103 83 104 84 this.getContentElement( 'info', 'txtName' ).focus(); 105 this.changedAttibutes = new Array(); 85 }, 86 onOk : function() 87 { 88 this.changedAttibutes[ 'type' ] = 'hidden'; 89 this.editObj.setAttributes( this.changedAttibutes ); 90 91 if ( this.editMode == false ) 92 { 93 this.restoreSelection(); 94 this.clearSavedSelection(); 95 editor.insertElement( this.editObj ); 96 } 97 return true; 106 98 }, 107 99 contents : [ -
CKEditor/branches/prototype/_source/plugins/forms/dialogs/radio.js
r2834 r2919 32 32 33 33 // Function called in onShow to load selected element. 34 var load Link= function( editor, selection, ranges, element )34 var loadSelection = function( editor, selection, ranges, element ) 35 35 { 36 36 this.saveSelection(); … … 38 38 this.editMode = true; 39 39 40 // Read attributes. 41 var checked = element.getAttribute( 'checked' ); 42 var name = element.getAttribute( 'name' ); 43 var value = element.getAttribute( 'value' ); 44 40 45 // Fill out all fields. 41 readAttribute.apply( this, [ 'info', 'name', 'txtName' ]);42 readAttribute.apply( this, [ 'info', 'value', 'txtValue' ]);43 readAttribute.apply( this, [ 'info', 'checked', 'cmbSelected' ]);46 this.setValueOf( 'info', 'txtName', name ); 47 this.setValueOf( 'info', 'txtValue', value ); 48 this.setValueOf( 'info', 'cmbSelected', checked ); 44 49 45 50 return false; 46 51 }; 47 48 var readAttribute = function( page, attribute, input )49 {50 var attributeValue = this.editObj.getAttribute( attribute );51 this.setValueOf( page, input, attributeValue );52 53 return attributeValue;54 }55 56 52 return { 57 53 title : editor.lang.checkboxAndRadio.radioTitle, … … 59 55 minWidth : 400, 60 56 minHeight : 200, 61 onOk : function()62 {63 this.changedAttibutes[ 'type' ] = 'radio';64 65 this.editObj.setAttributes( this.changedAttibutes );66 67 if ( this.editMode == false )68 {69 // It doesn't work with IE.70 this.restoreSelection();71 this.clearSavedSelection();72 editor.insertElement( this.editObj );73 }74 return true;75 },76 57 onShow : function() 77 58 { 78 59 // Default: create a new element. 79 60 this.editMode = false; 80 61 this.changedAttibutes = new Array(); 62 81 63 // IE BUG: Selection must be in the editor for getSelection() to work. 82 64 this.restoreSelection(); … … 95 77 if ( element && element.getAttribute( 'type' ) == "radio" ) 96 78 { 97 load Link.apply( this, [ editor, selection, ranges, element ] );79 loadSelection.apply( this, [ editor, selection, ranges, element ] ); 98 80 selection.selectElement( element ); 99 81 } … … 104 86 105 87 this.getContentElement( 'info', 'txtName' ).focus(); 106 this.changedAttibutes = new Array(); 88 }, 89 onOk : function() 90 { 91 this.changedAttibutes[ 'type' ] = 'radio'; 92 93 this.editObj.setAttributes( this.changedAttibutes ); 94 95 if ( this.editMode == false ) 96 { 97 // It doesn't work with IE. 98 this.restoreSelection(); 99 this.clearSavedSelection(); 100 editor.insertElement( this.editObj ); 101 } 102 return true; 107 103 }, 108 104 contents : [ -
CKEditor/branches/prototype/_source/plugins/forms/dialogs/select.js
r2875 r2919 21 21 CKEDITOR.dialog.add( 'select', function( editor ) 22 22 { 23 var plugin = CKEDITOR.plugins.forms.select; 23 24 var addChange = function( name, input ){ 24 25 var dialog = input.getDialog(); … … 34 35 var names = dialog.getContentElement( 'info', 'cmbName' ); 35 36 var values = dialog.getContentElement( 'info', 'cmbValue' ); 36 var namesOptions = CKEDITOR.plugins.forms.select.getOptions( names );37 var valuesOptions = CKEDITOR.plugins.forms.select.getOptions( values );37 var namesOptions = plugin.getOptions( names ); 38 var valuesOptions = plugin.getOptions( values ); 38 39 39 40 // Reset dialog. 40 for ( var i = namesOptions.length-1 ; i >= 0 ; i-- )41 for ( var i = namesOptions.length-1 ; i >= 0 ; i-- ) 41 42 { 42 43 namesOptions[i].parentNode.removeChild( namesOptions[i] ); … … 48 49 49 50 // Function called in onShow to load selected element. 50 var load Elements= function( editor, selection, ranges, element )51 var loadSelection = function( editor, selection, ranges, element ) 51 52 { 52 53 var dialog = this; … … 66 67 dialog.getContentElement( 'info', 'chkMulti' ).setValue( dialog.editObj.getAttribute( "multiple" ) ); 67 68 68 var objOptions = CKEDITOR.plugins.forms.select.getOptions( dialog.editObj );69 var objOptions = plugin.getOptions( dialog.editObj ); 69 70 70 71 //Load Options into dialog. … … 75 76 if ( objOptions[i].getAttribute( 'selected' ) == 'selected' ) 76 77 dialog.getContentElement( 'info', 'txtValue' ).setValue( objOptions[i].value ); 77 var oTOption = CKEDITOR.plugins.forms.select.addOption( names, oText, oText, editor.document );78 var oVOption = CKEDITOR.plugins.forms.select.addOption( values, oValue, oValue, editor.document );78 var oTOption = plugin.addOption( names, oText, oText, editor.document ); 79 var oVOption = plugin.addOption( values, oValue, oValue, editor.document ); 79 80 } 80 81 } … … 84 85 resizable : CKEDITOR.DIALOG_RESIZE_NONE, 85 86 minWidth : 400, 86 minHeight : 3 50,87 minHeight : 370, 87 88 onShow : function() 88 89 { 89 90 this.editMode = false; 91 this.changedAttibutes = new Array(); 90 92 91 93 // IE BUG: Selection must be in the editor for getSelection() to work. … … 104 106 if ( element ) 105 107 { 106 load Elements.apply( this, [ editor, selection, ranges, element ] );108 loadSelection.apply( this, [ editor, selection, ranges, element ] ); 107 109 selection.selectElement( element ); 108 110 this.saveSelection(); … … 118 120 this.pushDefault(); 119 121 this.getContentElement( 'info', 'txtName' ).focus(); 120 this.changedAttibutes = new Array();121 122 }, 122 123 onOk : function() 123 124 { 124 var objOptions = CKEDITOR.plugins.forms.select.getOptions( this.editObj );125 var objOptions = plugin.getOptions( this.editObj ); 125 126 126 127 // Remove all options. … … 130 131 131 132 var selectValue = this.getContentElement( 'info', 'txtValue' ).getValue(); 132 var optionsNames = CKEDITOR.plugins.forms.select.getOptions( this.getContentElement( 'info', 'cmbName' ) );133 var optionsValues = CKEDITOR.plugins.forms.select.getOptions( this.getContentElement( 'info', 'cmbValue' ) );133 var optionsNames = plugin.getOptions( this.getContentElement( 'info', 'cmbName' ) ); 134 var optionsValues = plugin.getOptions( this.getContentElement( 'info', 'cmbValue' ) ); 134 135 135 136 //Set added/changed attributes … … 145 146 if ( sValue.length == 0 ) sValue = sText; 146 147 147 var oOption = CKEDITOR.plugins.forms.select.addOption( this.editObj, sText, sValue, parentEditor.document );148 var oOption = plugin.addOption( this.editObj, sText, sValue, parentEditor.document ); 148 149 if ( sValue == selectValue ) 149 150 { … … 191 192 style : 'width:350px', 192 193 'default' : '', 193 accessKey : 'V',194 readonly : true, //TODO: make it readonly 194 195 disabled : true 195 196 }, … … 226 227 { 227 228 type : 'html', 228 align : 'center',229 229 html : '<span>' + CKEDITOR.tools.htmlEncode( editor.lang.select.lines ) + '</span>' 230 230 } … … 233 233 { 234 234 type : 'html', 235 align : 'center',236 235 html : '<span>' + CKEDITOR.tools.htmlEncode( editor.lang.select.opAvail ) + '</span>' 237 236 }, 238 237 { 239 238 type : 'hbox', 240 widths : [ '35%', '35%', '15%', '15%' ], 239 widths : [ '35%', '35%' ,'30%' ], 240 padding : 2, 241 align : 'top', 241 242 children : 242 243 [ 243 244 { 244 id : 'txtOptName', 245 type : 'text', 246 label : editor.lang.select.opText, 247 style : 'width:105px' 245 type : 'vbox', 246 padding : 0, 247 children : 248 [ 249 { 250 id : 'txtOptName', 251 type : 'text', 252 label : editor.lang.select.opText, 253 style : 'width:100%;margin-bottom:10px' 254 }, 255 256 { 257 type : 'select', 258 id : 'cmbName', 259 label : '', 260 title : '', 261 multiple : true, 262 size : 5, 263 style : 'width:100%;margin-bottom:5px', 264 items : [], 265 onChange : function() 266 { 267 var dialog = this.getDialog(); 268 var names = dialog.getContentElement( 'info', 'cmbName' ); 269 var values = dialog.getContentElement( 'info', 'cmbValue' ); 270 271 var name = dialog.getContentElement( 'info', 'txtOptName' ); 272 var value = dialog.getContentElement( 'info', 'txtOptValue' ); 273 274 var iIndex = plugin.getSelectedIndex( names ); 275 plugin.setSelectedIndex( values, iIndex ); 276 277 name.setValue( names.getValue() ); 278 value.setValue( values.getValue() ); 279 } 280 } 281 ] 248 282 }, 249 283 { 250 id : 'txtOptValue', 251 type : 'text', 252 label : editor.lang.select.opValue, 253 style : 'width:105px' 254 }, 255 { 256 type : 'button', 257 style : '', 258 label : editor.lang.select.btnAdd, 259 title : editor.lang.select.btnAdd, 260 onClick : function() 261 { 262 //Add new option. 263 var dialog = this.getDialog(); 264 var parentEditor = dialog.getParentEditor(); 265 var name = dialog.getContentElement( 'info', 'txtOptName' ); 266 var value = dialog.getContentElement( 'info', 'txtOptValue' ); 267 268 var names = dialog.getContentElement( 'info', 'cmbName' ); 269 var values = dialog.getContentElement( 'info', 'cmbValue' ); 270 271 CKEDITOR.plugins.forms.select.addOption(names, name.getValue(), name.getValue(), parentEditor.document ); 272 CKEDITOR.plugins.forms.select.addOption(values, value.getValue(), value.getValue(), parentEditor.document ); 273 274 name.setValue( "" ); 275 value.setValue( "" ); 276 } 277 }, 278 { 279 type : 'button', 280 label : editor.lang.select.btnModify, 281 title : editor.lang.select.btnModify, 282 onClick : function() 283 { 284 //Modify selected option. 285 var dialog = this.getDialog(); 286 var name = dialog.getContentElement( 'info', 'txtOptName' ); 287 var value = dialog.getContentElement( 'info', 'txtOptValue' ); 288 289 var names = dialog.getContentElement( 'info', 'cmbName' ); 290 var values = dialog.getContentElement( 'info', 'cmbValue' ); 291 292 var iIndex = CKEDITOR.plugins.forms.select.getSelectedIndex( names ); 293 if ( iIndex >= 0 ) 294 { 295 CKEDITOR.plugins.forms.select.modifyOption( names, iIndex, name.getValue(), name.getValue() ); 296 CKEDITOR.plugins.forms.select.modifyOption( values, iIndex, value.getValue(), value.getValue() ); 297 } 298 } 299 } 300 ] 301 }, 302 { 303 type : 'hbox', 304 widths : [ '35%','35%','30%'], 305 children : 306 [ 307 { 308 type : 'select', 309 id : 'cmbName', 310 label : '', 311 title : '', 312 multiple : true, 313 size : 5, 314 style : 'width:105px', 315 items : [], 316 onChange : function() 317 { 318 var dialog = this.getDialog(); 319 var names = dialog.getContentElement( 'info', 'cmbName' ); 320 var values = dialog.getContentElement( 'info', 'cmbValue' ); 321 322 var name = dialog.getContentElement( 'info', 'txtOptName' ); 323 var value = dialog.getContentElement( 'info', 'txtOptValue' ); 324 325 var iIndex = CKEDITOR.plugins.forms.select.getSelectedIndex( names ); 326 CKEDITOR.plugins.forms.select.setSelectedIndex( values, iIndex ); 327 328 name.setValue( names.getValue() ); 329 value.setValue( values.getValue() ); 330 } 331 }, 332 { 333 type : 'select', 334 id : 'cmbValue', 335 label : '', 336 title : '', 337 multiple : true, 338 size : 5, 339 style : 'width:105px', 340 items : [], 341 onChange : function() 342 { 343 var dialog = this.getDialog(); 344 var names = dialog.getContentElement( 'info', 'cmbName' ); 345 var values = dialog.getContentElement( 'info', 'cmbValue' ); 346 347 var name = dialog.getContentElement( 'info', 'txtOptName' ); 348 var value = dialog.getContentElement( 'info', 'txtOptValue' ); 349 350 var iIndex = CKEDITOR.plugins.forms.select.getSelectedIndex( values ); 351 CKEDITOR.plugins.forms.select.setSelectedIndex( names, iIndex ); 352 353 name.setValue( names.getValue() ); 354 value.setValue( values.getValue() ); 355 } 284 type : 'vbox', 285 padding : 0, 286 children : 287 [ 288 { 289 id : 'txtOptValue', 290 type : 'text', 291 label : editor.lang.select.opValue, 292 style : 'width:100%;margin-bottom:10px;' 293 }, 294 { 295 type : 'select', 296 id : 'cmbValue', 297 label : '', 298 multiple : true, 299 size : 5, 300 style : 'width:100%;margin-bottom:5px', 301 items : [], 302 onChange : function() 303 { 304 var dialog = this.getDialog(); 305 var names = dialog.getContentElement( 'info', 'cmbName' ); 306 var values = dialog.getContentElement( 'info', 'cmbValue' ); 307 308 var name = dialog.getContentElement( 'info', 'txtOptName' ); 309 var value = dialog.getContentElement( 'info', 'txtOptValue' ); 310 311 var iIndex = plugin.getSelectedIndex( values ); 312 plugin.setSelectedIndex( names, iIndex ); 313 314 name.setValue( names.getValue() ); 315 value.setValue( values.getValue() ); 316 } 317 }, 318 ] 356 319 }, 357 320 { … … 359 322 children : 360 323 [ 324 { 325 type : 'button', 326 style : '', 327 label : editor.lang.select.btnAdd, 328 title : editor.lang.select.btnAdd, 329 style : 'width:100%;', 330 onClick : function() 331 { 332 //Add new option. 333 var dialog = this.getDialog(); 334 var parentEditor = dialog.getParentEditor(); 335 var name = dialog.getContentElement( 'info', 'txtOptName' ); 336 var value = dialog.getContentElement( 'info', 'txtOptValue' ); 337 338 var names = dialog.getContentElement( 'info', 'cmbName' ); 339 var values = dialog.getContentElement( 'info', 'cmbValue' ); 340 341 plugin.addOption(names, name.getValue(), name.getValue() ); 342 plugin.addOption(values, value.getValue(), value.getValue() ); 343 344 name.setValue( "" ); 345 value.setValue( "" ); 346 } 347 }, 348 { 349 type : 'button', 350 label : editor.lang.select.btnModify, 351 title : editor.lang.select.btnModify, 352 style : 'width:100%;', 353 onClick : function() 354 { 355 //Modify selected option. 356 var dialog = this.getDialog(); 357 var name = dialog.getContentElement( 'info', 'txtOptName' ); 358 var value = dialog.getContentElement( 'info', 'txtOptValue' ); 359 360 var names = dialog.getContentElement( 'info', 'cmbName' ); 361 var values = dialog.getContentElement( 'info', 'cmbValue' ); 362 363 var iIndex = plugin.getSelectedIndex( names ); 364 if ( iIndex >= 0 ) 365 { 366 plugin.modifyOption( names, iIndex, name.getValue(), name.getValue() ); 367 plugin.modifyOption( values, iIndex, value.getValue(), value.getValue() ); 368 } 369 } 370 }, 361 371 { 362 372 type : 'button', … … 371 381 var values = dialog.getContentElement( 'info', 'cmbValue' ); 372 382 373 CKEDITOR.plugins.forms.select.changeOptionPosition( names, -1 );374 CKEDITOR.plugins.forms.select.changeOptionPosition( values, -1 );383 plugin.changeOptionPosition( names, -1 ); 384 plugin.changeOptionPosition( values, -1 ); 375 385 } 376 386 }, … … 387 397 var values = dialog.getContentElement( 'info', 'cmbValue' ); 388 398 389 CKEDITOR.plugins.forms.select.changeOptionPosition( names, 1 );390 CKEDITOR.plugins.forms.select.changeOptionPosition( values, 1 );399 plugin.changeOptionPosition( names, 1 ); 400 plugin.changeOptionPosition( values, 1 ); 391 401 } 392 402 } … … 424 434 var values = dialog.getContentElement( 'info', 'cmbValue' ); 425 435 426 CKEDITOR.plugins.forms.select.removeSelectedOptions( names );427 CKEDITOR.plugins.forms.select.removeSelectedOptions( values );436 plugin.removeSelectedOptions( names ); 437 plugin.removeSelectedOptions( values ); 428 438 429 439 var name = dialog.getContentElement( 'info', 'txtOptName' ); -
CKEditor/branches/prototype/_source/plugins/forms/dialogs/textarea.js
r2876 r2919 32 32 33 33 // Function called in onShow to load selected element. 34 var load Link= function( editor, selection, ranges, element )34 var loadSelection = function( editor, selection, ranges, element ) 35 35 { 36 36 this.saveSelection(); … … 59 59 minWidth : 400, 60 60 minHeight : 230, 61 onOk : function( data )62 {63 this.editObj.setAttributes( this.changedAttibutes );64 65 if ( this.editMode == false )66 {67 // It doesn't work with IE.68 this.restoreSelection();69 this.clearSavedSelection();70 editor.insertElement( this.editObj );71 }72 return true;73 },74 61 onShow : function() 75 62 { … … 93 80 if ( element ) 94 81 { 95 load Link.apply( this, [ editor, selection, ranges, element ] );82 loadSelection.apply( this, [ editor, selection, ranges, element ] ); 96 83 selection.selectElement( element ); 97 84 } … … 103 90 this.getContentElement( 'info', 'txtName' ).focus(); 104 91 this.changedAttibutes = new Array(); 92 }, 93 onOk : function() 94 { 95 this.editObj.setAttributes( this.changedAttibutes ); 96 97 if ( this.editMode == false ) 98 { 99 this.restoreSelection(); 100 this.clearSavedSelection(); 101 editor.insertElement( this.editObj ); 102 } 103 return true; 105 104 }, 106 105 contents : [ -
CKEditor/branches/prototype/_source/plugins/forms/dialogs/textfield.js
r2875 r2919 32 32 33 33 // Function called in onShow to load selected element. 34 var load Link= function( editor, selection, ranges, element )34 var loadSelection = function( editor, selection, ranges, element ) 35 35 { 36 36 this.saveSelection(); … … 55 55 return attributeValue; 56 56 } 57 58 57 return { 59 58 title : editor.lang.textfield.title, … … 61 60 minWidth : 400, 62 61 minHeight : 230, 63 onOk : function() 64 { 65 this.editObj.setAttributes( this.changedAttibutes ); 66 67 if ( this.editMode == false ) 68 { 69 // It doesn't work with IE. 70 this.restoreSelection(); 71 this.clearSavedSelection(); 72 editor.insertElement( this.editObj ); 73 } 74 return true; 75 }, 62 76 63 onShow : function() 77 64 { … … 98 85 if ( type == "text" || type == null ) 99 86 { 100 load Link.apply( this, [ editor, selection, ranges, element ] );87 loadSelection.apply( this, [ editor, selection, ranges, element ] ); 101 88 selection.selectElement( element ); 102 89 } … … 109 96 this.getContentElement( 'info', 'txtName' ).focus(); 110 97 this.changedAttibutes = new Array(); 98 }, 99 onOk : function() 100 { 101 this.editObj.setAttributes( this.changedAttibutes ); 102 103 if ( this.editMode == false ) 104 { 105 this.restoreSelection(); 106 this.clearSavedSelection(); 107 editor.insertElement( this.editObj ); 108 } 109 return true; 111 110 }, 112 111 contents : [ -
CKEditor/branches/prototype/_source/plugins/forms/plugin.js
r2838 r2919 115 115 oOption = document.createElement( "OPTION" ); 116 116 117 oOption = this._getObject( oOption, false ); 118 117 119 if ( combo.$ && oOption.$ && oOption.$.tagName ) 118 120 { … … 120 122 oOption.setText( optionText.length > 0 ? CKEDITOR.tools.htmlEncode( optionText ) : '' ); 121 123 oOption.setValue( optionValue ); 122 oOptionObj = oOption;123 }124 else if ( combo )125 {126 if ( combo.$ ) //TODO: improve this case127 combo = combo.$;128 129 if ( oOption.$ && oOption.$.tagName )130 oOptionObj = oOption.$;131 else132 oOptionObj = oOption;133 134 if ( !isNaN( parseInt( index, 10 ) ) )135 combo.options.add( oOptionObj, index );136 else137 combo.options.add( oOptionObj );138 139 oOptionObj.innerHTML = optionText.length > 0 ? CKEDITOR.tools.htmlEncode( optionText ) : '';140 oOptionObj.value = optionValue;141 124 } 142 125 else 143 126 return false; 144 127 145 return oOption Obj;128 return oOption; 146 129 }, 147 130 … … 231 214 { 232 215 if ( obj ){ 233 if ( obj.tagName && obj.tagName.toLowerCase() == 'select' ) 234 return obj; 216 // Dialog element. 217 if ( obj.domId && obj.getInputElement().$ ) 218 if ( getReal ) 219 return obj.getInputElement().$; 220 else 221 return obj.getInputElement(); 222 else if ( obj.tagName && ( obj.tagName.toLowerCase() == 'select' || obj.tagName.toLowerCase() == 'option' ) ) 223 if ( getReal ) 224 return obj; 225 else 226 return new CKEDITOR.dom.element( obj ); 235 227 else if ( obj.$ ) 236 228 if ( getReal ) … … 238 230 else 239 231 return obj; 240 else if ( obj.domId && obj.getInputElement().$ )241 if ( getReal )242 return obj.getInputElement().$;243 else244 return obj.getInputElement();245 232 return false; 246 233 }
Note: See TracChangeset
for help on using the changeset viewer.
