r30816 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r30815‎ | r30816 | r30817 >
Date:02:14, 11 February 2008
Author:dale
Status:old
Tags:
Comment:
interface and scraper enhancements
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Component.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_MetavidInterface.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Tools.php (modified) (history)
  • /trunk/extensions/MetavidWiki/languages/MV_Messages.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_stream.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php
@@ -29,6 +29,7 @@
3030 <pre>{{Bill|
3131 GovTrackID=The GovTrack Bill ID (used to key-into GovTracks Bill info)|
3232 ThomasID=The bill\'s Tomas id (used for Thomas linkback)|
 33+Title Description=The short title/description of the bill|
3334 Date Introduced=The date the bill was introduced|
3435 Session=The session of congress (110 for 2007-08) |
3536 Bill Key=The short bill name ie: H.R. #|
@@ -36,15 +37,18 @@
3738 Cosponsor #= Where # is 1-70 for listing all cosponsors|
3839 }}</pre>The template name (Bill) should be given as the \'\'first\'\' thing on a page. The Cosponsored list should come at the end.
3940 </noinclude><includeonly>
40 -==Bill [[Bill Key:={{{Bill Key}}}]] in the {{ #if: {{{Session|}}}| [[Congress Session:={{{Session}}}]] |}}th of Congress==
 41+==Bill [[Bill Key:={{{Bill Key}}}]] in the {{ #if: {{{Session|}}}| [[Congress Session:={{{Session}}}]] |}} of Congress==
 42+{{ #if: {{{Title Description|}}}|{{{Title Description}}} |}}
 43+
 44+<span style="background:#eee">{{ #if: {{{Bill Key|}}}| Media tagged/categorized with [[:Category:{{{Bill Key}}}]] |}}</span>
4145 {{ #if: {{{Date Introduced|}}}|* Date Introduced: [[Date Bill Introduced:={{{Date Introduced}}}]] |}}
4246 {{ #if: {{{Sponsor|}}}|* Sponsor: [[Bill Sponsor:={{{Sponsor}}}]] |}}
4347 {{ #if: {{{Cosponsor 1|}}}|* Cosponsor: [[Bill Cosponsor:={{{Cosponsor 1}}}]] |}}{{ #if: {{{Cosponsor 2|}}}|, [[Bill Cosponsor:={{{Cosponsor 2}}}]] |}}{{ #if: {{{Cosponsor 3|}}}|, [[Bill Cosponsor:={{{Cosponsor 3}}}]] |}}{{ #if: {{{Cosponsor 4|}}}|, [[Bill Cosponsor:={{{Cosponsor 4}}}]] |}}{{ #if: {{{Cosponsor 5|}}}|, [[Bill Cosponsor:={{{Cosponsor 5}}}]] |}}{{ #if: {{{Cosponsor 6|}}}|, [[Bill Cosponsor:={{{Cosponsor 6}}}]] |}}{{ #if: {{{Cosponsor 7|}}}|, [[Bill Cosponsor:={{{Cosponsor 7}}}]] |}}{{ #if: {{{Cosponsor 8|}}}|, [[Bill Cosponsor:={{{Cosponsor 8}}}]] |}}{{ #if: {{{Cosponsor 9|}}}|, [[Bill Cosponsor:={{{Cosponsor 9}}}]] |}}{{ #if: {{{Cosponsor 10|}}}|, [[Bill Cosponsor:={{{Cosponsor 10}}}]] |}}{{ #if: {{{Cosponsor 11|}}}|, [[Bill Cosponsor:={{{Cosponsor 11}}}]] |}}{{ #if: {{{Cosponsor 12|}}}|, [[Bill Cosponsor:={{{Cosponsor 12}}}]] |}}{{ #if: {{{Cosponsor 13|}}}|, [[Bill Cosponsor:={{{Cosponsor 13}}}]] |}}{{ #if: {{{Cosponsor 14|}}}|, [[Bill Cosponsor:={{{Cosponsor 14}}}]] |}}{{ #if: {{{Cosponsor 15|}}}|, [[Bill Cosponsor:={{{Cosponsor 15}}}]] |}}{{ #if: {{{Cosponsor 16|}}}|, [[Bill Cosponsor:={{{Cosponsor 16}}}]] |}}{{ #if: {{{Cosponsor 17|}}}|, [[Bill Cosponsor:={{{Cosponsor 17}}}]] |}}{{ #if: {{{Cosponsor 18|}}}|, [[Bill Cosponsor:={{{Cosponsor 18}}}]] |}}{{ #if: {{{Cosponsor 19|}}}|, [[Bill Cosponsor:={{{Cosponsor 19}}}]] |}}{{ #if: {{{Cosponsor 20|}}}|, [[Bill Cosponsor:={{{Cosponsor 20}}}]] |}}{{ #if: {{{Cosponsor 21|}}}|, [[Bill Cosponsor:={{{Cosponsor 21}}}]] |}}{{ #if: {{{Cosponsor 22|}}}|, [[Bill Cosponsor:={{{Cosponsor 22}}}]] |}}{{ #if: {{{Cosponsor 23|}}}|, [[Bill Cosponsor:={{{Cosponsor 23}}}]] |}}{{ #if: {{{Cosponsor 24|}}}|, [[Bill Cosponsor:={{{Cosponsor 24}}}]] |}}{{ #if: {{{Cosponsor 25|}}}|, [[Bill Cosponsor:={{{Cosponsor 25}}}]] |}}{{ #if: {{{Cosponsor 26|}}}|, [[Bill Cosponsor:={{{Cosponsor 26}}}]] |}}{{ #if: {{{Cosponsor 27|}}}|, [[Bill Cosponsor:={{{Cosponsor 27}}}]] |}}{{ #if: {{{Cosponsor 28|}}}|, [[Bill Cosponsor:={{{Cosponsor 28}}}]] |}}{{ #if: {{{Cosponsor 29|}}}|, [[Bill Cosponsor:={{{Cosponsor 29}}}]] |}}{{ #if: {{{Cosponsor 30|}}}|, [[Bill Cosponsor:={{{Cosponsor 30}}}]] |}}{{ #if: {{{Cosponsor 31|}}}|, [[Bill Cosponsor:={{{Cosponsor 31}}}]] |}}{{ #if: {{{Cosponsor 32|}}}|, [[Bill Cosponsor:={{{Cosponsor 32}}}]] |}}{{ #if: {{{Cosponsor 33|}}}|, [[Bill Cosponsor:={{{Cosponsor 33}}}]] |}}{{ #if: {{{Cosponsor 34|}}}|, [[Bill Cosponsor:={{{Cosponsor 34}}}]] |}}{{ #if: {{{Cosponsor 35|}}}|, [[Bill Cosponsor:={{{Cosponsor 35}}}]] |}}{{ #if: {{{Cosponsor 36|}}}|, [[Bill Cosponsor:={{{Cosponsor 36}}}]] |}}{{ #if: {{{Cosponsor 37|}}}|, [[Bill Cosponsor:={{{Cosponsor 37}}}]] |}}{{ #if: {{{Cosponsor 38|}}}|, [[Bill Cosponsor:={{{Cosponsor 38}}}]] |}}{{ #if: {{{Cosponsor 39|}}}|, [[Bill Cosponsor:={{{Cosponsor 39}}}]] |}}{{ #if: {{{Cosponsor 40|}}}|, [[Bill Cosponsor:={{{Cosponsor 40}}}]] |}}{{ #if: {{{Cosponsor 41|}}}|, [[Bill Cosponsor:={{{Cosponsor 41}}}]] |}}{{ #if: {{{Cosponsor 42|}}}|, [[Bill Cosponsor:={{{Cosponsor 42}}}]] |}}{{ #if: {{{Cosponsor 43|}}}|, [[Bill Cosponsor:={{{Cosponsor 43}}}]] |}}{{ #if: {{{Cosponsor 44|}}}|, [[Bill Cosponsor:={{{Cosponsor 44}}}]] |}}{{ #if: {{{Cosponsor 45|}}}|, [[Bill Cosponsor:={{{Cosponsor 45}}}]] |}}{{ #if: {{{Cosponsor 46|}}}|, [[Bill Cosponsor:={{{Cosponsor 46}}}]] |}}{{ #if: {{{Cosponsor 47|}}}|, [[Bill Cosponsor:={{{Cosponsor 47}}}]] |}}{{ #if: {{{Cosponsor 48|}}}|, [[Bill Cosponsor:={{{Cosponsor 48}}}]] |}}{{ #if: {{{Cosponsor 49|}}}|, [[Bill Cosponsor:={{{Cosponsor 49}}}]] |}}{{ #if: {{{Cosponsor 50|}}}|, [[Bill Cosponsor:={{{Cosponsor 50}}}]] |}}{{ #if: {{{Cosponsor 51|}}}|, [[Bill Cosponsor:={{{Cosponsor 51}}}]] |}}{{ #if: {{{Cosponsor 52|}}}|, [[Bill Cosponsor:={{{Cosponsor 52}}}]] |}}{{ #if: {{{Cosponsor 53|}}}|, [[Bill Cosponsor:={{{Cosponsor 53}}}]] |}}{{ #if: {{{Cosponsor 54|}}}|, [[Bill Cosponsor:={{{Cosponsor 54}}}]] |}}{{ #if: {{{Cosponsor 55|}}}|, [[Bill Cosponsor:={{{Cosponsor 55}}}]] |}}{{ #if: {{{Cosponsor 56|}}}|, [[Bill Cosponsor:={{{Cosponsor 56}}}]] |}}{{ #if: {{{Cosponsor 57|}}}|, [[Bill Cosponsor:={{{Cosponsor 57}}}]] |}}{{ #if: {{{Cosponsor 58|}}}|, [[Bill Cosponsor:={{{Cosponsor 58}}}]] |}}{{ #if: {{{Cosponsor 59|}}}|, [[Bill Cosponsor:={{{Cosponsor 59}}}]] |}}{{ #if: {{{Cosponsor 60|}}}|, [[Bill Cosponsor:={{{Cosponsor 60}}}]] |}}{{ #if: {{{Cosponsor 61|}}}|, [[Bill Cosponsor:={{{Cosponsor 61}}}]] |}}{{ #if: {{{Cosponsor 62|}}}|, [[Bill Cosponsor:={{{Cosponsor 62}}}]] |}}{{ #if: {{{Cosponsor 63|}}}|, [[Bill Cosponsor:={{{Cosponsor 63}}}]] |}}{{ #if: {{{Cosponsor 64|}}}|, [[Bill Cosponsor:={{{Cosponsor 64}}}]] |}}{{ #if: {{{Cosponsor 65|}}}|, [[Bill Cosponsor:={{{Cosponsor 65}}}]] |}}{{ #if: {{{Cosponsor 66|}}}|, [[Bill Cosponsor:={{{Cosponsor 66}}}]] |}}{{ #if: {{{Cosponsor 67|}}}|, [[Bill Cosponsor:={{{Cosponsor 67}}}]] |}}{{ #if: {{{Cosponsor 68|}}}|, [[Bill Cosponsor:={{{Cosponsor 68}}}]] |}}{{ #if: {{{Cosponsor 69|}}}|, [[Bill Cosponsor:={{{Cosponsor 69}}}]] |}}
4448
4549
4650 ==External Sources==
47 -{{ #if: {{{ThomasID|}}}|* Thomas Official Information:[http://thomas.loc.gov/cgi-bin/bdquery/z?{{{ThomasID}}}] [[Thomas Bill ID:={{{ThomasID}}}| ]] |}}
48 -{{ #if: {{{GovTrackID|}}}|* GovTrack Bill Overview:[http://www.govtrack.us/congress/bill.xpd?bill={{{GovTrackID}}}:] [[GovTrack Bill ID:={{{GovTrackID}}}| ]] |}}
 51+{{ #if: {{{ThomasID|}}}|* Thomas Official Information:[http://thomas.loc.gov/cgi-bin/bdquery/z?{{{ThomasID}}}:] [[Thomas Bill ID:={{{ThomasID}}}| ]] |}}
 52+{{ #if: {{{GovTrackID|}}}|* GovTrack Bill Overview:[http://www.govtrack.us/congress/bill.xpd?bill={{{GovTrackID}}}] [[GovTrack Bill ID:={{{GovTrackID}}}| ]] |}}
4953 [[Category:Bill]]
5054 </includeonly>
5155 ');
Index: trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.php
@@ -50,7 +50,7 @@
5151 var $base_query = '?q=node/69850';
5252 //swich on letter types:
5353 var $bill_types = array('H.J.RES.'=>'hj', 'H.R.'=>'h', 'H.RES.'=>'hr',
54 - 'S.'=>'s', 'S.CON.RES.'=>'sc', 'S.J.RES'=>'sj', 'S.RES.1'=>'sr');
 54+ 'S.CON.RES.'=>'sc', 'S.J.RES'=>'sj', 'S.RES.1'=>'sr', 'S.'=>'s');
5555
5656 var $govTrack_bill_url ='http://www.govtrack.us/congress/bill.xpd?bill=';
5757 function procArguments(){
@@ -314,8 +314,12 @@
315315 print "Get Additonal C-SPAN Data For \"synced\" Data:\n";
316316 foreach($cspan_person_ary as $pData){
317317 if(isset($pData['wiki_start_time'])){
318 - //print_r($pData);
 318+ //init:
319319 $bill_categories=array();
 320+ $annotate_body ='';
 321+ $body='';
 322+ $bill_key=null;
 323+
320324 $rawpage = $this->doRequest($this->base_url . $pData['href']);
321325 //$rawpage = $this->doRequest('http://www.c-spanarchives.org/congress/?q=node/77531&id=8330447');
322326
@@ -328,20 +332,19 @@
329333 //print_r($page_matches);
330334 }else{
331335 die("error can't find title or body\n");
332 - }
333 -
 336+ }
334337 //do debate tag search:
335338 preg_match('/<td colspan="2">Debate:\s<[^>]*>([^<]*)/', $rawpage, $debate_matches);
336339 if(isset($debate_matches[1])){
337340 $bill_key = trim($debate_matches[1]);
338 - print "found debate: tag " .$bill_key."\n";
339 - $bill_categories[$bill_key]=$bill_key;
 341+ print "found debate: tag " .$bill_key."\n";
340342 //build gov-track-congress-session friendly debate url:
341 - $this->get_and_proccess_govtrack_billid($bill_key,$stream->date_start_time);
342 -
 343+ if($this->get_and_proccess_govtrack_billid($bill_key,$stream->date_start_time)!=null){
 344+ $bill_categories[$bill_key]=$bill_key;
 345+ }
343346 }
344 - $annotate_body ='';
345 - $annotate_body.='Speach By: [[Speach by:='.str_replace('_',' ',$pData['Spoken_by']).']] ';
 347+
 348+ $annotate_body.='Speech By: [[Speech by:='.str_replace('_',' ',$pData['Spoken_by']).']] ';
346349 //title fix hack for C-span error motion to procceed
347350 //@@todo add in the rest of the motions:
348351 if(strpos($title,'MOTION TO PROCEED')!==false){
@@ -370,20 +373,29 @@
371374 $bill_pattern.='/i';//case insensative
372375 //$body='bla bla H.R. 3453 test S. 3494 some more text';
373376 //print "pattern:".$bill_pattern . "\n";
374 - preg_match_all($bill_pattern, $body, $bill_matches);
375 - //print_r($bill_matches);
 377+ preg_match_all($bill_pattern, $body, $bill_matches);
376378 if(isset($bill_matches[1])){
377 - foreach($bill_matches as$k=> $bill_type_ary){
 379+ foreach($bill_matches as $k=> $bill_type_ary){
378380 if($k!=0){
379 - if(isset($bill_type_ary[0])){
380 - $bill_categories[$bill_type_ary[0]]=str_replace(' ','',$bill_type_ary[0]);
 381+ if(isset($bill_type_ary[0])){
 382+ $bill_name =$bill_type_ary[0];
381383 }else if(isset($bill_type_ary[1])){
382 - $bill_categories[$bill_type_ary[1]]=str_replace(' ','',$bill_type_ary[1]);
 384+ $bill_name=$bill_type_ary[1];
 385+ }else{
 386+ continue;
 387+ }
 388+ //if the first letter is lower case not likely a bill
 389+ if(islower($bill_name[0]))continue;
 390+ //conform white space and case:
 391+ $bill_name=str_replace(array('S. ','Con. ', 'Res. '),array('S.', 'CON.', 'RES. '),$bill_name);
 392+ //make sure its not a false possitave and load bill data from govTrack:
 393+ if($this->get_and_proccess_govtrack_billid($bill_name,$stream->date_start_time)){
 394+ $bill_categories[$bill_name]=$bill_name;
383395 }
384396 }
385397 }
386398 }
387 -
 399+
388400 $body = preg_replace($bill_pattern_ary, '[[Mentions Bill:=$0]]', $body);
389401 //print "BODY: $body";
390402
@@ -407,6 +419,7 @@
408420 // but the db allows multiples separated by commas.
409421 $mRestrictions[$action] = implode( '', $cspanTitle->getRestrictions( $action ) );
410422 }
 423+
411424 $article = new Article($cspanTitle);
412425 $mRestrictions['edit']['sysop']=true;
413426 $expiry = Block::infinity();
@@ -420,16 +433,16 @@
421434 print "failed to update restrictions\n";
422435 }
423436
424 -
425437 //proccess each bill to the annotation body;
426438 $bcat='';
427439 $bill_lead_in ="\n\nBill ";
 440+ //print_r($bill_categories);
428441 foreach($bill_categories as $bill){
429 - if(trim($bill)!=''){
430 - $this->get_and_proccess_govtrack_billid($bill,$stream->date_start_time);
 442+ if(trim($bill)!=''){
 443+ //use short title for category and long title for semantic link... (highly arbitrary)
431444 $annotate_body.=$bill_lead_in.'[[Bill:='.$this->cur_bill_short_title.']] ';
432445 $bill_lead_in=' , ';
433 - $bcat.="[[Category:$bill]] ";
 446+ $annotate_body.="[[Category:$bill]] ";
434447 }
435448 }
436449 if(trim($title)!=''){
@@ -446,7 +459,7 @@
447460 //[Page: S14580] replaced with: [[Category:BillName]]
448461 //would be good to link into the official record for "pages"
449462
450 - //[[speach by:=name]]
 463+ //[[Speech by:=name]]
451464 //[[category:=title]]
452465
453466 //for documentation:
@@ -489,13 +502,16 @@
490503 $bill_key = trim($bill_key);
491504 if(substr($bill_key, 0,strlen($cspanT))==$cspanT){
492505 $govTrackBillId= $govtrakT.$session.'-'.trim(substr($bill_key,strlen($cspanT)));
 506+ break;
493507 }
494508 }
 509+ print "GOT bill id: $govTrackBillId from $bill_key\n";
495510 if($govTrackBillId){
496511 $this->proccessGovTrackBill($govTrackBillId, $bill_key);
497 - $this->govTrackBillId= $govTrackBillId;
 512+ $this->govTrackBillId= $govTrackBillId;
 513+ return $this->govTrackBillId;
498514 }else{
499 - print 'error in getting govTrack bill id on: '. $bill_key . "\n";
 515+ print 'error in getting govTrack bill id on: '. $bill_key . " (skiped)\n";
500516 return null;
501517 }
502518 }
@@ -510,7 +526,7 @@
511527
512528 preg_match('/property="dc:title" datatype="xsd:string" style="margin-bottom: 1em">([^<]*)<\/div><p style="margin-top: 1.75em; margin-bottom: 1.75em">([^<]*)/',$rawGovTrackPage, $title_match);
513529 if(isset($title_match[1])){
514 - $title_short = str_replace('_',' ',$title_match[1]);
 530+ $title_short = str_replace(array('_','...'),array(' ',''),$title_match[1]);
515531 $this->cur_bill_short_title=$title_short;
516532 $title_desc = $title_match[2];
517533 }else{
@@ -540,7 +556,7 @@
541557 $bp = "{{Bill|\n".
542558 'GovTrackID='.$govTrackBillId."|\n";
543559 if(isset($thomas_match[1]))$bp.='ThomasID='.$thomas_match[1]."|\n";
544 - if(isset($this->cur_session))$bp.='Session='.$this->cur_session."|\n";
 560+ if(isset($this->cur_session))$bp.='Session='.$this->cur_session."th session|\n";
545561 $bp.='Bill Key='.$bill_key."|\n";
546562 if(isset($date_intro_match[1]))$bp.='Date Introduced='.$date_intro_match[1]."|\n";
547563 if($title_desc){
@@ -557,6 +573,7 @@
558574 }
559575 }
560576 $bp.="}}\n";
 577+ $body.="\n\n".'Source: [[Data Source Name:=GovTrack]] [[Data Source URL:='.$this->govTrack_bill_url . $govTrackBillId.']]';
561578 //set up the base bill page:
562579 $wgBillTitle = Title::newFromText($title_short);
563580 do_update_wiki_page($wgBillTitle, $bp);
@@ -565,7 +582,7 @@
566583 do_update_wiki_page($wgBillKeyTitle, '#REDIRECT [['.$title_short.']]');
567584 //set up link on the category page:
568585 $wgCatPageTitle =Title::newFromText($bill_key, NS_CATEGORY);
569 - do_update_wiki_page($wgCatPageTitle, 'Also see [[:'.$wgBillTitle->getText().']]');
 586+ do_update_wiki_page($wgCatPageTitle, 'See Bill Page For More Info: [[:'.$wgBillTitle->getText().']]');
570587 }
571588 function get_wiki_name_from_govid($govID){
572589 if(!isset($this->govTrack_cache)){
@@ -578,7 +595,7 @@
579596 }
580597 if(!isset($this->govTrack_cache[$govID])){
581598 $wgTitle = Title::newFromText('CongressVid:Missing_People');
582 - append_to_wiki_page($wgTitle, "Missing GovTrack person: [http://www.govtrack.us/congress/person.xpd?id=$govID $govID] \n\n");
 599+ append_to_wiki_page($wgTitle, "Missing GovTrack person: [http://www.govtrack.us/congress/person.xpd?id=$govID $govID]");
583600 return false;
584601 }
585602 return str_replace('_',' ',$this->govTrack_cache[$govID]);
Index: trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php
@@ -57,7 +57,7 @@
5858 return;
5959 }
6060 }
61 - $cur_text.=$append_text;
 61+ $cur_text.="\n\n".$append_text;
6262 //do the edit:
6363 $sum_txt = 'metavid append';
6464 $wgArticle->doEdit($cur_text, $sum_txt);
@@ -78,7 +78,7 @@
7979
8080 $wgArticle = new Article($wgTitle);
8181 if(!mvDoMvPage($wgTitle, $wgArticle, false)){
82 - print "bad title: ".$wgTitle->getDBkey()." no edit";
 82+ print "bad title: ".$wgTitle->getNsText() .':'.$wgTitle->getDBkey()." no edit";
8383 if($wgTitle->exists()){
8484 print "remove article";
8585 $wgArticle->doDeleteArticle( 'bad title' );
@@ -95,7 +95,7 @@
9696 //if last edit!=mvBot skip (don't overwite peoples improvments')
9797 $rev = & Revision::newFromTitle($wgTitle);
9898 if( $botUserName!= $rev->getRawUserText()){
99 - print ' skiped page ' .$wgTitle->getText(). ' edited by user:'.$rev->getRawUserText()." != $botUserName \n";
 99+ print ' skiped page ' .$wgTitle->getNsText() .':'.$wgTitle->getText(). ' edited by user:'.$rev->getRawUserText()." != $botUserName \n";
100100 if(!$forceUpdate)return ;
101101 }
102102 //proc article:
@@ -107,14 +107,15 @@
108108 }
109109 //check if text is identical:
110110 if (trim($cur_text) == trim($wikiText)) {
111 - print "text " .$wgTitle->getText() ." is identical (no update)\n";
 111+ print "text " .$wgTitle->getNsText() .':'.$wgTitle->getText() ." is identical (no update)\n";
112112 if(!$forceUpdate)return ;
113113 }
114114 }
115115 //got here do the edit:
116116 $sum_txt = 'metavid bot insert';
117117 $wgArticle->doEdit($wikiText, $sum_txt);
118 - print "did edit on " . $wgTitle->getDBkey() . "\n";
 118+ print "did edit on ". $wgTitle->getNsText() .':'. $wgTitle->getDBkey() . "\n";
119119 //die;
120120 }
 121+function islower($i) { return (strtolower($i) === $i);}
121122 ?>
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_MetavidInterface.php
@@ -77,12 +77,7 @@
7878 $this->components['MV_Overlay']->setReq('Recentchanges');
7979 }*/
8080 function setupStreamView(){
81 - global $mvgIP, $mvDefaultStreamViewLength, $wgOut,$mvgScriptPath,$wgUser;
82 - //add in full title var:
83 - $wgOut->addScript("<script type=\"text/javascript\">".'/*<![CDATA[*/'."
84 - var mvTitle = '{$this->article->mvTitle->getWikiTitle()}'; \n".
85 - '/*]]>*/</script>'."\n");
86 -
 81+ global $mvgIP, $mvDefaultStreamViewLength, $wgOut,$mvgScriptPath,$wgUser;
8782 //set default time range if null time range request
8883 $this->article->mvTitle->setStartEndIfEmpty(
8984 seconds2ntp(0),
@@ -93,7 +88,15 @@
9489 $this->components[$cp_name] = new $cp_name(
9590 array('mv_interface'=>&$this)
9691 );
97 - }
 92+ }
 93+ //proccess track request:
 94+ $this->components['MV_Overlay']->procMVDReqSet();
 95+ //add in title & tracks var:
 96+ $wgOut->addScript('<script type="text/javascript">/*<![CDATA[*/'."
 97+ var mvTitle = '{$this->article->mvTitle->getWikiTitle()}';
 98+ var mvTracks = '".$this->components['MV_Overlay']->getMVDReqString(). '\';
 99+ /*]]>*/</script>'."\n");
 100+
98101 //also add prev next pagging
99102 $this->page_header ='<span style="position:relative;top:-12px;font-weight:bold">'.
100103 $this->article->mvTitle->getStreamNameText().
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Tools.php
@@ -10,7 +10,8 @@
1111 if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
1212 global $mvgIP;
1313 require_once($mvgIP . '/includes/MV_MetavidInterface/MV_Component.php');
14 - class MV_Tools extends MV_Component{
 14+ class MV_Tools extends MV_Component{
 15+ var $mv_valid_tools = array('mang_layers','search','navigate','export','embed','overlay');
1516 function getHTML(){
1617 global $wgOut;
1718 //@@todo look at mv_interface context to get what to display in tool box:
@@ -61,6 +62,9 @@
6263 $this->innerHTML = $wgOut->getHTML();
6364 }
6465 break;
 66+ case 'mang_layers':
 67+ $this->innerHTML = $this->get_mang_layers_page($title_str);
 68+ break;
6569 case 'search':
6670 $title = Title::newFromText($title_str, MV_NS_STREAM);
6771 //render search box
@@ -103,6 +107,7 @@
104108 return '<a href="javascript:mv_tool_disp(\'stream_page\')">'.wfMsg('mv_stream_meta').'</a>' .' | '.
105109 '<a href="javascript:mv_tool_disp(\'menu\')">'.wfMsg('mv_stream_tool_heading').'</a>';
106110 }
 111+
107112 /* outputs basic stream paging (this could be done client side) */
108113 function stream_paging_links($return_set='both'){
109114 global $wgUser, $mvDefaultStreamViewLength,$mvgScriptPath;
@@ -140,12 +145,11 @@
141146 * @@todo better integration with wiki
142147 * (ie tool listing should be a page like navigationBar or in our case MvStreamTools
143148 */
144 - function getToolsListing(){
145 - $mv_valid_tools = array('search','navigate','export','embed','overlay');
 149+ function getToolsListing(){
146150 $out='';
147151 $heading=wfMsg('mv_stream_tool_heading') . ':';
148152 $out.='<ul>';
149 - foreach($mv_valid_tools as $tool_id){
 153+ foreach($this->mv_valid_tools as $tool_id){
150154 $out.='<li><a title="'.wfMsg('mv_tool_'.$tool_id.'_title').
151155 '" href="javascript:mv_tool_disp(\''.$tool_id.'\')">' .
152156 wfMsg('mv_tool_'.$tool_id) . '</li>'."\n";
@@ -183,6 +187,21 @@
184188 <a href="javascript:tool_disp(\'overlay\')>Overlay Set</a><br>
185189 ';*/
186190 }
 191+ //returns layers overview text
 192+ function get_mang_layers_page($stream_title){
 193+ global $mvMVDTypeAllAvailable;
 194+ $out='<h3>'.wfMsg('mv_tool_mang_layers').'</h3>';
 195+ //grab the current track set:
 196+ $this->procMVDReqSet();
 197+ foreach($mvMVDTypeAllAvailable as $type_key){
 198+ //@@todo use something better than "title" for type_key description
 199+ $checked = (in_array($type_key, $this->mvd_tracks))?' checked':'';
 200+ $out.='<input type="checkbox" name="option_'.$type_key.'" id="option_'.$type_key.'" value="'.$type_key.'" '.$checked.'/> '.
 201+ '<a class="mv_mang_layers" id="a_'.$type_key.'" title="'.wfMsg($type_key.'_desc').'" href="#">'.wfMsg($type_key).'</a><br>';
 202+ }
 203+ $out.='<input id="submit_mang_layers" type="submit" value="'.wfMsg('mv_update_layers').'">';
 204+ return $out;
 205+ }
187206 function get_nav_page($stream_title){
188207 global $mvgIP;
189208 //output sliders for stream navigation:
@@ -194,15 +213,12 @@
195214 $stream = new MV_Stream(array('name'=>$stream_title));
196215 //$out.= "sn: ". $stream->name . '<br>';
197216 $duration = $stream->getDuration();
198 - //$out.=" duration: $duration";
199 -
200 - include_once($mvgIP. '/includes/MV_MetavidInterface/MV_Overlay.php');
 217+ //$out.=" duration: $duration";
201218 $MvOverlay = new MV_Overlay();
202219
203220 $titleKey = 'mvd_type:'.ucfirst($stream_title).'/'.$_REQUEST['time_range'];
204221 $out.= $MvOverlay->get_adjust_disp($titleKey, 'nav');
205 - $out.='<input type="button" id="mv_go_nav" value="Go">';
206 -
 222+ $out.='<input type="button" id="mv_go_nav" value="Go">';
207223 //set range:
208224 $this->js_eval = "var end_time = {$duration};";
209225 return $out;
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php
@@ -44,33 +44,7 @@
4545 $this->get_transcript_pages();
4646 $wgOut->addHTML("</div>");
4747 }
48 - //proccess the request set (load from settings if not set in url
49 - //@@todo would be good to allow user-set prefrence in the future)
50 - //@@todo might have to abstract to inteface or component level (since will be used in multiple places)
51 - function procMVDReqSet(){
52 - global $wgRequest;
53 - global $mvMVDTypeDefaultDisp, $mvMVDTypeAllAvailable;
54 - $user_tracks = $wgRequest->getVal('mvd_tracks');
55 - //print "USER TRACKS: " . $user_tracks;
56 - if($user_tracks!=''){
57 - $user_set = explode(',',$user_tracks);
58 - foreach($user_set as $tk){
59 - if(in_array($tk, $mvMVDTypeAllAvailable)){
60 - $this->mvd_tracks[]= $tk;
61 - }
62 - }
63 - }else{
64 - //do reality check on settings:
65 - foreach($mvMVDTypeDefaultDisp as $tk){
66 - if(!in_array($tk, $mvMVDTypeAllAvailable)){
67 - global $wgOut;
68 - $wgOut->errorPage('mvd_default_mismatch','mvd_default_mismatchtext');
69 - }
70 - }
71 - //just set to global default:
72 - $this->mvd_tracks = $mvMVDTypeDefaultDisp;
73 - }
74 - }
 48+
7549 function render_menu(){
7650 $base_title='';
7751 //set the base title to the stream name:
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Component.php
@@ -16,12 +16,43 @@
1717 var $innerHTML ='';
1818 var $js_eval=false;
1919 var $req = '';
 20+ var $mvd_tracks=array();
2021
2122 function __construct($init=array()){
2223 foreach($init as $k=>$v){
2324 $this->$k=$v;
2425 }
2526 }
 27+ //proccess the request set (load from settings if not set in url
 28+ //@@todo would be good to allow user-set prefrence in the future)
 29+ function procMVDReqSet(){
 30+ global $wgRequest;
 31+ global $mvMVDTypeDefaultDisp, $mvMVDTypeAllAvailable;
 32+ if(count($this->mvd_tracks)!=0)return $this->mvd_tracks;
 33+ $user_tracks = $wgRequest->getVal('tracks');
 34+ //print "USER TRACKS: " . $user_tracks;
 35+ if($user_tracks!=''){
 36+ $user_set = explode(',',$user_tracks);
 37+ foreach($user_set as $tk){
 38+ if(in_array($tk, $mvMVDTypeAllAvailable)){
 39+ $this->mvd_tracks[]= $tk;
 40+ }
 41+ }
 42+ }else{
 43+ //do reality check on settings:
 44+ foreach($mvMVDTypeDefaultDisp as $tk){
 45+ if(!in_array($tk, $mvMVDTypeAllAvailable)){
 46+ global $wgOut;
 47+ $wgOut->errorPage('mvd_default_mismatch','mvd_default_mismatchtext');
 48+ }
 49+ }
 50+ //just set to global default:
 51+ $this->mvd_tracks = $mvMVDTypeDefaultDisp;
 52+ }
 53+ }
 54+ function getMVDReqString(){
 55+ return implode(',',$this->mvd_tracks);
 56+ }
2657 function getReqStreamName(){
2758 if(isset($this->mv_interface->article))
2859 return $this->mv_interface->article->mvTitle->getStreamName();
Index: trunk/extensions/MetavidWiki/languages/MV_Messages.php
@@ -78,12 +78,14 @@
7979 'mv_tool_overlay' => 'Template Overlays',
8080 'mv_tool_overlay_title' => 'Template based metadata Overlays',
8181 'mv_results_found_for' => 'Search Results <b>$1</b> to <b>$2</b> of <b>$3</b> for:',
 82+ 'mv_tool_mang_layers' => 'Mannage Layers',
 83+ 'mv_update_layers' => 'Update Layers',
8284
8385 #mvd types:
8486 'ht_en' => 'Transcript',
8587 'ht_en_desc' => 'English transcripts. This overlay type is for text which spoken in the video stream. Links can be added, but all text should be what is spoken in the video stream.',
8688 'anno_en' => 'Annotations and Categories',
87 - 'anno_en_desc' => 'English categorizations and annotations. This overlay can be used to \"tag\"/Categorize sections of video or to add annotative information that is not spoken text',
 89+ 'anno_en_desc' => 'English categorizations and annotations. This overlay can be used to Categorize sections of video or to add annotative information that is not spoken text',
8890 'thomas_en' => 'Official Transcript',
8991 'thomas_en_desc'=>'Official Thomas Transcript from the governments THOMAS record service. Source time synced by C-SPAN\'s c-spanarchives.org',
9092
@@ -191,6 +193,7 @@
192194 'mv_stream_tool_heading' => 'Stream Tools',
193195 'mv_tool_missing' => 'tool request ($1) does not exist',
194196 'mv_bad_tool_request' => 'bad tool line should be form: tool_name|tool_display_name',
 197+ 'mv_update_layers' => 'update layers view',
195198
196199 #msg for overlay interface:
197200 'mv_search_stream' => 'Search Stream',
Index: trunk/extensions/MetavidWiki/skins/mv_stream.js
@@ -829,7 +829,7 @@
830830 if($j('#mv_tl_mvd_'+mvd_id).css('background').indexOf("red")==-1)
831831 mv_tl_mvd_org_color[mvd_id] = $j('#mv_tl_mvd_'+mvd_id).css('background');
832832 //js_log(mvd_id + ' org color: ' + mv_tl_mvd_org_color[mvd_id]);
833 - $j('#mv_tl_mvd_'+mvd_id).css({background:'red',opacity:.5});
 833+ $j('#mv_tl_mvd_'+mvd_id).css({background:'red',opacity:.4});
834834 }
835835 }
836836 function de_highlight_tl_ts(mvd_id){
@@ -899,6 +899,10 @@
900900 time_range = org_vid_src.substr( org_vid_src.indexOf('?t=')+3 );
901901 post_vars['time_range']=time_range;
902902 }
 903+ //set tracks from mv var:
 904+ if(tool_id=='mang_layers'){
 905+ post_vars['tracks']=mvTracks;
 906+ }
903907 sajax_request_type='POST';
904908 mv_sajax_do_call('mv_tool_disp', [tool_id, wgNamespaceNumber, wgTitle], f, post_vars);
905909 function f( request ) {
@@ -933,6 +937,13 @@
934938 mv_setup_search();
935939 });
936940 break;
 941+ case 'mang_layers':
 942+ $j('#mv_tool_cont').html( mv_result['innerHTML']);
 943+ //add in hooks for turnning on off layers (via click on link)
 944+ $j('a.mv_mang_layers').click(function(){
 945+ $j('#option_'+this.id.substring(2)).get(0).checked = !$j('#option_'+this.id.substring(2)).get(0).checked;
 946+ });
 947+ break;
937948 default:
938949 //set the content payload
939950 $j('#mv_tool_cont').html( mv_result['innerHTML']);

Status & tagging log