1 |
3 |
ahitrov@rambler.ru |
<%init> |
2 |
|
|
use POSIX qw(strftime); |
3 |
|
|
|
4 |
|
|
#force refresh state... todo add ->refresh method to Project.pm |
5 |
|
|
$project->restore($keeper, 1); |
6 |
|
|
|
7 |
|
|
my $context = $m->comp('/contenido/components/context.msn'); |
8 |
|
|
|
9 |
|
|
my $set_context_name = 'set_context'; |
10 |
|
|
if ($ARGS{$set_context_name} eq 'profile-admin' && !$user->check_group(1)) |
11 |
|
|
{ |
12 |
|
|
$m->clear_buffer; |
13 |
|
|
$m->abort(403); |
14 |
|
|
} |
15 |
|
|
|
16 |
|
|
if (exists $ARGS{$set_context_name}) |
17 |
|
|
{ |
18 |
|
|
map { |
19 |
|
|
my ($n, $v) = split /-/; |
20 |
|
|
$m->comp('/contenido/components/context.msn', name => $n, value => $v); |
21 |
|
|
} split('/', $ARGS{$set_context_name}); |
22 |
|
|
} |
23 |
|
|
my $unset_context_name = 'unset_context'; |
24 |
|
|
if (exists $ARGS{$unset_context_name}) |
25 |
|
|
{ |
26 |
|
|
map { |
27 |
|
|
$m->comp('/contenido/components/context.msn', name => $_, delete => 1); |
28 |
|
|
} split('/', $ARGS{$unset_context_name}); |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
## Selected profile, actually |
32 |
|
|
$request->{tab} = {}; |
33 |
|
|
|
34 |
|
|
## Default for 'profile' |
35 |
|
|
if (! (exists($context->{profile}) && (length($context->{profile}) > 0))) |
36 |
|
|
{ |
37 |
|
|
$m->comp('/contenido/components/context.msn', name => 'profile', value => 'rubricator'); |
38 |
|
|
} |
39 |
|
|
my $profile = $context->{profile} if exists $context->{profile}; |
40 |
|
|
|
41 |
|
|
if (length $profile > 0) |
42 |
|
|
{ |
43 |
|
|
my $toopi = $project->tabs(); |
44 |
|
|
if (ref($toopi) && exists($toopi->{$profile})) |
45 |
|
|
{ |
46 |
|
|
$request->{tab} = $toopi->{$profile}; |
47 |
|
|
} |
48 |
|
|
} |
49 |
|
|
$m->call_next(); |
50 |
|
|
|
51 |
|
|
</%init> |