liquid_feedback_frontend

changeset 725:344e5fdce8c9

Fixed public search, made draft history available again
author bsw
date Thu Jun 28 13:52:42 2012 +0200 (2012-06-28)
parents 20395309378a
children d3d7a01624f6
files app/main/_filter/21_auth.lua app/main/draft/list.lua app/main/event/_list.lua app/main/index/search.lua app/main/initiative/_list.lua app/main/initiative/_show.lua app/main/initiative/show.lua app/main/supporter/_show_box.lua config/development.lua locale/translations.de.lua static/style.css
line diff
     1.1 --- a/app/main/_filter/21_auth.lua	Thu Jun 28 01:02:03 2012 +0200
     1.2 +++ b/app/main/_filter/21_auth.lua	Thu Jun 28 13:52:42 2012 +0200
     1.3 @@ -1,33 +1,40 @@
     1.4 +local module = request.get_module()
     1.5 +local view   = request.get_view()
     1.6 +local action = request.get_action()
     1.7 +
     1.8  local auth_needed = not (
     1.9 -  request.get_module() == 'index'
    1.10 +  module == 'index'
    1.11    and (
    1.12 -       request.get_view()   == "index"
    1.13 -    or request.get_view()   == "login"
    1.14 -    or request.get_action() == "login"
    1.15 -    or request.get_view()   == "register"
    1.16 -    or request.get_action() == "register"
    1.17 -    or request.get_view()   == "about"
    1.18 -    or request.get_view()   == "reset_password"
    1.19 -    or request.get_action() == "reset_password"
    1.20 -    or request.get_view()   == "confirm_notify_email"
    1.21 -    or request.get_action() == "confirm_notify_email"
    1.22 -    or request.get_view()   == "menu"
    1.23 -    or request.get_action() == "set_lang"
    1.24 +       view   == "index"
    1.25 +    or view   == "login"
    1.26 +    or action == "login"
    1.27 +    or view   == "register"
    1.28 +    or action == "register"
    1.29 +    or view   == "about"
    1.30 +    or view   == "reset_password"
    1.31 +    or action == "reset_password"
    1.32 +    or view   == "confirm_notify_email"
    1.33 +    or action == "confirm_notify_email"
    1.34 +    or view   == "menu"
    1.35 +    or action == "set_lang"
    1.36    )
    1.37 -  or request.get_module() == "openid"
    1.38 +  or module == "openid"
    1.39  )
    1.40  
    1.41  if config.public_access then
    1.42  
    1.43    if
    1.44 -    request.get_module() == "area" and request.get_view() == "show"
    1.45 -    or request.get_module() == "unit" and request.get_view() == "show"
    1.46 -    or request.get_module() == "policy" and request.get_view() == "show"
    1.47 -    or request.get_module() == "policy" and request.get_view() == "list"
    1.48 -    or request.get_module() == "issue" and request.get_view() == "show"
    1.49 -    or request.get_module() == "initiative" and request.get_view() == "show"
    1.50 -    or request.get_module() == "suggestion" and request.get_view() == "show"
    1.51 -    or request.get_module() == "draft" and request.get_view() == "diff"
    1.52 +    module == "area" and view == "show"
    1.53 +    or module == "unit" and view == "show"
    1.54 +    or module == "policy" and view == "show"
    1.55 +    or module == "policy" and view == "list"
    1.56 +    or module == "issue" and view == "show"
    1.57 +    or module == "initiative" and view == "show"
    1.58 +    or module == "suggestion" and view == "show"
    1.59 +    or module == "draft" and view == "diff"
    1.60 +    or module == "draft" and view == "show"
    1.61 +    or module == "draft" and view == "list"
    1.62 +    or module == "index" and view == "search"
    1.63    then
    1.64      auth_needed = false
    1.65    end
    1.66 @@ -35,19 +42,19 @@
    1.67  end
    1.68  
    1.69  if config.public_access == "full" then
    1.70 -  if request.get_module() == "member_image" and request.get_view() == "show"
    1.71 -   or request.get_module() == "vote" and request.get_view() == "show_incoming"
    1.72 -   or request.get_module() == "interest" and request.get_view() == "show_incoming"
    1.73 -   or request.get_module() == "supporter" and request.get_view() == "show_incoming" then
    1.74 +  if module == "member_image" and view == "show"
    1.75 +   or module == "vote" and view == "show_incoming"
    1.76 +   or module == "interest" and view == "show_incoming"
    1.77 +   or module == "supporter" and view == "show_incoming" then
    1.78      auth_needed = false
    1.79    end
    1.80  end
    1.81  
    1.82 -if request.get_module() == "sitemap" then
    1.83 +if module == "sitemap" then
    1.84    auth_needed = false
    1.85  end
    1.86  
    1.87 -if config.public_access and not app.session.member_id and auth_needed and request.get_module() == "index" and request.get_view() == "index" then
    1.88 +if config.public_access and not app.session.member_id and auth_needed and module == "index" and view == "index" then
    1.89    if config.single_unit_id then
    1.90      request.redirect{ module = "unit", view = "show", id = config.single_unit_id }
    1.91    else
    1.92 @@ -65,8 +72,8 @@
    1.93    trace.debug("Not authenticated yet.")
    1.94    request.redirect{
    1.95      module = 'index', view = 'login', params = {
    1.96 -      redirect_module = request.get_module(),
    1.97 -      redirect_view = request.get_view(),
    1.98 +      redirect_module = module,
    1.99 +      redirect_view = view,
   1.100        redirect_id = param.get_id()
   1.101      }
   1.102    }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/app/main/draft/list.lua	Thu Jun 28 13:52:42 2012 +0200
     2.3 @@ -0,0 +1,61 @@
     2.4 +local initiative = Initiative:by_id(param.get("initiative_id", atom.number))
     2.5 +
     2.6 +execute.view{
     2.7 +  module = "initiative", view = "_show", params = {
     2.8 +    initiative = initiative, show_as_head = true
     2.9 +  }
    2.10 +}
    2.11 +
    2.12 +ui.link{
    2.13 +  text = _"Back to initiative",
    2.14 +  module = "initiative", view = "show", id = initiative.id
    2.15 +}
    2.16 +
    2.17 +slot.put("<br />")
    2.18 +slot.put("<br />")
    2.19 +
    2.20 +ui.form{
    2.21 +  method = "get",
    2.22 +  module = "draft",
    2.23 +  view = "diff",
    2.24 +  content = function()
    2.25 +    ui.list{
    2.26 +      records = initiative.drafts,
    2.27 +      columns = {
    2.28 +        {
    2.29 +          label = _"Created at",
    2.30 +          content = function(record)
    2.31 +            ui.field.text{ readonly = true, value = format.timestamp(record.created) }
    2.32 +          end
    2.33 +        },
    2.34 +        {
    2.35 +          label = _"Author",
    2.36 +          content = function(record)
    2.37 +            if record.author then
    2.38 +              return record.author:ui_field_text()
    2.39 +            end
    2.40 +          end
    2.41 +        },
    2.42 +        {
    2.43 +          content = function(record)
    2.44 +            ui.link{
    2.45 +              attr = { class = "action" },
    2.46 +              text = _"Show",
    2.47 +              module = "draft",
    2.48 +              view = "show",
    2.49 +              id = record.id
    2.50 +            }
    2.51 +          end
    2.52 +        },
    2.53 +        {
    2.54 +          label = _"Compare",
    2.55 +          content = function(record)
    2.56 +            slot.put('<input type="radio" name="old_draft_id" value="' .. tostring(record.id) .. '">')
    2.57 +            slot.put('<input type="radio" name="new_draft_id" value="' .. tostring(record.id) .. '">')
    2.58 +          end
    2.59 +        }
    2.60 +      }
    2.61 +    }
    2.62 +    ui.submit{ text = _"Compare" }
    2.63 +  end
    2.64 +}
     3.1 --- a/app/main/event/_list.lua	Thu Jun 28 01:02:03 2012 +0200
     3.2 +++ b/app/main/event/_list.lua	Thu Jun 28 13:52:42 2012 +0200
     3.3 @@ -151,15 +151,6 @@
     3.4          }
     3.5        end }
     3.6  
     3.7 -      if event.suggestion_id then
     3.8 -        ui.container{ attr = { class = "suggestion" }, content = function()
     3.9 -          ui.link{
    3.10 -            text = event.suggestion.name,
    3.11 -            module = "suggestion", view = "show", id = event.suggestion_id
    3.12 -          }
    3.13 -        end }   
    3.14 -      end
    3.15 -
    3.16        ui.container{ attr = { class = "initiative_list" }, content = function()
    3.17          if not event.initiative_id then
    3.18            local initiatives_selector = Initiative:new_selector()
    3.19 @@ -169,7 +160,7 @@
    3.20              issue = event.issue,
    3.21              initiatives_selector = initiatives_selector,
    3.22              no_sort = true,
    3.23 -            limit = 3
    3.24 +            limit = 5
    3.25            } }
    3.26          else
    3.27          local initiatives_selector = Initiative:new_selector()
    3.28 @@ -178,23 +169,20 @@
    3.29              issue = event.issue,
    3.30              initiatives_selector = initiatives_selector,
    3.31              no_sort = true,
    3.32 -            limit = 1
    3.33 +            limit = 1,
    3.34 +            hide_more_initiatives = true
    3.35            } }
    3.36          end
    3.37        end }
    3.38  
    3.39 -      --[[      
    3.40 -      if event.initiative_id then
    3.41 -        ui.container{ attr = { class = "initiative_id" }, content = event.initiative_id }
    3.42 -      end
    3.43 -      if event.draft_id then
    3.44 -        ui.container{ attr = { class = "draft_id" }, content = event.draft_id }
    3.45 -      end
    3.46 -      if event.suggestion_id then
    3.47 -        ui.container{ attr = { class = "suggestion_id" }, content = event.suggestion_id }
    3.48 -      end
    3.49 ---]]
    3.50 -      
    3.51 +      ui.container{ attr = { class = "content suggestion" }, content = function()
    3.52 +        if event.suggestion_id then
    3.53 +          ui.link{
    3.54 +            text = event.suggestion.name,
    3.55 +            module = "suggestion", view = "show", id = event.suggestion_id
    3.56 +          }
    3.57 +        end
    3.58 +      end }
    3.59      end }
    3.60    end
    3.61  
     4.1 --- a/app/main/index/search.lua	Thu Jun 28 01:02:03 2012 +0200
     4.2 +++ b/app/main/index/search.lua	Thu Jun 28 13:52:42 2012 +0200
     4.3 @@ -14,18 +14,21 @@
     4.4    } },
     4.5    attr = { class = "vertical" },
     4.6    content = function()
     4.7 -    ui.field.select{
     4.8 -      label = _"Search context",
     4.9 -      name = "search_for",
    4.10 -      value = search_for,
    4.11 -      foreign_records = {
    4.12 -        { id = "global", name = _"Global search" },
    4.13 -        { id = "member", name = _"Search for members" },
    4.14 -        { id = "issue", name = _"Search for issues" }
    4.15 -      },
    4.16 -      foreign_id = "id",
    4.17 -      foreign_name = "name",
    4.18 -    }
    4.19 +    
    4.20 +    if app.session.member_id or config.public_access == "full" then
    4.21 +      ui.field.select{
    4.22 +        label = _"Search context",
    4.23 +        name = "search_for",
    4.24 +        value = search_for,
    4.25 +        foreign_records = {
    4.26 +          { id = "global", name = _"Global search" },
    4.27 +          { id = "member", name = _"Search for members" },
    4.28 +          { id = "issue", name = _"Search for issues" }
    4.29 +        },
    4.30 +        foreign_id = "id",
    4.31 +        foreign_name = "name",
    4.32 +      }
    4.33 +    end
    4.34      ui.field.text{ label = _"Search term (only complete words)", name = "search", value = search_string }
    4.35      ui.submit{ value = _"Start search" }
    4.36    end
    4.37 @@ -35,15 +38,17 @@
    4.38  
    4.39  if search_string then
    4.40  
    4.41 -  if search_for == "global" or search_for == "member" then
    4.42 -    local members_selector = Member:get_search_selector(search_string)
    4.43 -    execute.view{
    4.44 -      module = "member",
    4.45 -      view = "_list",
    4.46 -      params = { members_selector = members_selector },
    4.47 -    }
    4.48 +  if app.session.member_id or config.public_access == "full" then
    4.49 +    if search_for == "global" or search_for == "member" then
    4.50 +      local members_selector = Member:get_search_selector(search_string)
    4.51 +      execute.view{
    4.52 +        module = "member",
    4.53 +        view = "_list",
    4.54 +        params = { members_selector = members_selector },
    4.55 +      }
    4.56 +    end
    4.57    end
    4.58 -
    4.59 +    
    4.60    if search_for == "global" or search_for == "issue" then
    4.61      local issues_selector = Issue:get_search_selector(search_string)
    4.62      execute.view{
     5.1 --- a/app/main/initiative/_list.lua	Thu Jun 28 01:02:03 2012 +0200
     5.2 +++ b/app/main/initiative/_list.lua	Thu Jun 28 13:52:42 2012 +0200
     5.3 @@ -14,6 +14,7 @@
     5.4  local for_member = param.get("for_member", "table") or app.session.member
     5.5  
     5.6  local limit = param.get("limit", atom.number)
     5.7 +local hide_more_initiatives = param.get("hide_more_initiatives", atom.boolean)
     5.8  
     5.9  local more_initiatives_count
    5.10  if limit then
    5.11 @@ -60,7 +61,7 @@
    5.12    }
    5.13  end
    5.14  
    5.15 -if more_initiatives_count and more_initiatives_count > 0 then
    5.16 +if not hide_more_initiatives and more_initiatives_count and more_initiatives_count > 0 then
    5.17    local text
    5.18    if more_initiatives_count == 1 then
    5.19      text = _("and one more initiative")
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/app/main/initiative/_show.lua	Thu Jun 28 13:52:42 2012 +0200
     6.3 @@ -0,0 +1,525 @@
     6.4 +local initiative = param.get("initiative", "table")
     6.5 +
     6.6 +local show_as_head = param.get("show_as_head", atom.boolean)
     6.7 +
     6.8 +initiative:load_everything_for_member_id(app.session.member_id)
     6.9 +
    6.10 +local issue = initiative.issue
    6.11 +
    6.12 +-- TODO performance
    6.13 +local initiator
    6.14 +if app.session.member_id then
    6.15 +  initiator = Initiator:by_pk(initiative.id, app.session.member.id)
    6.16 +end
    6.17 +
    6.18 +if app.session.member_id then
    6.19 +  issue:load_everything_for_member_id(app.session.member_id)
    6.20 +end
    6.21 +
    6.22 +app.html_title.title = initiative.name
    6.23 +app.html_title.subtitle = _("Initiative ##{id}", { id = initiative.id })
    6.24 +
    6.25 +slot.select("head", function()
    6.26 +  execute.view{
    6.27 +    module = "issue", view = "_head",
    6.28 +    params = { issue = issue, initiative = initiative }
    6.29 +  }
    6.30 +end)
    6.31 +  
    6.32 +local initiators_members_selector = initiative:get_reference_selector("initiating_members")
    6.33 +  :add_field("initiator.accepted", "accepted")
    6.34 +  :add_order_by("member.name")
    6.35 +if initiator and initiator.accepted then
    6.36 +  initiators_members_selector:add_where("initiator.accepted ISNULL OR initiator.accepted")
    6.37 +else
    6.38 +  initiators_members_selector:add_where("initiator.accepted")
    6.39 +end
    6.40 +
    6.41 +local initiators = initiators_members_selector:exec()
    6.42 +
    6.43 +
    6.44 +local initiatives_selector = initiative.issue:get_reference_selector("initiatives")
    6.45 +slot.select("head", function()
    6.46 +  execute.view{
    6.47 +    module = "issue",
    6.48 +    view = "_show",
    6.49 +    params = {
    6.50 +      issue = initiative.issue,
    6.51 +      initiative_limit = 3,
    6.52 +      for_initiative = initiative
    6.53 +    }
    6.54 +  }
    6.55 +end)
    6.56 +
    6.57 +util.help("initiative.show")
    6.58 +
    6.59 +ui.container{ attr = { class = "initiative_head" }, content = function()
    6.60 +
    6.61 +  local text = _("Initiative i#{id}: #{name}", { id = initiative.id, name = initiative.name }) 
    6.62 +  if show_as_head then
    6.63 +    ui.link{
    6.64 +      attr = { class = "title" }, text = text,
    6.65 +      module = "initiative", view = "show", id = initiative.id
    6.66 +    }
    6.67 +  else
    6.68 +    ui.container{ attr = { class = "title" }, content = text }
    6.69 +  end
    6.70 +  ui.container{ attr = { class = "content" }, content = function()
    6.71 +    if app.session.member_id or config.public_access == "pseudonym" or config.public_access == "full" then
    6.72 +      ui.tag{
    6.73 +        attr = { class = "initiator_names" },
    6.74 +        content = function()
    6.75 +          for i, initiator in ipairs(initiators) do
    6.76 +            slot.put(" ")
    6.77 +            if app.session.member_id or config.public_access == "full" then
    6.78 +              ui.link{
    6.79 +                content = function ()
    6.80 +                  execute.view{
    6.81 +                    module = "member_image",
    6.82 +                    view = "_show",
    6.83 +                    params = {
    6.84 +                      member = initiator,
    6.85 +                      image_type = "avatar",
    6.86 +                      show_dummy = true,
    6.87 +                      class = "micro_avatar",
    6.88 +                      popup_text = text
    6.89 +                    }
    6.90 +                  }
    6.91 +                end,
    6.92 +                module = "member", view = "show", id = initiator.id
    6.93 +              }
    6.94 +              slot.put(" ")
    6.95 +            end
    6.96 +            ui.link{
    6.97 +              text = initiator.name,
    6.98 +              module = "member", view = "show", id = initiator.id
    6.99 +            }
   6.100 +            if not initiator.accepted then
   6.101 +              ui.tag{ attr = { title = _"Not accepted yet" }, content = "?" }
   6.102 +            end
   6.103 +          end
   6.104 +          if initiator and initiator.accepted and not initiative.issue.fully_frozen and not initiative.issue.closed and not initiative.revoked then
   6.105 +            slot.put(" &middot; ")
   6.106 +            ui.link{
   6.107 +              attr = { class = "action" },
   6.108 +              content = function()
   6.109 +                slot.put(_"Invite initiator")
   6.110 +              end,
   6.111 +              module = "initiative",
   6.112 +              view = "add_initiator",
   6.113 +              params = { initiative_id = initiative.id }
   6.114 +            }
   6.115 +            if #initiators > 1 then
   6.116 +              slot.put(" &middot; ")
   6.117 +              ui.link{
   6.118 +                content = function()
   6.119 +                  slot.put(_"Remove initiator")
   6.120 +                end,
   6.121 +                module = "initiative",
   6.122 +                view = "remove_initiator",
   6.123 +                params = { initiative_id = initiative.id }
   6.124 +              }
   6.125 +            end
   6.126 +          end
   6.127 +          if initiator and initiator.accepted == false then
   6.128 +              slot.put(" &middot; ")
   6.129 +              ui.link{
   6.130 +                text   = _"Cancel refuse of invitation",
   6.131 +                module = "initiative",
   6.132 +                action = "remove_initiator",
   6.133 +                params = {
   6.134 +                  initiative_id = initiative.id,
   6.135 +                  member_id = app.session.member.id
   6.136 +                },
   6.137 +                routing = {
   6.138 +                  ok = {
   6.139 +                    mode = "redirect",
   6.140 +                    module = "initiative",
   6.141 +                    view = "show",
   6.142 +                    id = initiative.id
   6.143 +                  }
   6.144 +                }
   6.145 +              }
   6.146 +          end
   6.147 +          if (initiative.discussion_url and #initiative.discussion_url > 0) then
   6.148 +            slot.put(" &middot; ")
   6.149 +            if initiative.discussion_url:find("^https?://") then
   6.150 +              if initiative.discussion_url and #initiative.discussion_url > 0 then
   6.151 +                ui.link{
   6.152 +                  attr = {
   6.153 +                    target = "_blank",
   6.154 +                    title = _"Discussion with initiators"
   6.155 +                  },
   6.156 +                  text = _"Discuss with initiators",
   6.157 +                  external = initiative.discussion_url
   6.158 +                }
   6.159 +              end
   6.160 +            else
   6.161 +              slot.put(encode.html(initiative.discussion_url))
   6.162 +            end
   6.163 +          end
   6.164 +          if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
   6.165 +            slot.put(" &middot; ")
   6.166 +            ui.link{
   6.167 +              text   = _"change discussion URL",
   6.168 +              module = "initiative",
   6.169 +              view   = "edit",
   6.170 +              id     = initiative.id
   6.171 +            }
   6.172 +            slot.put(" ")
   6.173 +          end
   6.174 +        end
   6.175 +      }
   6.176 +    end
   6.177 +
   6.178 +  end }
   6.179 +  ui.container{ attr = { class = "content" }, content = function()
   6.180 +    if app.session.member_id then
   6.181 +      execute.view{
   6.182 +        module = "supporter",
   6.183 +        view = "_show_box",
   6.184 +        params = {
   6.185 +          initiative = initiative
   6.186 +        }
   6.187 +      }
   6.188 +    end
   6.189 +
   6.190 +  end }
   6.191 +
   6.192 +  
   6.193 +  -- voting results
   6.194 +  if initiative.issue.ranks_available and initiative.admitted then
   6.195 +    local class = initiative.winner and "admitted_info" or "not_admitted_info"
   6.196 +    ui.container{
   6.197 +      attr = { class = class },
   6.198 +      content = function()
   6.199 +        local max_value = initiative.issue.voter_count
   6.200 +        slot.put("&nbsp;")
   6.201 +        local positive_votes = initiative.positive_votes
   6.202 +        local negative_votes = initiative.negative_votes
   6.203 +        local sum_votes = initiative.positive_votes + initiative.negative_votes
   6.204 +        local function perc(votes, sum)
   6.205 +          if sum > 0 and votes > 0 then return " (" .. string.format( "%.f", votes * 100 / sum ) .. "%)" end
   6.206 +          return ""
   6.207 +        end
   6.208 +        slot.put(_"Yes" .. ": <b>" .. tostring(positive_votes) .. perc(positive_votes, sum_votes) .. "</b>")
   6.209 +        slot.put(" &middot; ")
   6.210 +        slot.put(_"Abstention" .. ": <b>" .. tostring(max_value - initiative.negative_votes - initiative.positive_votes)  .. "</b>")
   6.211 +        slot.put(" &middot; ")
   6.212 +        slot.put(_"No" .. ": <b>" .. tostring(initiative.negative_votes) .. perc(negative_votes, sum_votes) .. "</b>")
   6.213 +        slot.put(" &middot; ")
   6.214 +        slot.put("<b>")
   6.215 +        if initiative.winner then
   6.216 +          slot.put(_"Approved")
   6.217 +        elseif initiative.rank then
   6.218 +          slot.put(_("Not approved (rank #{rank})", { rank = initiative.rank }))
   6.219 +        else
   6.220 +          slot.put(_"Not approved")
   6.221 +        end
   6.222 +        slot.put("</b>")
   6.223 +      end
   6.224 +    }
   6.225 +  end
   6.226 +
   6.227 +  ui.container{ attr = { class = "content" }, content = function()
   6.228 +    execute.view{
   6.229 +      module = "initiative",
   6.230 +      view = "_battles",
   6.231 +      params = { initiative = initiative }
   6.232 +    }
   6.233 +  end }
   6.234 +    
   6.235 +  -- initiative not admitted info
   6.236 +  if initiative.admitted == false then
   6.237 +    local policy = initiative.issue.policy
   6.238 +    ui.container{
   6.239 +      attr = { class = "not_admitted_info" },
   6.240 +      content = _("This initiative has not been admitted! It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den) })
   6.241 +    }
   6.242 +  end
   6.243 +
   6.244 +  -- initiative revoked info
   6.245 +  if initiative.revoked then
   6.246 +    ui.container{
   6.247 +      attr = { class = "revoked_info" },
   6.248 +      content = function()
   6.249 +        slot.put(_("This initiative has been revoked at #{revoked}", { revoked = format.timestamp(initiative.revoked) }))
   6.250 +        local suggested_initiative = initiative.suggested_initiative
   6.251 +        if suggested_initiative then
   6.252 +          slot.put("<br /><br />")
   6.253 +          slot.put(_("The initiators suggest to support the following initiative:"))
   6.254 +          slot.put(" ")
   6.255 +          ui.link{
   6.256 +            content = _("Issue ##{id}", { id = suggested_initiative.issue.id } ) .. ": " .. encode.html(suggested_initiative.name),
   6.257 +            module = "initiative",
   6.258 +            view = "show",
   6.259 +            id = suggested_initiative.id
   6.260 +          }
   6.261 +        end
   6.262 +      end
   6.263 +    }
   6.264 +  end
   6.265 +
   6.266 +
   6.267 +  -- invited as initiator
   6.268 +  if initiator and initiator.accepted == nil and not initiative.issue.half_frozen and not initiative.issue.closed then
   6.269 +    ui.container{
   6.270 +      attr = { class = "initiator_invite_info" },
   6.271 +      content = function()
   6.272 +        slot.put(_"You are invited to become initiator of this initiative.")
   6.273 +        slot.put(" ")
   6.274 +        ui.link{
   6.275 +          image  = { static = "icons/16/tick.png" },
   6.276 +          text   = _"Accept invitation",
   6.277 +          module = "initiative",
   6.278 +          action = "accept_invitation",
   6.279 +          id     = initiative.id,
   6.280 +          routing = {
   6.281 +            default = {
   6.282 +              mode = "redirect",
   6.283 +              module = request.get_module(),
   6.284 +              view = request.get_view(),
   6.285 +              id = param.get_id_cgi(),
   6.286 +              params = param.get_all_cgi()
   6.287 +            }
   6.288 +          }
   6.289 +        }
   6.290 +        slot.put(" ")
   6.291 +        ui.link{
   6.292 +          image  = { static = "icons/16/cross.png" },
   6.293 +          text   = _"Refuse invitation",
   6.294 +          module = "initiative",
   6.295 +          action = "reject_initiator_invitation",
   6.296 +          params = {
   6.297 +            initiative_id = initiative.id,
   6.298 +            member_id = app.session.member.id
   6.299 +          },
   6.300 +          routing = {
   6.301 +            default = {
   6.302 +              mode = "redirect",
   6.303 +              module = request.get_module(),
   6.304 +              view = request.get_view(),
   6.305 +              id = param.get_id_cgi(),
   6.306 +              params = param.get_all_cgi()
   6.307 +            }
   6.308 +          }
   6.309 +        }
   6.310 +      end
   6.311 +    }
   6.312 +  end
   6.313 +
   6.314 +  -- draft updated
   6.315 +  local supporter
   6.316 +
   6.317 +  if app.session.member_id then
   6.318 +    supporter = app.session.member:get_reference_selector("supporters")
   6.319 +      :add_where{ "initiative_id = ?", initiative.id }
   6.320 +      :optional_object_mode()
   6.321 +      :exec()
   6.322 +  end
   6.323 +
   6.324 +  if supporter and not initiative.issue.closed then
   6.325 +    local old_draft_id = supporter.draft_id
   6.326 +    local new_draft_id = initiative.current_draft.id
   6.327 +    if old_draft_id ~= new_draft_id then
   6.328 +      ui.container{
   6.329 +        attr = { class = "draft_updated_info" },
   6.330 +        content = function()
   6.331 +          slot.put(_"The draft of this initiative has been updated!")
   6.332 +          slot.put(" ")
   6.333 +          ui.link{
   6.334 +            content = _"Show diff",
   6.335 +            module = "draft",
   6.336 +            view = "diff",
   6.337 +            params = {
   6.338 +              old_draft_id = old_draft_id,
   6.339 +              new_draft_id = new_draft_id
   6.340 +            }
   6.341 +          }
   6.342 +          if not initiative.revoked then
   6.343 +            slot.put(" ")
   6.344 +            ui.link{
   6.345 +              text   = _"Refresh support to current draft",
   6.346 +              module = "initiative",
   6.347 +              action = "add_support",
   6.348 +              id     = initiative.id,
   6.349 +              routing = {
   6.350 +                default = {
   6.351 +                  mode = "redirect",
   6.352 +                  module = "initiative",
   6.353 +                  view = "show",
   6.354 +                  id = initiative.id
   6.355 +                }
   6.356 +              }
   6.357 +            }
   6.358 +          end
   6.359 +        end
   6.360 +      }
   6.361 +    end
   6.362 +  end
   6.363 +
   6.364 +  if not show_as_head then
   6.365 +    local drafts_count = initiative:get_reference_selector("drafts"):count()
   6.366 +
   6.367 +    ui.container{ attr = { class = "content" }, content = function()
   6.368 +    
   6.369 +      if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
   6.370 +        ui.link{
   6.371 +          content = function()
   6.372 +            slot.put(_"Edit draft")
   6.373 +          end,
   6.374 +          module = "draft",
   6.375 +          view = "new",
   6.376 +          params = { initiative_id = initiative.id }
   6.377 +        }
   6.378 +        slot.put(" &middot; ")
   6.379 +        ui.link{
   6.380 +          content = function()
   6.381 +            slot.put(_"Revoke initiative")
   6.382 +          end,
   6.383 +          module = "initiative",
   6.384 +          view = "revoke",
   6.385 +          id = initiative.id
   6.386 +        }
   6.387 +        slot.put(" &middot; ")
   6.388 +      end
   6.389 +
   6.390 +      ui.tag{
   6.391 +        attr = { class = "draft_version" },
   6.392 +        content = _("Latest draft created at #{date} #{time}", {
   6.393 +          date = format.date(initiative.current_draft.created),
   6.394 +          time = format.time(initiative.current_draft.created)
   6.395 +        })
   6.396 +      }
   6.397 +      if drafts_count > 1 then
   6.398 +        slot.put(" &middot; ")
   6.399 +        ui.link{
   6.400 +          module = "draft", view = "list", params = { initiative_id = initiative.id },
   6.401 +          text = _("List all revisions (#{count})", { count = drafts_count })
   6.402 +        }
   6.403 +      end
   6.404 +    end }
   6.405 +
   6.406 +    execute.view{
   6.407 +      module = "draft",
   6.408 +      view = "_show",
   6.409 +      params = {
   6.410 +        draft = initiative.current_draft
   6.411 +      }
   6.412 +    }
   6.413 +  end
   6.414 +end }
   6.415 +
   6.416 +if not show_as_head then
   6.417 +  execute.view{
   6.418 +    module = "suggestion",
   6.419 +    view = "_list",
   6.420 +    params = {
   6.421 +      initiative = initiative,
   6.422 +      suggestions_selector = initiative:get_reference_selector("suggestions"),
   6.423 +      tab_id = param.get("tab_id")
   6.424 +    }
   6.425 +  }
   6.426 +
   6.427 +
   6.428 +  if config.public_access == "full" or app.session.member_id then
   6.429 +    if initiative.issue.ranks_available then
   6.430 +      local members_selector = initiative.issue:get_reference_selector("direct_voters")
   6.431 +            :left_join("vote", nil, { "vote.initiative_id = ? AND vote.member_id = member.id", initiative.id })
   6.432 +            :add_field("direct_voter.weight as voter_weight")
   6.433 +            :add_field("coalesce(vote.grade, 0) as grade")
   6.434 +            :left_join("initiative", nil, "initiative.id = vote.initiative_id")
   6.435 +            :left_join("issue", nil, "issue.id = initiative.issue_id")
   6.436 +      
   6.437 +      ui.anchor{ name = "voter", attr = { class = "heading" }, content = _"Member voter" }
   6.438 +      
   6.439 +      execute.view{
   6.440 +        module = "member",
   6.441 +        view = "_list",
   6.442 +        params = {
   6.443 +          initiative = initiative,
   6.444 +          for_votes = true,
   6.445 +          members_selector = members_selector,
   6.446 +          paginator_name = "voter"
   6.447 +        }
   6.448 +      }
   6.449 +    end
   6.450 +    
   6.451 +    local members_selector = initiative:get_reference_selector("supporting_members_snapshot")
   6.452 +              :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id")
   6.453 +              :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")
   6.454 +              :add_field("direct_interest_snapshot.weight")
   6.455 +              :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event")
   6.456 +              :add_where("direct_supporter_snapshot.satisfied")
   6.457 +              :add_field("direct_supporter_snapshot.informed", "is_informed")
   6.458 +
   6.459 +    if members_selector:count() > 0 then
   6.460 +      if issue.fully_frozen then
   6.461 +        ui.anchor{ name = "supporters", attr = { class = "heading" }, content = _"Supporters (before begin of voting)" }
   6.462 +      else
   6.463 +        ui.anchor{ name = "supporters", attr = { class = "heading" }, content = _"Supporters" }
   6.464 +      end      
   6.465 +      
   6.466 +      execute.view{
   6.467 +        module = "member",
   6.468 +        view = "_list",
   6.469 +        params = {
   6.470 +          initiative = initiative,
   6.471 +          members_selector = members_selector,
   6.472 +          paginator_name = "supporters"
   6.473 +        }
   6.474 +    }
   6.475 +    else
   6.476 +      if issue.fully_frozen then
   6.477 +        ui.anchor{ name = "supporters", attr = { class = "heading" }, content = _"No supporters (before begin of voting)" }
   6.478 +      else
   6.479 +        ui.anchor{ name = "supporters", attr = { class = "heading" }, content = _"No supporters" }
   6.480 +      end
   6.481 +      slot.put("<br />")
   6.482 +    end
   6.483 +
   6.484 +    local members_selector = initiative:get_reference_selector("supporting_members_snapshot")
   6.485 +              :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id")
   6.486 +              :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")
   6.487 +              :add_field("direct_interest_snapshot.weight")
   6.488 +              :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event")
   6.489 +              :add_where("NOT direct_supporter_snapshot.satisfied")
   6.490 +              :add_field("direct_supporter_snapshot.informed", "is_informed")
   6.491 +
   6.492 +    if members_selector:count() > 0 then
   6.493 +      if issue.fully_frozen then
   6.494 +        ui.anchor{ name = "potential_supporters", attr = { class = "heading" }, content = _"Potential supporters (before begin of voting)" }
   6.495 +      else
   6.496 +        ui.anchor{ name = "potential_supporters", attr = { class = "heading" }, content = _"Potential supporters" }
   6.497 +      end
   6.498 +                
   6.499 +      execute.view{
   6.500 +        module = "member",
   6.501 +        view = "_list",
   6.502 +        params = {
   6.503 +          initiative = initiative,
   6.504 +          members_selector = members_selector,
   6.505 +          paginator_name = "potential_supporters"
   6.506 +        }
   6.507 +      }
   6.508 +    else
   6.509 +      if issue.fully_frozen then
   6.510 +        ui.anchor{ name = "potential_supporters", attr = { class = "heading" }, content = _"No potential supporters (before begin of voting)" }
   6.511 +      else
   6.512 +        ui.anchor{ name = "potential_supporters", attr = { class = "heading" }, content = _"No potential supporters" }
   6.513 +      end
   6.514 +      slot.put("<br />")
   6.515 +    end
   6.516 +    
   6.517 +    ui.container{ attr = { class = "heading" }, content = _"Details" }
   6.518 +    execute.view {
   6.519 +      module = "initiative",
   6.520 +      view = "_details",
   6.521 +      params = {
   6.522 +        initiative = initiative,
   6.523 +        members_selector = members_selector
   6.524 +      }
   6.525 +    }
   6.526 +
   6.527 +  end
   6.528 +end
   6.529 \ No newline at end of file
     7.1 --- a/app/main/initiative/show.lua	Thu Jun 28 01:02:03 2012 +0200
     7.2 +++ b/app/main/initiative/show.lua	Thu Jun 28 13:52:42 2012 +0200
     7.3 @@ -1,442 +1,7 @@
     7.4  local initiative = Initiative:by_id(param.get_id())
     7.5 -initiative:load_everything_for_member_id(app.session.member_id)
     7.6 -
     7.7 -local issue = initiative.issue
     7.8 -
     7.9 -if app.session.member_id then
    7.10 -  issue:load_everything_for_member_id(app.session.member_id)
    7.11 -end
    7.12 -
    7.13 -app.html_title.title = initiative.name
    7.14 -app.html_title.subtitle = _("Initiative ##{id}", { id = initiative.id })
    7.15 -
    7.16 -slot.select("head", function()
    7.17 -  execute.view{
    7.18 -    module = "issue", view = "_head",
    7.19 -    params = { issue = issue, initiative = initiative }
    7.20 -  }
    7.21 -end)
    7.22 -  
    7.23 -local initiators_members_selector = initiative:get_reference_selector("initiating_members")
    7.24 -  :add_field("initiator.accepted", "accepted")
    7.25 -  :add_order_by("member.name")
    7.26 -if initiator and initiator.accepted then
    7.27 -  initiators_members_selector:add_where("initiator.accepted ISNULL OR initiator.accepted")
    7.28 -else
    7.29 -  initiators_members_selector:add_where("initiator.accepted")
    7.30 -end
    7.31 -
    7.32 -local initiators = initiators_members_selector:exec()
    7.33 -
    7.34 -
    7.35 -local initiatives_selector = initiative.issue:get_reference_selector("initiatives")
    7.36 -slot.select("head", function()
    7.37 -  execute.view{
    7.38 -    module = "issue",
    7.39 -    view = "_show",
    7.40 -    params = {
    7.41 -      issue = initiative.issue,
    7.42 -      initiative_limit = 3,
    7.43 -      for_initiative = initiative
    7.44 -    }
    7.45 -  }
    7.46 -end)
    7.47 -
    7.48 -util.help("initiative.show")
    7.49 -
    7.50 -ui.container{ attr = { class = "initiative_head" }, content = function()
    7.51 -
    7.52 -  ui.container{
    7.53 -    attr = { class = "title" },
    7.54 -    content = _("Initiative i#{id}: #{name}", { id = initiative.id, name = initiative.name })
    7.55 -  }
    7.56 -
    7.57 -  ui.container{ attr = { class = "content" }, content = function()
    7.58 -    if app.session.member_id or config.public_access == "pseudonym" or config.public_access == "full" then
    7.59 -      ui.tag{
    7.60 -        attr = { class = "initiator_names" },
    7.61 -        content = function()
    7.62 -          for i, initiator in ipairs(initiators) do
    7.63 -            slot.put(" ")
    7.64 -            if app.session.member_id or config.public_access == "full" then
    7.65 -              ui.link{
    7.66 -                content = function ()
    7.67 -                  execute.view{
    7.68 -                    module = "member_image",
    7.69 -                    view = "_show",
    7.70 -                    params = {
    7.71 -                      member = initiator,
    7.72 -                      image_type = "avatar",
    7.73 -                      show_dummy = true,
    7.74 -                      class = "micro_avatar",
    7.75 -                      popup_text = text
    7.76 -                    }
    7.77 -                  }
    7.78 -                end,
    7.79 -                module = "member", view = "show", id = initiator.id
    7.80 -              }
    7.81 -              slot.put(" ")
    7.82 -            end
    7.83 -            ui.link{
    7.84 -              text = initiator.name,
    7.85 -              module = "member", view = "show", id = initiator.id
    7.86 -            }
    7.87 -            if not initiator.accepted then
    7.88 -              ui.tag{ attr = { title = _"Not accepted yet" }, content = "?" }
    7.89 -            end
    7.90 -          end
    7.91 -        end
    7.92 -      }
    7.93 -    end
    7.94 -
    7.95 -    if initiator and initiator.accepted and not initiative.issue.fully_frozen and not initiative.issue.closed and not initiative.revoked then
    7.96 -      slot.put(" &middot; ")
    7.97 -      ui.link{
    7.98 -        attr = { class = "action" },
    7.99 -        content = function()
   7.100 -          slot.put(_"Invite initiator")
   7.101 -        end,
   7.102 -        module = "initiative",
   7.103 -        view = "add_initiator",
   7.104 -        params = { initiative_id = initiative.id }
   7.105 -      }
   7.106 -      if #initiators > 1 then
   7.107 -        slot.put(" &middot; ")
   7.108 -        ui.link{
   7.109 -          content = function()
   7.110 -            slot.put(_"Remove initiator")
   7.111 -          end,
   7.112 -          module = "initiative",
   7.113 -          view = "remove_initiator",
   7.114 -          params = { initiative_id = initiative.id }
   7.115 -        }
   7.116 -      end
   7.117 -    end
   7.118 -    if initiator and initiator.accepted == false then
   7.119 -        slot.put(" &middot; ")
   7.120 -        ui.link{
   7.121 -          text   = _"Cancel refuse of invitation",
   7.122 -          module = "initiative",
   7.123 -          action = "remove_initiator",
   7.124 -          params = {
   7.125 -            initiative_id = initiative.id,
   7.126 -            member_id = app.session.member.id
   7.127 -          },
   7.128 -          routing = {
   7.129 -            ok = {
   7.130 -              mode = "redirect",
   7.131 -              module = "initiative",
   7.132 -              view = "show",
   7.133 -              id = initiative.id
   7.134 -            }
   7.135 -          }
   7.136 -        }
   7.137 -    end
   7.138 -  end }
   7.139 -  ui.container{ attr = { class = "content" }, content = function()
   7.140 -    if app.session.member_id then
   7.141 -      execute.view{
   7.142 -        module = "supporter",
   7.143 -        view = "_show_box",
   7.144 -        params = {
   7.145 -          initiative = initiative
   7.146 -        }
   7.147 -      }
   7.148 -    end
   7.149 -
   7.150 -  end }
   7.151 -
   7.152 -  
   7.153 -  -- voting results
   7.154 -  if initiative.issue.ranks_available and initiative.admitted then
   7.155 -    local class = initiative.winner and "admitted_info" or "not_admitted_info"
   7.156 -    ui.container{
   7.157 -      attr = { class = class },
   7.158 -      content = function()
   7.159 -        local max_value = initiative.issue.voter_count
   7.160 -        slot.put("&nbsp;")
   7.161 -        local positive_votes = initiative.positive_votes
   7.162 -        local negative_votes = initiative.negative_votes
   7.163 -        local sum_votes = initiative.positive_votes + initiative.negative_votes
   7.164 -        local function perc(votes, sum)
   7.165 -          if sum > 0 and votes > 0 then return " (" .. string.format( "%.f", votes * 100 / sum ) .. "%)" end
   7.166 -          return ""
   7.167 -        end
   7.168 -        slot.put(_"Yes" .. ": <b>" .. tostring(positive_votes) .. perc(positive_votes, sum_votes) .. "</b>")
   7.169 -        slot.put(" &middot; ")
   7.170 -        slot.put(_"Abstention" .. ": <b>" .. tostring(max_value - initiative.negative_votes - initiative.positive_votes)  .. "</b>")
   7.171 -        slot.put(" &middot; ")
   7.172 -        slot.put(_"No" .. ": <b>" .. tostring(initiative.negative_votes) .. perc(negative_votes, sum_votes) .. "</b>")
   7.173 -        slot.put(" &middot; ")
   7.174 -        slot.put("<b>")
   7.175 -        if initiative.winner then
   7.176 -          slot.put(_"Approved")
   7.177 -        elseif initiative.rank then
   7.178 -          slot.put(_("Not approved (rank #{rank})", { rank = initiative.rank }))
   7.179 -        else
   7.180 -          slot.put(_"Not approved")
   7.181 -        end
   7.182 -        slot.put("</b>")
   7.183 -      end
   7.184 -    }
   7.185 -  end
   7.186 -
   7.187 -  ui.container{ attr = { class = "content" }, content = function()
   7.188 -    execute.view{
   7.189 -      module = "initiative",
   7.190 -      view = "_battles",
   7.191 -      params = { initiative = initiative }
   7.192 -    }
   7.193 -  end }
   7.194 -    
   7.195 -  -- initiative not admitted info
   7.196 -  if initiative.admitted == false then
   7.197 -    local policy = initiative.issue.policy
   7.198 -    ui.container{
   7.199 -      attr = { class = "not_admitted_info" },
   7.200 -      content = _("This initiative has not been admitted! It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den) })
   7.201 -    }
   7.202 -  end
   7.203 -
   7.204 -  -- initiative revoked info
   7.205 -  if initiative.revoked then
   7.206 -    ui.container{
   7.207 -      attr = { class = "revoked_info" },
   7.208 -      content = function()
   7.209 -        slot.put(_("This initiative has been revoked at #{revoked}", { revoked = format.timestamp(initiative.revoked) }))
   7.210 -        local suggested_initiative = initiative.suggested_initiative
   7.211 -        if suggested_initiative then
   7.212 -          slot.put("<br /><br />")
   7.213 -          slot.put(_("The initiators suggest to support the following initiative:"))
   7.214 -          slot.put(" ")
   7.215 -          ui.link{
   7.216 -            content = _("Issue ##{id}", { id = suggested_initiative.issue.id } ) .. ": " .. encode.html(suggested_initiative.name),
   7.217 -            module = "initiative",
   7.218 -            view = "show",
   7.219 -            id = suggested_initiative.id
   7.220 -          }
   7.221 -        end
   7.222 -      end
   7.223 -    }
   7.224 -  end
   7.225 -
   7.226 -
   7.227 -  -- invited as initiator
   7.228 -  if initiator and initiator.accepted == nil and not initiative.issue.half_frozen and not initiative.issue.closed then
   7.229 -    ui.container{
   7.230 -      attr = { class = "initiator_invite_info" },
   7.231 -      content = function()
   7.232 -        slot.put(_"You are invited to become initiator of this initiative.")
   7.233 -        slot.put(" ")
   7.234 -        ui.link{
   7.235 -          image  = { static = "icons/16/tick.png" },
   7.236 -          text   = _"Accept invitation",
   7.237 -          module = "initiative",
   7.238 -          action = "accept_invitation",
   7.239 -          id     = initiative.id,
   7.240 -          routing = {
   7.241 -            default = {
   7.242 -              mode = "redirect",
   7.243 -              module = request.get_module(),
   7.244 -              view = request.get_view(),
   7.245 -              id = param.get_id_cgi(),
   7.246 -              params = param.get_all_cgi()
   7.247 -            }
   7.248 -          }
   7.249 -        }
   7.250 -        slot.put(" ")
   7.251 -        ui.link{
   7.252 -          image  = { static = "icons/16/cross.png" },
   7.253 -          text   = _"Refuse invitation",
   7.254 -          module = "initiative",
   7.255 -          action = "reject_initiator_invitation",
   7.256 -          params = {
   7.257 -            initiative_id = initiative.id,
   7.258 -            member_id = app.session.member.id
   7.259 -          },
   7.260 -          routing = {
   7.261 -            default = {
   7.262 -              mode = "redirect",
   7.263 -              module = request.get_module(),
   7.264 -              view = request.get_view(),
   7.265 -              id = param.get_id_cgi(),
   7.266 -              params = param.get_all_cgi()
   7.267 -            }
   7.268 -          }
   7.269 -        }
   7.270 -      end
   7.271 -    }
   7.272 -  end
   7.273 -
   7.274 -  -- draft updated
   7.275 -  local supporter
   7.276 -
   7.277 -  if app.session.member_id then
   7.278 -    supporter = app.session.member:get_reference_selector("supporters")
   7.279 -      :add_where{ "initiative_id = ?", initiative.id }
   7.280 -      :optional_object_mode()
   7.281 -      :exec()
   7.282 -  end
   7.283 -
   7.284 -  if supporter and not initiative.issue.closed then
   7.285 -    local old_draft_id = supporter.draft_id
   7.286 -    local new_draft_id = initiative.current_draft.id
   7.287 -    if old_draft_id ~= new_draft_id then
   7.288 -      ui.container{
   7.289 -        attr = { class = "draft_updated_info" },
   7.290 -        content = function()
   7.291 -          slot.put(_"The draft of this initiative has been updated!")
   7.292 -          slot.put(" ")
   7.293 -          ui.link{
   7.294 -            content = _"Show diff",
   7.295 -            module = "draft",
   7.296 -            view = "diff",
   7.297 -            params = {
   7.298 -              old_draft_id = old_draft_id,
   7.299 -              new_draft_id = new_draft_id
   7.300 -            }
   7.301 -          }
   7.302 -          if not initiative.revoked then
   7.303 -            slot.put(" ")
   7.304 -            ui.link{
   7.305 -              text   = _"Refresh support to current draft",
   7.306 -              module = "initiative",
   7.307 -              action = "add_support",
   7.308 -              id     = initiative.id,
   7.309 -              routing = {
   7.310 -                default = {
   7.311 -                  mode = "redirect",
   7.312 -                  module = "initiative",
   7.313 -                  view = "show",
   7.314 -                  id = initiative.id
   7.315 -                }
   7.316 -              }
   7.317 -            }
   7.318 -          end
   7.319 -        end
   7.320 -      }
   7.321 -    end
   7.322 -  end
   7.323 -
   7.324 -
   7.325 -  execute.view{
   7.326 -    module = "draft",
   7.327 -    view = "_show",
   7.328 -    params = {
   7.329 -      draft = initiative.current_draft
   7.330 -    }
   7.331 -  }
   7.332 -  
   7.333 -end }
   7.334  
   7.335  execute.view{
   7.336 -  module = "suggestion",
   7.337 -  view = "_list",
   7.338 -  params = {
   7.339 -    initiative = initiative,
   7.340 -    suggestions_selector = initiative:get_reference_selector("suggestions"),
   7.341 -    tab_id = param.get("tab_id")
   7.342 +  module = "initiative", view = "_show", params = {
   7.343 +    initiative = initiative
   7.344    }
   7.345  }
   7.346 -
   7.347 -
   7.348 -if config.public_access == "full" or app.session.member_id then
   7.349 -  if initiative.issue.ranks_available then
   7.350 -    local members_selector = initiative.issue:get_reference_selector("direct_voters")
   7.351 -          :left_join("vote", nil, { "vote.initiative_id = ? AND vote.member_id = member.id", initiative.id })
   7.352 -          :add_field("direct_voter.weight as voter_weight")
   7.353 -          :add_field("coalesce(vote.grade, 0) as grade")
   7.354 -          :left_join("initiative", nil, "initiative.id = vote.initiative_id")
   7.355 -          :left_join("issue", nil, "issue.id = initiative.issue_id")
   7.356 -    
   7.357 -    ui.anchor{ name = "voter", attr = { class = "heading" }, content = _"Member voter" }
   7.358 -    
   7.359 -    execute.view{
   7.360 -      module = "member",
   7.361 -      view = "_list",
   7.362 -      params = {
   7.363 -        initiative = initiative,
   7.364 -        for_votes = true,
   7.365 -        members_selector = members_selector,
   7.366 -        paginator_name = "voter"
   7.367 -      }
   7.368 -    }
   7.369 -  end
   7.370 -  
   7.371 -  local members_selector = initiative:get_reference_selector("supporting_members_snapshot")
   7.372 -            :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id")
   7.373 -            :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")
   7.374 -            :add_field("direct_interest_snapshot.weight")
   7.375 -            :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event")
   7.376 -            :add_where("direct_supporter_snapshot.satisfied")
   7.377 -            :add_field("direct_supporter_snapshot.informed", "is_informed")
   7.378 -
   7.379 -  if members_selector:count() > 0 then
   7.380 -    if issue.fully_frozen then
   7.381 -      ui.anchor{ name = "supporters", attr = { class = "heading" }, content = _"Supporters (before begin of voting)" }
   7.382 -    else
   7.383 -      ui.anchor{ name = "supporters", attr = { class = "heading" }, content = _"Supporters" }
   7.384 -    end      
   7.385 -    
   7.386 -    execute.view{
   7.387 -      module = "member",
   7.388 -      view = "_list",
   7.389 -      params = {
   7.390 -        initiative = initiative,
   7.391 -        members_selector = members_selector,
   7.392 -        paginator_name = "supporters"
   7.393 -      }
   7.394 -  }
   7.395 -  else
   7.396 -    if issue.fully_frozen then
   7.397 -      ui.anchor{ name = "supporters", attr = { class = "heading" }, content = _"No supporters (before begin of voting)" }
   7.398 -    else
   7.399 -      ui.anchor{ name = "supporters", attr = { class = "heading" }, content = _"No supporters" }
   7.400 -    end
   7.401 -    slot.put("<br />")
   7.402 -  end
   7.403 -
   7.404 -  local members_selector = initiative:get_reference_selector("supporting_members_snapshot")
   7.405 -            :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id")
   7.406 -            :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")
   7.407 -            :add_field("direct_interest_snapshot.weight")
   7.408 -            :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event")
   7.409 -            :add_where("NOT direct_supporter_snapshot.satisfied")
   7.410 -            :add_field("direct_supporter_snapshot.informed", "is_informed")
   7.411 -
   7.412 -  if members_selector:count() > 0 then
   7.413 -    if issue.fully_frozen then
   7.414 -      ui.anchor{ name = "potential_supporters", attr = { class = "heading" }, content = _"Potential supporters (before begin of voting)" }
   7.415 -    else
   7.416 -      ui.anchor{ name = "potential_supporters", attr = { class = "heading" }, content = _"Potential supporters" }
   7.417 -    end
   7.418 -              
   7.419 -    execute.view{
   7.420 -      module = "member",
   7.421 -      view = "_list",
   7.422 -      params = {
   7.423 -        initiative = initiative,
   7.424 -        members_selector = members_selector,
   7.425 -        paginator_name = "potential_supporters"
   7.426 -      }
   7.427 -    }
   7.428 -  else
   7.429 -    if issue.fully_frozen then
   7.430 -      ui.anchor{ name = "potential_supporters", attr = { class = "heading" }, content = _"No potential supporters (before begin of voting)" }
   7.431 -    else
   7.432 -      ui.anchor{ name = "potential_supporters", attr = { class = "heading" }, content = _"No potential supporters" }
   7.433 -    end
   7.434 -    slot.put("<br />")
   7.435 -  end
   7.436 -  
   7.437 -  ui.container{ attr = { class = "heading" }, content = _"Details" }
   7.438 -  execute.view {
   7.439 -    module = "initiative",
   7.440 -    view = "_details",
   7.441 -    params = {
   7.442 -      initiative = initiative,
   7.443 -      members_selector = members_selector
   7.444 -    }
   7.445 -  }
   7.446 -
   7.447 -end
     8.1 --- a/app/main/supporter/_show_box.lua	Thu Jun 28 01:02:03 2012 +0200
     8.2 +++ b/app/main/supporter/_show_box.lua	Thu Jun 28 13:52:42 2012 +0200
     8.3 @@ -1,7 +1,5 @@
     8.4  local initiative = param.get("initiative", "table") or Initiative:by_id(param.get_id())
     8.5  
     8.6 --- TODO performance
     8.7 -local initiator = Initiator:by_pk(initiative.id, app.session.member.id)
     8.8  
     8.9  local initiative = param.get("initiative", "table")
    8.10  local supporter = Supporter:by_pk(initiative.id, app.session.member.id)
    8.11 @@ -77,57 +75,10 @@
    8.12    end
    8.13  end
    8.14  
    8.15 -if (initiative.discussion_url and #initiative.discussion_url > 0) then
    8.16 -  if initiative.discussion_url:find("^https?://") then
    8.17 -    if initiative.discussion_url and #initiative.discussion_url > 0 then
    8.18 -      ui.link{
    8.19 -        attr = {
    8.20 -          target = "_blank",
    8.21 -          title = _"Discussion with initiators"
    8.22 -        },
    8.23 -        text = _"Discuss with initiators",
    8.24 -        external = initiative.discussion_url
    8.25 -      }
    8.26 -      slot.put(" ")
    8.27 -    end
    8.28 -  else
    8.29 -    slot.put(encode.html(initiative.discussion_url))
    8.30 -  end
    8.31 -end
    8.32 -if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
    8.33 -  ui.link{
    8.34 -    text   = _"change discussion URL",
    8.35 -    module = "initiative",
    8.36 -    view   = "edit",
    8.37 -    id     = initiative.id
    8.38 -  }
    8.39 -  slot.put(" ")
    8.40 -end
    8.41 -if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
    8.42 -  ui.link{
    8.43 -    content = function()
    8.44 -      slot.put(_"Edit draft")
    8.45 -    end,
    8.46 -    module = "draft",
    8.47 -    view = "new",
    8.48 -    params = { initiative_id = initiative.id }
    8.49 -  }
    8.50 -  slot.put(" ")
    8.51 -end
    8.52  
    8.53 -if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
    8.54 -  ui.link{
    8.55 -    content = function()
    8.56 -      slot.put(_"Revoke initiative")
    8.57 -    end,
    8.58 -    module = "initiative",
    8.59 -    view = "revoke",
    8.60 -    id = initiative.id
    8.61 -  }
    8.62 -  slot.put(" ")
    8.63 -end
    8.64  
    8.65  if not initiative.issue.closed then
    8.66 +  slot.put(" &middot; ")
    8.67    local ignored_initiative = IgnoredInitiative:by_pk(app.session.member.id, initiative.id)
    8.68    if ignored_initiative then
    8.69      ui.tag{
     9.1 --- a/config/development.lua	Thu Jun 28 01:02:03 2012 +0200
     9.2 +++ b/config/development.lua	Thu Jun 28 13:52:42 2012 +0200
     9.3 @@ -33,7 +33,7 @@
     9.4  
     9.5  --config.motd_intern = "==Internal motd=="
     9.6  
     9.7 -config.public_access = "full"
     9.8 +config.public_access = "anonym"
     9.9  
    9.10  -- you can put some js code to the bottom on the page
    9.11  -- here it opens the trace window
    10.1 --- a/locale/translations.de.lua	Thu Jun 28 01:02:03 2012 +0200
    10.2 +++ b/locale/translations.de.lua	Thu Jun 28 13:52:42 2012 +0200
    10.3 @@ -43,7 +43,6 @@
    10.4  ["Add my interest"] = "Mein Interesse anmelden";
    10.5  ["Add new suggestion"] = "Neue Anregung hinzufügen";
    10.6  ["Add new unit"] = "Neue Gliederung";
    10.7 -["Add suggestion"] = "Neue Anregung";
    10.8  ["Add to my contacts"] = "Zu meinen Kontakten hinzufügen";
    10.9  ["Address"] = "Anschrift";
   10.10  ["Admin"] = "Admin";
   10.11 @@ -144,6 +143,7 @@
   10.12  ["Created at"] = "Erzeugt am/um";
   10.13  ["Current draft"] = "Aktueller Entwurf";
   10.14  ["Current name"] = "Aktueller Name";
   10.15 +["Latest draft created from #{name} at #{date} #{time}"] = "Letzter Entwurf von #{name} am #{date} um #{time}";
   10.16  ["Current status"] = "Aktueller Status";
   10.17  ["Current trustee"] = "Aktueller Delegierter";
   10.18  ["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:";
   10.19 @@ -260,7 +260,6 @@
   10.20  ["Initiated"] = "Initiiert";
   10.21  ["Initiative"] = "Initiative";
   10.22  ["Initiative ##{id}"] = "Initiative ##{id}";
   10.23 -["Initiative details"] = "Details zur Initiative";
   10.24  ["Initiative events"] = "Initiativen-Ereignisse";
   10.25  ["Initiative i#{id}: #{name}"] = "Initiative i#{id}: #{name}";
   10.26  ["Initiative is revoked now"] = "Initiative ist jetzt zurückgezogen";
   10.27 @@ -280,6 +279,7 @@
   10.28  ["Interest removed"] = "Interesse entfernt";
   10.29  ["Interest updated"] = "Interesse aktualisiert";
   10.30  ["Interested"] = "Interessiert";
   10.31 +["Interested members"] = "Interessierte Mitglieder";
   10.32  ["Internal posts"] = "Interne Ämter";
   10.33  ["Interval format:"] = "Intervall-Format";
   10.34  ["Invalid query"] = "Ungültige Anfrage";
   10.35 @@ -295,7 +295,6 @@
   10.36  ["Issue accepted"] = "Thema akzeptiert";
   10.37  ["Issue canceled"] = "Thema abgebrochen";
   10.38  ["Issue delegation"] = "Issue-Delegation";
   10.39 -["Issue details"] = "Details zum Thema";
   10.40  ["Issue events"] = "Themen-Ereignisse";
   10.41  ["Issue finished"] = "Thema abgeschlossen";
   10.42  ["Issue finished without voting"] = "Thema ohne Abstimmung abgeschlossen";
   10.43 @@ -336,7 +335,7 @@
   10.44  ["Member page"] = "Mitgliederseite";
   10.45  ["Member successfully registered"] = "Mitglied erfolgreich registriert";
   10.46  ["Member successfully updated"] = "Mitglied erfolgreich aktualisert";
   10.47 -["Member voting"] = "Abstimmungsverhalten";
   10.48 +["Member voter"] = false;
   10.49  ["Member: '#{identification}' (#{name})"] = "Mitglied: '#{identification}' (#{name})";
   10.50  ["Members"] = "Mitglieder";
   10.51  ["Membership not existent"] = "Mitgliedschaft existiert nicht";
   10.52 @@ -374,14 +373,18 @@
   10.53  ["No more events available"] = "Keine weiteren Ereignisse verfügbar";
   10.54  ["No multistage majority"] = "Keine mehrstufigen Mehrheiten";
   10.55  ["No notifications at all"] = "Gar keine Benachrichtigungen";
   10.56 +["No potential supporters"] = "Keine potentiellen Unterstützer";
   10.57 +["No potential supporters (before begin of voting)"] = "Keine potentiellen Unterstützer (zum Abstimmungsbeginn)";
   10.58  ["No reverse beat path"] = "Kein rückwärtsgerichteter Schlagpfad";
   10.59 +["No suggestions"] = "Keine Anregungen";
   10.60 +["No suggestions yet"] = "Noch keine Anregungen";
   10.61 +["No supporters"] = "Keine Unterstützer";
   10.62 +["No supporters (before begin of voting)"] = "Keine Unterstützer (zum Abstimmungsbeginn)";
   10.63  ["Not a member"] = "Kein Mitglied";
   10.64  ["Not accepted yet"] = "Bisher nicht angenommen";
   10.65  ["Not approved"] = "Nicht angenommen";
   10.66  ["Not approved (rank #{rank})"] = "Nicht angenommen (Rang #{rank})";
   10.67  ["Not voted"] = "Nicht abgestimmt";
   10.68 -["Not voted (not admitted)"] = "Nicht abgestimmt (nicht zugelassen)";
   10.69 -["Not voted (revoked from initiator)"] = "Nicht abgestimmt (durch Initiator zurückgezogen)";
   10.70  ["Not voted issues"] = "Nicht abgestimmt";
   10.71  ["Notification address unconfirmed"] = "E-Mail-Adresse für Benachrichtigungen unbestätigt";
   10.72  ["Notification email"] = "E-Mail für Benachrichtigungs";
   10.73 @@ -449,6 +452,7 @@
   10.74  ["Posts"] = "Ämter";
   10.75  ["Potential supported"] = "Potentiell unterstützt";
   10.76  ["Potential supporters"] = "Potentielle Unterstützer";
   10.77 +["Potential supporters (before begin of voting)"] = "Potentielle Unterstützer (zum Abstimmungsbeginn)";
   10.78  ["Potentially supported"] = "Potentiell unterstützt";
   10.79  ["Preview"] = "Vorschau";
   10.80  ["Profession"] = "Beruf";
   10.81 @@ -512,6 +516,7 @@
   10.82  ["Show help text"] = "Zeige Hilfe-Text";
   10.83  ["Show member"] = "Mitglied anzeigen";
   10.84  ["Show member history"] = "Historie des Mitglieds anzeigen";
   10.85 +["Show old revision"] = "Zeige alte Entwürfe";
   10.86  ["Show older events"] = "Zeige ältere Ereignisse";
   10.87  ["Show only events which match... (or associtated)"] = "Zeige nur Ereignisse welche folgendes erfüllen... (oder-verknüpft)";
   10.88  ["Show policies in use"] = "Zeige Regelwerke in Verwendung";
   10.89 @@ -552,6 +557,7 @@
   10.90  ["Support this initiative"] = "Diese Initiative unterstützen";
   10.91  ["Supported"] = "Unterstützt";
   10.92  ["Supporters"] = "Unterstützer";
   10.93 +["Supporters (before begin of voting)"] = "Unterstützer (zum Abstimmungesbeginn)";
   10.94  ["Syntax help"] = "Syntax-Hilfe";
   10.95  ["Terms of use"] = "Nutzungsbedingungen";
   10.96  ["The code you've entered is invalid"] = "Der Code, den Du eingeben hast, ist nicht gültig!";
   10.97 @@ -561,7 +567,6 @@
   10.98  ["This email address is too short!"] = "Diese E-Mail-Adresse ist zu kurz!";
   10.99  ["This identifier is not allowed for this instance."] = "Dieser Identifier ist für diese Instanz nicht zugelassen.";
  10.100  ["This initiative"] = "Diese Initiative";
  10.101 -["This initiative compared to alternative initiatives"] = "Diese Initiative im Vergleich zu alternativen Initiativen";
  10.102  ["This initiative has been revoked at #{revoked}"] = "Diese Initiative wurde am/um #{revoked} zurückgezogen";
  10.103  ["This initiative has not been admitted! It failed the quorum of #{quorum}."] = "Diese Initiative wurde nicht zugelassen. Sie hat das Quorum von #{quorum} nicht erreicht.";
  10.104  ["This initiative is already revoked"] = "Diese Initiative ist schon zurückgezogen";
  10.105 @@ -668,7 +673,6 @@
  10.106  ["You have ignored this initiative"] = "Du ignorierst diese Initiative";
  10.107  ["You have ignored this member"] = "Du ignorierst dieses Mitglied";
  10.108  ["You have not voted #{count} issue(s) you were interested in"] = "Du hast für #{count} Themen, die dich interessieren, noch nicht abgestimmt";
  10.109 -["You have saved this member as contact"] = "Du hast das Mitglied als Kontakt gespeichert";
  10.110  ["You have to mark 'Are you sure' to revoke!"] = "Zum Zurückziehen musst Du 'Sicher?' auswählen";
  10.111  ["You have voting privileges for this unit"] = "Du hast Stimmrecht in dieser Gliederung";
  10.112  ["You need to be logged in, to use all features of this system."] = "Du musst eingeloggt sein, um alle Funktionen dieses Systems nutzen zu können.";
    11.1 --- a/static/style.css	Thu Jun 28 01:02:03 2012 +0200
    11.2 +++ b/static/style.css	Thu Jun 28 13:52:42 2012 +0200
    11.3 @@ -346,6 +346,14 @@
    11.4    padding: 8px 10px 2px 10px;
    11.5  }
    11.6  
    11.7 +.initiative_head .draft_version {
    11.8 +  font-weight: bold;
    11.9 +}
   11.10 +
   11.11 +.initiative_head a.title {
   11.12 +  display: block;
   11.13 +}
   11.14 +
   11.15  .area_list .title {
   11.16    padding: 8px 10px 0px 10px;
   11.17  }
   11.18 @@ -942,7 +950,6 @@
   11.19  }
   11.20  
   11.21  .issue .suggestion {
   11.22 -  margin-left: 1ex;
   11.23    margin-bottom: 1ex;
   11.24    font-weight: bold;
   11.25  }
   11.26 @@ -1285,7 +1292,7 @@
   11.27  }
   11.28  
   11.29  .wiki {
   11.30 -  line-height: 133%;
   11.31 +  line-height: 150%;
   11.32  }
   11.33  
   11.34  .wiki h1,

Impressum / About Us