Changeset 8361 for trunk/gsdl/perllib/classify.pm
- Timestamp:
- 2004-10-18T14:59:51+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify.pm
r8275 r8361 153 153 # to the gdbm 154 154 sub output_classify_info { 155 my ($classifiers, $handle, $ allclassifications, $gli) = @_;155 my ($classifiers, $handle, $remove_empty_classifications, $gli) = @_; 156 156 # $handle = "main::STDOUT"; 157 157 … … 172 172 } 173 173 174 &print_classify_info ($handle, $classifyinfo, "", $ allclassifications);174 &print_classify_info ($handle, $classifyinfo, "", $remove_empty_classifications); 175 175 } 176 176 177 177 sub print_classify_info { 178 my ($handle, $classifyinfo, $OID, $ allclassifications) = @_;178 my ($handle, $classifyinfo, $OID, $remove_empty_classifications) = @_; 179 179 180 180 $OID =~ s/^\.+//; # just for good luck … … 184 184 185 185 # don't want empty classifications 186 if ($allclassifications || &check_contents ($classifyinfo) > 0) {186 return if ($remove_empty_classifications && &check_contents ($classifyinfo) == 0); 187 187 188 188 $OID = $classifyinfo->{'classifyOID'} if defined ($classifyinfo->{'classifyOID'}); 189 189 190 my $outputtext = "[$OID]\n"; 191 $outputtext .= "<doctype>classify\n"; 192 $outputtext .= "<hastxt>0\n"; 193 $outputtext .= "<childtype>$classifyinfo->{'childtype'}\n" 194 if defined $classifyinfo->{'childtype'}; 195 $outputtext .= "<Title>$classifyinfo->{'Title'}\n" 196 if defined $classifyinfo->{'Title'}; 197 $outputtext .= "<numleafdocs>$classifyinfo->{'numleafdocs'}\n" 198 if defined $classifyinfo->{'numleafdocs'}; 199 $outputtext .= "<thistype>$classifyinfo->{'thistype'}\n" 200 if defined $classifyinfo->{'thistype'}; 201 $outputtext .= "<parameters>$classifyinfo->{'parameters'}\n" 202 if defined $classifyinfo->{'parameters'}; 203 $outputtext .= "<supportsmemberof>$classifyinfo->{'supportsmemberof'}\n" 204 if defined $classifyinfo->{'supportsmemberof'}; 190 my $outputtext = "[$OID]\n"; 191 $outputtext .= "<doctype>classify\n"; 192 $outputtext .= "<hastxt>0\n"; 193 $outputtext .= "<childtype>$classifyinfo->{'childtype'}\n" 194 if defined $classifyinfo->{'childtype'}; 195 $outputtext .= "<Title>$classifyinfo->{'Title'}\n" 196 if defined $classifyinfo->{'Title'}; 197 $outputtext .= "<numleafdocs>$classifyinfo->{'numleafdocs'}\n" 198 if defined $classifyinfo->{'numleafdocs'}; 199 $outputtext .= "<thistype>$classifyinfo->{'thistype'}\n" 200 if defined $classifyinfo->{'thistype'}; 201 $outputtext .= "<parameters>$classifyinfo->{'parameters'}\n" 202 if defined $classifyinfo->{'parameters'}; 203 $outputtext .= "<supportsmemberof>$classifyinfo->{'supportsmemberof'}\n" 204 if defined $classifyinfo->{'supportsmemberof'}; 205 206 my $contains_text = "<contains>"; 207 my $mdoffset_text = "<mdoffset>"; 208 209 my $next_subOID = 1; 210 my $first = 1; 211 foreach $tempinfo (@{$classifyinfo->{'contains'}}) { 212 # empty contents were made undefined by clean_contents() 213 next unless defined $tempinfo; 205 214 206 my $contains_text = "<contains>"; 207 my $mdoffset_text = "<mdoffset>"; 215 if (!defined ($tempinfo->{'classifyOID'}) || 216 $tempinfo->{'classifyOID'} ne "oai") { 217 $contains_text .= ";" unless $first; 218 } 219 $mdoffset_text .= ";" unless $first; 220 $first = 0; 208 221 209 my $next_subOID = 1; 210 my $first = 1; 211 foreach $tempinfo (@{$classifyinfo->{'contains'}}) { 212 # empty contents were made undefined by clean_contents() 213 next unless defined $tempinfo; 214 215 if (!defined ($tempinfo->{'classifyOID'}) || 216 $tempinfo->{'classifyOID'} ne "oai") { 217 $contains_text .= ";" unless $first; 222 if (defined ($tempinfo->{'classifyOID'})) { 223 if ($tempinfo->{'classifyOID'} ne "oai") { 224 $contains_text .= $tempinfo->{'classifyOID'}; 218 225 } 219 $mdoffset_text .= ";" unless $first; 220 $first = 0; 221 222 if (defined ($tempinfo->{'classifyOID'})) { 223 if ($tempinfo->{'classifyOID'} ne "oai") { 224 $contains_text .= $tempinfo->{'classifyOID'}; 225 } 226 &print_classify_info ($handle, $tempinfo, $tempinfo->{'classifyOID'}, 227 $allclassifications); 228 } elsif (defined ($tempinfo->{'OID'})) { 229 $contains_text .= $tempinfo->{'OID'}; 230 $mdoffset_text .= $tempinfo->{'offset'} 231 if (defined ($tempinfo->{'offset'})) 226 &print_classify_info ($handle, $tempinfo, $tempinfo->{'classifyOID'}, 227 $remove_empty_classifications); 228 } elsif (defined ($tempinfo->{'OID'})) { 229 $contains_text .= $tempinfo->{'OID'}; 230 $mdoffset_text .= $tempinfo->{'offset'} 231 if (defined ($tempinfo->{'offset'})) 232 232 # note: we don't want to print the contents of the books 233 233 } else { … … 236 236 # so no bookshelf icon appears, top-level, along with the 237 237 # applet 238 238 239 239 if (!defined ($tempinfo->{'Title'}) || $tempinfo->{'Title'} ne "Collage") { 240 240 $contains_text .= "\".$next_subOID"; 241 241 } 242 242 243 243 &print_classify_info ($handle, $tempinfo, "$OID.$next_subOID", 244 $ allclassifications);244 $remove_empty_classifications); 245 245 $next_subOID++; 246 246 } 247 248 249 250 251 252 253 254 255 256 257 258 } 247 } 248 249 $outputtext .= "$contains_text\n"; 250 $outputtext .= "<mdtype>$classifyinfo->{'mdtype'}\n" 251 if defined $classifyinfo->{'mdtype'}; 252 $outputtext .= "$mdoffset_text\n" 253 if ($mdoffset_text !~ m/^<mdoffset>;+$/); 254 255 $outputtext .= '-' x 70 . "\n"; 256 257 print $handle $outputtext; 258 259 259 } 260 260
Note:
See TracChangeset
for help on using the changeset viewer.