Changeset 32061 for main/trunk/greenstone2/perllib
- Timestamp:
- 2017-11-06T18:54:37+13:00 (6 years ago)
- Location:
- main/trunk/greenstone2/perllib/cgiactions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/cgiactions/metadataaction.pm
r31617 r32061 841 841 } 842 842 843 sub 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 843 856 sub get_archives_metadata 844 857 { … … 949 962 } 950 963 964 965 sub 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 951 1006 1; -
main/trunk/greenstone2/perllib/cgiactions/modmetadataaction.pm
r31617 r32061 987 987 } 988 988 989 990 sub dxml_start_section991 {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 subsection1010 $new_secnum = "$old_secnum.1";1011 }1012 elsif ($new_depth == $old_depth) {1013 # sibling section => increase it's value by 11014 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 tail1021 $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 1031 989 sub edit_xml_file 1032 990 { … … 1651 1609 1652 1610 1653 sub mxml_filename1654 {1655 my ($tagname, $attrHash, $contextArray, $parentDataArray, $parser) = @_;1656 1657 # Store the filename of the Current Fileset1658 # Note: According to http://greenstone.org/dtd/DirectoryMetadata/1.0/DirectoryMetadata.dtd1659 # FileName tag must come before Description tag1660 $parser->{'parameters'}->{'current_file'} = $attrHash->{'_content'};1661 1662 # RAW is [$tagname => $attrHash] not $tagname => $attrHash!!1663 return [$tagname => $attrHash];1664 }1665 1666 1667 1611 sub mxml_fileset 1668 1612 {
Note:
See TracChangeset
for help on using the changeset viewer.