--- loncom/publisher/lonpublisher.pm 2008/07/26 16:03:46 1.240 +++ loncom/publisher/lonpublisher.pm 2008/08/14 13:39:02 1.245 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.240 2008/07/26 16:03:46 raeburn Exp $ +# $Id: lonpublisher.pm,v 1.245 2008/08/14 13:39:02 onken Exp $ # # Copyright Michigan State University Board of Trustees # @@ -118,11 +118,14 @@ use Apache::File; use File::Copy; use Apache::Constants qw(:common :http :methods); use HTML::LCParser; +use HTML::Entities; +use Encode::Encoder; use Apache::lonxml; use Apache::loncacc; use DBI; use Apache::lonnet; use Apache::loncommon(); +use Apache::lonhtmlcommon; use Apache::lonmysql; use Apache::lonlocal; use Apache::loncfile; @@ -886,17 +889,21 @@ sub checkonthis { 'return_only_error_and_warning_counts' => 1)); my ($errorcount,$warningcount)=split(':',$result); if (($errorcount) || ($warningcount)) { - $r->print('
'.$uri.': '); - if ($errorcount) { - $r->print(''. - $errorcount.' '. - &mt('error(s)').' '); - } - if ($warningcount) { - $r->print(''. - $warningcount.' '. - &mt('warning(s)').''); - } + $r->print('

'.&mt('Warnings and Errors').'

'); + $r->print(''.$uri.':'); + $r->print(''); } else { #$r->print(''.&mt('ok').''); } @@ -1167,17 +1174,22 @@ sub publish { $textonly=~s/\//g; $textonly=~s/\[^\<]+\<\/m\>//g; $textonly=~s/\<[^\>]*\>//g; - $textonly=~tr/A-Z/a-z/; - $textonly=~s/[\$\&][a-z]\w*//g; - $textonly=~s/[^a-z\s]//g; - - foreach ($textonly=~m/(\w+)/g) { - unless ($nokey{$_}) { - $keywords{$_}=1; - } - } - } + #this is a work simplification for german authors for present + $textonly=HTML::Entities::decode($textonly); #decode HTML-character + $textonly=Encode::Encoder::encode('utf8', $textonly); #encode to perl internal unicode + $textonly=~tr/A-ZÜÄÖ/a-züäö/; #add lowercase rule for german "Umlaute" + $textonly=~s/[\$\&][a-z]\w*//g; + $textonly=~s/[^a-z^ü^ä^ö^ß\s]//g; #dont delete german "Umlaute" + + foreach ($textonly=~m/[^\s]+/g) { #match all but whitespaces + unless ($nokey{$_}) { + $keywords{$_}=1; + } + } + + + } foreach my $addkey (split(/[\"\'\,\;]/,$metadatafields{'keywords'})) { $addkey=~s/\s+/ /g; @@ -1237,10 +1249,13 @@ END .'' .'' .'


' - .''; + .&Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_row(); + my $colcount=0; foreach (sort keys %keywords) { + $colcount++; $keywordout.=''; - if ($colcount>10) { - $keywordout.="\n"; + if ($colcount>=10) { + $keywordout.=&Apache::loncommon::end_data_table_row() + .&Apache::loncommon::start_data_table_row(); $colcount=0; } - $colcount++; } + # Proper end of started table row: + if ($colcount != 0) { # has still to be improved: if amount of keywords mod 10 == 0, then do not start another table row + while ($colcount<10) { + $keywordout.=''; + $colcount++; + } + } + $env{'form.keywords'}=~s/\,$//; - $keywordout.='
 
' + $keywordout.=&Apache::loncommon::end_data_table_row() + .&Apache::loncommon::end_data_table() .&Apache::lonhtmlcommon::row_closure(); $intr_scrout.=$keywordout;