http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72733
Revision: 72733
Author: dale
Date: 2010-09-10 18:52:52 +0000 (Fri, 10 Sep 2010)
Log Message:
-----------
keep sequence page text ( categories / description )
Modified Paths:
--------------
branches/MwEmbedStandAlone/components/mw.Api.js
branches/MwEmbedStandAlone/components/mw.Language.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
branches/MwEmbedStandAlone/mwEmbed.js
Modified: branches/MwEmbedStandAlone/components/mw.Api.js
===================================================================
--- branches/MwEmbedStandAlone/components/mw.Api.js 2010-09-10 18:48:21 UTC
(rev 72732)
+++ branches/MwEmbedStandAlone/components/mw.Api.js 2010-09-10 18:52:52 UTC
(rev 72733)
@@ -106,7 +106,7 @@
*
* @param {Mixed} url or data request
* @param {Mixed} data or callback
- * @param {Function} callbcak function called on success
+ * @param {Function} callback function called on success
* @param {Function} callbackTimeout - optional function called on
timeout
* Setting timeout callback also avoids default timed-out dialog
for proxy requests
*/
Modified: branches/MwEmbedStandAlone/components/mw.Language.js
===================================================================
--- branches/MwEmbedStandAlone/components/mw.Language.js 2010-09-10
18:48:21 UTC (rev 72732)
+++ branches/MwEmbedStandAlone/components/mw.Language.js 2010-09-10
18:52:52 UTC (rev 72733)
@@ -434,7 +434,7 @@
}
}
return ( typeInt )? parseInt( convertedNumber) :
convertedNumber;
- }
+ };
/**
* Checks if a language key is valid ( is part of languageCodeList )
@@ -443,7 +443,7 @@
*/
mw.isValidLang = function( langKey ) {
return ( mw.Language.names[ langKey ] )? true : false;
- }
+ };
/**
* Get a language transform key
@@ -462,7 +462,7 @@
}
// By default return the base 'en' class
return 'en';
- }
+ };
/**
* getRemoteMsg loads remote msg strings
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
2010-09-10 18:48:21 UTC (rev 72732)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
2010-09-10 18:52:52 UTC (rev 72733)
@@ -6,6 +6,8 @@
//Wrap in mw closure
( function( mw ) {
+
+ var SEQUENCER_PAYLOADKEY = '@gadgetsequencepayl...@_$%^%';
mw.SequencerServer = function( sequencer ) {
return this.init( sequencer );
@@ -100,20 +102,51 @@
*/
getSmilXml: function( callback ){
var _this = this;
- mw.getTitleText( this.getApiUrl(), this.getTitleKey(),
function( smilXml ){
- // set smil to empty string if unset:
- if(!smilXml )
- smilXml = '';
+ mw.getTitleText( this.getApiUrl(), this.getTitleKey(),
function( smilPage ){
+ // Check for remote payload wrapper
+ // XXX need to support multipe pages in single
context
+ _this.currentSequencePage =
_this.parseSequencerPage( smilPage );
+ // Cache the latest serverSmil ( for local
change checks )
+ // ( save requests automatically respond with
warnings on other user updates )
+ _this.serverSmilXml
=_this.currentSequencePage.sequenceXML;
- // Check for remote payload wrapper
- smilXml = mw.getRemoteSequencerPayLoad( smilXml
);
+ // Cache the pre / post bits
- // Cache the latest serverSmil ( for local
change checks )
- // ( save requests automatically respond with
warnings on other user updates )
- _this.serverSmilXml = smilXml;
- callback( smilXml );
+ callback( _this.serverSmilXml );
})
},
+ wrapSequencerWikiText : function( xmlString ){
+ var _this = this;
+ if( !_this.currentSequencePage.pageStart ){
+ _this.currentSequencePage.pageStart ="\nTo
edit this sequence " +
+
'[{{fullurl:{{FULLPAGENAME}}|withJS=MediaWiki:MwEmbed.js}} enable the
sequencer] for this page';
+ }
+ return _this.currentSequencePage.pageStart +
+ "\n\n<!-- " + SEQUENCER_PAYLOADKEY + "\n" +
+ xmlString +
+ "\n\n " + SEQUENCER_PAYLOADKEY + " -->\n" +
+ _this.currentSequencePage.pageEnd;
+ },
+
+ parseSequencerPage : function( pageText ){
+ var _this = this;
+ var startKey = '<!-- ' + SEQUENCER_PAYLOADKEY;
+ var endKey = SEQUENCER_PAYLOADKEY + ' -->';
+ // If the key is not found fail
+ if( !pageText || pageText.indexOf( startKey ) == -1 ||
pageText.indexOf(endKey) == -1 ){
+ mw.log("Error could not find sequence payload");
+ return '';
+ }
+ // trim the output:
+ return {
+ 'pageStart' : pageText.substring(0,
pageText.indexOf( startKey ) ),
+ 'sequenceXML' : pageText.substring(
pageText.indexOf( startKey ) + startKey.length,
+ pageText.indexOf(endKey ) ),
+ 'pageEnd' : pageText.substring(
pageText.indexOf(endKey) )
+ }
+ },
+
+
getTemplateText: function( templateTitle, callback ){
var _this = this;
if( this.templateTextCache[templateTitle] ){
@@ -159,7 +192,7 @@
'action' : 'edit',
'summary' : saveSummary,
'title' : _this.titleKey,
- 'text' :
mw.getRemoteSequencerPageHelper( sequenceXML ),
+ 'text' : _this.wrapSequencerWikiText(
sequenceXML ),
'token': token
};
mw.getJSON( _this.getApiUrl(), request,
function( data ) {
@@ -175,7 +208,8 @@
}
})
})
- },
+ },
+
/**
* Check if the published file is up-to-date with the saved
sequence
* ( higher page revision for file than sequence )
Modified:
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
===================================================================
---
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
2010-09-10 18:48:21 UTC (rev 72732)
+++
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
2010-09-10 18:52:52 UTC (rev 72733)
@@ -49,31 +49,6 @@
return url;
};
-var SEQUENCER_PAYLOADKEY = '@gadgetsequencepayl...@_$%^%';
-
-
-mw.getRemoteSequencerPageHelper = function( xmlString ){
- return 'To edit this sequence ' +
- '[{{fullurl:{{FULLPAGENAME}}|withJS=MediaWiki:MwEmbed.js}}
enable the sequencer] for this page' +
- "\n\n<!-- " + SEQUENCER_PAYLOADKEY + "\n" +
- xmlString +
- "\n\n " + SEQUENCER_PAYLOADKEY + " -->"
-};
-mw.getRemoteSequencerPayLoad = function( pageText ){
- var startKey = '<!-- ' + SEQUENCER_PAYLOADKEY;
- var endKey = SEQUENCER_PAYLOADKEY + ' -->';
- // if the key is not found fail
- if( pageText.indexOf( startKey ) == -1 || pageText.indexOf(endKey) ==
-1 ){
- mw.log("Error could not find sequence payload");
- return '';
- }
- var payload = pageText.substring( pageText.indexOf( startKey ) +
startKey.length,
- pageText.indexOf(endKey )
- );
- // trim the output:
- return $j.trim( payload );
-};
-
// Add player pause binding if config is set::
$j( mw ).bind( 'newEmbedPlayerEvent', function( event, embedPlayerId ) {
if( mw.getConfig( 'Sequencer.KalturaPlayerEditOverlay' )){
Modified: branches/MwEmbedStandAlone/mwEmbed.js
===================================================================
--- branches/MwEmbedStandAlone/mwEmbed.js 2010-09-10 18:48:21 UTC (rev
72732)
+++ branches/MwEmbedStandAlone/mwEmbed.js 2010-09-10 18:52:52 UTC (rev
72733)
@@ -2595,7 +2595,7 @@
if( window.jQuery ){
if( ! mw.versionIsAtLeast( '1.4.0', jQuery.fn.jquery ) ){
- if( console && console.log ) {
+ if( window.console && window.console.log ) {
console.log( 'Error mwEmbed requires jQuery 1.4 or
above' );
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs