Changeset 32061

Show
Ignore:
Timestamp:
06.11.2017 18:54:37 (2 years ago)
Author:
ak19
Message:

Moving two subroutines from modmetadataaction.pm to metadataaction.pm since they're already referenced in metadataaction.pm; and since metadataaction.pm includes modmetadataaction.pm anyway, so modmeta won't be missing the moved subroutines.

Location:
main/trunk/greenstone2/perllib/cgiactions
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cgiactions/metadataaction.pm

    r31617 r32061  
    841841} 
    842842 
     843sub mxml_filename 
     844{ 
     845    my ($tagname, $attrHash, $contextArray, $parentDataArray, $parser) = @_; 
     846 
     847    # Store the filename of the Current Fileset 
     848    # Note: According to http://greenstone.org/dtd/DirectoryMetadata/1.0/DirectoryMetadata.dtd 
     849    # FileName tag must come before Description tag 
     850    $parser->{'parameters'}->{'current_file'} = $attrHash->{'_content'}; 
     851 
     852    # RAW is [$tagname => $attrHash] not $tagname => $attrHash!! 
     853    return [$tagname => $attrHash]; 
     854} 
     855 
    843856sub get_archives_metadata 
    844857{ 
     
    949962} 
    950963 
     964 
     965sub dxml_start_section 
     966{ 
     967    my ($tagname, $attrHash, $contextArray, $parentDataArray, $parser) = @_; 
     968 
     969    my $new_depth = scalar(@$contextArray); 
     970 
     971#   print STDERR "**** START SECTION \n"; 
     972     
     973    if ($new_depth == 1) { 
     974    $parser->{'parameters'}->{'curr_section_depth'} = 1; 
     975    $parser->{'parameters'}->{'curr_section_num'}   = ""; 
     976    } 
     977 
     978    my $old_depth  = $parser->{'parameters'}->{'curr_section_depth'}; 
     979    my $old_secnum = $parser->{'parameters'}->{'curr_section_num'}; 
     980 
     981    my $new_secnum; 
     982 
     983    if ($new_depth > $old_depth) { 
     984    # child subsection 
     985    $new_secnum = "$old_secnum.1"; 
     986    } 
     987    elsif ($new_depth == $old_depth) { 
     988    # sibling section => increase it's value by 1 
     989    my ($tail_num) = ($old_secnum =~ m/\.(\d+)$/); 
     990    $tail_num++; 
     991    $new_secnum = $old_secnum; 
     992    $new_secnum =~ s/\.(\d+)$/\.$tail_num/; 
     993    } 
     994    else { 
     995    # back up to parent section => lopp off tail 
     996    $new_secnum = $old_secnum; 
     997    $new_secnum =~ s/\.\d+$//; 
     998    } 
     999 
     1000    $parser->{'parameters'}->{'curr_section_depth'} = $new_depth; 
     1001    $parser->{'parameters'}->{'curr_section_num'}   = $new_secnum; 
     1002     
     1003    1; 
     1004} 
     1005 
    95110061; 
  • main/trunk/greenstone2/perllib/cgiactions/modmetadataaction.pm

    r31617 r32061  
    987987} 
    988988 
    989  
    990 sub dxml_start_section 
    991 { 
    992     my ($tagname, $attrHash, $contextArray, $parentDataArray, $parser) = @_; 
    993  
    994     my $new_depth = scalar(@$contextArray); 
    995  
    996 #   print STDERR "**** START SECTION \n"; 
    997      
    998     if ($new_depth == 1) { 
    999     $parser->{'parameters'}->{'curr_section_depth'} = 1; 
    1000     $parser->{'parameters'}->{'curr_section_num'}   = ""; 
    1001     } 
    1002  
    1003     my $old_depth  = $parser->{'parameters'}->{'curr_section_depth'}; 
    1004     my $old_secnum = $parser->{'parameters'}->{'curr_section_num'}; 
    1005  
    1006     my $new_secnum; 
    1007  
    1008     if ($new_depth > $old_depth) { 
    1009     # child subsection 
    1010     $new_secnum = "$old_secnum.1"; 
    1011     } 
    1012     elsif ($new_depth == $old_depth) { 
    1013     # sibling section => increase it's value by 1 
    1014     my ($tail_num) = ($old_secnum =~ m/\.(\d+)$/); 
    1015     $tail_num++; 
    1016     $new_secnum = $old_secnum; 
    1017     $new_secnum =~ s/\.(\d+)$/\.$tail_num/; 
    1018     } 
    1019     else { 
    1020     # back up to parent section => lopp off tail 
    1021     $new_secnum = $old_secnum; 
    1022     $new_secnum =~ s/\.\d+$//; 
    1023     } 
    1024  
    1025     $parser->{'parameters'}->{'curr_section_depth'} = $new_depth; 
    1026     $parser->{'parameters'}->{'curr_section_num'}   = $new_secnum; 
    1027      
    1028     1; 
    1029 } 
    1030  
    1031989sub edit_xml_file 
    1032990{ 
     
    16511609 
    16521610 
    1653 sub mxml_filename 
    1654 { 
    1655     my ($tagname, $attrHash, $contextArray, $parentDataArray, $parser) = @_; 
    1656  
    1657     # Store the filename of the Current Fileset 
    1658     # Note: According to http://greenstone.org/dtd/DirectoryMetadata/1.0/DirectoryMetadata.dtd 
    1659     # FileName tag must come before Description tag 
    1660     $parser->{'parameters'}->{'current_file'} = $attrHash->{'_content'}; 
    1661  
    1662     # RAW is [$tagname => $attrHash] not $tagname => $attrHash!! 
    1663     return [$tagname => $attrHash]; 
    1664 } 
    1665  
    1666  
    16671611sub mxml_fileset 
    16681612{