[LON-CAPA-cvs] cvs: loncom /interface courseprefs.pm lonsyllabus.pm
raeburn
raeburn at source.lon-capa.org
Sat Aug 31 21:12:01 EDT 2013
raeburn Sun Sep 1 01:12:01 2013 EDT
Modified files:
/loncom/interface courseprefs.pm lonsyllabus.pm
Log:
- Syllabus options no longer restricted to standard template, or external URL.
- replace textbox for External Syllabus in "General Course Settings" interface
with information about syllabus type in use, and links to View or Edit.
Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.59 loncom/interface/courseprefs.pm:1.60
--- loncom/interface/courseprefs.pm:1.59 Wed Jun 26 21:22:39 2013
+++ loncom/interface/courseprefs.pm Sun Sep 1 01:12:01 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set configuration settings for a course
#
-# $Id: courseprefs.pm,v 1.59 2013/06/26 21:22:39 raeburn Exp $
+# $Id: courseprefs.pm,v 1.60 2013/09/01 01:12:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -367,7 +367,7 @@
'categories' => $lt{'catg'},
'hidefromcat' => $lt{'excc'},
'cloners' => $lt{'clon'},
- 'externalsyllabus' => 'URL of Syllabus',
+ 'externalsyllabus' => 'Syllabus status',
'url' => 'Top Level Map',
'rolenames' => $lt{'rept'},
'loncaparev' => $lt{'lcrv'},
@@ -1694,10 +1694,23 @@
}
ENDSCRIPT
}
+ my $cnum = $env{'course.'.$cid.'.num'};
+ my $syllabus_js = <<ENDSCRIPT;
+function syllabusinfo() {
+ var syllwin = null;
+ var url = '/public/$cdom/$cnum/syllabus?only_body=1';
+ if (!syllwin || syllwin.closed) {
+ syllwin=window.open(url,'syllabuswin','height=480,width=600,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
+ } else {
+ syllwin.focus();
+ }
+}
+ENDSCRIPT
$jscript = '<script type="text/javascript" language="Javascript">'."\n".
'// <![CDATA['."\n".
$browse_js."\n".$categorize_js."\n".$loncaparev_js."\n".
- $cloners_js."\n".'// ]]>'."\n".
+ $cloners_js."\n".
+ $syllabus_js."\n".'//]]>'."\n".
'</script>'."\n".$stubrowse_js."\n";
return $jscript;
}
@@ -1808,6 +1821,7 @@
}
my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype);
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
my $replace;
if ($crstype eq 'Community') {
@@ -1858,10 +1872,10 @@
advanced => 1
},
'externalsyllabus' => {
- text => '<b>'.&mt($itemtext->{'externalsyllabus'}).'</b><br />('.
- &mt('not using syllabus template)'),
- input => 'textbox',
- size => '40',
+ text => '<b>'.&mt($itemtext->{'externalsyllabus'}).'</b><br />'.
+ &mt('(Syllabus type in use)').(' ' x2).
+ &mt('[_1]Edit[_2]','<a href="/public/'.$cdom.'/'.$cnum.'/syllabus?forceedit=1">',
+ '</a>'),
},
'hidefromcat' => {
text => '<b>'.&mt($itemtext->{'hidefromcat'}).'</b><br />'.
@@ -2025,7 +2039,6 @@
}
$datatable .= $owner;
} elsif ($item eq 'co-owners') {
- my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
my $coowners = $env{'course.'.$env{'request.course.id'}.'.internal.co-owners'};
my @currcoown;
if ($coowners) {
@@ -2044,6 +2057,36 @@
$datatable .= &manage_coownership($cnum,$cdom, at currcoown);
}
}
+ } elsif ($item eq 'externalsyllabus') {
+ my $external = $env{'course.'.$env{'request.course.id'}.'.externalsyllabus'};
+ my $uploaded = $env{'course.'.$env{'request.course.id'}.'.uploadedsyllabus'};
+ my $minimal = $env{'course.'.$env{'request.course.id'}.'.minimalsyllabus'};
+ if (($minimal =~/\w/) || ($uploaded =~/\w/)) {
+ if ($minimal =~/\w/) {
+ if ($external =~ m{\Q$minimal\E$}) {
+ undef($external);
+ }
+ } elsif ($uploaded =~/\w/) {
+ if ($external =~ m{\Q$uploaded\E$}) {
+ undef($external);
+ }
+ }
+ } elsif ($external!~/\w/) {
+ undef($external);
+ }
+ if ($external) {
+ $datatable .= &mt('External URL');
+ } elsif ($minimal) {
+ $datatable .= &mt('Minimal template');
+ } elsif ($uploaded) {
+ $datatable .= &mt('Uploaded file');
+ } else {
+ $datatable .= &mt('Standard template');
+ }
+ $datatable .= (' ' x 2).
+ &mt('[_1]View[_2]',
+ '<a href="javascript:syllabusinfo();">',
+ '</a>');
} elsif ($item eq 'loncaparev') {
my $loncaparev = $env{'course.'.$env{'request.course.id'}.'.internal.releaserequired'};
my $showreqd;
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.131 loncom/interface/lonsyllabus.pm:1.132
--- loncom/interface/lonsyllabus.pm:1.131 Sat Aug 31 18:58:57 2013
+++ loncom/interface/lonsyllabus.pm Sun Sep 1 01:12:01 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Syllabus
#
-# $Id: lonsyllabus.pm,v 1.131 2013/08/31 18:58:57 raeburn Exp $
+# $Id: lonsyllabus.pm,v 1.132 2013/09/01 01:12:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -53,7 +53,7 @@
# ------------------------------------------------------------ Get query string
&Apache::loncommon::get_unprocessed_cgi
($ENV{'QUERY_STRING'},['register','forceedit','todocs',
- 'folderpath','title']);
+ 'folderpath','title','only_body']);
# ----------------------------------------------------- Is this even a course?
my $homeserver=&Apache::lonnet::homeserver($cnum,$cdom);
if ($homeserver eq 'no_host') {
@@ -97,7 +97,7 @@
my $uploaded=$courseenv{'uploadedsyllabus'};
my $minimal=$courseenv{'minimalsyllabus'};
- if (($minimal =~/\w/) || ($uploaded =~/\w/)) {
+ if (($minimal =~/\w/) || ($uploaded =~/\w/)) {
my $item;
if ($minimal =~/\w/) {
if ($external =~ m{\Q$minimal\E$}) {
@@ -125,6 +125,9 @@
$env{'form.texengine'});
my %args;
&get_breadcrumbs($cdom,$cnum,$crstype,\%args);
+ if ($env{'form.only_body'}) {
+ $args{'only_body'} = 1;
+ }
$r->print(&Apache::loncommon::start_page("Syllabus",undef,\%args).
$result.
&Apache::loncommon::end_page());
@@ -692,6 +695,9 @@
);
$args->{'add_entries'} = \%loaditem;
}
+ if ($env{'form.only_body'}) {
+ $args->{'only_body'} = 1;
+ }
my $start_page =
&Apache::loncommon::start_page("Syllabus", $rss_link.$js,$args);
if ($start_page) {
More information about the LON-CAPA-cvs
mailing list