/[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 6 by dpavlin, Thu Nov 29 12:36:51 2007 UTC revision 9 by dpavlin, Thu Nov 29 16:40:10 2007 UTC
# Line 14  template '/pictures' => page { Line 14  template '/pictures' => page {
14          my $present;          my $present;
15          form {          form {
16                  table {                  table {
                         row {  
                                 cell { _('Part of campaign') }  
                                 cell { _('Picture filename') }  
                                 cell { _('Type of picture') }  
                                 cell {}  
                         };  
17                          while ( my $f = $fc->next ) {                          while ( my $f = $fc->next ) {
18                                  $present->{ $f->filename }++;                                  $present->{ $f->filename }++;
19                                  my $delete = new_action( class => 'DeletePicture' );                                  my $delete = new_action( class => 'DeletePicture' );
20                                    my $update = new_action( class => 'UpdatePicture', record => $f );
21                                  row {                                  row {
                                         cell { $f->campaign->name }  
22                                          cell {                                          cell {
23                                                  img { attr { src => "static/pics/" . $f->filename } }                                                  img { attr { src => "static/pics/" . $f->filename } }
24                                                  div { tt{ $f->filename } }                                                  div { tt{ $f->filename } }
25                                          }                                          }
                                         cell { $f->type->name }  
26                                          cell {                                          cell {
27                                                  $delete->button(                                                  render_param( $update => 'campaign', render_mode => 'read' );
28                                                          submit => $delete,                                                  render_param( $update => 'type', render_mode => 'read' );
29                                                          label => _('Delete'),                                                  div {
30                                                          arguments => {                                                          $delete->button(
31                                                                  id => $f->id,                                                                  submit => $delete,
32                                                          }                                                                  label => _('Delete'),
33                                                  )                                                                  arguments => {
34                                                                            id => $f->id,
35                                                                    }
36                                                            )
37                                                    }
38                                          }                                          }
39                                  }                                  }
40                          }                          }
# Line 49  template '/pictures' => page { Line 46  template '/pictures' => page {
46                                  next if $present->{$f};                                  next if $present->{$f};
47                                  my $create = new_action( class => 'CreatePicture' );                                  my $create = new_action( class => 'CreatePicture' );
48                                  row {                                  row {
                                         cell { render_param( $create => 'campaign' ) }  
49                                          cell {                                          cell {
50                                                  img { attr { src => "static/pics/$f" } }                                                  img { attr { src => "static/pics/$f" } }
51                                                  div { tt{ $f } }                                                  div { tt{ $f } }
52                                          }                                          }
                                         cell { render_param( $create => 'type' ) }  
53                                          cell {                                          cell {
54                                                    render_param( $create => 'campaign' );
55                                                    render_param( $create => 'type' );
56                                                  $create->button(                                                  $create->button(
57                                                          submit => $create,                                                          submit => $create,
58                                                          label => _('Add'),                                                          label => _('Add'),
59                                                          arguments => {                                                          arguments => {
60                                                                  filename => $f,                                                                  filename => $f,
61                                                          }                                                          }
62                                                  )                                                  );
63                                          }                                          }
64                                  }                                  }
65                          }                          }
# Line 71  template '/pictures' => page { Line 68  template '/pictures' => page {
68    
69  };  };
70    
71    template '/units' => page {
72            h1 { _("Units available in system") };
73    
74            my $units = Arh::Model::UnitCollection->new;
75            $units->unlimit;
76    
77            while ( my $u = $units->next ) {
78                    unit( $u );
79            }
80    };
81    
82    sub unit {
83            my $unit = shift || die "no unit?";
84            my $a = new_action( class => 'UpdateUnit', record => $unit );
85            form {
86                    foreach my $f ( qw/name number campaign material dimensions position description chronology location/ ) {
87                            if ( $f eq 'material' ) {
88                                    my $material = $unit->material;
89                                    while ( my $um = $material->next ) {
90                                            my $m = new_action( class => 'UpdateMaterial', record => $um->material );
91                                            render_param( $m => 'name', label => _("Material"), render_mode => 'read' );
92                                    }
93                            } else {
94                                    render_param( $a => $f, render_mode => 'read' );
95                            }
96                    }
97            }
98    }
99    
100  1;  1;

Legend:
Removed from v.6  
changed lines
  Added in v.9

  ViewVC Help
Powered by ViewVC 1.1.26