r42757 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42756‎ | r42757 | r42758 >
Date:02:10, 29 October 2008
Author:dale
Status:old
Tags:
Comment:
updated sequencer advanced timeline support, json pull of sequencer tools for the eventual support of remote editing, basic xml output of sequencer state
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_SequenceTools.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/articlepages/MV_SequencePage.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php (modified) (history)
  • /trunk/extensions/MetavidWiki/languages/MV_Messages.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_htmlEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_page.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_sequencer.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php
@@ -479,6 +479,32 @@
480480 /*
481481 * Utility functions:
482482 */
 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+}
483509 if ( ! function_exists( 'php2jsObj' ) ) {
484510 function php2jsObj( $array, $objName = 'mv_result' )
485511 {
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php
@@ -121,11 +121,22 @@
122122 $this->get_roe_xml();
123123 break;
124124 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 );
126131 break;
127132 case 'json_roe':
128133 // 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 );
130141 break;
131142 }
132143 break;
@@ -211,36 +222,7 @@
212223 // get all avaliable files
213224 $this->file_list = $this->mvTitle->mvStream->getFileList();
214225 }
215 - function get_json( $type = '' ) {
216 - $fname = 'Mv_SpecialExport::get_roe_json';
217 - wfProfileIn( $fname );
218 -
219 - global $wgRequest;
220226
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 - }
245227 // start high level:
246228 function get_roe_xml( $header = true ) {
247229 global $wgServer;
Index: trunk/extensions/MetavidWiki/includes/articlepages/MV_SequencePage.php
@@ -152,6 +152,7 @@
153153 $node->setAttribute('type','text/html');
154154 return $this->parseInnerWikiText($node);
155155 }
 156+
156157 $uriTitle = Title::newFromDBkey($node_uri);
157158 //figure out if how we should parse innerHTML:
158159 switch( $uriTitle->getNamespace() ){
@@ -184,20 +185,23 @@
185186 return $node;
186187 }
187188
 189+ //by default set the ogg source
188190 //@@todo parse child nodes for stream request params?
189 - $f = $node->ownerDocument->createDocumentFragment();
 191+
190192 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:
195198 if( $flash_stream_url ){
 199+ $f = $node->ownerDocument->createDocumentFragment();
196200 $f->appendXML( '<source type="' .
197201 htmlspecialchars( MV_StreamFile::getTypeForQK( $mvDefaultFlashQualityKey ) ) .
198202 '" src="' . $flash_stream_url . '"></source>' );
199 - }
200 - $node->appendChild($f);
201 -
 203+ $node->appendChild($f);
 204+ }
 205+
202206 break;
203207 case NS_TEMPLATE:
204208 //templates are of type text/html
@@ -258,7 +262,7 @@
259263 $this->parseInnerWikiText( $node, $thumbnail->toHtml() );
260264 }else{
261265 $node->setAttribute( 'type', $img->getMimeType() );
262 - $node->setAttribute( 'src', $thumbnail->file->getURL() );
 266+ $node->setAttribute( 'src', $thumbnail->getURL() );
263267
264268 //if type is ogg: (set dur and poster)
265269 if( $img->getMimeType()=='application/ogg') {
@@ -268,7 +272,7 @@
269273 $node->setAttribute('poster', $thumbnail->url);
270274 }
271275 }
272 - }
 276+ }
273277 break;
274278 default:
275279 $node->setAttribute('type','text/html');
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_SequenceTools.php
@@ -13,6 +13,13 @@
1414 // make sure the parent class mv_component is included
1515
1616 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+ );
1724 function getHTML() {
1825 global $wgOut;
1926 // @@todo look at mv_interface context to get what to display in tool box:
@@ -24,7 +31,20 @@
2532 $wgOut->addHTML( '</div>' );
2633 }
2734 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:
2949 switch( $tool_id ) {
3050 case 'sequence_page':
3151 global $mvgIP, $wgOut, $wgParser, $wgTitle;
@@ -54,17 +74,22 @@
5575 case 'options':
5676 $this->add_editor_options();
5777 break;
58 - default:
59 - $wgOut->addHTML( wfMsg('mv_tool_missing'), $tool_id);
 78+ default:
 79+ $wgOut->addHTML( wfMsg('mv_tool_missing', htmlspecialchars ($tool_id) ) );
6080 break;
6181 }
6282 return $wgOut->getHTML();
6383 }
6484 function add_embed_search() {
6585 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+ );
6994 }
7095 function add_editor_options(){
7196 global $wgOut;
@@ -163,11 +188,5 @@
164189 return $wgOut->getHTML();
165190 }
166191 }
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 - }
173192 }
174193 ?>
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php
@@ -453,7 +453,7 @@
454454 global $wgUser, $mvgScriptPath, $wgRequest;
455455 $sk = $wgUser->getSkin();
456456
457 - // hack to get menu correct... (previsuly menu was not encapulsated)
 457+ // hack to get menu correct...
458458 $do_adjust = $wgRequest->getVal( 'do_adjust' );
459459 //fix boolean string issue:
460460 $do_adjust = ( $do_adjust == 'false' ) ? false : $do_adjust;
@@ -477,6 +477,7 @@
478478 $hTitle = Title::newFromText( $mvd_page->wiki_title, MV_NS_MVD );
479479 // print $hTitle->
480480 $hlink = $sk->makeKnownLinkObj( $hTitle, wfMsg( 'mv_history' ), 'action=history' );
 481+
481482 $dTitle = Title::newFromText( $mvd_page->wiki_title, MV_NS_MVD_TALK );
482483 $dlink = $sk->makeKnownLinkObj( $dTitle, wfMsg( 'talk' ) );
483484
@@ -750,12 +751,12 @@
751752 $wpTextbox1 .= "\n[[" . $catNStxt . ":" . $v . "]]";
752753 }
753754 }
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
755756 $editPageAjax = new MV_EditPageAjax( $Article );
756757 $editPageAjax->mvd_id = $mvd_id;
757758
758759 // 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)
760761 // use the "livePreview" functionality of Edit page.
761762 if ( isset( $_POST['wpPreview'] ) ) {
762763 // $out = $editPageAjax->getPreviewText();
Index: trunk/extensions/MetavidWiki/languages/MV_Messages.php
@@ -244,6 +244,9 @@
245245 'mv_resource_not_supported'=>"Resource '''$1''' type not supported",
246246 'mv_welcome_to_sequencer' => '<h3>Welcome to The sequencer demo</h3>'.
247247 'very <b>limited</b> functionality right now',
 248+ 'mv_resource_locator'=>'Resource Locator',
 249+
 250+ 'mv_media_search'=>'Media Search',
248251
249252 'mv_editor_options'=>'Editor options',
250253 'mv_editor_mode' =>'Editor mode',
@@ -273,7 +276,7 @@
274277 'mv_embed_options' => 'Embed options',
275278 'mv_overlay' => 'Overlay controls',
276279 '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',
278281 'mv_bad_tool_request' => 'bad tool line should be form: tool_name|tool_display_name',
279282 'mv_update_layers' => 'update layers view',
280283
Index: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_page.php
@@ -40,10 +40,10 @@
4141 // '<a href="javascript:document.getElementById(\'vflash\').play();">Play</a> | ' .
4242 // '<a href="javascript:document.getElementById(\'vflash\').stop();">Stop</a> <br />';
4343
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">';
4545 $sample_embed[1]['desc'] = 'Demo of json ROE attribute';
4646
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>';
4848 $sample_embed[3]['desc'] = 'Demo of ROE only attribute';
4949
5050
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_htmlEmbed.js
@@ -84,7 +84,8 @@
8585 var thumb_render_id = this.id +'_thumb_render_'+ options.height;
8686 if( $j('#' + thumb_render_id ).length == 0 || do_refresh ){
8787 //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 );
8990 //min scale font percent of 70 (overflow is hidden)
9091 var font_perc = ( Math.round( scale_perc*100 ) < 80 )?80:Math.round( scale_perc*100 );
9192
@@ -104,12 +105,12 @@
105106 });
106107
107108 //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(){
109110 $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 )
112113 }
113 - );
 114+ );
114115 });
115116 }
116117 return $j('#' + thumb_render_id ).html();
@@ -118,12 +119,12 @@
119120 //@@todo render out a mini text "preview"
120121 updateThumbTime:function( float_time ){
121122 return ;
122 - },
 123+ },
123124 getEmbedHTML:function(){
124125 js_log('f:html:getEmbedHTML');
125126 //set up the css for our parent div:
126127 $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:
128129
129130 //wrap output in videoPlayer_ div:
130131 $j(this).html('<div id="videoPlayer_'+ this.id+'">'+this.getThumbnailHTML()+'</div>');
@@ -132,10 +133,11 @@
133134 var out='';
134135 if( this.pc.type =='image/jpeg'){
135136 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+'">';
137138 }else{
138139 out = this.pc.wholeText;
139140 }
 141+ js_log('f:getThumbnailHTML: got thumb: '+out);
140142 return out;
141143 },
142144 doThumbnailHTML:function(){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -1490,24 +1490,22 @@
14911491 * @param {String} end_time in NTP format
14921492 */
14931493 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);
14951495 //js_log("pre uri:" + this.src);
14961496 //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
15081507 this.parseURLDuration();
1509 - }
1510 -
1511 - //update the duration
 1508+ }
 1509+ //this.setDuration( )
15121510 //js_log("post uri:" + this.src);
15131511 },
15141512 setDuration:function (duration)
@@ -1557,7 +1555,7 @@
15581556 * supports media_url?t=ntp_start/ntp_end url request format
15591557 */
15601558 parseURLDuration : function(){
1561 - //js_log('f:parseURLDuration() for:' + this.src);
 1559+ js_log('f:parseURLDuration() for:' + this.src);
15621560 var index_time_val = false;
15631561 if(this.src.indexOf('?t=')!=-1)index_time_val='?t=';
15641562 if(this.src.indexOf('&t=')!=-1)index_time_val='&t=';
@@ -1651,10 +1649,10 @@
16521650 },
16531651 /** Updates the time request for all sources that have a standard time request argument (ie &t=start_time/end_time)
16541652 */
1655 - updateSourceTimes:function(start_time, end_time){
 1653+ updateSourceTimes:function(start_ntp, end_ntp){
16561654 var _this = this;
16571655 $j.each(this.sources, function(inx, mediaSource){
1658 - mediaSource.updateSrcTime(start_time, end_time);
 1656+ mediaSource.updateSrcTime(start_ntp, end_ntp);
16591657 });
16601658 },
16611659 /** Returns the array of mediaSources of this element.
@@ -2059,8 +2057,12 @@
20602058 return this.media_element.selected_source.start_ntp+'/'+this.media_element.selected_source.end_ntp;
20612059 },
20622060 getDuration:function(){
 2061+ //update some local pointers for the selected source:
20632062 this.duration = this.media_element.selected_source.duration;
20642063 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
20652067 return this.duration;
20662068 },
20672069 /* get the duration in ntp format */
@@ -2411,23 +2413,18 @@
24122414 this.updateVideoTime(time_parts[0], time_parts[1]);
24132415 },
24142416 //update video time
2415 - updateVideoTime:function(start_time, end_time){
 2417+ updateVideoTime:function(start_ntp, end_ntp){
24162418 //update media
2417 - this.media_element.updateSourceTimes(start_time, end_time);
 2419+ this.media_element.updateSourceTimes( start_ntp, end_ntp );
24182420 //update mv_time
2419 - this.setStatus(start_time+'/'+end_time);
 2421+ this.setStatus(start_ntp+'/'+end_ntp);
24202422 //reset slider
24212423 this.setSliderValue(0);
24222424 //reset seek_offset:
24232425 if(this.media_element.selected_source.supports_url_time_encoding)
24242426 this.seek_time_sec=0;
24252427 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);
24322429 },
24332430 //@@todo overwite by embed library if we can render frames natavily
24342431 renderTimelineThumbnail:function( options ){
@@ -2435,7 +2432,7 @@
24362433
24372434 if( my_thumb_src.indexOf('t=') !== -1){
24382435 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 );
24402437 }
24412438 return '<img src="' + my_thumb_src +'" '+
24422439 'style="height:' + options.height + 'px;' +
@@ -2792,7 +2789,7 @@
27932790 js_log("mv_embed play:"+this.id);
27942791 js_log('thum disp:'+this.thumbnail_disp);
27952792 //check if thumbnail is being displayed and embed html
2796 - if(this.thumbnail_disp){
 2793+ if( this.thumbnail_disp ){
27972794 if(!this.selected_player){
27982795 js_log('no selected_player');
27992796 //this.innerHTML = this.getPluginMissingHTML();
@@ -2982,14 +2979,12 @@
29832980 * takes hh:mm:ss input returns number of seconds
29842981 */
29852982 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);
29892985 }
29902986 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);
29942989 }
29952990 //return seconds float (ie take seconds float value if present):
29962991 return parseInt(times[0]*3600)+parseInt(times[1]*60)+parseFloat(times[2]);
@@ -2998,7 +2993,7 @@
29992994 function mv_addLoadEvent(func) {
30002995 mvEmbed.addLoadEvent(func);
30012996 }
3002 -function do_request(req_url, callback, mv_json_response){
 2997+function do_request(req_url, callback){
30032998 js_log('do request: ' + req_url);
30042999 if( parseUri(document.URL).host == parseUri(req_url).host){
30053000 //no proxy at all do a direct request:
@@ -3006,8 +3001,8 @@
30073002 type: "GET",
30083003 url:req_url,
30093004 async: false,
3010 - success:function(data){
3011 - callback(data);
 3005+ success:function(data){
 3006+ callback( data );
30123007 }
30133008 });
30143009 }else{
@@ -3055,7 +3050,7 @@
30563051 return false;
30573052 break;
30583053 }
3059 - global_req_cb[response['cb_inx']](response['pay_load']);
 3054+ global_req_cb[response['cb_inx']]( response['pay_load'] );
30603055 }
30613056 //load external js via dom injection
30623057 //@@todo swich over to jQuery injection
@@ -3165,7 +3160,7 @@
31663161 }*/
31673162 }
31683163 //give the string back (ie in cases of returning an error)
3169 - return string;
 3164+ return false;
31703165 }
31713166
31723167 function js_error(string){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_sequencer.js
@@ -93,14 +93,14 @@
9494 'resource_overview':0,
9595 'options':0
9696 },
97 - init:function(initObj){
 97+ init:function( initObj ){
9898 //set the default values:
99 - for(i in sequencerDefaultValues){
 99+ for(var i in sequencerDefaultValues){
100100 this[ i ] = sequencerDefaultValues[i];
101101 }
102102 //@@todo deal with multi-dimensional object updates
103103 // (ie one word in wfMsg does not replace the whole wfMsg default set)
104 - for(i in initObj){
 104+ for(var i in initObj){
105105 //js_log('on '+ i + ' :' + initObj[i]);
106106 if(sequencerDefaultValues[i]){ //make sure its a valid property
107107 this[i]=initObj[i];
@@ -132,8 +132,21 @@
133133 '<div id="'+this.sequence_tools_id+'" style="position:absolute;' +
134134 'left:0px;right:'+(this.video_width+10)+'px;top:0px;height:'+this.video_height+'px;border:solid thin black;"/>'+
135135 '<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+ );
138151
139152 js_log('set: '+this.sequence_container_id + ' html to:'+ "\n"+
140153 $j('#'+this.sequence_container_id).html()
@@ -163,30 +176,49 @@
164177 $j('#'+i+'_ic').filter(':visible').hide("slide", { direction: "down" }, "fast");
165178 }
166179 },
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');
170183 if( !this.plObj.interface_url )
171184 return js_log( 'Error:missing interface_url, can not load item' );
172185
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+
177206 //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+ //});
182211 },
183 - doMenuItemDispJs:function(item, target_id){
 212+ doMenuItemDispJs:function(item){
184213 var _this = this;
 214+ var target_id = item + '_ic';
185215 //do any menu item post embed js hook processing:
186216 switch(item){
187 - case 'cliplib':
188 - //setup extra search functions
 217+ case 'cliplib':
 218+ $j('#mv_ams_submit').click(function(){
 219+ _this.doClipSearch();
 220+ })
189221 break;
190 - case 'options':
 222+ case 'options':
191223 $j('#'+target_id+" input[value='simple_editor']").attr({
192224 'checked':(_this.timeline_mode=='clip')?true:false
193225 }).click(function(){
@@ -199,7 +231,7 @@
200232 });
201233 break;
202234 }
203 - },
 235+ },
204236 renderTimeLine:function(){
205237 //empty out the top level html:
206238 $j('#'+this.timeline_id).html('');
@@ -322,8 +354,7 @@
323355 $j('#'+this.sequence_tools_id).html( menu_html + item_containers );
324356
325357 //load init content into containers
326 - for(var i in this.menu_items)
327 - this.loadInitMenuItem(i, i+'_ic');
 358+ this.loadInitMenuItems();
328359
329360 //render the timeline
330361 this.renderTimeLine();
@@ -338,17 +369,53 @@
339370 //js_log('at time:'+ jh_time_sec + ' px:'+ Math.round(jh_time_sec_float/this.timeline_scale));
340371 },
341372 /*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');
352375 },
 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+ },
353420 //add clips to the pl object: (by default to the end of the track)
354421 addClip:function(clip_init){
355422 js_log("seq: add clip");
@@ -409,6 +476,9 @@
410477 saveClipEdit:function(){
411478 //saves the clip updates
412479 },
 480+ closeModEditor:function(){
 481+ $j('#modalbox').hide();
 482+ },
413483 closeModWindow:function(){
414484 $j('#modal_window').hide();
415485 $j('#modalbox').show();
@@ -425,19 +495,19 @@
426496 }
427497 }
428498 //re-render tracks:
429 - this_seq.render_tracks(track_inx);
 499+ this_seq.render_tracks( track_inx );
430500
431501 if(this_seq.plObj.tracks[track_inx].clips.length==0){
432502 this_seq.plObj.getHTML();
433503 }else{
434 - //update playlist desc:
 504+ //update playlist desc:
435505 this_seq.plObj.pl_duration=null;
436506 this_seq.plObj.updateTitle();
437507 }
438508 });
439509 },
440510 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")
442512 this.edit_stack.push( editObj );
443513 //make the adjustments
444514 this.makeAdjustment( editObj );
@@ -695,6 +765,7 @@
696766 $j('#' + this.id + ' > .mv_clip_stats').fadeIn("fast");
697767 },
698768 stop: function(e,ui) {
 769+ js_log('stop resize');
699770 //restore border
700771 $j(this).css('border', 'solid thin white');
701772 //remove stats
@@ -712,7 +783,7 @@
713784 });
714785 },
715786 resize: function(e,ui) {
716 - //update time stats / render images:
 787+ //update time stats & render images:
717788 this_seq.update_clip_resize(this);
718789 }
719790 });
@@ -738,6 +809,7 @@
739810 clip_frames_html+=clip.embed.renderTimelineThumbnail({
740811 'width': frame_width,
741812 'height': this.track_thumb_height,
 813+ 'size' : "icon", //set size to "icon" preset
742814 'time': clip_time
743815 });
744816 }
@@ -785,7 +857,7 @@
786858 var new_start = seconds2ntp(ntp2seconds(clip.embed.start_ntp)+clip_dif);
787859 clip_desc+='<br>start time: ' + new_start;
788860 }
789 -
 861+
790862 //update clip stats:
791863 $j('#'+clip_element.id+' > .mv_clip_stats').html(clip_desc);
792864 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 @@
286286 //check for smil tag:
287287 smilElm = this.data.getElementsByTagName('smil')[0];
288288 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)
290290 this.srcType='smil';
291291 }
292292 }else if(typeof this.data == 'string'){
@@ -927,27 +927,32 @@
928928
929929 },
930930 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) );
951939 }
 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();*/
952957 }
953958 },
954959 getDuration:function(){
@@ -1573,7 +1578,7 @@
15741579 _this.interface_url = meta_elm.getAttribute('content');
15751580 }
15761581 }
1577 - });
 1582+ });
15781583 //add transition objects:
15791584 var transition_tags = this.data.getElementsByTagName('transition');
15801585 $j.each(transition_tags, function(i,trans_elm){
@@ -1583,8 +1588,9 @@
15841589 js_log('skipping transition: (missing id) ' + trans_elm );
15851590 }
15861591 });
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)
15891595 var seq_tags = this.data.getElementsByTagName('seq');
15901596 $j.each(seq_tags, function(i,seq_elm){
15911597 var inx = 0;
@@ -1621,23 +1627,23 @@
16221628 var mvSMILClip=function(smil_clip_element, mvClipInit){
16231629 return this.init(smil_clip_element, mvClipInit);
16241630 }
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 -);
16401631 //all the overwritten and new methods for SMIL extension of mv_embed
16411632 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+ ),
16421648 init:function(smil_clip_element, mvClipInit){
16431649 _this = this;
16441650
@@ -1653,7 +1659,7 @@
16541660 }
16551661 }
16561662 //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){
16581664 if( $j(smil_clip_element).attr(attr)){
16591665 _this[attr]=$j(smil_clip_element).attr(attr);
16601666 }
@@ -1695,32 +1701,41 @@
16961702 //debugger;
16971703 return this;
16981704 },
 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+ },
16991715 /*
17001716 * getDuration
17011717 * @returns duration in int
17021718 */
17031719 getDuration:function(){
17041720 //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();
17081724 }
17091725 }
17101726 /* object to manage embedding html with smil timings
17111727 * grabs settings from parent clip
17121728 */
1713 -var mv_supported_transition_attr = new Array(
1714 - 'id',
1715 - 'type',
1716 - 'subtype',
1717 - 'fadeColor',
1718 - 'dur'
1719 -);
1720 -
17211729 var transitionObj = function(element) {
17221730 this.init(element);
17231731 };
17241732 transitionObj.prototype = {
 1733+ supported_attributes : new Array(
 1734+ 'id',
 1735+ 'type',
 1736+ 'subtype',
 1737+ 'fadeColor',
 1738+ 'dur'
 1739+ ),
17251740 transAttrType:null, //transIn or transOut
17261741 overlay_selector_id:null,
17271742 pClip:null,
@@ -1731,7 +1746,7 @@
17321747 init:function(element){
17331748 //load supported attributes:
17341749 var _this = this;
1735 - $j.each(mv_supported_transition_attr, function(i, attr){
 1750+ $j.each(this.supported_attributes, function(i, attr){
17361751 if(element.getAttribute(attr))
17371752 _this[attr]= element.getAttribute(attr);
17381753 });
@@ -1740,6 +1755,16 @@
17411756 if(_this.dur)
17421757 _this.dur = smilParseTime(_this.dur);
17431758 },
 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+ },
17441769 /*
17451770 * the main animation loop called every MV_ANIMATION_CB_RATE or 34ms ~around 30frames per second~
17461771 */
@@ -1833,24 +1858,38 @@
18341859 var trackObj = function( initObj ){
18351860 return this.init( initObj );
18361861 }
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+ ),
18421871 disp_mode:'timeline_thumb',
18431872 init : function(initObj){
18441873 if(!initObj)
18451874 initObj={};
1846 -
 1875+ //make sure clips is new:
18471876 this.clips = new Array();
18481877
18491878 var _this = this;
1850 - $j.each(supported_track_attr, function(i, attr){
 1879+ $j.each(this.supported_attributes, function(i, attr){
18511880 if(initObj[attr])
18521881 _this[attr] = initObj[attr];
18531882 });
18541883 },
 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+ },
18551894 addClip:function(clipObj, pos){
18561895 js_log('ignored pos: '+ pos);
18571896 //for now just add to the end:

Status & tagging log