r72276 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72275‎ | r72276 | r72277 >
Date:11:17, 3 September 2010
Author:dale
Status:deferred
Tags:
Comment:
fixes old videoBufferSeek call
added msgs for sequencer
fixed loader calls to include widget and mouse par of juqery ui 1.8.4 upgrade )
expanded flatten dialog box so it does not get cut off
more testing and minor fixes
Modified paths:
  • /branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/loader.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js (modified) (history)
  • /branches/MwEmbedStandAlone/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
@@ -89,7 +89,7 @@
9090 this.getElementsForTime( time ,
9191 /* SMIL Element in Range */
9292 function( smilElement) {
93 - mw.log("SmilBody::renderTime: Element in Range" + $j( smilElement ).attr('id'));
 93+ //mw.log("SmilBody::renderTime: Element in Range" + $j( smilElement ).attr('id'));
9494 // var relativeTime = time - smilElement.parentTimeOffset;
9595 var relativeTime = time - $j( smilElement ).data ( 'startOffset' );
9696
@@ -101,7 +101,7 @@
102102 },
103103 /* SMIL Element out of range */
104104 function( smilElement ){
105 - mw.log("SmilBody::renderTime: Element out of Range" + $j( smilElement ).attr('id'));
 105+ //mw.log("SmilBody::renderTime: Element out of Range" + $j( smilElement ).attr('id'));
106106 // Stop the animation or playback
107107 _this.smil.getAnimate().pauseAnimation( smilElement )
108108
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
@@ -130,7 +130,7 @@
131131 case 'img':
132132 case 'cdata_html':
133133 case 'smiltext':
134 - // Give the static content a getSmilElementPlayerID for player layaer control
 134+ // Give the static content a getSmilElementPlayerID for player layer control
135135 var $target = $j('<div />')
136136 .attr('id', _this.smil.getSmilElementPlayerID( smilElement ) )
137137 .css({
@@ -208,7 +208,7 @@
209209 break;
210210 case 'mwtemplate':
211211 $target.loadingSpinner();
212 - this.addSmilTemplateHtml( smilElement, $target, callback );
 212+ this.getSmilTemplateHtml( smilElement, $target, callback );
213213 return;
214214 break;
215215 case 'cdata_html':
@@ -371,7 +371,7 @@
372372 /**
373373 * Add Smil Template to a $target
374374 */
375 - addSmilTemplateHtml: function( smilElement, $target, callback ){
 375+ getSmilTemplateHtml: function( smilElement, $target, callback ){
376376 var _this = this;
377377 var addTemplateHtmlToTarget = function(){
378378 // Add the html to the target:
@@ -400,7 +400,7 @@
401401 return ;
402402 }
403403
404 - mw.log("addSmilTemplateHtml:: x-wikitemplate:: " + $j( smilElement).attr( 'apititlekey' ) + " to target:" + $target.attr('class'));;
 404+ mw.log("getSmilTemplateHtml:: x-wikitemplate:: " + $j( smilElement).attr( 'apititlekey' ) + " to target:" + $target.attr('class'));;
405405 // build a wikitext call ( xml keys lose case when put into xml )
406406 var templateKey = $j( smilElement).attr( 'apititlekey' );
407407 if(!templateKey){
@@ -526,7 +526,9 @@
527527 return $j('<div />')
528528 // Wrap in font-size percentage relative to virtual size
529529 .css( {
530 - 'font-size': ( scalePercent *100 ) + '%'
 530+ 'font-size': ( scalePercent *100 ) + '%',
 531+ 'width': '100%',
 532+ 'height' : '100%'
531533 })
532534 .append(
533535 $htmlLayout.css( textCss )
@@ -703,11 +705,15 @@
704706 */
705707 panZoomLayout: function( smilElement, $target, img ){
706708 var _this = this;
 709+ mw.log( 'panZoomLayout:' + $j( smilElement).attr('id') );
707710 var panZoom = $j( smilElement).attr('panZoom').split(',');
708711 if( !img ){
709 - var img = $j( '#' + this.smil.getSmilElementPlayerID( smilElement ) ).get(0);
 712+ var img = $j( '#' + this.smil.getSmilElementPlayerID( smilElement ) ).find('img').get(0);
 713+ if( !img){
 714+ mw.log('Error getting image for ' + $j( smilElement).attr('id') );
 715+ }
710716 }
711 -
 717+
712718 _this.getNaturalSize( img, function( natrualSize ){
713719 // Check if the transfrom is needed:
714720 if( parseInt( panZoom.left ) == 0
@@ -719,11 +725,13 @@
720726 ( parseInt( panZoom.height ) == 100 && panZoom.height.indexOf('%') != -1 )
721727 ){
722728 // no transform is needed
 729+ mw.log("no transofmr needed: " + parseInt( panZoom.left ) + ' = 0 && ' +
 730+ ( parseInt( panZoom.width ) ) );
723731 return ;
724732 }
725733 // Get percent values
726734 var percentValues = _this.smil.getAnimate().getPercentFromPanZoomValues( panZoom, natrualSize );
727 - //mw.log('panZoomLayout::' + 'l:' + percentValues.left + ' t:' + percentValues.top + ' w:' + percentValues.width + ' h:' + percentValues.height );
 735+ mw.log('panZoomLayout::' + 'l:' + percentValues.left + ' t:' + percentValues.top + ' w:' + percentValues.width + ' h:' + percentValues.height );
728736 // Update the layout via the animation engine updateElementLayout method
729737 _this.smil.getAnimate().updateElementLayout( smilElement, percentValues, $target, img );
730738 });
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
@@ -235,7 +235,7 @@
236236 //mw.log( "SmilAnimate::transformVideoForTime:" + assetId + " ct:" +vid.currentTime + ' should be: ' + videoSeekTime );
237237
238238 // Register a buffer ready callback
239 - this.smil.getBuffer().videoBufferSeek( smilElement, videoSeekTime, function() {
 239+ this.smil.getBuffer().mediaBufferSeek( smilElement, videoSeekTime, function() {
240240 //mw.log( "transformVideoForTime:: seek complete ")
241241 if( callback )
242242 callback();
@@ -435,7 +435,7 @@
436436 // xxx need to refactor move to "smilLayout"
437437 updateElementLayout: function( smilElement, percentValues, $target, htmlElement ){
438438 var _this = this;
439 - //mw.log("updateElementLayout::" + ' ' + percentValues.left + ' ' + percentValues.top + ' ' + percentValues.width + ' ' + percentValues.height );
 439+ mw.log("updateElementLayout::" + ' ' + percentValues.left + ' ' + percentValues.top + ' ' + percentValues.width + ' ' + percentValues.height );
440440
441441 // get a pointer to the html target:
442442 if( !$target ) {
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
@@ -156,8 +156,7 @@
157157 // Set up the embed video player class request: (include the skin js as well)
158158 var dependencyRequest = [
159159 [
160 - '$j.ui',
161 - '$j.widget',
 160+ '$j.ui',
162161 'mw.EmbedPlayer',
163162 'mw.PlayerControlBuilder',
164163 '$j.fn.hoverIntent',
@@ -167,6 +166,7 @@
168167 'JSON'
169168 ],
170169 [
 170+ '$j.widget',
171171 '$j.ui.mouse',
172172 '$j.fn.menu',
173173 'mw.style.jquerymenu',
Index: branches/MwEmbedStandAlone/modules/Sequencer/loader.js
@@ -87,7 +87,8 @@
8888 '$j.fn.layout',
8989
9090 // UI components used in the sequencer interface:
91 - '$j.ui.mouse',
 91+ '$j.ui.mouse',
 92+ '$j.widget',
9293 '$j.ui.accordion',
9394 '$j.ui.dialog',
9495 '$j.ui.droppable',
@@ -95,7 +96,7 @@
9697 '$j.ui.progressbar',
9798 '$j.ui.sortable',
9899 '$j.ui.resizable',
99 - '$j.ui.slider',
 100+ '$j.ui.slider',
100101 '$j.ui.tabs'
101102 ]
102103 ];
Index: branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
@@ -45,8 +45,11 @@
4646 'mwe-sequencer-tools-panzoomhelper-desc' => 'Resize and move the <i>layout helper</i> to update layout',
4747 'mwe-sequencer-tools-panzoomhelper-resetlayout' => 'Reset layout',
4848
 49+ 'mwe-sequencer-tools-templateedit' => 'Edit template',
 50+ 'mwe-sequencer-template-name' => 'Template page name',
 51+ 'mwe-sequencer-tools-templateedit-desc' => 'Edit template parameters',
 52+ 'mwe-sequencer-edittemplate-params' => 'Template parameters',
4953
50 -
5154 'mwe-sequencer-tools-transitions' => 'Transitions',
5255 'mwe-sequencer-tools-transitions-desc' => 'Set in and out Transitions',
5356 'mwe-sequencer-clip-transin' => 'Transition in',
Index: branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
@@ -252,7 +252,7 @@
253253 'title' : gM('mwe-sequencer-menu-sequence-publish-desc'),
254254 'content' : gM('mwe-sequencer-loading-publish-render'),
255255 'width' : 450,
256 - 'height' : 400
 256+ 'height' : 470
257257 });
258258
259259 // Check if we have unsaved changes ( don't publish unsaved changes )
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
@@ -40,7 +40,7 @@
4141 },
4242 'templateedit':{
4343 'editWidgets' : ['edittemplate'],
44 - 'editableAttributes' : [ 'apiTitleKey' ],
 44+ 'editableAttributes' : [ 'apititlekey' ],
4545 'contentTypes' : ['mwtemplate']
4646 },
4747 'transitions' : {
@@ -63,9 +63,9 @@
6464 'title' : gM('mwe-sequencer-clip-panzoom' ),
6565 'defaultValue' : '0%, 0%, 100%, 100%'
6666 },
67 - 'apiTitleKey' : {
 67+ 'apititlekey' : {
6868 'type' : 'string',
69 - 'inputSize' : 15,
 69+ 'inputSize' : 30,
7070 'title' : gM('mwe-sequencer-template-name' )
7171 },
7272 'transIn' : {
@@ -79,28 +79,34 @@
8080 // Special child node type
8181 'param' : {
8282 'type' : 'childParam',
83 - 'inputSize' : 20
 83+ 'inputSize' : 30
8484 }
8585 },
8686 editableTypes: {
8787 'childParam': {
88 - update: function( _this, smilElement, paramName, value){
 88+ update: function( _this, smilElement, paramName, value){
8989 // Check if the param already exists
90 - $paramNode = $j( smilElement ).find( "[name='"+ paramName + '"]' );
 90+ $paramNode = $j( smilElement ).find( "[name='"+ paramName + "']" );
9191 if( $paramNode.length == 0){
9292 $j( smilElement ).append(
93 - $j('<param />').attr('name', paramName)
 93+ $j('<param />').attr({
 94+ 'name': paramName,
 95+ 'value' : value
 96+ })
9497 )
 98+ } else {
 99+ // Update the param value
 100+ $paramNode.attr( 'value', value);
95101 }
96 - // Update the param value
97 - $paramNode.attr( 'value', value);
 102+ mw.log("editableTypes::Should have updated smilElement param: " + paramName
 103+ + ' to : ' + $j( smilElement ).find( "[name='"+ paramName + '"]' ).attr( 'value') );
98104 },
99 - getSmilVal: function( _this, smilElement, paramName, value){
100 - $paramNode = $j( smilElement ).find( "[name='"+ paramName + '"]' );
 105+ getSmilVal: function( _this, smilElement, paramName ){
 106+ $paramNode = $j( smilElement ).find( "[name='"+ paramName + "']" );
101107 if( $paramNode.length == 0){
102108 return '';
103109 }
104 - $paramNode.attr('value');
 110+ return $paramNode.attr('value');
105111 }
106112 },
107113 'string': {
@@ -185,8 +191,16 @@
186192 },
187193 editWidgets: {
188194 'edittemplate':{
189 - 'onChange' : function( _this, target, smilElement ){
190 -
 195+ 'onChange' : function( _this, smilElement, target ){
 196+ // Clear the smilElement template cache:
 197+ $j( smilElement ).data('templateHtmlCache', null);
 198+ // Re draw the smilElement in the player
 199+ var smil = _this.sequencer.getSmil();
 200+ $playerTarget = $j('#' + smil.getSmilElementPlayerID( smilElement ) );
 201+ $playerTarget.loadingSpinner();
 202+ smil.getLayout().getSmilTemplateHtml( smilElement, $playerTarget, function(){
 203+ mw.log("SequencerTools::editWidgets: smil template updated");
 204+ });
191205 },
192206 'draw': function( _this, target, smilElement ){
193207 // Parse the set of templates from the template text cache
@@ -197,19 +211,23 @@
198212 return ;
199213 }
200214 // Get the template wikitext
201 - _this.sequencer.getServer().getTemplateText($j( smilElement).attr('apititlekey'), function( templateText ){
202 - if( ! templateText ){
 215+ _this.sequencer
 216+ .getServer()
 217+ .getTemplateText( $j( smilElement).attr('apititlekey'), function( templateText ){
 218+ mw.log("GotTemplateText: " + templateText );
 219+ if( ! templateText || typeof templateText != 'string' ){
203220 mw.log("Error: could not get wikitext form titlekey: " + $j( smilElement).attr('apititlekey'))
204221 return ;
205222 }
206223 $j( target ).empty().append(
207 - $j('<h3 />').text('mwe-sequencer-edittemplate-params')
 224+ $j('<h3 />').text( gM('mwe-sequencer-edittemplate-params') )
208225 )
209226
210227 // This is not supposed to be perfect ..
211228 // just get you 'most' of the input vars 'most' of the time via the greedy regEx:
212 - var templateVars = templateText.match(/\{\{\{([^\}]*)\}\}\}/gi);
213 - var cleanTemplateParams = {};
 229+ var templateVars = templateText.match(/\{\{\{([^\}]*)\}\}\}/gi);
 230+ var cleanTemplateParams = {};
 231+
214232 for( i =0;i<templateVars.length; i++ ){
215233 var tVar = templateVars[i];
216234 // Remove all {{{ and }}}
@@ -224,15 +242,34 @@
225243 // Output input boxes for each template var as a param
226244 for( var paramName in cleanTemplateParams ){
227245 $j( target ).append(
228 - _this.getEditableAttribute(smilElement, 'edittemplate', 'param', paramName ),
229 - $j('<br />')
 246+ _this.getEditableAttribute(
 247+ smilElement,
 248+ 'edittemplate',
 249+ 'param',
 250+ paramName
 251+ )
 252+ .find('input')
 253+ // Bind the change event:
 254+ .change(function(){
 255+ _this.editWidgets.edittemplate.onChange(
 256+ _this,
 257+ smilElement,
 258+ target
 259+ )
 260+ })
 261+ .parent()
 262+ ,
 263+ $j('<div />')
 264+ .css('clear', 'both')
230265 )
231 - }
 266+ }
 267+
 268+
232269 });
233270 }
234271 },
235272 'panzoom' : {
236 - 'onChange': function( _this, target, smilElement ){
 273+ 'onChange': function( _this, smilElement, target ){
237274 var panZoomVal = $j('#' +_this.getEditToolInputId( 'panzoom', 'panZoom')).val();
238275 mw.log("panzoom change:" + panZoomVal );
239276
@@ -267,7 +304,7 @@
268305 // Add a input box binding:
269306 $j('#' +_this.getEditToolInputId( 'panzoom', 'panZoom'))
270307 .change(function(){
271 - _this.editWidgets.panzoom.onChange( _this, target, smilElement);
 308+ _this.editWidgets.panzoom.onChange( _this, smilElement, target );
272309 })
273310
274311 $j( target ).append(
@@ -357,7 +394,7 @@
358395 _this.sequencer.getSmil()
359396 .getLayout()
360397 .panZoomLayout(
361 - smilElement
 398+ smilElement
362399 );
363400 }
364401 // Add bindings
@@ -378,7 +415,7 @@
379416 // Restore original css for the layout helper
380417 $j(this).css( orginalHelperCss )
381418 // trigger the 'change'
382 - _this.editWidgets.panzoom.onChange( _this, target, smilElement );
 419+ _this.editWidgets.panzoom.onChange( _this, smilElement, target );
383420 }
384421 })
385422 .css('cursor', 'move')
@@ -400,14 +437,14 @@
401438 // Restore original css
402439 $j(this).css( orginalHelperCss )
403440 // trigger the change
404 - _this.editWidgets.panzoom.onChange( _this, target, smilElement );
 441+ _this.editWidgets.panzoom.onChange( _this, smilElement, target );
405442 }
406443 })
407444
408445 }
409446 },
410447 'trimTimeline' : {
411 - 'onChange': function( _this, target, smilElement ){
 448+ 'onChange': function( _this, smilElement, target){
412449 var smil = _this.sequencer.getSmil();
413450 // Update the preview thumbs
414451
@@ -466,7 +503,7 @@
467504
468505 var onInputChange = function( sliderIndex, timeValue ){
469506 // Register the change
470 - _this.editWidgets.trimTimeline.onChange( _this, target, smilElement);
 507+ _this.editWidgets.trimTimeline.onChange( _this, smilElement, target);
471508 // Update the slider
472509 if( fullClipDuration ){
473510 $j('#'+_this.sequencer.id + '_trimTimeline' )
@@ -493,7 +530,7 @@
494531 });
495532
496533 // Update the thumbnails:
497 - _this.editWidgets.trimTimeline.onChange( _this, target, smilElement );
 534+ _this.editWidgets.trimTimeline.onChange( _this, smilElement, target);
498535
499536 // Get the clip full duration to build out the timeline selector
500537 smil.getBody().getClipAssetDuration( smilElement, function( clipDuration ) {
@@ -539,7 +576,7 @@
540577 _this.editableTypes['time'].update( _this, smilElement, 'dur', sliderToTime( ui.values[ 1 ]- ui.values[0] ) );
541578
542579 // update the widget display
543 - _this.editWidgets.trimTimeline.onChange( _this, target, smilElement);
 580+ _this.editWidgets.trimTimeline.onChange( _this, smilElement, target);
544581
545582 // Register the edit state for undo / redo
546583 _this.sequencer.getActionsEdit().registerEdit();
@@ -758,7 +795,7 @@
759796 _this.editableAttributes[ attributeName ].inputSize : 6;
760797
761798 // Set paramName based attributes:
762 - var attributeTitle = ( editAttribute.title ) ? editAttribute.title : paramName;
 799+ var attributeTitle = ( editAttribute.title ) ? editAttribute.title : paramName + ':';
763800
764801 return $j( '<div />' )
765802 .css({
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
@@ -116,8 +116,8 @@
117117 },
118118 getTemplateText: function( templateTitle, callback ){
119119 var _this = this;
120 - if(this.templateTextCache[templateTitle]){
121 - callback(templateTitle);
 120+ if( this.templateTextCache[templateTitle] ){
 121+ callback( this.templateTextCache[templateTitle] );
122122 return ;
123123 }
124124 mw.getTitleText( this.getApiUrl(),templateTitle, function( templateText ){
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
@@ -113,11 +113,9 @@
114114 var trackStack =0;
115115 // Draw all the tracks
116116 $j.each(smilSequenceTracks, function( trackIndex, smilSequenceTrack ){
117 - trackStack++;
118 - mw.log("!!!t++ inx: " + trackIndex + ' stack:' + trackStack);
 117+ trackStack++;
119118 _this.drawSequenceTrack( trackIndex, smilSequenceTrack, function(){
120119 trackStack--;
121 - mw.log("t-- inx: " + trackIndex + ' stack:' + trackStack);
122120 if( trackStack == 0 && callback ){
123121 callback();
124122 }
Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js
@@ -271,11 +271,13 @@
272272 var jsPlayerRequest = [
273273 'mw.EmbedPlayer',
274274 'mw.style.EmbedPlayer',
275 - '$j.ui',
 275+ '$j.ui',
 276+ '$j.widget',
 277+ '$j.ui.mouse',
276278 'mw.PlayerControlBuilder',
277279 '$j.fn.hoverIntent',
278280 '$j.cookie',
279 - 'JSON',
 281+ 'JSON',
280282 '$j.ui.slider',
281283
282284 'mw.PlayerSkinKskin',

Status & tagging log