function edit()
    {
        global $wgOut, $wgUser, $wgHooks, $wgTitle;
        //add some user variables
        $seqPlayer = new MV_SequencePlayer($wgTitle);
        mvAddGlobalJSVariables(array('mvSeqExportUrl' => $seqPlayer->getExportUrl()));
        //add the "switch" link to the top of the page
        $wgOut->addHTML('<span id="swich_seq_links">
	 			<a id="swich_seq_text" style="display:none"
	 			    href="javascript:mv_do_sequence_edit_swap(\'text\')">' . wfMsg('mv_sequence_edit_text') . '</a>' . '<a id="switch_seq_wysiwyg"
	 				href="javascript:mv_do_sequence_edit_swap(\'seq_update\')">' . wfMsg('mv_sequence_edit_visual_editor') . '</a>' . '</span>' . '<div id="seq_edit_container" style="display:none;position:relative;width:100%;height:580px;background:#AAA"></div>');
        $wgOut->addHTML('<div id="mv_text_edit_container"> ');
        parent::edit();
        $wgOut->addHTML('</div>');
    }
 static function doSeqReplace(&$input, &$argv, &$parser)
 {
     global $wgTitle, $wgUser, $wgRequest, $markerList;
     $sk = $wgUser->getSkin();
     $options = array();
     $oldid = $wgRequest->getVal('oldid');
     if ($oldid != '') {
         $options['oldid'] = $oldid;
     }
     $seqPlayer = new MV_SequencePlayer($wgTitle);
     $vidtag = '<div id="file" class="fullImageLink">';
     $vidtag .= $seqPlayer->getEmbedSeqHtml($options);
     $vidtag .= '</div><hr>';
     $marker = "xx-marker" . count($markerList) . "-xx";
     $markerList[] = $vidtag;
     return $marker;
 }
예제 #3
0
/**
 * enables the rewriting of links to the Stream and Sequence namespace to support inline embeding.
 * see page: sample in-wiki-embed syntax
 * @@todo should probably be integrated to respective Stream and Sequence class.
 * and maybe integrated with File / image handle
*/
function mvLinkEnd($skin, $title, $options, &$text, &$attribs, &$ret)
{
    global $mvDefaultAspectRatio, $mvDefaultVideoPlaybackRes, $mvEmbedKey;
    //only do link rewrites for $mvEmbedKey
    if (substr($title->getText(), 0, strlen($mvEmbedKey)) != $mvEmbedKey) {
        return true;
    }
    //parse text for extra parameters
    //@@todo integrate with image params / maybe file handle )
    $params = explode('|', $text);
    //setup defaults:
    $size = $mvDefaultVideoPlaybackRes;
    $start_ntp = $end_ntp = null;
    foreach ($params as $param) {
        if (substr($param, -2) == 'px') {
            //size param
            if (strpos($param, 'x') === false) {
                $k = intval(str_replace($param, 'px', ''));
                //@@todo should use the actual clips aspect ratio
                $size = intval($v) . 'x' . (int) ($mvDefaultAspectRatio * $v);
            } else {
                list($width, $height) = explode('x', str_replace('px', '', $param));
                $size = intval($width) . 'x' . intval($height);
            }
        } else {
            //only applicable to Stream:
            if ($title->getNamespace() == MV_NS_STREAM) {
                if (substr($param, 0, 6) == 'start=') {
                    $start_str = substr($param, 6);
                    $timeSec = npt2seconds($start_str);
                    if ((int) $timeSec > 0) {
                        $start_ntp = seconds2npt($timeSec);
                    }
                } elseif (substr($param, 0, 4) == 'end=') {
                    $end_str = substr($param, 6);
                    $timeSec = npt2seconds($start_str);
                    if ((int) $timeSec > 0) {
                        $end_ntp = seconds2npt($timeSec);
                    }
                } else {
                    //caption text / desc
                }
            }
        }
    }
    if (substr($title->getText(), 0, strlen($mvEmbedKey)) == $mvEmbedKey) {
        $resourceTitle = Title::newFromText(substr($title->getText(), strlen($mvEmbedKey) + 1));
        if ($resourceTitle->getNamespace() == MV_NS_STREAM) {
            $mvTitle = new MV_Title($resourceTitle);
            $ret = $mvTitle->getEmbedVideoHtml(array('size' => $size, 'showmeta' => true));
        }
        if ($resourceTitle->getNamespace() == MV_NS_SEQUENCE) {
            $seqPlayer = new MV_SequencePlayer($resourceTitle);
            $ret = $seqPlayer->getEmbedSeqHtml(array('size' => $size));
        }
        return false;
    }
    return true;
}