annotate createHTML.sh @ 0:ac5f9272033b draft

first upload
author saskia-hiltemann
date Tue, 01 Jul 2014 11:42:23 -0400
parents
children 440f4aa3db97
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
1 function makeIntroPage ( ){
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
2 echo "Creating Intro Page"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3 title="$1"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4 coverimage=$2
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5 link=$3
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6 htmlout=$4
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 echo -e "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 <html>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10 <head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 </head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 <body>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13 <!-- dummy intro page, since first page will not have any javascript/css features enabled unless specified in universe_wsgi.ini file, but subsequent pages will -->
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 <br/>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 <br/>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 <center>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 <b><font size=\"15\"> iReport: ${title} </font></b><br/>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 <br/>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 <br/>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20 <a href=\"$link\"> Click here to view report </a> <br/><br/>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 <a href=\"$link\"> <img src="$coverimage" width=\"50%\" alt=\"loading image..\"/> </a><br/><br/>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22 </center>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 </body>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 </html>" > $htmlout
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 function makeTabContent ( ){
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 tab=$1 #name of current tab
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31 itemslist=$2 #list of all items
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 contentline="<br/>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 imgcount=0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 #echo -e "\n Creating items. itemslist: $itemslist"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 for item in $itemslist
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 do
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38 #echo -e "\n -> item : $item"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 item=${item/::/:emptycol:}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 declare -a myarr=(`echo $item |sed 's/:/ /g'`)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 #echo "break: ${myarr[3]}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 if [ ${myarr[0]} == $tab ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 ## add contents of text field to page####
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46 if [ ${myarr[1]} == "text" ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48 text=${myarr[2]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 ## allow some html formatting tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50 text=${text//==lt==strong==gt==/<strong>} # search for strong tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 text=${text//==lt====slash==strong==gt==/<\/strong>} # search for strong tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52 text=${text//==lt==em==gt==/<em>} # search for strong tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53 text=${text//==lt====slash==em==gt==/<\/em>} # search for strong tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 text=${text//==lt==b==gt==/<strong>} # search for strong tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56 text=${text//==lt====slash==b==gt==/<\/strong>} # search for strong tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 text=${text//==lt==i==gt==/<em>} # search for strong tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 text=${text//==lt====slash==i==gt==/<\/em>} # search for strong tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 text=${text//==lt==br==gt==/<br\/>} # search for strong tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 text=${text//==lt====br==slash==gt==/<br\/>} # search for strong tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 text=${text//==lt==h1==gt==/<h1>} # search for h1-h6 tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 text=${text//==lt==h2==gt==/<h2>} # search for h1-h6 tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 text=${text//==lt==h3==gt==/<h3>} # search for h1-h6 tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65 text=${text//==lt==h4==gt==/<h4>} # search for h1-h6 tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 text=${text//==lt==h5==gt==/<h5>} # search for h1-h6 tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67 text=${text//==lt==h6==gt==/<h6>} # search for h1-h6 tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 text=${text//==lt====slash==h1==gt==/<\/h1>} # search for h1-h6 closing tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 text=${text//==lt====slash==h2==gt==/<\/h2>} # search for h1-h6 closing tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70 text=${text//==lt====slash==h3==gt==/<\/h3>} # search for h1-h6 closing tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
71 text=${text//==lt====slash==h4==gt==/<\/h4>} # search for h1-h6 closing tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
72 text=${text//==lt====slash==h5==gt==/<\/h5>} # search for h1-h6 closing tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
73 text=${text//==lt====slaxh==h6==gt==/<\/h6>} # search for h1-h6 closing tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
75 ## display everything else verbatim
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
76 text=${text//==space==/ }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77 text=${text//==colon==/:}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
78 text=${text//==comma==/,}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
79 text=${text//==slash==/\/}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
80 text=${text//==lt==/&lt;}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
81 text=${text//==gt==/&gt;}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
82 text=${text//==apos==/&apos;}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
83 text=${text//==quote==/&quot;}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
84 text=${text//&&/&amp;}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
85 text=${text//\\n/<br/>}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
86 text=${text//\\t/&emsp;}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
87 text=${text//\&r\&n/<br/>}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
88 text=${text//\&r/<br/>}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
89 text=${text//\&n/<br/>}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
90 text=${text//\&c/:}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
91 contentline="${contentline}${text}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
92 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
93
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
94 ## add contents of a text file to page
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
95 if [ ${myarr[1]} == "textfile" ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
96 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
97 tfile=${myarr[2]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
98 fname=`basename ${tfile}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
99 fname=${fname%.*}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
100 fname="${fname}.txt"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
101 cp ${tfile} "${galaxypath}/${fname}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
102
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
103 #estimate height for iframe based on number oflines in the file
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
104 numlines=`wc -l ${tfile} | cut -d" " -f1`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
105 minheight=$[$numlines*17]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
106
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
107 contentline="${contentline}<iframe class=\"invisibleframe\" src=\"${fname}\" width=\"100%\" height=\"$minheight\"> </iframe>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
108 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
109
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
110 ## add image file to page
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
111 if [ ${myarr[1]} == "image" ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
112 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
113 imgcount=$[$imgcount+1]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
114 #restore file suffix for html
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
115 ftype=`file ${myarr[2]}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
116 zoomlevel=${myarr[4]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
117 zoomenable=${myarr[5]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
118 align=${myarr[6]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
119 #####echo "zoomenable:${zoomenable}, align:${align}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
120 if [[ $ftype == *JPEG* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
121 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
122 suffix=".jpg"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
123 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
124 if [[ $ftype == *SVG* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
125 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
126 suffix=".svg"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
127 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
128 if [[ $ftype == *PNG* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
129 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
130 suffix=".png"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
131 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
132
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
133 image=`basename ${myarr[2]}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
134 image=${image%.dat}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
135 image="${image}${suffix}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
136 cp ${myarr[2]} ${galaxypath}/${image}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
137
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
138 if [[ ${align} == "none" ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
139 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
140 alignstring=""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
141 alignstring2=""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
142 else
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
143 alignstring="<div float=\"${align}\">"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
144 alignstring2="</div>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
145
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
146 alignstring="align=\"${align}\""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
147 alignstring2=""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
148 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
149
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
150
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
151 if [[ ${zoomlevel} -eq 0 ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
152 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
153 widthstring=""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
154 else
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
155 widthstring="width=\"${zoomlevel}\""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
156 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
157
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
158 if [[ ${zoomlevel} -eq 0 || ${zoomenable} == "N" ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
159 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
160 contentline="${contentline}<span id=\"img${imgcount}\"> <img src=\"${image}\" ${alignstring} ${widthstring} alt=\"loading image..\"/></span>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
161 else
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
162 contentline="${contentline}<span class=\"zoomme\" id=\"img${imgcount}\"> <img src=\"${image}\" ${alignstring} ${widthstring} alt=\"loading image..\"/></span>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
163 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
164
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
165 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
166 if [ ${myarr[1]} == "table" ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
167 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
168 maxlines=50000
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
169 tsvfile_orig=${myarr[2]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
170 tsvfile="tablehead.tsv"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
171 fname=`basename ${tsvfile_orig}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
172 fname=${fname%.*}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
173 fancy=${myarr[4]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
174 makelinks=${myarr[5]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
175 #echo "\nmakelinks: $makelinks fancy: $fancy <br>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
176
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
177 #TODO client side database for large files. For now only display first section of file and add download link
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
178 numlines=`wc -l ${tsvfile_orig} |cut -d" " -f1`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
179
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
180 head -${maxlines} ${tsvfile_orig} > tsvtmpfile
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
181
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
182 #remove any empty or header lines (lines starting with #, unless vcf file, then keep #CHROM line)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
183 awk 'BEGIN{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
184 FS="\t"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
185 OFS="\t"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
186 }{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
187 if((index($0,"#")==1 && index($0,"#CHROM")!=1) || $0==""){
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
188 headerlines++
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
189 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
190 else print $0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
191
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
192 }END{}' tsvtmpfile > ${tsvfile}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
193
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
194 if [[ $makelinks == "Y" ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
195 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
196 col=${myarr[6]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
197 prefix=${myarr[7]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
198 suffix=${myarr[8]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
199 suffix=${suffix/emptycol/}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
200 suffix=${suffix/==quote==/&}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
201 prefix=${prefix/emptycol/}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
202 prefix=${prefix/==quote==/&}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
203 prefix=${prefix/==colon==/:}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
204 #echo "prefix: $prefix"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
205
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
206 #edit the table to include links
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
207 awk 'BEGIN{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
208 FS="\t"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
209 OFS="\t"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
210 url="'"$prefix"'"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
211 url2="'"$suffix"'"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
212 prefix="<a href=\42"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
213 suffix="\42>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
214 col="'"$col"'"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
215 end="</a>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
216 }{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
217 if(FNR==1)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
218 print $0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
219 else{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
220 $col=prefix""url""$col""url2""suffix""$col""end
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
221 print $0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
222 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
223 }END{}' ${tsvfile} > ${tsvfile}2
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
224 #echo "converted file: "
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
225 #cat ${tsvfile}2
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
226 else
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
227 cp ${tsvfile} ${tsvfile}2
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
228 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
229
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
230 if [ $fancy == "Y" ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
231 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
232 perl ${repositorypath}/tsv2html.pl < ${tsvfile}2 > ${galaxypath}/htmltable_${fname}.html
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
233 #contentline="${contentline}\n<div class=\"resizable\" id=\"iframe${iframecount}\"><iframe src=\"htmltable_${fname}.html\" style=\"max-width: 100%;vertical-align: top;\" onload=\"resizeIframe(this)\"></iframe></div>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
234 #contentline="${contentline}\n<iframe class=\"resizable\" id=\"iframe${iframecount}\" src=\"htmltable_${fname}.html\" style=\"max-width: 100%;vertical-align: top;\" onload=\"resizeIframe(this)\"></iframe>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
235 contentline="${contentline}\n<iframe class=\"invisibleframe fancyiframe\" src=\"htmltable_${fname}.html\" width=\"100%\" style=\"min-height: 300px; overflow-y: hidden; overflow-x: scroll\" ></iframe>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
236
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
237 iframecount=$[$iframecount+1]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
238 else
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
239 perl ${repositorypath}/tsv2html_simple.pl < ${tsvfile}2 > ${galaxypath}/htmltable_${fname}.html
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
240 #contentline="${contentline}\n<iframe class=\"invisibleframe\" id=\"iframe${iframecount}\" style=\"max-width: 100%; vertical-align: top;\" src=\"htmltable_${fname}.html\" onload=\"resizeIframe(this)\"></iframe>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
241 contentline="${contentline}\n<iframe class=\"unfancyiframe invisibleframe\" src=\"htmltable_${fname}.html\" scrolling=\"no\" style=\"max-width: 100%; vertical-align: top;\" onload=\"resizeIframe(this)\"></iframe>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
242 iframecount=$[$iframecount+1]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
243 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
244
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
245 if [[ $numlines -gt ${maxlines} ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
246 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
247 tablename=`basename ${tsvfile_orig}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
248 cp ${tsvfile_orig} ${galaxypath}/$tablename
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
249 contentline="${contentline}<br/>\nLarge tables will be supported soon. The first ${maxlines} lines are shown here, and you can download the full file <a href=\"${tablename}\">here</a>."
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
250 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
251 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
252
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
253 if [[ ${myarr[1]} == "pdf" ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
254 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
255 pdffile=${myarr[2]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
256 fname=`basename ${pdffile}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
257 fname=${fname%.dat}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
258 pdfname="${fname}.pdf"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
259 cp ${pdffile} "${galaxypath}/${pdfname}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
260
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
261 width=1000
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
262 height=800
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
263 #contentline="${contentline}<object data=\"${fname}\" type=\"application/pdf\" width=\"1000\" height=\"1000\"><p>It appears you have no PDF plugin for your browser. No biggie... you can <a href=\"${fname}\">click here to download the PDF file.</a></p></object>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
264 echo -e "<html><body><object data=\"${pdfname}\" type=\"application/pdf\" width=\"$width\" height=\"$height\"><embed src=\"${pdfname}\" type=\"application/pdf\" /><p>It appears you have no PDF plugin for your browser. No biggie... you can <a href=\"${pdfname}\">click here to download the PDF file.</a></p></object></body></html>" > "${galaxypath}/${fname}.html"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
265 width=$[$width+10]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
266 height=$[$height+10]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
267 contentline="${contentline}<iframe src=\"${fname}.html\" width=\"${width}\" height=\"${height}\"></iframe>\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
268
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
269 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
270 ## link to a location on the web, open in new window
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
271 if [ ${myarr[1]} == "weblink" ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
272 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
273 url=${myarr[2]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
274 linktext=${myarr[4]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
275 url=${url/==colon==/:}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
276 url=${url/==quote==/&}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
277
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
278 contentline="${contentline}<a href=\"${url}\" target=\"_blank\">${linktext}</a>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
279 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
280
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
281 ## link to a file in the history
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
282 if [ ${myarr[1]} == "link" ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
283 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
284 linkfile=${myarr[2]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
285 apiid=${myarr[4]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
286 isireport=${myarr[5]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
287 linkfilename=`basename ${linkfile}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
288 linktext=${myarr[6]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
289
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
290
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
291 #check for some basic filetypes
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
292 ftype=`file $linkfile`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
293 if [[ $ftype == *HTML* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
294 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
295 linkfilename=${linkfilename%.dat}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
296 linkfilename=${linkfilename}.html
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
297 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
298 if [[ $ftype == *PNG* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
299 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
300 linkfilename=${linkfilename%.dat}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
301 linkfilename=${linkfilename}.png
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
302 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
303 if [[ $ftype == *SVG* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
304 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
305 linkfilename=${linkfilename%.dat}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
306 linkfilename=${linkfilename}.svg
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
307 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
308 if [[ $ftype == *JPEG* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
309 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
310 linkfilename=${linkfilename%.dat}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
311 linkfilename=${linkfilename}.jpg
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
312 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
313
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
314
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
315 if [[ ${isireport} == "Y" ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
316 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
317 linkfilename="/datasets/${apiid}/display/"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
318 else
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
319 cp ${linkfile} "${galaxypath}/${linkfilename}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
320 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
321
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
322 contentline="${contentline}<a href=\"${linkfilename}\">${linktext}</a>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
323 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
324
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
325 ## link to files in an archive in the history item
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
326 if [[ ${myarr[1]} == "links" ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
327 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
328 #echo "making links:"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
329 archive=${myarr[2]}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
330 fname=`basename ${archive}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
331 fname=${fname%.dat}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
332 ftype=`file $archive`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
333 mkdir ${galaxypath}/archive_${fname}/
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
334
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
335 #echo "archive type: `file $archive`"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
336 # decompress archive
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
337 if [[ $ftype == *Zip* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
338 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
339 #echo "detected zip file"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
340 cp $archive ${galaxypath}/archive_${fname}/${fname}.zip
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
341 wd=`pwd`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
342 cd ${galaxypath}/archive_${fname}/
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
343 unzip -q ${fname}.zip
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
344 rm ${fname}.zip
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
345 cd $wd
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
346 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
347 if [[ $ftype == *tar* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
348 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
349 cp $archive ${galaxypath}/archive_${fname}/${fname}.tar
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
350 wd=`pwd`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
351 cd ${galaxypath}/archive_${fname}/
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
352 tar xf ${fname}.tar
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
353 rm ${fname}.tar
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
354 cd $wd
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
355 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
356 if [[ $ftype == *gzip* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
357 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
358 cp $archive ${galaxypath}/archive_${fname}/${fname}.gz
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
359 gunzip ${galaxypath}/archive_${fname}/${fname}.gz
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
360 #ls ${galaxypath}/archive_${fname}/
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
361
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
362 # check for tar.gz
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
363 ftype=`file ${galaxypath}/archive_${fname}/${fname}`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
364 if [[ $ftype == *tar* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
365 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
366 # turns out it was tar.gz
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
367 rm -Rf ${galaxypath}/archive_${fname}/*
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
368 ls ${galaxypath}/archive_${fname}/
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
369 cp $archive ${galaxypath}/archive_${fname}/${fname}.tar.gz
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
370
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
371 wd=`pwd`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
372 cd ${galaxypath}/archive_${fname}/
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
373 tar xzf ${fname}.tar.gz
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
374 cd $wd
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
375 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
376 wait
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
377 rm -f ${galaxypath}/archive_${fname}/*.tar
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
378 rm -f ${galaxypath}/archive_${fname}/*.tar.gz
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
379 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
380 if [[ $ftype == *bzip2* ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
381 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
382 cp $archive ${galaxypath}/archive_${fname}/${fname}.gz
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
383 gunzip2 ${galaxypath}/archive_${fname}/${fname}.gz
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
384 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
385
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
386
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
387
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
388 # add links to webpage
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
389 # separate line for each folder, files within folder on same line
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
390 for linkfile in `ls ${galaxypath}/archive_${fname}/ |sort -V`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
391 do
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
392 #echo "<br/> ->making link to file: $linkfile "
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
393 if [ -d ${galaxypath}/archive_${fname}/$linkfile ] # if directory, add break, and list all contained files, max level 1 deep
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
394 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
395 #echo "<br/> ->is directory, entering: $linkfile "
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
396 #ls ${galaxypath}/archive_${fname}/$linkfile
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
397 contentline="${contentline}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
398 for linkfile2 in `ls ${galaxypath}/archive_${fname}/$linkfile | sort -V`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
399 do
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
400 #echo "<br/> ->making link to file: ${galaxypath}/archive_${fname}/$linkfile2"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
401 if [ -f ${galaxypath}/archive_${fname}/$linkfile/$linkfile2 ] # if directory, add break, and list all contained files, max level 1 deep
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
402 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
403 #echo "<br/> ->is file, making link: $linkfile "
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
404 label=`basename $linkfile2`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
405 label=${label%.*}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
406 contentline="${contentline}<a class=\"mylinks\" href=\"archive_${fname}/${linkfile}/${linkfile2}\">${label}</a>&nbsp;\n "
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
407 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
408 done
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
409 elif [ -f ${galaxypath}/archive_${fname}/$linkfile ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
410 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
411 label=`basename ${galaxypath}/archive_${fname}/$linkfile`
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
412 label=${label%.*}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
413 contentline="${contentline}<a class=\"mylinks\" href=\"archive_${fname}/${linkfile}\">$label</a>&nbsp;\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
414 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
415 done
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
416
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
417
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
418 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
419
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
420 if [[ ${myarr[3]} == "Y" ]]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
421 then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
422 contentline="${contentline}<br/>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
423 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
424 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
425 done
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
426
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
427 echo "${contentline}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
428 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
429
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
430
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
431 createMainPage (){
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
432 page=$1
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
433 tabtitles=$2 #comma-separated list of tab titles
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
434 tabitems=$3
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
435 iframecount=1
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
436 minwidth=$4
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
437
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
438 echo "createMainPage: tabitems: $tabitems. tabtitles: $tabtitles"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
439 # create correct number of tabs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
440 count=0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
441
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
442 tabtitles=${tabtitles//,/ }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
443 tabtitles=${tabtitles//==colon==/:}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
444 tabslist="<ul>\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
445 mytabs=""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
446 for title in $tabtitles
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
447 do
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
448 #create list of tabs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
449
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
450 count=$[count+1]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
451 title2=${title//_s_/ }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
452 tabslist="${tabslist} <li><a href=\"#tabs-${count}\">${title2}</a></li>\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
453
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
454 #create tabs with content
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
455 tabcontent=$(makeTabContent $title "$tabitems")
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
456 mytabs="${mytabs}\n<div id=\"tabs-${count}\">\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
457 mytabs="${mytabs}${tabcontent}"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
458 mytabs="${mytabs}\n</div>\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
459 done
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
460 tabslist="${tabslist}</ul>"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
461
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
462 #output the webpage
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
463 echo -e "<!doctype html>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
464 <head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
465 <meta charset=\"utf-8\">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
466 <title>jQuery UI Tabs - Default functionality</title>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
467
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
468
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
469 <link rel=\"stylesheet\" href=\"//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css\">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
470 <link rel=\"stylesheet\" href=\"/resources/demos/style.css\">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
471
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
472 <script src=\"//code.jquery.com/jquery-1.10.2.js\"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
473 <script src=\"//code.jquery.com/ui/1.10.4/jquery-ui.js\"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
474 <script type=\"text/javascript\" src=\"iframe-resizer/src/iframeResizer.js\"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
475 <script type=\"text/javascript\" src=\"jquery.zoom.js\"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
476 <script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
477 \$(function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
478 \$( \"#tabs\" ).tabs();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
479 });
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
480
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
481 \$(function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
482 \$( \".resizable\" ).resizable();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
483 });
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
484
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
485 \$(document).ready(function(){
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
486 \$('.zoomme').zoom();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
487 \$('#ex2').zoom({ on:'grab' });
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
488 \$('#ex3').zoom({ on:'click' });
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
489 \$('#ex4').zoom({ on:'toggle' });
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
490 \$('.fancyiframe').iFrameResize({
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
491 heightCalculationMethod: 'max',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
492 minHeight: 250,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
493 scrolling: true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
494 checkOrigin: false,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
495 bodyMargin: 15
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
496 });
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
497 \$('.unfancyiframe').iFrameResize({
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
498 heightCalculationMethod: 'max',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
499 scrolling: false,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
500 checkOrigin: false
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
501 });
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
502 });
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
503
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
504 </script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
505
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
506
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
507 <script language=\"javascript\" type=\"text/javascript\">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
508 function resizeIframe(obj) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
509 oldheight=obj.style.height
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
510 oldwidth=obj.style.width
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
511 obj.style.height = obj.contentWindow.document.body.scrollHeight + 4 + 'px';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
512 obj.style.width = obj.contentWindow.document.body.scrollWidth + 4 + 'px';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
513
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
514 if(obj.style.height < 50){
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
515 obj.style.height=oldheight
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
516 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
517 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
518 </script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
519 <style type=\"text/css\">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
520 body {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
521 min-width: ${minwidth}px;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
522 width: ${minwidth}px;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
523 min-height: 100%;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
524 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
525 .invisibleframe{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
526 border: 0px;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
527 overflow: hidden
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
528 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
529 .mylinks{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
530 color: blue !important;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
531 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
532 .mylinks:visited {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
533 color: #551A8B !important;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
534 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
535 </style>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
536 <style >
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
537 .zoomme {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
538 display: inline-block;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
539 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
540 </style>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
541
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
542
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
543 </head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
544 <body>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
545
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
546 <div id=\"tabs\" style=\"display:inline-block; min-height:100%; min-width:${minwidth}px\">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
547 $tabslist
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
548
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
549 $mytabs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
550 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
551
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
552
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
553 </body>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
554 </html>" > $page
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
555
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
556
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
557
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
558 }