annotate createHTML.sh @ 1:440f4aa3db97 draft

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