[LON-CAPA-cvs] cvs: loncom(version_2_6_X) /interface lonpickcourse.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Wed, 02 Jan 2008 11:25:42 -0000


raeburn		Wed Jan  2 06:25:42 2008 EDT

  Modified files:              (Branch: version_2_6_X)
    /loncom/interface	lonpickcourse.pm 
  Log:
  - backport 1.68, 1.69
  
  
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.67.2.1 loncom/interface/lonpickcourse.pm:1.67.2.2
--- loncom/interface/lonpickcourse.pm:1.67.2.1	Wed Nov 28 12:36:11 2007
+++ loncom/interface/lonpickcourse.pm	Wed Jan  2 06:25:38 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.67.2.1 2007/11/28 17:36:11 albertel Exp $
+# $Id: lonpickcourse.pm,v 1.67.2.2 2008/01/02 11:25:38 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -104,7 +104,7 @@
 
     # if called to assign a role in a course to a user via CUSR
     if ($env{'form.form'} eq 'cu' || $env{'form.form'} eq 'studentform') {
-        $r->print(&create_user_javascript($type)); 
+        $r->print(&create_user_javascript($type));
     }
 
     # print javascript functions for choosing a course 
@@ -215,9 +215,30 @@
     if ($env{'form.form'} eq 'portform') {
         $action = '/adm/portfolio';
     }
+    my $numcourses = keys(%courses);
     $r->print('<form name="courselist" method="post" action="'.$action.'">');
+    if ($env{'form.form'} eq 'modifycourse') {
+        if ($numcourses > 0) {
+            my $cctitle = &Apache::lonnet::plaintext('cc',$type);
+            my $dctitle = &Apache::lonnet::plaintext('dc');
+            my $ccrolechk = ' checked="checked" ';
+            my $menuchk = ' ';
+            if ($env{'form.prevphase'} ne '') {
+                 $ccrolechk = ' ';
+                 $menuchk = ' checked="checked" ';
+            }
+            $r->print(
+                '<span class="LC_nobreak"><label>'.
+                '<input type="radio" name="phase" value="ccrole"'.$ccrolechk.'/>'.
+                '&nbsp;'.&mt('Enter the course with the role of [_1].',$cctitle).
+                '</label>'.('&nbsp;'x3).'</span><br />'.
+                '<span class="LC_nobreak"><label>'.
+                '<input type="radio" name="phase" value="menu"'.$menuchk.'/>&nbsp;'.
+                &mt('View or modify course settings which only a [_1] may modify.',$dctitle).
+                '</label></span><br /><br />');
+        }
+    }
     my %by_descrip;
-    my $numcourses = keys(%courses);
     foreach my $course (keys(%courses)) {
         my $descr;
         if (ref($courses{$course}) eq 'HASH') {
@@ -260,7 +281,7 @@
             }
             my $owner = join(', ',@owners);
             $r->print(&course_chooser($multiple,$cdom,$cnum,$cleandesc));
-            $r->print($description.'('.
+            $r->print($description.' ('.
                       (&Apache::lonnet::domain($cdom,'description')?
                        &Apache::lonnet::domain($cdom,'description'):$cdom).")");
             if ($instcode ne '') {
@@ -272,7 +293,7 @@
                 $r->print(', '.&mt('owner').' - '.$owner);
             }
             if ($ttype ne '') {
-                $r->print('('.&unescape($ttype).')');
+                $r->print(' ('.&unescape($ttype).')');
             }
             if ($multiple) { $r->print("</label>\n"); }
             $r->print("<br />\n");
@@ -296,7 +317,6 @@
         $r->print('<input type="hidden" name="setroles" value="'.$env{'form.setroles'}.'" />');
         $r->print('<input type="hidden" name="action" value="rolepicker" />');
     } elsif ($env{'form.form'} eq 'modifycourse') {
-        $r->print('<input type="hidden" name="phase" value="menu" />'."\n");
         $r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','pickedcourse','type','form']));
     } else {
         $r->print('<input type="hidden" name="cnumelement" value="'.
@@ -406,8 +426,10 @@
 <input type="hidden" name="form" value="$formname" />
 |;
     if ($formname eq 'modifycourse') {
-        $output .= '<input type="hidden" name="phase" value="courselist" />';
-    } else {     
+        $output .= '<input type="hidden" name="phase" value="courselist" />'."\n".
+                   '<input type="hidden" name="prevphase" value="'.
+                   $env{'form.prevphase'}.'" />'."\n";
+    } else {
         my $name_input;
         if ($env{'form.cnameelement'} ne '') {
             $name_input = '<input type="hidden" name="cnameelement" value="'.