Revision 275

Date:
2013/02/07 18:20:04
Author:
ahitrov
Revision Log:
Lookup multi bug - multiple deletion didn't funtion
Links block now can be used in plugins. It returns BACK to the caller, not to /contenido/
Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/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> &nbsp;<&
    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';
  • utf8/core/comps/contenido/components/document_links_list.msn

     
    75 75 <div style="padding:2px; text-align:right">
    76 76 <input type="hidden" name="id" value="<% $document->id %>">
    77 77 <input type="hidden" name="class" value="<% $document->class %>">
    78 <input type="hidden" name="parent_url" value="<% $parent_url %>">
    78 79 % if ( ref $destination ) {
    79 80 <input type="hidden" name="source_class" value="<% $links->[0]->class %>">
    80 81 % } else {
     
    92 93 $docs => undef
    93 94 $destination => undef
    94 95 $source => undef
    96 $parent_url => undef
    95 97
    96 98 </%args>
    97 99 <%init>
  • utf8/core/comps/contenido/components/outputs/lookup_multi.msn

     
    19 19 next unless $k =~ /^${name}_(add|delete)$/;
    20 20 next unless $v;
    21 21
    22 warn Dumper $v;
    22 23 if ($1 eq 'add') {
    23 24 $ids{$v} = 1;
    24 25 } elsif ($1 eq 'delete') {
    25 delete $ids{$v};
    26 if ( ref $v eq 'ARRAY' ) {
    27 map { delete $ids{$_} } @$v;
    28 } else {
    29 delete $ids{$v};
    30 }
    26 31 }
    27 32 }
    28 33
  • utf8/core/comps/contenido/document_links.html

     
    41 41 <& "/contenido/components/document_links_block.msn",
    42 42 document => $document, lclasses => \@sources, class => $lclass, p => $p,
    43 43 link_id_name => 'source_id',
    44 link_class_name => 'source_class'
    44 link_class_name => 'source_class',
    45 parent_url => $parent_url,
    45 46 &>
    46 47 </div>
    47 48 <div id="div_source_hidden" style="display:<% $show ? 'none' : 'block' %>; padding:5px;"><a href="javascript:switch_div('div_source')"
     
    62 63 <& "/contenido/components/document_links_block.msn",
    63 64 document => $document, lclasses => \@destinations, class => $lclass, p => $p,
    64 65 link_id_name => 'dest_id',
    65 link_class_name => 'dest_class'
    66 link_class_name => 'dest_class',
    67 parent_url => $parent_url,
    66 68 &>
    67 69 </div>
    68 70 <div id="div_destination_hidden" style="display:<% $show ? 'none' : 'block' %>; padding:5px;"><a href="javascript:switch_div('div_destination')"
     
    81 83 $class => undef
    82 84 $id => undef
    83 85 $link_class => undef
    86 $parent_url => undef
    84 87
    85 88 </%ARGS>
    86 89
    87 90 <%INIT>
    91
    88 92 return unless ($state->{available_links} and @{$state->{available_links}});
    93 $parent_url ||= $r->header_in("Referer");
    89 94 my $document;
    90 95 my (@sources, @destinations);
    91 96 if ($id && ($id !~ /\D/) && ($id > 0)) {
  • utf8/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;
  • utf8/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
  • utf8/core/comps/contenido/links/link_add.html

     
    8 8 $dest_class => undef
    9 9 $sources => undef
    10 10 $destinations => undef
    11 $back => undef
    11 12
    12 13 </%args>
    13 14 <%init>
     
    59 60 $ret_params = "id=$dest_id&class=$dest_class";
    60 61 }
    61 62 if ($ret_params) {
    62 $r->header_out("Location", "/contenido/document.html?".$ret_params);
    63 $r->status(302);
    64 $r->send_http_header();
    65 $m->abort();
    66 }else{
    67 abort404;
    63 $m->redirect( $back || "/contenido/document.html?".$ret_params );
    64 } else {
    65 &abort404;
    68 66 }
    69 67
    70 68 </%init>
  • utf8/core/comps/contenido/links/source.html

     
    77 77 <form action="link_add.html" name="destform" target="_top" method="post" onsubmit="return CheckDest();">
    78 78 <div id="link_list"></div>
    79 79
    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
  • utf8/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