r50753 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50752‎ | r50753 | r50754 >
Date:20:58, 18 May 2009
Author:dale
Status:deferred
Tags:
Comment:
Fixes for upload-via-url (defaults async if supported)
Better error checking
Fixes for stand alone script-loader
Stubs for advanced firefogg support
Stub Make_Ogg.html sample stand alone page
Modified paths:
  • /branches/new-upload/phase3/includes/AutoLoader.php (modified) (history)
  • /branches/new-upload/phase3/includes/DefaultSettings.php (modified) (history)
  • /branches/new-upload/phase3/includes/OutputPage.php (modified) (history)
  • /branches/new-upload/phase3/includes/UploadFromUrl.php (modified) (history)
  • /branches/new-upload/phase3/includes/api/ApiUpload.php (modified) (history)
  • /branches/new-upload/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /branches/new-upload/phase3/js2/editPage.js (deleted) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/example_usage/Make_Ogg.html (added) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/jsScriptLoader.php (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvAdvFirefogg.js (added) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvUploader.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/mv_embed.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/php/jsAutoloadLocalClasses.php (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/php/noMediaWikiConfig.php (modified) (history)
  • /branches/new-upload/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: branches/new-upload/phase3/js2/editPage.js
@@ -1,67 +0,0 @@
2 -//initial refactoring of the edit page into jquery based edit page
3 -
4 -loadGM({
5 - "add_media_to_page" : "Add Media to this Page"
6 -});
7 -
8 -mwAddOnloadHook( function(){
9 - //add the add media button:
10 - $j('#toolbar').append( '<img id="mv-add-media" title="' + gM('add_media_to_page') + '"' +
11 - 'src="' + mv_skin_img_path + 'Button_add_media.png"' +
12 - 'style="cursor:pointer" />' );
13 - $j('#mv-add-media').click(mv_do_load_wiz);
14 -});
15 -
16 -function mv_do_load_wiz(){
17 - //add the add media-wizard button:
18 - caret_pos={};
19 - var txtarea = document.editform.wpTextbox1;
20 - var getTextCusorStartPos = function (o){
21 - if (o.createTextRange) {
22 - var r = document.selection.createRange().duplicate()
23 - r.moveEnd('character', o.value.length)
24 - if (r.text == '') return o.value.length
25 - return o.value.lastIndexOf(r.text)
26 - } else return o.selectionStart
27 - }
28 - var getTextCusorEndPos = function (o){
29 - if (o.createTextRange) {
30 - var r = document.selection.createRange().duplicate();
31 - r.moveStart('character', -o.value.length);
32 - return r.text.length;
33 - } else{
34 - return o.selectionEnd
35 - }
36 - }
37 - caret_pos.s = getTextCusorStartPos( txtarea );
38 - caret_pos.e = getTextCusorEndPos( txtarea );
39 - caret_pos.text = txtarea.value;
40 - //show/empty modalbox:
41 - $j('#modalbox,#mv_overlay').remove();
42 - $j('body').append(''+
43 - '<div id="modalbox" style="background:#DDD;border:3px solid #666666;font-size:115%;'+
44 - 'top:30px;left:20px;right:20px;bottom:30px;position:fixed;z-index:100;">'+
45 - 'loading external media wizard<blink>...</blink>'+
46 - '</div>'+
47 - '<div id="mv_overlay" style="background:#000;cursor:wait;height:100%;left:0;position:fixed;'+
48 - 'top:0;width:100%;z-index:5;filter:alpha(opacity=60);-moz-opacity: 0.6;'+
49 - 'opacity: 0.6;"/>');
50 -
51 - //load mv_embed and do text search interface:
52 -
53 - //setup the restore text value:
54 - var txtarea = document.editform.wpTextbox1;
55 - txtarea.value = caret_pos.text;
56 - //do the remote search interface:
57 - mv_do_remote_search({
58 - 'target_id' :'modalbox',
59 - 'profile' :'mediawiki_edit',
60 - 'target_textbox' : 'wpTextbox1',
61 - 'caret_pos' : caret_pos,
62 - //note selections in the textbox will override the default query
63 - 'default_query' : wgTitle,
64 - 'target_title' : wgPageName,
65 - 'cpconfig' : {},
66 - 'local_wiki_api_url': wgServer + wgScriptPath + '/api.php'
67 - });
68 -}
\ No newline at end of file
Index: branches/new-upload/phase3/js2/mwEmbed/php/jsAutoloadLocalClasses.php
@@ -1,63 +1,83 @@
22 <?php
33 if ( !defined( 'MEDIAWIKI' ) ) die(1);
44
5 -global $wgJSAutoloadLocalClasses, $wgScriptPath;
6 -
7 - $mvjsp = 'js2/mwEmbed/';
 5+global $wgJSAutoloadLocalClasses, $mwEmbedDirectory;
86
97 //the basis of the loader calls:
10 - $wgJSAutoloadLocalClasses['mv_embed'] = $mvjsp . 'mv_embed.js';
 8+ $wgJSAutoloadLocalClasses['mv_embed'] = $mwEmbedDirectory . 'mv_embed.js';
119
1210 //core:
13 - $wgJSAutoloadLocalClasses['window.jQuery'] = $mvjsp . 'jquery/jquery-1.3.2.js';
 11+ $wgJSAutoloadLocalClasses['window.jQuery'] = $mwEmbedDirectory . 'jquery/jquery-1.3.2.js';
1412
15 - $wgJSAutoloadLocalClasses['mv_allpages'] = $mv_jspath . 'mv_allpages.js';
16 - $wgJSAutoloadLocalClasses['mv_search'] = $mv_jspath . 'mv_search.js';
17 - $wgJSAutoloadLocalClasses['mv_stream'] = $mv_jspath . 'mv_stream.js';
 13+ $wgJSAutoloadLocalClasses['j.secureEvalJSON'] = $mwEmbedDirectory . 'jquery/plugins/jquery.json-1.3.js';
1814
19 - $wgJSAutoloadLocalClasses['j.secureEvalJSON'] = $mvjsp . 'jquery/plugins/jquery.json-1.3.js';
20 - $wgJSAutoloadLocalClasses['j.ui'] = $mvjsp . 'jquery/jquery.ui-1.7.1/ui/ui.core.js';
21 - $wgJSAutoloadLocalClasses['j.ui.droppable'] = $mvjsp . 'jquery/jquery.ui-1.7.1/ui/ui.droppable.js';
22 - $wgJSAutoloadLocalClasses['j.ui.draggable'] = $mvjsp . 'jquery/jquery.ui-1.7.1/ui/ui.droppable.js';
23 - $wgJSAutoloadLocalClasses['j.ui.sortable'] = $mvjsp . 'jquery/jquery.ui-1.7.1/ui/ui.sortable.js';
24 - $wgJSAutoloadLocalClasses['j.ui.resizable'] = $mvjsp . 'jquery/jquery.ui-1.7.1/ui/ui.resizable.js';
25 - $wgJSAutoloadLocalClasses['j.cookie'] = $mvjsp . 'jquery/jquery.ui-1.7.1/external/jquery.cookie.js';
 15+ $wgJSAutoloadLocalClasses['j.cookie'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/external/jquery.cookie.js';
2616
27 - $wgJSAutoloadLocalClasses['j.contextMenu'] = $mvjsp . 'jquery/plugins/jquery.contextMenu.js';
28 - $wgJSAutoloadLocalClasses['j.fn.autocomplete'] = $mvjsp . 'jquery/plugins/jquery.autocomplete.js';
29 - $wgJSAutoloadLocalClasses['j.fn.hoverIntent'] = $mvjsp . 'jquery/plugins/jquery.hoverIntent.js';
30 - $wgJSAutoloadLocalClasses['j.Jcrop'] = $mvjsp . 'jquery/plugins/Jcrop/js/jquery.Jcrop.js';
31 - $wgJSAutoloadLocalClasses['Date.fromString'] = $mvjsp . 'jquery/plugins/date.js';
32 - $wgJSAutoloadLocalClasses['j.fn.datePicker'] = $mvjsp . 'jquery/plugins/jquery.datePicker.js';
 17+ $wgJSAutoloadLocalClasses['j.contextMenu'] = $mwEmbedDirectory . 'jquery/plugins/jquery.contextMenu.js';
 18+ $wgJSAutoloadLocalClasses['j.fn.autocomplete'] = $mwEmbedDirectory . 'jquery/plugins/jquery.autocomplete.js';
 19+ $wgJSAutoloadLocalClasses['j.fn.hoverIntent'] = $mwEmbedDirectory . 'jquery/plugins/jquery.hoverIntent.js';
 20+ $wgJSAutoloadLocalClasses['j.Jcrop'] = $mwEmbedDirectory . 'jquery/plugins/Jcrop/js/jquery.Jcrop.js';
 21+ $wgJSAutoloadLocalClasses['Date.fromString'] = $mwEmbedDirectory . 'jquery/plugins/date.js';
 22+ $wgJSAutoloadLocalClasses['j.fn.datePicker'] = $mwEmbedDirectory . 'jquery/plugins/jquery.datePicker.js';
3323
 24+ //jquery.ui
 25+ $wgJSAutoloadLocalClasses['j.ui'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.core.js';
 26+
 27+ $wgJSAutoloadLocalClasses['j.effects.blind'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.blind.js';
 28+ $wgJSAutoloadLocalClasses['j.effects.drop'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.drop.js';
 29+ $wgJSAutoloadLocalClasses['j.effects.pulsate'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.pulsate.js';
 30+ $wgJSAutoloadLocalClasses['j.effects.transfer'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.transfer.js';
 31+ $wgJSAutoloadLocalClasses['j.ui.droppable'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.droppable.js';
 32+ $wgJSAutoloadLocalClasses['j.ui.slider'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.slider.js';
 33+ $wgJSAutoloadLocalClasses['j.effects.bounce'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.bounce.js';
 34+ $wgJSAutoloadLocalClasses['j.effects.explode'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.explode.js';
 35+ $wgJSAutoloadLocalClasses['j.effects.scale'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.scale.js';
 36+ $wgJSAutoloadLocalClasses['j.ui.datepicker'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.datepicker.js';
 37+ $wgJSAutoloadLocalClasses['j.ui.progressbar'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.progressbar.js';
 38+ $wgJSAutoloadLocalClasses['j.ui.sortable'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.sortable.js';
 39+ $wgJSAutoloadLocalClasses['j.effects.clip'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.clip.js';
 40+ $wgJSAutoloadLocalClasses['j.effects.fold'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.fold.js';
 41+ $wgJSAutoloadLocalClasses['j.effects.shake'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.shake.js';
 42+ $wgJSAutoloadLocalClasses['j.ui.dialog'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.dialog.js';
 43+ $wgJSAutoloadLocalClasses['j.ui.resizable'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.resizable.js';
 44+ $wgJSAutoloadLocalClasses['j.ui.tabs'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.tabs.js';
 45+ $wgJSAutoloadLocalClasses['j.effects.core'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.core.js';
 46+ $wgJSAutoloadLocalClasses['j.effects.highlight']= $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.highlight.js';
 47+ $wgJSAutoloadLocalClasses['j.effects.slide'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.slide.js';
 48+ $wgJSAutoloadLocalClasses['j.ui.accordion'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.accordion.js';
 49+ $wgJSAutoloadLocalClasses['j.ui.draggable'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.draggable.js';
 50+ $wgJSAutoloadLocalClasses['j.ui.selectable'] = $mwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.selectable.js';
 51+
 52+
3453 //libAddMedia:
35 - $wgJSAutoloadLocalClasses['mvFirefogg'] = $mvjsp . 'libAddMedia/mvFirefogg.js';
36 - $wgJSAutoloadLocalClasses['mvUploader'] = $mvjsp . 'libAddMedia/mvUploader.js';
37 - $wgJSAutoloadLocalClasses['remoteSearchDriver'] = $mvjsp . 'libAddMedia/remoteSearchDriver.js';
38 - $wgJSAutoloadLocalClasses['seqRemoteSearchDriver'] = $mvjsp . 'libAddMedia/seqRemoteSearchDriver.js';
39 - $wgJSAutoloadLocalClasses['baseRemoteSearch'] = $mvjsp . 'libAddMedia/searchLibs/baseRemoteSearch.js';
40 - $wgJSAutoloadLocalClasses['mediaWikiSearch'] = $mvjsp . 'libAddMedia/searchLibs/mediaWikiSearch.js';
41 - $wgJSAutoloadLocalClasses['metavidSearch'] = $mvjsp . 'libAddMedia/searchLibs/metavidSearch.js';
42 - $wgJSAutoloadLocalClasses['archiveOrgSearch'] = $mvjsp . 'libAddMedia/searchLibs/archiveOrgSearch.js';
43 - $wgJSAutoloadLocalClasses['baseRemoteSearch'] = $mvjsp . 'libAddMedia/searchLibs/baseRemoteSearch.js';
 54+ $wgJSAutoloadLocalClasses['mvFirefogg'] = $mwEmbedDirectory . 'libAddMedia/mvFirefogg.js';
 55+ $wgJSAutoloadLocalClasses['mvAdvFirefogg'] = $mwEmbedDirectory . 'libAddMedia/advFirefogg.js';
 56+ $wgJSAutoloadLocalClasses['mvUploader'] = $mwEmbedDirectory . 'libAddMedia/mvUploader.js';
 57+ $wgJSAutoloadLocalClasses['remoteSearchDriver'] = $mwEmbedDirectory . 'libAddMedia/remoteSearchDriver.js';
 58+ $wgJSAutoloadLocalClasses['seqRemoteSearchDriver'] = $mwEmbedDirectory . 'libAddMedia/seqRemoteSearchDriver.js';
 59+ $wgJSAutoloadLocalClasses['baseRemoteSearch'] = $mwEmbedDirectory . 'libAddMedia/searchLibs/baseRemoteSearch.js';
 60+ $wgJSAutoloadLocalClasses['mediaWikiSearch'] = $mwEmbedDirectory . 'libAddMedia/searchLibs/mediaWikiSearch.js';
 61+ $wgJSAutoloadLocalClasses['metavidSearch'] = $mwEmbedDirectory . 'libAddMedia/searchLibs/metavidSearch.js';
 62+ $wgJSAutoloadLocalClasses['archiveOrgSearch'] = $mwEmbedDirectory . 'libAddMedia/searchLibs/archiveOrgSearch.js';
 63+ $wgJSAutoloadLocalClasses['baseRemoteSearch'] = $mwEmbedDirectory . 'libAddMedia/searchLibs/baseRemoteSearch.js';
4464
4565 //libClipEdit:
46 - $wgJSAutoloadLocalClasses['mvClipEdit'] = $mvjsp . 'libClipEdit/mvClipEdit.js';
 66+ $wgJSAutoloadLocalClasses['mvClipEdit'] = $mwEmbedDirectory . 'libClipEdit/mvClipEdit.js';
4767
4868 //libEmbedObj:
49 - $wgJSAutoloadLocalClasses['embedVideo'] = $mvjsp . 'libEmbedObj/mv_baseEmbed.js';
50 - $wgJSAutoloadLocalClasses['flashEmbed'] = $mvjsp . 'libEmbedObj/mv_flashEmbed.js';
51 - $wgJSAutoloadLocalClasses['genericEmbed'] = $mvjsp . 'libEmbedObj/mv_genericEmbed.js';
52 - $wgJSAutoloadLocalClasses['htmlEmbed'] = $mvjsp . 'libEmbedObj/mv_htmlEmbed.js';
53 - $wgJSAutoloadLocalClasses['javaEmbed'] = $mvjsp . 'libEmbedObj/mv_javaEmbed.js';
54 - $wgJSAutoloadLocalClasses['nativeEmbed'] = $mvjsp . 'libEmbedObj/mv_nativeEmbed.js';
55 - $wgJSAutoloadLocalClasses['quicktimeEmbed'] = $mvjsp . 'libEmbedObj/mv_quicktimeEmbed.js';
56 - $wgJSAutoloadLocalClasses['vlcEmbed'] = $mvjsp . 'libEmbedObj/mv_vlcEmbed.js';
 69+ $wgJSAutoloadLocalClasses['embedVideo'] = $mwEmbedDirectory . 'libEmbedObj/mv_baseEmbed.js';
 70+ $wgJSAutoloadLocalClasses['flashEmbed'] = $mwEmbedDirectory . 'libEmbedObj/mv_flashEmbed.js';
 71+ $wgJSAutoloadLocalClasses['genericEmbed'] = $mwEmbedDirectory . 'libEmbedObj/mv_genericEmbed.js';
 72+ $wgJSAutoloadLocalClasses['htmlEmbed'] = $mwEmbedDirectory . 'libEmbedObj/mv_htmlEmbed.js';
 73+ $wgJSAutoloadLocalClasses['javaEmbed'] = $mwEmbedDirectory . 'libEmbedObj/mv_javaEmbed.js';
 74+ $wgJSAutoloadLocalClasses['nativeEmbed'] = $mwEmbedDirectory . 'libEmbedObj/mv_nativeEmbed.js';
 75+ $wgJSAutoloadLocalClasses['quicktimeEmbed'] = $mwEmbedDirectory . 'libEmbedObj/mv_quicktimeEmbed.js';
 76+ $wgJSAutoloadLocalClasses['vlcEmbed'] = $mwEmbedDirectory . 'libEmbedObj/mv_vlcEmbed.js';
5777
5878 //libSequencer:
59 - $wgJSAutoloadLocalClasses['mvPlayList'] = $mvjsp . 'libSequencer/mvPlayList.js';
60 - $wgJSAutoloadLocalClasses['mvSequencer'] = $mvjsp . 'libSequencer/mvSequencer.js';
 79+ $wgJSAutoloadLocalClasses['mvPlayList'] = $mwEmbedDirectory . 'libSequencer/mvPlayList.js';
 80+ $wgJSAutoloadLocalClasses['mvSequencer'] = $mwEmbedDirectory . 'libSequencer/mvSequencer.js';
6181
6282 //libTimedText:
63 - $wgJSAutoloadLocalClasses['mvTextInterface'] = $mvjsp . 'libTimedText/mvTextInterface.js';
 83+ $wgJSAutoloadLocalClasses['mvTextInterface'] = $mwEmbedDirectory . 'libTimedText/mvTextInterface.js';
6484 ?>
\ No newline at end of file
Index: branches/new-upload/phase3/js2/mwEmbed/php/noMediaWikiConfig.php
@@ -1,13 +1,32 @@
22 <?php
3 -mv_nomediawiki_config();
 3+//give us true for mediaWiki
 4+define( 'MEDIAWIKI', true );
45
5 -function mv_nomediawiki_config() {
6 - global $wgJSAutoloadLocalClasses, $wgScriptPath;
7 - $wgJSAutoloadLocalClasses = array();
8 - $wgScriptPath = realpath(dirname(__FILE__).'../');
 6+define('MWEMBED_STANDALONE', true);
 7+
 8+//setup the globals: (for documentation see: DefaultSettings.php )
 9+
 10+$wgJSAutoloadLocalClasses = array();
 11+
 12+$IP = realpath(dirname(__FILE__).'/../');
 13+
 14+//$mwEmbedDirectory becomes the root $IP
 15+$mwEmbedDirectory = '';
 16+
 17+$wgUseFileCache = true;
 18+
 19+$wgEnableScriptLoaderJsFile = false;
 20+
 21+$wgEnableScriptLocalization = false;
 22+
 23+$wgStyleVersion = '218';
 24+
 25+$wgEnableScriptMinify = true;
 26+
 27+//get the autoLoadClasses
 28+require_once( realpath( dirname(__FILE__) ) . '/jsAutoloadLocalClasses.php' );
929
10 - //give us true for mediaWiki
11 - define( 'MEDIAWIKI', true );
12 -}
13 -?>
 30+//get the JSmin class:
 31+require_once( realpath( dirname(__FILE__) ) . '/minify/JSMin.php' );
1432
 33+?>
\ No newline at end of file
Index: branches/new-upload/phase3/js2/mwEmbed/mv_embed.js
@@ -44,6 +44,8 @@
4545
4646 var mediaWiki_mvEmbed_path = 'js2/mv_embed/';
4747
 48+//
 49+
4850 var global_player_list = new Array(); //the global player list per page
4951 var global_req_cb = new Array(); //the global request callback array
5052 var _global = this; //global obj
@@ -263,10 +265,9 @@
264266 callback();
265267 return ;
266268 }
267 - //check if we should use the script loader to combine all the requests into one:
268 - var slpath = getScriptLoaderPath();
269 - if( slpath ){
270 - var class_set = '';
 269+ //check if we should use the script loader to combine all the requests into one:
 270+ if( mwSlScript ){
 271+ var class_set = '';
271272 var last_class = '';
272273 var coma = '';
273274 for( var i in libs ){
@@ -278,7 +279,7 @@
279280 }
280281 }
281282 var dbug_attr = (parseUri( getMvEmbedURL() ).queryKey['debug'])?'&debug=true':'';
282 - this.libs[ last_class ] = slpath + '?class=' + class_set +
 283+ this.libs[ last_class ] = mwSlScript + '?class=' + class_set +
283284 '&urid=' + getMvUniqueReqId() + dbug_attr;
284285
285286 }else{
@@ -450,7 +451,10 @@
451452 }
452453 }
453454 //mwAddOnloadHook: ensure jQuery and the DOM are ready:
454 -function mwAddOnloadHook( func ) {
 455+function mwAddOnloadHook( func ) {
 456+ //issue a style sheet request (no load checks on style sheets:
 457+ if(!styleSheetPresent( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css'))
 458+ loadExternalCss( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css');
455459 //if we have already run the dom ready just run the function directly:
456460 if( mvJsLoader.doneReadyEvents ){
457461 //make sure jQuery is there:
@@ -855,20 +859,6 @@
856860 e.rel = 'stylesheet';
857861 document.getElementsByTagName("head")[0].appendChild(e);
858862 }
859 -function getScriptLoaderPath(){
860 - var eurl = getMvEmbedURL();
861 - //script loader by either of its two names
862 - var smv = 'jsScriptLoader.php';
863 - var smw = 'mwScriptLoader.php';
864 - //get just the script loader part of the url:
865 - if( eurl.indexOf(smv) != -1 ){
866 - return eurl.substr(0, (eurl.indexOf(smv) + smv.length));
867 - }else if( eurl.indexOf(smw) != -1 ){
868 - return eurl.substr(0, (eurl.indexOf(smw) + smw.length));
869 - }else{
870 - return false; //could not get script loader location
871 - }
872 -}
873863 function getMvEmbedURL(){
874864 if( _global['mv_embed_url'] )
875865 return _global['mv_embed_url'];
Index: branches/new-upload/phase3/js2/mwEmbed/jsScriptLoader.php
@@ -2,18 +2,13 @@
33 //This core jsScriptLoader class provides the script loader functionality
44
55 //check if we are being invoked in mediaWiki context or stand alone usage:
6 -if ( !defined( 'MEDIAWIKI' ) ){
7 - //make sure we are not in an mediaWiki install (where the only entry point should be the root scriptLoader)
8 - if(is_file( dirname(__FILE__) . '../../mvwScriptLoader.php')){
9 - die('should use the mediaWiki script loader entry point (not the mv_embed scriptloader)');
10 - }
11 - //load config stub
12 - require_once( realpath( dirname(__FILE__) ) . 'php/noMediaWikiConfig.php' );
13 - //get the autoLoadClasses
14 - require_once( realpath( dirname(__FILE__) ) . 'php/jsAutoloadLocalClasses.php' );
 6+if ( !defined( 'MEDIAWIKI' ) ){
 7+ //load noMediaWiki helper:
 8+ require_once( realpath( dirname(__FILE__) ) . '/php/noMediaWikiConfig.php' );
159
1610 //run the main action:
1711 $myScriptLoader = new jsScriptLoader();
 12+ //preset request values via normal $_GET opperation:
1813 $myScriptLoader->doScriptLoader();
1914 }
2015
@@ -25,13 +20,14 @@
2621 var $error_msg ='';
2722 var $debug = false;
2823 var $jsvarurl =false; // if we should include generated js (special class '-')
 24+ var $doProcReqFlag =true;
2925
3026 function doScriptLoader(){
3127 global $wgJSAutoloadClasses,$wgJSAutoloadLocalClasses, $wgEnableScriptLoaderJsFile, $wgRequest, $IP,
3228 $wgEnableScriptMinify, $wgUseFileCache;
3329
34 - //process the request
35 - $this->procRequestVars();
 30+ //process the request
 31+ $this->procRequestVars();
3632
3733 $wgUseFileCache=false;
3834 //if cache is on and file is present grab it from there:
@@ -43,7 +39,10 @@
4440 $this->sFileCache->loadFromFileCache();
4541 }
4642 }
47 -
 43+ //setup script loader header info
 44+ $this->jsout .= 'var mwSlScript = "'. $_SERVER['SCRIPT_NAME'] . '";' . "\n";
 45+ $this->jsout .= 'var mwSlGenISODate = "'. date('c') . '";' ."\n";
 46+ $this->jsout .= 'var mwSlURID = "' . $this->urid . '";' ."\n";
4847 //Build the Output:
4948 //swap in the appropriate language per js_file
5049 foreach($this->jsFileList as $classKey => $file_name){
@@ -74,7 +73,10 @@
7574 //its a wikiTitle append the output of the wikitext:
7675 $t = Title::newFromText ( $title_block );
7776 $a = new Article( $t );
78 - $this->jsout .= $a->getContent() . "\n";
 77+ //only get content if the page is not empty:
 78+ if($a->getID() !== 0 ){
 79+ $this->jsout .= $a->getContent() . "\n";
 80+ }
7981 continue;
8082 }
8183 }
@@ -87,8 +89,7 @@
8890 */\n";
8991 $this->jsout .= ( $this->doProccessJsFile( $file_name ) ). "\n";
9092 }
91 - }
92 -
 93+ }
9394 //check if we should minify :
9495 if( $wgEnableScriptMinify && !$this->debug){
9596 //do the minification and output
@@ -121,15 +122,27 @@
122123 * updates the proc Request
123124 */
124125 function procRequestVars(){
125 - global $wgRequest, $wgContLanguageCode, $wgEnableScriptMinify, $wgJSAutoloadClasses, $wgJSAutoloadLocalClasses;
126 -
127 - //set debug flag:
128 - if( $wgRequest->getVal('debug') || $wgEnableScriptDebug==true )
129 - $this->debug = true;
 126+ global $wgRequest, $wgContLanguageCode, $wgEnableScriptMinify, $wgJSAutoloadClasses, $wgJSAutoloadLocalClasses, $wgStyleVersion;
130127
 128+ //set debug flag:
 129+ if( (isset($_GET['debug']) && $_GET['debug']=='true') && (isset($wgEnableScriptDebug) && $wgEnableScriptDebug==true )){
 130+ $this->debug = true;
 131+ }
 132+ //set the urid:
 133+ if( isset( $_GET['urid'] ) && $_GET['urid'] !=''){
 134+ $this->urid = htmlspecialchars( $_GET['urid'] );
 135+ }else{
 136+ //just give it the current style sheet id:
 137+ //@@todo read the svn version number
 138+ $this->urid = $wgStyleVersion;
 139+ }
 140+
 141+ $reqClassList = false;
 142+ if( isset($_GET['class']) && $_GET['class']!=''){
 143+ $reqClassList = explode( ',', $_GET['class'] );
 144+ }
131145 //check for the requested classes
132 - if( $wgRequest->getVal('class') ){
133 - $reqClassList = explode( ',', $wgRequest->getVal('class') );
 146+ if( $reqClassList ){
134147 //clean the class list and populate jsFileList
135148 foreach( $reqClassList as $reqClass ){
136149 if(trim($reqClass) != ''){
@@ -154,7 +167,7 @@
155168 }
156169 }
157170 }
158 - }
 171+ }
159172 //check for requested files if enabled:
160173 if( $wgEnableScriptLoaderJsFile ){
161174 if( $wgRequest->getVal('files')){
@@ -166,24 +179,18 @@
167180 //only allow alphanumeric underscores periods and ending with .js
168181 $reqFile = ereg_replace("[^A-Za-z0-9_\-\/\.]", "", $reqFile );
169182 if( substr($reqFile, -3) == '.js' ){
170 - if( is_file( $IP . $reqFile) && !in_array($reqFile, $jsFileList ) ){
 183+ //don't add it twice:
 184+ if( !in_array($reqFile, $jsFileList )) {
171185 $this->jsFileList[] = $IP . $reqFile;
172186 $this->rKey.=$reqFile;
173 - }else{
174 - $this->error_msg.= 'Requested File: ' . $reqFile . ' not found' . "\n";
175 - }
 187+ }
 188+ }else{
 189+ $this->error_msg.= 'Not valid requsted javascript file' . "\n";
176190 }
177191 }
178192 }
179193 }
180 - //check for a unique request id (should be tied to the svn version for "fresh" copies of things
181 - if( $wgRequest->getVal('urid') ) {
182 - $this->urid = $wgRequest->getVal('urid');
183 - }else{
184 - //just give it the current version number:
185 - global $IP;
186 - $this->urid = SpecialVersion::getSvnRevision( $IP );
187 - }
 194+
188195 //add the language code to the rKey:
189196 $this->rKey .= '_' . $wgContLanguageCode;
190197
@@ -196,20 +203,28 @@
197204 }
198205 }
199206 function doProccessJsFile( $file_name ){
200 - //set working directory to root path:
 207+ global $IP, $wgEnableScriptLocalization, $IP, $mwEmbedDirectory;
 208+
 209+ //load the file:
 210+ $str = @file_get_contents("{$IP}/{$file_name}");
 211+
 212+ if($str===false){
 213+ //@@todo check php error level (don't want to expose paths if errors are hidden)
 214+ $this->error_msg.= 'Requested File: ' . htmlspecialchars( $file_name ) . ' could not be read' . "\n";
 215+ return '';
 216+ }
 217+ $this->cur_file = $file_name;
201218
202 - $str = file_get_contents($IP.$file_name);
203 - $this->cur_file = $file_name;
204219 //strip out js_log debug lines not much luck with this regExp yet:
205220 //if( !$this->debug )
206 - // $str = preg_replace('/\n\s*js_log\s*\([^\)]([^;]|\n])*;/', "\n", $str);
207 - //die('<pre>'.$str);
 221+ // $str = preg_replace('/\n\s*js_log\s*\([^\)]([^;]|\n])*;/', "\n", $str);
208222
209223 // do language swap
210 - $str = preg_replace_callback('/loadGM\s*\(\s*{(.*)}\s*\)\s*/siU', //@@todo fix: will break down if someone does }) in their msg text
 224+ if($wgEnableScriptLocalization)
 225+ $str = preg_replace_callback('/loadGM\s*\(\s*{(.*)}\s*\)\s*/siU', //@@todo fix: will break down if someone does }) in their msg text
211226 array($this, 'languageMsgReplace'),
212227 $str);
213 -
 228+
214229 return $str;
215230 }
216231 function languageMsgReplace($jvar){
Index: branches/new-upload/phase3/js2/mwEmbed/example_usage/Make_Ogg.html
@@ -0,0 +1,128 @@
 2+<!DOCTYPE HTML>
 3+<html><head>
 4+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
 5+ <title>Firefogg - Make Ogg Video in your Browser</title>
 6+ <script type="text/javascript" src="../jsScriptLoader.php?class=mv_embed"></script>
 7+<style type="text/css" media="all">@import "http://www.firefogg.org/css/style.css";</style>
 8+
 9+<script type="text/javascript">
 10+mwAddOnloadHook(function(){
 11+ $j('.install').hide();
 12+ if(!($j.browser.mozilla && $h.browser.version >= '1.9.1')) {
 13+ $j('#use_firefox').show();
 14+ }else {
 15+ if(typeof(Firefogg) != 'undefined' && Firefogg().version >= '0.9.5') {
 16+ $j('#installed').show();
 17+ setupFirefogg();
 18+ } else {
 19+ if(navigator.oscpu && navigator.oscpu.search('Linux') >= 0)
 20+ $j('#install_linux').show();
 21+ else if(navigator.oscpu && navigator.oscpu.search('Mac') >= 0)
 22+ $j('#install_macosx').show();
 23+ else if(navigator.oscpu && navigator.oscpu.search('Win') >= 0)
 24+ $j('#install_win32').show();
 25+ }
 26+ }
 27+});
 28+
 29+//sets up the local settings for the encode (restored from a cookie if you have them)
 30+function setupSettings( force ){
 31+ if(!force){
 32+ if($.cookie('firefogg_settings')){
 33+ firefogg_settings = JSON.parse( $.cookie('firefogg_settings') );
 34+ }
 35+ }
 36+ for(var i in firefogg_defaults){
 37+ if( firefogg_defaults[i]['d'] ){
 38+ firefogg_settings[i] = firefogg_defaults[i]['d'];
 39+ }
 40+ }
 41+ setValuesInHtml();
 42+}
 43+function setValuesInHtml(){
 44+ //set the actual HTML:
 45+ $.each(firefogg_settings, function(inx, val){
 46+ if($j('#_'+inx).length !=0){
 47+ $j('#_'+inx).val( val );
 48+ }
 49+ })
 50+}
 51+function saveSettings(){
 52+ $.cookie('firefogg_settings', JSON.stringify( firefogg_settings ) );
 53+}
 54+
 55+function setupFirefogg(){
 56+ //get all the libraries we will need (should be single scriptLoader request
 57+ //(unless you loaded mv_embed.js without php in which case lots of js load requests:)
 58+ mvJsLoader.doLoad({
 59+ 'mvUploader' : 'libAddMedia/mvUploader.js',
 60+ 'mvFirefogg' : 'libAddMedia/mvFirefogg.js',
 61+ 'mvAdvFirefogg' : 'libAddMedia/mvAdvFirefogg.js',
 62+ '$j.cookie' : 'jquery/jquery.ui-1.7.1/external/jquery.cookie.js',
 63+ '$j.ui' : 'jquery/jquery.ui-1.7.1/ui/ui.core.js',
 64+ '$j.ui.accordion' : 'jquery/jquery.ui-1.7.1/ui/ui.accordion.js',
 65+ '$j.ui.slider' : 'jquery/jquery.ui-1.7.1/ui/ui.slider.js';
 66+ },function(){
 67+ //do setupSettings:
 68+ //for all options see /* iniObj in mvAdvFirefogg.js */
 69+ mvAdvFirefogg = new mvAdvFirefogg({
 70+ //set up the targets:
 71+ 'btn_select_file' : '#select_file',
 72+ 'btn_select_new_file' : '#select_new_file',
 73+ 'btn_save_local_file' : '#save_local_file',
 74+ //the control container (where we put all the controls)
 75+ 'control_container' : '#control_container'
 76+ });
 77+ );
 78+}
 79+</script>
 80+</head><body>
 81+<div id="main">
 82+ <h1><a href="http://www.firefogg.org/index.html"><img
 83+src="http://www.firefogg.org/png/firefogg.png" alt="Firefogg"></a><br>
 84+Make Ogg Video</h1>
 85+<br>
 86+<center>
 87+<table width="500" border="0">
 88+<tr>
 89+<td colspan="2">
 90+ <div id="install_linux" class="install">
 91+ <a href="linux/Firefogg-0.9.5.xpi">Install Firefogg</a>
 92+</div>
 93+<div id="install_macosx" class="install">
 94+ <a href="macosx/Firefogg-0.9.5.xpi">Install Firefogg</a>
 95+</div>
 96+<div id="install_win32" class="install">
 97+ <a href="win32/Firefogg-0.9.5.xpi">Install Firefogg</a>
 98+</div>
 99+<div id="installed" class="install" style="background:#FFF">
 100+ <a href="http://firefogg.org">Firefogg</a> installed. </a>
 101+</div>
 102+<div id="use_firefox" class="install">
 103+ You need <a href="http://www.mozilla.com/en-US/firefox/all-beta.html">Firefox 3.5</a><br>to use this extension.
 104+</div>
 105+
 106+</td>
 107+</tr>
 108+<tr>
 109+<td>
 110+
 111+<input style="font-size:150%" id="select_file" type="button" value="Select File" disabled="true">
 112+<input style="font-size:150%;display:none" id="save_local_file" type="button" value="Save Ogg File" >
 113+<input style="font-size:150%;display:none" id="select_new_file" type="button" value="Select New File" >
 114+
 115+</td>
 116+<td id="file_info">
 117+</td>
 118+</tr>
 119+<tr>
 120+<td colspan="2" style="display:none" id="fogg_control_td" >
 121+ <div style="height:400px" id="control_container"></div>
 122+<br><br>
 123+<span style="font:size:80%">Built using <a href="http://firefogg.org">firefogg</a> & <a href="http://jqueryui.com/">jquery.ui</a> Supports
 124+<a href="javascript:(function(){if%20(!/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){alert('Sorry,%20due%20to%20security%20restrictions,%20this%20tool%20only%20works%20in%20Firefox');%20return%20false;%20};%20if(window.jquitr){%20jquitr.addThemeRoller();%20}%20else{%20jquitr%20=%20{};%20jquitr.s%20=%20document.createElement('script');%20jquitr.s.src%20=%20'http://jqueryui.com/themeroller/developertool/developertool.js.php';%20document.getElementsByTagName('head')[0].appendChild(jquitr.s);}%20})();">custom themes</a>, <b>remix me</b>
 125+</td>
 126+</tr>
 127+</table>
 128+ <h2></h2>
 129+</body></html>
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvAdvFirefogg.js
@@ -0,0 +1,427 @@
 2+/*
 3+* Adds advanced firefogg support (let you control and structure advanced controls over many aspects of video editing)
 4+*/
 5+
 6+//@@todo put all msg text into loadGM json
 7+
 8+
 9+var mvAdvFirefogg = function( initObj ){
 10+ return this.init( initObj );
 11+}
 12+var default_mvAdvFirefogg_config = {
 13+ //which config groups to include
 14+ 'config_groups' : ['preset', 'quality', 'meta', 'advVideo', 'advAudio'],
 15+
 16+ //if you want to load any custom presets to chose from
 17+ 'custom_presets' : {},
 18+
 19+ //any firefog config properties that may need to be excluded from options
 20+ 'exclude_settings' : [],
 21+
 22+ //taget buttons:
 23+ 'btn_select_file' : '',
 24+ 'btn_select_new_file': '',
 25+ 'btn_save_local_file': '',
 26+
 27+ //the control container (where we put all the controls)
 28+ 'control_container' : ''
 29+}
 30+
 31+mvAdvFirefogg.prototype = {
 32+
 33+ //the global groupings and titles for for configuration options :
 34+ config_groups :{
 35+ 'preset' : "Preset: $1",
 36+ 'quality' : "Basic Quality and Resolution Control",
 37+ 'meta' : "Meta Data for the Clip",
 38+ 'advVideo' : "Advanced Video Encoding Controls",
 39+ 'advAudio' : "Advanced Audio Encoding Controls"
 40+ },
 41+ //list of pre-sets:
 42+ presetConf : {
 43+ 'presets' :{
 44+ 'd' : 'webvideo',
 45+ 'type' : 'select',
 46+ 'selectVal': ['webvideo'],
 47+ 'group' : "preset",
 48+ 'preset_conf':{
 49+ 'webvideo': {
 50+ 'desc': "Webvideo Theora, Vorbis 400kbs & 400px Width",
 51+ 'conf': {
 52+ 'maxSize': 400,
 53+ 'videoBitrate': 400,
 54+ 'noUpscaling':true
 55+ }
 56+ }
 57+ }
 58+ }
 59+ },
 60+ //core firefogg default encoder configuration
 61+ //see encoder options here: http://www.firefogg.org/dev/index.html
 62+ encoder_config : {
 63+ //base quality settings:
 64+ 'videoQuality': {
 65+ 'd' : 5,
 66+ 't' : 'Video Quality',
 67+ 'range' : {'min':0,'max':10},
 68+ 'type' : 'slider',
 69+ 'group' : 'quality',
 70+ 'help' : "Used to set the <i>Visual Quality</i> of the encoded video."
 71+ },
 72+ 'audioQuality': {
 73+ 'd' : 1,
 74+ 't' : 'Audio Quality',
 75+ 'range' : {'min':-1,'max':10},
 76+ 'type' : 'slider',
 77+ 'group' : 'quality',
 78+ 'help' : "Used to set the <i>Acoustic Quality</i> of the encoded audio."
 79+ },
 80+ 'videoCodec':{
 81+ 'd' : "theora",
 82+ 't' : 'Video Codec',
 83+ 'selectVal' : ['theora'],
 84+ 'type' : "select",
 85+ 'group' : "quality",
 86+ 'help' : "Used to select the clip video codec. Presently only Theora is supported. More about the <a href=\"http://www.theora.org/\">theora codec</a> "
 87+ },
 88+ 'audioCodec':{
 89+ 'd' : "vorbis",
 90+ 't' : 'Audio Codec',
 91+ 'selectVal' : ['vorbis'],
 92+ 'type' : "select",
 93+ 'group' : "quality",
 94+ 'help' : "Used to set the clip audio codec. Presently only Vorbis is supported. More about the <a href=\"http://www.vorbis.com//\">vorbis codec</a> "
 95+ },
 96+ 'width': {
 97+ 't' : 'Video Width',
 98+ 'type' : "int",
 99+ 'group' : "quality",
 100+ 'help' : "Resize to given width."
 101+ },
 102+ 'height': {
 103+ 't' : 'Video Height',
 104+ 'type' : "int",
 105+ 'group' : "quality",
 106+ 'help' : "Resize to given height"
 107+ },
 108+
 109+ //advanced Video control configs:
 110+ 'framerate':{
 111+ 't' : 'Framerate',
 112+ 'selectVal' : ['12', '16', '23:976', '24', '29:97', '30'],
 113+ 'type' : "select",
 114+ 'group' : "advVideo",
 115+ 'help' : "The video Framerate. More about <a target=\"_new\" href=\"http://en.wikipedia.org/wiki/Frame_rate\">Framerate</a>"
 116+ },
 117+ 'aspect':{
 118+ 't' : 'Aspect Ratio',
 119+ 'type' : "select",
 120+ 'selectVal' : ['4:3', '16:9'],
 121+ 'group' : "advVideo",
 122+ 'help' : "The video aspect ratio can be fraction 4:3 or 16:9. More about <a target=\"_new\" href=\"http://en.wikipedia.org/wiki/Aspect_ratio_%28image%29\">aspect ratios</a>"
 123+ },
 124+ 'keyframeInterval':{
 125+ 'd' : '64',
 126+ 't' : 'Key Frame Interval',
 127+ 'range' : {'min':0,'max':65536},
 128+ 'numberType' : 'force keyframe every $1 frames',
 129+ 'type' : 'slider',
 130+ 'group' : 'advVideo',
 131+ 'help' : "The keyframe interval in frames. Note: Most codecs force keyframes if the difference between frames is greater than keyframe encode size. More about <a href=\"http://en.wikipedia.org/wiki/I-frame\">keyframes</a>"
 132+ },
 133+ 'denoise':{
 134+ 'type' : "boolean",
 135+ 't' : "Denoise Filter",
 136+ 'group' : 'advVideo',
 137+ 'help' : "Denoise input video. More about <a target=\"_new\" href=\"http://en.wikipedia.org/wiki/Video_denoising\">denoise</a>"
 138+ },
 139+ 'novideo':{
 140+ 't' : "No Video",
 141+ 'type' : "boolean",
 142+ 'group' : 'advVideo',
 143+ 'help' : "disable video in the output"
 144+ },
 145+
 146+ //advanced Audio control Config:
 147+ 'audioBitrate':{
 148+ 't' : "Audio Bitrate",
 149+ 'range' : {'min':32,'max':500},
 150+ 'numberType' : '$1 kbs',
 151+ 'type' : 'slider',
 152+ 'group' : 'advAudio'
 153+ },
 154+ 'samplerate':{
 155+ 't' : "Audio Sample Rate",
 156+ 'type' : 'select',
 157+ 'selectVal' : [{'22050':'22 kHz'}, {'44100':'44 khz'}, {'48000':'48 khz'}],
 158+ 'formatSelect' : function(val){
 159+ return (Math.round(val/100)*10) + ' Hz';
 160+ },
 161+ 'help' : "set output samplerate (in Hz)."
 162+ },
 163+ 'noaudio':{
 164+ 't' : "No Audio",
 165+ 'type' : 'boolean',
 166+ 'group' : 'advAudio',
 167+ 'help' : "disable audio in the output"
 168+ },
 169+
 170+ //meta tags:
 171+ 'title':{
 172+ 't' : "Title",
 173+ 'type' : 'string',
 174+ 'group' : 'meta',
 175+ 'help' : "A title for your clip"
 176+ },
 177+ 'artist':{
 178+ 't' : "Artist Name",
 179+ 'type' : 'string',
 180+ 'group' : 'meta',
 181+ 'help' : "The artist that created this clip"
 182+ },
 183+ 'date':{
 184+ 't' : "Date",
 185+ 'group' : 'meta',
 186+ 'type' : 'date',
 187+ 'help' : "The date the footage was created or released"
 188+ },
 189+ 'location':{
 190+ 't' : "Location",
 191+ 'type' : 'location',
 192+ 'group' : 'meta',
 193+ 'help' : "The location of the footage"
 194+ },
 195+ 'organization':{
 196+ 't' : "Organization",
 197+ 'type' : 'string',
 198+ 'group' : 'meta',
 199+ 'help' : "Name of organization (studio)"
 200+ },
 201+ 'copyright':{
 202+ 't' : "Copyright",
 203+ 'type' : 'string',
 204+ 'group' : 'meta',
 205+ 'help' : "The Copyright of the clip"
 206+ },
 207+ 'license':{
 208+ 't' : "License",
 209+ 'type' : 'url-license',
 210+ 'group' : 'meta',
 211+ 'help' : "The license of the clip (preferably a creative commons url)"
 212+ },
 213+ 'contact':{
 214+ 't' : "Contact",
 215+ 'type' : 'string',
 216+ 'group' : 'meta',
 217+ 'help' : "Contact link"
 218+ }
 219+ },
 220+ //inherit mvFirefog (which provides access point to ogg and inherits mvUploader)
 221+ init:function( initObj ){
 222+ //setup a "supported" initObj:
 223+ for(var i in initObj){
 224+ if( default_mvAdvFirefogg_config [i] ){
 225+ this[i] = initObj[i];
 226+ }
 227+ }
 228+ //do inherit myFogg:
 229+ var myFogg = new mvFirefogg ( {} )
 230+ for(var i in myFogg){
 231+ if(this[i])
 232+ this['parent_'+i] = myFogg[i];
 233+ else
 234+ this[i] = myFogg[i];
 235+ }
 236+ },
 237+ setupForm:function(){
 238+ //if we have a target control form gennerate the html and setup the bindings
 239+ if( this.control_container != ''){
 240+ //gennerate the control html
 241+ this.doControlHTML();
 242+
 243+ //setup bindings:
 244+ this.doControlBindings();
 245+ }
 246+ //else maybe we could just have a single link that invokes the interface?
 247+
 248+ },
 249+ doControlHTML: function(){
 250+ var out ='';
 251+ $.each(firefogg_config_groups, function(group_key, group_desc){
 252+ out+= '<div> '+
 253+ '<h3><a href="#" id="gd_'+group_key+'" >' + group_desc + '</a></h3>'+
 254+ '<div>';
 255+ //output that group control options:
 256+ out+='<table width="450" ><tr><td width="35%"></td><td width="65%"></td></tr>';
 257+ //special preset case:
 258+
 259+ for(var cK in firefogg_defaults){
 260+ var cConf = firefogg_defaults[cK];
 261+ if(cConf.group == group_key){
 262+ out+= proccessCkControlHTML( cK );
 263+ }
 264+ }
 265+ out+='</table>';
 266+ out+= '</div>' +
 267+ '</div>';
 268+
 269+ });
 270+ //console.log("out: " + out);
 271+ $j('#control_container').html( out );
 272+ },
 273+ proccessCkControlHTML:function( cK ){
 274+ var cConf = firefogg_defaults[cK];
 275+ var out ='';
 276+ out+='<tr><td valign="top">'+
 277+ '<label for="_' + cK + '">' +
 278+ cConf.t + ':' +
 279+ '<span id="help_'+ cK + '" class="ui-icon ui-icon-info" style="float:left"></span>'+
 280+ '</label></td><td>';
 281+ //check if we have a value for this:
 282+ var dv = ( firefogg_settings[ cK ] ) ? firefogg_settings[ cK ] : '';
 283+ //switch on the config type
 284+ switch( cConf.type ){
 285+ case 'string':
 286+ out+= '<input type="text" id="_' + cK + '" value="' + dv + '" >' ;
 287+ break;
 288+ case 'slider':
 289+ maxdigits = (Math.round( firefogg_defaults[ cK ].range.max / 10) +1);
 290+ out+= '<input type="text" maxlength="'+maxdigits+'" size="' +maxdigits + '" '+
 291+ 'id="_' + cK + '" style="display:inline;border:0; color:#f6931f; font-weight:bold;" ' +
 292+ 'value="' + dv + '" >' +
 293+ '<div id="slider_' + cK + '"></div>';
 294+ break;
 295+ case 'select':
 296+ out+= '<select id="_' + cK + '">'+
 297+ '<option value=""> </option>';
 298+ for(var i in cConf.selectVal){
 299+ var val = cConf.selectVal[i];
 300+ if(typeof val == 'string'){
 301+ var sel = ( cConf.selectVal[i] == val)?' selected':'';
 302+ out+= '<option value="'+val+'"'+sel+'>'+val+'</option>';
 303+ }else if(typeof val == 'object'){
 304+ for(var key in val){
 305+ hr_val = val[key];
 306+ }
 307+ var sel = ( cConf.selectVal[i] == key )?' selected':'';
 308+
 309+ out+= '<option value="'+key+'"'+sel+'>'+hr_val+'</option>';
 310+ }
 311+ }
 312+ out+='</select>';
 313+ break;
 314+ }
 315+ //output the help row:
 316+ if(cConf.help){
 317+ out+='<div id="helpRow_' + cK + '">'+
 318+ '<span id="helpClose_' + cK +'" class="ui-icon ui-icon-circle-close" '+
 319+ 'title="Close Help"'+
 320+ 'style="float:left"/>'+
 321+ cConf.help +
 322+ '</div>';
 323+ }
 324+ out+='</td></tr><tr><td colspan="2" height="10"></td></tr>';
 325+ return out;
 326+ },
 327+ doControlBindings:function(){
 328+ //bind the select action:
 329+ $j( '#select_file' ).click( function(){
 330+ doSelectFile();
 331+ //hide this show the select new button
 332+ $j(this).hide();
 333+ $j('#save_file,select_new_file,').show();
 334+ }).attr( 'disabled', false );
 335+
 336+ $j('#select_file_new').click(function(){
 337+ $j("#dialog").dialog({
 338+ bgiframe: true,
 339+ resizable: false,
 340+ height:140,
 341+ modal: true,
 342+ overlay: {
 343+ backgroundColor: '#000',
 344+ opacity: 0.5
 345+ },
 346+ buttons: {
 347+ 'Delete all items in recycle bin': function() {
 348+ $j(this).dialog('close');
 349+ },
 350+ Cancel: function() {
 351+ $j(this).dialog('close');
 352+ }
 353+ }
 354+ });
 355+ });
 356+ function doSelectFile(){
 357+ //select the video
 358+ if( ogg.selectVideo() ) {
 359+ //enable/show all the options
 360+ $j('#fogg_control_td').fadeIn("slow");
 361+ doControlBindings();
 362+ }
 363+ }
 364+
 365+ for(var cK in firefogg_defaults){
 366+ var cConf = firefogg_defaults[cK];
 367+ //set up the help for all types:
 368+ if(cConf.help){
 369+ //initial state is hidden:
 370+ $j('#helpRow_' + cK).hide();
 371+ $j('#help_' + cK).click(function(){
 372+ var cK = $j(this).attr("id").replace('help_','');
 373+ if(helpState[cK]){
 374+ $j('#helpRow_' + cK).hide('slow');
 375+ helpState[cK] = false;
 376+ }else{
 377+ $j('#helpRow_' + cK).show('slow');
 378+ helpState[cK] = true;
 379+ }
 380+ return false;
 381+ }).hover(function(){
 382+ var cK = $j(this).attr("id").replace('help_','');
 383+ $j('#helpRow_' + cK).show('slow');
 384+ },function(){
 385+ var cK = $j(this).attr("id").replace('help_','');
 386+ if(!helpState[cK])
 387+ $j('#helpRow_' + cK).hide('slow')
 388+
 389+ }
 390+ );
 391+ $j('#helpClose_' + cK).click(function(){
 392+ var cK = $j(this).attr("id").replace('helpClose_','');
 393+ $j('#helpRow_' + cK).hide('slow');
 394+ helpState[cK] = false;
 395+ return false;
 396+ });
 397+ }else{
 398+ $j('#help_' + cK).hide();
 399+ }
 400+
 401+ switch( cConf.type ){
 402+ case 'string':
 403+ //@@check if we have a validate function on the string
 404+ break;
 405+ case 'slider':
 406+ $j('#slider_' + cK ).slider({
 407+ range: "min",
 408+ value: parseInt($j('#_' + cK ).val() ),
 409+ min: firefogg_defaults[ cK ].range.min,
 410+ max: firefogg_defaults[ cK ].range.max,
 411+ slide: function(event, ui) {
 412+ var id = $j(this).attr('id').replace('slider_', '');;
 413+ $j('#_'+ id).val( ui.value );
 414+ }
 415+ });
 416+ break
 417+ case 'select':
 418+
 419+ break;
 420+ }
 421+ }
 422+ $j('#control_container').accordion({
 423+ header: "h3",
 424+ collapsible: true,
 425+ active: false
 426+ });
 427+ }
 428+}
\ No newline at end of file
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js
@@ -2,20 +2,21 @@
33 * autodetects: new upload api or old http POST.
44 */
55
6 -
76 var default_firefogg_options = {
87 'upload_done_action':'redirect',
98 'fogg_enabled':false,
109 'api_url':null,
11 - 'passthrough': false
12 -}
 10+ 'passthrough': false
 11+}
 12+
 13+
1314 var mvFirefogg = function(initObj){
1415 return this.init( initObj );
1516 }
1617 mvFirefogg.prototype = { //extends mvBaseUploadInterface
1718
1819 min_firefogg_version : '0.9.5',
19 - fogg_enabled : false, //if firefogg is enabled or not.
 20+ fogg_enabled : false, //if firefogg is enabled or not.
2021 encoder_settings:{ //@@todo allow server to set this
2122 'maxSize': 400,
2223 'videoBitrate': 400,
@@ -47,7 +48,7 @@
4849 }
4950 }
5051 },
51 - setupForm: function(){
 52+ setupForm: function(){
5253 var _this = this;
5354 //call the parent form setup
5455 _this.pe_setupForm();
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js
@@ -830,7 +830,7 @@
831831 '<h3 id="rsd_resource_title" style="margin:4px;">' + gM('rsd_resource_edit', rObj.title ) +'</h3>'+
832832 '<div id="clip_edit_disp" style="position:absolute;'+overflow_style+'top:35px;left:5px;bottom:0px;'+
833833 'width:' + (maxWidth + 25) + 'px;" >' +
834 - mv_get_loading_img('position:absolute;top:30px;left:30px', 'mv_img_loader') +
 834+ mv_get_loading_img('position:absolute;top:30px;left:30px') +
835835 '</div>'+
836836 '<div id="clip_edit_ctrl" style="position:absolute;border:solid thin blue;'+
837837 'top:35px;left:' + ( maxWidth + 30 ) +'px;bottom:0px;right:0px;padding:5px;overflow:auto;">'+
@@ -1059,7 +1059,7 @@
10601060 '<br style="clear both">'+
10611061 '<strong>Resource Page Description:</strong>'+
10621062 '<div id="rsd_import_desc" syle="display:inline;">'+
1063 - mv_get_loading_img('position:absolute;top:5px;left:5px', 'mv_img_loader') +
 1063+ mv_get_loading_img('position:absolute;top:5px;left:5px') +
10641064 '</div>'+
10651065 '</div>'+
10661066 '<div id="rds_edit_import_container" style="position:absolute;left:50%;' +
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvUploader.js
@@ -3,7 +3,7 @@
44 will be replaced with upload API once that is ready
55 */
66
7 -loadGM( {
 7+loadGM({
88 "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>",
99 "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>",
1010 "upload-transcode-in-progress":"Doing Transcode & Upload (do not close this window)",
@@ -16,7 +16,7 @@
1717 "wgfogg_waring_bad_extension" : "You have selected a file with an unsuported extension. <a href=\"http://commons.wikimedia.org/wiki/Commons:Firefogg#Supported_File_Types\">More help</a>",
1818 "upload-stats-fileprogres": "$1 of $2",
1919
20 - "mv_upload_done" : "Your upload <i>should be<\/i> accessible <a href=\"$1\">here<\/a>",
 20+ "mv_upload_done" : "Your upload <i>should be</i> accessible <a href=\"$1\">here</a>",
2121 "upload-unknown-size": "Unknown size",
2222
2323 "successfulupload" : "Successful upload",
@@ -380,14 +380,14 @@
381381 }
382382 },
383383 doUploadSwitch:function(){
 384+
384385 js_log('mvUPload:doUploadSwitch()');
385386 var _this = this;
386387 //issue a normal post request
387388 if( _this.upload_mode == 'post' || $j('#wpSourceTypeFile').get(0).checked ){
 389+ js_log('do normal submit form');
388390 //update the status
389 - $j('#dlbox-centered').html( '<h5>' + _this.getProgressTitle() + '</h5>' +
390 - mv_get_loading_img( 'left:40%;top:20%')
391 - );
 391+ _this.updateEmptyLoadingStatus();
392392
393393 //do normal post upload no status indicators (also since its a file I think we have to submit the form)
394394 _this.form_post_override = true;
@@ -400,24 +400,30 @@
401401
402402 //do the submit :
403403 _this.editForm.submit();
 404+ return true;
404405 }else if( _this.upload_mode == 'api' && $j('#wpSourceTypeURL').get(0).checked){
405406 js_log('doHttpUpload (no form submit) ');
406407 //if the api is supported.. && source type is http do upload with http status updates
407 - _this.doHttpUpload();
 408+ _this.doHttpUpload();
408409 }else{
409410 js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode );
410 - }
 411+ }
 412+ return false;
411413 },
412414 doHttpUpload:function(){
413415 var _this = this;
414 - //build the api query:
415 - js_log('do doHttpUpload upload!');
 416+ //set the http box to loading (in case we don't get an update for some time)
 417+ $j('#dlbox-centered').html( '<h5>' + _this.getProgressTitle() + '</h5>' +
 418+ mv_get_loading_img( 'left:40%;top:20%')
 419+ );
 420+ //build the api query:
416421 do_api_req({
417422 'data':{
418423 'action' : 'upload',
419424 'url' : $j('#wpUploadFileURL').val(),
420425 'filename' : $j('#wpDestFile').val(),
421426 'comment' : $j('#wpUploadDescription').val(),
 427+ 'asyncdownload': 'true'
422428 },
423429 'url' : _this.api_url
424430 }, function( data ){
@@ -512,47 +518,62 @@
513519 },
514520 processApiResult: function( apiRes ){
515521 var _this = this;
516 - //check for simple error
517 - if( apiRes.error ){
518 - if( apiRes.error.code )
519 - _this.updateUploadError( apiRes.error.code );
520 - //else just simple msg:
521 - _this.updateUploadError( apiRes.error );
522 - return false;
523 - }
524522 //check for upload api error:
525 - if( apiRes.upload && apiRes.upload.result == "Failure" ){
526 - var error_code = (typeof apiRes.upload.code == 'object')? apiRes.upload.code[0]:apiRes.upload.code;
 523+ // {"upload":{"result":"Failure","error":"unknown-error","code":{"status":5,"filtered":"NGC2207%2BIC2163.jpg"}}}
 524+ if( apiRes.error || ( apiRes.upload && apiRes.upload.result == "Failure" ) ){
 525+
 526+ //check a few places for the error code:
 527+ var error_code=0;
 528+ if( apiRes.error && apiRes.error.code ){
 529+ error_code = apiRes.error.code;
 530+ }else if( apiRes.upload.code ){
 531+ if(typeof apiRes.upload.code == 'object'){
 532+ if(apiRes.upload.code[0]){
 533+ error_code = apiRes.upload.code[0];
 534+ }
 535+ if(apiRes.upload.code['status']){
 536+ error_code = apiRes.upload['status'];
 537+ }
 538+ }else{
 539+ apiRes.upload.code;
 540+ }
 541+ }
 542+
 543+ var error_msg = '';
 544+ if(typeof apiRes.error == 'string')
 545+ error_msg = apiRes.error;
527546 //error space is too large so we don't front load it
528547 //do a remote call to get the error msg:
529548 if(!error_code || error_code == 'unknown-error'){
530 - _this.updateUploadError( gM('unknown-error') );
 549+ js_log('Error: apiRes: ' + JSON.stringify( apiRes) );
 550+ _this.updateUploadError( gM('unknown-error') + '<br>' + error_msg);
531551 }else{
532552 gMsgLoadRemote(error_code, function(){
533553 js_log('send msg: ' + gM( error_code ));
534554 _this.updateUploadError( gM( error_code ));
535555 });
536 - }
537 - return false;
 556+ }
 557+ return ;
538558 }
539559 //check for upload_session key for async upload:
540560 if( apiRes.upload && apiRes.upload.upload_session_key ){
541561 //set the session key
542 - _this.upload_session_key = data.upload.upload_session_key;
 562+ _this.upload_session_key = apiRes.upload.upload_session_key;
543563 js_log("set session key: " + _this.upload_session_key);
544564 //do ajax upload status:
545 - _this.doAjaxUploadStatus();
546 - return true;
 565+ _this.doAjaxUploadStatus();
 566+ return ;
547567 }
548568
549569 if( apiRes.upload.imageinfo && apiRes.upload.imageinfo.descriptionurl ){
550570 _this.updateUploadDone( apiRes.upload.imageinfo.descriptionurl );
551 - return true;
 571+ return ;
552572 }
553573
554574 //check for upload error:
555575 if( apiRes.upload && apiRes.upload.error){
556 -
 576+ js_log(' apiRes.upload.error: ' + apiRes.upload.error );
 577+ return ;
557578 }
558579 //check for known warnings:
559580 if( apiRes.upload.warnings ){
@@ -609,6 +630,11 @@
610631 $j( '#dlbox-centered' ).html( '<h3>' + gM('successfulupload') + '</h3>' +
611632 gM( 'mv_upload_done', url) );
612633 },
 634+ updateEmptyLoadingStatus:function(){
 635+ $j('#dlbox-centered').html( '<h5>' + _this.getProgressTitle() + '</h5>' +
 636+ mv_get_loading_img( 'left:40%;top:20%')
 637+ );
 638+ },
613639 getProgressTitle:function(){
614640 return gM('upload-in-progress');
615641 },
Index: branches/new-upload/phase3/includes/DefaultSettings.php
@@ -2579,7 +2579,15 @@
25802580 */
25812581 $wgEnableScriptMinify = true;
25822582
 2583+/*
 2584+ * boolean; if we should enable javascript localization (it loads loadGM json call with mediaWiki msgs)
 2585+ */
 2586+$wgEnableScriptLocalization = true;
25832587
 2588+/*
 2589+ * path for mwEmbed normally js2/mwEmbed/
 2590+ */
 2591+$mwEmbedDirectory = "js2/mwEmbed/";
25842592
25852593 /**
25862594 * An array of extension types and inside that their names, versions, authors,
Index: branches/new-upload/phase3/includes/OutputPage.php
@@ -161,7 +161,7 @@
162162 * different page load types (edit, upload, view, etc)
163163 */
164164 function addCoreScripts2Top(){
165 - global $wgStyleVersion,$wgJSAutoloadLocalClasses, $wgJsMimeType, $wgScriptPath ;
 165+ global $wgEnableScriptLoader, $wgStyleVersion,$wgJSAutoloadLocalClasses, $wgJsMimeType, $wgScriptPath ;
166166 //@@todo we should depricate wikibits in favor of mv_embed and native jQuery functions
167167 $core_classes = array('window.jQuery', 'mv_embed', 'wikibits');
168168 if( $wgEnableScriptLoader ){
Index: branches/new-upload/phase3/includes/AutoLoader.php
@@ -583,7 +583,9 @@
584584 'editPage' => 'js2/editPage.js',
585585 );
586586
587 -//add the mwEmbed set of classes that we want to expose: (could be conditional)
 587+//add the mwEmbed set of classes that we want to expose: (could be conditional)
 588+//@@todo move jsAutoloadLocalClasses.php to post Setup so we have $mwEmbedDirectory var
 589+$mwEmbedDirectory = "js2/mwEmbed/";
588590 require_once("$IP/js2/mwEmbed/php/jsAutoloadLocalClasses.php");
589591
590592 class AutoLoader {
Index: branches/new-upload/phase3/includes/UploadFromUrl.php
@@ -16,7 +16,7 @@
1717 }
1818 /*entry point for Api upload:: ASYNC_DOWNLOAD (if possible) */
1919 function initialize( $name, $url, $asyncdownload = Http::SYNC_DOWNLOAD ) {
20 - global $wgTmpDirectory, $wgPhpCliPath;
 20+ global $wgTmpDirectory, $wgPhpCliPath;
2121
2222 if($asyncdownload && $wgPhpCliPath && wfShellExecEnabled() ){
2323 $this->dl_mode = Http::ASYNC_DOWNLOAD;
Index: branches/new-upload/phase3/includes/specials/SpecialUpload.php
@@ -571,8 +571,8 @@
572572
573573 $adc = wfBoolToStr( $useAjaxDestCheck );
574574 $alp = wfBoolToStr( $useAjaxLicensePreview );
575 - $autofill = wfBoolToStr( $this->mDesiredDestName == '' );
576 -
 575+ $autofill = wfBoolToStr( $this->mDesiredDestName == '' );
 576+
577577 $wgOut->addScript( "<script type=\"text/javascript\">
578578 wgAjaxUploadDestCheck = {$adc};
579579 wgAjaxLicensePreview = {$alp};
Index: branches/new-upload/phase3/includes/api/ApiUpload.php
@@ -120,12 +120,12 @@
121121 );
122122 } elseif( isset( $this->mParams['url'] ) ) {
123123
124 - $this->mUpload = new UploadFromUrl();
125 - $this->mUpload->initialize( $this->mParams['filename'], $this->mParams['url'], $this->mParam['asyncdownload']);
 124+ $this->mUpload = new UploadFromUrl();
 125+ $this->mUpload->initialize( $this->mParams['filename'], $this->mParams['url'], $this->mParams['asyncdownload']);
126126
127127 $status = $this->mUpload->fetchFile();
128128 if( !$status->isOK() ){
129 - return $this->dieUsage( 'fetchfileerror', $status->getWikiText());
 129+ return $this->dieUsage( 'fetchfileerror', $status->getWikiText() );
130130 }
131131 //check if we doing a async request set session info and return the upload_session_key)
132132 if( $this->mUpload->isAsync() ){
@@ -306,7 +306,7 @@
307307 'url' => 'Url to upload from',
308308 'enablechunks' => 'Boolean If we are in chunk mode; accepts many small file POSTs',
309309 'comment' => 'Upload comment or initial page text',
310 - 'asyncdownload' => 'If we should download asyncrously (returns a upload session key to get status updates in subquent calls)',
 310+ 'asyncdownload' => 'If we should download the url asyncrously usefull for large http downloads (returns a upload session key to get status updates in subquent calls)',
311311 'watch' => 'Watch the page',
312312 'ignorewarnings' => 'Ignore any warnings',
313313 'done' => 'When used with "chunks", Is sent to notify the api The last chunk is being uploaded.',
Index: branches/new-upload/phase3/languages/messages/MessagesEn.php
@@ -1847,7 +1847,7 @@
18481848 'wgfogg_waring_bad_extension'=> 'You have selected a file with an unsuported extension. <a href=\"http://commons.wikimedia.org/wiki/Commons:Firefogg#Supported_File_Types\">More help</a>',
18491849 'upload-stats-fileprogres' => '$1 of $2',
18501850
1851 -'mv_upload_done' => 'Your upload <i>should be<\/i> accessible <a href=\"$1\">here<\/a>',
 1851+'mv_upload_done' => 'Your upload <i>should be</i> accessible <a href="$1">here</a>',
18521852 'upload-unknown-size' => 'Unknown size',
18531853 'unknown-error' => 'Unknown Error',
18541854 'return-to-form' => 'Return to form',

Status & tagging log