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