--- loncom/publisher/lonpublisher.pm 2000/12/01 12:08:01 1.8 +++ loncom/publisher/lonpublisher.pm 2000/12/02 12:40:27 1.10 @@ -5,7 +5,7 @@ # # 05/29/00,05/30,10/11 Gerd Kortemeyer) # -# 11/28,11/29,11/30,12/01 Gerd Kortemeyer +# 11/28,11/29,11/30,12/01,12/02 Gerd Kortemeyer package Apache::lonpublisher; @@ -14,10 +14,13 @@ use Apache::File; use Apache::Constants qw(:common :http :methods); use HTML::TokeParser; use Apache::lonxml; -use Apache::lonhomework; +use Apache::structuretags; +use Apache::response; my %addid; my %nokey; +my %language; +my %cprtag; my %metadatafields; my %metadatakeys; @@ -74,11 +77,22 @@ sub metaread { } sub textfield { - my ($title,$value)=@_; + my ($title,$name,$value)=@_; return "\n

$title:
". ''; } +sub selectbox { + my ($title,$name,$value,%options)=@_; + my $selout="\n

$title:
".''; +} + sub publish { my ($source,$target,$style)=@_; @@ -223,6 +237,7 @@ sub publish { $ENV{'environment.generation'}; $metadatafields{'author'}=~s/\s+/ /g; $metadatafields{'author'}=~s/\s+$//; + $metadatafields{'owner'}=$ENV{'user.name'}.'@'.$ENV{'user.domain'}; # ------------------------------------------------ Check out directory hierachy @@ -263,12 +278,7 @@ sub publish { # -------------------------------------------------- Parse content for metadata - my $allmeta=''; - if ($source=~/\.problem$/) { - $allmeta=Apache::lonhomework::subhandler('meta',$content); - } else { - $allmeta=Apache::lonxml::xmlparse('meta',$content); - } + my $allmeta=Apache::lonxml::xmlparse('meta',$content); &metaeval($allmeta); # ---------------- Find and document discrepancies in the parameters and stores @@ -309,9 +319,9 @@ sub publish { '

'. ''. ''. - &textfield('Title',$metadatafields{'title'}). - &textfield('Author(s)',$metadatafields{'author'}). - &textfield('Subject',$metadatafields{'subject'}); + &textfield('Title','title',$metadatafields{'title'}). + &textfield('Author(s)','author',$metadatafields{'author'}). + &textfield('Subject','subject',$metadatafields{'subject'}); # --------------------------------------------------- Scan content for keywords @@ -351,9 +361,23 @@ sub publish { } -# DEGUG - $scrout.=$keywordout; + + $scrout.=&textfield('Notes','notes',$metadatafields{'notes'}); + + $scrout.= + '

Abstract:
'; + + $scrout.=&selectbox('Language','language', + $metadatafields{'language'},%language); + + $scrout.=&textfield('Publisher/Owner','owner', + $metadatafields{'owner'}); + + $scrout.=&selectbox('Copyright/Distribution','copyright', + $metadatafields{'copyright'},%cprtag); + } return $scrout. '

'; @@ -432,6 +456,26 @@ sub handler { $nokey{$word}=1; } <$fh>; } + + %language=(); + + { + my $fh=Apache::File->new($r->dir_config('lonTabDir').'/language.tab'); + map { + $_=~/(\w+)\s+([\w\s\-]+)/; + $language{$1}=$2; + } <$fh>; + } + + %cprtag=(); + + { + my $fh=Apache::File->new($r->dir_config('lonIncludes').'/copyright.tab'); + map { + $_=~/(\w+)\s+([\w\s\-]+)/; + $cprtag{$1}=$2; + } <$fh>; + } # ----------------------------------------------------------- Start page output $r->content_type('text/html');