Index: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php |
— | — | @@ -591,7 +591,7 @@ |
592 | 592 | return $out; |
593 | 593 | } |
594 | 594 | function do_bill_insert( $bill_key ) { |
595 | | - print "not yet implemented\n"; |
| 595 | + //grab bill list with categories from govtrack |
596 | 596 | } |
597 | 597 | function do_people_insert( $doInterestLookup = false, $forcePerson = '', $force = false ) { |
598 | 598 | global $valid_attributes, $states_ary; |
Index: trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php |
— | — | @@ -306,8 +306,7 @@ |
307 | 307 | |
308 | 308 | $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/mv_embed.js?{$unique_req_param}\"></script>" ); |
309 | 309 | $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_allpages.js?{$unique_req_param}\"></script>" ); |
310 | | - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_search.js?{$unique_req_param}\"></script>" ); |
311 | | - $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_common.js?{$unique_req_param}\"></script>" ); |
| 310 | + $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_search.js?{$unique_req_param}\"></script>" ); |
312 | 311 | |
313 | 312 | //temp for testing: |
314 | 313 | if( $mvgJSDebug ) |
Index: trunk/extensions/MetavidWiki/includes/MV_StreamImage.php |
— | — | @@ -115,6 +115,9 @@ |
116 | 116 | list( $im_width, $im_height, $ext ) = MV_StreamImage::getSizeType( $req_size ); |
117 | 117 | if ( $ext == 'jpg' )header( "Content-type: image/jpeg" ); |
118 | 118 | if ( $ext == 'png' )header( "Content-type: image/png" ); |
| 119 | + //set out a long expire: |
| 120 | + //keep in the cache for a 90 days: |
| 121 | + header('Expires: ' . gmdate('D, d M Y H:i:s', time()+90*24*60*60) . ' GMT'); |
119 | 122 | // print "img path: $img_path"; |
120 | 123 | // @@todo a redirect to real image (will serv from cache that way) |
121 | 124 | if ( is_file( $img_path ) ) { |
Index: trunk/extensions/MetavidWiki/includes/MV_OggHandler.php |
— | — | @@ -1,9 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | /* |
4 | 4 | * class to override oggHandler for compatibility/feature enhancement with metavid |
5 | | - * |
6 | | - * primararly does the following: |
7 | | - * changes |
| 5 | + * |
8 | 6 | */ |
9 | 7 | |
10 | 8 | class mvOggHandler extends OggHandler{ |
Index: trunk/extensions/MetavidWiki/skins/mv_common.js |
— | — | @@ -5,197 +5,8 @@ |
6 | 6 | * adds adjustment hooks |
7 | 7 | * @mvd_id set to the mvd_id |
8 | 8 | */ |
9 | | -function add_adjust_hooks(mvd_id, track_dur, targets){ |
10 | | - if(track_dur)track_dur=parseInt(track_dur); |
11 | | - js_log('add_adjust_hooks: ' + mvd_id + ' td: '+ track_dur); |
12 | | - |
13 | | - /*var base_targets = new Array('mv_end_hr', 'mv_start_hr', 'track_target' ); |
14 | | - |
15 | | - if( typeof targets == 'object'){ |
16 | | - for(var i in targets){ |
17 | | - |
18 | | - } |
19 | | - }else{ |
20 | | - |
21 | | - }*/ |
22 | | - |
23 | | - //if options are unset populate functions: |
24 | | - //add mouse over end time frame highlight |
25 | | - $j('#mv_end_hr_'+mvd_id).hoverIntent({interval:200,over:function(){ |
26 | | - //js_log('pre style: ' + $j(this).css('border')); |
27 | | - $j(this).css('border','solid red'); |
28 | | - do_video_time_update( $j('#mv_end_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
29 | | - },out:function(){ |
30 | | - $j(this).css('border','solid black thin'); |
31 | | - do_video_time_update($j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
32 | | - }}); |
33 | | - //add onchange js hooks: |
34 | | - $j('.mv_adj_hr').change(function(){ |
35 | | - //preserve track duration for nav and seq: |
36 | | - //ie seems to crash so no interface updates for IE for the time being |
37 | | - if(!$j.browser.msie){ |
38 | | - if(mvd_id=='nav'||mvd_id=='seq'){ |
39 | | - add_adjust_hooks(mvd_id, track_dur); |
40 | | - }else{ |
41 | | - add_adjust_hooks(mvd_id) |
42 | | - } |
43 | | - } |
44 | | - //update the video time for onChange |
45 | | - do_video_time_update($j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
46 | | - }); |
47 | | - //read the ntp time from the fields |
48 | | - var start_sec = ntp2seconds( $j('#mv_start_hr_'+mvd_id).val() ); |
49 | | - var end_sec = ntp2seconds( $j('#mv_end_hr_'+mvd_id).val() ); |
50 | | - js_log('start_sec:'+start_sec + ' end: ' + end_sec); |
51 | | - if(start_sec > end_sec){ |
52 | | - js_log('start > end : ' + start_sec + ' > ' + end_sec); |
53 | | - //update end time to start_time + 1 second |
54 | | - end_sec = parseInt(start_sec+1); |
55 | | - $j('#mv_end_hr_'+mvd_id).val(seconds2ntp(end_sec)); |
56 | | - } |
57 | 9 | |
58 | | - var duration = end_sec - start_sec; |
59 | | - //set the track duration as 2 min or 2*duration (whatever is longer) |
60 | | - if(!track_dur) |
61 | | - var track_dur = (duration*2<120)?120:duration*2; |
62 | 10 | |
63 | | - //set the base offset |
64 | | - if(start_sec==0){ |
65 | | - var base_offset = 0 |
66 | | - }else{ |
67 | | - //make sure we won't go into negative with a 1/4 track offset |
68 | | - //alert('wtf:s:' + start_sec + '-' + (track_dur*.25) ); |
69 | | - var base_offset= start_sec-(track_dur*.25); |
70 | | - //alert('wtf: '+ base_offset); |
71 | | - if(base_offset < 0) |
72 | | - base_offset=0; |
73 | | - //js_log('set base offset: '+track_dur +'* .25 = '+ parseInt(base_offset) ); |
74 | | - } |
75 | | - js_log('BASE OFFSET: '+ base_offset); |
76 | | - //set the base offset / track_dur interface vars: |
77 | | - $j('#track_time_start_'+mvd_id).html( seconds2ntp(base_offset) ); |
78 | | - $j('#track_time_end_'+mvd_id).html( seconds2ntp( base_offset+track_dur )); |
79 | | - |
80 | | - //set up start /end slider values: |
81 | | - var slider_start = (start_sec - base_offset) / track_dur; |
82 | | - var slider_end = (end_sec - base_offset) / track_dur; |
83 | | - var slider_dur = slider_end -slider_start; |
84 | | - //clear out the existing effect if present |
85 | | - //if(mv_sliders[mvd_id])mv_sliders[mvd_id].dispose(); |
86 | | - |
87 | | - //update the slider values (left right) |
88 | | - track_width = $j('#container_track_'+mvd_id).width(); |
89 | | - |
90 | | - js_log('start: '+ slider_start + ' =' + (slider_start*track_width) + |
91 | | - ' se:'+ slider_end + ' =' + (slider_end*track_width) + |
92 | | - ' width would be: :' + Math.round((slider_end*track_width)-(slider_start*track_width))); |
93 | | - |
94 | | - //if re-size width less than width of image bump it up: |
95 | | - var resize_width = Math.round((slider_end*track_width)-(slider_start*track_width)); |
96 | | - if(resize_width<17)resize_width=17; |
97 | | - |
98 | | - $j('#resize_'+mvd_id).css({ |
99 | | - left:Math.round(slider_start*track_width)+'px', |
100 | | - width: resize_width+'px' |
101 | | - }); |
102 | | - js_log("track width: " + $j('#container_track_'+mvd_id).width() + |
103 | | - ' slider_width: ' + $j('#resize_'+mvd_id).width()); |
104 | | - //add an additional flag |
105 | | - var cur_handle = ''; |
106 | | - $j('.ui-resizable-handle').mousedown( function(){ |
107 | | - js_log('hid: ' + this.id); |
108 | | - cur_handle = this.id; |
109 | | - }); |
110 | | - org_start = org_end =''; |
111 | | - //jQuery slider: |
112 | | - $j('#resize_'+mvd_id).resizable({ |
113 | | - minWidth: 10, |
114 | | - maxWidth: $j('#resize_'+mvd_id).width(), |
115 | | - minHeight: 20, |
116 | | - maxHeight: 20, |
117 | | - handles: { |
118 | | - e: '.ui-resizable-e', |
119 | | - w: '.ui-resizable-w' |
120 | | - }, |
121 | | - start: function(e,ui) { |
122 | | - mv_lock_vid_updates=true; |
123 | | - org_start = $j('#mv_start_hr_'+mvd_id).val(); |
124 | | - org_end = $j('#mv_end_hr_'+mvd_id).val(); |
125 | | - //js_log("org maxWidth: " + ui.options.maxWidth); |
126 | | - right_x = ( $j('#resize_'+mvd_id).position().left+ |
127 | | - $j('#resize_'+mvd_id).width() |
128 | | - ); |
129 | | - /*js_log('left:' + $j('#resize_'+mvd_id).position().left + ' width: '+ |
130 | | - * $j('#resize_'+mvd_id).width() + ' right_x:'+ right_x); |
131 | | - */ |
132 | | - if(cur_handle.indexOf('handle1')!=-1){ |
133 | | - ui.options.maxWidth= right_x; |
134 | | - }else{ |
135 | | - ui.options.maxWidth= ( |
136 | | - $j('#container_track_'+mvd_id).width() - |
137 | | - $j('#resize_'+mvd_id).position().left |
138 | | - ); |
139 | | - } |
140 | | - js_log("updated maxWidth: " + ui.options.maxWidth); |
141 | | - //js_log('grabbed: ' + e.explicitOriginalTarget.id); |
142 | | - //console.log('start ', ui); |
143 | | - }, |
144 | | - stop: function(e,ui) { |
145 | | - mv_lock_vid_updates=false; |
146 | | - //console.log('stop ', ui); |
147 | | - //return the non-adjusted to its original value: |
148 | | - if(cur_handle.indexOf('handle1')!=-1){ |
149 | | - $j('#mv_end_hr_'+mvd_id).val(org_end); |
150 | | - }else{ |
151 | | - $j('#mv_start_hr_'+mvd_id).val(org_start); |
152 | | - } |
153 | | - //update the clip |
154 | | - do_video_time_update($j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
155 | | - }, |
156 | | - resize: function(e,ui) { |
157 | | - base_offset = ntp2seconds( $j('#track_time_start_'+mvd_id).html()); |
158 | | - mv_slider_update_stats(mvd_id); |
159 | | - } |
160 | | - }); |
161 | | - $j('#dragSpan_'+mvd_id).css('cursor','move'); |
162 | | - $j('#resize_'+mvd_id).draggable({ |
163 | | - axis:'x', |
164 | | - containment:'parent', |
165 | | - handle: "#dragSpan_"+mvd_id, |
166 | | - drag:function(e, ui){ |
167 | | - mv_slider_update_stats(mvd_id, true); |
168 | | - }, |
169 | | - stop:function(e,ui){ |
170 | | - $j('#resize_'+mvd_id).css('top', 0); |
171 | | - //if in seq mode:update the clip |
172 | | - if(mvd_id=='seq')do_video_time_update($j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
173 | | - } |
174 | | - }); |
175 | | - //store the necessary values in the slider obj |
176 | | - //mv_sliders[mvd_id]['base_offset']=base_offset; |
177 | | - //mv_sliders[mvd_id]['track_dur']=track_dur; |
178 | | - function mv_slider_update_stats(mvd_id, drag){ |
179 | | - var update_start=update_end=false; |
180 | | - //only update the side we are dragging: |
181 | | - if(cur_handle.indexOf('handle1')!=-1){ |
182 | | - update_start=true; |
183 | | - }else{ |
184 | | - update_end=true; |
185 | | - } |
186 | | - if(drag)update_end=update_start=true; |
187 | | - if(update_end){ |
188 | | - var end_time = base_offset + (track_dur *(($j('#resize_'+mvd_id).position().left + |
189 | | - $j('#resize_'+mvd_id).width()) / |
190 | | - $j('#container_track_'+mvd_id).width())); |
191 | | - if(end_time>(track_dur+base_offset))end_time=track_dur+base_offset; |
192 | | - $j('#mv_end_hr_'+mvd_id).val( seconds2ntp(end_time) ); |
193 | | - } |
194 | | - if(update_start) |
195 | | - $j('#mv_start_hr_'+mvd_id).val( seconds2ntp(base_offset + (track_dur *($j('#resize_'+mvd_id).position().left / |
196 | | - $j('#container_track_'+mvd_id).width()) ) )); |
197 | | - } |
198 | | -} |
199 | | - |
200 | 11 | //alert(typeof js_log); |
201 | 12 | //logging: |
202 | 13 | function js_log(string){ |
Index: trunk/extensions/MetavidWiki/skins/mv_stream.js |
— | — | @@ -60,9 +60,10 @@ |
61 | 61 | //:hoverIntent |
62 | 62 | //http://cherne.net/brian/resources/jquery.hoverIntent.html |
63 | 63 | mvJsLoader.doLoad({ |
64 | | - '$j.autocomplete':'jquery/plugins/jquery.autocomplete.js', |
65 | | - '$j.fn.hoverIntent':'jquery/plugins/jquery.hoverIntent.js', |
66 | | - '$j.ui.resizable':'jquery/jquery.ui-1.5.2/ui/minified/ui.resizable.min.js' |
| 64 | + '$j.autocomplete' : 'jquery/plugins/jquery.autocomplete.js', |
| 65 | + '$j.fn.hoverIntent' : 'jquery/plugins/jquery.hoverIntent.js', |
| 66 | + '$j.ui.resizable' : 'jquery/jquery.ui-1.5.2/ui/minified/ui.resizable.min.js', |
| 67 | + 'mvClipEdit' : 'libSequencer/mv_clipedit.js' |
67 | 68 | },function(){ |
68 | 69 | //now extend draggable |
69 | 70 | mvJsLoader.doLoad({ |
— | — | @@ -1012,47 +1013,6 @@ |
1013 | 1014 | }); |
1014 | 1015 | } |
1015 | 1016 | } |
1016 | | -function do_video_time_update(start_time, end_time, mvd_id) { |
1017 | | - if(mv_lock_vid_updates==false){ |
1018 | | - //update the vid title: |
1019 | | - $j('#mv_videoPlayerTime').html( start_time + ' to ' + end_time ); |
1020 | | - var ebvid = $j('#embed_vid').get(0); |
1021 | | - if(ebvid.isPaused()) |
1022 | | - ebvid.stop(); |
1023 | | - $j('#embed_vid').get(0).updateVideoTime(start_time, end_time); |
1024 | | - do_update_thumb(mvd_id, start_time); |
1025 | | - } |
1026 | | -} |
1027 | | -function do_update_thumb(mvd_id, start_time){ |
1028 | | - //set via mvd |
1029 | | - if(mvd_id){ |
1030 | | - if($j('#mv_fd_mvd_'+mvd_id).attr('image_url')!=$j('#embed_vid').get(0).thumbnail){ |
1031 | | - $j('#embed_vid').get(0).updateThumbnail($j('#mv_fd_mvd_'+mvd_id).attr('image_url')); |
1032 | | - return ; |
1033 | | - } |
1034 | | - } |
1035 | | - //else set via org_thum_src |
1036 | | - if( $j('#embed_vid').get(0).org_thum_src.indexOf('?')!=-1){ |
1037 | | - var url = $j('#embed_vid').get(0).org_thum_src.split('?'); |
1038 | | - var args = Array(); |
1039 | | - var arg_parts = url[1].split('&'); |
1040 | | - for(i in arg_parts){ |
1041 | | - var tmp = arg_parts[i].split('='); |
1042 | | - args[tmp[0]]=tmp[1]; |
1043 | | - } |
1044 | | - var new_thumb = url[0]+'?'; |
1045 | | - for(k in args){ |
1046 | | - var v = args[k]; |
1047 | | - if(k!='t'){ |
1048 | | - new_thumb+=k+'='+v+'&'; |
1049 | | - } |
1050 | | - } |
1051 | | - new_thumb+= 't='+ start_time; |
1052 | | - //js_log("new thumb:" + new_thumb); |
1053 | | - if(new_thumb!=$j('#embed_vid').get(0).thumbnail) |
1054 | | - $j('#embed_vid').get(0).updateThumbnail(new_thumb); |
1055 | | - } |
1056 | | -} |
1057 | 1017 | function mv_tool_disp(tool_id){ |
1058 | 1018 | //set content to loading |
1059 | 1019 | $j('#mv_tool_cont').html( getMsg('loading_txt') ); |
— | — | @@ -1089,7 +1049,7 @@ |
1090 | 1050 | //run any request javascript call backs |
1091 | 1051 | //do per tool post-req js actions: |
1092 | 1052 | switch(tool_id){ |
1093 | | - case 'navigate': |
| 1053 | + /*case 'navigate': |
1094 | 1054 | //set the content payload |
1095 | 1055 | $j('#mv_tool_cont').html( mv_result['innerHTML']); |
1096 | 1056 | eval(mv_result['js_eval']); |
— | — | @@ -1099,7 +1059,7 @@ |
1100 | 1060 | '/'+$j('#mv_end_hr_nav').val(); |
1101 | 1061 | }); |
1102 | 1062 | add_adjust_hooks('nav', end_time); |
1103 | | - break; |
| 1063 | + break;*/ |
1104 | 1064 | case 'search': |
1105 | 1065 | //load search.js ... @@todo cleanup path |
1106 | 1066 | mvJsLoader.doLoad({ |
Index: trunk/extensions/MetavidWiki/skins/external_media_wizard.js |
— | — | @@ -9,6 +9,7 @@ |
10 | 10 | }, |
11 | 11 | 'metavid':{ |
12 | 12 | 'local':true //this will change the output from [[embed:StreamName]] to [[remoteEmbed:roe_url]] |
| 13 | + // you will need to run the mv remoteEmbed extension. |
13 | 14 | } |
14 | 15 | } |
15 | 16 | var wg_local_wiki_api_url = wgServer + wgScriptPath + '/api.php'; |
— | — | @@ -37,7 +38,7 @@ |
38 | 39 | //show the loading screen: |
39 | 40 | var body_elm = document.getElementsByTagName("body")[0]; |
40 | 41 | body_elm.innerHTML = body_elm.innerHTML + ''+ |
41 | | - '<div id="modalbox" style="background:#DDD;border:3px solid #666666;'+ |
| 42 | + '<div id="modalbox" style="background:#DDD;border:3px solid #666666;font-size:115%;'+ |
42 | 43 | 'top:30px;left:20px;right:20px;bottom:30px;position:fixed;z-index:100;">'+ |
43 | 44 | |
44 | 45 | 'loading external media wizard<blink>...</blink>'+ |
— | — | @@ -71,9 +72,10 @@ |
72 | 73 | 'target_id':'modalbox', |
73 | 74 | 'profile':'mediawiki_edit', |
74 | 75 | 'target_textbox': 'wpTextbox1', |
75 | | - 'caret_pos':caret_pos, |
| 76 | + 'caret_pos':caret_pos, |
76 | 77 | //note selections in the textbox will take over the default query |
77 | 78 | 'default_query': wgTitle, |
| 79 | + 'target_title':wgPageName, |
78 | 80 | 'cpconfig':wg_content_proivers_config, |
79 | 81 | 'local_wiki_api_url': wg_local_wiki_api_url |
80 | 82 | }); |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_clipedit.js |
— | — | @@ -38,18 +38,101 @@ |
39 | 39 | } |
40 | 40 | } |
41 | 41 | //check the media_type: |
42 | | - js_log('mvClipEdit:: media type:' + this.media_type + 'base width: ' + rObj.width + ' bh: ' + rObj.height); |
| 42 | + js_log('mvClipEdit:: media type:' + this.media_type + 'base width: ' + this.rObj.width + ' bh: ' + this.rObj.height); |
43 | 43 | |
44 | | - |
45 | 44 | //could seperate out into media Types objects for now just call method |
46 | 45 | if(this.media_type == 'image'){ |
47 | 46 | this.setUpImageCtrl(); |
48 | | - }else if(this.media_type=='jpeg'){ |
| 47 | + }else if(this.media_type=='video'){ |
49 | 48 | this.setUpVideoCtrl(); |
50 | 49 | } |
51 | 50 | }, |
| 51 | + setUpVideoCtrl:function(){ |
| 52 | + js_log('setUpVideoCtrl:f'); |
| 53 | + var eb = $j('#embed_vid').get(0); |
| 54 | + //turn on preview to avoid onDone actions |
| 55 | + eb.preview_mode = true; |
| 56 | + |
| 57 | + $j('#'+this.control_ct).html( |
| 58 | + '<h3>Edit Video Tools:</h3>' + |
| 59 | + '<strong>Set in-out points</strong>'+ |
| 60 | + '<table border="0" style="background: transparent; width:94%;height:50px;">'+ |
| 61 | + '<tbody><tr><td width="40">'+ |
| 62 | + '<span style="font-size: small;" id="track_time_start_rsd">' + eb.start_ntp +'</span>'+ |
| 63 | + '</td><td><div style="border: 1px solid black; width: 100%; height: 5px; background-color: #888;" '+ |
| 64 | + 'id="container_track_rsd">'+ |
| 65 | + '<div id="resize_rsd" class="ui-resizable ui-draggable">'+ |
| 66 | + |
| 67 | + '<div class="ui-resizable-w ui-resizable-handle"'+ |
| 68 | + ' id="handle1_rsd" unselectable="on"/>'+ |
| 69 | + |
| 70 | + '<div class="ui-resizable-e ui-resizable-handle" '+ |
| 71 | + ' id="handle2_rsd" unselectable="on"/>'+ |
| 72 | + |
| 73 | + '<div class="ui-dragSpan" id="dragSpan_rsd" style="cursor: move;"/>'+ |
| 74 | + '</div>'+ |
| 75 | + '</div>'+ |
| 76 | + '</td><td width="50">'+ |
| 77 | + '<span style="font-size: small;" id="track_time_end_rsd">'+ eb.end_ntp +'</span>'+ |
| 78 | + '</td></tr></tbody>'+ |
| 79 | + '</table>'+ |
| 80 | + '<span style="float: left;">'+ |
| 81 | + '<label class="mv_css_form" for="mv_start_hr_rsd"><i>Start time:</i></label>'+ |
| 82 | + '<input id="mv_start_hr_rsd" class="mv_adj_hr" name="mv_start_hr_rsd" value="' + eb.start_ntp + '" maxlength="8" size="8"/>'+ |
| 83 | + '</span>'+ |
| 84 | + '<span style="float: left;">'+ |
| 85 | + '<label for="mv_end_hr_rsd" class="mv_css_form"><i>End time:</i></label>'+ |
| 86 | + '<input name="mv_end_hr_rsd" id="mv_end_hr_rsd" value="' + eb.end_ntp + '" maxlength="8" size="8" class="mv_adj_hr"/>'+ |
| 87 | + '</span>'+ |
| 88 | + '<div style="clear: both;"/>'+ |
| 89 | + '<input id="mv_preview_clip" type="button" value="Preview In-out points">'+ |
| 90 | + this.getInsertControl() |
| 91 | + ); |
| 92 | + //setup bindings: |
| 93 | + add_adjust_hooks('rsd'); |
| 94 | + |
| 95 | + $j('#mv_preview_clip').click(function(){ |
| 96 | + $j('#embed_vid').get(0).stop(); |
| 97 | + $j('#embed_vid').get(0).play(); |
| 98 | + }); |
| 99 | + |
| 100 | + this.applyInsertControlBindings(); |
| 101 | + }, |
| 102 | + getInsertControl:function(){ |
| 103 | + return '<h3>Inline Caption Description</h3>'+ |
| 104 | + '<textarea style="width:300px;" id="mv_inline_img_desc" rows="4" cols="30"></textarea><br>'+ |
| 105 | + '<h3>Actions</h3>'+ |
| 106 | + '<input type="button" class="mv_insert_image_page" value="' + getMsg('mv_insert_image_page') + '"> '+ |
| 107 | + '<input type="button" style="font-weight:bold" class="mv_preview_insert" value="' + getMsg('mv_preview_insert')+ '"> '+ |
| 108 | + '<a href="#" class="mv_cancel_img_edit" title="' + getMsg('mv_cancel_image_insert')+'">' + getMsg('mv_cancel_image_insert') + '</a> '; |
| 109 | + }, |
| 110 | + applyEdit:function(){ |
| 111 | + if(this.media_type == 'image'){ |
| 112 | + this.applyCrop(); |
| 113 | + }else if(this.media_type == 'video'){ |
| 114 | + this.applyVideoAdj(); |
| 115 | + } |
| 116 | + }, |
| 117 | + applyInsertControlBindings:function(){ |
| 118 | + var _this = this; |
| 119 | + $j('.mv_insert_image_page').click(function(){ |
| 120 | + _this.applyEdit(); |
| 121 | + //copy over the desc text to the resource object |
| 122 | + rObj['inlineDesc']= $j('#mv_inline_img_desc').val(); |
| 123 | + _this.p_rsdObj.insertResource( _this.rObj ); |
| 124 | + }); |
| 125 | + $j('.mv_preview_insert').click(function(){ |
| 126 | + _this.applyEdit(); |
| 127 | + //copy over the desc text to the resource object |
| 128 | + _this.rObj['inlineDesc']= $j('#mv_inline_img_desc').val(); |
| 129 | + _this.p_rsdObj.previewResource( _this.rObj ); |
| 130 | + }); |
| 131 | + $j('.mv_cancel_img_edit').click( function(){ |
| 132 | + $j('#' + _this.parent_ct).fadeOut("fast"); |
| 133 | + }); |
| 134 | + }, |
52 | 135 | setUpImageCtrl:function(){ |
53 | | - var _this = this; |
| 136 | + var _this = this; |
54 | 137 | //by default apply Crop tool |
55 | 138 | $j('#'+this.control_ct).html( |
56 | 139 | '<h3>Edit tools</h3>' + |
— | — | @@ -63,17 +146,11 @@ |
64 | 147 | '<a href="#" class="mv_scale_msg">' + getMsg('mv_scale') + '</a><br>'+ |
65 | 148 | '<a href="#" style="display:none" class="mv_apply_scale">' + getMsg('mv_apply_scale') + '</a> '+ |
66 | 149 | '<a href="#" style="display:none" class="mv_rest_scale">' + getMsg('mv_reset_scale') + '</a> '+ |
67 | | - |
68 | | - '<h3>Inline Caption Description</h3>'+ |
69 | | - '<textarea id="mv_img_desc" rows="4" cols="30"></textarea><br>'+ |
70 | | - '<h3>Actions</h3>'+ |
71 | | - '<input type="button" class="mv_insert_image_page" value="' + getMsg('mv_insert_image_page') + '"> '+ |
72 | | - '<input type="button" style="font-weight:bold" class="mv_preview_insert" value="' + getMsg('mv_preview_insert')+ '"> '+ |
73 | | - '<a href="#" class="mv_cancel_img_edit" title="' + getMsg('mv_cancel_image_insert')+'">' + getMsg('mv_cancel_image_insert') + '</a> ' |
| 150 | + _this.getInsertControl() |
74 | 151 | ); |
75 | 152 | //add bidings: |
76 | 153 | $j('#mv_crop_button,.mv_crop_msg,.mv_apply_crop').click(function(){ |
77 | | - js_log('click:mv_crop_button: base width: ' + rObj.width + ' bh: ' + rObj.height); |
| 154 | + js_log('click:mv_crop_button: base width: ' + _this.rObj.width + ' bh: ' + _this.rObj.height); |
78 | 155 | if($j('#mv_crop_button').hasClass('mv_crop_button_selected')){ |
79 | 156 | _this.applyCrop(); |
80 | 157 | }else{ |
— | — | @@ -86,24 +163,17 @@ |
87 | 164 | $j('.mv_crop_msg').show(); |
88 | 165 | $j('#mv_crop_button').removeClass('mv_crop_button_selected').addClass('mv_crop_button_base').attr('title',getMsg('mv_crop')); |
89 | 166 | _this.rObj.crop=null; |
90 | | - $j('#'+_this.clip_disp_ct ).empty().html( |
91 | | - '<img src="'+ _this.rObj.url + '" id="rsd_edit_img">' |
92 | | - ) |
93 | | - }); |
94 | | - $j('.mv_insert_image_page').click(function(){ |
95 | | - _this.applyCrop(); |
96 | | - //have the (parent remote search object) do the insert |
97 | | - _this.p_rsdObj.insertResource( rObj ); |
98 | | - }); |
99 | | - $j('.mv_preview_insert').click(function(){ |
100 | | - _this.applyCrop(); |
101 | | - //copy over the desc text to the resouce object |
102 | | - _this.p_rsdObj.previewResource( rObj ); |
103 | | - }); |
104 | | - $j('.mv_cancel_img_edit').click( function(){ |
105 | | - $j('#' + _this.parent_ct).fadeOut("fast"); |
106 | | - }); |
| 167 | + $j('#' + _this.clip_disp_ct ).empty().html( |
| 168 | + '<img src="' + _this.rObj.url + '" id="rsd_edit_img">' |
| 169 | + ); |
| 170 | + }); |
| 171 | + this.applyInsertControlBindings(); |
107 | 172 | }, |
| 173 | + applyVideoAdj:function(){ |
| 174 | + //update video related keys |
| 175 | + _this.rObj['titleKey'] = 'Stream:'; |
| 176 | + _this.rObj['start_time'] = ''; |
| 177 | + }, |
108 | 178 | applyCrop:function(){ |
109 | 179 | var _this = this; |
110 | 180 | $j('.mv_apply_crop').hide(); |
— | — | @@ -135,11 +205,201 @@ |
136 | 206 | js_log('on select:' + c.x +','+ c.y+','+ c.x2+','+ c.y2+','+ c.w+','+ c.h); |
137 | 207 | _this.rObj.crop = c; |
138 | 208 | }, |
139 | | - onChange: function(c){ |
140 | | - } |
| 209 | + onChange: function(c){ |
| 210 | + } |
141 | 211 | }); |
142 | | - }, |
143 | | - setUpVideoCtrl:function(){ |
144 | | - |
145 | 212 | } |
| 213 | +} |
| 214 | +// mv_lock_vid_updates defeined in mv_stream.js (we need further refactoring) |
| 215 | +if(typeof mv_lock_vid_updates == 'undefined') |
| 216 | + mv_lock_vid_updates= false; |
| 217 | + |
| 218 | +function add_adjust_hooks(mvd_id){ |
| 219 | + js_log('add_adjust_hooks: ' + mvd_id ); |
| 220 | + //if options are unset populate functions: |
| 221 | + //add mouse over end time frame highlight |
| 222 | + $j('#mv_end_hr_'+mvd_id).hoverIntent({interval:200,over:function(){ |
| 223 | + //js_log('pre style: ' + $j(this).css('border')); |
| 224 | + $j(this).css('border','solid red'); |
| 225 | + do_video_time_update( $j('#mv_end_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
| 226 | + },out:function(){ |
| 227 | + $j(this).css('border','solid black thin'); |
| 228 | + do_video_time_update($j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
| 229 | + }}); |
| 230 | + //add onchange js hooks: |
| 231 | + $j('.mv_adj_hr').change(function(){ |
| 232 | + //preserve track duration for nav and seq: |
| 233 | + //ie seems to crash so no interface updates for IE for the time being |
| 234 | + if(!$j.browser.msie){ |
| 235 | + if(mvd_id=='nav'||mvd_id=='seq'){ |
| 236 | + add_adjust_hooks(mvd_id); |
| 237 | + }else{ |
| 238 | + add_adjust_hooks(mvd_id) |
| 239 | + } |
| 240 | + } |
| 241 | + //update the video time for onChange |
| 242 | + do_video_time_update($j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
| 243 | + }); |
| 244 | + //read the ntp time from the fields |
| 245 | + var start_sec = ntp2seconds( $j('#mv_start_hr_'+mvd_id).val() ); |
| 246 | + var end_sec = ntp2seconds( $j('#mv_end_hr_'+mvd_id).val() ); |
| 247 | + js_log('start_sec:'+start_sec + ' end: ' + end_sec); |
| 248 | + if(start_sec > end_sec){ |
| 249 | + js_log('start > end : ' + start_sec + ' > ' + end_sec); |
| 250 | + //update end time to start_time + 1 second |
| 251 | + end_sec = parseInt(start_sec+1); |
| 252 | + $j('#mv_end_hr_'+mvd_id).val(seconds2ntp(end_sec)); |
| 253 | + } |
| 254 | + |
| 255 | + var duration = end_sec - start_sec; |
| 256 | + //set the track duration as 2 min or 2*duration (whatever is longer) |
| 257 | + var track_dur = (duration*2<120)?120:duration*2; |
| 258 | + |
| 259 | + //set the base offset |
| 260 | + if(start_sec==0){ |
| 261 | + var base_offset = 0 |
| 262 | + }else{ |
| 263 | + //make sure we won't go into negative with a 1/4 track offset |
| 264 | + //alert('wtf:s:' + start_sec + '-' + (track_dur*.25) ); |
| 265 | + var base_offset= start_sec-(track_dur*.25); |
| 266 | + //alert('wtf: '+ base_offset); |
| 267 | + if(base_offset < 0) |
| 268 | + base_offset=0; |
| 269 | + //js_log('set base offset: '+track_dur +'* .25 = '+ parseInt(base_offset) ); |
| 270 | + } |
| 271 | + js_log('BASE OFFSET: '+ base_offset); |
| 272 | + //set the base offset / track_dur interface vars: |
| 273 | + $j('#track_time_start_'+mvd_id).html( seconds2ntp(base_offset) ); |
| 274 | + $j('#track_time_end_'+mvd_id).html( seconds2ntp( base_offset+track_dur )); |
| 275 | + |
| 276 | + //set up start /end slider values: |
| 277 | + var slider_start = (start_sec - base_offset) / track_dur; |
| 278 | + var slider_end = (end_sec - base_offset) / track_dur; |
| 279 | + var slider_dur = slider_end -slider_start; |
| 280 | + //clear out the existing effect if present |
| 281 | + //if(mv_sliders[mvd_id])mv_sliders[mvd_id].dispose(); |
| 282 | + |
| 283 | + //update the slider values (left right) |
| 284 | + track_width = $j('#container_track_'+mvd_id).width(); |
| 285 | + |
| 286 | + js_log('start: '+ slider_start + ' =' + (slider_start*track_width) + |
| 287 | + ' se:'+ slider_end + ' =' + (slider_end*track_width) + |
| 288 | + ' width would be: :' + Math.round((slider_end*track_width)-(slider_start*track_width))); |
| 289 | + |
| 290 | + //if re-size width less than width of image bump it up: |
| 291 | + var resize_width = Math.round((slider_end*track_width)-(slider_start*track_width)); |
| 292 | + if(resize_width<17)resize_width=17; |
| 293 | + |
| 294 | + $j('#resize_'+mvd_id).css({ |
| 295 | + left:Math.round(slider_start*track_width)+'px', |
| 296 | + width: resize_width+'px' |
| 297 | + }); |
| 298 | + js_log("track width: " + $j('#container_track_'+mvd_id).width() + |
| 299 | + ' slider_width: ' + $j('#resize_'+mvd_id).width()); |
| 300 | + //add an additional flag |
| 301 | + var cur_handle = ''; |
| 302 | + $j('.ui-resizable-handle').mousedown( function(){ |
| 303 | + js_log('hid: ' + this.id); |
| 304 | + cur_handle = this.id; |
| 305 | + }); |
| 306 | + org_start = org_end =''; |
| 307 | + //jQuery slider: |
| 308 | + $j('#resize_'+mvd_id).resizable({ |
| 309 | + minWidth: 10, |
| 310 | + maxWidth: $j('#resize_'+mvd_id).width(), |
| 311 | + minHeight: 20, |
| 312 | + maxHeight: 20, |
| 313 | + handles: { |
| 314 | + e: '.ui-resizable-e', |
| 315 | + w: '.ui-resizable-w' |
| 316 | + }, |
| 317 | + start: function(e,ui) { |
| 318 | + mv_lock_vid_updates=true; |
| 319 | + org_start = $j('#mv_start_hr_'+mvd_id).val(); |
| 320 | + org_end = $j('#mv_end_hr_'+mvd_id).val(); |
| 321 | + //js_log("org maxWidth: " + ui.options.maxWidth); |
| 322 | + right_x = ( $j('#resize_'+mvd_id).position().left+ |
| 323 | + $j('#resize_'+mvd_id).width() |
| 324 | + ); |
| 325 | + /*js_log('left:' + $j('#resize_'+mvd_id).position().left + ' width: '+ |
| 326 | + * $j('#resize_'+mvd_id).width() + ' right_x:'+ right_x); |
| 327 | + */ |
| 328 | + if(cur_handle.indexOf('handle1')!=-1){ |
| 329 | + ui.options.maxWidth= right_x; |
| 330 | + }else{ |
| 331 | + ui.options.maxWidth= ( |
| 332 | + $j('#container_track_'+mvd_id).width() - |
| 333 | + $j('#resize_'+mvd_id).position().left |
| 334 | + ); |
| 335 | + } |
| 336 | + js_log("updated maxWidth: " + ui.options.maxWidth); |
| 337 | + //js_log('grabbed: ' + e.explicitOriginalTarget.id); |
| 338 | + //console.log('start ', ui); |
| 339 | + }, |
| 340 | + stop: function(e,ui) { |
| 341 | + mv_lock_vid_updates=false; |
| 342 | + //console.log('stop ', ui); |
| 343 | + //return the non-adjusted to its original value: |
| 344 | + if(cur_handle.indexOf('handle1')!=-1){ |
| 345 | + $j('#mv_end_hr_'+mvd_id).val(org_end); |
| 346 | + }else{ |
| 347 | + $j('#mv_start_hr_'+mvd_id).val(org_start); |
| 348 | + } |
| 349 | + //update the clip |
| 350 | + do_video_time_update($j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
| 351 | + }, |
| 352 | + resize: function(e,ui) { |
| 353 | + base_offset = ntp2seconds( $j('#track_time_start_'+mvd_id).html()); |
| 354 | + mv_slider_update_stats(mvd_id); |
| 355 | + } |
| 356 | + }); |
| 357 | + $j('#dragSpan_'+mvd_id).css('cursor','move'); |
| 358 | + $j('#resize_'+mvd_id).draggable({ |
| 359 | + axis:'x', |
| 360 | + containment:'parent', |
| 361 | + handle: "#dragSpan_"+mvd_id, |
| 362 | + drag:function(e, ui){ |
| 363 | + mv_slider_update_stats(mvd_id, true); |
| 364 | + }, |
| 365 | + stop:function(e,ui){ |
| 366 | + $j('#resize_'+mvd_id).css('top', 0); |
| 367 | + do_video_time_update($j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
| 368 | + } |
| 369 | + }); |
| 370 | + //store the necessary values in the slider obj |
| 371 | + //mv_sliders[mvd_id]['base_offset']=base_offset; |
| 372 | + //mv_sliders[mvd_id]['track_dur']=track_dur; |
| 373 | + function mv_slider_update_stats(mvd_id, drag){ |
| 374 | + var update_start=update_end=false; |
| 375 | + //only update the side we are dragging: |
| 376 | + if(cur_handle.indexOf('handle1')!=-1){ |
| 377 | + update_start=true; |
| 378 | + }else{ |
| 379 | + update_end=true; |
| 380 | + } |
| 381 | + if(drag)update_end=update_start=true; |
| 382 | + if(update_end){ |
| 383 | + var end_time = base_offset + (track_dur *(($j('#resize_'+mvd_id).position().left + |
| 384 | + $j('#resize_'+mvd_id).width()) / |
| 385 | + $j('#container_track_'+mvd_id).width())); |
| 386 | + if(end_time>(track_dur+base_offset))end_time=track_dur+base_offset; |
| 387 | + $j('#mv_end_hr_'+mvd_id).val( seconds2ntp(end_time) ); |
| 388 | + } |
| 389 | + if(update_start) |
| 390 | + $j('#mv_start_hr_'+mvd_id).val( seconds2ntp(base_offset + (track_dur *($j('#resize_'+mvd_id).position().left / |
| 391 | + $j('#container_track_'+mvd_id).width()) ) )); |
| 392 | + } |
| 393 | +} |
| 394 | +function do_video_time_update(start_time, end_time, mvd_id) { |
| 395 | + js_log('do_video_time_update: ' +start_time + end_time); |
| 396 | + if(mv_lock_vid_updates==false){ |
| 397 | + //update the vid title: |
| 398 | + $j('#mv_videoPlayerTime').html( start_time + ' to ' + end_time ); |
| 399 | + var ebvid = $j('#embed_vid').get(0); |
| 400 | + if(ebvid.isPaused()) |
| 401 | + ebvid.stop(); |
| 402 | + $j('#embed_vid').get(0).updateVideoTime(start_time, end_time); |
| 403 | + js_log('update thumb: '+ start_time); |
| 404 | + ebvid.updateThumbTimeNTP( start_time ); |
| 405 | + } |
146 | 406 | } |
\ No newline at end of file |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/slider_handle_red.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/slider_handle_red.gif |
___________________________________________________________________ |
Added: svn:mime-type |
147 | 407 | + application/octet-stream |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/slider_handle_green.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/slider_handle_green.gif |
___________________________________________________________________ |
Added: svn:mime-type |
148 | 408 | + application/octet-stream |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/slider_handle.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/slider_handle.gif |
___________________________________________________________________ |
Added: svn:executable |
149 | 409 | + * |
Added: svn:mime-type |
150 | 410 | + application/octet-stream |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/styles.css |
— | — | @@ -311,7 +311,7 @@ |
312 | 312 | width: 183px; |
313 | 313 | overflow: hidden; |
314 | 314 | position: absolute; |
315 | | - z-index: 2; |
| 315 | + z-index: 100; |
316 | 316 | /* margin: 0 0 0 230px;*/ |
317 | 317 | } |
318 | 318 | *:first-child+html .videoOptions {margin-top: -20px;} |
— | — | @@ -484,23 +484,30 @@ |
485 | 485 | #resizable css: |
486 | 486 | .ui-resizable-handle { position: absolute; background: #ddd; display: none; } |
487 | 487 | .ui-resizable .ui-resizable-handle { display: block } |
488 | | -.ui-resizable-e { z-index:5; position:absolute; cursor: e-resize; width: 15px;height:19px; top: 0px; bottom: 0px; right: 0px;} |
489 | | -.ui-resizable-w { z-index:5; position:absolute; cursor: w-resize; width: 15px;height:19px; top: 0px; bottom: 0px; left: 0px;} |
| 488 | +.ui-resizable-e { z-index:5; position:absolute; cursor: e-resize; |
| 489 | + width: 15px;height:19px; top: 0px; bottom: 0px; right: 0px; |
| 490 | + background: transparent url(images/slider_handle_red.gif) no-repeat scroll 0% 0%; |
| 491 | +} |
| 492 | +.ui-resizable-w { z-index:5; position:absolute; cursor: w-resize; |
| 493 | + width: 15px;height:19px; top: 0px; bottom: 0px; left: 0px; |
| 494 | + background: transparent url(images/slider_handle_green.gif) no-repeat scroll 0% 0%; |
| 495 | +} |
490 | 496 | .ui-dragSpan {filter: alpha(opacity=70); -moz-opacity: .7; background-color:#AAF; position:absolute; left: 10px; right:10px;height:19px; } |
491 | 497 | |
492 | 498 | #remote search css: |
| 499 | + |
493 | 500 | ul.rsd_cp_tabs { |
494 | 501 | border-bottom:1px solid #CCCCCC; |
495 | 502 | display:inline; |
496 | 503 | list-style-image:none; |
497 | 504 | list-style-position:outside; |
498 | 505 | list-style-type:none; |
499 | | - z-index:2; |
| 506 | + z-index:2; |
500 | 507 | } |
501 | 508 | ul.rsd_cp_tabs li.rsd_selected { |
502 | 509 | background:#FFFFFF none repeat scroll 0 0; |
503 | 510 | border-bottom:0; |
504 | | - padding-bottom:1px; |
| 511 | + padding-bottom:7px; |
505 | 512 | padding-top:12px; |
506 | 513 | top:40px; |
507 | 514 | } |
— | — | @@ -510,7 +517,7 @@ |
511 | 518 | padding:10px 0 0; |
512 | 519 | background:#F7F7F7 url(remote_search/tab-bg.png) repeat-x scroll left bottom; |
513 | 520 | border:1px solid #777; |
514 | | - padding-bottom:0; |
| 521 | + padding-bottom:6px; |
515 | 522 | margin-left:7px; |
516 | 523 | cursor:pointer; |
517 | 524 | } |
— | — | @@ -575,3 +582,18 @@ |
576 | 583 | .mv_scale_button_selected{ |
577 | 584 | background-image: url('images/stock-tool-button-scale_over.png'); |
578 | 585 | } |
| 586 | +.mv_loading_img{ |
| 587 | + width:32px; |
| 588 | + height:32px; |
| 589 | + display:inline; |
| 590 | + padding:0px; |
| 591 | + position:absolute; |
| 592 | + background-image: url('images/loading_ani.gif'); |
| 593 | +} |
| 594 | +.mv_loading_bar_img{ |
| 595 | + width:220px; |
| 596 | + height:19px; |
| 597 | + display:inline; |
| 598 | + position:absolute; |
| 599 | + background-image: url('images/loading_bar_ani.gif'); |
| 600 | +} |
\ No newline at end of file |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js |
— | — | @@ -136,8 +136,7 @@ |
137 | 137 | function mv_get_loading_img( style , class ){ |
138 | 138 | var style_txt = (style)?style:''; |
139 | 139 | var class_attr = (class)?'class="'+class+'"':'class="mv_loading_img"'; |
140 | | - return '<img '+class_attr+' style="' + style +'" src="'+ |
141 | | - mv_embed_path + 'skins/' + mv_skin_name + '/images/loading_ani.gif">'; |
| 140 | + return '<div '+class_attr+' style="' + style +'"></div>'; |
142 | 141 | } |
143 | 142 | |
144 | 143 | /* the base video control JSON object with default attributes |
— | — | @@ -213,7 +212,8 @@ |
214 | 213 | pc:null, //used to store pointer to parent clip (when in playlist mode) |
215 | 214 | load_libs:function( callback , target_id){ |
216 | 215 | //js_log('f:load_libs: '+callback); |
217 | | - if(callback)this.load_callback = callback; |
| 216 | + if( callback )this.load_callback = callback; |
| 217 | + |
218 | 218 | //if libs are already loaded jump directly to the callback |
219 | 219 | if(this.libs_loaded){ |
220 | 220 | mvEmbed.init( target_id ); |
— | — | @@ -272,7 +272,7 @@ |
273 | 273 | //js_log('f:check_init_done '+ is_ready + ' ' + cur_vid.load_error + ' rtp: '+ cur_vid.ready_to_play); |
274 | 274 | if( !is_ready ){ |
275 | 275 | //js_log('some ' + global_player_list + ' not ready'); |
276 | | - setTimeout( 'mvEmbed.check_init_done()', 250 ); |
| 276 | + setTimeout( 'mvEmbed.check_init_done()', 50 ); |
277 | 277 | }else{ |
278 | 278 | //call the callback: |
279 | 279 | if(typeof this.load_callback == 'function') |
— | — | @@ -993,10 +993,10 @@ |
994 | 994 | /* |
995 | 995 | * this function allows for targeted rewriting |
996 | 996 | */ |
997 | | -function rewrite_by_id( vid_id ){ |
| 997 | +function rewrite_by_id( vid_id, ready_callback ){ |
998 | 998 | js_log('f:rewrite_by_id: ' + vid_id); |
999 | 999 | //force a recheck of the dom for playlist or video element: |
1000 | | - mvEmbed.load_libs( vid_id ); |
| 1000 | + mvEmbed.load_libs( ready_callback, vid_id ); |
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | |
— | — | @@ -1033,7 +1033,7 @@ |
1034 | 1034 | var loadPlaylistLib=false; |
1035 | 1035 | //set up the jQuery selector: |
1036 | 1036 | var j_selector = 'video,playlist'; |
1037 | | - if( force_id!=null ) |
| 1037 | + if( force_id !=null ) |
1038 | 1038 | var j_selector = '#'+force_id; |
1039 | 1039 | |
1040 | 1040 | //process selected elements: |
— | — | @@ -1271,7 +1271,7 @@ |
1272 | 1272 | * @param {String} end_time in NTP format |
1273 | 1273 | */ |
1274 | 1274 | updateSrcTime:function (start_ntp, end_ntp){ |
1275 | | - js_log("f:updateSrcTime: "+ start_ntp+'/'+ end_ntp + ' from org: ' + this.start_ntp+ '/'+this.end_ntp); |
| 1275 | + //js_log("f:updateSrcTime: "+ start_ntp+'/'+ end_ntp + ' from org: ' + this.start_ntp+ '/'+this.end_ntp); |
1276 | 1276 | //js_log("pre uri:" + this.src); |
1277 | 1277 | //if we have time we can use: |
1278 | 1278 | if( this.supports_url_time_encoding ){ |
— | — | @@ -1386,7 +1386,7 @@ |
1387 | 1387 | this.start_offset = 0; |
1388 | 1388 | this.start_ntp = seconds2ntp(this.start_offset); |
1389 | 1389 | } |
1390 | | - js_log('f:parseURLDuration() for:' + this.src + ' d:' + this.duration); |
| 1390 | + //js_log('f:parseURLDuration() for:' + this.src + ' d:' + this.duration); |
1391 | 1391 | }, |
1392 | 1392 | /** Attempts to detect the type of a media file based on the URI. |
1393 | 1393 | @param {String} uri URI of the media file. |
— | — | @@ -2266,7 +2266,11 @@ |
2267 | 2267 | 'width:' + options.width + 'px">' + |
2268 | 2268 | '</div>'; |
2269 | 2269 | }, |
| 2270 | + updateThumbTimeNTP:function( time){ |
| 2271 | + this.updateThumbTime( ntp2seconds(time) - parseInt(this.start_offset) ); |
| 2272 | + }, |
2270 | 2273 | updateThumbTime:function( float_sec ){ |
| 2274 | + js_log('updateThumbTime:'+float_sec); |
2271 | 2275 | var _this = this; |
2272 | 2276 | if( typeof this.org_thum_src=='undefined' ){ |
2273 | 2277 | this.org_thum_src = this.media_element.getThumbnailURL(); |
— | — | @@ -2285,6 +2289,7 @@ |
2286 | 2290 | }, |
2287 | 2291 | //updates the thumbnail if the thumbnail is being displayed |
2288 | 2292 | updateThumbnail : function(src, quick_switch){ |
| 2293 | + js_log('update thumb: ' + src); |
2289 | 2294 | //make sure we don't go to the same url if we are not already updating: |
2290 | 2295 | if( !this.thumbnail_updating && $j('#img_thumb_'+this.id).attr('src')== src ) |
2291 | 2296 | return false; |
— | — | @@ -2427,7 +2432,7 @@ |
2428 | 2433 | //@@todo support position config |
2429 | 2434 | var loc = $j(this).position(); |
2430 | 2435 | if($j('#metaBox_'+this.id).length==0){ |
2431 | | - $j(this).after('<div style="position:absolute;z-index:' + ($j(this).css("zindex") + 1) + ';'+ |
| 2436 | + $j(this).after('<div style="position:absolute;z-index:10;'+ |
2432 | 2437 | 'top:' + (loc.top) + 'px;' + |
2433 | 2438 | 'left:' + (parseInt( loc.left ) + parseInt(this.width) + 10 )+'px;' + |
2434 | 2439 | 'height:'+ parseInt( this.height )+'px;width:400px;' + |
— | — | @@ -2673,15 +2678,6 @@ |
2674 | 2679 | $j('#'+this_id).get(0).play(); |
2675 | 2680 | }); |
2676 | 2681 | }, |
2677 | | - /*play_or_pause: function(){ |
2678 | | - js_log('embed:f:play_or_pause'); |
2679 | | - //check state and set play or pause |
2680 | | - if(this.paused){ |
2681 | | - this.play(); |
2682 | | - }else{ |
2683 | | - this.pause(); |
2684 | | - } |
2685 | | - },*/ |
2686 | 2682 | /* |
2687 | 2683 | * base embed stop (can be overwritten by the plugin) |
2688 | 2684 | */ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_flashEmbed.js |
— | — | @@ -1643,14 +1643,16 @@ |
1644 | 1644 | pause : function() |
1645 | 1645 | { |
1646 | 1646 | this.getFLA(); |
1647 | | - this.parent_pause(); |
1648 | | - if(this.fla){ |
1649 | | - js_log("Flash:Pause: " + this.fla.isPaused() ); |
1650 | | - if( this.fla['pause'] ){ |
1651 | | - if( ! this.fla.isPaused() ){ |
1652 | | - js_log('calling plugin pause'); |
1653 | | - this.fla.pause(); |
1654 | | - } |
| 1647 | + if(!this.thumbnail_disp){ |
| 1648 | + this.parent_pause(); |
| 1649 | + if(this.fla){ |
| 1650 | + js_log("Flash:Pause: " + this.fla.isPaused() ); |
| 1651 | + if( this.fla['pause'] ){ |
| 1652 | + if( ! this.fla.isPaused() ){ |
| 1653 | + js_log('calling plugin pause'); |
| 1654 | + this.fla.pause(); |
| 1655 | + } |
| 1656 | + } |
1655 | 1657 | } |
1656 | 1658 | } |
1657 | 1659 | }, |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libRemoteMediaSearch/mv_remote_media_search.js |
— | — | @@ -23,12 +23,15 @@ |
24 | 24 | |
25 | 25 | 'caret_pos':null, |
26 | 26 | 'local_wiki_api_url':null, |
| 27 | + 'target_title':null, |
27 | 28 | |
28 | 29 | 'target_textbox':null, |
29 | 30 | 'instance_name': null, //a globally accessible callback instance name |
30 | 31 | 'default_query':'', //default search query |
31 | 32 | //specific to sequence profile |
32 | | - 'p_seq':null |
| 33 | + 'p_seq':null, |
| 34 | + 'cFileNS':'Image' //what is the cannonical namespace for images |
| 35 | + //@@todo (should be able to get that from the api in the future) |
33 | 36 | } |
34 | 37 | var remoteSearchDriver = function(initObj){ |
35 | 38 | return this.init( initObj ); |
— | — | @@ -69,28 +72,33 @@ |
70 | 73 | 'wiki_commons':{ |
71 | 74 | 'enabled':1, |
72 | 75 | 'checked':1, |
73 | | - 'd' :1, |
| 76 | + 'd' :0, |
74 | 77 | 'title' :'Wikipedia Commons', |
75 | 78 | 'desc' : 'Wikimedia Commons is a media file repository making available public domain '+ |
76 | 79 | 'and freely-licensed educational media content (images, sound and video clips) to all.', |
77 | 80 | 'homepage': 'http://commons.wikimedia.org/wiki/Main_Page', |
78 | 81 | 'api_url':'http://commons.wikimedia.org/w/api.php', |
79 | | - 'lib' :'mediaWiki', |
80 | | - 'search_title':false, //disable title search |
| 82 | + 'lib' :'mediaWiki', |
81 | 83 | 'local' :false, |
82 | | - 'resource_prefix': 'WC_' //prefix on imported resources (not applicable if the repository is local) |
| 84 | + 'resource_prefix': 'WC_', //prefix on imported resources (not applicable if the repository is local) |
| 85 | + |
| 86 | + //specific to wiki comons config: |
| 87 | + 'search_title':false //disable title search |
83 | 88 | }, |
84 | 89 | 'metavid':{ |
85 | 90 | 'enabled':1, |
86 | 91 | 'checked':1, |
87 | | - 'd' :0, |
| 92 | + 'd' :1, |
88 | 93 | 'title' :'Metavid.org', |
89 | 94 | 'homepage':'http://metavid.org', |
90 | 95 | 'desc' : 'Metavid hosts thousands of hours of US house and senate floor proceedings', |
91 | | - 'api_url':'http://localhost/wiki/index.php?title=Special:MvExportSearch', |
| 96 | + 'api_url':'http://metavid.org/w/index.php?title=Special:MvExportSearch', |
92 | 97 | 'lib' : 'metavid', |
93 | | - 'local' :false, |
94 | | - 'resource_prefix': 'MV_' //what prefix to use on imported resources |
| 98 | + 'local' :false, //if local set to true we can use local |
| 99 | + 'resource_prefix': 'MV_', //what prefix to use on imported resources |
| 100 | + |
| 101 | + 'local_copy': true //if local_copy set to true if we should download assets |
| 102 | + //(else just remote embed copy) |
95 | 103 | }, |
96 | 104 | 'archive_org':{ |
97 | 105 | 'enabled':0, |
— | — | @@ -141,12 +149,12 @@ |
142 | 150 | getTexboxSelection:function(){ |
143 | 151 | if(this.caret_pos.s && this.caret_pos.e && |
144 | 152 | (this.caret_pos.s != this.caret_pos.e)) |
145 | | - this.default_query = caret_pos.text.substring(this.caret_pos.s, this.caret_pos.e).replace(/ /g, '\xa0') || '\xa0' |
| 153 | + this.default_query = this.caret_pos.text.substring(this.caret_pos.s, this.caret_pos.e).replace(/ /g, '\xa0') || '\xa0' |
146 | 154 | }, |
147 | 155 | //sets up the initial html interface |
148 | 156 | init_interface_html:function(){ |
149 | 157 | var out = '<div class="rsd_control_container" style="width:100%">' + |
150 | | - '<table style="width:100%">' + |
| 158 | + '<table style="width:100%;background-color:transparent;">' + |
151 | 159 | '<tr>'+ |
152 | 160 | '<td style="width:110px">'+ |
153 | 161 | '<h3> Media Search </h3>'+ |
— | — | @@ -197,11 +205,8 @@ |
198 | 206 | var _this = this; |
199 | 207 | js_log("add_interface_bindings:"); |
200 | 208 | //setup for this.main_search_options: |
201 | | - $j('#mso_cancel').click(function(){ |
202 | | - $j('#modalbox').fadeOut("normal",function(){ |
203 | | - $j(this).remove(); |
204 | | - $j('#mv_overlay').remove(); |
205 | | - }); |
| 209 | + $j('#mso_cancel').click(function(){ |
| 210 | + _this.closeAll(); |
206 | 211 | }); |
207 | 212 | |
208 | 213 | $j('#mso_selprovider,#mso_selprovider_close').click(function(){ |
— | — | @@ -229,8 +234,8 @@ |
230 | 235 | var _this = this; |
231 | 236 | //set loading div: |
232 | 237 | $j('#rsd_results').append('<div style="position:absolute;top:0px;left:0px;height:100%;width:100%;'+ |
233 | | - 'background-color:#FFF;margin:30px">' + |
234 | | - mv_get_loading_img('padding:30px') + |
| 238 | + 'background-color:#FFF;">' + |
| 239 | + mv_get_loading_img('top:30px;left:30px') + |
235 | 240 | '</div>'); |
236 | 241 | //get a remote search object for each search provider and run the search |
237 | 242 | for(var cp_id in this.content_providers){ |
— | — | @@ -272,7 +277,7 @@ |
273 | 278 | drawTabs: function(){ |
274 | 279 | var _this = this; |
275 | 280 | //add the tabs to the rsd_results container: |
276 | | - var o= '<ul class="rsd_cp_tabs" style="margin-bottom:2px;">'; //no idea why margin-bottom does not work in the css file |
| 281 | + var o= '<ul class="rsd_cp_tabs" style="margin: 1em 0 0 1em;position:absolute;top:42px;padding:0;">'; //no idea why margin does not overwrite from the css |
277 | 282 | o+='<li id="rsd_tab_combined" ><img src="' + mv_embed_path + 'skins/'+mv_skin_name+ '/remote_search/combined_tab.png"></li>'; |
278 | 283 | for(var cp_id in this.content_providers){ |
279 | 284 | var cp = this.content_providers[cp_id]; |
— | — | @@ -308,7 +313,7 @@ |
309 | 314 | return false; |
310 | 315 | }, |
311 | 316 | drawOutputResults: function(){ |
312 | | - js_log('f:drawOutputResults'); |
| 317 | + js_log('f:drawOutputResults'); |
313 | 318 | var _this = this; |
314 | 319 | var o=''; |
315 | 320 | $j('#rsd_results').empty(); |
— | — | @@ -344,29 +349,42 @@ |
345 | 350 | this.addResultBindings(); |
346 | 351 | }, |
347 | 352 | addResultBindings:function(){ |
348 | | - var _this = this; |
| 353 | + var _this = this; |
349 | 354 | $j('.mv_clip_box_result').hover(function(){ |
350 | 355 | $j(this).addClass('mv_clip_box_result_over'); |
351 | 356 | },function(){ |
352 | 357 | $j(this).removeClass('mv_clip_box_result_over'); |
353 | | - }); |
| 358 | + }); |
354 | 359 | //resource click action: (bring up the resource editor) |
355 | 360 | $j('.rsd_res_item').click(function(){ |
356 | 361 | //get the resource obj: |
357 | | - rObj = _this.getResourceFromId( this.id ); |
| 362 | + var rObj = _this.getResourceFromId( this.id ); |
358 | 363 | //remove any existing resource edit interface: |
359 | | - $j('#rsd_resource_edit').remove(); |
| 364 | + $j('#rsd_resource_edit').remove(); |
| 365 | + |
| 366 | + //set the media type: |
| 367 | + if(rObj.mime.indexOf('image')!=-1){ |
| 368 | + //set width to default image_edit_width |
| 369 | + var maxWidth = _this.image_edit_width; |
| 370 | + var mediaType = 'image'; |
| 371 | + }else{ |
| 372 | + //set to default video size: |
| 373 | + var maxWidth = _this.video_edit_width; |
| 374 | + var mediaType = 'video'; |
| 375 | + } |
| 376 | + //so that transcripts show ontop |
| 377 | + var overflow_style = ( mediaType =='video' )?'':'overflow:auto;'; |
360 | 378 | //append to the top level of model window: |
361 | 379 | $j( '#'+ _this.target_id ).append('<div id="rsd_resource_edit" '+ |
362 | 380 | 'style="position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:#FFF;">' + |
363 | 381 | '<h3 style="margin:4px;">' + getMsg('rsd_resource_edit') + ' ' + rObj.title +'</h3>'+ |
364 | | - '<div id="clip_edit_disp" style="position:absolute;top:30px;left:0px;bottom:0px;'+ |
365 | | - 'width:' + (_this.image_edit_width+30) + 'px;overflow:auto;" >' + |
| 382 | + '<div id="clip_edit_disp" style="position:absolute;'+overflow_style+'top:30px;left:0px;bottom:0px;'+ |
| 383 | + 'width:' + (maxWidth + 30) + 'px;" >' + |
366 | 384 | mv_get_loading_img('position:absolute;top:30px;left:30px', 'mv_img_loader') + |
367 | 385 | '</div>'+ |
368 | 386 | '<div id="clip_edit_ctrl" style="position:absolute;border:solid thin blue;'+ |
369 | | - 'top:30px;left:' + (_this.image_edit_width+30) +'px;bottom:0px;right:0px;">'+ |
370 | | - mv_get_loading_img('padding:30px') + |
| 387 | + 'top:30px;left:' + (maxWidth+30) +'px;bottom:0px;right:0px;">'+ |
| 388 | + mv_get_loading_img() + |
371 | 389 | '</div>'+ |
372 | 390 | '</div>'); |
373 | 391 | $j('#rsd_resource_edit').css('opacity',0); |
— | — | @@ -380,15 +398,7 @@ |
381 | 399 | 'left':'20%', |
382 | 400 | 'opacity':0 |
383 | 401 | }); |
384 | | - if(rObj.mime.indexOf('image')!=-1){ |
385 | | - //set width to default image_edit_width |
386 | | - var maxWidth = _this.image_edit_width; |
387 | | - var mediaType = 'image'; |
388 | | - }else{ |
389 | | - //set to default video size: |
390 | | - var maxWidth = _this.video_edit_width; |
391 | | - var mediaType = 'video'; |
392 | | - } |
| 402 | + |
393 | 403 | //assume we keep aspect ratio for the thumbnail that we clicked: |
394 | 404 | var tRatio = $j(this).height() / $j(this).width(); |
395 | 405 | if( ! tRatio ) |
— | — | @@ -436,7 +446,7 @@ |
437 | 447 | js_log('using req size: ' + imObj.width + 'x' + imObj.height); |
438 | 448 | $j('#'+target_img_id).animate( {'width':imObj.width+'px', 'height' : imObj.height + 'px'}); |
439 | 449 | } |
440 | | - //don't swap it in untill its loaded: |
| 450 | + //don't swap it in until its loaded: |
441 | 451 | var img = new Image(); |
442 | 452 | // load the image image: |
443 | 453 | $j(img).load(function () { |
— | — | @@ -457,23 +467,32 @@ |
458 | 468 | 'clip_disp_ct':'clip_edit_disp', |
459 | 469 | 'control_ct': 'clip_edit_ctrl', |
460 | 470 | 'media_type': mediaType, |
461 | | - 'p_rsdObj': _this |
462 | | - |
| 471 | + 'p_rsdObj': _this |
463 | 472 | }; |
464 | 473 | var loadLibs = {'mvClipEdit':'libSequencer/mv_clipedit.js'}; |
465 | 474 | if( mediaType == 'image'){ |
466 | 475 | //load the croping library: |
467 | 476 | loadLibs['$j.Jcrop']='jquery/plugins/Jcrop/js/jquery.Jcrop.js'; |
468 | 477 | //@@todo integrate css calls into mvJsLoader or move jcrop css |
469 | | - loadExternalCss( mv_embed_path + 'jquery/plugins/Jcrop/css/jquery.Jcrop.css'); |
470 | | - } |
471 | | - //load the library: |
472 | | - mvJsLoader.doLoad( loadLibs, |
473 | | - function(){ |
474 | | - js_log('done loading libs: mvClipEdit + Jcrop'); |
| 478 | + loadExternalCss( mv_embed_path + 'jquery/plugins/Jcrop/css/jquery.Jcrop.css'); |
| 479 | + //display the mvClipEdit obj once we are done loading: |
| 480 | + mvJsLoader.doLoad( loadLibs,function(){ |
475 | 481 | //run the image clip tools |
476 | 482 | _this.cEdit = new mvClipEdit( mvClipInit ); |
477 | | - }); |
| 483 | + }); |
| 484 | + } |
| 485 | + if( mediaType == 'video'){ |
| 486 | + $j('#clip_edit_disp').append('<video id="embed_vid" roe="'+ rObj['roe_url']+'"></video>'); |
| 487 | + //rewrite by id hanldes getting any libs we are missing: |
| 488 | + rewrite_by_id('embed_vid',function(){ |
| 489 | + //add the resizable to the doLoad request: |
| 490 | + loadLibs['$j.ui.resizable'] = 'jquery/jquery.ui-1.5.2/ui/minified/ui.resizable.min.js', |
| 491 | + mvJsLoader.doLoad( loadLibs,function(){ |
| 492 | + //run the image clip tools |
| 493 | + _this.cEdit = new mvClipEdit( mvClipInit ); |
| 494 | + }); |
| 495 | + }); |
| 496 | + } |
478 | 497 | }, |
479 | 498 | checkImportResource:function( rObj, cir_callback){ |
480 | 499 | //check if the resource is "locally accesible" |
— | — | @@ -485,23 +504,25 @@ |
486 | 505 | var cp = rObj.pSobj.cp; |
487 | 506 | |
488 | 507 | //first check if the resource is not already on this wiki: |
489 | | - //@@todo get the File Msg |
490 | | - var cFileNS= 'Image' |
491 | | - var target_resource_title = cp.resource_prefix + rObj.titleKey.substr( cFileNS.length + 1 ); |
492 | | - reqObj={'action':'query', titles: cFileNS + ':' + target_resource_title + '|' + rObj.titleKey}; |
| 508 | + //@@todo get the File/Image namespace name: |
| 509 | + rObj.target_resource_title = rObj.titleKey.replace(/File:|Image:/,''); |
| 510 | + |
| 511 | + reqObj={'action':'query', titles: _this.cFileNS + ':' + rObj.target_resource_title + '|' + rObj.titleKey}; |
493 | 512 | do_api_req( reqObj, this.local_wiki_api_url, function(data){ |
494 | 513 | var found_title = false; |
495 | 514 | for(var i in data.query.pages){ |
496 | | - if(i>0) |
497 | | - found_title=true; |
| 515 | + if( i != '-1' && i != '-2' ){ |
| 516 | + js_log('found title: ' + i + ':' + data.query.pages[i]['title']); |
| 517 | + found_title=data.query.pages[i]['title']; |
| 518 | + } |
498 | 519 | } |
499 | 520 | if( found_title ){ |
| 521 | + js_log("checkImportResource:found title:" + found_title); |
500 | 522 | //resource is already present (or resource with same name is already present) |
501 | | - js_log("checkImportResource:resource is already present: {"+ |
502 | | - cp.resource_prefix + '}' + rObj.titleKey); |
| 523 | + rObj.target_resource_title = found_title.replace(/File:|Image:/,''); |
503 | 524 | cir_callback( rObj ); |
504 | 525 | }else{ |
505 | | - js_log("resource not present: update:"+ cFileNS + ':' + target_resource_title); |
| 526 | + js_log("resource not present: update:"+ _this.cFileNS + ':' + rObj.target_resource_title); |
506 | 527 | |
507 | 528 | //setup the resource description from resource description: |
508 | 529 | var base_resource_desc = '{{Information '+"\n"+ |
— | — | @@ -538,7 +559,7 @@ |
539 | 560 | '<div id="rds_edit_import_container" style="position:absolute;left:50%;' + |
540 | 561 | 'bottom:0px;top:30px;right:0px;overflow:auto;">'+ |
541 | 562 | '<strong>Local Resource Title:</strong><br>'+ |
542 | | - '<input type="text" size="30" value="' + target_resource_title + '" readonly="true"><br>'+ |
| 563 | + '<input type="text" size="30" value="' + rObj.target_resource_title + '" readonly="true"><br>'+ |
543 | 564 | '<strong>Edit WikiText Resource Description:</strong>(will be replaced by forms soon)'+ |
544 | 565 | '<textarea id="rsd_import_ta" id="mv_img_desc" rows="8" cols="50">'+ |
545 | 566 | base_resource_desc + |
— | — | @@ -552,7 +573,7 @@ |
553 | 574 | //output the rendered and non-renderd version of description for easy swiching: |
554 | 575 | '</div>'); |
555 | 576 | //load the preview text: |
556 | | - _this.getParsedWikiText( base_resource_desc, cFileNS +':'+ target_resource_title, function( o ){ |
| 577 | + _this.getParsedWikiText( base_resource_desc, _this.cFileNS +':'+ rObj.target_resource_title, function( o ){ |
557 | 578 | $j('#rsd_import_desc').html(o); |
558 | 579 | }); |
559 | 580 | //add bidings: |
— | — | @@ -561,14 +582,14 @@ |
562 | 583 | mv_get_loading_img() |
563 | 584 | ); |
564 | 585 | //load the preview text: |
565 | | - _this.getParsedWikiText( $j('#rsd_import_ta').val(), cFileNS +':'+ target_resource_title, function( o ){ |
| 586 | + _this.getParsedWikiText( $j('#rsd_import_ta').val(), _this.cFileNS +':'+ rObj.target_resource_title, function( o ){ |
566 | 587 | js_log('got updated preivew: '+ o); |
567 | 588 | $j('#rsd_import_desc').html(o); |
568 | 589 | }); |
569 | 590 | }); |
570 | 591 | $j('#rsd_import_doimport').click(function(){ |
571 | 592 | //replace the parent with progress bar: |
572 | | - $j('rsd_resource_import').html( |
| 593 | + $j('#rsd_resource_import').html( |
573 | 594 | '<h3>Importing asset</h3>'+ |
574 | 595 | mv_get_loading_img() |
575 | 596 | ); |
— | — | @@ -592,41 +613,46 @@ |
593 | 614 | var postVars = { |
594 | 615 | 'wpSourceType' :'web', |
595 | 616 | 'wpUploadFileURL' : rObj.url, |
596 | | - 'wpDestFile' : target_resource_title, |
| 617 | + 'wpDestFile' : rObj.target_resource_title, |
597 | 618 | 'wpUploadDescription':$j('#rsd_import_ta').val(), |
598 | 619 | 'wpWatchthis' : $j('#wpWatchthis').val(), |
599 | 620 | 'wpUpload' : 'Upload file' |
600 | 621 | } |
601 | 622 | //set to uploading: |
602 | 623 | $j('#rsd_resource_import').append('<div id="rsd_import_progress"'+ |
603 | | - 'style="position:abolute;top:0px;"'+ |
| 624 | + 'style="position:absolute;top:0px;'+ |
604 | 625 | 'left:0px;width:100%;height:100%;'+ |
605 | | - 'z-index:4;background:#555;">'+ |
606 | | - '<div style="left:30%;right:30%">Importing Asset' + |
607 | | - mv_get_loading_img() + |
608 | | - '</dvi>'+ |
| 626 | + 'z-index:5;background:#FFF;overflow:auto;">'+ |
| 627 | + '<div style="position:absolute;left:30%;right:30%"><h3>Importing Asset</h3><br>' + |
| 628 | + mv_get_loading_img('','mv_loading_bar_img') + |
| 629 | + '</div>'+ |
609 | 630 | '</div>' |
610 | | - ); |
| 631 | + ); |
| 632 | + $j.post(wgArticlePath.replace(/\$1/,'Special:Upload'), |
| 633 | + postVars, |
| 634 | + function(data){ |
| 635 | + //@@todo this will be replaced once we add upload image support to the api. |
611 | 636 | |
612 | | - $j.ajax({ |
613 | | - type:"POST", |
614 | | - url: wgArticlePath.replace(/\$1/,'Special:Upload'), |
615 | | - data: postVars, |
616 | | - sucess:function(data, textStatus){ |
617 | | - js_log('success in uploading: '+target_resource_title +' textStatus:'+ textStatus); |
618 | | - //cir_callback with pointer to local resource: |
619 | | - cObj.target_resource_title = target_resource_title; |
620 | | - cir_callback( rObj ) |
621 | | - }, |
622 | | - error:function(XMLHttpRequest, textStatus, errorThrown){ |
623 | | - js_log('error httpReq:' + ' status:' + XMLHttpRequest.status) |
624 | | - }, |
625 | | - complete:function(XMLHttpRequest, textStatus){ |
626 | | - js_log('completed request:' + textStatus + ' status:'+ XMLHttpRequest.status); |
627 | | - rObj.target_resource_title = target_resource_title; |
628 | | - cir_callback( rObj ) |
| 637 | + //very basic test to see if we got passed to the image page: |
| 638 | + //@@todo more normalization stuff |
| 639 | + var sstring ='var wgPageName = "' + _this.cFileNS + ':' + rObj.target_resource_title.replace(/ /g,'_') +'"'; |
| 640 | + if(data.indexOf( sstring ) !=-1){ |
| 641 | + js_log('found: ' + sstring); |
| 642 | + $j('#rsd_resource_import').remove(); |
| 643 | + cir_callback( rObj ); |
| 644 | + }else{ |
| 645 | + js_log("Error or warning: (did not find: \"" + sstring + ' in output' ); |
| 646 | + $j('#rsd_resource_import').html( |
| 647 | + '<b>error importing asset (we should have better error handling soon)</b><br>'+ |
| 648 | + '<a href="#" id="rsd_import_error" >Cancel import</a>' |
| 649 | + ); |
| 650 | + $j('#rsd_import_error').click(function(){ |
| 651 | + $j('#rsd_resource_import').remove(); |
| 652 | + }); |
| 653 | + } |
| 654 | + |
629 | 655 | } |
630 | | - }); |
| 656 | + ); |
631 | 657 | } |
632 | 658 | } |
633 | 659 | }); |
— | — | @@ -646,16 +672,29 @@ |
647 | 673 | this.checkImportResource( rObj, function(){ |
648 | 674 | //put another window ontop: |
649 | 675 | $j( '#'+ _this.target_id ).append('<div id="rsd_resource_preview" '+ |
650 | | - 'style="position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:#FFF;">' + |
651 | | - '<h3>preview resource: ' + rObj.title + '</h3>'+ |
652 | | - '<div id="rsd_preview_display" style="position:absolute;width:100%;bottom:30px;>'+ |
653 | | - mv_get_loading_img('position:absolute;top:30px;left:30px', 'mv_img_loader') + |
654 | | - '</div>'+ |
655 | | - '<div id="rsd_preview_control" style="position:absolute;width:60%;left:40%;bottom:0px;height:30px;">'+ |
656 | | - '<input type="button" id="preview_do_insert" value="Do Insert">'+ |
657 | | - '<a href="#" id="preview_close">Close Preview</a>'+ |
658 | | - '</div>'+ |
| 676 | + 'style="position:absolute;z-index:4;top:0px;left:0px;width:100%;height:100%;background-color:#FFF;">' + |
| 677 | + '<h3>preview insert of resource: ' + rObj.title + '</h3>'+ |
| 678 | + '<div id="rsd_preview_display" style="position:absolute;width:100%;top:30px;bottom:30px;overflow:auto;">' + |
| 679 | + mv_get_loading_img('top:30px;left:30px') + |
| 680 | + '</div>' + |
| 681 | + '<div id="rsd_preview_control" style="position:absolute;width:60%;left:40%;bottom:0px;height:30px;">' + |
| 682 | + '<input type="button" id="preview_do_insert" value="Do Insert">' + |
| 683 | + '<a href="#" id="preview_close">Do More Modification</a>' + |
| 684 | + '</div>' + |
659 | 685 | '</div>'); |
| 686 | + //do a page preview given the original page text, insert point |
| 687 | + js_log('insert at: ' + _this.caret_pos.s + "\n" + rObj.pSobj.getEmbedWikiText( rObj ) ); |
| 688 | + |
| 689 | + //update the preview_wtext |
| 690 | + _this.preview_wtext = _this.caret_pos.text.substring(0, _this.caret_pos.s) + |
| 691 | + rObj.pSobj.getEmbedWikiText( rObj ) + |
| 692 | + _this.caret_pos.text.substring( _this.caret_pos.s ); |
| 693 | + |
| 694 | + _this.getParsedWikiText(_this.preview_wtext, _this.target_title, |
| 695 | + function(phtml){ |
| 696 | + $j('#rsd_preview_display').html( phtml ); |
| 697 | + } |
| 698 | + ); |
660 | 699 | //add bindings: |
661 | 700 | $j('#preview_do_insert').click(function(){ |
662 | 701 | _this.insertResource( rObj ); |
— | — | @@ -675,8 +714,15 @@ |
676 | 715 | }); |
677 | 716 | }, |
678 | 717 | insertResource:function( rObj){ |
679 | | - |
| 718 | + $j('#'+this.target_textbox).val( this.preview_wtext ); |
| 719 | + this.closeAll(); |
680 | 720 | }, |
| 721 | + closeAll:function( rObj ){ |
| 722 | + $j('#modalbox').fadeOut("normal",function(){ |
| 723 | + $j(this).remove(); |
| 724 | + $j('#mv_overlay').remove(); |
| 725 | + }); |
| 726 | + }, |
681 | 727 | setResultBarControl:function( ){ |
682 | 728 | var _this = this; |
683 | 729 | var box_dark_url = mv_embed_path + 'skins/' + mv_skin_name + '/images/box_layout_icon_dark.png'; |
— | — | @@ -824,13 +870,15 @@ |
825 | 871 | } |
826 | 872 | } |
827 | 873 | } |
828 | | - //add pointer to parent serach obj: |
| 874 | + //force a mime type for now.. in the future generalize for other RSS feeds |
| 875 | + rObj['mime'] = 'video/ogg'; |
| 876 | + //add pointer to parent search obj: |
829 | 877 | rObj['pSobj'] = _this; |
830 | 878 | //add the result to the result set: |
831 | 879 | _this.resultsObj[inx] = rObj; |
832 | 880 | }); |
833 | 881 | }, |
834 | | - //by default just retrun the existing image: |
| 882 | + //by default just return the existing image: |
835 | 883 | getImageObj:function( rObj, size, callback){ |
836 | 884 | callback( {'url':rObj.poster} ); |
837 | 885 | } |
— | — | @@ -856,13 +904,7 @@ |
857 | 905 | this['parent_'+i] = baseSearch[i]; |
858 | 906 | } |
859 | 907 | } |
860 | | - }, |
861 | | - getImageObj:function( rObj, size, callback ){ |
862 | | - js_log('metavidSearch:getImageObj:'+size + ' s:' + size ); |
863 | | - //metavid uses a dynamic image request url: |
864 | | - var pparts = this.parseURI( rObj.poster ); |
865 | | - callback( {'url':rObj.poster} ); |
866 | | - }, |
| 908 | + }, |
867 | 909 | getSearchResults:function(){ |
868 | 910 | var _this = this; |
869 | 911 | //start loading: |
— | — | @@ -880,6 +922,11 @@ |
881 | 923 | do_request(url, function(data){ |
882 | 924 | //should have an xml rss data object: |
883 | 925 | _this.addRSSData( data , url ); |
| 926 | + //do some metavid specific pos proccessing: |
| 927 | + for(var i in _this.resultsObj){ |
| 928 | + var rObj = _this.resultsObj[i]; |
| 929 | + } |
| 930 | + |
884 | 931 | //done loading: |
885 | 932 | _this.loading=0; |
886 | 933 | }); |
— | — | @@ -1028,24 +1075,33 @@ |
1029 | 1076 | js_log('ERROR:unsupored mime type: ' + rObj.mime); |
1030 | 1077 | }, |
1031 | 1078 | //returns the inline wikitext for insertion (template based crops for now) |
1032 | | - getEmbedWikiText: function( rObj , callback ){ |
| 1079 | + getEmbedWikiText: function( rObj ){ |
1033 | 1080 | //set default layout to right justified |
1034 | 1081 | var layout = ( rObj.layout)? rObj.layout:"right" |
1035 | 1082 | //if crop is null do simple output: |
1036 | | - if( rObj.crop == null) |
1037 | | - callback( '[[' + rObj.titleKey + '|layout' + '|'+rObj.width + 'px|' + rObj.inlineDesc + ']]' ); |
1038 | | - |
| 1083 | + if( rObj.crop == null){ |
| 1084 | + var o= '[[' + this.rsd.cFileNS + ':' + rObj.target_resource_title + '|thumb|'+layout; |
| 1085 | + |
| 1086 | + if(rObj.target_width) |
| 1087 | + o+='|' + rObj.target_width + 'px'; |
| 1088 | + |
| 1089 | + if( rObj.inlineDesc ) |
| 1090 | + o+='|' + rObj.inlineDesc; |
| 1091 | + |
| 1092 | + o+=']]'; |
| 1093 | + return o; |
| 1094 | + } |
1039 | 1095 | //using the preview crop template: http://en.wikipedia.org/wiki/Template:Preview_Crop |
1040 | 1096 | //should be replaced with server side cropping |
1041 | | - callback( '{{Preview Crop '+ |
1042 | | -'|Image = ' + rObj.titleKey + "\n" + |
1043 | | -'|bSize = ' + rObj.width + "\n" + |
1044 | | -'|cWidth = ' + rObj.crop.w + "\n" + |
1045 | | -'|cHeight = ' + rObj.crop.h + "\n" + |
1046 | | -'|oTop = ' + rObj.crop.y + "\n" + |
1047 | | -'|oLeft = ' + rObj.crop.x + "\n" + |
1048 | | -'|Location =' + layout + "\n" + |
1049 | | -'|Description =' + rObj.inlineDesc + "\n" + |
1050 | | -'}}'); |
| 1097 | + return '{{Preview Crop ' + "\n" + |
| 1098 | + '|Image = ' + rObj.target_resource_title + "\n" + |
| 1099 | + '|bSize = ' + rObj.width + "\n" + |
| 1100 | + '|cWidth = ' + rObj.crop.w + "\n" + |
| 1101 | + '|cHeight = ' + rObj.crop.h + "\n" + |
| 1102 | + '|oTop = ' + rObj.crop.y + "\n" + |
| 1103 | + '|oLeft = ' + rObj.crop.x + "\n" + |
| 1104 | + '|Location =' + layout + "\n" + |
| 1105 | + '|Description =' + rObj.inlineDesc + "\n" + |
| 1106 | + '}}'; |
1051 | 1107 | } |
1052 | 1108 | } |
\ No newline at end of file |