Last modified: 2006-10-21 18:28:20 UTC
Dear all, within the chemistry part of the wikipedia, we are trying to get rid of excessive, and biased external links on chemical substance-pages. Since every chemical substance gets assigned some unique identifiers, it would be possible to collate all the external links into a page (a rough setup is on http://en.wikipedia.org/wiki/Wikipedia:Chemical_sources), and then have a special page creating the links, just like the special:booksources page. I would like to have some help setting this up, I do not have a live server to run a test wikipedia on, I have not much of a clue about php, and don't know how to get my hands on an example (probs a copy of the special:booksources page. For as far as I now can see, it boils down to making a copy of the special:booksources page, which loads the chemical sources page. The special page has to be able to take more than one unique identifier, and fill them in (maybe in some cases using some extra handling). I expect that the second step might be also creating the magiclinks, but to start with I would be satisfied with templates calling the special page. Can somebody have a look if what we would like to have is possible, and then help us set this up? Cheers, Dirk.
Created attachment 2377 [details] New Special Page Hi, managed to get a working wikipedia on my pc, could not get the newest version to run (requires php5 (got that) and mysql, but errormessages and install instructions are not helpful). This file creates a special page that works under 1.6.8. Added a line to Specialpage.php: 'ChemicalSources' => new SpecialPage('ChemicalSources' ), and some variables to messages.php: 'Chemicalsources' => 'Chemical sources', 'Cas' => 'CAS-Number ', 'Einecs' => 'EINECS', 'PubChem' => 'PubChem', 'SMILES' => 'SMILES', 'InChI' => 'InChI', 'ATCCode' => 'ATC-Code', 'DrugBank' => 'DrugBank', 'Formula' => 'Molecular Formula', 'Name' => 'IUPAC Name', 'Chemicalsourcetext' => "Below is a list of links to other sites that sell chemicals, and may also have further information about chemicals you are looking for.", Not sure how to proceed from here. Could someone give me a hand on this? Cheers. Dirk
Created attachment 2385 [details] New version of Special:ChemicalSources (vide supra) New version, other files changed (in version 1.6.8) *New line in includes\specialpage (before line 67): 'ChemicalSources' => new SpecialPage('ChemicalSources'), *Addition to languages\Messages.php (before line 1010): 'Chemicalsources' => 'Chemical sources', 'Cas' => 'CAS-Number ', 'Einecs' => 'EINECS', 'PubChem' => 'PubChem', 'SMILES' => 'SMILES', 'InChI' => 'InChI', 'CHEBI' => 'ChEBI', 'ATCCode' => 'ATC-Code', 'DrugBank' => 'DrugBank', 'Formula' => 'Molecular Formula', 'Name' => 'IUPAC Name', 'Chemicalsourcetext' => "Below is a list of links to other sites that may provide information about the chemical substance you are looking for.", *Addition to languages\Language.php (before line 173): /* private */ $wgChemicalstoreListEn = array( 'NIST WEbbook' => 'http://webbook.nist.gov/cgi/cbook.cgi?ID=$1&Units=SI', 'Oxford MSDS' => 'http://ptcl.chem.ox.ac.uk/MSDS/', 'ACROS MSDS (commercial supplier)' => 'http://www.acros.be/DesktopModules/Acros_Search_Results/Acros_Search_Results.aspx?search_type=CatalogSearch&SearchString=$1' ); *And addition to languages\Language.php (before line 345): /** * Exports $wgChemicalstoreListEn * @return array */ function getChemicalstoreList() { global $wgChemicalstoreListEn ; return $wgChemicalstoreListEn ; } Hope to hear more about this soon! Cheers! Dirk.
If I see correctly the only thing different from the above mentioned changes in the files, is that in 1.7.1 includes\Specialpage.php should get as an extra line: 'ChemicalSources' => array( 'SpecialPage', 'ChemicalSources' ), (instead of thementioned 'ChemicalSources' => new SpecialPage('ChemicalSources'),). The other changes should be correct. Dirk.
Created attachment 2399 [details] Updated chemicalsources php updated file, no other changes made
Can't you rewrite this as a "real" extension. See http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/examples/SpecialIncludable.php?revision=11132&view=markup for an example. Elsewhere you can hack MediaWiki itself, but then you should provide a unified patch. But IMHO it better should be an extension. Cheers Jimmy
Created attachment 2409 [details] Addition of ChemicalSources functionality First attempt to a patch, hope this is all OK
Created attachment 2410 [details] New Chemicalsources specialpage Discard other patch, forgot to turn of a redirect function. This is the correct version. Cheers. Dirk
Created attachment 2415 [details] New version of special:chemicalsources Added extra functionality to special:Chemicalsources (more parameters, checking of some parameters)
Created attachment 2424 [details] Upgraded patch Bit extra functionality in patch compared to last.
Created attachment 2432 [details] Special:Chemicalsources written as an extension This patch yields the same result as patch 2424, mediawiki gets a special:chemicalsources, but this time the page is written as an extension. The patch contains the extension, and some variables which are added to Language.php and MessagesEN.php. People at en.wikipedia.org would like to see this extension (or patch 2424) added, since it gives us a better possibility to link to external chemical sources (which yield a wealth of info), an option which is now impossible without bias.
Extensions should probably not modify core code. You could check some of the extensions in SVN to see how custom messages can be added without changing languages/* files and with support for internationalization.
Created attachment 2436 [details] internationalised, only files in extensions, now. Extensions for use in wikipedia that have [[chemical substances]] in them. Three files: SpecialChemicalsources.php, creates a specialpage, similar to the booksources page. ChemFunctions.php, creates a new tag <chemform>, to use with chemical formulae. ChemFunctions.i18n.php, an internationalisation file, is used by both SpecialChemicalsources.php and ChemFunctions.php (overlapping data). Could these three files be uploaded into the extensions directory, in a own subdir 'Chemistry' (or something similar)? After uploading, could a core dev. please test these, see if they do no harm, and if so, install them both in the wikipedia (en.wikipedia.org, calling SpecialChemicalsources.php and ChemFunctions.php from localsettings.php, that is also thé way to uninstall them again). Cheers! Dirk.
Created attachment 2455 [details] New version of the extensions New version, code more optimised! Could use some feedback!
This extension allows the use of HTML in pages, without checking the user supplied HTML code for sanity, and could thus be used by an attacker to gather user passwords and session cookies.
Created attachment 2458 [details] New version Forced output through the parser, added new option to <chemform>-tag, added support for nl
Created attachment 2459 [details] new diff Good version
Created attachment 2460 [details] remove one file, needs more work Remove one not working part, needs work to remove arbitrary HTML. Will add other extension seperately.
Created attachment 2472 [details] ChemFunctions files See comment #12 @ comment #14, the chemform tag now filters the two tags that are used through the sanitizer. SpecialChemicalPages.php does not use any arbitrary html.
Added the extension files in r16831.
Created attachment 2475 [details] Patch some changes Removed link, added possibility to explanation in i18n
(In reply to comment #20) > Created an attachment (id=2475) [edit] > Patch some changes > > Removed link, added possibility to explanation in i18n In r16843.
Created attachment 2488 [details] Invert working of one option Working of the option 'nolink' has been removed and changed into the option 'link' (so the extension only links when the option is given, not the other way around).
(In reply to comment #22) > Created an attachment (id=2488) [edit] > Invert working of one option Committed in r16895.
Created attachment 2531 [details] cleanup of code, make code more general, easier to adapt Cleanup of code, removing empty lines, adding some comments. Parameters and variables have been generalized a bit, so that adapting the page for other functions is easier.
(In reply to comment #24) > Created an attachment (id=2531) [edit] Appled in r17153. Please open a *new* bug next time.