Team:SJTU-BioX-Shanghai/Others

From 2009.igem.org

Revision as of 15:56, 20 October 2009 by Pnstontale (Talk | contribs)

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...)

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, by the limit 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 File:SJTU09 MassUpload.zip to download.

The script is modified from Eloquence's upload bot. Our member pnstontale modified it to work with iGEM 2009 Team Wiki. Hope this script can improve your efficiency.

Warning: You need a Perl environment for this script. Get it at ActivePerl if you are running a Windows Operating System.
Usage:
  1. Put the files you want to upload in the directory "upload".
  2. Edit the Perl file and read though the descriptions. Modify your "username" and "password" and save.
  3. Modify other variables such as $siteType, $siteBase, $loginUrl & $uploadUrl if necessary.
  4. Run this script and wait. It will show you its progress.
  5. 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.
  1. http://www.mediawiki.org/wiki/Word_macros
  2. http://en.wikipedia.org/wiki/Help:WordToWiki
  3. OpenOffice.org software

However, the word macros may be incompatible with non-English versions of Micrsoft Word. So 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:
  1. Use 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.