Index: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_xspf.xml |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | knobs in there, you've got sand. in. and try to. do a picture. on. etch-a-sketch |
13 | 13 | gone gone to. china. I mean, they're all gone |
14 | 14 | </annotation> |
15 | | - <location>http://128.114.20.64/media/senate_11-14-05.ogg?t=0:42:14/0:42:56</location> |
| 15 | + <location>http://metavidstorage01.ucsc.edu/media/senate_11-14-05.ogg?t=0:42:14/0:42:56</location> |
16 | 16 | <image>http://metavid.org/w/index.php?action=ajax&rs=mv_frame_server&stream_id=14&t=0:42:00&size=400x300</image> |
17 | 17 | <info>http://metavid.ucsc.edu/overlay/video_player/webview?stream_name=senate_11-14-05&t=0:42:14/0:42:56</info> |
18 | 18 | </track> |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | <title>we know better</title> |
21 | 21 | <annotation><b>Byran Dorgan:</b>that 1.4 trillion in combined debut we know better than that we know what to do |
22 | 22 | </annotation> |
23 | | - <location>http://128.114.20.64/media/senate_proceeding_02-10-06.ogg?t=01:30:59/01:31:24</location> |
| 23 | + <location>http://metavidstorage01.ucsc.edu/media/senate_proceeding_02-10-06.ogg?t=01:30:59/01:31:24</location> |
24 | 24 | <image>http://metavid.org/w/index.php?action=ajax&rs=mv_frame_server&stream_name=senate_proceeding_02-10-06&t=1:30:59&size=400x300</image> |
25 | 25 | <info>http://metavid.ucsc.edu/overlay/video_player/webview?stream_name=senate_proceeding_02-10-06&t=01:30:59/01:31:24</info> |
26 | 26 | </track> |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | <title>random clip</title> |
29 | 29 | <annotation>example annotation |
30 | 30 | </annotation> |
31 | | - <location>http://128.114.20.64/media/senate_11-14-05.ogg?t=0:44:14/0:45:56</location> |
| 31 | + <location>http://metavidstorage01.ucsc.edu/media/senate_11-14-05.ogg?t=0:44:14/0:45:56</location> |
32 | 32 | <image>http://metavid.org/w/index.php?action=ajax&rs=mv_frame_server&stream_name=senate_proceeding_06-08-06&t=0:44:14&size=400x300</image> |
33 | 33 | <info>http://metavid.ucsc.edu/overlay/video_player/webview?stream_name=senate_proceeding_06-08-06&t=0:44:14/0:45:56</info> |
34 | 34 | </track> |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_smil.smil.xml |
— | — | @@ -28,14 +28,14 @@ |
29 | 29 | transOut="xFade" |
30 | 30 | type="video/ogg" |
31 | 31 | fill="transition" |
32 | | - dur="12s" |
| 32 | + dur="7s" |
33 | 33 | poster="sample_fish.jpg"/> |
34 | 34 | |
35 | | - <video src="sample_eclipse.ogg?t=0:0:0/0:0:06" |
| 35 | + <video src="sample_jellyfish.ogg?t=0:0:0/0:0:10" |
36 | 36 | region="video_region" |
37 | 37 | fill="transition" |
38 | 38 | type="video/ogg" |
39 | | - poster="sample_eclipse.jpg"/> |
| 39 | + poster="sample_jellyfish.jpg"/> |
40 | 40 | </seq> |
41 | 41 | </body> |
42 | 42 | </smil> |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvFirefogg.js |
— | — | @@ -3,31 +3,29 @@ |
4 | 4 | */ |
5 | 5 | |
6 | 6 | loadGM( { |
7 | | - "mv_upload_done" : "Your upload <i>should be<\/i> accessible <a href=\"$1\">here<\/a>", |
| 7 | + "mv_upload_done" : "Your upload <i>should be<\/i> accessible <a href=\"$1\">here<\/a>", |
8 | 8 | "mv_upload_completed" : "Upload Completed" |
9 | 9 | }); |
10 | 10 | |
11 | 11 | var default_firefogg_options = { |
12 | 12 | 'upload_done_action':'redirect', |
13 | | - 'enabled':false, |
14 | | - 'api_url':false |
| 13 | + 'fogg_enabled':false, |
| 14 | + 'api_url':null |
15 | 15 | } |
16 | 16 | var mvFirefogg = function(initObj){ |
17 | 17 | return this.init( initObj ); |
18 | 18 | } |
19 | | -mvFirefogg.prototype = { |
| 19 | +mvFirefogg.prototype = { //extends mvBaseUploadInterface |
20 | 20 | |
21 | 21 | min_firefogg_version : '0.9.5', |
22 | | - enabled : false, //if firefogg is enabled or not. |
23 | | - upload_mode:'autodetect', //can be 'post', 'chunks' or autodetect. (autodetect issues an api call) |
| 22 | + fogg_enabled : false, //if firefogg is enabled or not. |
24 | 23 | encoder_settings:{ //@@todo allow server to set this |
25 | 24 | 'maxSize': 400, |
26 | 25 | 'videoBitrate': 400, |
27 | 26 | 'noUpscaling':true |
28 | 27 | }, |
29 | | - formData:{}, //the form to be submitted |
30 | 28 | |
31 | | - init : function( iObj ){ |
| 29 | + init: function( iObj ){ |
32 | 30 | if(!iObj) |
33 | 31 | iObj = {}; |
34 | 32 | //inherit iObj properties: |
— | — | @@ -38,10 +36,22 @@ |
39 | 37 | this[i] = default_firefogg_options[i]; |
40 | 38 | } |
41 | 39 | } |
42 | | - this.setupFirefogg(); |
| 40 | + var myBUI = new mvBaseUploadInterface( iObj ); |
| 41 | + //standard extends code: |
| 42 | + for(var i in myBUI){ |
| 43 | + if(this[i]){ |
| 44 | + this['pe_'+ i] = myBUI[i]; |
| 45 | + }else{ |
| 46 | + this[i] = myBUI[i]; |
| 47 | + } |
| 48 | + } |
43 | 49 | }, |
44 | | - setupFirefogg : function(){ |
| 50 | + setupForm: function(){ |
45 | 51 | var _this = this; |
| 52 | + //call the parent form setup |
| 53 | + _this.pe_setupForm(); |
| 54 | + |
| 55 | + //do all firefogg form setup: |
46 | 56 | if(typeof(Firefogg) == 'undefined'){ |
47 | 57 | $j('#wgfogg_not_installed').show(); |
48 | 58 | return false; |
— | — | @@ -62,11 +72,11 @@ |
63 | 73 | $j('#wgfogg_installed').hide(); |
64 | 74 | } |
65 | 75 | //make sure the checkbox accurately reflects the current state per config: |
66 | | - $j('#wgEnableFirefogg').get(0).checked = this.enabled; |
| 76 | + $j('#wgEnableFirefogg').get(0).checked = this.fogg_enabled; |
67 | 77 | |
68 | 78 | //setup the click bindding: |
69 | 79 | $j('#wgEnableFirefogg').click( function(){ |
70 | | - if( _this.enabled ){ |
| 80 | + if( _this.fogg_enabled ){ |
71 | 81 | _this.disable_fogg(); |
72 | 82 | }else{ |
73 | 83 | _this.enable_fogg(); |
— | — | @@ -80,17 +90,16 @@ |
81 | 91 | var _this = this; |
82 | 92 | |
83 | 93 | //enable the FOGG_TOGGLE |
84 | | - this.enabled=true; |
| 94 | + this.fogg_enabled=true; |
85 | 95 | |
86 | 96 | //make sure file is "checked" |
87 | 97 | if($j( '#wpSourceTypeFile' ).length != 0) |
88 | 98 | $j( '#wpSourceTypeFile' ).get(0).checked = true; |
89 | 99 | |
90 | 100 | //hide normal file upload stuff |
91 | | - $j( '#wg-base-upload' ).hide(); |
92 | | - |
| 101 | + $j( '#wg-base-upload' ).hide(); |
93 | 102 | //setup the form pointer: |
94 | | - _this.editForm = $j( '#mw-upload-form' ).get(0); |
| 103 | + _this.getEditForm(); |
95 | 104 | |
96 | 105 | //show fogg & add click binding: |
97 | 106 | $j( '#fogg-video-file' ).unbind().show().click( function(){ |
— | — | @@ -100,19 +109,12 @@ |
101 | 110 | disable_fogg:function(){ |
102 | 111 | var _this = this; |
103 | 112 | //not enabled: |
104 | | - this.enabled=false; |
| 113 | + this.fogg_enabled=false; |
105 | 114 | |
106 | 115 | $j( '#wg-base-upload' ).show(); |
107 | 116 | |
108 | 117 | //hide any errors warnings and video select: |
109 | | - $j( '#wgfogg_waring_ogg_upload,#wgfogg_waring_bad_extension,#fogg-video-file' ).hide(); |
110 | | - |
111 | | - //restore the orignal |
112 | | - if( _this.org_onsubmit ){ |
113 | | - _this.editForm.onsubmit = _this.org_onsubmit; |
114 | | - }else{ |
115 | | - _this.editForm.onsubmit = function(){ return true; }; |
116 | | - } |
| 118 | + $j( '#wgfogg_waring_ogg_upload,#wgfogg_waring_bad_extension,#fogg-video-file' ).hide(); |
117 | 119 | }, |
118 | 120 | fogg_update_progress:function(progress){ |
119 | 121 | $j( '#fogg-progressbar' ).css( 'width', parseInt(progress*100) +'%'); |
— | — | @@ -148,78 +150,30 @@ |
149 | 151 | } |
150 | 152 | //run the onClick hanndle: |
151 | 153 | if( toggleFilenameFiller ) |
152 | | - toggleFilenameFiller(); |
153 | | - |
154 | | - //set up the org_onsubmit if not set: |
155 | | - if( typeof( _this.org_onsubmit ) == 'undefined' ) |
156 | | - _this.org_onsubmit = _this.editForm.onsubmit; |
157 | | - |
158 | | - _this.editForm.onsubmit = function() { |
159 | | - |
160 | | - //run the original onsubmit (if not run yet set flag to avoid excessive chaining ) |
161 | | - if( typeof( _this.org_onsubmit ) == 'function' ){ |
162 | | - if( ! _this.org_onsubmit() ){ |
163 | | - //error in org submit return false; |
164 | | - return false; |
165 | | - } |
166 | | - } |
167 | | - //get the input form data in flat json: |
168 | | - var tmpAryData = $j( _this.editForm ).serializeArray(); |
169 | | - for(var i=0; i < tmpAryData.length; i++){ |
170 | | - if( tmpAryData[i]['name'] ) |
171 | | - _this.formData[ tmpAryData[i]['name'] ] = tmpAryData[i]['value']; |
172 | | - } |
173 | | - |
174 | | - //display the loader: |
175 | | - $j('#dlbox-centered,#dlbox-overlay').show(); |
176 | | - |
177 | | - //for some unknown reason we have to drop down the #p-search z-index: |
178 | | - $j('#p-search').css('z-index', 1); |
179 | | - |
180 | | - //select upload mode: |
181 | | - _this.doUploadSwitch(); |
182 | | - //don't submit the form (firefogg will handle that) |
183 | | - return false; |
184 | | - } |
| 154 | + toggleFilenameFiller(); |
185 | 155 | } |
186 | 156 | }, |
187 | | - doUploadSwitch:function(){ |
| 157 | + getProgressTitle:function(){ |
| 158 | + //return the parent if we don't have fogg turned on: |
| 159 | + if(! this.fogg_enabled ) |
| 160 | + return this.pe_getProgressTitle(); |
| 161 | + |
| 162 | + return gM('upload-transcode-in-progress'); |
| 163 | + }, |
| 164 | + doUploadSwitch:function(){ |
188 | 165 | var _this = this; |
189 | | - //check the upload mode: |
190 | | - if( _this.upload_mode == 'autodetect' ){ |
191 | | - if( ! _this.api_url ) |
192 | | - return js_error( 'Error: can\'t autodetect mode without api url' ); |
193 | | - do_api_req( { |
194 | | - 'data':{ 'action':'paraminfo','modules':'upload' }, |
195 | | - 'url':_this.api_url |
196 | | - }, function(data){ |
197 | | - if( typeof data.paraminfo == 'undefined' || typeof data.paraminfo.modules == 'undefined' ) |
198 | | - return js_error( 'Error: bad api results' ); |
199 | | - if( typeof data.paraminfo.modules[0].classname == 'undefined'){ |
200 | | - js_log( 'Autodetect Upload Mode: \'post\' '); |
201 | | - _this.upload_mode = 'post'; |
202 | | - }else{ |
203 | | - for( var i in data.paraminfo.modules[0].parameters ){ |
204 | | - var pname = data.paraminfo.modules[0].parameters[i].name; |
205 | | - if( pname == 'enablechunks' ){ |
206 | | - js_log( 'Autodetect Upload Mode: chunks ' ); |
207 | | - _this.upload_mode = 'chunks'; |
208 | | - break; |
209 | | - } |
210 | | - } |
211 | | - if( _this.upload_mode != 'chunks'){ |
212 | | - return js_error('Upload API without chunks param is not supported'); |
213 | | - } |
214 | | - } |
215 | | - _this.doUploadSwitch(); |
216 | | - }); |
217 | | - }else if( _this.upload_mode == 'post') { |
| 166 | + //make sure firefogg is enabled otherwise do parent UploadSwich: |
| 167 | + if( ! this.fogg_enabled ) |
| 168 | + return _this.pe_doUploadSwitch(); |
| 169 | + |
| 170 | + //check what mode to use firefogg in: |
| 171 | + if( _this.upload_mode == 'post' ){ |
218 | 172 | _this.doEncUpload(); |
219 | | - }else if( _this.upload_mode == 'chunks'){ |
| 173 | + }else if( _this.upload_mode == 'api' && _this.chunks_supported){ //if api mode and chunks supported do chunkUpload |
220 | 174 | _this.doChunkUpload(); |
221 | | - }else{ |
| 175 | + }else{ |
222 | 176 | js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode ); |
223 | | - } |
| 177 | + } |
224 | 178 | }, |
225 | 179 | //doChunkUpload does both uploading and encoding at the same time and uploads one meg chunks as they are ready |
226 | 180 | doChunkUpload : function(){ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -833,13 +833,13 @@ |
834 | 834 | |
835 | 835 | $j('#rsd_edit_img').remove();//remove any existing rsd_edit_img |
836 | 836 | |
837 | | - //left side holds the image right size the controls / |
| 837 | + //left side holds the image right size the controls / |
838 | 838 | $j(rsdElement).clone().attr('id', 'rsd_edit_img').appendTo('#clip_edit_disp').css({ |
839 | 839 | 'position':'absolute', |
840 | 840 | 'top':'40%', |
841 | 841 | 'left':'20%', |
842 | 842 | 'opacity':0 |
843 | | - }); |
| 843 | + }); |
844 | 844 | |
845 | 845 | |
846 | 846 | //assume we keep aspect ratio for the thumbnail that we clicked: |
— | — | @@ -857,9 +857,11 @@ |
858 | 858 | 'height': parseInt( tRatio * maxWidth) + 'px' |
859 | 859 | }, "slow"); // do it slow to give it a chance to finish loading the HQ version |
860 | 860 | |
861 | | - _this.loadHQImg(rObj, {'width':maxWidth}, 'rsd_edit_img', function(){ |
862 | | - $j('.mv_img_loader').remove(); |
863 | | - }); |
| 861 | + if( mediaType == 'image' ){ |
| 862 | + _this.loadHQImg(rObj, {'width':maxWidth}, 'rsd_edit_img', function(){ |
| 863 | + $j('.mv_img_loader').remove(); |
| 864 | + }); |
| 865 | + } |
864 | 866 | //also fade in the container: |
865 | 867 | $j('#rsd_resource_edit').animate({ |
866 | 868 | 'opacity':1, |
— | — | @@ -916,15 +918,15 @@ |
917 | 919 | 'control_ct': 'clip_edit_ctrl', |
918 | 920 | 'media_type': mediaType, |
919 | 921 | 'p_rsdObj': _this |
920 | | - }; |
921 | | - var loadLibs = {'mvClipEdit':'libClipEdit/mvClipEdit.js'}; |
| 922 | + }; |
| 923 | + var clibs = {'mvClipEdit':'libClipEdit/mvClipEdit.js'}; |
922 | 924 | if( mediaType == 'image'){ |
923 | 925 | //load the crop library: |
924 | 926 | //loadLibs['$j.Jcrop']='jquery/plugins/Jcrop/js/jquery.Jcrop.js'; |
925 | 927 | //@@todo integrate css calls into mvJsLoader or move jcrop css |
926 | 928 | //loadExternalCss( mv_embed_path + 'jquery/plugins/Jcrop/css/jquery.Jcrop.css'); |
927 | 929 | //display the mvClipEdit obj once we are done loading: |
928 | | - mvJsLoader.doLoad( loadLibs,function(){ |
| 930 | + mvJsLoader.doLoad( clibs,function(){ |
929 | 931 | //run the image clip tools |
930 | 932 | _this.cEdit = new mvClipEdit( mvClipInit ); |
931 | 933 | }); |
— | — | @@ -935,15 +937,15 @@ |
936 | 938 | rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'}) |
937 | 939 | ); |
938 | 940 | //rewrite by id handldes getting any libs we are missing: |
939 | | - rewrite_by_id('embed_vid',function(){ |
940 | | - //hide the rsd_edit_img: |
941 | | - $j('#rsd_edit_img').hide(); |
| 941 | + rewrite_by_id('embed_vid',function(){ |
942 | 942 | //grab any information that we got from the ROE xml or parsed from the media file |
943 | 943 | rObj = rObj.pSobj.getEmbedObjParsedInfo( rObj, 'embed_vid' ); |
944 | | - //add the re-sizable to the doLoad request: |
945 | | - loadLibs['$j.ui.resizable'] = 'jquery/jquery.ui-1.5.2/ui/minified/ui.resizable.min.js', |
946 | | - loadLibs['$j.fn.hoverIntent'] = 'jquery/plugins/jquery.hoverIntent.js'; |
947 | | - mvJsLoader.doLoad( loadLibs,function(){ |
| 944 | + //add the re-sizable to the doLoad request: |
| 945 | + clibs['$j.ui.resizable'] ='jquery/jquery.ui-1.5.2/ui/minified/ui.resizable.min.js'; |
| 946 | + clibs['$j.fn.hoverIntent'] ='jquery/plugins/jquery.hoverIntent.js'; |
| 947 | + mvJsLoader.doLoad(clibs, function(){ |
| 948 | + //make sure the rsd_edit_img is hidden: |
| 949 | + $j('#rsd_edit_img').hide(); |
948 | 950 | //run the image clip tools |
949 | 951 | _this.cEdit = new mvClipEdit( mvClipInit ); |
950 | 952 | }); |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvUploader.js |
— | — | @@ -6,7 +6,8 @@ |
7 | 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 | | - "upload-in-progress":"Doing Transcode & Upload (do not close this window)", |
| 10 | + "upload-transcode-in-progress":"Doing Transcode & Upload (do not close this window)", |
| 11 | + "upload-in-progress": "Upload in Progress (do not close this window)", |
11 | 12 | "upload-transcoded-status": "Transcoded", |
12 | 13 | "uploaded-status": "Uploaded", |
13 | 14 | "upload-select-file": "Select File...", |
— | — | @@ -66,11 +67,27 @@ |
67 | 68 | }); |
68 | 69 | }); |
69 | 70 | }else{ |
70 | | - _this.setupFirefogg(); |
| 71 | + //@@could check if firefogg is enabled here: |
| 72 | + _this.setupFirefogg(); |
| 73 | + //if only want httpUploadFrom help enable it here: |
71 | 74 | } |
72 | 75 | } |
73 | 76 | ); |
74 | 77 | }, |
| 78 | + /** |
| 79 | + * setupBaseUpInterface supports intefaces for progress indication if the browser supports it |
| 80 | + * also sets up ajax progress updates for http posts |
| 81 | + * //pre |
| 82 | + */ |
| 83 | + setupBaseUpInterface:function(){ |
| 84 | + //check if this feature is not false (we want it on by default (null) instances that don't have the upload api or any modifications) |
| 85 | + this.upForm = new mvBaseUploadInterface( { |
| 86 | + 'api_url' : this.api_url, |
| 87 | + 'parent_uploader': this |
| 88 | + } |
| 89 | + ); |
| 90 | + this.upForm.setupForm(); |
| 91 | + }, |
75 | 92 | setupFirefogg:function(){ |
76 | 93 | var _this = this; |
77 | 94 | //add firefogg html if not already there: ( same as $wgEnableFirebug added in SpecialUpload.php ) |
— | — | @@ -93,10 +110,10 @@ |
94 | 111 | }; |
95 | 112 | if( _this.api_url ) |
96 | 113 | intFirefoggObj['api_url'] = _this.api_url; |
97 | | - js_log('new mvFirefogg'); |
98 | | - //if firefog is not taking over the submit we can here: |
99 | | - _this.fogg = new mvFirefogg( intFirefoggObj ); |
100 | | - |
| 114 | + |
| 115 | + js_log('new mvFirefogg extends mvUploader (this)'); |
| 116 | + this.fogg = new mvFirefogg( intFirefoggObj ); |
| 117 | + this.fogg.setupForm(); |
101 | 118 | }, |
102 | 119 | //same add code as specialUpload if($wgEnableFirefogg){ |
103 | 120 | addFirefoggHtml:function(){ |
— | — | @@ -123,22 +140,171 @@ |
124 | 141 | "<span id='wgfogg_installed' style='display:none' >"+ |
125 | 142 | '<input id="wgEnableFirefogg" type="checkbox" name="wgEnableFirefogg" >' + |
126 | 143 | gM('upload-enable-converter') + |
127 | | - '</span><br></p>'); |
128 | | - //add in loader dl box: |
129 | | - //hard code style (since not always easy to import style sheets) |
130 | | - $j('body').append('<div id="dlbox-centered" class="dlbox-centered" style="display:none;'+ |
131 | | - 'position:fixed;background:#DDD;border:3px solid #AAA;font-size:115%;width:40%;'+ |
132 | | - 'height:300px;padding: 10px;z-index:100;top:100px;bottom:40%;left:20%;" >'+ |
133 | | - '<h5>' + gM('upload-in-progress') + '</h5>' + |
134 | | - '<div id="fogg-pbar-container" style="border:solid thin gray;width:90%;height:15px;" >' + |
135 | | - '<div id="fogg-progressbar" style="background:#AAC;width:0%;height:15px;"></div>' + |
136 | | - '</div>' + |
137 | | - '<span id="fogg-pstatus">0%</span>' + |
138 | | - '<span id="fogg-status-transcode">' + gM('upload-transcoded-status') + '</span>'+ |
139 | | - '<span style="display:none" id="fogg-status-upload">' + gM('uploaded-status') + '</span>' + |
140 | | - '</div>' + |
141 | | - '<div id="dlbox-overlay" class="dlbox-overlay" style="display:none;background:#000;cursor:wait;height:100%;'+ |
142 | | - 'left:0;top:0;position:fixed;width:100%;z-index:99;filter:alpha(opacity=60);'+ |
143 | | - '-moz-opacity: 0.6; opacity: 0.6;" ></div>'); |
| 144 | + '</span><br></p>'); |
144 | 145 | } |
| 146 | +} |
| 147 | +/** |
| 148 | + * the base Upload Interface extended via firefogg |
| 149 | + */ |
| 150 | +var default_bui_options = { |
| 151 | + 'api_url':null, |
| 152 | + 'parent_uploader':null |
| 153 | +} |
| 154 | +var mvBaseUploadInterface = function( iObj ){ |
| 155 | + return this.init( iObj ); |
| 156 | +} |
| 157 | +mvBaseUploadInterface.prototype = { |
| 158 | + parent_uploader:false, |
| 159 | + formData:{}, //the form to be submitted |
| 160 | + upload_mode:'autodetect', //can be 'post', 'chunks' or autodetect. (autodetect issues an api call) |
| 161 | + chunks_supported:false, |
| 162 | + form_post_override:false, |
| 163 | + init: function( iObj ){ |
| 164 | + if(!iObj) |
| 165 | + iObj = {}; |
| 166 | + //inherit iObj properties: |
| 167 | + for(var i in default_bui_options){ |
| 168 | + if(iObj[i]){ |
| 169 | + this[i] = iObj[i]; |
| 170 | + }else{ |
| 171 | + this[i] = default_bui_options[i]; |
| 172 | + } |
| 173 | + } |
| 174 | + }, |
| 175 | + setupForm:function(){ |
| 176 | + var _this = this; |
| 177 | + //set up the local pointer to the edit form: |
| 178 | + _this.getEditForm(); |
| 179 | + |
| 180 | + if(_this.editForm){ |
| 181 | + //set up the org_onsubmit if not set: |
| 182 | + if( typeof( _this.org_onsubmit ) == 'undefined' ) |
| 183 | + _this.org_onsubmit = _this.editForm.onsubmit; |
| 184 | + |
| 185 | + //bind the onSubmit the base onSubmit action: |
| 186 | + js_log("should have ...remove org:: " + _this.editForm.onsubmit); |
| 187 | + |
| 188 | + //have to define the onsubmit function inline or its hard to pass the "_this" instance |
| 189 | + _this.editForm.onsubmit = function(){ |
| 190 | + //run the original onsubmit (if not run yet set flag to avoid excessive chaining ) |
| 191 | + if( typeof( _this.org_onsubmit ) == 'function' ){ |
| 192 | + if( ! _this.org_onsubmit() ){ |
| 193 | + //error in org submit return false; |
| 194 | + return false; |
| 195 | + } |
| 196 | + } |
| 197 | + |
| 198 | + //check for post action override: |
| 199 | + if( _this.form_post_override ){ |
| 200 | + alert('woudld submit here'); |
| 201 | + //return true; |
| 202 | + } |
| 203 | + |
| 204 | + |
| 205 | + //get the input form data in flat json: |
| 206 | + var tmpAryData = $j( _this.editForm ).serializeArray(); |
| 207 | + for(var i=0; i < tmpAryData.length; i++){ |
| 208 | + if( tmpAryData[i]['name'] ) |
| 209 | + _this.formData[ tmpAryData[i]['name'] ] = tmpAryData[i]['value']; |
| 210 | + } |
| 211 | + |
| 212 | + //display the loader: |
| 213 | + _this.dispProgressOverlay(); |
| 214 | + |
| 215 | + //for some unknown reason we have to drop down the #p-search z-index: |
| 216 | + $j('#p-search').css('z-index', 1); |
| 217 | + |
| 218 | + //select upload mode: |
| 219 | + |
| 220 | + _this.detectUploadMode(); |
| 221 | + |
| 222 | + //don't submit the form we will do the post in ajax |
| 223 | + return false; |
| 224 | + }; |
| 225 | + } |
| 226 | + |
| 227 | + }, |
| 228 | + detectUploadMode:function( callback ){ |
| 229 | + var _this = this; |
| 230 | + js_log('detectUploadMode::' + _this.upload_mode + ' api:' + _this.api_url); |
| 231 | + //check the upload mode: |
| 232 | + if( _this.upload_mode == 'autodetect' ){ |
| 233 | + if( ! _this.api_url ) |
| 234 | + return js_error( 'Error: can\'t autodetect mode without api url' ); |
| 235 | + do_api_req( { |
| 236 | + 'data':{ 'action':'paraminfo','modules':'upload' }, |
| 237 | + 'url':_this.api_url |
| 238 | + }, function(data){ |
| 239 | + if( typeof data.paraminfo == 'undefined' || typeof data.paraminfo.modules == 'undefined' ) |
| 240 | + return js_error( 'Error: bad api results' ); |
| 241 | + if( typeof data.paraminfo.modules[0].classname == 'undefined'){ |
| 242 | + js_log( 'Autodetect Upload Mode: \'post\' '); |
| 243 | + _this.upload_mode = 'post'; |
| 244 | + }else{ |
| 245 | + js_log( 'Autodetect Upload Mode: api ' ); |
| 246 | + _this.upload_mode = 'api'; |
| 247 | + //make sure chunks are supported: |
| 248 | + for( var i in data.paraminfo.modules[0].parameters ){ |
| 249 | + var pname = data.paraminfo.modules[0].parameters[i].name; |
| 250 | + if( pname == 'enablechunks' ){ |
| 251 | + js_log( 'this.chunks_supported = true' ); |
| 252 | + _this.chunks_supported = true; |
| 253 | + break; |
| 254 | + } |
| 255 | + } |
| 256 | + } |
| 257 | + _this.doUploadSwitch(); |
| 258 | + }); |
| 259 | + }else{ |
| 260 | + _this.doUploadSwitch(); |
| 261 | + } |
| 262 | + }, |
| 263 | + doUploadSwitch:function(){ |
| 264 | + js_log('mvUPload:doUploadSwitch()'); |
| 265 | + var _this = this; |
| 266 | + //issue a post req: |
| 267 | + if( _this.upload_mode == 'post' || $j('#wpSourceTypeFile').get(0).checked ){ |
| 268 | + //update the status |
| 269 | + $j('#dlbox-centered').html('<h5>' + _this.getProgressTitle() + '</h5>' + |
| 270 | + mv_get_loading_img( 'left:40%;top:20%') |
| 271 | + ); |
| 272 | + |
| 273 | + //do normal post upload no status indicators (also since its a file I think we have to submit the form) |
| 274 | + _this.form_post_override=true; |
| 275 | + //js_log('run form submit!!'); |
| 276 | + _this.editForm.submit(); |
| 277 | + }else if( _this.upload_mode == 'api'){ |
| 278 | + //do api upload |
| 279 | + }else{ |
| 280 | + js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode ); |
| 281 | + } |
| 282 | + }, |
| 283 | + getProgressTitle:function(){ |
| 284 | + return gM('upload-in-progress'); |
| 285 | + }, |
| 286 | + getEditForm:function(){ |
| 287 | + this.editForm = $j( '#mw-upload-form' ).get(0); |
| 288 | + }, |
| 289 | + dispProgressOverlay:function(){ |
| 290 | + var _this = this; |
| 291 | + //add in loader dl box if not present: |
| 292 | + if( $j('#dlbox-centered').length ==0 ){ |
| 293 | + //hard code style (since not always easy to import style sheets) |
| 294 | + $j('body').append('<div id="dlbox-centered" class="dlbox-centered" style="'+ |
| 295 | + 'position:fixed;background:#DDD;border:3px solid #AAA;font-size:115%;width:40%;'+ |
| 296 | + 'height:300px;padding: 10px;z-index:100;top:100px;bottom:40%;left:20%;" >'+ |
| 297 | + '<h5>' + _this.getProgressTitle() + '</h5>' + |
| 298 | + '<div id="fogg-pbar-container" style="border:solid thin gray;width:90%;height:15px;" >' + |
| 299 | + '<div id="fogg-progressbar" style="background:#AAC;width:0%;height:15px;"></div>' + |
| 300 | + '</div>' + |
| 301 | + '<span id="fogg-pstatus">0%</span>' + |
| 302 | + '<span id="fogg-status-transcode">' + gM('upload-transcoded-status') + '</span>'+ |
| 303 | + '<span style="display:none" id="fogg-status-upload">' + gM('uploaded-status') + '</span>' + |
| 304 | + '</div>' + |
| 305 | + '<div id="dlbox-overlay" class="dlbox-overlay" style="background:#000;cursor:wait;height:100%;'+ |
| 306 | + 'left:0;top:0;position:fixed;width:100%;z-index:99;filter:alpha(opacity=60);'+ |
| 307 | + '-moz-opacity: 0.6; opacity: 0.6;" ></div>'); |
| 308 | + } |
| 309 | + } |
| 310 | + |
145 | 311 | } |
\ No newline at end of file |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mvSequencer.js |
— | — | @@ -444,7 +444,7 @@ |
445 | 445 | } |
446 | 446 | }, |
447 | 447 | getLocalApiUrl:function(){ |
448 | | - return this.plObj.interface_url.replace(/index\.php/, 'api.php'); |
| 448 | + return this.plObj.interface_url; |
449 | 449 | }, |
450 | 450 | plReadyInit:function(){ |
451 | 451 | var this_seq = this; |
— | — | @@ -740,7 +740,8 @@ |
741 | 741 | js_log('error: presently we can\'t copy clips across domains'); |
742 | 742 | }else{ |
743 | 743 | if( this_seq.clipboardEditToken ){ |
744 | | - var req_url = this_seq.plObj.interface_url + '?action=ajax&rs=mv_seqtool_clipboard&rsargs[]=copy'; |
| 744 | + //@@todo we need a api entry point to store a "clipboard" |
| 745 | + var req_url = this_seq.plObj.interface_url.replace(/api.php/, 'index.php') + '?action=ajax&rs=mv_seqtool_clipboard&rsargs[]=copy'; |
745 | 746 | $j.ajax({ |
746 | 747 | type: "POST", |
747 | 748 | url:req_url, |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libClipEdit/mvClipEdit.js |
— | — | @@ -192,7 +192,7 @@ |
193 | 193 | 'rvprop':'content' |
194 | 194 | }; |
195 | 195 | //get the interface uri from the plObject |
196 | | - var api_url = _this.p_seqObj.plObj.interface_url.replace(/index\.php/, 'api.php'); |
| 196 | + var api_url = _this.p_seqObj.plObj.interface_url; |
197 | 197 | //first check |
198 | 198 | do_api_req( { |
199 | 199 | 'data':reqObj, |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js |
— | — | @@ -1134,7 +1134,7 @@ |
1135 | 1135 | //force format to json (if not already set) |
1136 | 1136 | options.data['format'] = 'json'; |
1137 | 1137 | |
1138 | | - js_log('do api req: ' + options.url +' data' + JSON.stringify( options.data ) ); |
| 1138 | + js_log('do api req: ' + options.url +' data' + options.data ); |
1139 | 1139 | //build request string: |
1140 | 1140 | if( parseUri( document.URL ).host == parseUri( options.url ).host ){ |
1141 | 1141 | //local request do api request directly |