r34198 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34197‎ | r34198 | r34199 >
Date:08:28, 4 May 2008
Author:dale
Status:old
Tags:
Comment:
improved IE support for remote inline display of captions
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/MV_Settings.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_vlcEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/sample_page.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/includes/MV_Settings.php
@@ -6,7 +6,7 @@
77 /*
88 * your settings overrides here:
99 */
10 -$mvExternalImages = false;
 10+$mvExternalImages = true;
1111 $mvExternalImgServerPath = 'http://metavid.ucsc.edu/wiki/index.php';
1212
1313 ?>
\ No newline at end of file
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php
@@ -248,7 +248,7 @@
249249 if(!$inline)header('Content-Type: text/xml');
250250 //print the header:
251251 if(!$inline)print '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n";
252 - if(!$inline)print '<!DOCTYPE cmml SYSTEM "cmml.dtd">'."\n";
 252+ //if(!$inline)print '<!DOCTYPE cmml SYSTEM "http://svn.annodex.net/standards/cmml_2_0.dtd">'."\n";
253253 $tracks=array();
254254 if(count($dbr->numRows($mvd_res))!=0){
255255 global $wgOut;
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -727,8 +727,7 @@
728728 this.getParseCMML();
729729 }
730730 //start the autoscroll timer:
731 - this.setAutoScroll(true);
732 -
 731+ this.setAutoScroll(true);
733732 },
734733 //@@todo seperate out data loader & data display
735734 getParseCMML:function(){
@@ -778,12 +777,15 @@
779778 url+='t='+seconds2ntp(req_time[0])+'/'+seconds2ntp(req_time[1])+'&';
780779 }
781780 }
782 - js_log('do request on url:' + url);
783 - $j('#mv_loading_icon').css('display','inline');
 781+ //js_log('do request on url:' + url);
 782+ //$j('#mv_loading_icon').css('display','inline');
784783 do_request(url, function(data){
 784+ //js_log('wtf' + data.xml);
 785+ //js_log("load track data: "+ data.toString() );
785786 //hide loading icon:
786787 $j('#mv_loading_icon').css('display','none');
787788 $j.each(data.getElementsByTagName('clip'), function(inx, n){
 789+ js_log('on clip '+ n.getAttribute('id'));
788790 var text_clip = {
789791 start:n.getAttribute('start').replace('ntp:', ''),
790792 end:n.getAttribute('end').replace('ntp:', ''),
@@ -791,10 +793,15 @@
792794 id:n.getAttribute('id')
793795 }
794796 $j.each(n.getElementsByTagName('body'), function(binx, bn){
795 - text_clip.body = bn.textContent;
796 - });
 797+ if(bn.textContent){
 798+ text_clip.body = bn.textContent;
 799+ }else if(bn.text){
 800+ text_clip.body = bn.text;
 801+ }
 802+ });
797803 _this.add_merge_text_clip(text_clip);
798804 });
 805+ //js_log('done with merge insert text clips');
799806 //done loading update availableTracks
800807 _this.availableTracks[track_id].loaded=true;
801808 _this.availableTracks[track_id].display=true;
@@ -813,14 +820,23 @@
814821 '</div>'+
815822 text_clip.body +
816823 '</div>';
 824+
 825+ if($j('#mmbody_'+this.pe.id).length==0)this.show();
 826+
817827 $j('#mmbody_'+this.pe.id +' .mvtt').each(function(){
 828+ js_log('searching for insert point..');
818829 if(!inserted){
 830+ js_log( ntp2seconds($j(this).attr('start')) + ' > ' + text_clip_start_time);
819831 if( ntp2seconds($j(this).attr('start')) > text_clip_start_time){
820832 inserted=true;
 833+
821834 $j(this).before(insertHTML);
822835 }
 836+ }else{
 837+ js_log('already inserted')
823838 }
824839 });
 840+ //js_log('should just append: '+insertHTML);
825841 if(!inserted){
826842 $j('#mmbody_'+this.pe.id ).append(insertHTML);
827843 }
@@ -834,21 +850,22 @@
835851 if($j('#metaBox_'+this.pe.id).length==0){
836852 //append it to body relative to offset of this.pe
837853 var loc = $j(this.pe).position();
 854+ js_log('got loc');
838855 js_log('top ' +loc.top + ' left:'+loc.left );
839856 var append ='<div style="position:absolute;z-index: 5001;' +
840 - 'top:'+(loc.top-4)+'px;' +
841 - 'left:'+(parseInt(loc.left)+parseInt(this.pe.width))+'px;' +
 857+ 'top:'+(loc.top)+'px;' +
 858+ 'left:'+(parseInt(loc.left)+parseInt(this.pe.width)+10)+'px;' +
842859 'height:'+this.pe.height+'px;width:400px;' +
843860 'background:white;border:solid black;" ' +
844861 'id="metaBox_'+this.pe.id+'">' +
845862 this.getMenu() +
846863 this.getBody() +
847864 '</div>';
848 - $j(this.pe).after(append);
 865+ $j(this.pe).after(append);
849866 //$j('body').append();
850867 }else{
851868 $j('#metaBox_'+this.pe.id).fadeIn("fast");
852 - }
 869+ }
853870 },
854871 close:function(){
855872 //the meta box:
@@ -857,7 +874,7 @@
858875 $j('#metaText_'+this.pe.id).fadeIn('fast');
859876 },
860877 getBody:function(){
861 - return '<div id="mmbody_'+this.pe.id+'" style="position:absolute;top:20px;left:0px;right:0px;bottom:0px;overflow:auto;"/>';
 878+ return '<div id="mmbody_'+this.pe.id+'" style="position:absolute;top:20px;left:0px;right:0px;bottom:0px;height:'+(this.pe.height-20)+'px;overflow:auto;"/>';
862879 },
863880 getTsSelect:function(){
864881 js_log('getTsSelect');
@@ -902,7 +919,7 @@
903920 },
904921 monitor:function(){
905922 //grab the time from the video object
906 - var cur_time = parseInt(this.pe.currentTime());
 923+ var cur_time = parseInt( this.pe.currentTime() );
907924 if(cur_time!=0 && this.prevTimeScroll!=cur_time){
908925 //search for current time: flash red border trascript
909926 _this = this;
@@ -922,7 +939,9 @@
923940 this.scrollTimerId = setInterval('document.getElementById(\''+this.pe.id+'\').textInterface.monitor()', 500);
924941 }
925942 //jump to the current position:
926 - var cur_time = parseInt(this.pe.currentTime());
 943+ var cur_time = parseInt (this.pe.currentTime());
 944+ js_log('cur time: '+ cur_time);
 945+
927946 _this = this;
928947 $j('#mmbody_'+this.pe.id +' .mvtt').each(function(){
929948 if(cur_time > ntp2seconds($j(this).attr('start')) ){
@@ -939,16 +958,18 @@
940959 getMenu:function(){
941960 var out='';
942961 //add in loading icon:
 962+ /*
943963 out+= '<div class="mv_loading_icon" style="background:url(\''+mv_embed_path+'images/indicator.gif\');display:';
944964 out+= (this.roe_data)? 'none':'inline';
945965 out+='"/>';
 966+ */
946967 var as_checked = (this.autoscroll)?'checked':'';
947968 out+= '<div id="mmenu_'+this.pe.id+'" style="background:#AAF;font-size:small;position:absolute;top:0;height:20px;left:0px;right:0px;">' +
948969 '<a style="font-color:#000;" title="'+getMsg('close')+'" href="#" onClick="document.getElementById(\''+this.pe.id+'\').closeTextInterface();return false;">'+
949970 '<img border="0" width="16" height="16" src="'+mv_embed_path + 'images/cancel.png"></a> ' +
950971 '<a style="font-color:#000;" title="'+getMsg('select_transcript_set')+'" href="#" onClick="document.getElementById(\''+this.pe.id+'\').textInterface.getTsSelect();return false;">'+
951972 getMsg('select_transcript_set')+'</a> | ' +
952 - '<input onClick="document.getElementById(\''+this.pe.id+'\').textInterface.setAutoScroll(this.checked)" ' +
 973+ '<input onClick="document.getElementById(\''+this.pe.id+'\').textInterface.setAutoScroll(this.checked);return false;" ' +
953974 'type="checkbox" '+as_checked +'>'+getMsg('auto_scroll');
954975 if(this.pe.linkback){
955976 out+=' | <a style="font-color:#000;" title="'+getMsg('improve_transcript')+'" href="'+this.pe.linkback+'">'+
@@ -1394,6 +1415,7 @@
13951416 }
13961417 //show interface
13971418 this.textInterface.show();
 1419+ //js_log('text interface should be show');
13981420 },
13991421 closeTextInterface:function(){
14001422 js_log('closeTextInterface '+ typeof this.textInterface);
@@ -1772,7 +1794,7 @@
17731795 function mv_addLoadEvent(func) {
17741796 mvEmbed.addLoadEvent(func);
17751797 }
1776 - function do_request(req_url,callback,mv_json_response){
 1798+ function do_request(req_url, callback, mv_json_response){
17771799 js_log('do request: ' + req_url);
17781800 if( parseUri(document.URL).host == parseUri(req_url).host){
17791801 //no proxy at all do a direct request:
@@ -1786,12 +1808,14 @@
17871809 }else{
17881810 //check if MV_embed path matches document.URL then we can use the local proxy:
17891811 if(parseUri(document.URL).host == parseUri(mv_embed_path).host ){
1790 - js_log('use mv_embed_proxy : ' + parseUri(document.URL).host + ' != '+ parseUri(req_url).host);
 1812+ js_log('use mv_embed_proxy : ' + parseUri(document.URL).host + ' != '+ parseUri(req_url).host);
 1813+ js_log("do ajax req:" +req_url);
17911814 $j.ajax({
17921815 type: "POST",
17931816 url:mv_embed_path + 'mv_data_proxy.php',
17941817 data:{url:req_url},
1795 - success:function(data){
 1818+ success:function(data){
 1819+ js_log("did ajax req:"+ typeof data);
17961820 callback(data);
17971821 }
17981822 });
@@ -1834,7 +1858,7 @@
18351859 }
18361860 global_req_cb[response['cb_inx']](response['pay_load']);
18371861 }
1838 -//load external via dom injection
 1862+//load external js via dom injection
18391863 function loadExternalJs(url){
18401864 js_log('load js: '+ url);
18411865 var e = document.createElement("script");
@@ -1889,7 +1913,26 @@
18901914 js_log('already absolute');
18911915 }
18921916 }
 1917+if (typeof DOMParser == "undefined") {
 1918+ DOMParser = function () {}
18931919
 1920+ DOMParser.prototype.parseFromString = function (str, contentType) {
 1921+ if (typeof ActiveXObject != "undefined") {
 1922+ var d = new ActiveXObject("MSXML.DomDocument");
 1923+ d.loadXML(str);
 1924+ return d;
 1925+ } else if (typeof XMLHttpRequest != "undefined") {
 1926+ var req = new XMLHttpRequest;
 1927+ req.open("GET", "data:" + (contentType || "application/xml") +
 1928+ ";charset=utf-8," + encodeURIComponent(str), false);
 1929+ if (req.overrideMimeType) {
 1930+ req.overrideMimeType(contentType);
 1931+ }
 1932+ req.send(null);
 1933+ return req.responseXML;
 1934+ }
 1935+ }
 1936+}
18941937 /*
18951938 * utility functions:
18961939 */
@@ -1901,14 +1944,14 @@
19021945 /*
19031946 * IE and non-firebug debug:
19041947 */
1905 - /*var log_elm = document.getElementById('mv_js_log');
 1948+ var log_elm = document.getElementById('mv_js_log');
19061949 if(!log_elm){
19071950 document.write('<div style="position:absolute;z-index:50;top:0px;left:0px;right:0px;height:150px;"><textarea id="mv_js_log" cols="80" rows="6"></textarea></div>');
19081951 var log_elm = document.getElementById('mv_js_log');
19091952 }
19101953 if(log_elm){
19111954 log_elm.value+=string+"\n";
1912 - }*/
 1955+ }
19131956 }
19141957 }
19151958 //}
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_vlcEmbed.js
@@ -273,7 +273,7 @@
274274 return this.vlc.input.time/1000;
275275 }
276276 }
277 - return 0;
 277+ return '0';
278278 },
279279 // get the embed vlc object
280280 getVLC : function getVLC(){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/sample_page.php
@@ -36,10 +36,9 @@
3737 //$sample_embed[1]['desc'] = '<b>RSS</b> a podcast like dynamic feed for "peace"<br />'.
3838 // '<iframe width="500" height="200" src="'.$plurl.'">rss feed here</iframe>';
3939
40 -$sample_embed[1]['tag'] = '<video roe="http://localhost/mvWiki/index.php?title=Special:MvExportStream&feed_format=roe&stream_name=Senate_proceeding_08-01-07&t=0:00:00/0:05:00">';
41 -$sample_embed[1]['desc'] = 'Demo of json ROE attribute';
 40+//$sample_embed[1]['tag'] = '<video roe="http://192.168.0.104/mvWiki/index.php?title=Special:MvExportStream&feed_format=roe&stream_name=Senate_proceeding_08-01-07&t=0:00:00/0:05:00">';
 41+//$sample_embed[1]['desc'] = 'Demo of json ROE attribute';
4242
43 -
4443 $sample_embed[2]['tag'] = '<video roe="http://metavid.ucsc.edu/wiki/index.php?title=Special:MvExportStream&feed_format=roe&stream_name=Senate_proceeding_08-01-07&t=0:06:00/0:07:00">';
4544 $sample_embed[2]['desc'] = 'Demo2 of json ROE attribute';
4645

Status & tagging log