Commits

Anonymous committed 3941792

Version beta3

Table allowed_policy is respected while creating new issues

Broken vote now/later link is not shown anymore (until it's implemented)

More user friendly error page

Minor spelling error corrected

Comments (0)

Files changed (7)

app/main/_layout/system_error.html

     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     <title>Liquid Democracy System Error</title>
     <link rel="stylesheet" type="text/css" media="screen" href="__BASEURL__/static/trace.css" />
-    <link rel="stylesheet" type="text/css" media="screen" href="__BASEURL__/static/style.css" />
+    <style>
+      body {
+        font-family: sans-serif;
+      }
+      .title {
+        font-size: 150%;
+        font-weight: bold;
+      }
+      .layout_trace {
+        left: 0;
+      }
+      a {
+        background-color: #ddd;
+        color: #000;
+        padding: 1ex;
+        margin: 1ex;
+        line-height: 300%;
+        border: 1px solid #777;
+      }
+      hr {
+        margin-top: 2ex;
+        margin-bottom: 2ex;
+      }
+    </style>
   </head>
   <body class="system_error">
-    <div class="layout_content">
-      <div class="layout_title">
-        <div class="title">
-          <br />
-          <br />
-          System message
-        </div>
-      </div>
-      <br style="clear: left;">
-      <div class="layout_actions">
-        &nbsp;
-      </div>
-      <div class="layout_main">
-        <div class="main">
-          <tt><!-- WEBMCP SLOT system_error --></tt>
-          <br />
-          <br />
-          <br />
-          <br />
-          <button onclick="window.location.reload()">Retry request</button>
-          <a href="__BASEURL__">index</a>
-        </div>
-      </div>
+
+    <div class="title">
+      <img src="__BASEURL__/static/lang/en.png" />
+      Ooops, a system error occured
     </div>
-      <div class="layout_trace" id="layout_trace" style="xdisplay: none">
-	    <div id="trace_show" onclick="document.getElementById('trace_content').style.display='block';this.style.display='none';" style="display: none;">TRACE</div>
-        <div id="trace_content">
-	        <!-- WEBMCP SLOT trace -->
-	        <div class="trace_close" onclick="document.getElementById('trace_show').style.display='block';document.getElementById('trace_content').style.display='none';">close</div>
-	    </div>
-      </div>
+    <p>
+      Most probably you found a software bug. Don't panic, you can now choose one of the following options:
+    </p>
+
+    <nobr><a href="__BASEURL__">Go to start page</a></nobr>
+    <nobr><a href="#" onclick="window.location.reload()">Retry request</a></nobr>
+    <nobr><a href="http://trac.public-software-group.org/projects/lf" target="_blank">Create bug report</a></nobr>
+
+    <hr />
+
+    <div class="title">
+      <img src="__BASEURL__/static/lang/de.png" />
+      Leider ist ein Systemfehler aufgetreten
+    </div>
+    <p>
+      Du hast vermutlich gerade einen Fehler in der Software entdeckt. Das ist kein Grund zur Panik, dir bleiben die folgenden Optionen:
+    </p>
+
+    <nobr><a href="__BASEURL__">Weiter zur Startseite</a></nobr>
+    <nobr><a href="#" onclick="window.location.reload()">Anfrage wiederholen</a></nobr>
+    <nobr><a href="http://trac.public-software-group.org/projects/lf" target="_blank">Fehlerbericht erstellen</a></nobr>
+
+    <hr />
+    <p>
+      If you write a bug report, please include the following output in your bug report.<br />
+      Falls Du einen Fehlerbericht erstellst, füge bitte die folgenden Ausgaben mit ein.
+    </p>
+    <tt style="font-size: 75%;"><!-- WEBMCP SLOT system_error --></tt>
+
+
+    <div class="layout_trace" id="layout_trace" style="xdisplay: none">
+      <div id="trace_show" onclick="document.getElementById('trace_content').style.display='block';this.style.display='none';" style="display: none;">TRACE</div>
+      <div id="trace_content">
+        <!-- WEBMCP SLOT trace -->
+      <div class="trace_close" onclick="document.getElementById('trace_show').style.display='block';document.getElementById('trace_content').style.display='none';">close</div>
+    </div>
+
   </body>
 </html>

app/main/initiative/_action/create.lua

 local initiative = Initiative:new()
 
 if not issue then
+  local policy_id = param.get("policy_id", atom.integer)
+  if not area:get_reference_selector("allowed_policies")
+    :add_where{ "policy.id = ?", policy_id }
+    :optional_object_mode()
+    :exec()
+  then
+    error("policy not allowed")
+  end
   issue = Issue:new()
   issue.area_id = area.id
-  issue.policy_id = param.get("policy_id", atom.integer)
+  issue.policy_id = policy_id
   issue:save()
 end
 

app/main/initiative/new.lua

     if issue_id then
       ui.field.text{ label = _"Issue",  value = issue_id }
     else
+      local value
       ui.field.select{
         label = _"Policy",
         name = "policy_id",
-        foreign_records = Policy:new_selector():add_order_by("index"):exec(),
+        foreign_records = area.allowed_policies,
         foreign_id = "id",
-        foreign_name = "name"
+        foreign_name = "name",
+        value = area.default_policy.id
       }
     end
     ui.field.text{ label = _"Name", name = "name" }

app/main/issue/_show_head.lua

       params = { issue_id = issue.id }
     }
   end
- 
+
+--[[ 
   if issue.state == "accepted" then
     -- TODO
     ui.link{
       end,
     }
   end
+--]]
 
 end)
 

config/default.lua

 config.app_name = "LiquidFeedback"
-config.app_version = "beta2"
+config.app_version = "beta3"
 
 config.app_title = config.app_name .. " (" .. request.get_config_name() .. " environment)"
 

locale/translations.de.lua

 ["Supporter"] = "Unterstützer";
 ["Terms accepted"] = "Bedingungen akzeptiert";
 ["That's me!"] = "Das bin ich";
-["The code you've entered is invalid"] = "Den Code den Du eingeben hast ist nicht gültig!";
+["The code you've entered is invalid"] = "Der Code, den Du eingeben hast, ist nicht gültig!";
 ["The drafts do not differ"] = "Die Entwürfe unterscheiden sich nicht";
 ["This issue is already closed."] = "Das Thema ist schon geschlossen.";
 ["This issue is already frozen."] = "Das Thema ist schon eingefroren";
   connected_by_that_key = 'member_id',
   ref                   = 'members'
 }
+
+Area:add_reference{
+  mode                  = 'mm',
+  to                    = "Policy",
+  this_key              = 'id',
+  that_key              = 'id',
+  connected_by_table    = 'allowed_policy',
+  connected_by_this_key = 'area_id',
+  connected_by_that_key = 'policy_id',
+  ref                   = 'allowed_policies'
+}
+
+function Area.object_get:default_policy()
+  return Policy:new_selector()
+    :join("allowed_policy", nil, "allowed_policy.policy_id = policy.id")
+    :add_where{ "allowed_policy.area_id = ? AND allowed_policy.default_policy", self.id }
+    :single_object_mode()
+    :exec()
+end
+