14 |
form { |
form { |
15 |
if ( $fc->count ) { |
if ( $fc->count ) { |
16 |
h1 { _("Pictures available in system") }; |
h1 { _("Pictures available in system") }; |
17 |
|
} else { |
18 |
|
span { outs _("No pubicly available pictures at this time...") } |
19 |
} |
} |
20 |
table { |
table { |
21 |
while ( my $f = $fc->next ) { |
while ( my $f = $fc->next ) { |
46 |
} |
} |
47 |
} |
} |
48 |
} |
} |
49 |
row { |
warn "current_user->id: ",current_user->id; |
50 |
cell { attr { colspan => 2 } h1 { _('Pending pictures') } } |
if ( current_user->id ) { |
|
}; |
|
|
warn "## present = ",dump( $present ); |
|
|
foreach my $f ( Arh::Model::Picture->all_filenames ) { |
|
|
next if $present->{$f}; |
|
|
my $create = new_action( class => 'CreatePicture' ); |
|
51 |
row { |
row { |
52 |
cell { |
cell { attr { colspan => 2 } h1 { _('Pending pictures') } } |
53 |
attr { class => 'picture' }; |
}; |
54 |
img { attr { src => "static/pics/$f" } } |
warn "## present = ",dump( $present ); |
55 |
div { tt{ $f } } |
foreach my $f ( Arh::Model::Picture->all_filenames ) { |
56 |
} |
next if $present->{$f}; |
57 |
cell { |
my $create = new_action( class => 'CreatePicture' ); |
58 |
attr { class => 'picture-description' }; |
row { |
59 |
render_param( $create => 'campaign' ); |
cell { |
60 |
render_param( $create => 'type' ); |
attr { class => 'picture' }; |
61 |
$create->button( |
img { attr { src => "static/pics/$f" } } |
62 |
submit => $create, |
div { tt{ $f } } |
63 |
label => _('Add'), |
} |
64 |
arguments => { |
cell { |
65 |
filename => $f, |
attr { class => 'picture-description' }; |
66 |
} |
render_param( $create => 'campaign' ); |
67 |
); |
render_param( $create => 'type' ); |
68 |
|
$create->button( |
69 |
|
submit => $create, |
70 |
|
label => _('Add'), |
71 |
|
arguments => { |
72 |
|
filename => $f, |
73 |
|
} |
74 |
|
); |
75 |
|
} |
76 |
} |
} |
77 |
} |
} |
78 |
} |
} |
81 |
|
|
82 |
}; |
}; |
83 |
|
|
84 |
|
use Jifty::View::Declare::CRUD; |
85 |
|
Jifty::View::Declare::CRUD->mount_view('materials'); |
86 |
|
|
87 |
|
use Jifty::View::Declare::CRUD; |
88 |
|
Jifty::View::Declare::CRUD->mount_view('units'); |
89 |
|
|
90 |
template '/units' => page { |
template '/units' => page { |
91 |
h1 { _("Units available in system") }; |
h1 { _("Units available in system") }; |
92 |
|
|
93 |
my $units = Arh::Model::UnitCollection->new; |
my $search = Arh::Model::UnitCollection->new; |
94 |
$units->unlimit; |
$search->unlimit; |
95 |
|
|
96 |
while ( my $u = $units->next ) { |
set( search_collection => $search ); |
97 |
unit( $u ); |
render_region( |
98 |
} |
name => 'units', |
99 |
}; |
path => '/units/list', |
100 |
|
defaults => { |
101 |
sub unit { |
page => 1, |
|
my $unit = shift || die "no unit?"; |
|
|
my $a = new_action( class => 'UpdateUnit', record => $unit ); |
|
|
warn "## current_user = ",dump( current_user ); |
|
|
form { |
|
|
foreach my $f ( qw/name number campaign material dimensions position description chronology location/ ) { |
|
|
if ( $f eq 'material' ) { |
|
|
my $material = $unit->material; |
|
|
while ( my $um = $material->next ) { |
|
|
my $m = new_action( class => 'UpdateMaterial', record => $um->material ); |
|
|
render_param( $m => 'name', label => _("Material"), render_mode => 'read' ); |
|
|
} |
|
|
} else { |
|
|
my %opt; |
|
|
$opt{render_mode} = 'read'; # unless |
|
|
warn "write $f ",$unit->current_user_can('write',$f) ? 'ok' : 'DENIED'; |
|
|
render_param( $a => $f, %opt ); |
|
|
} |
|
102 |
} |
} |
103 |
} |
); |
104 |
} |
|
105 |
|
}; |
106 |
|
|
107 |
1; |
1; |