0
|
1 #!/bin/bash
|
|
2 repositorypath="/mnt/galaxyTools/shed_tools/toolshed.nbic.nl/repos/saskia-hiltemann/ireport/71dc132e9bb2/ireport" # TODO: dependency
|
|
3 source "${repositorypath}/createHTML.sh"
|
|
4
|
|
5 echo "allparams: $@"
|
|
6 function usage() { echo "Oops!"; }
|
|
7
|
|
8
|
|
9 # set some defaults
|
|
10
|
|
11
|
|
12 set -- `getopt -n$0 -u -a --longoptions="ifusepath: galaxypath: tab: item: htmlout: label: toolpath: minwidth: coverimage:" "h:" "$@"` || usage
|
|
13 [ $# -eq 0 ] && usage
|
|
14
|
|
15 while [ $# -gt 0 ]
|
|
16 do
|
|
17 case "$1" in
|
|
18 --toolpath) repositorypath=$2;shift;;
|
|
19 --galaxypath) galaxypath=$2;shift;;
|
|
20 --minwidth) minwidth=$2;shift;;
|
|
21 --tab) tabs+=",$2";shift;;
|
|
22 --item) items+=",$2";shift;;
|
|
23 --htmlout) htmlout=$2;shift;;
|
|
24 --label) title="$@";shift;;
|
|
25 --coverimage) coverimage=$2;shift;;
|
|
26 -h) shift;;
|
|
27 --) shift;break;;
|
|
28 -*) usage;;
|
|
29 *) break;;
|
|
30 esac
|
|
31 shift
|
|
32 done
|
|
33
|
|
34
|
|
35 mkdir $galaxypath
|
|
36
|
|
37 tabs=${tabs//,/ }; tabs=${tabs/ /}
|
|
38 items=${items//,/ }; items=${items/ /}
|
|
39 title=${title//--/}
|
|
40 title=${title//label/}
|
1
|
41
|
|
42 reportname=${title// /}
|
|
43
|
0
|
44 echo -e "\n"
|
|
45 echo -e "title: $title"
|
|
46 echo -e "tabs: $tabs"
|
|
47 echo -e "items: $items"
|
|
48 echo -e "htmlout: $htmlout"
|
|
49 echo -e "coverimage: $coverimage"
|
|
50 echo -e "\n"
|
|
51
|
|
52 for i in $tabs
|
|
53 do
|
|
54 echo "tabname: $i"
|
|
55 done
|
|
56
|
|
57 coverimage=${coverimage:1}
|
|
58 echo -e "coverimage2: $coverimage"
|
|
59
|
|
60 #if no coverimage provided, use default EMC logo
|
|
61 if [[ -z $coverimage ]]
|
|
62 then
|
|
63 cp $repositorypath/intro.jpg ${galaxypath}/intro.jpg
|
|
64 coverimage="intro.jpg"
|
|
65 fi
|
|
66 echo -e "coverimage3: $coverimage"
|
|
67
|
|
68 ## Copy supporting files to output directory
|
|
69 cp ${repositorypath}/jquery.dataTables.css ${galaxypath}/jquery.dataTables.css
|
|
70 cp ${repositorypath}/jquery.dataTables.js ${galaxypath}/jquery.dataTables.js
|
|
71 cp -R ${repositorypath}/iframe-resizer/ ${galaxypath}/iframe-resizer/
|
|
72 cp -R ${repositorypath}/DataTables-1.9.4/ ${galaxypath}/DataTables-1.9.4/
|
|
73 cp ${repositorypath}/jquery.zoom.js ${galaxypath}/jquery.zoom.js
|
1
|
74 cp ${repositorypath}/jquery-ui.css ${galaxypath}/jquery-ui.css
|
|
75 cp ${repositorypath}/jquery-1.10.2.js ${galaxypath}/jquery-1.10.2.js
|
|
76 cp ${repositorypath}/jquery-ui.js ${galaxypath}/jquery-ui.js
|
0
|
77
|
|
78 echo "done copying resource files"
|
|
79 ls ${galaxypath}
|
|
80
|
|
81
|
|
82 ## Create cover HTML page
|
1
|
83 makeIntroPage "$title" $coverimage "report.html" $htmlout iReport_${reportname}.zip
|
|
84
|
|
85 ## Create copy of cover page for downloadable version
|
|
86 makeIntroPage "$title" $coverimage "report.html" coverpage.html iReport_${reportname}.zip
|
|
87 cp coverpage.html ${galaxypath}/coverpage.html
|
0
|
88
|
|
89 ## Create Report page with tabs
|
|
90 createMainPage ${galaxypath}/report.html "$tabs" "$items" $minwidth
|
|
91
|
1
|
92
|
|
93 ## Create zip file of this iReport for download by user
|
|
94 wd=`pwd`
|
|
95 cd ${galaxypath}
|
|
96 zip -r iReport_${reportname} .
|
|
97 cd $wd
|
|
98
|