summaryrefslogtreecommitdiff
path: root/plugins/flash
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2013-07-15 14:18:47 +0100
committerlsces <lester@lsces.co.uk>2013-07-15 14:18:47 +0100
commitde6d09676a9527919813a4474cc28af554a35fe1 (patch)
treea2b3c2ddf01eca1600e130125733d324b59744bb /plugins/flash
parent1d0d1733baef4dbab3f8cd7d7150a55ef2828464 (diff)
downloadckeditor-de6d09676a9527919813a4474cc28af554a35fe1.tar.gz
ckeditor-de6d09676a9527919813a4474cc28af554a35fe1.tar.bz2
ckeditor-de6d09676a9527919813a4474cc28af554a35fe1.zip
Upgrade to CKEditor V4
Directory structure changed so many files removed and replace in a new location This batch is the actuall file changes
Diffstat (limited to 'plugins/flash')
-rw-r--r--plugins/flash/dialogs/flash.js675
1 files changed, 667 insertions, 8 deletions
diff --git a/plugins/flash/dialogs/flash.js b/plugins/flash/dialogs/flash.js
index 475ede3..e0e60e8 100644
--- a/plugins/flash/dialogs/flash.js
+++ b/plugins/flash/dialogs/flash.js
@@ -1,9 +1,668 @@
-/*
-Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
+/**
+ * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.html or http://ckeditor.com/license
+ */
-(function(){var a=1,b=2,c=4,d={id:[{type:a,name:'id'}],classid:[{type:a,name:'classid'}],codebase:[{type:a,name:'codebase'}],pluginspage:[{type:c,name:'pluginspage'}],src:[{type:b,name:'movie'},{type:c,name:'src'},{type:a,name:'data'}],name:[{type:c,name:'name'}],align:[{type:a,name:'align'}],title:[{type:a,name:'title'},{type:c,name:'title'}],'class':[{type:a,name:'class'},{type:c,name:'class'}],width:[{type:a,name:'width'},{type:c,name:'width'}],height:[{type:a,name:'height'},{type:c,name:'height'}],hSpace:[{type:a,name:'hSpace'},{type:c,name:'hSpace'}],vSpace:[{type:a,name:'vSpace'},{type:c,name:'vSpace'}],style:[{type:a,name:'style'},{type:c,name:'style'}],type:[{type:c,name:'type'}]},e=['play','loop','menu','quality','scale','salign','wmode','bgcolor','base','flashvars','allowScriptAccess','allowFullScreen'];for(var f=0;f<e.length;f++)d[e[f]]=[{type:c,name:e[f]},{type:b,name:e[f]}];e=['allowFullScreen','play','loop','menu'];for(f=0;f<e.length;f++)d[e[f]][0]['default']=d[e[f]][1]['default']=true;var g=CKEDITOR.tools.cssLength;function h(j,k,l){var r=this;var m=d[r.id];if(!m)return;var n=r instanceof CKEDITOR.ui.dialog.checkbox;for(var o=0;o<m.length;o++){var p=m[o];switch(p.type){case a:if(!j)continue;if(j.getAttribute(p.name)!==null){var q=j.getAttribute(p.name);if(n)r.setValue(q.toLowerCase()=='true');else r.setValue(q);return;}else if(n)r.setValue(!!p['default']);break;case b:if(!j)continue;if(p.name in l){q=l[p.name];if(n)r.setValue(q.toLowerCase()=='true');else r.setValue(q);return;}else if(n)r.setValue(!!p['default']);break;case c:if(!k)continue;if(k.getAttribute(p.name)){q=k.getAttribute(p.name);if(n)r.setValue(q.toLowerCase()=='true');else r.setValue(q);return;}else if(n)r.setValue(!!p['default']);}}};function i(j,k,l){var t=this;var m=d[t.id];if(!m)return;var n=t.getValue()==='',o=t instanceof CKEDITOR.ui.dialog.checkbox;for(var p=0;p<m.length;p++){var q=m[p];switch(q.type){case a:if(!j||q.name=='data'&&k&&!j.hasAttribute('data'))continue;var r=t.getValue();if(n||o&&r===q['default'])j.removeAttribute(q.name);else j.setAttribute(q.name,r);break;case b:if(!j)continue;r=t.getValue();if(n||o&&r===q['default']){if(q.name in l)l[q.name].remove();}else if(q.name in l)l[q.name].setAttribute('value',r);else{var s=CKEDITOR.dom.element.createFromHtml('<cke:param></cke:param>',j.getDocument());s.setAttributes({name:q.name,value:r});if(j.getChildCount()<1)s.appendTo(j);else s.insertBefore(j.getFirst());}break;case c:if(!k)continue;r=t.getValue();if(n||o&&r===q['default'])k.removeAttribute(q.name);
-else k.setAttribute(q.name,r);}}};CKEDITOR.dialog.add('flash',function(j){var k=!j.config.flashEmbedTagOnly,l=j.config.flashAddEmbedTag||j.config.flashEmbedTagOnly,m,n='<div>'+CKEDITOR.tools.htmlEncode(j.lang.common.preview)+'<br>'+'<div id="cke_FlashPreviewLoader'+CKEDITOR.tools.getNextNumber()+'" style="display:none"><div class="loading">&nbsp;</div></div>'+'<div id="cke_FlashPreviewBox'+CKEDITOR.tools.getNextNumber()+'" class="FlashPreviewBox"></div></div>';return{title:j.lang.flash.title,minWidth:420,minHeight:310,onShow:function(){var A=this;A.fakeImage=A.objectNode=A.embedNode=null;m=new CKEDITOR.dom.element('embed',j.document);var o=A.getSelectedElement();if(o&&o.data('cke-real-element-type')&&o.data('cke-real-element-type')=='flash'){A.fakeImage=o;var p=j.restoreRealElement(o),q=null,r=null,s={};if(p.getName()=='cke:object'){q=p;var t=q.getElementsByTag('embed','cke');if(t.count()>0)r=t.getItem(0);var u=q.getElementsByTag('param','cke');for(var v=0,w=u.count();v<w;v++){var x=u.getItem(v),y=x.getAttribute('name'),z=x.getAttribute('value');s[y]=z;}}else if(p.getName()=='cke:embed')r=p;A.objectNode=q;A.embedNode=r;A.setupContent(q,r,s,o);}},onOk:function(){var y=this;var o=null,p=null,q=null;if(!y.fakeImage){if(k){o=CKEDITOR.dom.element.createFromHtml('<cke:object></cke:object>',j.document);var r={classid:'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',codebase:'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'};o.setAttributes(r);}if(l){p=CKEDITOR.dom.element.createFromHtml('<cke:embed></cke:embed>',j.document);p.setAttributes({type:'application/x-shockwave-flash',pluginspage:'http://www.macromedia.com/go/getflashplayer'});if(o)p.appendTo(o);}}else{o=y.objectNode;p=y.embedNode;}if(o){q={};var s=o.getElementsByTag('param','cke');for(var t=0,u=s.count();t<u;t++)q[s.getItem(t).getAttribute('name')]=s.getItem(t);}var v={},w={};y.commitContent(o,p,q,v,w);var x=j.createFakeElement(o||p,'cke_flash','flash',true);x.setAttributes(w);x.setStyles(v);if(y.fakeImage){x.replace(y.fakeImage);j.getSelection().selectElement(x);}else j.insertElement(x);},onHide:function(){if(this.preview)this.preview.setHtml('');},contents:[{id:'info',label:j.lang.common.generalTab,accessKey:'I',elements:[{type:'vbox',padding:0,children:[{type:'hbox',widths:['280px','110px'],align:'right',children:[{id:'src',type:'text',label:j.lang.common.url,required:true,validate:CKEDITOR.dialog.validate.notEmpty(j.lang.flash.validateSrc),setup:h,commit:i,onLoad:function(){var o=this.getDialog(),p=function(q){m.setAttribute('src',q);
-o.preview.setHtml('<embed height="100%" width="100%" src="'+CKEDITOR.tools.htmlEncode(m.getAttribute('src'))+'" type="application/x-shockwave-flash"></embed>');};o.preview=o.getContentElement('info','preview').getElement().getChild(3);this.on('change',function(q){if(q.data&&q.data.value)p(q.data.value);});this.getInputElement().on('change',function(q){p(this.getValue());},this);}},{type:'button',id:'browse',filebrowser:'info:src',hidden:true,style:'display:inline-block;margin-top:10px;',label:j.lang.common.browseServer}]}]},{type:'hbox',widths:['25%','25%','25%','25%','25%'],children:[{type:'text',id:'width',style:'width:95px',label:j.lang.common.width,validate:CKEDITOR.dialog.validate.htmlLength(j.lang.common.invalidHtmlLength.replace('%1',j.lang.common.width)),setup:h,commit:i},{type:'text',id:'height',style:'width:95px',label:j.lang.common.height,validate:CKEDITOR.dialog.validate.htmlLength(j.lang.common.invalidHtmlLength.replace('%1',j.lang.common.height)),setup:h,commit:i},{type:'text',id:'hSpace',style:'width:95px',label:j.lang.flash.hSpace,validate:CKEDITOR.dialog.validate.integer(j.lang.flash.validateHSpace),setup:h,commit:i},{type:'text',id:'vSpace',style:'width:95px',label:j.lang.flash.vSpace,validate:CKEDITOR.dialog.validate.integer(j.lang.flash.validateVSpace),setup:h,commit:i}]},{type:'vbox',children:[{type:'html',id:'preview',style:'width:95%;',html:n}]}]},{id:'Upload',hidden:true,filebrowser:'uploadButton',label:j.lang.common.upload,elements:[{type:'file',id:'upload',label:j.lang.common.upload,size:38},{type:'fileButton',id:'uploadButton',label:j.lang.common.uploadSubmit,filebrowser:'info:src','for':['Upload','upload']}]},{id:'properties',label:j.lang.flash.propertiesTab,elements:[{type:'hbox',widths:['50%','50%'],children:[{id:'scale',type:'select',label:j.lang.flash.scale,'default':'',style:'width : 100%;',items:[[j.lang.common.notSet,''],[j.lang.flash.scaleAll,'showall'],[j.lang.flash.scaleNoBorder,'noborder'],[j.lang.flash.scaleFit,'exactfit']],setup:h,commit:i},{id:'allowScriptAccess',type:'select',label:j.lang.flash.access,'default':'',style:'width : 100%;',items:[[j.lang.common.notSet,''],[j.lang.flash.accessAlways,'always'],[j.lang.flash.accessSameDomain,'samedomain'],[j.lang.flash.accessNever,'never']],setup:h,commit:i}]},{type:'hbox',widths:['50%','50%'],children:[{id:'wmode',type:'select',label:j.lang.flash.windowMode,'default':'',style:'width : 100%;',items:[[j.lang.common.notSet,''],[j.lang.flash.windowModeWindow,'window'],[j.lang.flash.windowModeOpaque,'opaque'],[j.lang.flash.windowModeTransparent,'transparent']],setup:h,commit:i},{id:'quality',type:'select',label:j.lang.flash.quality,'default':'high',style:'width : 100%;',items:[[j.lang.common.notSet,''],[j.lang.flash.qualityBest,'best'],[j.lang.flash.qualityHigh,'high'],[j.lang.flash.qualityAutoHigh,'autohigh'],[j.lang.flash.qualityMedium,'medium'],[j.lang.flash.qualityAutoLow,'autolow'],[j.lang.flash.qualityLow,'low']],setup:h,commit:i}]},{type:'hbox',widths:['50%','50%'],children:[{id:'align',type:'select',label:j.lang.common.align,'default':'',style:'width : 100%;',items:[[j.lang.common.notSet,''],[j.lang.common.alignLeft,'left'],[j.lang.flash.alignAbsBottom,'absBottom'],[j.lang.flash.alignAbsMiddle,'absMiddle'],[j.lang.flash.alignBaseline,'baseline'],[j.lang.common.alignBottom,'bottom'],[j.lang.common.alignMiddle,'middle'],[j.lang.common.alignRight,'right'],[j.lang.flash.alignTextTop,'textTop'],[j.lang.common.alignTop,'top']],setup:h,commit:function(o,p,q,r,s){var t=this.getValue();
-i.apply(this,arguments);t&&(s.align=t);}},{type:'html',html:'<div></div>'}]},{type:'fieldset',label:CKEDITOR.tools.htmlEncode(j.lang.flash.flashvars),children:[{type:'vbox',padding:0,children:[{type:'checkbox',id:'menu',label:j.lang.flash.chkMenu,'default':true,setup:h,commit:i},{type:'checkbox',id:'play',label:j.lang.flash.chkPlay,'default':true,setup:h,commit:i},{type:'checkbox',id:'loop',label:j.lang.flash.chkLoop,'default':true,setup:h,commit:i},{type:'checkbox',id:'allowFullScreen',label:j.lang.flash.chkFull,'default':true,setup:h,commit:i}]}]}]},{id:'advanced',label:j.lang.common.advancedTab,elements:[{type:'hbox',widths:['45%','55%'],children:[{type:'text',id:'id',label:j.lang.common.id,setup:h,commit:i},{type:'text',id:'title',label:j.lang.common.advisoryTitle,setup:h,commit:i}]},{type:'hbox',widths:['45%','55%'],children:[{type:'text',id:'bgcolor',label:j.lang.flash.bgcolor,setup:h,commit:i},{type:'text',id:'class',label:j.lang.common.cssClass,setup:h,commit:i}]},{type:'text',id:'style',validate:CKEDITOR.dialog.validate.inlineStyle(j.lang.common.invalidInlineStyle),label:j.lang.common.cssStyle,setup:h,commit:i}]}]};});})();
+(function() {
+ // It is possible to set things in three different places.
+ // 1. As attributes in the object tag.
+ // 2. As param tags under the object tag.
+ // 3. As attributes in the embed tag.
+ // It is possible for a single attribute to be present in more than one place.
+ // So let's define a mapping between a sementic attribute and its syntactic
+ // equivalents.
+ // Then we'll set and retrieve attribute values according to the mapping,
+ // instead of having to check and set each syntactic attribute every time.
+ //
+ // Reference: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701
+ var ATTRTYPE_OBJECT = 1,
+ ATTRTYPE_PARAM = 2,
+ ATTRTYPE_EMBED = 4;
+
+ var attributesMap = {
+ id: [ {
+ type: ATTRTYPE_OBJECT, name: 'id'
+ }],
+ classid: [ {
+ type: ATTRTYPE_OBJECT, name: 'classid'
+ }],
+ codebase: [ {
+ type: ATTRTYPE_OBJECT, name: 'codebase'
+ }],
+ pluginspage: [ {
+ type: ATTRTYPE_EMBED, name: 'pluginspage'
+ }],
+ src: [ {
+ type: ATTRTYPE_PARAM, name: 'movie'
+ }, {
+ type: ATTRTYPE_EMBED, name: 'src'
+ }, {
+ type: ATTRTYPE_OBJECT, name: 'data'
+ }],
+ name: [ {
+ type: ATTRTYPE_EMBED, name: 'name'
+ }],
+ align: [ {
+ type: ATTRTYPE_OBJECT, name: 'align'
+ }],
+ 'class': [ {
+ type: ATTRTYPE_OBJECT, name: 'class'
+ }, {
+ type: ATTRTYPE_EMBED, name: 'class'
+ }],
+ width: [ {
+ type: ATTRTYPE_OBJECT, name: 'width'
+ }, {
+ type: ATTRTYPE_EMBED, name: 'width'
+ }],
+ height: [ {
+ type: ATTRTYPE_OBJECT, name: 'height'
+ }, {
+ type: ATTRTYPE_EMBED, name: 'height'
+ }],
+ hSpace: [ {
+ type: ATTRTYPE_OBJECT, name: 'hSpace'
+ }, {
+ type: ATTRTYPE_EMBED, name: 'hSpace'
+ }],
+ vSpace: [ {
+ type: ATTRTYPE_OBJECT, name: 'vSpace'
+ }, {
+ type: ATTRTYPE_EMBED, name: 'vSpace'
+ }],
+ style: [ {
+ type: ATTRTYPE_OBJECT, name: 'style'
+ }, {
+ type: ATTRTYPE_EMBED, name: 'style'
+ }],
+ type: [ {
+ type: ATTRTYPE_EMBED, name: 'type'
+ }]
+ };
+
+ var names = [ 'play', 'loop', 'menu', 'quality', 'scale', 'salign', 'wmode', 'bgcolor', 'base', 'flashvars', 'allowScriptAccess', 'allowFullScreen' ];
+ for ( var i = 0; i < names.length; i++ )
+ attributesMap[ names[ i ] ] = [ {
+ type: ATTRTYPE_EMBED, name: names[ i ]
+ }, {
+ type: ATTRTYPE_PARAM, name: names[ i ]
+ }];
+ names = [ 'allowFullScreen', 'play', 'loop', 'menu' ];
+ for ( i = 0; i < names.length; i++ )
+ attributesMap[ names[ i ] ][ 0 ][ 'default' ] = attributesMap[ names[ i ] ][ 1 ][ 'default' ] = true;
+
+ var defaultToPixel = CKEDITOR.tools.cssLength;
+
+ function loadValue( objectNode, embedNode, paramMap ) {
+ var attributes = attributesMap[ this.id ];
+ if ( !attributes )
+ return;
+
+ var isCheckbox = ( this instanceof CKEDITOR.ui.dialog.checkbox );
+ for ( var i = 0; i < attributes.length; i++ ) {
+ var attrDef = attributes[ i ];
+ switch ( attrDef.type ) {
+ case ATTRTYPE_OBJECT:
+ if ( !objectNode )
+ continue;
+ if ( objectNode.getAttribute( attrDef.name ) !== null ) {
+ var value = objectNode.getAttribute( attrDef.name );
+ if ( isCheckbox )
+ this.setValue( value.toLowerCase() == 'true' );
+ else
+ this.setValue( value );
+ return;
+ } else if ( isCheckbox )
+ this.setValue( !!attrDef[ 'default' ] );
+ break;
+ case ATTRTYPE_PARAM:
+ if ( !objectNode )
+ continue;
+ if ( attrDef.name in paramMap ) {
+ value = paramMap[ attrDef.name ];
+ if ( isCheckbox )
+ this.setValue( value.toLowerCase() == 'true' );
+ else
+ this.setValue( value );
+ return;
+ } else if ( isCheckbox )
+ this.setValue( !!attrDef[ 'default' ] );
+ break;
+ case ATTRTYPE_EMBED:
+ if ( !embedNode )
+ continue;
+ if ( embedNode.getAttribute( attrDef.name ) ) {
+ value = embedNode.getAttribute( attrDef.name );
+ if ( isCheckbox )
+ this.setValue( value.toLowerCase() == 'true' );
+ else
+ this.setValue( value );
+ return;
+ } else if ( isCheckbox )
+ this.setValue( !!attrDef[ 'default' ] );
+ }
+ }
+ }
+
+ function commitValue( objectNode, embedNode, paramMap ) {
+ var attributes = attributesMap[ this.id ];
+ if ( !attributes )
+ return;
+
+ var isRemove = ( this.getValue() === '' ),
+ isCheckbox = ( this instanceof CKEDITOR.ui.dialog.checkbox );
+
+ for ( var i = 0; i < attributes.length; i++ ) {
+ var attrDef = attributes[ i ];
+ switch ( attrDef.type ) {
+ case ATTRTYPE_OBJECT:
+ // Avoid applying the data attribute when not needed (#7733)
+ if ( !objectNode || ( attrDef.name == 'data' && embedNode && !objectNode.hasAttribute( 'data' ) ) )
+ continue;
+ var value = this.getValue();
+ if ( isRemove || isCheckbox && value === attrDef[ 'default' ] )
+ objectNode.removeAttribute( attrDef.name );
+ else
+ objectNode.setAttribute( attrDef.name, value );
+ break;
+ case ATTRTYPE_PARAM:
+ if ( !objectNode )
+ continue;
+ value = this.getValue();
+ if ( isRemove || isCheckbox && value === attrDef[ 'default' ] ) {
+ if ( attrDef.name in paramMap )
+ paramMap[ attrDef.name ].remove();
+ } else {
+ if ( attrDef.name in paramMap )
+ paramMap[ attrDef.name ].setAttribute( 'value', value );
+ else {
+ var param = CKEDITOR.dom.element.createFromHtml( '<cke:param></cke:param>', objectNode.getDocument() );
+ param.setAttributes({ name: attrDef.name, value: value } );
+ if ( objectNode.getChildCount() < 1 )
+ param.appendTo( objectNode );
+ else
+ param.insertBefore( objectNode.getFirst() );
+ }
+ }
+ break;
+ case ATTRTYPE_EMBED:
+ if ( !embedNode )
+ continue;
+ value = this.getValue();
+ if ( isRemove || isCheckbox && value === attrDef[ 'default' ] )
+ embedNode.removeAttribute( attrDef.name );
+ else
+ embedNode.setAttribute( attrDef.name, value );
+ }
+ }
+ }
+
+ CKEDITOR.dialog.add( 'flash', function( editor ) {
+ var makeObjectTag = !editor.config.flashEmbedTagOnly,
+ makeEmbedTag = editor.config.flashAddEmbedTag || editor.config.flashEmbedTagOnly;
+
+ var previewPreloader,
+ previewAreaHtml = '<div>' + CKEDITOR.tools.htmlEncode( editor.lang.common.preview ) + '<br>' +
+ '<div id="cke_FlashPreviewLoader' + CKEDITOR.tools.getNextNumber() + '" style="display:none"><div class="loading">&nbsp;</div></div>' +
+ '<div id="cke_FlashPreviewBox' + CKEDITOR.tools.getNextNumber() + '" class="FlashPreviewBox"></div></div>';
+
+ return {
+ title: editor.lang.flash.title,
+ minWidth: 420,
+ minHeight: 310,
+ onShow: function() {
+ // Clear previously saved elements.
+ this.fakeImage = this.objectNode = this.embedNode = null;
+ previewPreloader = new CKEDITOR.dom.element( 'embed', editor.document );
+
+ // Try to detect any embed or object tag that has Flash parameters.
+ var fakeImage = this.getSelectedElement();
+ if ( fakeImage && fakeImage.data( 'cke-real-element-type' ) && fakeImage.data( 'cke-real-element-type' ) == 'flash' ) {
+ this.fakeImage = fakeImage;
+
+ var realElement = editor.restoreRealElement( fakeImage ),
+ objectNode = null,
+ embedNode = null,
+ paramMap = {};
+ if ( realElement.getName() == 'cke:object' ) {
+ objectNode = realElement;
+ var embedList = objectNode.getElementsByTag( 'embed', 'cke' );
+ if ( embedList.count() > 0 )
+ embedNode = embedList.getItem( 0 );
+ var paramList = objectNode.getElementsByTag( 'param', 'cke' );
+ for ( var i = 0, length = paramList.count(); i < length; i++ ) {
+ var item = paramList.getItem( i ),
+ name = item.getAttribute( 'name' ),
+ value = item.getAttribute( 'value' );
+ paramMap[ name ] = value;
+ }
+ } else if ( realElement.getName() == 'cke:embed' )
+ embedNode = realElement;
+
+ this.objectNode = objectNode;
+ this.embedNode = embedNode;
+
+ this.setupContent( objectNode, embedNode, paramMap, fakeImage );
+ }
+ },
+ onOk: function() {
+ // If there's no selected object or embed, create one. Otherwise, reuse the
+ // selected object and embed nodes.
+ var objectNode = null,
+ embedNode = null,
+ paramMap = null;
+ if ( !this.fakeImage ) {
+ if ( makeObjectTag ) {
+ objectNode = CKEDITOR.dom.element.createFromHtml( '<cke:object></cke:object>', editor.document );
+ var attributes = {
+ classid: 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',
+ codebase: 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'
+ };
+ objectNode.setAttributes( attributes );
+ }
+ if ( makeEmbedTag ) {
+ embedNode = CKEDITOR.dom.element.createFromHtml( '<cke:embed></cke:embed>', editor.document );
+ embedNode.setAttributes({
+ type: 'application/x-shockwave-flash',
+ pluginspage: 'http://www.macromedia.com/go/getflashplayer'
+ });
+ if ( objectNode )
+ embedNode.appendTo( objectNode );
+ }
+ } else {
+ objectNode = this.objectNode;
+ embedNode = this.embedNode;
+ }
+
+ // Produce the paramMap if there's an object tag.
+ if ( objectNode ) {
+ paramMap = {};
+ var paramList = objectNode.getElementsByTag( 'param', 'cke' );
+ for ( var i = 0, length = paramList.count(); i < length; i++ )
+ paramMap[ paramList.getItem( i ).getAttribute( 'name' ) ] = paramList.getItem( i );
+ }
+
+ // A subset of the specified attributes/styles
+ // should also be applied on the fake element to
+ // have better visual effect. (#5240)
+ var extraStyles = {},
+ extraAttributes = {};
+ this.commitContent( objectNode, embedNode, paramMap, extraStyles, extraAttributes );
+
+ // Refresh the fake image.
+ var newFakeImage = editor.createFakeElement( objectNode || embedNode, 'cke_flash', 'flash', true );
+ newFakeImage.setAttributes( extraAttributes );
+ newFakeImage.setStyles( extraStyles );
+ if ( this.fakeImage ) {
+ newFakeImage.replace( this.fakeImage );
+ editor.getSelection().selectElement( newFakeImage );
+ } else
+ editor.insertElement( newFakeImage );
+ },
+
+ onHide: function() {
+ if ( this.preview )
+ this.preview.setHtml( '' );
+ },
+
+ contents: [
+ {
+ id: 'info',
+ label: editor.lang.common.generalTab,
+ accessKey: 'I',
+ elements: [
+ {
+ type: 'vbox',
+ padding: 0,
+ children: [
+ {
+ type: 'hbox',
+ widths: [ '280px', '110px' ],
+ align: 'right',
+ children: [
+ {
+ id: 'src',
+ type: 'text',
+ label: editor.lang.common.url,
+ required: true,
+ validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.flash.validateSrc ),
+ setup: loadValue,
+ commit: commitValue,
+ onLoad: function() {
+ var dialog = this.getDialog(),
+ updatePreview = function( src ) {
+ // Query the preloader to figure out the url impacted by based href.
+ previewPreloader.setAttribute( 'src', src );
+ dialog.preview.setHtml( '<embed height="100%" width="100%" src="' + CKEDITOR.tools.htmlEncode( previewPreloader.getAttribute( 'src' ) )
+ + '" type="application/x-shockwave-flash"></embed>' );
+ };
+ // Preview element
+ dialog.preview = dialog.getContentElement( 'info', 'preview' ).getElement().getChild( 3 );
+
+ // Sync on inital value loaded.
+ this.on( 'change', function( evt ) {
+
+ if ( evt.data && evt.data.value )
+ updatePreview( evt.data.value );
+ });
+ // Sync when input value changed.
+ this.getInputElement().on( 'change', function( evt ) {
+
+ updatePreview( this.getValue() );
+ }, this );
+ }
+ },
+ {
+ type: 'button',
+ id: 'browse',
+ filebrowser: 'info:src',
+ hidden: true,
+ // v-align with the 'src' field.
+ // TODO: We need something better than a fixed size here.
+ style: 'display:inline-block;margin-top:10px;',
+ label: editor.lang.common.browseServer
+ }
+ ]
+ }
+ ]
+ },
+ {
+ type: 'hbox',
+ widths: [ '25%', '25%', '25%', '25%', '25%' ],
+ children: [
+ {
+ type: 'text',
+ id: 'width',
+ requiredContent: 'embed[width]',
+ style: 'width:95px',
+ label: editor.lang.common.width,
+ validate: CKEDITOR.dialog.validate.htmlLength( editor.lang.common.invalidHtmlLength.replace( '%1', editor.lang.common.width ) ),
+ setup: loadValue,
+ commit: commitValue
+ },
+ {
+ type: 'text',
+ id: 'height',
+ requiredContent: 'embed[height]',
+ style: 'width:95px',
+ label: editor.lang.common.height,
+ validate: CKEDITOR.dialog.validate.htmlLength( editor.lang.common.invalidHtmlLength.replace( '%1', editor.lang.common.height ) ),
+ setup: loadValue,
+ commit: commitValue
+ },
+ {
+ type: 'text',
+ id: 'hSpace',
+ requiredContent: 'embed[hspace]',
+ style: 'width:95px',
+ label: editor.lang.flash.hSpace,
+ validate: CKEDITOR.dialog.validate.integer( editor.lang.flash.validateHSpace ),
+ setup: loadValue,
+ commit: commitValue
+ },
+ {
+ type: 'text',
+ id: 'vSpace',
+ requiredContent: 'embed[vspace]',
+ style: 'width:95px',
+ label: editor.lang.flash.vSpace,
+ validate: CKEDITOR.dialog.validate.integer( editor.lang.flash.validateVSpace ),
+ setup: loadValue,
+ commit: commitValue
+ }
+ ]
+ },
+
+ {
+ type: 'vbox',
+ children: [
+ {
+ type: 'html',
+ id: 'preview',
+ style: 'width:95%;',
+ html: previewAreaHtml
+ }
+ ]
+ }
+ ]
+ },
+ {
+ id: 'Upload',
+ hidden: true,
+ filebrowser: 'uploadButton',
+ label: editor.lang.common.upload,
+ elements: [
+ {
+ type: 'file',
+ id: 'upload',
+ label: editor.lang.common.upload,
+ size: 38
+ },
+ {
+ type: 'fileButton',
+ id: 'uploadButton',
+ label: editor.lang.common.uploadSubmit,
+ filebrowser: 'info:src',
+ 'for': [ 'Upload', 'upload' ]
+ }
+ ]
+ },
+ {
+ id: 'properties',
+ label: editor.lang.flash.propertiesTab,
+ elements: [
+ {
+ type: 'hbox',
+ widths: [ '50%', '50%' ],
+ children: [
+ {
+ id: 'scale',
+ type: 'select',
+ requiredContent: 'embed[scale]',
+ label: editor.lang.flash.scale,
+ 'default': '',
+ style: 'width : 100%;',
+ items: [
+ [ editor.lang.common.notSet, '' ],
+ [ editor.lang.flash.scaleAll, 'showall' ],
+ [ editor.lang.flash.scaleNoBorder, 'noborder' ],
+ [ editor.lang.flash.scaleFit, 'exactfit' ]
+ ],
+ setup: loadValue,
+ commit: commitValue
+ },
+ {
+ id: 'allowScriptAccess',
+ type: 'select',
+ requiredContent: 'embed[allowscriptaccess]',
+ label: editor.lang.flash.access,
+ 'default': '',
+ style: 'width : 100%;',
+ items: [
+ [ editor.lang.common.notSet, '' ],
+ [ editor.lang.flash.accessAlways, 'always' ],
+ [ editor.lang.flash.accessSameDomain, 'samedomain' ],
+ [ editor.lang.flash.accessNever, 'never' ]
+ ],
+ setup: loadValue,
+ commit: commitValue
+ }
+ ]
+ },
+ {
+ type: 'hbox',
+ widths: [ '50%', '50%' ],
+ children: [
+ {
+ id: 'wmode',
+ type: 'select',
+ requiredContent: 'embed[wmode]',
+ label: editor.lang.flash.windowMode,
+ 'default': '',
+ style: 'width : 100%;',
+ items: [
+ [ editor.lang.common.notSet, '' ],
+ [ editor.lang.flash.windowModeWindow, 'window' ],
+ [ editor.lang.flash.windowModeOpaque, 'opaque' ],
+ [ editor.lang.flash.windowModeTransparent, 'transparent' ]
+ ],
+ setup: loadValue,
+ commit: commitValue
+ },
+ {
+ id: 'quality',
+ type: 'select',
+ requiredContent: 'embed[quality]',
+ label: editor.lang.flash.quality,
+ 'default': 'high',
+ style: 'width : 100%;',
+ items: [
+ [ editor.lang.common.notSet, '' ],
+ [ editor.lang.flash.qualityBest, 'best' ],
+ [ editor.lang.flash.qualityHigh, 'high' ],
+ [ editor.lang.flash.qualityAutoHigh, 'autohigh' ],
+ [ editor.lang.flash.qualityMedium, 'medium' ],
+ [ editor.lang.flash.qualityAutoLow, 'autolow' ],
+ [ editor.lang.flash.qualityLow, 'low' ]
+ ],
+ setup: loadValue,
+ commit: commitValue
+ }
+ ]
+ },
+ {
+ type: 'hbox',
+ widths: [ '50%', '50%' ],
+ children: [
+ {
+ id: 'align',
+ type: 'select',
+ requiredContent: 'object[align]',
+ label: editor.lang.common.align,
+ 'default': '',
+ style: 'width : 100%;',
+ items: [
+ [ editor.lang.common.notSet, '' ],
+ [ editor.lang.common.alignLeft, 'left' ],
+ [ editor.lang.flash.alignAbsBottom, 'absBottom' ],
+ [ editor.lang.flash.alignAbsMiddle, 'absMiddle' ],
+ [ editor.lang.flash.alignBaseline, 'baseline' ],
+ [ editor.lang.common.alignBottom, 'bottom' ],
+ [ editor.lang.common.alignMiddle, 'middle' ],
+ [ editor.lang.common.alignRight, 'right' ],
+ [ editor.lang.flash.alignTextTop, 'textTop' ],
+ [ editor.lang.common.alignTop, 'top' ]
+ ],
+ setup: loadValue,
+ commit: function( objectNode, embedNode, paramMap, extraStyles, extraAttributes ) {
+ var value = this.getValue();
+ commitValue.apply( this, arguments );
+ value && ( extraAttributes.align = value );
+ }
+ },
+ {
+ type: 'html',
+ html: '<div></div>'
+ }
+ ]
+ },
+ {
+ type: 'fieldset',
+ label: CKEDITOR.tools.htmlEncode( editor.lang.flash.flashvars ),
+ children: [
+ {
+ type: 'vbox',
+ padding: 0,
+ children: [
+ {
+ type: 'checkbox',
+ id: 'menu',
+ label: editor.lang.flash.chkMenu,
+ 'default': true,
+ setup: loadValue,
+ commit: commitValue
+ },
+ {
+ type: 'checkbox',
+ id: 'play',
+ label: editor.lang.flash.chkPlay,
+ 'default': true,
+ setup: loadValue,
+ commit: commitValue
+ },
+ {
+ type: 'checkbox',
+ id: 'loop',
+ label: editor.lang.flash.chkLoop,
+ 'default': true,
+ setup: loadValue,
+ commit: commitValue
+ },
+ {
+ type: 'checkbox',
+ id: 'allowFullScreen',
+ label: editor.lang.flash.chkFull,
+ 'default': true,
+ setup: loadValue,
+ commit: commitValue
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ id: 'advanced',
+ label: editor.lang.common.advancedTab,
+ elements: [
+ {
+ type: 'hbox',
+ children: [
+ {
+ type: 'text',
+ id: 'id',
+ requiredContent: 'object[id]',
+ label: editor.lang.common.id,
+ setup: loadValue,
+ commit: commitValue
+ }
+ ]
+ },
+ {
+ type: 'hbox',
+ widths: [ '45%', '55%' ],
+ children: [
+ {
+ type: 'text',
+ id: 'bgcolor',
+ requiredContent: 'embed[bgcolor]',
+ label: editor.lang.flash.bgcolor,
+ setup: loadValue,
+ commit: commitValue
+ },
+ {
+ type: 'text',
+ id: 'class',
+ requiredContent: 'embed(cke-xyz)', // Random text like 'xyz' will check if all are allowed.
+ label: editor.lang.common.cssClass,
+ setup: loadValue,
+ commit: commitValue
+ }
+ ]
+ },
+ {
+ type: 'text',
+ id: 'style',
+ requiredContent: 'embed{cke-xyz}', // Random text like 'xyz' will check if all are allowed.
+ validate: CKEDITOR.dialog.validate.inlineStyle( editor.lang.common.invalidInlineStyle ),
+ label: editor.lang.common.cssStyle,
+ setup: loadValue,
+ commit: commitValue
+ }
+ ]
+ }
+ ]
+ };
+ });
+})();