Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php |
— | — | @@ -106,14 +106,17 @@ |
107 | 107 | switch($this->feed_format ){ |
108 | 108 | case 'cmml': |
109 | 109 | $this->get_stream_cmml(); |
| 110 | + break; |
| 111 | + case 'roe': |
| 112 | + $this->get_roe_xml(); |
110 | 113 | break; |
| 114 | + case 'json_cmml': |
| 115 | + $this->get_json('cmml'); |
| 116 | + break; |
111 | 117 | case 'json_roe': |
112 | 118 | //returns roe stream info in json object for easy DOM injection |
113 | | - $this->get_roe_json(); |
| 119 | + $this->get_json('roe'); |
114 | 120 | break; |
115 | | - case 'roe': |
116 | | - $this->get_roe_xml(); |
117 | | - break; |
118 | 121 | } |
119 | 122 | break; |
120 | 123 | case 'category': |
— | — | @@ -187,7 +190,7 @@ |
188 | 191 | //get all avaliable files |
189 | 192 | $this->file_list =$this->mvTitle->mvStream->getFileList(); |
190 | 193 | } |
191 | | - function get_roe_json(){ |
| 194 | + function get_json($type=''){ |
192 | 195 | $fname = 'Mv_SpecialExport::get_roe_json'; |
193 | 196 | wfProfileIn( $fname ); |
194 | 197 | |
— | — | @@ -197,13 +200,16 @@ |
198 | 201 | $callback_index=$wgRequest->getVal('cb_inx'); |
199 | 202 | $wrap_function=$wgRequest->getVal('cb'); |
200 | 203 | |
201 | | - $this->get_row_data(); |
202 | 204 | //sucks to do big XML page operations ... |
203 | 205 | //@@todo cache it.. |
204 | 206 | 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(); |
208 | 214 | header('Content-Type: text/javascript'); |
209 | 215 | print htmlspecialchars($wrap_function).'('. PhpArrayToJsObject_Recurse( |
210 | 216 | array( 'cb_inx'=>htmlspecialchars($callback_index), |
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php |
— | — | @@ -297,7 +297,7 @@ |
298 | 298 | return ; |
299 | 299 | } |
300 | 300 | } |
301 | | - $parserOutput = $this->parse_format_text($wikiText, $mvdTitle, $mvd_page); |
| 301 | + $parserOutput = $this->parse_format_text($wikiText, $mvdTitle, $mvd_page, $absolute_links); |
302 | 302 | |
303 | 303 | //if absolute_links set preg_replace with the server for every relative link: |
304 | 304 | if($absolute_links==true){ |
— | — | @@ -309,7 +309,7 @@ |
310 | 310 | $MvParserCache->save( $parserOutput, $mvdArticle, $wgUser ); |
311 | 311 | } |
312 | 312 | } |
313 | | - function parse_format_text(&$text, &$mvdTile, &$mvd_page=''){ |
| 313 | + function parse_format_text(&$text, &$mvdTile, &$mvd_page='', $absolute_links=false){ |
314 | 314 | global $wgOut, $mvgScriptPath; |
315 | 315 | global $wgParser, $wgUser, $wgTitle, $wgContLang; |
316 | 316 | $template_key=''; |
— | — | @@ -317,14 +317,18 @@ |
318 | 318 | $template_key = strtolower($mvdTile->getMvdTypeKey()); |
319 | 319 | //$wgOut->addHTML('looking at: ' . strtolower($template_key)); |
320 | 320 | $sk = &$wgUser->getSkin(); |
321 | | - $pre_text_html = $post_text_html=''; |
| 321 | + $pre_text_html = $post_text_html=''; |
| 322 | + $added_play_link =false; |
322 | 323 | $smw_text_html=''; |
323 | 324 | switch($template_key){ |
324 | 325 | 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 | + |
326 | 330 | $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: |
329 | 333 | switch($smw_key){ |
330 | 334 | case 'speech_by': |
331 | 335 | case 'spoken_by': |
— | — | @@ -332,27 +336,36 @@ |
333 | 337 | $pimg = mv_get_person_img($smw_attr_val); |
334 | 338 | $pre_text_html.='<p class="mvd_page_image">'; |
335 | 339 | |
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() ).'">'; |
341 | 346 | 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; |
343 | 348 | $pre_text_html.='</p>'; |
344 | 349 | break; |
345 | | - } |
| 350 | + } |
346 | 351 | //@@todo we should just use semantic mediaWikis info box with some custom style . |
347 | 352 | $smwKeyTitle=Title::newFromText($smw_key); |
348 | 353 | $valueTitle = Title::newFromText($smw_attr_val); |
349 | 354 | if($template_key=='anno_en') |
350 | 355 | $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 | + } |
352 | 362 | $pre_text_html.='<p class="text">'; |
353 | 363 | if($mvd_page!=''){ |
354 | 364 | $pre_text_html.='<span class="mvd_menu_header">'.$this->get_mvd_menu($mvd_page).'</span>'; |
355 | 365 | } |
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">'; |
357 | 370 | $pre_text_html.=$smw_text_html; |
358 | 371 | //for ht_en add spoken by add name to start of text: |
359 | 372 | if( $template_key=='ht_en'){ |