summaryrefslogtreecommitdiff
path: root/web/style.sh
blob: 0bb235db082e8f6f99dfd1def475f5a7131081d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
#!/bin/sh

if [ -z "$BASE" ]; then
BASE="http://neo900.org/git/?p=scans;a=blob_plain;hb=HEAD;f="
fi

BG=#e4e4e0
TITLE=#ffd0b0
EXPLAIN=#ffff90


# ----- section ---------------------------------------------------------------


flush()
{
    echo "$__before_set"
    __before_set=
    echo "<P>"
}


section()
{
    flush
    cat <<EOF
<HR>
<P>
<A name="$1">
<H2>$2</H2>
EOF
}


# ----- scan_set / images / texts ---------------------------------------------


scan_set()
{
    echo "$__before_set"
    __id=$1
    __before_set="</TABLE></TABLE>"
    __before_image="<TR><TD><TABLE bgcolor="$BG" border=0 cellspacing=3 cellpadding=2><TR>"
    __before_text="<TR>"
    cat <<EOF
<P>
<A name="$1">
<TABLE border=0 cellspacing=0 cellpadding=0>
  <TR>
    <TD>
      <TABLE border=1 cellspacing=0 width="100%">
	<TR>
      </TABLE>
  <TR>
    <TD>
      <TABLE bgcolor="$TITLE" border=0 cellspacing=3 cellpadding=2
        width="100%">
        <TR>
          <TD><B>$2</B>
      </TABLE>
EOF
}


__do_explain()
{
    cat <<EOF
    <TABLE bgcolor="$BG" border=0 cellspacing=3 cellpadding=2 width="100%">
      <TR>
        <TD>
	  <TABLE bgcolor="$EXPLAIN" border=0 cellspacing=3 cellpadding=2>
	    <TR>
	      <TD><I>
EOF
    cat
    cat <<EOF
		</I>
	  </TABLE>
    </TABLE>
EOF
}


explain_set()
{
    cat <<EOF
<TR>
  <TD>
EOF
    __do_explain
}


__do_before_image()
{
    echo "$__before_image"
    __before_image=
}


image()
{
    __do_before_image
    cat <<EOF
<TD><A href="${BASE}data/png/$1.png"><IMG src="${BASE}data/jpg/$1.jpg"></A>
EOF
}


images1()
{
    image "$__id-1mm"
}


image2nd()
{
    image "$__id-500um"
}


image3rd()
{
    image "$__id-100um"
}


image4th()
{
    image "$__id-50um"
}


images2()
{
    images1
    image2nd
}


images3()
{
    images2
    image3rd
}


images4()
{
    images3
    image4th
}


under_consideration()
{
    __do_before_image
    cat <<EOF
<TD><H1>Under consideration</H1>
EOF
}


planned()
{
    __do_before_image
    cat <<EOF
<TD><H1>Planned</H1>
EOF
}


in_progress()
{
    __do_before_image
    cat <<EOF
<TD><H1>In progress</H1>
EOF
}


link()
{
    [ -r "../$1" ] || return
    size=`ls -l ../$1 | awk '{printf $5}'`
    if [ $size -lt 95000 ]; then
	size="`echo $size | awk '{printf("%.0f kB", $1/1000)}'`"
	size=
    else
	size="`echo $size | awk '{printf("%.1f MB", $1/1000000)}'`"
    fi
    echo "<A href=\"${BASE}$1\">$2</A> $size"
}


__text()
{
    echo "$__before_text"
    __before_text=
    echo "<TD>"
    cat
    link "data/pix/$1.pix.bz2" PIX
    link "data/stl/$1.stl.bz2" STL
}


text()
{
    __text "$__id-$1"
}


text1st()
{
    text 1mm <<EOF
X/Y step size: 1 mm.<BR>
Z resolution: <B>DRAFT</B><BR>
Approximate scan time: $1<BR>
EOF
}


text2nd()
{
    text 500um <<EOF
X/Y step size: 500 &mu;m.<BR>
Z resolution: 25 &mu;m.<BR>
Approximate scan time: $1<BR>
EOF
}


texts1()
{
    text1st "$1"
}


texts2()
{
    text1st "$1"
    text2nd "$2"
}


text3rd()
{
    text 100um <<EOF
X/Y step size: 100 &mu;m.<BR>
Z resolution: 25 &mu;m.<BR>
Approximate scan time: $1<BR>
EOF
}


texts3()
{
    texts2 "$1" "$2"
    text3rd "$3"
}


text4th()
{
    text 50um <<EOF
X/Y step size: 50 &mu;m.<BR>
Z resolution: 25 &mu;m.<BR>
Approximate scan time: $1<BR>
EOF
}


texts4()
{
    texts3 "$1" "$2" "$3"
    text4th "$4"
}


# ----- scan_group / scan -----------------------------------------------------


scan_group()
{
    echo "$__before_set"
    __before_set="</TABLE>"
    __before_hdr="<TR>"
    __before_img="<TR>"
    __before_text="<TR>"
    cat <<EOF
<P>
<TABLE bgcolor="$BG" border=0 cellspacing=0 cellpadding=0>
  <TR>
EOF
}


scan_bar()
{
cat <<EOF
<TD>
  <TABLE border=1 cellspacing=0 width="100%">
    <TR>
  </TABLE>
EOF
}


scan_hdr()
{
    echo "$__before_hdr"
    __before_hdr=
cat <<EOF
<TD>
  <TABLE bgcolor="$TITLE" border=0 cellspacing=3 cellpadding=0 width="100%">
    <TR>
      <TD><B>$1</B>
    </TABLE>
EOF
}


scan_img()
{
    echo "$__before_img"
    __before_img=
cat <<EOF
<TD>
  <TABLE border=0 cellspacing=3 cellpadding=0>
    <TR>
      <TD><IMG src="${BASE}data/jpg/$1.jpg">
  </TABLE>
EOF
}


scan_text()
{
    echo "$__before_text"
    __before_text=
    echo "<TD>"
    if [ ! -z "$3" ]; then
	echo "$3" | __do_explain
    fi
    cat <<EOF
<TABLE border=0 cellspacing=3 cellpadding=2>
  <TR>
EOF
    __text $1 <<EOF
Approximate scan time: $2<BR>
X/Y step size: 100 &mu;m.<BR>
Z resolution: 25 &mu;m.<BR>
EOF
    echo "</TABLE>"
}


# ----- photos ----------------------------------------------------------------


photo()
{
    cat <<EOF
<A href="${BASE}pics/large/$1.jpg"><IMG src="${BASE}pics/small/$1.jpg"></A>
EOF
}


# ----- end -------------------------------------------------------------------


end()
{
    echo "$__before_set"
    cat <<EOF
<P>
<HR>
<P>
`date -u '+%F %X'` UTC
</BODY>
</HTML>
EOF
}