function expand_wt($mvd_id)
 {
     global $wgOut, $mvgIP;
     global $mvDefaultSearchVideoPlaybackRes;
     require_once $mvgIP . '/includes/MV_Index.php';
     require_once $mvgIP . '/includes/MV_Title.php';
     require_once $mvgIP . '/includes/MV_MetavidInterface/MV_Overlay.php';
     $mvd = MvIndex::getMVDbyId($mvd_id);
     if (count($mvd) != 0) {
         $mvTitle = new MvTitle($mvd->wiki_title);
         //validate title and load stream ref:
         if ($mvTitle->validRequestTitle()) {
             list($vWidth, $vHeight) = explode('x', $mvDefaultSearchVideoPlaybackRes);
             $embedHTML = '<span style="float:left;width:' . ($vWidth + 20) . 'px">' . $mvTitle->getEmbedVideoHtml($mvd_id, $mvDefaultSearchVideoPlaybackRes) . '</span>';
             $wgOut->clearHTML();
             $title = Title::MakeTitle(MV_NS_MVD, $mvd->wiki_title);
             $article = new Article($title);
             $MvOverlay = new MV_Overlay();
             $MvOverlay->parse_format_text($article->getContent(), $mvTitle);
             $bgcolor = $MvOverlay->getMvdBgColor($mvd);
             $pageHTML = $wgOut->getHTML();
             //encasulate page html:
             $pageHTML = '<span style="padding-top:10px;float:left;width:450px">' . $pageHTML . '</span>';
             return $embedHTML . $pageHTML . '<div style="clear: both;"/>';
         } else {
             return wfMsg('mvBadMVDtitle');
         }
     } else {
         return wfMsg('mv_error_mvd_not_found');
     }
     //$title = Title::MakeTitle(MV_NS_MVD, $wiki_title);
     //$article = new Article($title);
     //output table with embed left, and content right
     //return $wgOut->parse($article->getContent());
 }
 function execute()
 {
     global $wgRequest, $wgOut, $wgUser, $mvStream_name, $mvgIP;
     #init html output var:
     $html = '';
     # Get request data from, e.g.
     $title_str = $wgRequest->getVal('title');
     //get Mv_Title to normalize the stream name:
     require_once $mvgIP . '/includes/MV_Title.php';
     $this->stream_name = $wgRequest->getVal('stream_name') == '' ? '' : MvTitle::normalizeTitle($wgRequest->getVal('stream_name'));
     $this->stream_type = $wgRequest->getVal('stream_type');
     $this->wpEditToken = $wgRequest->getVal('wpEditToken');
     $this->stream_desc = $wgRequest->getVal('stream_desc');
     //grab the desc from the wiki page if not in the POST req
     if ($this->stream_desc == '') {
         $desTitle = Title::makeTitle(MV_NS_STREAM, $this->stream_name);
         //grab the article text:
         $curRevision = Revision::newFromTitle($desTitle);
         if ($curRevision) {
             $this->stream_desc = $curRevision->getText();
         }
     }
     if ($this->stream_name == '') {
         //default page request
         $parts = split('/', $title_str);
         if (count($parts) >= 2) {
             //means we can use part 1 as a stream name:
             $this->stream_name = $parts[1];
         }
     } else {
         if ($this->mode == 'add') {
             //output add_ status to html
             $html .= $this->add_stream();
         } else {
             //possible edit
         }
     }
     //if edit check for stream name:
     if ($this->mode == 'edit' && $this->stream_name == '') {
         $html .= wfMsg('edit_stream_missing');
         $wgOut->addHTML($html);
         return;
     }
     $this->check_permissions();
     if (count($this->_allowedStreamTypeArray) == 0) {
         //break out user lacks permissions to add anything
         $html .= wfMsg('add_stream_permission');
         $wgOut->addHTML($html);
         return;
     }
     //output the stream form
     //output the add stream form
     $spectitle = Title::makeTitle(NS_SPECIAL, 'Mv_Add_stream');
     $docutitle = Title::newFromText(wfMsg('mv_add_stream'), NS_HELP);
     if ($this->mode == 'edit') {
         $mvStreamTitle = Title::makeTitle(MV_NS_STREAM, $this->stream_name);
         if ($mvStreamTitle->exists()) {
             $sk = $wgUser->getSkin();
             $streamLink = $sk->makeLinkObj($mvStreamTitle, $this->stream_name);
             $html .= wfMsg('mv_edit_strea_docu', $streamLink);
         }
     } else {
         $html .= wfMsg('mv_add_stream_docu', $docutitle->getFullURL()) . "\n";
     }
     $html .= '<form name="add_stream" action="' . $spectitle->escapeLocalURL() . '" method="post" enctype="multipart/form-data">';
     $html .= '<fieldset><legend>' . wfMsg('mv_add_stream') . '</legend>' . "\n" . '<input type="hidden" name="title" value="' . $spectitle->getPrefixedText() . '"/>';
     $html .= '<table width="600" border="0">' . '<tr>';
     $html .= '<td  width="140">';
     //output the stream type pulldown
     $html .= '<i>' . wfMsg('mv_label_stream_name') . "</i>:";
     $html .= '</td><td>';
     $html .= '<input type="text" name="stream_name" value="' . htmlspecialchars(MvTitle::getStreamNameText($this->stream_name)) . '" size="30" maxlength="1024"><br />' . "\n";
     $html .= '</td>';
     $html .= '<td><tr><td><i>' . wfMsg('mv_label_stream_type') . '</i></td><td>';
     $html .= '<select name="stream_type">' . '<option value="">Select Stream Type</option>' . "\n";
     foreach ($this->_allowedStreamTypeArray as $type => $na) {
         $sel = $type == $this->stream_type ? 'selected' : '';
         $html .= '<option value="' . $type . '" ' . $sel . '>' . wfMsg('mv_' . $type) . '</option>' . "\n";
     }
     $html .= '</select></tr>' . "\n";
     $html .= '<tr><td valign="top"><i>' . wfMsg('mv_label_stream_desc') . '</i>:</td><td>';
     //add an edit token (for the stream description)
     if ($wgUser->isLoggedIn()) {
         $token = htmlspecialchars($wgUser->editToken());
     } else {
         $token = EDIT_TOKEN_SUFFIX;
     }
     $html .= "\n<input type='hidden' value=\"{$token}\"{$docutitle} name=\"wpEditToken\" />\n";
     //output the text area:
     $html .= '<textarea tabindex="1" accesskey="," name="stream_desc" id="stream_desc" rows=6 cols=5>' . $this->stream_desc . '</textarea>' . "\n";
     $html .= '<br /><input type="submit" value="' . wfMsg('mv_add_stream_submit') . "\"/>\n</form>";
     $html .= '</td></tr><tr><td><p>adfadfa</p></td><td><p>adfadfasdf</p></td></tr>';
     $html .= '</fieldset>';
     # Output menu items
     # @@todo link with language file
     $wgOut->addHTML($html);
     //output the stream files list (if in edit mode)
     if ($this->mode == 'edit') {
         $this->list_stream_files();
     }
 }