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