Team:SJTU-BioX-Shanghai/Others

From 2009.igem.org

(Difference between revisions)
m
m
 
(One intermediate revision not shown)
Line 3: Line 3:
=Tools for Wiki=
=Tools for Wiki=
==Mass upload script - Improve efficiency for uploading==
==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.
+
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
;Mass files upload for MediaWiki and iGEM 2009 Team Wiki
Line 9: Line 9:
The script is modified from [http://commons.wikimedia.org/wiki/Commons:File_upload_service/Script '''''Eloquence's upload bot'''''].
The script is modified from [http://commons.wikimedia.org/wiki/Commons:File_upload_service/Script '''''Eloquence's upload bot'''''].
-
Our member [[User:Pnstontale|'''''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.
+
Our member [[User:Pnstontale|'''''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.
-
: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 [https://www.activestate.com/activeperl/downloads/ ActivePerl].  
+
: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:
:Usage:
#Put the files you want to upload in the directory "upload".
#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.
+
#Edit the Perl file and read though the descriptions. Modify the variables "''$username''" and "''$password''" according to you, then save this file.
-
#Modify other variables such as $siteType, $siteBase, $loginUrl & $uploadUrl if necessary.
+
#Modify other variables such as ''$siteType'', ''$siteBase'', ''$loginUrl'' & ''$uploadUrl'' for additional usage if necessary.
#Run this script and wait. It will show you its progress.
#Run this script and wait. It will show you its progress.
-
#If it shows "Mission finished", close this window or press [Ctrl] + [C].
+
#If it says "Mission finished", close this window or press [Ctrl] + [C].
==Convert Word Document(.doc) to MediaWiki==
==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.
+
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 type.
+
:Here are some tools to convert a word Document(.doc) to MediaWiki codes.
#[http://www.mediawiki.org/wiki/Word_macros http://www.mediawiki.org/wiki/Word_macros]
#[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://en.wikipedia.org/wiki/Help:WordToWiki http://en.wikipedia.org/wiki/Help:WordToWiki]
#[http://www.openoffice.org OpenOffice.org software]
#[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.
+
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<nowiki>:</nowiki> You need a PHP server to run this script.
;Warning<nowiki>:</nowiki> You need a PHP server to run this script.
Line 58: Line 58:
:Usage:
: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).
+
#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.
#Put the HTML & TXT file to the same directory of the PHP script.
-
#Modify the variable $target to the basename(for example: example).
+
#Modify the variable '''''$target''''' to the basename(for example: example).
-
#Run this PHP script under a PHP server.
+
#Run this PHP script under a PHP server environment.
-
==PNG transparency fix for Internet Explorer 6==
+
==PNG transparency amendment 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<sup>[http://www.w3counter.com/globalstats.php]</sup>. 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.
+
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<sup>[http://www.w3counter.com/globalstats.php]</sup>. 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 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 "''<nowiki><HTML></HTML></nowiki>''". However, in order to secure its HTML, MediaWiki favors to convert tag "&" to "& amp;" between "''<nowiki><HTML></HTML></nowiki>''" 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:
+
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 "''<nowiki><HTML></HTML></nowiki>''". However, in order to secure HTML codes, MediaWiki favors to convert the character "&" to "& amp;" between "''<nowiki><HTML></HTML></nowiki>''" 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 [https://static.igem.org/mediawiki/2009/a/a8/SJTU09_DD_belatedPNG.zip SJTU09_DD_belatedPNG.zip] to download.
  Click [https://static.igem.org/mediawiki/2009/a/a8/SJTU09_DD_belatedPNG.zip SJTU09_DD_belatedPNG.zip] to download.
:'''Usage'''
:'''Usage'''
-
#Edit your wiki page, copy the code in the SJTU09_DD_belatedPNG.txt into the tags "<nowiki><HTML></HTML></nowiki>"
+
#Edit your wiki page, copy the code in the ''SJTU09_DD_belatedPNG.txt'' into the tags "<nowiki><HTML></HTML></nowiki>"
#Modify the '#mainDiv' in this row "DD_belatedPNG.fix('#mainDiv');" to the DIV you want to fix for the PNG transparency
#Modify the '#mainDiv' in this row "DD_belatedPNG.fix('#mainDiv');" to the DIV you want to fix for the PNG transparency
{{Template:SJTU09_enddiv}}
{{Template:SJTU09_enddiv}}

Latest revision as of 01:29, 22 October 2009

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