MarvinView and MarvinSketch in MediaWiki

ChemAxon b124dd5f17

27-05-2008 17:05:43

--Not currently working--




I copy this post from the Marvin technical support forum











Quote:
Hi,




I have written in half a day a some lines of code to integrate marvin view and marvin sketch in wikimedia.




The first extension is just some lines of code to translate <marvin> tags in html code (that displays compounds).


Source code is available at :


http://cheminfo.u-strasbg.fr/mediawiki/index.php/ChemAxon-Marvin_Mediawiki_Extensions




The second extension called marvinEditButton is to draw compounds after clicking on the toolbar of the wiki Edit page (Button with character M in uppercase for Marvin).


For now, it is at the following URL (in miscellaneous tool section - marvinEditButton ) :


http://cheminfo.u-strasbg.fr/template/jd/pages/download/download.php




How I said this code is really basic. It's a kind of skeleton. Feel free to improve it and put more options.




All instructions to install the extension are on :


http://cheminfo.u-strasbg.fr/mediawiki/index.php/ChemAxon-Marvin_Mediawiki_Extensions




Kind regards

User 73b6540133

12-05-2009 21:13:35

I couldn't get the link to work myself either but I've worked through how to do it. You create a custom extension to MediaWiki that converts <marvin/> tags within the page to the requisite Marvin JavaScript. Attributes of the <marvin/> tag can be used to specify which file to load, the number of mols, etc.


Installation instructions:


Copy Marvin to $MediaWiki/scripts/marvin (or change the path below)
Copy
to $MediaWiki/extensions/MarvinTag and then include the following line
at the end of  $MediaWiki/LocalSettings.php:  include(
"$IP/extensions/MarvinTag/MarvinTag.php" );


Usage:


e.g.


<marvin name="mview2" max=8 mol="/data/mols.sdf"/>


this actually renders to the following:


<script language='JavaScript1.1' src='/scripts/marvin/marvin.js'></script><script language='JavaScript1.1'>
var max=8;
var col=2;
var vcol=2;
var vrow=2;
if(max < 2) {
col = 1;
row = 1;
} else{
row = Math.floor((max + 1) / col);
}
if(vcol > col) {
vcol = col;
}
if(vrow > row) {
vrow = row;
}
mview_name = "mview2";
mview_begin("/scripts/marvin",250,250);
mview_param("editable", 2);
mview_param("dispQuality", 1);
mview_param("rendering", "wireframe");
mview_param("rows", row);
mview_param("cols", col);
mview_param("visibleCols", vcol);
mview_param("visibleRows", vrow);
mview_param("border", 1);
mview_param("layout", ":2:1:M:1:0:1:1:c:b:1:1:L:0:0:1:1:c:n:0:1");
mview_param("param", ":M:200:200:L:10b");
for(i=0;i<(row*col);i++) {
mview_param("cell"+i,"||"+(i+1));
}
mview_param("mol", "/data/mols.sdf");
mview_end();
</script>