# HG changeset patch
# User bsw
# Date 1270411511 -7200
# Node ID 0849be39114032d43d2cee208320989cfa5ebdf9
# Parent ff1926efa6aa11b62c9d3be8544b0492536ea826
Public read access; Read-only API for initiatives; Prepared integration of OpenID
diff -r ff1926efa6aa -r 0849be391140 app/main/_filter/21_auth.lua
--- a/app/main/_filter/21_auth.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/_filter/21_auth.lua Sun Apr 04 22:05:11 2010 +0200
@@ -1,8 +1,8 @@
local auth_needed = not (
request.get_module() == 'index'
and (
- request.get_view() == 'login'
- or request.get_action() == 'login'
+ request.get_view() == "login"
+ or request.get_action() == "login"
or request.get_view() == "register"
or request.get_action() == "register"
or request.get_view() == "about"
@@ -12,8 +12,35 @@
or request.get_action() == "confirm_notify_email"
or request.get_action() == "set_lang"
)
+ or request.get_module() == "openid"
)
+if config.public_access then
+
+ if
+ request.get_module() == "area" and (
+ request.get_view() == "list"
+ or request.get_view() == "show"
+ or request.get_view() == "show_tab"
+ )
+ or request.get_module() == "issue" and request.get_view() == "show"
+ or request.get_module() == "issue" and request.get_view() == "show_tab"
+ or request.get_module() == "initiative" and request.get_view() == "show"
+ or request.get_module() == "initiative" and request.get_view() == "show_partial"
+ or request.get_module() == "initiative" and request.get_view() == "show_tab"
+ or request.get_module() == "suggestion" and request.get_view() == "show"
+ or request.get_module() == "draft" and request.get_view() == "diff"
+ then
+ auth_needed = false
+ end
+
+end
+
+if config.public_access and not app.session.member_id and auth_needed and request.get_module() == "index" and request.get_view() == "index" then
+ request.redirect{ module = "area", view = "list" }
+ return
+end
+
-- if not app.session.user_id then
-- trace.debug("DEBUG: AUTHENTICATION BYPASS ENABLED")
-- app.session.user_id = 1
diff -r ff1926efa6aa -r 0849be391140 app/main/_filter_view/30_navigation.lua
--- a/app/main/_filter_view/30_navigation.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/_filter_view/30_navigation.lua Sun Apr 04 22:05:11 2010 +0200
@@ -1,13 +1,37 @@
slot.put_into("app_name", config.app_title)
--- display navigation only, if user is logged in
-if app.session.member == nil then
- slot.select('navigation', function()
+slot.select('navigation', function()
+
+ if app.session.member then
+ ui.link{
+ image = { static = "icons/16/house.png" },
+ text = _"Home",
+ module = 'index',
+ view = 'index'
+ }
+ end
+
+ if app.session.member or config.public_access then
+ ui.link{
+ image = { static = "icons/16/package.png" },
+ text = _"Areas",
+ module = 'area',
+ view = 'list'
+ }
+
+ end
+
+ if app.session.member == nil then
ui.link{
image = { static = "icons/16/key.png" },
text = _"Login",
module = 'index',
- view = 'login'
+ view = 'login',
+ params = {
+ redirect_module = request.get_module(),
+ redirect_view = request.get_view(),
+ redirect_id = param.get_id()
+ }
}
ui.link{
image = { static = "icons/16/book_edit.png" },
@@ -27,68 +51,50 @@
module = 'index',
view = 'about'
}
- end)
- execute.inner()
- return
-end
-
-slot.select('navigation', function()
-
- ui.link{
- image = { static = "icons/16/house.png" },
- text = _"Home",
- module = 'index',
- view = 'index'
- }
-
- ui.link{
- image = { static = "icons/16/time.png" },
- text = _"Timeline",
- module = "timeline",
- view = "index"
- }
+ else
- ui.link{
- image = { static = "icons/16/package.png" },
- text = _"Areas",
- module = 'area',
- view = 'list'
- }
-
- ui.link{
- image = { static = "icons/16/group.png" },
- text = _"Members",
- module = 'member',
- view = 'list',
- params = { member_list = "newest" }
- }
+ ui.link{
+ image = { static = "icons/16/time.png" },
+ text = _"Timeline",
+ module = "timeline",
+ view = "index"
+ }
- ui.link{
- image = { static = "icons/16/book_edit.png" },
- text = _"Contacts",
- module = 'contact',
- view = 'list'
- }
-
- ui.link{
- image = { static = "icons/16/information.png" },
- text = _"About",
- module = 'index',
- view = 'about'
- }
-
- if app.session.member.admin then
-
- slot.put(" ")
+ ui.link{
+ image = { static = "icons/16/group.png" },
+ text = _"Members",
+ module = 'member',
+ view = 'list',
+ params = { member_list = "newest" }
+ }
ui.link{
- attr = { class = { "admin_only" } },
- image = { static = "icons/16/cog.png" },
- text = _"Admin",
- module = 'admin',
- view = 'index'
+ image = { static = "icons/16/book_edit.png" },
+ text = _"Contacts",
+ module = 'contact',
+ view = 'list'
+ }
+
+ ui.link{
+ image = { static = "icons/16/information.png" },
+ text = _"About",
+ module = 'index',
+ view = 'about'
}
+ if app.session.member.admin then
+
+ slot.put(" ")
+
+ ui.link{
+ attr = { class = { "admin_only" } },
+ image = { static = "icons/16/cog.png" },
+ text = _"Admin",
+ module = 'admin',
+ view = 'index'
+ }
+
+ end
end
end)
diff -r ff1926efa6aa -r 0849be391140 app/main/_filter_view/34_stylesheet.lua
--- a/app/main/_filter_view/34_stylesheet.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/_filter_view/34_stylesheet.lua Sun Apr 04 22:05:11 2010 +0200
@@ -25,6 +25,8 @@
if tab_mode then
config.user_tab_mode = tab_mode
end
+else
+ config.user_tab_mode = "accordeon_first_expanded"
end
local web20 = config.user_tab_mode == "accordeon"
@@ -39,12 +41,15 @@
slot.set_layout("blank")
end
-
-ui.container{
- attr = {
- class = web20 and "web20" or "web10"
- },
- content = function()
- execute.inner()
- end
-}
\ No newline at end of file
+if request.get_module() ~= "api" then
+ ui.container{
+ attr = {
+ class = web20 and "web20" or "web10"
+ },
+ content = function()
+ execute.inner()
+ end
+ }
+else
+ execute.inner()
+end
\ No newline at end of file
diff -r ff1926efa6aa -r 0849be391140 app/main/_filter_view/35_openid.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main/_filter_view/35_openid.lua Sun Apr 04 22:05:11 2010 +0200
@@ -0,0 +1,6 @@
+auth.openid.xrds_header{
+ module = "openid",
+ view = "announce.xrds"
+}
+
+execute.inner()
\ No newline at end of file
diff -r ff1926efa6aa -r 0849be391140 app/main/_layout/xml.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main/_layout/xml.html Sun Apr 04 22:05:11 2010 +0200
@@ -0,0 +1,2 @@
+
+
diff -r ff1926efa6aa -r 0849be391140 app/main/api/_filter/00_api.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main/api/_filter/00_api.lua Sun Apr 04 22:05:11 2010 +0200
@@ -0,0 +1,25 @@
+if not config.api_enabled then
+ error("API is not enabled.")
+end
+
+local api_key = param.get("key")
+
+if not api_key then
+ error("No API key supplied.")
+end
+
+local setting_key = "liquidfeedback_frontend_api_key"
+
+local setting = Setting:new_selector()
+ :add_where{ "key = ?", setting_key }
+ :add_where{ "value = ?", api_key }
+ :join("member", nil, "member.id = setting.member_id")
+ :add_where("member.active")
+ :optional_object_mode()
+ :exec()
+
+if not setting then
+ error("Supplied API key is not valid.")
+end
+
+execute.inner()
diff -r ff1926efa6aa -r 0849be391140 app/main/api/initiative.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main/api/initiative.lua Sun Apr 04 22:05:11 2010 +0200
@@ -0,0 +1,193 @@
+local id = param.get_id()
+local min_id = param.get("min_id")
+local max_id = param.get("max_id")
+local area_id = param.get("area_id", atom.integer)
+local issue_id = param.get("issue_id", atom.integer)
+local policy_id = param.get("policy_id", atom.integer)
+local state = param.get("state")
+local agreed = param.get("agreed")
+local rank = param.get("rank")
+local search = param.get("search")
+local search_context = param.get("search_context") or "full"
+local limit = param.get("limit", atom.integer)
+local order = param.get("order")
+
+local initiatives_selector = Initiative:new_selector()
+ :join("issue", nil, "issue.id = initiative.id")
+ :join("area", nil, "area.id = issue.area_id")
+ :join("policy", nil, "policy.id = issue.policy_id")
+
+if id then
+ initiatives_selector:add_where{"initiative.id = ?", id}
+end
+
+if min_id then
+ initiatives_selector:add_where{"initiative.id >= ?", min_id}
+end
+
+if max_id then
+ initiatives_selector:add_where{"initiative.id <= ?", max_id}
+end
+
+if area_id then
+ initiatives_selector:add_where{"area.id = ?", area_id}
+end
+
+if issue_id then
+ initiatives_selector:add_where{"issue.id = ?", issue_id}
+end
+
+if policy_id then
+ initiatives_selector:add_where{"policy.id = ?", policy_id}
+end
+
+if state then
+ Issue:modify_selector_for_state(state)
+end
+
+if agreed then
+ initiatives_selector:add_where("initiative.agreed")
+end
+
+if rank then
+ initiatives_selector:add_where{ "initiative.rank = ?", rank }
+end
+
+if search then
+ if search_context == "full" then
+ elseif search_context == "title" then
+ end
+end
+
+if order == "supporter_count" then
+ initiatives_selector:add_order_by("initiative.supporter_count")
+end
+
+initiatives_selector:add_order_by("initiative.id")
+
+if limit then
+ initiatives_selector:limit(limit)
+end
+
+local api_engine = param.get("api_engine") or "xml"
+
+local function format_timestamp(timestamp)
+ if timestamp then
+ return format.timestamp(timestamp)
+ else
+ return ""
+ end
+end
+
+local fields = {
+
+ { name = "area_id", field = "area.id" },
+ { name = "area_name", field = "area.name" },
+ { name = "issue_id", field = "issue.id" },
+ {
+ name = "issue_state",
+ func = function(record)
+ return record.issue.state
+ end
+ },
+ {
+ name = "issue_created",
+ field = "issue.created",
+ func = function(record)
+ return format_timestamp(record.issue_created)
+ end
+ },
+ {
+ name = "issue_accepted",
+ field = "issue.accepted",
+ func = function(record)
+ return format_timestamp(record.issue_accepted)
+ end
+ },
+ {
+ name = "issue_half_frozen",
+ field = "issue.half_frozen",
+ func = function(record)
+ return format_timestamp(record.issue_half_frozen)
+ end
+ },
+ {
+ name = "issue_fully_frozen",
+ field = "issue.fully_frozen",
+ func = function(record)
+ return format_timestamp(record.issue_fully_frozen)
+ end
+ },
+ {
+ name = "issue_closed",
+ field = "issue.closed",
+ func = function(record)
+ return format_timestamp(record.issue_closed)
+ end
+ },
+ { name = "issue_admission_time", field = "issue.admission_time" },
+ { name = "issue_discussion_time", field = "issue.discussion_time" },
+ { name = "issue_verification_time", field = "issue.verification_time" },
+ { name = "issue_voting_time", field = "issue.voting_time" },
+ { name = "issue_ranks_available", field = "issue.ranks_available" },
+
+ { name = "policy_issue_quorum_num", field = "policy.issue_quorum_num" },
+ { name = "policy_issue_quorum_den", field = "policy.issue_quorum_den" },
+ { name = "policy_initiative_quorum_num",
+ field = "policy.initiative_quorum_num" },
+ { name = "policy_initiative_quorum_den",
+ field = "policy.initiative_quorum_den" },
+ { name = "policy_majority_num", field = "policy.majority_num" },
+ { name = "policy_majority_den", field = "policy.majority_den" },
+ { name = "policy_majority_strict", field = "policy.majority_strict" },
+ { name = "id", field = "initiative.id" },
+ { name = "name", field = "initiative.name" },
+ { name = "discussion_url", field = "initiative.discussion_url" },
+ {
+ name = "created",
+ field = "initiative.created",
+ func = function(record)
+ return format.timestamp(record.created)
+ end
+ },
+ { name = "revoked", field = "initiative.revoked" },
+ { name = "suggested_initiative_id", field = "initiative.suggested_initiative_id" },
+ { name = "admitted", field = "initiative.admitted" },
+ { name = "issue_population", field = "issue.population" },
+ { name = "supporter_count", field = "initiative.supporter_count" },
+ { name = "informed_supporter_count", field = "initiative.informed_supporter_count" },
+ { name = "satisfied_supporter_count", field = "initiative.satisfied_supporter_count" },
+ { name = "satisfied_informed_supporter_count",
+ field = "initiative.satisfied_informed_supporter_count" },
+ { name = "issue_vote_now", field = "issue.vote_now" },
+ { name = "issue_vote_later", field = "issue.vote_later" },
+ { name = "issue_voter_count", field = "issue.voter_count" },
+ { name = "positive_votes", field = "initiative.positive_votes" },
+ { name = "negative_votes", field = "initiative.negative_votes" },
+ { name = "agreed", field = "initiative.agreed" },
+ { name = "rank", field = "initiative.rank" },
+ {
+ name = "current_draft_created",
+ func = function(record)
+ return format.timestamp(record.current_draft.created)
+ end
+ },
+ {
+ name = "current_draft_formatting_engine",
+ func = function(record)
+ return record.current_draft.formatting_engine
+ end
+ },
+ {
+ name = "current_draft_content",
+ func = function(record)
+ return record.current_draft.content
+ end
+ }
+}
+
+util.autoapi{
+ selector = initiatives_selector,
+ fields = fields,
+ api_engine = api_engine
+}
\ No newline at end of file
diff -r ff1926efa6aa -r 0849be391140 app/main/area/_list.lua
--- a/app/main/area/_list.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/area/_list.lua Sun Apr 04 22:05:11 2010 +0200
@@ -10,11 +10,17 @@
:add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.accepted NOTNULL AND issue.half_frozen ISNULL AND issue.closed ISNULL)", "issues_discussion_count")
:add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.half_frozen NOTNULL AND issue.fully_frozen ISNULL AND issue.closed ISNULL)", "issues_frozen_count")
:add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL)", "issues_voting_count")
- :add_field({ "(SELECT COUNT(*) FROM issue LEFT JOIN direct_voter ON direct_voter.issue_id = issue.id AND direct_voter.member_id = ? WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL AND direct_voter.member_id ISNULL)", app.session.member.id }, "issues_to_vote_count")
:add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed NOTNULL)", "issues_finished_count")
:add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen ISNULL AND issue.closed NOTNULL)", "issues_cancelled_count")
- :left_join("membership", "_membership", { "_membership.area_id = area.id AND _membership.member_id = ?", app.session.member.id })
- :add_field("_membership.member_id NOTNULL", "is_member", { "grouped" })
+
+if app.session.member_id then
+ areas_selector
+ :add_field({ "(SELECT COUNT(*) FROM issue LEFT JOIN direct_voter ON direct_voter.issue_id = issue.id AND direct_voter.member_id = ? WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL AND direct_voter.member_id ISNULL)", app.session.member.id }, "issues_to_vote_count")
+ :left_join("membership", "_membership", { "_membership.area_id = area.id AND _membership.member_id = ?", app.session.member.id })
+ :add_field("_membership.member_id NOTNULL", "is_member", { "grouped" })
+else
+ areas_selector:add_field("0", "issues_to_vote_count")
+end
local label_attr = { style = "text-align: right; width: 4em;" }
local field_attr = { style = "text-align: right; width: 4em;" }
@@ -242,13 +248,15 @@
slot.put(" ")
-ui.image{
- attr = { title = title, alt = title },
- static = "icons/16/user_gray.png"
-}
-slot.put(" ")
-slot.put(_"Member of area")
-slot.put(" ")
+if app.session.member_id then
+ ui.image{
+ attr = { title = title, alt = title },
+ static = "icons/16/user_gray.png"
+ }
+ slot.put(" ")
+ slot.put(_"Member of area")
+ slot.put(" ")
+end
ui.image{
attr = { title = title, alt = title },
diff -r ff1926efa6aa -r 0849be391140 app/main/area/list.lua
--- a/app/main/area/list.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/area/list.lua Sun Apr 04 22:05:11 2010 +0200
@@ -1,4 +1,24 @@
-slot.put_into("title", _'Area list')
+if app.session.member_id then
+ slot.put_into("title", _'Area list')
+else
+ slot.put_into("title", encode.html(config.app_title))
+end
+
+local lang = locale.get("lang")
+local basepath = request.get_app_basepath()
+local file_name = basepath .. "/locale/motd/" .. lang .. "_public.txt"
+local file = io.open(file_name)
+if file ~= nil then
+ local help_text = file:read("*a")
+ if #help_text > 0 then
+ ui.container{
+ attr = { class = "motd wiki" },
+ content = function()
+ slot.put(format.wiki_text(help_text))
+ end
+ }
+ end
+end
util.help("area.list", _"Area list")
diff -r ff1926efa6aa -r 0849be391140 app/main/area/show.lua
--- a/app/main/area/show.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/area/show.lua Sun Apr 04 22:05:11 2010 +0200
@@ -9,32 +9,36 @@
end
}
-
-slot.select("actions", function()
- ui.link{
- content = function()
- ui.image{ static = "icons/16/folder_add.png" }
- slot.put(_"Create new issue")
- end,
- module = "initiative",
- view = "new",
- params = { area_id = area.id }
- }
-end)
+if app.session.member_id then
+ slot.select("actions", function()
+ ui.link{
+ content = function()
+ ui.image{ static = "icons/16/folder_add.png" }
+ slot.put(_"Create new issue")
+ end,
+ module = "initiative",
+ view = "new",
+ params = { area_id = area.id }
+ }
+ end)
+end
util.help("area.show")
-execute.view{
- module = "membership",
- view = "_show_box",
- params = { area = area }
-}
+if app.session.member_id then
+ execute.view{
+ module = "membership",
+ view = "_show_box",
+ params = { area = area }
+ }
-execute.view{
- module = "delegation",
- view = "_show_box",
- params = { area_id = area.id }
-}
+ execute.view{
+ module = "delegation",
+ view = "_show_box",
+ params = { area_id = area.id }
+ }
+
+end
--[[
for i, issue in ipairs(area.issues) do
diff -r ff1926efa6aa -r 0849be391140 app/main/area/show_tab.lua
--- a/app/main/area/show_tab.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/area/show_tab.lua Sun Apr 04 22:05:11 2010 +0200
@@ -4,10 +4,13 @@
local members_selector = area:get_reference_selector("members")
local delegations_selector = area:get_reference_selector("delegations")
-ui.tabs{
+local tabs = {
module = "area",
view = "show_tab",
static_params = { area_id = area.id },
+}
+
+tabs[#tabs+1] =
{
name = "issues",
label = _"Issues" .. " (" .. tostring(issues_selector:count()) .. ")",
@@ -19,22 +22,28 @@
filter = cgi.params["filter"],
filter_voting = param.get("filter_voting")
}
- },
- {
- name = "members",
- label = _"Members" .. " (" .. tostring(members_selector:count()) .. ")",
- icon = { static = "icons/16/group.png" },
- module = "member",
- view = "_list",
- params = { members_selector = members_selector }
- },
- {
- name = "delegations",
- label = _"Delegations" .. " (" .. tostring(delegations_selector:count()) .. ")",
- icon = { static = "icons/16/table_go.png" },
- module = "delegation",
- view = "_list",
- params = { delegations_selector = delegations_selector }
- },
-}
+ }
+
+if app.session.member_id then
+ tabs[#tabs+1] =
+ {
+ name = "members",
+ label = _"Members" .. " (" .. tostring(members_selector:count()) .. ")",
+ icon = { static = "icons/16/group.png" },
+ module = "member",
+ view = "_list",
+ params = { members_selector = members_selector }
+ }
+ tabs[#tabs+1] =
+ {
+ name = "delegations",
+ label = _"Delegations" .. " (" .. tostring(delegations_selector:count()) .. ")",
+ icon = { static = "icons/16/table_go.png" },
+ module = "delegation",
+ view = "_list",
+ params = { delegations_selector = delegations_selector }
+ }
+end
+
+ui.tabs(tabs)
diff -r ff1926efa6aa -r 0849be391140 app/main/draft/_list.lua
--- a/app/main/draft/_list.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/draft/_list.lua Sun Apr 04 22:05:11 2010 +0200
@@ -15,7 +15,11 @@
{
label = _"Author",
content = function(record)
- ui.field.text{ readonly = true, value = record.author.name }
+ if app.session.member_id or config.public_access == "pseudonym" then
+ ui.field.text{ readonly = true, value = record.author.name }
+ else
+ ui.field.text{ readonly = true, value = _"[not displayed public]" }
+ end
end
},
{
diff -r ff1926efa6aa -r 0849be391140 app/main/draft/_show.lua
--- a/app/main/draft/_show.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/draft/_show.lua Sun Apr 04 22:05:11 2010 +0200
@@ -6,15 +6,28 @@
readonly = true,
content = function()
- ui.field.text{
- label = _"Last author",
- value = _(
- "#{author} at #{date}", {
- author = draft.author_name,
- date = format.timestamp(draft.created)
- }
- )
- }
+ if app.session.member_id or config.public_access == "pseudonym" then
+ ui.field.text{
+ label = _"Last author",
+ value = _(
+ "#{author} at #{date}", {
+ author = draft.author_name,
+ date = format.timestamp(draft.created)
+ }
+ )
+ }
+ else
+ ui.field.text{
+ label = _"Last author",
+ value = _(
+ "#{author} at #{date}", {
+ author = "[not displayed public]",
+ date = format.timestamp(draft.created)
+ }
+ )
+ }
+ end
+
ui.container{
attr = { class = "draft_content wiki" },
content = function()
diff -r ff1926efa6aa -r 0849be391140 app/main/index/login.lua
--- a/app/main/index/login.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/index/login.lua Sun Apr 04 22:05:11 2010 +0200
@@ -44,27 +44,9 @@
end)
-local lang = locale.get("lang")
-local basepath = request.get_app_basepath()
-local file_name = basepath .. "/locale/motd/" .. lang .. "_public.txt"
-local file = io.open(file_name)
-if file ~= nil then
- local help_text = file:read("*a")
- if #help_text > 0 then
- ui.container{
- attr = { class = "motd wiki" },
- content = function()
- slot.put(format.wiki_text(help_text))
- end
- }
- end
-end
-
-
-
ui.tag{
tag = 'p',
- content = _'You need to be logged in, to use this system.'
+ content = _'You need to be logged in, to use all features of this system.'
}
ui.form{
@@ -74,8 +56,9 @@
routing = {
ok = {
mode = 'redirect',
- module = 'index',
- view = 'index'
+ module = param.get("redirect_module") or "index",
+ view = param.get("redirect_view") or "index",
+ id = param.get("redirect_id"),
},
error = {
mode = 'forward',
@@ -102,3 +85,27 @@
end
}
+if config.auth_openid_enabled then
+ ui.form{
+ attr = { class = "login" },
+ module = 'openid',
+ action = 'initiate',
+ routing = {
+ default = {
+ mode = 'forward',
+ module = 'index',
+ view = 'login',
+ }
+ },
+ content = function()
+ ui.field.text{
+ label = _'OpenID',
+ html_name = 'openid_identifier',
+ value = ''
+ }
+ ui.submit{
+ text = _'OpenID Login'
+ }
+ end
+ }
+end
diff -r ff1926efa6aa -r 0849be391140 app/main/initiative/_list.lua
--- a/app/main/initiative/_list.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/initiative/_list.lua Sun Apr 04 22:05:11 2010 +0200
@@ -3,14 +3,19 @@
local issue = param.get("issue", "table")
local initiatives_selector = param.get("initiatives_selector", "table")
+
initiatives_selector
:join("issue", nil, "issue.id = initiative.issue_id")
- :left_join("initiator", "_initiator", { "_initiator.initiative_id = initiative.id AND _initiator.member_id = ?", app.session.member.id} )
- :left_join("supporter", "_supporter", { "_supporter.initiative_id = initiative.id AND _supporter.member_id = ?", app.session.member.id} )
- :add_field("(_initiator.member_id NOTNULL)", "is_initiator")
- :add_field({"(_supporter.member_id NOTNULL) AND NOT EXISTS(SELECT 1 FROM opinion WHERE opinion.initiative_id = initiative.id AND opinion.member_id = ? AND ((opinion.degree = 2 AND NOT fulfilled) OR (opinion.degree = -2 AND fulfilled)))", app.session.member.id }, "is_supporter")
- :add_field({"EXISTS(SELECT 1 FROM opinion WHERE opinion.initiative_id = initiative.id AND opinion.member_id = ? AND ((opinion.degree = 2 AND NOT fulfilled) OR (opinion.degree = -2 AND fulfilled)))", app.session.member.id }, "is_potential_supporter")
+if app.session.member_id then
+ initiatives_selector
+ :left_join("initiator", "_initiator", { "_initiator.initiative_id = initiative.id AND _initiator.member_id = ?", app.session.member.id} )
+ :left_join("supporter", "_supporter", { "_supporter.initiative_id = initiative.id AND _supporter.member_id = ?", app.session.member.id} )
+
+ :add_field("(_initiator.member_id NOTNULL)", "is_initiator")
+ :add_field({"(_supporter.member_id NOTNULL) AND NOT EXISTS(SELECT 1 FROM opinion WHERE opinion.initiative_id = initiative.id AND opinion.member_id = ? AND ((opinion.degree = 2 AND NOT fulfilled) OR (opinion.degree = -2 AND fulfilled)))", app.session.member.id }, "is_supporter")
+ :add_field({"EXISTS(SELECT 1 FROM opinion WHERE opinion.initiative_id = initiative.id AND opinion.member_id = ? AND ((opinion.degree = 2 AND NOT fulfilled) OR (opinion.degree = -2 AND fulfilled)))", app.session.member.id }, "is_potential_supporter")
+end
local initiatives_count = initiatives_selector:count()
@@ -208,7 +213,7 @@
}
end
- if not (issue.fully_frozen or issue.closed) then
+ if app.session.member_id and not (issue.fully_frozen or issue.closed) then
slot.put(" ")
ui.link{
content = function()
diff -r ff1926efa6aa -r 0849be391140 app/main/initiative/_show.lua
--- a/app/main/initiative/_show.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/initiative/_show.lua Sun Apr 04 22:05:11 2010 +0200
@@ -120,10 +120,14 @@
end
-local supporter = app.session.member:get_reference_selector("supporters")
- :add_where{ "initiative_id = ?", initiative.id }
- :optional_object_mode()
- :exec()
+local supporter
+
+if app.session.member_id then
+ supporter = app.session.member:get_reference_selector("supporters")
+ :add_where{ "initiative_id = ?", initiative.id }
+ :optional_object_mode()
+ :exec()
+end
if supporter and not initiative.issue.closed then
local old_draft_id = supporter.draft_id
@@ -164,21 +168,22 @@
end
-
-ui.container{
- attr = {
- id = "initiative_" .. tostring(initiative.id) .. "_support"
- },
- content = function()
- execute.view{
- module = "initiative",
- view = "show_support",
- params = {
- initiative = initiative
+if app.session.member_id then
+ ui.container{
+ attr = {
+ id = "initiative_" .. tostring(initiative.id) .. "_support"
+ },
+ content = function()
+ execute.view{
+ module = "initiative",
+ view = "show_support",
+ params = {
+ initiative = initiative
+ }
}
- }
- end
-}
+ end
+ }
+end
if (initiative.discussion_url and #initiative.discussion_url > 0)
or (initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked) then
diff -r ff1926efa6aa -r 0849be391140 app/main/initiative/_suggestions.lua
--- a/app/main/initiative/_suggestions.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/initiative/_suggestions.lua Sun Apr 04 22:05:11 2010 +0200
@@ -1,6 +1,6 @@
local initiative = param.get("initiative", "table")
-if not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
+if app.session.member_id and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
ui.link{
content = function()
ui.image{ static = "icons/16/comment_add.png" }
diff -r ff1926efa6aa -r 0849be391140 app/main/initiative/show_partial.lua
--- a/app/main/initiative/show_partial.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/initiative/show_partial.lua Sun Apr 04 22:05:11 2010 +0200
@@ -7,7 +7,10 @@
end
-- TODO performance
-local initiator = Initiator:by_pk(initiative.id, app.session.member.id)
+local initiator
+if app.session.member_id then
+ initiator = Initiator:by_pk(initiative.id, app.session.member.id)
+end
ui.partial{
module = "initiative",
diff -r ff1926efa6aa -r 0849be391140 app/main/initiative/show_static.lua
--- a/app/main/initiative/show_static.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/initiative/show_static.lua Sun Apr 04 22:05:11 2010 +0200
@@ -24,19 +24,20 @@
--slot.put_into("html_head", '')
-
-slot.select("actions", function()
- if not initiative.issue.fully_frozen and not initiative.issue.closed then
- ui.link{
- image = { static = "icons/16/script_add.png" },
- attr = { class = "action" },
- text = _"Create alternative initiative",
- module = "initiative",
- view = "new",
- params = { issue_id = initiative.issue.id }
- }
- end
-end)
+if app.session.member_id then
+ slot.select("actions", function()
+ if not initiative.issue.fully_frozen and not initiative.issue.closed then
+ ui.link{
+ image = { static = "icons/16/script_add.png" },
+ attr = { class = "action" },
+ text = _"Create alternative initiative",
+ module = "initiative",
+ view = "new",
+ params = { issue_id = initiative.issue.id }
+ }
+ end
+ end)
+end
slot.put_into("sub_title", encode.html(_("Initiative: '#{name}'", { name = initiative.name }) ))
diff -r ff1926efa6aa -r 0849be391140 app/main/initiative/show_tab.lua
--- a/app/main/initiative/show_tab.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/initiative/show_tab.lua Sun Apr 04 22:05:11 2010 +0200
@@ -5,7 +5,7 @@
initiative = Initiative:by_id(param.get("initiative_id", atom.number))
end
-if not initiator then
+if not initiator and app.session.member_id then
initiator = Initiator:by_pk(initiative.id, app.session.member.id)
end
@@ -32,17 +32,19 @@
}
}
-if initiative.issue.ranks_available then
- tabs[#tabs+1] = {
- name = "voting",
- label = _"Voting details",
- icon = { static = "icons/16/email_open.png" },
- module = "initiative",
- view = "_show_voting",
- params = {
- initiative = initiative
+if app.session.member_id then
+ if initiative.issue.ranks_available then
+ tabs[#tabs+1] = {
+ name = "voting",
+ label = _"Voting details",
+ icon = { static = "icons/16/email_open.png" },
+ module = "initiative",
+ view = "_show_voting",
+ params = {
+ initiative = initiative
+ }
}
- }
+ end
end
local suggestion_count = initiative:get_reference_selector("suggestions"):count()
@@ -58,90 +60,92 @@
}
}
-local members_selector = initiative:get_reference_selector("supporting_members_snapshot")
- :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id")
- :join("direct_interest_snapshot", nil, "direct_interest_snapshot.event = issue.latest_snapshot_event AND direct_interest_snapshot.issue_id = issue.id AND direct_interest_snapshot.member_id = member.id")
- :add_field("direct_interest_snapshot.weight")
- :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event")
- :add_where("direct_supporter_snapshot.satisfied")
- :add_field("direct_supporter_snapshot.informed", "is_informed")
-
-local tmp = db:query("SELECT count(1) AS count, sum(weight) AS weight FROM (" .. tostring(members_selector) .. ") as subquery", "object")
-local direct_satisfied_supporter_count = tmp.count
-local indirect_satisfied_supporter_count = (tmp.weight or 0) - tmp.count
-
-local count_string
-if indirect_satisfied_supporter_count > 0 then
- count_string = "(" .. tostring(direct_satisfied_supporter_count) .. "+" .. tostring(indirect_satisfied_supporter_count) .. ")"
-else
- count_string = "(" .. tostring(direct_satisfied_supporter_count) .. ")"
-end
-
-tabs[#tabs+1] = {
- name = "satisfied_supporter",
- label = _"Supporter" .. " " .. count_string,
- icon = { static = "icons/16/thumb_up_green.png" },
- module = "member",
- view = "_list",
- params = {
- initiative = initiative,
- members_selector = members_selector
+if app.session.member_id then
+ local members_selector = initiative:get_reference_selector("supporting_members_snapshot")
+ :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id")
+ :join("direct_interest_snapshot", nil, "direct_interest_snapshot.event = issue.latest_snapshot_event AND direct_interest_snapshot.issue_id = issue.id AND direct_interest_snapshot.member_id = member.id")
+ :add_field("direct_interest_snapshot.weight")
+ :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event")
+ :add_where("direct_supporter_snapshot.satisfied")
+ :add_field("direct_supporter_snapshot.informed", "is_informed")
+
+ local tmp = db:query("SELECT count(1) AS count, sum(weight) AS weight FROM (" .. tostring(members_selector) .. ") as subquery", "object")
+ local direct_satisfied_supporter_count = tmp.count
+ local indirect_satisfied_supporter_count = (tmp.weight or 0) - tmp.count
+
+ local count_string
+ if indirect_satisfied_supporter_count > 0 then
+ count_string = "(" .. tostring(direct_satisfied_supporter_count) .. "+" .. tostring(indirect_satisfied_supporter_count) .. ")"
+ else
+ count_string = "(" .. tostring(direct_satisfied_supporter_count) .. ")"
+ end
+
+ tabs[#tabs+1] = {
+ name = "satisfied_supporter",
+ label = _"Supporter" .. " " .. count_string,
+ icon = { static = "icons/16/thumb_up_green.png" },
+ module = "member",
+ view = "_list",
+ params = {
+ initiative = initiative,
+ members_selector = members_selector
+ }
}
-}
-
-local members_selector = initiative:get_reference_selector("supporting_members_snapshot")
- :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id")
- :join("direct_interest_snapshot", nil, "direct_interest_snapshot.event = issue.latest_snapshot_event AND direct_interest_snapshot.issue_id = issue.id AND direct_interest_snapshot.member_id = member.id")
- :add_field("direct_interest_snapshot.weight")
- :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event")
- :add_where("NOT direct_supporter_snapshot.satisfied")
- :add_field("direct_supporter_snapshot.informed", "is_informed")
-
-local tmp = db:query("SELECT count(1) AS count, sum(weight) AS weight FROM (" .. tostring(members_selector) .. ") as subquery", "object")
-local direct_potential_supporter_count = tmp.count
-local indirect_potential_supporter_count = (tmp.weight or 0) - tmp.count
-
-local count_string
-if indirect_potential_supporter_count > 0 then
- count_string = "(" .. tostring(direct_potential_supporter_count) .. "+" .. tostring(indirect_potential_supporter_count) .. ")"
-else
- count_string = "(" .. tostring(direct_potential_supporter_count) .. ")"
+
+ local members_selector = initiative:get_reference_selector("supporting_members_snapshot")
+ :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id")
+ :join("direct_interest_snapshot", nil, "direct_interest_snapshot.event = issue.latest_snapshot_event AND direct_interest_snapshot.issue_id = issue.id AND direct_interest_snapshot.member_id = member.id")
+ :add_field("direct_interest_snapshot.weight")
+ :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event")
+ :add_where("NOT direct_supporter_snapshot.satisfied")
+ :add_field("direct_supporter_snapshot.informed", "is_informed")
+
+ local tmp = db:query("SELECT count(1) AS count, sum(weight) AS weight FROM (" .. tostring(members_selector) .. ") as subquery", "object")
+ local direct_potential_supporter_count = tmp.count
+ local indirect_potential_supporter_count = (tmp.weight or 0) - tmp.count
+
+ local count_string
+ if indirect_potential_supporter_count > 0 then
+ count_string = "(" .. tostring(direct_potential_supporter_count) .. "+" .. tostring(indirect_potential_supporter_count) .. ")"
+ else
+ count_string = "(" .. tostring(direct_potential_supporter_count) .. ")"
+ end
+
+ tabs[#tabs+1] = {
+ name = "supporter",
+ label = _"Potential supporter" .. " " .. count_string,
+ icon = { static = "icons/16/thumb_up.png" },
+ module = "member",
+ view = "_list",
+ params = {
+ initiative = initiative,
+ members_selector = members_selector
+ }
+ }
+
+ local initiators_members_selector = initiative:get_reference_selector("initiating_members")
+ :add_field("initiator.accepted", "accepted")
+
+ if not (initiator and initiator.accepted) then
+ initiators_members_selector:add_where("initiator.accepted")
+ end
+
+ local initiator_count = initiators_members_selector:count()
+
+ tabs[#tabs+1] = {
+ name = "initiators",
+ label = _"Initiators" .. " (" .. tostring(initiator_count) .. ")",
+ icon = { static = "icons/16/user_edit.png" },
+ module = "initiative",
+ view = "_initiators",
+ params = {
+ initiative = initiative,
+ initiator = initiator,
+ initiators_members_selector = initiators_members_selector
+ }
+ }
end
-tabs[#tabs+1] = {
- name = "supporter",
- label = _"Potential supporter" .. " " .. count_string,
- icon = { static = "icons/16/thumb_up.png" },
- module = "member",
- view = "_list",
- params = {
- initiative = initiative,
- members_selector = members_selector
- }
-}
-
-local initiators_members_selector = initiative:get_reference_selector("initiating_members")
- :add_field("initiator.accepted", "accepted")
-
-if not (initiator and initiator.accepted) then
- initiators_members_selector:add_where("initiator.accepted")
-end
-
-local initiator_count = initiators_members_selector:count()
-
-tabs[#tabs+1] = {
- name = "initiators",
- label = _"Initiators" .. " (" .. tostring(initiator_count) .. ")",
- icon = { static = "icons/16/user_edit.png" },
- module = "initiative",
- view = "_initiators",
- params = {
- initiative = initiative,
- initiator = initiator,
- initiators_members_selector = initiators_members_selector
- }
-}
-
local drafts_count = initiative:get_reference_selector("drafts"):count()
tabs[#tabs+1] = {
diff -r ff1926efa6aa -r 0849be391140 app/main/issue/_list.lua
--- a/app/main/issue/_list.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/issue/_list.lua Sun Apr 04 22:05:11 2010 +0200
@@ -1,8 +1,10 @@
local issues_selector = param.get("issues_selector", "table")
-issues_selector
- :left_join("interest", "_interest", { "_interest.issue_id = issue.id AND _interest.member_id = ?", app.session.member.id} )
- :add_field("(_interest.member_id NOTNULL)", "is_interested")
+if app.session.member_id then
+ issues_selector
+ :left_join("interest", "_interest", { "_interest.issue_id = issue.id AND _interest.member_id = ?", app.session.member.id} )
+ :add_field("(_interest.member_id NOTNULL)", "is_interested")
+end
ui.add_partial_param_names{
"filter",
@@ -265,9 +267,9 @@
issue = record,
initiatives_selector = initiatives_selector,
highlight_string = highlight_string,
- per_page = tonumber(app.session.member:get_setting_value("initiatives_preview_limit") or 3),
+ per_page = app.session.member_id and tonumber(app.session.member:get_setting_value("initiatives_preview_limit") or 3) or 3,
no_sort = true,
- limit = tonumber(app.session.member:get_setting_value("initiatives_preview_limit") or 3)
+ limit = app.session.member_id and tonumber(app.session.member:get_setting_value("initiatives_preview_limit") or 3) or 3
}
}
end
diff -r ff1926efa6aa -r 0849be391140 app/main/issue/_show_head.lua
--- a/app/main/issue/_show_head.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/issue/_show_head.lua Sun Apr 04 22:05:11 2010 +0200
@@ -1,6 +1,10 @@
local issue = param.get("issue", "table")
-local direct_voter = DirectVoter:by_pk(issue.id, app.session.member.id)
+local direct_voter
+
+if app.session.member_id then
+ direct_voter = DirectVoter:by_pk(issue.id, app.session.member.id)
+end
slot.put_into("html_head", '')
@@ -31,43 +35,47 @@
slot.select("actions", function()
- if issue.state == 'voting' then
- local text
- if not direct_voter then
- text = _"Vote now"
- else
- text = _"Change vote"
+ if app.session.member_id then
+
+ if issue.state == 'voting' then
+ local text
+ if not direct_voter then
+ text = _"Vote now"
+ else
+ text = _"Change vote"
+ end
+ ui.link{
+ content = function()
+ ui.image{ static = "icons/16/email_open.png" }
+ slot.put(text)
+ end,
+ module = "vote",
+ view = "list",
+ params = { issue_id = issue.id }
+ }
end
- ui.link{
- content = function()
- ui.image{ static = "icons/16/email_open.png" }
- slot.put(text)
- end,
- module = "vote",
- view = "list",
- params = { issue_id = issue.id }
- }
- end
- execute.view{
- module = "interest",
- view = "_show_box",
- params = { issue = issue }
- }
-
- if not issue.closed then
execute.view{
- module = "delegation",
+ module = "interest",
view = "_show_box",
- params = { issue_id = issue.id }
+ params = { issue = issue }
}
- end
- execute.view{
- module = "issue",
- view = "_show_vote_later_box",
- params = { issue = issue }
- }
+ if not issue.closed then
+ execute.view{
+ module = "delegation",
+ view = "_show_box",
+ params = { issue_id = issue.id }
+ }
+ end
+
+ execute.view{
+ module = "issue",
+ view = "_show_vote_later_box",
+ params = { issue = issue }
+ }
+
+ end
if config.issue_discussion_url_func then
local url = config.issue_discussion_url_func(issue)
@@ -98,14 +106,16 @@
content = function()
slot.put(_"Voting for this issue is currently running!")
slot.put(" ")
- ui.link{
- content = function()
- slot.put(_"Vote now")
- end,
- module = "vote",
- view = "list",
- params = { issue_id = issue.id }
- }
+ if app.session.member_id then
+ ui.link{
+ content = function()
+ slot.put(_"Vote now")
+ end,
+ module = "vote",
+ view = "list",
+ params = { issue_id = issue.id }
+ }
+ end
end
}
slot.put(" ")
diff -r ff1926efa6aa -r 0849be391140 app/main/issue/show_tab.lua
--- a/app/main/issue/show_tab.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/issue/show_tab.lua Sun Apr 04 22:05:11 2010 +0200
@@ -22,41 +22,51 @@
local delegations_selector = issue:get_reference_selector("delegations")
-
-ui.tabs{
+local tabs = {
module = "issue",
view = "show_tab",
static_params = { issue_id = issue.id },
- {
- name = "interested_members",
- label = _"Interested members" .. " (" .. tostring(interested_members_selector:count()) .. ")" ,
- icon = { static = "icons/16/eye.png" },
- module = "member",
- view = "_list",
- params = {
- issue = issue,
- members_selector = interested_members_selector
+}
+
+if app.session.member_id then
+ tabs[#tabs+1] =
+ {
+ name = "interested_members",
+ label = _"Interested members" .. " (" .. tostring(interested_members_selector:count()) .. ")" ,
+ icon = { static = "icons/16/eye.png" },
+ module = "member",
+ view = "_list",
+ params = {
+ issue = issue,
+ members_selector = interested_members_selector
+ }
}
- },
- {
- name = "voting_requests",
- label = _"Vote later requests" .. " (" .. tostring(voting_requests_selector:count()) .. ") (" .. tostring(voting_requested_percentage) .. "%)",
- icon = { static = "icons/16/clock_play.png" },
- module = "member",
- view = "_list",
- params = {
- issue = issue,
- members_selector = voting_requests_selector
+
+ tabs[#tabs+1] =
+ {
+ name = "voting_requests",
+ label = _"Vote later requests" .. " (" .. tostring(voting_requests_selector:count()) .. ") (" .. tostring(voting_requested_percentage) .. "%)",
+ icon = { static = "icons/16/clock_play.png" },
+ module = "member",
+ view = "_list",
+ params = {
+ issue = issue,
+ members_selector = voting_requests_selector
+ }
}
- },
- {
- name = "delegations",
- label = _"Delegations" .. " (" .. tostring(delegations_selector:count()) .. ")" ,
- icon = { static = "icons/16/table_go.png" },
- module = "delegation",
- view = "_list",
- params = { delegations_selector = delegations_selector }
- },
+
+ tabs[#tabs+1] =
+ {
+ name = "delegations",
+ label = _"Delegations" .. " (" .. tostring(delegations_selector:count()) .. ")" ,
+ icon = { static = "icons/16/table_go.png" },
+ module = "delegation",
+ view = "_list",
+ params = { delegations_selector = delegations_selector }
+ }
+end
+
+tabs[#tabs+1] =
{
name = "details",
label = _"Details",
@@ -64,7 +74,8 @@
module = "issue",
view = "_details",
params = { issue = issue }
- },
-}
+ }
+
+ui.tabs(tabs)
diff -r ff1926efa6aa -r 0849be391140 app/main/member/_action/update_api_key.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main/member/_action/update_api_key.lua Sun Apr 04 22:05:11 2010 +0200
@@ -0,0 +1,54 @@
+
+local setting_key = "liquidfeedback_frontend_api_key"
+local setting = Setting:by_pk(app.session.member.id, setting_key)
+
+local api_key
+
+if param.get("delete", atom.boolean) then
+
+ if setting then
+ setting:destroy()
+ end
+
+else
+
+ if not setting then
+ setting = Setting:new()
+ setting.member_id = app.session.member.id
+ setting.key = setting_key
+ end
+
+ api_key = multirand.string(
+ 20,
+ '23456789BCDFGHJKLMNPQRSTVWXYZbcdfghjkmnpqrstvwxyz'
+ )
+
+ setting.value = api_key
+
+ setting:save()
+end
+
+
+local setting_key = "liquidfeedback_frontend_api_key_history"
+
+setting = SettingMap:new()
+setting.member_id = app.session.member.id
+setting.key = setting_key
+setting.subkey = db:query("SELECT now()")[1].now
+setting.value = api_key or ""
+local dberr = setting:try_save()
+
+if dberr then
+ if dberr:is_kind_of("IntegrityConstraintViolation.UniqueViolation") then
+ slot.put_into("error", _"The API key has been changed too fast.")
+ return
+ else
+ dberr:escalate()
+ end
+end
+
+if not api_key then
+ slot.put_into("notice", _"API key has been deleted")
+else
+ slot.put_into("notice", _"API key has been updated")
+end
diff -r ff1926efa6aa -r 0849be391140 app/main/member/_show_thumb.lua
--- a/app/main/member/_show_thumb.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/member/_show_thumb.lua Sun Apr 04 22:05:11 2010 +0200
@@ -124,15 +124,17 @@
end
-- TODO performance
- local contact = Contact:by_pk(app.session.member.id, member.id)
- if contact then
- ui.image{
- attr = {
- alt = _"You have saved this member as contact",
- title = _"You have saved this member as contact"
- },
- static = "icons/16/bullet_disk.png"
- }
+ if app.session.member_id then
+ local contact = Contact:by_pk(app.session.member.id, member.id)
+ if contact then
+ ui.image{
+ attr = {
+ alt = _"You have saved this member as contact",
+ title = _"You have saved this member as contact"
+ },
+ static = "icons/16/bullet_disk.png"
+ }
+ end
end
end
}
diff -r ff1926efa6aa -r 0849be391140 app/main/member/developer_settings.lua
--- a/app/main/member/developer_settings.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/member/developer_settings.lua Sun Apr 04 22:05:11 2010 +0200
@@ -11,26 +11,89 @@
}
end)
-ui.form{
- attr = { class = "vertical" },
- module = "member",
- action = "update_stylesheet_url",
- routing = {
- ok = {
- mode = "redirect",
- module = "index",
- view = "index"
+ local setting_key = "liquidfeedback_frontend_developer_features"
+ local setting = Setting:by_pk(app.session.member.id, setting_key)
+
+ if setting then
+ ui.form{
+ attr = { class = "vertical" },
+ module = "member",
+ action = "update_stylesheet_url",
+ routing = {
+ ok = {
+ mode = "redirect",
+ module = "index",
+ view = "index"
+ }
+ },
+ content = function()
+ local setting_key = "liquidfeedback_frontend_stylesheet_url"
+ local setting = Setting:by_pk(app.session.member.id, setting_key)
+ local value = setting and setting.value
+ ui.field.text{
+ label = _"Stylesheet URL",
+ name = "stylesheet_url",
+ value = value
+ }
+ ui.submit{ value = _"Set URL" }
+ end
}
- },
- content = function()
- local setting_key = "liquidfeedback_frontend_stylesheet_url"
- local setting = Setting:by_pk(app.session.member.id, setting_key)
- local value = setting and setting.value
- ui.field.text{
- label = _"Stylesheet URL",
- name = "stylesheet_url",
- value = value
+ end
+
+ local setting_key = "liquidfeedback_frontend_api_key"
+ local setting = Setting:by_pk(app.session.member.id, setting_key)
+ local api_key
+ if setting then
+ api_key = setting.value
+ end
+
+ ui.heading{ content = _"Generate / change API key" }
+ util.help("member.developer_settings.api_key", _"API key")
+
+ if api_key then
+ slot.put(_"Your API key:")
+ slot.put(" ")
+ slot.put("", api_key, "")
+ slot.put(" ")
+ ui.link{
+ text = _"Change API key",
+ module = "member",
+ action = "update_api_key",
+ routing = {
+ default = {
+ mode = "redirect",
+ module = "member",
+ view = "developer_settings"
+ }
+ }
}
- ui.submit{ value = _"Set URL" }
+ slot.put(" ")
+ ui.link{
+ text = _"Delete API key",
+ module = "member",
+ action = "update_api_key",
+ params = { delete = true },
+ routing = {
+ default = {
+ mode = "redirect",
+ module = "member",
+ view = "developer_settings",
+ }
+ }
+ }
+ else
+ slot.put(_"Currently no API key is set.")
+ slot.put(" ")
+ ui.link{
+ text = _"Generate API key",
+ module = "member",
+ action = "update_api_key",
+ routing = {
+ default = {
+ mode = "redirect",
+ module = "member",
+ view = "developer_settings"
+ }
+ }
+ }
end
-}
diff -r ff1926efa6aa -r 0849be391140 app/main/member/settings.lua
--- a/app/main/member/settings.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/member/settings.lua Sun Apr 04 22:05:11 2010 +0200
@@ -11,19 +11,15 @@
view = "index"
}
- local setting_key = "liquidfeedback_frontend_developer_features"
- local setting = Setting:by_pk(app.session.member.id, setting_key)
+ ui.link{
+ content = function()
+ ui.image{ static = "icons/16/wrench.png" }
+ slot.put(_"Developer features")
+ end,
+ module = "member",
+ view = "developer_settings"
+ }
- if setting then
- ui.link{
- content = function()
- ui.image{ static = "icons/16/wrench.png" }
- slot.put(_"Developer features")
- end,
- module = "member",
- view = "developer_settings"
- }
- end
end)
ui.heading{ content = _"Display settings" }
diff -r ff1926efa6aa -r 0849be391140 app/main/openid/_action/initiate.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main/openid/_action/initiate.lua Sun Apr 04 22:05:11 2010 +0200
@@ -0,0 +1,20 @@
+local user_supplied_identifier = param.get("openid_identifier")
+
+if not config.auth_openid_identifier_check_func(user_supplied_identifier) then
+ slot.put_into("error", _"This identifier is not allowed for this instance.")
+ return
+end
+
+local success,errmsg = auth.openid.initiate{
+ user_supplied_identifier = user_supplied_identifier,
+ https_as_default = config.auth_openid_https_as_default,
+ curl_options = config.auth_openid_curl_options,
+ realm = request.get_absolute_baseurl(),
+ return_to_module = "openid",
+ return_to_view = "verify"
+}
+
+if not success then
+ slot.put_into("error", encode.html(_("Error while resolving openid. Internal message: '#{errmsg}'", { errmsg = errmsg })))
+ return false
+end
\ No newline at end of file
diff -r ff1926efa6aa -r 0849be391140 app/main/openid/_filter/00_openid.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main/openid/_filter/00_openid.lua Sun Apr 04 22:05:11 2010 +0200
@@ -0,0 +1,5 @@
+if not config.auth_openid_enabled then
+ error("OpenID is not enabled.")
+end
+
+execute.inner()
diff -r ff1926efa6aa -r 0849be391140 app/main/openid/announce.xrds.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main/openid/announce.xrds.lua Sun Apr 04 22:05:11 2010 +0200
@@ -0,0 +1,4 @@
+auth.openid.xrds_document{
+ return_to_module = "openid",
+ return_to_view = "verify"
+}
diff -r ff1926efa6aa -r 0849be391140 app/main/openid/verify.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main/openid/verify.lua Sun Apr 04 22:05:11 2010 +0200
@@ -0,0 +1,17 @@
+local claimed_identifier, errmsg = auth.openid.verify{
+ force_https = config.auth_openid_force_https,
+ curl_options = config.auth_openid_curl_options
+}
+
+if not claimed_identifier then
+ slot.put_into("error", _"Sorry, it was not possible to verify your OpenID.")
+ return
+end
+
+if not config.auth_openid_identifier_check_func(claimed_identifier) then
+ slot.put_into("error", _"This identifier is not allowed for this instance.")
+ return
+end
+
+slot.put("validated as: ", encode.html(claimed_identifier), " ")
+
diff -r ff1926efa6aa -r 0849be391140 app/main/suggestion/_list.lua
--- a/app/main/suggestion/_list.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/suggestion/_list.lua Sun Apr 04 22:05:11 2010 +0200
@@ -108,104 +108,111 @@
label = _"My opinion",
content = function(record)
local degree
- local opinion = Opinion:by_pk(app.session.member.id, record.id)
+ local opinion
+ if app.session.member_id then
+ opinion = Opinion:by_pk(app.session.member.id, record.id)
+ end
if opinion then
degree = opinion.degree
end
ui.container{
attr = { class = "suggestion_my_opinion" },
content = function()
- if initiative.issue.state == "voting" or initiative.issue.state == "closed" then
- ui.tag{
- tag = "span",
- attr = { class = "action" .. (degree == -2 and " active_red2" or "") },
- content = _"must not"
- }
- ui.tag{
- tag = "span",
- attr = { class = "action" .. (degree == -1 and " active_red1" or "") },
- content = _"should not"
- }
- ui.tag{
- tag = "span",
- attr = { class = "action" .. (degree == nil and " active" or "") },
- content = _"neutral"
- }
- ui.tag{
- tag = "span",
- attr = { class = "action" .. (degree == 1 and " active_green1" or "") },
- content = _"should"
- }
- ui.tag{
- tag = "span",
- attr = { class = "action" .. (degree == 2 and " active_green2" or "") },
- content = _"must"
- }
+ if app.session.member_id then
+ if initiative.issue.state == "voting" or initiative.issue.state == "closed" then
+ ui.tag{
+ tag = "span",
+ attr = { class = "action" .. (degree == -2 and " active_red2" or "") },
+ content = _"must not"
+ }
+ ui.tag{
+ tag = "span",
+ attr = { class = "action" .. (degree == -1 and " active_red1" or "") },
+ content = _"should not"
+ }
+ ui.tag{
+ tag = "span",
+ attr = { class = "action" .. (degree == nil and " active" or "") },
+ content = _"neutral"
+ }
+ ui.tag{
+ tag = "span",
+ attr = { class = "action" .. (degree == 1 and " active_green1" or "") },
+ content = _"should"
+ }
+ ui.tag{
+ tag = "span",
+ attr = { class = "action" .. (degree == 2 and " active_green2" or "") },
+ content = _"must"
+ }
+ else
+ ui.link{
+ attr = { class = "action" .. (degree == -2 and " active_red2" or "") },
+ text = _"must not",
+ module = "opinion",
+ action = "update",
+ routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
+ params = {
+ suggestion_id = record.id,
+ degree = -2
+ },
+ partial = partial
+ }
+ slot.put(" ")
+ ui.link{
+ attr = { class = "action" .. (degree == -1 and " active_red1" or "") },
+ text = _"should not",
+ module = "opinion",
+ action = "update",
+ routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
+ params = {
+ suggestion_id = record.id,
+ degree = -1
+ },
+ partial = partial
+ }
+ slot.put(" ")
+ ui.link{
+ attr = { class = "action" .. (degree == nil and " active" or "") },
+ text = _"neutral",
+ module = "opinion",
+ action = "update",
+ routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
+ params = {
+ suggestion_id = record.id,
+ delete = true
+ },
+ partial = partial
+ }
+ slot.put(" ")
+ ui.link{
+ attr = { class = "action" .. (degree == 1 and " active_green1" or "") },
+ text = _"should",
+ module = "opinion",
+ action = "update",
+ routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
+ params = {
+ suggestion_id = record.id,
+ degree = 1
+ },
+ partial = partial
+ }
+ slot.put(" ")
+ ui.link{
+ attr = { class = "action" .. (degree == 2 and " active_green2" or "") },
+ text = _"must",
+ module = "opinion",
+ action = "update",
+ routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
+ params = {
+ suggestion_id = record.id,
+ degree = 2
+ },
+ partial = partial
+ }
+ end
else
- ui.link{
- attr = { class = "action" .. (degree == -2 and " active_red2" or "") },
- text = _"must not",
- module = "opinion",
- action = "update",
- routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
- params = {
- suggestion_id = record.id,
- degree = -2
- },
- partial = partial
- }
- slot.put(" ")
- ui.link{
- attr = { class = "action" .. (degree == -1 and " active_red1" or "") },
- text = _"should not",
- module = "opinion",
- action = "update",
- routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
- params = {
- suggestion_id = record.id,
- degree = -1
- },
- partial = partial
- }
- slot.put(" ")
- ui.link{
- attr = { class = "action" .. (degree == nil and " active" or "") },
- text = _"neutral",
- module = "opinion",
- action = "update",
- routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
- params = {
- suggestion_id = record.id,
- delete = true
- },
- partial = partial
- }
- slot.put(" ")
- ui.link{
- attr = { class = "action" .. (degree == 1 and " active_green1" or "") },
- text = _"should",
- module = "opinion",
- action = "update",
- routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
- params = {
- suggestion_id = record.id,
- degree = 1
- },
- partial = partial
- }
- slot.put(" ")
- ui.link{
- attr = { class = "action" .. (degree == 2 and " active_green2" or "") },
- text = _"must",
- module = "opinion",
- action = "update",
- routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
- params = {
- suggestion_id = record.id,
- degree = 2
- },
- partial = partial
- }
+ ui.field.text{ value = _"[Registered members only]" }
end
end
}
@@ -213,7 +220,10 @@
},
{
content = function(record)
- local opinion = Opinion:by_pk(app.session.member.id, record.id)
+ local opinion
+ if app.session.member_id then
+ opinion = Opinion:by_pk(app.session.member.id, record.id)
+ end
if opinion and not opinion.fulfilled then
ui.image{ static = "icons/16/cross.png" }
end
@@ -242,7 +252,10 @@
},
{
content = function(record)
- local opinion = Opinion:by_pk(app.session.member.id, record.id)
+ local opinion
+ if app.session.member_id then
+ opinion = Opinion:by_pk(app.session.member.id, record.id)
+ end
if opinion and opinion.fulfilled then
ui.image{ static = "icons/16/tick.png" }
end
@@ -273,7 +286,10 @@
label_attr = { style = "width: 200px;" },
content = function(record)
local degree
- local opinion = Opinion:by_pk(app.session.member.id, record.id)
+ local opinion
+ if app.session.member_id then
+ opinion = Opinion:by_pk(app.session.member.id, record.id)
+ end
if opinion then
degree = opinion.degree
end
@@ -321,7 +337,10 @@
},
{
content = function(record)
- local opinion = Opinion:by_pk(app.session.member.id, record.id)
+ local opinion
+ if app.session.member_id then
+ opinion = Opinion:by_pk(app.session.member.id, record.id)
+ end
if opinion then
if (opinion.fulfilled and opinion.degree > 0) or (not opinion.fulfilled and opinion.degree < 0) then
ui.image{ static = "icons/16/thumb_up_green.png" }
diff -r ff1926efa6aa -r 0849be391140 app/main/suggestion/_suggestion.lua
--- a/app/main/suggestion/_suggestion.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/suggestion/_suggestion.lua Sun Apr 04 22:05:11 2010 +0200
@@ -5,7 +5,11 @@
record = suggestion,
readonly = true,
content = function()
- ui.field.text{ label = _"Author", value = suggestion.author.name }
+ if app.session.member_id or config.public_access == "pseudonym" then
+ ui.field.text{ label = _"Author", value = suggestion.author.name }
+ else
+ ui.field.text{ label = _"Author", value = _"[not displayed public]" }
+ end
ui.field.text{ label = _"Title", name = "name" }
ui.container{
attr = { class = "suggestion_content wiki" },
diff -r ff1926efa6aa -r 0849be391140 app/main/suggestion/show_tab.lua
--- a/app/main/suggestion/show_tab.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/suggestion/show_tab.lua Sun Apr 04 22:05:11 2010 +0200
@@ -1,11 +1,14 @@
local suggestion = param.get("suggestion", "table") or Suggestion:by_id(param.get("suggestion_id"))
-ui.tabs{
+local tabs = {
module = "suggestion",
view = "show_tab",
static_params = {
suggestion_id = suggestion.id
},
+}
+
+tabs[#tabs+1] =
{
name = "description",
label = _"Suggestion",
@@ -14,15 +17,19 @@
params = {
suggestion = suggestion
}
- },
- {
- name = "opinions",
- label = _"Opinions",
- module = "suggestion",
- view = "_opinions",
- params = {
- suggestion = suggestion
+ }
+
+if app.session.member_id then
+ tabs[#tabs+1] =
+ {
+ name = "opinions",
+ label = _"Opinions",
+ module = "suggestion",
+ view = "_opinions",
+ params = {
+ suggestion = suggestion
+ }
}
- }
-}
+end
+ui.tabs(tabs)
\ No newline at end of file
diff -r ff1926efa6aa -r 0849be391140 app/main/timeline/_filter/29_filter.lua
--- a/app/main/timeline/_filter/29_filter.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/app/main/timeline/_filter/29_filter.lua Sun Apr 04 22:05:11 2010 +0200
@@ -1,6 +1,9 @@
if request.get_view() == "index" and not param.get("date") then
+ local setting
local setting_key = "liquidfeedback_frontend_timeline_current_options"
- local setting = Setting:by_pk(app.session.member.id, setting_key)
+ if app.session.member_id then
+ setting = Setting:by_pk(app.session.member.id, setting_key)
+ end
local timeline_params = {}
if setting and setting.value then
@@ -14,8 +17,11 @@
end
end
+ local setting
local setting_key = "liquidfeedback_frontend_timeline_current_date"
- local setting = Setting:by_pk(app.session.member.id, setting_key)
+ if app.session.member_id then
+ setting = Setting:by_pk(app.session.member.id, setting_key)
+ end
if setting then
timeline_params.date = setting.value
diff -r ff1926efa6aa -r 0849be391140 config/default.lua
--- a/config/default.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/config/default.lua Sun Apr 04 22:05:11 2010 +0200
@@ -27,8 +27,18 @@
config.download_use_terms = "=== Nutzungsbedingungen ===\nAlles ist verboten"
+config.public_access = false -- Available options: "anonymous", "pseudonym"
+
+config.api_enabled = false
+
+-- OpenID authentication is not fully implemented yet, DO NOT USE BEFORE THIS NOTICE HAS BEEN REMOVED!
+config.auth_openid_enabled = false
+config.auth_openid_https_as_default = true
+config.auth_openid_identifier_check_func = function(uri) return false end
+
request.set_allowed_json_request_slots{ "title", "actions", "support", "default", "trace", "system_error" }
+
if request.get_json_request_slots() then
request.force_absolute_baseurl()
end
diff -r ff1926efa6aa -r 0849be391140 config/development.lua
--- a/config/development.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/config/development.lua Sun Apr 04 22:05:11 2010 +0200
@@ -10,4 +10,19 @@
config.mail_from = "LiquidFeedback"
config.mail_reply_to = "liquid-support@localhost"
-config.issue_discussion_url_func = function(issue) return "http://example.com/issue_" .. tostring(issue.id) end
\ No newline at end of file
+config.issue_discussion_url_func = function(issue) return "http://example.com/issue_" .. tostring(issue.id) end
+
+config.auth_openid_enabled = true
+config.auth_openid_https_as_default = true
+
+config.auth_openid_identifier_check_func = function(uri)
+ local uri = uri:lower()
+ if uri:find("^https://") then
+ uri = uri:match("^https://(.*)")
+ end
+ if uri:find("^[0-9A-Za-z_-]+%.example%.com/?$") then
+ return true
+ else
+ return false
+ end
+end
\ No newline at end of file
diff -r ff1926efa6aa -r 0849be391140 env/util/autoapi.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/env/util/autoapi.lua Sun Apr 04 22:05:11 2010 +0200
@@ -0,0 +1,76 @@
+function util.autoapi_xml(args)
+ local selector = assert(args.selector)
+ local fields = assert(args.fields)
+ local rows = selector:exec()
+ slot.set_layout("xml")
+ slot.put("\n")
+ for i_row, row in ipairs(rows) do
+ slot.put(" \n")
+ for i_field, field in ipairs(fields) do
+ slot.put(" <", field.name, ">")
+ local value
+ if field.func then
+ value = field.func(row)
+ elseif field.field then
+ value = row[field.name]
+ end
+ if value then
+ slot.put(encode.html(tostring(value)))
+ end
+ slot.put("", field.name, ">\n")
+ end
+ slot.put(" \n")
+ end
+ slot.put("\n")
+end
+
+function util.autoapi_json(args)
+ slot.set_layout("blank")
+ local selector = assert(args.selector)
+ local fields = assert(args.fields)
+ local rows = selector:exec()
+ slot.put("{\n")
+ for i_row, row in ipairs(rows) do
+ slot.put(" {\n")
+ for i_field, field in ipairs(fields) do
+ slot.put(" ", field.name, ": ")
+ local value
+ if field.func then
+ value = field.func(row)
+ elseif field.field then
+ value = row[field.name]
+ end
+ slot.put(encode.json(value))
+ slot.put(",\n")
+ end
+ slot.put(" },\n")
+ end
+ slot.put("}\n")
+end
+
+function util.autoapi(args)
+ local selector = assert(args.selector)
+ local fields = assert(args.fields)
+ local api_engine = assert(args.api_engine)
+
+ selector:reset_fields()
+
+ for i_field, field in ipairs(fields) do
+ if field.field then
+ selector:add_field(field.field, field.name)
+ end
+ end
+
+ if api_engine == "xml" then
+ util.autoapi_xml{
+ selector = selector,
+ fields = fields
+ }
+ elseif api_engine == "json" then
+ util.autoapi_json{
+ selector = selector,
+ fields = fields
+ }
+ end
+
+end
\ No newline at end of file
diff -r ff1926efa6aa -r 0849be391140 env/util/help.lua
--- a/env/util/help.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/env/util/help.lua Sun Apr 04 22:05:11 2010 +0200
@@ -1,4 +1,7 @@
function util.help(id, title)
+ if not app.session.member_id then
+ return
+ end
local setting_key = "liquidfeedback_frontend_hidden_help_" .. id
local setting = Setting:by_pk(app.session.member.id, setting_key)
if not setting then
diff -r ff1926efa6aa -r 0849be391140 locale/translations.de.lua
--- a/locale/translations.de.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/locale/translations.de.lua Sun Apr 04 22:05:11 2010 +0200
@@ -11,6 +11,9 @@
["(new window)"] = "(neues Fenster)";
["+ #{weight}"] = "+ #{weight}";
["A-Z"] = "A-Z";
+["API key"] = false;
+["API key has been deleted"] = false;
+["API key has been updated"] = false;
["About"] = "About";
["About / Impressum"] = false;
["About LiquidFeedback"] = "Über LiquidFeedback";
@@ -71,6 +74,7 @@
["Cancel refuse of invitation"] = "Ablehnung der Einladung aufheben";
["Cancel registration"] = "Registration abbrechen";
["Cancelled"] = "Abgebrochen";
+["Change API key"] = false;
["Change area delegation"] = "Delegation für Themenbereich ändern";
["Change display settings"] = "Anzeige-Einstellungen ändern";
["Change filters and order"] = "Filter und Sortierung ändern";
@@ -103,9 +107,11 @@
["Created at"] = "Erzeugt am/um";
["Current draft"] = "Aktueller Entwurf";
["Current votings in areas you are member of and issues you are interested in:"] = "Jetzt laufende Abstimmungen zu Themen aus Deinen Themenbereichen oder solchen an denen Du interessiert bist:";
+["Currently no API key is set."] = false;
["Date"] = "Datum";
["Degree"] = "Grad";
["Delegations"] = "Delegationen";
+["Delete API key"] = false;
["Delete filter"] = "Filter löschen";
["Description"] = "Beschreibung";
["Details"] = "Details";
@@ -144,6 +150,7 @@
["Email address too short!"] = "E-Mail-Adresse ist zu kurz!";
["Email confirmation request"] = "Bestätigung Deiner E-Mail-Adresse";
["Empty help text: #{id}.#{lang}.txt"] = "Leerer Hilfe-Text: #{id}.#{lang}.txt";
+["Error while resolving openid. Internal message: '#{errmsg}'"] = false;
["Error while updating member, database reported:
(#{errormessage})"] = "Fehler beim aktualisieren des Mitglieds, die Datenbank berichtet folgenden Fehler:
(#{errormessage})";
["External memberships"] = "Externe Mitgliedschaften";
["External posts"] = "Externe Ämter";
@@ -153,6 +160,8 @@
["Friday"] = "Freitag";
["Frozen"] = "Eingefroren";
["Fully frozen at"] = "Ganz eingefroren am/um";
+["Generate / change API key"] = false;
+["Generate API key"] = false;
["Global delegation"] = "Globale Delegation";
["Global delegation active"] = "Globale Delegation aktiv";
["Go up"] = "Nach oben";
@@ -297,6 +306,8 @@
["One issue you are interested in"] = "Ein Thema, das Dich interessiert";
["One step back"] = "Ein Schritt zurück";
["Open"] = "Offen";
+["OpenID"] = false;
+["OpenID Login"] = false;
["Opinions"] = "Meinungen";
["Order by"] = "Sortieren nach";
["Organizational unit"] = "Organisationseinheit";
@@ -397,6 +408,7 @@
["Some JavaScript based functions (voting in particular) will not work.\nFor this beta, please use a current version of Firefox, Safari, Opera(?), Konqueror or another (more) standard compliant browser.\nAlternative access without JavaScript will be available soon."] = "Einige auf JavaScript basierende Funktionen (insbesondere der Abstimmung) sind nicht benutzbar.\nFür diese Beta verwende bitte eine aktuelle Version von Firefox, Safari, Opera(?), Konqueror oder einen anderen (mehr) den Standards entsprechenden Browser.\nEin alternativer Zugriff ohne JavaScript wird bald zur Verfügung stehen.";
["Sorry, but there is not confirmed email address for your account. Please contact the administrator or support."] = "Sorry, aber für diesen Account ist keine bestätigte E-Mail-Adresse hinterlegt. Bitte wende Dich an den Administrator oder den Support.";
["Sorry, but you are currently not invited"] = "Sorry, aber Du bist zur Zeit nicht eingeladen";
+["Sorry, it was not possible to verify your OpenID."] = false;
["Sorry, you have reached your personal flood limit. Please be slower..."] = "Sorry, Du hast Dein persönliches Flood-Limit erreicht. Bitte sei langsamer...";
["Sorry, your contingent for creating initiatives has been used up. Please try again later."] = "Sorry, Dein Antragskontingent ist zur Zeit ausgeschöpft. Bitte versuche es später erneut!";
["State"] = "Zustand";
@@ -424,12 +436,14 @@
["Tabs"] = "Registerkarten";
["Terms accepted"] = "Bedingungen akzeptiert";
["Terms of use"] = "Nutzungsbedingungen";
+["The API key has been changed too fast."] = false;
["The code you've entered is invalid"] = "Der Code, den Du eingeben hast, ist nicht gültig!";
["The draft of this initiative has been updated!"] = "Der Entwurfstext der Initiative wurde aktualisiert!";
["The drafts do not differ"] = "Die Entwürfe unterscheiden sich nicht";
["The initiators suggest to support the following initiative:"] = "Die Initiatoren empfehlen folgende Initiative zu unterstützen:";
["There are no more alternative initiatives currently."] = "Es gibt zur Zeit keine weiteren alternative Initiative.";
["There were no more alternative initiatives."] = "Es gab keine weiteren alternativen Initiativen.";
+["This identifier is not allowed for this instance."] = false;
["This initiative"] = "Diese Initiative";
["This initiative compared to alternative initiatives"] = "Diese Initiative im Vergleich zu alternativen Initiativen";
["This initiative has been revoked at #{revoked}"] = "Diese Initiative wurde am/um #{revoked} zurückgezogen";
@@ -506,9 +520,10 @@
["You have saved this member as contact."] = "Du hast das Mitglied als Kontakt gespeichert.";
["You have to accept the terms of use to complete registration."] = "Du musst die Nutzungsbedingungen akzeptieren um die Registration abzuschliessen.";
["You have to mark 'Are you sure' to revoke!"] = "Zum Zurückziehen musst Du 'Sicher?' auswählen";
-["You need to be logged in, to use this system."] = "Du musst eingeloggt sein, um das System zu benutzen";
+["You need to be logged in, to use all features of this system."] = false;
["You want to vote later"] = "Du willst später abstimmen";
["You've successfully registered and you can login now with your login and password!"] = "Du hast Dich erfolgreich registriert und kannst Dich jetzt mit Deinen Benutzernamen und Kennwort anmelden!";
+["Your API key:"] = false;
["Your are interested"] = "Du bist interessiert";
["Your are potential supporter"] = "Du bist potentieller Unterstützer";
["Your are supporter"] = "Du bist Unterstützer";
@@ -532,6 +547,8 @@
["Your vote has been discarded. Delegation rules apply if set."] = "Deine Abstimmung wurde zurückgezogen. Delegationsregeln gelten sofern gesetzt.";
["Your web browser is not fully supported yet."] = "Dein Web-Browser wird noch nicht vollständig unterstützt.";
["Z-A"] = "Z-A";
+["[Registered members only]"] = false;
+["[not displayed public]"] = false;
["and #{count} more initiatives"] = "und #{count} weitere Initiativen";
["continuing"] = "andauernd";
["delete
"] = "löschen
";
diff -r ff1926efa6aa -r 0849be391140 locale/translations.en.lua
--- a/locale/translations.en.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/locale/translations.en.lua Sun Apr 04 22:05:11 2010 +0200
@@ -11,6 +11,9 @@
["(new window)"] = false;
["+ #{weight}"] = false;
["A-Z"] = false;
+["API key"] = false;
+["API key has been deleted"] = false;
+["API key has been updated"] = false;
["About"] = false;
["About / Impressum"] = false;
["About LiquidFeedback"] = false;
@@ -71,6 +74,7 @@
["Cancel refuse of invitation"] = false;
["Cancel registration"] = false;
["Cancelled"] = false;
+["Change API key"] = false;
["Change area delegation"] = false;
["Change display settings"] = false;
["Change filters and order"] = false;
@@ -103,9 +107,11 @@
["Created at"] = false;
["Current draft"] = false;
["Current votings in areas you are member of and issues you are interested in:"] = false;
+["Currently no API key is set."] = false;
["Date"] = false;
["Degree"] = false;
["Delegations"] = false;
+["Delete API key"] = false;
["Delete filter"] = false;
["Description"] = false;
["Details"] = false;
@@ -144,6 +150,7 @@
["Email address too short!"] = false;
["Email confirmation request"] = false;
["Empty help text: #{id}.#{lang}.txt"] = false;
+["Error while resolving openid. Internal message: '#{errmsg}'"] = false;
["Error while updating member, database reported:
(#{errormessage})"] = false;
["External memberships"] = false;
["External posts"] = false;
@@ -153,6 +160,8 @@
["Friday"] = false;
["Frozen"] = false;
["Fully frozen at"] = false;
+["Generate / change API key"] = false;
+["Generate API key"] = false;
["Global delegation"] = false;
["Global delegation active"] = false;
["Go up"] = false;
@@ -297,6 +306,8 @@
["One issue you are interested in"] = false;
["One step back"] = false;
["Open"] = false;
+["OpenID"] = false;
+["OpenID Login"] = false;
["Opinions"] = false;
["Order by"] = false;
["Organizational unit"] = false;
@@ -397,6 +408,7 @@
["Some JavaScript based functions (voting in particular) will not work.\nFor this beta, please use a current version of Firefox, Safari, Opera(?), Konqueror or another (more) standard compliant browser.\nAlternative access without JavaScript will be available soon."] = false;
["Sorry, but there is not confirmed email address for your account. Please contact the administrator or support."] = false;
["Sorry, but you are currently not invited"] = false;
+["Sorry, it was not possible to verify your OpenID."] = false;
["Sorry, you have reached your personal flood limit. Please be slower..."] = false;
["Sorry, your contingent for creating initiatives has been used up. Please try again later."] = false;
["State"] = false;
@@ -424,12 +436,14 @@
["Tabs"] = false;
["Terms accepted"] = false;
["Terms of use"] = false;
+["The API key has been changed too fast."] = false;
["The code you've entered is invalid"] = false;
["The draft of this initiative has been updated!"] = false;
["The drafts do not differ"] = false;
["The initiators suggest to support the following initiative:"] = false;
["There are no more alternative initiatives currently."] = false;
["There were no more alternative initiatives."] = false;
+["This identifier is not allowed for this instance."] = false;
["This initiative"] = false;
["This initiative compared to alternative initiatives"] = false;
["This initiative has been revoked at #{revoked}"] = false;
@@ -506,9 +520,10 @@
["You have saved this member as contact."] = false;
["You have to accept the terms of use to complete registration."] = false;
["You have to mark 'Are you sure' to revoke!"] = false;
-["You need to be logged in, to use this system."] = false;
+["You need to be logged in, to use all features of this system."] = false;
["You want to vote later"] = false;
["You've successfully registered and you can login now with your login and password!"] = false;
+["Your API key:"] = false;
["Your are interested"] = false;
["Your are potential supporter"] = false;
["Your are supporter"] = false;
@@ -532,6 +547,8 @@
["Your vote has been discarded. Delegation rules apply if set."] = false;
["Your web browser is not fully supported yet."] = false;
["Z-A"] = false;
+["[Registered members only]"] = false;
+["[not displayed public]"] = false;
["and #{count} more initiatives"] = false;
["continuing"] = false;
["delete
"] = false;
diff -r ff1926efa6aa -r 0849be391140 locale/translations.eo.lua
--- a/locale/translations.eo.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/locale/translations.eo.lua Sun Apr 04 22:05:11 2010 +0200
@@ -11,6 +11,9 @@
["(new window)"] = "(nova fenestro)";
["+ #{weight}"] = "+ #{weight}";
["A-Z"] = "A-Z";
+["API key"] = false;
+["API key has been deleted"] = false;
+["API key has been updated"] = false;
["About"] = "Pri";
["About / Impressum"] = "Pri / Pres-indikaĵoj";
["About LiquidFeedback"] = "Pri LiquidFeedback";
@@ -71,6 +74,7 @@
["Cancel refuse of invitation"] = "Nuligi rifuzon de la invito";
["Cancel registration"] = "Nuligi registradon";
["Cancelled"] = "Abolita";
+["Change API key"] = false;
["Change area delegation"] = "Ŝanĝi delegacion por temaro";
["Change display settings"] = "Sangi afiŝajn agordojn";
["Change filters and order"] = "Ŝanĝi filtrojn kaj ordon";
@@ -103,9 +107,11 @@
["Created at"] = "Kreita je";
["Current draft"] = "Aktuala skizo";
["Current votings in areas you are member of and issues you are interested in:"] = "Aktualaj voĉdonoj pri temoj en kiuj vi membraa kaj kiuj vin interesas:";
+["Currently no API key is set."] = false;
["Date"] = "Dato";
["Degree"] = "Grado";
["Delegations"] = "Delegacioj";
+["Delete API key"] = false;
["Delete filter"] = "Forvisi filtron";
["Description"] = "Priskribo";
["Details"] = "Detaloj";
@@ -144,6 +150,7 @@
["Email address too short!"] = "Retadreso estas tro mallonga!";
["Email confirmation request"] = "Konfirmopeto de via retadreso";
["Empty help text: #{id}.#{lang}.txt"] = "Malplena helpoteksto: #{id}.#{lang}.txt";
+["Error while resolving openid. Internal message: '#{errmsg}'"] = false;
["Error while updating member, database reported:
(#{errormessage})"] = "Eraro dum ĝisdatigo de la membro, la datumbazo raportas sekvan eraron:
(#{errormessage})";
["External memberships"] = "Eksteraj membrecoj";
["External posts"] = "Eksteraj postenoj";
@@ -153,6 +160,8 @@
["Friday"] = "Vendredo";
["Frozen"] = "Ĝelita";
["Fully frozen at"] = "Tute ĝelita je";
+["Generate / change API key"] = false;
+["Generate API key"] = false;
["Global delegation"] = "Ĝenerala delegacio";
["Global delegation active"] = "Ĝenerala delegacio estas aktiva";
["Go up"] = "Movi supren";
@@ -297,6 +306,8 @@
["One issue you are interested in"] = "Unu temo, kiu vin interesas";
["One step back"] = "Unu paŝo reen";
["Open"] = "Malferma";
+["OpenID"] = false;
+["OpenID Login"] = false;
["Opinions"] = "Opinioj";
["Order by"] = "Ordigi laŭ";
["Organizational unit"] = "Organiza unuo";
@@ -397,6 +408,7 @@
["Some JavaScript based functions (voting in particular) will not work.\nFor this beta, please use a current version of Firefox, Safari, Opera(?), Konqueror or another (more) standard compliant browser.\nAlternative access without JavaScript will be available soon."] = "Kelkaj funkcioj bazitaj je JavaScript (precipe la voĉdono) ne funkcios.\nBonvolu, uzi por tiu betaversio aktualan version de Firefox, Safari, Opera(?), Konqueror aŭ alian (pli) normokonforman retumilon.\nAlternativa atingo sen JavaScript estos baldaŭ disponeble.";
["Sorry, but there is not confirmed email address for your account. Please contact the administrator or support."] = "Pardonu, por tiu konto ne ekzistas konfirmita retadreson. Bonvolu vin turni al administranto aŭ al la helpantaro.";
["Sorry, but you are currently not invited"] = "Pardonu, sed aktuale vi ne estas invitita";
+["Sorry, it was not possible to verify your OpenID."] = false;
["Sorry, you have reached your personal flood limit. Please be slower..."] = "Pardonu, vi atingis vian propran inundolimigon. Bonvolu esti pli malrapida...";
["Sorry, your contingent for creating initiatives has been used up. Please try again later."] = "Pardonu, via kontingento por krei iniciatojn estas aktuale elĉerpita. Bonvolu provi pli malfrue denove!";
["State"] = "Stato";
@@ -424,12 +436,14 @@
["Tabs"] = "Langetoj";
["Terms accepted"] = "Kondiĉoj akceptitaj";
["Terms of use"] = "Uzokondiĉoj";
+["The API key has been changed too fast."] = false;
["The code you've entered is invalid"] = "La kodo, kiun vi enigis ne estas valida!";
["The draft of this initiative has been updated!"] = "La skizo de tiu ĉi iniciato estas ĝisdatigita";
["The drafts do not differ"] = "La skizoj ne estas malsamaj";
["The initiators suggest to support the following initiative:"] = "La iniciatantoj rekomendas subteni sekvan iniciaton:";
["There are no more alternative initiatives currently."] = "Aktuale ne eksistas pliajn alternativajn iniciatojn.";
["There were no more alternative initiatives."] = "Ne eksistis pliajn alternativajn iniciatojn.";
+["This identifier is not allowed for this instance."] = false;
["This initiative"] = "Tiu iniciato";
["This initiative compared to alternative initiatives"] = "Tiu iniciato komparata al la alternativajn iniciatojn";
["This initiative has been revoked at #{revoked}"] = "Tiu iniciato estis nuligita je #{revoked}";
@@ -506,9 +520,10 @@
["You have saved this member as contact."] = "Vi ne jam storis membron kiel kontakton.";
["You have to accept the terms of use to complete registration."] = "Vi devas akcepti la uzokondiĉojn por fini la registradon.";
["You have to mark 'Are you sure' to revoke!"] = "Por nuligi vi devas elekti 'Certa?'";
-["You need to be logged in, to use this system."] = "Vi devas esti ensalutinta, por uzi la sistemon";
+["You need to be logged in, to use all features of this system."] = false;
["You want to vote later"] = "Vi volas baloti pli malfrue";
["You've successfully registered and you can login now with your login and password!"] = "Vi sukcese registriĝis kaj povas nun ensaluti per via salutnomo kaj pasvorto!";
+["Your API key:"] = false;
["Your are interested"] = "Vi estas interesita";
["Your are potential supporter"] = "Vi estas eventuala subtenanto";
["Your are supporter"] = "Vi estas subtenanto";
@@ -532,6 +547,8 @@
["Your vote has been discarded. Delegation rules apply if set."] = "Via voĉo estas retirata. La delegacioregularo aplikas se metita.";
["Your web browser is not fully supported yet."] = "Via retumilo ne estas jam komplete subtenita.";
["Z-A"] = "Z-A";
+["[Registered members only]"] = false;
+["[not displayed public]"] = false;
["and #{count} more initiatives"] = "kaj #{count} pliaj iniciatoj";
["continuing"] = "kontinue";
["delete
"] = "forviŝi
";
diff -r ff1926efa6aa -r 0849be391140 locale/translations.fr.lua
--- a/locale/translations.fr.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/locale/translations.fr.lua Sun Apr 04 22:05:11 2010 +0200
@@ -11,6 +11,9 @@
["(new window)"] = false;
["+ #{weight}"] = false;
["A-Z"] = false;
+["API key"] = false;
+["API key has been deleted"] = false;
+["API key has been updated"] = false;
["About"] = false;
["About / Impressum"] = false;
["About LiquidFeedback"] = false;
@@ -71,6 +74,7 @@
["Cancel refuse of invitation"] = false;
["Cancel registration"] = false;
["Cancelled"] = false;
+["Change API key"] = false;
["Change area delegation"] = false;
["Change display settings"] = false;
["Change filters and order"] = false;
@@ -103,9 +107,11 @@
["Created at"] = false;
["Current draft"] = false;
["Current votings in areas you are member of and issues you are interested in:"] = false;
+["Currently no API key is set."] = false;
["Date"] = false;
["Degree"] = false;
["Delegations"] = false;
+["Delete API key"] = false;
["Delete filter"] = false;
["Description"] = false;
["Details"] = false;
@@ -144,6 +150,7 @@
["Email address too short!"] = false;
["Email confirmation request"] = false;
["Empty help text: #{id}.#{lang}.txt"] = false;
+["Error while resolving openid. Internal message: '#{errmsg}'"] = false;
["Error while updating member, database reported:
(#{errormessage})"] = false;
["External memberships"] = false;
["External posts"] = false;
@@ -153,6 +160,8 @@
["Friday"] = false;
["Frozen"] = false;
["Fully frozen at"] = false;
+["Generate / change API key"] = false;
+["Generate API key"] = false;
["Global delegation"] = false;
["Global delegation active"] = false;
["Go up"] = false;
@@ -297,6 +306,8 @@
["One issue you are interested in"] = false;
["One step back"] = false;
["Open"] = false;
+["OpenID"] = false;
+["OpenID Login"] = false;
["Opinions"] = false;
["Order by"] = false;
["Organizational unit"] = false;
@@ -397,6 +408,7 @@
["Some JavaScript based functions (voting in particular) will not work.\nFor this beta, please use a current version of Firefox, Safari, Opera(?), Konqueror or another (more) standard compliant browser.\nAlternative access without JavaScript will be available soon."] = false;
["Sorry, but there is not confirmed email address for your account. Please contact the administrator or support."] = false;
["Sorry, but you are currently not invited"] = false;
+["Sorry, it was not possible to verify your OpenID."] = false;
["Sorry, you have reached your personal flood limit. Please be slower..."] = false;
["Sorry, your contingent for creating initiatives has been used up. Please try again later."] = false;
["State"] = false;
@@ -424,12 +436,14 @@
["Tabs"] = false;
["Terms accepted"] = false;
["Terms of use"] = false;
+["The API key has been changed too fast."] = false;
["The code you've entered is invalid"] = false;
["The draft of this initiative has been updated!"] = false;
["The drafts do not differ"] = false;
["The initiators suggest to support the following initiative:"] = false;
["There are no more alternative initiatives currently."] = false;
["There were no more alternative initiatives."] = false;
+["This identifier is not allowed for this instance."] = false;
["This initiative"] = false;
["This initiative compared to alternative initiatives"] = false;
["This initiative has been revoked at #{revoked}"] = false;
@@ -506,9 +520,10 @@
["You have saved this member as contact."] = false;
["You have to accept the terms of use to complete registration."] = false;
["You have to mark 'Are you sure' to revoke!"] = false;
-["You need to be logged in, to use this system."] = false;
+["You need to be logged in, to use all features of this system."] = false;
["You want to vote later"] = false;
["You've successfully registered and you can login now with your login and password!"] = false;
+["Your API key:"] = false;
["Your are interested"] = false;
["Your are potential supporter"] = false;
["Your are supporter"] = false;
@@ -532,6 +547,8 @@
["Your vote has been discarded. Delegation rules apply if set."] = false;
["Your web browser is not fully supported yet."] = false;
["Z-A"] = false;
+["[Registered members only]"] = false;
+["[not displayed public]"] = false;
["and #{count} more initiatives"] = false;
["continuing"] = false;
["delete
"] = false;
diff -r ff1926efa6aa -r 0849be391140 model/initiative.lua
--- a/model/initiative.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/model/initiative.lua Sun Apr 04 22:05:11 2010 +0200
@@ -136,10 +136,10 @@
:add_group_by("_supporter.member_id")
end
-function Member:get_search_selector(search_string)
- return self:new_selector()
- :add_where("active")
-end
+--function Member:get_search_selector(search_string)
+-- return self:new_selector()
+-- :add_where("active")
+--end
function Initiative.object_get:current_draft()
diff -r ff1926efa6aa -r 0849be391140 model/issue.lua
--- a/model/issue.lua Wed Mar 31 17:50:32 2010 +0200
+++ b/model/issue.lua Sun Apr 04 22:05:11 2010 +0200
@@ -146,6 +146,22 @@
--:set_distinct()
end
+function Issue:modify_selector_for_state(state)
+ if state == "new" then
+ initiatives_selector:add_where("issue.accepted ISNULL AND issue.cancelled ISNULL")
+ elseif state == "accepted" then
+ initiatives_selector:add_where("issue.accepted NOTNULL AND issue.half_frozen ISNULL AND issue.cancelled ISNULL")
+ elseif state == "frozen" then
+ initiatives_selector:add_where("issue.half_frozen NOTNULL AND issue.fully_frozen ISNULL AND cancelled ISNULL")
+ elseif state == "voting" then
+ initiatives_selector:add_where("issue.fully_frozen NOTNULL AND issue.finished ISNULL AND issue.cancelled ISNULL")
+ elseif state == "finished" then
+ initiatives_selector:add_where("issue.finished NOTNULL")
+ elseif state == "cancelled" then
+ initiatives_selector:add_where("issue.cancelled NOTNULL")
+ end
+end
+
function Issue.object_get:state()
if self.accepted then
if self.closed then