Last modified: 2006-10-21 18:28:20 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 7364 - New extension for chemical substance identifiers
New extension for chemical substance identifiers
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Extensions requests (Other open bugs)
unspecified
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Dirk Beetstra
http://en.wikipedia.org/wiki/Wikipedi...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-09-18 18:33 UTC by Dirk Beetstra
Modified: 2006-10-21 18:28 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
New Special Page (6.85 KB, text/plain)
2006-09-20 22:05 UTC, Dirk Beetstra
Details
New version of Special:ChemicalSources (vide supra) (9.04 KB, text/plain)
2006-09-23 16:34 UTC, Dirk Beetstra
Details
Updated chemicalsources php (9.07 KB, application/octet-stream)
2006-09-24 18:59 UTC, Dirk Beetstra
Details
Addition of ChemicalSources functionality (75.90 KB, patch)
2006-09-24 22:36 UTC, Dirk Beetstra
Details
New Chemicalsources specialpage (75.90 KB, patch)
2006-09-24 22:46 UTC, Dirk Beetstra
Details
New version of special:chemicalsources (77.57 KB, patch)
2006-09-26 08:11 UTC, Dirk Beetstra
Details
Upgraded patch (85.85 KB, patch)
2006-09-30 12:46 UTC, Dirk Beetstra
Details
Special:Chemicalsources written as an extension (74.04 KB, patch)
2006-10-03 22:15 UTC, Dirk Beetstra
Details
internationalised, only files in extensions, now. (19.06 KB, patch)
2006-10-04 13:27 UTC, Dirk Beetstra
Details
New version of the extensions (12.21 KB, patch)
2006-10-05 21:14 UTC, Dirk Beetstra
Details
New version (74.04 KB, patch)
2006-10-05 22:13 UTC, Dirk Beetstra
Details
new diff (13.43 KB, patch)
2006-10-05 22:22 UTC, Dirk Beetstra
Details
remove one file, needs more work (10.30 KB, patch)
2006-10-05 22:42 UTC, Dirk Beetstra
Details
ChemFunctions files (14.22 KB, patch)
2006-10-07 12:01 UTC, Dirk Beetstra
Details
Patch some changes (4.39 KB, patch)
2006-10-07 15:31 UTC, Dirk Beetstra
Details
Invert working of one option (1.72 KB, patch)
2006-10-09 10:14 UTC, Dirk Beetstra
Details
cleanup of code, make code more general, easier to adapt (19.98 KB, patch)
2006-10-21 16:09 UTC, Dirk Beetstra
Details

Description Dirk Beetstra 2006-09-18 18:33:01 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.
Comment 1 Dirk Beetstra 2006-09-20 22:05:21 UTC
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
Comment 2 Dirk Beetstra 2006-09-23 16:34:48 UTC
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.
Comment 3 Dirk Beetstra 2006-09-23 17:08:15 UTC
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.
Comment 4 Dirk Beetstra 2006-09-24 18:59:35 UTC
Created attachment 2399 [details]
Updated chemicalsources php

updated file, no other changes made
Comment 5 Jimmy Collins 2006-09-24 19:26:41 UTC
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
Comment 6 Dirk Beetstra 2006-09-24 22:36:55 UTC
Created attachment 2409 [details]
Addition of ChemicalSources functionality

First attempt to a patch, hope this is all OK
Comment 7 Dirk Beetstra 2006-09-24 22:46:41 UTC
Created attachment 2410 [details]
New Chemicalsources specialpage

Discard other patch, forgot to turn of a redirect function.  This is the
correct version.
Cheers.  Dirk
Comment 8 Dirk Beetstra 2006-09-26 08:11:27 UTC
Created attachment 2415 [details]
New version of special:chemicalsources

Added extra functionality to special:Chemicalsources (more parameters, checking
of some parameters)
Comment 9 Dirk Beetstra 2006-09-30 12:46:11 UTC
Created attachment 2424 [details]
Upgraded patch

Bit extra functionality in patch compared to last.
Comment 10 Dirk Beetstra 2006-10-03 22:15:54 UTC
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.
Comment 11 Dan Li 2006-10-04 04:08:08 UTC
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.
Comment 12 Dirk Beetstra 2006-10-04 13:27:23 UTC
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.
Comment 13 Dirk Beetstra 2006-10-05 21:14:35 UTC
Created attachment 2455 [details]
New version of the extensions

New version, code more optimised!  Could use some feedback!
Comment 14 JeLuF 2006-10-05 21:53:47 UTC
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. 
Comment 15 Dirk Beetstra 2006-10-05 22:13:35 UTC
Created attachment 2458 [details]
New version

Forced output through the parser, added new option to <chemform>-tag, added
support for nl
Comment 16 Dirk Beetstra 2006-10-05 22:22:28 UTC
Created attachment 2459 [details]
new diff

Good version
Comment 17 Dirk Beetstra 2006-10-05 22:42:23 UTC
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.
Comment 18 Dirk Beetstra 2006-10-07 12:01:28 UTC
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.
Comment 19 Rotem Liss 2006-10-07 12:09:49 UTC
Added the extension files in r16831.
Comment 20 Dirk Beetstra 2006-10-07 15:31:28 UTC
Created attachment 2475 [details]
Patch some changes

Removed link, added possibility to explanation in i18n
Comment 21 Jimmy Collins 2006-10-07 15:39:00 UTC
(In reply to comment #20)
> Created an attachment (id=2475) [edit]
> Patch some changes
> 
> Removed link, added possibility to explanation in i18n

In r16843.
Comment 22 Dirk Beetstra 2006-10-09 10:14:20 UTC
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).
Comment 23 Jimmy Collins 2006-10-09 18:06:05 UTC
(In reply to comment #22)
> Created an attachment (id=2488) [edit]
> Invert working of one option

Committed in r16895.

Comment 24 Dirk Beetstra 2006-10-21 16:09:44 UTC
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.
Comment 25 Jimmy Collins 2006-10-21 18:28:20 UTC
(In reply to comment #24)
> Created an attachment (id=2531) [edit]

Appled in r17153. Please open a *new* bug next time.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links