function getItemOutput($row, $opt = array()) { global $wgUser; $sk = $wgUser->getSkin(); //set defaults: $person_ht = $bill_ht = $category_ht = $o = ''; if (!isset($row->start_time)) { $row->start_time = 0; } if (!isset($row->end_time)) { $row->end_time = 60 * 20; } $mvd_out_html = ''; $mvd_rows = MV_Index::getMVDInRange($row->stream_id, $row->start_time, $row->end_time, $mvd_type = 'anno_en', $getText = true, $smw_properties = array('Speech_by', 'Bill', 'category'), $options = array('limit' => 1)); if (count($mvd_rows) != 0) { reset($mvd_rows); $mvd_row = current($mvd_rows); if (isset($opt['use_mvd_time']) && $opt['use_mvd_time']) { $row->start_time = $mvd_row->start_time; $row->end_time = $mvd_row->end_time; } // print_r($mvd_rows); // print "type of: " . gettype($mvd_row); if (isset($mvd_row->Speech_by)) { if (trim($mvd_row->Speech_by) != '') { $ptitle = Title::MakeTitle(NS_MAIN, $mvd_row->Speech_by); $mvd_out_html .= '<span class="keywords">' . $sk->makeKnownLinkObj($ptitle, $ptitle->getText()) . '</span><br />'; } } if (isset($mvd_row->Bill)) { if (trim($mvd_row->Bill) != '') { $btitle = Title::MakeTitle(NS_MAIN, $mvd_row->Bill); $mvd_out_html .= '<span class="keywords">Bill: ' . $sk->makeKnownLinkObj($btitle) . ' </span><br />'; } } global $wgContLang; $mvdNStxt = $wgContLang->getNsText(MV_NS_MVD); //grab categories if no bill or speech if ($this->params['display_cat'] || $mvd_out_html == '') { $dbr = wfGetDB(DB_READ); $cl_res = $dbr->select('categorylinks', 'cl_to', array('cl_sortkey' => $mvdNStxt . ':' . str_replace('_', ' ', $mvd_row->wiki_title)), 'getTopClips::Categories', 'LIMIT 0, 5'); if ($dbr->numRows($cl_res) != 0) { $mvd_out_html .= '<span class="keywords">Categories: '; $coma = ''; while ($cl_row = $dbr->fetchObject($cl_res)) { $cTitle = Title::MakeTitle(NS_CATEGORY, $cl_row->cl_to); $mvd_out_html .= $coma . $sk->makeKnownLinkObj($cTitle, $cTitle->getText()); $coma = ', '; } $mvd_out_html .= '</span><br />'; } } } else { //we have not meta //if( isset($opt['remove_no_meta']) && $opt['remove_no_meta']) //return false; } // first make link and stream title: $mvStream = MV_Stream::newStreamByID($row->stream_id); if (!$mvStream->doesStreamExist()) { return false; } //limit our output range to < 20 min if ($row->end_time - $row->start_time > 20 * 60) { $row->end_time = $row->start_time + 20 * 60; } $nt = $mvStream->getStreamName() . '/' . seconds2npt($row->start_time) . '/' . seconds2npt($row->end_time); $mvTitle = new MV_Title($nt, MV_NS_STREAM); $mvStreamTitle = Title::MakeTitle(MV_NS_STREAM, $mvTitle->getNearStreamName($extra_range = '0')); // output the image: $o .= $sk->makeKnownLinkObj($mvStreamTitle, '<img alt="image for ' . $mvTitle->getStreamNameText() . ' ' . $mvTitle->getTimeDesc() . '" src="' . $mvTitle->getStreamImageURL('small') . '"/>', 'tl=1'); $title_span = ''; if (isset($mvStream->date_start_time)) { $parts = split('_', $mvStream->getStreamName()); if (count($parts) >= 3) { $title_span = ucfirst($parts[0] . ' '); } else { $title_span = $mvStream->getStreamName(); } $title_span .= date('F jS, Y', $mvStream->date_start_time); } else { $title_span = $mvTitle->getStreamNameText() . $mvTitle->getTimeDesc(); } $o .= '<span class="title">' . $sk->makeKnownLinkObj($mvStreamTitle, $title_span, 'tl=1') . '</span>'; //add mvd_annotative output: $o .= $mvd_out_html; return $o; }
function outPutItem($wikiTitle, $desc_html=''){ global $wgOut; $mvTitle = new MV_Title($wikiTitle); $mStreamTitle = Title::makeTitle(MV_NS_STREAM, ucfirst($mvTitle->getStreamName()) . '/'.$mvTitle->getTimeRequest()); //only output media RSS item if its valid media: if(!$mvTitle->doesStreamExist())return ; //@@todo this should be cached $thumb_ref = $mvTitle->getStreamImageURL('320x240'); if($desc_html==''){ $article = new Article($wikiTitle); $wgOut->clearHTML(); $wgOut->addWikiText($article->getContent() ); $desc_html = $wgOut->getHTML(); $wgOut->clearHTML(); } $desc_xml ='<![CDATA[ <center class="mv_rss_view_only"> <a href="'.$mStreamTitle->getFullUrl().'"><img src="'.$thumb_ref.'" border="0" /></a> </center> <br />'. $desc_html. ']]>'; $stream_url = $mvTitle->getWebStreamURL(); $talkpage = $wikiTitle->getTalkPage(); $type_desc = ($mvTitle->getMvdTypeKey())?wfMsg($mvTitle->getMvdTypeKey()):''; $time_desc = ($mvTitle->getTimeDesc())?$mvTitle->getTimeDesc():''; ?> <item> <link><?=mvRSSFeed::xmlEncode($mStreamTitle->getFullUrl())?></link> <title><?=mvRSSFeed::xmlEncode( $mvTitle->getStreamNameText() . ' ' . $time_desc)?></title> <description><?=$desc_xml?></description> <enclosure type="video/ogg" url="<?=mvRSSFeed::xmlEncode($stream_url)?>"/> <comments><?=mvRSSFeed::xmlEncode($talkpage->getFullUrl())?></comments> <media:thumbnail url="<?=mvRSSFeed::xmlEncode($thumb_ref)?>"/> <? /*todo add in alternate streams HQ, lowQ archive.org etc: <media:group> <media:content blip:role="Source" expression="full" fileSize="2702848" height="240" isDefault="true" type="video/msvideo" url="http://blip.tv/file/get/Conceptdude-EroticDanceOfANiceBabe266.avi" width="360"></media:content> <media:content blip:role="web" expression="full" fileSize="3080396" height="240" isDefault="false" type="video/x-flv" url="http://blip.tv/file/get/Conceptdude-EroticDanceOfANiceBabe266.flv" width="360"></media:content> </media:group> */ ?> </item> <? }
function toHTML() { global $wgLang, $mvDefaultAspectRatio; $sk = $this->getSkin(); $attribs = Sanitizer::mergeAttributes(array('class' => 'gallery', 'cellspacing' => '0', 'cellpadding' => '0'), $this->mAttribs); $s = Xml::openElement('table', $attribs); if ($this->mCaption) { $s .= "\n\t<caption>" . htmlspecialchars($this->mCaption) . "</caption>"; } $params = array('width' => $this->mWidths, 'height' => $this->mHeights); $i = 0; $this->already_named_resource = array(); foreach ($this->mImages as $pair) { $nt = $pair[0]; $text = $pair[1]; # Give extensions a chance to select the file revision for us $time = false; wfRunHooks('BeforeGalleryFindFile', array(&$this, &$nt, &$time)); $img = wfFindFile($nt, array('time' => $time)); if ($nt->getNamespace() == MV_NS_MVD || $nt->getNamespace() == MV_NS_STREAM || $nt->getNamespace() == MV_NS_SEQUENCE) { // @@todo fix sequence embed // $vpad = floor( ( 1.25*$this->mHeights - $thumb->height ) /2 ) - 2; $mvTitle = new MV_Title($nt); // remap MVD namespace links into the Stream view (so contextual metadata is present) if ($nt->getNamespace() == MV_NS_MVD) { $nt = Title::MakeTitle(MV_NS_STREAM, ucfirst($mvTitle->getStreamName()) . '/' . $mvTitle->getTimeRequest()); } $vidH = round($this->mWidths * $mvDefaultAspectRatio); $vidRes = $this->mWidths . 'x' . $vidH; // print "img url: " . $mvTitle->getStreamImageURL(); $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="padding: 4px 0; width: ' . htmlspecialchars($this->mWidths + 5) . 'px;">' . '<div style="margin-left: auto; margin-right: auto; width: ' . htmlspecialchars($this->mWidths) . 'px;">' . $sk->makeKnownLinkObj($nt, '<img title="' . htmlspecialchars($mvTitle->getStreamNameText()) . '"' . ' width="160" height="120" src="' . $mvTitle->getStreamImageURL('160x120') . '">') . '</div>' . '</div>' . '<span class="gallerytext" style="float:left">' . $sk->makeKnownLinkObj($nt, $mvTitle->getStreamNameText() . ' ' . $mvTitle->getTimeDesc()) . '</span>' . '</div>'; $nb = ''; $textlink = ''; } else { if ($nt->getNamespace() != NS_IMAGE || !$img) { # We're dealing with a non-image, spit out the name and be done with it. $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ($this->mHeights * 1.25 + 2) . 'px;">' . htmlspecialchars($nt->getText()) . '</div>'; } elseif ($this->mHideBadImages && wfIsBadImage($nt->getDBkey(), $this->getContextTitle())) { # The image is blacklisted, just show it as a text link. $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ($this->mHeights * 1.25 + 2) . 'px;">' . $sk->makeKnownLinkObj($nt, htmlspecialchars($nt->getText())) . '</div>'; } elseif (!($thumb = $img->transform($params))) { # Error generating thumbnail. $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ($this->mHeights * 1.25 + 2) . 'px;">' . htmlspecialchars($img->getLastError()) . '</div>'; } else { $vpad = floor((1.25 * $this->mHeights - $thumb->height) / 2) - 2; $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="padding: ' . htmlspecialchars($vpad) . 'px 0; width: ' . htmlspecialchars($this->mWidths + 30) . 'px;">' . '<div style="margin-left: auto; margin-right: auto; width: ' . htmlspecialchars($this->mWidths) . 'px;">' . $thumb->toHtml(array('desc-link' => true)) . '</div></div>'; // Call parser transform hook if ($this->mParser && $img->getHandler()) { $img->getHandler()->parserTransformHook($this->mParser, $img); } } if ($this->mShowBytes) { if ($img) { $nb = wfMsgExt('nbytes', array('parsemag', 'escape'), $wgLang->formatNum($img->getSize())); } else { $nb = wfMsgHtml('filemissing'); } $nb = "{$nb}<br />\n"; } else { $nb = ''; } $textlink = $this->mShowFilename ? $sk->makeKnownLinkObj($nt, htmlspecialchars($wgLang->truncate($nt->getText(), 20))) . "<br />\n" : ''; } # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which # in version 4.8.6 generated crackpot html in its absence, see: # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar if ($i % $this->mPerRow == 0) { $s .= "\n\t<tr>"; } $s .= "\n\t\t" . '<td><div class="gallerybox" style="width: ' . ($this->mWidths + 10) . 'px;">' . $thumbhtml . "\n\t\t\t" . '<div class="gallerytext">' . "\n" . $textlink . htmlspecialchars($text) . $nb . "\n\t\t\t</div>" . "\n\t\t</div></td>"; if ($i % $this->mPerRow == $this->mPerRow - 1) { $s .= "\n\t</tr>"; } ++$i; } if ($i % $this->mPerRow != 0) { $s .= "\n\t</tr>"; } $s .= "\n</table>"; return $s; }
function getResultsHTML() { global $mvgIP, $wgOut, $mvgScriptPath, $mvgContLang, $wgUser, $wgParser; $sk =& $wgUser->getSkin(); $o = ''; if ($this->outputContainer) { $o .= '<div id="mv_search_results_container">'; } //for each stream range: if (count($this->results) == 0) { $o .= '<h2><span class="mw-headline">' . wfMsg('mv_search_no_results') . '</span></h2>'; if ($this->outputContainer) { $o .= '</div>'; } return $o; } else { if ($this->outputInlineHeader) { $o .= '<h2> <span class="mw-headline">' . wfMsg('mv_media_matches') . '</span> </h2>'; $title = Title::MakeTitle(NS_SPECIAL, 'MediaSearch'); $o .= $sk->makeKnownLinkObj($title, wfMsg('mv_advaced_search'), $this->get_httpd_filters_query()); } } //media pagging: $prevnext = mvViewPrevNext($this->offset, $this->limit, SpecialPage::getTitleFor('MediaSearch'), $this->get_httpd_filters_query(), $this->num < $this->limit); $o .= "<br /><span id=\"mv_search_pagging\">{$prevnext}</span>\n"; //add the rss link: $sTitle = Title::MakeTitle(NS_SPECIAL, 'MvExportSearch'); $o .= '<span style="float:right;">'; $o .= $sk->makeKnownLinkObj($sTitle, '<img border="0" src="' . $mvgScriptPath . '/skins/images/feed-icon-28x28.png">', $this->get_httpd_filters_query()); $o .= '</span>'; //add the results bar: $o .= $this->getResultsBar(); //print_r($this->results); foreach ($this->results as $stream_id => &$stream_set) { $matches = 0; $stream_out = $mvTitle = ''; foreach ($stream_set as &$srange) { $cat_html = $mvd_out = ''; $range_match = 0; foreach ($srange['rows'] as $inx => &$mvd) { $matches++; $mvTitle = new MV_Title($mvd->wiki_title); //retrieve only the first article: //$title = Title::MakeTitle(MV_NS_MVD, $mvd->wiki_title); //$article = new Article($title); $bgcolor = MV_Overlay::getMvdBgColor($mvd); //output indent if not the first and count more than one if (count($srange['rows']) != 1 && $inx != 0) { $mvd_out .= ' '; } //'<img src="'. $mvgScriptPath . '/skins/images/film.png">' //$mvd_out .= '<div class="mv_rtdesc" title="' . wfMsg('mv_expand_play') . '" '. // '> '; $mvd_out .= '<img style="float:left;width:84px;cursor:pointer;border:solid #' . $bgcolor . '" ' . ' onclick="mv_ex(\'' . $mvd->id . '\')" width="80" height="60" src="' . $mvTitle->getStreamImageURL('icon') . '">'; $mvd_out .= '</div>'; $mvd_out .= '<b>' . $mvTitle->getTimeDesc() . '</b> '; $mvd_cnt_links = ''; if (isset($mvd->spoken_by)) { $ptitle = Title::MakeTitle(NS_MAIN, $mvd->spoken_by); $mvd_cnt_links .= wfMsg('mv_search_spoken_by') . ': ' . $sk->makeKnownLinkObj($ptitle); $mvd_cnt_links .= '<br>'; } if ($this->outputSeqLinks == true) { $mvd_cnt_links .= ' <a href="javascript:mv_add_to_seq({mvclip:\'' . $mvTitle->getStreamName() . '/' . $mvTitle->getTimeRequest() . '\',' . 'src:\'' . $mvTitle->getWebStreamURL() . '\',' . 'img_url:\'' . $mvTitle->getStreamImageURL() . '\'})">' . '<img style="cursor:pointer;" ' . 'title="' . wfMsg('mv_seq_add_end') . '" ' . 'src="' . $mvgScriptPath . '/skins/mv_embed/images/application_side_expand.png">' . wfMsg('mv_seq_add_end') . '</a>'; } $mvd_cnt_links .= '<a title="' . wfMsg('mv_expand_play') . '" href="javascript:mv_ex(\'' . $mvd->id . '\')">' . '<img id="mv_img_ex_' . $mvd->id . '" src="' . $mvgScriptPath . '/skins/images/closed.png">' . '<span id="mv_watch_clip_' . $mvd->id . '">' . wfMsg('mv_watch_clip') . '</span>' . '<span style="display:none;" id="mv_close_clip_' . $mvd->id . '">' . wfMsg('mv_close_clip') . '</span>' . '</a>' . ' '; //output control links: //make stream title link: $mvStreamTitle = Title::MakeTitle(MV_NS_STREAM, $mvTitle->getNearStreamName()); //$mvTitle->getStreamName() .'/'.$mvTitle->getStartTime() .'/'. $mvTitle->getEndTime() ); $mvd_cnt_links .= $sk->makeKnownLinkObj($mvStreamTitle, '<img border="1" src="' . $mvgScriptPath . '/skins/images/run_mv_stream.png"> ' . wfMsg('mv_improve_transcript'), '', '', '', '', ' title="' . wfMsg('mv_view_in_stream_interface') . '" '); $mvd_cnt_links .= '<br>'; //$title = MakeTitle::() //don't inclue link to wiki page (too confusing) //$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 .= '<span id="mvr_desc_' . $mvd->id . '">'; if (!isset($mvd->toplq)) { $mvd->toplq = false; } //output short desc send partial regEx: if (!$mvd->toplq) { $mvd_out .= $this->termHighlight($mvd->text, implode('|', $this->getTerms())); } else { if ($mvdTitle->exists() && !isset($mvd->text)) { //grab the article text: $curRevision = Revision::newFromTitle($mvdTitle); $wikiText = $curRevision->getText(); } else { $wikiText =& $mvd->text; } //@@todo parse category info if present $cat_html = ''; //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($wikiText, $title, $parserOptions); $cats = $parserOutput->getCategories(); foreach ($cats as $catkey => $title_str) { $catTitle = Title::MakeTitle(NS_CATEGORY, $catkey); $cat_html .= ' ' . $sk->makeKnownLinkObj($catTitle); } //add category pre-text: //if ($cat_html != '') //$mvd_out.= wfMsg('Categories') . ':' . $cat_html; $mvd_out .= $cat_html; $mvd_out .= count($srange['rows']) - 1 == 1 ? wfMsg('mv_match_text_one') : wfMsg('mv_match_text', count($srange['rows']) - 1); //$wgOut->addCategoryLinks( $parserOutput->getCategories() ); //$cat_html = $sk->getCategories(); //empty out the categories //$wgOut->mCategoryLinks = array(); } $mvd_out .= '</span>'; $mvd_out .= '<br>' . $mvd_cnt_links; $mvd_out .= '<div style="display:block;clear:both;padding-top:4px;padding-bottom:4px;"/>'; $mvd_out .= '<div id="mvr_' . $mvd->id . '" style="display:none;background:#' . $bgcolor . ';" ></div>'; } $stream_out .= $mvd_out; /*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->getNamespaces(); //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(); $o .= $matches == 1 ? wfMsg('mv_match_text_one') : wfMsg('mv_match_text', $matches); $o .= '</h3>'; $o .= '<div id="mv_stream_' . $stream_id . '">' . $stream_out . '</div>'; } if ($this->outputContainer) { $o .= '</div>'; } return $o; }