r47525 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47524‎ | r47525 | r47526 >
Date:00:19, 20 February 2009
Author:dale
Status:deferred
Tags:
Comment:
massive refactoring of mv_embed
support for js ScriptServer
Modified paths:
  • /trunk/extensions/MetavidWiki/MV_LocalSettings.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_MagicWords.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/add_media_wizard.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_allpages.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_common.js (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sampleEditor.html (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvUploader.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libClipEdit/mvClipEdit.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_baseEmbed.js (replaced) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_flashEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mvSequencer.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mvwScriptLoader.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_search.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_stream.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/MV_LocalSettings.php
@@ -1,4 +1,5 @@
22 <?
 3+//@@todo depreciate put all settings into LocalSettings.php
34 if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
45 // include the default settings:
56 include_once( dirname( __FILE__ ) . '/includes/MV_DefaultSettings.php' );
Index: trunk/extensions/MetavidWiki/includes/MV_MagicWords.php
@@ -19,7 +19,7 @@
2020 // list of valid arguments and their default value:
2121 var $params = array ( 'format' => 'ul_list', 'num_results' => 5,
2222 'time_range' => 'last_week', 'class' => '',
23 - 'person' => '', 'bill' => '' );
 23+ 'person' => '', 'bill' => '', 'display_cat'=>'' );
2424
2525 function __construct( $arg_list ) {
2626 // print_r($arg_list);
@@ -209,38 +209,42 @@
210210 $ptitle = Title::MakeTitle( NS_MAIN, $mvd_row->Speech_by );
211211 $mvd_out_html .= '<span class="keywords">' .
212212 $sk->makeKnownLinkObj( $ptitle, $ptitle->getText() ) .
213 - '</span>';
 213+ '</span><br>';
214214 }
215215 }
216216 if ( isset( $mvd_row->Bill ) ) {
217217 if ( trim( $mvd_row->Bill ) != '' ) {
218218 $btitle = Title::MakeTitle( NS_MAIN, $mvd_row->Bill );
219 - $mvd_out_html .= '<br><span class="keywords">Bill:' .
 219+ $mvd_out_html .= '<span class="keywords">Bill: ' .
220220 $sk->makeKnownLinkObj( $btitle ) . '
221 - </span>';
 221+ </span><br>';
222222 }
223223 }
224224 global $wgContLang;
225225 $mvdNStxt = $wgContLang->getNsText(MV_NS_MVD);
226 - //grab categories:
227 - /*$cl_res = $dbr->select('categorylinks', 'cl_to',
228 - array('cl_sortkey'=>$mvdNStxt.':'.str_replace('_',' ',$mvd_row->wiki_title)),
229 - 'getTopClips::Categories',
230 - 'LIMIT 0, 5');
231 - if($dbr->numRows($cl_res)!=0){
232 - $o.='<span class="keywords">Categories: ';
233 - $coma='';
234 - while($cl_row= $dbr->fetchObject($cl_res) ){
235 - $cTitle = Title::MakeTitle(NS_CATEGORY, $cl_row->cl_to);
236 - $mvd_out_html.=$coma.$sk->makeKnownLinkObj($cTitle, $cTitle->getText());
237 - $coma=', ';
238 - }
239 - $mvd_out_html.='</span>';
240 - }*/
 226+
 227+ //grab categories if no bill or speech
 228+ if( $this->params['display_cat'] || $mvd_out_html=='' ){
 229+ $dbr = wfGetDB( DB_READ );
 230+ $cl_res = $dbr->select('categorylinks', 'cl_to',
 231+ array('cl_sortkey'=>$mvdNStxt.':'.str_replace('_',' ',$mvd_row->wiki_title)),
 232+ 'getTopClips::Categories',
 233+ 'LIMIT 0, 5');
 234+ if($dbr->numRows($cl_res)!=0){
 235+ $mvd_out_html .='<span class="keywords">Categories: ';
 236+ $coma='';
 237+ while($cl_row= $dbr->fetchObject($cl_res) ){
 238+ $cTitle = Title::MakeTitle(NS_CATEGORY, $cl_row->cl_to);
 239+ $mvd_out_html.=$coma.$sk->makeKnownLinkObj($cTitle, $cTitle->getText());
 240+ $coma=', ';
 241+ }
 242+ $mvd_out_html.='</span><br>';
 243+ }
 244+ }
241245 }else{
242 - //return false if we have not meta
243 - if( isset($opt['remove_no_meta']) && $opt['remove_no_meta'])
244 - return false;
 246+ //we have not meta
 247+ //if( isset($opt['remove_no_meta']) && $opt['remove_no_meta'])
 248+ //return false;
245249 }
246250
247251
Index: trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php
@@ -22,8 +22,10 @@
2323
2424
2525 //script loader settings:
 26+$mvgJSDebug=false;
2627 $wgEnableScriptLoader = true; //if the script loader is on at all
2728 $wgEnableScriptLoaderJsFile = true; //if you can use the script loader with js files (rather than only js classes)
 29+$wgEnableScriptMinify = true;
2830
2931
3032
@@ -31,8 +33,8 @@
3234 // (causes the inclution of jquery into every page.. can slow things down a bit)
3335 $mvEnableAutoComplete = true;
3436
35 -$mvgJSDebug=false;
3637
 38+
3739 // if you want mvd links to be rewritten client side as inline movie clips and link to the stream page
3840 $mvEnableJSMVDrewrite = true;
3941
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php
@@ -558,7 +558,7 @@
559559 if ( !$mvTitle->doesStreamExist() )return ;
560560
561561 // @@todo this should be cached
562 - $thumb_ref = $mvTitle->getStreamImageURL( '320x240', null, '', true );
 562+ $thumb_ref = $mvTitle->getFullStreamImageURL( '320x240', null, '', true );
563563 if ( $desc_html == '' ) {
564564 $article = new Article( $wikiTitle );
565565 $wgOut->clearHTML();
@@ -590,13 +590,21 @@
591591 <?php echo $desc_xml?>
592592 </description>
593593 <?php
594 -global $mvDefaultVideoQualityKey, $mvVidQualityMsgKeyType;
595 -//check a few different types:
596 -$stream_url = $mvTitle->getWebStreamURL($mvDefaultVideoQualityKey);
597 -if($stream_url !== false && isset( $mvVidQualityMsgKeyType[ $mvDefaultVideoQualityKey ]) ) {
598 - echo '<enclosure name="'. wfMsg($mvDefaultVideoQualityKey) .'" type="video/ogg" url="'. mvRSSFeed::xmlEncode( $ogg_stream_url ) .'"/>';
 594+global $mvDefaultVideoQualityKey, $mvVidQualityMsgKeyType, $mvDefaultVideoHighQualityKey;
 595+//check a few different types in order of prefrence:
 596+if( $stream_url = $mvTitle->getWebStreamURL($mvDefaultVideoHighQualityKey) ){
 597+ $mk = $mvDefaultVideoHighQualityKey;
 598+}else if( $stream_url = $mvTitle->getWebStreamURL($mvDefaultVideoQualityKey) ) {
 599+ $mk = $mvDefaultVideoQualityKey;
 600+}else if( $stream_url = $mvTitle->getWebStreamURL($mvDefaultFlashQualityKey) ) {
 601+ $mk = $mvDefaultFlashQualityKey;
599602 }
 603+if($stream_url) {
 604+ echo '<enclosure name="'. wfMsg($mk) .'" type="video/ogg" '.
 605+ 'url="'. mvRSSFeed::xmlEncode( $stream_url ).'"/>';
 606+}
600607 ?>
 608+
601609 <comments>
602610 <?php echo mvRSSFeed::xmlEncode( $talkpage->getFullUrl() )?>
603611 </comments>
Index: trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php
@@ -46,7 +46,7 @@
4747 global $mvVersion, $mvNamespace, $mvgIP, $wgHooks, $wgExtensionCredits, $mvMasterStore,
4848 $wgParser, $mvArticlePath, $mvgScriptPath, $wgServer, $wgExtensionFunctions, $markerList,$wgVersion,
4949 $wgAjaxExportList, $mvEnableAutoComplete, $mvEnableJSMVDrewrite,
50 - $wgAutoloadClasses, $wgSpecialPages, $wgMediaHandlers, $wgJsAutoloadLocalClasses,
 50+ $wgAutoloadClasses, $wgSpecialPages, $wgMediaHandlers, $wgJSAutoloadClasses,
5151 $wgAPIModules;
5252
5353
@@ -100,34 +100,51 @@
101101 /**********************************************/
102102 $mv_jspath = $mvgIP . '/skins/';
103103 $mvjsp = $mv_jspath . 'mv_embed/';
 104+ //core:
 105+ $wgJSAutoloadClasses['window.jQuery'] = $mvjsp . 'jquery/jquery-1.2.6.js';
 106+ $wgJSAutoloadClasses['mv_embed'] = $mvjsp . 'mv_embed.js';
104107
 108+ $wgJSAutoloadClasses['mv_allpages'] = $mv_jspath . 'mv_allpages.js';
 109+ $wgJSAutoloadClasses['mv_search'] = $mv_jspath . 'mv_search.js';
 110+ $wgJSAutoloadClasses['mv_stream'] = $mv_jspath . 'mv_stream.js';
 111+
 112+ //$wgJSAutoloadClasses['']
 113+ $wgJSAutoloadClasses['j.ui.mouse'] = $mvjsp . 'jquery/jquery.ui-1.5.2/ui/ui.core.js';
 114+ $wgJSAutoloadClasses['j.ui.droppable'] = $mvjsp . 'jquery/jquery.ui-1.5.2/ui/ui.droppable.js';
 115+ $wgJSAutoloadClasses['j.ui.draggable'] = $mvjsp . 'jquery/jquery.ui-1.5.2/ui/ui.draggable.js';
 116+ $wgJSAutoloadClasses['j.ui.sortable'] = $mvjsp . 'jquery/jquery.ui-1.5.2/ui/ui.sortable.js';
 117+ $wgJSAutoloadClasses['j.ui.resizable'] = $mvjsp . 'jquery/jquery.ui-1.5.2/ui/ui.resizable.js';
 118+ $wgJSAutoloadClasses['j.contextMenu'] = $mvjsp . 'jquery/plugins/jquery.contextMenu.js';
 119+ $wgJSAutoloadClasses['j.fn.autocomplete'] = $mvjsp . 'jquery/plugins/jquery.autocomplete.js';
 120+ $wgJSAutoloadClasses['j.fn.hoverIntent'] = $mvjsp . 'jquery/plugins/jquery.hoverIntent.js';
 121+
105122 //libAddMedia:
106 - $wgJsAutoloadLocalClasses['upFirefogg'] = $mvjsp . 'libAddMedia/firefogg.js';
107 - $wgJsAutoloadLocalClasses['mvUploader'] = $mvjsp . 'libAddMedia/mvUploader.js';
108 - $wgJsAutoloadLocalClasses['remoteSearchDriver'] = $mvjsp . 'libAddMedia/remoteSearchDriver.js';
109 - $wgJsAutoloadLocalClasses['mediaWikiSearch'] = $mvjsp . 'libAddMedia/searchLibs/mediaWikiSearch.js';
110 - $wgJsAutoloadLocalClasses['metavidSearch'] = $mvjsp . 'libAddMedia/searchLibs/metavidSearch.js';
111 - $wgJsAutoloadLocalClasses['solrArchiveSearch'] = $mvjsp . 'libAddMedia/searchLibs/solrArchiveSearch.js';
 123+ $wgJSAutoloadClasses['upFirefogg'] = $mvjsp . 'libAddMedia/firefogg.js';
 124+ $wgJSAutoloadClasses['mvUploader'] = $mvjsp . 'libAddMedia/mvUploader.js';
 125+ $wgJSAutoloadClasses['remoteSearchDriver'] = $mvjsp . 'libAddMedia/remoteSearchDriver.js';
 126+ $wgJSAutoloadClasses['mediaWikiSearch'] = $mvjsp . 'libAddMedia/searchLibs/mediaWikiSearch.js';
 127+ $wgJSAutoloadClasses['metavidSearch'] = $mvjsp . 'libAddMedia/searchLibs/metavidSearch.js';
 128+ $wgJSAutoloadClasses['solrArchiveSearch'] = $mvjsp . 'libAddMedia/searchLibs/solrArchiveSearch.js';
112129
113130 //libClipEdit:
114 - $wgJsAutoloadLocalClasses['mvClipEdit'] = $mvjsp . 'libClipEdit/mvClipEdit.js';
 131+ $wgJSAutoloadClasses['mvClipEdit'] = $mvjsp . 'libClipEdit/mvClipEdit.js';
115132
116133 //libEmbedObj:
117 - $wgJsAutoloadLocalClasses['mv_baseEmbed'] = $mvjsp . 'libEmbedObj/mv_baseEmbed.js';
118 - $wgJsAutoloadLocalClasses['mv_flashEmbed'] = $mvjsp . 'libEmbedObj/mv_flashEmbed.js';
119 - $wgJsAutoloadLocalClasses['mv_genericEmbed'] = $mvjsp . 'libEmbedObj/mv_genericEmbed.js';
120 - $wgJsAutoloadLocalClasses['mv_htmlEmbed'] = $mvjsp . 'libEmbedObj/mv_htmlEmbed.js';
121 - $wgJsAutoloadLocalClasses['mv_javaEmbed'] = $mvjsp . 'libEmbedObj/mv_javaEmbed.js';
122 - $wgJsAutoloadLocalClasses['mv_nativeEmbed'] = $mvjsp . 'libEmbedObj/mv_nativeEmbed.js';
123 - $wgJsAutoloadLocalClasses['mv_quicktimeEmbed'] = $mvjsp . 'libEmbedObj/mv_quicktimeEmbed.js';
124 - $wgJsAutoloadLocalClasses['mv_vlcEmbed'] = $mvjsp . 'libEmbedObj/mv_vlcEmbed.js';
 134+ $wgJSAutoloadClasses['embedVideo'] = $mvjsp . 'libEmbedObj/mv_baseEmbed.js';
 135+ $wgJSAutoloadClasses['flashEmbed'] = $mvjsp . 'libEmbedObj/mv_flashEmbed.js';
 136+ $wgJSAutoloadClasses['genericEmbed'] = $mvjsp . 'libEmbedObj/mv_genericEmbed.js';
 137+ $wgJSAutoloadClasses['htmlEmbed'] = $mvjsp . 'libEmbedObj/mv_htmlEmbed.js';
 138+ $wgJSAutoloadClasses['javaEmbed'] = $mvjsp . 'libEmbedObj/mv_javaEmbed.js';
 139+ $wgJSAutoloadClasses['nativeEmbed'] = $mvjsp . 'libEmbedObj/mv_nativeEmbed.js';
 140+ $wgJSAutoloadClasses['quicktimeEmbed'] = $mvjsp . 'libEmbedObj/mv_quicktimeEmbed.js';
 141+ $wgJSAutoloadClasses['vlcEmbed'] = $mvjsp . 'libEmbedObj/mv_vlcEmbed.js';
125142
126143 //libSequencer:
127 - $wgJsAutoloadLocalClasses['mvPlayList'] = $mvjsp . 'libSequencer/mvPlayList.js';
128 - $wgJsAutoloadLocalClasses['mvSequencer'] = $mvjsp . 'libSequencer/mvSequencer.js';
 144+ $wgJSAutoloadClasses['mvPlayList'] = $mvjsp . 'libSequencer/mvPlayList.js';
 145+ $wgJSAutoloadClasses['mvSequencer'] = $mvjsp . 'libSequencer/mvSequencer.js';
129146
130147 //libTimedText:
131 - $wgJsAutoloadLocalClasses['mvTextInterface'] = $mvjsp . 'libTimedText/mvTextInterface.js';
 148+ $wgJSAutoloadClasses['mvTextInterface'] = $mvjsp . 'libTimedText/mvTextInterface.js';
132149
133150
134151 /**********************************************/
@@ -324,28 +341,38 @@
325342 * enables linkback and autocomplete for search
326343 */
327344 function mvfAutoAllPageHeader() {
328 - global $mvgScriptPath, $wgJsMimeType, $wgOut, $mvExtraHeader, $wgTitle, $mvgJSDebug;
 345+ global $mvgScriptPath, $wgJsMimeType, $wgOut, $mvExtraHeader, $wgTitle, $mvgJSDebug, $wgEnableScriptLoader;
329346 $mvgScriptPath = htmlspecialchars( $mvgScriptPath );
330347 $wgJsMimeType = htmlspecialchars( $wgJsMimeType ) ;
331348 //set the unquie request value
332349 if( $mvgJSDebug ){
333350 $unique_req_param = time();
334351 }else{
 352+ //@@could just read from the svn version file info
335353 $unique_req_param = MV_VERSION;
336354 }
337355
338356 /* (moved to on_dom ready) but here as well*/
339 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/jquery-1.2.6.min.js?{$unique_req_param}\"></script>" );
340 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/plugins/jquery.autocomplete.js?{$unique_req_param}\"></script>" );
341 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/plugins/jquery.hoverIntent.js?{$unique_req_param}\"></script>" );
342 -
343 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/mv_embed.js?{$unique_req_param}\"></script>" );
344 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_allpages.js?{$unique_req_param}\"></script>" );
345 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_search.js?{$unique_req_param}\"></script>" );
 357+ if( $wgEnableScriptLoader ){
 358+ $debug_param = ($mvgJSDebug)?'&debug=true':false;
 359+ $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/mvwScriptLoader.php?" .
 360+ "class=window.jQuery,j.fn.autocomplete,j.fn.hoverIntent,mv_embed,mv_allpages,mv_search" .
 361+ '&urid=' .$unique_req_param .
 362+ $debug_param . "\"></script>"
 363+ );
 364+ }else{
 365+ $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/jquery-1.2.6.min.js?{$unique_req_param}\"></script>" );
 366+ $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/plugins/jquery.autocomplete.js?{$unique_req_param}\"></script>" );
 367+ $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/plugins/jquery.hoverIntent.js?{$unique_req_param}\"></script>" );
 368+
 369+ $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/mv_embed.js?{$unique_req_param}\"></script>" );
 370+ $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_allpages.js?{$unique_req_param}\"></script>" );
 371+ $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_search.js?{$unique_req_param}\"></script>" );
 372+ }
346373
347374 //temp for testing:
348 - if( $mvgJSDebug )
349 - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/add_media_wizard.js?{$unique_req_param}\"></script>" );
 375+ //if( $mvgJSDebug )
 376+ // $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/add_media_wizard.js?{$unique_req_param}\"></script>" );
350377
351378 $mvCssUrl = $mvgScriptPath . '/skins/mv_custom.css';
352379 $wgOut->addLink( array(
Index: trunk/extensions/MetavidWiki/skins/mv_common.js
@@ -1,27 +0,0 @@
2 -/*@@TODO should be set by mediaWiki so it uses wfMsg */
3 -
4 -/*
5 -* adds adjustment hooks
6 -* @mvd_id set to the mvd_id
7 -*/
8 -
9 -
10 -//alert(typeof js_log);
11 -//logging:
12 -function js_log(string){
13 - if( window.console ){
14 - console.log(string);
15 - }else{
16 - /*
17 - * IE and non-firebug debug append text box:
18 - */
19 - /* var log_elm = document.getElementById('mv_js_log');
20 - if(!log_elm){
21 - document.write('<textarea id="mv_js_log" cols="80" rows="6"></textarea>');
22 - var log_elm = document.getElementById('mv_js_log');
23 - }
24 - if(log_elm){
25 - log_elm.value+=string+"\n";
26 - }*/
27 - }
28 -}
Index: trunk/extensions/MetavidWiki/skins/add_media_wizard.js
@@ -42,8 +42,10 @@
4343 //alert("!!upload hook");
4444 load_mv_embed( function(){
4545 //load jQuery and what not (we need to refactor the loading system for mv_embed)
46 - mvEmbed.load_libs(function(){
47 - mvJsLoader.doLoad({'mvUploader' : 'libAddMedia/mvUploader.js'},function(){
 46+ mvJsLoader.loadBaseLibs(function(){
 47+ mvJsLoader.doLoad( {
 48+ 'mvUploader' : 'libAddMedia/mvUploader.js'
 49+ },function(){
4850 mvUp = new mvUploader();
4951 });
5052 });
Index: trunk/extensions/MetavidWiki/skins/mv_search.js
@@ -4,8 +4,7 @@
55 var mv_search_action='';
66 function mv_pre_setup_search(req_mode){
77 //make sure we have jQuery and any base required libs:
8 - mvJsLoader.doLoad(mvEmbed.lib_jquery, function(){
9 - _global['$j'] = jQuery.noConflict();
 8+ mvJsLoader.loadBaseLibs(function(){
109 mv_setup_search(req_mode);
1110 });
1211 }
Index: trunk/extensions/MetavidWiki/skins/mv_allpages.js
@@ -16,26 +16,23 @@
1717
1818 var gMvd={};
1919 function mv_setup_allpage(){
20 - js_log("mv embed done loading now setup 'all page'");
21 -
 20+ js_log("mv embed done loading now setup 'all page'");
2221 //make sure we have jQuery and any base required libs:
23 - mvJsLoader.doLoad(mvEmbed.lib_jquery, function(){
24 - _global['$j'] = jQuery.noConflict();
25 - js_log('allpage_ did jquery check');
26 -
27 - var reqLibs = {'$j.fn.autocomplete':'jquery/plugins/jquery.autocomplete.js',
28 - '$j.fn.hoverIntent':'jquery/plugins/jquery.hoverIntent.js'};
29 - mvJsLoader.doLoad(
30 - reqLibs, function(){
31 - //js_log('allpage_ auto and hover check'+mv_setup_allpage_flag);
32 - if(!mv_setup_allpage_flag){
33 - mv_setup_search_ac();
34 - mv_do_mvd_link_rewrite();
35 - mv_page_specific_rewrites();
36 - //set the flag:
37 - mv_setup_allpage_flag=true;
38 - }
39 - });
 22+ mvJsLoader.loadBaseLibs(function(){
 23+ js_log('allpage_ did jquery check');
 24+ mvJsLoader.doLoad( {
 25+ '$j.fn.autocomplete':'jquery/plugins/jquery.autocomplete.js',
 26+ '$j.fn.hoverIntent':'jquery/plugins/jquery.hoverIntent.js'
 27+ }, function(){
 28+ //js_log('allpage_ auto and hover check'+mv_setup_allpage_flag);
 29+ if( !mv_setup_allpage_flag ){
 30+ mv_setup_search_ac();
 31+ mv_do_mvd_link_rewrite();
 32+ mv_page_specific_rewrites();
 33+ //set the flag:
 34+ mv_setup_allpage_flag=true;
 35+ }
 36+ });
4037 });
4138 }
4239 function mv_do_sequence_edit_swap(mode){
Index: trunk/extensions/MetavidWiki/skins/mv_stream.js
@@ -54,13 +54,13 @@
5555 function mv_load_interface_libs(){
5656 js_log('f:mv_load_interface_libs');
5757 //we will need mv_embed stuff:
58 - mvEmbed.load_libs(function(){
 58+ mvJsLoader.loadBaseLibs(function(){
5959 js_log('load stream js');
6060 //load some additional plugins/components:
6161 //:hoverIntent
6262 //http://cherne.net/brian/resources/jquery.hoverIntent.html
6363 mvJsLoader.doLoad({
64 - '$j.autocomplete' : 'jquery/plugins/jquery.autocomplete.js',
 64+ '$j.fn.autocomplete' : 'jquery/plugins/jquery.autocomplete.js',
6565 '$j.fn.hoverIntent' : 'jquery/plugins/jquery.hoverIntent.js',
6666 '$j.ui.resizable' : 'jquery/jquery.ui-1.5.2/ui/minified/ui.resizable.min.js',
6767 'mvClipEdit' : 'libClipEdit/mvClipEdit.js'
@@ -68,8 +68,12 @@
6969 //now extend draggable
7070 mvJsLoader.doLoad({
7171 '$j.ui.draggable.prototype.plugins.drag':'jquery/plugins/ui.draggable.ext.js'
72 - },function(){
73 - mv_stream_interface.init();
 72+ },function(){
 73+ //make sure mv_embed has done video re-write:
 74+ mv_embed( function(){
 75+ mv_stream_interface.init();
 76+ });
 77+
7478 });
7579 });
7680 });
@@ -95,7 +99,7 @@
96100 //add_custom_effects();
97101 //set up the init values for mouse over restore:
98102 org_vid_title = $j('#mv_stream_time').html();
99 - if( $j('#embed_vid').length==0 || !$j('#embed_vid').get(0).ready_to_play){
 103+ if( $j('#embed_vid').length==0 || !$j('#embed_vid').get(0).ready_to_play ){
100104 //no embed video present stop init
101105 js_log('no clip ready to play');
102106 return false;
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -22,8 +22,12 @@
2323 }
2424
2525 //used to grab fresh copies of scripts. (should be changed on commit)
26 -var MV_EMBED_VERSION = '1.0r10';
 26+var MV_EMBED_VERSION = '1.0r11';
2727
 28+//if we should use the scriptLoader
 29+//( lets you group requests, minimize javascript, and use mediaWiki localization infastructure)
 30+var MV_USE_SCRIPT_LOADER = true;
 31+
2832 //the name of the player skin (default is mvpcf)
2933 var mv_skin_name = 'mvpcf';
3034
@@ -68,52 +72,48 @@
6973 }
7074
7175 //all default msg in [English] should be overwritten by the CMS language msg system.
72 -loadGM( {
73 - 'loading_txt':'loading <blink>...</blink>',
74 - 'loading_plugin' : 'loading plugin<blink>...</blink>',
75 - 'select_playback' : 'Set Playback Preference',
76 - 'link_back' : 'Link Back',
77 - 'error_load_lib' : 'mv_embed: Unable to load required javascript libraries\n'+
78 - 'insert script via DOM has failed, try reloading? ',
 76+loadGM({
 77+ "loading_txt":"loading <blink>...</blink>",
 78+ "loading_plugin" : "loading plugin<blink>...</blink>",
 79+ "select_playback" : "Set Playback Preference",
 80+ "link_back" : "Link Back",
 81+ "error_load_lib" : "mv_embed: Unable to load required javascript libraries\n insert script via DOM has failed, try reloading? ",
7982
80 - 'error_swap_vid' : 'Error:mv_embed was unable to swap the video tag for the mv_embed interface',
 83+ "error_swap_vid" : "Error:mv_embed was unable to swap the video tag for the mv_embed interface",
8184
82 - 'download_segment' : 'Download Selection:',
83 - 'download_full' : 'Download Full Video File:',
84 - 'download_clip' : 'Download the Clip',
85 - 'download_text' : 'Download Text (<a style="color:white" title="cmml" href="http://wiki.xiph.org/index.php/CMML">cmml</a> xml):',
 85+ "download_segment" : "Download Selection:",
 86+ "download_full" : "Download Full Video File:",
 87+ "download_clip" : "Download the Clip",
 88+ "download_text" : "Download Text (<a style=\"color:white\" title=\"cmml\" href=\"http://wiki.xiph.org/index.php/CMML\">cmml</a> xml):",
8689
87 - 'clip_linkback' : 'Clip Source Page',
88 - //plugin names:
89 - 'ogg-player-vlc-mozilla' : 'VLC Plugin',
90 - 'ogg-player-videoElement' : 'Native Ogg Video Support',
91 - 'ogg-player-vlc-activex' : 'VLC ActiveX',
92 - 'ogg-player-oggPlay' : 'Annodex OggPlay Plugin',
93 - 'ogg-player-oggPlugin' : 'Generic Ogg Plugin',
94 - 'ogg-player-quicktime-mozilla' : 'Quicktime Plugin',
95 - 'ogg-player-quicktime-activex' : 'Quicktime ActiveX',
96 - 'ogg-player-cortado' : 'Java Cortado',
97 - 'ogg-player-flowplayer' : 'Flowplayer',
98 - 'ogg-player-selected' : ' (selected)',
99 - 'generic_missing_plugin' : 'You browser does not appear to support playback type: <b>$1</b><br>' +
100 - 'visit the <a href="http://metavid.org/wiki/Client_Playback">Playback Methods</a> page to download a player<br>',
 90+ "clip_linkback" : "Clip Source Page",
 91+
 92+ "ogg-player-vlc-mozilla" : "VLC Plugin",
 93+ "ogg-player-videoElement" : "Native Ogg Video Support",
 94+ "ogg-player-vlc-activex" : "VLC ActiveX",
 95+ "ogg-player-oggPlay" : "Annodex OggPlay Plugin",
 96+ "ogg-player-oggPlugin" : "Generic Ogg Plugin",
 97+ "ogg-player-quicktime-mozilla" : "Quicktime Plugin",
 98+ "ogg-player-quicktime-activex" : "Quicktime ActiveX",
 99+ "ogg-player-cortado" : "Java Cortado",
 100+ "ogg-player-flowplayer" : "Flowplayer",
 101+ "ogg-player-selected" : " (selected)",
 102+ "generic_missing_plugin" : "You browser does not appear to support playback type: <b>$1</b><br> visit the <a href=\"http://metavid.org/wiki/Client_Playback\">Playback Methods</a> page to download a player<br>",
101103
102 - 'add_to_end_of_sequence' : 'Add to End of Sequence',
 104+ "add_to_end_of_sequence" : "Add to End of Sequence",
103105
104 - 'missing_video_stream' : 'The video file for this stream is missing',
 106+ "missing_video_stream" : "The video file for this stream is missing",
105107
106 - 'select_transcript_set' : 'Select Text Layers',
107 - 'auto_scroll' : 'auto scroll',
108 - 'close' : 'close',
109 - 'improve_transcript' : 'Improve Transcript',
 108+ "select_transcript_set" : "Select Text Layers",
 109+ "auto_scroll" : "auto scroll",
 110+ "close" : "close",
 111+ "improve_transcript" : "Improve Transcript",
110112
111 - 'next_clip_msg' : 'Play Next Clip',
112 - 'prev_clip_msg' : 'Play Previous Clip',
113 - 'current_clip_msg' : 'Continue Playing this Clip',
114 -
115 - 'seek_to' : 'Seek to'
116 - }
117 -);
 113+ "next_clip_msg" : "Play Next Clip",
 114+ "prev_clip_msg" : "Play Previous Clip",
 115+ "current_clip_msg" : "Continue Playing this Clip",
 116+ "seek_to" : "Seek to"
 117+});
118118
119119 //get a language message
120120 function gM( key , args ) {
@@ -144,114 +144,170 @@
145145 '</div>');
146146 }
147147
148 -/*********** INITIALIZATION CODE *************
149 - * the mvEmbed object drives basic loading of libs
150 - * its load_libs function will be called if mv_embed is to be used on a given page
151 - *********************************************/
152 -var mvEmbed = {
153 - Version: MV_EMBED_VERSION,
154 - loaded:false,
155 - load_time:0,
156 - flist:Array(),
157 - load_callback:false,
158 - loading:false,
159 - libs_loaded:false,
160 - //plugin libs var names and paths:
161 - lib_base:{
162 - 'window.jQuery' :'jquery/jquery-1.2.6.js',
163 - 'embedVideo' :'libEmbedObj/mv_baseEmbed.js'
164 - },
165 - lib_plugins:{
166 - '$j.ui.mouse' :'jquery/jquery.ui-1.5.2/ui/minified/ui.core.min.js' //load the core ui
167 - },
168 - // not used:
169 - //'$j.timer.global':'jquery/plugins/jquery.timers.js',
170 - lib_controlui:{
171 - '$j.ui.droppable':'jquery/jquery.ui-1.5.2/ui/minified/ui.droppable.min.js',
172 - '$j.ui.draggable':'jquery/jquery.ui-1.5.2/ui/minified/ui.draggable.min.js'
173 - },
174 - /* @@todo move to single packaged jquery ui library:
175 - , //include draggable
176 - '$j.ui.resizable':'jquery/jquery.ui-1.5.2/ui/minified/ui.resizable.min.js'
177 - '$j.ui.progressbar':'jquery/jquery-ui-personalized-1.6rc1.debug.js'
178 - */
179 - pc:null, //used to store pointer to parent clip (when in playlist mode)
180 - load_libs:function( callback , target_id){
181 - //js_log('f:load_libs: '+callback);
182 - if( callback )this.load_callback = callback;
183 -
184 - //if libs are already loaded jump directly to the callback
185 - if(this.libs_loaded){
186 - mvEmbed.init( target_id );
187 - return true;
188 - }
189 - //two loading stages, first get jQuery
190 - var _this = this;
191 - mvJsLoader.doLoad(this.lib_base,function(){
192 - js_log("type of " + typeof window.jQuery);
193 - //once jQuery is loaded set up no conflict & load plugins:
194 - _global['$j'] = jQuery.noConflict();
195 - //set up ajax to not send dynamic urls for loading scripts
196 - $j.ajaxSetup({
197 - cache: true
198 - });
199 - js_log('jquery loaded');
200 - mvJsLoader.doLoad(_this.lib_plugins, function(){
201 - //load control ui after ui.core loaded
202 - mvJsLoader.doLoad(_this.lib_controlui, function(){
203 - js_log('plugins loaded');
204 - mvEmbed.libs_loaded=true;
205 - mvEmbed.init();
 148+/**
 149+ * mvJsLoader class handles initialization and js file loads
 150+ */
 151+var mvJsLoader = {
 152+ libreq:{},
 153+ libs:{},
 154+ //to keep consistency across threads:
 155+ ptime:0,
 156+ ctime:0,
 157+ load_error:false,//load error flag (false by default)
 158+ calledloadBaseLibs:false,//flag for base load lib
 159+ load_time:0,
 160+ callbacks:new Array(),
 161+
 162+ flist:new Array(),
 163+ loadBaseLibs : function( callback ){
 164+ //queue the callback:
 165+ if(callback)
 166+ mvJsLoader.addLoadEvent(callback);
 167+ //run if not already running:
 168+ if( ! mvJsLoader.calledloadBaseLibs ){
 169+ js_log("called loadBaseLibs");
 170+ //only call load base libs once
 171+ mvJsLoader.calledloadBaseLibs=true;
 172+ //issue a style sheet request can come in whenever:
 173+ if(!styleSheetPresent(mv_embed_path+'skins/'+mv_skin_name+'/styles.css'))
 174+ loadExternalCss(mv_embed_path+'skins/'+mv_skin_name+'/styles.css');
 175+
 176+ //two loading stages, first get jQuery
 177+ var _this = this;
 178+ mvJsLoader.doLoad({
 179+ 'window.jQuery' :'jquery/jquery-1.2.6.js',
 180+ 'embedVideo' :'libEmbedObj/mv_baseEmbed.js'
 181+ },function(){
 182+ //once jQuery is loaded set up no conflict & load plugins:
 183+ _global['$j'] = jQuery.noConflict();
 184+ //set up ajax to not send dynamic urls for loading scripts
 185+ $j.ajaxSetup({
 186+ cache: true
206187 });
207 - });
208 - });
209 - },
210 - addLoadEvent:function(fn){
211 - this.flist.push(fn);
212 - },
213 - init: function( target_id ){
214 - //load mv_embed skin stylesheet:
215 - if(!styleSheetPresent(mv_embed_path+'skins/'+mv_skin_name+'/styles.css'))
216 - loadExternalCss(mv_embed_path+'skins/'+mv_skin_name+'/styles.css');
217 -
218 - mv_embed( target_id );
219 -
220 - this.check_init_done();
221 - },
222 - /*
223 - * should be cleaned up ... the embedType loading should be part of load_libs above:
224 - */
225 - check_init_done:function(){
226 - //check if all videos are "ready to play"
227 - var is_ready=true;
228 -
229 - for(var i=0; i < global_player_list.length; i++){
230 - if( $j('#'+global_player_list[i]).length !=0){
231 - var cur_vid = $j('#'+global_player_list[i]).get(0);
232 - is_ready = ( cur_vid.ready_to_play ) ? is_ready : false;
233 - if( !is_ready && cur_vid.load_error ){
234 - is_ready=true;
235 - $j(cur_vid).html( cur_vid.load_error );
236 - }
237 - }
238 - }
239 - //js_log('f:check_init_done '+ is_ready + ' ' + cur_vid.load_error + ' rtp: '+ cur_vid.ready_to_play);
240 - if( !is_ready ){
241 - //js_log('some ' + global_player_list + ' not ready');
242 - setTimeout( 'mvEmbed.check_init_done()', 50 );
243 - }else{
244 - //call the callback:
245 - if(typeof this.load_callback == 'function')
246 - if(this.load_callback)this.load_callback();
247 -
248 - //js_log('run queue functions:' + mvEmbed.flist);
249 - while (mvEmbed.flist.length){
250 - mvEmbed.flist.shift()();
251 - }
252 - }
253 - }
 188+ js_log('jquery loaded');
 189+ //load the jQuery dependent plugins:
 190+ mvJsLoader.doLoad({
 191+ '$j.ui.mouse' :'jquery/jquery.ui-1.5.2/ui/minified/ui.core.min.js',
 192+ '$j.ui.droppable' : 'jquery/jquery.ui-1.5.2/ui/minified/ui.droppable.min.js',
 193+ '$j.ui.draggable' : 'jquery/jquery.ui-1.5.2/ui/minified/ui.draggable.min.js'
 194+ },function(){
 195+ js_log('plugins loaded');
 196+ // run queued functions
 197+ while (mvJsLoader.flist.length){
 198+ mvJsLoader.flist.shift()();
 199+ }
 200+ });
 201+ });
 202+ }
 203+ },
 204+ addLoadEvent:function(fn){
 205+ this.flist.push(fn);
 206+ },
 207+ doLoad:function(libs, callback){
 208+ this.ctime++;
 209+ if(libs){ //setup this.libs:
 210+
 211+ //first check if we already have this lib loaded
 212+ var all_libs_loaded=true;
 213+ for(var i in libs){
 214+ //check if the lib is already loaded:
 215+ if( ! this.checkObjPath( i ) ){
 216+ all_libs_loaded=false;
 217+ }
 218+ }
 219+ if( all_libs_loaded ){
 220+ //jump directly to the call back; do not pass go do not issue load request
 221+ callback();
 222+ return ;
 223+ }
 224+
 225+ //check if we should use the script loader to combine all the requests into one:
 226+ if( MV_USE_SCRIPT_LOADER ){
 227+ var class_set = '';
 228+ var last_class = '';
 229+ var coma = '';
 230+ for( var i in libs ){
 231+ //only add if not included yet:
 232+ if( ! this.checkObjPath( i ) ){
 233+ class_set+=coma + i ;
 234+ last_class=i;
 235+ coma=',';
 236+ }
 237+ }
 238+ this.libs[ last_class ] = 'mvwScriptLoader.php?class=' + class_set +
 239+ '&urid='+ mv_embed_urid;
 240+ }else{
 241+ //do many requests:
 242+ for(var i in libs){ //for in loop oky on object
 243+ //js_log('add lib: '+i + ' = ' + libs[i]);
 244+ this.libs[i]=libs[i];
 245+ }
 246+ }
 247+ }
 248+ if( callback ){
 249+ this.callbacks.push(callback);
 250+ }
 251+ if( mvJsLoader.checkLoading() ){
 252+ if( this.load_time++ > 2000){ //time out after ~50seconds
 253+ js_error( gM('error_load_lib') + this.cur_path );
 254+ this.load_error=true;
 255+ }else{
 256+ setTimeout( 'mvJsLoader.doLoad()', 25 );
 257+ }
 258+ }else{
 259+ //only do callback if we are in the same instance (weird concurency issue)
 260+ var cb_count=0;
 261+ for(var i=0; i < this.callbacks.length; i++)
 262+ cb_count++;
 263+ //js_log('REST LIBS: loading is: '+ loading + ' run callbacks: '+cb_count +' p:'+ this.ptime +' c:'+ this.ctime);
 264+ //reset the libs
 265+ this.libs={};
 266+ //js_log('done loading do call: ' + this.callbacks[0] );
 267+ while( this.callbacks.length !=0 ){
 268+ if( this.ptime== ( this.ctime-1) ){ //enforce thread consistency
 269+ this.callbacks.pop()();
 270+ //func = this.callbacks.pop();
 271+ //js_log(' run: '+this.ctime+ ' p: ' + this.ptime + ' ' +loading+ ' :'+ func);
 272+ //func();
 273+ }else{
 274+ //re-issue doLoad ( ptime will be set to ctime so we should catch up)
 275+ setTimeout('mvJsLoader.doLoad()',25);
 276+ break;
 277+ }
 278+ }
 279+ }
 280+ this.ptime=this.ctime;
 281+ },
 282+ checkLoading:function(){
 283+ var loading=0;
 284+ var i=null;
 285+ for(var i in this.libs){ //for in loop oky on object
 286+ if( ! this.checkObjPath( i ) ){
 287+ if(!this.libreq[i]) loadExternalJs( mv_embed_path + this.libs[i] );
 288+ this.libreq[i]=1;
 289+ loading=1;
 290+ }
 291+ }
 292+ return loading;
 293+ },
 294+ checkObjPath:function( libVar ){
 295+ var objPath = libVar.split('.')
 296+ var cur_path ='';
 297+ for(var p=0; p < objPath.length; p++){
 298+ cur_path = (cur_path=='')?cur_path+objPath[p]:cur_path+'.'+objPath[p];
 299+ eval( 'var ptest = typeof ( '+ cur_path + ' ); ');
 300+ if( ptest == 'undefined'){
 301+ return false;
 302+ }
 303+ }
 304+ this.cur_path = cur_path;
 305+ return true;
 306+ }
254307 }
255308
 309+
 310+
 311+
256312 /**
257313 * mediaPlayer represents a media player plugin.
258314 * @param {String} id id used for the plugin.
@@ -649,87 +705,6 @@
650706
651707 //load an external JS (similar to jquery .require plugin)
652708 //but checks for object availability rather than load state
653 -var mvJsLoader = {
654 - libreq:{},
655 - libs:{},
656 - //to keep consistency across threads:
657 - ptime:0,
658 - ctime:0,
659 - load_error:false,//load error flag (false by default)
660 -
661 - load_time:0,
662 - callbacks:new Array(),
663 - doLoad:function(libs,callback){
664 - this.ctime++;
665 - //js_log('doLoad: '+this.ctime);
666 - //stack callbacks
667 - if(callback){
668 - this.callbacks.push(callback);
669 - }
670 - //merge any new requested libs
671 - if(libs){
672 - for(var i in libs){ //for in loop oky on object
673 - //js_log('add lib: '+i + ' = ' + libs[i]);
674 - this.libs[i]=libs[i];
675 - }
676 - }
677 - var loading=0;
678 - var i=null;
679 - for(var i in this.libs){ //for in loop oky on object
680 - //if(i=='vlcEmbed')alert('got called with '+i+' ' + typeof(vlcEmbed));
681 - //itor the objPath (to avoid 'has no properties' errors)
682 - var objPath = i.split('.');
683 - var cur_path ='';
684 - var cur_load=0;
685 - for(var p=0; p < objPath.length; p++){
686 - cur_path = (cur_path=='')?cur_path+objPath[p]:cur_path+'.'+objPath[p];
687 - if(eval('typeof '+cur_path)=='undefined'){
688 - cur_load = loading=1;
689 - //js_log("cur_load = loading=1");
690 - break;
691 - }
692 - //if we have made the full comparison break out:
693 - if(cur_path==i){
694 - break;
695 - }
696 - }
697 - if(cur_load==1){
698 - if(!this.libreq[i])loadExternalJs(mv_embed_path + this.libs[i]);
699 - this.libreq[i]=1;
700 - }
701 - }
702 - if(loading){
703 - if( this.load_time++ > 2000){ //time out after ~50seconds
704 - js_error( gM('error_load_lib') + cur_path);
705 - this.load_error=true;
706 - }else{
707 - setTimeout('mvJsLoader.doLoad()',25);
708 - }
709 - }else{
710 - //only do callback if we are in the same range:
711 - var cb_count=0;
712 - for(var i=0; i < this.callbacks.length; i++)
713 - cb_count++;
714 - //js_log('REST LIBS: loading is: '+ loading + ' run callbacks: '+cb_count +' p:'+ this.ptime +' c:'+ this.ctime);
715 - //reset the libs
716 - this.libs={};
717 - //js_log('done loading do call: ' + this.callbacks[0] );
718 - while( this.callbacks.length !=0 ){
719 - if( this.ptime== ( this.ctime-1) ){ //enforce thread consistency
720 - this.callbacks.pop()();
721 - //func = this.callbacks.pop();
722 - //js_log(' run: '+this.ctime+ ' p: ' + this.ptime + ' ' +loading+ ' :'+ func);
723 - //func();
724 - }else{
725 - //re-issue doLoad ( ptime will be set to ctime so we should catch up)
726 - setTimeout('mvJsLoader.doLoad()',25);
727 - break;
728 - }
729 - }
730 - }
731 - this.ptime=this.ctime;
732 - }
733 -}
734709
735710 /*********** INITIALIZATION CODE *************
736711 * this will get called when DOM is ready
@@ -740,7 +715,7 @@
741716 * $j(document).ready( function(){ */
742717 function init_mv_embed(force){
743718 js_log('f:init_mv_embed');
744 - if(!force && mv_init_done ){
 719+ if( !force && mv_init_done ){
745720 js_log("mv_init_done do nothing...");
746721 return false;
747722 }
@@ -749,13 +724,15 @@
750725 if(document.getElementsByTagName("video").length!=0 ||
751726 document.getElementsByTagName("playlist").length!=0){
752727 js_log('we have vids to process');
753 - //load libs
754 - mvEmbed.load_libs();
 728+ //load libs and proccess:
 729+ mvJsLoader.loadBaseLibs(function(){
 730+ mv_embed();
 731+ });
755732 }else{
756733 js_log('no video or playlist on the page... (done)');
757734 //run any queued functions:
758 - while (mvEmbed.flist.length){
759 - mvEmbed.flist.shift()();
 735+ while (mvJsLoader.flist.length){
 736+ mvJsLoader.flist.shift()();
760737 }
761738 }
762739 }
@@ -765,7 +742,9 @@
766743 function rewrite_by_id( vid_id, ready_callback ){
767744 js_log('f:rewrite_by_id: ' + vid_id);
768745 //force a recheck of the dom for playlist or video element:
769 - mvEmbed.load_libs( ready_callback, vid_id );
 746+ mvJsLoader.loadBaseLibs(function(){
 747+ mv_embed(ready_callback, vid_id );
 748+ });
770749 }
771750
772751
@@ -795,81 +774,165 @@
796775 /*
797776 * Converts all occurrences of <video> tag into video object
798777 */
799 -function mv_embed( force_id ){
800 - //get mv_embed location if it has not been set
801 - js_log('mv_embed ' + mvEmbed.Version);
802 -
803 - var loadPlaylistLib=false;
804 - //set up the jQuery selector:
805 - var j_selector = 'video,audio,playlist';
806 - if( force_id !=null )
807 - var j_selector = '#'+force_id;
808 -
809 - js_log('SELECTOR: '+ j_selector);
810 -
811 - //process selected elements:
812 - $j(j_selector).each(function(){
813 - js_log( "Do SWAP: " + $j(this).attr("id") + ' tag: '+ this.tagName.toLowerCase() );
814 -
815 - if( $j(this).attr("id") == '' ){
816 - $j(this).attr("id", 'v'+ global_player_list.length);
817 - }
818 - //stre a global reference to the id
819 - global_player_list.push( $j(this).attr("id") );
820 - //add loading: (pre-loading div)
821 - /*$j(this).after('<div id="pre_loading_div_'+elm_id + '">'+
822 - gM('loading_txt')+'</div>' );
823 - */
824 -
825 - //if video doSwap
826 - switch( this.tagName.toLowerCase()){
827 - case 'video':
828 - var videoInterface = new embedVideo(this);
829 - swapEmbedVideoElement( this, videoInterface );
830 - break;
831 - case 'audio':
832 - var videoInterface = new embedVideo(this);
833 - videoInterface.type ='audio';
834 - swapEmbedVideoElement( this, videoInterface );
835 - break;
836 - case 'playlist':
837 - loadPlaylistLib=true;
838 - break;
839 - }
840 - });
841 - if(loadPlaylistLib){
842 - js_log('f:load Playlist Lib:');
843 - mvJsLoader.doLoad({'mvPlayList':'libSequencer/mvPlayList.js'},function(){
844 - $j('playlist').each(function(){
845 - //check if we are in sequence mode load sequence libs (if not already loaded)
846 - if( $j(this).attr('sequencer')=="true" ){
847 - var pl_element = this;
848 - //load the mv_sequencer and the json util lib:
849 - mvJsLoader.doLoad({
850 - 'mvSeqPlayList':'libSequencer/mvSequencer.js'
851 - },function(){
852 - var seqObj = new mvSeqPlayList( pl_element );
853 - swapEmbedVideoElement( pl_element, seqObj );
854 - }
855 - );
856 - }else{
857 - //create new playlist interface:
858 - var plObj = new mvPlayList( this );
859 - swapEmbedVideoElement(this, plObj);
860 - var added_height = plObj.pl_layout.title_bar_height + plObj.pl_layout.control_height;
861 - //move into a blocking display container with height + controls + title height:
862 - $j('#'+plObj.id).wrap('<div style="display:block;height:' + (plObj.height + added_height) + 'px;"></div>');
863 - }
 778+function mv_embed(swap_done_callback, force_id){
 779+ mvEmbed.init( swap_done_callback, force_id );
 780+}
 781+mvEmbed = {
 782+ flist:new Array(),
 783+ init:function( swap_done_callback, force_id ){
 784+ if(swap_done_callback)
 785+ mvEmbed.flist.push( swap_done_callback );
 786+ //get mv_embed location if it has not been set
 787+ js_log('mv_embed ' + MV_EMBED_VERSION);
 788+
 789+ this.swap_done_callback = swap_done_callback;
 790+
 791+ var loadPlaylistLib=false;
 792+ //set up the jQuery selector:
 793+ if( force_id == null && force_id != '' ){
 794+ var j_selector = 'video,audio,playlist';
 795+ }else{
 796+ var j_selector = '#'+force_id;
 797+ }
 798+
 799+ js_log('SELECTOR: '+ j_selector);
 800+
 801+ //process selected elements:
 802+ $j(j_selector).each(function(){
 803+ js_log( "Do SWAP: " + $j(this).attr("id") + ' tag: '+ this.tagName.toLowerCase() );
 804+
 805+ if( $j(this).attr("id") == '' ){
 806+ $j(this).attr("id", 'v'+ global_player_list.length);
 807+ }
 808+ //stre a global reference to the id
 809+ global_player_list.push( $j(this).attr("id") );
 810+ //add loading: (pre-loading div)
 811+ /*$j(this).after('<div id="pre_loading_div_'+elm_id + '">'+
 812+ gM('loading_txt')+'</div>' );
 813+ */
 814+
 815+ //if video doSwap
 816+ switch( this.tagName.toLowerCase()){
 817+ case 'video':
 818+ var videoInterface = new embedVideo(this);
 819+ mvEmbed.swapEmbedVideoElement( this, videoInterface );
 820+ break;
 821+ case 'audio':
 822+ var videoInterface = new embedVideo(this);
 823+ videoInterface.type ='audio';
 824+ mvEmbed.swapEmbedVideoElement( this, videoInterface );
 825+ break;
 826+ case 'playlist':
 827+ loadPlaylistLib=true;
 828+ break;
 829+ }
 830+ });
 831+ if(loadPlaylistLib){
 832+ mvJsLoader.doLoad({ 'mvPlayList' : 'libSequencer/mvPlayList.js' },function(){
 833+ $j('playlist').each(function(){
 834+ //check if we are in sequence mode load sequence libs (if not already loaded)
 835+ if( $j(this).attr('sequencer')=="true" ){
 836+ var pl_element = this;
 837+ //load the mv_sequencer and the json util lib:
 838+ mvJsLoader.doLoad({
 839+ 'mvSeqPlayList':'libSequencer/mvSequencer.js'
 840+ },function(){
 841+ var seqObj = new mvSeqPlayList( pl_element );
 842+ mvEmbed.swapEmbedVideoElement( pl_element, seqObj );
 843+ }
 844+ );
 845+ }else{
 846+ //create new playlist interface:
 847+ var plObj = new mvPlayList( this );
 848+ mvEmbed.swapEmbedVideoElement(this, plObj);
 849+ var added_height = plObj.pl_layout.title_bar_height + plObj.pl_layout.control_height;
 850+ //move into a blocking display container with height + controls + title height:
 851+ $j('#'+plObj.id).wrap('<div style="display:block;height:' + (plObj.height + added_height) + 'px;"></div>');
 852+ }
 853+ });
864854 });
 855+ }
 856+ this.checkClipsReady();
 857+ },
 858+ /*
 859+ * swapEmbedVideoElement
 860+ * takes a video element as input and swaps it out with
 861+ * an embed video interface based on the video_elements attributes
 862+ */
 863+ swapEmbedVideoElement:function(video_element, videoInterface){
 864+ js_log('do swap ' + videoInterface.id + ' for ' + video_element);
 865+ embed_video = document.createElement('div');
 866+ //make sure our div has a hight/width set:
 867+
 868+ $j(embed_video).css({
 869+ 'width':videoInterface.width,
 870+ 'height':videoInterface.height
865871 });
866 - }
 872+ //inherit the video interface
 873+ for(var method in videoInterface){ //for in loop oky in Element context
 874+ if(method!='readyState'){ //readyState crashes IE
 875+ if(method=='style'){
 876+ embed_video.setAttribute('style', videoInterface[method]);
 877+ }else if(method=='class'){
 878+ if(embedTypes.msie)
 879+ embed_video.setAttribute("className", videoInterface['class']);
 880+ else
 881+ embed_video.setAttribute("class", videoInterface['class']);
 882+ }else{
 883+ //normal inherit:
 884+ embed_video[method]=videoInterface[method];
 885+ }
 886+ }
 887+ //string -> boolean:
 888+ if(embed_video[method]=="false")embed_video[method]=false;
 889+ if(embed_video[method]=="true")embed_video[method]=true;
 890+ }
 891+ ///js_log('did vI style');
 892+ //now swap out the video element for the embed_video obj:
 893+ $j(video_element).after(embed_video).remove();
 894+ //js_log('did swap');
 895+ $j('#'+embed_video.id).get(0).on_dom_swap();
 896+ //remove loading:
 897+ $j('#pre_loading_div_'+embed_video.id).remove();
 898+ // now that "embed_video" is stable, do more initialization (if we are ready)
 899+ if($j('#'+embed_video.id).get(0).loading_external_data==false &&
 900+ $j('#'+embed_video.id).get(0).init_with_sources_loadedDone==false){
 901+ //load and set ready state since source are available:
 902+ $j('#'+embed_video.id).get(0).init_with_sources_loaded();
 903+ }
 904+ js_log('done with child: ' + embed_video.id + ' len:' + global_player_list.length);
 905+ return true;
 906+ },
 907+ //this should not be needed.
 908+ checkClipsReady : function(){
 909+ var is_ready=true;
 910+ for(var i=0; i < global_player_list.length; i++){
 911+ if( $j('#'+global_player_list[i]).length !=0){
 912+ var cur_vid = $j('#'+global_player_list[i]).get(0);
 913+ is_ready = ( cur_vid.ready_to_play ) ? is_ready : false;
 914+ if( !is_ready && cur_vid.load_error ){
 915+ is_ready=true;
 916+ $j(cur_vid).html( cur_vid.load_error );
 917+ }
 918+ }
 919+ }
 920+ if( is_ready ){
 921+ mvEmbed.allClipsReady = true;
 922+ // run queued functions
 923+ js_log('run queded functions:');
 924+ while (mvEmbed.flist.length){
 925+ mvEmbed.flist.shift()();
 926+ }
 927+ }else{
 928+ setTimeout( 'mvEmbed.checkClipsReady()', 25 );
 929+ }
 930+ }
867931 }
868 -
869932 /* init remote search */
870933 function mv_do_remote_search(initObj){
871934 js_log(':::::mv_do_remote_search::::');
872935 //insure we have the basic libs (jquery etc) :
873 - mvEmbed.load_libs(function(){
 936+ mvJsLoader.loadBaseLibs(function(){
874937 //load search specifc extra stuff
875938 mvJsLoader.doLoad({
876939 'mvBaseRemoteSearch':'libAddMedia/remoteSearchDriver.js'
@@ -888,7 +951,7 @@
889952 if(!styleSheetPresent(mv_embed_path+'skins/'+mv_skin_name+'/mv_sequence.css'))
890953 loadExternalCss(mv_embed_path+'skins/'+mv_skin_name+'/mv_sequence.css');
891954 //make sure we have the required mv_embed libs (they are not loaded when no video element is on the page)
892 - mvEmbed.load_libs(function(){
 955+ mvJsLoader.loadBaseLibs(function(){
893956 //load playlist object and drag,drop,resize,hoverintent,libs
894957 mvJsLoader.doLoad({
895958 'mvPlayList':'libSequencer/mvPlayList.js',
@@ -917,58 +980,7 @@
918981 });
919982 });
920983 }
921 -
922 -
923984 /*
924 -* swapEmbedVideoElement
925 -* takes a video element as input and swaps it out with
926 -* an embed video interface based on the video_elements attributes
927 -*/
928 -function swapEmbedVideoElement(video_element, videoInterface){
929 - js_log('do swap ' + videoInterface.id + ' for ' + video_element);
930 - embed_video = document.createElement('div');
931 - //make sure our div has a hight/width set:
932 -
933 - $j(embed_video).css({
934 - 'width':videoInterface.width,
935 - 'height':videoInterface.height
936 - });
937 - //inherit the video interface
938 - for(var method in videoInterface){ //for in loop oky in Element context
939 - if(method!='readyState'){ //readyState crashes IE
940 - if(method=='style'){
941 - embed_video.setAttribute('style', videoInterface[method]);
942 - }else if(method=='class'){
943 - if(embedTypes.msie)
944 - embed_video.setAttribute("className", videoInterface['class']);
945 - else
946 - embed_video.setAttribute("class", videoInterface['class']);
947 - }else{
948 - //normal inherit:
949 - embed_video[method]=videoInterface[method];
950 - }
951 - }
952 - //string -> boolean:
953 - if(embed_video[method]=="false")embed_video[method]=false;
954 - if(embed_video[method]=="true")embed_video[method]=true;
955 - }
956 - ///js_log('did vI style');
957 - //now swap out the video element for the embed_video obj:
958 - $j(video_element).after(embed_video).remove();
959 - //js_log('did swap');
960 - $j('#'+embed_video.id).get(0).on_dom_swap();
961 - //remove loading:
962 - $j('#pre_loading_div_'+embed_video.id).remove();
963 - // now that "embed_video" is stable, do more initialization (if we are ready)
964 - if($j('#'+embed_video.id).get(0).loading_external_data==false &&
965 - $j('#'+embed_video.id).get(0).init_with_sources_loadedDone==false){
966 - //load and set ready state since source are available:
967 - $j('#'+embed_video.id).get(0).init_with_sources_loaded();
968 - }
969 - js_log('done with child: ' + embed_video.id + ' len:' + global_player_list.length);
970 - return true;
971 -}
972 -/*
973985 * utility functions:
974986 */
975987 //simple url re-writer for standard temporal and size request urls:
@@ -1026,7 +1038,7 @@
10271039
10281040 //addLoadEvent for adding functions to be run when the page DOM is done loading
10291041 function mv_addLoadEvent(func) {
1030 - mvEmbed.addLoadEvent(func);
 1042+ mvJsLoader.addLoadEvent(func);
10311043 }
10321044
10331045 //does a remote or local api request based on request url
@@ -1193,18 +1205,19 @@
11941206 function getMvEmbedURL(){
11951207 js_elements = document.getElementsByTagName("script");
11961208 for(var i=0;i<js_elements.length; i++){
1197 - if( js_elements[i].src.indexOf('mv_embed.js') !=-1){
 1209+ if( js_elements[i].src.indexOf('mv_embed') !=-1){
11981210 return js_elements[i].src;
11991211 }
12001212 }
12011213 return false;
12021214 }
1203 -//gets a unique id from the mv_embed url else returns the version number
 1215+//gets a unique request id to ensure fresh javascript
12041216 function getMvUniqueReqId(){
12051217 var mv_embed_url = getMvEmbedURL();
1206 - if( mv_embed_url.indexOf('?')!=-1 ){
1207 - return mv_embed_url.substr( mv_embed_url.indexOf('?')+1 );
1208 - }
 1218+ var urid = parseUri( mv_embed_url).queryKey['urid']
 1219+ if( urid )
 1220+ return urid;
 1221+ //else just return the mv_embed version;
12091222 return MV_EMBED_VERSION;
12101223 }
12111224 /*
@@ -1212,7 +1225,11 @@
12131226 */
12141227 function getMvEmbedPath(){
12151228 var mv_embed_url = getMvEmbedURL();
1216 - mv_embed_path = mv_embed_url.substr(0, mv_embed_url.indexOf('mv_embed.js'));
 1229+ if(mv_embed_url.indexOf('mv_embed.js') !== -1){
 1230+ mv_embed_path = mv_embed_url.substr(0, mv_embed_url.indexOf('mv_embed.js'));
 1231+ }else{
 1232+ mv_embed_path = mv_embed_url.substr(0, mv_embed_url.indexOf('mvwScriptLoader.php'));
 1233+ }
12171234 //absolute the url (if relative) (if we don't have mv_embed path)
12181235 if(mv_embed_path.indexOf('://')==-1){
12191236 var pURL = parseUri( document.URL );
@@ -1258,7 +1275,7 @@
12591276 */
12601277 /*var log_elm = document.getElementById('mv_js_log');
12611278 if(!log_elm){
1262 - document.write('<div style="position:absolute;z-index:500;top:0px;left:0px;right:0px;height:50px;"><textarea id="mv_js_log" cols="80" rows="2"></textarea></div>');
 1279+ document.write('<div style="position:absolute;z-index:500;top:0px;left:0px;right:0px;height:50px;"><textarea id="mv_js_log" cols="120" rows="10"></textarea></div>');
12631280 var log_elm = document.getElementById('mv_js_log');
12641281 }
12651282 if(log_elm){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_flashEmbed.js
@@ -1588,8 +1588,7 @@
15891589 postEmbedJS: function()
15901590 {
15911591 var _this = this;
1592 - js_log('embedFlow: uri:'+ _this.media_element.selected_source.getURI(this.seek_time_sec)
1593 - +"\n"+ mv_embed_path + 'flowplayer/flowplayer-3.0.1.swf' ) ;
 1592+ js_log('embedFlow: uri:'+ _this.media_element.selected_source.getURI(this.seek_time_sec) + "\n"+ mv_embed_path + 'flowplayer/flowplayer-3.0.1.swf' ) ;
15941593 var flowConfig = {
15951594 clip: {
15961595 url: _this.media_element.selected_source.getURI(this.seek_time_sec),
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_baseEmbed.js
@@ -843,7 +843,7 @@
844844 do_request(this.roe, function(data)
845845 {
846846 //continue
847 - _this.media_element.addROE(data);
 847+ _this.media_element.addROE( data );
848848 js_log('added_roe::' + _this.media_element.sources.length);
849849
850850 js_log('set loading_external_data=false');
@@ -1698,20 +1698,20 @@
16991699 out+='</blockquote></span>';
17001700 this.displayHTML(out);
17011701 },
1702 - /*download list is exessivly complicated ... rewrite for clarity: */
 1702+ /*download list is too complicated ... rewrite for clarity: */
17031703 showVideoDownload:function(){
1704 - //load the roe if avaliable (to populate out download options:
1705 - js_log('f:showVideoDownload '+ this.roe + ' ' + this.media_element.addedROEData);
 1704+ //load the roe if available (to populate out download options:
 1705+ //js_log('f:showVideoDownload '+ this.roe + ' ' + this.media_element.addedROEData);
17061706 if(this.roe && this.media_element.addedROEData==false){
17071707 var _this = this;
17081708 this.displayHTML(gM('loading_txt'));
17091709 do_request(this.roe, function(data)
17101710 {
17111711 _this.media_element.addROE(data);
1712 - $j('#mv_disp_inner_'+_this.id).html(_this.getShowVideoDownload());
 1712+ $j('#mv_disp_inner_'+_this.id).html( _this.getShowVideoDownload() );
17131713 });
17141714 }else{
1715 - this.displayHTML(this.getShowVideoDownload());
 1715+ this.displayHTML( this.getShowVideoDownload() );
17161716 }
17171717 },
17181718 getShowVideoDownload:function(){
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_baseEmbed.js
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mvwScriptLoader.php
@@ -22,17 +22,24 @@
2323 * http://www.gnu.org/copyleft/gpl.html
2424 */
2525
 26+/*
 27+ * mvwScriptLoader:
 28+ *
 29+ * some documentation goes here
 30+ *
 31+ */
 32+
 33+
 34+
2635 //set the initial javascript classes: (for loading javascript via class name)
27 -// also works via direct file calls
28 -//can be extended via
29 -global $wgJsAutoloadLocalClasses;
30 -$wgJsAutoloadLocalClasses = array(
 36+global $wgJSAutoloadClasses;
 37+$wgJSAutoloadClasses = array(
3138
3239 );
3340
3441 //include WebStart.php (this can be simplified once we move mvwScriptLoader to the root dir:
3542 $root_path = dirname(__FILE__) . '/../../../../';
36 -chdir($root_path);
 43+chdir( $root_path );
3744 require_once('includes/WebStart.php');
3845
3946 wfProfileIn('mvwScriptLoader.php');
@@ -51,65 +58,246 @@
5259 }
5360 //Verify the script loader is on:
5461 if (!$wgEnableScriptLoader) {
55 - echo 'MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php';
56 - echo '<pre><b>$wgEnableAPI=true;</b></pre>';
 62+ echo 'ScriptLoader is not enabled for this site. To enable add the following line to your LocalSettings.php';
 63+ echo '<pre><b>$wgEnableScriptLoader=true;</b></pre>';
5764 die(1);
5865 }
5966 //run the main action:
60 -do_return_js();
61 -function do_return_js(){
62 - global $wgJsAutoloadLocalClasses, $wgEnableScriptLoaderJsFile, $wgRequest, $IP;
63 - $jsFileList = array();
64 - //check for the requested classes
65 - if( $wgRequest->getVal('class') ){
66 - $reqClassList = explode(',', $wgRequest->getVal('class'));
67 - //clean the class list and populate jsFileList
68 - foreach($reqClassList as $reqClass){
69 - $reqClass = ereg_replace("[^A-Za-z0-9_\-]", "", $reqClass );
70 - if( isset( $wgJsAutoloadLocalClasses[$reqClass] ) ){
71 - $jsFileList[ $reqClass ] = $wgJsAutoloadLocalClasses[ $reqClass ];
 67+$myScriptLoader = new jsScriptLoader();
 68+$myScriptLoader->doScriptLoader();
 69+
 70+class jsScriptLoader{
 71+ var $jsFileList = array();
 72+ var $jsout = '';
 73+ var $rKey = ''; // the request key
 74+ var $error_msg ='';
 75+ var $debug = false;
 76+
 77+ function doScriptLoader(){
 78+ global $wgJSAutoloadClasses, $wgEnableScriptLoaderJsFile, $wgRequest, $IP,
 79+ $wgEnableScriptMinify, $wgUseFileCache;
 80+
 81+ //process the request
 82+ $this->procRequestVars();
 83+
 84+ $wgUseFileCache=false;
 85+ //if cache is on and file is present grab it from there:
 86+ if( $wgUseFileCache && !$this->debug ) {
 87+ //setup file cache obj:
 88+ $this->sFileCache = new simpleFileCache( $this->rKey );
 89+ if( $this->sFileCache->isFileCached() ){
 90+ $this->outputjsHeaders();
 91+ $this->sFileCache->loadFromFileCache();
7292 }
 93+ }
 94+ //build the output:
 95+
 96+ //swap in the appropriate language per js_file
 97+ foreach($this->jsFileList as $file_name){
 98+ if( trim( $file_name ) != '')
 99+ $this->jsout .= $this->doProccessJsFile( $file_name );
73100 }
 101+
 102+ //check if we should minify :
 103+ if( $wgEnableScriptMinify && !$this->debug){
 104+ //do the minification and output
 105+ require_once ( dirname(__FILE__) . '/jsmin.php');
 106+ $this->jsout = JSMin::minify( $this->jsout);
 107+ }
 108+ //save to the file cache:
 109+ if( $wgUseFileCache && !$this->debug) {
 110+ $this->sFileCache->saveToFileCache($this->jsout);
 111+ }
 112+
 113+ $this->outputjsHeaders();
 114+ if( $this->error_msg != '')
 115+ echo 'alert(\'' . str_replace("\n", '\'+"\n"+'."\n'", $this->error_msg ). '\');';
 116+
 117+ echo trim($this->jsout);
 118+
74119 }
 120+ function outputJsHeaders(){
 121+ global $wgJsMimeType;
 122+ //output js mime type:
 123+ header( 'Content-type: '.$wgJsMimeType);
 124+ //cache forever:
 125+ //(the point is we never have to re validate since we should always change the request url based on the svn version)
 126+ $one_year = 60*60*24*365;
 127+ //header("Expires: " . gmdate( "D, d M Y H:i:s", time() + $one_year ) . " GM");
 128+ }
 129+ /*
 130+ * updates the proc Request
 131+ */
 132+ function procRequestVars(){
 133+ global $wgRequest, $wgContLanguageCode, $wgEnableScriptMinify, $wgJSAutoloadClasses;
 134+
 135+ //set debug flag:
 136+ if($wgRequest->getVal('debug') || $wgEnableScriptDebug==true)
 137+ $this->debug = true;
 138+
 139+ //check for the requested classes
 140+ if( $wgRequest->getVal('class') ){
 141+ $reqClassList = explode(',', $wgRequest->getVal('class'));
 142+ //clean the class list and populate jsFileList
 143+ foreach($reqClassList as $reqClass){
 144+ if(trim($reqClass)!=''){
 145+ $reqClass = ereg_replace("[^A-Za-z0-9_\-\.]", "", $reqClass );
 146+ if( isset( $wgJSAutoloadClasses[$reqClass] ) ){
 147+ $this->jsFileList[ $reqClass ] = $wgJSAutoloadClasses[ $reqClass ];
 148+ $this->rKey.=$reqClass;
 149+ }else{
 150+ $this->error_msg.= 'Requested class: '.$reqClass.' not found'."\n";
 151+ }
 152+ }
 153+ }
 154+ }
 155+ //check for requested files if enabled:
 156+ if( $wgEnableScriptLoaderJsFile ){
 157+ if( $wgRequest->getVal('files')){
 158+ $reqFileList = explode(',', $wgRequest->getVal('files'));
 159+ //clean the file list and populate jsFileList
 160+ foreach($reqFileList as $reqFile){
 161+ //no jumping dirs:
 162+ $reqFile = str_replace('../','',$reqFile);
 163+ //only allow alphanumeric underscores periods and ending with .js
 164+ $reqFile = ereg_replace("[^A-Za-z0-9_\-\/\.]", "", $reqFile );
 165+ if( substr($reqFile, -3)=='.js'){
 166+ if( is_file( $IP . $reqFile) && !in_array($reqFile, $jsFileList ) ){
 167+ $this->jsFileList[] = $IP . $reqFile;
 168+ $this->rKey.=$reqFile;
 169+ }else{
 170+ $this->error_msg.= 'Requested File: '.$reqFile.' not found'."\n";
 171+ }
 172+ }
 173+ }
 174+ }
 175+ }
 176+ //check for a unique request id (should be tied to the svn version for "fresh" copies of things
 177+ if( $wgRequest->getVal('urid') ) {
 178+ $this->urid = $wgRequest->getVal('urid');
 179+ }else{
 180+ //just give it the current version number:
 181+ global $IP;
 182+ $this->urid = SpecialVersion::getSvnRevision( $IP );
 183+ }
 184+ //add the language code to the rKey:
 185+ $this->rKey .= '_' . $wgContLanguageCode;
 186+
 187+ //add the unique rid to the rKey
 188+ $this->rKey .= $this->urid;
 189+
 190+ //add a min flag:
 191+ if($wgEnableScriptMinify){
 192+ $this->rKey.='_min';
 193+ }
 194+ }
 195+ function doProccessJsFile( $file_name ){
 196+ $str = file_get_contents($file_name);
 197+ $this->cur_file = $file_name;
 198+ //strip out js_log debug lines not much luck with this regExp yet:
 199+ //if( !$this->debug )
 200+ // $str = preg_replace('/\n\s*js_log\s*\([^\)]([^;]|\n])*;/', "\n", $str);
 201+ //die('<pre>'.$str);
 202+
 203+ // do language swap
 204+ $str = preg_replace_callback('/loadGM\s*\(\s*{(.*)}\s*\)\s*/siU', //@@todo fix: will break down if someone does }) in their msg text
 205+ array($this, 'languageMsgReplace'),
 206+ $str);
75207
76 - //check for requested files if enabled:
77 - if( $wgEnableScriptLoaderJsFile ){
78 - if( $wgRequest->getVal('files')){
79 - $reqFileList = explode(',', $wgRequest->getVal('files'));
80 - //clean the file list and populate jsFileList
81 - foreach($reqFileList as $reqFile){
82 - //no jumping dirs:
83 - $reqFile = str_replace('../','',$reqFile);
84 - //only allow alphanumeric underscores periods and ending with .js
85 - $reqFile = ereg_replace("[^A-Za-z0-9_\-\/\.]", "", $reqFile );
86 - if( substr($reqFile, -3)=='.js'){
87 - if( is_file( $IP . $reqFile) && !in_array($reqFile, $jsFileList ) ){
88 - $jsFileList[] = $IP . $reqFile;
89 - }
90 - }
 208+ return $str;
 209+ }
 210+ function languageMsgReplace($jvar){
 211+ if(!isset($jvar[1]))
 212+ return ;
 213+
 214+ $jmsg = json_decode( '{' . $jvar[1] . '}', true );
 215+ //do the language lookup:
 216+ if($jmsg){
 217+ foreach($jmsg as $msgKey => $default_en_value){
 218+ $jmsg[$msgKey] = wfMsgNoTrans( $msgKey );
91219 }
 220+ //return the updated loadGM json
 221+ return 'loadGM( '. json_encode( $jmsg ) . ')';
 222+ }else{
 223+ $this->error_msg.= "Could not parse JSON language msg in File:\n" .
 224+ $this->cur_file ."\n";
92225 }
93 - }
94 - //swap in the appropriate language per file:
95 - $js_file_string = '';
96 - foreach($jsFileList as $file_name){
97 - $js_file_string+= do_proccess_js_file($file_name);
 226+ //could not parse json (throw error?)
 227+ return $jvar[0];
98228 }
 229+}
 230+//a simple version of HTMLFileCache (@@todo abstract shared pieces)
 231+class simpleFileCache{
 232+ var $mFileCache;
 233+ public function __construct( &$rKey ) {
 234+ $this->rKey = $rKey;
 235+ $this->fileCacheName(); // init name
 236+ }
 237+ public function fileCacheName() {
 238+ if( !$this->mFileCache ) {
 239+ global $wgFileCacheDirectory, $wgRequest;
 240+
 241+ $hash = md5( $this->rKey );
 242+ # Avoid extension confusion
 243+ $key = str_replace( '.', '%2E', urlencode( $this->rKey ) );
99244
100 - print "<pre>";
101 - print_r( $jsFileList );
102 -}
 245+ $hash1 = substr( $hash, 0, 1 );
 246+ $hash2 = substr( $hash, 0, 2 );
 247+ $this->mFileCache = "{$wgFileCacheDirectory}/{$subdir}{$hash1}/{$hash2}/{$this->rKey}.js";
103248
104 -function do_proccess_js_file($file){
105 - $file_string = file_get_contents($file);
106 - //print $file_string;
107 - //do language swap
108 - preg_replace_callback("/loadGM\(\s*\{([^}]*)/", 'language_msg_replace', $file_string);
 249+ if( $this->useGzip() )
 250+ $this->mFileCache .= '.gz';
 251+
 252+ wfDebug( " fileCacheName() - {$this->mFileCache}\n" );
 253+ }
 254+ return $this->mFileCache;
 255+ }
 256+ public function isFileCached() {
 257+ return file_exists( $this->fileCacheName() );
 258+ }
 259+ public function loadFromFileCache(){
 260+ global $wgJsMimeType;
 261+ if( $wgUseGzip ) {
 262+ if( wfClientAcceptsGzip() ) {
 263+ header( 'Content-Encoding: gzip' );
 264+ readfile( $filename );
 265+ } else {
 266+ /* Send uncompressed */
 267+ readgzfile( $filename );
 268+ return;
 269+ }
 270+ }
 271+ }
 272+ public function saveToFileCache( $text ) {
 273+ global $wgUseFileCache;
 274+ if( !$wgUseFileCache ) {
 275+ return $text; // return to output
 276+ }
 277+ if( strcmp($text,'') == 0 ) return '';
 278+
 279+ wfDebug(" simpleSaveToFileCache()\n", false);
 280+
 281+ $this->checkCacheDirs();
 282+
 283+ $f = fopen( $this->fileCacheName(), 'w' );
 284+ if($f) {
 285+ $now = wfTimestampNow();
 286+ $text = '//cached at: ' . $now . " :: " . $this->rKey . " \n" . $text ;
 287+ if( $this->useGzip() ) {
 288+ $text = gzencode( $text);
 289+ }
 290+ fwrite( $f, $text );
 291+ fclose( $f );
 292+ }
 293+ return $text;
 294+ }
 295+ protected function checkCacheDirs() {
 296+ $filename = $this->fileCacheName();
 297+ $mydir2 = substr($filename,0,strrpos($filename,'/')); # subdirectory level 2
 298+ $mydir1 = substr($mydir2,0,strrpos($mydir2,'/')); # subdirectory level 1
 299+
 300+ wfMkdirParents( $mydir1 );
 301+ wfMkdirParents( $mydir2 );
 302+ }
109303 }
110 -function language_msg_replace($match){
111 - print "CB: ";
112 - print_r($match);
113 -}
114 -//do the minification and output
115 -require_once ( dirname(__FILE__) . '/jsmin.php');
116304 ?>
\ No newline at end of file
Index: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sampleEditor.html
@@ -6,13 +6,7 @@
77 <script type="text/javascript" src="mv_embed.js"></script>
88 <script type="text/javascript">
99 //set up the sequencer (once the page is ready):
10 - mv_addLoadEvent(setup_sequencer);
11 - function setup_sequencer(){
12 - mv_do_sequence({
13 - sequence_container_id:'sequence_container',
14 - inline_playlist_id:'inline_pl_empty'
15 - });
16 - }
 10+
1711 </script>
1812 <style>
1913 .ui-resizable-handle { position: absolute; background: #ddd; display: none; }
@@ -23,35 +17,6 @@
2418 </head>
2519 <body>
2620 <h3>sample editor</h3>
27 -
28 -<div id="sequence_container" style="position:relative;width:800px;height:600px;border:solid black;">
29 -loading editor <blink>...</blink>
30 -</div>
31 -<div id="inline_pl_empty">
32 -</div>
33 -<div id="inline_pl_txt">
34 -<!--
35 -#playlist attr:
36 -|title=Inline Playlist
37 -|linkback=http://metavid.ucsc.edu/wiki/index.php/Mv_embed
38 -
39 -#mvclip special for metavid clips can be refreces with a single key attribute
40 -|mvClip=senate_proceeding_12-07-06?t=04:46:27/04:46:58
41 -|title=I fancy Pencils
42 -
43 -#new clips are start with |mvclip or |clip_src (everything after will apply to that clip)
44 -|mvClip=house_proceeding_02-05-07_00?t=0:02:00/0:02:30
45 -|desc=budget is like swiss cheese
46 -but smells like limburger
47 -
48 -#more verbose arbitrary clip listing: (be mindfull of cross site data policy of java for cortado playback)
49 -|srcClip=http://128.114.20.23/media/house_proceeding_04-05-06_3.ogg.anx?t=01:35:47/01:35:58
50 -|image=http://metavid.ucsc.edu/image_media/house_proceeding_04-05-06_3?t=01:35:47&size=320x240
51 -|desc=Jeb Hensarling uses the <b>dictionary</b>
52 -
53 -|mvClip=house_proceeding_02-05-07_00?t=0:12:00/0:12:30
54 -|desc=no desc here
55 -</div>
 21+needs update to new sequence editor system
5622 </body>
5723 </html>
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js
@@ -8,15 +8,15 @@
99 and archive.org
1010 */
1111
12 -loadGM( { 'mv_media_search' : 'Media Search',
13 - 'rsd_box_layout' : 'Box layout',
14 - 'rsd_list_layout' : 'List Layout',
15 - 'rsd_results_desc' : 'Results some ',
16 - 'rsd_results_next' : 'next ',
17 - 'rsd_results_prev' : 'previous ',
18 - 'upload' : 'Upload',
19 - 'rsd_layout' : 'Layout:',
20 - 'rsd_resource_edit' : 'Edit Resource:'
 12+loadGM( { "mv_media_search" : "Media Search why test test",
 13+ "rsd_box_layout" : "Box layout",
 14+ "rsd_list_layout" : "List Layout",
 15+ "rsd_results_desc" : "Results some ",
 16+ "rsd_results_next" : "next ",
 17+ "rsd_results_prev" : "previous ",
 18+ "upload" : "Upload",
 19+ "rsd_layout" : "Layout:",
 20+ "rsd_resource_edit" : "Edit Resource:"
2121 });
2222
2323 var default_remote_search_options = {
@@ -35,7 +35,7 @@
3636 //specific to sequence profile
3737 'p_seq':null,
3838 'cFileNS':'Image', //what is the cannonical namespace for images
39 - //@@todo (should be able to get that from the api in the future)
 39+ //@@todo (should get that from the api or inpage vars)
4040
4141 'enable_uploads':false // if we want to enable an uploads tab:
4242 }
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvUploader.js
@@ -4,18 +4,15 @@
55 */
66
77 loadGM( {
8 - 'upload-enable-converter' : 'Enable video converter (to upload source video not yet converted to theora format)'+
9 - ' <a href="http://commons.wikimedia.org/wiki/Commons:Firefogg">more info</a>',
10 - 'upload-fogg_not_installed': 'If you want to upload video consider installing <a href="http://firefogg.org">firefogg.org</a>, '+
11 - '<a href="http://commons.wikimedia.org/wiki/Commons:Firefogg">more info</a>',
12 - 'upload-in-progress':'Doing Transcode & Upload (do not close this window)',
13 - 'upload-transcoded-status': 'Transcoded',
14 - 'uploaded-status':'Uploaded',
15 - 'upload-select-file': 'Select File...',
16 - 'wgfogg_wrong_version': 'You have firefogg installed but its outdated, <a href="http://firefogg.org">please upgrade</a> ',
17 - 'wgfogg_waring_ogg_upload': 'You have selected an ogg file for conversion to ogg (this is probably unnessesary). Maybe disable the video converter?'
18 - }
19 -);
 8+ "upload-enable-converter" : "Enable video converter (to upload source video not yet converted to theora format) <a href=\"http://commons.wikimedia.org/wiki/Commons:Firefogg\">more info</a>",
 9+ "upload-fogg_not_installed": "If you want to upload video consider installing <a href=\"http://firefogg.org\">firefogg.org</a>, <a href=\"http://commons.wikimedia.org/wiki/Commons:Firefogg\">more info</a>",
 10+ "upload-in-progress":"Doing Transcode & Upload (do not close this window)",
 11+ "upload-transcoded-status": "Transcoded",
 12+ "uploaded-status": "Uploaded",
 13+ "upload-select-file": "Select File...",
 14+ "wgfogg_wrong_version": "You have firefogg installed but its outdated, <a href=\"http://firefogg.org\">please upgrade</a> ",
 15+ "wgfogg_waring_ogg_upload": "You have selected an ogg file for conversion to ogg (this is probably unnessesary). Maybe disable the video converter?"
 16+});
2017
2118 var default_upload_options = {
2219 'target_div':'',
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mvSequencer.js
@@ -18,47 +18,47 @@
1919 */
2020
2121 loadGM( {
22 - 'menu_clipedit' : 'Edit Selected Resource',
23 - 'menu_cliplib' : 'Add Resource',
24 - 'menu_transition' : 'Transitions Effects',
25 - 'menu_resource_overview' : 'Resource Overview',
26 - 'menu_options' : 'Options',
 22+ "menu_clipedit" : "Edit Selected Resource",
 23+ "menu_cliplib" : "Add Resource",
 24+ "menu_transition" : "Transitions Effects",
 25+ "menu_resource_overview" : "Resource Overview",
 26+ "menu_options" : "Options",
2727
28 - 'loading_timeline' : 'Loading TimeLine <blink>...</blink>',
29 - 'loading_user_rights' : 'Loading user rights <blink>...</blink>',
 28+ "loading_timeline" : "Loading TimeLine <blink>...</blink>",
 29+ "loading_user_rights" : "Loading user rights <blink>...</blink>",
3030
31 - 'no_edit_permissions' : 'You don\'t have permissions to save changes to this sequence',
 31+ "no_edit_permissions" : "You don\'t have permissions to save changes to this sequence",
3232
3333
34 - 'edit_clip' : 'Edit Clip',
35 - 'edit_save' : 'Save Changes',
36 - 'edit_cancel' : 'Cancel Edit',
37 - 'edit_cancel_confirm' : 'Are you sure you want to cancel your edit, changes will be lost',
 34+ "edit_clip" : "Edit Clip",
 35+ "edit_save" : "Save Changes",
 36+ "edit_cancel" : "Cancel Edit",
 37+ "edit_cancel_confirm" : "Are you sure you want to cancel your edit, changes will be lost",
3838
39 - 'zoom_in' : 'Zoom In',
40 - 'zoom_out' : 'Zoom Out',
41 - 'cut_clip' : 'Cut Clips',
42 - 'expand_track' : 'Expand Track',
43 - 'colapse_track' : 'Collapse Track',
44 - 'play_clip' : 'Play From Playline Position',
45 - 'pixle2sec' : 'pixles to seconds',
46 - 'rmclip' : 'Remove Clip',
47 - 'clip_in' : 'clip in',
48 - 'clip_out' : 'clip out',
 39+ "zoom_in" : "Zoom In",
 40+ "zoom_out" : "Zoom Out",
 41+ "cut_clip" : "Cut Clips",
 42+ "expand_track" : "Expand Track",
 43+ "colapse_track" : "Collapse Track",
 44+ "play_clip" : "Play From Playline Position",
 45+ "pixle2sec" : "pixles to seconds",
 46+ "rmclip" : "Remove Clip",
 47+ "clip_in" : "clip in",
 48+ "clip_out" : "clip out",
4949
5050 //menu items display helper:
51 - 'mv_welcome_to_sequencer' : '<h3>Welcome to the sequencer demo</h3>'+
52 - 'very <b>limited</b> functionality right now. Not much documentation yet either',
 51+ "mv_welcome_to_sequencer" : "<h3>Welcome to the sequencer demo</h3>"+
 52+ "very <b>limited</b> functionality right now. Not much documentation yet either",
5353
54 - 'no_selected_resource' : '<h3>No Resource selected</h3> Select a Clip to enable resource editing',
55 - 'error_edit_multiple' : '<h3>Multiple Resources Selected</h3> Select a single clip to edit it',
 54+ "no_selected_resource" : "<h3>No Resource selected</h3> Select a Clip to enable resource editing",
 55+ "error_edit_multiple" : "<h3>Multiple Resources Selected</h3> Select a single clip to edit it",
5656
57 - 'mv_editor_options' : 'Editor options',
58 - 'mv_editor_mode' : 'Editor mode',
59 - 'mv_simple_editor_desc' : 'simple editor (iMovie style)',
60 - 'mv_advanced_editor_desc' : 'advanced editor (Final Cut style)',
61 - 'mv_other_options' : 'Other Options',
62 - 'mv_contextmenu_opt' : 'Enable Context Menus'
 57+ "mv_editor_options" : "Editor options",
 58+ "mv_editor_mode" : "Editor mode",
 59+ "mv_simple_editor_desc" : "simple editor (iMovie style)",
 60+ "mv_advanced_editor_desc" : "advanced editor (Final Cut style)",
 61+ "mv_other_options" : "Other Options",
 62+ "mv_contextmenu_opt" : "Enable Context Menus"
6363 });
6464
6565 //used to set default values and validate the passed init object
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libClipEdit/mvClipEdit.js
@@ -7,25 +7,25 @@
88 */
99 //set gMsg object:
1010 loadGM( {
11 - 'mv_crop':'Crop Image',
12 - 'mv_apply_crop':'Apply Crop to Image',
13 - 'mv_reset_crop':'Rest Crop',
14 - 'mv_insert_image_page':'Insert Into page',
15 - 'mv_preview_insert':'Preview Insert',
16 - 'mv_cancel_image_insert':'Cancel Image Insert',
 11+ "mv_crop":"Crop Image",
 12+ "mv_apply_crop":"Apply Crop to Image",
 13+ "mv_reset_crop":"Rest Crop",
 14+ "mv_insert_image_page":"Insert Into page",
 15+ "mv_preview_insert":"Preview Insert",
 16+ "mv_cancel_image_insert":"Cancel Image Insert",
1717
18 - 'sc_fileopts':'Clip Detail Edit',
19 - 'sc_inoutpoints':'Set In-Out points',
20 - 'sc_panzoom':'Pan Zoom Crop',
21 - 'sc_overlays':'Overlays',
22 - 'sc_audio':'Audio Control',
23 - 'sc_duration':'Duration',
 18+ "sc_fileopts":"Clip Detail Edit",
 19+ "sc_inoutpoints":"Set In-Out points",
 20+ "sc_panzoom":"Pan Zoom Crop",
 21+ "sc_overlays":"Overlays",
 22+ "sc_audio":"Audio Control",
 23+ "sc_duration":"Duration",
2424
25 - 'mv_template_properties':'Template Properties',
26 - 'mv_custom_title':'Custom Title',
27 - 'mv_edit_properties':'Edit Properties',
28 - 'mv_other_properties':'Other Properties',
29 - 'mv_resource_page':'Resource Page'
 25+ "mv_template_properties":"Template Properties",
 26+ "mv_custom_title":"Custom Title",
 27+ "mv_edit_properties":"Edit Properties",
 28+ "mv_other_properties":"Other Properties",
 29+ "mv_resource_page":"Resource Page"
3030 });
3131
3232 var default_clipedit_values = {

Status & tagging log