Line # Revision Author
1 8 ahitrov@rambler.ru <%ARGS>
2 $id => undef
3 $class => undef
4 </%ARGS>
5
6 <%INIT>
7 if ($id)
8 {
9 my $document = $keeper->get_document_by_id($id, class=>$class);
10
11 my %sections = ();
12 foreach my $name (keys %ARGS)
13 {
14 if ($name =~ /^section_(\d+)$/)
15 {
16 $sections{$1} = 1;
17 }
18 }
19 my @sections_in_order = ();
20 if ($ARGS{main_section} > 0)
21 {
22 delete $sections{ $ARGS{main_section} };
23 push (@sections_in_order, $ARGS{main_section});
24 }
25 push (@sections_in_order, keys(%sections));
26
27 $document->sections(@sections_in_order);
28 $document->store();
29
30 $r->header_out("Location", "document.html?id=$id&class=$class");
31 $r->status(302);
32 $r->send_http_header();
33 $m->abort();
34 }
35
36 </%init>