r40196 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40195‎ | r40196 | r40197 >
Date:23:21, 28 August 2008
Author:dale
Status:old
Tags:
Comment:
fixes for inline display of transcript data
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php
@@ -106,14 +106,17 @@
107107 switch($this->feed_format ){
108108 case 'cmml':
109109 $this->get_stream_cmml();
 110+ break;
 111+ case 'roe':
 112+ $this->get_roe_xml();
110113 break;
 114+ case 'json_cmml':
 115+ $this->get_json('cmml');
 116+ break;
111117 case 'json_roe':
112118 //returns roe stream info in json object for easy DOM injection
113 - $this->get_roe_json();
 119+ $this->get_json('roe');
114120 break;
115 - case 'roe':
116 - $this->get_roe_xml();
117 - break;
118121 }
119122 break;
120123 case 'category':
@@ -187,7 +190,7 @@
188191 //get all avaliable files
189192 $this->file_list =$this->mvTitle->mvStream->getFileList();
190193 }
191 - function get_roe_json(){
 194+ function get_json($type=''){
192195 $fname = 'Mv_SpecialExport::get_roe_json';
193196 wfProfileIn( $fname );
194197
@@ -197,13 +200,16 @@
198201 $callback_index=$wgRequest->getVal('cb_inx');
199202 $wrap_function=$wgRequest->getVal('cb');
200203
201 - $this->get_row_data();
202204 //sucks to do big XML page operations ...
203205 //@@todo cache it..
204206 ob_start();
205 - $this->get_roe_xml(false);
206 - $xml_page = ob_get_clean();
207 -
 207+ if($type=='roe'){
 208+ $this->get_row_data();
 209+ $this->get_roe_xml(false);
 210+ }else if($type=='cmml'){
 211+ $this->get_stream_cmml();
 212+ }
 213+ $xml_page = ob_get_clean();
208214 header('Content-Type: text/javascript');
209215 print htmlspecialchars($wrap_function).'('. PhpArrayToJsObject_Recurse(
210216 array( 'cb_inx'=>htmlspecialchars($callback_index),
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php
@@ -297,7 +297,7 @@
298298 return ;
299299 }
300300 }
301 - $parserOutput = $this->parse_format_text($wikiText, $mvdTitle, $mvd_page);
 301+ $parserOutput = $this->parse_format_text($wikiText, $mvdTitle, $mvd_page, $absolute_links);
302302
303303 //if absolute_links set preg_replace with the server for every relative link:
304304 if($absolute_links==true){
@@ -309,7 +309,7 @@
310310 $MvParserCache->save( $parserOutput, $mvdArticle, $wgUser );
311311 }
312312 }
313 - function parse_format_text(&$text, &$mvdTile, &$mvd_page=''){
 313+ function parse_format_text(&$text, &$mvdTile, &$mvd_page='', $absolute_links=false){
314314 global $wgOut, $mvgScriptPath;
315315 global $wgParser, $wgUser, $wgTitle, $wgContLang;
316316 $template_key='';
@@ -317,14 +317,18 @@
318318 $template_key = strtolower($mvdTile->getMvdTypeKey());
319319 //$wgOut->addHTML('looking at: ' . strtolower($template_key));
320320 $sk = &$wgUser->getSkin();
321 - $pre_text_html = $post_text_html='';
 321+ $pre_text_html = $post_text_html='';
 322+ $added_play_link =false;
322323 $smw_text_html='';
323324 switch($template_key){
324325 case 'ht_en':
325 - case 'anno_en':
 326+ case 'anno_en':
 327+ $play_link_o='<a href="javascript:mv_do_play('.htmlspecialchars($mvd_page->id).')">';
 328+ $play_link_img_close='<img border="0" src="'.htmlspecialchars($mvgScriptPath).'/skins/images/button_play.png">'.'</a>';
 329+
326330 $smw_attr = $this->get_and_strip_semantic_tags($text);
327 - foreach($smw_attr as $smw_key=>$smw_attr_val){
328 - //do special display for given values:
 331+ foreach($smw_attr as $smw_key=>$smw_attr_val){
 332+ //do special display for given values:
329333 switch($smw_key){
330334 case 'speech_by':
331335 case 'spoken_by':
@@ -332,27 +336,36 @@
333337 $pimg = mv_get_person_img($smw_attr_val);
334338 $pre_text_html.='<p class="mvd_page_image">';
335339
336 - if($mvd_page!='')
337 - $pre_text_html.='<a href="javascript:mv_do_play('.htmlspecialchars($mvd_page->id).')">';
338 -
339 - $pre_text_html.='<img width="44" alt="'.$pTitle->getText().'" '.
340 - 'src="'. htmlspecialchars($pimg->getURL() ).'">';
 340+ if($mvd_page!=''){
 341+ $pre_text_html.=$play_link_o;
 342+ $added_play_link=true;
 343+ }
 344+ $pre_text_html.='<img width="44" alt="' . $pTitle->getText() . '" ' .
 345+ 'src="' . htmlspecialchars($pimg->getURL() ).'">';
341346 if($mvd_page!='')
342 - $pre_text_html.='<img border="0" src="'.htmlspecialchars($mvgScriptPath).'/skins/images/button_play.png">'.'</a>';
 347+ $pre_text_html.=$play_link_img_close;
343348 $pre_text_html.='</p>';
344349 break;
345 - }
 350+ }
346351 //@@todo we should just use semantic mediaWikis info box with some custom style .
347352 $smwKeyTitle=Title::newFromText($smw_key);
348353 $valueTitle = Title::newFromText($smw_attr_val);
349354 if($template_key=='anno_en')
350355 $smw_text_html.=ucwords($smwKeyTitle->getText()). ': '. $sk->makeLinkObj($valueTitle).'<br>';
351 - }
 356+ }
 357+
 358+ if(!$added_play_link && $mvd_page!=''){
 359+ $pre_text_html.='<p class="mvd_page_image">'. $play_link_o . $play_link_img_close . '</p>';
 360+ //print "SHOULD HAVE PUT IN pre_text:$pre_text_html";
 361+ }
352362 $pre_text_html.='<p class="text">';
353363 if($mvd_page!=''){
354364 $pre_text_html.='<span class="mvd_menu_header">'.$this->get_mvd_menu($mvd_page).'</span>';
355365 }
356 - $pre_text_html.='<span class="description"><br>';
 366+ //if absolute links clear out links:
 367+ if($absolute_links)
 368+ $pre_text_html='';
 369+ $pre_text_html.='<span class="description">';
357370 $pre_text_html.=$smw_text_html;
358371 //for ht_en add spoken by add name to start of text:
359372 if( $template_key=='ht_en'){