Changeset 27111
- Timestamp:
- 2013-03-22T15:31:54+13:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/cgiactions/metadataaction.pm
r27007 r27111 757 757 if(defined $parser->{'parameters'}->{'metapos'} && $parser->{'parameters'}->{'poscount'} == $parser->{'parameters'}->{'metapos'}) 758 758 { 759 ##print STDERR " ****got match!!\n";759 ##print STDERR "#### got match!!\n"; 760 760 # Get the value and override the current value 761 761 my $metavalue = $parser->{'parameters'}->{'metavalue'}; … … 778 778 } 779 779 780 # This method exists purely for catching invalid section numbers that the client 781 # requested to edit. Once the parser has reached the end (the final </Archive> tag), 782 # we've seen all the Sections in the doc.xml, and none of their section nums matched 783 # if the metamode has not been set to 'done' by then. 784 sub dxml_archive 785 { 786 my ($tagname, $attrHash, $contextArray, $parentDataArray, $parser) = @_; 787 my $metamode = $parser->{'parameters'}->{'metamode'}; 788 789 my $curr_secnum = $parser->{'parameters'}->{'curr_section_num'}; 790 my $opt_doc_secnum = $parser->{'parameters'}->{'secnum'}; 791 792 # print STDERR "@@@ $tagname Processing a closing </Archive> tag [$curr_secnum|$opt_doc_secnum]\n"; 793 794 if ($metamode ne "done" && $curr_secnum ne $opt_doc_secnum) { 795 print STDERR "@@@ $tagname Finished processing FINAL Section [$curr_secnum|$opt_doc_secnum]\n"; 796 797 my $metaname = $parser->{'parameters'}->{'metaname'}; 798 my $metavalue = $parser->{'parameters'}->{'metavalue'}; 799 800 print STDERR "@@@ Unknown requested section number $opt_doc_secnum\n"; 801 print STDERR "\tas final section number in document was $curr_secnum\n"; 802 print STDERR "\tMetadata value '$metavalue' for meta '$metaname'\n"; 803 print STDERR "\tin section $opt_doc_secnum discarded.\n"; 804 } 805 806 # RAW is [$tagname => $attrHash] not $tagname => $attrHash!! 807 return [$tagname => $attrHash]; 808 } 780 809 781 810 sub dxml_description … … 784 813 my $metamode = $parser->{'parameters'}->{'metamode'}; 785 814 815 my $curr_secnum = $parser->{'parameters'}->{'curr_section_num'}; 816 my $opt_doc_secnum = $parser->{'parameters'}->{'secnum'}; 817 786 818 print STDERR "**** Processing a closing </Description> tag \n"; 819 # print STDERR "@@@ $tagname Processing a closing </Description> tag [$curr_secnum|$opt_doc_secnum]\n"; 787 820 788 821 # Accumulate the metadata 789 822 790 if (($metamode eq "accumulate") || ($metamode eq "override")) { 823 # We'll be accumulating metadata at this point if we haven't found and therefore 824 # haven't processed the metadata yet. 825 # For subsections, this means that if we're at a matching subsection, but haven't 826 # found the correct metaname to override in that subsection, we accumulate it as new 827 # meta in the subsection by adding it to the current description. 828 # If there's no subsection info for the metadata, it will accumulate at the top level 829 # section description if we hadn't found a matching metaname to override at this point. 830 831 # Both curr_secnum and opt_doc_secnum can be "". In the former case, it means we're now 832 # at the toplevel section. In the latter case, it means we want to process meta in the 833 # toplevel section. So the eq check between the values below will work in all cases. 834 835 # The only time this won't work is if an opt_doc_secnum beyond the section numbers of 836 # this document has been provided. In that case, the metadata for that opt_doc_secnum 837 # won't get attached/accumulated to any part of the doc, not even its top-level section. 838 839 if ($curr_secnum eq $opt_doc_secnum 840 && ($metamode eq "accumulate" || $metamode eq "override")) { 791 841 if ($metamode eq "override") { 792 842 print "No metadata value to override. Switching 'metamode' to accumulate\n"; … … 944 994 ( _default => 'raw', 945 995 'Metadata' => \&dxml_metadata, 946 'Description' => \&dxml_description); 996 'Description' => \&dxml_description, 997 'Archive' => \&dxml_archive); # just for catching errors at end 947 998 948 999 # Sets the parameters
Note:
See TracChangeset
for help on using the changeset viewer.