[MediaWiki-CVS] SVN: [90947] trunk/extensions/WikiLove/patches/WikiLoveImageLog.sql

2011-06-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90947

Revision: 90947
Author:   janpaul123
Date: 2011-06-28 10:18:59 + (Tue, 28 Jun 2011)
Log Message:
---
wlil_success boolean should NOT be NULL, as then we would have the values TRUE, 
FALSE, NULL, which is ambiguous...

Modified Paths:
--
trunk/extensions/WikiLove/patches/WikiLoveImageLog.sql

Modified: trunk/extensions/WikiLove/patches/WikiLoveImageLog.sql
===
--- trunk/extensions/WikiLove/patches/WikiLoveImageLog.sql  2011-06-28 
08:33:14 UTC (rev 90946)
+++ trunk/extensions/WikiLove/patches/WikiLoveImageLog.sql  2011-06-28 
10:18:59 UTC (rev 90947)
@@ -9,7 +9,7 @@
wlil_timestamp binary(14) NOT NULL,
wlil_user_id int(11) NOT NULL,
wlil_image varchar(128) NOT NULL,
-   wlil_success bool DEFAULT NULL
+   wlil_success bool NOT NULL
 ) /*$wgDBTableOptions*/;
 
 CREATE INDEX /*i*/wlil_timestamp ON /*_*/wikilove_image_log (wlil_timestamp);


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90948] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. defaultOptions.js

2011-06-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90948

Revision: 90948
Author:   janpaul123
Date: 2011-06-28 10:22:41 + (Tue, 28 Jun 2011)
Log Message:
---
Changed default image to Trophy.png, to be consistent with the example added in 
r90944

Modified Paths:
--

trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js

Modified: 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js
===
--- 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js   
2011-06-28 10:18:59 UTC (rev 90947)
+++ 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js   
2011-06-28 10:22:41 UTC (rev 90948)
@@ -9,7 +9,7 @@
defaultBackgroundColor: '#fdffe7',
defaultBorderColor: '#fceb92',
defaultImageSize: '100px',
-   defaultImage: 'Emblem-fun.svg',
+   defaultImage: 'Trophy.png',

types: {
// example type, could be removed later (also no i18n)


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90949] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. core.js

2011-06-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90949

Revision: 90949
Author:   janpaul123
Date: 2011-06-28 10:27:29 + (Tue, 28 Jun 2011)
Log Message:
---
Added spinner when checking for image existence

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 10:22:41 UTC (rev 90948)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 10:27:29 UTC (rev 90949)
@@ -292,6 +292,8 @@
} else {
// Make sure the image exists
var imageTitle = $.wikiLove.addFilePrefix( $( 
'#mw-wikilove-image' ).val() );
+   $( '#mw-wikilove-preview-spinner' ).fadeIn( 200 
);
+   
$.ajax( {
url: mw.util.wikiScript( 'api' ),
data: {
@@ -305,6 +307,7 @@
if ( 
!data.query.pages[-1].imageinfo ) {
// Image does not exist
$.wikiLove.showError( 
'wikilove-err-image-bad' );
+   $( 
'#mw-wikilove-preview-spinner' ).fadeOut( 200 );
} else {
// Image exists. 
Proceed with preview.

$.wikiLove.submitPreview();


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90950] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. core.js

2011-06-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90950

Revision: 90950
Author:   janpaul123
Date: 2011-06-28 10:42:32 + (Tue, 28 Jun 2011)
Log Message:
---
Only show error messages if the user is required to enter a field. Also adds 
error message for missing title.

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 10:27:29 UTC (rev 90949)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 10:42:32 UTC (rev 90950)
@@ -270,17 +270,26 @@
$( '#mw-wikilove-preview' ).hide();
$( '#mw-wikilove-dialog' ).find( '.mw-wikilove-error' 
).remove();

-   if( $( '#mw-wikilove-header' ).val().length = 0 ) {
+   // Check for a header if it is required
+   if( $.inArray( 'header', currentTypeOrSubtype.fields ) = 0  
$( '#mw-wikilove-header' ).val().length = 0 ) {
$.wikiLove.showError( 'wikilove-err-header' ); return 
false;
}

-   if( $( '#mw-wikilove-message' ).val().length = 0 ) {
-   $.wikiLove.showError( 'wikilove-err-msg' ); return 
false;
+   // Check for a title if it is required
+   if( $.inArray( 'title', currentTypeOrSubtype.fields ) = 0  
$( '#mw-wikilove-title' ).val().length = 0 ) {
+   $.wikiLove.showError( 'wikilove-err-title' ); return 
false;
}

-   // If there isn't a signature already in the message, throw an 
error
-   if ( $( '#mw-wikilove-message' ).val().indexOf( '~~~' ) = 0 ) {
-   $.wikiLove.showError( 'wikilove-err-sig' ); return 
false;
+   if( $.inArray( 'message', currentTypeOrSubtype.fields ) = 0 ) {
+   // Check for a message if it is required
+   if ( $( '#mw-wikilove-message' ).val().length = 0 ) {
+   $.wikiLove.showError( 'wikilove-err-msg' ); 
return false;
+   }
+   
+   // If there isn't a signature already in the message, 
throw an error
+   if ( $( '#mw-wikilove-message' ).val().indexOf( '~~~' ) 
= 0 ) {
+   $.wikiLove.showError( 'wikilove-err-sig' ); 
return false;
+   }
}

// Split image validation depending on whether or not it is a 
gallery
@@ -315,6 +324,7 @@
},
error: function() {
$.wikiLove.showError( 
'wikilove-err-image-api' );
+   $( 
'#mw-wikilove-preview-spinner' ).fadeOut( 200 );
}
} );
}


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90955] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. core.js

2011-06-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90955

Revision: 90955
Author:   janpaul123
Date: 2011-06-28 13:28:30 + (Tue, 28 Jun 2011)
Log Message:
---
Added functionality to disable the sending of WikiLove when the input has 
changed, per user test and comments.

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 12:55:51 UTC (rev 90954)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 13:28:30 UTC (rev 90955)
@@ -130,6 +130,16 @@
$( '#mw-wikilove-preview-form' ).submit( 
$.wikiLove.validatePreviewForm );
$( '#mw-wikilove-send-form' ).click( 
$.wikiLove.submitSend );
$( '#mw-wikilove-message' ).elastic(); // have the 
message textarea grow automatically
+   
+   // when the input changes, we want to disable the send 
button
+   $( '#mw-wikilove-header' ).change( 
$.wikiLove.changeInput );
+   $( '#mw-wikilove-header' ).keyup( 
$.wikiLove.changeInput );
+   $( '#mw-wikilove-title' ).change( 
$.wikiLove.changeInput );
+   $( '#mw-wikilove-title' ).keyup( $.wikiLove.changeInput 
);
+   $( '#mw-wikilove-image' ).change( 
$.wikiLove.changeInput );
+   $( '#mw-wikilove-image' ).keyup( $.wikiLove.changeInput 
);
+   $( '#mw-wikilove-message' ).change( 
$.wikiLove.changeInput );
+   $( '#mw-wikilove-message' ).keyup( 
$.wikiLove.changeInput );
}

$dialog.dialog( 'open' );
@@ -350,6 +360,8 @@
'header': $( '#mw-wikilove-header' ).val(),
'text': text,
'message': $( '#mw-wikilove-message' ).val(),
+   'title':  $( '#mw-wikilove-title' ).val(),
+   'image': $( '#mw-wikilove-image' ).val(),
'type': currentTypeId
+ (currentSubtypeId !== null ? '-' + 
currentSubtypeId : '')
};
@@ -423,21 +435,41 @@

/*
 * Callback for the preview function. Sets the preview area with the 
HTML and fades it in.
+* It also (re-)enables the send button.
 */
showPreview: function( html ) {
$( '#mw-wikilove-preview-area' ).html( html );
$( '#mw-wikilove-preview' ).fadeIn( 200 );
+   $( '#mw-wikilove-button-send' ).button( 'enable' );
},

+   changeInput: function() {
+   if( previewData !== null 
+   ( previewData.message   != $( '#mw-wikilove-message' 
).val()
+   || previewData.title  != $( '#mw-wikilove-title' ).val()
+   || previewData.header != $( '#mw-wikilove-header' 
).val()
+   || previewData.image  != $( '#mw-wikilove-image' ).val()
+   )) {
+   $( '#mw-wikilove-button-send' ).button( 'disable' );
+   }
+   else {
+   $( '#mw-wikilove-button-send' ).button( 'enable' );
+   }
+   },
+   
/*
 * Handler for the send (final submit) button.
 * The type sent for statistics is 'typeId-subtypeId' when using 
subtypes,
 * or simply 'typeId' otherwise.
 */
submitSend: function( e ) {
-   e.preventDefault();
-   $.wikiLove.doSend( previewData.header, previewData.text,
-   previewData.message, previewData.type, 
previewData.email );
+   $( '#mw-wikilove-dialog' ).find( '.mw-wikilove-error' 
).remove();
+   
+   if( !$( '#mw-wikilove-button-send' ).button( 'option', 
'disabled' ) ) {
+   e.preventDefault();
+   $.wikiLove.doSend( previewData.header, previewData.text,
+   previewData.message, previewData.type, 
previewData.email );
+   }
},

/*
@@ -565,6 +597,7 @@
$( 
'#mw-wikilove-gallery a' ).removeClass( 'selected' );
$( this 
).addClass( 'selected' );
$( 
'#mw-wikilove-image' ).val( gallery[$( this ).attr( 'id' )] );
+   
$.wikiLove.changeInput

[MediaWiki-CVS] SVN: [90956] trunk/extensions/WikiLove

2011-06-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90956

Revision: 90956
Author:   janpaul123
Date: 2011-06-28 13:51:41 + (Tue, 28 Jun 2011)
Log Message:
---
Fixes posting to anonymous users. Also shows a warning when posting to 
anonymous users, this fixes bug 29620

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.api.php
trunk/extensions/WikiLove/WikiLove.hooks.php
trunk/extensions/WikiLove/WikiLove.i18n.php
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  2011-06-28 13:28:30 UTC (rev 
90955)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-06-28 13:51:41 UTC (rev 
90956)
@@ -56,7 +56,7 @@
global $wgUser;
$dbw = wfGetDB( DB_MASTER );
$receiver = User::newFromName( 
$talk-getSubjectPage()-getBaseText() );
-   if ( $receiver-isAnon() ) {
+   if ( $receiver === false || $receiver-isAnon() ) {
$this-setWarning( 'Not logging anonymous recipients' );
return;
}

Modified: trunk/extensions/WikiLove/WikiLove.hooks.php
===
--- trunk/extensions/WikiLove/WikiLove.hooks.php2011-06-28 13:28:30 UTC 
(rev 90955)
+++ trunk/extensions/WikiLove/WikiLove.hooks.php2011-06-28 13:51:41 UTC 
(rev 90956)
@@ -71,7 +71,7 @@
$out-addModules( 'ext.wikiLove.defaultOptions' 
);
}

-   self::$recipient = $title-getText();
+   self::$recipient = $title-getBaseText();
}
return true;
}
@@ -83,6 +83,12 @@
global $wgUser;
$vars['wikilove-recipient'] = self::$recipient;
$vars['wikilove-edittoken'] = $wgUser-edittoken();
+   
+   $vars['wikilove-anon'] = 0;
+   if ( self::$recipient !== '' ) {
+   $receiver = User::newFromName( self::$recipient );
+   if ( $receiver === false || $receiver-isAnon() ) 
$vars['wikilove-anon'] = 1;
+   }
return true;
}


Modified: trunk/extensions/WikiLove/WikiLove.i18n.php
===
--- trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-28 13:28:30 UTC (rev 
90955)
+++ trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-28 13:51:41 UTC (rev 
90956)
@@ -47,6 +47,7 @@
'wikilove-err-gallery-again' = 'Try again',
'wikilove-summary' = '/* $1 */ new WikiLove message',
'wikilove-what-is-this' = What is this?,
+   'wikilove-anon-warning' = 'Note: This user is not registered, he or 
she many not notice this message.',
 );
 
 /** Message documentation (Message documentation)

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-06-28 13:28:30 UTC (rev 
90955)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-06-28 13:51:41 UTC (rev 
90956)
@@ -125,6 +125,7 @@
'wikilove-err-gallery',
'wikilove-err-gallery-again',
'wikilove-what-is-this',
+   'wikilove-anon-warning',
),
'dependencies' = array(
'jquery.ui.dialog',

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 13:28:30 UTC (rev 90955)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 13:51:41 UTC (rev 90956)
@@ -59,6 +59,7 @@
pa target=_blank href=http://www.mediawiki.org/wiki/WikiLove;\
html:msg key=wikilove-what-is-this/\
/a/p\
+   p id=mw-wikilove-anon-warningstronghtml:msg 
key=wikilove-anon-warning//strong/p\
 /div\
 div id=mw-wikilove-add-details\
span class=mw-wikilove-number2/span\
@@ -131,6 +132,8 @@
$( '#mw-wikilove-send-form' ).click( 
$.wikiLove.submitSend );
$( '#mw-wikilove-message' ).elastic(); // have the 
message textarea grow automatically

+   if ( mw.config.get( 'wikilove-anon' ) === 0 ) $( 
'#mw-wikilove-anon-warning' ).hide();
+   
// when the input changes, we want to disable the send 
button
$( '#mw-wikilove-header' ).change( 
$.wikiLove.changeInput

[MediaWiki-CVS] SVN: [90958] trunk/extensions/WikiLove

2011-06-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90958

Revision: 90958
Author:   janpaul123
Date: 2011-06-28 14:12:40 + (Tue, 28 Jun 2011)
Log Message:
---
Better directions to Wikimedia Commons.

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.i18n.php
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css

Modified: trunk/extensions/WikiLove/WikiLove.i18n.php
===
--- trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-28 14:10:55 UTC (rev 
90957)
+++ trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-28 14:12:40 UTC (rev 
90958)
@@ -24,7 +24,7 @@
'wikilove-get-started-list-2' = 'Add details to your WikiLove',
'wikilove-get-started-list-3' = 'Send your WikiLove!',
'wikilove-add-details' = 'Add details',
-   'wikilove-image' = 'Enter an image from Wikimedia Commons:',
+   'wikilove-image' = 'Enter an image filename:',
'wikilove-select-image' = 'Select an image:',
'wikilove-header' = 'Enter a header:',
'wikilove-title' = 'Enter a title:',
@@ -48,6 +48,9 @@
'wikilove-summary' = '/* $1 */ new WikiLove message',
'wikilove-what-is-this' = What is this?,
'wikilove-anon-warning' = 'Note: This user is not registered, he or 
she many not notice this message.',
+   'wikilove-commons-text' = 'You can find images by browsing $1.',
+   'wikilove-commons-link' = 'Wikimedia Commons',
+   'wikilove-commons-url' = 'http://commons.wikimedia.org',
 );
 
 /** Message documentation (Message documentation)
@@ -58,6 +61,7 @@
'wikilove-preview' = 'Title. Noun.',
'wikilove-barnstar-header' = 'See [[:wikipedia:Barnstar]]. Probably 
not literally translatable.',
'wikilove-image-example' = 'The filename should be an actual image on 
Wikimedia Commons.',
+   'wikilove-commons-text' = '$1 gets replaced by a link with 
wikilove-commons-link as caption and wikilove-commons-url as URL',
 );
 
 /** Bulgarian (Български)

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-06-28 14:10:55 UTC (rev 
90957)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-06-28 14:12:40 UTC (rev 
90958)
@@ -126,6 +126,9 @@
'wikilove-err-gallery-again',
'wikilove-what-is-this',
'wikilove-anon-warning',
+   'wikilove-commons-text',
+   'wikilove-commons-link',
+   'wikilove-commons-url',
),
'dependencies' = array(
'jquery.ui.dialog',

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 14:10:55 UTC (rev 90957)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 14:12:40 UTC (rev 90958)
@@ -84,6 +84,9 @@
label for=mw-wikilove-image 
id=mw-wikilove-image-labelhtml:msg key=wikilove-image//label\
span class=mw-wikilove-note 
id=mw-wikilove-image-notehtml:msg key=wikilove-image-example//span\
input type=text class=text id=mw-wikilove-image/\
+   div id=mw-wikilove-commons-text\
+   ' + mw.msg( 'wikilove-commons-text', 'a href=' + mw.msg( 
'wikilove-commons-url' ) +' target=_blank' + mw.msg( 
'wikilove-commons-link' ) +'/a' ) + '\
+   /div\
label for=mw-wikilove-message 
id=mw-wikilove-message-labelhtml:msg key=wikilove-enter-message//label\
span class=mw-wikilove-note 
id=mw-wikilove-message-notehtml:msg key=wikilove-omit-sig//span\
textarea id=mw-wikilove-message/textarea\
@@ -244,7 +247,7 @@
$( '#mw-wikilove-title' ).val( currentTypeOrSubtype.title || '' 
);

// show or hide image label and textbox depending on fields 
configuration
-   $( '#mw-wikilove-image, #mw-wikilove-image-label, 
#mw-wikilove-image-note' )
+   $( '#mw-wikilove-image, #mw-wikilove-image-label, 
#mw-wikilove-image-note, #mw-wikilove-commons-text' )
.toggle( $.inArray( 'image', 
currentTypeOrSubtype.fields ) = 0 );

// set the new text for the image textbox

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css 
2011-06-28 14:10:55 UTC (rev 90957)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css

[MediaWiki-CVS] SVN: [90961] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. core.js

2011-06-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90961

Revision: 90961
Author:   janpaul123
Date: 2011-06-28 14:35:01 + (Tue, 28 Jun 2011)
Log Message:
---
Entered input is now remembered when selecting a different type or subtype, 
fixes bug 29624.

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 14:28:11 UTC (rev 90960)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 14:35:01 UTC (rev 90961)
@@ -7,6 +7,7 @@
currentSubtypeId = null, // id of the currently selected subtype (e.g. 
'original' or 'special')
currentTypeOrSubtype = null, // content of the current (sub)type (i.e. 
an object with title, descr, text, etc.)
previewData = null, // data of the currently previewed thing is set here
+   rememberData = null, // input data to remember when switching types or 
subtypes
emailable = false,
gallery = {};

@@ -157,6 +158,7 @@
 */
clickType: function( e ) {
e.preventDefault();
+   $.wikiLove.rememberInputData(); // remember previously entered 
data
$( '#mw-wikilove-get-started' ).hide(); // always hide the get 
started section

var newTypeId = $( this ).data( 'typeId' );
@@ -206,6 +208,8 @@
 * Handler for changing the subtype.
 */
changeSubtype: function() {
+   $.wikiLove.rememberInputData(); // remember previously entered 
data
+   
// find out which subtype is selected
var newSubtypeId = $( '#mw-wikilove-subtype option:selected' 
).first().data( 'subtypeId' );
if( currentSubtypeId != newSubtypeId ) { // only change stuff 
when a different subtype is selected
@@ -220,11 +224,47 @@
},

/*
+* Remember data the user entered if it is different from the default.
+*/
+   rememberInputData: function() {
+   if( rememberData === null) {
+   rememberData = {
+   'header' : '',
+   'title'  : '',
+   'message': '',
+   'image'  : '',
+   };
+   }
+   if( currentTypeOrSubtype !== null ) {
+   if( !currentTypeOrSubtype.header || $( 
'#mw-wikilove-header' ).val()   != currentTypeOrSubtype.header  ) {
+   rememberData.header  = $( '#mw-wikilove-header' 
).val();
+   }
+   if( !currentTypeOrSubtype.title  || $( 
'#mw-wikilove-title' ).val()!= currentTypeOrSubtype.title ) {
+   rememberData.title   = $( '#mw-wikilove-title' 
).val();
+   }
+   if( !currentTypeOrSubtype.message || $( 
'#mw-wikilove-message' ).val() != currentTypeOrSubtype.message ) {
+   rememberData.message = $( 
'#mw-wikilove-message' ).val();
+   }
+   if( typeof currentTypeOrSubtype.gallery == undefined  
$.inArray( 'image', currentTypeOrSubtype.fields ) = 0 ) {
+   rememberData.image   = $( '#mw-wikilove-image' 
).val();
+   }
+   }
+   },
+   
+   /*
 * Called when type or subtype changes, updates controls.
 */
updateAllDetails: function() {
$( '#mw-wikilove-dialog' ).find( '.mw-wikilove-error' 
).remove();

+   // use remembered data for fields that can be set by the user
+   var currentRememberData = {
+   'header' : ( $.inArray( 'header', 
currentTypeOrSubtype.fields )  = 0 ? rememberData.header : '' ),
+   'title'  : ( $.inArray( 'title', 
currentTypeOrSubtype.fields )   = 0 ? rememberData.title : '' ),
+   'message': ( $.inArray( 'message', 
currentTypeOrSubtype.fields ) = 0 ? rememberData.message : '' ),
+   'image'  : ( $.inArray( 'image', 
currentTypeOrSubtype.fields )   = 0 ? rememberData.image : '' ),
+   };
+   
// only show the description if it exists for this type or 
subtype
if( typeof currentTypeOrSubtype.descr == 'string' ) {
$( '#mw-wikilove-subtype-description').show();
@@ -237,21 +277,21 @@
.toggle( $.inArray( 'header', 
currentTypeOrSubtype.fields ) = 0 );

// set the new text for the header textbox
-   $( '#mw-wikilove-header' ).val

[MediaWiki-CVS] SVN: [90962] trunk/extensions/WikiLove

2011-06-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90962

Revision: 90962
Author:   janpaul123
Date: 2011-06-28 14:39:03 + (Tue, 28 Jun 2011)
Log Message:
---
Fixed 'Make your own' screen per bug 29622, should hopefully fix it.

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.i18n.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/WikiLove.i18n.php
===
--- trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-28 14:35:01 UTC (rev 
90961)
+++ trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-28 14:39:03 UTC (rev 
90962)
@@ -27,7 +27,7 @@
'wikilove-image' = 'Enter an image filename:',
'wikilove-select-image' = 'Select an image:',
'wikilove-header' = 'Enter a header:',
-   'wikilove-title' = 'Enter a title:',
+   'wikilove-title' = 'Enter an award title:',
'wikilove-enter-message' = 'Enter a message:',
'wikilove-omit-sig' = '(without a signature)',
'wikilove-image-example' = '(example: Trophy.png)',

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 14:35:01 UTC (rev 90961)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 14:39:03 UTC (rev 90962)
@@ -331,9 +331,9 @@
$.wikiLove.showError( 'wikilove-err-header' ); return 
false;
}

-   // Check for a title if it is required
+   // Check for a title if it is required, and otherwise use the 
header text
if( $.inArray( 'title', currentTypeOrSubtype.fields ) = 0  
$( '#mw-wikilove-title' ).val().length = 0 ) {
-   $.wikiLove.showError( 'wikilove-err-title' ); return 
false;
+   $( '#mw-wikilove-title' ).val( $( '#mw-wikilove-header' 
).val() );
}

if( $.inArray( 'message', currentTypeOrSubtype.fields ) = 0 ) {


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90964] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. core.js

2011-06-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90964

Revision: 90964
Author:   janpaul123
Date: 2011-06-28 14:49:10 + (Tue, 28 Jun 2011)
Log Message:
---
Fixed bug 28968.

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 14:42:31 UTC (rev 90963)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 14:49:10 UTC (rev 90964)
@@ -440,7 +440,7 @@
msg = msg.replace( '$4', currentTypeOrSubtype.imageSize || 
options.defaultImageSize ); // replace the image size
msg = msg.replace( '$5', currentTypeOrSubtype.backgroundColor 
|| options.defaultBackgroundColor ); // replace the background color
msg = msg.replace( '$6', currentTypeOrSubtype.borderColor || 
options.defaultBorderColor ); // replace the border color
-   msg = msg.replace( '$7', mw.config.get( 'wikilove-recipient' ) 
); // replace the username we're sending to
+   msg = msg.replace( '$7', 'nowiki' + mw.config.get( 
'wikilove-recipient' ) + '/nowiki' ); // replace the username we're sending to

return msg;
},


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90969] trunk/extensions/WikiLove

2011-06-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90969

Revision: 90969
Author:   janpaul123
Date: 2011-06-28 15:32:13 + (Tue, 28 Jun 2011)
Log Message:
---
Added error messages when API calls fail.

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.api.php
trunk/extensions/WikiLove/WikiLove.i18n.php
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  2011-06-28 15:24:38 UTC (rev 
90968)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-06-28 15:32:13 UTC (rev 
90969)
@@ -31,14 +31,12 @@
'notminor' = true,
), false, array( 'wsEditToken' = $wgRequest-getSessionData( 
'wsEditToken' ) ) ), true );

+   $api-execute();
+   
if ( isset( $params['email'] ) ) {
$this-emailUser( $talk, $params['subject'], 
$params['email'], $params['token'] );
}
 
-   $api-execute();
-   
-   $result = $api-getResult();
-
$this-getResult()-addValue( 'redirect', 'pageName', 
$talk-getPrefixedDBkey() );
$this-getResult()-addValue( 'redirect', 'fragment', 
Title::escapeFragmentForURL( $params['subject'] ) );
// note that we cannot use Title::makeTitle here as it doesn't 
sanitize the fragment

Modified: trunk/extensions/WikiLove/WikiLove.i18n.php
===
--- trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-28 15:24:38 UTC (rev 
90968)
+++ trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-28 15:32:13 UTC (rev 
90969)
@@ -41,10 +41,12 @@
'wikilove-err-msg' = 'Please enter a message.',
'wikilove-err-image' = 'Please select an image.',
'wikilove-err-image-bad' = 'Image does not exist.',
-   'wikilove-err-image-api' = 'Image check failed.',
+   'wikilove-err-image-api' = 'Something went wrong when retrieving the 
image. Please try again.',
'wikilove-err-sig' = 'Please do not include a signature in the 
message.',
-   'wikilove-err-gallery' = 'Something went wrong when loading the 
images!',
+   'wikilove-err-gallery' = 'Something went wrong when loading the 
images.',
'wikilove-err-gallery-again' = 'Try again',
+   'wikilove-err-preview-api' = 'Something went wrong during previewing. 
Please try again.',
+   'wikilove-err-send-api' = 'Something went wrong when sending the 
message. Please try again.',
'wikilove-summary' = '/* $1 */ new WikiLove message',
'wikilove-what-is-this' = What is this?,
'wikilove-anon-warning' = 'Note: This user is not registered, he or 
she many not notice this message.',

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-06-28 15:24:38 UTC (rev 
90968)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-06-28 15:32:13 UTC (rev 
90969)
@@ -129,6 +129,8 @@
'wikilove-commons-text',
'wikilove-commons-link',
'wikilove-commons-url',
+   'wikilove-err-preview-api',
+   'wikilove-err-send-api',
),
'dependencies' = array(
'jquery.ui.dialog',

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 15:24:38 UTC (rev 90968)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-28 15:32:13 UTC (rev 90969)
@@ -328,7 +328,7 @@

// Check for a header if it is required
if( $.inArray( 'header', currentTypeOrSubtype.fields ) = 0  
$( '#mw-wikilove-header' ).val().length = 0 ) {
-   $.wikiLove.showError( 'wikilove-err-header' ); return 
false;
+   $.wikiLove.showAddDetailsError( 'wikilove-err-header' 
); return false;
}

// Check for a title if it is required, and otherwise use the 
header text
@@ -339,12 +339,12 @@
if( $.inArray( 'message', currentTypeOrSubtype.fields ) = 0 ) {
// Check for a message if it is required
if ( $( '#mw-wikilove-message' ).val().length = 0 ) {
-   $.wikiLove.showError( 'wikilove-err-msg' ); 
return false;
+   $.wikiLove.showAddDetailsError( 
'wikilove-err-msg' ); return false

[MediaWiki-CVS] SVN: [90983] trunk/extensions/WikiLove/WikiLove.i18n.php

2011-06-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90983

Revision: 90983
Author:   janpaul123
Date: 2011-06-28 17:47:29 + (Tue, 28 Jun 2011)
Log Message:
---
Added qqq comment per suggestion in r90967.

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.i18n.php

Modified: trunk/extensions/WikiLove/WikiLove.i18n.php
===
--- trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-28 17:40:06 UTC (rev 
90982)
+++ trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-28 17:47:29 UTC (rev 
90983)
@@ -63,7 +63,8 @@
'wikilove-preview' = 'Title. Noun.',
'wikilove-barnstar-header' = 'See [[:wikipedia:Barnstar]]. Probably 
not literally translatable.',
'wikilove-image-example' = 'The filename should be an actual image on 
Wikimedia Commons.',
-   'wikilove-commons-text' = '$1 gets replaced by a link with 
wikilove-commons-link as caption and wikilove-commons-url as URL',
+   'wikilove-commons-text' = '$1 gets replaced by a link with 
wikilove-commons-link as caption and wikilove-commons-url as URL.',
+   'wikilove-commons-url' = 'This URL can be changed to point at a 
localised page on Wikimedia Commons.',
 );
 
 /** Bulgarian (Български)


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90873] trunk/extensions/WikiLove/modules/ext.wikiLove

2011-06-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90873

Revision: 90873
Author:   janpaul123
Date: 2011-06-27 12:57:23 + (Mon, 27 Jun 2011)
Log Message:
---
Added gallery height attribute

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-27 12:25:19 UTC (rev 90872)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-27 12:57:23 UTC (rev 90873)
@@ -477,7 +477,8 @@
'prop': 'imageinfo',
'iiprop'  : 'mime|url',
'titles'  : titles,
-   'iiurlwidth'  : 
currentTypeOrSubtype.gallery.width
+   'iiurlwidth'  : 
currentTypeOrSubtype.gallery.width,
+   'iiurlheight' : 
currentTypeOrSubtype.gallery.height
},
dataType: 'json',
type: 'POST',
@@ -494,10 +495,9 @@

$.each( data.query.pages, function( id, page ) {
if ( page.imageinfo  
page.imageinfo.length ) {
-   // build an image tag with the 
correct url and width
+   // build an image tag with the 
correct url
var $img = $( 'img/' )
.attr( 'src', 
page.imageinfo[0].thumburl )
-   .attr( 'width', 
currentTypeOrSubtype.gallery.width )
.hide()
.load( function() { 
$( this ).css( 
'display', 'inline-block' );

Modified: 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js
===
--- 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js   
2011-06-27 12:25:19 UTC (rev 90872)
+++ 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js   
2011-06-27 12:57:23 UTC (rev 90873)
@@ -343,6 +343,7 @@
gallery: {
imageList: [ 'Cucciolo gatto Bibo.jpg', 'Kitten 
(06) by Ron.jpg', 'Kitten-stare.jpg', 'Red Kitten 01.jpg', 'Kitten in a 
helmet.jpg', 'Cute grey kitten.jpg' ],
width: 145,
+   height: 150,
number: 3
},
icon: mw.config.get( 'wgExtensionAssetsPath' ) + 
'/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-kitten.png'


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90875] trunk/extensions/WikiLove

2011-06-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90875

Revision: 90875
Author:   janpaul123
Date: 2011-06-27 14:04:15 + (Mon, 27 Jun 2011)
Log Message:
---
Circumvented problem of local config breaking when debug=true and filed 
ResourceLoader bug: https://bugzilla.wikimedia.org/show_bug.cgi?id=29608

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.hooks.php
trunk/extensions/WikiLove/WikiLove.local.php
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js

Removed Paths:
-
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.init.js

Modified: trunk/extensions/WikiLove/WikiLove.hooks.php
===
--- trunk/extensions/WikiLove/WikiLove.hooks.php2011-06-27 13:48:01 UTC 
(rev 90874)
+++ trunk/extensions/WikiLove/WikiLove.hooks.php2011-06-27 14:04:15 UTC 
(rev 90875)
@@ -49,7 +49,7 @@
 * @param $skin Skin
 */
public static function beforePageDisplay( $out, $skin ) {
-   global $wgWikiLoveGlobal, $wgUser;
+   global $wgWikiLoveGlobal, $wgWikiLoveEnableLocalConfig, $wgUser;
if ( !$wgWikiLoveGlobal  !$wgUser-getOption( 
'wikilove-enabled' ) ) {
return true;
}
@@ -57,7 +57,17 @@
$title = self::getUserTalkPage( $skin-getTitle() );
if ( !is_null( $title ) ) {
$out-addModules( 'ext.wikiLove.icon' );
-   $out-addModules( 'ext.wikiLove.init' );
+   
+   // it is much better to have a chain like: startup - 
default - local - init,
+   // but because of this bug that isn't possible right 
now: https://bugzilla.wikimedia.org/29608
+   $optionsTitle = Title::newFromText( 
MediaWiki:WikiLove.js );
+   if( $optionsTitle-exists()  
$optionsTitle-isCssOrJsPage() ) {
+   $out-addModules( 'ext.wikiLove.local' );
+   }
+   else {
+   $out-addModules( 'ext.wikiLove.defaultOptions' 
);
+   }
+   
self::$recipient = $title-getText();
}
return true;

Modified: trunk/extensions/WikiLove/WikiLove.local.php
===
--- trunk/extensions/WikiLove/WikiLove.local.php2011-06-27 13:48:01 UTC 
(rev 90874)
+++ trunk/extensions/WikiLove/WikiLove.local.php2011-06-27 14:04:15 UTC 
(rev 90875)
@@ -14,4 +14,9 @@
'ext.wikiLove.startup',
);
}
+   
+   public function getMessages() {
+   global $wgWikiLoveOptionMessages;
+   return $wgWikiLoveOptionMessages;
+   }
 }

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-06-27 13:48:01 UTC (rev 
90874)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-06-27 14:04:15 UTC (rev 
90875)
@@ -77,7 +77,15 @@
'remoteExtPath' = 'WikiLove/modules/ext.wikiLove',
 );
 
+// messages for default options, because we want to use them in the default
+// options module, but also for the user in the user options module
+$wgWikiLoveOptionMessages = array(
+   'wikilove-type-makeyourown',
+);
+
 // resources
+// it is much better to have a chain like: startup - default - local - init,
+// but because of this bug that isn't possible right now: 
https://bugzilla.wikimedia.org/29608
 $wgResourceModules += array(
'ext.wikiLove.icon' = $extWikiLoveTpl + array(
'styles' = 'ext.wikiLove.icon.css',
@@ -86,7 +94,6 @@
'ext.wikiLove.startup' = $extWikiLoveTpl + array(
'scripts' = array(
'ext.wikiLove.core.js',
-   'ext.wikiLove.defaultOptions.js',
),
'styles' = 'ext.wikiLove.css',
'messages' = array(
@@ -107,7 +114,6 @@
'wikilove-preview',
'wikilove-notify',
'wikilove-button-send',
-   'wikilove-type-makeyourown',
'wikilove-err-header',
'wikilove-err-title',
'wikilove-err-msg',
@@ -125,15 +131,15 @@
'ext.wikiLove.local' = array(
'class' = 'WikiLoveLocal',
/* for information only, this is actually in the class!
-   'dependencies' = array(
-   'ext.wikiLove.startup',
-   ),
+   'messages

[MediaWiki-CVS] SVN: [90878] trunk/extensions/WikiLove

2011-06-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90878

Revision: 90878
Author:   janpaul123
Date: 2011-06-27 14:54:04 + (Mon, 27 Jun 2011)
Log Message:
---
Fixed performance issue by commenting out a line for now. This line doesn't 
make sense as it is only necessary to check for resizing when the *width* of 
the textarea changed, and in this function we only change the height. This line 
caused infinite recursion in Firefox. Will report this problem and proposed 
solution upstream.

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
trunk/extensions/WikiLove/modules/jquery.elastic/jquery.elastic.js

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-06-27 14:05:23 UTC (rev 
90877)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-06-27 14:54:04 UTC (rev 
90878)
@@ -126,6 +126,7 @@
'jquery.ui.dialog',
'jquery.ui.button',
'jquery.localize',
+   'jquery.elastic',
),
),
'ext.wikiLove.local' = array(
@@ -142,4 +143,9 @@
'messages' = $wgWikiLoveOptionMessages,
'dependencies' = 'ext.wikiLove.startup'
),
+   'jquery.elastic' = array(
+   'localBasePath' = dirname( __FILE__ ) . 
'/modules/jquery.elastic',
+   'remoteExtPath' = 'WikiLove/modules/jquery.elastic',
+   'scripts' = 'jquery.elastic.js',
+   ),
 );

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-27 14:05:23 UTC (rev 90877)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-27 14:54:04 UTC (rev 90878)
@@ -125,7 +125,7 @@
$( '#mw-wikilove-subtype' ).change( 
$.wikiLove.changeSubtype );
$( '#mw-wikilove-preview-form' ).submit( 
$.wikiLove.submitPreview );
$( '#mw-wikilove-send-form' ).click( 
$.wikiLove.submitSend );
-   $( '#mw-wikilove-message' ); // have the message 
textarea grow automatically
+   $( '#mw-wikilove-message' ).elastic(); // have the 
message textarea grow automatically
}

$dialog.dialog( 'open' );

Modified: trunk/extensions/WikiLove/modules/jquery.elastic/jquery.elastic.js
===
--- trunk/extensions/WikiLove/modules/jquery.elastic/jquery.elastic.js  
2011-06-27 14:05:23 UTC (rev 90877)
+++ trunk/extensions/WikiLove/modules/jquery.elastic/jquery.elastic.js  
2011-06-27 14:54:04 UTC (rev 90878)
@@ -90,7 +90,7 @@
$textarea.css({'height': 
curratedHeight + 'px','overflow':overflow});

// Fire the custom event resize
-   $textarea.trigger('resize');
+   //$textarea.trigger('resize');

}
}


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90879] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. core.js

2011-06-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90879

Revision: 90879
Author:   janpaul123
Date: 2011-06-27 15:01:52 + (Mon, 27 Jun 2011)
Log Message:
---
In r90567 the message box was made shown/hidden based on configuration options, 
but when shown, it was still permitted not to enter a message. That is fixed 
now.

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-27 14:54:04 UTC (rev 90878)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-27 15:01:52 UTC (rev 90879)
@@ -278,15 +278,9 @@
$.wikiLove.showError( 'wikilove-err-header' ); return 
false;
}

-   /*
-   Let's not show an error for not entering a message, making it 
always optional.
-   This is preferred over removing the field from the interface, 
so that users are
-   stimulated to enter a message, but are not required to do so if 
they want to leave
-   a quick gesture of appreciation.
if( $( '#mw-wikilove-message' ).val().length = 0 ) {
$.wikiLove.showError( 'wikilove-err-msg' ); return 
false;
}
-   */

// If there isn't a signature already in the message, throw an 
error
if ( $( '#mw-wikilove-message' ).val().indexOf( '~~~' ) = 0 ) {


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90880] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. core.js

2011-06-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90880

Revision: 90880
Author:   janpaul123
Date: 2011-06-27 15:11:09 + (Mon, 27 Jun 2011)
Log Message:
---
Fixed adding file prefix as mentioned in the comments of r90220

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-27 15:01:52 UTC (rev 90879)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-27 15:11:09 UTC (rev 90880)
@@ -321,11 +321,7 @@

msg = msg.replace( '$1', $( '#mw-wikilove-message' ).val() ); 
// replace the raw message
msg = msg.replace( '$2', $( '#mw-wikilove-title' ).val() ); // 
replace the title
-   var imageName = $( '#mw-wikilove-image' ).val();
-   // if the image name doesn't start with a prefix, add one
-   if ( imageName.indexOf( 'File:' ) !== 0  imageName.indexOf( 
'Image:' ) !== 0  imageName.indexOf( wgFormattedNamespaces[6] !== 0 ) ) {
-   imageName = 'File:' + imageName;
-   }
+   var imageName = $.wikiLove.addFilePrefix( $( 
'#mw-wikilove-image' ).val() );
msg = msg.replace( '$3', imageName ); // replace the image
msg = msg.replace( '$4', currentTypeOrSubtype.imageSize || 
options.defaultImageSize ); // replace the image size
msg = msg.replace( '$5', currentTypeOrSubtype.backgroundColor 
|| options.defaultBackgroundColor ); // replace the background color
@@ -336,6 +332,16 @@
},

/*
+* Adds a File: prefix if there isn't already a media namespace 
prefix.
+*/
+   addFilePrefix: function( filename ) {
+   if ( filename.indexOf( 'File:' ) !== 0  filename.indexOf( 
'Image:' ) !== 0  filename.indexOf( wgFormattedNamespaces[6] + ':' ) !== 0  ) 
{
+   filename = 'File:' + filename;
+   }
+   return filename;
+   },
+   
+   /*
 * Fires AJAX request for previewing wikitext.
 */
doPreview: function( wikitext ) {
@@ -447,12 +453,7 @@
for( var i=0; icurrentTypeOrSubtype.gallery.number; i++ ) {
// get a random image from imageList and add it to the 
list of titles to be retrieved
var id = Math.floor( Math.random() * imageList.length );
-   // make sure the image name has a prefix
-   if ( imageList[id].indexOf( 'File:' ) === 0 || 
imageList[id].indexOf( 'Image:' ) === 0 || imageList[id].indexOf( 
wgFormattedNamespaces[6] ) === 0) {
-   titles = titles + imageList[id] + '|';
-   } else {
-   titles = titles + 'File:' + imageList[id] + '|';
-   }
+   titles = titles + $.wikiLove.addFilePrefix( 
imageList[id] ) + '|';

// remove the randomly selected image from imageList so 
that it can't be added twice 
imageList.splice(id, 1);


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90881] trunk/extensions/WikiLove

2011-06-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90881

Revision: 90881
Author:   janpaul123
Date: 2011-06-27 15:35:32 + (Mon, 27 Jun 2011)
Log Message:
---
Added 'What is this?' link.

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.i18n.php
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css

Modified: trunk/extensions/WikiLove/WikiLove.i18n.php
===
--- trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-27 15:11:09 UTC (rev 
90880)
+++ trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-27 15:35:32 UTC (rev 
90881)
@@ -42,7 +42,8 @@
'wikilove-err-sig' = 'Please do not include a signature in the 
message.',
'wikilove-err-gallery' = 'Something went wrong when loading the 
images!',
'wikilove-err-gallery-again' = 'Try again',
-   'wikilove-summary' = '/* $1 */ new WikiLove message'
+   'wikilove-summary' = '/* $1 */ new WikiLove message',
+   'wikilove-what-is-this' = What is this?,
 );
 
 /** Message documentation (Message documentation)

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-06-27 15:11:09 UTC (rev 
90880)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-06-27 15:35:32 UTC (rev 
90881)
@@ -121,6 +121,7 @@
'wikilove-err-sig',
'wikilove-err-gallery',
'wikilove-err-gallery-again',
+   'wikilove-what-is-this',
),
'dependencies' = array(
'jquery.ui.dialog',

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-27 15:11:09 UTC (rev 90880)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-27 15:35:32 UTC (rev 90881)
@@ -56,6 +56,9 @@
lihtml:msg key=wikilove-get-started-list-2//li\
lihtml:msg key=wikilove-get-started-list-3//li\
/ol\
+   pa target=_blank href=http://www.mediawiki.org/wiki/WikiLove;\
+   html:msg key=wikilove-what-is-this/\
+   /a/p\
 /div\
 div id=mw-wikilove-add-details\
span class=mw-wikilove-number2/span\

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css 
2011-06-27 15:11:09 UTC (rev 90880)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css 
2011-06-27 15:35:32 UTC (rev 90881)
@@ -344,3 +344,7 @@
padding-left: 34px;
padding-bottom: 3px;
 }
+
+#mw-wikilove-dialog a {
+   color: #0645AD;
+}


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90133] trunk/extensions/WikiLove

2011-06-15 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90133

Revision: 90133
Author:   janpaul123
Date: 2011-06-15 18:32:29 + (Wed, 15 Jun 2011)
Log Message:
---
Reverted r88565 for now for 1.17wmf1 compatibility

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.hooks.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/WikiLove.hooks.php
===
--- trunk/extensions/WikiLove/WikiLove.hooks.php2011-06-15 18:30:15 UTC 
(rev 90132)
+++ trunk/extensions/WikiLove/WikiLove.hooks.php2011-06-15 18:32:29 UTC 
(rev 90133)
@@ -43,22 +43,25 @@
}

/**
-* Adds the required module if we are on a user (talk) page.
+* Adds the required module and edit token JS if we are on a user 
(talk) page.
 *
 * @param $output
 * @param $skin Skin
 */
public static function beforePageDisplay( $out, $skin ) {
global $wgWikiLoveGlobal, $wgUser;
-   if ( !$wgWikiLoveGlobal  !$wgUser-getOption( 
'wikilove-enabled' ) ) {
-   return true;
-   }
+   if ( !$wgWikiLoveGlobal  !$wgUser-getOption( 
'wikilove-enabled' ) ) return true;

$title = self::getUserTalkPage( $skin-getTitle() );
if ( !is_null( $title ) ) {
$out-addModules( 'ext.wikiLove.icon' );
$out-addModules( 'ext.wikiLove.init' );
self::$recipient = $title-getText();
+   $out-addInlineScript(
+   'jQuery( document ).ready( function() {
+   jQuery.wikiLove.editToken = ' . 
FormatJson::encode( $wgUser-edittoken() ) . ';
+   } );'
+   );
}
return true;
}

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-15 18:30:15 UTC (rev 90132)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-15 18:32:29 UTC (rev 90133)
@@ -7,6 +7,7 @@
currentSubtypeId = null, // id of the currently selected subtype (e.g. 
'original' or 'special')
currentTypeOrSubtype = null, // content of the current (sub)type (i.e. 
an object with title, descr, text, etc.)
previewData = null, // data of the currently previewed thing is set here
+   editToken = '', // edit token used for the final AJAX call (deprecated 
after 1.17)
emailable = false,
gallery = {};

@@ -384,7 +385,7 @@
'text': wikitext,
'message': message,
'subject': subject,
-   'token': mw.user.tokens.get( 'editToken' )
+   'token': $.wikiLove.editToken // after 1.17 this can 
become mw.user.tokens.get( 'editToken' )
};

if ( email ) {


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90134] trunk/extensions/WikiLove

2011-06-15 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90134

Revision: 90134
Author:   janpaul123
Date: 2011-06-15 18:39:20 + (Wed, 15 Jun 2011)
Log Message:
---
Followup to r90133 as this was still incorrect.

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.hooks.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/WikiLove.hooks.php
===
--- trunk/extensions/WikiLove/WikiLove.hooks.php2011-06-15 18:32:29 UTC 
(rev 90133)
+++ trunk/extensions/WikiLove/WikiLove.hooks.php2011-06-15 18:39:20 UTC 
(rev 90134)
@@ -43,34 +43,33 @@
}

/**
-* Adds the required module and edit token JS if we are on a user 
(talk) page.
+* Adds the required module if we are on a user (talk) page.
 *
 * @param $output
 * @param $skin Skin
 */
public static function beforePageDisplay( $out, $skin ) {
global $wgWikiLoveGlobal, $wgUser;
-   if ( !$wgWikiLoveGlobal  !$wgUser-getOption( 
'wikilove-enabled' ) ) return true;
+   if ( !$wgWikiLoveGlobal  !$wgUser-getOption( 
'wikilove-enabled' ) ) {
+   return true;
+   }

$title = self::getUserTalkPage( $skin-getTitle() );
if ( !is_null( $title ) ) {
$out-addModules( 'ext.wikiLove.icon' );
$out-addModules( 'ext.wikiLove.init' );
self::$recipient = $title-getText();
-   $out-addInlineScript(
-   'jQuery( document ).ready( function() {
-   jQuery.wikiLove.editToken = ' . 
FormatJson::encode( $wgUser-edittoken() ) . ';
-   } );'
-   );
}
return true;
}

/**
-* Exports wikilove-recipient variable to JS
+* Exports wikilove-recipient and edittoken variables to JS
 */
public static function makeGlobalVariablesScript( $vars ) {
+   global $wgUser;
$vars['wikilove-recipient'] = self::$recipient;
+   $vars['wikilove-edittoken'] = $wgUser-edittoken();
return true;
}


Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-15 18:32:29 UTC (rev 90133)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-15 18:39:20 UTC (rev 90134)
@@ -7,7 +7,6 @@
currentSubtypeId = null, // id of the currently selected subtype (e.g. 
'original' or 'special')
currentTypeOrSubtype = null, // content of the current (sub)type (i.e. 
an object with title, descr, text, etc.)
previewData = null, // data of the currently previewed thing is set here
-   editToken = '', // edit token used for the final AJAX call (deprecated 
after 1.17)
emailable = false,
gallery = {};

@@ -385,7 +384,7 @@
'text': wikitext,
'message': message,
'subject': subject,
-   'token': $.wikiLove.editToken // after 1.17 this can 
become mw.user.tokens.get( 'editToken' )
+   'token': mw.config.get( 'wikilove-edittoken' ) // after 
1.17 this can become mw.user.tokens.get( 'editToken' )
};

if ( email ) {


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90136] trunk/extensions/WikiLove/WikiLove.api.php

2011-06-15 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90136

Revision: 90136
Author:   janpaul123
Date: 2011-06-15 19:03:45 + (Wed, 15 Jun 2011)
Log Message:
---
Fixes sending WikiLove to a non-existing talk page

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.api.php

Modified: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  2011-06-15 18:44:17 UTC (rev 
90135)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-06-15 19:03:45 UTC (rev 
90136)
@@ -19,13 +19,13 @@
$this-saveInDb( $talk, $params['subject'], 
$params['message'], $params['type'], isset( $params['email'] ) ? 1 : 0 );
}

-   $article = new Article( $talk, 0 );
-   
// not using section = 'new' here, as we like to give our own 
edit summary
$api = new ApiMain( new FauxRequest( array(
'action' = 'edit',
'title'  = $talk-getFullText(),
-   'text' = $article-replaceSection( 'new', 
$params['text'], $params['subject'] ),
+   // need to do this, as Article::replaceSection fails 
for non-existing pages
+   'appendtext' = ( $talk-exists() ? \n\n : '' ) . 
wfMsgForContent( 'newsectionheaderdefaultlevel', $params['subject'] )
+   . \n\n . $params['text'],
'token'  = $params['token'],
'summary' = wfMsgForContent( 'wikilove-summary', 
$wgParser-stripSectionName( $params['subject'] ) ),
'notminor' = true,


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90046] trunk/extensions/WikiLove/WikiLove.api.php

2011-06-14 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90046

Revision: 90046
Author:   janpaul123
Date: 2011-06-14 14:39:10 + (Tue, 14 Jun 2011)
Log Message:
---
Fixed r90017 per 
https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Special:Code/MediaWiki/90017#c18040

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.api.php

Modified: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  2011-06-14 14:21:57 UTC (rev 
90045)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-06-14 14:39:10 UTC (rev 
90046)
@@ -19,10 +19,13 @@
$this-saveInDb( $talk, $params['subject'], 
$params['message'], $params['type'], isset( $params['email'] ) ? 1 : 0 );
}

+   $article = new Article( $talk, 0 );
+   
+   // not using section = 'new' here, as we like to give our own 
edit summary
$api = new ApiMain( new FauxRequest( array(
'action' = 'edit',
'title'  = $talk-getFullText(),
-   'text' = Article::newFromTitle( $talk, new 
RequestContext() )-replaceSection( 'new', $params['text'], $params['subject'] 
),
+   'text' = $article-replaceSection( 'new', 
$params['text'], $params['subject'] ),
'token'  = $params['token'],
'summary' = wfMsgForContent( 'wikilove-summary', 
$wgParser-stripSectionName( $params['subject'] ) ),
'notminor' = true,


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90050] trunk/extensions/WikiLove

2011-06-14 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90050

Revision: 90050
Author:   janpaul123
Date: 2011-06-14 14:50:56 + (Tue, 14 Jun 2011)
Log Message:
---
Actually fills the database with registration and edit count data now. Removed 
the recent edit count as I don't see a way to efficiently include that right 
now.

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.api.php
trunk/extensions/WikiLove/patches/WikiLoveLog.sql

Modified: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  2011-06-14 14:48:48 UTC (rev 
90049)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-06-14 14:50:56 UTC (rev 
90050)
@@ -56,15 +56,26 @@
private function saveInDb( $talk, $subject, $message, $type, $email ) {
global $wgUser;
$dbw = wfGetDB( DB_MASTER );
+   $receiver = User::newFromName( 
$talk-getSubjectPage()-getBaseText() );
+   if ( $receiver-isAnon() ) {
+   $this-setWarning( 'Not logging anonymous recipients' );
+   return;
+   }
+   
$values = array(
'wll_timestamp' = $dbw-timestamp(),
'wll_sender' = $wgUser-getId(),
-   'wll_receiver' = User::newFromName( 
$talk-getSubjectPage()-getBaseText() )-getId(),
+   'wll_sender_editcount' = $wgUser-getEditCount(),
+   'wll_sender_registration' = $wgUser-getRegistration(),
+   'wll_receiver' = $receiver-getId(),
+   'wll_receiver_editcount' = $receiver-getEditCount(),
+   'wll_receiver_registration' = 
$receiver-getRegistration(),
'wll_type' = $type,
'wll_subject' = $subject,
'wll_message' = $message,
'wll_email' = $email,
);
+   
try{
$dbw-insert( 'wikilove_log', $values, __METHOD__ );
} catch( DBQueryError $dbqe ) {

Modified: trunk/extensions/WikiLove/patches/WikiLoveLog.sql
===
--- trunk/extensions/WikiLove/patches/WikiLoveLog.sql   2011-06-14 14:48:48 UTC 
(rev 90049)
+++ trunk/extensions/WikiLove/patches/WikiLoveLog.sql   2011-06-14 14:50:56 UTC 
(rev 90050)
@@ -8,13 +8,11 @@
wll_id int NOT NULL PRIMARY KEY auto_increment, -- unique id
wll_timestamp binary(14) NOT NULL,  -- timestamp
wll_sender int(11) NOT NULL,-- user id of 
the sender
-   wll_sender_registration varchar(16) default NULL,   -- registration 
date of the sender
-   wll_sender_totaledits mediumint(8) default NULL,-- total number 
of edits for the sender
-   wll_sender_recentedits smallint(6) default NULL,-- number of 
recent edits for the sender
+   wll_sender_registration binary(14) default NULL,-- registration 
date of the sender
+   wll_sender_editcount int(11) default NULL,  -- 
total number of edits for the sender
wll_receiver int(11) NOT NULL,  -- user id of 
the receiver
-   wll_receiver_registration varchar(16) default NULL, -- registration 
date of the receiver
-   wll_receiver_totaledits mediumint(8) default NULL,  -- total number 
of edits for the receiver
-   wll_receiver_recentedits smallint(6) default NULL,  -- number of 
recent edits for the receiver
+   wll_receiver_registration binary(14) default NULL,  -- registration 
date of the receiver
+   wll_receiver_editcount int(11) default NULL,-- total number 
of edits for the receiver
wll_type varchar(64) NOT NULL,  -- type (and 
subtype) of message
wll_subject varchar(255) NOT NULL,  -- subject line
wll_message blob NOT NULL,  -- actual 
message


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90017] trunk/extensions/WikiLove

2011-06-13 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90017

Revision: 90017
Author:   janpaul123
Date: 2011-06-13 22:23:10 + (Mon, 13 Jun 2011)
Log Message:
---
Fixed problem: Edit Summary should mention WikiLove

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.api.php
trunk/extensions/WikiLove/WikiLove.i18n.php

Modified: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  2011-06-13 22:13:38 UTC (rev 
90016)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-06-13 22:23:10 UTC (rev 
90017)
@@ -1,7 +1,7 @@
 ?php
 class WikiLoveApi extends ApiBase {
public function execute() {
-   global $wgRequest, $wgWikiLoveLogging;
+   global $wgRequest, $wgWikiLoveLogging, $wgParser;

$params = $this-extractRequestParams();

@@ -22,10 +22,9 @@
$api = new ApiMain( new FauxRequest( array(
'action' = 'edit',
'title'  = $talk-getFullText(),
-   'section' = 'new',
-   'text' = $params['text'],
+   'text' = Article::newFromTitle( $talk, new 
RequestContext() )-replaceSection( 'new', $params['text'], $params['subject'] 
),
'token'  = $params['token'],
-   'summary' = $params['subject'],
+   'summary' = wfMsgForContent( 'wikilove-summary', 
$wgParser-stripSectionName( $params['subject'] ) ),
'notminor' = true,
), false, array( 'wsEditToken' = $wgRequest-getSessionData( 
'wsEditToken' ) ) ), true );


Modified: trunk/extensions/WikiLove/WikiLove.i18n.php
===
--- trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-13 22:13:38 UTC (rev 
90016)
+++ trunk/extensions/WikiLove/WikiLove.i18n.php 2011-06-13 22:23:10 UTC (rev 
90017)
@@ -41,6 +41,7 @@
'wikilove-err-sig' = 'Please do not include a signature in the 
message.',
'wikilove-err-gallery' = 'Something went wrong when loading the 
images!',
'wikilove-err-gallery-again' = 'Try again',
+   'wikilove-summary' = '/* $1 */ new WikiLove message'
 );
 
 /** Message documentation (Message documentation)


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [90018] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. core.js

2011-06-13 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90018

Revision: 90018
Author:   janpaul123
Date: 2011-06-13 22:35:04 + (Mon, 13 Jun 2011)
Log Message:
---
Fixed JS leakage

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-13 22:23:10 UTC (rev 90017)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-06-13 22:35:04 UTC (rev 90018)
@@ -448,7 +448,7 @@
}

var index = 0,
-   loadingType = currentTypeOrSubtype
+   loadingType = currentTypeOrSubtype,
loadingIndex = 0;
$.ajax({
url: mw.util.wikiScript( 'api' ),
@@ -476,7 +476,7 @@
$.each( data.query.pages, function( id, page ) {
if ( page.imageinfo  
page.imageinfo.length ) {
// build an image tag with the 
correct url and width
-   $img = $( 'img/' )
+   var $img = $( 'img/' )
.attr( 'src', 
page.imageinfo[0].thumburl )
.attr( 'width', 
currentTypeOrSubtype.gallery.width )
.hide()


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [89139] trunk/extensions/WikiLove

2011-05-29 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89139

Revision: 89139
Author:   janpaul123
Date: 2011-05-29 22:49:54 + (Sun, 29 May 2011)
Log Message:
---
Fix for when image loading fails

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.i18n.php
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css

Modified: trunk/extensions/WikiLove/WikiLove.i18n.php
===
--- trunk/extensions/WikiLove/WikiLove.i18n.php 2011-05-29 21:50:09 UTC (rev 
89138)
+++ trunk/extensions/WikiLove/WikiLove.i18n.php 2011-05-29 22:49:54 UTC (rev 
89139)
@@ -39,6 +39,8 @@
'wikilove-err-msg' = 'Please enter a message.',
'wikilove-err-image' = 'Please select an image.',
'wikilove-err-sig' = 'Please do not include a signature in the 
message.',
+   'wikilove-err-gallery' = 'Something went wrong when loading the 
images!',
+   'wikilove-err-gallery-again' = 'Try again',
 );
 
 /** Message documentation (Message documentation)

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-05-29 21:50:09 UTC (rev 
89138)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-05-29 22:49:54 UTC (rev 
89139)
@@ -112,7 +112,8 @@
'wikilove-err-msg',
'wikilove-err-image',
'wikilove-err-sig',
-   'wikilove-barnstar-header',
+   'wikilove-err-gallery',
+   'wikilove-err-gallery-again',
),
'dependencies' = array(
'jquery.ui.dialog',

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-29 21:50:09 UTC (rev 89138)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-29 22:49:54 UTC (rev 89139)
@@ -68,6 +68,10 @@
div id=mw-wikilove-subtype-description/div\
label id=mw-wikilove-gallery-labelhtml:msg 
key=wikilove-image//label\
div id=mw-wikilove-gallery\
+   div id=mw-wikilove-gallery-error\
+   html:msg key=wikilove-err-gallery/\
+   a href=# 
id=mw-wikilove-gallery-error-againhtml:msg 
key=wikilove-err-gallery-again//a\
+   /div\
div id=mw-wikilove-gallery-spinner 
class=mw-wikilove-spinner/div\
div id=mw-wikilove-gallery-content/div\
/div\
@@ -114,7 +118,7 @@
$( '#mw-wikilove-add-details' ).hide();
$( '#mw-wikilove-preview' ).hide();
$( '#mw-wikilove-types' ).replaceWith( $typeList );
-   
+   $( '#mw-wikilove-gallery-error-again' ).click( 
$.wikiLove.showGallery );
$( '#mw-wikilove-types a' ).click( $.wikiLove.clickType 
);
$( '#mw-wikilove-subtype' ).change( 
$.wikiLove.changeSubtype );
$( '#mw-wikilove-preview-form' ).submit( 
$.wikiLove.submitPreview );
@@ -424,6 +428,7 @@
$( '#mw-wikilove-gallery-content' ).html( '' );
gallery = {};
$( '#mw-wikilove-gallery-spinner' ).fadeIn( 200 );
+   $( '#mw-wikilove-gallery-error' ).hide();

if( typeof currentTypeOrSubtype.gallery.number == 'undefined'
|| currentTypeOrSubtype.gallery.number = 0
@@ -458,10 +463,16 @@
dataType: 'json',
type: 'POST',
success: function( data ) {
-   if ( !data || !data.query || !data.query.pages 
|| loadingType != currentTypeOrSubtype ) {
+   if ( !data || !data.query || !data.query.pages 
) {
+   $( '#mw-wikilove-gallery-error' 
).show();
+   $( '#mw-wikilove-gallery-spinner' 
).fadeOut( 200 );
return;
}

+   if ( loadingType != currentTypeOrSubtype ) {
+   return;
+   }
+   
$.each( data.query.pages, function( id, page ) {
if ( page.imageinfo  
page.imageinfo.length ) {
// build an image tag

[MediaWiki-CVS] SVN: [89030] trunk/extensions/WikiLove/modules/ext.wikiLove

2011-05-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89030

Revision: 89030
Author:   janpaul123
Date: 2011-05-28 10:49:36 + (Sat, 28 May 2011)
Log Message:
---
Restructured the core file per 
http://www.mediawiki.org/wiki/User:Krinkle/Extension_review/WikiLove (IIFE)

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.init.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-28 09:58:43 UTC (rev 89029)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-28 10:49:36 UTC (rev 89030)
@@ -1,38 +1,41 @@
-( function( $ ) { $.wikiLove = {
+( function( $ ) { 
+$.wikiLove = (function(){
+
+varoptions = {}, // options modifiable by the user
+   $dialog = null, // dialog jQuery object
+   currentTypeId = null, // id of the currently selected type (e.g. 
'barnstar' or 'makeyourown')
+   currentSubtypeId = null, // id of the currently selected subtype (e.g. 
'original' or 'special')
+   currentTypeOrSubtype = null, // content of the current (sub)type (i.e. 
an object with title, descr, text, etc.)
+   previewData = null, // data of the currently previewed thing is set here
+   emailable = false,
+   gallery = {};

-   options: {}, // options modifiable by the user
+return {
optionsHook: function() { return {}; }, // hook that can be overridden 
by the user to modify options
-   $dialog: null, // dialog jQuery object
-   currentTypeId: null, // id of the currently selected type (e.g. 
'barnstar' or 'makeyourown')
-   currentSubtypeId: null, // id of the currently selected subtype (e.g. 
'original' or 'special')
-   currentTypeOrSubtype: null, // content of the current (sub)type (i.e. 
an object with title, descr, text, etc.)
-   previewData: null, // data of the currently previewed thing is set here
-   emailable: false,
-   gallery: {},

/*
 * Opens the dialog and builds it if necessary.
 */
openDialog: function() {
-   if ( $.wikiLove.$dialog === null ) {
+   if ( $dialog === null ) {
// Test to see if the 'E-mail this user' link exists
-   $.wikiLove.emailable = $( '#t-emailuser' ).length ? 
true : false;
+   emailable = $( '#t-emailuser' ).length ? true : false;

// Build a type list like this:
var $typeList = $( 'ul id=mw-wikilove-types/ul' );
-   for( var typeId in $.wikiLove.options.types ) {
+   for( var typeId in options.types ) {
var $button = $( 'a href=#/a' );
var $buttonInside = $( 'div 
class=mw-wikilove-inside/div' );

-   if( typeof 
$.wikiLove.options.types[typeId].icon == 'string' ) {
+   if( typeof options.types[typeId].icon == 
'string' ) {
$buttonInside.append( 'div 
class=mw-wikilove-icon-boximg src='
-   + mw.html.escape( 
$.wikiLove.options.types[typeId].icon ) + '//div' );
+   + mw.html.escape( 
options.types[typeId].icon ) + '//div' );
}
else {
$buttonInside.addClass( 
'mw-wikilove-no-icon' );
}

-   $buttonInside.append( 'div 
class=mw-wikilove-link-text' + $.wikiLove.options.types[typeId].name + 
'/div' );
+   $buttonInside.append( 'div 
class=mw-wikilove-link-text' + options.types[typeId].name + '/div' );

$button.append( 'div 
class=mw-wikilove-left-cap/div');
$button.append( $buttonInside );
@@ -41,7 +44,7 @@
$typeList.append( $( 'li tabindex=0/li' 
).append( $button ) );
}

-   $.wikiLove.$dialog = $( '\
+   $dialog = $( '\
 div id=mw-wikilove-dialog\
 div id=mw-wikilove-select-type\
span class=mw-wikilove-number1/span\
@@ -95,9 +98,9 @@
/form\
 /div\
 /div' );
-   $.wikiLove.$dialog.localize();
+   $dialog.localize();

-   $.wikiLove.$dialog.dialog({
+   $dialog.dialog({
width

[MediaWiki-CVS] SVN: [89031] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. core.js

2011-05-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89031

Revision: 89031
Author:   janpaul123
Date: 2011-05-28 10:52:55 + (Sat, 28 May 2011)
Log Message:
---
Fixed bug where gallery elements were removed so that after a few refreshes of 
a gallery there were no images left

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-28 10:49:36 UTC (rev 89030)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-28 10:52:55 UTC (rev 89031)
@@ -460,7 +460,7 @@
}

var titles = '';
-   var imageList = currentTypeOrSubtype.gallery.imageList;
+   var imageList = currentTypeOrSubtype.gallery.imageList.slice( 0 
);
for( var i=0; icurrentTypeOrSubtype.gallery.number; i++ ) {
// get a randomimage
var id = Math.floor( Math.random() * imageList.length );


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [89032] trunk/extensions/WikiLove

2011-05-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89032

Revision: 89032
Author:   janpaul123
Date: 2011-05-28 11:22:32 + (Sat, 28 May 2011)
Log Message:
---
Some more fixes:
* Optimisations per 
http://www.mediawiki.org/wiki/User:Krinkle/Extension_review/WikiLove (used 
.toggle for even cleaner code)
* Fixed bug when leaving WikiLove at User:SomeUser/subpage, now it actually 
delivers on User talk:SomeUser instead of User talk:SomeUser/subpage, and the 
username is substituted for $7, instead of the page name which includes the 
subpath.
* Fixed bug in the API which triggered an error when not entering a message 
although this is allowed client-side.
* Fixed some more leftovers of r89030

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.api.php
trunk/extensions/WikiLove/WikiLove.hooks.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  2011-05-28 10:52:55 UTC (rev 
89031)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-05-28 11:22:32 UTC (rev 
89032)
@@ -98,7 +98,6 @@
),
'message' = array(
ApiBase::PARAM_TYPE = 'string',
-   ApiBase::PARAM_REQUIRED = true,
),
'token' = array(
ApiBase::PARAM_TYPE = 'string',

Modified: trunk/extensions/WikiLove/WikiLove.hooks.php
===
--- trunk/extensions/WikiLove/WikiLove.hooks.php2011-05-28 10:52:55 UTC 
(rev 89031)
+++ trunk/extensions/WikiLove/WikiLove.hooks.php2011-05-28 11:22:32 UTC 
(rev 89032)
@@ -56,6 +56,11 @@
if ( !is_null( $title ) ) {
$out-addModules( 'ext.wikiLove.icon' );
$out-addModules( 'ext.wikiLove.init' );
+   $out-addInlineScript(
+   'jQuery( document ).ready( function() {
+   jQuery.wikiLove.setUsername( ' . 
FormatJson::encode( $title-getText() ) . ' );
+   } );'
+   );
}
return true;
}
@@ -130,10 +135,15 @@
}

$ns = $title-getNamespace();
-   if ( $ns == NS_USER_TALK  $title-quickUserCan( 'edit' ) ) {
-   return $title;
+   // return quickly if we're in the wrong namespace anyway
+   if ( $ns != NS_USER  $ns != NS_USER_TALK ) return null;
+   
+   $baseTitle = Title::newFromText( $title-getBaseText(), $ns );
+   
+   if ( $ns == NS_USER_TALK  $baseTitle-quickUserCan( 'edit' ) 
) {
+   return $baseTitle;
} elseif ( $ns == NS_USER ) {
-   $talk = $title-getTalkPage();
+   $talk = $baseTitle-getTalkPage();
if ( $talk-quickUserCan( 'edit' ) ) {
return $talk;
}

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-28 10:52:55 UTC (rev 89031)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-28 11:22:32 UTC (rev 89032)
@@ -8,7 +8,8 @@
currentTypeOrSubtype = null, // content of the current (sub)type (i.e. 
an object with title, descr, text, etc.)
previewData = null, // data of the currently previewed thing is set here
emailable = false,
-   gallery = {};
+   gallery = {},
+   username = '';

 return {
optionsHook: function() { return {}; }, // hook that can be overridden 
by the user to modify options
@@ -138,7 +139,7 @@
currentTypeId = newTypeId;
currentSubtypeId = null; // reset the subtype id

-   $( '#mw-wikilove-types a' ).removeClass( 'selected' );
+   $( '#mw-wikilove-types' ).find( 'a' ).removeClass( 
'selected' );
$( this ).addClass( 'selected' ); // highlight the new 
type in the menu

if( typeof options.types[currentTypeId].subtypes == 
'object' ) {
@@ -207,51 +208,34 @@
}

// show or hide header label and textbox depending on whether a 
predefined header exists
-   if( $.inArray( 'header', currentTypeOrSubtype.fields ) = 0 ) {
-   $( '#mw-wikilove-header-label').show

[MediaWiki-CVS] SVN: [89033] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. core.js

2011-05-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89033

Revision: 89033
Author:   janpaul123
Date: 2011-05-28 11:30:29 + (Sat, 28 May 2011)
Log Message:
---
* Fixed bug in gallery loading
* Fading away the gallery spinner now happens only when all the images are 
visible

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-28 11:22:32 UTC (rev 89032)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-28 11:30:29 UTC (rev 89033)
@@ -454,7 +454,9 @@
imageList.splice(id, 1);
}

-   var index = 0;
+   var index = 0,
+   loadingType = currentTypeOrSubtype
+   loadingIndex = 0;
$.ajax({
url: mw.util.wikiScript( 'api' ),
data: {
@@ -468,11 +470,10 @@
dataType: 'json',
type: 'POST',
success: function( data ) {
-   $( '#mw-wikilove-gallery-spinner' ).fadeOut( 
200 );
-   
-   if ( !data || !data.query || !data.query.pages 
) {
+   if ( !data || !data.query || !data.query.pages 
|| loadingType != currentTypeOrSubtype ) {
return;
}
+   
$.each( data.query.pages, function( id, page ) {
if ( page.imageinfo  
page.imageinfo.length ) {
// build an image tag with the 
correct url and width
@@ -480,7 +481,13 @@
.attr( 'src', 
page.imageinfo[0].thumburl )
.attr( 'width', 
currentTypeOrSubtype.gallery.width )
.hide()
-   .load( function() { $( 
this ).css( 'display', 'inline-block' ); } );
+   .load( function() { 
+   $( this ).css( 
'display', 'inline-block' );
+   loadingIndex++;
+   if ( 
loadingIndex = currentTypeOrSubtype.gallery.number ) {
+   $( 
'#mw-wikilove-gallery-spinner' ).fadeOut( 200 );
+   }
+   } );
$( 
'#mw-wikilove-gallery-content' ).append( 
$( 'a href=#/a' )
.attr( 'id', 
'mw-wikilove-gallery-img-' + index )


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [89034] trunk/extensions/WikiLove

2011-05-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89034

Revision: 89034
Author:   janpaul123
Date: 2011-05-28 11:46:55 + (Sat, 28 May 2011)
Log Message:
---
Fixed inline JS based on comment in 
http://www.mediawiki.org/wiki/User:Catrope/Extension_review/WikiLove

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.hooks.php
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/WikiLove.hooks.php
===
--- trunk/extensions/WikiLove/WikiLove.hooks.php2011-05-28 11:30:29 UTC 
(rev 89033)
+++ trunk/extensions/WikiLove/WikiLove.hooks.php2011-05-28 11:46:55 UTC 
(rev 89034)
@@ -7,6 +7,8 @@
  */
 
 class WikiLoveHooks {
+   private static $recipient = '';
+   
/**
 * LoadExtensionSchemaUpdates hook
 *
@@ -56,16 +58,20 @@
if ( !is_null( $title ) ) {
$out-addModules( 'ext.wikiLove.icon' );
$out-addModules( 'ext.wikiLove.init' );
-   $out-addInlineScript(
-   'jQuery( document ).ready( function() {
-   jQuery.wikiLove.setUsername( ' . 
FormatJson::encode( $title-getText() ) . ' );
-   } );'
-   );
+   self::$recipient = $title-getText();
}
return true;
}

/**
+* Exports wikilove-recipient variable to JS
+*/
+   public static function makeGlobalVariablesScript( $vars ) {
+   $vars['wikilove-recipient'] = self::$recipient;
+   return true;
+   }
+   
+   /**
 * Adds a tab the old way (before MW 1.18)
 */
public static function skinTemplateTabs( $skin, $contentActions ) {

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-05-28 11:30:29 UTC (rev 
89033)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-05-28 11:46:55 UTC (rev 
89034)
@@ -67,6 +67,7 @@
 $wgHooks['SkinTemplateTabs'][]= 
'WikiLoveHooks::skinTemplateTabs';
 $wgHooks['BeforePageDisplay'][]   = 
'WikiLoveHooks::beforePageDisplay';
 $wgHooks['LoadExtensionSchemaUpdates'][]  = 
'WikiLoveHooks::loadExtensionSchemaUpdates';
+$wgHooks['MakeGlobalVariablesScript'][]   = 
'WikiLoveHooks::makeGlobalVariablesScript';
 
 // api modules
 $wgAPIModules['wikilove'] = 'WikiLoveApi';

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-28 11:30:29 UTC (rev 89033)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-28 11:46:55 UTC (rev 89034)
@@ -8,8 +8,7 @@
currentTypeOrSubtype = null, // content of the current (sub)type (i.e. 
an object with title, descr, text, etc.)
previewData = null, // data of the currently previewed thing is set here
emailable = false,
-   gallery = {},
-   username = '';
+   gallery = {};

 return {
optionsHook: function() { return {}; }, // hook that can be overridden 
by the user to modify options
@@ -331,7 +330,7 @@
msg = msg.replace( '$5', myBackgroundColor ); // replace the 
background color
msg = msg.replace( '$6', myBorderColor ); // replace the border 
color

-   msg = msg.replace( '$7', username ); // replace the username 
we're sending to
+   msg = msg.replace( '$7', mw.config.get( 'wikilove-recipient' ) 
); // replace the username we're sending to

return msg;
},
@@ -516,13 +515,6 @@
$.wikiLove.openDialog();
e.preventDefault();
});
-   },
-   
-   /*
-* Public function to set the username by finding the base title 
server-side.
-*/
-   setUsername: function( name ) {
-   username = name;
}

/*


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [89055] trunk/extensions/WikiLove

2011-05-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89055

Revision: 89055
Author:   janpaul123
Date: 2011-05-28 18:42:11 + (Sat, 28 May 2011)
Log Message:
---
Some minor things

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.api.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js

Modified: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  2011-05-28 18:33:01 UTC (rev 
89054)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-05-28 18:42:11 UTC (rev 
89055)
@@ -123,6 +123,7 @@
'message' = 'Actual message the user has entered, for 
logging purposes',
'token' = 'Edit token. You can get one of these 
through prop=info',
'subject' = 'Subject header of the new section',
+   'email' = 'Content of the optional e-mail message to 
send to the user',
'type' = array( 'Type of WikiLove (for statistics); 
this corresponds with a type',
 'selected in the left menu, and 
optionally a subtype after that',
 '(e.g. barnstar-normal or kitten)',

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-28 18:33:01 UTC (rev 89054)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-28 18:42:11 UTC (rev 89055)
@@ -281,12 +281,7 @@
$.wikiLove.showError( 'wikilove-err-sig' ); return 
false;
}

-   var text = $.wikiLove.prepareMsg(
-   currentTypeOrSubtype.text || options.defaultText,
-   currentTypeOrSubtype.imageSize,
-   currentTypeOrSubtype.backgroundColor,
-   currentTypeOrSubtype.borderColor
-   );
+   var text = $.wikiLove.prepareMsg( currentTypeOrSubtype.text || 
options.defaultText );

$.wikiLove.doPreview( '==' + $( '#mw-wikilove-header' ).val() + 
==\n + text );
previewData = {
@@ -316,20 +311,14 @@
 * $6: border color
 * $7: username of the recipient
 */
-   prepareMsg: function( msg, imageSize, backgroundColor, borderColor ) {
+   prepareMsg: function( msg ) {

msg = msg.replace( '$1', $( '#mw-wikilove-message' ).val() ); 
// replace the raw message
msg = msg.replace( '$2', $( '#mw-wikilove-title' ).val() ); // 
replace the title
msg = msg.replace( '$3', $( '#mw-wikilove-image' ).val() ); // 
replace the image
-   
-   var myImageSize = imageSize || options.defaultImageSize;
-   var myBackgroundColor = backgroundColor || 
options.defaultBackgroundColor;
-   var myBorderColor = borderColor || options.defaultBorderColor;
-   
-   msg = msg.replace( '$4', myImageSize ); // replace the image 
size
-   msg = msg.replace( '$5', myBackgroundColor ); // replace the 
background color
-   msg = msg.replace( '$6', myBorderColor ); // replace the border 
color
-   
+   msg = msg.replace( '$4', currentTypeOrSubtype.imageSize || 
options.defaultImageSize ); // replace the image size
+   msg = msg.replace( '$5', currentTypeOrSubtype.backgroundColor 
|| options.defaultBackgroundColor ); // replace the background color
+   msg = msg.replace( '$6', currentTypeOrSubtype.borderColor || 
options.defaultBorderColor ); // replace the border color
msg = msg.replace( '$7', mw.config.get( 'wikilove-recipient' ) 
); // replace the username we're sending to

return msg;

Modified: 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js
===
--- 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js   
2011-05-28 18:33:01 UTC (rev 89054)
+++ 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js   
2011-05-28 18:42:11 UTC (rev 89055)
@@ -263,7 +263,7 @@
email: 'Hello $7!\n\nI just awarded you 
a barnstar.'
}
},
-   icon: mw.config.get( 'wgServer' ) + mw.config.get( 
'wgScriptPath' ) + 
'/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-barnstar.png'
 // icon for left-side menu
+   icon: mw.config.get

[MediaWiki-CVS] SVN: [89056] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. defaultOptions.js

2011-05-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89056

Revision: 89056
Author:   janpaul123
Date: 2011-05-28 18:44:27 + (Sat, 28 May 2011)
Log Message:
---
Small followup to r89055

Modified Paths:
--

trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js

Modified: 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js
===
--- 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js   
2011-05-28 18:42:11 UTC (rev 89055)
+++ 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js   
2011-05-28 18:44:27 UTC (rev 89056)
@@ -263,7 +263,7 @@
email: 'Hello $7!\n\nI just awarded you 
a barnstar.'
}
},
-   icon: mw.config.get( 'wgExtensionAssetsPath' ) + 
'/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-barnstar.png'
 // icon for left-side menu
+   icon: mw.config.get( 'wgExtensionAssetsPath' ) + 
'/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-barnstar.png' // 
icon for left-side menu
},
'beer': {
name: 'Beer',
@@ -275,7 +275,7 @@
width: 145,
number: 3
},
-   icon: mw.config.get( 'wgExtensionAssetsPath' ) + 
'/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-beer.png' 
// icon for left-side menu
+   icon: mw.config.get( 'wgExtensionAssetsPath' ) + 
'/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-beer.png' // icon 
for left-side menu
},
'kitten': {
name: 'Kitten',
@@ -287,14 +287,14 @@
width: 145,
number: 3
},
-   icon: mw.config.get( 'wgExtensionAssetsPath' ) + 
'/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-kitten.png'
 // icon for left-side menu
+   icon: mw.config.get( 'wgExtensionAssetsPath' ) + 
'/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-kitten.png' // icon 
for left-side menu
},
// default type, nice to leave this one in place when adding 
other types
'makeyourown': {
name: mw.msg( 'wikilove-type-makeyourown' ),
fields: [ 'header', 'title', 'image', 'notify' ],
imageSize: '150px',
-   icon: mw.config.get( 'wgExtensionAssetsPath' ) + 
'/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-create.png'
 // icon for left-side menu
+   icon: mw.config.get( 'wgExtensionAssetsPath' ) + 
'/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-create.png' // icon 
for left-side menu
}
}
 }; };


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [88963] trunk/extensions/WikiLove/modules/ext.wikiLove

2011-05-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88963

Revision: 88963
Author:   janpaul123
Date: 2011-05-27 10:38:58 + (Fri, 27 May 2011)
Log Message:
---
Added a default image that is used when no image is specified

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-27 09:42:25 UTC (rev 88962)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-27 10:38:58 UTC (rev 88963)
@@ -266,10 +266,14 @@
$( '#mw-wikilove-preview' ).hide();
$( '#mw-wikilove-dialog' ).find( '.mw-wikilove-error' 
).remove();

-   if( typeof $.wikiLove.currentTypeOrSubtype.gallery == 'object' 
) {
-   if ( $( '#mw-wikilove-image' ).val().length = 0 ) {
+   
+   if ( $( '#mw-wikilove-image' ).val().length = 0 ) {
+   if( typeof $.wikiLove.currentTypeOrSubtype.gallery == 
'object' ) {
$.wikiLove.showError( 'wikilove-err-image' ); 
return false;
}
+   else {
+   $( '#mw-wikilove-image' ).val( 
$.wikiLove.options.defaultImage );
+   }
}
if( $( '#mw-wikilove-header' ).val().length = 0 ) {
$.wikiLove.showError( 'wikilove-err-header' ); return 
false;

Modified: 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js
===
--- 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js   
2011-05-27 09:42:25 UTC (rev 88962)
+++ 
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js   
2011-05-27 10:38:58 UTC (rev 88963)
@@ -1,7 +1,7 @@
 ( function( $ ) {
 $.wikiLove.optionsHook = function() { return {
defaultText: '{| style=background-color: $5; border: 1px solid $6;\n\
-|rowspan=2 style=vertical-align: middle; padding: 5px; | [[Image:$3|$4]]\n\
+|rowspan=2 style=vertical-align: middle; padding: 5px; | [[File:$3|$4]]\n\
 |style=font-size: x-large; padding: 3px; height: 1.5em; | \'\'\'$2\'\'\'\n\
 |-\n\
 |style=vertical-align: middle; padding: 3px; | $1 \n\
@@ -9,6 +9,7 @@
defaultBackgroundColor: '#fdffe7',
defaultBorderColor: '#fceb92',
defaultImageSize: '100px',
+   defaultImage: 'Emblem-fun.svg',

types: {
// example type, could be removed later (also no i18n)


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [88965] trunk/extensions/WikiLove/modules/ext.wikiLove

2011-05-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88965

Revision: 88965
Author:   janpaul123
Date: 2011-05-27 11:15:06 + (Fri, 27 May 2011)
Log Message:
---
Removed the old gallery function and moved some functionality to the current 
gallery function. It's now possible to show a random selection of images.

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-27 10:41:59 UTC (rev 88964)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-27 11:15:06 UTC (rev 88965)
@@ -440,60 +440,80 @@
$.wikiLove.gallery = {};
$( '#mw-wikilove-gallery-spinner' ).fadeIn( 200 );

-   $.each( $.wikiLove.currentTypeOrSubtype.gallery.imageList, 
function(index, value) {
+   if( typeof $.wikiLove.currentTypeOrSubtype.gallery.number == 
'undefined'
+   || $.wikiLove.currentTypeOrSubtype.gallery.number = 0
+   ) {
+   $.wikiLove.currentTypeOrSubtype.gallery.number = 
$.wikiLove.currentTypeOrSubtype.gallery.imageList.length;
+   }

-   $.ajax({
-   url: mw.config.get( 'wgServer' ) + 
mw.config.get( 'wgScriptPath' ) + '/api.php',
-   data: {
-   'action'  : 'query',
-   'format'  : 'json',
-   'prop': 'imageinfo',
-   'iiprop'  : 'mime|url',
-   'titles'  : value,
-   'iiurlwidth'  : 
$.wikiLove.currentTypeOrSubtype.gallery.width
-   },
-   dataType: 'json',
-   type: 'POST',
-   success: function( data ) {
-   $( '#mw-wikilove-gallery-spinner' 
).fadeOut( 200 );
-   
-   if ( !data || !data.query || 
!data.query.pages ) {
-   return;
+   var titles = '';
+   var imageList = 
$.wikiLove.currentTypeOrSubtype.gallery.imageList;
+   for( var i=0; i$.wikiLove.currentTypeOrSubtype.gallery.number; 
i++ ) {
+   // get a randomimage
+   var id = Math.floor( Math.random() * imageList.length );
+   titles = titles + 'File:' + imageList[id] + '|';
+   
+   // remove the random page from the keys array
+   imageList.splice(id, 1);
+   }
+   
+   var index = 0;
+   $.ajax({
+   url: mw.config.get( 'wgServer' ) + mw.config.get( 
'wgScriptPath' ) + '/api.php',
+   data: {
+   'action'  : 'query',
+   'format'  : 'json',
+   'prop': 'imageinfo',
+   'iiprop'  : 'mime|url',
+   'titles'  : titles,
+   'iiurlwidth'  : 
$.wikiLove.currentTypeOrSubtype.gallery.width
+   },
+   dataType: 'json',
+   type: 'POST',
+   success: function( data ) {
+   $( '#mw-wikilove-gallery-spinner' ).fadeOut( 
200 );
+   
+   if ( !data || !data.query || !data.query.pages 
) {
+   return;
+   }
+   $.each( data.query.pages, function( id, page ) {
+   if ( page.imageinfo  
page.imageinfo.length ) {
+   // build an image tag with the 
correct url and width
+   $img = $( 'img/' )
+   .attr( 'src', 
page.imageinfo[0].thumburl )
+   .attr( 'width', 
$.wikiLove.currentTypeOrSubtype.gallery.width )
+   .hide()
+   .load( function() { $( 
this ).css( 'display', 'inline-block' ); } );
+   $( 
'#mw-wikilove

[MediaWiki-CVS] SVN: [88966] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. core.js

2011-05-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88966

Revision: 88966
Author:   janpaul123
Date: 2011-05-27 11:20:15 + (Fri, 27 May 2011)
Log Message:
---
Removed error for not entering a message and added rationale

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-27 11:15:06 UTC (rev 88965)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-27 11:20:15 UTC (rev 88966)
@@ -278,9 +278,16 @@
if( $( '#mw-wikilove-header' ).val().length = 0 ) {
$.wikiLove.showError( 'wikilove-err-header' ); return 
false;
}
+   
+   /*
+   Let's not show an error for not entering a message, making it 
always optional.
+   This is preferred over removing the field from the interface, 
so that users are
+   stimulated to enter a message, but are not required to do so if 
they want to leave
+   a quick gesture of appreciation.
if( $( '#mw-wikilove-message' ).val().length = 0 ) {
$.wikiLove.showError( 'wikilove-err-msg' ); return 
false;
}
+   */

// If there isn't a signature already in the message, throw an 
error
if ( $( '#mw-wikilove-message' ).val().indexOf( '~~~' ) = 0 ) {


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [88968] trunk/extensions/WikiLove

2011-05-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88968

Revision: 88968
Author:   janpaul123
Date: 2011-05-27 11:57:37 + (Fri, 27 May 2011)
Log Message:
---
Fixed logging:
* E-mail notifications are logged correctly now
* Errors are displayed correctly
* Raw message and not the final wikitext are logged. This is because the final 
wikitext is not interesting, the actual message that was typed is much more 
useful as we can do data mining on that.

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.api.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js

Modified: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  2011-05-27 11:43:33 UTC (rev 
88967)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-05-27 11:57:37 UTC (rev 
88968)
@@ -16,7 +16,7 @@
}

if ( $wgWikiLoveLogging ) {
-   $this-saveInDb( $talk, $params['subject'], 
$params['text'], $params['type'], isset( $params['email'] ) ? 1 : 0 );
+   $this-saveInDb( $talk, $params['subject'], 
$params['message'], $params['type'], isset( $params['email'] ) ? 1 : 0 );
}

$api = new ApiMain( new FauxRequest( array(
@@ -30,7 +30,7 @@
), false, array( 'wsEditToken' = $wgRequest-getSessionData( 
'wsEditToken' ) ) ), true );

if ( isset( $params['email'] ) ) {
-   $this-emailUser( $talk, $params['subject'], 
$params['email'] );
+   $this-emailUser( $talk, $params['subject'], 
$params['email'], $params['token'] );
}
 
$api-execute();
@@ -46,11 +46,12 @@
/**
 * @param $talk Title
 * @param $subject
-* @param $text
+* @param $message
 * @param $type
+* @param $email
 * @return void
 */
-   private function saveInDb( $talk, $subject, $text, $type, $email ) {
+   private function saveInDb( $talk, $subject, $message, $type, $email ) {
global $wgUser;
$dbw = wfGetDB( DB_MASTER );
$values = array(
@@ -59,7 +60,7 @@
'wll_receiver' = User::newFromName( 
$talk-getSubjectPage()-getBaseText() )-getId(),
'wll_type' = $type,
'wll_subject' = $subject,
-   'wll_message' = $text,
+   'wll_message' = $message,
'wll_email' = $email,
);
try{
@@ -69,12 +70,14 @@
}
}

-   private function emailUser( $talk, $subject, $text ) {
+   private function emailUser( $talk, $subject, $text, $token ) {
+   global $wgRequest;
$api = new ApiMain( new FauxRequest( array(
'action' = 'emailuser',
'target'  =  User::newFromName( 
$talk-getSubjectPage()-getBaseText() )-getName(),
'subject' = $subject,
'text'  = $text,
+   'token' = $token,
), false, array( 'wsEditToken' = $wgRequest-getSessionData( 
'wsEditToken' ) ) ), true );
try{
$api-execute();
@@ -93,6 +96,10 @@
ApiBase::PARAM_TYPE = 'string',
ApiBase::PARAM_REQUIRED = true,
),
+   'message' = array(
+   ApiBase::PARAM_TYPE = 'string',
+   ApiBase::PARAM_REQUIRED = true,
+   ),
'token' = array(
ApiBase::PARAM_TYPE = 'string',
ApiBase::PARAM_REQUIRED = true,
@@ -114,6 +121,7 @@
return array(
'title' = 'Title of the user or user talk page to send 
WikiLove to',
'text' = 'Raw wikitext to add in the new section',
+   'message' = 'Actual message the user has entered, for 
logging purposes',
'token' = 'Edit token. You can get one of these 
through prop=info',
'subject' = 'Subject header of the new section',
'type' = array( 'Type of WikiLove (for statistics); 
this corresponds with a type',

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-27 11:43:33 UTC (rev 88967)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove

[MediaWiki-CVS] SVN: [88781] trunk/extensions/WikiLove

2011-05-25 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88781

Revision: 88781
Author:   janpaul123
Date: 2011-05-25 11:03:06 + (Wed, 25 May 2011)
Log Message:
---
Fixed spinner image per 
http://www.mediawiki.org/wiki/User:Krinkle/Extension_review/WikiLove

Modified Paths:
--
trunk/extensions/WikiLove/wikiLove.css
trunk/extensions/WikiLove/wikiLove.js

Modified: trunk/extensions/WikiLove/wikiLove.css
===
--- trunk/extensions/WikiLove/wikiLove.css  2011-05-25 10:11:06 UTC (rev 
88780)
+++ trunk/extensions/WikiLove/wikiLove.css  2011-05-25 11:03:06 UTC (rev 
88781)
@@ -259,6 +259,13 @@
float: right;
margin-top: 0.9em;
display: none;
+   
+   /* @embed */
+   background-image: url(images/spinner.gif);
+   background-position: 0px 0px;
+   background-repeat: repeat-x;
+   width: 16px;
+   height: 16px;
 }
 
 /* add details gallery */

Modified: trunk/extensions/WikiLove/wikiLove.js
===
--- trunk/extensions/WikiLove/wikiLove.js   2011-05-25 10:11:06 UTC (rev 
88780)
+++ trunk/extensions/WikiLove/wikiLove.js   2011-05-25 11:03:06 UTC (rev 
88781)
@@ -29,9 +29,6 @@
// Test to see if the 'E-mail this user' link exists
$.wikiLove.emailable = $( '#t-emailuser' ).length ? 
true : false;

-   // Reusable spinner string
-   var spinner = 'img class=wlSpinner src=' + 
mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + 
'/extensions/WikiLove/images/spinner.gif' + '/';
-   
// Build a type list like this:
var $typeList = $( 'ul id=wlTypes/ul' );
for( var typeId in $.wikiLove.types ) {
@@ -78,7 +75,7 @@
select id=wlSubtype/select\
div id=wlSubtypeDescription/div\
label id=wlGalleryLabelhtml:msg 
key=wikilove-image//label\
-   div id=wlGallerySpinner' + spinner + '/div\
+   div id=wlGallerySpinner class=wlSpinner/div\
div id=wlGallery/div\
label for=wlHeader id=wlHeaderLabelhtml:msg 
key=wikilove-header//label\
input type=text class=text id=wlHeader/\
@@ -94,7 +91,7 @@
label for=wlNotifyCheckboxhtml:msg 
key=wikilove-notify//label\
/div\
button class=submit id=wlButtonPreview 
type=submit/button\
-   ' + spinner + '\
+   div id=wlPreviewSpinner class=wlSpinner/div\
/form\
 /div\
 div id=wlPreview\
@@ -103,7 +100,7 @@
div id=wlPreviewArea/div\
form id=wlSendForm\
button class=submit id=wlButtonSend 
type=submit/button\
-   ' + spinner + '\
+   div id=wlSendSpinner class=wlSpinner/div\
/form\
 /div\
 /div' );
@@ -248,20 +245,17 @@
if( $.wikiLove.currentTypeOrSubtype.gallery.imageList 
instanceof Array) {
$( '#wlGalleryLabel' ).show();
$( '#wlGallery' ).show();
-   $( '#wlGallerySpinner' ).show();
$.wikiLove.showGallery(); // build gallery from 
array of images
} else {
// gallery is a category
$( '#wlGalleryLabel' ).show();
$( '#wlGallery' ).show();
-   $( '#wlGallerySpinner' ).show();
$.wikiLove.makeGallery(); // build gallery from 
category
}
}
else {
$( '#wlGalleryLabel' ).hide();
$( '#wlGallery' ).hide();
-   $( '#wlGallerySpinner' ).hide();
}

if( $.inArray( 'notify', $.wikiLove.currentTypeOrSubtype.fields 
) = 0  $.wikiLove.emailable ) {
@@ -355,7 +349,7 @@
 * Fires AJAX request for previewing wikitext.
 */
doPreview: function( wikitext ) {
-   $( '#wlAddDetails .wlSpinner' ).fadeIn( 200 );
+   $( '#wlPreviewSpinner' ).fadeIn( 200 );
$.ajax({
url: mw.config.get( 'wgServer' ) + mw.config.get( 
'wgScriptPath' ) + '/api.php?',
data: {
@@ -369,7 +363,7 @@
type: 'POST',
success: function( data ) {
$.wikiLove.showPreview( data.parse.text['*'] );
-   $( '#wlAddDetails .wlSpinner' ).fadeOut( 200 );
+   $( '#wlPreviewSpinner' ).fadeOut( 200

[MediaWiki-CVS] SVN: [88782] trunk/extensions/WikiLove/wikiLove.js

2011-05-25 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88782

Revision: 88782
Author:   janpaul123
Date: 2011-05-25 11:05:53 + (Wed, 25 May 2011)
Log Message:
---
Removed some return false; statements per 
http://www.mediawiki.org/wiki/User:Krinkle/Extension_review/WikiLove

Modified Paths:
--
trunk/extensions/WikiLove/wikiLove.js

Modified: trunk/extensions/WikiLove/wikiLove.js
===
--- trunk/extensions/WikiLove/wikiLove.js   2011-05-25 11:03:06 UTC (rev 
88781)
+++ trunk/extensions/WikiLove/wikiLove.js   2011-05-25 11:05:53 UTC (rev 
88782)
@@ -178,7 +178,6 @@
$( '#wlPreview' ).hide();
$.wikiLove.previewData = null;
}
-   return false;
},

/*
@@ -309,7 +308,6 @@
if ( $( '#wlNotifyCheckbox:checked' ).val()  
$.wikiLove.emailable ) {
$.wikiLove.previewData.mail = $.wikiLove.prepareMsg( 
$.wikiLove.currentTypeOrSubtype.mail );
}
-   return false;
},

showError: function( errmsg ) {
@@ -385,7 +383,6 @@
e.preventDefault();
$.wikiLove.doSend( $.wikiLove.previewData.header, 
$.wikiLove.previewData.msg,
$.wikiLove.previewData.type, 
$.wikiLove.previewData.notify );
-   return false;
},

/*
@@ -482,7 +479,6 @@

$( '#wlGallery a' ).removeClass( 'selected' );

$( this ).addClass( 'selected' );

$( '#wlImage' ).val( $.wikiLove.gallery[$( this ).attr( 'id' )] );
-   
return false;
}) 
);

$.wikiLove.gallery['wlGalleryImg' + index] = page.title;
@@ -562,7 +558,6 @@

$( '#wlGallery a' ).removeClass( 'selected' );

$( this ).addClass( 'selected' );

$( '#wlImage' ).val( $.wikiLove.gallery[$( this ).attr( 'id' )] );
-   
return false;

})
);

@@ -590,7 +585,6 @@
$( '#ca-wikilove a' ).click( function( e ) {
$.wikiLove.openDialog();
e.preventDefault();
-   return false;
});
}
 };


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [88783] trunk/extensions/WikiLove

2011-05-25 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88783

Revision: 88783
Author:   janpaul123
Date: 2011-05-25 11:32:40 + (Wed, 25 May 2011)
Log Message:
---
Fixed naming convention per 
http://www.mediawiki.org/wiki/User:Krinkle/Extension_review/WikiLove

Modified Paths:
--
trunk/extensions/WikiLove/wikiLove.css
trunk/extensions/WikiLove/wikiLove.js

Modified: trunk/extensions/WikiLove/wikiLove.css
===
--- trunk/extensions/WikiLove/wikiLove.css  2011-05-25 11:05:53 UTC (rev 
88782)
+++ trunk/extensions/WikiLove/wikiLove.css  2011-05-25 11:32:40 UTC (rev 
88783)
@@ -42,24 +42,24 @@
 }
 
 /* dialog */
-#wikiLoveDialog {
+#mw-wikilove-dialog {
margin: 10px;
 }
 
 /* dialog type selection */
-#wikiLoveDialog #wlSelectType {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type {
float: left;
width: 250px;
 }
 
-#wikiLoveDialog #wlSelectType ul {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type ul {
list-style: none;
margin: 0;
padding: 0;
 }
 
-#wikiLoveDialog #wlSelectType ul li,
-#wikiLoveDialog #wlSelectType a
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type ul li,
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a
 {
display: block;
width: 250px;
@@ -71,19 +71,19 @@
outline: none;
 }
 
-#wikiLoveDialog #wlSelectType a:hover,
-#wikiLoveDialog #wlSelectType a:focus {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a:hover,
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a:focus {
text-decoration:none;
 }
 
 /* IGNORED BY IE6 */
-#wikiLoveDialog #wlSelectType ul  li,
-#wikiLoveDialog #wlSelectType ul li  a {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type ul  li,
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type ul li  a {
display: inline-block;
 }
 
-#wikiLoveDialog #wlSelectType a .wlLeftCap,
-#wikiLoveDialog #wlSelectType a .wlRightCap {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a .mw-wikilove-left-cap,
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a .mw-wikilove-right-cap {
padding: 0;
margin: 0;
width: 6px;
@@ -92,45 +92,45 @@
top: 0px;
 }
 
-#wikiLoveDialog #wlSelectType a .wlLeftCap,
-#wikiLoveDialog #wlSelectType a .wlRightCap,
-#wikiLoveDialog #wlSelectType a .wlIconBox {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a .mw-wikilove-left-cap,
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a .mw-wikilove-right-cap,
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a .mw-wikilove-icon-box {
/* @embed */
background-image: url(images/select-sprite.png);
background-repeat: no-repeat;
 }
 
-#wikiLoveDialog #wlSelectType a .wlLeftCap {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a .mw-wikilove-left-cap {
/* @noflip */
left: 0px;
background-position: 0px 0px;
 }
 
-#wikiLoveDialog #wlSelectType a:hover .wlLeftCap,
-#wikiLoveDialog #wlSelectType a:focus .wlLeftCap {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a:hover .mw-wikilove-left-cap,
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a:focus .mw-wikilove-left-cap 
{
background-position: -6px 0px;
 }
 
-#wikiLoveDialog #wlSelectType a.selected .wlLeftCap {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a.selected 
.mw-wikilove-left-cap {
background-position: -12px 0px;
 }
 
-#wikiLoveDialog #wlSelectType a .wlRightCap {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a .mw-wikilove-right-cap {
/* @noflip */
right: 0px;
background-position: -18px 0px;
 }
 
-#wikiLoveDialog #wlSelectType a:hover .wlRightCap,
-#wikiLoveDialog #wlSelectType a:focus .wlRightCap {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a:hover 
.mw-wikilove-right-cap,
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a:focus 
.mw-wikilove-right-cap {
background-position: -25px 0px;
 }
 
-#wikiLoveDialog #wlSelectType a.selected .wlRightCap {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a.selected 
.mw-wikilove-right-cap {
background-position: -32px 0px;
 }
 
-#wikiLoveDialog #wlSelectType a .wlInside {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a .mw-wikilove-inside {
padding: 0;
margin: 0;
width: 238px;
@@ -145,16 +145,16 @@
background-repeat: repeat-x;
 }
 
-#wikiLoveDialog #wlSelectType a:hover .wlInside,
-#wikiLoveDialog #wlSelectType a:focus .wlInside {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a:hover .mw-wikilove-inside,
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a:focus .mw-wikilove-inside {
background-position: 0px -66px;
 }
 
-#wikiLoveDialog #wlSelectType a.selected .wlInside {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a.selected 
.mw-wikilove-inside {
background-position: 0px -132px;
 }
 
-#wikiLoveDialog #wlSelectType a .wlIconBox {
+/*#mw-wikilove-dialog*/ #mw-wikilove-select-type a .mw-wikilove-icon-box

[MediaWiki-CVS] SVN: [88784] trunk/extensions/WikiLove

2011-05-25 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88784

Revision: 88784
Author:   janpaul123
Date: 2011-05-25 11:40:48 + (Wed, 25 May 2011)
Log Message:
---
Fixed escaping and CSS clarification per 
http://www.mediawiki.org/wiki/User:Krinkle/Extension_review/WikiLove

Modified Paths:
--
trunk/extensions/WikiLove/wikiLove.css
trunk/extensions/WikiLove/wikiLove.js

Modified: trunk/extensions/WikiLove/wikiLove.css
===
--- trunk/extensions/WikiLove/wikiLove.css  2011-05-25 11:32:40 UTC (rev 
88783)
+++ trunk/extensions/WikiLove/wikiLove.css  2011-05-25 11:40:48 UTC (rev 
88784)
@@ -1,4 +1,4 @@
-/* include fix from r87101 here for older versions */
+/* include fix from r87101 here for older versions; these three blocks can 
become deprecated later */
 div.vectorTabs span {
display: inline-block;
/* @embed */

Modified: trunk/extensions/WikiLove/wikiLove.js
===
--- trunk/extensions/WikiLove/wikiLove.js   2011-05-25 11:32:40 UTC (rev 
88783)
+++ trunk/extensions/WikiLove/wikiLove.js   2011-05-25 11:40:48 UTC (rev 
88784)
@@ -428,8 +428,9 @@
window.location.reload();
}
else {
-   window.location = mw.config.get( 
'wgArticlePath' ).replace( '$1', data.redirect.pageName ) 
-   + '#' + data.redirect.fragment;
+   window.location = 
mw.util.wikiUrlencode( 
+   mw.config.get( 'wgArticlePath' 
).replace( '$1', data.redirect.pageName ) 
+   + '#' + data.redirect.fragment 
);
}
}
});


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [88786] trunk/extensions/WikiLove

2011-05-25 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88786

Revision: 88786
Author:   janpaul123
Date: 2011-05-25 12:10:07 + (Wed, 25 May 2011)
Log Message:
---
Icon CSS now loaded on top of the page per 
http://www.mediawiki.org/wiki/User:Krinkle/Extension_review/WikiLove

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.hooks.php
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css

Added Paths:
---
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.icon.css

Modified: trunk/extensions/WikiLove/WikiLove.hooks.php
===
--- trunk/extensions/WikiLove/WikiLove.hooks.php2011-05-25 11:59:53 UTC 
(rev 88785)
+++ trunk/extensions/WikiLove/WikiLove.hooks.php2011-05-25 12:10:07 UTC 
(rev 88786)
@@ -54,6 +54,7 @@

$title = self::getUserTalkPage( $skin-getTitle() );
if ( !is_null( $title ) ) {
+   $out-addModules( 'ext.wikiLove.icon' );
$out-addModules( 'ext.wikiLove' );
}
return true;

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-05-25 11:59:53 UTC (rev 
88785)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-05-25 12:10:07 UTC (rev 
88786)
@@ -70,11 +70,18 @@
 // api modules
 $wgAPIModules['wikilove'] = 'WikiLoveApi';
 
+$extWikiLoveTpl = array(
+   'localBasePath' = dirname( __FILE__ ) . '/modules/ext.wikiLove',
+   'remoteExtPath' = 'WikiLove/modules/ext.wikiLove',
+);
+
 // resources
 $wgResourceModules += array(
-   'ext.wikiLove' = array(
-   'localBasePath' = dirname( __FILE__ ) . 
'/modules/ext.wikiLove',
-   'remoteExtPath' = 'WikiLove/modules/ext.wikiLove',
+   'ext.wikiLove.icon' = $extWikiLoveTpl + array(
+   'styles' = 'ext.wikiLove.icon.css',
+   'position' = 'top',
+   ),
+   'ext.wikiLove' = $extWikiLoveTpl + array(
'scripts' = array(
'ext.wikiLove.core.js',
'ext.wikiLove.defaultOptions.js',

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css 
2011-05-25 11:59:53 UTC (rev 88785)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css 
2011-05-25 12:10:07 UTC (rev 88786)
@@ -1,46 +1,3 @@
-/* include fix from r87101 here for older versions; these three blocks can 
become deprecated later */
-div.vectorTabs span {
-   display: inline-block;
-   /* @embed */
-   background-image: url(images/tab-break.png);
-   background-position: bottom right;
-   background-repeat: no-repeat;
-}
-
-div.vectorTabs li a {
-   background-image: none;
-}
-
-#ca-unwatch.icon,
-#ca-watch.icon {
-   margin-right: 0px;
-}
-
-/* icon style */
-#ca-wikilove.icon a {
-   margin: 0;
-   padding: 0;
-   outline: none;
-   display: block;
-   width: 27px;
-   /* This hides the text but shows the background image */
-   padding-top: 3.1em;
-   margin-top: 0;
-   /* Only applied in IE6 */
-   margin-top: -0.8em !ie;
-   height: 0;
-   overflow: hidden;
-   /* @embed */
-   background-image: url(images/heart-icons.png);
-}
-#ca-wikilove.icon a {
-   background-position: 5px 60%;
-}
-#ca-wikilove.icon a:hover,
-#ca-wikilove.icon a:focus {
-   background-position: -19px 60%;
-}
-
 /* dialog */
 #mw-wikilove-dialog {
margin: 10px;

Added: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.icon.css
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.icon.css
(rev 0)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.icon.css
2011-05-25 12:10:07 UTC (rev 88786)
@@ -0,0 +1,42 @@
+/* include fix from r87101 here for older versions; these three blocks can 
become deprecated later */
+div.vectorTabs span {
+   display: inline-block;
+   /* @embed */
+   background-image: url(images/tab-break.png);
+   background-position: bottom right;
+   background-repeat: no-repeat;
+}
+
+div.vectorTabs li a {
+   background-image: none;
+}
+
+#ca-unwatch.icon,
+#ca-watch.icon {
+   margin-right: 0px;
+}
+
+/* icon style */
+#ca-wikilove.icon a {
+   margin: 0;
+   padding: 0;
+   outline: none;
+   display: block;
+   width: 27px;
+   /* This hides the text but shows the background image */
+   padding-top: 3.1em;
+   margin-top: 0;
+   /* Only applied in IE6 */
+   margin-top: -0.8em !ie

[MediaWiki-CVS] SVN: [88787] trunk/extensions/WikiLove

2011-05-25 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88787

Revision: 88787
Author:   janpaul123
Date: 2011-05-25 13:48:19 + (Wed, 25 May 2011)
Log Message:
---
Rewrite of module structure per comments by Krinkle

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.hooks.php
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js

trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js

Added Paths:
---
trunk/extensions/WikiLove/WikiLove.local.php
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.init.js

Modified: trunk/extensions/WikiLove/WikiLove.hooks.php
===
--- trunk/extensions/WikiLove/WikiLove.hooks.php2011-05-25 12:10:07 UTC 
(rev 88786)
+++ trunk/extensions/WikiLove/WikiLove.hooks.php2011-05-25 13:48:19 UTC 
(rev 88787)
@@ -55,7 +55,7 @@
$title = self::getUserTalkPage( $skin-getTitle() );
if ( !is_null( $title ) ) {
$out-addModules( 'ext.wikiLove.icon' );
-   $out-addModules( 'ext.wikiLove' );
+   $out-addModules( 'ext.wikiLove.init' );
}
return true;
}

Added: trunk/extensions/WikiLove/WikiLove.local.php
===
--- trunk/extensions/WikiLove/WikiLove.local.php
(rev 0)
+++ trunk/extensions/WikiLove/WikiLove.local.php2011-05-25 13:48:19 UTC 
(rev 88787)
@@ -0,0 +1,17 @@
+?php
+/*
+ * Custom ResourceLoader module that loads a custom WikiLove.js per-wiki.
+ */
+class WikiLoveLocal extends ResourceLoaderWikiModule {
+   protected function getPages( ResourceLoaderContext $context ) {
+   return array(
+   'MediaWiki:WikiLove.js'  = array( 'type' = 
'script' ),
+   );
+   }
+   
+   public function getDependencies() {
+   return array(
+   'ext.wikiLove.startup',
+   );
+   }
+}


Property changes on: trunk/extensions/WikiLove/WikiLove.local.php
___
Added: svn:eol-style
   + native

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-05-25 12:10:07 UTC (rev 
88786)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-05-25 13:48:19 UTC (rev 
88787)
@@ -56,6 +56,7 @@
 // add autoload classes
 $wgAutoloadClasses['WikiLoveApi'] = $dir . 'WikiLove.api.php';
 $wgAutoloadClasses['WikiLoveHooks']   = $dir . 
'WikiLove.hooks.php';
+$wgAutoloadClasses['WikiLoveLocal']   = $dir . 
'WikiLove.local.php';
 
 // i18n messages
 $wgExtensionMessagesFiles['WikiLove'] = $dir . 'WikiLove.i18n.php';
@@ -81,7 +82,7 @@
'styles' = 'ext.wikiLove.icon.css',
'position' = 'top',
),
-   'ext.wikiLove' = $extWikiLoveTpl + array(
+   'ext.wikiLove.startup' = $extWikiLoveTpl + array(
'scripts' = array(
'ext.wikiLove.core.js',
'ext.wikiLove.defaultOptions.js',
@@ -119,6 +120,20 @@
'jquery.localize',
),
),
+   'ext.wikiLove.local' = array(
+   'class' = 'WikiLoveLocal',
+   /* for information only, this is actually in the class!
+   'dependencies' = array(
+   'ext.wikiLove.startup',
+   ),
+   */
+   ),
+   'ext.wikiLove.init' = $extWikiLoveTpl + array(
+   'scripts' = 'ext.wikiLove.init.js',
+   'dependencies' = array(
+   'ext.wikiLove.local',
+   ),
+   ),
'jquery.elastic' = array(
'localBasePath' = dirname( __FILE__ ) . 
'/modules/jquery.elastic',
'remoteExtPath' = 'WikiLove/modules/jquery.elastic',

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-25 12:10:07 UTC (rev 88786)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js 
2011-05-25 13:48:19 UTC (rev 88787)
@@ -1,5 +1,7 @@
 ( function( $ ) { $.wikiLove = {
-
+   
+   options: {}, // options modifiable by the user
+   optionsHook: function() { return {}; }, // hook that can be overridden 
by the user to modify options
$dialog: null, // dialog jQuery object
currentTypeId: null, // id of the currently selected type (e.g. 
'barnstar' or 'makeyourown')
currentSubtypeId: null, // id of the currently selected

[MediaWiki-CVS] SVN: [88789] trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove. css

2011-05-25 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88789

Revision: 88789
Author:   janpaul123
Date: 2011-05-25 14:01:03 + (Wed, 25 May 2011)
Log Message:
---
Fixed some CSS

Modified Paths:
--
trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css

Modified: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css
===
--- trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css 
2011-05-25 14:01:03 UTC (rev 88788)
+++ trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.css 
2011-05-25 14:01:03 UTC (rev 88789)
@@ -201,6 +201,12 @@
width: 300px;
 }
 
+/*#mw-wikilove-dialog #mw-wikilove-add-details*/ 
#mw-wikilove-subtype-description {
+   margin: 5px 0px 8px 15px;
+   font-size: 1.0em;
+   line-height: 1.2em;
+}
+
 /*#mw-wikilove-dialog*/ #mw-wikilove-add-details .mw-wikilove-note {
font-weight: light;
font-size: 0.9em;
@@ -212,19 +218,6 @@
resize: none;
 }
 
-#mw-wikilove-dialog .mw-wikilove-spinner {
-   float: right;
-   margin-top: 0.9em;
-   display: none;
-   
-   /* @embed */
-   background-image: url(images/spinner.gif);
-   background-position: 0px 0px;
-   background-repeat: repeat-x;
-   width: 16px;
-   height: 16px;
-}
-
 /* add details gallery */
 /*#mw-wikilove-dialog*/ #mw-wikilove-gallery {
min-height: 40px;
@@ -280,12 +273,6 @@
display: block;
 }
 
-/*#mw-wikilove-dialog*/ #wlSubtypeDescription {
-   margin: 5px 0px 8px 15px;
-   font-size: 1.0em;
-   line-height: 1.2em;
-}
-
 #mw-wikilove-dialog input[type=checkbox] {
display:inline-box;
margin: 5px 0px 5px 0px;
@@ -299,6 +286,19 @@
float: right;
 }
 
+#mw-wikilove-dialog .mw-wikilove-spinner {
+   float: right;
+   margin-top: 0.9em;
+   display: none;
+   
+   /* @embed */
+   background-image: url(images/spinner.gif);
+   background-position: 0px 0px;
+   background-repeat: repeat-x;
+   width: 16px;
+   height: 16px;
+}
+
 #mw-wikilove-dialog .mw-wikilove-number {
color: white;
float: left;


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [88669] trunk/extensions/WikiLove/jquery.elastic.js

2011-05-23 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88669

Revision: 88669
Author:   janpaul123
Date: 2011-05-23 19:29:42 + (Mon, 23 May 2011)
Log Message:
---
Updated jquery.elastic.js as per 
https://secure.wikimedia.org/wikipedia/mediawiki/wiki/User:Catrope/Extension_review/WikiLove;
 also notified the author of the (minor) fixes

Modified Paths:
--
trunk/extensions/WikiLove/jquery.elastic.js

Modified: trunk/extensions/WikiLove/jquery.elastic.js
===
--- trunk/extensions/WikiLove/jquery.elastic.js 2011-05-23 19:08:26 UTC (rev 
88668)
+++ trunk/extensions/WikiLove/jquery.elastic.js 2011-05-23 19:29:42 UTC (rev 
88669)
@@ -1,6 +1,133 @@
-(function(jQuery){jQuery.fn.extend({elastic:function(){var 
mimics=['paddingTop','paddingRight','paddingBottom','paddingLeft','fontSize','lineHeight','fontFamily','width','fontWeight'];return
 this.each(function(){if(this.type!='textarea'){return false;}
-var $textarea=jQuery(this),$twin=jQuery('div 
/').css({'position':'absolute','display':'none','word-wrap':'break-word'}),lineHeight=parseInt($textarea.css('line-height'),10)||parseInt($textarea.css('font-size'),'10'),minheight=parseInt($textarea.css('height'),10)||lineHeight*3,maxheight=parseInt($textarea.css('max-height'),10)||Number.MAX_VALUE,goalheight=0,i=0;if(maxheight0){maxheight=Number.MAX_VALUE;}
-$twin.appendTo($textarea.parent());var 
i=mimics.length;while(i--){$twin.css(mimics[i].toString(),$textarea.css(mimics[i].toString()));}
-function 
setHeightAndOverflow(height,overflow){curratedHeight=Math.floor(parseInt(height,10));if($textarea.height()!=curratedHeight){$textarea.css({'height':curratedHeight+'px','overflow':overflow});}}
-function update(){var 
textareaContent=$textarea.val().replace(//g,'amp;').replace(/  
/g,'nbsp;').replace(/|/g,'gt;').replace(/\n/g,'br /');var 
twinContent=$twin.html();if(textareaContent+'nbsp;'!=twinContent){$twin.html(textareaContent+'nbsp;');if(Math.abs($twin.height()+lineHeight-$textarea.height())3){var
 
goalheight=$twin.height()+lineHeight;if(goalheight=maxheight){setHeightAndOverflow(maxheight,'auto');}else
 
if(goalheight=minheight){setHeightAndOverflow(minheight,'hidden');}else{setHeightAndOverflow(goalheight,'hidden');
-$textarea.css({'overflow':'hidden'});$textarea.keyup(function(){update();});$textarea.live('input
 paste',function(e){setTimeout(update,250);});update();});}});})(jQuery);
\ No newline at end of file
+/**
+*  @name   Elastic
+*  @descripton Elastic is 
jQuery plugin that grow and shrink your textareas automatically
+*  @version1.6.5
+*  @requires   jQuery 1.2.6+
+*
+*  @author Jan Jarfalk
+*  @author-email   
jan.jarf...@unwrongest.com
+*  @author-website 
http://www.unwrongest.com
+*
+*  @licenceMIT License - 
http://www.opensource.org/licenses/mit-license.php
+*
+*   This file has been downloaded from 
http://unwrongest.com/projects/elastic/, please notify the author of
+*   any changes.
+*/
+
+(function(jQuery){ 
+   jQuery.fn.extend({  
+   elastic: function() {
+   
+   //  We will create a div clone of the textarea
+   //  by copying these attributes from the textarea 
to the div.
+   var mimics = [
+   'paddingTop',
+   'paddingRight',
+   'paddingBottom',
+   'paddingLeft',
+   'fontSize',
+   'lineHeight',
+   'fontFamily',
+   'width',
+   'fontWeight'];
+   
+   return this.each( function() {
+   
+   // Elastic only works on textareas
+   if ( this.type != 'textarea' ) {
+   return false;
+   }
+   
+   var $textarea   = jQuery(this),
+   $twin   = jQuery('div 
/').css({'position': 'absolute','display':'none','word-wrap':'break-word'}),
+   lineHeight  = 
parseInt($textarea.css('line-height'),10) || 
parseInt($textarea.css('font-size'),'10'),
+   minheight   = 
parseInt($textarea.css('height'),10) || lineHeight*3,
+   maxheight   = 
parseInt($textarea.css('max

[MediaWiki-CVS] SVN: [88699] trunk/extensions/WikiLove

2011-05-23 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88699

Revision: 88699
Author:   janpaul123
Date: 2011-05-23 22:45:23 + (Mon, 23 May 2011)
Log Message:
---
All kinds of fixes per 
https://secure.wikimedia.org/wikipedia/mediawiki/wiki/User:Catrope/Extension_review/WikiLove
 and myself

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.api.php
trunk/extensions/WikiLove/WikiLove.i18n.php
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/defaultTypes.js
trunk/extensions/WikiLove/patches/WikiLoveLog.sql
trunk/extensions/WikiLove/wikiLove.js

Modified: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  2011-05-23 22:44:35 UTC (rev 
88698)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-05-23 22:45:23 UTC (rev 
88699)
@@ -7,16 +7,16 @@

$title = Title::newFromText( $params['title'] );
if ( is_null( $title ) ) {
-   $this-dieUsageMsg( array( 'invalidtitle', 
$params['title'] ) );
+   $this-dieUsageMsg( array( 'invaliduser', 
$params['title'] ) );
}

$talk = WikiLoveHooks::getUserTalkPage( $title );
if ( is_null( $talk ) ) {
-   $this-dieUsageMsg( array( 'invalidtitle', 
$params['title'] ) );
+   $this-dieUsageMsg( array( 'invaliduser', 
$params['title'] ) );
}

if ( $wgWikiLoveLogging ) {
-   $this-saveInDb( $talk, $params['subject'], 
$params['text'], $params['type'], $params['template'] );
+   $this-saveInDb( $talk, $params['subject'], 
$params['text'], $params['type'], isset( $params['email'] ) ? 1 : 0 );
}

$api = new ApiMain( new FauxRequest( array(
@@ -28,15 +28,19 @@
'summary' = $params['subject'],
'notminor' = true,
), false, array( 'wsEditToken' = $wgRequest-getSessionData( 
'wsEditToken' ) ) ), true );
+   
+   if ( isset( $params['email'] ) ) {
+   $this-emailUser( $talk, $params['subject'], 
$params['email'] );
+   }
 
$api-execute();

$result = $api-getResult();
$data = $result-getData();

-   $talk-setFragment( '#' . $params['subject'] );
$this-getResult()-addValue( 'redirect', 'pageName', 
$talk-getPrefixedDBkey() );
-   $this-getResult()-addValue( 'redirect', 'fragment', 
$talk-getFragmentForURL() );
+   $this-getResult()-addValue( 'redirect', 'fragment', 
Title::escapeFragmentForURL( $params['subject'] ) );
+   // note that we cannot use Title::makeTitle here as it doesn't 
sanitize the fragment
}
 
/**
@@ -46,25 +50,38 @@
 * @param $type
 * @return void
 */
-   private function saveInDb( $talk, $subject, $text, $type, $template ) {
+   private function saveInDb( $talk, $subject, $text, $type, $email ) {
global $wgUser;
$dbw = wfGetDB( DB_MASTER );
$values = array(
-   'wl_timestamp' = $dbw-timestamp(),
-   'wl_sender_id' = $wgUser-getId(),
-   'wl_receiver_id' = User::newFromName( 
$talk-getSubjectPage()-getBaseText() )-getId(),
-   'wl_type' = $type,
-   'wl_subject' = $subject,
-   'wl_message' = $text,
-   'wl_email' = 0,
+   'wll_timestamp' = $dbw-timestamp(),
+   'wll_sender' = $wgUser-getId(),
+   'wll_receiver' = User::newFromName( 
$talk-getSubjectPage()-getBaseText() )-getId(),
+   'wll_type' = $type,
+   'wll_subject' = $subject,
+   'wll_message' = $text,
+   'wll_email' = $email,
);
try{
$dbw-insert( 'wikilove_log', $values, __METHOD__ );
} catch( DBQueryError $dbqe ) {
-   $this-dieUsage( 'Warning: action was not logged!', 
'nologging' );
-   return false;
+   $this-setWarning( 'Action was not logged' );
}
}
+   
+   private function emailUser( $talk, $subject, $text ) {
+   $api = new ApiMain( new FauxRequest( array(
+   'action' = 'emailuser',
+   'target'  =  User::newFromName( 
$talk-getSubjectPage()-getBaseText() )-getName(),
+   'subject' = $subject,
+   'text'  = $text

[MediaWiki-CVS] SVN: [88701] trunk/extensions/WikiLove/wikiLove.js

2011-05-23 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88701

Revision: 88701
Author:   janpaul123
Date: 2011-05-23 22:50:19 + (Mon, 23 May 2011)
Log Message:
---
Quick followup to r88699, forgot to remove var mw; at the top which I added for 
JSHint testing

Modified Paths:
--
trunk/extensions/WikiLove/wikiLove.js

Modified: trunk/extensions/WikiLove/wikiLove.js
===
--- trunk/extensions/WikiLove/wikiLove.js   2011-05-23 22:46:58 UTC (rev 
88700)
+++ trunk/extensions/WikiLove/wikiLove.js   2011-05-23 22:50:19 UTC (rev 
88701)
@@ -1,4 +1,3 @@
-var mw;
 ( function( $ ) { $.wikiLove = {
 
$dialog: null, // dialog jQuery object


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [88703] trunk/extensions/WikiLove/wikiLove.js

2011-05-23 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88703

Revision: 88703
Author:   janpaul123
Date: 2011-05-23 23:08:48 + (Mon, 23 May 2011)
Log Message:
---
Followup to r88699, fix by Krinkle

Modified Paths:
--
trunk/extensions/WikiLove/wikiLove.js

Modified: trunk/extensions/WikiLove/wikiLove.js
===
--- trunk/extensions/WikiLove/wikiLove.js   2011-05-23 22:58:55 UTC (rev 
88702)
+++ trunk/extensions/WikiLove/wikiLove.js   2011-05-23 23:08:48 UTC (rev 
88703)
@@ -303,7 +303,7 @@
'header': $( '#wlHeader' ).val(),
'msg': msg,
'type': $.wikiLove.currentTypeId
-   + ($.wikiLove.currentSubtypeId !== null ? '-' + 
$.wikiLove.currentSubtypeId : ''),
+   + ($.wikiLove.currentSubtypeId !== null ? '-' + 
$.wikiLove.currentSubtypeId : '')
};

if ( $( '#wlNotifyCheckbox:checked' ).val()  
$.wikiLove.emailable ) {


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [88309] trunk/extensions/WikiLove/images/alert.png

2011-05-17 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88309

Revision: 88309
Author:   janpaul123
Date: 2011-05-17 14:54:11 + (Tue, 17 May 2011)
Log Message:
---
Added forgotten alert img

Added Paths:
---
trunk/extensions/WikiLove/images/alert.png

Added: trunk/extensions/WikiLove/images/alert.png
===
(Binary files differ)


Property changes on: trunk/extensions/WikiLove/images/alert.png
___
Added: svn:mime-type
   + image/png


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [88140] trunk/extensions/WikiLove

2011-05-15 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88140

Revision: 88140
Author:   janpaul123
Date: 2011-05-15 10:16:07 + (Sun, 15 May 2011)
Log Message:
---
* Basic gallery functionality
* Basic error messages

This still needs major cleanup but I wanted to commit this huge thing first.

Modified Paths:
--
trunk/extensions/WikiLove/README
trunk/extensions/WikiLove/WikiLove.i18n.php
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/wikiLove.css
trunk/extensions/WikiLove/wikiLove.js

Modified: trunk/extensions/WikiLove/README
===
--- trunk/extensions/WikiLove/README2011-05-15 09:54:31 UTC (rev 88139)
+++ trunk/extensions/WikiLove/README2011-05-15 10:16:07 UTC (rev 88140)
@@ -1,5 +1,5 @@
-WikiLove is an extension designed to promote the spread of WikiLove within
-Wikipedia.
+WikiLove is an extension designed to promote the spread of WikiLove,
+message of positive reinforcement that users can send to each other.
 
 See documentation at the MediaWiki wiki:
   http://www.mediawiki.org/wiki/Extension:WikiLove

Modified: trunk/extensions/WikiLove/WikiLove.i18n.php
===
--- trunk/extensions/WikiLove/WikiLove.i18n.php 2011-05-15 09:54:31 UTC (rev 
88139)
+++ trunk/extensions/WikiLove/WikiLove.i18n.php 2011-05-15 10:16:07 UTC (rev 
88140)
@@ -24,6 +24,7 @@
'wikilove-get-started-list-2' = 'Add details to your WikiLove',
'wikilove-get-started-list-3' = 'Send your WikiLove!',
'wikilove-add-details' = 'Add details',
+   'wikilove-gallery' = 'Picture:',
'wikilove-title' = 'Title:',
'wikilove-enter-message' = 'Enter a message:',
'wikilove-omit-sig' = '(without a signature)',
@@ -31,5 +32,9 @@
'wikilove-preview' = 'Preview',
'wikilove-button-send' = 'Send WikiLove',
'wikilove-type-makeyourown' = 'Make your own',
+   'wikilove-err-title' = 'Please enter a title.',
+   'wikilove-err-msg' = 'Please enter a message.',
+   'wikilove-err-image' = 'Please select an image.',
+   'wikilove-err-sig' = 'Please do not include a signature in the 
message.',
 );
 

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-05-15 09:54:31 UTC (rev 
88139)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-05-15 10:16:07 UTC (rev 
88140)
@@ -88,6 +88,7 @@
'wikilove-get-started-list-2',
'wikilove-get-started-list-3',
'wikilove-add-details',
+   'wikilove-gallery',
'wikilove-title',
'wikilove-enter-message',
'wikilove-omit-sig',
@@ -95,6 +96,10 @@
'wikilove-preview',
'wikilove-button-send',
'wikilove-type-makeyourown',
+   'wikilove-err-title',
+   'wikilove-err-msg',
+   'wikilove-err-image',
+   'wikilove-err-sig',
),
'dependencies' = array(
'jquery.ui.dialog',

Modified: trunk/extensions/WikiLove/wikiLove.css
===
--- trunk/extensions/WikiLove/wikiLove.css  2011-05-15 09:54:31 UTC (rev 
88139)
+++ trunk/extensions/WikiLove/wikiLove.css  2011-05-15 10:16:07 UTC (rev 
88140)
@@ -254,23 +254,45 @@
resize: none;
 }
 
+#wikiLoveDialog #wlAddDetails #wlNotify {
+   float: left;
+}
+
 #wikiLoveDialog .wlSpinner {
float: right;
margin-top: 6px;
display: none;
 }
 
+/* add details gallery */
+#wikiLoveDialog #wlGallery img {
+   margin-right: 5px;
+   margin-bottom: 5px;
+   padding: 5px;
+}
+
+#wikiLoveDialog #wlGallery a:hover img,
+#wikiLoveDialog #wlGallery a:focus img {
+   background-color: #aacfe9;
+}
+
+#wikiLoveDialog #wlGallery a.selected img {
+   background-color: #f56427;
+}
+
 /* dialog preview */
 #wikiLoveDialog #wlPreview {
float: right;
width: 480px;
 }
 
-#wikiLoveDialog #wlPreview div {
+#wikiLoveDialog #wlPreview #wlPreviewArea {
margin-left: 15px;
+   width: 465px;
+   overflow: auto;
 }
 
-#wikiLoveDialog #wlPreview .editsection {
+#wikiLoveDialog #wlPreview #wlPreviewArea .editsection {
display: none;
 }
 

Modified: trunk/extensions/WikiLove/wikiLove.js
===
--- trunk/extensions/WikiLove/wikiLove.js   2011-05-15 09:54:31 UTC (rev 
88139)
+++ trunk/extensions/WikiLove/wikiLove.js   2011-05-15 10:16:07 UTC (rev 
88140)
@@ -10,14 +10,14 @@
'original

[MediaWiki-CVS] SVN: [88180] trunk/extensions/WikiLove

2011-05-15 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88180

Revision: 88180
Author:   janpaul123
Date: 2011-05-15 14:11:40 + (Sun, 15 May 2011)
Log Message:
---
Some more refactoring

Modified Paths:
--
trunk/extensions/WikiLove/wikiLove.css
trunk/extensions/WikiLove/wikiLove.js

Modified: trunk/extensions/WikiLove/wikiLove.css
===
--- trunk/extensions/WikiLove/wikiLove.css  2011-05-15 13:56:12 UTC (rev 
88179)
+++ trunk/extensions/WikiLove/wikiLove.css  2011-05-15 14:11:40 UTC (rev 
88180)
@@ -231,6 +231,7 @@
 #wikiLoveDialog #wlAddDetails {
float: right;
width: 480px;
+   margin-bottom: 5px;
 }
 
 #wikiLoveDialog #wlAddDetails label {
@@ -346,5 +347,13 @@
 }
 
 #wikiLoveDialog .wlError {
+   /* @embed */
+   background-image: url(images/alert.png);
+   background-position: center left;
+   background-repeat: no-repeat;
color: red;
+   font-weight: bold;
+   line-height: 32px;
+   padding-left: 34px;
+   padding-bottom: 3px;
 }

Modified: trunk/extensions/WikiLove/wikiLove.js
===
--- trunk/extensions/WikiLove/wikiLove.js   2011-05-15 13:56:12 UTC (rev 
88179)
+++ trunk/extensions/WikiLove/wikiLove.js   2011-05-15 14:11:40 UTC (rev 
88180)
@@ -29,11 +29,11 @@
'cat': {
descr: 'Cat',
title: null,
-   text: [[$3|left|150px]]\n$1\n\n, // $3 is the 
image filename
+   text: '[[$3|left|150px]]\n$1\n\n\nbr style=clear: 
both/', // $3 is the image filename
template: '',
gallery: {
// right now we can only query the local wiki 
(not e.g. commons)
-   category: 'Category:Tropical',
+   category: 'Category:Cat',
total: 100, // total number of pictures to 
retrieve, and to randomise
num: 3, // number of pictures to show from the 
randomised set
width: 150 // width of each picture in pixels 
in the interface (not in the template)
@@ -144,7 +144,7 @@
.append( 'label for=wlMessage 
id=wlMessageLabel' + mw.msg( 'wikilove-enter-message' ) + '/label'  )
.append( 'span class=wlOmitSig' + 
mw.msg( 'wikilove-omit-sig' ) + '/span'  )
.append( 'textarea 
id=wlMessage/textarea' )
-   .append( $('div 
id=wlNotify/div').html('input type=checkbox id=wlNotifyCheckbox 
name=notify/ Notify user by email') )
+   .append( $('div 
id=wlNotify/div').html('input type=checkbox id=wlNotifyCheckbox 
name=notify/ label for=wlNotifyCheckboxNotify user by email/label') )
.append( 'input id=wlButtonPreview 
class=submit type=submit value='
+ mw.msg( 
'wikilove-button-preview' ) + '/' )
.append( 'img class=wlSpinner src=' 
+ mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' )
@@ -292,6 +292,8 @@
 * Called when type or subtype changes, updates controls. Currently 
only updates title label and textbox.
 */
updateAllDetails: function() {
+   $( '#wikiLoveDialog' ).find( '.wlError' ).remove();
+   
// show or hide title label and textbox depending on whether a 
predefined title exists
if( typeof $.wikiLove.currentTypeOrSubtype.title == 'string' ) {
$( '#wlTitleLabel').hide();
@@ -326,26 +328,27 @@
 */
submitPreview: function( e ) {
e.preventDefault();
+   $( '#wlPreview' ).hide();
+   $( '#wikiLoveDialog' ).find( '.wlError' ).remove();
+   
+   if( typeof $.wikiLove.currentTypeOrSubtype.gallery == 'object' 
) {
+   if ( !$.wikiLove.imageTitle ) {
+   $.wikiLove.showError( 'wikilove-err-image' ); 
return false;
+   }
+   }
if( $( '#wlTitle' ).val().length = 0 ) {
$.wikiLove.showError( 'wikilove-err-title' ); return 
false;
}
if( $( '#wlMessage' ).val().length = 0 ) {
$.wikiLove.showError( 'wikilove-err-msg' ); return 
false;
}
-   if( typeof $.wikiLove.currentTypeOrSubtype.gallery == 'object' 
) {
-   if ( !$.wikiLove.imageTitle ) {
-   $.wikiLove.showError( 'wikilove-err-img' ); 
return false

[MediaWiki-CVS] SVN: [88183] trunk/extensions/WikiLove

2011-05-15 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88183

Revision: 88183
Author:   janpaul123
Date: 2011-05-15 14:18:07 + (Sun, 15 May 2011)
Log Message:
---
API and setup cleanup

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.api.php
trunk/extensions/WikiLove/WikiLove.php

Modified: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  2011-05-15 14:17:42 UTC (rev 
88182)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-05-15 14:18:07 UTC (rev 
88183)
@@ -1,7 +1,7 @@
 ?php
 class WikiLoveApi extends ApiBase {
public function execute() {
-   global $wgRequest;
+   global $wgRequest, $wgWikiLoveLogging;

$params = $this-extractRequestParams();

@@ -16,9 +16,13 @@
}

if ( stripos( $params['text'], $params['template'] ) === false 
) {
-   // error
+   $this-dieUsage( 'Template could not be found in the 
message!', 'invalidtemplate' );
}

+   if ( $wgWikiLoveLogging ) {
+   $this-saveInDb( $talk, $params['subject'], 
$params['text'], $params['type'], $params['template'] );
+   }
+   
$api = new ApiMain( new FauxRequest( array(
'action' = 'edit',
'title'  = $talk-getFullText(),
@@ -37,8 +41,6 @@
$talk-setFragment( '#' . $params['subject'] );
$this-getResult()-addValue( 'redirect', 'pageName', 
$talk-getPrefixedDBkey() );
$this-getResult()-addValue( 'redirect', 'fragment', 
$talk-getFragmentForURL() );
-   
-   $this-saveInDb( $talk, $params['subject'], $params['text'], 
$params['type'], $params['template'] );
}
 
/**
@@ -128,6 +130,10 @@
'code' = 'nologging',
'info' = 'Warning: action was not logged!'
),
+   array(
+   'code' = 'invalidtemplate',
+   'info' = 'Template could not be found in the 
message!'
+   ),
) );
}
 

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-05-15 14:17:42 UTC (rev 
88182)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-05-15 14:18:07 UTC (rev 
88183)
@@ -67,7 +67,9 @@
 $wgAPIModules['wikiLove'] = 'WikiLoveApi';
 
 // default user options
+$wgWikiLoveGlobal  = false;
 $wgWikiLoveTabIcon = true;
+$wgWikiLoveLogging = false;
 
 // resources
 $wikiLoveTpl = array(


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [88197] trunk/extensions/WikiLove

2011-05-15 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88197

Revision: 88197
Author:   janpaul123
Date: 2011-05-15 17:17:12 + (Sun, 15 May 2011)
Log Message:
---
Better gallery

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.api.php
trunk/extensions/WikiLove/wikiLove.css
trunk/extensions/WikiLove/wikiLove.js

Modified: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  2011-05-15 17:01:06 UTC (rev 
88196)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-05-15 17:17:12 UTC (rev 
88197)
@@ -15,7 +15,7 @@
$this-dieUsageMsg( array( 'invalidtitle', 
$params['title'] ) );
}

-   if ( stripos( $params['text'], $params['template'] ) === false 
) {
+   if ( strlen( $params['template'] )  0  stripos( 
$params['text'], $params['template'] ) === false ) {
$this-dieUsage( 'Template could not be found in the 
message!', 'invalidtemplate' );
}


Modified: trunk/extensions/WikiLove/wikiLove.css
===
--- trunk/extensions/WikiLove/wikiLove.css  2011-05-15 17:01:06 UTC (rev 
88196)
+++ trunk/extensions/WikiLove/wikiLove.css  2011-05-15 17:17:12 UTC (rev 
88197)
@@ -266,6 +266,10 @@
 }
 
 /* add details gallery */
+#wikiLoveDialog #wlGallery {
+   min-height: 40px;
+}
+
 #wikiLoveDialog #wlGallery img {
margin-right: 5px;
margin-bottom: 5px;
@@ -281,6 +285,16 @@
background-color: #f56427;
 }
 
+#wikiLoveDialog #wlGallerySpinner {
+   position: relative;
+}
+
+#wikiLoveDialog #wlGallerySpinner .wlSpinner {
+   float: none;
+   position: absolute;
+   z-index: -1;
+}
+
 /* dialog preview */
 #wikiLoveDialog #wlPreview {
float: right;

Modified: trunk/extensions/WikiLove/wikiLove.js
===
--- trunk/extensions/WikiLove/wikiLove.js   2011-05-15 17:01:06 UTC (rev 
88196)
+++ trunk/extensions/WikiLove/wikiLove.js   2011-05-15 17:17:12 UTC (rev 
88197)
@@ -33,10 +33,10 @@
template: '',
gallery: {
// right now we can only query the local wiki 
(not e.g. commons)
-   category: 'Category:Cat',
+   category: 'Category:Cats',
total: 100, // total number of pictures to 
retrieve, and to randomise
num: 3, // number of pictures to show from the 
randomised set
-   width: 150 // width of each picture in pixels 
in the interface (not in the template)
+   width: 145 // width of each picture in pixels 
in the interface (not in the template)
}
},
// default type, nice to leave this one in place when adding 
other types
@@ -69,11 +69,11 @@
// Find out if we can email the user
$.wikiLove.getEmailable();

+   // Reusable spinner string
+   var spinner = 'img class=wlSpinner src=' + 
mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' )
+   + 
'/extensions/WikiLove/images/spinner.gif/';
+   
// Build a type list like this:
-   // ul id=wlTypes
-   //   li tabindex=0spanBarnstar/span/li
-   //   li tabindex=0spanMake your own/span/li
-   // /ul
var $typeList = $( 'ul id=wlTypes/ul' );
for( var typeId in $.wikiLove.types ) {
$button = $( 'a href=#/a' );
@@ -97,10 +97,6 @@
}

// Build the left menu for selecting a type:
-   // div id=wlSelectType
-   //   h3Select Type:/h3
-   //   ul id=wlTypes.../ul
-   // /div
var $selectType = $( 'div id=wlSelectType/div' )
.append( 'span class=wlNumber1/span' )
.append( 'h3' + mw.msg( 
'wikilove-select-type' ) + '/h3' )
@@ -115,22 +111,6 @@
);

// Build the right top section for selecting a subtype 
and entering a title (optional) and message
-   // div id=wlAddDetails
-   //   h3Add Details:/h3
-   //
-   //   label for=wlSubtype 
id=wlSubtypeLabel.../label   (label depends

[MediaWiki-CVS] SVN: [87995] trunk/extensions/WikiLove/WikiLove.api.php

2011-05-13 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/87995

Revision: 87995
Author:   janpaul123
Date: 2011-05-13 15:44:09 + (Fri, 13 May 2011)
Log Message:
---
Updated documentation

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.api.php

Modified: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  2011-05-13 15:42:36 UTC (rev 
87994)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-05-13 15:44:09 UTC (rev 
87995)
@@ -95,11 +95,14 @@
public function getParamDescription() {
return array(
'title' = 'Title of the user or user talk page to send 
WikiLove to',
-   'text' = 'Wikitext to add in the new section',
+   'text' = 'Raw ikitext to add in the new section',
'token' = 'Edit token. You can get one of these 
through prop=info',
'subject' = 'Subject header of the new section',
-   'template' = 'Template used in the wikitext (for 
statistics)',
-   'type' = 'Type of WikiLove (for statistics)',
+   'template' = 'Template name used in the wikitext (for 
statistics)',
+   'type' = array( 'Type of WikiLove (for statistics); 
this corresponds with a type',
+'selected in the left menu, and 
optionally a subtype after that',
+'(e.g. barnstar-normal or kitten)',
+   ),
);
}
 
@@ -107,8 +110,9 @@
return array(
'Give WikiLove to another user.',
WikiLove is a positive message posted to a user's talk 
page through a,
-   'convenient interface with preset images and templates. 
For statistical',
-   'purposes, the type and template (among the other data) 
are logged.',
+   'convenient interface with preset images and templates. 
This action adds',
+   'the specified wikitext to a certain talk page. For 
statistical purposes,',
+   'the type and template (among the other data) are 
logged.',
);
}
 


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [87685] trunk/extensions/WikiLove

2011-05-08 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/87685

Revision: 87685
Author:   janpaul123
Date: 2011-05-08 14:51:09 + (Sun, 08 May 2011)
Log Message:
---
Added images, fixed RTL, fixed accessibility, fixed bug where a message other 
than the previewed message was sent

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.i18n.php
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/wikiLove.css
trunk/extensions/WikiLove/wikiLove.js

Added Paths:
---
trunk/extensions/WikiLove/images/get-started-ltr.png
trunk/extensions/WikiLove/images/get-started-rtl.png
trunk/extensions/WikiLove/images/number.png
trunk/extensions/WikiLove/images/select-bg-sprite.png
trunk/extensions/WikiLove/images/select-sprite.png

Modified: trunk/extensions/WikiLove/WikiLove.i18n.php
===
--- trunk/extensions/WikiLove/WikiLove.i18n.php 2011-05-08 13:22:42 UTC (rev 
87684)
+++ trunk/extensions/WikiLove/WikiLove.i18n.php 2011-05-08 14:51:09 UTC (rev 
87685)
@@ -19,6 +19,10 @@
'tooltip-ca-wikilove' = 'Post a message for this user showing your 
appreciation',
'wikilove-dialog-title' = 'WikiLove',
'wikilove-select-type' = 'Select Type',
+   'wikilove-get-started-header' = Let's get started!,
+   'wikilove-get-started-list-1' = 'Select the type of WikiLove you wish 
to send',
+   'wikilove-get-started-list-2' = 'Add details to your WikiLove',
+   'wikilove-get-started-list-3' = 'Send your WikiLove!',
'wikilove-add-details' = 'Add Details',
'wikilove-title' = 'Title:',
'wikilove-enter-message' = 'Enter a message:',

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-05-08 13:22:42 UTC (rev 
87684)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-05-08 14:51:09 UTC (rev 
87685)
@@ -83,6 +83,10 @@
'messages' = array(
'wikilove-dialog-title',
'wikilove-select-type',
+   'wikilove-get-started-header',
+   'wikilove-get-started-list-1',
+   'wikilove-get-started-list-2',
+   'wikilove-get-started-list-3',
'wikilove-add-details',
'wikilove-title',
'wikilove-enter-message',

Added: trunk/extensions/WikiLove/images/get-started-ltr.png
===
(Binary files differ)


Property changes on: trunk/extensions/WikiLove/images/get-started-ltr.png
___
Added: svn:mime-type
   + image/png

Added: trunk/extensions/WikiLove/images/get-started-rtl.png
===
(Binary files differ)


Property changes on: trunk/extensions/WikiLove/images/get-started-rtl.png
___
Added: svn:mime-type
   + image/png

Added: trunk/extensions/WikiLove/images/number.png
===
(Binary files differ)


Property changes on: trunk/extensions/WikiLove/images/number.png
___
Added: svn:mime-type
   + image/png

Added: trunk/extensions/WikiLove/images/select-bg-sprite.png
===
(Binary files differ)


Property changes on: trunk/extensions/WikiLove/images/select-bg-sprite.png
___
Added: svn:mime-type
   + image/png

Added: trunk/extensions/WikiLove/images/select-sprite.png
===
(Binary files differ)


Property changes on: trunk/extensions/WikiLove/images/select-sprite.png
___
Added: svn:mime-type
   + image/png

Modified: trunk/extensions/WikiLove/wikiLove.css
===
--- trunk/extensions/WikiLove/wikiLove.css  2011-05-08 13:22:42 UTC (rev 
87684)
+++ trunk/extensions/WikiLove/wikiLove.css  2011-05-08 14:51:09 UTC (rev 
87685)
@@ -58,39 +58,174 @@
padding: 0;
 }
 
-#wikiLoveDialog #wlSelectType ul li {
+#wikiLoveDialog #wlSelectType ul li,
+#wikiLoveDialog #wlSelectType a
+{
display: block;
-   background-color: #3060b0;
width: 250px;
-   padding: 10px 0;
-   
-   /* create a hand cursor, cross-browser hack: 
http://www.quirksmode.org/css/cursor.html */
-   cursor: pointer;
-   cursor: hand;
+   height: 66px;
+   padding: 0;
+   margin: 0;
+   position: relative;
+   text-decoration: none

[MediaWiki-CVS] SVN: [87686] trunk/extensions/WikiLove

2011-05-08 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/87686

Revision: 87686
Author:   janpaul123
Date: 2011-05-08 14:58:33 + (Sun, 08 May 2011)
Log Message:
---
Reverted r87521 for now. Couldn't find any documentation that elastic textareas 
are available in jQuery UI.

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.php
trunk/extensions/WikiLove/wikiLove.js

Added Paths:
---
trunk/extensions/WikiLove/jquery.elastic.js

Modified: trunk/extensions/WikiLove/WikiLove.php
===
--- trunk/extensions/WikiLove/WikiLove.php  2011-05-08 14:51:09 UTC (rev 
87685)
+++ trunk/extensions/WikiLove/WikiLove.php  2011-05-08 14:58:33 UTC (rev 
87686)
@@ -98,6 +98,10 @@
),
'dependencies' = array(
'jquery.ui.dialog',
+   'jquery.elastic',
),
),
+   'jquery.elastic' = $wikiLoveTpl + array(
+   'scripts' = 'jquery.elastic.js',
+   ),
 );

Copied: trunk/extensions/WikiLove/jquery.elastic.js (from rev 87520, 
trunk/extensions/WikiLove/jquery.elastic.js)
===
--- trunk/extensions/WikiLove/jquery.elastic.js (rev 0)
+++ trunk/extensions/WikiLove/jquery.elastic.js 2011-05-08 14:58:33 UTC (rev 
87686)
@@ -0,0 +1,6 @@
+(function(jQuery){jQuery.fn.extend({elastic:function(){var 
mimics=['paddingTop','paddingRight','paddingBottom','paddingLeft','fontSize','lineHeight','fontFamily','width','fontWeight'];return
 this.each(function(){if(this.type!='textarea'){return false;}
+var $textarea=jQuery(this),$twin=jQuery('div 
/').css({'position':'absolute','display':'none','word-wrap':'break-word'}),lineHeight=parseInt($textarea.css('line-height'),10)||parseInt($textarea.css('font-size'),'10'),minheight=parseInt($textarea.css('height'),10)||lineHeight*3,maxheight=parseInt($textarea.css('max-height'),10)||Number.MAX_VALUE,goalheight=0,i=0;if(maxheight0){maxheight=Number.MAX_VALUE;}
+$twin.appendTo($textarea.parent());var 
i=mimics.length;while(i--){$twin.css(mimics[i].toString(),$textarea.css(mimics[i].toString()));}
+function 
setHeightAndOverflow(height,overflow){curratedHeight=Math.floor(parseInt(height,10));if($textarea.height()!=curratedHeight){$textarea.css({'height':curratedHeight+'px','overflow':overflow});}}
+function update(){var 
textareaContent=$textarea.val().replace(//g,'amp;').replace(/  
/g,'nbsp;').replace(/|/g,'gt;').replace(/\n/g,'br /');var 
twinContent=$twin.html();if(textareaContent+'nbsp;'!=twinContent){$twin.html(textareaContent+'nbsp;');if(Math.abs($twin.height()+lineHeight-$textarea.height())3){var
 
goalheight=$twin.height()+lineHeight;if(goalheight=maxheight){setHeightAndOverflow(maxheight,'auto');}else
 
if(goalheight=minheight){setHeightAndOverflow(minheight,'hidden');}else{setHeightAndOverflow(goalheight,'hidden');
+$textarea.css({'overflow':'hidden'});$textarea.keyup(function(){update();});$textarea.live('input
 paste',function(e){setTimeout(update,250);});update();});}});})(jQuery);
\ No newline at end of file

Modified: trunk/extensions/WikiLove/wikiLove.js
===
--- trunk/extensions/WikiLove/wikiLove.js   2011-05-08 14:51:09 UTC (rev 
87685)
+++ trunk/extensions/WikiLove/wikiLove.js   2011-05-08 14:58:33 UTC (rev 
87686)
@@ -159,6 +159,7 @@
$( '#wlSubtype' ).change( $.wikiLove.changeSubtype );
$( '#wlPreviewForm' ).submit( $.wikiLove.submitPreview 
);
$( '#wlSendForm' ).click( $.wikiLove.submitSend );
+   $( '#wlMessage' ).elastic(); // have the message 
textarea grow automatically
}

$.wikiLove.$dialog.dialog( 'open' );


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [87294] trunk/extensions/WikiLove

2011-05-02 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/87294

Revision: 87294
Author:   janpaul123
Date: 2011-05-02 20:34:52 + (Mon, 02 May 2011)
Log Message:
---
Added first very experimental -- but working! -- version of the WikiLove 
extension.

Modified Paths:
--
trunk/extensions/WikiLove/WikiLove.i18n.php
trunk/extensions/WikiLove/WikiLove.php

Added Paths:
---
trunk/extensions/WikiLove/WikiLove.api.php
trunk/extensions/WikiLove/WikiLove.hooks.php
trunk/extensions/WikiLove/images/heart-hover.png
trunk/extensions/WikiLove/images/heart-icons.png
trunk/extensions/WikiLove/images/spinner.gif
trunk/extensions/WikiLove/images/tab-break.png
trunk/extensions/WikiLove/jquery.elastic.js
trunk/extensions/WikiLove/patches/
trunk/extensions/WikiLove/patches/WikiLoveLog.sql
trunk/extensions/WikiLove/wikiLove.css
trunk/extensions/WikiLove/wikiLove.js

Removed Paths:
-
trunk/extensions/WikiLove/WikiLove.sql

Added: trunk/extensions/WikiLove/WikiLove.api.php
===
--- trunk/extensions/WikiLove/WikiLove.api.php  (rev 0)
+++ trunk/extensions/WikiLove/WikiLove.api.php  2011-05-02 20:34:52 UTC (rev 
87294)
@@ -0,0 +1,126 @@
+?php
+class WikiLoveApi extends ApiBase {
+   public function execute() {
+   global $wgRequest;
+   
+   $params = $this-extractRequestParams();
+   
+   $title = Title::newFromText( $params['title'] );
+   if ( is_null( $title ) ) {
+   // error
+   }
+   
+   $talk = WikiLoveHooks::getUserTalkPage( $title );
+   if ( is_null( $talk ) ) {
+   // error
+   }
+   
+   if ( stripos( $params['text'], $params['template'] ) === false 
) {
+   // error
+   }
+   
+   $api = new ApiMain( new FauxRequest( array(
+   'action' = 'edit',
+   'title'  = $talk-getFullText(),
+   'section' = 'new',
+   'text' = $params['text'],
+   'token'  = $params['token'],
+   'summary' = $params['subject'],
+   'notminor' = true,
+   ), false, array( 'wsEditToken' = $wgRequest-getSessionData( 
'wsEditToken' ) ) ), true );
+   $api-execute();
+   
+   $result = $api-getResult();
+   $data = $result-getData();
+   
+   $talk-setFragment( '#' . $params['subject'] );
+   $this-getResult()-addValue( 'redirect', 'pageName', 
$talk-getPrefixedDBkey() );
+   $this-getResult()-addValue( 'redirect', 'fragment', 
$talk-getFragmentForURL() );
+   
+   $this-saveInDb( $talk, $params['subject'], $params['text'], 
$params['type'], $params['template'] );
+   }
+   
+   private function saveInDb( $talk, $subject, $text, $type, $template ) {
+   global $wgUser, $wgSitename;
+   $dbw = wfGetDB( DB_MASTER );
+   $values = array(
+   'wl_timestamp' = $dbw-timestamp(),
+   'wl_sender_id' = $wgUser-getId(),
+   'wl_receiver_id' = User::newFromName( 
$talk-getSubjectPage()-getBaseText() )-getId(),
+   'wl_wiki' = $wgSitename,
+   'wl_type' = $type,
+   'wl_template' = $template,
+   'wl_subject' = $subject,
+   'wl_message' = $text,
+   'wl_email' = 0,
+   );
+   $dbw-insert( 'wikilove_log', $values, __METHOD__ );
+   }
+
+   public function getAllowedParams() {
+   return array(
+   'title' = array(
+   ApiBase::PARAM_TYPE = 'string',
+   ApiBase::PARAM_REQUIRED = true,
+   ),
+   'text' = array(
+   ApiBase::PARAM_TYPE = 'string',
+   ApiBase::PARAM_REQUIRED = true,
+   ),
+   'token' = array(
+   ApiBase::PARAM_TYPE = 'string',
+   ApiBase::PARAM_REQUIRED = true,
+   ),
+   'subject' = array(
+   ApiBase::PARAM_TYPE = 'string',
+   ApiBase::PARAM_REQUIRED = true,
+   ),
+   'template' = array(
+   ApiBase::PARAM_TYPE = 'string',
+   ),
+   'type' = array(
+   ApiBase::PARAM_TYPE

[MediaWiki-CVS] SVN: [87101] trunk/phase3/skins/vector/screen.css

2011-04-28 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/87101

Revision: 87101
Author:   janpaul123
Date: 2011-04-28 21:34:55 + (Thu, 28 Apr 2011)
Log Message:
---
Moved the tab break from the link to the span. This allows for multiple icons, 
as icons overwrite this link image and thus wouldn't have a tab break. This was 
originally solved for the watchlist star by using a right margin, so this one 
is removed to prevent double borders.

Modified Paths:
--
trunk/phase3/skins/vector/screen.css

Modified: trunk/phase3/skins/vector/screen.css
===
--- trunk/phase3/skins/vector/screen.css2011-04-28 20:38:36 UTC (rev 
87100)
+++ trunk/phase3/skins/vector/screen.css2011-04-28 21:34:55 UTC (rev 
87101)
@@ -165,10 +165,6 @@
height: 1.9em;
padding-left: 0.5em;
padding-right: 0.5em;
-   /* @embed */
-   background-image: url(images/tab-break.png);
-   background-position: bottom right;
-   background-repeat: no-repeat;
color: #0645ad;
cursor: pointer;
font-size: 0.8em;
@@ -177,6 +173,10 @@
div.vectorTabs li  a {
display: block;
}
+   div.vectorTabs li.icon a {
+   background-position: bottom right;
+   background-repeat: no-repeat;
+   }
/* OVERRIDDEN BY COMPLIANT BROWSERS */
div.vectorTabs span a  {
display: inline-block;
@@ -188,6 +188,13 @@
float: left;
display: block;
}
+   div.vectorTabs span {
+   display: inline-block;
+   /* @embed */
+   background-image: url(images/tab-break.png);
+   background-position: bottom right;
+   background-repeat: no-repeat;
+   }
div.vectorTabs li.selected a,
div.vectorTabs li.selected a:visited{
color: #33;
@@ -1166,10 +1173,6 @@
 }
 
 /* Watch/Unwatch Icon Styling */
-#ca-unwatch.icon,
-#ca-watch.icon {
-   margin-right:1px;
-}
 #ca-unwatch.icon a,
 #ca-watch.icon a {
margin: 0;


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [86853] trunk/extensions/WikiEditor/modules

2011-04-25 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/86853

Revision: 86853
Author:   janpaul123
Date: 2011-04-25 12:26:20 + (Mon, 25 Apr 2011)
Log Message:
---
Fixes bug 24088: WikiEditor toolbar RTL icons

Modified Paths:
--
trunk/extensions/WikiEditor/modules/images/toolbar/button-sprite.png
trunk/extensions/WikiEditor/modules/jquery.wikiEditor.js
trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.config.js

Added Paths:
---
trunk/extensions/WikiEditor/modules/images/toolbar/format-indent-rtl.png
trunk/extensions/WikiEditor/modules/images/toolbar/format-olist-rtl.png
trunk/extensions/WikiEditor/modules/images/toolbar/format-ulist-rtl.png
trunk/extensions/WikiEditor/modules/images/toolbar/insert-redirect-rtl.png

Modified: trunk/extensions/WikiEditor/modules/images/toolbar/button-sprite.png
===
(Binary files differ)

Added: trunk/extensions/WikiEditor/modules/images/toolbar/format-indent-rtl.png
===
(Binary files differ)


Property changes on: 
trunk/extensions/WikiEditor/modules/images/toolbar/format-indent-rtl.png
___
Added: svn:mime-type
   + image/png

Added: trunk/extensions/WikiEditor/modules/images/toolbar/format-olist-rtl.png
===
(Binary files differ)


Property changes on: 
trunk/extensions/WikiEditor/modules/images/toolbar/format-olist-rtl.png
___
Added: svn:mime-type
   + image/png

Added: trunk/extensions/WikiEditor/modules/images/toolbar/format-ulist-rtl.png
===
(Binary files differ)


Property changes on: 
trunk/extensions/WikiEditor/modules/images/toolbar/format-ulist-rtl.png
___
Added: svn:mime-type
   + image/png

Added: 
trunk/extensions/WikiEditor/modules/images/toolbar/insert-redirect-rtl.png
===
(Binary files differ)


Property changes on: 
trunk/extensions/WikiEditor/modules/images/toolbar/insert-redirect-rtl.png
___
Added: svn:mime-type
   + image/png

Modified: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.js
===
--- trunk/extensions/WikiEditor/modules/jquery.wikiEditor.js2011-04-25 
12:19:16 UTC (rev 86852)
+++ trunk/extensions/WikiEditor/modules/jquery.wikiEditor.js2011-04-25 
12:26:20 UTC (rev 86853)
@@ -149,14 +149,16 @@
},
/**
 * Provides a way to extract a property of an object in a certain 
language, falling back on the property keyed as
-* 'default'. If such key doesn't exist, the object itself is 
considered the actual value, which should ideally
-* be the case so that you may use a string or object of any number of 
strings keyed by language with a default.
+* 'default' or 'default-rtl'. If such key doesn't exist, the object 
itself is considered the actual value, which
+* should ideally be the case so that you may use a string or object of 
any number of strings keyed by language
+* with a default.
 * 
 * @param object Object to extract property from
 * @param lang Language code, defaults to wgUserLanguage
 */
'autoLang': function( object, lang ) {
-   return object[lang || wgUserLanguage] || object['default'] || 
object;
+   var defaultKey = $( 'body' ).hasClass( 'rtl' ) ? 'default-rtl' 
: 'default';
+   return object[lang || wgUserLanguage] || object[defaultKey] || 
object['default'] || object;
},
/**
 * Provides a way to extract the path of an icon in a certain language, 
automatically appending a version number for

Modified: 
trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.config.js
===
--- trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.config.js 
2011-04-25 12:19:16 UTC (rev 86852)
+++ trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.config.js 
2011-04-25 12:26:20 UTC (rev 86853)
@@ -261,8 +261,14 @@
'ulist': {
'labelMsg': 
'wikieditor-toolbar-tool-ulist',
'type': 'button',
-   'icon': 
'format-ulist.png',
-   'offset': [2, -1366],
+   'icon

[MediaWiki-CVS] SVN: [86703] trunk/extensions/WikiEditor

2011-04-22 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/86703

Revision: 86703
Author:   janpaul123
Date: 2011-04-22 12:10:18 + (Fri, 22 Apr 2011)
Log Message:
---
Fixes bug 28149 (but with default to true)

Modified Paths:
--
trunk/extensions/WikiEditor/WikiEditor.hooks.php
trunk/extensions/WikiEditor/WikiEditor.i18n.php
trunk/extensions/WikiEditor/WikiEditor.php
trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.config.js

Added Paths:
---
trunk/extensions/WikiEditor/modules/ext.wikiEditor.toolbar.hideSig.js

Modified: trunk/extensions/WikiEditor/WikiEditor.hooks.php
===
--- trunk/extensions/WikiEditor/WikiEditor.hooks.php2011-04-22 11:32:32 UTC 
(rev 86702)
+++ trunk/extensions/WikiEditor/WikiEditor.hooks.php2011-04-22 12:10:18 UTC 
(rev 86703)
@@ -47,6 +47,22 @@
'ext.wikiEditor.dialogs',
),
),
+   'hidesig' = array(
+   'preferences' = array(
+   'wikieditor-toolbar-hidesig' = array(
+   'type' = 'toggle',
+   'label-message' = 
'wikieditor-toolbar-hidesig',
+   'section' = 'editing/beta',
+   ),
+   ),
+   'requirements' = array(
+   'wikieditor-toolbar-hidesig' = true,
+   'usebetatoolbar' = true,
+   ),
+   'modules' = array(
+   'ext.wikiEditor.toolbar.hideSig',
+   ),
+   ),

/* Labs Features */


Modified: trunk/extensions/WikiEditor/WikiEditor.i18n.php
===
--- trunk/extensions/WikiEditor/WikiEditor.i18n.php 2011-04-22 11:32:32 UTC 
(rev 86702)
+++ trunk/extensions/WikiEditor/WikiEditor.i18n.php 2011-04-22 12:10:18 UTC 
(rev 86703)
@@ -55,6 +55,7 @@
'wikieditor-toolbar-desc' = 'Edit page toolbar with enhanced 
usability',
'wikieditor-toolbar-preference' = 'Enable enhanced editing toolbar',
'wikieditor-toolbar-dialogs-preference' = 'Enable dialogs for 
inserting links, tables and more',
+   'wikieditor-toolbar-hidesig' = 'Hide the signature button from pages 
in the main namespace',
'wikieditor-toolbar-loading' = 'Loading...',
/* Toolbar - Main Section */
'wikieditor-toolbar-tool-bold' = 'Bold',

Modified: trunk/extensions/WikiEditor/WikiEditor.php
===
--- trunk/extensions/WikiEditor/WikiEditor.php  2011-04-22 11:32:32 UTC (rev 
86702)
+++ trunk/extensions/WikiEditor/WikiEditor.php  2011-04-22 12:10:18 UTC (rev 
86703)
@@ -23,6 +23,8 @@
'toolbar' = array( 'global' = false, 'user' = true ),
// Provides interactive tools
'dialogs' = array( 'global' = false, 'user' = true ),
+   // Hide signature button from main namespace
+   'hidesig' = array( 'global' = false, 'user' = false ),

/* Textarea / i-frame compatible, but still experimental and unstable 
(do not deploy!) */

@@ -496,5 +498,11 @@
'jquery.wikiEditor.toolbar.config',
)
),
-   
+   'ext.wikiEditor.toolbar.hideSig' = $wikiEditorTpl + array(
+   'scripts' = 'ext.wikiEditor.toolbar.hideSig.js',
+   'dependencies' = array(
+   'ext.wikiEditor',
+   'ext.wikiEditor.toolbar',
+   )
+   ),
 );

Added: trunk/extensions/WikiEditor/modules/ext.wikiEditor.toolbar.hideSig.js
===
--- trunk/extensions/WikiEditor/modules/ext.wikiEditor.toolbar.hideSig.js   
(rev 0)
+++ trunk/extensions/WikiEditor/modules/ext.wikiEditor.toolbar.hideSig.js   
2011-04-22 12:10:18 UTC (rev 86703)
@@ -0,0 +1,11 @@
+/*
+ * Remove the signature button if the main namespace is edited.
+ */
+$( document ).ready( function() {
+   if ( !$.wikiEditor.isSupported( $.wikiEditor.modules.toolbar ) ) {
+   return;
+   }
+   if ( $( 'body' ).hasClass( 'ns-0' ) ) {
+   $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 
'section': 'main', 'group': 'insert', 'tool': 'signature' } );
+   }
+});


Property changes on: 
trunk/extensions/WikiEditor/modules/ext.wikiEditor.toolbar.hideSig.js
___
Added: svn:eol-style
   + native

Modified: 
trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.config.js
===
--- trunk

[MediaWiki-CVS] SVN: [86704] trunk/extensions/WikiEditor/WikiEditor.php

2011-04-22 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/86704

Revision: 86704
Author:   janpaul123
Date: 2011-04-22 12:24:24 + (Fri, 22 Apr 2011)
Log Message:
---
The hiding of signature button in the WikiEditor for the main namespace is now 
actually defaults to true, as intended in my previous commit (r86703)

Modified Paths:
--
trunk/extensions/WikiEditor/WikiEditor.php

Modified: trunk/extensions/WikiEditor/WikiEditor.php
===
--- trunk/extensions/WikiEditor/WikiEditor.php  2011-04-22 12:10:18 UTC (rev 
86703)
+++ trunk/extensions/WikiEditor/WikiEditor.php  2011-04-22 12:24:24 UTC (rev 
86704)
@@ -24,7 +24,7 @@
// Provides interactive tools
'dialogs' = array( 'global' = false, 'user' = true ),
// Hide signature button from main namespace
-   'hidesig' = array( 'global' = false, 'user' = false ),
+   'hidesig' = array( 'global' = true, 'user' = false ),

/* Textarea / i-frame compatible, but still experimental and unstable 
(do not deploy!) */



___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [84204] trunk/extensions/InlineEditor/jquery.json.js

2011-03-17 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84204

Revision: 84204
Author:   janpaul123
Date: 2011-03-17 22:00:45 + (Thu, 17 Mar 2011)
Log Message:
---
Removed evalJSON because jQuery already has parseJSON. Also refactored 
jquery.json.js a bit.

Modified Paths:
--
trunk/extensions/InlineEditor/jquery.json.js

Modified: trunk/extensions/InlineEditor/jquery.json.js
===
--- trunk/extensions/InlineEditor/jquery.json.js2011-03-17 21:09:27 UTC 
(rev 84203)
+++ trunk/extensions/InlineEditor/jquery.json.js2011-03-17 22:00:45 UTC 
(rev 84204)
@@ -13,7 +13,8 @@
  * It is also influenced heavily by MochiKit's serializeJSON, which is 
  * copyrighted 2005 by Bob Ippolito.
  *
- * The script has been modified by Jan Paul Posma to always use 
$.secureEvalJSON.
+ * The script has been modified by Jan Paul Posma by removing $.evalJSON, 
because jQuery
+ * already includes $.parseJSON, and moving variables into functions.
  */
  
 (function($) {
@@ -110,37 +111,7 @@
 return { + pairs.join(, ) + };
 }
 };
-
-/** jQuery.evalJSON(src)
-Evaluates a given piece of json source.
- **/
-$.evalJSON = function(src)
-{
-   return $.secureEvalJSON(src);
-//if (typeof(JSON) == 'object'  JSON.parse)
-//return JSON.parse(src);
-//return eval(( + src + )); 
-};
 
-/** jQuery.secureEvalJSON(src)
-Evals JSON in a way that is *more* secure.
-**/
-$.secureEvalJSON = function(src)
-{
-if (typeof(JSON) == 'object'  JSON.parse)
-return JSON.parse(src);
-
-var filtered = src;
-filtered = filtered.replace(/\\[\\\/bfnrtu]/g, '@');
-filtered = 
filtered.replace(/[^\\\n\r]*|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
 ']');
-filtered = filtered.replace(/(?:^|:|,)(?:\s*\[)+/g, '');
-
-if (/^[\],:{}\s]*$/.test(filtered))
-return eval(( + src + ));
-else
-throw new SyntaxError(Error parsing JSON, source is not valid.);
-};
-
 /** jQuery.quoteString(string)
 Returns a string-repr of a string, escaping quotes intelligently.  
 Mostly a support function for toJSON.
@@ -154,6 +125,18 @@
  **/
 $.quoteString = function(string)
 {
+   var _escapeable = /[\\\x00-\x1f\x7f-\x9f]/g;
+
+   var _meta = {
+   '\b': '\\b',
+   '\t': '\\t',
+   '\n': '\\n',
+   '\f': '\\f',
+   '\r': '\\r',
+   '' : '\\',
+   '\\': ''
+   };
+   
 if (string.match(_escapeable))
 {
 return '' + string.replace(_escapeable, function (a) 
@@ -166,16 +149,4 @@
 }
 return '' + string + '';
 };
-
-var _escapeable = /[\\\x00-\x1f\x7f-\x9f]/g;
-
-var _meta = {
-'\b': '\\b',
-'\t': '\\t',
-'\n': '\\n',
-'\f': '\\f',
-'\r': '\\r',
-'' : '\\',
-'\\': ''
-};
 })(jQuery);


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [84206] trunk/extensions/InlineEditor/jquery.json.js

2011-03-17 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84206

Revision: 84206
Author:   janpaul123
Date: 2011-03-17 22:17:34 + (Thu, 17 Mar 2011)
Log Message:
---
Small improvement by Krinkle

Modified Paths:
--
trunk/extensions/InlineEditor/jquery.json.js

Modified: trunk/extensions/InlineEditor/jquery.json.js
===
--- trunk/extensions/InlineEditor/jquery.json.js2011-03-17 22:13:38 UTC 
(rev 84205)
+++ trunk/extensions/InlineEditor/jquery.json.js2011-03-17 22:17:34 UTC 
(rev 84206)
@@ -29,8 +29,8 @@
  **/
 $.toJSON = function(o)
 {
-if (typeof(JSON) == 'object'  JSON.stringify)
-return JSON.stringify(o);
+if (typeof window.JSON == 'object'  window.JSON.stringify)
+return window.JSON.stringify(o);
 
 var type = typeof(o);
 


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [83873] trunk/extensions/InlineEditor

2011-03-14 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83873

Revision: 83873
Author:   janpaul123
Date: 2011-03-14 08:52:42 + (Mon, 14 Mar 2011)
Log Message:
---
Fixed support for browsers not supporting the JSON object. I'd recommend adding 
jquery.json.js to core.

Modified Paths:
--
trunk/extensions/InlineEditor/InlineEditor.php
trunk/extensions/InlineEditor/jquery.inlineEditor.js

Added Paths:
---
trunk/extensions/InlineEditor/jquery.json.js

Modified: trunk/extensions/InlineEditor/InlineEditor.php
===
--- trunk/extensions/InlineEditor/InlineEditor.php  2011-03-14 07:38:13 UTC 
(rev 83872)
+++ trunk/extensions/InlineEditor/InlineEditor.php  2011-03-14 08:52:42 UTC 
(rev 83873)
@@ -77,6 +77,7 @@
'dependencies' = array(
'jquery.color',
'mediawiki.util',
+   'jquery.json',
),
),
'jquery.inlineEditor.editors.basic' = $inlineEditorTpl + array(
@@ -99,4 +100,7 @@
'jquery.elastic' = $inlineEditorTpl + array(
'scripts'  = 'jquery.elastic.js',
),
+   'jquery.json' = $inlineEditorTpl + array(
+   'scripts'  = 'jquery.json.js',
+   ),
 );

Modified: trunk/extensions/InlineEditor/jquery.inlineEditor.js
===
--- trunk/extensions/InlineEditor/jquery.inlineEditor.js2011-03-14 
07:38:13 UTC (rev 83872)
+++ trunk/extensions/InlineEditor/jquery.inlineEditor.js2011-03-14 
08:52:42 UTC (rev 83873)
@@ -39,7 +39,7 @@
'lastEdit': { 'id': id, 'text': text }
};

-   var args = [ JSON.stringify( data ), wgPageName ];
+   var args = [ $.toJSON( data ), wgPageName ];
sajax_request_type = 'POST';
sajax_do_call( 'InlineEditor::ajaxPreview', args, 
$.inlineEditor.addNewState );
},
@@ -48,7 +48,7 @@
 * Adds a new state from an AJAX request.
 */
addNewState: function( request ) {
-   var state = JSON.parse( request.responseText );
+   var state = $.parseJSON( request.responseText );

// restore the html to the current state, instantly remove the 
lastEdit,
// and then add the new html
@@ -180,7 +180,7 @@
var data = {
'object': 
$.inlineEditor.states[$.inlineEditor.currentState].object
};
-   var json = JSON.stringify( data );
+   var json = $.toJSON( data );

// set and send the form
$( '#json' ).val( json );

Added: trunk/extensions/InlineEditor/jquery.json.js
===
--- trunk/extensions/InlineEditor/jquery.json.js
(rev 0)
+++ trunk/extensions/InlineEditor/jquery.json.js2011-03-14 08:52:42 UTC 
(rev 83873)
@@ -0,0 +1,181 @@
+/*
+ * jQuery JSON Plugin
+ * version: 2.1 (2009-08-14)
+ *
+ * This document is licensed as free software under the terms of the
+ * MIT License: http://www.opensource.org/licenses/mit-license.php
+ *
+ * Brantley Harris wrote this plugin. It is based somewhat on the JSON.org 
+ * website's http://www.json.org/json2.js, which proclaims:
+ * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK., a sentiment that
+ * I uphold.
+ *
+ * It is also influenced heavily by MochiKit's serializeJSON, which is 
+ * copyrighted 2005 by Bob Ippolito.
+ *
+ * The script has been modified by Jan Paul Posma to always use 
$.secureEvalJSON.
+ */
+ 
+(function($) {
+/** jQuery.toJSON( json-serializble )
+Converts the given argument into a JSON respresentation.
+
+If an object has a toJSON function, that will be used to get the 
representation.
+Non-integer/string keys are skipped in the object, as are keys that 
point to a function.
+
+json-serializble:
+The *thing* to be converted.
+ **/
+$.toJSON = function(o)
+{
+if (typeof(JSON) == 'object'  JSON.stringify)
+return JSON.stringify(o);
+
+var type = typeof(o);
+
+if (o === null)
+return null;
+
+if (type == undefined)
+return undefined;
+
+if (type == number || type == boolean)
+return o + ;
+
+if (type == string)
+return $.quoteString(o);
+
+if (type == 'object')
+{
+if (typeof o.toJSON == function) 
+return $.toJSON( o.toJSON() );
+
+if (o.constructor === Date)
+{
+var month = o.getUTCMonth() + 1;
+if (month  10) month = '0' + month

[MediaWiki-CVS] SVN: [83875] trunk/extensions/InlineEditor

2011-03-14 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83875

Revision: 83875
Author:   janpaul123
Date: 2011-03-14 09:33:38 + (Mon, 14 Mar 2011)
Log Message:
---
Slightly changed the behaviour of marking collapsing.

Modified Paths:
--
trunk/extensions/InlineEditor/InlineEditorMarking.class.php
trunk/extensions/InlineEditor/InlineEditorText.class.php
trunk/extensions/InlineEditor/MediaEditor/MediaEditor.class.php
trunk/extensions/InlineEditor/TemplateEditor/TemplateEditor.class.php

Modified: trunk/extensions/InlineEditor/InlineEditorMarking.class.php
===
--- trunk/extensions/InlineEditor/InlineEditorMarking.class.php 2011-03-14 
09:30:56 UTC (rev 83874)
+++ trunk/extensions/InlineEditor/InlineEditorMarking.class.php 2011-03-14 
09:33:38 UTC (rev 83875)
@@ -15,7 +15,7 @@
protected $block;   ///  whether the tag should be added as a 
block or inline
protected $bar; ///  whether the text should carry a bar at 
the left, or be fully selectable
protected $level;   ///  nesting level, which is used to sort 
consistently when two markings are of same length
-   protected $collapsible; ///  whether or not the marking can be 
collapsed when only containing one nested element
+   protected $collapsible; ///  whether or not the marking can be 
collapsed by removing parent elements of the same size

protected $id;  ///  id in the original text; this will be 
unique even when calculating new ids!
protected $matched; ///  bool whether or not this marking has been 
matched with a previous marking (default: true)
@@ -27,7 +27,7 @@
 * @param $block   bool Whether the tag should be added as a block 
or inline
 * @param $bar bool Whether the text should carry a bar at the 
left, or be fully selectable
 * @param $level   int Nesting level, which is used to sort 
consistently when two markings are of same length, default: 0
-* @param $collapsible bool Whether or not the marking can be collapsed 
when only containing one nested element, default: true
+* @param $collapsible bool Whether or not the marking can be collapsed 
by removing parent elements of the same size
 */
function __construct( $start, $end, $classes, $block, $bar, $level = 0, 
$collapsible = true ) {
$this-start   = $start;
@@ -187,7 +187,7 @@
}

/**
-* Get whether or not the marking can be collapsed when only containing 
one nested element.
+* Get whether or not the marking can be collapsed by removing parent 
elements of the same size
 * @param $value int
 */
public function getCollapsible() {

Modified: trunk/extensions/InlineEditor/InlineEditorText.class.php
===
--- trunk/extensions/InlineEditor/InlineEditorText.class.php2011-03-14 
09:30:56 UTC (rev 83874)
+++ trunk/extensions/InlineEditor/InlineEditorText.class.php2011-03-14 
09:33:38 UTC (rev 83875)
@@ -260,7 +260,7 @@
protected function collapseMarkings() {
foreach( $this-markings as $id = $marking ) {
if( isset( $previous ) ) {
-   if( $previous-getCollapsible()  
$marking-samePositionAs( $previous ) ) {
+   if( $marking-getCollapsible()  
$marking-samePositionAs( $previous ) ) {
unset( $this-markings[$previousID] );
}
}

Modified: trunk/extensions/InlineEditor/MediaEditor/MediaEditor.class.php
===
--- trunk/extensions/InlineEditor/MediaEditor/MediaEditor.class.php 
2011-03-14 09:30:56 UTC (rev 83874)
+++ trunk/extensions/InlineEditor/MediaEditor/MediaEditor.class.php 
2011-03-14 09:33:38 UTC (rev 83875)
@@ -31,7 +31,7 @@
if ( $namespace == NS_FILE ) {
$start = $match[1];
$end   = $start + strlen( $match[0] );
-   $inlineEditorText-addMarking( new 
InlineEditorMarking( $start, $end, 'mediaEditorElement inlineEditorBasic', 
true, false ) );
+   $inlineEditorText-addMarking( new 
InlineEditorMarking( $start, $end, 'mediaEditorElement inlineEditorBasic', 
true, false, 0, false ) );
}
}
 

Modified: trunk/extensions/InlineEditor/TemplateEditor/TemplateEditor.class.php
===
--- trunk/extensions/InlineEditor/TemplateEditor/TemplateEditor.class.php   
2011-03-14 09:30:56 UTC (rev 83874)
+++ trunk/extensions/InlineEditor/TemplateEditor/TemplateEditor.class.php   
2011-03-14 09:33:38

[MediaWiki-CVS] SVN: [83601] trunk/extensions/InlineEditor

2011-03-09 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83601

Revision: 83601
Author:   janpaul123
Date: 2011-03-09 19:01:37 + (Wed, 09 Mar 2011)
Log Message:
---
AFAIK, this completely fixes bug 27853

Modified Paths:
--
trunk/extensions/InlineEditor/jquery.inlineEditor.css
trunk/extensions/InlineEditor/jquery.inlineEditor.editors.basic.css

Modified: trunk/extensions/InlineEditor/jquery.inlineEditor.css
===
--- trunk/extensions/InlineEditor/jquery.inlineEditor.css   2011-03-09 
18:55:54 UTC (rev 83600)
+++ trunk/extensions/InlineEditor/jquery.inlineEditor.css   2011-03-09 
19:01:37 UTC (rev 83601)
@@ -26,6 +26,17 @@
padding: 0px;
 }
 
+/* more skin-specific fixes */
+.skin-chick #inlineEditorBox,
+.skin-standard #inlineEditorBox,
+.skin-cologneblue #inlineEditorBox,
+.skin-myskin #inlineEditorBox,
+.skin-nostalgia #inlineEditorBox,
+.skin-simple #inlineEditorBox {
+   line-height: 1.5em;
+   font-size: 0.9em;
+}
+
 #introbox {
/* basic grey box */
background-color: #f3f3f3;

Modified: trunk/extensions/InlineEditor/jquery.inlineEditor.editors.basic.css
===
--- trunk/extensions/InlineEditor/jquery.inlineEditor.editors.basic.css 
2011-03-09 18:55:54 UTC (rev 83600)
+++ trunk/extensions/InlineEditor/jquery.inlineEditor.editors.basic.css 
2011-03-09 19:01:37 UTC (rev 83601)
@@ -98,6 +98,15 @@
resize: none;
 }
 
+/* some skin-specific fixes */
+.skin-chick #editContent .editbar textarea,
+.skin-standard #editContent .editbar textarea,
+.skin-myskin #editContent .editbar textarea,
+.skin-nostalgia #editContent .editbar textarea,
+.skin-simple #editContent .editbar textarea {
+   font-size: 0.8em;
+}
+
 #editContent .saving {
/* have a cross-browser alpha overlay, see 
http://www.quirksmode.org/css/opacity.html */
opacity: 0.95;


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [83338] trunk/extensions/InlineEditor

2011-03-05 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83338

Revision: 83338
Author:   janpaul123
Date: 2011-03-05 23:30:09 + (Sat, 05 Mar 2011)
Log Message:
---
Fixes a few things:

* Bug 27386: An advanced bar is introduced with a user option, which includes 
undo and redo buttons, minor edit, watch this page.
* Bug 27770: Partly solved. Only tabindexes have to be set more carefully.
* Bug 27853: Partly solved. Only the font face and size have to be fixed, as 
they are not consistent with the current interface.
* Some more editing messages and options are respected (see bug 27167).

Modified Paths:
--
trunk/extensions/InlineEditor/ExtendedEditPage.class.php
trunk/extensions/InlineEditor/InlineEditor.class.php
trunk/extensions/InlineEditor/InlineEditor.i18n.php
trunk/extensions/InlineEditor/InlineEditor.php
trunk/extensions/InlineEditor/jquery.inlineEditor.css
trunk/extensions/InlineEditor/jquery.inlineEditor.editors.basic.css
trunk/extensions/InlineEditor/jquery.inlineEditor.editors.basic.js
trunk/extensions/InlineEditor/jquery.inlineEditor.js

Modified: trunk/extensions/InlineEditor/ExtendedEditPage.class.php
===
--- trunk/extensions/InlineEditor/ExtendedEditPage.class.php2011-03-05 
23:06:28 UTC (rev 83337)
+++ trunk/extensions/InlineEditor/ExtendedEditPage.class.php2011-03-05 
23:30:09 UTC (rev 83338)
@@ -12,6 +12,9 @@
 */
public function initInlineEditor( $inlineEditor ) {
global $wgRequest, $wgOut;
+   
+   $intro = '';
+   
$this-importFormData( $wgRequest );
 
if ( !empty( $this-section ) ) return false;
@@ -65,13 +68,13 @@
$wgOut-clearHTML();
if ( $this-formtype == 'initial' || $this-firsttime ) {
$this-showIntro();
-   $inlineEditor-setIntro( $wgOut-getHTML() );
+   $intro .= $wgOut-getHTML();
$wgOut-clearHTML();
}

if ( 'initial' == $this-formtype || 'preview' == 
$this-formtype || $this-firsttime ) {
if ( $this-initialiseForm() !== false ) {
-   return true;
+   // first init some other stuff (below)
}
else {
return false;
@@ -84,12 +87,27 @@
return false;
}
else {
-   return true;
+   // first init some other stuff (below)
}
}
else {
return false;
}
+   
+   $wgOut-setRobotPolicy( 'noindex,nofollow' );
+   $wgOut-setArticleRelated( true );
+
+   if ( $this-showHeader() === false ) {
+   $wgOut-clearHTML();
+   return false;
+   }
+   
+   $intro .= $wgOut-getHTML();
+   $wgOut-clearHTML();
+   
+   $inlineEditor-setIntro( $intro );
+   
+   return true;
}
 
/**
@@ -107,6 +125,14 @@
public function getSummary() {
return $this-summary;
}
+   
+   public function getMinorEdit() {
+   return $this-minoredit;
+   }
+   
+   public function getWatchThis() {
+   return $this-watchthis;
+   }
 
/**
 * Get the URL to submit to, with some options in the URL that are 
usually hidden fields
@@ -122,8 +148,6 @@
);
 
if ( $this-scrolltop ) $options['wpScrolltop'] = 1;
-   if ( $this-minoredit ) $options['wpMinorEdit'] = 1;
-   if ( $this-watchthis ) $options['wpWatchthis'] = 1;
 
return $this-mTitle-getLocalURL( $options );
}

Modified: trunk/extensions/InlineEditor/InlineEditor.class.php
===
--- trunk/extensions/InlineEditor/InlineEditor.class.php2011-03-05 
23:06:28 UTC (rev 83337)
+++ trunk/extensions/InlineEditor/InlineEditor.class.php2011-03-05 
23:30:09 UTC (rev 83338)
@@ -24,7 +24,7 @@
public static function mediaWikiPerformAction( $output, $article, 
$title, $user, $request, $wiki) {
global $wgHooks, $wgInlineEditorEnableGlobal;

-   if ( $user-getOption( 'inline-editor-enabled' ) != true  
!$wgInlineEditorEnableGlobal ) {
+   if ( !$user-getOption( 'inline-editor-enabled' )  
!$wgInlineEditorEnableGlobal ) {
return true;
}
 
@@ -144,11 +144,21 @@
 * @param

[MediaWiki-CVS] SVN: [83211] trunk/extensions/InlineEditor

2011-03-04 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83211

Revision: 83211
Author:   janpaul123
Date: 2011-03-04 11:27:18 + (Fri, 04 Mar 2011)
Log Message:
---
Fixes bug 27388, and should fix a bug with some hooks being run incorrectly on 
some installations.

Modified Paths:
--
trunk/extensions/InlineEditor/InlineEditor.class.php
trunk/extensions/InlineEditor/InlineEditorText.class.php
trunk/extensions/InlineEditor/jquery.inlineEditor.js

Modified: trunk/extensions/InlineEditor/InlineEditor.class.php
===
--- trunk/extensions/InlineEditor/InlineEditor.class.php2011-03-04 
07:41:07 UTC (rev 83210)
+++ trunk/extensions/InlineEditor/InlineEditor.class.php2011-03-04 
11:27:18 UTC (rev 83211)
@@ -12,6 +12,7 @@
const REASON_ADVANCED = 2;  ///  reason is editing an 'advanced' 
page, whatever that may be
 
private $section;   ///  Section number to 
scroll to if the user chooses to edit a specific section
+   private $editWarning;   ///  boolean that shows if the 
editWarning message of the Vector Extension is enabled
private $article;   ///  Article object to edit
private $extendedEditPage;  ///  ExtendedEditPage object we're 
using to handle editor logic
 
@@ -70,6 +71,9 @@
unset( $_GET['section'] );
unset( $_POST['section'] );
$request-setVal( 'section', null );
+   
+   // set a warning when leaving the page if necessary
+   $editor-setEditWarning( $user-getOption( 'useeditwarning' ) 
== 1 );
 
if ( $editor-render( $output ) ) {
return false;
@@ -230,6 +234,7 @@
$this-renderScripts( $output );
$this-renderInitialState( $output, $text );
$this-renderScroll( $output, $parserOutput );
+   $this-renderEditWarning( $output );

// hook into SiteNoticeBefore to display the two boxes 
above the title
// @todo: fix this in core, make sure that anything can 
be inserted above the title, outside #siteNotice
@@ -258,6 +263,14 @@
}

/**
+* Set whether or not to use the editWarning utility of the Vector 
Extension
+* @param $value Boolean
+*/
+   public function setEditWarning( $value ) {
+   $this-editWarning = $value;
+   }
+   
+   /**
 * Add the preference in the user preferences
 * @param $user
 * @param $preferences
@@ -332,6 +345,22 @@
}

/**
+* Render the edit warning script
+*
+* @param $output OutputPage
+* @param $parserOutput ParserOutput
+*/
+   private function renderEditWarning( $output ) {
+   if ( $this-editWarning ) {
+   $output-addInlineScript(
+   'jQuery( document ).ready( function() {
+   jQuery.inlineEditor.enableEditWarning();
+   } );'
+   );  
+   }
+   }
+   
+   /**
 * Get an anchor to scroll to, or null
 * @param $parserOutput ParserOutput
 * @return string or null

Modified: trunk/extensions/InlineEditor/InlineEditorText.class.php
===
--- trunk/extensions/InlineEditor/InlineEditorText.class.php2011-03-04 
07:41:07 UTC (rev 83210)
+++ trunk/extensions/InlineEditor/InlineEditorText.class.php2011-03-04 
11:27:18 UTC (rev 83211)
@@ -59,9 +59,9 @@

if( $this-changedNode != $this-root ) {
$markedWiki = $this-changedNode-render();
-   if( wfRunHooks( 'InlineEditorPartialBeforeParse', 
array( $markedWiki ) ) ) {
+   if( wfRunHooks( 'InlineEditorPartialBeforeParse', 
array( $markedWiki ) ) ) {
$output = $this-parse( $markedWiki );
-   if( wfRunHooks( 
'InlineEditorPartialAfterParse', array( $output ) ) ) {
+   if( wfRunHooks( 
'InlineEditorPartialAfterParse', array( $output ) ) ) {
return array( 'id' = 
$this-changedNode-getId(), 'html' = $output-getText() );
}
}

Modified: trunk/extensions/InlineEditor/jquery.inlineEditor.js
===
--- trunk/extensions/InlineEditor/jquery.inlineEditor.js2011-03-04 
07:41:07 UTC (rev 83210)
+++ trunk/extensions/InlineEditor/jquery.inlineEditor.js2011-03-04 
11:27:18 UTC (rev 83211)
@@ -5,9 +5,10

[MediaWiki-CVS] SVN: [83213] trunk/extensions/Cite/Cite_body.php

2011-03-04 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83213

Revision: 83213
Author:   janpaul123
Date: 2011-03-04 11:45:22 + (Fri, 04 Mar 2011)
Log Message:
---
Followup of r82891 and r82894. Fixes hook for InlineEditor, which forces a page 
reparse when either a ref or references tag shows up. Doesn't affect normal 
behaviour when not using InlineEditor.

Modified Paths:
--
trunk/extensions/Cite/Cite_body.php

Modified: trunk/extensions/Cite/Cite_body.php
===
--- trunk/extensions/Cite/Cite_body.php 2011-03-04 11:36:47 UTC (rev 83212)
+++ trunk/extensions/Cite/Cite_body.php 2011-03-04 11:45:22 UTC (rev 83213)
@@ -71,6 +71,12 @@
 * @var int
 */
var $mInCnt = 0;
+   
+   /**
+* Counter to track the total number of (useful) calls to either the
+* ref or references tag hook
+*/
+   var $mCallCnt = 0;
 
/**
 * The backlinks, in order, to pass as $3 to
@@ -151,6 +157,7 @@
if ( $this-mInCite ) {
return htmlspecialchars( ref$str/ref );
} else {
+   $this-mCallCnt++;
$this-mInCite = true;
$ret = $this-guardedRef( $str, $argv, $parser );
$this-mInCite = false;
@@ -507,6 +514,7 @@
return htmlspecialchars( 
references$str/references );
}
} else {
+   $this-mCallCnt++;
$this-mInReferences = true;
$ret = $this-guardedReferences( $str, $argv, $parser );
$this-mInReferences = false;
@@ -984,6 +992,7 @@
$this-mGroupCnt = array();
$this-mOutCnt = - 1;
$this-mInCnt = 0;
+   $this-mCallCnt = 0;
$this-mRefs = array();
$this-mReferencesErrors = array();
$this-mRefCallStack = array();
@@ -1015,11 +1024,11 @@
}

/**
-* Hook for the InlineEditor extension. If any reference is in the 
text, the entire
+* Hook for the InlineEditor extension. If any ref or reference 
reference tag is in the text, the entire
 * page should be reparsed, so we return false in that case.
 */
-   function checkAnyRefs( $output ) {
-   return ( count( $this-mRefs ) = 0 );
+   function checkAnyCalls( $output ) {
+   return ( $this-mCallCnt = 0 );
}
 
/**
@@ -1033,7 +1042,7 @@
 
$wgHooks['ParserClearState'][] = array( 
self::$instance, 'clearState' );
$wgHooks['ParserBeforeTidy'][] = array( 
self::$instance, 'checkRefsNoReferences' );
-   $wgHooks['InlineEditorPartialAfterParse'][] = array( 
self::$instance, 'checkAnyRefs' );
+   $wgHooks['InlineEditorPartialAfterParse'][] = array( 
self::$instance, 'checkAnyCalls' );
}
$parser-setHook( 'ref' , array( self::$instance, 'ref' ) );
$parser-setHook( 'references' , array( self::$instance, 
'references' ) );


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [83222] trunk/extensions/InlineEditor

2011-03-04 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83222

Revision: 83222
Author:   janpaul123
Date: 2011-03-04 17:06:16 + (Fri, 04 Mar 2011)
Log Message:
---
This should fix bug 27167, but testing is needed to verify all messages are 
handled properly. Also some cleanup and restructuring.

Modified Paths:
--
trunk/extensions/InlineEditor/ExtendedEditPage.class.php
trunk/extensions/InlineEditor/InlineEditor.class.php
trunk/extensions/InlineEditor/InlineEditor.i18n.php
trunk/extensions/InlineEditor/InlineEditorMarking.class.php
trunk/extensions/InlineEditor/InlineEditorNode.class.php
trunk/extensions/InlineEditor/InlineEditorRecommended.php
trunk/extensions/InlineEditor/InlineEditorRoot.class.php
trunk/extensions/InlineEditor/InlineEditorText.class.php
trunk/extensions/InlineEditor/jquery.inlineEditor.css
trunk/extensions/InlineEditor/jquery.inlineEditor.editors.basic.js
trunk/extensions/InlineEditor/jquery.inlineEditor.js

Added Paths:
---
trunk/extensions/InlineEditor/jquery.inlineEditor.api.js

Removed Paths:
-
trunk/extensions/InlineEditor/FullEditor/

Modified: trunk/extensions/InlineEditor/ExtendedEditPage.class.php
===
--- trunk/extensions/InlineEditor/ExtendedEditPage.class.php2011-03-04 
16:24:22 UTC (rev 83221)
+++ trunk/extensions/InlineEditor/ExtendedEditPage.class.php2011-03-04 
17:06:16 UTC (rev 83222)
@@ -10,7 +10,7 @@
 * Inits the edit page for the InlineEditor.
 * This is largely a copy-paste from EditPage::edit(), with some 
specific changes.
 */
-   public function initInlineEditor() {
+   public function initInlineEditor( $inlineEditor ) {
global $wgRequest, $wgOut;
$this-importFormData( $wgRequest );
 
@@ -65,10 +65,8 @@
$wgOut-clearHTML();
if ( $this-formtype == 'initial' || $this-firsttime ) {
$this-showIntro();
-   if ( $wgOut-getHTML() != '' ) {
-   $wgOut-clearHTML();
-   return false;
-   }
+   $inlineEditor-setIntro( $wgOut-getHTML() );
+   $wgOut-clearHTML();
}

if ( 'initial' == $this-formtype || 'preview' == 
$this-formtype || $this-firsttime ) {

Modified: trunk/extensions/InlineEditor/InlineEditor.class.php
===
--- trunk/extensions/InlineEditor/InlineEditor.class.php2011-03-04 
16:24:22 UTC (rev 83221)
+++ trunk/extensions/InlineEditor/InlineEditor.class.php2011-03-04 
17:06:16 UTC (rev 83222)
@@ -15,6 +15,7 @@
private $editWarning;   ///  boolean that shows if the 
editWarning message of the Vector Extension is enabled
private $article;   ///  Article object to edit
private $extendedEditPage;  ///  ExtendedEditPage object we're 
using to handle editor logic
+   private $intro; ///  Intro message(s) that should be 
displayed on top
 
/**
 * Main entry point, hooks into MediaWikiPerformAction.
@@ -163,7 +164,7 @@
 */
public static function ajaxPreview( $json, $pageName ) {
$title   = Title::newFromText( $pageName );
-   $article = Article::newFromId( $title-getArticleId() );
+   $article = new Article( $title );
 
$editor = new InlineEditor( $article );
return $editor-preview( $json );
@@ -213,7 +214,7 @@
 
// try to initialise, or else return false, which will spawn an 
'advanced page' notice
$this-extendedEditPage = new ExtendedEditPage( $this-article 
);
-   if ( $this-extendedEditPage-initInlineEditor() ) {
+   if ( $this-extendedEditPage-initInlineEditor( $this ) ) {
// IMPORTANT: if the page was being saved, the script 
has been terminated by now!!

// have the different kind of editors register 
themselves
@@ -235,6 +236,7 @@
$this-renderInitialState( $output, $text );
$this-renderScroll( $output, $parserOutput );
$this-renderEditWarning( $output );
+   $this-renderOpenFullEditor( $output );

// hook into SiteNoticeBefore to display the two boxes 
above the title
// @todo: fix this in core, make sure that anything can 
be inserted above the title, outside #siteNotice
@@ -271,6 +273,14 @@
}

/**
+* Set the intro message(s) that should be displayed on top of the page.
+* @param $intro String
+*/
+   public function

[MediaWiki-CVS] SVN: [83242] trunk/extensions/InlineEditor

2011-03-04 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83242

Revision: 83242
Author:   janpaul123
Date: 2011-03-04 20:39:38 + (Fri, 04 Mar 2011)
Log Message:
---
Fixes bug 27169.

Modified Paths:
--
trunk/extensions/InlineEditor/InlineEditor.class.php
trunk/extensions/InlineEditor/InlineEditorText.class.php

Modified: trunk/extensions/InlineEditor/InlineEditor.class.php
===
--- trunk/extensions/InlineEditor/InlineEditor.class.php2011-03-04 
20:20:28 UTC (rev 83241)
+++ trunk/extensions/InlineEditor/InlineEditor.class.php2011-03-04 
20:39:38 UTC (rev 83242)
@@ -45,13 +45,7 @@
self::$fallbackReason = self::REASON_BROWSER;
return true;
}
-
-   // terminate if we consider this page 'advanced'
-   if ( self::isAdvancedPage( $article, $title ) ) {
-   self::$fallbackReason = self::REASON_ADVANCED;
-   return true;
-   }
-
+   
// start the session if needed
if ( session_id() == '' ) {
wfSetupSession();
@@ -82,6 +76,10 @@
else {
// if rendering fails for some reason, terminate and 
show the advanced page notice
self::$fallbackReason = self::REASON_ADVANCED;
+   
+   // don't leave traces of HTML behind
+   $output-clearHTML();
+   
return true;
}
}
@@ -139,22 +137,21 @@
}
return true;
}
-
+   
/**
-* Check if the page is 'advanced'. For now, that means it has to be in 
an allowed namespace.
-* @param $article Article
-* @param $title Title
-* @return bool
+* Add the preference in the user preferences with the GetPreferences 
hook.
+* @param $user
+* @param $preferences
 */
-   private static function isAdvancedPage( $article, $title ) {
-   global $wgInlineEditorAllowedNamespaces;
-   if ( !empty( $wgInlineEditorAllowedNamespaces )
-!in_array( $title-getNamespace(), 
$wgInlineEditorAllowedNamespaces ) ) {
-   return true;
-   }
-   return false;
+   public static function getPreferences( $user, $preferences ) {
+   $preferences['inline-editor-enabled'] = array(
+   'type' = 'check',
+   'section' = 'editing/labs',
+   'label-message' = 'inline-editor-enable-preference',
+   );
+   return true;
}
-
+   
/**
 * Entry point for the 'Preview' function through ajax.
 * No real point in securing this, as nothing is actually saved.
@@ -219,6 +216,9 @@

// have the different kind of editors register 
themselves
wfRunHooks( 'InlineEditorDefineEditors', array( $this, 
$output ) );
+   
+   // don't do any marking if this is an advanced page
+   if( $this-isAdvancedPage() ) $text-setDisableMarking( 
true );
 
// load the wikitext into the InlineEditorText object
$text-loadFromWikiText( 
$this-extendedEditPage-getWikiText() );
@@ -281,18 +281,16 @@
}

/**
-* Add the preference in the user preferences
-* @param $user
-* @param $preferences
+* Check if the page is 'advanced'. For now, that means it has to be in 
an allowed namespace.
+* @return bool
 */
-   
-   public static function getPreferences( $user, $preferences ) {
-   $preferences['inline-editor-enabled'] = array(
-   'type' = 'check',
-   'section' = 'editing/labs',
-   'label-message' = 'inline-editor-enable-preference',
-   );
-   return true;
+   private function isAdvancedPage() {
+   global $wgInlineEditorAllowedNamespaces;
+   if ( !empty( $wgInlineEditorAllowedNamespaces )
+!in_array( 
$this-article-getTitle()-getNamespace(), $wgInlineEditorAllowedNamespaces ) 
) {
+   return true;
+   }
+   return false;
}

/**

Modified: trunk/extensions/InlineEditor/InlineEditorText.class.php
===
--- trunk/extensions/InlineEditor/InlineEditorText.class.php2011-03-04 
20:20:28 UTC (rev 83241)
+++ trunk/extensions/InlineEditor/InlineEditorText.class.php2011-03-04 
20:39:38

[MediaWiki-CVS] SVN: [83012] trunk/extensions/InlineEditor/jquery.inlineEditor.js

2011-03-01 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83012

Revision: 83012
Author:   janpaul123
Date: 2011-03-01 11:59:26 + (Tue, 01 Mar 2011)
Log Message:
---
Minor architecture cleanup

Modified Paths:
--
trunk/extensions/InlineEditor/jquery.inlineEditor.js

Modified: trunk/extensions/InlineEditor/jquery.inlineEditor.js
===
--- trunk/extensions/InlineEditor/jquery.inlineEditor.js2011-03-01 
10:37:26 UTC (rev 83011)
+++ trunk/extensions/InlineEditor/jquery.inlineEditor.js2011-03-01 
11:59:26 UTC (rev 83012)
@@ -77,13 +77,20 @@
},

/**
+* Cancels any open editor.
+*/
+   cancel: function() {
+   for( var optionNr in $.inlineEditor.editors ) {
+   $.inlineEditor.editors[optionNr].cancel();
+   }
+   },
+   
+   /**
 * Reloads the current editor and finish some things in the HTML.
 */
reload: function() {
// cancel all editing
-   for( var optionNr in $.inlineEditor.editors ) {
-   $.inlineEditor.editors[optionNr].cancel();
-   }
+   $.inlineEditor.cancel();

// reload the editors
for( var optionNr in $.inlineEditor.editors ) {


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [82891] trunk/extensions/Cite/Cite_body.php

2011-02-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82891

Revision: 82891
Author:   janpaul123
Date: 2011-02-27 14:50:56 + (Sun, 27 Feb 2011)
Log Message:
---
Added hook to support partial rendering for the InlineEditor extension. Doesn't 
affect normal behaviour.

Modified Paths:
--
trunk/extensions/Cite/Cite_body.php

Modified: trunk/extensions/Cite/Cite_body.php
===
--- trunk/extensions/Cite/Cite_body.php 2011-02-27 13:41:03 UTC (rev 82890)
+++ trunk/extensions/Cite/Cite_body.php 2011-02-27 14:50:56 UTC (rev 82891)
@@ -1013,6 +1013,14 @@
}
return true;
}
+   
+   /**
+* Hook for the InlineEditor extension. If any reference is in the 
text, the entire
+* page should be reparsed, so we return false in that case.
+*/
+   function checkAnyRefs( $output ) {
+   return ( empty( $this-mRefs ) );
+   }
 
/**
 * Initialize the parser hooks
@@ -1025,6 +1033,7 @@
 
$wgHooks['ParserClearState'][] = array( 
self::$instance, 'clearState' );
$wgHooks['ParserBeforeTidy'][] = array( 
self::$instance, 'checkRefsNoReferences' );
+   $wgHooks['InlineEditorPartialAfterParse'][] = array( 
self::$instance, 'checkAnyRefs' );
}
$parser-setHook( 'ref' , array( self::$instance, 'ref' ) );
$parser-setHook( 'references' , array( self::$instance, 
'references' ) );


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [82892] trunk/extensions/InlineEditor

2011-02-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82892

Revision: 82892
Author:   janpaul123
Date: 2011-02-27 14:54:52 + (Sun, 27 Feb 2011)
Log Message:
---
Moved reference detection to Cite extension (per r82891).

Modified Paths:
--
trunk/extensions/InlineEditor/InlineEditor.class.php
trunk/extensions/InlineEditor/InlineEditor.php

Modified: trunk/extensions/InlineEditor/InlineEditor.class.php
===
--- trunk/extensions/InlineEditor/InlineEditor.class.php2011-02-27 
14:50:56 UTC (rev 82891)
+++ trunk/extensions/InlineEditor/InlineEditor.class.php2011-02-27 
14:54:52 UTC (rev 82892)
@@ -430,18 +430,4 @@
 
return Html::rawElement( 'div', array( 'class' = 'editbox' ), 
$form );
}
-
-   /**
-* Make sure the entire page rerenders when rendering a reference.
-* 
-* @todo: FIXME: This should be moved over to the Cite extension, and 
something like this should
-* be included in other extensions as well. In the future, something 
smarter should be
-* implemented, to be able to only rerender the dependencies and not 
the entire page.
-*  
-* @param $markedWiki string
-* @return bool
-*/
-   public static function partialRenderCite( $markedWiki ) {
-   return ( preg_match( '/ref[^\/]*?.*?\/ref|ref.*?\//is', 
$markedWiki) = 0) ;
-   }
 }

Modified: trunk/extensions/InlineEditor/InlineEditor.php
===
--- trunk/extensions/InlineEditor/InlineEditor.php  2011-02-27 14:50:56 UTC 
(rev 82891)
+++ trunk/extensions/InlineEditor/InlineEditor.php  2011-02-27 14:54:52 UTC 
(rev 82892)
@@ -46,7 +46,6 @@
 
 $wgHooks['InlineEditorPartialBeforeParse']= array();
 $wgHooks['InlineEditorPartialAfterParse'] = array();
-$wgHooks['InlineEditorPartialBeforeParse'][]  = 
'InlineEditor::partialRenderCite';
 
 // i18n messages
 $wgExtensionMessagesFiles['InlineEditor'] = $dir . 
'InlineEditor.i18n.php';


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [82894] trunk/extensions/Cite/Cite_body.php

2011-02-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82894

Revision: 82894
Author:   janpaul123
Date: 2011-02-27 15:30:35 + (Sun, 27 Feb 2011)
Log Message:
---
Fixed call per http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82891#c14483

Modified Paths:
--
trunk/extensions/Cite/Cite_body.php

Modified: trunk/extensions/Cite/Cite_body.php
===
--- trunk/extensions/Cite/Cite_body.php 2011-02-27 15:23:41 UTC (rev 82893)
+++ trunk/extensions/Cite/Cite_body.php 2011-02-27 15:30:35 UTC (rev 82894)
@@ -1019,7 +1019,7 @@
 * page should be reparsed, so we return false in that case.
 */
function checkAnyRefs( $output ) {
-   return ( empty( $this-mRefs ) );
+   return ( count( $this-mRefs ) = 0 );
}
 
/**


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [82900] trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs. js

2011-02-27 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82900

Revision: 82900
Author:   janpaul123
Date: 2011-02-27 17:14:01 + (Sun, 27 Feb 2011)
Log Message:
---
Fixes bug when having multiple textareas, which is caused by the fact that 
dialogs are kept in memory for performance, even when selecting a different 
textarea.

Modified Paths:
--
trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js

Modified: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js
===
--- trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js
2011-02-27 16:36:22 UTC (rev 82899)
+++ trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js
2011-02-27 17:14:01 UTC (rev 82900)
@@ -84,7 +84,12 @@
}
}
}
-   if ( !filtered  $.wikiEditor.isSupported( module )  
$( '#' + module.id ).size() == 0 ) {
+   // If the dialog already exists, but for another 
textarea, simply remove it
+   var $existingDialog = $( '#' + module.id );
+   if ( $existingDialog.size()  0  
$existingDialog.data( 'context' ).$textarea != context.$textarea ) {
+   $existingDialog.remove();
+   }
+   if ( !filtered  $.wikiEditor.isSupported( module )  
$existingDialog.size() == 0 ) {
$.wikiEditor.modules.dialogs.modules[mod] = 
module;
// If this dialog requires the iframe, set it up
if ( typeof context.$iframe == 'undefined'  
$.wikiEditor.isRequired( module, 'iframe' ) ) {


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [82863] trunk/extensions/InlineEditor/InlineEditor.class.php

2011-02-26 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82863

Revision: 82863
Author:   janpaul123
Date: 2011-02-26 18:49:07 + (Sat, 26 Feb 2011)
Log Message:
---
Fixed bug 26968 again (regression)

Modified Paths:
--
trunk/extensions/InlineEditor/InlineEditor.class.php

Modified: trunk/extensions/InlineEditor/InlineEditor.class.php
===
--- trunk/extensions/InlineEditor/InlineEditor.class.php2011-02-26 
17:04:26 UTC (rev 82862)
+++ trunk/extensions/InlineEditor/InlineEditor.class.php2011-02-26 
18:49:07 UTC (rev 82863)
@@ -325,7 +325,7 @@
if( $scrollAnchor !== null ) {
$output-addInlineScript(
'jQuery( document ).ready( function() {
-   $( html,body ).animate( { scrollTop: 
$( #' . $scrollAnchor .' ).offset().top}, slow ); }
+   $( html,body ).animate( { scrollTop: 
$( #' . $scrollAnchor .' ).offset().top }, slow );
} );'
);
}


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [82769] trunk/extensions/WikiEditor

2011-02-24 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82769

Revision: 82769
Author:   janpaul123
Date: 2011-02-25 00:01:57 + (Fri, 25 Feb 2011)
Log Message:
---
1. Re-introduces check if the browser supports the dialogs, which was removed 
for no apparent reason in r74276.

2. Makes the isEnabled function public, to allow other extensions to use the 
same configuration settings as WikiEditor.

Modified Paths:
--
trunk/extensions/WikiEditor/WikiEditor.hooks.php
trunk/extensions/WikiEditor/modules/ext.wikiEditor.dialogs.js

Modified: trunk/extensions/WikiEditor/WikiEditor.hooks.php
===
--- trunk/extensions/WikiEditor/WikiEditor.hooks.php2011-02-25 00:01:06 UTC 
(rev 82768)
+++ trunk/extensions/WikiEditor/WikiEditor.hooks.php2011-02-25 00:01:57 UTC 
(rev 82769)
@@ -158,9 +158,17 @@
),
);

-   /* Protected Static Methods */
+   /* Static Methods */

-   protected static function isEnabled( $name ) {
+   /**
+* Checks if a certain option is enabled
+*
+* This method is public to allow other extensions that use WikiEditor 
to use the
+* same configuration as WikiEditor itself
+*
+* @param $name Name of the feature, should be a key of $features
+*/
+   public static function isEnabled( $name ) {
global $wgWikiEditorFeatures, $wgUser;

// Features with global set to true are always enabled
@@ -183,8 +191,6 @@
return false;
}

-   /* Static Methods */
-   
/**
 * EditPage::showEditForm:initial hook
 * 

Modified: trunk/extensions/WikiEditor/modules/ext.wikiEditor.dialogs.js
===
--- trunk/extensions/WikiEditor/modules/ext.wikiEditor.dialogs.js   
2011-02-25 00:01:06 UTC (rev 82768)
+++ trunk/extensions/WikiEditor/modules/ext.wikiEditor.dialogs.js   
2011-02-25 00:01:57 UTC (rev 82769)
@@ -3,11 +3,10 @@
  */
 
 $( document ).ready( function() {
-   /*
if ( !$.wikiEditor.isSupported( $.wikiEditor.modules.dialogs ) ) {
return;
}
-   */
+   
// Replace icons
$.wikiEditor.modules.dialogs.config.replaceIcons( $( '#wpTextbox1' ) );



___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [82776] trunk/extensions/InlineEditor

2011-02-24 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82776

Revision: 82776
Author:   janpaul123
Date: 2011-02-25 01:16:57 + (Fri, 25 Feb 2011)
Log Message:
---
Small fixes, i18n. Also fixes bug 27390.

Modified Paths:
--
trunk/extensions/InlineEditor/InlineEditor.i18n.php
trunk/extensions/InlineEditor/jquery.inlineEditor.editors.basic.js
trunk/extensions/InlineEditor/jquery.inlineEditor.js

Modified: trunk/extensions/InlineEditor/InlineEditor.i18n.php
===
--- trunk/extensions/InlineEditor/InlineEditor.i18n.php 2011-02-25 01:11:09 UTC 
(rev 82775)
+++ trunk/extensions/InlineEditor/InlineEditor.i18n.php 2011-02-25 01:16:57 UTC 
(rev 82776)
@@ -28,6 +28,8 @@
'inline-editor-editmodes-undo' = 'Undo',
'inline-editor-editmodes-redo' = 'Redo',
'inline-editor-enable-preference' = 'Enable inline editing',
+   'inline-editor-preview' = 'Preview',
+   'inline-editor-cancel' = 'Cancel',
 );
 
 /** Language descriptions
@@ -62,4 +64,6 @@
 unambiguous: it will be shown to the world. On the other hand, using the word 
Publish may have legal
 consequences in some countries, which should be looked into.',
'inline-editor-enable-preference' = '',
+   'inline-editor-preview' = '',
+   'inline-editor-cancel' = '',
 );

Modified: trunk/extensions/InlineEditor/jquery.inlineEditor.editors.basic.js
===
--- trunk/extensions/InlineEditor/jquery.inlineEditor.editors.basic.js  
2011-02-25 01:11:09 UTC (rev 82775)
+++ trunk/extensions/InlineEditor/jquery.inlineEditor.editors.basic.js  
2011-02-25 01:16:57 UTC (rev 82776)
@@ -35,9 +35,12 @@
$input.text( wiki );

// build preview and cancel buttons and add click events
-   var $preview = $( 'input type=button value=Preview 
class=preview/' );
-   var $cancel = $( 'input type=button value=Cancel 
class=cancel/' );
+   var $preview = $( 'input type=button class=preview/' );
+   $preview.attr( 'value', mediaWiki.msg( 'inline-editor-preview' 
) );
$preview.click( $.inlineEditor.editors.basic.clickPreview );
+   
+   var $cancel = $( 'input type=button class=cancel/' );
+   $cancel.attr( 'value', mediaWiki.msg( 'inline-editor-cancel' ) 
);
$cancel.click( $.inlineEditor.editors.basic.clickCancel );

// build a div for the buttons
@@ -156,7 +159,7 @@
 * Reload the editor.
 */
reload: function() {
-   $.inlineEditor.editors.basic.bindEvents( $( 
'.inlineEditorElement .inlineEditorBasic' ) );
+   $.inlineEditor.editors.basic.bindEvents( $( 
'.inlineEditorBasic' ) );
},

/**

Modified: trunk/extensions/InlineEditor/jquery.inlineEditor.js
===
--- trunk/extensions/InlineEditor/jquery.inlineEditor.js2011-02-25 
01:11:09 UTC (rev 82775)
+++ trunk/extensions/InlineEditor/jquery.inlineEditor.js2011-02-25 
01:16:57 UTC (rev 82776)
@@ -151,12 +151,9 @@
},

/**
-* Publishes the document in its current state.
+* Submit event, adds the json to the hidden field
 */
-   publish: function( event ) {
-   event.stopPropagation();
-   event.preventDefault();
-   
+   submit: function( event ) { 
// get the wikitext from the state as it's currently on the 
screen
var data = {
'object': 
$.inlineEditor.states[$.inlineEditor.currentState].object
@@ -165,6 +162,12 @@

// set and send the form
$( '#json' ).val( json );
+   },
+   
+   /**
+* Publishes the document
+*/
+   publish: function() {
$( '#editForm' ).submit();
},

@@ -172,6 +175,7 @@
 * Initializes the editor.
 */
init : function() {
+   $( '#editForm' ).submit( $.inlineEditor.submit );
$( '#publish' ).click( $.inlineEditor.publish );
//$( '#undo' ).click( $.inlineEditor.undo );
//$( '#redo' ).click( $.inlineEditor.redo );


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [82637] trunk/extensions/InlineEditor

2011-02-22 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82637

Revision: 82637
Author:   janpaul123
Date: 2011-02-22 22:35:30 + (Tue, 22 Feb 2011)
Log Message:
---
Actually fixes bug 27165 and 27168, plus some minor stuff.

Modified Paths:
--
trunk/extensions/InlineEditor/InlineEditor.class.php
trunk/extensions/InlineEditor/InlineEditor.i18n.php
trunk/extensions/InlineEditor/InlineEditor.php
trunk/extensions/InlineEditor/InlineEditorNode.class.php
trunk/extensions/InlineEditor/jquery.inlineEditor.basicEditor.js
trunk/extensions/InlineEditor/jquery.inlineEditor.js

Added Paths:
---
trunk/extensions/InlineEditor/jquery.inlineEditor.configWikiEditor.js

Modified: trunk/extensions/InlineEditor/InlineEditor.class.php
===
--- trunk/extensions/InlineEditor/InlineEditor.class.php2011-02-22 
22:30:39 UTC (rev 82636)
+++ trunk/extensions/InlineEditor/InlineEditor.class.php2011-02-22 
22:35:30 UTC (rev 82637)
@@ -22,7 +22,11 @@
 * Checks whether or not to spawn the editor, and does so if necessary.
 */
public static function mediaWikiPerformAction( $output, $article, 
$title, $user, $request, $wiki) {
-   global $wgHooks;
+   global $wgHooks, $wgInlineEditorEnableGlobal;
+   
+   if ( $user-getOption( 'inline-editor-enabled' ) != true  
!$wgInlineEditorEnableGlobal ) {
+   return true;
+   }
 
// return if the action is not 'edit' or if it's disabled
// @todo: FIXME: we don't want to break with older versions 
just yet,
@@ -228,6 +232,10 @@
$output-addScriptFile( $wgExtensionAssetsPath . 
/InlineEditor/jquery.inlineEditor.basicEditor.js?0 );
$output-addScriptFile( $wgExtensionAssetsPath . 
/InlineEditor/jquery-ui-effects-1.8.4.min.js?0 );

+   // include the JS file needed for the WikiEditor toolbar
+   // @todo: FIXME: get the configuration from the 
WikiEditor extension
+   $output-addScriptFile( $wgExtensionAssetsPath . 
/InlineEditor/jquery.inlineEditor.configWikiEditor.js?0 );
+
// include the required JS files for scrolling
$output-addScriptFile( $wgExtensionAssetsPath . 
/InlineEditor/jquery.sectionScroller.js?0 );

@@ -303,6 +311,21 @@
}

/**
+* Add the preference in the user preferences
+* @param $user
+* @param $preferences
+*/
+   
+   public static function getPreferences( $user, $preferences ) {
+   $preferences['inline-editor-enabled'] = array(
+   'type' = 'check',
+   'section' = 'editing/labs',
+   'label-message' = 'inline-editor-enable-preference',
+   );
+   return true;
+   }
+   
+   /**
 * Get an anchor to scroll to, or null
 * @param $parserOutput ParserOutput
 * @return string or null

Modified: trunk/extensions/InlineEditor/InlineEditor.i18n.php
===
--- trunk/extensions/InlineEditor/InlineEditor.i18n.php 2011-02-22 22:30:39 UTC 
(rev 82636)
+++ trunk/extensions/InlineEditor/InlineEditor.i18n.php 2011-02-22 22:35:30 UTC 
(rev 82637)
@@ -27,6 +27,7 @@
 You can only use the '''full editor''' for this page.,
'inline-editor-editmodes-undo' = 'Undo',
'inline-editor-editmodes-redo' = 'Redo',
+   'inline-editor-enable-preference' = 'Enable inline editing',
 );
 
 /** Language descriptions
@@ -60,5 +61,5 @@
 it be saved into some kind of database, waiting for approval? Publish is
 unambiguous: it will be shown to the world. On the other hand, using the word 
Publish may have legal
 consequences in some countries, which should be looked into.',
-
+   'inline-editor-enable-preference' = '',
 );

Modified: trunk/extensions/InlineEditor/InlineEditor.php
===
--- trunk/extensions/InlineEditor/InlineEditor.php  2011-02-22 22:30:39 UTC 
(rev 82636)
+++ trunk/extensions/InlineEditor/InlineEditor.php  2011-02-22 22:35:30 UTC 
(rev 82637)
@@ -42,6 +42,7 @@
 // register hooks
 $wgHooks['MediaWikiPerformAction'][]  = 
'InlineEditor::mediaWikiPerformAction';
 $wgHooks['EditPage::showEditForm:initial'][]  = 
'InlineEditor::showEditForm';
+$wgHooks['GetPreferences'][]  = 
'InlineEditor::getPreferences';
 
 $wgHooks['InlineEditorPartialBeforeParse']= array();
 $wgHooks['InlineEditorPartialAfterParse'] = array();
@@ -54,5 +55,9 @@
 $wgAjaxExportList[]   = 
'InlineEditor::ajaxPreview';
 
 // default options

[MediaWiki-CVS] SVN: [82204] trunk/extensions/InlineEditor

2011-02-15 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82204

Revision: 82204
Author:   janpaul123
Date: 2011-02-16 00:05:56 + (Wed, 16 Feb 2011)
Log Message:
---
Added section scrolling by GRNET developers.

Modified Paths:
--
trunk/extensions/InlineEditor/InlineEditor.class.php
trunk/extensions/InlineEditor/InlineEditor.php

Added Paths:
---
trunk/extensions/InlineEditor/jquery.sectionScroller.js

Modified: trunk/extensions/InlineEditor/InlineEditor.class.php
===
--- trunk/extensions/InlineEditor/InlineEditor.class.php2011-02-15 
23:45:57 UTC (rev 82203)
+++ trunk/extensions/InlineEditor/InlineEditor.class.php2011-02-16 
00:05:56 UTC (rev 82204)
@@ -4,12 +4,16 @@
  * It handles hooks through static functions, and they can spawn an 
InlineEditor object using
  * an article object, and then render like a normal page, or as JSON. Reason 
for this is to be
  * able to pass this object to different hook functions.
+ *
+ * This file was modified by Dimitris Mitropoulos and Dimitris Meimaris (GRNET)
+ * 
  */
 class InlineEditor {
private static $fallbackReason; ///  reason for not using the editor, 
used for showing a message
const REASON_BROWSER  = 1;  ///  reason is an incompatible browser
const REASON_ADVANCED = 2;  ///  reason is editing an 'advanced' 
page, whatever that may be
 
+   private $section;   ///  Section number to 
scroll to if the user chooses to edit a specific section
private $article;   ///  Article object to edit
private $extendedEditPage;  ///  ExtendedEditPage object we're 
using to handle editor logic
 
@@ -17,15 +21,9 @@
 * Main entry point, hooks into MediaWikiPerformAction.
 * Checks whether or not to spawn the editor, and does so if necessary.
 */
-   public static function mediaWikiPerformAction( $output, $article, 
$title, $user, $request, $wiki ) {
+   public static function mediaWikiPerformAction( $output, $article, 
$title, $user, $request, $wiki) {
global $wgHooks;
 
-   // check if the editor could be used on this page, and if so, 
hide the [edit] links
-   if ( self::isValidBrowser()  !self::isAdvancedPage( $article, 
$title ) ) {
-   self::hideEditSection( $output );
-   }
-
-   
// return if the action is not 'edit' or if it's disabled
// @todo: FIXME: we don't want to break with older versions 
just yet,
// but do remove this when the time is there!
@@ -47,11 +45,6 @@
$wgHooks['EditPage::showEditForm:fields'][] = 
'InlineEditor::showEditFormFields';
return true;
}
-   
-   // for now, ignore section edits and just edit the whole page
-   unset( $_GET['section'] );
-   unset( $_POST['section'] );
-   $request-setVal( 'section', null );
 
// terminate if the browser is not supported
if ( !self::isValidBrowser() ) {
@@ -72,6 +65,20 @@

// try to spawn the editor and render the page
$editor = new InlineEditor( $article );
+
+   // set the section to scroll to 
+   if( isset( $_GET['section'] ) ) {
+   $editor-setSection( $_GET['section'] );
+   }
+   elseif( isset( $_POST['section'] ) ) {
+   $editor-setSection( $_POST['section'] );
+   }
+   
+   // unset the section variables so the entire page will be edited
+   unset( $_GET['section'] );
+   unset( $_POST['section'] );
+   $request-setVal( 'section', null );
+
if ( $editor-render( $output ) ) {
return false;
}
@@ -167,15 +174,6 @@
}
 
/**
-* Hide the [edit] links on the page by enabling a piece of CSS 
(instead of screwing with the parser cache).
-* @param $output OutputPage
-*/
-   public static function hideEditSection( $output ) {
-   global $wgExtensionAssetsPath;
-   $output-addExtensionStyle( $wgExtensionAssetsPath . 
/InlineEditor/HideEditSection.css?0 );
-   }
-
-   /**
 * Add a 'fulleditor' hidden input field to the normal edit page
 * @param $editpage EditPage
 * @param $output OutputPage
@@ -204,7 +202,7 @@
 * @param $output OutputPage
 */
public function render( $output ) {
-   global $wgHooks, $wgRequest, $wgExtensionAssetsPath, 
$wgDisableOutputCompression;
+   global $wgHooks, $wgRequest, $wgExtensionAssetsPath;
 
// if the page is being saved

[MediaWiki-CVS] SVN: [80782] trunk/extensions/InlineEditor/InlineEditor.class.php

2011-01-22 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/80782

Revision: 80782
Author:   janpaul123
Date: 2011-01-22 23:53:11 + (Sat, 22 Jan 2011)
Log Message:
---
Minor fixes

Modified Paths:
--
trunk/extensions/InlineEditor/InlineEditor.class.php

Modified: trunk/extensions/InlineEditor/InlineEditor.class.php
===
--- trunk/extensions/InlineEditor/InlineEditor.class.php2011-01-22 
23:34:20 UTC (rev 80781)
+++ trunk/extensions/InlineEditor/InlineEditor.class.php2011-01-22 
23:53:11 UTC (rev 80782)
@@ -25,10 +25,21 @@
self::hideEditSection( $output );
}
 
+   
// return if the action is not 'edit' or if it's disabled
-   if ( $wiki-getAction( $request ) != 'edit' ) {
-   return true;
+   // @todo: FIXME: we don't want to break with older versions 
just yet,
+   // but do remove this when the time is there!
+   if( method_exists( $wiki, 'getAction' ) ) {
+   if( $wiki-getAction( $request ) != 'edit' ) {
+   return true;
+   }
}
+   else {
+   $action = $request-getVal( 'action', 'view' );
+   if ( $action != 'edit' || in_array( $action, 
$wiki-getVal( 'DisabledActions', array() ) ) ) {
+   return true;
+   }
+   }
 
// check if the 'fulleditor' parameter is set either in GET or 
POST
if ( $request-getCheck( 'fulleditor' ) ) {
@@ -193,7 +204,7 @@
 * @param $output OutputPage
 */
public function render( $output ) {
-   global $wgParser, $wgHooks, $wgRequest, $wgExtensionAssetsPath;
+   global $wgParser, $wgHooks, $wgRequest, $wgExtensionAssetsPath, 
$wgDisableOutputCompression;
 
// if the page is being saved, retrieve the wikitext from the 
JSON
if ( $wgRequest-wasPosted() ) {
@@ -235,6 +246,9 @@
$output-addParserOutput( $parserOutput );
$output-setPageTitle( $parserOutput-getTitleText() );

+   // make sure that no compression is used, or the page 
might be corrupted
+   $wgDisableOutputCompression = false;
+   
// convert the text object into an initial state to send
$initial = InlineEditorText::initialState( $text );



___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [80731] trunk/extensions/InlineEditor

2011-01-21 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/80731

Revision: 80731
Author:   janpaul123
Date: 2011-01-21 23:48:35 + (Fri, 21 Jan 2011)
Log Message:
---
Followup to r80717: fixed some browser bugs, added some nice collapsing 
functionality to the algorithm, cleaned some stuff up.

Modified Paths:
--
trunk/extensions/InlineEditor/InlineEditor.class.php
trunk/extensions/InlineEditor/InlineEditorMarking.class.php
trunk/extensions/InlineEditor/InlineEditorText.class.php
trunk/extensions/InlineEditor/jquery.inlineEditor.basicEditor.js
trunk/extensions/InlineEditor/jquery.inlineEditor.js

Modified: trunk/extensions/InlineEditor/InlineEditor.class.php
===
--- trunk/extensions/InlineEditor/InlineEditor.class.php2011-01-21 
23:35:58 UTC (rev 80730)
+++ trunk/extensions/InlineEditor/InlineEditor.class.php2011-01-21 
23:48:35 UTC (rev 80731)
@@ -371,6 +371,7 @@
 * @return bool
 */
public static function partialRenderCite( $markedWiki ) {
-   return ( preg_match( '/ref[^\/]*?.*?\/ref|ref.*?\//is', 
$markedWiki) = 0) ;
+   return true;
+   /*return ( preg_match( '/ref[^\/]*?.*?\/ref|ref.*?\//is', 
$markedWiki) = 0) ;*/
}
 }

Modified: trunk/extensions/InlineEditor/InlineEditorMarking.class.php
===
--- trunk/extensions/InlineEditor/InlineEditorMarking.class.php 2011-01-21 
23:35:58 UTC (rev 80730)
+++ trunk/extensions/InlineEditor/InlineEditorMarking.class.php 2011-01-21 
23:48:35 UTC (rev 80731)
@@ -9,34 +9,38 @@
const autoClasses = 'block inline bar nobar'; // automatically added 
classes which shouldn't be added by hand 
protected static $lastId = 0; ///  counter which is used to generate 
unique ids
 
-   protected $start; ///  start position of the marking in the 
wikitext
-   protected $end;   ///  end position of the marking in the wikitext
-   protected $classes;   ///  class(es) attached to the marking which 
identifies the type
-   protected $block; ///  whether the tag should be added as a block 
or inline
-   protected $bar;   ///  whether the text should carry a bar at the 
left, or be fully selectable
-   protected $id;///  id in the original text; this will be 
unique even when calculating new ids!
-   protected $matched;   ///  bool whether or not this marking has been 
matched with a previous marking (default: true)
-   protected $level; ///  nesting level, which is used to sort 
consistently when two markings are of same length
+   protected $start;   ///  start position of the marking in the 
wikitext
+   protected $end; ///  end position of the marking in the 
wikitext
+   protected $classes; ///  class(es) attached to the marking which 
identifies the type
+   protected $block;   ///  whether the tag should be added as a 
block or inline
+   protected $bar; ///  whether the text should carry a bar at 
the left, or be fully selectable
+   protected $level;   ///  nesting level, which is used to sort 
consistently when two markings are of same length
+   protected $collapsible; ///  whether or not the marking can be 
collapsed when only containing one nested element

+   protected $id;  ///  id in the original text; this will be 
unique even when calculating new ids!
+   protected $matched; ///  bool whether or not this marking has been 
matched with a previous marking (default: true)
+   
/**
-* @param $start   int Start of the marking, offset in number of 
characters from the begin of the wikitext
-* @param $end int End of the marking, offset in number of 
characters from the begin of the wikitext
-* @param $classes mixed Class(es) the marking should be labeled with, 
can be either a string or an array of strings 
-* @param $block   bool Whether the tag should be added as a block or 
inline
-* @param $bar bool Whether the text should carry a bar at the 
left, or be fully selectable
-* @param $level   int Nesting level, which is used to sort 
consistently when two markings are of same length, default: 0
+* @param $start   int Start of the marking, offset in number of 
characters from the begin of the wikitext
+* @param $end int End of the marking, offset in number of 
characters from the begin of the wikitext
+* @param $classes mixed Class(es) the marking should be labeled 
with, can be either a string or an array of strings 
+* @param $block   bool Whether the tag should be added as a block 
or inline
+* @param $bar bool Whether the text should carry a bar at the 
left, or be fully selectable
+* @param $level   int Nesting level

[MediaWiki-CVS] SVN: [80732] trunk/extensions/InlineEditor

2011-01-21 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/80732

Revision: 80732
Author:   janpaul123
Date: 2011-01-21 23:50:20 + (Fri, 21 Jan 2011)
Log Message:
---
Small followup to r80731 again, forgot to remove some debugging.

Modified Paths:
--
trunk/extensions/InlineEditor/InlineEditor.class.php
trunk/extensions/InlineEditor/jquery.inlineEditor.js

Modified: trunk/extensions/InlineEditor/InlineEditor.class.php
===
--- trunk/extensions/InlineEditor/InlineEditor.class.php2011-01-21 
23:48:35 UTC (rev 80731)
+++ trunk/extensions/InlineEditor/InlineEditor.class.php2011-01-21 
23:50:20 UTC (rev 80732)
@@ -371,7 +371,6 @@
 * @return bool
 */
public static function partialRenderCite( $markedWiki ) {
-   return true;
-   /*return ( preg_match( '/ref[^\/]*?.*?\/ref|ref.*?\//is', 
$markedWiki) = 0) ;*/
+   return ( preg_match( '/ref[^\/]*?.*?\/ref|ref.*?\//is', 
$markedWiki) = 0) ;
}
 }

Modified: trunk/extensions/InlineEditor/jquery.inlineEditor.js
===
--- trunk/extensions/InlineEditor/jquery.inlineEditor.js2011-01-21 
23:48:35 UTC (rev 80731)
+++ trunk/extensions/InlineEditor/jquery.inlineEditor.js2011-01-21 
23:50:20 UTC (rev 80732)
@@ -180,4 +180,4 @@
$.inlineEditor.reload();
}
 
-}; } ) ( jQuery );
\ No newline at end of file
+}; } ) ( jQuery );


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [77605] trunk/extensions/InlineEditor

2010-12-02 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/77605

Revision: 77605
Author:   janpaul123
Date: 2010-12-02 21:08:39 + (Thu, 02 Dec 2010)
Log Message:
---
Quick update to the version which also runs at 
[http://janpaulposma.nl/sle/wiki] at the moment.

This update includes:
* Dutch translations for usability testing with Dutch subjects.
* (Quick) bugfix for a bug where two edit modes tried to highlight the exact 
same piece of text, and the order of the output was incorrect.
* Speed improvements by storing things in the session.

Most of this commit should be cleaned up, but as the usability test showed a 
lot need to be changed, I will not do this right now.

Modified Paths:
--
trunk/extensions/InlineEditor/FullEditor/FullEditor.i18n.php
trunk/extensions/InlineEditor/HideEditSection.css
trunk/extensions/InlineEditor/InlineEditor.class.php
trunk/extensions/InlineEditor/InlineEditor.i18n.php
trunk/extensions/InlineEditor/InlineEditorMarking.class.php
trunk/extensions/InlineEditor/InlineEditorText.class.php
trunk/extensions/InlineEditor/ListEditor/ListEditor.i18n.php
trunk/extensions/InlineEditor/MediaEditor/MediaEditor.i18n.php
trunk/extensions/InlineEditor/ParagraphEditor/ParagraphEditor.class.php
trunk/extensions/InlineEditor/ParagraphEditor/ParagraphEditor.css
trunk/extensions/InlineEditor/ParagraphEditor/ParagraphEditor.i18n.php
trunk/extensions/InlineEditor/ReferenceEditor/ReferenceEditor.i18n.php
trunk/extensions/InlineEditor/SectionEditor/SectionEditor.class.php
trunk/extensions/InlineEditor/SectionEditor/SectionEditor.css
trunk/extensions/InlineEditor/SectionEditor/SectionEditor.i18n.php
trunk/extensions/InlineEditor/SentenceEditor/SentenceEditor.class.php
trunk/extensions/InlineEditor/SentenceEditor/SentenceEditor.css
trunk/extensions/InlineEditor/SentenceEditor/SentenceEditor.i18n.php
trunk/extensions/InlineEditor/TemplateEditor/TemplateEditor.i18n.php
trunk/extensions/InlineEditor/jquery.inlineEditor.basicEditor.js

Modified: trunk/extensions/InlineEditor/FullEditor/FullEditor.i18n.php
===
--- trunk/extensions/InlineEditor/FullEditor/FullEditor.i18n.php
2010-12-02 21:08:23 UTC (rev 77604)
+++ trunk/extensions/InlineEditor/FullEditor/FullEditor.i18n.php
2010-12-02 21:08:39 UTC (rev 77605)
@@ -20,3 +20,16 @@
 The editor is also more complex to use, but to have full control of editing 
this wikis, may be worth it!,
'fulleditor-editmode-description-link' = 'Use the full editor »',
 );
+
+/** Dutch / Nederlands
+ * @author Jan Paul Posma
+ */
+$messages['nl'] = array(
+   'fulleditor-desc' = 'Zorgt voor een link naar de volledige editor in 
InlineEditor',
+
+   'fulleditor-editmode-caption' = 'Volledige editor',
+   'fulleditor-editmode-description' = Als je echt de controle over de 
pagina wil, kun je de volledige editor gebruiken.
+Met deze editor kun je de [http://en.wikipedia.org/wiki/Help:Wiki_markup Wiki 
codes] direct veranderen.
+Deze editor is lastiger te gebruiken, maar voor de totale controle kan dat het 
waard zijn!,
+   'fulleditor-editmode-description-link' = 'Gebruik de volledige editor 
»',
+);

Modified: trunk/extensions/InlineEditor/HideEditSection.css
===
--- trunk/extensions/InlineEditor/HideEditSection.css   2010-12-02 21:08:23 UTC 
(rev 77604)
+++ trunk/extensions/InlineEditor/HideEditSection.css   2010-12-02 21:08:39 UTC 
(rev 77605)
@@ -1,4 +1,4 @@
 .editsection {
/* hide the edit section from the page using CSS as opposed to hacking 
the parser options (and thus, cache) */
-   display: none !important;
+   /*display: none !important;*/
 }
\ No newline at end of file

Modified: trunk/extensions/InlineEditor/InlineEditor.class.php
===
--- trunk/extensions/InlineEditor/InlineEditor.class.php2010-12-02 
21:08:23 UTC (rev 77604)
+++ trunk/extensions/InlineEditor/InlineEditor.class.php2010-12-02 
21:08:39 UTC (rev 77605)
@@ -41,6 +41,10 @@
$wgHooks['EditPage::showEditForm:fields'][] = 
'InlineEditor::showEditFormFields';
return true;
}
+   
+   unset( $_GET['section'] );
+   unset( $_POST['section'] );
+   $request-setVal( 'section', null );
 
// terminate if the browser is not supported
if ( !self::isValidBrowser() ) {
@@ -58,7 +62,7 @@
if ( session_id() == '' ) {
wfSetupSession();
}
-
+   
// try to spawn the editor and render the page
$editor = new InlineEditor( $article );
if ( $editor-render( $output ) ) {
@@ -199,6 +203,7

[MediaWiki-CVS] SVN: [75411] trunk/extensions/InlineEditor/InlineEditorText.class.php

2010-10-26 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/75411

Revision: 75411
Author:   janpaul123
Date: 2010-10-26 07:36:56 + (Tue, 26 Oct 2010)
Log Message:
---
Small followup to r75344; always remove TOC as we don't want to update it every 
time, and don't want a TOC to pop up in a partial rendering

Modified Paths:
--
trunk/extensions/InlineEditor/InlineEditorText.class.php

Modified: trunk/extensions/InlineEditor/InlineEditorText.class.php
===
--- trunk/extensions/InlineEditor/InlineEditorText.class.php2010-10-26 
06:22:42 UTC (rev 75410)
+++ trunk/extensions/InlineEditor/InlineEditorText.class.php2010-10-26 
07:36:56 UTC (rev 75411)
@@ -207,6 +207,10 @@
$parserOptions = clone $this-article-getParserOptions();
$parserOptions-setEditSection( false );

+   // always remove the table of contents as we don't want it pop 
up at partial parsing
+   // or even at the first page render as it is an dependency
+   $wikiMarked .= \n__NOTOC__;
+   
// run $wikiMarked through the parser and store the result
return $wgParser-parse( $wikiMarked, 
$this-article-getTitle(),
$parserOptions, true, true, 
$this-article-getRevIdFetched() );


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [75345] trunk/extensions/InlineEditor/jquery.inlineEditor.basicEditor. js

2010-10-25 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/75345

Revision: 75345
Author:   janpaul123
Date: 2010-10-25 09:34:27 + (Mon, 25 Oct 2010)
Log Message:
---
Removed a debug value still present in r75344

Modified Paths:
--
trunk/extensions/InlineEditor/jquery.inlineEditor.basicEditor.js

Modified: trunk/extensions/InlineEditor/jquery.inlineEditor.basicEditor.js
===
--- trunk/extensions/InlineEditor/jquery.inlineEditor.basicEditor.js
2010-10-25 09:17:41 UTC (rev 75344)
+++ trunk/extensions/InlineEditor/jquery.inlineEditor.basicEditor.js
2010-10-25 09:34:27 UTC (rev 75345)
@@ -117,7 +117,7 @@
// highlight the text orange and have it fade to blue again
// this is a visual indicator to where the element is now
$orig.addClass( 'lastEdit' );
-   $orig.removeClass( 'lastEdit', 2 );
+   $orig.removeClass( 'lastEdit', 800 );
 },
 
 /**


___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs


[MediaWiki-CVS] SVN: [71941] USERINFO/janpaul123

2010-08-30 Thread janpaul123
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/71941

Revision: 71941
Author:   janpaul123
Date: 2010-08-30 11:43:55 + (Mon, 30 Aug 2010)

Log Message:
---
Added my USERINFO

Added Paths:
---
USERINFO/janpaul123

Added: USERINFO/janpaul123
===
--- USERINFO/janpaul123 (rev 0)
+++ USERINFO/janpaul123 2010-08-30 11:43:55 UTC (rev 71941)
@@ -0,0 +1,3 @@
+name: Jan Paul Posma
+email: jp.po...@gmail.com
+url: http://www.mediawiki.org/wiki/User:JanPaul123


Property changes on: USERINFO/janpaul123
___
Added: svn:eol-style
   + native



___
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs