r29889 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r29888‎ | r29889 | r29890 >
Date:10:24, 17 January 2008
Author:dale
Status:old
Tags:
Comment:
removed FULL TEXT index in `mv_mvd_index` table in favor of unification of media search with `searchindex` table (be sure to run maintance/mv_update.php to upgrade db schema)
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_ImageGallery.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_Index.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_SequenceTools.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_Title.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php (modified) (history)
  • /trunk/extensions/MetavidWiki/languages/MV_Messages.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/mv_tables.sql (added) (history)
  • /trunk/extensions/MetavidWiki/maintenance/mv_update.php (added) (history)
  • /trunk/extensions/MetavidWiki/maintenance/updateTables.sql.php (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_search.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/maintenance/updateTables.sql.php
@@ -1,91 +0,0 @@
2 -<?
3 -/*
4 -*will update tables to new database schema (once we have a more or less stable version)
5 -*
6 -*
7 -*table code:
8 -
9 -
10 -CREATE TABLE IF NOT EXISTS `mv_mvd_index` (
11 - `id` int(10) unsigned NOT NULL auto_increment,
12 - `wiki_title` varchar(100) collate utf8_unicode_ci NOT NULL,
13 - `mvd_type` varchar(32) collate utf8_unicode_ci NOT NULL,
14 - `stream_id` int(11) NOT NULL,
15 - `start_time` int(7) unsigned NOT NULL,
16 - `end_time` int(7) unsigned default NULL,
17 - `text` text collate utf8_unicode_ci NOT NULL,
18 - PRIMARY KEY (`id`),
19 - UNIQUE KEY `wiki_title` (`wiki_title`),
20 - KEY `mvd_type` (`mvd_type`),
21 - KEY `stream_id` (`stream_id`),
22 - KEY `stream_time_start` (`start_time`,`end_time`),
23 - FULLTEXT KEY `text` (`text`)
24 -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='metavid data index' AUTO_INCREMENT=5545 ;
25 -
26 -
27 -
28 -CREATE TABLE IF NOT EXISTS `mv_streams` (
29 - `id` int(10) unsigned NOT NULL auto_increment,
30 - `name` varchar(48) collate utf8_unicode_ci NOT NULL,
31 - `state` enum('available','available_more_otw','live','otw','failed') collate utf8_unicode_ci default NULL,
32 - `date_start_time` int(10) default NULL,
33 - `duration` int(7) default NULL,
34 - UNIQUE KEY `id` (`id`),
35 - UNIQUE KEY `name` (`name`),
36 - KEY `adj_start_time` (`date_start_time`),
37 - KEY `state` (`state`)
38 -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=13 ;
39 -
40 -
41 -
42 -CREATE TABLE IF NOT EXISTS `mv_stream_files` (
43 - `id` int(10) unsigned NOT NULL auto_increment,
44 - `stream_id` int(10) unsigned NOT NULL,
45 - `base_offset` int(10) default NULL,
46 - `duration` int(9) default NULL,
47 - `path_type` enum('mvprime','cap1','ext_cspan','ext_archive_org','ext_url') character set utf8 collate utf8_unicode_ci NOT NULL,
48 - `file_desc_msg` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL,
49 - `path` text character set utf8 collate utf8_unicode_ci NOT NULL,
50 - UNIQUE KEY `id` (`id`),
51 - KEY `stream_id` (`stream_id`)
52 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='base urls for path types are hard coded' AUTO_INCREMENT=16 ;
53 -
54 -
55 -
56 -CREATE TABLE IF NOT EXISTS `mv_stream_images` (
57 - `id` int(11) NOT NULL auto_increment,
58 - `stream_id` int(11) NOT NULL,
59 - `time` int(11) NOT NULL,
60 - PRIMARY KEY (`id`),
61 - KEY `stream_id` (`stream_id`,`time`)
62 -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='time to images table' AUTO_INCREMENT=1 ;
63 -
64 - CREATE TABLE IF NOT EXISTS `mv_url_cache` (
65 -`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
66 -`url` VARCHAR( 255 ) NOT NULL ,
67 -`post_vars` TEXT NULL ,
68 -`req_time` INT NOT NULL ,
69 -`result` TEXT NULL ,
70 -INDEX ( `url` ) ,
71 -UNIQUE (
72 -`id`
73 -)
74 -) ENGINE = MYISAM COMMENT = 'simple url cache (as to not tax external services too much) '
75 -
76 -*/
77 -?>
\ No newline at end of file
Index: trunk/extensions/MetavidWiki/maintenance/mv_tables.sql
@@ -0,0 +1,98 @@
 2+-- metavid tables
 3+--
 4+-- stores the most recent mysql schema
 5+
 6+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
 7+
 8+--
 9+-- Database: `mvWiki`
 10+--
 11+
 12+-- --------------------------------------------------------
 13+
 14+--
 15+-- Table structure for table `mv_mvd_index`
 16+--
 17+
 18+CREATE TABLE IF NOT EXISTS `mv_mvd_index` (
 19+ `id` int(10) unsigned NOT NULL auto_increment,
 20+ `wiki_title` varchar(100) collate utf8_unicode_ci NOT NULL,
 21+ `mvd_type` varchar(32) collate utf8_unicode_ci NOT NULL,
 22+ `stream_id` int(11) NOT NULL,
 23+ `start_time` int(7) unsigned NOT NULL,
 24+ `end_time` int(7) unsigned default NULL,
 25+ `text` text collate utf8_unicode_ci NOT NULL,
 26+ PRIMARY KEY (`id`),
 27+ UNIQUE KEY `wiki_title` (`wiki_title`),
 28+ KEY `mvd_type` (`mvd_type`),
 29+ KEY `stream_id` (`stream_id`),
 30+ KEY `stream_time_start` (`start_time`,`end_time`),
 31+ FULLTEXT KEY `text` (`text`)
 32+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='metavid data index' AUTO_INCREMENT=0 ;
 33+
 34+-- --------------------------------------------------------
 35+
 36+--
 37+-- Table structure for table `mv_streams`
 38+--
 39+
 40+CREATE TABLE IF NOT EXISTS `mv_streams` (
 41+ `id` int(10) unsigned NOT NULL auto_increment,
 42+ `name` varchar(48) collate utf8_unicode_ci NOT NULL,
 43+ `state` enum('available','available_more_otw','live','otw','failed') collate utf8_unicode_ci default NULL,
 44+ `date_start_time` int(10) default NULL,
 45+ `duration` int(7) default NULL,
 46+ UNIQUE KEY `id` (`id`),
 47+ UNIQUE KEY `name` (`name`),
 48+ KEY `adj_start_time` (`date_start_time`),
 49+ KEY `state` (`state`)
 50+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=15 ;
 51+
 52+-- --------------------------------------------------------
 53+
 54+--
 55+-- Table structure for table `mv_stream_files`
 56+--
 57+
 58+CREATE TABLE IF NOT EXISTS `mv_stream_files` (
 59+ `id` int(10) unsigned NOT NULL auto_increment,
 60+ `stream_id` int(10) unsigned NOT NULL,
 61+ `base_offset` int(10) NOT NULL default '0',
 62+ `duration` int(9) NOT NULL,
 63+ `file_desc_msg` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL,
 64+ `path_type` enum('url_anx','wiki_title') character set utf8 collate utf8_bin NOT NULL default 'url_anx',
 65+ `path` text character set utf8 collate utf8_unicode_ci NOT NULL,
 66+ UNIQUE KEY `id` (`id`),
 67+ KEY `stream_id` (`stream_id`)
 68+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='base urls for path types are hard coded' AUTO_INCREMENT=0 ;
 69+
 70+-- --------------------------------------------------------
 71+
 72+--
 73+-- Table structure for table `mv_stream_images`
 74+--
 75+
 76+CREATE TABLE IF NOT EXISTS `mv_stream_images` (
 77+ `id` int(11) NOT NULL auto_increment,
 78+ `stream_id` int(11) NOT NULL,
 79+ `time` int(11) NOT NULL,
 80+ PRIMARY KEY (`id`),
 81+ KEY `stream_id` (`stream_id`,`time`)
 82+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='time to images table' AUTO_INCREMENT=0 ;
 83+
 84+-- --------------------------------------------------------
 85+
 86+--
 87+-- Table structure for table `mv_url_cache`
 88+--
 89+
 90+CREATE TABLE IF NOT EXISTS `mv_url_cache` (
 91+ `id` int(10) unsigned NOT NULL auto_increment,
 92+ `url` varchar(255) NOT NULL,
 93+ `post_vars` text,
 94+ `req_time` int(11) NOT NULL,
 95+ `result` text,
 96+ UNIQUE KEY `id` (`id`),
 97+ KEY `url` (`url`)
 98+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='simple url cache (as to not tax external services too much) ' AUTO_INCREMENT=10 ;
 99+
Index: trunk/extensions/MetavidWiki/maintenance/mv_update.php
@@ -0,0 +1,65 @@
 2+<?
 3+//eventually should fix to use mediaWiki format
 4+//for now just has little scripts for doing database operations
 5+
 6+//include commandLine.inc from the mediaWiki maintance dir:
 7+require_once ('../../../maintenance/commandLine.inc');
 8+
 9+$dbclass = 'Database' . ucfirst( $wgDBtype ) ;
 10+# Attempt to connect to the database as a privileged user
 11+# This will vomit up an error if there are permissions problems
 12+$wgDatabase = new $dbclass( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname, 1 );
 13+
 14+
 15+//do mvd_index text removal update:
 16+//check if mvd_index has text field
 17+$page_id_added=false;
 18+if(!$wgDatabase->fieldExists($mvIndexTableName, 'page_id')){
 19+ print "$mvIndexTableName missing `page_id`...adding\n ";
 20+ $page_id_added=true;
 21+ //add page_id
 22+ $wgDatabase->query("ALTER TABLE `$mvIndexTableName` ADD `mv_page_id` INT( 10 ) UNSIGNED NOT NULL AFTER `id`");
 23+}
 24+//if we added do lookups
 25+if($page_id_added){
 26+ $sql = "SELECT SQL_CALC_FOUND_ROWS `id`, `wiki_title` FROM `$mvIndexTableName`";
 27+ $result = $wgDatabase->query($sql);
 28+ echo 'updating '.$wgDatabase->numRows($result) . " mvd rows \n";
 29+ $c = $wgDatabase->numRows($result);
 30+ $i=$j=0;
 31+ $page_table = $wgDatabase->tableName( 'page' );
 32+ while($mvd_row = $wgDatabase->fetchObject( $result )){
 33+ $sql_pid = "SELECT `page_id` FROM $page_table " .
 34+ "WHERE `page_title`='{$mvd_row->wiki_title}' " .
 35+ "AND `page_namespace`=".MV_NS_MVD.' LIMIT 1';
 36+ $pid_res = $wgDatabase->query($sql_pid);
 37+ if($wgDatabase->numRows($pid_res)!=0){
 38+ $pid_row = $wgDatabase->fetchObject($pid_res);
 39+ $upSql = "UPDATE `$mvIndexTableName` SET `mv_page_id`=$pid_row->page_id " .
 40+ "WHERE `id`={$mvd_row->id} LIMIT 1";
 41+ $wgDatabase->query($upSql);
 42+ }else{
 43+ print "ERROR: mvd row:{$mvd_row->wiki_title} missing page\n ";
 44+ die;
 45+ }
 46+ //status updates:
 47+ if($i==100){
 48+ print "on $j of $c mvd rows\n";
 49+ $i=0;
 50+ }
 51+ $i++;
 52+ $j++;
 53+ }
 54+ //now we can drop id and add PRIMARY to mv_page_id
 55+ print "DROP id COLUMN from $mvIndexTableName ...";
 56+ $wgDatabase->query("ALTER TABLE `$mvIndexTableName` DROP PRIMARY KEY, DROP COLUMN `id`, DROP COLUMN `text`");
 57+ print "done\n";
 58+
 59+ //now add UNIQUE to mv_mvd_index
 60+ print "ADD PRIMARY to mv_page_id ...";
 61+ $wgDatabase->query("ALTER TABLE `$mvIndexTableName` ADD PRIMARY KEY(`mv_page_id`)");
 62+ print "done\n";
 63+
 64+}
 65+
 66+?>
\ No newline at end of file
Index: trunk/extensions/MetavidWiki/includes/MV_Index.php
@@ -107,7 +107,7 @@
108108 global $mvIndexTableName, $mvDefaultClipLength;
109109 $dbr =& wfGetDB(DB_SLAVE);
110110
111 - $sql = "SELECT `id`, `mvd_type`, `wiki_title`, `stream_id`, `start_time`, `end_time` " .
 111+ $sql = "SELECT `mv_page_id` as `id`, `mvd_type`, `wiki_title`, `stream_id`, `start_time`, `end_time` " .
112112 "FROM {$dbr->tableName($mvIndexTableName)} " .
113113 "WHERE `stream_id`={$stream_id} ";
114114 if($mvd_type!='all'){
@@ -145,7 +145,7 @@
146146 return true;
147147 }
148148 function doFiltersQuery(&$filters){
149 - global $mvIndexTableName, $mvDefaultClipLength, $wgRequest, $mvDo_SQL_CALC_FOUND_ROWS;
 149+ global $mvIndexTableName, $mvDefaultClipLength, $wgRequest, $mvDo_SQL_CALC_FOUND_ROWS, $mvSpokenByInSearchResult;
150150 $dbr =& wfGetDB(DB_SLAVE);
151151 //organize the queries (group full-text searches and category/attributes)
152152 //if the attribute is not a numerical just add it to the fulltext query
@@ -155,7 +155,8 @@
156156 $selOpt = ($mvDo_SQL_CALC_FOUND_ROWS)?'SQL_CALC_FOUND_ROWS':'';
157157
158158 list( $this->limit, $this->offset ) = $wgRequest->getLimitOffset( 20, 'searchlimit' );
159 -
 159+ //print_r($filters);
 160+ //print_r($_GET);
160161 foreach($filters as $f){
161162 //proocc and or for fulltext:
162163 if(!isset($f['a']))$f['a']='and';
@@ -195,6 +196,7 @@
196197 break;
197198 }
198199 }
 200+ $searchindexTable = $dbr->tableName( 'searchindex' );
199201 $ret_ary = array();
200202 //only run the top range query if we have no secondary query
201203 if($toplq!='' && $ftq==''){
@@ -203,18 +205,27 @@
204206 if($snq!='')$andstr.='AND';
205207 //@@todo we should only look in annotative layer for top level queries? ...
206208 //@@todo paging for top level queries? ... 100 stream limit is probably ok
207 - $sql = "SELECT `id`, `stream_id`,`start_time`,`end_time`, `wiki_title`, `text`
 209+ //@@ no spoken by attribute for 'anno_en' mvd_type
 210+ $sql = "SELECT `mv_page_id` as `id`, `stream_id`,`start_time`,`end_time`, `wiki_title`, $searchindexTable.`si_text` as `text`
208211 FROM `$mvIndexTableName`
 212+ JOIN $searchindexTable ON `$mvIndexTableName`.`mv_page_id` = $searchindexTable.`si_page`
209213 WHERE $snq $andstr `mvd_type`='Anno_en'
210 - AND MATCH (text)
 214+ AND MATCH ($searchindexTable.`si_text`)
211215 AGAINST('$toplq' IN BOOLEAN MODE)
212216 LIMIT 0, 100";
213 - //echo "topQ: $sql \n\n";
 217+ echo "topQ: $sql \n\n";
214218 $top_result = $dbr->query($sql);
215219 if($dbr->numRows($top_result)==0)return array();
216220 //set up ranges sql query
217 - $sql="SELECT $selOpt `id`, `stream_id`,`start_time`,`end_time`, `wiki_title`, `text`
218 - FROM `$mvIndexTableName` WHERE ";
 221+ $sql="SELECT $selOpt `mv_page_id` as `id`, `stream_id`,`start_time`,`end_time`, `wiki_title`, $searchindexTable.`si_text` as `text` ";
 222+ if($mvSpokenByInSearchResult)$sql.=",`smw_relations`.`object_title` as `spoken_by` ";
 223+ $sql.="FROM `$mvIndexTableName` " .
 224+ "JOIN $searchindexTable ON `$mvIndexTableName`.`mv_page_id` = $searchindexTable.`si_page` ";
 225+ if($mvSpokenByInSearchResult){
 226+ $sql.="LEFT JOIN `smw_relations` ON (`mv_mvd_index`.`mv_page_id`=`smw_relations`.`subject_id` " .
 227+ "AND `smw_relations`.`relation_title`='Spoken_By') ";
 228+ }
 229+ $sql.="WHERE ";
219230 $or='';
220231 $sql.='( ';
221232 while($row = $dbr->fetchObject( $top_result )){
@@ -239,16 +250,24 @@
240251 }else{
241252 //add the top query to the base query:
242253 $ftq.=$toplq;
243 - $sql = "SELECT $selOpt `id`,`stream_id`,`start_time`,`end_time`, `wiki_title`, `text`
244 - FROM `$mvIndexTableName`
245 - WHERE $snq ";
 254+ $sql = "SELECT $selOpt `mv_page_id` as `id`,`stream_id`,`start_time`,`end_time`, `wiki_title`, $searchindexTable.`si_text` AS `text` ";
 255+ if($mvSpokenByInSearchResult)$sql.=",`smw_relations`.`object_title` as `spoken_by` ";
 256+ $sql.="FROM `$mvIndexTableName`
 257+ JOIN $searchindexTable ON `$mvIndexTableName`.`mv_page_id` = $searchindexTable.`si_page` ";
 258+
 259+ //include spoken by relation in results (LEFT JOIN should not be *that* costly )
 260+ if($mvSpokenByInSearchResult){
 261+ $sql.="LEFT JOIN `smw_relations` ON (`mv_mvd_index`.`mv_page_id`=`smw_relations`.`subject_id` " .
 262+ "AND `smw_relations`.`relation_title`='Spoken_By') ";
 263+ }
 264+ $sql.="WHERE $snq ";
246265 if($ftq!=''){
247 - $sql.=" MATCH (text)
 266+ $sql.=" MATCH ( $searchindexTable.`si_text` )
248267 AGAINST('$ftq' IN BOOLEAN MODE) ";
249268 }
250269 $sql.="LIMIT {$this->offset}, {$this->limit} ";
251270 }
252 - //echo "SQL:".$sql;
 271+ echo "SQL:".$sql;
253272 $result = $dbr->query($sql);
254273
255274 $this->numResults=$dbr->numRows($result);
@@ -349,6 +368,28 @@
350369 }
351370 $ret_ary[$row->stream_id][]=$new_srange;
352371 }
 372+ function getMVDbyId($id, $fields='*'){
 373+ global $mvIndexTableName;
 374+ $dbr =& wfGetDB(DB_SLAVE);
 375+ $result = $dbr->select( $mvIndexTableName, $fields,
 376+ array('mv_page_id'=>$id) );
 377+ if($dbr->numRows($result)==0){
 378+ return array();
 379+ }else{
 380+ return $dbr->fetchObject( $result );
 381+ }
 382+ }
 383+ function getMVDbyTitle($title_key, $fields='*'){
 384+ global $mvIndexTableName;
 385+ $dbr =& wfGetDB(DB_SLAVE);
 386+ $result = $dbr->select( $mvIndexTableName, $fields,
 387+ array('wiki_title'=>$title_key) );
 388+ if($dbr->numRows($result)==0){
 389+ return null;
 390+ }else{
 391+ return $dbr->fetchObject( $result );
 392+ }
 393+ }
353394 function update_index_title($old_title, $new_title){
354395 global $mvIndexTableName;
355396
@@ -366,35 +407,13 @@
367408 $mvd_row = MV_Index::getMVDbyTitle( $old_title );
368409 $dbw =& wfGetDB(DB_WRITE);
369410 $dbw->update($mvIndexTableName, $update_ary,
370 - array('id'=>$mvd_row->id));
 411+ array('mv_page_id'=>$mvd_row->mv_page_id));
371412 }else{
372413 //print "NOT VALID MOVE";
373414 //@@todo better error handling (tyring to move a MVD data into bad request form)
374415 throw new MWException("Invalid Page name for MVD namespace \n");
375416 }
376417 }
377 - function getMVDbyId($id, $fields='*'){
378 - global $mvIndexTableName;
379 - $dbr =& wfGetDB(DB_SLAVE);
380 - $result = $dbr->select( $mvIndexTableName, $fields,
381 - array('id'=>$id) );
382 - if($dbr->numRows($result)==0){
383 - return array();
384 - }else{
385 - return $dbr->fetchObject( $result );
386 - }
387 - }
388 - function getMVDbyTitle($title_key, $fields='*'){
389 - global $mvIndexTableName;
390 - $dbr =& wfGetDB(DB_SLAVE);
391 - $result = $dbr->select( $mvIndexTableName, $fields,
392 - array('wiki_title'=>$title_key) );
393 - if($dbr->numRows($result)==0){
394 - return null;
395 - }else{
396 - return $dbr->fetchObject( $result );
397 - }
398 - }
399418 /*
400419 * update_index_page updates the `mv_mvd_index` table (on MVD namespace saves)
401420 */
@@ -412,8 +431,7 @@
413432 'mvd_type'=>$mvTitle->getTypeMarker(),
414433 'stream_id'=>$mvTitle->getStreamId(),
415434 'start_time'=>$mvTitle->getStartTimeSeconds(),
416 - 'end_time'=>$mvTitle->getEndTimeSeconds(),
417 - 'text'=> $text
 435+ 'end_time'=>$mvTitle->getEndTimeSeconds(),
418436 );
419437
420438 $dbw =& wfGetDB(DB_WRITE);
@@ -421,7 +439,7 @@
422440 return $dbw->insert( $mvIndexTableName , $insAry);
423441 }else{
424442 $dbw->update($mvIndexTableName, $insAry,
425 - array('id'=>$mvd_row->id));
 443+ array('mv_page_id'=>$mvd_row->mv_page_id));
426444 }
427445 }
428446 }
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php
@@ -221,13 +221,12 @@
222222 $mvd_out .='&nbsp;';
223223 $mvdTitle = Title::MakeTitle(MV_NS_MVD, $mvd->wiki_title);
224224 $mvd_out .= $sk->makeKnownLinkObj($mvdTitle, '<img border="0" src="' . $mvgScriptPath . '/skins/images/run_mediawiki.png">', '', '', '', '', ' title="' . wfMsg('mv_view_wiki_page') . '" ');
225 -
226 - //@@todo is it faster to hit the semantic media db or run the regEx ?
 225+
227226 $mvd_out.='<span id="mvr_desc_'.$mvd->id.'">';
228 - $smw_properties = MV_Overlay::get_and_strip_semantic_tags($mvd->text);
229 - if(isset($smw_properties['Spoken By'])){
230 - $ptitle = Title::MakeTitle(NS_MAIN, $smw_properties['Spoken By']);
231 - $mvd_out.=' '.$sk->makeKnownLinkObj($ptitle, $smw_properties['Spoken By']);
 227+
 228+ if(isset($mvd->spoken_by)){
 229+ $ptitle = Title::MakeTitle(NS_MAIN, $mvd->spoken_by);
 230+ $mvd_out.=' '.$sk->makeKnownLinkObj($ptitle, $mvd->spoken_by);
232231 }
233232 if(!isset($mvd->toplq))$mvd->toplq=false;
234233 //output short desc send partial regEx:
@@ -372,7 +371,7 @@
373372 //return "<li>{$link} ({$size}){$extract}</li>\n";
374373 return $extract;
375374 }
376 - //output expanded request with retired title text
 375+ //output expanded request via mvd_id
377376 function expand_wt($mvd_id, $terms_ary) {
378377 global $wgOut,$mvgIP;
379378 global $mvDefaultSearchVideoPlaybackRes;
@@ -386,7 +385,7 @@
387386
388387 list($vWidth, $vHeight) = explode('x', $mvDefaultSearchVideoPlaybackRes);
389388 $embedHTML='<span style="float:left;width:'.($vWidth+20).'px">' .
390 - $mvTitle->getEmbedVideoHtml($mvd_id, $mvDefaultSearchVideoPlaybackRes) .
 389+ $mvTitle->getEmbedVideoHtml('vid_'.$mvd_id, $mvDefaultSearchVideoPlaybackRes) .
391390 '</span>';
392391 $wgOut->clearHTML();
393392
@@ -488,7 +487,7 @@
489488 function getResultsBar(){
490489 $o='<div class="mv_result_bar">';
491490 if($this->numResultsFound){
492 - $re = ($this->numResultsFound < $this->limit+$this->offset)?$this->numResultsFound:($this->limit+$this->offset);
 491+ $re = ($this->limit+$this->offset > $this->numResultsFound)?$this->numResultsFound:($this->limit+$this->offset);
493492 $o.=wfMsg('mv_results_found_for',$this->offset,$re , number_format($this->numResultsFound));
494493 }
495494 $o.=$this->getFilterDesc();
Index: trunk/extensions/MetavidWiki/includes/MV_Title.php
@@ -24,7 +24,7 @@
2525
2626
2727 var $hasMVDType = false;
28 -
 28+ var $dispVideoPlayerTime=false;
2929 //a pointer to the mvStream
3030 var $mvStream = null;
3131 var $wiki_title='';
@@ -231,14 +231,19 @@
232232 $vid_id=($vid_id=='')?'':'id="'.$vid_id.'"';
233233 list($vWidth, $vHeight) = explode('x', $size);
234234 $stream_web_url = $this->getWebStreamURL();
235 - if($stream_web_url){
236 - return '<span id="mv_videoPlayerTime">'.$this->getStartTime().' to '.
237 - $this->getEndTime() .
238 - '</span>'.
239 - '<'.$tag.' '.$vid_id.' thumbnail="'.$this->getStreamImageURL($size, null, $force_server).'" '.
 235+ if($stream_web_url){
 236+ $o='';
 237+ if($this->dispVideoPlayerTime){
 238+ $o.='<span id="mv_videoPlayerTime">'.$this->getStartTime().' to '.
 239+ $this->getEndTime() .
 240+ '</span>';
 241+ }
 242+ $o.='<'.$tag.' '.$vid_id.' thumbnail="'.$this->getStreamImageURL($size, null, $force_server).'" '.
240243 'src="'.$stream_web_url .'" ' .
241244 'style="width:'.$vWidth.'px;height:'.$vHeight.'px" '.
242 - 'controls="true" embed_link="true" />';
 245+ 'controls="true" embed_link="true" />';
 246+
 247+ return $o;
243248 }else{
244249 return wfMsg('mv_error_stream_missing');
245250 }
Index: trunk/extensions/MetavidWiki/includes/MV_ImageGallery.php
@@ -52,7 +52,7 @@
5353
5454 //remap MVD namespace links into the Stream view (so contextual metadata is present)
5555 if($nt->getNamespace() == MV_NS_MVD ){
56 - $nt = Title::MakeTitle(MV_NS_STREAM,$mvTitle->getNearStreamName(0) );
 56+ $nt = Title::MakeTitle(MV_NS_STREAM,$mvTitle->getWikiTitle() );
5757 }
5858 $vidH = round($this->mWidths*$mvDefaultAspectRatio);
5959 $vidRes = $this->mWidths.'x'.$vidH;
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_SequenceTools.php
@@ -72,7 +72,7 @@
7373 $out.= $row->name.'|'.$streamTitle->getStreamNameText().
7474 '|'.$streamTitle->getStreamImageURL('icon') .
7575 '|'.$row->duration .
76 - '|'.$streamTitle->getEmbedVideoHtml('seq', $mvDefaultSearchVideoPlaybackRes, 'video', 'http://metavid.ucsc.edu/image_media/'). "\n";
 76+ '|'.$streamTitle->getEmbedVideoHtml('vid_seq', $mvDefaultSearchVideoPlaybackRes, 'video', 'http://metavid.ucsc.edu/image_media/'). "\n";
7777 }
7878 //$out.='</ul>';
7979 //return people people in the Person Category
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php
@@ -26,7 +26,8 @@
2727 $out='';
2828 //give the stream the request information:
2929 $mvTitle= & $this->mv_interface->article->mvTitle;
30 - //check if media is availible:
 30+ //check if media is availible:
 31+ $mvTitle->dispVideoPlayerTime=true;
3132 return $mvTitle->getEmbedVideoHtml('embed_vid');
3233 }
3334 function render_menu(){
Index: trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php
@@ -17,11 +17,18 @@
1818 //include the global functions & init the extension
1919 include_once('MV_GlobalFunctions.php');
2020
 21+##########################
 22+# semanticWiki integration options
 23+##########################
 24+//if you want to include spoken by relation in search results:
 25+$mvSpokenByInSearchResult = true;
2126
22 -######
 27+
 28+#########################
2329 # metavid paths
2430 # @@todo clean up with internal handlers for annodex and images
2531 # use the mediaWiki defaults for storage of media
 32+##########################
2633
2734 //define the image location:
2835 //$mvImageWebLoc ='http://metavid.ucsc.edu/image_media/';
Index: trunk/extensions/MetavidWiki/languages/MV_Messages.php
@@ -19,7 +19,7 @@
2020 'mv_ogg_high_quality' => 'High Quality ogg theora, hosted on metavid',
2121 'mv_archive_org_link' => 'Links into Archive.org mpeg2 originals',
2222
23 - 'mv_error_stream_missing' => '<span class="error">Error: There is no video stream associated with this metadata.</span><br />Please report this to the site administrator.<br /><i>stream metadata interface is disabled</i>',
 23+ 'mv_error_stream_missing' => '<span class="error">Error: There is no video file associated with this stream.</span><br />Please report this to the site administrator.',
2424
2525 #add/edit stream text:
2626 'mv_stream_meta' => 'Stream Page',
Index: trunk/extensions/MetavidWiki/skins/mv_search.js
@@ -56,6 +56,17 @@
5757 }));
5858 //update the input name:
5959 $j('#mv_person_input_'+inx).attr('name', 'f['+inx+'][v]');
 60+ //for more logical default behavior:
 61+ //default to OR if any other "spoken by" are present in list else AND
 62+ var default_sel_inx=0;
 63+ $j('.mv_search_select').each(function(){
 64+ if(this.id!='mvsel_t_'+inx){
 65+ if(this.value=='spoken_by'){
 66+ default_sel_inx=1; //set to OR
 67+ }
 68+ }
 69+ })
 70+ $j('#mvsel_a_'+inx).get(0).selectedIndex=default_sel_inx;
6071 mv_add_person_ac(inx);
6172 break;
6273 case 'smw_property':

Status & tagging log