liquid_feedback_frontend
diff app/main/initiative/show.rss.lua @ 0:3bfb2fcf7ab9
Version alpha1
author | bsw/jbe |
---|---|
date | Wed Nov 18 12:00:00 2009 +0100 (2009-11-18) |
parents | |
children | 733f65c0c0a0 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/initiative/show.rss.lua Wed Nov 18 12:00:00 2009 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +slot.set_layout("rss") 1.5 + 1.6 +local function rss_channel(channel) 1.7 + for key, val in pairs(channel) do 1.8 + slot.put("<", key, ">", val, "</", key, ">") 1.9 + end 1.10 +end 1.11 + 1.12 +local function rss_item(item) 1.13 + slot.put("<item>") 1.14 + for key, val in pairs(item) do 1.15 + slot.put("<", key, ">", val, "</", key, ">") 1.16 + end 1.17 + slot.put("</item>") 1.18 +end 1.19 + 1.20 + 1.21 +local initiative = Initiative:by_id(param.get_id()) 1.22 + 1.23 +rss_channel{ 1.24 + title = initiative.name, 1.25 + description = initiative.current_draft.content, 1.26 + language = "de", 1.27 + copyright = initiative.current_draft.author.name, 1.28 + pubDate = "Tue, 8 Jul 2008 2:43:19" 1.29 +} 1.30 + 1.31 +for i, suggestion in ipairs(initiative.suggestions) do 1.32 + 1.33 + local text = suggestion.name 1.34 + 1.35 + text = text .. " (" 1.36 + text = text .. tostring(suggestion.plus2_unfulfilled_count + suggestion.plus2_unfulfilled_count) .. "++ " 1.37 + text = text .. tostring(suggestion.plus1_unfulfilled_count + suggestion.plus1_unfulfilled_count) .. "+ " 1.38 + text = text .. tostring(suggestion.minus1_unfulfilled_count + suggestion.minus1_unfulfilled_count) .. "- " 1.39 + text = text .. tostring(suggestion.minus2_unfulfilled_count + suggestion.minus2_unfulfilled_count) .. "--" 1.40 + 1.41 + text = text .. ")" 1.42 + 1.43 + rss_item{ 1.44 + title = text, 1.45 + description = suggestion.content, 1.46 + link = "http://localhost/lf/suggestion/show/" .. tostring(suggestion.id) .. ".html", 1.47 + author = "", 1.48 + guid = "guid", 1.49 + pubDate = "Tue, 8 Jul 2008 2:43:19" 1.50 + } 1.51 + 1.52 +end 1.53 \ No newline at end of file