package AllList;

use BasClas;

use strict;
no strict 'refs'; # allow filehandles to be variables and viceversa

sub BEGIN {
    @AllList::ISA = ('BasClas');
}

my $arguments = 
    [
     ];

my $options = { 'name'     => "AllList",
	        'abstract' => "no",
	        'inherits' => "yes" };

sub new {
    my ($class) = shift (@_);
    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
    push(@$classifierslist, $class);

    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};

    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
    
    if ($self->{'info_only'}) {
	# don't worry about any options etc
	return bless $self, $class;
    }

    # Manually set $self parameters.
    $self->{'list'} = [];
    $self->{'buttonname'} = "All Documents";

    return bless $self, $class;
}

sub init {
    my $self = shift (@_);
}

sub classify {
    my $self = shift (@_);
    my ($doc_obj) = @_;

    my $doc_OID = $doc_obj->get_OID();
    
    push (@{$self->{'list'}}, $doc_OID);

    return;
}

sub get_classify_info {
    my $self = shift(@_);
    my ($no_thistype) = @_;

    my %classifyinfo = ('childtype'   =>'VList',
			'Title'       =>$self->{'buttonname'},
			'contains'    =>[],
			'classifyOID' =>"oai");
    $classifyinfo{'thistype'} = 'Invisible';
    my @list = @{$self->{'list'}};

    my $seqNo = 0;
    foreach my $OID (@list) {
	my $hashref={};
	$hashref->{'OID'}=$OID;
       
	my %tempinfo=('childtype'=>'VList',
		      'Title'=>$self->{'buttonname'},
		      'classifyOID' =>"oai.$seqNo",
		      'contains'    =>[]);

	push (@{$tempinfo{'contains'}}, $hashref);

	push (@{$classifyinfo{'contains'}}, \%tempinfo);
	$seqNo ++;
    }

    return \%classifyinfo;
}
