summaryrefslogtreecommitdiff
path: root/htc/layout.htc
diff options
context:
space:
mode:
Diffstat (limited to 'htc/layout.htc')
-rw-r--r--htc/layout.htc348
1 files changed, 348 insertions, 0 deletions
diff --git a/htc/layout.htc b/htc/layout.htc
new file mode 100644
index 0000000..b3e7b44
--- /dev/null
+++ b/htc/layout.htc
@@ -0,0 +1,348 @@
1\const{HEIGHT.head}{40}
2\const{HEIGHT.foot}{32}
3\const{COLOR.private}{#ffffcc}
4\const{COLOR.public}{#ffffff}
5\const{COLOR.special}{#cccccc}
6\const{COLOR.grayed}{#999999}
7\def{page}{r}{
8 \if("GET HEAD" which \req.method){
9 \output{
10 \body{bgcolor=\if(\group ne ""){\COLOR.private}{\COLOR.public}}{
11 \1
12 }
13 }
14 }
15}
16\def{show.head}{}{
17 <head>
18 <title>\server.alias\uri</title>
19 </head>
20}
21\def{show.page}{}{
22 \nif(\req.useragent cnt "Mozilla"){\resp.cont.type.charset{}};
23 \switch(stat.MIME)
24 {text/x-htc}{
25 \if(stat.MOD&1){
26 \parse.public(stat.REFER)
27 }{
28 \if(stat.MOD&8){
29 \parse.private(stat.REFER)
30 }{
31 \parse(stat.REFER)
32 }
33 }
34 }
35 {text/x-htx}{
36 \show.latex(stat.REFER)
37 }
38 {text/html}{
39 \resp.cont.type(stat.MIME);
40 \output{\minilang{\load(stat.REFER)}}
41 }
42}
43\def{show.rawpage}{}{
44 \resp.cont.type(stat.MIME);
45 \output{\load(stat.REFER)}
46}
47\def{show.srcpage}{}{
48 \resp.cont.type{text/plain}
49 \nif(\req.useragent cnt "Mozilla"){\resp.cont.type.charset{}};
50 \output{
51 \switch(stat.MIME)
52 {text/x-htc}{
53 \%/SRC\uri HTC/1.2 Last modified \time2http(stat.LASTMOD)
54 }
55 {text/html}{
56 \%/SRC\uri HTML Last modified \time2http(stat.LASTMOD)
57 }
58 {text/x-htx}{
59 \%/SRC\uri HTX/1.2 (LaTeX) Last modified \time2http(stat.LASTMOD)
60 }
61 \load(stat.REFER)
62 }
63}
64\def{show.banner}{}{
65 \ldef{shist}{x}{
66 \find.rec{\1}{
67 \if(count BANNER){
68 [ban:=rest BANNER]\run.local{ban}
69 }{
70 \if(count PARENT){\shist(PARENT)}
71 }
72 }
73 };
74 \db{TREE}{\shist(stat.URI rleftand "/")}
75}
76\def{calc.height}{}{
77 \ldef{chist}{x}{
78 \find.rec{\1}{
79 \if(count BANNER)(first BANNER){\if(count PARENT){\chist(PARENT)}{\HEIGHT.head}}
80 }{
81 \HEIGHT.head
82 }
83 };
84 \db{TREE}{\chist(stat.URI rleftand "/")}
85}
86\def{page.header}{}{
87 \ldef{hist}{x}{
88 \find.rec{\1}{
89 \if(count PARENT){\hist(PARENT)};
90 \if(URI eq uri){\run.local{ALIAS}}{\href{\andlang;[URI]}{\run.local{ALIAS}}}>
91 }
92 }
93 \page{
94 \show.banner
95 \table{width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=\COLOR.special}{
96 \tr{valign=top align=left}{
97 \td{width=60%}{
98 \font{size=3}{
99 [uri:=stat.URI;dir:=uri rleftand "/";n:=0];
100 \db{TREE}{
101 \hist(dir);
102 \query(PARENT eq dir && URI ne "/"){
103 \if{\user.allow(X.CLEAR){\now}}{
104 \if(n){|}[n+=1]\if(URI eq uri){
105 \run.local{ALIAS}
106 }{
107 \href{\andlang;[URI]}{\run.local{ALIAS}}
108 }
109 }
110 }
111 }\space;
112 }
113 };
114 \td{width=40% align=right}{
115 \font{size=3}{
116 \if{\user.id}{\user.name}{\lang{Anonymous}{Anonym}}, \time2htc{\now}
117 }
118 }
119 }
120 }
121 }
122}
123\def{show.icons}{}{}
124\def{page.footer}{}{
125 \output{
126 \body{bgcolor=\COLOR.special}{
127 \table{width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=\COLOR.special}{
128 \td{valign=top align=left}{
129 \iref{mailto:\server.admin}{\icons/mail.gif}
130 \if{\user.id}{
131 \iref{/LOGOUT\uri\andarg}{\icons/logout.gif}
132 }{
133 \iref{/LOGIN\uri\andarg}{\icons/login.gif}
134 }
135 \on.clear{ADM}{
136 \iref{\andlang/HTC/admin.htc}{\icons/adm.gif}
137 }
138 \iref{
139 \lang{/sv}{/en}[stat.URI]
140 }{
141 \icons/lang.gif
142 }
143 \if{\user.id}{
144 \iref{\andlang/HTC/prefs.htc}{\icons/prefs.gif}
145 }
146 \iref{/SRC[stat.URI]}{\icons/source.gif}
147 [acc:=\upload.clear(stat.URI)]\if((first acc) ne "ROOT"){
148 \on.clear(acc){
149 \iref{\server/RAW[stat.URI]}{\icons/transfer.gif}
150 }
151 }
152 \show.icons;
153 }
154 \td{valign=center align=right}{
155 HTCd/1.2 \[\lang{en}{sv}\] \time2htc(stat.LASTMOD)
156 }
157 }
158 }
159 }
160}
161\redef{show.register}{}{
162 \lang{
163 If your are not a registered user, register first.
164 }{
165 Om du inte {\"a}r en registrerad anv{\"a}ndare,
166 registrera dig f{\"o}rst.
167 }
168}
169\def{page.login}{}{
170 \cond{T.alias}{}
171 \page{
172 \h1{\server.alias Login}
173 \if{\user.id}{
174 \lang{
175 You are logged in as \user.name; (\user.alias).
176 }{
177 Du {\"a}r inloggad som \user.name; (\user.alias).
178 }
179 <p>
180 \href{\referer}{\lang{Continue}{Forts{\"a}tt}}
181 }{
182 \lang{
183 This server contains information only accessible to registered users.
184 Each registered user receives a user ID and a PIN code.
185 }{
186 Den h{\"a}r servern inneh{\aa}ller information som bara {\"a}r
187 tillg{\"a}nglig f{\"o}r registrerade anv{\"a}ndare.
188 Varje registrerad anv{\"a}ndare erh{\aa}ller ett anv{\"a}ndar-ID
189 och en PIN-kod.
190 };
191 <p>
192 \show.register;
193 <p>
194 \lang{
195 To login, enter your email address and PIN code below.
196 \it{DO NOT} enter your unix password!
197 }{
198 F{\"o}r att logga in, fyll i din epostadress och PIN kod nedan.
199 An{\"a}nd \it{EJ} ditt unix passord!
200 };
201 [remcookie:=0;email:=\T.alias];
202 \for(i:=0)(i<\ncookie)(i+=1){
203 \if(\cookie[i].name eq "RESEND"){
204 [remcookie=1;email=\cookie[i].val];
205 <p>
206 \font{color=red}{
207 \lang{E-mail has been sent to }{E-post har skickats till }[email]
208 (\lang{provided user exist}{f{\"o}rutsatt anv{\"a}ndaren existerar})
209 }
210 }
211 };
212 <p>
213 \form{
214 \variable{remcookie}(remcookie);
215 \variable{ref}{\referer};
216 \table{
217 \tr{
218 \td{\lang{E-mail (or alias)}{E-post (eller alias)}:}
219 \td{\input{email}{28}(email)}
220 };
221 \tr{
222 \td{PIN:}
223 \td{
224 \passwd{pin}{6}
225 }
226 };
227 \tr{
228 \td{colspan=2}{
229 \check{T.keep}{\endtime}
230 \lang{
231 Keep me logged in by storing to disk
232 }{
233 H{\aa}ll mig inloggad genom att spara till disk
234 };
235 }
236 };
237 \tr{
238 \td{colspan=2}{
239 \button{Login}
240 \button{Forgot my PIN code}
241 \button{Assign a new (4 digit) PIN code}
242 }
243 }
244 }
245 }
246 \h3{\lang{Nota bene}{Observera}}
247 <p>
248 \li{
249 \lang{
250 You must allow a COOKIE containing your user ID and
251 PIN code to be set. If you normally do not allow cookies,
252 you need to make an exception in this case, or by some other
253 means arrange for the cookie to be set.
254 If you don't know what a cookie is, you can probably ignore
255 this paragraph.
256 }{
257 Du m{\aa}ste till{\aa}ta s{\"a}ttning av en COOKIE med
258 ditt anv{\"a}ndar-ID och PIN-kod. Om du normalt inte till{\aa}ter
259 "kakor", m{\aa}ste du antingen g{\"o}ra ett undantag i det
260 h{\"a}r fallet, eller p{\aa} n{\aa}got annat s{\"a}tt
261 se till att kakan blir satt p{\aa} r{\"a}tt s{\"a}tt.
262 Vet du inte vad en kaka {\"a}r, kan du troligtvis bortse
263 fr{\aa}n denna paragraf.
264 }
265 };
266 <p>
267 \li{
268 \lang{
269 If logging in from a 'shared' browser, don't forget to logout
270 properly when you're done. Otherwise, the person after you may
271 enter the server as you.
272 }{
273 Om du loggar in fr{\aa}n en 'delad' webbl{\"a}sare, gl{\"o}m
274 inte att logga ut dig ordentligt. Annars kan n{\"a}sta person
275 komma in p{\aa} servern som dig.
276 }
277 }
278 }
279 };
280 \onpost{
281 \cond{T.keep}{0};
282 \cond{T.uid}{\getuser{\T.email}};
283 \switch(first \T.cmd)
284 {Login}{
285 \log{SetID \[\T.uid.\T.pin\] (\T.keep)};
286 \setcookie{ID}{\T.uid.\T.pin}{\T.keep};
287 \if{\T.remcookie}{\setcookie{RESEND}{deleted}{1}};
288 \redirect{\T.ref};
289 }
290 {Forgot}{
291 \su{\T.uid}{
292 \mail.user{PIN code}{
293 Your PIN code is \user.pin.
294
295 /Admin
296 }
297 };
298 \if(\T.email ne ""){\setcookie{RESEND}{\T.email}};
299 \redirect{\server\this\andarg};
300 }
301 {Assign}{
302 \su{\T.uid}{
303 \if(\user.pin eq \T.pin){
304 \user.pin.set{\random{4}}\user.update;
305 \mail.user{New PIN code}{
306 Your new PIN code is \user.pin.
307
308 /Admin
309 }
310 }
311 };
312 \if(\T.email ne ""){\setcookie{RESEND}{\T.email}};
313 \redirect{\server\this\andarg};
314 }{
315 Don't understand "\T.cmd"
316 }
317 }
318}
319\def{page.logout}{}{
320 \setcookie{ID}{deleted}{1};
321 \resp.cont.type.charset{};
322 \redirect{\server/}
323}
324\def{layout}{}{
325 \if{\FRAMES}{
326 [cacheok=1;stat.X.CACHE=\days{14}];
327 \output{
328 \show.head;
329 <frameset rows="\calc.height,*,\HEIGHT.foot" border=0 scrolling=no onload="\killframes">
330 <frame scrolling=no name=head align=top src="/HEAD\uri\andarg">
331 <frame scrolling=auto name=body align=left src="/BODY\uri\andarg">
332 <frame scrolling=no name=foot align=bottom src="/FOOT\uri\andarg">
333 </frameset>
334 }
335 }{
336 \resp.cont.type.charset{};
337 \output{\show.head};
338 \page.header;
339 \output{<br><br>};
340 \show.page;
341 \output{<br><br>};
342 \page.footer
343 }
344}
345\def{show.latex}{x}{
346 \parse.public{\1}
347}
348