Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

mod_survey: Added easily-printable output.

  • Loading branch information...
commit 868fadf9b03e1ab530f9c1b025cdea3faf98cdf6 1 parent f9779ec
@arjan arjan authored
View
58 modules/mod_mailinglist/translations/template/mod_mailinglist.pot
@@ -65,7 +65,7 @@ msgid ""
"Act"
msgstr ""
-#: ./modules/mod_mailinglist/templates/admin_mailinglist_recipients.tpl:38 ./modules/mod_mailinglist/templates/_admin_mailing_status_overview.tpl:17 ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:24
+#: ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:24 ./modules/mod_mailinglist/templates/admin_mailinglist_recipients.tpl:38 ./modules/mod_mailinglist/templates/_admin_mailing_status_overview.tpl:17
msgid ""
"Actions"
msgstr ""
@@ -136,7 +136,7 @@ msgid ""
"Bounces"
msgstr ""
-#: ./modules/mod_mailinglist/templates/_mailinglist_scheduled.tpl:12 ./modules/mod_mailinglist/templates/_dialog_mailing_testaddress.tpl:14 ./modules/mod_mailinglist/templates/_dialog_mailinglist_recipients_upload.tpl:13 ./modules/mod_mailinglist/templates/_dialog_mailing_page.tpl:28
+#: ./modules/mod_mailinglist/templates/_dialog_mailing_testaddress.tpl:14 ./modules/mod_mailinglist/templates/_mailinglist_scheduled.tpl:12 ./modules/mod_mailinglist/templates/_dialog_mailinglist_recipients_upload.tpl:13 ./modules/mod_mailinglist/templates/_dialog_mailing_page.tpl:28
msgid ""
"Cancel"
msgstr ""
@@ -182,6 +182,11 @@ msgid ""
"Confirm sending to mailinglist"
msgstr ""
+#: ./modules/mod_mailinglist/templates/_email_mailinglist_hello.tpl:4
+msgid ""
+"Dear"
+msgstr ""
+
#: ./modules/mod_mailinglist/templates/admin_mailinglist_recipients.tpl:20
msgid ""
"Delete all recipients from this list?"
@@ -217,7 +222,7 @@ msgid ""
"Edit the mailing list »"
msgstr ""
-#: ./modules/mod_mailinglist/templates/_dialog_mailing_bounces.tpl:7 ./modules/mod_mailinglist/templates/admin_mailinglist_recipients.tpl:37 ./modules/mod_mailinglist/templates/_dialog_mailing_testaddress.tpl:7
+#: ./modules/mod_mailinglist/templates/_dialog_mailing_bounces.tpl:7 ./modules/mod_mailinglist/templates/_dialog_mailing_testaddress.tpl:7 ./modules/mod_mailinglist/templates/admin_mailinglist_recipients.tpl:37
msgid ""
"Email"
msgstr ""
@@ -243,7 +248,7 @@ msgid ""
"First name"
msgstr ""
-#: ./modules/mod_mailinglist/templates/email_mailinglist_welcome.tpl:8
+#: ./modules/mod_mailinglist/templates/email_mailinglist_welcome.tpl:7
msgid ""
"From now on you will receive mail from our mailing list."
msgstr ""
@@ -258,12 +263,7 @@ msgid ""
"Go to mailinglist page"
msgstr ""
-#: ./modules/mod_mailinglist/templates/email_mailinglist_goodbye.tpl:6
-msgid ""
-"Goodbye,"
-msgstr ""
-
-#: ./modules/mod_mailinglist/templates/email_mailinglist_welcome.tpl:6 ./modules/mod_mailinglist/templates/email_mailinglist_confirm.tpl:6
+#: ./modules/mod_mailinglist/templates/_email_mailinglist_hello.tpl:6
msgid ""
"Hello,"
msgstr ""
@@ -278,7 +278,7 @@ msgid ""
"Help about the mailing page."
msgstr ""
-#: ./modules/mod_mailinglist/templates/email_mailinglist_goodbye.tpl:9
+#: ./modules/mod_mailinglist/templates/email_mailinglist_goodbye.tpl:8
msgid ""
"Hope to see you again."
msgstr ""
@@ -296,7 +296,7 @@ msgid ""
"Keep mailing"
msgstr ""
-#: ./modules/mod_mailinglist/templates/email_mailinglist_welcome.tpl:12 ./modules/mod_mailinglist/templates/email_mailinglist_goodbye.tpl:11 ./modules/mod_mailinglist/templates/email_mailinglist_confirm.tpl:17
+#: ./modules/mod_mailinglist/templates/email_mailinglist_welcome.tpl:11 ./modules/mod_mailinglist/templates/email_mailinglist_confirm.tpl:17 ./modules/mod_mailinglist/templates/email_mailinglist_goodbye.tpl:10
msgid ""
"Kind Regards,"
msgstr ""
@@ -321,7 +321,7 @@ msgid ""
"Mailing list settings."
msgstr ""
-#: ./modules/mod_mailinglist/templates/_admin_mailing_status_overview.tpl:10 ./modules/mod_mailinglist/templates/_admin_menu_module.tpl:2 ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:9
+#: ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:9 ./modules/mod_mailinglist/templates/_admin_mailing_status_overview.tpl:10 ./modules/mod_mailinglist/templates/_admin_menu_module.tpl:2
msgid ""
"Mailing lists"
msgstr ""
@@ -331,7 +331,7 @@ msgid ""
"Mailing status"
msgstr ""
-#: ./modules/mod_mailinglist/templates/admin_mailing_status.tpl:14 ./modules/mod_mailinglist/templates/_admin_edit_sidebar.mailinglist.tpl:10
+#: ./modules/mod_mailinglist/templates/_admin_edit_sidebar.mailinglist.tpl:10 ./modules/mod_mailinglist/templates/admin_mailing_status.tpl:14
msgid ""
"Need more help?"
msgstr ""
@@ -341,12 +341,12 @@ msgid ""
"New mailing list"
msgstr ""
-#: ./modules/mod_mailinglist/mod_mailinglist.erl:154
+#: ./modules/mod_mailinglist/mod_mailinglist.erl:155
msgid ""
"No addresses selected"
msgstr ""
-#: ./modules/mod_mailinglist/templates/_admin_mailing_status_overview.tpl:73 ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:50
+#: ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:50 ./modules/mod_mailinglist/templates/_admin_mailing_status_overview.tpl:73
msgid ""
"No items found"
msgstr ""
@@ -404,7 +404,7 @@ msgid ""
"Please note:"
msgstr ""
-#: ./modules/mod_mailinglist/templates/_mailing_footer.tpl:8
+#: ./modules/mod_mailinglist/templates/_mailing_footer.tpl:18
msgid ""
"Please unsubscribe"
msgstr ""
@@ -419,7 +419,7 @@ msgid ""
"Read this page on the web."
msgstr ""
-#: ./modules/mod_mailinglist/templates/admin_mailinglist_recipients.tpl:33 ./modules/mod_mailinglist/templates/_admin_mailing_status_overview.tpl:14 ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:22
+#: ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:22 ./modules/mod_mailinglist/templates/admin_mailinglist_recipients.tpl:33 ./modules/mod_mailinglist/templates/_admin_mailing_status_overview.tpl:14
msgid ""
"Recipients"
msgstr ""
@@ -440,12 +440,12 @@ msgid ""
"Remove this recipient. No undo possible."
msgstr ""
-#: ./modules/mod_mailinglist/mod_mailinglist.erl:156
+#: ./modules/mod_mailinglist/mod_mailinglist.erl:157
msgid ""
"Resending bounced addresses..."
msgstr ""
-#: ./modules/mod_mailinglist/templates/_mailinglist_scheduled.tpl:2 ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:23
+#: ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:23 ./modules/mod_mailinglist/templates/_mailinglist_scheduled.tpl:2
msgid ""
"Scheduled"
msgstr ""
@@ -649,7 +649,7 @@ msgid ""
"message."
msgstr ""
-#: ./modules/mod_mailinglist/templates/_admin_mailing_status_overview.tpl:13 ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:20
+#: ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:20 ./modules/mod_mailinglist/templates/_admin_mailing_status_overview.tpl:13
msgid ""
"Title"
msgstr ""
@@ -700,7 +700,7 @@ msgid ""
"When you don’t want to receive any mail then please ignore this message."
msgstr ""
-#: ./modules/mod_mailinglist/templates/email_mailinglist_welcome.tpl:10
+#: ./modules/mod_mailinglist/templates/email_mailinglist_welcome.tpl:9
msgid ""
"When you don’t want to receive any more mail then"
msgstr ""
@@ -716,7 +716,7 @@ msgid ""
"edit permission on the mailing list to change and view the recipients."
msgstr ""
-#: ./modules/mod_mailinglist/templates/email_mailinglist_welcome.tpl:8
+#: ./modules/mod_mailinglist/templates/email_mailinglist_welcome.tpl:7
msgid ""
"You are now subscribed to our mailing list"
msgstr ""
@@ -763,7 +763,7 @@ msgid ""
"bounced"
msgstr ""
-#: ./modules/mod_mailinglist/templates/_dialog_mailinglist_delete_confirm.tpl:9 ./modules/mod_mailinglist/templates/_mailinglist_subscribe_form.tpl:62 ./modules/mod_mailinglist/templates/admin_mailinglist_recipients.tpl:14 ./modules/mod_mailinglist/templates/_admin_mailing_status_overview.tpl:60
+#: ./modules/mod_mailinglist/templates/_mailinglist_subscribe_form.tpl:62 ./modules/mod_mailinglist/templates/admin_mailinglist_recipients.tpl:14 ./modules/mod_mailinglist/templates/_dialog_mailinglist_delete_confirm.tpl:9 ./modules/mod_mailinglist/templates/_admin_mailing_status_overview.tpl:60
msgid ""
"cancel"
msgstr ""
@@ -773,12 +773,12 @@ msgid ""
"clear"
msgstr ""
-#: ./modules/mod_mailinglist/templates/email_mailinglist_welcome.tpl:10
+#: ./modules/mod_mailinglist/templates/email_mailinglist_welcome.tpl:9
msgid ""
"click here to unsubscribe."
msgstr ""
-#: ./modules/mod_mailinglist/templates/_dialog_mailinglist_delete_confirm.tpl:8 ./modules/mod_mailinglist/templates/_dialog_mailing_bounces.tpl:23 ./modules/mod_mailinglist/templates/admin_mailinglist_recipients.tpl:46 ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:43
+#: ./modules/mod_mailinglist/templates/_dialog_mailing_bounces.tpl:23 ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:43 ./modules/mod_mailinglist/templates/admin_mailinglist_recipients.tpl:46 ./modules/mod_mailinglist/templates/_dialog_mailinglist_delete_confirm.tpl:8
msgid ""
"delete"
msgstr ""
@@ -788,7 +788,7 @@ msgid ""
"e-Mail"
msgstr ""
-#: ./modules/mod_mailinglist/templates/_dialog_mailing_bounces.tpl:22 ./modules/mod_mailinglist/templates/_mailinglist_subscribe_form.tpl:56 ./modules/mod_mailinglist/templates/admin_mailing_status.tpl:18 ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:39
+#: ./modules/mod_mailinglist/templates/_dialog_mailing_bounces.tpl:22 ./modules/mod_mailinglist/templates/_mailinglist_subscribe_form.tpl:56 ./modules/mod_mailinglist/templates/admin_mailinglist.tpl:39 ./modules/mod_mailinglist/templates/admin_mailing_status.tpl:18
msgid ""
"edit"
msgstr ""
@@ -883,12 +883,12 @@ msgid ""
"view"
msgstr ""
-#: ./modules/mod_mailinglist/templates/_mailing_footer.tpl:8
+#: ./modules/mod_mailinglist/templates/_mailing_footer.tpl:18
msgid ""
"when you don't want to receive any further mail from this list."
msgstr ""
-#: ./modules/mod_mailinglist/templates/email_mailinglist_welcome.tpl:8
+#: ./modules/mod_mailinglist/templates/email_mailinglist_welcome.tpl:7
msgid ""
"with your e-mail address"
msgstr ""
View
3  modules/mod_survey/dispatch/survey
@@ -1,5 +1,6 @@
[
- {survey_results_download, ["survey", "results", "download", id], resource_survey_results, []},
+ {survey_results_download, ["survey", "results", "download", id], resource_survey_results, []},
+ {survey_results_printable, ["survey", "results", "printable", id], resource_page, [ {template, "survey_results_printable.tpl"}, {acl, {module, mod_survey}} ]},
{survey_results, ["survey", "results", id], resource_page, [ {template, "survey_results.tpl"} ]},
{survey_results, ["survey", "results", id, slug], resource_page, [ {template, "survey_results.tpl"} ]},
View
14 modules/mod_survey/models/m_survey.erl
@@ -48,6 +48,8 @@ m_find_value(results, #m{value=undefined} = M, _Context) ->
M#m{value=results};
m_find_value(all_results, #m{value=undefined} = M, _Context) ->
M#m{value=all_results};
+m_find_value(captions, #m{value=undefined} = M, _Context) ->
+ M#m{value=captions};
m_find_value(did_survey, #m{value=undefined} = M, _Context) ->
M#m{value=did_survey};
m_find_value(is_allowed_results_download, #m{value=undefined} = M, _Context) ->
@@ -64,6 +66,8 @@ m_find_value(Id, #m{value=results}, Context) ->
prepare_results(Id, Context);
m_find_value(Id, #m{value=all_results}, Context) ->
survey_results(Id, Context);
+m_find_value(Id, #m{value=captions}, Context) ->
+ survey_captions(Id, Context);
m_find_value(Id, #m{value=did_survey}, Context) ->
did_survey(Id, Context);
m_find_value(Id, #m{value=is_allowed_results_download}, Context) ->
@@ -326,3 +330,13 @@ delete_result(SurveyId, UserId, PersistentId, Context) ->
false -> {"user_id = $1", [UserId]}
end,
z_db:q("DELETE FROM survey_answer WHERE " ++ Clause ++ " and survey_id = $2", Args ++ [SurveyId], Context).
+
+
+survey_captions(Id, Context) ->
+ {survey, _, Questions} = m_rsc:p(Id, survey, Context),
+ [{<<"created">>, ?__("Created", Context)} |
+ [
+ {list_to_binary(S#survey_question.name),
+ S#survey_question.question}
+ || {_, S} <- Questions]
+ ].
View
3  modules/mod_survey/templates/_admin_edit_content.survey.tpl
@@ -42,8 +42,9 @@
%}
{% endif %}
<a href="{% url survey_results id=id %}">{_ Show survey results _}</a> |
- <a href="#" id="{{ #email_addresses }}">{_ Show email addresses _}</a> |
+ <a href="#" id="{{ #email_addresses }}">{_ Email addresses _}</a> |
{% wire id=#email_addresses postback={admin_show_emails id=id} delegate="mod_survey" %}
+ <a href="{% url survey_results_printable id=id %}" target="_blank">{_ Printable list _}</a> |
<a href="{% url admin_survey_editor id=id %}">{_ Survey results editor _}</a>
</p>
View
4 modules/mod_survey/templates/_admin_survey_editor_results.tpl
@@ -2,12 +2,13 @@
{% with m.survey.all_results[id] as r %}
{% with r|first as columns %}
{% with r|tail as results %}
+{% with m.survey.captions[id] as captions %}
<table width="100%">
<tr>
<th>&nbsp;</th>
{% for name in columns|tail|tail %}
- <th>{{ name|capfirst }}</th>
+ <th>{{ captions[name] }}</th>
{% endfor %}
<th>&nbsp;</th>
</tr>
@@ -30,3 +31,4 @@
{% endwith %}
{% endwith %}
{% endwith %}
+{% endwith %}
View
33 modules/mod_survey/templates/survey_results_printable.tpl
@@ -0,0 +1,33 @@
+{% with q.id|default:id as id %}
+{% with m.survey.all_results[id] as r %}
+{% with r|first as columns %}
+{% with r|tail as results %}
+
+{% with m.survey.captions[id] as captions %}
+
+<h1>{{ m.rsc[id].title }}</h1>
+<p><strong>{_ All survey entries up until _} {{ now|date:"Y-m-d H:i" }}</strong></p>
+
+<table width="100%">
+ <tr>
+ <th>&nbsp;</th>
+ {% for name in columns|tail|tail %}
+ <th align="left">{{ captions[name] }}</th>
+ {% endfor %}
+ </tr>
+
+ {% for r in results %}
+ <tr id="survey-result-{{ r[1] }}-{{ r[2] }}">
+ <td align="right">{{ forloop.counter }}.&nbsp;&nbsp;</td>
+ {% for value in r|tail|tail %}
+ <td>{{ value }}</td>
+ {% endfor %}
+ </tr>
+ {% endfor %}
+</table>
+
+{% endwith %}
+{% endwith %}
+{% endwith %}
+{% endwith %}
+{% endwith %}
View
59 modules/mod_survey/translations/template/mod_survey.pot
@@ -18,6 +18,11 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
+#: ./modules/mod_survey/templates/survey_results_printable.tpl:9
+msgid ""
+"All survey entries up until"
+msgstr ""
+
#: ./modules/mod_survey/templates/_admin_edit_content.survey.tpl:33
msgid ""
"Allow multiple entries per user/browser."
@@ -53,7 +58,22 @@ msgid ""
"Click here to download the results as a CSV file."
msgstr ""
-#: ./modules/mod_survey/templates/_survey_results.tpl:8
+#: ./modules/mod_survey/templates/_dialog_survey_email_addresses.tpl:4
+msgid ""
+"Close"
+msgstr ""
+
+#: ./modules/mod_survey/models/m_survey.erl:337
+msgid ""
+"Created"
+msgstr ""
+
+#: ./modules/mod_survey/templates/_admin_edit_content.survey.tpl:39
+msgid ""
+"Download CSV results"
+msgstr ""
+
+#: ./modules/mod_survey/templates/_survey_results.tpl:8 ./modules/mod_survey/templates/_admin_edit_content.survey.tpl:41
msgid ""
"Download will start in the background. Please check your download window."
msgstr ""
@@ -63,17 +83,27 @@ msgid ""
"Drag questions here."
msgstr ""
+#: ./modules/mod_survey/mod_survey.erl:94
+msgid ""
+"E-mail addresses"
+msgstr ""
+
#: ./modules/mod_survey/templates/_action_dialog_survey_question.tpl:4
msgid ""
"Edit"
msgstr ""
-#: ./modules/mod_survey/templates/_admin_survey_editor_results.tpl:22
+#: ./modules/mod_survey/templates/_admin_survey_editor_results.tpl:23
msgid ""
"Edit survey result"
msgstr ""
-#: ./modules/mod_survey/templates/_survey_question_truefalse.tpl:4
+#: ./modules/mod_survey/templates/_admin_edit_content.survey.tpl:45
+msgid ""
+"Email addresses"
+msgstr ""
+
+#: ./modules/mod_survey/templates/_survey_question_truefalse.tpl:5
msgid ""
"False"
msgstr ""
@@ -98,7 +128,7 @@ msgid ""
"Next"
msgstr ""
-#: ./modules/mod_survey/templates/_survey_question_yesno.tpl:4
+#: ./modules/mod_survey/templates/_survey_question_yesno.tpl:5
msgid ""
"No"
msgstr ""
@@ -109,12 +139,17 @@ msgid ""
"will be shown to the people surveyed."
msgstr ""
+#: ./modules/mod_survey/templates/_admin_edit_content.survey.tpl:47
+msgid ""
+"Printable list"
+msgstr ""
+
#: ./modules/mod_survey/templates/_action_dialog_survey_question.tpl:14 ./modules/mod_survey/templates/_survey_question_page.tpl:2
msgid ""
"Question"
msgstr ""
-#: ./modules/mod_survey/templates/_admin_edit_content.survey.tpl:45
+#: ./modules/mod_survey/templates/_admin_edit_content.survey.tpl:57
msgid ""
"Question Templates"
msgstr ""
@@ -139,7 +174,7 @@ msgid ""
"Show results to user after completion of survey."
msgstr ""
-#: ./modules/mod_survey/templates/_admin_edit_content.survey.tpl:38
+#: ./modules/mod_survey/templates/_admin_edit_content.survey.tpl:44
msgid ""
"Show survey results"
msgstr ""
@@ -179,7 +214,7 @@ msgid ""
"Survey result deleted."
msgstr ""
-#: ./modules/mod_survey/templates/_admin_edit_content.survey.tpl:39
+#: ./modules/mod_survey/templates/_admin_edit_content.survey.tpl:49
msgid ""
"Survey results editor"
msgstr ""
@@ -201,7 +236,7 @@ msgid ""
"this."
msgstr ""
-#: ./modules/mod_survey/templates/_survey_question_truefalse.tpl:3
+#: ./modules/mod_survey/templates/_survey_question_truefalse.tpl:4
msgid ""
"True"
msgstr ""
@@ -211,7 +246,7 @@ msgid ""
"Whether the question needs answering or not."
msgstr ""
-#: ./modules/mod_survey/templates/_survey_question_yesno.tpl:3
+#: ./modules/mod_survey/templates/_survey_question_yesno.tpl:4
msgid ""
"Yes"
msgstr ""
@@ -227,17 +262,17 @@ msgid ""
"on the right."
msgstr ""
-#: ./modules/mod_survey/templates/_admin_edit_content.survey.tpl:52
+#: ./modules/mod_survey/templates/_admin_edit_content.survey.tpl:64
msgid ""
"Your survey"
msgstr ""
-#: ./modules/mod_survey/templates/_admin_survey_editor_results.tpl:23
+#: ./modules/mod_survey/templates/_admin_survey_editor_results.tpl:24
msgid ""
"delete"
msgstr ""
-#: ./modules/mod_survey/templates/_admin_survey_questions_edit.tpl:4 ./modules/mod_survey/templates/admin_survey_editor.tpl:15 ./modules/mod_survey/templates/_admin_survey_editor_results.tpl:22
+#: ./modules/mod_survey/templates/_admin_survey_editor_results.tpl:23 ./modules/mod_survey/templates/admin_survey_editor.tpl:15 ./modules/mod_survey/templates/_admin_survey_questions_edit.tpl:4
msgid ""
"edit"
msgstr ""
Please sign in to comment.
Something went wrong with that request. Please try again.