function do_pre_htEdit() { global $wgOut, $wgUser; $this->loadEditText(); $MvOverlay = new MV_Overlay(); // strip semantic tags which are managed by the interface: $semantic_data = $MvOverlay->get_and_strip_semantic_tags($this->stripped_edit_text); $out = $js_eval = ''; // add a div for previews: $wgOut->addHTML('<div id="wikiPreview_' . $this->mvd_id . '"></div>'); // set the default action so save page: $wgOut->addHTML($this->getAjaxForm()); // add in adjust html if present: $wgOut->addHTML($this->adj_html); // structure layout via tables (@@todo switch to class based css layout) $wgOut->addHTML('<table style="background: transparent;" width="100%"><tr><td valign="top" width="90">'); // output the person selector: if (!isset($semantic_data['spoken_by'])) { $semantic_data['spoken_by'] = ''; } $img = mv_get_person_img($semantic_data['spoken_by']); $wgOut->addHTML('<img id="mv_edit_im_' . htmlspecialchars($this->mvd_id) . '" style="display: block;margin-left: auto;margin-right: auto;" src="' . htmlspecialchars($img->getURL()) . '" width="44">'); $wgOut->addHTML('<input style="font-size:x-small" value="' . htmlspecialchars($semantic_data['spoken_by']) . '" name="smw_Spoken_By" onClick="this.value=\'\';" type="text" id="auto_comp_' . htmlspecialchars($this->mvd_id) . '" size="12" maxlength="125" autocomplete="off"/>'); // only add one auto_comp_choices_ per object/request pass if (!isset($this->auto_comp_choices)) { $this->auto_comp_choices = true; $wgOut->addHTML('<div id="auto_comp_choices_' . htmlspecialchars($this->mvd_id) . '" class="autocomplete"></div>'); } // add container formatting for MV_Overlay $wgOut->addHTML('</td>' . '<td>'); }
function get_search_feed() { global $wgSitename, $wgOut; // set up search obj: $sms = new MV_SpecialMediaSearch(); // setup filters: $sms->setUpFilters(); // do the search: $sms->doSearch(); // get the search page title: $msTitle = Title::MakeTitle( NS_SPECIAL, 'MediaSearch' ); $this->feed = new mvRSSFeed( $wgSitename . ' - ' . wfMsg( 'mediasearch' ) . ' : ' . strip_tags( $sms->getFilterDesc() ), // title strip_tags( $sms->getFilterDesc() ), // description $msTitle->getFullUrl() . '?' . $sms->get_httpd_filters_query() // link ); $this->feed->outHeader( $this->output_xml_header ); $MV_Overlay = new MV_Overlay(); // for each search result: foreach ( $sms->results as $inx => & $mvd ) { // get Stream title for mvd match: $mvTitle = new MV_Title( $mvd->wiki_title ); $stremTitle = Title::MakeTitle( MV_NS_STREAM, $mvTitle->getStreamName() . '/' . $mvTitle->getTimeRequest() ); $this->feed->outPutItem( $mvTitle, $MV_Overlay->getMVDhtml( $mvd, $absolute_links = true ) ); } $this->feed->outFooter(); }
function takes() { global $mvgIP; require_once $mvgIP . '/includes/MV_Index.php'; require_once $mvgIP . '/includes/MV_MetavidInterface/MV_Overlay.php'; $s = MV_Stream::newStreamByName($this->name); if (!$s->db_load_stream()) { return "An error occured please notify Administrator"; } $dbr =& wfGetDB(DB_SLAVE); $result =& MV_Index::getMVDInRange($s->getStreamId(), 0, $s->getDuration(), $this->mvd_tracks); if ($dbr->numRows($result) == 0) { return "No takes have been generated " . $this->name . ' - ' . $s->getStreamId() . ' - ' . $s->getDuration(); } else { $i = 0; $temp = array(); while ($row = $dbr->fetchObject($result)) { $mvdTitle = new MV_Title($row->wiki_title); $curRevision = Revision::newFromTitle($mvdTitle); $wikitext = $curRevision->getText(); $smw_attr = MV_Overlay::get_and_strip_semantic_tags($wikitext); $temp[$i]['start_time'] = $row->start_time; $temp[$i]['end_time'] = $row->end_time; $temp[$i]['Reported by'] = '' . $smw_attr['Reported By']; $temp[$i]['Read by'] = '' . $smw_attr['Read By']; $temp[$i]['Edited by'] = '' . $smw_attr['Edited By']; $i++; } $html = '<table><tr><th>Time</th><th>Editors</th><th>Readers</th><th>Reporters</th></tr><tr><td><ul id="ul-takes" class="draglist">'; for ($j = 0; $j < $i; $j++) { $html .= '<li class="li-takes">' . $temp[$j]['start_time'] . ' -> ' . $temp[$j]['end_time'] . '</li>'; } $html .= '</ul></td>'; $html .= '<td><ul id="ul1" class="draglist">'; for ($j = 0; $j < $i; $j++) { $html .= '<li class="list1">' . $temp[$j]['Edited by'] . '</li>'; } $html .= '</ul></td>'; $html .= '<td><ul id="ul2" class="draglist">'; for ($j = 0; $j < $i; $j++) { $html .= '<li class="list2">' . $temp[$j]['Read by'] . '</li>'; } $html .= '</ul></td>'; $html .= '<td> <ul id="ul3" class="draglist">'; for ($j = 0; $j < $i; $j++) { $html .= '<li class="list3">' . $temp[$j]['Reported by'] . '</li>'; } $html .= '</ul></td></tr></table>'; return $html; } }
function get_nav_page($stream_title) { global $mvgIP; // output sliders for stream navigation: $out = '<h3>' . wfMsg('mv_tool_navigate') . ' ' . htmlspecialchars(ucfirst($stream_title)) . '</h3>'; // normalize stream title: $stream_title = str_replace(' ', '_', strtolower($stream_title)); // get the total length of the stream: $stream = new MV_Stream(array('name' => $stream_title)); // $out.= "sn: ". $stream->name . '<br />'; $duration = $stream->getDuration(); // $out.=" duration: $duration"; $MvOverlay = new MV_Overlay(); $titleKey = 'mvd_type:' . ucfirst($stream_title) . '/' . $_REQUEST['time_range']; $out .= $MvOverlay->get_adjust_disp($titleKey, 'nav'); $out .= '<input type="button" id="mv_go_nav" value="Go">'; // set range: $this->js_eval = 'var end_time = \'' . htmlspecialchars($duration) . '\';'; return $out; }
function parsePlaylist() { global $wgParser, $wgOut; //valid playlist in-line-attributes: $mvInlineAttr = array('wClip', 'mvClip', 'title', 'linkback', 'desc', 'desc', 'image'); //build a associative array of "clips" $seq_text = $this->getSequenceText(); $seq_lines = explode("\n", $seq_text); $parseBucket = $cur_attr = ''; $clip_inx = -1; foreach ($seq_lines as $line) { //actions start with | $e = strpos($line, '='); if ($e !== false) { $cur_attr = substr($line, 1, $e - 1); } if (in_array($cur_attr, $mvInlineAttr)) { if ($cur_attr == 'mvClip') { $clip_inx++; } //close the parse bucket (found a valid inline attr) if ($parseBucket != '' && $cur_attr != 'desc') { $output = $wgParser->parse($parseBucket, $parser->mTitle, $parser->mOptions, true, false); $parseBucket = ''; } } $start_pos = $e !== false ? $e + 1 : 0; if ($clip_inx != -1) { if (!isset($this->clips[$clip_inx])) { $this->clips[$clip_inx] = array(); } if (!isset($this->clips[$clip_inx][$cur_attr])) { $this->clips[$clip_inx][$cur_attr] = ''; } $this->clips[$clip_inx][$cur_attr] .= substr($line, $start_pos); } } //poluate data (this could go here or somewhere else) foreach ($this->clips as $inx => &$clip) { if (trim($clip['mvClip']) == '') { unset($this->clips[$inx]); continue; } if ($clip['mvClip']) { $sn = str_replace('?t=', '/', $clip['mvClip']); $streamTitle = new MV_Title($sn); $wgStreamTitle = Title::newFromText($sn, MV_NS_STREAM); if ($streamTitle->doesStreamExist()) { //mvClip is a substitue for src so assume its there: $clip['src'] = $streamTitle->getWebStreamURL(); //title if (!isset($clip['title'])) { $clip['title'] = ''; } if ($clip['title'] == '') { $clip['title'] = $streamTitle->getTitleDesc(); } if (!isset($clip['info'])) { $clip['info'] = ''; } if ($clip['info'] == '') { $clip['info'] = $wgStreamTitle->getFullURL(); } } //check if we should look up the image: if (!isset($clip['image'])) { $clip['image'] == ''; } if ($clip['image'] == '') { $clip['image'] = $streamTitle->getFullStreamImageURL(); } //check if desc was present: if (!isset($clip['desc'])) { $clip['desc'] = ''; } //for now just lookup all ... @@todo future expose diffrent language tracks if ($clip['desc'] == '') { $dbr =& wfGetDB(DB_SLAVE); $mvd_res = MV_Index::getMVDInRange($streamTitle->getStreamId(), $streamTitle->getStartTimeSeconds(), $streamTitle->getEndTimeSeconds()); if (count($dbr->numRows($mvd_res)) != 0) { $MV_Overlay = new MV_Overlay(); $wgOut->clearHTML(); while ($mvd = $dbr->fetchObject($mvd_res)) { //output a link /line break $MV_Overlay->outputMVD($mvd); $wgOut->addHTML('<br>'); } $clip['desc'] = $wgOut->getHTML(); $wgOut->clearHTML(); } } } } //print_r($this->clips); }
function mv_history_disp($titleKey, $mvd_id) { global $wgOut; $MV_Overlay = new MV_Overlay(); return $MV_Overlay->get_history_disp($titleKey, $mvd_id); }
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 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 add_clips_manual() { global $wgOut, $mvgIP, $mvDefaultSearchVideoPlaybackRes; $MV_Overlay = new MV_Overlay(); // add preview clips space and manual add title list($iw, $ih) = explode('x', $mvDefaultSearchVideoPlaybackRes); $wgOut->addHTML('<h3>' . wfMsg('mv_add_clip_by_name') . ':</h3>' . '<form id="mv_add_to_seq_form" action="">' . '<div id="mv_seq_manual_embed" style="display:none;position:relative;border:solid thin black;width:' . htmlspecialchars($iw) . 'px;height:' . htmlspecialchars($ih) . 'px;"> </div><br />' . wfMsg('mv_label_stream_name') . ': <input id="mv_add_stream_name" name="mv_add_stream_name" ' . ' size="25" maxlength="65" ' . 'value="">'); $wgOut->addHTML('<div id="mv_add_stream_name_choices" class="autocomplete"></div>'); $wgOut->addHTML('<br class="mv_css_form">'); // get adjustment disp: $wgOut->addHTML('<div id="mv_add_adj_cnt" style="display:none;">' . $MV_Overlay->get_adjust_disp('seq', 'seq') . '<input type="button" value="' . wfMsg('mv_seq_add_end') . '" onClick="mv_add_to_seq();" >' . '<br class="mv_css_form">' . '</div></form>'); }
function getMetaData($normalized_prop_name = true) { global $wgUser, $wgParser; $article = new Article($this); $retAry = array(); $text = $article->getContent(); // @@todo should use semanticMediaWiki api here $tmpProp = MV_Overlay::get_and_strip_semantic_tags($text); // strip categories $retAry['striped_text'] = preg_replace('/\\[\\[[^:]+:[^\\]]+\\]\\]/', '', $text); if ($normalized_prop_name) { foreach ($tmpProp as $pkey => $pval) { $retAry['prop'][str_replace(' ', '_', $pkey)] = $pval; } } else { $retAry['prop'] = $tmpProp; } $sk =& $wgUser->getSkin(); // run via parser to add in Category info: $parserOptions = ParserOptions::newFromUser($wgUser); $parserOutput = $wgParser->parse($text, $this, $parserOptions); $retAry['categories'] = $parserOutput->getCategories(); return $retAry; }