Skip to content

Commit

Permalink
Improve look of MailingLetter View
Browse files Browse the repository at this point in the history
  • Loading branch information
Taverne Sylvain committed Apr 19, 2011
1 parent a2f76f9 commit 2b08083
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 35 deletions.
18 changes: 3 additions & 15 deletions letter_views.py
Expand Up @@ -65,24 +65,12 @@ class MailingLetterView(STLForm):
title = MSG(u'View')

def get_namespace(self, resource, context):

# nb_users
number = resource.get_property('number')
if number:
nb_users = MSG(u'Sent to {nb} E-Mails')
nb_users = nb_users.gettext(nb=number)
else:
nb_users = MSG(u'There are {nb} E-Mails in Database')
nb_users = nb_users.gettext(
nb=resource.parent.get_subscripters_nb())

txt_data = resource.get_property('email_text')

return {'title': resource.get_title(),
'spool_size': context.server.get_spool_size(),
'nb_users': resource.parent.get_subscripters_nb(),
'is_sent': resource.get_property('is_sent'),
'nb_users': nb_users,
'txt_data': txt_data}
'number': resource.get_property('number'),
'txt_data': resource.get_property('email_text')}


def action(self, resource, context, form):
Expand Down
61 changes: 41 additions & 20 deletions ui/mailing/MailingLetter_view.xml.en
Expand Up @@ -6,30 +6,51 @@

<h2>Newsletter '${title}'</h2>

<stl:inline stl:if="is_sent">
<b>State:</b> Already sent
</stl:inline>
<stl:inline stl:if="not is_sent">
<b>State:</b> Not sent
</stl:inline>
<br/>
<b>Number of Emails: </b> ${nb_users}<br/>
<b>Spool size: </b> ${spool_size}<br/><br/>
<table cellpadding="5" cellspacing="0">
<tr>
<th>State</th>
<td>
<stl:inline stl:if="is_sent">Already sent</stl:inline>
<stl:inline stl:if="not is_sent">Not sent</stl:inline>
</td>
</tr>
<tr>
<th>Spool size</th>
<td>${spool_size}</td>
</tr>
<tr>
<th>Number of Emails</th>
<td>
<stl:inline stl:if="not is_sent">
There are ${nb_users} E-mails in Database
</stl:inline>
<stl:inline stl:if="is_sent">
Sent to ${number} E-mails
</stl:inline>
</td>
</tr>
<tr stl:if="not is_sent">
<th>
Action
</th>
<td>
<form method="POST" stl:if="not is_sent">
<input class="button-ok" type="submit" value="Send the newsletter"/>
</form>
</td>
</tr>
</table>

<form method="POST" stl:if="not is_sent">
<input class="button-ok" type="submit" value="Send the newsletter"/>
<br/>
</form>

<h2>HTML Version</h2>
<iframe src="./;download"
width="630" height="800"
style="border:1px solid black"/>

<h2>Text Version</h2>

<div style="border:1px solid black">
<pre>${txt_data}</pre>
<div style="border:1px solid black; width:620px;padding:5px">
${txt_data}
</div>

<h2>HTML Version</h2>
<iframe src="./;download"
width="630" height="800"
style="border:1px solid black"/>

</stl:block>

0 comments on commit 2b08083

Please sign in to comment.