function getHTMLResults() { global $mvgIP, $wgOut, $mvgScriptPath, $mvgContLang, $wgUser, $wgParser; //print_r($this->results); //for each stream range: $o = ''; //print_r($this->results ); require_once $mvgIP . '/includes/MV_Title.php'; require_once $mvgIP . '/includes/MV_MetavidInterface/MV_Overlay.php'; if (count($this->results) == 0) { return '<h3>' . wfMsg('mv_search_no_results') . '</h3>'; } foreach ($this->results as $stream_id => &$stream_set) { $matches = 0; $stream_out = $mvTitle = ''; $sk =& $wgUser->getSkin(); foreach ($stream_set as &$srange) { $cat_html = $mvd_out = ''; $range_match = 0; foreach ($srange['rows'] as &$mvd) { $matches++; if (isset($mvd->text)) { //@@todo parse category info if present //$cat_html = $mvd->text; //run via parser to add in Category info: $parserOptions = ParserOptions::newFromUser($wgUser); $parserOptions->setEditSection(false); $parserOptions->setTidy(true); $title = Title::MakeTitle(MV_NS_MVD, $mvd->wiki_title); $parserOutput = $wgParser->parse($mvd->text, $title, $parserOptions); $cats = $parserOutput->getCategories(); foreach ($cats as $catkey => $title_str) { $title = Title::MakeTitle(NS_CATEGORY, $catkey); $cat_html .= ' ' . $sk->makeKnownLinkObj($title, $catkey); } //add category pre-text: if ($cat_html != '') { $cat_html = wfMsg('Categories') . ':' . $cat_html; } //$wgOut->addCategoryLinks( $parserOutput->getCategories() ); //$cat_html = $sk->getCategories(); //empty out the categories //$wgOut->mCategoryLinks = array(); } $mvTitle = new MvTitle($mvd->wiki_title); //retive only the first article: //$title = Title::MakeTitle(MV_NS_MVD, $mvd->wiki_title); //$article = new Article($title); $bgcolor = MV_Overlay::getMvdBgColor($mvd); $mvd_out .= '<span style="background:#' . $bgcolor . '"> ' . $mvTitle->getTimeDesc() . ' </span>'; $mvd_out .= '<a title="' . wfMsg('mv_expand_play') . '" href="javascript:mv_ex(\'' . $mvd->id . '\')"><img id="mv_img_ex_' . $mvd->id . '" border="0" src="' . $mvgScriptPath . '/skins/images/closed.png"></a>' . ' '; //output control liniks: //make stream title link: $mvStreamTitle = Title::MakeTitle(MV_NS_STREAM, $mvTitle->getNearStreamName()); //$mvTitle->getStreamName() .'/'.$mvTitle->getStartTime() .'/'. $mvTitle->getEndTime() ); $mvd_out .= $sk->makeKnownLinkObj($mvStreamTitle, '<img border="0" src="' . $mvgScriptPath . '/skins/images/run_mv_stream.png">', '', '', '', '', ' title="' . wfMsg('mv_view_in_stream_interface') . '" '); //$title = MakeTitle::() $mvd_out .= ' '; $mvdTitle = Title::MakeTitle(MV_NS_MVD, $mvd->wiki_title); $mvd_out .= $sk->makeKnownLinkObj($mvdTitle, '<img border="0" src="' . $mvgScriptPath . '/skins/images/run_mediawiki.png">', '', '', '', '', ' title="' . wfMsg('mv_view_wiki_page') . '" '); $mvd_out .= '<div id="mvr_' . $mvd->id . '" style="display:none;background:#' . $bgcolor . ';" ></div>'; $mvd_out .= '<br>' . "\n"; } if (count($srange['rows']) != 1) { $stream_out .= ' ' . $cat_html . ' In range:' . seconds2ntp($srange['s']) . ' to ' . seconds2ntp($srange['e']) . wfMsg('mv_match_text', count($srange['rows'])) . '<br>' . "\n"; $stream_out .= $mvd_out; } else { $stream_out .= $mvd_out; } } $nsary = $mvgContLang->getNamespaceArray(); //output stream name and mach count /*$o.='<br><img class="mv_stream_play_button" name="'.$nsary[MV_NS_STREAM].':' . $mvTitle->getStreamName() . '" align="left" src="'.$mvgScriptPath.'/skins/mv_embed/images/vid_play_sm.png">'; */ $o .= '<h3>' . $mvTitle->getStreamNameText() . wfMsg('mv_match_text', $matches) . '</h3>'; $o .= '<div id="mv_stream_' . $stream_id . '">' . $stream_out . '</div>'; } return $o; }
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(); } }