1 |
3 |
ahitrov@rambler.ru |
<& "/contenido/components/header.msn" &> |
2 |
|
|
|
3 |
|
|
<& "/contenido/components/naviline.msn", sect_id => $owner->id &> |
4 |
|
|
|
5 |
|
|
% if ( (length($class)<=0) && (! ref($section)) ) |
6 |
|
|
% { |
7 |
|
|
|
8 |
|
|
% if ($id) |
9 |
|
|
% { |
10 |
|
|
<div align="center" style="font-size:110%; color:red;"> |
11 |
|
|
������ � ��������������� <% $id %> �� ������� |
12 |
|
|
</div> |
13 |
|
|
<br><br> |
14 |
|
|
% } |
15 |
|
|
|
16 |
|
|
<!-- ���� � ������� ����� ������ ��� �������� --> |
17 |
|
|
<table width="50%" border="0"><tr><td> |
18 |
|
|
<fieldset> |
19 |
|
|
<legend>�������� ��� ������ ��� ��������</legend> |
20 |
|
|
<& "/contenido/components/new_objects_form.msn", proto => 'sections', sect_id => $owner->id &> |
21 |
|
|
</fieldset> |
22 |
|
|
</td></tr></table> |
23 |
|
|
|
24 |
|
|
% } else { |
25 |
|
|
|
26 |
|
|
<& "/contenido/components/obj_list_js.msn", object => $section &> |
27 |
|
|
<& "/contenido/components/object_form.msn", object => $section, proto => 'sections', sect_id => $owner->id &> |
28 |
|
|
|
29 |
|
|
% } |
30 |
|
|
|
31 |
|
|
</body> |
32 |
|
|
</html> |
33 |
|
|
<%ARGS> |
34 |
|
|
|
35 |
|
|
$class => undef |
36 |
|
|
$sect_id => undef |
37 |
|
|
$pid => undef |
38 |
|
|
$id => undef |
39 |
|
|
$ret => undef |
40 |
|
|
|
41 |
|
|
$delete => undef |
42 |
|
|
$save => undef |
43 |
|
|
$move => undef |
44 |
|
|
|
45 |
|
|
</%ARGS> |
46 |
|
|
<%INIT> |
47 |
|
|
# �������� ���������� ������ - �� ������ ���� ����� ����... |
48 |
|
|
if ($class) |
49 |
|
|
{ |
50 |
|
|
my @correct_classes = @{ $state->{available_sections} }; |
51 |
|
|
if (! (grep { $_ eq $class } @correct_classes)) |
52 |
|
|
{ |
53 |
|
|
# ����� �����, �� �� �� ���������� |
54 |
|
|
$class = undef; |
55 |
|
|
} |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
my $section; |
59 |
|
|
if ($id && ($id !~ /\D/) && ($id > 0)) |
60 |
|
|
{ |
61 |
|
|
# ��������� ����� �������������� ������ |
62 |
|
|
if ($user->section_accesses($user, $id) != 2) |
63 |
|
|
{ |
64 |
|
|
$m->clear_buffer; |
65 |
|
|
$m->abort(403); |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
$section = $keeper->get_section_by_id($id); |
69 |
|
|
} |
70 |
|
|
|
71 |
|
|
if ( ($class) && (length($class) > 0) && (! ref($section)) ) |
72 |
|
|
{ |
73 |
|
|
$section = new $class ($keeper); |
74 |
|
|
} |
75 |
|
|
|
76 |
|
|
if ( (! $sect_id) && ref($section) && $section->id ) |
77 |
|
|
{ |
78 |
|
|
$sect_id = $section->pid; |
79 |
|
|
} |
80 |
|
|
if ( $pid > 0 ) |
81 |
|
|
{ |
82 |
|
|
if (ref($section) && $section->id) |
83 |
|
|
{ |
84 |
|
|
$sect_id = $pid if ($section->id != $pid); |
85 |
|
|
} else { |
86 |
|
|
$sect_id = $pid; |
87 |
|
|
} |
88 |
|
|
} |
89 |
|
|
|
90 |
|
|
my $owner = $keeper->get_section_by_id ($sect_id || $Contenido::Section::ROOT || 1); |
91 |
|
|
if (! ref($owner)) |
92 |
|
|
{ |
93 |
|
|
$owner = $keeper->get_section_by_id ($Contenido::Section::ROOT || 1); |
94 |
|
|
} |
95 |
|
|
if (! ref($owner)) |
96 |
|
|
{ |
97 |
|
|
warn "Contenido Die: �� ���� ����� �������� ������\n"; |
98 |
|
|
return undef; |
99 |
|
|
} |
100 |
|
|
|
101 |
|
|
|
102 |
|
|
# ��������... |
103 |
|
|
if ( defined($id) && ($id > 0) && ($delete == 1) ) |
104 |
|
|
{ |
105 |
|
|
$section = $keeper->get_section_by_id($id); |
106 |
|
|
$section->delete(); |
107 |
|
|
|
108 |
|
|
$r->header_out("Location", "sections.html?id=".$owner->id); |
109 |
|
|
$r->status(302); |
110 |
|
|
$r->send_http_header(); |
111 |
|
|
$m->abort(); |
112 |
|
|
} |
113 |
|
|
|
114 |
|
|
# ���������� �����... |
115 |
|
|
elsif ( $save == 1 ) |
116 |
|
|
{ |
117 |
|
|
if ($m->comp('/contenido/components/set_properties.msn', object => $section, SETS => \%ARGS) != 1) |
118 |
|
|
{ |
119 |
|
|
# ������, ���� �� ����������... |
120 |
|
|
} |
121 |
|
|
$section->pid($sect_id); |
122 |
|
|
$section->store(); |
123 |
|
|
|
124 |
|
|
if ($ARGS{_save_and_leave}) |
125 |
|
|
{ |
126 |
|
|
$r->header_out("Location", "sections.html?id=".$owner->id); |
127 |
|
|
$r->status(302); |
128 |
|
|
$r->send_http_header(); |
129 |
|
|
$m->abort(); |
130 |
|
|
} |
131 |
|
|
elsif ($ARGS{_save_and_again}) |
132 |
|
|
{ |
133 |
|
|
$r->header_out("Location", "section.html?class=".$section->class()."§_id=".$owner->id()); |
134 |
|
|
$r->status(302); |
135 |
|
|
$r->send_http_header(); |
136 |
|
|
$m->abort(); |
137 |
|
|
} |
138 |
|
|
|
139 |
|
|
|
140 |
|
|
$r->header_out("Location", "section.html?id=".$section->id); |
141 |
|
|
$r->status(302); |
142 |
|
|
$r->send_http_header(); |
143 |
|
|
$m->abort(); |
144 |
|
|
} |
145 |
|
|
|
146 |
|
|
# �����������... |
147 |
|
|
elsif ($move) { |
148 |
|
|
warn "MOVING to $move"; |
149 |
|
|
$section->move($move); |
150 |
|
|
$r->header_out("Location", $ret ? "sections.html?id=".$ret : 'index.html'); |
151 |
|
|
$r->status(302); |
152 |
|
|
$r->send_http_header(); |
153 |
|
|
$m->abort(); |
154 |
|
|
} |
155 |
|
|
|
156 |
|
|
</%INIT> |
157 |
|
|
|