--- loncom/publisher/lonpublisher.pm 2008/05/12 23:47:49 1.234
+++ loncom/publisher/lonpublisher.pm 2008/06/27 18:52:35 1.238
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Publication Handler
#
-# $Id: lonpublisher.pm,v 1.234 2008/05/12 23:47:49 www Exp $
+# $Id: lonpublisher.pm,v 1.238 2008/06/27 18:52:35 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -331,9 +331,9 @@ sub textfield {
$value=~s/\s+/ /gs;
$title=&mt($title);
$env{'form.'.$name}=$value;
- return "\n
$title:".
- "
".
- '';
+ return "\n".&Apache::lonhtmlcommon::row_title($title)
+ .''
+ .&Apache::lonhtmlcommon::row_closure();
}
sub text_with_browse_field {
@@ -343,12 +343,16 @@ sub text_with_browse_field {
$value=~s/\s+/ /gs;
$title=&mt($title);
$env{'form.'.$name}=$value;
- return "\n$title:".
- "
".
- ''.
- ''.&mt('Select').' '.
- ''.&mt('Search').'';
-
+ return "\n".&Apache::lonhtmlcommon::row_title($title)
+ .''
+ .'
'
+ .''
+ .&mt('Select')
+ .' '
+ .''
+ .&mt('Search')
+ .''
+ .&Apache::lonhtmlcommon::row_closure();
}
sub hiddenfield {
@@ -372,8 +376,8 @@ sub selectbox {
} else {
$env{'form.'.$name}=$idlist[0];
}
- my $selout="\n$title:".
- '
'.&Apache::lonhtmlcommon::row_closure();
+ return $selout;
}
sub select_level_form {
@@ -665,6 +670,7 @@ sub fix_ids_and_indices {
"Max Index: $maxindex (min 10)\n";
}
my $outstring='';
+ my $responsecounter=1;
my @parser;
$parser[0]=HTML::LCParser->new(\$content);
$parser[-1]->xml_mode(1);
@@ -680,6 +686,10 @@ sub fix_ids_and_indices {
next;
}
if ($lctag eq 'base') { next; }
+ if (($lctag eq 'part') || ($lctag eq 'problem')) {
+ $responsecounter=0;
+ }
+ if ($lctag=~/response$/) { $responsecounter++; }
my %parms=%{$token->[2]};
$counter=$addid{$tag};
if (!$counter) { $counter=$addid{$lctag}; }
@@ -775,7 +785,7 @@ sub fix_ids_and_indices {
}
if (!$endtag) { if ($token->[4]=~m:/>$:) { $endtag=' /'; }; }
$outstring.='<'.$tag.$newparmstring.$endtag.'>';
- if ($lctag eq 'm' || $lctag eq 'script'
+ if ($lctag eq 'm' || $lctag eq 'script' || $lctag eq 'answer'
|| $lctag eq 'display' || $lctag eq 'tex') {
$outstring.=&get_all_text_unbalanced('/'.$lctag,\@parser);
}
@@ -784,7 +794,12 @@ sub fix_ids_and_indices {
unless ($token->[1] eq 'allow') {
$outstring.=''.$token->[1].'>';
}
- }
+ }
+ if ((($token->[1] eq 'part') || ($token->[1] eq 'problem'))
+ && (!$responsecounter)) {
+ my $outstring=''.&mt('Found [_1] without responses',$token->[1]).'';
+ return ($outstring,1);
+ }
} else {
$outstring.=$token->[1];
}
@@ -840,8 +855,7 @@ sub store_metadata {
return ($error,undef);
}
my $dbh = &Apache::lonmysql::get_dbh();
- if (($metadata{'obsolete'}) || ($metadata{'copyright'} eq 'priv') ||
- ($metadata{'copyright'} eq 'custom')) {
+ if (($metadata{'obsolete'}) || ($metadata{'copyright'} eq 'priv')) {
# remove this entry
my $delitem = 'url = '.$dbh->quote($metadata{'url'});
$status = &LONCAPA::lonmetadata::delete_metadata($dbh,undef,$delitem);
@@ -1181,9 +1195,16 @@ sub publish {
# $env{'from.'..} so that it can be used by the phase two handler in
# batch mode
- my $intr_scrout.=
- '';
+ $scrout.=$intr_scrout
+ .&Apache::lonhtmlcommon::row_title()
+ .''.&Apache::lonhtmlcommon::row_closure()
+ .''
+ .&Apache::lonhtmlcommon::end_pick_box();
}
return($scrout,0);
}
@@ -1701,7 +1719,7 @@ sub phasetwo {
$r->print(
'
'.
&mt('View Published Version').''.
- ''.
+ ''.
&mt('Back to Source').'
'.
''.