Index: trunk/gsdl/perllib/classify/List.pm
===================================================================
--- trunk/gsdl/perllib/classify/List.pm	(revision 544)
+++ trunk/gsdl/perllib/classify/List.pm	(revision 545)
@@ -27,7 +27,11 @@
 # options are:
 # metadata=Metaname -- (optional) all documents with Metaname metadata
-#                      will be included in list, list will be sorted
-#                      by this element. if not included all documents
-#                      will be included in list in build (random) order
+#                      will be included in list. if not included all documents
+#                      will be included in list.
+# sort=Meta         -- (optional) sort documents in list alphabetically by
+#                      Meta. by default it will sort by Metaname, if neither
+#                      are set documents will be in build (random) order.
+#                      Meta may be Filename to sort by original filename or
+#                      nosort to force not to sort
 # title=Title       -- (optional) the title field for this classification.
 #                      if not included title field will be Metaname. 
@@ -42,5 +46,5 @@
 
     my $list = [];
-    my ($metaname, $title);
+    my ($metaname, $title, $sortname);
 
     foreach $option (@options) {
@@ -50,4 +54,6 @@
 	} elsif ($option =~ /^title=(.*)$/i) {
 	    $title = $1;
+	} elsif ($option =~ /^sort=(.*)$/i) {
+	    $sortname = $1;
 	}
     }
@@ -61,8 +67,15 @@
     }
 
+    if (defined $sortname && $sortname =~ /^nosort$/i) {
+	$sortname = undef;
+    } elsif (!defined $sortname && defined $metaname) {
+	$sortname = $metaname;
+    }
+
     return bless {
 	'list'=>$list,
 	'metaname' => $metaname,
-	'title' => $title
+	'title' => $title,
+	'sortname' => $sortname
 	}, $class;
 }
@@ -71,5 +84,5 @@
     my $self = shift (@_);
 
-    if (defined $self->{'metaname'}) {
+    if (defined $self->{'sortname'}) {
 	$self->{'list'} = {};
     } else {
@@ -84,22 +97,44 @@
     my $doc_OID = $doc_obj->get_OID();
 
-    if (defined $self->{'metaname'}) {
-	my $metavalue = $doc_obj->get_metadata_element ($doc_obj->get_top_section(),
-						     $self->{'metaname'});
-	if (defined $metavalue) {
-	    if ($self->{'metaname'} eq 'Creator') {
-		&sorttools::format_string_name_english (\$metavalue);
+    my $sortmeta = "";
+    if (defined $self->{'sortname'}) {
+	if ($self->{'sortname'} =~ /^filename$/i) {
+	    $sortmeta = $doc_obj->get_source_filename();
+	} else {
+	    $sortmeta = $doc_obj->get_metadata_element($doc_obj->get_top_section(),
+						       $self->{'sortname'});
+	    if ($self->{'sortname'} eq "Creator") {
+		&sorttools::format_string_name_english (\$sortmeta);
 	    } else {
-		&sorttools::format_string_english (\$metavalue);
+		&sorttools::format_string_english (\$sortmeta);
 	    }
+	}
+	$sortmeta = "" unless defined $sortmeta;
+
+	if (defined $self->{'metaname'}) {
+	    my $metavalue = $doc_obj->get_metadata_element ($doc_obj->get_top_section(),
+							    $self->{'metaname'});
+	    if (defined $metavalue) {
+		if (defined $self->{'list'}->{$doc_OID}) {
+		    print STDERR "WARNING: List::classify called multiple times for $doc_OID\n";
+		} 
+		$self->{'list'}->{$doc_OID} = $sortmeta;
+	    }
+	} else {
 	    if (defined $self->{'list'}->{$doc_OID}) {
-		print STDERR "metavalue: $metavalue\n";
-		print STDERR "title: $self->{'title'}\n";
 		print STDERR "WARNING: List::classify called multiple times for $doc_OID\n";
 	    } 
-	    $self->{'list'}->{$doc_OID} = $metavalue;
+	    $self->{'list'}->{$doc_OID} = $sortmeta;
 	}
     } else {
-	push (@{$self->{'list'}}, $doc_OID);
+	if (defined $self->{'metaname'}) {
+	    my $metavalue = $doc_obj->get_metadata_element ($doc_obj->get_top_section(),
+							    $self->{'metaname'});
+	    if (defined $metavalue) {
+		push (@{$self->{'list'}}, $doc_OID);
+	    }
+	} else {
+	    push (@{$self->{'list'}}, $doc_OID);
+	}	    	    
     }
 }
@@ -108,7 +143,6 @@
     my $self = shift (@_);
 
-    my $contains = "";
     my @list = ();
-    if (defined $self->{'metaname'}) {
+    if (defined $self->{'sortname'}) {
 	if (keys %{$self->{'list'}}) {
 	    @list = sort {$self->{'list'}->{$a} 
Index: trunk/gsdl/perllib/classify/SectionList.pm
===================================================================
--- trunk/gsdl/perllib/classify/SectionList.pm	(revision 544)
+++ trunk/gsdl/perllib/classify/SectionList.pm	(revision 545)
@@ -86,5 +86,5 @@
     my $self = shift (@_);
 
-    if (defined $self->{'metaname'}) {
+    if (defined $self->{'sortname'}) {
 	$self->{'list'} = {};
     } else {
@@ -128,8 +128,15 @@
     $sortmeta = "" unless defined $sortmeta;
 
-    if (defined $self->{'metaname'}) {
+    if (defined $self->{'sortname'}) {
+	if (defined $self->{'metaname'}) {
 
-	my $metavalue = $doc_obj->get_metadata_element ($section, $self->{'metaname'});
-	if (defined $metavalue) {
+	    my $metavalue = $doc_obj->get_metadata_element ($section, $self->{'metaname'});
+	    if (defined $metavalue) {
+		if (defined $self->{'list'}->{"$doc_OID.$section"}) {
+		    print STDERR "WARNING: SectionList::classify called multiple times for $doc_OID.$section\n";
+		} 
+		$self->{'list'}->{"$doc_OID.$section"} = $sortmeta;
+	    }
+	} else {
 	    if (defined $self->{'list'}->{"$doc_OID.$section"}) {
 		print STDERR "WARNING: SectionList::classify called multiple times for $doc_OID.$section\n";
@@ -137,6 +144,15 @@
 	    $self->{'list'}->{"$doc_OID.$section"} = $sortmeta;
 	}
+
     } else {
-	push (@{$self->{'list'}}, "$doc_OID.$section");
+	if (defined $self->{'metaname'}) {
+
+	    my $metavalue = $doc_obj->get_metadata_element ($section, $self->{'metaname'});
+	    if (defined $metavalue) {
+		push (@{$self->{'list'}}, "$doc_OID.$section");
+	    }
+	} else {
+	    push (@{$self->{'list'}}, "$doc_OID.$section");
+	}
     }
 }
@@ -145,7 +161,6 @@
     my $self = shift (@_);
 
-    my $contains = "";
     my @list = ();
-    if (defined $self->{'metaname'}) {
+    if (defined $self->{'sortname'}) {
 	if (keys %{$self->{'list'}}) {
 	    @list = sort {$self->{'list'}->{$a} 
