Team:SJTU-BioX-Shanghai/Others

From 2009.igem.org

Team Logo ButtonTeam Logo ButtonProject ButtonTeam Logo Button

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 areas 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 compatible with iGEM 2009 Team Wiki. Hope this script can improve your efficiency or offer you any clues or inspirations in scripting. You may modify this script to fit iGEM 2010 Team Wiki or so.

Warning: You need a Perl environment for this script. You may get it from [http://www.activestate.com/activeperl/downloads/ ActivePerl]. The Windows internal VBS/JS scripts may seem unable to upload files to a MediaWiki server, so Perl scripts may be a fine solution.
Usage:
  1. Put the files you want to upload in the directory "upload".
  2. Edit the Perl file and read though the descriptions. Modify the variables "$username" and "$password" according to you, then save this file.
  3. Modify other variables such as $siteType, $siteBase, $loginUrl & $uploadUrl for additional usage if necessary.
  4. Run this script and wait. It will show you its progress.
  5. If it says "Mission finished", close this window or press [Ctrl] + [C].

Convert Word Document(.doc) to MediaWiki

It would be wonderful if all members in your team know how to write wiki codes. However, some members is not familiar with wiki codes and write contents in a word Document(.doc). So you may need to find a solution to convert word Document(.doc) to MediaWiki codes.

Here are some tools to convert a word Document(.doc) to MediaWiki codes.
  1. [http://www.mediawiki.org/wiki/Word_macros http://www.mediawiki.org/wiki/Word_macros]
  2. [http://en.wikipedia.org/wiki/Help:WordToWiki http://en.wikipedia.org/wiki/Help:WordToWiki]
  3. [http://www.openoffice.org OpenOffice.org software]

However, the word macros might be incompatible with some non-English versions of Micrsoft Word. So [http://www.openoffice.org OpenOffice.org] could be a better solution. It can export a word Document(.doc) to HTML or wiki code. However, images need to be integrated into the wiki code manually. Here is a PHP script to integrate images into the wiki code automaticly.

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:
  1. 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).
  2. Put the HTML & TXT file to the same directory of the PHP script.
  3. Modify the variable $target to the basename(for example: example).
  4. Run this PHP script under a PHP server environment.

PNG transparency amendment for Internet Explorer 6

Are you a wiki designer? If so, you may meet the same problem that we experienced. For example, if you want to display any PNG images with any transparency effects such as page backgrounds, you may get puzzled with 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 effects 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 page 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 solution 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 HTML codes, MediaWiki favors to convert the character "&" to "& amp;" between "<HTML></HTML>" which makes JavaScript to crash if there is a "&" in its code. So you may need a minor amendment for the source code to avoid "&" character. Here is the fixed code:

Click SJTU09_DD_belatedPNG.zip to download.
Usage
  1. Edit your wiki page, copy the code in the SJTU09_DD_belatedPNG.txt into the tags "<HTML></HTML>"
  2. Modify the '#mainDiv' in this row "DD_belatedPNG.fix('#mainDiv');" to the DIV you want to fix for the PNG transparency