Revision 371
- Date:
- 2013/07/24 17:13:31
- Files:
-
- /koi8/core/comps/contenido/components/document_links_block.msn (Diff) (Checkout)
- /koi8/core/comps/contenido/document_links.html (Diff) (Checkout)
- /koi8/core/comps/contenido/link_frame.html (Diff) (Checkout)
- /koi8/core/comps/contenido/links/destination.html (Diff) (Checkout)
- /koi8/core/comps/contenido/links/source.html (Diff) (Checkout)
- /koi8/core/comps/contenido/store_document_links.html (Diff) (Checkout)
- /koi8/core/lib/Contenido/Keeper.pm (Diff) (Checkout)
Legend:
- Added
- Removed
- Modified
-
koi8/core/comps/contenido/components/document_links_block.msn
9 9 % } 10 10 <br clear="all"> 11 11 <div style="padding:4px 0 2px;"><a target="_top" 12 href="link_frame.html?class=<% $class %>&<% $link_class_name %>=<% $document->class %>&<% $link_id_name %>=<% $document->id %>"><b>�������� �����</b></a></div> 12 href="link_frame.html?class=<% $class %>&<% $link_class_name %>=<% $document->class %>&<% $link_id_name %>=<% $document->id %>&back=<% $back %>"><b>�������� �����</b></a></div> 13 13 % if ( $total > $size ) { 14 14 <div style="padding:2px 0 4px;"><b>��������:</b> <& 15 15 '/inc/pages_.msn', total => $total, n => $size, p => $p, 16 16 params => { id => $document->id, class => $document->class, link_class => $class }, 17 17 &></div> 18 18 % } 19 <& /contenido/components/document_links_list.msn, 19 <& /contenido/components/document_links_list.msn, parent_url => $parent_url, 20 20 links => $links, docs => $docs, $link_id_name eq 'dest_id' ? (destination => $document) : (source => $document) &> 21 21 <%args> 22 22 … … 27 27 $opts => {} 28 28 $link_id_name => 'dest_id' 29 29 $link_class_name=> 'dest_class' 30 $parent_url => undef 30 31 31 32 </%args> 32 33 <%init> … … 34 35 return unless ref $document; 35 36 return unless ref $lclasses eq 'ARRAY' && @$lclasses; 36 37 $class ||= $lclasses->[0]; 38 my $back = URI::Escape::uri_escape( $parent_url ); 37 39 38 40 my $size = 20; 39 41 my $revert_id = $link_id_name eq 'dest_id' ? 'source_id' : 'dest_id'; -
koi8/core/comps/contenido/document_links.html
31 31 % my $show = (@sources && $link_class && grep { $_ eq $link_class } @sources) || ((@sources && @destinations) || !@destinations) ? 1 : 0; 32 32 % my $lclass = $link_class; 33 33 % if ( $link_class && grep { $_ eq $link_class } @destinations ) { 34 % $show = 0; 35 % $lclass = undef; 34 % if ( grep { $_ eq $link_class } @sources ) { 35 % $show = 1; 36 % } else { 37 % $show = 0; 38 % $lclass = undef; 39 % } 36 40 % } 37 41 <fieldset> 38 42 <legend>→ <a href="javascript:switch_div('div_source')" style="color:white;" … … 41 45 <& "/contenido/components/document_links_block.msn", 42 46 document => $document, lclasses => \@sources, class => $lclass, p => $p, 43 47 link_id_name => 'source_id', 44 link_class_name => 'source_class' 48 link_class_name => 'source_class', 49 parent_url => $parent_url, 45 50 &> 46 51 </div> 47 52 <div id="div_source_hidden" style="display:<% $show ? 'none' : 'block' %>; padding:5px;"><a href="javascript:switch_div('div_source')" … … 52 57 % my $show = (@destinations && $link_class && grep { $_ eq $link_class } @destinations ) || !@sources ? 1 : 0; 53 58 % my $lclass = $link_class; 54 59 % if ( $link_class && grep { $_ eq $link_class } @sources ) { 55 % $show = 0; 56 % $lclass = undef; 60 % if ( grep { $_ eq $link_class } @destinations ) { 61 % $show = 1; 62 % } else { 63 % $show = 0; 64 % $lclass = undef; 65 % } 57 66 % } 58 67 <fieldset> 59 68 <legend>← <a href="javascript:switch_div('div_destination')" style="color:white;" … … 62 71 <& "/contenido/components/document_links_block.msn", 63 72 document => $document, lclasses => \@destinations, class => $lclass, p => $p, 64 73 link_id_name => 'dest_id', 65 link_class_name => 'dest_class' 74 link_class_name => 'dest_class', 75 parent_url => $parent_url, 66 76 &> 67 77 </div> 68 78 <div id="div_destination_hidden" style="display:<% $show ? 'none' : 'block' %>; padding:5px;"><a href="javascript:switch_div('div_destination')" … … 81 91 $class => undef 82 92 $id => undef 83 93 $link_class => undef 94 $parent_url => undef 84 95 85 96 </%ARGS> 86 97 87 98 <%INIT> 99 88 100 return unless ($state->{available_links} and @{$state->{available_links}}); 101 $parent_url ||= $r->header_in("Referer"); 89 102 my $document; 90 103 my (@sources, @destinations); 91 104 if ($id && ($id !~ /\D/) && ($id > 0)) { -
koi8/core/comps/contenido/link_frame.html
15 15 $dest_id => '' 16 16 $save => 0 17 17 $status => 0 18 $back => undef 18 19 </%args> 19 20 <%init> 20 21 … … 22 23 push @source_args, 'class='.$class if $class; 23 24 push @source_args, 'source_class='.$source_class if $source_class; 24 25 push @source_args, 'source_id='.$source_id if $source_id; 26 push @source_args, 'back='.URI::Escape::uri_escape( $back ); 25 27 push @dest_args, 'class='.$class if $class; 26 28 push @dest_args, 'dest_class='.$dest_class if $dest_class; 27 29 push @dest_args, 'dest_id='.$dest_id if $dest_id; 30 push @dest_args, 'back='.URI::Escape::uri_escape( $back ); 28 31 29 32 $sargs = @source_args ? '?'.join('&', @source_args) : undef; 30 33 $dargs = @dest_args ? '?'.join('&', @dest_args) : undef; -
koi8/core/comps/contenido/links/destination.html
78 78 <form action="link_add.html" name="sourceform" target="_top" method="post" onsubmit="return CheckSource();"> 79 79 <div id="link_list"></div> 80 80 81 <input type="hidden" name="back" value="<% $back %>"> 81 82 <input type="hidden" name="class" value="<% $class %>"> 82 83 <input type="hidden" name="dest_id" value="<% $dest_id %>"> 83 84 <input type="hidden" name="dest_class" value="<% $dest_class %>"> … … 146 147 $dest_id => '' 147 148 $save => 0 148 149 $status => 0 150 $back => undef 149 151 150 152 $p => 1 151 153 $use_section => undef -
koi8/core/comps/contenido/links/source.html
72 72 <fieldset> 73 73 <legend>������ ������</legend> 74 74 75 <table class="tform" width="100%"> 76 <tr><td> 75 77 <form action="link_add.html" name="destform" target="_top" method="post" onsubmit="return CheckDest();"> 76 78 <div id="link_list"></div> 77 79 78 <table class="tform" width="100%"> 79 <tr><td> 80 <input type="hidden" name="back" value="<% $back %>"> 80 81 <input type="hidden" name="class" value="<% $class %>"> 81 82 <input type="hidden" name="source_id" value="<% $source_id %>"> 82 83 <input type="hidden" name="source_class" value="<% $source_class %>"> … … 145 146 $dest_id => '' 146 147 $save => 0 147 148 $status => 0 149 $back => undef 148 150 149 151 $p => 1 150 152 $restrict_class => undef … … 167 169 $source_class = $class->available_sources; 168 170 } 169 171 170 </%init> -
koi8/core/comps/contenido/store_document_links.html
5 5 $source_class => undef 6 6 $dest_class => undef 7 7 $update => undef 8 $parent_url => undef 8 9 9 10 </%ARGS> 10 11 … … 82 83 } 83 84 } 84 85 86 $parent_url = URI::Escape::uri_escape( $parent_url ) if $parent_url; 85 87 # ������� �� ���������� ���������... 86 88 if ( $source_class ) { 87 $m->redirect ("document_links.html?id=$id&class=$class&source_class=$source_class"); 89 $m->redirect ("document_links.html?id=$id&class=$class&source_class=$source_class&parent_url=$parent_url"); 88 90 } elsif ( $dest_class ) { 89 $m->redirect ("document_links.html?id=$id&class=$class&dest_class=$dest_class"); 91 $m->redirect ("document_links.html?id=$id&class=$class&dest_class=$dest_class&parent_url=$parent_url"); 90 92 } else { 91 $m->redirect ("document_links.html?id=$id&class=$class"); 93 $m->redirect ("document_links.html?id=$id&class=$class&parent_url=$parent_url"); 92 94 } 93 95 } 94 96 -
koi8/core/lib/Contenido/Keeper.pm
506 506 delete $opts{order_by} if exists $opts{order_by}; 507 507 delete $opts{no_limit} if exists $opts{no_limit}; 508 508 my $root_id = delete $opts{root_id}; 509 $opts{light} = exists $opts{light} ? $opts{light} : 1; 509 510 my $sections = $self->get_sections ( 510 511 %opts, 511 512 return_mode => 'array_ref', 512 513 order_by => 'sorder', 513 514 no_limit => 1, 514 light => exists $opts{light} ? $opts{light} : 1, 515 515 ); 516 516 my %section_hash = map { $_->id => $_ } @$sections if ref $sections eq 'ARRAY'; 517 517 my %tree; … … 843 843 my ($self, $s)=@_; 844 844 return [] unless $s; 845 845 # �������� ���� ������� �� ������ ������ � ������... 846 my $section = $self->get_section_by_id($s, light=>1); 847 return [] unless (ref($section)); 848 my @all_childs = $section->childs(100); 846 my $tree = $self->get_section_tree( root_id => $s ); 847 return [] unless ref $tree && exists $tree->{root} && ref $tree->{root} && $tree->{root}->id == $s; 848 my @all_childs; 849 my $root = $tree->{root}; 850 my @stack = exists $root->{children} ? @{$root->{children}} : (); 851 while ( @stack ) { 852 my $sect = shift @stack; 853 push @all_childs, $sect->id; 854 if ( exists $sect->{children} ) { 855 push @stack, @{$sect->{children}}; 856 } 857 } 849 858 return \@all_childs; 850 859 } 851 860