Page 1 of 1

My first contribute with community

Posted: Mon Oct 01, 2007 12:35 am
by nuno
/*
@ N.C. - Portugal
PLUGIN FLASH with compatibility HTML e XHTML 1.0 and valid (x)html
Added SWFObject - http://blog.deconcept.com/swfobject/


TinyMCE with flash plugin

//////////////////////////////////////////////////

download

1. http://blog.deconcept.com/swfobject/swfobject.zip

2. In template put

{literal}

{/literal}


Modified File

plugins/flash/editor_plugin_src.js

+- line 146 - 184

I WHAIT FOR YOUR FEEDBACK
*/


tinyMCE.importPluginLanguagePack('flash');
var TinyMCE_FlashPlugin={getInfo:function()
{
return{longname:'Flash',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/flash',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}
},
initInstance:function(inst){
if(!tinyMCE.settings['flash_skip_plugin_css'])
tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/plugins/flash/css/content.css")
},getControlHTML:function(cn){switch(cn){
case"flash":return tinyMCE.getButtonHTML(cn,'lang_flash_desc','{$pluginurl}/images/flash.gif','mceFlash')
}return""
},execCommand:function(editor_id,element,command,user_interface,value){

switch(command){
case"mceFlash":var name="",swffile="",swfwidth="",swfheight="",action="insert";
var template=new Array();
var inst=tinyMCE.getInstanceById(editor_id);
var focusElm=inst.getFocusElement();
template['file']='../../plugins/flash/flash.htm';
template['width']=430;
template['height']=175;
template['width']+=tinyMCE.getLang('lang_flash_delta_width',0);
template['height']+=tinyMCE.getLang('lang_flash_delta_height',0);
if(focusElm!=null&&focusElm.nodeName.toLowerCase()=="img"){
name=tinyMCE.getAttrib(focusElm,'class');
if(name.indexOf('mceItemFlash')==-1)return true;
swffile=tinyMCE.getAttrib(focusElm,'alt');

if(tinyMCE.getParam('convert_urls'))swffile=eval(tinyMCE.settings['urlconverter_callback']+"(swffile, null, true);");
swfwidth=tinyMCE.getAttrib(focusElm,'width');
swfheight=tinyMCE.getAttrib(focusElm,'height');
action="update"}tinyMCE.openWindow(template,{
   editor_id:editor_id,inline:"yes",swffile:swffile,swfwidth:swfwidth,swfheight:swfheight,action:action});
return true
}
return false
},cleanup:function(type,content){

switch(type)
{
case"insert_to_editor_dom":
if(tinyMCE.getParam('convert_urls')){
var imgs=content.getElementsByTagName("img");
for(var i=0;i','gi'),'');
content=content.replace(new RegExp('','gi'),'');

while((startPos=content.indexOf('',startPos);
var attribs=TinyMCE_FlashPlugin._parseAttributes(content.substring(startPos+6,endPos));
embedList[embedList.length]=attribs}
var index=0;
while((startPos=content.indexOf('=embedList.length)
break;
var attribs=embedList[index];
endPos=content.indexOf('',startPos);endPos+=9;
var contentAfter=content.substring(endPos);
content=content.substring(0,startPos);
content+=''+content.substring(endPos);content+=contentAfter;index++;startPos++}
var index=0;
while((startPos=content.indexOf('=embedList.length)break;
var attribs=embedList[index];
endPos=content.indexOf('>',startPos);endPos+=9;
var contentAfter=content.substring(endPos);
content=content.substring(0,startPos);
content+=''+content.substring(endPos);
content+=contentAfter;index++;startPos++}
break;
case"get_from_editor":var startPos=-1;
while((startPos=content.indexOf('',startPos);
var attribs=TinyMCE_FlashPlugin._parseAttributes(content.substring(startPos+4,endPos));if(attribs['class']!="mceItemFlash")
continue;
endPos+=2;
var embedHTML='';
var wmode=tinyMCE.getParam("flash_wmode","transparent");
var quality=tinyMCE.getParam("flash_quality","high");
var menu=tinyMCE.getParam("flash_menu","false");






/*--------------
beta // 11 agosto 2007 - 15h54 // by N.C. -  Portugal
SWFObject - http://blog.deconcept.com/swfobject/
I WHAIT FOR YOUR FEEDBACK
---------------*/

/*TODO*/


/*news param*/
var scale=tinyMCE.getParam("flash_exactfit","exactfit");
/*news param*/



embedHTML+='';




embedHTML+='';

embedHTML+=' var so = new SWFObject("'+attribs["title"]+'", "my_CW_FlashID", "'+attribs["width"]+'", "'+attribs["height"]+'", "8", "#ffffff");';


embedHTML+=' so.addParam("quality", "'+quality+'");';
embedHTML+='  so.addParam("wmode", "'+wmode+'");';
embedHTML+='  so.addParam("scale", "'+scale+'");';


                       

embedHTML+=' so.write("flashcontent");';

embedHTML+='';

     /*TODO*/                             


/*--------------fim beta /--------------*/



chunkBefore=content.substring(0,startPos);
chunkAfter=content.substring(endPos);
content=chunkBefore+embedHTML+chunkAfter}
break
}
return content},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){
if(node==null)return;
do{
if(node.nodeName=="IMG"&&tinyMCE.getAttrib(node,'class').indexOf('mceItemFlash')==0){tinyMCE.switchClass(editor_id+'_flash','mceButtonSelected');
return true}
}
while((node=node.parentNode));
tinyMCE.switchClass(editor_id+'_flash','mceButtonNormal');
return true},_parseAttributes:function(attribute_string)
{
var attributeName="";
var attributeValue="";
var withInName;
var withInValue;
var attributes=new Array();
var whiteSpaceRegExp=new RegExp('^[ \n\r\t]+','g');
if(attribute_string==null||attribute_string.length<2)return null;
withInName=withInValue=false;
for(var i=0;i<attribute_string.length;i++)
{
var chr=attribute_string.charAt(i);
if((chr=='"'||chr=="'")&&!withInValue)withInValue=true;
else if((chr=='"'||chr=="'")&&withInValue){withInValue=false;
var pos=attributeName.lastIndexOf(' ');
if(pos!=-1)attributeName=attributeName.substring(pos+1);attributes[attributeName.toLowerCase()]=attributeValue.substring(1);
attributeName="";
attributeValue=""}
else if
(!whiteSpaceRegExp.test(chr)&&!withInName&&!withInValue)withInName=true;
if(chr=='='&&withInName)withInName=false;
if(withInName)attributeName+=chr;
if(withInValue)attributeValue+=chr
}
return attributes}
};
tinyMCE.addPlugin("flash",TinyMCE_FlashPlugin);

Re: My first contribute wdth community

Posted: Mon Oct 01, 2007 5:02 am
by Duketown
Nuno,

Seems nice, but I miss an explanation of what will happen if I perform the steps. In other words, what might I expect (what does it do).
Is the code CMSMS version dependent? What happens with an upgrade, do I have to redo the steps mentioned?

Re: My first contribute wdth community

Posted: Mon Oct 01, 2007 8:46 am
by nuno
good with this modification its code flash is with xhtml validated and the edges of the flash in the IE desactiva.

It is only enough to have puglin of the flash in the TinyMCE and the file "plugins/flash/editor_plugin_src.js" to change for mine.

for more information http://blog.deconcept.com/swfobject/

I wait that it is a good contribution
I LOVE CMSMS

Re: My first contribute wdth community

Posted: Tue Oct 02, 2007 8:57 am
by nuno
none, feedback?
I was sad! eh... eh...

Re: My first contribute wdth community

Posted: Tue Oct 02, 2007 9:08 am
by cyberman
Nice thing.

Maybe you could add it to its project forge too :).

Re: My first contribute with community

Posted: Tue Oct 02, 2007 9:49 pm
by Pierre M.
Hello all,

I'm lazy tonight. Could somebody explain what it is ? What it does and what it solves ?
Thanks in advance.

Pierre M.

Re: My first contribute with community

Posted: Fri Oct 05, 2007 2:09 pm
by chowbow
Hi Nuno. Can you explain what this plugin is for? Is it for embedding flash movies or what?

Re: My first contribute with community

Posted: Sat Oct 06, 2007 12:07 pm
by nuno
Hi, is normal flash plugin with une cool optimation

in first this optimation it is for fulfilling the standards of webstandart, because tag embed is not acceptance for w3c.

it substitutes tag embed, also if the navigating one will not have activated the Javascript or not to tivar the flash to player substitutes for an image that will be defined and nobody  notice, what he is fantastic


sorry my bad english