Re: [Wikitech-l] Call to eliminate sajax

2012-10-04 Thread Tim Starling
On 04/10/12 03:18, Daniel Friesen wrote:
 sajax is an ancient ajax library, it's part of our legacy code. And it
 still gets to sneak a license note into our README.
 
 It's probably about time that we start making sure that code is ready
 for the day it disappears. Just as code shouldn't be relying on bits
 and pieces of wikibits.
 
 Currently the only parts of core that depend on sajax are the legacy
 mwsuggest and upload.js.
 mwsuggest is going to disappear when Krinkle's work making
 simplesearch's suggestions work universally is finished.
 I'm not sure what's going on with upload.js.
 
 The real problem however is extensions. For some reason it appears
 that we STILL have extensions depending on sajax. And I'm not talking
 about ancient extensions on the wiki or in svn. I only did an ack
 through stuff that's currently in git.
 
 So I welcome anyone who is interested in going through extension code
 and eliminating the use of sajax in favor of jQuery.ajax and RL.

It's a fair bit easier to implement a Sajax/AjaxDispatcher callback
than it is to implement an API module, mostly because of the API's
dual role as both an internal interface and a public interface for
external developers. So you can see why extension developers writing
internal interfaces would be hesitant to choose the API route.

sajax_do_call() is only 163 lines. Why not just rewrite it to use
jquery.ajax? Just because it's called sajax_do_call() doesn't mean it
actually has to *be* Sajax.

-- Tim Starling


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Call to eliminate sajax

2012-10-04 Thread Tim Starling
On 04/10/12 03:18, Daniel Friesen wrote:
 sajax is an ancient ajax library, it's part of our legacy code. And it
 still gets to sneak a license note into our README.
 
 It's probably about time that we start making sure that code is ready
 for the day it disappears. Just as code shouldn't be relying on bits
 and pieces of wikibits.
 
 Currently the only parts of core that depend on sajax are the legacy
 mwsuggest and upload.js.
 mwsuggest is going to disappear when Krinkle's work making
 simplesearch's suggestions work universally is finished.
 I'm not sure what's going on with upload.js.
 
 The real problem however is extensions. For some reason it appears
 that we STILL have extensions depending on sajax. And I'm not talking
 about ancient extensions on the wiki or in svn. I only did an ack
 through stuff that's currently in git.
 
 So I welcome anyone who is interested in going through extension code
 and eliminating the use of sajax in favor of jQuery.ajax and RL.

It's a fair bit easier to implement a Sajax/AjaxDispatcher callback
than it is to implement an API module, mostly because of the API's
dual role as both an internal interface and a public interface for
external developers. So you can see why extension developers writing
internal interfaces would be hesitant to choose the API route.

sajax_do_call() is only 163 lines. Why not just rewrite it to use
jquery.ajax? Just because it's called sajax_do_call() doesn't mean it
actually has to *be* Sajax.

-- Tim Starling


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Call to eliminate sajax

2012-10-04 Thread Daniel Friesen

On Wed, 03 Oct 2012 14:25:29 -0700, MZMcBride z...@mzmcbride.com wrote:


Daniel Friesen wrote:

sajax is an ancient ajax library, it's part of our legacy code. And it
still gets to sneak a license note into our README.

It's probably about time that we start making sure that code is ready  
for

the day it disappears. Just as code shouldn't be relying on bits and
pieces of wikibits.

Currently the only parts of core that depend on sajax are the legacy
mwsuggest and upload.js.
mwsuggest is going to disappear when Krinkle's work making  
simplesearch's

suggestions work universally is finished.
I'm not sure what's going on with upload.js.

The real problem however is extensions. For some reason it appears that  
we

STILL have extensions depending on sajax. And I'm not talking about
ancient extensions on the wiki or in svn. I only did an ack through  
stuff

that's currently in git.


Can you please file a tracking bug for removing sajax?

MZMcBride


Tracking bug:
https://bugzilla.wikimedia.org/show_bug.cgi?id=40787

sajax: https://bugzilla.wikimedia.org/show_bug.cgi?id=40785
AjaxDispatcher: https://bugzilla.wikimedia.org/show_bug.cgi?id=40786

--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


[Wikitech-l] Call to eliminate sajax

2012-10-03 Thread Daniel Friesen
sajax is an ancient ajax library, it's part of our legacy code. And it  
still gets to sneak a license note into our README.


It's probably about time that we start making sure that code is ready for  
the day it disappears. Just as code shouldn't be relying on bits and  
pieces of wikibits.


Currently the only parts of core that depend on sajax are the legacy  
mwsuggest and upload.js.
mwsuggest is going to disappear when Krinkle's work making simplesearch's  
suggestions work universally is finished.

I'm not sure what's going on with upload.js.

The real problem however is extensions. For some reason it appears that we  
STILL have extensions depending on sajax. And I'm not talking about  
ancient extensions on the wiki or in svn. I only did an ack through stuff  
that's currently in git.


So I welcome anyone who is interested in going through extension code and  
eliminating the use of sajax in favor of jQuery.ajax and RL.



core/skins/common/ajax.js
3:window.sajax_debug_mode = false;
4:window.sajax_request_type = 'GET';
7: * if sajax_debug_mode is true, this function outputs given the message  
into
8: * the element with id = sajax_debug; if no such element exists in the  
document,

11:window.sajax_debug = function(text) {
12: if (!sajax_debug_mode) return false;
14: var e = document.getElementById( 'sajax_debug' );
18: e.className = 'sajax_debug';
19: e.id = 'sajax_debug';
41:window.sajax_init_object = function() {
42: sajax_debug( 'sajax_init_object() called..' );
61: sajax_debug( 'Could not create connection object.' );
77: *sajax_do_call( 'doFoo', [1, 2, 3], document.getElementById(  
'showFoo' ) );

83:window.sajax_do_call = function(func_name, args, target) {
88: if ( sajax_request_type == 'GET' ) {
105:x = sajax_init_object();
112:x.open( sajax_request_type, uri, true );
119:if ( sajax_request_type == 'POST' ) {
130:		sajax_debug( 'received (' + x.status + ' ' + x.statusText + ') ' +  
x.responseText );
153:			alert( 'bad target for sajax_do_call: not a function or object: ' +  
target );

157:sajax_debug( func_name + ' uri = ' + uri + ' / post = ' + post_data );
159:sajax_debug( func_name + ' waiting..' );
169:var request = sajax_init_object();

core/skins/common/mwsuggest.js
489:var xmlhttp = sajax_init_object();

core/skins/common/upload.js
99: if ( !ajaxUploadDestCheck || !sajax_init_object() ) return;
124:if ( !ajaxUploadDestCheck || !sajax_init_object() ) return;
133:if ( !ajaxUploadDestCheck || !sajax_init_object() ) return;
141:		sajax_do_call( 'SpecialUpload::ajaxGetExistsWarning',  
[this.nameToCheck],

287:var req = sajax_init_object();

extensions/CommunityVoice/Resources/CommunityVoice.js
100:var oldRequestType = sajax_request_type;
102:sajax_request_type = POST;
104:sajax_do_call(
114:sajax_request_type = oldRequestType;

extensions/DonationInterface/modules/validate_input.js
14: sajax_do_call( 'efPayflowGatewayCheckSession', [], checkSession );

extensions/Drafts/Drafts.js
76: var oldRequestType = sajax_request_type;
78: sajax_request_type = 'POST';
80: sajax_do_call(
98: sajax_request_type = oldRequestType;

extensions/OnlineStatus/OnlineStatus.js
35: sajax_do_call( 'OnlineStatus::Ajax', ['get'], function( x ){
71: sajax_do_call( 'OnlineStatus::Ajax', ['set', status], function( x ){

extensions/ReaderFeedback/readerfeedback.js
36:  /*extern sajax_init_object, sajax_do_call */
92:	sajax_do_call( ReaderFeedbackPage::AjaxReview, args,  
wgAjaxFeedback.processResult );


extensions/SecurePoll/resources/SecurePoll.js
95:	sajax_do_call( 'wfSecurePollStrike', [ action, id, reason ],  
processResult );


extensions/SemanticForms/includes/SF_FormUtils.php
450:function FCK_sajax(func_name, args, target) {
451:sajax_request_type = 'POST' ;
452:sajax_do_call(func_name, args, function (x) {
716:sajax_request_type = 'POST' ;
718:		sajax_do_call('wfSajaxWikiToHTML', [SRCtextarea.value], function (  
result ){

736:if (!oFCKeditor.ready) return false;//sajax_do_call in 
action
754:sajax_request_type = 'GET' ;
755:			sajax_do_call( 'wfSajaxToggleFCKeditor', ['hide'], function(){} )  
;		//remember closing in session


extensions/SemanticForms/libs/SF_ajax_form_preview.js
43: var aj = sajax_init_object();
44: var aj2 = sajax_init_object();
70:	// if (!oFCKeditor.ready) return false;//sajax_do_call in action -  
what do we do?


extensions/SemanticForms/libs/SF_autoedit.js
35: sajax_request_type = 'POST';
37:		sajax_do_call( 'SFAutoeditAPI::handleAutoEdit', data, function(  
ajaxHeader ){


extensions/SemanticForms/libs/SF_submit.js
55: sajax_request_type = 'POST';
58:			sajax_do_call( 'SFAutoeditAPI::handleAutoEdit', new  

Re: [Wikitech-l] Call to eliminate sajax

2012-10-03 Thread Bryan Tong Minh
On Wed, Oct 3, 2012 at 7:18 PM, Daniel Friesen
dan...@nadir-seen-fire.com wrote:
 core/skins/common/upload.js
 99: if ( !ajaxUploadDestCheck || !sajax_init_object() ) return;
 124:if ( !ajaxUploadDestCheck || !sajax_init_object() ) return;
 133:if ( !ajaxUploadDestCheck || !sajax_init_object() ) return;
 141:sajax_do_call( 'SpecialUpload::ajaxGetExistsWarning',
 [this.nameToCheck],
 287:var req = sajax_init_object();



https://bugzilla.wikimedia.org/show_bug.cgi?id=31946

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Call to eliminate sajax

2012-10-03 Thread Krinkle
On Oct 3, 2012, at 7:18 PM, Daniel Friesen dan...@nadir-seen-fire.com wrote:

 The real problem however is extensions. For some reason it appears that we 
 STILL have extensions depending on sajax. And I'm not talking about ancient 
 extensions on the wiki or in svn. I only did an ack through stuff that's 
 currently in git.
 
 So I welcome anyone who is interested in going through extension code and 
 eliminating the use of sajax in favor of jQuery.ajax and RL.
 
 

Also note that in various cases these are not just frontend legacy problems, 
backend as well. Meaning, AjaxDispatcher.

Invoked through index.php?action=ajaxrs=efFooBarrsargs[]=paramrsargs[]=param.

Though blindly replacing sajax would allow us to remove it from core, it would 
be very much worth it to give these extensions a good look and update them in 
general (to make it use API modules, ResourceLoader modules, and following 
current conventions for front-end code with mw and jQuery).

-- Krinkle


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Call to eliminate sajax

2012-10-03 Thread S Page
Informative e-mail threads are not documentation.
I added https://www.mediawiki.org/wiki/Manual:Ajax#Deprecated_functionality

There seems to be no mention of AjaxDispatcher on mediawiki.org ,
which I guess is good?  If it's obsolete someone needs to add a
comment to includes/AjaxDispatcher.php.
-- 
=S Page  software engineer on E3

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Call to eliminate sajax

2012-10-03 Thread MZMcBride
Daniel Friesen wrote:
 sajax is an ancient ajax library, it's part of our legacy code. And it
 still gets to sneak a license note into our README.
 
 It's probably about time that we start making sure that code is ready for
 the day it disappears. Just as code shouldn't be relying on bits and
 pieces of wikibits.
 
 Currently the only parts of core that depend on sajax are the legacy
 mwsuggest and upload.js.
 mwsuggest is going to disappear when Krinkle's work making simplesearch's
 suggestions work universally is finished.
 I'm not sure what's going on with upload.js.
 
 The real problem however is extensions. For some reason it appears that we
 STILL have extensions depending on sajax. And I'm not talking about
 ancient extensions on the wiki or in svn. I only did an ack through stuff
 that's currently in git.

Can you please file a tracking bug for removing sajax?

MZMcBride



___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l