[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface courseprefs.pm

raeburn raeburn at source.lon-capa.org
Sat Aug 31 22:09:24 EDT 2013


raeburn		Sun Sep  1 02:09:24 2013 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	courseprefs.pm 
  Log:
  - For 2.11
    - Backport 1.60
  
  
Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.49.2.9 loncom/interface/courseprefs.pm:1.49.2.10
--- loncom/interface/courseprefs.pm:1.49.2.9	Thu Jun 27 03:09:17 2013
+++ loncom/interface/courseprefs.pm	Sun Sep  1 02:09:23 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set configuration settings for a course
 #
-# $Id: courseprefs.pm,v 1.49.2.9 2013/06/27 03:09:17 raeburn Exp $
+# $Id: courseprefs.pm,v 1.49.2.10 2013/09/01 02:09:23 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;




More information about the LON-CAPA-cvs mailing list