summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--GroLUG/lib/GroLUG.pm8
-rw-r--r--GroLUG/lib/GroLUG/C/Iscritto.pm24
-rw-r--r--GroLUG/lib/GroLUG/M/DB.pm2
-rw-r--r--GroLUG/lib/GroLUG/M/DB/Iscritto.pm2
-rw-r--r--GroLUG/root/src/lista-iscritti.tt24
-rw-r--r--GroLUG/root/src/message.tt216
-rw-r--r--GroLUG/root/src/scheda-iscritto.tt26
-rw-r--r--GroLUG/root/src/welcome.tt29
8 files changed, 23 insertions, 48 deletions
diff --git a/GroLUG/lib/GroLUG.pm b/GroLUG/lib/GroLUG.pm
index f7c7751..bfc7986 100644
--- a/GroLUG/lib/GroLUG.pm
+++ b/GroLUG/lib/GroLUG.pm
@@ -7,7 +7,7 @@ use Catalyst qw{
Session Session::Store::DBI Session::State::Cookie
Authentication Authentication::Store::Htpasswd Authentication::Credential::Password
Authorization::Roles
- HTML::Widget
+ HTML::Widget Unicode
};
use Catalyst::Log::Log4perl;
@@ -28,4 +28,10 @@ sub index : Private {
}
}
+sub strdate {
+ my ($self,$date)=@_;
+
+ return (ref $date) ? $date->strftime('%F') : '';
+}
+
1;
diff --git a/GroLUG/lib/GroLUG/C/Iscritto.pm b/GroLUG/lib/GroLUG/C/Iscritto.pm
index 20cb5c2..b2a9609 100644
--- a/GroLUG/lib/GroLUG/C/Iscritto.pm
+++ b/GroLUG/lib/GroLUG/C/Iscritto.pm
@@ -52,9 +52,9 @@ sub widget_for_iscr {
$widget->filter('TrimEdges','nome','email','note');
- $widget->constraint('All','nome','email');
- $widget->constraint('Email','email');
- $widget->constraint('Printable','nome');
+ $widget->constraint('All','nome','email')->message('Campo obbligatorio');
+ $widget->constraint('Email','email')->message('Indirizzo malformato');
+ $widget->constraint('Printable','nome')->message('Caratteri non validi nel nome');
$widget->indicator('email');
@@ -121,12 +121,6 @@ sub attiva :Local {
$c->res->redirect($c->uri_for('scheda',$id));
}
-sub strdate {
- my ($date)=@_;
-
- return (defined $date ? $date->strftime('%F') : '');
-}
-
sub widget_for_pag {
my ($self,$c,$pag,$iscr_id)=@_;
@@ -138,9 +132,9 @@ sub widget_for_pag {
my $widget=$c->widget('pagamento');
$widget->method('post');
- $widget->element('Textfield','data_pagamento')->label('Data del pagamento')->value(strdate($pagamento->data_pagamento));
- $widget->element('Textfield','data_iscrizione')->label('Data di iscrizione')->value(strdate($pagamento->data_iscrizione));
- $widget->element('Textfield','data_scadenza')->label('Data di scadenza')->value(strdate($pagamento->data_scadenza));
+ $widget->element('Textfield','data_pagamento')->label('Data del pagamento')->value($self->strdate($pagamento->data_pagamento));
+ $widget->element('Textfield','data_iscrizione')->label('Data di iscrizione')->value($self->strdate($pagamento->data_iscrizione));
+ $widget->element('Textfield','data_scadenza')->label('Data di scadenza')->value($self->strdate($pagamento->data_scadenza));
$widget->element('Textfield','prezzo')->label('Importo pagato')->value($pagamento->prezzo);
$widget->element('Hidden','iscr_id')->value($iscr_id || (defined $pag ? $pagamento->iscritto->id : ''));
@@ -148,9 +142,9 @@ sub widget_for_pag {
$widget->filter('TrimEdges','data_scadenza','data_pagamento','data_iscrizione','prezzo');
- $widget->constraint('All','data_scadenza','data_pagamento','data_iscrizione','prezzo');
- $widget->constraint('ISODate','data_scadenza','data_pagamento','data_iscrizione');
- $widget->constraint('EuroAmount','prezzo');
+ $widget->constraint('All','data_scadenza','data_pagamento','data_iscrizione','prezzo')->messagge('Campo obbligatorio');
+ $widget->constraint('ISODate','data_scadenza','data_pagamento','data_iscrizione')->message('Data non valida');
+ $widget->constraint('EuroAmount','prezzo')->message('Prezzo non valido');
$widget->indicator('iscr_id');
diff --git a/GroLUG/lib/GroLUG/M/DB.pm b/GroLUG/lib/GroLUG/M/DB.pm
index 2622de2..42d6d15 100644
--- a/GroLUG/lib/GroLUG/M/DB.pm
+++ b/GroLUG/lib/GroLUG/M/DB.pm
@@ -7,7 +7,7 @@ my @conn_info = (
'dbi:Pg:dbname=iscritti',
'grolug',
'',
- { RaiseError => 1, PrintError => 0, ShowErrorStatement => 1, TraceLevel => 0 }
+ { RaiseError => 1, PrintError => 0, ShowErrorStatement => 1, TraceLevel => 0, pg_enable_utf8 => 1 }
);
__PACKAGE__->load_classes();
diff --git a/GroLUG/lib/GroLUG/M/DB/Iscritto.pm b/GroLUG/lib/GroLUG/M/DB/Iscritto.pm
index 1cea0ac..b4a091d 100644
--- a/GroLUG/lib/GroLUG/M/DB/Iscritto.pm
+++ b/GroLUG/lib/GroLUG/M/DB/Iscritto.pm
@@ -11,7 +11,7 @@ sub scadenza {
my ($self)=@_;
my $last_pag=$self->pagamenti()->next();
- return ($last_pag ? $last_pag->data_scadenza() : undef);
+ return $last_pag ? $last_pag->data_scadenza() : undef;
}
1;
diff --git a/GroLUG/root/src/lista-iscritti.tt2 b/GroLUG/root/src/lista-iscritti.tt2
index 9618520..27b93de 100644
--- a/GroLUG/root/src/lista-iscritti.tt2
+++ b/GroLUG/root/src/lista-iscritti.tt2
@@ -3,8 +3,8 @@
<ol>
[% WHILE (iscr = iscritti.next()) %]
<li>
- <span class="nome iscritto"><a href="[% Catalyst.uri_for('scheda',iscr.id) %]">[% iscr.nome %]</a></span>
- <span class="scade iscritto">scade: [% iscr.scadenza %]</span>
+ <span class="nome iscritto"><a href="[% Catalyst.uri_for('scheda',iscr.id) %]">[% iscr.nome | html %]</a></span>
+ <span class="scade iscritto">scade: [% Catalyst.strdate(iscr.scadenza) %]</span>
<span class="rinnova iscritto"><a href="[% Catalyst.uri_for('rinnova',iscr.id) %]">rinnova</a></span>
</li>
[% END %]
diff --git a/GroLUG/root/src/message.tt2 b/GroLUG/root/src/message.tt2
deleted file mode 100644
index e72a468..0000000
--- a/GroLUG/root/src/message.tt2
+++ /dev/null
@@ -1,16 +0,0 @@
-[% META title = 'Catalyst/TT View!' %]
-<p>
- Yay! You're looking at a page generated by the Catalyst::View::TT
- plugin module.
-</p>
-<p>
- We have a message for you: <span class="message">[% message %]</span>.
-</p>
-<p>
- Why not try updating the message? Go on, it's really exciting, honest!
-</p>
-<form action="[% site.url.message %]"
- method="POST" enctype="application/x-www-form-urlencoded">
- <input type="text" name="message" value="[% message %]" />
- <input type="submit" name="submit" value=" Update Message "/>
-</form>
diff --git a/GroLUG/root/src/scheda-iscritto.tt2 b/GroLUG/root/src/scheda-iscritto.tt2
index 835b22a..9dab32e 100644
--- a/GroLUG/root/src/scheda-iscritto.tt2
+++ b/GroLUG/root/src/scheda-iscritto.tt2
@@ -1,4 +1,4 @@
-<h1>Scheda di [% iscritto.nome %]</h1>
+<h1>Scheda di [% iscritto.nome | html %]</h1>
<p>Operazioni:</p>
<ul>
<li><a href="[% Catalyst.uri_for('edit',iscritto.id) %]">Edit</a></li>
@@ -11,10 +11,10 @@
</ul>
<dl>
<dt>Indirizzo:</dt><dd>[% iscritto.email %]</dd>
-<dt>Note:</dt><dd>[% iscritto.note %]</dd>
+<dt>Note:</dt><dd>[% iscritto.note | html %]</dd>
<dt>Pagamenti:</dt><dd><ol>
[%- FOREACH pag IN iscritto.pagamenti %]
-<li>[% pag.prezzo %] il [% pag.data_pagamento %] <a href="[% Catalyst.uri_for('pagamento',pag.id) %]">edit</a> <a href="[% Catalyst.uri_for('cancella_pag',pag.id) %]">elimina</a></li>
+<li>[% pag.prezzo %] il [% Catalyst.strdate(pag.data_pagamento) %] <a href="[% Catalyst.uri_for('pagamento',pag.id) %]">edit</a> <a href="[% Catalyst.uri_for('cancella_pag',pag.id) %]">elimina</a></li>
[% END -%]
</ol></dd>
</dl>
diff --git a/GroLUG/root/src/welcome.tt2 b/GroLUG/root/src/welcome.tt2
deleted file mode 100644
index 26f3d89..0000000
--- a/GroLUG/root/src/welcome.tt2
+++ /dev/null
@@ -1,9 +0,0 @@
-[% META title = 'Catalyst/TT View!' %]
-<p>
- Yay! You're looking at a page generated by the Catalyst::View::TT
- plugin module.
-</p>
-<p>
- This is the welcome page. Why not try the equally-exciting
- <a href="[% site.url.message %]">Message Page</a>?
-</p>