function auto_complete_stream_name($val) { global $mvStreamTable, $mvDefaultSearchVideoPlaybackRes; $dbr =& wfGetDB(DB_SLAVE); //check against stream name list: $result = $dbr->select($mvStreamTable, array('name', 'duration'), array('`name` LIKE \'%' . mysql_escape_string($val) . '%\''), __METHOD__, array('LIMIT' => '5')); //print "ran: " . $dbr->lastQuery(); if ($dbr->numRows($result) == 0) { return ''; } //$out='<ul>'."\n"; $out = ''; while ($row = $dbr->fetchObject($result)) { //make sure the person page exists: $streamTitle = new MV_Title('Stream:' . $row->name . '/0:00:00/0:00:30'); //print "stream name:" . $streamTitle->getStreamName(); //@@TODO fix this up.. this is getting ugly new line in embed video for example breaks things $out .= $row->name . '|' . $streamTitle->getStreamNameText() . '|' . $streamTitle->getStreamImageURL('icon') . '|' . $row->duration . '|' . $streamTitle->getEmbedVideoHtml('vid_seq', $mvDefaultSearchVideoPlaybackRes, 'http://metavid.ucsc.edu/image_media/') . "\n"; } //$out.='</ul>'; //return people people in the Person Category return $out; }
function mv_pl_wt($mvd_id) { global $wgRequest; $mvd = MV_Index::getMVDbyId($mvd_id); $mvTitle = new MV_Title($mvd->wiki_title); return $mvTitle->getEmbedVideoHtml(array('id' => 'vid_' . $mvd_id, 'size' => $wgRequest->getVal('size'), 'autoplay' => true)); }
function expand_wt($mvd_id, $terms_ary) { global $wgOut, $mvgIP; global $mvDefaultSearchVideoPlaybackRes; $mvd = MV_Index::getMVDbyId($mvd_id); if (count($mvd) != 0) { $mvTitle = new MV_Title($mvd->wiki_title); // validate title and load stream ref: if ($mvTitle->validRequestTitle()) { list($vWidth, $vHeight) = explode('x', $mvDefaultSearchVideoPlaybackRes); $embedHTML = '<span style="float:left;width:' . htmlspecialchars($vWidth + 20) . 'px">' . $mvTitle->getEmbedVideoHtml(array('id' => 'vid_' . $mvd_id, 'size' => $mvDefaultSearchVideoPlaybackRes, 'autoplay' => true)) . '</span>'; $wgOut->clearHTML(); $MvOverlay = new MV_Overlay(); $MvOverlay->outputMVD($mvd, $mvTitle); $pageHTML = '<span style="padding-top:10px;float:left;width:450px">' . $wgOut->getHTML() . '</span>'; // return page html: 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 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>{$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, $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; //make sure we have the mv_embed header: mvfAddHTMLHeader('embed'); //print "img url: " . $mvTitle->getStreamImageURL(); $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="padding: 4px 0; width: ' . ($this->mWidths + 5) . 'px;">' . '<div style="margin-left: auto; margin-right: auto; width: ' . $this->mWidths . 'px;">' . $mvTitle->getEmbedVideoHtml('', $vidRes) . '</div>' . '<span style="clear:both"></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: ' . $vpad . 'px 0; width: ' . ($this->mWidths + 30) . 'px;">' . '<div style="margin-left: auto; margin-right: auto; width: ' . $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); } } //TODO //$ul = $sk->makeLink( $wgContLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut ); 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 . $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; }