| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Gantry::Control::C::Pages; |
|
2
|
1
|
|
|
1
|
|
79544
|
use strict; |
|
|
1
|
|
|
|
|
29
|
|
|
|
1
|
|
|
|
|
40
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
624
|
use Gantry qw/-TemplateEngine=TT/; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Data::FormValidator; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
40
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
523
|
use Gantry::Control; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
85
|
|
|
9
|
1
|
|
|
1
|
|
7
|
use Gantry::Utils::Validate; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
23
|
|
|
10
|
1
|
|
|
1
|
|
629
|
use Gantry::Utils::HTML qw( :all ); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
374
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
532
|
use Gantry::Utils::CRUDHelp qw( form_profile ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
56
|
|
|
13
|
1
|
|
|
1
|
|
593
|
use Gantry::Plugins::CRUD; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
92
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
578
|
use Gantry::Control::Model::auth_pages; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
39
|
|
|
16
|
1
|
|
|
1
|
|
513
|
use Gantry::Control::Model::auth_groups; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
38
|
|
|
17
|
1
|
|
|
1
|
|
454
|
use Gantry::Control::Model::auth_group_members; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
37
|
|
|
18
|
1
|
|
|
1
|
|
501
|
use Gantry::Control::Model::auth_users; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1612
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
############################################################ |
|
21
|
|
|
|
|
|
|
# Variables # |
|
22
|
|
|
|
|
|
|
############################################################ |
|
23
|
|
|
|
|
|
|
our @ISA = ( 'Gantry' ); # Inherit the handler. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our $AUTH_PAGES = 'Gantry::Control::Model::auth_pages'; |
|
26
|
|
|
|
|
|
|
our $AUTH_GROUPS = 'Gantry::Control::Model::auth_groups'; |
|
27
|
|
|
|
|
|
|
our $AUTH_GROUP_MEMBERS = 'Gantry::Control::Model::auth_group_members'; |
|
28
|
|
|
|
|
|
|
our $AUTH_USERS = 'Gantry::Control::Model::auth_users'; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $crud = Gantry::Plugins::CRUD->new( |
|
31
|
|
|
|
|
|
|
add_action => \&add_page, |
|
32
|
|
|
|
|
|
|
edit_action => \&edit_page, |
|
33
|
|
|
|
|
|
|
delete_action => \&delete_page, |
|
34
|
|
|
|
|
|
|
form => \&page_form, |
|
35
|
|
|
|
|
|
|
redirect => \&redirect_to_main, |
|
36
|
|
|
|
|
|
|
template => 'form.tt', |
|
37
|
|
|
|
|
|
|
text_descr => 'pages', |
|
38
|
|
|
|
|
|
|
use_clean_dates => 1, |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
############################################################ |
|
44
|
|
|
|
|
|
|
# Functions # |
|
45
|
|
|
|
|
|
|
############################################################ |
|
46
|
|
|
|
|
|
|
#------------------------------------------------- |
|
47
|
|
|
|
|
|
|
# $self->do_main( $order ) |
|
48
|
|
|
|
|
|
|
#------------------------------------------------- |
|
49
|
|
|
|
|
|
|
sub do_main { |
|
50
|
0
|
|
|
0
|
1
|
|
my ( $self, $order ) = @_; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# stash template, title |
|
53
|
0
|
|
|
|
|
|
$self->stash->view->template( 'results.tt' ); |
|
54
|
0
|
|
|
|
|
|
$self->stash->view->title( 'Page Permissions' ); |
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
|
0
|
|
|
|
$order ||= 'uri'; # set default order |
|
57
|
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my $retval = { |
|
59
|
|
|
|
|
|
|
headings => [ |
|
60
|
|
|
|
|
|
|
'URI', 'Title', 'Permissions', 'Owner', 'Group' |
|
61
|
|
|
|
|
|
|
], |
|
62
|
|
|
|
|
|
|
header_options => [ { |
|
63
|
|
|
|
|
|
|
text => 'Add', link => ( $self->location . "/add" ), |
|
64
|
|
|
|
|
|
|
} ], |
|
65
|
|
|
|
|
|
|
}; |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
my @rows = $AUTH_PAGES->retrieve_all( |
|
68
|
|
|
|
|
|
|
{ 'order_by' => $order } |
|
69
|
|
|
|
|
|
|
); |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
foreach my $row ( @rows ) { |
|
72
|
0
|
|
|
|
|
|
my $id = $row->id; |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
push( |
|
75
|
0
|
|
|
|
|
|
@{$$retval{rows}}, |
|
76
|
|
|
|
|
|
|
{ |
|
77
|
|
|
|
|
|
|
data => [ |
|
78
|
|
|
|
|
|
|
ht_a( $row->uri, $row->uri ), |
|
79
|
|
|
|
|
|
|
$row->title, |
|
80
|
|
|
|
|
|
|
( $row->user_perm . $row->group_perm . $row->world_perm ), |
|
81
|
|
|
|
|
|
|
( $row->owner_id->last_name . ', ' |
|
82
|
|
|
|
|
|
|
. $row->owner_id->first_name ), |
|
83
|
|
|
|
|
|
|
$row->group_id->name, |
|
84
|
|
|
|
|
|
|
], |
|
85
|
|
|
|
|
|
|
options => [ |
|
86
|
|
|
|
|
|
|
{ |
|
87
|
|
|
|
|
|
|
text => 'Edit', |
|
88
|
|
|
|
|
|
|
link => ( $self->location . "/edit/$id" ), |
|
89
|
|
|
|
|
|
|
}, |
|
90
|
|
|
|
|
|
|
{ |
|
91
|
|
|
|
|
|
|
text => 'Delete', |
|
92
|
|
|
|
|
|
|
link => ( $self->location . "/delete/$id" ) |
|
93
|
|
|
|
|
|
|
}, |
|
94
|
|
|
|
|
|
|
] |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
); |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# stash view data |
|
100
|
0
|
|
|
|
|
|
$self->stash->view->data( $retval ); |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
} # end do_main |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub redirect_to_main { |
|
105
|
0
|
|
|
0
|
1
|
|
my ( $self, $data ) = @_; |
|
106
|
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
return $self->location; |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
#------------------------------------------------- |
|
112
|
|
|
|
|
|
|
# $self->do_add( $r ) |
|
113
|
|
|
|
|
|
|
#------------------------------------------------- |
|
114
|
|
|
|
|
|
|
sub do_add { |
|
115
|
0
|
|
|
0
|
1
|
|
my ( $self ) = ( shift ); |
|
116
|
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
$crud->add( $self ); |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
} # end do_add |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub add_page { |
|
122
|
0
|
|
|
0
|
1
|
|
my( $self, $params, $data ) = @_; |
|
123
|
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
my %param = %{ $params }; |
|
|
0
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
# Clean up the variables some. |
|
127
|
0
|
|
|
|
|
|
for my $bit ( qw( ur uw ux gr gw gx wr ww wx ) ) { |
|
128
|
0
|
0
|
|
|
|
|
$param{$bit} = ( $param{$bit} ) ? 1 : 0; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
# set user_perm, group_perm, world_perm |
|
132
|
|
|
|
|
|
|
$param{user_perm} = |
|
133
|
0
|
|
|
|
|
|
( $param{ur} * 4 ) |
|
134
|
|
|
|
|
|
|
+ ( $param{uw} * 2 ) |
|
135
|
|
|
|
|
|
|
+ ( $param{ux} * 1 ); |
|
136
|
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
$param{group_perm} = |
|
138
|
|
|
|
|
|
|
( $param{gr} * 4 ) |
|
139
|
|
|
|
|
|
|
+ ( $param{gw} * 2 ) |
|
140
|
|
|
|
|
|
|
+ ( $param{gx} * 1 ); |
|
141
|
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
$param{world_perm} = |
|
143
|
|
|
|
|
|
|
( $param{wr} * 4 ) |
|
144
|
|
|
|
|
|
|
+ ( $param{ww} * 2 ) |
|
145
|
|
|
|
|
|
|
+ ( $param{wx} * 1 ); |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
# remove bits from param hash |
|
148
|
0
|
|
|
|
|
|
for my $bit ( qw( ur uw ux gr gw gx wr ww wx ) ) { |
|
149
|
0
|
|
|
|
|
|
delete( $param{$bit} ); |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
my $new_row = $AUTH_PAGES->create( \%param ); |
|
153
|
0
|
|
|
|
|
|
$new_row->dbi_commit; |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
} # end do_add |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
#------------------------------------------------- |
|
158
|
|
|
|
|
|
|
# $self->do_delete( $id, $yes ) |
|
159
|
|
|
|
|
|
|
#------------------------------------------------- |
|
160
|
|
|
|
|
|
|
sub do_delete { |
|
161
|
0
|
|
|
0
|
1
|
|
my ( $self, $id, $yes ) = @_; |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
# Load row values |
|
164
|
0
|
|
|
|
|
|
my $page = $AUTH_PAGES->retrieve( $id ); |
|
165
|
0
|
|
|
|
|
|
$crud->delete( $self, $yes, { page => $page } ); |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
} # end do_delete |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
#------------------------------------------------- |
|
170
|
|
|
|
|
|
|
# $self->delete_page( $data ) |
|
171
|
|
|
|
|
|
|
#------------------------------------------------- |
|
172
|
|
|
|
|
|
|
sub delete_page { |
|
173
|
0
|
|
|
0
|
1
|
|
my( $self, $data ) = @_; |
|
174
|
|
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
|
my $page = $data->{page}; |
|
176
|
|
|
|
|
|
|
|
|
177
|
0
|
|
|
|
|
|
$page->delete; |
|
178
|
0
|
|
|
|
|
|
$AUTH_PAGES->dbi_commit(); |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
} # end delete_page |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
#------------------------------------------------- |
|
183
|
|
|
|
|
|
|
# $self->do_edit( $id ) |
|
184
|
|
|
|
|
|
|
#------------------------------------------------- |
|
185
|
|
|
|
|
|
|
sub do_edit { |
|
186
|
0
|
|
|
0
|
1
|
|
my ( $self, $id ) = @_; |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
# Load row values |
|
189
|
0
|
|
|
|
|
|
my $page = $AUTH_PAGES->retrieve( $id ); |
|
190
|
|
|
|
|
|
|
|
|
191
|
0
|
|
|
|
|
|
$crud->edit( $self, { page => $page } ); |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
} # end do_edit |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
#------------------------------------------------- |
|
196
|
|
|
|
|
|
|
# $self->edit_page( $param, $data ) |
|
197
|
|
|
|
|
|
|
#------------------------------------------------- |
|
198
|
|
|
|
|
|
|
sub edit_page { |
|
199
|
0
|
|
|
0
|
1
|
|
my( $self, $params, $data ) = @_; |
|
200
|
|
|
|
|
|
|
|
|
201
|
0
|
|
|
|
|
|
my %param = %{ $params }; |
|
|
0
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
|
|
203
|
0
|
|
|
|
|
|
my $page = $data->{page}; |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
# Clean up the variables some. |
|
206
|
0
|
|
|
|
|
|
for my $bit ( qw/ur uw ux gr gw gx wr ww wx/ ) { |
|
207
|
0
|
0
|
|
|
|
|
$param{$bit} = ( defined $param{$bit} ) ? 1 : 0; |
|
208
|
|
|
|
|
|
|
} |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
$param{user_perm} = |
|
211
|
0
|
|
|
|
|
|
( $param{ur} * 4 ) |
|
212
|
|
|
|
|
|
|
+ ( $param{uw} * 2 ) |
|
213
|
|
|
|
|
|
|
+ ( $param{ux} * 1 ); |
|
214
|
|
|
|
|
|
|
|
|
215
|
0
|
|
|
|
|
|
$param{group_perm} = |
|
216
|
|
|
|
|
|
|
( $param{gr} * 4 ) |
|
217
|
|
|
|
|
|
|
+ ( $param{gw} * 2 ) |
|
218
|
|
|
|
|
|
|
+ ( $param{gx} * 1 ); |
|
219
|
|
|
|
|
|
|
|
|
220
|
0
|
|
|
|
|
|
$param{world_perm} = |
|
221
|
|
|
|
|
|
|
( $param{wr} * 4 ) |
|
222
|
|
|
|
|
|
|
+ ( $param{ww} * 2 ) |
|
223
|
|
|
|
|
|
|
+ ( $param{wx} * 1 ); |
|
224
|
|
|
|
|
|
|
|
|
225
|
0
|
|
|
|
|
|
for my $bit ( qw/ur uw ux gr gw gx wr ww wx/ ) { |
|
226
|
0
|
|
|
|
|
|
delete( $param{$bit} ); |
|
227
|
|
|
|
|
|
|
} |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
# Make update |
|
230
|
0
|
|
|
|
|
|
$page->set( %param ); |
|
231
|
0
|
|
|
|
|
|
$page->update; |
|
232
|
0
|
|
|
|
|
|
$page->dbi_commit; |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
} # end do_edit |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
#------------------------------------------------- |
|
238
|
|
|
|
|
|
|
# _form( $row ? ) |
|
239
|
|
|
|
|
|
|
#------------------------------------------------- |
|
240
|
|
|
|
|
|
|
sub page_form { |
|
241
|
0
|
|
|
0
|
1
|
|
my ( $self, $data ) = @_; |
|
242
|
|
|
|
|
|
|
|
|
243
|
0
|
|
|
|
|
|
my $row = $data->{page}; |
|
244
|
|
|
|
|
|
|
|
|
245
|
0
|
|
|
|
|
|
my %param = $self->get_param_hash; |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
# user permissions |
|
248
|
0
|
0
|
0
|
|
|
|
if ( ( ! defined $param{ur} ) |
|
|
|
|
0
|
|
|
|
|
|
249
|
|
|
|
|
|
|
|| ( ! defined $param{uw} ) |
|
250
|
|
|
|
|
|
|
|| ( ! defined defined $param{ux} ) ) { |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
( $param{ur}, |
|
253
|
|
|
|
|
|
|
$param{uw}, |
|
254
|
0
|
|
|
|
|
|
$param{ux} ) = dec2bin( eval{ $row->user_perm } ); |
|
|
0
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
} |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
# group permissions |
|
258
|
0
|
0
|
0
|
|
|
|
if ( ( ! defined $param{gr} ) |
|
|
|
|
0
|
|
|
|
|
|
259
|
|
|
|
|
|
|
|| ( ! defined $param{gw} ) |
|
260
|
|
|
|
|
|
|
|| ( ! defined defined $param{gx} ) ) { |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
( $param{gr}, |
|
263
|
|
|
|
|
|
|
$param{gw}, |
|
264
|
0
|
|
|
|
|
|
$param{gx} ) = dec2bin( eval{ $row->{group_perm} } ); |
|
|
0
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
} |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
# world permissions |
|
268
|
0
|
0
|
0
|
|
|
|
if ( ( ! defined $param{wr} ) |
|
|
|
|
0
|
|
|
|
|
|
269
|
|
|
|
|
|
|
|| ( ! defined $param{ww} ) |
|
270
|
|
|
|
|
|
|
|| ( ! defined defined $param{wx} ) ) { |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
( $param{wr}, |
|
273
|
|
|
|
|
|
|
$param{ww}, |
|
274
|
0
|
|
|
|
|
|
$param{wx} ) = dec2bin( eval{ $row->{world_perm} } ); |
|
|
0
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
} |
|
276
|
|
|
|
|
|
|
|
|
277
|
0
|
|
|
|
|
|
my @permissions = ( |
|
278
|
|
|
|
|
|
|
ht_table(), |
|
279
|
|
|
|
|
|
|
ht_tr(), |
|
280
|
|
|
|
|
|
|
ht_td( { 'class' => 'shd' }, 'Owner' ), |
|
281
|
|
|
|
|
|
|
ht_td( { 'class' => 'shd' }, 'Group' ), |
|
282
|
|
|
|
|
|
|
ht_td( { 'class' => 'shd' }, 'World' ), |
|
283
|
|
|
|
|
|
|
ht_utr(), |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
ht_tr(), |
|
286
|
|
|
|
|
|
|
ht_td( { 'class' => 'dta' }, |
|
287
|
|
|
|
|
|
|
ht_checkbox( 'ur', 1, $param{ur} ), 'Read', ht_br(), |
|
288
|
|
|
|
|
|
|
ht_checkbox( 'uw', 1, $param{ux} ), 'Write', ht_br(), |
|
289
|
|
|
|
|
|
|
ht_checkbox( 'ux', 1, $param{ux} ), 'Execute' ), |
|
290
|
|
|
|
|
|
|
ht_td( { 'class' => 'dta' }, |
|
291
|
|
|
|
|
|
|
ht_checkbox( 'gr', 1, $param{gr} ), 'Read', ht_br(), |
|
292
|
|
|
|
|
|
|
ht_checkbox( 'gw', 1, $param{gw} ), 'Write', ht_br(), |
|
293
|
|
|
|
|
|
|
ht_checkbox( 'gx', 1, $param{gx} ), 'Execute' ), |
|
294
|
|
|
|
|
|
|
ht_td( { 'class' => 'dta' }, |
|
295
|
|
|
|
|
|
|
ht_checkbox( 'wr', 1, $param{wr} ), 'Read', ht_br(), |
|
296
|
|
|
|
|
|
|
ht_checkbox( 'ww', 1, $param{ww} ), 'Write', ht_br(), |
|
297
|
|
|
|
|
|
|
ht_checkbox( 'wx', 1, $param{wx} ), 'Execute' ), |
|
298
|
|
|
|
|
|
|
ht_utr(), |
|
299
|
|
|
|
|
|
|
ht_utable() , |
|
300
|
|
|
|
|
|
|
); |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
# push groups to array |
|
303
|
0
|
|
|
|
|
|
my @group_options; |
|
304
|
0
|
|
|
|
|
|
foreach ( $AUTH_GROUPS->retrieve_all( { order_by => 'name' } ) ) { |
|
305
|
0
|
|
|
|
|
|
push( @group_options, { |
|
306
|
|
|
|
|
|
|
label => $_->name, |
|
307
|
|
|
|
|
|
|
value => $_->id, |
|
308
|
|
|
|
|
|
|
}); |
|
309
|
|
|
|
|
|
|
} |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
# push users to array |
|
312
|
0
|
|
|
|
|
|
my @owner_options; |
|
313
|
0
|
|
|
|
|
|
foreach ( $AUTH_USERS->retrieve_all( |
|
314
|
|
|
|
|
|
|
{ order_by => 'last_name, first_name' } ) ) { |
|
315
|
|
|
|
|
|
|
|
|
316
|
0
|
|
|
|
|
|
push( @owner_options, { |
|
317
|
|
|
|
|
|
|
label => ( $_->last_name . ", " . $_->first_name ), |
|
318
|
|
|
|
|
|
|
value => $_->id, |
|
319
|
|
|
|
|
|
|
}); |
|
320
|
|
|
|
|
|
|
} |
|
321
|
|
|
|
|
|
|
|
|
322
|
0
|
0
|
|
|
|
|
my $form = { |
|
323
|
|
|
|
|
|
|
legend => $self->path_info =~ /edit/i ? 'Edit' : 'Add', |
|
324
|
|
|
|
|
|
|
width => "400", |
|
325
|
|
|
|
|
|
|
label_width => '40px', |
|
326
|
|
|
|
|
|
|
row => $row, |
|
327
|
|
|
|
|
|
|
fields => [ |
|
328
|
|
|
|
|
|
|
{ name => 'uri', |
|
329
|
|
|
|
|
|
|
label => 'URI', |
|
330
|
|
|
|
|
|
|
type => 'text', |
|
331
|
|
|
|
|
|
|
is => 'varchar' |
|
332
|
|
|
|
|
|
|
}, |
|
333
|
|
|
|
|
|
|
{ name => 'title', |
|
334
|
|
|
|
|
|
|
label => 'Title', |
|
335
|
|
|
|
|
|
|
type => 'text', |
|
336
|
|
|
|
|
|
|
is => 'varchar', |
|
337
|
|
|
|
|
|
|
}, |
|
338
|
|
|
|
|
|
|
{ name => 'owner_id', |
|
339
|
|
|
|
|
|
|
label => 'Owner', |
|
340
|
|
|
|
|
|
|
is => 'int4', |
|
341
|
|
|
|
|
|
|
type => 'select', |
|
342
|
|
|
|
|
|
|
options => \@owner_options |
|
343
|
|
|
|
|
|
|
}, |
|
344
|
|
|
|
|
|
|
{ name => 'group_id', |
|
345
|
|
|
|
|
|
|
label => 'Group', |
|
346
|
|
|
|
|
|
|
is => 'int4', |
|
347
|
|
|
|
|
|
|
type => 'select', |
|
348
|
|
|
|
|
|
|
options => \@group_options |
|
349
|
|
|
|
|
|
|
}, |
|
350
|
|
|
|
|
|
|
{ html => join( "\n", @permissions ), |
|
351
|
|
|
|
|
|
|
optional => 1, |
|
352
|
|
|
|
|
|
|
type => 'html', |
|
353
|
|
|
|
|
|
|
is => 'varchar', |
|
354
|
|
|
|
|
|
|
label => 'Permissions', |
|
355
|
|
|
|
|
|
|
} |
|
356
|
|
|
|
|
|
|
] |
|
357
|
|
|
|
|
|
|
}; |
|
358
|
|
|
|
|
|
|
|
|
359
|
0
|
|
|
|
|
|
return( $form ); |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
} # end form |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
sub site_links { |
|
364
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
365
|
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
return( [ |
|
367
|
0
|
|
|
|
|
|
{ link => ($self->app_rootp . '/users'), label => 'Users' }, |
|
368
|
|
|
|
|
|
|
{ link => ($self->app_rootp . '/groups'), label => 'Groups' }, |
|
369
|
|
|
|
|
|
|
{ link => ($self->app_rootp . '/pages'), label => 'Pages' }, |
|
370
|
|
|
|
|
|
|
] ); |
|
371
|
|
|
|
|
|
|
} |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
# EOF |
|
374
|
|
|
|
|
|
|
1; |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
__END__ |