Root/web/style.sh

Source at commit 4226d0bca2c0c6e6a9a58e18e773c5136bf2cc67 created 9 years 1 month ago.
By Werner Almesberger, Experimental alignments for solidify.
1#!/bin/sh
2
3if [ -z "$BASE" ]; then
4BASE=http://projects.qi-hardware.com/index.php/p/ben-scans/source/tree/master/
5fi
6
7# ----- section ---------------------------------------------------------------
8
9
10section()
11{
12    echo "$__before_set"
13    __before_set=
14    cat <<EOF
15<P>
16<HR>
17<P>
18<A name="$1">
19<H2>$2</H2>
20EOF
21}
22
23
24# ----- scan_set / images / texts ---------------------------------------------
25
26
27scan_set()
28{
29    echo "$__before_set"
30    __id=$1
31    __before_set="</TABLE></TABLE>"
32    __before_image="<TR><TD><TABLE bgcolor="#e4e4e4" border=0 cellspacing=3 cellpadding=2><TR>"
33    __before_text="<TR>"
34    cat <<EOF
35<P>
36<A name="$1">
37<TABLE border=0 cellspacing=0 cellpadding=0>
38  <TR>
39    <TD>
40      <TABLE border=1 cellspacing=0 width="100%">
41    <TR>
42      </TABLE>
43  <TR>
44    <TD>
45      <TABLE bgcolor="#fff0a0" border=0 cellspacing=3 cellpadding=2
46        width="100%">
47        <TR>
48          <TD><B>$2</B>
49      </TABLE>
50EOF
51}
52
53
54__do_explain()
55{
56    cat <<EOF
57    <TABLE bgcolor="#e4e4e4" border=0 cellspacing=3 cellpadding=2 width="100%">
58      <TR>
59        <TD>
60      <TABLE bgcolor="#90ff90" border=0 cellspacing=3 cellpadding=2>
61        <TR>
62          <TD><I>
63EOF
64    cat
65    cat <<EOF
66        </I>
67      </TABLE>
68    </TABLE>
69EOF
70}
71
72
73explain_set()
74{
75    cat <<EOF
76<TR>
77  <TD>
78EOF
79    __do_explain
80}
81
82
83__do_before_image()
84{
85    echo "$__before_image"
86    __before_image=
87}
88
89
90image()
91{
92    __do_before_image
93    cat <<EOF
94<TD><IMG src="${BASE}data/jpg/$1.jpg">
95EOF
96}
97
98
99images1()
100{
101    image "$__id-1mm"
102}
103
104
105images2()
106{
107    images1
108    image "$__id-500um"
109}
110
111
112images3()
113{
114    images2
115    image "$__id-100um"
116}
117
118
119under_consideration()
120{
121    __do_before_image
122    cat <<EOF
123<TD><H1>Under consideration</H1>
124EOF
125}
126
127
128planned()
129{
130    __do_before_image
131    cat <<EOF
132<TD><H1>Planned</H1>
133EOF
134}
135
136
137in_progress()
138{
139    __do_before_image
140    cat <<EOF
141<TD><H1>In progress</H1>
142EOF
143}
144
145
146link()
147{
148    [ -r "../$1" ] || return
149    size=`ls -l ../$1 | awk '{printf $5}'`
150    if [ $size -lt 950000 ]; then
151    size="`echo $size | awk '{printf("%.0f kB", $1/1000)}'`"
152    size=
153    else
154    size="`echo $size | awk '{printf("%.1f MB", $1/1000000)}'`"
155    fi
156    echo "<A href=\"${BASE}$1\">$2</A> $size"
157}
158
159
160__text()
161{
162    echo "$__before_text"
163    __before_text=
164    echo "<TD>"
165    cat
166    link "data/pij/$1.pij.bz2" PIJ
167    link "data/dxf/$1.dxf.bz2" DXF
168    link "data/stl/$1.stl.bz2" STL
169    link "data/csv/$1.txt.bz2" "TXT(CSV)"
170}
171
172
173text()
174{
175    __text "$__id-$1"
176}
177
178
179texts2()
180{
181    text 1mm <<EOF
182X/Y step size: 1 mm.<BR>
183Z resolution: <B>DRAFT</B><BR>
184Approximate scan time: $1<BR>
185EOF
186    text 500um <<EOF
187X/Y step size: 500 &mu;m.<BR>
188Z resolution: 25 &mu;m.<BR>
189Approximate scan time: $2<BR>
190EOF
191}
192
193
194texts3()
195{
196    texts2 "$1" "$2"
197    text 100um <<EOF
198X/Y step size: 100 &mu;m.<BR>
199Z resolution: 25 &mu;m.<BR>
200Approximate scan time: $3<BR>
201EOF
202}
203
204
205# ----- scan_group / scan -----------------------------------------------------
206
207
208scan_group()
209{
210    echo "$__before_set"
211    __before_set="</TABLE>"
212    __before_hdr="<TR>"
213    __before_img="<TR>"
214    __before_text="<TR>"
215    cat <<EOF
216<P>
217<TABLE bgcolor="#e4e4e4" border=0 cellspacing=0 cellpadding=0>
218  <TR>
219EOF
220}
221
222
223scan_bar()
224{
225cat <<EOF
226<TD>
227  <TABLE border=1 cellspacing=0 width="100%">
228    <TR>
229  </TABLE>
230EOF
231}
232
233
234scan_hdr()
235{
236    echo "$__before_hdr"
237    __before_hdr=
238cat <<EOF
239<TD>
240  <TABLE bgcolor="#fff0a0" border=0 cellspacing=3 cellpadding=0 width="100%">
241    <TR>
242      <TD><B>$1</B>
243    </TABLE>
244EOF
245}
246
247
248scan_img()
249{
250    echo "$__before_img"
251    __before_img=
252cat <<EOF
253<TD>
254  <TABLE border=0 cellspacing=3 cellpadding=0>
255    <TR>
256      <TD><IMG src="${BASE}data/jpg/$1.jpg">
257  </TABLE>
258EOF
259}
260
261
262scan_text()
263{
264    echo "$__before_text"
265    __before_text=
266    echo "<TD>"
267    if [ ! -z "$3" ]; then
268    echo "$3" | __do_explain
269    fi
270    cat <<EOF
271<TABLE border=0 cellspacing=3 cellpadding=2>
272  <TR>
273EOF
274    __text $1 <<EOF
275Approximate scan time: $2<BR>
276X/Y step size: 100 &mu;m.<BR>
277Z resolution: 25 &mu;m.<BR>
278EOF
279    echo "</TABLE>"
280}
281
282
283# ----- end -------------------------------------------------------------------
284
285
286end()
287{
288    echo "$__before_set"
289    cat <<EOF
290<P>
291<HR>
292<P>
293`date -u '+%F %X'` UTC
294</BODY>
295</HTML>
296EOF
297}
298

Archive Download this file

Branches:
master



interactive