Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_MetavidInterface.php |
— | — | @@ -80,10 +80,12 @@ |
81 | 81 | //process track request: |
82 | 82 | $this->components['MV_Overlay']->procMVDReqSet(); |
83 | 83 | //add in title & tracks var: |
| 84 | + global $mvgScriptPath; |
84 | 85 | $wgOut->addScript('<script type="text/javascript">/*<![CDATA[*/'." |
85 | 86 | var mvTitle = '{$this->article->mvTitle->getWikiTitle()}'; |
86 | | - var mvTracks = '".$this->components['MV_Overlay']->getMVDReqString(). '\'; |
87 | | - /*]]>*/</script>'."\n"); |
| 87 | + var mvTracks = '".$this->components['MV_Overlay']->getMVDReqString(). "'; |
| 88 | + var mvgScriptPath = '".$mvgScriptPath."'; |
| 89 | + /*]]>*/</script>\n"); |
88 | 90 | |
89 | 91 | //also add prev next paging |
90 | 92 | $this->page_header ='<h1 class="videoHeader">'. |
Index: branches/MetavidWiki-exp/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php |
— | — | @@ -113,8 +113,9 @@ |
114 | 114 | } |
115 | 115 | } |
116 | 116 | } |
117 | | - /*functions for transcript pages*/ |
118 | | - //@@TODO OPTIMIZATION: (group article text queries) |
| 117 | + /*functions for transcript pages |
| 118 | + @@TODO OPTIMIZATION: (group article text queries) |
| 119 | + */ |
119 | 120 | function get_transcript_pages(){ |
120 | 121 | global $wgUser, $mvgIP, $wgOut; |
121 | 122 | $sk = $wgUser->getSkin(); |
— | — | @@ -477,6 +478,7 @@ |
478 | 479 | $metaData = $mvTitle->getMetaData(); |
479 | 480 | } |
480 | 481 | foreach($mvMetaDataHelpers[strtolower($mvd_type)] as $prop=>$ac_index){ |
| 482 | + $val=''; |
481 | 483 | //normalize the |
482 | 484 | $prop=str_replace(' ', '_', $prop); |
483 | 485 | //set existing "value" |
— | — | @@ -506,9 +508,10 @@ |
507 | 509 | //list each category with a little - next to it that removes its respective hidden field. |
508 | 510 | $i=0; |
509 | 511 | $o.='<tr><td>'.wfMsg('mv_existing_categories').'</td><td>'; |
| 512 | + $o.='<div id="mv_ext_cat_container_'.$mvd_id.'"></div>'; |
510 | 513 | foreach($metaData['categories'] as $cat=>$page){ |
511 | 514 | $catTitle = Title::newFromText($cat, NS_CATEGORY); |
512 | | - $o.='<span id="ext_cat_'.$i.'"><input type="hidden" style="display:none;" name="ext_cat_'.$i.'" class="mv_ext_cat">'. |
| 515 | + $o.='<span id="ext_cat_'.$i.'"><input value="'. $catTitle->getDBKey().'" type="hidden" style="display:none;" name="ext_cat[]" class="mv_ext_cat">'. |
513 | 516 | $catTitle->getText(). |
514 | 517 | '<a href="#" onclick="$j(\'#ext_cat_'.$i.'\').fadeOut(\'fast\').remove();return false;"> |
515 | 518 | <img border="0" src="'.$mvgScriptPath.'/skins/images/delete.png"> |
— | — | @@ -517,7 +520,8 @@ |
518 | 521 | $i++; |
519 | 522 | } |
520 | 523 | $o.='</tr>'; |
521 | | - $o.= "<tr><td><label for=\"category\">".wfMsg('mv_add_category').":</label></td><td><input size=\"40\" class=\"mv_anno_ac_{$mvd_id}\" name=\"category\" type=\"text\"> |
| 524 | + $o.= "<tr><td><label for=\"category\">".wfMsg('mv_add_category').":</label></td><td><input id=\"mv_add_cat_ext_{$mvd_id}\" maxlength=\"255\" size=\"20\" class=\"mv_anno_ac_{$mvd_id}\" name=\"category\" type=\"text\"> |
| 525 | + <img onClick=\"mv_add_category('{$mvd_id}', \$j('#mv_add_cat_ext_{$mvd_id}').val())\" border=\"0\" src=\"{$mvgScriptPath}/skins/images/add.png\"> |
522 | 526 | <div class=\"autocomplete\" id=\"category_choices_{$mvd_id}\" style=\"display: none;\"/></td></tr>"; |
523 | 527 | } |
524 | 528 | //output a short desc field (the text with striped semantic values)... |
— | — | @@ -614,7 +618,7 @@ |
615 | 619 | |
616 | 620 | /*@@TODO document */ |
617 | 621 | function do_edit_submit($titleKey, $mvd_id, $returnEncapsulated=false){ |
618 | | - global $wgOut, $wgScriptPath, $wgUser, $wgTitle, $wgRequest; |
| 622 | + global $wgOut, $wgScriptPath, $wgUser, $wgTitle, $wgRequest, $wgContLang; |
619 | 623 | |
620 | 624 | if($mvd_id=='new'){ |
621 | 625 | $titleKey =substr($_REQUEST['title'],0,strpos($_REQUEST['title'],'/')). |
— | — | @@ -652,6 +656,11 @@ |
653 | 657 | } |
654 | 658 | } |
655 | 659 | } |
| 660 | + //add all categorizations: |
| 661 | + $catNStxt = $wgContLang->getNsText(NS_CATEGORY); |
| 662 | + foreach($_POST['ext_cat'] as $k=>$v){ |
| 663 | + $wpTextbox1.="\n\n[[".$catNStxt.":".$v."]]"; |
| 664 | + } |
656 | 665 | //add the text to the end after a line break to not confuse mannual editors |
657 | 666 | $editPageAjax = new MV_EditPageAjax( $Article); |
658 | 667 | $editPageAjax->mvd_id = $mvd_id; |
Index: branches/MetavidWiki-exp/MetavidWiki/skins/mv_stream.js |
— | — | @@ -456,7 +456,7 @@ |
457 | 457 | } |
458 | 458 | /* |
459 | 459 | * adds autocomplete to semantic forms |
460 | | - * with special case for speech by |
| 460 | + * with special case for speech by and "categories" |
461 | 461 | * @@todo generalize for all autocompletes |
462 | 462 | */ |
463 | 463 | function add_mv_helpers_ac(mvd_id){ |
— | — | @@ -469,16 +469,26 @@ |
470 | 470 | { |
471 | 471 | autoFill:true, |
472 | 472 | onItemSelect:function(v){ |
473 | | - js_log('selected:' + v.innerHTML ); |
| 473 | + js_log('selected:' + v.innerHTML + 'fill with' + $j(input_item).val() ); |
474 | 474 | //@@todo better way to determin type |
475 | 475 | //js_log("img src: " + $j(v).children('img').attr('src')); |
476 | 476 | //'mv_edit_im_'+mvd_id |
477 | 477 | if($j(v).children('img').length!=0){ |
478 | 478 | $j('#smw_Speech_by_img').attr('src', $j(v).children('img').attr('src')); |
| 479 | + } |
| 480 | + //add category and empty input (@@todo make cat_ns multi-lengual friendly |
| 481 | + var cat_ns="Category:" |
| 482 | + if($j(input_item).val().indexOf(cat_ns==0)){ |
| 483 | + mv_add_category(mvd_id, $j(input_item).val().substr(cat_ns.length)); |
| 484 | + $j(input_item).val(''); |
479 | 485 | } |
480 | 486 | }, |
481 | | - formatItem:function(row){ |
482 | | - return '<img width="44" src="'+ row[2] + '">'+row[1]; |
| 487 | + formatItem:function(row){ |
| 488 | + if(row[2]=='no_image'){ |
| 489 | + return row[1]; |
| 490 | + }else{ |
| 491 | + return '<img width="44" src="'+ row[2] + '">'+row[1]; |
| 492 | + } |
483 | 493 | }, |
484 | 494 | matchSubset:0, |
485 | 495 | extraParams:{action:'ajax',rs:'mv_helpers_auto_complete',prop_name:prop_name}, |
— | — | @@ -487,7 +497,17 @@ |
488 | 498 | }); |
489 | 499 | }); |
490 | 500 | } |
491 | | - |
| 501 | +function mv_add_category(mvd_id, cat_name){ |
| 502 | + js_log("add cat: "+ cat_name); |
| 503 | + if(cat_name=='')return false; |
| 504 | + var currentDate = new Date() |
| 505 | + var unique_inx = currentDate.getUTCMilliseconds(); |
| 506 | + $j('#mv_ext_cat_container_'+mvd_id).append('<span id="ext_cat_'+unique_inx+'"><input value="'+cat_name+'" type="hidden" style="display:none;" name="ext_cat[]" class="mv_ext_cat">'+ |
| 507 | + cat_name.replace(/_/g," ") + |
| 508 | + '<a href="#" onclick="$j(\'#ext_cat_'+unique_inx+'\').fadeOut(\'fast\').remove();return false;">'+ |
| 509 | + '<img border="0" src="'+mvgScriptPath+'/skins/images/delete.png">'+ |
| 510 | + '</a></span><br>'); |
| 511 | +} |
492 | 512 | /* |
493 | 513 | * @@TODO add_autocomplete should be merged with generalized mv_helpers_ac |
494 | 514 | */ |