/[Arh]/lib/Arh/View.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/Arh/View.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8 by dpavlin, Thu Nov 29 16:08:13 2007 UTC revision 12 by dpavlin, Thu Nov 29 19:32:41 2007 UTC
# Line 8  use Jifty::View::Declare -base; Line 8  use Jifty::View::Declare -base;
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
9    
10  template '/pictures' => page {  template '/pictures' => page {
         h1 { _("Pictures available in system") };  
11          my $fc = Arh::Model::PictureCollection->new;          my $fc = Arh::Model::PictureCollection->new;
12          $fc->unlimit;          $fc->unlimit;
13          my $present;          my $present;
14          form {          form {
15                    if ( $fc->count ) {
16                            h1 { _("Pictures available in system") };
17                    }
18                  table {                  table {
19                          while ( my $f = $fc->next ) {                          while ( my $f = $fc->next ) {
20                                  $present->{ $f->filename }++;                                  $present->{ $f->filename }++;
# Line 20  template '/pictures' => page { Line 22  template '/pictures' => page {
22                                  my $update = new_action( class => 'UpdatePicture', record => $f );                                  my $update = new_action( class => 'UpdatePicture', record => $f );
23                                  row {                                  row {
24                                          cell {                                          cell {
25                                                    attr { class => 'picture' };
26                                                  img { attr { src => "static/pics/" . $f->filename } }                                                  img { attr { src => "static/pics/" . $f->filename } }
27                                                  div { tt{ $f->filename } }                                                  div { tt{ $f->filename } }
28                                          }                                          }
29                                          cell {                                          cell {
30                                                    attr { class => 'picture-description' };
31                                                  render_param( $update => 'campaign', render_mode => 'read' );                                                  render_param( $update => 'campaign', render_mode => 'read' );
32                                                  render_param( $update => 'type', render_mode => 'read' );                                                  render_param( $update => 'type', render_mode => 'read' );
33                                                  div {                                                  if ( $f->current_user_can('write') ) {
34                                                          $delete->button(                                                          div {
35                                                                  submit => $delete,                                                                  $delete->button(
36                                                                  label => _('Delete'),                                                                          submit => $delete,
37                                                                  arguments => {                                                                          label => _('Delete'),
38                                                                          id => $f->id,                                                                          arguments => {
39                                                                  }                                                                                  id => $f->id,
40                                                          )                                                                          }
41                                                                    )
42                                                            }
43                                                  }                                                  }
44                                          }                                          }
45                                  }                                  }
46                          }                          }
47                          row {                          row {
48                                  cell { attr { colspan => 4 } outs _('Pending pictures') }                                  cell { attr { colspan => 2 } h1 { _('Pending pictures') } }
49                          };                          };
50                          warn "## present = ",dump( $present );                          warn "## present = ",dump( $present );
51                          foreach my $f ( Arh::Model::Picture->all_filenames ) {                          foreach my $f ( Arh::Model::Picture->all_filenames ) {
# Line 47  template '/pictures' => page { Line 53  template '/pictures' => page {
53                                  my $create = new_action( class => 'CreatePicture' );                                  my $create = new_action( class => 'CreatePicture' );
54                                  row {                                  row {
55                                          cell {                                          cell {
56                                                    attr { class => 'picture' };
57                                                  img { attr { src => "static/pics/$f" } }                                                  img { attr { src => "static/pics/$f" } }
58                                                  div { tt{ $f } }                                                  div { tt{ $f } }
59                                          }                                          }
60                                          cell {                                          cell {
61                                                    attr { class => 'picture-description' };
62                                                  render_param( $create => 'campaign' );                                                  render_param( $create => 'campaign' );
63                                                  render_param( $create => 'type' );                                                  render_param( $create => 'type' );
64                                                  $create->button(                                                  $create->button(
# Line 82  template '/units' => page { Line 90  template '/units' => page {
90  sub unit {  sub unit {
91          my $unit = shift || die "no unit?";          my $unit = shift || die "no unit?";
92          my $a = new_action( class => 'UpdateUnit', record => $unit );          my $a = new_action( class => 'UpdateUnit', record => $unit );
93            warn "## current_user = ",dump( current_user );
94          form {          form {
95                  foreach my $f ( qw/name number material dimensions position description chronology/ ) {                  foreach my $f ( qw/name number campaign material dimensions position description chronology location/ ) {
96                          if ( $f eq 'material' ) {                          if ( $f eq 'material' ) {
97                                  my $material = $unit->material;                                  my $material = $unit->material;
98                                  while ( my $um = $material->next ) {                                  while ( my $um = $material->next ) {
# Line 91  sub unit { Line 100  sub unit {
100                                          render_param( $m => 'name', label => _("Material"), render_mode => 'read' );                                          render_param( $m => 'name', label => _("Material"), render_mode => 'read' );
101                                  }                                  }
102                          } else {                          } else {
103                                  render_param( $a => $f, render_mode => 'read' );                                  my %opt;
104                                    $opt{render_mode} = 'read'; # unless
105                                    warn "write $f ",$unit->current_user_can('write',$f) ? 'ok' : 'DENIED';
106                                    render_param( $a => $f, %opt );
107                          }                          }
108                  }                  }
109          }          }

Legend:
Removed from v.8  
changed lines
  Added in v.12

  ViewVC Help
Powered by ViewVC 1.1.26