Team:SJTU-BioX-Shanghai/Others
From 2009.igem.org
Project introduction. Inspired by the natural regulator of circadian bioclock exhibited in most eukaryotic organisms, our team has designed an E.coli-based genetic network with the toxin-antitoxin system so that the bacterium oscillates between two states of dormancy and activity (more...)
Contents |
Tools for Wiki
Mass upload script - Improve efficiency for uploading
You may need to upload a lot of files(or images) if you are editing your wiki page. However, because of the limitation of MediaWiki, you can only upload one file in one time. In some places such as modelling or results, you may need to upload dozens of files. So the Mass upload script is right here for you.
- Mass files upload for MediaWiki and iGEM 2009 Team Wiki
Click SJTU09_MassUpload.zip to download.
The script is modified from [http://commons.wikimedia.org/wiki/Commons:File_upload_service/Script Eloquence's upload bot]. Our member pnstontale modified it to work with iGEM 2009 Team Wiki. Hope this script can improve your efficiency or offer you any clues or inspirations. You may modify this script to fit iGEM 2010 Team Wiki or so.
- The Windows internal VBS/JS scripts may seem unable to upload files to a MediaWiki server, so Perl scripts may be a fine solution. Warning: You need a Perl environment for this script. You may get it from [http://www.activestate.com/activeperl/ ActivePerl].
- Usage:
- Put the files you want to upload in the directory "upload".
- Edit the Perl file and read though the descriptions. Modify your "username" and "password" and save.
- Modify other variables such as $siteType, $siteBase, $loginUrl & $uploadUrl if necessary.
- Run this script and wait. It will show you its progress.
- If it shows "Mission finished", close this window or press [Ctrl] + [C].
Convert Word Document(.doc) to MediaWiki
It is wonderful if all members in your team know how to write wiki codes. However, some members like to use word Document(.doc) to store wiki contents, so you may need to find a solution to convert word Document(.doc) to MediaWiki code.
- Here are some tools to convert a word Document(.doc) to MediaWiki type.
- [http://www.mediawiki.org/wiki/Word_macros http://www.mediawiki.org/wiki/Word_macros]
- [http://en.wikipedia.org/wiki/Help:WordToWiki http://en.wikipedia.org/wiki/Help:WordToWiki]
- [http://www.openoffice.org OpenOffice.org software]
However, the word macros may be incompatible with non-English versions of Micrsoft Word. So [http://www.openoffice.org OpenOffice.org] might be a better solution. It can export a word Document(.doc) to HTML or wiki code. However, images should be integrated into the wiki code manually. Here is a PHP script to integrate images into the wiki code.
- Warning: You need a PHP server to run this script.
$target = ""; //File basename for exported htm & wiki code file $wikiSrc = file($target.".txt"); $maxwidth = 580; //Max width for image thumb if(file_exists($target.".html")) { $htmlSrc = file_get_contents($target.".html"); } else $htmlSrc = file_get_contents($target.".htm"); preg_match_all ('|<img src="(.*?)".*?width=(.*?) .*?>|i', $htmlSrc, $matches); $i=0; $content = ""; foreach($wikiSrc as $key => $line) { if(substr($line,0,10) == "[[Image:]]") { $img = $matches[1][$i]; if($matches[2][$i] > $maxwidth) { $content .= "[[Image:$img|center|thumb|${maxwidth}px]]\n"; } else $content .= "[[Image:$img|center]]\n"; $i++; } else $content.=$line; } print "<pre>$content</pre>";
- Usage:
- Use [http://www.openoffice.org OpenOffice.org] to export a word document(.doc) to both HTML(.html) & wiki code(.txt) with the same basename(for example: example.html & example.txt).
- Put the HTML & TXT file to the same directory of the PHP script.
- Modify the variable $target to the basename(for example: example).
- Run this PHP script under a PHP server.
PNG transparency fix for Internet Explorer 6
Are you a wiki designer? If so, you may meet the same problem that we experienced once. For example, if you want to display any PNG images with transparency effects such as backgrounds, you may get puzzled by Internet Explorer 6(IE6). Objectively speaking, IE6 is such a multi-bug brower with still mass users in the world[http://www.w3counter.com/globalstats.php]. For 8-bit PNG, IE6 can not display the α-transparent effect which makes the image looks distorted. And for 24-bit PNG, IE can not display any transparency effects at all which may cause you a headache.
You may use "Microsoft.AlphaImageLoader" to fix this problem, however, it may disrupt the web to function well. There is a fine solution from [http://www.dillerdesign.com/experiment/DD_belatedPNG/ DD_belatedPNG] to fix IE6's problem as one in dozens. But things may not always go well. Because a .JS file is not allowed to upload in this site, you must put the JavaScript code between tags "<HTML></HTML>". However, in order to secure its HTML, MediaWiki favors to convert tag "&" to "& amp;" between "<HTML></HTML>" which makes JavaScript to crash if there is a "&" tag in its code. So you may need a minor amendment for the source code to avoid "&" tag. Here is the fixed code:
Click SJTU09_DD_belatedPNG.zip to download.
- Usage
- Edit your wiki page, copy the code in the SJTU09_DD_belatedPNG.txt into the tags "<HTML></HTML>"
- Modify the '#mainDiv' in this row "DD_belatedPNG.fix('#mainDiv');" to the DIV you want to fix for the PNG transparency