Menu

#17 flash and video add'on

open
nobody
None
5
2014-12-30
2004-09-27
php
No

It 's a very simply plug'in to insert movie and swf into
spaw editor.

//////// in "class/script.js.php" insert

function SPAW_swf_insert_click(editor, sender)
{
window.frames[editor+'_rEdit'].focus();

var imgSrc = showModalDialog('<?php echo
$spaw_dir ?>dialogs/img_library.php?typee=swf&lang=' +
document.all['SPAW_'+editor+'_lang'].value + '&theme='
+ document.all
['SPAW_'+editor+'_theme'].value+'&request_uri='+escape
(window.location.href), '',
'dialogHeight:420px; dialogWidth:420px;
resizable:no; status:no');

if(imgSrc != null)
var swf='<object classid=\"clsid:D27CDB6E-AE6D-
11cf-96B8-444553540000\"
codebase=\"http://download.macromedia.com/pub/shock
wave/cabs/flash/swflash.cab#version=6,0,29,0
\"><param name=\"movie\" value=\"'+imgSrc+'"><param
name=\"quality\" value=\"high\"><embed
src=\"'+imgSrc+'" quality=\"high\"
pluginspage=\"http://www.macromedia.com/go/getflashpl
ayer\" type=\"application/x-shockwave-flash\"
></embed></object>';

sel = document.selection.createRange();
sel.pasteHTML(swf) ;

SPAW_update_toolbar(editor, true);
}

function SPAW_video_insert_click(editor, sender)
{
window.frames[editor+'_rEdit'].focus();

var imgSrc = showModalDialog('<?php echo
$spaw_dir ?>dialogs/img_library.php?typee=avi&lang=' +
document.all['SPAW_'+editor+'_lang'].value + '&theme='
+ document.all
['SPAW_'+editor+'_theme'].value+'&request_uri='+escape
(window.location.href), '',
'dialogHeight:420px; dialogWidth:420px;
resizable:no; status:no');

if(imgSrc != null)
var video='<OBJECT ID=\"MediaPlayer1\"
src=\"'+imgSrc+'"CLASSID=\"CLSID:22D6f312-B0F6-11D0-
94AB-0080C74C7E95\"STANDBY=\"Loading Windows
Media Player components...\"TYPE=\"application/x-
oleobject\"><param name=\"SRC\" value=\"'+imgSrc+'" >
<param name=\"BACKGROUNDCOLOR\" value=\"#000000
\"><PARAM NAME=\"ShowControls\"
VALUE=\"true\"><PARAM NAME=\"AutoRewind\"
VALUE=\"False\"><PARAM NAME=\"AutoStart\"
VALUE=\"True\"><embed src=\"'+imgSrc+'"
controls=\"ControlPanel\" console=\"cons\"
></embed></OBJECT>';

sel = document.selection.createRange();
sel.pasteHTML(video) ;

SPAW_update_toolbar(editor, true);
}

////// in "lib/toolbars/..../toolbar_data.inc.php"
insert
array(
'name' => 'swf_insert',
'type' => SPAW_TBI_BUTTON
),
array(
'name' => 'video_insert',
'type' => SPAW_TBI_BUTTON
),

//////////// copy images to "lib/themes/..../img"

/////////// in dialogs/img_library.php
//after
include $spaw_root.'class/lang.class.php';

//insert

if(isset($HTTP_GET_VARS['typee']) and
$HTTP_GET_VARS['typee']=="swf")
{
unset($spaw_valid_imgs);
$spaw_valid_imgs[]="swf";
//echo"swf";
}
if(isset($HTTP_GET_VARS['typee']) and
$HTTP_GET_VARS['typee']=="avi")
{
unset($spaw_valid_imgs);
$spaw_valid_imgs[]="mpeg";
$spaw_valid_imgs[]="avi";
$spaw_valid_imgs[]="mpg";

}
///replace
if ($d)
{
while (false !== ($entry = $d->read())) {
if (is_file($_root.$imglib.$entry))
{
?>
<option value="<?php echo $entry?>" <?php
echo ($entry == $img)?'selected':''?>><?php echo
$entry?></option>
<?php
}
}
$d->close();
}

////by

if ($d)
{
while (false !== ($entry = $d->read())) {

if (is_file($_root.$imglib.$entry) and in_array(substr
(strrchr($_root.$imglib.$entry,"."),1),$spaw_valid_imgs))
{
?>
<option value="<?php echo $entry?>" <?php
echo ($entry == $img)?'selected':''?>><?php echo
$entry?></option>
<?php
}
}
$d->close();
}

Discussion

  • php

    php - 2004-09-27

    image and modif

     
  • php

    php - 2004-09-27
    • summary: simply flash and video plug --> simply flash and video add'on
     
  • php

    php - 2004-09-27
    • summary: simply flash and video add'on --> flash and video add'on
     
  • michael831

    michael831 - 2004-12-07

    Logged In: YES
    user_id=1150882

    Hi djigeto ,

    I have the flash-video patch from sourceforge but the
    video part doens't work good. It passes the code good to
    the var video (tested with an alert) but it don't work
    with sel.pasteHTML(video);. Is there something in the
    Editor that filters html code like <param> because the
    code below writes only the <object> and <embed>
    tags.

    function SPAW_video_insert_click(editor, sender)
    {
    window.frames[editor+'_rEdit'].focus();

    var imgSrc = showModalDialog('<?php echo
    $spaw_dir ?>dialogs/img_library.php?typee=avi&lang='
    + document.all['SPAW_'+editor+'_lang'].value
    + '&theme=' + document.all
    ['SPAW_'+editor+'_theme'].value+'&request_uri='+escap
    e(window.location.href), '',
    'dialogHeight:420px; dialogWidth:420px;
    resizable:no; status:no');

    if(imgSrc != null)
    var video='<OBJECT ID=\"MediaPlayer1\"
    src=\"'+imgSrc+'"CLASSID=\"CLSID:22D6f312-B0F6-11D0-
    94AB-0080C74C7E95\"STANDBY=\"Loading Windows
    Media Player components...\"TYPE=\"application/x-
    oleobject\"><param name=\"SRC\" value=\"'+imgSrc+'"
    > <param name=\"BACKGROUNDCOLOR\"
    value=\"#000000\"><PARAM NAME=\"ShowControls\"
    VALUE=\"true\"><PARAM NAME=\"AutoRewind\"
    VALUE=\"False\"><PARAM NAME=\"AutoStart\"
    VALUE=\"True\"><embed src=\"'+imgSrc+'"
    controls=\"ControlPanel\" console=\"cons\"
    ></embed></OBJECT>';

    sel = document.selection.createRange();
    sel.pasteHTML(video) ;

    SPAW_update_toolbar(editor, true);
    }

    current output = <OBJECT id=MediaPlayer1
    type=application/x-oleobject standby="Loading Windows
    Media Player components..." classid=CLSID:22D6f312-
    B0F6-11D0- 94AB-0080C74C7E95
    src="/uploadedfiles/producten/karel3.mpeg"><embed
    src="/uploadedfiles/producten/karel3.mpeg"
    controls="ControlPanel"
    console="cons" ></embed></OBJECT>

    Thank you in advanced,

    Greetz Michael

     
  • michael831

    michael831 - 2004-12-09

    Logged In: YES
    user_id=1150882

    It's working with this line:

    var video='<object classid=\"CLSID:6BF52A52-394A-11d3-
    B153-00C04F79FAA6\"><param name=\"src\"
    value=\"'+imgSrc+'\"><param name=\"AutoStart\"
    value=\"False\"><param name=\"ShowControls\"
    value=\"True\"><param name=\"ShowStatusBar\"
    value=\"False\"><param name=\"ShowDisplay\"
    value=\"False\"><param name=\"AutoRewind\"
    value=\"True\"><param name=\"url\"
    value=\"'+imgSrc+'\"><embed src=\"'+imgSrc+'\"
    type=\"application/x-mplayer2\"
    pluginspage=\"http://www.microsoft.com/Windows/Downloads/
    Contents/MediaPlayer/\"; ></embed></object>';

    I'am using another clsid and a pluginpage so it works with
    almost all browsers (ie6,firefox1.0 and netscape 7.02)

    Greetz Michael

     
  • CAN007

    CAN007 - 2005-12-01

    Logged In: YES
    user_id=1394400

    Great job.

    You may want to add the following to the

    en_lang_data.inc.php file:

    'swf_insert' => array(
    # Title function
    'title' => 'Insert Flash',
    ),
    'video_insert' => array(
    # Title function
    'title' => 'Insert Video',
    ),

    for your hover description.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.