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


Michael Dale <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]




--- Comment #12 from Michael Dale <[email protected]>  2009-09-22 14:18:43 UTC ---
Comment #11 makes sense. But will require some modifications to the gadget &
outputpage since Gadget is itself an extension and there is presently no way to
call "add script after site but before user" from an extension :( .. We would
have to add a few more "hooks". 

At any rate this is only an intermediary solution to configuration problem. We
eventually want a system for the script-loader to package in configuration that
is stored in a database and requested on a per Script-Class level (similar to
how we package in the language msgs). This way we can have actual interfaces
for customizing configuration instead of having to modify the JS files or
modify mediaWiki pages with JS code). This should be part of the overall
configuration flatfile to db rewrite. 

In the mean time .. we can structure development so the order does not matter
so much... doing all configuration with inline-execution and inheriting the
defaults onDomReady: see how editPage.js is structured in customizing the
add-media-wizard:
http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/js2/editPage.js 

another made up example for configuration handling : 

= core script editPage.js =
if(! wgConfigToolbar )
        wgConfigToolbar = {};

//the default configuration is short since the wikiEditor application supplies
its own "defaults" 
wgDefaultToolBarSettings = { 'enabledModules':['sidepanel', 'help', 'tocnav'],
'otherDefaults: ['values'] };

js2AddOnloadHook( function() {
        //also see http://docs.jquery.com/Utilities/jQuery.extend
        wgConfigToolbar = $j.extend(true, wgDefaultToolBarSettings, 
wgConfigToolbar);
        $j('#textEditBox').wikiEdit( wgConfigToolbar );
}
//the regardless of the order any script can set the configuration (although
last scripts included wins where there are conflicts )

= script site js = 

if(! wgConfigToolbar)
        wgConfigToolbar = {};
wgConfigToolbar = $j.extend(wgConfigToolbar, { enabledModules:
['licenceHelper'] });

= script addEditWidget.js =

if(! wgConfigToolbar)
        wgConfigToolbar = {};

wgConfigToolbar = $j.extend(wgConfigToolbar, { 'enabledModules':
['myCustomTool'],  //array will be "merged" and default settings
        'customModules':{ 
                myCustomTool:function( wikiEditObj ){
                        wikiEditObj.getTextSelection();
                        //custom toolbar calls here
                        wikiEditObj.insertBefore( 'my custom insert');
                        //etc
                }
        }
}
//alternatively extension code can depend on core stuff being ready at
js2AddOnloadHook time so: 
js2AddOnloadHook(function(){
        $j('#textEditBox').wikiEdit('addToolModule', :function( wikiEditObj ){
                        wikiEditObj.getTextSelection();
                        //custom toolbar calls here
                        wikiEditObj.insertBefore( 'my custom insert');
                        //etc
                }
        ); //could also work. 
});


-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to