Changeset 637 for trunk/gsdl/perllib/classify.pm
- Timestamp:
- 1999-09-29T08:40:14+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify.pm
r537 r637 111 111 112 112 # don't want empty classifications 113 if ($allclassifications || &c lean_contents ($classifyinfo)) {113 if ($allclassifications || &check_contents ($classifyinfo) > 0) { 114 114 115 115 $OID = $classifyinfo->{'classifyOID'} if defined ($classifyinfo->{'classifyOID'}); … … 120 120 $outputtext .= "<classifytype>$classifyinfo->{'classifytype'}\n" if defined $classifyinfo->{'classifytype'}; 121 121 $outputtext .= "<Title>$classifyinfo->{'Title'}\n" if defined $classifyinfo->{'Title'}; 122 $outputtext .= "<numleafdocs>$classifyinfo->{'numleafdocs'}\n" if defined $classifyinfo->{'numleafdocs'}; 123 print "numleafdocs = $classifyinfo->{'numleafdocs'}\n" if defined $classifyinfo->{'numleafdocs'}; 122 124 123 125 $outputtext .= "<contains>"; … … 153 155 } 154 156 155 sub c lean_contents {157 sub check_contents { 156 158 my ($classifyinfo) = @_; 157 my $has_content = 0; 159 my $num_leaf_docs = 0; 160 my $sub_num_leaf_docs = 0; 161 162 return $classifyinfo->{'numleafdocs'} if (defined $classifyinfo->{'numleafdocs'}); 158 163 159 164 foreach $content (@{$classifyinfo->{'contains'}}) { 160 165 if (defined $content->{'OID'}) { 161 166 # found a book 162 $ has_content = 1;163 } elsif ( &clean_contents ($content)) {167 $num_leaf_docs ++; 168 } elsif (($sub_num_leaf_docs = &check_contents ($content)) > 0) { 164 169 # there's a book somewhere below 165 $ has_content = 1;170 $num_leaf_docs += $sub_num_leaf_docs; 166 171 } else { 167 172 # section contains no books so we want to remove … … 170 175 } 171 176 } 172 return $has_content; 177 178 $classifyinfo->{'numleafdocs'} = $num_leaf_docs; 179 return $num_leaf_docs; 173 180 } 174 181
Note:
See TracChangeset
for help on using the changeset viewer.