From 5df79c53745fde5d6c3340a2979b1429cd5892c1 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sat, 8 Oct 2011 20:30:28 +0200 Subject: Initial import of htcd system 1.0 Signed-off-by: Henrik Rydberg --- htc/layout.htc | 348 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 348 insertions(+) create mode 100644 htc/layout.htc (limited to 'htc/layout.htc') 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 @@ +\const{HEIGHT.head}{40} +\const{HEIGHT.foot}{32} +\const{COLOR.private}{#ffffcc} +\const{COLOR.public}{#ffffff} +\const{COLOR.special}{#cccccc} +\const{COLOR.grayed}{#999999} +\def{page}{r}{ + \if("GET HEAD" which \req.method){ + \output{ + \body{bgcolor=\if(\group ne ""){\COLOR.private}{\COLOR.public}}{ + \1 + } + } + } +} +\def{show.head}{}{ + + \server.alias\uri + +} +\def{show.page}{}{ + \nif(\req.useragent cnt "Mozilla"){\resp.cont.type.charset{}}; + \switch(stat.MIME) + {text/x-htc}{ + \if(stat.MOD&1){ + \parse.public(stat.REFER) + }{ + \if(stat.MOD&8){ + \parse.private(stat.REFER) + }{ + \parse(stat.REFER) + } + } + } + {text/x-htx}{ + \show.latex(stat.REFER) + } + {text/html}{ + \resp.cont.type(stat.MIME); + \output{\minilang{\load(stat.REFER)}} + } +} +\def{show.rawpage}{}{ + \resp.cont.type(stat.MIME); + \output{\load(stat.REFER)} +} +\def{show.srcpage}{}{ + \resp.cont.type{text/plain} + \nif(\req.useragent cnt "Mozilla"){\resp.cont.type.charset{}}; + \output{ + \switch(stat.MIME) + {text/x-htc}{ + \%/SRC\uri HTC/1.2 Last modified \time2http(stat.LASTMOD) + } + {text/html}{ + \%/SRC\uri HTML Last modified \time2http(stat.LASTMOD) + } + {text/x-htx}{ + \%/SRC\uri HTX/1.2 (LaTeX) Last modified \time2http(stat.LASTMOD) + } + \load(stat.REFER) + } +} +\def{show.banner}{}{ + \ldef{shist}{x}{ + \find.rec{\1}{ + \if(count BANNER){ + [ban:=rest BANNER]\run.local{ban} + }{ + \if(count PARENT){\shist(PARENT)} + } + } + }; + \db{TREE}{\shist(stat.URI rleftand "/")} +} +\def{calc.height}{}{ + \ldef{chist}{x}{ + \find.rec{\1}{ + \if(count BANNER)(first BANNER){\if(count PARENT){\chist(PARENT)}{\HEIGHT.head}} + }{ + \HEIGHT.head + } + }; + \db{TREE}{\chist(stat.URI rleftand "/")} +} +\def{page.header}{}{ + \ldef{hist}{x}{ + \find.rec{\1}{ + \if(count PARENT){\hist(PARENT)}; + \if(URI eq uri){\run.local{ALIAS}}{\href{\andlang;[URI]}{\run.local{ALIAS}}}> + } + } + \page{ + \show.banner + \table{width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=\COLOR.special}{ + \tr{valign=top align=left}{ + \td{width=60%}{ + \font{size=3}{ + [uri:=stat.URI;dir:=uri rleftand "/";n:=0]; + \db{TREE}{ + \hist(dir); + \query(PARENT eq dir && URI ne "/"){ + \if{\user.allow(X.CLEAR){\now}}{ + \if(n){|}[n+=1]\if(URI eq uri){ + \run.local{ALIAS} + }{ + \href{\andlang;[URI]}{\run.local{ALIAS}} + } + } + } + }\space; + } + }; + \td{width=40% align=right}{ + \font{size=3}{ + \if{\user.id}{\user.name}{\lang{Anonymous}{Anonym}}, \time2htc{\now} + } + } + } + } + } +} +\def{show.icons}{}{} +\def{page.footer}{}{ + \output{ + \body{bgcolor=\COLOR.special}{ + \table{width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=\COLOR.special}{ + \td{valign=top align=left}{ + \iref{mailto:\server.admin}{\icons/mail.gif} + \if{\user.id}{ + \iref{/LOGOUT\uri\andarg}{\icons/logout.gif} + }{ + \iref{/LOGIN\uri\andarg}{\icons/login.gif} + } + \on.clear{ADM}{ + \iref{\andlang/HTC/admin.htc}{\icons/adm.gif} + } + \iref{ + \lang{/sv}{/en}[stat.URI] + }{ + \icons/lang.gif + } + \if{\user.id}{ + \iref{\andlang/HTC/prefs.htc}{\icons/prefs.gif} + } + \iref{/SRC[stat.URI]}{\icons/source.gif} + [acc:=\upload.clear(stat.URI)]\if((first acc) ne "ROOT"){ + \on.clear(acc){ + \iref{\server/RAW[stat.URI]}{\icons/transfer.gif} + } + } + \show.icons; + } + \td{valign=center align=right}{ + HTCd/1.2 \[\lang{en}{sv}\] \time2htc(stat.LASTMOD) + } + } + } + } +} +\redef{show.register}{}{ + \lang{ + If your are not a registered user, register first. + }{ + Om du inte {\"a}r en registrerad anv{\"a}ndare, + registrera dig f{\"o}rst. + } +} +\def{page.login}{}{ + \cond{T.alias}{} + \page{ + \h1{\server.alias Login} + \if{\user.id}{ + \lang{ + You are logged in as \user.name; (\user.alias). + }{ + Du {\"a}r inloggad som \user.name; (\user.alias). + } +

+ \href{\referer}{\lang{Continue}{Forts{\"a}tt}} + }{ + \lang{ + This server contains information only accessible to registered users. + Each registered user receives a user ID and a PIN code. + }{ + Den h{\"a}r servern inneh{\aa}ller information som bara {\"a}r + tillg{\"a}nglig f{\"o}r registrerade anv{\"a}ndare. + Varje registrerad anv{\"a}ndare erh{\aa}ller ett anv{\"a}ndar-ID + och en PIN-kod. + }; +

+ \show.register; +

+ \lang{ + To login, enter your email address and PIN code below. + \it{DO NOT} enter your unix password! + }{ + F{\"o}r att logga in, fyll i din epostadress och PIN kod nedan. + An{\"a}nd \it{EJ} ditt unix passord! + }; + [remcookie:=0;email:=\T.alias]; + \for(i:=0)(i<\ncookie)(i+=1){ + \if(\cookie[i].name eq "RESEND"){ + [remcookie=1;email=\cookie[i].val]; +

+ \font{color=red}{ + \lang{E-mail has been sent to }{E-post har skickats till }[email] + (\lang{provided user exist}{f{\"o}rutsatt anv{\"a}ndaren existerar}) + } + } + }; +

+ \form{ + \variable{remcookie}(remcookie); + \variable{ref}{\referer}; + \table{ + \tr{ + \td{\lang{E-mail (or alias)}{E-post (eller alias)}:} + \td{\input{email}{28}(email)} + }; + \tr{ + \td{PIN:} + \td{ + \passwd{pin}{6} + } + }; + \tr{ + \td{colspan=2}{ + \check{T.keep}{\endtime} + \lang{ + Keep me logged in by storing to disk + }{ + H{\aa}ll mig inloggad genom att spara till disk + }; + } + }; + \tr{ + \td{colspan=2}{ + \button{Login} + \button{Forgot my PIN code} + \button{Assign a new (4 digit) PIN code} + } + } + } + } + \h3{\lang{Nota bene}{Observera}} +

+ \li{ + \lang{ + You must allow a COOKIE containing your user ID and + PIN code to be set. If you normally do not allow cookies, + you need to make an exception in this case, or by some other + means arrange for the cookie to be set. + If you don't know what a cookie is, you can probably ignore + this paragraph. + }{ + Du m{\aa}ste till{\aa}ta s{\"a}ttning av en COOKIE med + ditt anv{\"a}ndar-ID och PIN-kod. Om du normalt inte till{\aa}ter + "kakor", m{\aa}ste du antingen g{\"o}ra ett undantag i det + h{\"a}r fallet, eller p{\aa} n{\aa}got annat s{\"a}tt + se till att kakan blir satt p{\aa} r{\"a}tt s{\"a}tt. + Vet du inte vad en kaka {\"a}r, kan du troligtvis bortse + fr{\aa}n denna paragraf. + } + }; +

+ \li{ + \lang{ + If logging in from a 'shared' browser, don't forget to logout + properly when you're done. Otherwise, the person after you may + enter the server as you. + }{ + Om du loggar in fr{\aa}n en 'delad' webbl{\"a}sare, gl{\"o}m + inte att logga ut dig ordentligt. Annars kan n{\"a}sta person + komma in p{\aa} servern som dig. + } + } + } + }; + \onpost{ + \cond{T.keep}{0}; + \cond{T.uid}{\getuser{\T.email}}; + \switch(first \T.cmd) + {Login}{ + \log{SetID \[\T.uid.\T.pin\] (\T.keep)}; + \setcookie{ID}{\T.uid.\T.pin}{\T.keep}; + \if{\T.remcookie}{\setcookie{RESEND}{deleted}{1}}; + \redirect{\T.ref}; + } + {Forgot}{ + \su{\T.uid}{ + \mail.user{PIN code}{ + Your PIN code is \user.pin. + + /Admin + } + }; + \if(\T.email ne ""){\setcookie{RESEND}{\T.email}}; + \redirect{\server\this\andarg}; + } + {Assign}{ + \su{\T.uid}{ + \if(\user.pin eq \T.pin){ + \user.pin.set{\random{4}}\user.update; + \mail.user{New PIN code}{ + Your new PIN code is \user.pin. + + /Admin + } + } + }; + \if(\T.email ne ""){\setcookie{RESEND}{\T.email}}; + \redirect{\server\this\andarg}; + }{ + Don't understand "\T.cmd" + } + } +} +\def{page.logout}{}{ + \setcookie{ID}{deleted}{1}; + \resp.cont.type.charset{}; + \redirect{\server/} +} +\def{layout}{}{ + \if{\FRAMES}{ + [cacheok=1;stat.X.CACHE=\days{14}]; + \output{ + \show.head; + + + + + + } + }{ + \resp.cont.type.charset{}; + \output{\show.head}; + \page.header; + \output{

}; + \show.page; + \output{

}; + \page.footer + } +} +\def{show.latex}{x}{ + \parse.public{\1} +} + -- cgit v1.2.3