Index: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php |
— | — | @@ -29,6 +29,7 @@ |
30 | 30 | <pre>{{Bill| |
31 | 31 | GovTrackID=The GovTrack Bill ID (used to key-into GovTracks Bill info)| |
32 | 32 | ThomasID=The bill\'s Tomas id (used for Thomas linkback)| |
| 33 | +Title Description=The short title/description of the bill| |
33 | 34 | Date Introduced=The date the bill was introduced| |
34 | 35 | Session=The session of congress (110 for 2007-08) | |
35 | 36 | Bill Key=The short bill name ie: H.R. #| |
— | — | @@ -36,15 +37,18 @@ |
37 | 38 | Cosponsor #= Where # is 1-70 for listing all cosponsors| |
38 | 39 | }}</pre>The template name (Bill) should be given as the \'\'first\'\' thing on a page. The Cosponsored list should come at the end. |
39 | 40 | </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> |
41 | 45 | {{ #if: {{{Date Introduced|}}}|* Date Introduced: [[Date Bill Introduced:={{{Date Introduced}}}]] |}} |
42 | 46 | {{ #if: {{{Sponsor|}}}|* Sponsor: [[Bill Sponsor:={{{Sponsor}}}]] |}} |
43 | 47 | {{ #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}}}]] |}} |
44 | 48 | |
45 | 49 | |
46 | 50 | ==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}}}| ]] |}} |
49 | 53 | [[Category:Bill]] |
50 | 54 | </includeonly> |
51 | 55 | '); |
Index: trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.php |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | var $base_query = '?q=node/69850'; |
52 | 52 | //swich on letter types: |
53 | 53 | 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'); |
55 | 55 | |
56 | 56 | var $govTrack_bill_url ='http://www.govtrack.us/congress/bill.xpd?bill='; |
57 | 57 | function procArguments(){ |
— | — | @@ -314,8 +314,12 @@ |
315 | 315 | print "Get Additonal C-SPAN Data For \"synced\" Data:\n"; |
316 | 316 | foreach($cspan_person_ary as $pData){ |
317 | 317 | if(isset($pData['wiki_start_time'])){ |
318 | | - //print_r($pData); |
| 318 | + //init: |
319 | 319 | $bill_categories=array(); |
| 320 | + $annotate_body =''; |
| 321 | + $body=''; |
| 322 | + $bill_key=null; |
| 323 | + |
320 | 324 | $rawpage = $this->doRequest($this->base_url . $pData['href']); |
321 | 325 | //$rawpage = $this->doRequest('http://www.c-spanarchives.org/congress/?q=node/77531&id=8330447'); |
322 | 326 | |
— | — | @@ -328,20 +332,19 @@ |
329 | 333 | //print_r($page_matches); |
330 | 334 | }else{ |
331 | 335 | die("error can't find title or body\n"); |
332 | | - } |
333 | | - |
| 336 | + } |
334 | 337 | //do debate tag search: |
335 | 338 | preg_match('/<td colspan="2">Debate:\s<[^>]*>([^<]*)/', $rawpage, $debate_matches); |
336 | 339 | if(isset($debate_matches[1])){ |
337 | 340 | $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"; |
340 | 342 | //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 | + } |
343 | 346 | } |
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']).']] '; |
346 | 349 | //title fix hack for C-span error motion to procceed |
347 | 350 | //@@todo add in the rest of the motions: |
348 | 351 | if(strpos($title,'MOTION TO PROCEED')!==false){ |
— | — | @@ -370,20 +373,29 @@ |
371 | 374 | $bill_pattern.='/i';//case insensative |
372 | 375 | //$body='bla bla H.R. 3453 test S. 3494 some more text'; |
373 | 376 | //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); |
376 | 378 | if(isset($bill_matches[1])){ |
377 | | - foreach($bill_matches as$k=> $bill_type_ary){ |
| 379 | + foreach($bill_matches as $k=> $bill_type_ary){ |
378 | 380 | 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]; |
381 | 383 | }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; |
383 | 395 | } |
384 | 396 | } |
385 | 397 | } |
386 | 398 | } |
387 | | - |
| 399 | + |
388 | 400 | $body = preg_replace($bill_pattern_ary, '[[Mentions Bill:=$0]]', $body); |
389 | 401 | //print "BODY: $body"; |
390 | 402 | |
— | — | @@ -407,6 +419,7 @@ |
408 | 420 | // but the db allows multiples separated by commas. |
409 | 421 | $mRestrictions[$action] = implode( '', $cspanTitle->getRestrictions( $action ) ); |
410 | 422 | } |
| 423 | + |
411 | 424 | $article = new Article($cspanTitle); |
412 | 425 | $mRestrictions['edit']['sysop']=true; |
413 | 426 | $expiry = Block::infinity(); |
— | — | @@ -420,16 +433,16 @@ |
421 | 434 | print "failed to update restrictions\n"; |
422 | 435 | } |
423 | 436 | |
424 | | - |
425 | 437 | //proccess each bill to the annotation body; |
426 | 438 | $bcat=''; |
427 | 439 | $bill_lead_in ="\n\nBill "; |
| 440 | + //print_r($bill_categories); |
428 | 441 | 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) |
431 | 444 | $annotate_body.=$bill_lead_in.'[[Bill:='.$this->cur_bill_short_title.']] '; |
432 | 445 | $bill_lead_in=' , '; |
433 | | - $bcat.="[[Category:$bill]] "; |
| 446 | + $annotate_body.="[[Category:$bill]] "; |
434 | 447 | } |
435 | 448 | } |
436 | 449 | if(trim($title)!=''){ |
— | — | @@ -446,7 +459,7 @@ |
447 | 460 | //[Page: S14580] replaced with: [[Category:BillName]] |
448 | 461 | //would be good to link into the official record for "pages" |
449 | 462 | |
450 | | - //[[speach by:=name]] |
| 463 | + //[[Speech by:=name]] |
451 | 464 | //[[category:=title]] |
452 | 465 | |
453 | 466 | //for documentation: |
— | — | @@ -489,13 +502,16 @@ |
490 | 503 | $bill_key = trim($bill_key); |
491 | 504 | if(substr($bill_key, 0,strlen($cspanT))==$cspanT){ |
492 | 505 | $govTrackBillId= $govtrakT.$session.'-'.trim(substr($bill_key,strlen($cspanT))); |
| 506 | + break; |
493 | 507 | } |
494 | 508 | } |
| 509 | + print "GOT bill id: $govTrackBillId from $bill_key\n"; |
495 | 510 | if($govTrackBillId){ |
496 | 511 | $this->proccessGovTrackBill($govTrackBillId, $bill_key); |
497 | | - $this->govTrackBillId= $govTrackBillId; |
| 512 | + $this->govTrackBillId= $govTrackBillId; |
| 513 | + return $this->govTrackBillId; |
498 | 514 | }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"; |
500 | 516 | return null; |
501 | 517 | } |
502 | 518 | } |
— | — | @@ -510,7 +526,7 @@ |
511 | 527 | |
512 | 528 | 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); |
513 | 529 | if(isset($title_match[1])){ |
514 | | - $title_short = str_replace('_',' ',$title_match[1]); |
| 530 | + $title_short = str_replace(array('_','...'),array(' ',''),$title_match[1]); |
515 | 531 | $this->cur_bill_short_title=$title_short; |
516 | 532 | $title_desc = $title_match[2]; |
517 | 533 | }else{ |
— | — | @@ -540,7 +556,7 @@ |
541 | 557 | $bp = "{{Bill|\n". |
542 | 558 | 'GovTrackID='.$govTrackBillId."|\n"; |
543 | 559 | 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"; |
545 | 561 | $bp.='Bill Key='.$bill_key."|\n"; |
546 | 562 | if(isset($date_intro_match[1]))$bp.='Date Introduced='.$date_intro_match[1]."|\n"; |
547 | 563 | if($title_desc){ |
— | — | @@ -557,6 +573,7 @@ |
558 | 574 | } |
559 | 575 | } |
560 | 576 | $bp.="}}\n"; |
| 577 | + $body.="\n\n".'Source: [[Data Source Name:=GovTrack]] [[Data Source URL:='.$this->govTrack_bill_url . $govTrackBillId.']]'; |
561 | 578 | //set up the base bill page: |
562 | 579 | $wgBillTitle = Title::newFromText($title_short); |
563 | 580 | do_update_wiki_page($wgBillTitle, $bp); |
— | — | @@ -565,7 +582,7 @@ |
566 | 583 | do_update_wiki_page($wgBillKeyTitle, '#REDIRECT [['.$title_short.']]'); |
567 | 584 | //set up link on the category page: |
568 | 585 | $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().']]'); |
570 | 587 | } |
571 | 588 | function get_wiki_name_from_govid($govID){ |
572 | 589 | if(!isset($this->govTrack_cache)){ |
— | — | @@ -578,7 +595,7 @@ |
579 | 596 | } |
580 | 597 | if(!isset($this->govTrack_cache[$govID])){ |
581 | 598 | $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]"); |
583 | 600 | return false; |
584 | 601 | } |
585 | 602 | return str_replace('_',' ',$this->govTrack_cache[$govID]); |
Index: trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | return; |
59 | 59 | } |
60 | 60 | } |
61 | | - $cur_text.=$append_text; |
| 61 | + $cur_text.="\n\n".$append_text; |
62 | 62 | //do the edit: |
63 | 63 | $sum_txt = 'metavid append'; |
64 | 64 | $wgArticle->doEdit($cur_text, $sum_txt); |
— | — | @@ -78,7 +78,7 @@ |
79 | 79 | |
80 | 80 | $wgArticle = new Article($wgTitle); |
81 | 81 | if(!mvDoMvPage($wgTitle, $wgArticle, false)){ |
82 | | - print "bad title: ".$wgTitle->getDBkey()." no edit"; |
| 82 | + print "bad title: ".$wgTitle->getNsText() .':'.$wgTitle->getDBkey()." no edit"; |
83 | 83 | if($wgTitle->exists()){ |
84 | 84 | print "remove article"; |
85 | 85 | $wgArticle->doDeleteArticle( 'bad title' ); |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | //if last edit!=mvBot skip (don't overwite peoples improvments') |
97 | 97 | $rev = & Revision::newFromTitle($wgTitle); |
98 | 98 | 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"; |
100 | 100 | if(!$forceUpdate)return ; |
101 | 101 | } |
102 | 102 | //proc article: |
— | — | @@ -107,14 +107,15 @@ |
108 | 108 | } |
109 | 109 | //check if text is identical: |
110 | 110 | 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"; |
112 | 112 | if(!$forceUpdate)return ; |
113 | 113 | } |
114 | 114 | } |
115 | 115 | //got here do the edit: |
116 | 116 | $sum_txt = 'metavid bot insert'; |
117 | 117 | $wgArticle->doEdit($wikiText, $sum_txt); |
118 | | - print "did edit on " . $wgTitle->getDBkey() . "\n"; |
| 118 | + print "did edit on ". $wgTitle->getNsText() .':'. $wgTitle->getDBkey() . "\n"; |
119 | 119 | //die; |
120 | 120 | } |
| 121 | +function islower($i) { return (strtolower($i) === $i);} |
121 | 122 | ?> |
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_MetavidInterface.php |
— | — | @@ -77,12 +77,7 @@ |
78 | 78 | $this->components['MV_Overlay']->setReq('Recentchanges'); |
79 | 79 | }*/ |
80 | 80 | 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; |
87 | 82 | //set default time range if null time range request |
88 | 83 | $this->article->mvTitle->setStartEndIfEmpty( |
89 | 84 | seconds2ntp(0), |
— | — | @@ -93,7 +88,15 @@ |
94 | 89 | $this->components[$cp_name] = new $cp_name( |
95 | 90 | array('mv_interface'=>&$this) |
96 | 91 | ); |
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 | + |
98 | 101 | //also add prev next pagging |
99 | 102 | $this->page_header ='<span style="position:relative;top:-12px;font-weight:bold">'. |
100 | 103 | $this->article->mvTitle->getStreamNameText(). |
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Tools.php |
— | — | @@ -10,7 +10,8 @@ |
11 | 11 | if ( !defined( 'MEDIAWIKI' ) ) die( 1 ); |
12 | 12 | global $mvgIP; |
13 | 13 | 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'); |
15 | 16 | function getHTML(){ |
16 | 17 | global $wgOut; |
17 | 18 | //@@todo look at mv_interface context to get what to display in tool box: |
— | — | @@ -61,6 +62,9 @@ |
62 | 63 | $this->innerHTML = $wgOut->getHTML(); |
63 | 64 | } |
64 | 65 | break; |
| 66 | + case 'mang_layers': |
| 67 | + $this->innerHTML = $this->get_mang_layers_page($title_str); |
| 68 | + break; |
65 | 69 | case 'search': |
66 | 70 | $title = Title::newFromText($title_str, MV_NS_STREAM); |
67 | 71 | //render search box |
— | — | @@ -103,6 +107,7 @@ |
104 | 108 | return '<a href="javascript:mv_tool_disp(\'stream_page\')">'.wfMsg('mv_stream_meta').'</a>' .' | '. |
105 | 109 | '<a href="javascript:mv_tool_disp(\'menu\')">'.wfMsg('mv_stream_tool_heading').'</a>'; |
106 | 110 | } |
| 111 | + |
107 | 112 | /* outputs basic stream paging (this could be done client side) */ |
108 | 113 | function stream_paging_links($return_set='both'){ |
109 | 114 | global $wgUser, $mvDefaultStreamViewLength,$mvgScriptPath; |
— | — | @@ -140,12 +145,11 @@ |
141 | 146 | * @@todo better integration with wiki |
142 | 147 | * (ie tool listing should be a page like navigationBar or in our case MvStreamTools |
143 | 148 | */ |
144 | | - function getToolsListing(){ |
145 | | - $mv_valid_tools = array('search','navigate','export','embed','overlay'); |
| 149 | + function getToolsListing(){ |
146 | 150 | $out=''; |
147 | 151 | $heading=wfMsg('mv_stream_tool_heading') . ':'; |
148 | 152 | $out.='<ul>'; |
149 | | - foreach($mv_valid_tools as $tool_id){ |
| 153 | + foreach($this->mv_valid_tools as $tool_id){ |
150 | 154 | $out.='<li><a title="'.wfMsg('mv_tool_'.$tool_id.'_title'). |
151 | 155 | '" href="javascript:mv_tool_disp(\''.$tool_id.'\')">' . |
152 | 156 | wfMsg('mv_tool_'.$tool_id) . '</li>'."\n"; |
— | — | @@ -183,6 +187,21 @@ |
184 | 188 | <a href="javascript:tool_disp(\'overlay\')>Overlay Set</a><br> |
185 | 189 | ';*/ |
186 | 190 | } |
| 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 | + } |
187 | 206 | function get_nav_page($stream_title){ |
188 | 207 | global $mvgIP; |
189 | 208 | //output sliders for stream navigation: |
— | — | @@ -194,15 +213,12 @@ |
195 | 214 | $stream = new MV_Stream(array('name'=>$stream_title)); |
196 | 215 | //$out.= "sn: ". $stream->name . '<br>'; |
197 | 216 | $duration = $stream->getDuration(); |
198 | | - //$out.=" duration: $duration"; |
199 | | - |
200 | | - include_once($mvgIP. '/includes/MV_MetavidInterface/MV_Overlay.php'); |
| 217 | + //$out.=" duration: $duration"; |
201 | 218 | $MvOverlay = new MV_Overlay(); |
202 | 219 | |
203 | 220 | $titleKey = 'mvd_type:'.ucfirst($stream_title).'/'.$_REQUEST['time_range']; |
204 | 221 | $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">'; |
207 | 223 | //set range: |
208 | 224 | $this->js_eval = "var end_time = {$duration};"; |
209 | 225 | return $out; |
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php |
— | — | @@ -44,33 +44,7 @@ |
45 | 45 | $this->get_transcript_pages(); |
46 | 46 | $wgOut->addHTML("</div>"); |
47 | 47 | } |
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 | + |
75 | 49 | function render_menu(){ |
76 | 50 | $base_title=''; |
77 | 51 | //set the base title to the stream name: |
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Component.php |
— | — | @@ -16,12 +16,43 @@ |
17 | 17 | var $innerHTML =''; |
18 | 18 | var $js_eval=false; |
19 | 19 | var $req = ''; |
| 20 | + var $mvd_tracks=array(); |
20 | 21 | |
21 | 22 | function __construct($init=array()){ |
22 | 23 | foreach($init as $k=>$v){ |
23 | 24 | $this->$k=$v; |
24 | 25 | } |
25 | 26 | } |
| 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 | + } |
26 | 57 | function getReqStreamName(){ |
27 | 58 | if(isset($this->mv_interface->article)) |
28 | 59 | return $this->mv_interface->article->mvTitle->getStreamName(); |
Index: trunk/extensions/MetavidWiki/languages/MV_Messages.php |
— | — | @@ -78,12 +78,14 @@ |
79 | 79 | 'mv_tool_overlay' => 'Template Overlays', |
80 | 80 | 'mv_tool_overlay_title' => 'Template based metadata Overlays', |
81 | 81 | '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', |
82 | 84 | |
83 | 85 | #mvd types: |
84 | 86 | 'ht_en' => 'Transcript', |
85 | 87 | '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.', |
86 | 88 | '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', |
88 | 90 | 'thomas_en' => 'Official Transcript', |
89 | 91 | 'thomas_en_desc'=>'Official Thomas Transcript from the governments THOMAS record service. Source time synced by C-SPAN\'s c-spanarchives.org', |
90 | 92 | |
— | — | @@ -191,6 +193,7 @@ |
192 | 194 | 'mv_stream_tool_heading' => 'Stream Tools', |
193 | 195 | 'mv_tool_missing' => 'tool request ($1) does not exist', |
194 | 196 | 'mv_bad_tool_request' => 'bad tool line should be form: tool_name|tool_display_name', |
| 197 | + 'mv_update_layers' => 'update layers view', |
195 | 198 | |
196 | 199 | #msg for overlay interface: |
197 | 200 | 'mv_search_stream' => 'Search Stream', |
Index: trunk/extensions/MetavidWiki/skins/mv_stream.js |
— | — | @@ -829,7 +829,7 @@ |
830 | 830 | if($j('#mv_tl_mvd_'+mvd_id).css('background').indexOf("red")==-1) |
831 | 831 | mv_tl_mvd_org_color[mvd_id] = $j('#mv_tl_mvd_'+mvd_id).css('background'); |
832 | 832 | //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}); |
834 | 834 | } |
835 | 835 | } |
836 | 836 | function de_highlight_tl_ts(mvd_id){ |
— | — | @@ -899,6 +899,10 @@ |
900 | 900 | time_range = org_vid_src.substr( org_vid_src.indexOf('?t=')+3 ); |
901 | 901 | post_vars['time_range']=time_range; |
902 | 902 | } |
| 903 | + //set tracks from mv var: |
| 904 | + if(tool_id=='mang_layers'){ |
| 905 | + post_vars['tracks']=mvTracks; |
| 906 | + } |
903 | 907 | sajax_request_type='POST'; |
904 | 908 | mv_sajax_do_call('mv_tool_disp', [tool_id, wgNamespaceNumber, wgTitle], f, post_vars); |
905 | 909 | function f( request ) { |
— | — | @@ -933,6 +937,13 @@ |
934 | 938 | mv_setup_search(); |
935 | 939 | }); |
936 | 940 | 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; |
937 | 948 | default: |
938 | 949 | //set the content payload |
939 | 950 | $j('#mv_tool_cont').html( mv_result['innerHTML']); |