[LON-CAPA-cvs] cvs: loncom /interface lonrss.pm lonsyllabus.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 21 Mar 2006 21:25:34 -0000
albertel Tue Mar 21 16:25:34 2006 EDT
Modified files:
/loncom/interface lonsyllabus.pm lonrss.pm
Log:
- trying to move more towards start_page
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.48 loncom/interface/lonsyllabus.pm:1.49
--- loncom/interface/lonsyllabus.pm:1.48 Wed Mar 15 14:41:26 2006
+++ loncom/interface/lonsyllabus.pm Tue Mar 21 16:25:33 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Syllabus
#
-# $Id: lonsyllabus.pm,v 1.48 2006/03/15 19:41:26 albertel Exp $
+# $Id: lonsyllabus.pm,v 1.49 2006/03/21 21:25:33 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -56,25 +56,19 @@
if ($homeserver eq 'no_host') {
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
- $r->print(&Apache::loncommon::startpage('No syllabus available').
- &mt('No syllabus available').
- &Apache::loncommon::end_page());
+ &Apache::loncommon::simple_error_page($r,'No syllabus available',
+ 'No syllabus available');
return OK;
}
# ------------------------------------- There is such a course, get environment
my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum);
# ------------------------------------------------------------ Print the screen
- my $feedurl='http://'.$ENV{'HTTP_HOST'}.'/public/'.$cdom.'/'.$cnum.'/Course_Announcements.rss';
- if ($target ne 'tex') {
- my $html=&Apache::lonxml::xmlbegin();
- my $head=&Apache::loncommon::headtag('The LearningOnline Network with CAPA');
- $r->print(<<ENDDOCUMENT);
-$html
-$head
-<link rel="alternate" type="application/rss+xml" title="Course Announcements" href="$feedurl" />
-ENDDOCUMENT
- } else {
+
+ my $rss_link =
+ &Apache::lonrss::rss_link('http://'.$ENV{'HTTP_HOST'}.'/public/'.$cdom.'/'.$cnum.'/Course_Announcements.rss');
+
+ if ($target eq 'tex') {
$r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}));
}
# ----------------------------------------------------- Force menu registration
@@ -86,6 +80,7 @@
}
# -------------------------------------------------- Let's see who handles this
my $externalsyllabus=$courseenv{'externalsyllabus'};
+
if ($externalsyllabus=~/\w/) {
$r->print(&Apache::loncommon::endheadtag());
if ($env{'form.wrapperdisplay'} eq 'menu') {
@@ -157,25 +152,29 @@
# ----------------------------------------------------------------- Make header
if ($target ne 'tex') {
- $r->print(&Apache::lonhtmlcommon::htmlareaheaders().
- &Apache::loncommon::endheadtag().
- &Apache::loncommon::bodytag("Syllabus",$forcestudent,$addentries,'',$cdom,$env{'form.register'}));
- $r->print('<h1>'.$courseenv{'description'}.'</h1><h3>'.
+ my $start_page =
+ &Apache::loncommon::start_page("Syllabus", $rss_link,
+ {'function' => $forcestudent,
+ 'add_entries' => $addentries,
+ 'domain' => $cdom,
+ 'force_register' =>
+ $env{'form.register'},});
+
+ $r->print($start_page.'<h1>'.$courseenv{'description'}.'</h1><h3>'.
$Apache::lonnet::domaindescription{$cdom}.'</h3>');
} else {
$r->print('\noindent{\large\textbf{'.$courseenv{'description'}.'}}\\\\\\\\\textbf{'.
$Apache::lonnet::domaindescription{$cdom}.'}\\\\');
}
# -------------------------------------------------------------- Announcements?
+ my $day = &Apache::lonannounce::showday(time,2,
+ &Apache::lonannounce::readcalendar($cdom.'_'.$cnum));
if ($target ne 'tex') {
- $r->print(&Apache::lonannounce::showday(time,2,
- &Apache::lonannounce::readcalendar($cdom.'_'.$cnum)).
- &Apache::lonrss::advertisefeeds($cnum,$cdom));
+ $r->print($day. &Apache::lonrss::advertisefeeds($cnum,$cdom));
} else {
- $r->print(&Apache::lonxml::xmlparse($r,'tex',
- &Apache::lonannounce::showday(time,2,
- &Apache::lonannounce::readcalendar($cdom.'_'.$cnum))));
+ $r->print(&Apache::lonxml::xmlparse($r,'tex',$day));
}
+
# -------------------------------------------------------- Get course personnel
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles($cdom.'/'.$cnum);
if ($target ne 'tex') {
Index: loncom/interface/lonrss.pm
diff -u loncom/interface/lonrss.pm:1.11 loncom/interface/lonrss.pm:1.12
--- loncom/interface/lonrss.pm:1.11 Thu Mar 16 15:03:11 2006
+++ loncom/interface/lonrss.pm Tue Mar 21 16:25:33 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# RSS Feeder
#
-# $Id: lonrss.pm,v 1.11 2006/03/16 20:03:11 albertel Exp $
+# $Id: lonrss.pm,v 1.12 2006/03/21 21:25:33 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -97,6 +97,12 @@
}
}
+sub rss_link {
+ my ($url) = @_;
+ return qq|<link rel="alternate" type="application/rss+xml" title="Course Announcements" href="$url" />|;
+
+}
+
{
my $feedcounter;
sub addentry {