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