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 @@ |
2 | 2 | <?php |
3 | 3 | if ( !defined( 'MEDIAWIKI' ) ) die(1); |
4 | 4 | |
5 | | -global $wgJSAutoloadLocalClasses, $wgScriptPath; |
6 | | - |
7 | | - $mvjsp = 'js2/mwEmbed/'; |
| 5 | +global $wgJSAutoloadLocalClasses, $mwEmbedDirectory; |
8 | 6 | |
9 | 7 | //the basis of the loader calls: |
10 | | - $wgJSAutoloadLocalClasses['mv_embed'] = $mvjsp . 'mv_embed.js'; |
| 8 | + $wgJSAutoloadLocalClasses['mv_embed'] = $mwEmbedDirectory . 'mv_embed.js'; |
11 | 9 | |
12 | 10 | //core: |
13 | | - $wgJSAutoloadLocalClasses['window.jQuery'] = $mvjsp . 'jquery/jquery-1.3.2.js'; |
| 11 | + $wgJSAutoloadLocalClasses['window.jQuery'] = $mwEmbedDirectory . 'jquery/jquery-1.3.2.js'; |
14 | 12 | |
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'; |
18 | 14 | |
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'; |
26 | 16 | |
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'; |
33 | 23 | |
| 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 | + |
34 | 53 | //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'; |
44 | 64 | |
45 | 65 | //libClipEdit: |
46 | | - $wgJSAutoloadLocalClasses['mvClipEdit'] = $mvjsp . 'libClipEdit/mvClipEdit.js'; |
| 66 | + $wgJSAutoloadLocalClasses['mvClipEdit'] = $mwEmbedDirectory . 'libClipEdit/mvClipEdit.js'; |
47 | 67 | |
48 | 68 | //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'; |
57 | 77 | |
58 | 78 | //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'; |
61 | 81 | |
62 | 82 | //libTimedText: |
63 | | - $wgJSAutoloadLocalClasses['mvTextInterface'] = $mvjsp . 'libTimedText/mvTextInterface.js'; |
| 83 | + $wgJSAutoloadLocalClasses['mvTextInterface'] = $mwEmbedDirectory . 'libTimedText/mvTextInterface.js'; |
64 | 84 | ?> |
\ No newline at end of file |
Index: branches/new-upload/phase3/js2/mwEmbed/php/noMediaWikiConfig.php |
— | — | @@ -1,13 +1,32 @@ |
2 | 2 | <?php |
3 | | -mv_nomediawiki_config(); |
| 3 | +//give us true for mediaWiki |
| 4 | +define( 'MEDIAWIKI', true ); |
4 | 5 | |
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' ); |
9 | 29 | |
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' ); |
14 | 32 | |
| 33 | +?> |
\ No newline at end of file |
Index: branches/new-upload/phase3/js2/mwEmbed/mv_embed.js |
— | — | @@ -44,6 +44,8 @@ |
45 | 45 | |
46 | 46 | var mediaWiki_mvEmbed_path = 'js2/mv_embed/'; |
47 | 47 | |
| 48 | +// |
| 49 | + |
48 | 50 | var global_player_list = new Array(); //the global player list per page |
49 | 51 | var global_req_cb = new Array(); //the global request callback array |
50 | 52 | var _global = this; //global obj |
— | — | @@ -263,10 +265,9 @@ |
264 | 266 | callback(); |
265 | 267 | return ; |
266 | 268 | } |
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 = ''; |
271 | 272 | var last_class = ''; |
272 | 273 | var coma = ''; |
273 | 274 | for( var i in libs ){ |
— | — | @@ -278,7 +279,7 @@ |
279 | 280 | } |
280 | 281 | } |
281 | 282 | 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 + |
283 | 284 | '&urid=' + getMvUniqueReqId() + dbug_attr; |
284 | 285 | |
285 | 286 | }else{ |
— | — | @@ -450,7 +451,10 @@ |
451 | 452 | } |
452 | 453 | } |
453 | 454 | //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'); |
455 | 459 | //if we have already run the dom ready just run the function directly: |
456 | 460 | if( mvJsLoader.doneReadyEvents ){ |
457 | 461 | //make sure jQuery is there: |
— | — | @@ -855,20 +859,6 @@ |
856 | 860 | e.rel = 'stylesheet'; |
857 | 861 | document.getElementsByTagName("head")[0].appendChild(e); |
858 | 862 | } |
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 | | -} |
873 | 863 | function getMvEmbedURL(){ |
874 | 864 | if( _global['mv_embed_url'] ) |
875 | 865 | return _global['mv_embed_url']; |
Index: branches/new-upload/phase3/js2/mwEmbed/jsScriptLoader.php |
— | — | @@ -2,18 +2,13 @@ |
3 | 3 | //This core jsScriptLoader class provides the script loader functionality |
4 | 4 | |
5 | 5 | //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' ); |
15 | 9 | |
16 | 10 | //run the main action: |
17 | 11 | $myScriptLoader = new jsScriptLoader(); |
| 12 | + //preset request values via normal $_GET opperation: |
18 | 13 | $myScriptLoader->doScriptLoader(); |
19 | 14 | } |
20 | 15 | |
— | — | @@ -25,13 +20,14 @@ |
26 | 21 | var $error_msg =''; |
27 | 22 | var $debug = false; |
28 | 23 | var $jsvarurl =false; // if we should include generated js (special class '-') |
| 24 | + var $doProcReqFlag =true; |
29 | 25 | |
30 | 26 | function doScriptLoader(){ |
31 | 27 | global $wgJSAutoloadClasses,$wgJSAutoloadLocalClasses, $wgEnableScriptLoaderJsFile, $wgRequest, $IP, |
32 | 28 | $wgEnableScriptMinify, $wgUseFileCache; |
33 | 29 | |
34 | | - //process the request |
35 | | - $this->procRequestVars(); |
| 30 | + //process the request |
| 31 | + $this->procRequestVars(); |
36 | 32 | |
37 | 33 | $wgUseFileCache=false; |
38 | 34 | //if cache is on and file is present grab it from there: |
— | — | @@ -43,7 +39,10 @@ |
44 | 40 | $this->sFileCache->loadFromFileCache(); |
45 | 41 | } |
46 | 42 | } |
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"; |
48 | 47 | //Build the Output: |
49 | 48 | //swap in the appropriate language per js_file |
50 | 49 | foreach($this->jsFileList as $classKey => $file_name){ |
— | — | @@ -74,7 +73,10 @@ |
75 | 74 | //its a wikiTitle append the output of the wikitext: |
76 | 75 | $t = Title::newFromText ( $title_block ); |
77 | 76 | $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 | + } |
79 | 81 | continue; |
80 | 82 | } |
81 | 83 | } |
— | — | @@ -87,8 +89,7 @@ |
88 | 90 | */\n"; |
89 | 91 | $this->jsout .= ( $this->doProccessJsFile( $file_name ) ). "\n"; |
90 | 92 | } |
91 | | - } |
92 | | - |
| 93 | + } |
93 | 94 | //check if we should minify : |
94 | 95 | if( $wgEnableScriptMinify && !$this->debug){ |
95 | 96 | //do the minification and output |
— | — | @@ -121,15 +122,27 @@ |
122 | 123 | * updates the proc Request |
123 | 124 | */ |
124 | 125 | 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; |
130 | 127 | |
| 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 | + } |
131 | 145 | //check for the requested classes |
132 | | - if( $wgRequest->getVal('class') ){ |
133 | | - $reqClassList = explode( ',', $wgRequest->getVal('class') ); |
| 146 | + if( $reqClassList ){ |
134 | 147 | //clean the class list and populate jsFileList |
135 | 148 | foreach( $reqClassList as $reqClass ){ |
136 | 149 | if(trim($reqClass) != ''){ |
— | — | @@ -154,7 +167,7 @@ |
155 | 168 | } |
156 | 169 | } |
157 | 170 | } |
158 | | - } |
| 171 | + } |
159 | 172 | //check for requested files if enabled: |
160 | 173 | if( $wgEnableScriptLoaderJsFile ){ |
161 | 174 | if( $wgRequest->getVal('files')){ |
— | — | @@ -166,24 +179,18 @@ |
167 | 180 | //only allow alphanumeric underscores periods and ending with .js |
168 | 181 | $reqFile = ereg_replace("[^A-Za-z0-9_\-\/\.]", "", $reqFile ); |
169 | 182 | 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 )) { |
171 | 185 | $this->jsFileList[] = $IP . $reqFile; |
172 | 186 | $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"; |
176 | 190 | } |
177 | 191 | } |
178 | 192 | } |
179 | 193 | } |
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 | + |
188 | 195 | //add the language code to the rKey: |
189 | 196 | $this->rKey .= '_' . $wgContLanguageCode; |
190 | 197 | |
— | — | @@ -196,20 +203,28 @@ |
197 | 204 | } |
198 | 205 | } |
199 | 206 | 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; |
201 | 218 | |
202 | | - $str = file_get_contents($IP.$file_name); |
203 | | - $this->cur_file = $file_name; |
204 | 219 | //strip out js_log debug lines not much luck with this regExp yet: |
205 | 220 | //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); |
208 | 222 | |
209 | 223 | // 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 |
211 | 226 | array($this, 'languageMsgReplace'), |
212 | 227 | $str); |
213 | | - |
| 228 | + |
214 | 229 | return $str; |
215 | 230 | } |
216 | 231 | 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 @@ |
3 | 3 | * autodetects: new upload api or old http POST. |
4 | 4 | */ |
5 | 5 | |
6 | | - |
7 | 6 | var default_firefogg_options = { |
8 | 7 | 'upload_done_action':'redirect', |
9 | 8 | 'fogg_enabled':false, |
10 | 9 | 'api_url':null, |
11 | | - 'passthrough': false |
12 | | -} |
| 10 | + 'passthrough': false |
| 11 | +} |
| 12 | + |
| 13 | + |
13 | 14 | var mvFirefogg = function(initObj){ |
14 | 15 | return this.init( initObj ); |
15 | 16 | } |
16 | 17 | mvFirefogg.prototype = { //extends mvBaseUploadInterface |
17 | 18 | |
18 | 19 | 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. |
20 | 21 | encoder_settings:{ //@@todo allow server to set this |
21 | 22 | 'maxSize': 400, |
22 | 23 | 'videoBitrate': 400, |
— | — | @@ -47,7 +48,7 @@ |
48 | 49 | } |
49 | 50 | } |
50 | 51 | }, |
51 | | - setupForm: function(){ |
| 52 | + setupForm: function(){ |
52 | 53 | var _this = this; |
53 | 54 | //call the parent form setup |
54 | 55 | _this.pe_setupForm(); |
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -830,7 +830,7 @@ |
831 | 831 | '<h3 id="rsd_resource_title" style="margin:4px;">' + gM('rsd_resource_edit', rObj.title ) +'</h3>'+ |
832 | 832 | '<div id="clip_edit_disp" style="position:absolute;'+overflow_style+'top:35px;left:5px;bottom:0px;'+ |
833 | 833 | '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') + |
835 | 835 | '</div>'+ |
836 | 836 | '<div id="clip_edit_ctrl" style="position:absolute;border:solid thin blue;'+ |
837 | 837 | 'top:35px;left:' + ( maxWidth + 30 ) +'px;bottom:0px;right:0px;padding:5px;overflow:auto;">'+ |
— | — | @@ -1059,7 +1059,7 @@ |
1060 | 1060 | '<br style="clear both">'+ |
1061 | 1061 | '<strong>Resource Page Description:</strong>'+ |
1062 | 1062 | '<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') + |
1064 | 1064 | '</div>'+ |
1065 | 1065 | '</div>'+ |
1066 | 1066 | '<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 @@ |
4 | 4 | will be replaced with upload API once that is ready |
5 | 5 | */ |
6 | 6 | |
7 | | -loadGM( { |
| 7 | +loadGM({ |
8 | 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 | 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 | 10 | "upload-transcode-in-progress":"Doing Transcode & Upload (do not close this window)", |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | "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>", |
18 | 18 | "upload-stats-fileprogres": "$1 of $2", |
19 | 19 | |
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>", |
21 | 21 | "upload-unknown-size": "Unknown size", |
22 | 22 | |
23 | 23 | "successfulupload" : "Successful upload", |
— | — | @@ -380,14 +380,14 @@ |
381 | 381 | } |
382 | 382 | }, |
383 | 383 | doUploadSwitch:function(){ |
| 384 | + |
384 | 385 | js_log('mvUPload:doUploadSwitch()'); |
385 | 386 | var _this = this; |
386 | 387 | //issue a normal post request |
387 | 388 | if( _this.upload_mode == 'post' || $j('#wpSourceTypeFile').get(0).checked ){ |
| 389 | + js_log('do normal submit form'); |
388 | 390 | //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(); |
392 | 392 | |
393 | 393 | //do normal post upload no status indicators (also since its a file I think we have to submit the form) |
394 | 394 | _this.form_post_override = true; |
— | — | @@ -400,24 +400,30 @@ |
401 | 401 | |
402 | 402 | //do the submit : |
403 | 403 | _this.editForm.submit(); |
| 404 | + return true; |
404 | 405 | }else if( _this.upload_mode == 'api' && $j('#wpSourceTypeURL').get(0).checked){ |
405 | 406 | js_log('doHttpUpload (no form submit) '); |
406 | 407 | //if the api is supported.. && source type is http do upload with http status updates |
407 | | - _this.doHttpUpload(); |
| 408 | + _this.doHttpUpload(); |
408 | 409 | }else{ |
409 | 410 | js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode ); |
410 | | - } |
| 411 | + } |
| 412 | + return false; |
411 | 413 | }, |
412 | 414 | doHttpUpload:function(){ |
413 | 415 | 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: |
416 | 421 | do_api_req({ |
417 | 422 | 'data':{ |
418 | 423 | 'action' : 'upload', |
419 | 424 | 'url' : $j('#wpUploadFileURL').val(), |
420 | 425 | 'filename' : $j('#wpDestFile').val(), |
421 | 426 | 'comment' : $j('#wpUploadDescription').val(), |
| 427 | + 'asyncdownload': 'true' |
422 | 428 | }, |
423 | 429 | 'url' : _this.api_url |
424 | 430 | }, function( data ){ |
— | — | @@ -512,47 +518,62 @@ |
513 | 519 | }, |
514 | 520 | processApiResult: function( apiRes ){ |
515 | 521 | 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 | | - } |
524 | 522 | //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; |
527 | 546 | //error space is too large so we don't front load it |
528 | 547 | //do a remote call to get the error msg: |
529 | 548 | 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); |
531 | 551 | }else{ |
532 | 552 | gMsgLoadRemote(error_code, function(){ |
533 | 553 | js_log('send msg: ' + gM( error_code )); |
534 | 554 | _this.updateUploadError( gM( error_code )); |
535 | 555 | }); |
536 | | - } |
537 | | - return false; |
| 556 | + } |
| 557 | + return ; |
538 | 558 | } |
539 | 559 | //check for upload_session key for async upload: |
540 | 560 | if( apiRes.upload && apiRes.upload.upload_session_key ){ |
541 | 561 | //set the session key |
542 | | - _this.upload_session_key = data.upload.upload_session_key; |
| 562 | + _this.upload_session_key = apiRes.upload.upload_session_key; |
543 | 563 | js_log("set session key: " + _this.upload_session_key); |
544 | 564 | //do ajax upload status: |
545 | | - _this.doAjaxUploadStatus(); |
546 | | - return true; |
| 565 | + _this.doAjaxUploadStatus(); |
| 566 | + return ; |
547 | 567 | } |
548 | 568 | |
549 | 569 | if( apiRes.upload.imageinfo && apiRes.upload.imageinfo.descriptionurl ){ |
550 | 570 | _this.updateUploadDone( apiRes.upload.imageinfo.descriptionurl ); |
551 | | - return true; |
| 571 | + return ; |
552 | 572 | } |
553 | 573 | |
554 | 574 | //check for upload error: |
555 | 575 | if( apiRes.upload && apiRes.upload.error){ |
556 | | - |
| 576 | + js_log(' apiRes.upload.error: ' + apiRes.upload.error ); |
| 577 | + return ; |
557 | 578 | } |
558 | 579 | //check for known warnings: |
559 | 580 | if( apiRes.upload.warnings ){ |
— | — | @@ -609,6 +630,11 @@ |
610 | 631 | $j( '#dlbox-centered' ).html( '<h3>' + gM('successfulupload') + '</h3>' + |
611 | 632 | gM( 'mv_upload_done', url) ); |
612 | 633 | }, |
| 634 | + updateEmptyLoadingStatus:function(){ |
| 635 | + $j('#dlbox-centered').html( '<h5>' + _this.getProgressTitle() + '</h5>' + |
| 636 | + mv_get_loading_img( 'left:40%;top:20%') |
| 637 | + ); |
| 638 | + }, |
613 | 639 | getProgressTitle:function(){ |
614 | 640 | return gM('upload-in-progress'); |
615 | 641 | }, |
Index: branches/new-upload/phase3/includes/DefaultSettings.php |
— | — | @@ -2579,7 +2579,15 @@ |
2580 | 2580 | */ |
2581 | 2581 | $wgEnableScriptMinify = true; |
2582 | 2582 | |
| 2583 | +/* |
| 2584 | + * boolean; if we should enable javascript localization (it loads loadGM json call with mediaWiki msgs) |
| 2585 | + */ |
| 2586 | +$wgEnableScriptLocalization = true; |
2583 | 2587 | |
| 2588 | +/* |
| 2589 | + * path for mwEmbed normally js2/mwEmbed/ |
| 2590 | + */ |
| 2591 | +$mwEmbedDirectory = "js2/mwEmbed/"; |
2584 | 2592 | |
2585 | 2593 | /** |
2586 | 2594 | * An array of extension types and inside that their names, versions, authors, |
Index: branches/new-upload/phase3/includes/OutputPage.php |
— | — | @@ -161,7 +161,7 @@ |
162 | 162 | * different page load types (edit, upload, view, etc) |
163 | 163 | */ |
164 | 164 | function addCoreScripts2Top(){ |
165 | | - global $wgStyleVersion,$wgJSAutoloadLocalClasses, $wgJsMimeType, $wgScriptPath ; |
| 165 | + global $wgEnableScriptLoader, $wgStyleVersion,$wgJSAutoloadLocalClasses, $wgJsMimeType, $wgScriptPath ; |
166 | 166 | //@@todo we should depricate wikibits in favor of mv_embed and native jQuery functions |
167 | 167 | $core_classes = array('window.jQuery', 'mv_embed', 'wikibits'); |
168 | 168 | if( $wgEnableScriptLoader ){ |
Index: branches/new-upload/phase3/includes/AutoLoader.php |
— | — | @@ -583,7 +583,9 @@ |
584 | 584 | 'editPage' => 'js2/editPage.js', |
585 | 585 | ); |
586 | 586 | |
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/"; |
588 | 590 | require_once("$IP/js2/mwEmbed/php/jsAutoloadLocalClasses.php"); |
589 | 591 | |
590 | 592 | class AutoLoader { |
Index: branches/new-upload/phase3/includes/UploadFromUrl.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | } |
18 | 18 | /*entry point for Api upload:: ASYNC_DOWNLOAD (if possible) */ |
19 | 19 | function initialize( $name, $url, $asyncdownload = Http::SYNC_DOWNLOAD ) { |
20 | | - global $wgTmpDirectory, $wgPhpCliPath; |
| 20 | + global $wgTmpDirectory, $wgPhpCliPath; |
21 | 21 | |
22 | 22 | if($asyncdownload && $wgPhpCliPath && wfShellExecEnabled() ){ |
23 | 23 | $this->dl_mode = Http::ASYNC_DOWNLOAD; |
Index: branches/new-upload/phase3/includes/specials/SpecialUpload.php |
— | — | @@ -571,8 +571,8 @@ |
572 | 572 | |
573 | 573 | $adc = wfBoolToStr( $useAjaxDestCheck ); |
574 | 574 | $alp = wfBoolToStr( $useAjaxLicensePreview ); |
575 | | - $autofill = wfBoolToStr( $this->mDesiredDestName == '' ); |
576 | | - |
| 575 | + $autofill = wfBoolToStr( $this->mDesiredDestName == '' ); |
| 576 | + |
577 | 577 | $wgOut->addScript( "<script type=\"text/javascript\"> |
578 | 578 | wgAjaxUploadDestCheck = {$adc}; |
579 | 579 | wgAjaxLicensePreview = {$alp}; |
Index: branches/new-upload/phase3/includes/api/ApiUpload.php |
— | — | @@ -120,12 +120,12 @@ |
121 | 121 | ); |
122 | 122 | } elseif( isset( $this->mParams['url'] ) ) { |
123 | 123 | |
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']); |
126 | 126 | |
127 | 127 | $status = $this->mUpload->fetchFile(); |
128 | 128 | if( !$status->isOK() ){ |
129 | | - return $this->dieUsage( 'fetchfileerror', $status->getWikiText()); |
| 129 | + return $this->dieUsage( 'fetchfileerror', $status->getWikiText() ); |
130 | 130 | } |
131 | 131 | //check if we doing a async request set session info and return the upload_session_key) |
132 | 132 | if( $this->mUpload->isAsync() ){ |
— | — | @@ -306,7 +306,7 @@ |
307 | 307 | 'url' => 'Url to upload from', |
308 | 308 | 'enablechunks' => 'Boolean If we are in chunk mode; accepts many small file POSTs', |
309 | 309 | '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)', |
311 | 311 | 'watch' => 'Watch the page', |
312 | 312 | 'ignorewarnings' => 'Ignore any warnings', |
313 | 313 | '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 @@ |
1848 | 1848 | '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>', |
1849 | 1849 | 'upload-stats-fileprogres' => '$1 of $2', |
1850 | 1850 | |
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>', |
1852 | 1852 | 'upload-unknown-size' => 'Unknown size', |
1853 | 1853 | 'unknown-error' => 'Unknown Error', |
1854 | 1854 | 'return-to-form' => 'Return to form', |