Index: trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php |
— | — | @@ -479,6 +479,32 @@ |
480 | 480 | /* |
481 | 481 | * Utility functions: |
482 | 482 | */ |
| 483 | +function mvOutputJSON( & $data ) { |
| 484 | + $fname = 'Mv_output_json_data'; |
| 485 | + wfProfileIn( $fname ); |
| 486 | + |
| 487 | + global $wgRequest; |
| 488 | + |
| 489 | + // get callback index and wrap function: |
| 490 | + $callback_index = $wgRequest->getVal( 'cb_inx' ); |
| 491 | + $wrap_function = $wgRequest->getVal( 'cb' ); |
| 492 | + |
| 493 | + //header( 'Content-Type: text/javascript' ); |
| 494 | + if($callback_index!='' && $wrap_function!=''){ |
| 495 | + $output = htmlspecialchars( $wrap_function ) . '(' . PhpArrayToJsObject_Recurse( |
| 496 | + array( 'cb_inx' => htmlspecialchars( $callback_index ), |
| 497 | + 'content-type' => 'text/xml', |
| 498 | + 'pay_load' => $data |
| 499 | + ) |
| 500 | + ) . ');'; |
| 501 | + }else{ |
| 502 | + //just produce a results var: |
| 503 | + $output = php2jsObj( array('pay_load'=>$data) ); |
| 504 | + } |
| 505 | + wfProfileOut( $fname ); |
| 506 | + //if all is well return true: |
| 507 | + return $output; |
| 508 | +} |
483 | 509 | if ( ! function_exists( 'php2jsObj' ) ) { |
484 | 510 | function php2jsObj( $array, $objName = 'mv_result' ) |
485 | 511 | { |
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php |
— | — | @@ -121,11 +121,22 @@ |
122 | 122 | $this->get_roe_xml(); |
123 | 123 | break; |
124 | 124 | case 'json_cmml': |
125 | | - $this->get_json( 'cmml' ); |
| 125 | + // sucks to do big XML page operations ... |
| 126 | + // @@todo cache it.. |
| 127 | + ob_start(); |
| 128 | + $this->get_stream_cmml(); |
| 129 | + $xml_page = ob_get_clean(); |
| 130 | + print mvOutputJSON( $xml_page ); |
126 | 131 | break; |
127 | 132 | case 'json_roe': |
128 | 133 | // returns roe stream info in json object for easy DOM injection |
129 | | - $this->get_json( 'roe' ); |
| 134 | + // sucks to do big XML page operations ... |
| 135 | + //@@todo cache it.. |
| 136 | + ob_start(); |
| 137 | + $this->get_row_data(); |
| 138 | + $this->get_roe_xml( false ); |
| 139 | + $xml_page = ob_get_clean(); |
| 140 | + print mvOutputJSON( $xml_page ); |
130 | 141 | break; |
131 | 142 | } |
132 | 143 | break; |
— | — | @@ -211,36 +222,7 @@ |
212 | 223 | // get all avaliable files |
213 | 224 | $this->file_list = $this->mvTitle->mvStream->getFileList(); |
214 | 225 | } |
215 | | - function get_json( $type = '' ) { |
216 | | - $fname = 'Mv_SpecialExport::get_roe_json'; |
217 | | - wfProfileIn( $fname ); |
218 | | - |
219 | | - global $wgRequest; |
220 | 226 | |
221 | | - // get callback index and wrap function: |
222 | | - $callback_index = $wgRequest->getVal( 'cb_inx' ); |
223 | | - $wrap_function = $wgRequest->getVal( 'cb' ); |
224 | | - |
225 | | - // sucks to do big XML page operations ... |
226 | | - // @@todo cache it.. |
227 | | - ob_start(); |
228 | | - if ( $type == 'roe' ) { |
229 | | - $this->get_row_data(); |
230 | | - $this->get_roe_xml( false ); |
231 | | - } else if ( $type == 'cmml' ) { |
232 | | - $this->get_stream_cmml(); |
233 | | - } |
234 | | - $xml_page = ob_get_clean(); |
235 | | - header( 'Content-Type: text/javascript' ); |
236 | | - print htmlspecialchars( $wrap_function ) . '(' . PhpArrayToJsObject_Recurse( |
237 | | - array( 'cb_inx' => htmlspecialchars( $callback_index ), |
238 | | - 'content-type' => 'text/xml', |
239 | | - 'pay_load' => $xml_page |
240 | | - ) |
241 | | - ) . ');'; |
242 | | - |
243 | | - wfProfileOut( $fname ); |
244 | | - } |
245 | 227 | // start high level: |
246 | 228 | function get_roe_xml( $header = true ) { |
247 | 229 | global $wgServer; |
Index: trunk/extensions/MetavidWiki/includes/articlepages/MV_SequencePage.php |
— | — | @@ -152,6 +152,7 @@ |
153 | 153 | $node->setAttribute('type','text/html'); |
154 | 154 | return $this->parseInnerWikiText($node); |
155 | 155 | } |
| 156 | + |
156 | 157 | $uriTitle = Title::newFromDBkey($node_uri); |
157 | 158 | //figure out if how we should parse innerHTML: |
158 | 159 | switch( $uriTitle->getNamespace() ){ |
— | — | @@ -184,20 +185,23 @@ |
185 | 186 | return $node; |
186 | 187 | } |
187 | 188 | |
| 189 | + //by default set the ogg source |
188 | 190 | //@@todo parse child nodes for stream request params? |
189 | | - $f = $node->ownerDocument->createDocumentFragment(); |
| 191 | + |
190 | 192 | if( $stream_web_url ){ |
191 | | - $f->appendXML( '<source type="' . |
192 | | - htmlspecialchars( MV_StreamFile::getTypeForQK( $mvDefaultVideoQualityKey ) ) . |
193 | | - '" src="' . $stream_web_url . '"></source>' ); |
194 | | - } |
| 193 | + $node->setAttribute('type', htmlspecialchars( MV_StreamFile::getTypeForQK( $mvDefaultVideoQualityKey ) )); |
| 194 | + $node->setAttribute('src', $stream_web_url ); |
| 195 | + $node->setAttribute('poster', $mvTitle->getStreamImageURL() ); |
| 196 | + } |
| 197 | + //add in flash as a fallback method: |
195 | 198 | if( $flash_stream_url ){ |
| 199 | + $f = $node->ownerDocument->createDocumentFragment(); |
196 | 200 | $f->appendXML( '<source type="' . |
197 | 201 | htmlspecialchars( MV_StreamFile::getTypeForQK( $mvDefaultFlashQualityKey ) ) . |
198 | 202 | '" src="' . $flash_stream_url . '"></source>' ); |
199 | | - } |
200 | | - $node->appendChild($f); |
201 | | - |
| 203 | + $node->appendChild($f); |
| 204 | + } |
| 205 | + |
202 | 206 | break; |
203 | 207 | case NS_TEMPLATE: |
204 | 208 | //templates are of type text/html |
— | — | @@ -258,7 +262,7 @@ |
259 | 263 | $this->parseInnerWikiText( $node, $thumbnail->toHtml() ); |
260 | 264 | }else{ |
261 | 265 | $node->setAttribute( 'type', $img->getMimeType() ); |
262 | | - $node->setAttribute( 'src', $thumbnail->file->getURL() ); |
| 266 | + $node->setAttribute( 'src', $thumbnail->getURL() ); |
263 | 267 | |
264 | 268 | //if type is ogg: (set dur and poster) |
265 | 269 | if( $img->getMimeType()=='application/ogg') { |
— | — | @@ -268,7 +272,7 @@ |
269 | 273 | $node->setAttribute('poster', $thumbnail->url); |
270 | 274 | } |
271 | 275 | } |
272 | | - } |
| 276 | + } |
273 | 277 | break; |
274 | 278 | default: |
275 | 279 | $node->setAttribute('type','text/html'); |
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_SequenceTools.php |
— | — | @@ -13,6 +13,13 @@ |
14 | 14 | // make sure the parent class mv_component is included |
15 | 15 | |
16 | 16 | class MV_SequenceTools extends MV_Component { |
| 17 | + var $valid_tools=array( |
| 18 | + 'sequence_page', |
| 19 | + 'add_clips_manual', |
| 20 | + 'welcome', |
| 21 | + 'cliplib', |
| 22 | + 'options' |
| 23 | + ); |
17 | 24 | function getHTML() { |
18 | 25 | global $wgOut; |
19 | 26 | // @@todo look at mv_interface context to get what to display in tool box: |
— | — | @@ -24,7 +31,20 @@ |
25 | 32 | $wgOut->addHTML( '</div>' ); |
26 | 33 | } |
27 | 34 | function get_tool_html( $tool_id, $ns = '', $title_str = '' ) { |
28 | | - global $wgOut, $wgUser; |
| 35 | + global $wgOut, $wgUser; |
| 36 | + //check if we are proccessing a set: |
| 37 | + $tool_set = explode('|', $tool_id); |
| 38 | + if(count($tool_set)>1){ |
| 39 | + $tool_values = array(); |
| 40 | + foreach($tool_set as $tool_id){ |
| 41 | + if( in_array($tool_id, $this->valid_tools )){ |
| 42 | + $tool_values[$tool_id] = $this->get_tool_html($tool_id); |
| 43 | + } |
| 44 | + } |
| 45 | + return mvOutputJSON( $tool_values ); |
| 46 | + } |
| 47 | + $wgOut->clearHTML(); |
| 48 | + //else process a single tool: |
29 | 49 | switch( $tool_id ) { |
30 | 50 | case 'sequence_page': |
31 | 51 | global $mvgIP, $wgOut, $wgParser, $wgTitle; |
— | — | @@ -54,17 +74,22 @@ |
55 | 75 | case 'options': |
56 | 76 | $this->add_editor_options(); |
57 | 77 | break; |
58 | | - default: |
59 | | - $wgOut->addHTML( wfMsg('mv_tool_missing'), $tool_id); |
| 78 | + default: |
| 79 | + $wgOut->addHTML( wfMsg('mv_tool_missing', htmlspecialchars ($tool_id) ) ); |
60 | 80 | break; |
61 | 81 | } |
62 | 82 | return $wgOut->getHTML(); |
63 | 83 | } |
64 | 84 | function add_embed_search() { |
65 | 85 | global $wgOut; |
66 | | - // grab a de-encapsulated search with prefix |
67 | | - |
68 | | - //$wgOut->addHTML( 'results go here' ); |
| 86 | + // grab a de-encapsulated search with prefix |
| 87 | + $wgOut->addHTML( '<h3>'. wfMsg('mv_resource_locator') . '</h3>' ); |
| 88 | + //add the input form |
| 89 | + $wgOut->addHTML( |
| 90 | + xml::input('mv_ams_search', 255,'', array('class'=>'searchField')) . |
| 91 | + xml::submitButton( wfMsg('mv_media_search'), array('id'=>'mv_ams_submit') ) . |
| 92 | + xml::element('div',array('id'=>'mv_ams_results')) |
| 93 | + ); |
69 | 94 | } |
70 | 95 | function add_editor_options(){ |
71 | 96 | global $wgOut; |
— | — | @@ -163,11 +188,5 @@ |
164 | 189 | return $wgOut->getHTML(); |
165 | 190 | } |
166 | 191 | } |
167 | | - function render_menu() { |
168 | | - return |
169 | | - '<a title="' . htmlspecialchars( wfMsg( 'mv_sequence_page_desc' ) ) . '" href="javascript:mv_seqtool_disp(\'sequence_page\')">' . wfMsg( 'mv_save_sequence' ) . '</a>' . |
170 | | - ' | ' . '<a title="' . htmlspecialchars( wfMsg( 'mv_sequence_add_manual_desc' ) ) . '" href="javascript:mv_seqtool_disp(\'add_clips_manual\')">' . wfMsg( 'mv_sequence_add_manual' ) . '</a>' . |
171 | | - ' | ' . '<a title="' . htmlspecialchars( wfMsg( 'mv_sequence_add_search_desc' ) ) . '" href="javascript:mv_seqtool_disp(\'add_clips_search\')">' . wfMsg( 'mv_sequence_add_search' ) . '</a>' ; |
172 | | - } |
173 | 192 | } |
174 | 193 | ?> |
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php |
— | — | @@ -453,7 +453,7 @@ |
454 | 454 | global $wgUser, $mvgScriptPath, $wgRequest; |
455 | 455 | $sk = $wgUser->getSkin(); |
456 | 456 | |
457 | | - // hack to get menu correct... (previsuly menu was not encapulsated) |
| 457 | + // hack to get menu correct... |
458 | 458 | $do_adjust = $wgRequest->getVal( 'do_adjust' ); |
459 | 459 | //fix boolean string issue: |
460 | 460 | $do_adjust = ( $do_adjust == 'false' ) ? false : $do_adjust; |
— | — | @@ -477,6 +477,7 @@ |
478 | 478 | $hTitle = Title::newFromText( $mvd_page->wiki_title, MV_NS_MVD ); |
479 | 479 | // print $hTitle-> |
480 | 480 | $hlink = $sk->makeKnownLinkObj( $hTitle, wfMsg( 'mv_history' ), 'action=history' ); |
| 481 | + |
481 | 482 | $dTitle = Title::newFromText( $mvd_page->wiki_title, MV_NS_MVD_TALK ); |
482 | 483 | $dlink = $sk->makeKnownLinkObj( $dTitle, wfMsg( 'talk' ) ); |
483 | 484 | |
— | — | @@ -750,12 +751,12 @@ |
751 | 752 | $wpTextbox1 .= "\n[[" . $catNStxt . ":" . $v . "]]"; |
752 | 753 | } |
753 | 754 | } |
754 | | - // add the text to the end after a line break to not confuse mannual editors |
| 755 | + // add the text to the end after a line break to not confuse manual editors |
755 | 756 | $editPageAjax = new MV_EditPageAjax( $Article ); |
756 | 757 | $editPageAjax->mvd_id = $mvd_id; |
757 | 758 | |
758 | 759 | // if preview just return the parsed preview |
759 | | - // @@todo refactor to use as much EditPage code as possible |
| 760 | + // @@todo refactor to use as much EditPage code as possible or (switch over to the API) |
760 | 761 | // use the "livePreview" functionality of Edit page. |
761 | 762 | if ( isset( $_POST['wpPreview'] ) ) { |
762 | 763 | // $out = $editPageAjax->getPreviewText(); |
Index: trunk/extensions/MetavidWiki/languages/MV_Messages.php |
— | — | @@ -244,6 +244,9 @@ |
245 | 245 | 'mv_resource_not_supported'=>"Resource '''$1''' type not supported", |
246 | 246 | 'mv_welcome_to_sequencer' => '<h3>Welcome to The sequencer demo</h3>'. |
247 | 247 | 'very <b>limited</b> functionality right now', |
| 248 | + 'mv_resource_locator'=>'Resource Locator', |
| 249 | + |
| 250 | + 'mv_media_search'=>'Media Search', |
248 | 251 | |
249 | 252 | 'mv_editor_options'=>'Editor options', |
250 | 253 | 'mv_editor_mode' =>'Editor mode', |
— | — | @@ -273,7 +276,7 @@ |
274 | 277 | 'mv_embed_options' => 'Embed options', |
275 | 278 | 'mv_overlay' => 'Overlay controls', |
276 | 279 | 'mv_stream_tool_heading' => 'Stream tools', |
277 | | - 'mv_tool_missing' => 'tool request ($1) does not exist', |
| 280 | + 'mv_tool_missing' => 'requested tool does not exist', |
278 | 281 | 'mv_bad_tool_request' => 'bad tool line should be form: tool_name|tool_display_name', |
279 | 282 | 'mv_update_layers' => 'update layers view', |
280 | 283 | |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_page.php |
— | — | @@ -40,10 +40,10 @@ |
41 | 41 | // '<a href="javascript:document.getElementById(\'vflash\').play();">Play</a> | ' . |
42 | 42 | // '<a href="javascript:document.getElementById(\'vflash\').stop();">Stop</a> <br />'; |
43 | 43 | |
44 | | -$sample_embed[1]['tag'] = '<video roe="http://metavid.ucsc.edu/wiki/index.php?title=Special:MvExportStream&feed_format=roe&stream_name=Senate_proceeding_06-06-06_1&t=0:07:50/0:09:06">'; |
| 44 | +$sample_embed[1]['tag'] = '<video roe="http://metavid.org/wiki/index.php?title=Special:MvExportStream&feed_format=roe&stream_name=Senate_proceeding_06-06-06_1&t=0:07:50/0:09:06">'; |
45 | 45 | $sample_embed[1]['desc'] = 'Demo of json ROE attribute'; |
46 | 46 | |
47 | | -$sample_embed[3]['tag'] = '<video roe="http://metavid.ucsc.edu/wiki/index.php?title=Special:MvExportStream&feed_format=roe&stream_name=Senate_proceeding_08-01-07&t=0:11:40/0:12:20" ></video>'; |
| 47 | +$sample_embed[3]['tag'] = '<video roe="http://metavid.org/mvw-exp/index.php?title=Special:MvExportStream&feed_format=roe&stream_name=Senate_proceeding_08-01-07&t=0:11:40/0:12:20" ></video>'; |
48 | 48 | $sample_embed[3]['desc'] = 'Demo of ROE only attribute'; |
49 | 49 | |
50 | 50 | |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_htmlEmbed.js |
— | — | @@ -84,7 +84,8 @@ |
85 | 85 | var thumb_render_id = this.id +'_thumb_render_'+ options.height; |
86 | 86 | if( $j('#' + thumb_render_id ).length == 0 || do_refresh ){ |
87 | 87 | //set the font scale down percentage: (kind of arbitrary) |
88 | | - var scale_perc = options.width / $j(this).width(); |
| 88 | + var scale_perc = options.width / this.pc.pp.width; |
| 89 | + //js_log('scale_perc:'+options.width + ' / '+ $j(this).width()+ ' = '+scale_perc ); |
89 | 90 | //min scale font percent of 70 (overflow is hidden) |
90 | 91 | var font_perc = ( Math.round( scale_perc*100 ) < 80 )?80:Math.round( scale_perc*100 ); |
91 | 92 | |
— | — | @@ -104,12 +105,12 @@ |
105 | 106 | }); |
106 | 107 | |
107 | 108 | //scale images that have width or height: |
108 | | - $j('#' + thumb_render_id + ' img').filter('[width]').each(function(){ |
| 109 | + $j('#' + thumb_render_id + ' img').filter('[width]').each(function(){ |
109 | 110 | $j(this).attr({ |
110 | | - 'width':$j(this).attr('width') * scale_perc, |
111 | | - 'height':$j(this).attr('height') * scale_perc |
| 111 | + 'width': Math.round( $j(this).attr('width') * scale_perc ), |
| 112 | + 'height': Math.round( $j(this).attr('height') * scale_perc ) |
112 | 113 | } |
113 | | - ); |
| 114 | + ); |
114 | 115 | }); |
115 | 116 | } |
116 | 117 | return $j('#' + thumb_render_id ).html(); |
— | — | @@ -118,12 +119,12 @@ |
119 | 120 | //@@todo render out a mini text "preview" |
120 | 121 | updateThumbTime:function( float_time ){ |
121 | 122 | return ; |
122 | | - }, |
| 123 | + }, |
123 | 124 | getEmbedHTML:function(){ |
124 | 125 | js_log('f:html:getEmbedHTML'); |
125 | 126 | //set up the css for our parent div: |
126 | 127 | $j(this).css({'width':this.pc.pp.width, 'height':this.pc.pp.height, 'overflow':"hidden"}); |
127 | | - //@@todo support more smil image layout stuff: |
| 128 | + //@@todo support more smil annimation layout stuff: |
128 | 129 | |
129 | 130 | //wrap output in videoPlayer_ div: |
130 | 131 | $j(this).html('<div id="videoPlayer_'+ this.id+'">'+this.getThumbnailHTML()+'</div>'); |
— | — | @@ -132,10 +133,11 @@ |
133 | 134 | var out=''; |
134 | 135 | if( this.pc.type =='image/jpeg'){ |
135 | 136 | js_log('should put src: '+this.pc.src); |
136 | | - out = '<img src="'+this.pc.src+'">'; |
| 137 | + out = '<img width="'+this.pc.pp.width+'" height="'+this.pc.pp.height+'" src="'+this.pc.src+'">'; |
137 | 138 | }else{ |
138 | 139 | out = this.pc.wholeText; |
139 | 140 | } |
| 141 | + js_log('f:getThumbnailHTML: got thumb: '+out); |
140 | 142 | return out; |
141 | 143 | }, |
142 | 144 | doThumbnailHTML:function(){ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js |
— | — | @@ -1490,24 +1490,22 @@ |
1491 | 1491 | * @param {String} end_time in NTP format |
1492 | 1492 | */ |
1493 | 1493 | updateSrcTime:function (start_ntp, end_ntp){ |
1494 | | - js_log("f:updateSrcTime: "+ start_ntp+'/'+ end_ntp); |
| 1494 | + js_log("f:updateSrcTime: "+ start_ntp+'/'+ end_ntp + ' from org: ' + this.start_ntp+ '/'+this.end_ntp); |
1495 | 1495 | //js_log("pre uri:" + this.src); |
1496 | 1496 | //if we have time we can use: |
1497 | | - if(this.supports_url_time_encoding){ |
1498 | | - var index_time_val = false; |
1499 | | - var time_req_delimitator = ''; |
1500 | | - if(this.src.indexOf('?t=')!=-1)index_time_val='?t='; |
1501 | | - if(this.src.indexOf('&t=')!=-1)index_time_val='&t='; |
1502 | | - if(index_time_val){ |
1503 | | - var end_req_string = (this.src.indexOf('&', this.src.indexOf(index_time_val)+3)==-1)? |
1504 | | - '': |
1505 | | - this.src.indexOf('&', this.src.indexOf(index_time_val)); |
1506 | | - this.src = this.src.substring(0, this.src.indexOf(index_time_val) ) + index_time_val + start_ntp + '/'+end_ntp + end_req_string; |
1507 | | - } |
| 1497 | + if( this.supports_url_time_encoding ){ |
| 1498 | + //make sure its a valid start time / end time (else set default) |
| 1499 | + if( !ntp2seconds(start_ntp) ) |
| 1500 | + start_ntp = this.start_ntp; |
| 1501 | + |
| 1502 | + if( !ntp2seconds(end_ntp) ) |
| 1503 | + end_ntp = this.end_ntp; |
| 1504 | + |
| 1505 | + this.src = getUpdateTimeURL(this.src, start_ntp +'/'+end_ntp); |
| 1506 | + //update the duration |
1508 | 1507 | this.parseURLDuration(); |
1509 | | - } |
1510 | | - |
1511 | | - //update the duration |
| 1508 | + } |
| 1509 | + //this.setDuration( ) |
1512 | 1510 | //js_log("post uri:" + this.src); |
1513 | 1511 | }, |
1514 | 1512 | setDuration:function (duration) |
— | — | @@ -1557,7 +1555,7 @@ |
1558 | 1556 | * supports media_url?t=ntp_start/ntp_end url request format |
1559 | 1557 | */ |
1560 | 1558 | parseURLDuration : function(){ |
1561 | | - //js_log('f:parseURLDuration() for:' + this.src); |
| 1559 | + js_log('f:parseURLDuration() for:' + this.src); |
1562 | 1560 | var index_time_val = false; |
1563 | 1561 | if(this.src.indexOf('?t=')!=-1)index_time_val='?t='; |
1564 | 1562 | if(this.src.indexOf('&t=')!=-1)index_time_val='&t='; |
— | — | @@ -1651,10 +1649,10 @@ |
1652 | 1650 | }, |
1653 | 1651 | /** Updates the time request for all sources that have a standard time request argument (ie &t=start_time/end_time) |
1654 | 1652 | */ |
1655 | | - updateSourceTimes:function(start_time, end_time){ |
| 1653 | + updateSourceTimes:function(start_ntp, end_ntp){ |
1656 | 1654 | var _this = this; |
1657 | 1655 | $j.each(this.sources, function(inx, mediaSource){ |
1658 | | - mediaSource.updateSrcTime(start_time, end_time); |
| 1656 | + mediaSource.updateSrcTime(start_ntp, end_ntp); |
1659 | 1657 | }); |
1660 | 1658 | }, |
1661 | 1659 | /** Returns the array of mediaSources of this element. |
— | — | @@ -2059,8 +2057,12 @@ |
2060 | 2058 | return this.media_element.selected_source.start_ntp+'/'+this.media_element.selected_source.end_ntp; |
2061 | 2059 | }, |
2062 | 2060 | getDuration:function(){ |
| 2061 | + //update some local pointers for the selected source: |
2063 | 2062 | this.duration = this.media_element.selected_source.duration; |
2064 | 2063 | this.start_offset = this.media_element.selected_source.start_offset; |
| 2064 | + this.start_ntp = this.media_element.selected_source.start_ntp; |
| 2065 | + this.end_ntp = this.media_element.selected_source.end_ntp; |
| 2066 | + //return the duration |
2065 | 2067 | return this.duration; |
2066 | 2068 | }, |
2067 | 2069 | /* get the duration in ntp format */ |
— | — | @@ -2411,23 +2413,18 @@ |
2412 | 2414 | this.updateVideoTime(time_parts[0], time_parts[1]); |
2413 | 2415 | }, |
2414 | 2416 | //update video time |
2415 | | - updateVideoTime:function(start_time, end_time){ |
| 2417 | + updateVideoTime:function(start_ntp, end_ntp){ |
2416 | 2418 | //update media |
2417 | | - this.media_element.updateSourceTimes(start_time, end_time); |
| 2419 | + this.media_element.updateSourceTimes( start_ntp, end_ntp ); |
2418 | 2420 | //update mv_time |
2419 | | - this.setStatus(start_time+'/'+end_time); |
| 2421 | + this.setStatus(start_ntp+'/'+end_ntp); |
2420 | 2422 | //reset slider |
2421 | 2423 | this.setSliderValue(0); |
2422 | 2424 | //reset seek_offset: |
2423 | 2425 | if(this.media_element.selected_source.supports_url_time_encoding) |
2424 | 2426 | this.seek_time_sec=0; |
2425 | 2427 | else |
2426 | | - this.seek_time_sec=ntp2seconds(start_time); |
2427 | | - }, |
2428 | | - //updates the video src |
2429 | | - updateVideoSrc : function(src){ |
2430 | | - js_log("UPDATE SRC:"+src); |
2431 | | - this.src = src; |
| 2428 | + this.seek_time_sec=ntp2seconds(start_ntp); |
2432 | 2429 | }, |
2433 | 2430 | //@@todo overwite by embed library if we can render frames natavily |
2434 | 2431 | renderTimelineThumbnail:function( options ){ |
— | — | @@ -2435,7 +2432,7 @@ |
2436 | 2433 | |
2437 | 2434 | if( my_thumb_src.indexOf('t=') !== -1){ |
2438 | 2435 | var time_ntp = seconds2ntp ( options.time + parseInt(this.start_offset) ); |
2439 | | - my_thumb_src = getUpdateTimeURL( org_thum_src, time_ntp, options.size ); |
| 2436 | + my_thumb_src = getUpdateTimeURL( my_thumb_src, time_ntp, options.size ); |
2440 | 2437 | } |
2441 | 2438 | return '<img src="' + my_thumb_src +'" '+ |
2442 | 2439 | 'style="height:' + options.height + 'px;' + |
— | — | @@ -2792,7 +2789,7 @@ |
2793 | 2790 | js_log("mv_embed play:"+this.id); |
2794 | 2791 | js_log('thum disp:'+this.thumbnail_disp); |
2795 | 2792 | //check if thumbnail is being displayed and embed html |
2796 | | - if(this.thumbnail_disp){ |
| 2793 | + if( this.thumbnail_disp ){ |
2797 | 2794 | if(!this.selected_player){ |
2798 | 2795 | js_log('no selected_player'); |
2799 | 2796 | //this.innerHTML = this.getPluginMissingHTML(); |
— | — | @@ -2982,14 +2979,12 @@ |
2983 | 2980 | * takes hh:mm:ss input returns number of seconds |
2984 | 2981 | */ |
2985 | 2982 | function ntp2seconds(ntp){ |
2986 | | - if(!ntp){ |
2987 | | - js_log('ntp2seconds:not valid ntp:'+ntp); |
2988 | | - return null; |
| 2983 | + if(!ntp){ |
| 2984 | + return js_log('ntp2seconds:not valid ntp:'+ntp); |
2989 | 2985 | } |
2990 | 2986 | times = ntp.split(':'); |
2991 | | - if(times.length!=3){ |
2992 | | - js_log('ntp2seconds:not valid ntp:'+ntp); |
2993 | | - return null; |
| 2987 | + if(times.length!=3){ |
| 2988 | + return js_log('ntp2seconds:not valid ntp:'+ntp); |
2994 | 2989 | } |
2995 | 2990 | //return seconds float (ie take seconds float value if present): |
2996 | 2991 | return parseInt(times[0]*3600)+parseInt(times[1]*60)+parseFloat(times[2]); |
— | — | @@ -2998,7 +2993,7 @@ |
2999 | 2994 | function mv_addLoadEvent(func) { |
3000 | 2995 | mvEmbed.addLoadEvent(func); |
3001 | 2996 | } |
3002 | | -function do_request(req_url, callback, mv_json_response){ |
| 2997 | +function do_request(req_url, callback){ |
3003 | 2998 | js_log('do request: ' + req_url); |
3004 | 2999 | if( parseUri(document.URL).host == parseUri(req_url).host){ |
3005 | 3000 | //no proxy at all do a direct request: |
— | — | @@ -3006,8 +3001,8 @@ |
3007 | 3002 | type: "GET", |
3008 | 3003 | url:req_url, |
3009 | 3004 | async: false, |
3010 | | - success:function(data){ |
3011 | | - callback(data); |
| 3005 | + success:function(data){ |
| 3006 | + callback( data ); |
3012 | 3007 | } |
3013 | 3008 | }); |
3014 | 3009 | }else{ |
— | — | @@ -3055,7 +3050,7 @@ |
3056 | 3051 | return false; |
3057 | 3052 | break; |
3058 | 3053 | } |
3059 | | - global_req_cb[response['cb_inx']](response['pay_load']); |
| 3054 | + global_req_cb[response['cb_inx']]( response['pay_load'] ); |
3060 | 3055 | } |
3061 | 3056 | //load external js via dom injection |
3062 | 3057 | //@@todo swich over to jQuery injection |
— | — | @@ -3165,7 +3160,7 @@ |
3166 | 3161 | }*/ |
3167 | 3162 | } |
3168 | 3163 | //give the string back (ie in cases of returning an error) |
3169 | | - return string; |
| 3164 | + return false; |
3170 | 3165 | } |
3171 | 3166 | |
3172 | 3167 | function js_error(string){ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_sequencer.js |
— | — | @@ -93,14 +93,14 @@ |
94 | 94 | 'resource_overview':0, |
95 | 95 | 'options':0 |
96 | 96 | }, |
97 | | - init:function(initObj){ |
| 97 | + init:function( initObj ){ |
98 | 98 | //set the default values: |
99 | | - for(i in sequencerDefaultValues){ |
| 99 | + for(var i in sequencerDefaultValues){ |
100 | 100 | this[ i ] = sequencerDefaultValues[i]; |
101 | 101 | } |
102 | 102 | //@@todo deal with multi-dimensional object updates |
103 | 103 | // (ie one word in wfMsg does not replace the whole wfMsg default set) |
104 | | - for(i in initObj){ |
| 104 | + for(var i in initObj){ |
105 | 105 | //js_log('on '+ i + ' :' + initObj[i]); |
106 | 106 | if(sequencerDefaultValues[i]){ //make sure its a valid property |
107 | 107 | this[i]=initObj[i]; |
— | — | @@ -132,8 +132,21 @@ |
133 | 133 | '<div id="'+this.sequence_tools_id+'" style="position:absolute;' + |
134 | 134 | 'left:0px;right:'+(this.video_width+10)+'px;top:0px;height:'+this.video_height+'px;border:solid thin black;"/>'+ |
135 | 135 | '<div id="'+this.timeline_id+'" style="position:absolute;' + |
136 | | - 'left:0px;right:0px;top:'+(this.video_height+10)+'px;bottom:0px;overflow:auto;">'+ |
137 | | - getMsg('loading_timeline')+ '</div>'); |
| 136 | + 'left:0px;right:0px;top:'+(this.video_height+10)+'px;bottom:25px;overflow:auto;">'+ |
| 137 | + getMsg('loading_timeline')+ '</div>'+ |
| 138 | + '<div id="'+this.id+'_save_cancel" style="position:absolute;'+ |
| 139 | + 'right:0px;bottom:0px;height:25px;overflow:hidden;">'+ |
| 140 | + '<a style="border:solid gray;font-size:1.2em;" onClick="window.confirm(\''+getMsg('edit_cancel_confirm')+'\')" '+ |
| 141 | + 'href="javascript:'+this.instance_name+'.closeModEditor()">'+ |
| 142 | + getMsg('edit_cancel') + '</a> '+ |
| 143 | + '<a style="border:solid gray;font-size:1.2em;" href="#" onClick="'+this.instance_name+'.getSeqOutputJSON()">'+ |
| 144 | + 'Preview Json Output'+ |
| 145 | + '</a>' + |
| 146 | + '<a style="border:solid gray;font-size:1.2em;" href="#" onClick="'+this.instance_name+'.getSeqOutputHLRDXML()">'+ |
| 147 | + 'Preview XML Output (will be save shortly) ' + |
| 148 | + '</a>' + |
| 149 | + '</div>' |
| 150 | + ); |
138 | 151 | |
139 | 152 | js_log('set: '+this.sequence_container_id + ' html to:'+ "\n"+ |
140 | 153 | $j('#'+this.sequence_container_id).html() |
— | — | @@ -163,30 +176,49 @@ |
164 | 177 | $j('#'+i+'_ic').filter(':visible').hide("slide", { direction: "down" }, "fast"); |
165 | 178 | } |
166 | 179 | }, |
167 | | - //@@todo probably should switch this over to php generated...or via an ajax request. |
168 | | - //since this content could/should be more dynamic |
169 | | - loadInitMenuItem:function(item, target_id){ |
| 180 | + //load the menu items: |
| 181 | + loadInitMenuItems:function(){ |
| 182 | + js_log('loadInitMenuItems'); |
170 | 183 | if( !this.plObj.interface_url ) |
171 | 184 | return js_log( 'Error:missing interface_url, can not load item' ); |
172 | 185 | |
173 | | - var req_url =this.plObj.interface_url+ '?action=ajax&rs=mv_seqtool_disp&rsargs[]='+item; |
174 | | - |
175 | | - //set to loading: |
176 | | - $j('#'+target_id).html( getMsg('loading_txt') ); |
| 186 | + var req_url =this.plObj.interface_url+ '?action=ajax&rs=mv_seqtool_disp&rsargs[]='; |
| 187 | + //ouput the requested items list: |
| 188 | + for(var i in this.menu_items){ |
| 189 | + req_url+='|'+i; |
| 190 | + $j('#'+i+'_ic').html( getMsg('loading_txt') );//set targets to loading |
| 191 | + } |
| 192 | + var _this = this; |
| 193 | + do_request(req_url, function(data){ |
| 194 | + if(typeof data=='string'){ |
| 195 | + js_log(' eval data: ' + data); |
| 196 | + eval(data); |
| 197 | + var data = mv_result['pay_load']; |
| 198 | + } |
| 199 | + for(var i in data){ |
| 200 | + js_log('set '+ i + ' to: '+ data[i] ); |
| 201 | + $j('#'+i+'_ic').html( data[i] ); |
| 202 | + _this.doMenuItemDispJs(i) |
| 203 | + } |
| 204 | + }); |
| 205 | + |
177 | 206 | //load req content: |
178 | | - var _this = this; |
179 | | - $j('#'+target_id).load(req_url, function(responseText, textStatus, XMLHttpRequest){ |
180 | | - _this.doMenuItemDispJs(item, target_id); |
181 | | - }); |
| 207 | + //var _this = this; |
| 208 | + //$j('#'+target_id).load(req_url, function(responseText, textStatus, XMLHttpRequest){ |
| 209 | + // _this.doMenuItemDispJs(item, target_id); |
| 210 | + //}); |
182 | 211 | }, |
183 | | - doMenuItemDispJs:function(item, target_id){ |
| 212 | + doMenuItemDispJs:function(item){ |
184 | 213 | var _this = this; |
| 214 | + var target_id = item + '_ic'; |
185 | 215 | //do any menu item post embed js hook processing: |
186 | 216 | switch(item){ |
187 | | - case 'cliplib': |
188 | | - //setup extra search functions |
| 217 | + case 'cliplib': |
| 218 | + $j('#mv_ams_submit').click(function(){ |
| 219 | + _this.doClipSearch(); |
| 220 | + }) |
189 | 221 | break; |
190 | | - case 'options': |
| 222 | + case 'options': |
191 | 223 | $j('#'+target_id+" input[value='simple_editor']").attr({ |
192 | 224 | 'checked':(_this.timeline_mode=='clip')?true:false |
193 | 225 | }).click(function(){ |
— | — | @@ -199,7 +231,7 @@ |
200 | 232 | }); |
201 | 233 | break; |
202 | 234 | } |
203 | | - }, |
| 235 | + }, |
204 | 236 | renderTimeLine:function(){ |
205 | 237 | //empty out the top level html: |
206 | 238 | $j('#'+this.timeline_id).html(''); |
— | — | @@ -322,8 +354,7 @@ |
323 | 355 | $j('#'+this.sequence_tools_id).html( menu_html + item_containers ); |
324 | 356 | |
325 | 357 | //load init content into containers |
326 | | - for(var i in this.menu_items) |
327 | | - this.loadInitMenuItem(i, i+'_ic'); |
| 358 | + this.loadInitMenuItems(); |
328 | 359 | |
329 | 360 | //render the timeline |
330 | 361 | this.renderTimeLine(); |
— | — | @@ -338,17 +369,53 @@ |
339 | 370 | //js_log('at time:'+ jh_time_sec + ' px:'+ Math.round(jh_time_sec_float/this.timeline_scale)); |
340 | 371 | }, |
341 | 372 | /*returns a xml or json representation of the current sequence */ |
342 | | - getSeqText:function(mode){ |
343 | | - if(!mode)mode='json'; |
344 | | - switch(mode){ |
345 | | - case'json': |
346 | | - return this.plObj.tracks.toSource(); |
347 | | - break; |
348 | | - case 'xml': |
349 | | - return "@@todo hlrd xml output"; |
350 | | - break; |
351 | | - } |
| 373 | + getSeqOutputJSON:function(){ |
| 374 | + js_log('json output'); |
352 | 375 | }, |
| 376 | + getSeqOutputHLRDXML:function(){ |
| 377 | + var o='<sequence_hlrd>' +"\n"+ |
| 378 | + o+="\t<head>"; |
| 379 | + //get transitions |
| 380 | + for(var i in this.plObj.transitions){ |
| 381 | + var tObj = this.plObj.transitions[i].getAttributeObj(); |
| 382 | + o+="\t<transition "; |
| 383 | + for(var j in tObj){ |
| 384 | + o+=' '+j+'="' + tObj[j] + '"\n\t\t'; |
| 385 | + } |
| 386 | + o+='/>'+"\n"; //transitions don't have children |
| 387 | + } |
| 388 | + o+="\t</head>\n"; |
| 389 | + |
| 390 | + //get clips |
| 391 | + o+="\t<body>\n"; |
| 392 | + //output each track: |
| 393 | + for(var i in this.plObj.tracks){ |
| 394 | + var curTrack = this.plObj.tracks[i]; |
| 395 | + o+="\t<seq"; |
| 396 | + var tAttr = curTrack.getAttributeObj(); |
| 397 | + for(var j in tAttr){ |
| 398 | + o+=' '+j+'="' + tAttr[j] + '"\n\t\t\t'; |
| 399 | + } |
| 400 | + o+=">\n"; |
| 401 | + for(var k in curTrack.clips){ |
| 402 | + var curClip = curTrack.clips[k]; |
| 403 | + o+="\t\t<ref "; |
| 404 | + var cAttr = curClip.getAttributeObj(); |
| 405 | + for(var j in cAttr){ |
| 406 | + o+=' '+j+'="' + cAttr[j] + '"\n\t\t\t'; |
| 407 | + } |
| 408 | + o+="/>\n" //close the clip |
| 409 | + } |
| 410 | + o+="\n</seq>n"; |
| 411 | + } |
| 412 | + o+="\t</body>\n"; |
| 413 | + //close the tag |
| 414 | + o+='</sequence_hlrd>'; |
| 415 | + |
| 416 | + js_log('f:getSeqOutputHLRDXML'+ o); |
| 417 | + |
| 418 | + return false; |
| 419 | + }, |
353 | 420 | //add clips to the pl object: (by default to the end of the track) |
354 | 421 | addClip:function(clip_init){ |
355 | 422 | js_log("seq: add clip"); |
— | — | @@ -409,6 +476,9 @@ |
410 | 477 | saveClipEdit:function(){ |
411 | 478 | //saves the clip updates |
412 | 479 | }, |
| 480 | + closeModEditor:function(){ |
| 481 | + $j('#modalbox').hide(); |
| 482 | + }, |
413 | 483 | closeModWindow:function(){ |
414 | 484 | $j('#modal_window').hide(); |
415 | 485 | $j('#modalbox').show(); |
— | — | @@ -425,19 +495,19 @@ |
426 | 496 | } |
427 | 497 | } |
428 | 498 | //re-render tracks: |
429 | | - this_seq.render_tracks(track_inx); |
| 499 | + this_seq.render_tracks( track_inx ); |
430 | 500 | |
431 | 501 | if(this_seq.plObj.tracks[track_inx].clips.length==0){ |
432 | 502 | this_seq.plObj.getHTML(); |
433 | 503 | }else{ |
434 | | - //update playlist desc: |
| 504 | + //update playlist desc: |
435 | 505 | this_seq.plObj.pl_duration=null; |
436 | 506 | this_seq.plObj.updateTitle(); |
437 | 507 | } |
438 | 508 | }); |
439 | 509 | }, |
440 | 510 | doEdit:function( editObj ){ |
441 | | - //add the current editObj to the edit stack |
| 511 | + //add the current editObj to the edit stack (should allow for "undo") |
442 | 512 | this.edit_stack.push( editObj ); |
443 | 513 | //make the adjustments |
444 | 514 | this.makeAdjustment( editObj ); |
— | — | @@ -695,6 +765,7 @@ |
696 | 766 | $j('#' + this.id + ' > .mv_clip_stats').fadeIn("fast"); |
697 | 767 | }, |
698 | 768 | stop: function(e,ui) { |
| 769 | + js_log('stop resize'); |
699 | 770 | //restore border |
700 | 771 | $j(this).css('border', 'solid thin white'); |
701 | 772 | //remove stats |
— | — | @@ -712,7 +783,7 @@ |
713 | 784 | }); |
714 | 785 | }, |
715 | 786 | resize: function(e,ui) { |
716 | | - //update time stats / render images: |
| 787 | + //update time stats & render images: |
717 | 788 | this_seq.update_clip_resize(this); |
718 | 789 | } |
719 | 790 | }); |
— | — | @@ -738,6 +809,7 @@ |
739 | 810 | clip_frames_html+=clip.embed.renderTimelineThumbnail({ |
740 | 811 | 'width': frame_width, |
741 | 812 | 'height': this.track_thumb_height, |
| 813 | + 'size' : "icon", //set size to "icon" preset |
742 | 814 | 'time': clip_time |
743 | 815 | }); |
744 | 816 | } |
— | — | @@ -785,7 +857,7 @@ |
786 | 858 | var new_start = seconds2ntp(ntp2seconds(clip.embed.start_ntp)+clip_dif); |
787 | 859 | clip_desc+='<br>start time: ' + new_start; |
788 | 860 | } |
789 | | - |
| 861 | + |
790 | 862 | //update clip stats: |
791 | 863 | $j('#'+clip_element.id+' > .mv_clip_stats').html(clip_desc); |
792 | 864 | var frame_width = Math.round(this.track_thumb_height*1.3333333); |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js |
— | — | @@ -285,7 +285,7 @@ |
286 | 286 | //check for smil tag: |
287 | 287 | smilElm = this.data.getElementsByTagName('smil')[0]; |
288 | 288 | if(smilElm){ |
289 | | - //don't check for dtd yet.. (have not defined the smil subset) |
| 289 | + //don't check dtd yet.. (have not defined the smil subset) |
290 | 290 | this.srcType='smil'; |
291 | 291 | } |
292 | 292 | }else if(typeof this.data == 'string'){ |
— | — | @@ -927,27 +927,32 @@ |
928 | 928 | |
929 | 929 | }, |
930 | 930 | doAdjust:function(side, delta){ |
931 | | - if(this.embed){ |
932 | | - if(this.src.indexOf('?')!=-1){ |
933 | | - var base_src = this.src.substr(0,this.src.indexOf('?')); |
934 | | - js_log("delta:"+ delta); |
935 | | - if(side=='start'){ |
936 | | - //since we adjust start invert the delta: |
937 | | - var start_offset =parseInt(this.embed.start_offset/1000)+parseInt(delta*-1); |
938 | | - this.src = base_src +'?t='+ seconds2ntp(start_offset) +'/'+ this.embed.end_ntp; |
939 | | - }else if(side=='end'){ |
940 | | - //put back into seconds for adjustment: |
941 | | - var end_offset = parseInt(this.embed.start_offset/1000) + parseInt(this.embed.duration/1000) + parseInt(delta); |
942 | | - this.src = base_src +'?t='+ this.embed.start_ntp +'/'+ seconds2ntp(end_offset); |
943 | | - } |
944 | | - js_log('new src:'+this.src); |
945 | | - this.embed.updateVideoSrc(this.src); |
946 | | - //update values |
947 | | - this.duration = this.embed.getDuration(); |
948 | | - this.pp.pl_duration=null; |
949 | | - //update playlist stuff: |
950 | | - this.pp.updateTitle(); |
| 931 | + js_log("f:doAdjust: "+side+ ' , ' + delta); |
| 932 | + if(this.embed){ |
| 933 | + if(side=='start'){ |
| 934 | + var start_offset =parseInt(this.embed.start_offset)+parseInt(delta*-1); |
| 935 | + this.embed.updateVideoTime( seconds2ntp(start_offset), seconds2ntp ( this.embed.start_offset + this.embed.getDuration() ) ); |
| 936 | + }else if(side=='end'){ |
| 937 | + var end_offset = parseInt(this.embed.start_offset) + parseInt( this.embed.getDuration() ) + parseInt(delta); |
| 938 | + this.embed.updateVideoTime( seconds2ntp(this.embed.start_offset), seconds2ntp(end_offset) ); |
951 | 939 | } |
| 940 | + /*var base_src = this.src.substr(0,this.src.indexOf('?')); |
| 941 | + js_log("delta:"+ delta); |
| 942 | + if(side=='start'){ |
| 943 | + //since we adjust start invert the delta: |
| 944 | + var start_offset =parseInt(this.embed.start_offset/1000)+parseInt(delta*-1); |
| 945 | + this.src = base_src +'?t='+ seconds2ntp(start_offset) +'/'+ this.embed.end_ntp; |
| 946 | + }else if(side=='end'){ |
| 947 | + //put back into seconds for adjustment: |
| 948 | + var end_offset = parseInt(this.embed.start_offset/1000) + parseInt(this.embed.duration/1000) + parseInt(delta); |
| 949 | + this.src = base_src +'?t='+ this.embed.start_ntp +'/'+ seconds2ntp(end_offset); |
| 950 | + } |
| 951 | + this.embed.updateVideoTime( this.src ); |
| 952 | + //update values |
| 953 | + this.duration = this.embed.getDuration(); |
| 954 | + this.pp.pl_duration=null; |
| 955 | + //update playlist stuff: |
| 956 | + this.pp.updateTitle();*/ |
952 | 957 | } |
953 | 958 | }, |
954 | 959 | getDuration:function(){ |
— | — | @@ -1573,7 +1578,7 @@ |
1574 | 1579 | _this.interface_url = meta_elm.getAttribute('content'); |
1575 | 1580 | } |
1576 | 1581 | } |
1577 | | - }); |
| 1582 | + }); |
1578 | 1583 | //add transition objects: |
1579 | 1584 | var transition_tags = this.data.getElementsByTagName('transition'); |
1580 | 1585 | $j.each(transition_tags, function(i,trans_elm){ |
— | — | @@ -1583,8 +1588,9 @@ |
1584 | 1589 | js_log('skipping transition: (missing id) ' + trans_elm ); |
1585 | 1590 | } |
1586 | 1591 | }); |
1587 | | - js_log('loaded transitions:' + _this.transitions.length); |
1588 | | - //add seq (latter we will have support than one) |
| 1592 | + js_log('loaded transitions:' + _this.transitions.length); |
| 1593 | + |
| 1594 | + //add seq (latter we will have support more than one seq tag) |
1589 | 1595 | var seq_tags = this.data.getElementsByTagName('seq'); |
1590 | 1596 | $j.each(seq_tags, function(i,seq_elm){ |
1591 | 1597 | var inx = 0; |
— | — | @@ -1621,23 +1627,23 @@ |
1622 | 1628 | var mvSMILClip=function(smil_clip_element, mvClipInit){ |
1623 | 1629 | return this.init(smil_clip_element, mvClipInit); |
1624 | 1630 | } |
1625 | | -//http://www.w3.org/TR/2007/WD-SMIL3-20070713/smil-extended-media-object.html#smilMediaNS-BasicMedia |
1626 | | -//and some resource description elements |
1627 | | -var mv_supported_media_attr = new Array( |
1628 | | - 'id', |
1629 | | - 'src', |
1630 | | - 'type', |
1631 | | - 'region', |
1632 | | - 'transIn', |
1633 | | - 'transOut', |
1634 | | - 'fill', |
1635 | | - 'dur', |
1636 | | - |
1637 | | - 'uri', |
1638 | | - 'poster' |
1639 | | -); |
1640 | 1631 | //all the overwritten and new methods for SMIL extension of mv_embed |
1641 | 1632 | mvSMILClip.prototype = { |
| 1633 | + //http://www.w3.org/TR/2007/WD-SMIL3-20070713/smil-extended-media-object.html#smilMediaNS-BasicMedia |
| 1634 | + //and added resource description elements |
| 1635 | + supported_attributes : new Array( |
| 1636 | + 'id', |
| 1637 | + 'src', |
| 1638 | + 'type', |
| 1639 | + 'region', |
| 1640 | + 'transIn', |
| 1641 | + 'transOut', |
| 1642 | + 'fill', |
| 1643 | + 'dur', |
| 1644 | + |
| 1645 | + 'uri', |
| 1646 | + 'poster' |
| 1647 | + ), |
1642 | 1648 | init:function(smil_clip_element, mvClipInit){ |
1643 | 1649 | _this = this; |
1644 | 1650 | |
— | — | @@ -1653,7 +1659,7 @@ |
1654 | 1660 | } |
1655 | 1661 | } |
1656 | 1662 | //get supported media attr init non-set |
1657 | | - $j.each(mv_supported_media_attr, function(i, attr){ |
| 1663 | + $j.each(this.supported_attributes, function(i, attr){ |
1658 | 1664 | if( $j(smil_clip_element).attr(attr)){ |
1659 | 1665 | _this[attr]=$j(smil_clip_element).attr(attr); |
1660 | 1666 | } |
— | — | @@ -1695,32 +1701,41 @@ |
1696 | 1702 | //debugger; |
1697 | 1703 | return this; |
1698 | 1704 | }, |
| 1705 | + //returns the values of supported_attributes: |
| 1706 | + getAttributeObj:function(){ |
| 1707 | + var elmObj = {}; |
| 1708 | + for(var i in this.supported_attributes){ |
| 1709 | + var attr = this.supported_attributes[i]; |
| 1710 | + if(this[attr]) |
| 1711 | + elmObj[ attr ] = this[attr]; |
| 1712 | + } |
| 1713 | + return elmObj; |
| 1714 | + }, |
1699 | 1715 | /* |
1700 | 1716 | * getDuration |
1701 | 1717 | * @returns duration in int |
1702 | 1718 | */ |
1703 | 1719 | getDuration:function(){ |
1704 | 1720 | //check for smil dur: |
1705 | | - if(!this.dur) |
1706 | | - this.dur = this.embed.getDuration(); |
1707 | | - return this.dur; |
| 1721 | + if( this.dur ) |
| 1722 | + return this.dur; |
| 1723 | + return this.embed.getDuration(); |
1708 | 1724 | } |
1709 | 1725 | } |
1710 | 1726 | /* object to manage embedding html with smil timings |
1711 | 1727 | * grabs settings from parent clip |
1712 | 1728 | */ |
1713 | | -var mv_supported_transition_attr = new Array( |
1714 | | - 'id', |
1715 | | - 'type', |
1716 | | - 'subtype', |
1717 | | - 'fadeColor', |
1718 | | - 'dur' |
1719 | | -); |
1720 | | - |
1721 | 1729 | var transitionObj = function(element) { |
1722 | 1730 | this.init(element); |
1723 | 1731 | }; |
1724 | 1732 | transitionObj.prototype = { |
| 1733 | + supported_attributes : new Array( |
| 1734 | + 'id', |
| 1735 | + 'type', |
| 1736 | + 'subtype', |
| 1737 | + 'fadeColor', |
| 1738 | + 'dur' |
| 1739 | + ), |
1725 | 1740 | transAttrType:null, //transIn or transOut |
1726 | 1741 | overlay_selector_id:null, |
1727 | 1742 | pClip:null, |
— | — | @@ -1731,7 +1746,7 @@ |
1732 | 1747 | init:function(element){ |
1733 | 1748 | //load supported attributes: |
1734 | 1749 | var _this = this; |
1735 | | - $j.each(mv_supported_transition_attr, function(i, attr){ |
| 1750 | + $j.each(this.supported_attributes, function(i, attr){ |
1736 | 1751 | if(element.getAttribute(attr)) |
1737 | 1752 | _this[attr]= element.getAttribute(attr); |
1738 | 1753 | }); |
— | — | @@ -1740,6 +1755,16 @@ |
1741 | 1756 | if(_this.dur) |
1742 | 1757 | _this.dur = smilParseTime(_this.dur); |
1743 | 1758 | }, |
| 1759 | + //returns the values of supported_attributes: |
| 1760 | + getAttributeObj:function(){ |
| 1761 | + var elmObj = {}; |
| 1762 | + for(var i in this.supported_attributes){ |
| 1763 | + var attr = this.supported_attributes[i]; |
| 1764 | + if(this[attr]) |
| 1765 | + elmObj[ attr ] = this[attr]; |
| 1766 | + } |
| 1767 | + return elmObj; |
| 1768 | + }, |
1744 | 1769 | /* |
1745 | 1770 | * the main animation loop called every MV_ANIMATION_CB_RATE or 34ms ~around 30frames per second~ |
1746 | 1771 | */ |
— | — | @@ -1833,24 +1858,38 @@ |
1834 | 1859 | var trackObj = function( initObj ){ |
1835 | 1860 | return this.init( initObj ); |
1836 | 1861 | } |
1837 | | - var supported_track_attr = { |
1838 | | - title:'track', |
1839 | | - desc:'track description', |
1840 | | - } |
1841 | | -trackObj.prototype = { |
| 1862 | + var supported_track_attr = |
| 1863 | +trackObj.prototype = { |
| 1864 | + //http://www.w3.org/TR/SMIL3/smil-timing.html#edef-seq |
| 1865 | + //(We don't closely mirror the smil spec at this point) |
| 1866 | + // but we don't really support anywhere near the full concept of seq containers yet either |
| 1867 | + supported_attributes: new Array( |
| 1868 | + 'title', |
| 1869 | + 'desc:' |
| 1870 | + ), |
1842 | 1871 | disp_mode:'timeline_thumb', |
1843 | 1872 | init : function(initObj){ |
1844 | 1873 | if(!initObj) |
1845 | 1874 | initObj={}; |
1846 | | - |
| 1875 | + //make sure clips is new: |
1847 | 1876 | this.clips = new Array(); |
1848 | 1877 | |
1849 | 1878 | var _this = this; |
1850 | | - $j.each(supported_track_attr, function(i, attr){ |
| 1879 | + $j.each(this.supported_attributes, function(i, attr){ |
1851 | 1880 | if(initObj[attr]) |
1852 | 1881 | _this[attr] = initObj[attr]; |
1853 | 1882 | }); |
1854 | 1883 | }, |
| 1884 | + //returns the values of supported_attributes: |
| 1885 | + getAttributeObj:function(){ |
| 1886 | + var elmObj = {}; |
| 1887 | + for(var i in this.supported_attributes){ |
| 1888 | + var attr = this.supported_attributes[i]; |
| 1889 | + if(this[attr]) |
| 1890 | + elmObj[ attr ] = this[attr]; |
| 1891 | + } |
| 1892 | + return elmObj; |
| 1893 | + }, |
1855 | 1894 | addClip:function(clipObj, pos){ |
1856 | 1895 | js_log('ignored pos: '+ pos); |
1857 | 1896 | //for now just add to the end: |