-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathExpress.xxm
58 lines (56 loc) · 1.95 KB
/
Express.xxm
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
[[@DataLank,xxmSession,fCommon]][[!var
qr:TQueryResult;
id,i:integer;
r:string;
db:TDataConnection;
d1:TDateTime;
]][[
id:=Context['id'].AsInteger;
r:=Context.URL;
i:=Length(r);
while (i<>0) and (r[i]<>'/') do dec(i);
SetLength(r,i);
db:=Session.Connection;
qr:=TQueryResult.Create(db,
'select P.guid, P.url, P.created, P.pubdate, P.title, O.opinion, S.label, S.color'+
' from "Post" P'+
' inner join "Feed" F on F.id=P.feed_id'+
' left outer join "Subscription" S on S.feed_id=P.feed_id and S.user_id=$1'+
' left outer join "Opinion" O on O.user_id=$1 and O.post_id=P.id'+
' where P.id=$2',[Session.UserID,id]);
try
Context.Include('dHead.xxmi',[r]);
d1:=double(qr['pubdate'])+Session.TimeBias;
<<div style="padding-bottom:4pt;">>
if UtcNow+Session.TimeBias-d1>180 then
begin
<<div class="date">>=FormatDateTime('ddd yyyy-mm-dd hh:nn',d1)<</div>>
end
else
begin
<<div class="date" title="[[=FormatDateTime('ddd yyyy-mm-dd hh:nn:ss',d1)]]">>=FormatDateTime('mm-dd hh:nn',d1)<</div>>
end;
]]
[[#ShowLabel(qr.GetStr('label'),qr.GetStr('color'),'')]]
<b>>#qr['title']<</b>
</div>
<form method="post" action="ExpressNew.xxm" onsubmit="fsub()">
<input type="hidden" name="id" value="[[=id]]" />
<textarea name="opinion" id="op1" wordwrap="soft" style="width:90%;height:5em;" >>=qr['opinion']<</textarea><br />
<input type="submit" value="Express" id="subm1" />
</form>
<script>
document.getElementById("op1").focus();
function fsub(){
document.getElementById("subm1").value="Posting...";
}
</script>
<div style="height:75vh;margin-top:4pt;border-top:4px solid gold;color:#9999AA;font-size:0.8em;">
<span title="[[=qr['guid']]]">>=qr['url']<</span>
<a class="raw" target="postview" href="[[=r]]Post.xxm?[[=Context.ContextString(csQueryString)]]"
title="[[=FormatDateTime('ddd yyyy-mm-dd hh:nn:ss',double(qr['created']))]]"> ℹ </a>
</div>>
finally
qr.Free;
end;
Context.Include('dFoot.xxmi');