My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
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
module(..., package.seeall)

require("cosmo")

actions = {}

actions.show_content = function(node, params, sputnik)
local city_by_tz = {}
for i, city in ipairs(node.content.cities) do
city_by_tz[city[2]] = city
end

return cosmo.f(node.templates.WORLD_CLOCK){
do_hour = function() for i=1,24 do
local slot = i + node.content.start
local t = os.date("*t", os.time() + 3600*(slot-node.content.local_tz))
local city = city_by_tz[slot]
local city_name
if city then city_name = city[1] end
cosmo.yield {
hh = string.format("%02d", t.hour),
mm = string.format("%02d", t.min),
ss = string.format("%02d", t.sec),
city = city_name,
_template = city and 1 or 2
}
end end,
}
end

actions.full_html = function(node, params, sputnik)
node.inner_html = cosmo.f(node.templates.TIMED_UPDATE){
url = node.urls:show_content(),
timeout = node.content.timeout * 1000
}
return node.wrappers.default(node, params, sputnik)
end

Change log

r193 by takhteyev on Feb 10, 2008   Diff
update the worldclock demo

Go to: 
Project members, sign in to write a code review

Older revisions

r192 by takhteyev on Feb 10, 2008   Diff
Fixing the worldclock demo for the new
version

r178 by takhteyev on Jan 19, 2008   Diff
Moving plugins to rocks

r176 by takhteyev on Jan 19, 2008   Diff
More plugins

All revisions of this file

File info

Size: 1399 bytes, 38 lines
Powered by Google Project Hosting