[LON-CAPA-cvs] cvs: loncom /homework structuretags.pm /interface loncommon.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 14 Apr 2006 21:09:54 -0000
albertel Fri Apr 14 17:09:54 2006 EDT
Modified files:
/loncom/interface loncommon.pm
/loncom/homework structuretags.pm
Log:
- homeowkr problems now call start_page
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.337 loncom/interface/loncommon.pm:1.338
--- loncom/interface/loncommon.pm:1.337 Fri Apr 14 16:16:02 2006
+++ loncom/interface/loncommon.pm Fri Apr 14 17:09:51 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.337 2006/04/14 20:16:02 albertel Exp $
+# $Id: loncommon.pm,v 1.338 2006/04/14 21:09:51 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2753,7 +2753,10 @@
=item * $notopbar, if true, keep the 'what is this' info but remove the
navigational links
-=item * $bgcolor, used to override the bg coor on a webpage to a specific value
+=item * $bgcolor, used to override the bgcolor on a webpage to a specific value
+
+=item * $notitle, if true keep the nav controls, but remove the title bar
+
=back
@@ -2766,7 +2769,7 @@
sub bodytag {
my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,$customtitle,
- $notopbar,$bgcolor,$hidetitle)=@_;
+ $notopbar,$bgcolor,$notitle)=@_;
$title=&mt($title);
$function = &get_users_function() if (!$function);
my $img=&designparm($function.'.img',$domain);
@@ -2826,7 +2829,7 @@
# Accessibility
$bodytag.=&Apache::lonmenu::menubuttons($forcereg,$forcereg);
- if (!$hidetitle) {
+ if (!$notitle) {
$bodytag.='<h1>LON-CAPA: '.$title.'</h1>';
}
return $bodytag;
@@ -2879,7 +2882,7 @@
$forcereg=1;
}
my $titletable;
- if (!$hidetitle) {
+ if (!$notitle) {
$titletable =
'<table bgcolor="'.$pgbg.'" width="100%" border="0" '.
'cellspacing="3" cellpadding="3">'.
@@ -2924,7 +2927,7 @@
# Explicit link to get inline menu
my $menu='<br /><font size="2" face="Arial, Helvetica, sans-serif"> <a href="/adm/remote?action=collapse">'.&mt('Switch to Inline Menu Mode').'</a></font>';
#
- if ($hidetitle) {
+ if ($notitle) {
return $bodytag;
}
return(<<ENDBODY);
@@ -3131,6 +3134,10 @@
is not auto translated like the $title is
frameset -> if true will start with a <frameset>
rather than <body>
+ no_title -> if true the title bar won't be shown
+ skip_phases -> hash ref of
+ head -> skip the <html><head> generation
+ body -> skip all <body> generation
=back
@@ -3147,21 +3154,29 @@
}
$env{'internal.start_page'}++;
- my $result =
- &Apache::lonxml::xmlbegin().
- &headtag($title,$head_extra,\%head_args).&endheadtag();
- if ($args->{'frameset'}) {
- my $attr_string = &make_attr_string($args->{'force_register'},
- $args->{'add_entries'});
- $result .= "\n<frameset $attr_string>\n";
- } else {
- $result .=
- &bodytag($title,
- $args->{'function'}, $args->{'add_entries'},
- $args->{'only_body'}, $args->{'domain'},
- $args->{'force_register'}, $args->{'body_title'},
- $args->{'no_nav_bar'}, $args->{'bgcolor'});
+ my $result;
+ if (! exists($args->{'skip_phases'}{'head'}) ) {
+ $result.=
+ &Apache::lonxml::xmlbegin().
+ &headtag($title,$head_extra,\%head_args).&endheadtag();
}
+
+ if (! exists($args->{'skip_phases'}{'body'}) ) {
+ if ($args->{'frameset'}) {
+ my $attr_string = &make_attr_string($args->{'force_register'},
+ $args->{'add_entries'});
+ $result .= "\n<frameset $attr_string>\n";
+ } else {
+ $result .=
+ &bodytag($title,
+ $args->{'function'}, $args->{'add_entries'},
+ $args->{'only_body'}, $args->{'domain'},
+ $args->{'force_register'}, $args->{'body_title'},
+ $args->{'no_nav_bar'}, $args->{'bgcolor'},
+ $args->{'no_title'});
+ }
+ }
+
if ($args->{'js_ready'}) {
$result = &js_ready($result);
}
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.343 loncom/homework/structuretags.pm:1.344
--- loncom/homework/structuretags.pm:1.343 Fri Apr 14 16:16:23 2006
+++ loncom/homework/structuretags.pm Fri Apr 14 17:09:54 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.343 2006/04/14 20:16:23 albertel Exp $
+# $Id: structuretags.pm,v 1.344 2006/04/14 21:09:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -85,10 +85,13 @@
$parstack,$parser,$safeeval);
}
- my $page_start;
- if (!defined($found{'html'})) {
+ my %body_args;
+ my $extra_head;
+ if (defined($found{'html'})) {
+ $body_args{'skip_phases'}{'head'}=1;
+ } else {
- my $extra_head = &Apache::lonhtmlcommon::spellheader();
+ $extra_head = &Apache::lonhtmlcommon::spellheader();
my $css_href = &Apache::lonnet::EXT('resource.0.cssfile');
if ($css_href =~ /\S/) {
@@ -102,18 +105,15 @@
"if (typeof swmenu != 'undefined') {swmenu.currentURL=null;}\n".
&Apache::loncommon::browser_and_searcher_javascript().
"\n</script>\n";
-
}
- $page_start .=
- &Apache::loncommon::head($name,$extra_head,
- {'force_register' =>
- ($target ne 'edit') });
}
- if (!defined($found{'body'}) && $env{'request.state'} eq 'construct') {
+ if (defined($found{'body'})) {
+ $body_args{'skip_phases'}{'body'}=1;
+ } elsif (!defined($found{'body'})
+ && $env{'request.state'} eq 'construct') {
if ($target eq 'web' || $target eq 'edit') {
- $page_start.=&Apache::loncommon::bodytag();
- $page_start.=&Apache::lonxml::message_location();
+ # no extra args to bodytag
}
} elsif (!defined($found{'body'})) {
my %add_entries;
@@ -122,27 +122,36 @@
if ($background ne '' ) {
$add_entries{'background'} = $background;
}
+
my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack,
$safeeval);
-
- if ($bgcolor eq '' ) { $bgcolor = '#FFFFFF'; }
- $page_start .=
- &Apache::loncommon::bodytag(undef,undef,\%add_entries,undef,undef,
- 1,undef,undef,$bgcolor,$target,1);
-
- if ( ($target eq 'web' || $target eq 'webgrade')
- && $env{'request.state'} ne 'construct') {
- my ($symb,undef,undef,undef,$publicuser)=
- &Apache::lonxml::whichuser();
- if ($symb eq '' && !$publicuser) {
- my $help = &Apache::loncommon::help_open_topic("Ambiguous_Reference");
- $help=&mt("Browsing resource, all submissions are temporary.")."<br />";
- $page_start .= $help;
- }
+ if ($bgcolor eq '' ) { $bgcolor = '#FFFFFF'; }
+
+ $body_args{'bgcolor'} = $bgcolor;
+ $body_args{'no_title'} = 1;
+ $body_args{'force_register'} = 1;
+ $body_args{'add_entries'} = \%add_entries;
+ }
+
+ my $page_start = &Apache::loncommon::start_page($name,$extra_head,
+ \%body_args);
+
+ if (!defined($found{'body'})
+ && $env{'request.state'} ne 'construct'
+ && ($target eq 'web' || $target eq 'webgrade')) {
+
+ my ($symb,undef,undef,undef,$publicuser)= &Apache::lonxml::whichuser();
+ if ($symb eq '' && !$publicuser) {
+ my $help = &Apache::loncommon::help_open_topic("Ambiguous_Reference");
+ $help=&mt("Browsing resource, all submissions are temporary.")."<br />";
+ $page_start .= $help;
}
- $page_start .= &Apache::lonxml::message_location();
}
+ if (!defined($found{'body'})) {
+ $page_start .= &Apache::lonxml::message_location();
+ }
+
my $form_tag_start;
if (!defined($found{'form'})) {
$form_tag_start='<form name="lonhomework" enctype="multipart/form-data" method="post" action="';
@@ -153,6 +162,7 @@
}
$form_tag_start.='>';
}
+
return ($page_start,$form_tag_start);
}