[LON-CAPA-cvs] cvs: loncom /interface lonmodifycourse.pm lonpickcourse.pm mydesk.tab

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sun, 30 Dec 2007 23:22:41 -0000


This is a MIME encoded message

--raeburn1199056961
Content-Type: text/plain

raeburn		Sun Dec 30 18:22:41 2007 EDT

  Modified files:              
    /loncom/interface	lonpickcourse.pm lonmodifycourse.pm mydesk.tab 
  Log:
  Bug 4323. Ability for DC to enter a course as a Course Coordinator from the Main Menu, in case the user has only one role (DC), so roles screen is skipped on log-in.
  - Some spaces added to text displayed for matched courses in course search.
  
  
--raeburn1199056961
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20071230182241.txt"

Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.67 loncom/interface/lonpickcourse.pm:1.68
--- loncom/interface/lonpickcourse.pm:1.67	Mon Nov  5 23:39:19 2007
+++ loncom/interface/lonpickcourse.pm	Sun Dec 30 18:22:41 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.67 2007/11/06 04:39:19 raeburn Exp $
+# $Id: lonpickcourse.pm,v 1.68 2007/12/30 23:22:41 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,7 +215,29 @@
     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)) {
@@ -260,7 +282,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 +294,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 +318,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 +427,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="'.
Index: loncom/interface/lonmodifycourse.pm
diff -u loncom/interface/lonmodifycourse.pm:1.36 loncom/interface/lonmodifycourse.pm:1.37
--- loncom/interface/lonmodifycourse.pm:1.36	Thu Dec 13 19:24:11 2007
+++ loncom/interface/lonmodifycourse.pm	Sun Dec 30 18:22:41 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # handler for DC-only modifiable course settings
 #
-# $Id: lonmodifycourse.pm,v 1.36 2007/12/14 00:24:11 raeburn Exp $
+# $Id: lonmodifycourse.pm,v 1.37 2007/12/30 23:22:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -108,22 +108,12 @@
     my $action = '/adm/modifycourse';
     my $cctitle = &Apache::lonnet::plaintext('cc',$type);
     my $dctitle = &Apache::lonnet::plaintext('dc');
-    my %lt=&Apache::lonlocal::texthash(
-                    'some' => "Certain settings which control auto-enrollment of students from your institution's student information system.",
-                    'crqo' => 'The total disk space allocated for storage of portfolio files in all groups in a course.',
-                    'tmod' => 'To view or modify these settings use the criteria below to select a course from this domain.',
-    );
-    $r->print('<h3>'.
-              &mt('Course settings which only a [_1] may modify.'
-                  ,$dctitle).'</h3>'.
-              &mt('Although almost all course settings can be modified by a [_1], a number of settings exist which only a [_2] may change:',$cctitle,$dctitle).'
-<ul>
-  <li>'.$lt{'some'}.'</li>
-  <li>'.$lt{'crqo'}.'</li>
-</ul>'.
-$lt{'tmod'}.' ('.$domdesc.')
-<br /><br />
-    ');
+    $r->print(
+        '<h3>'.&mt('Search for a course in the [_1] domain',$domdesc).'</h3>'.
+        &mt('Actions available after selecting a course:').'<ul>'.  
+        '<li>'.&mt('Enter the course with the role of [_1]',$cctitle).'</li>'."\n".
+        '<li>'.&mt('View or modify course settings which only a [_1] may modify.'
+                  ,$dctitle).'</li>'."\n".'</ul>');
     $r->print(&Apache::lonpickcourse::build_filters($filterlist,$type,
                              undef,undef,$filter,$action,'modifycourse'));
 }
@@ -149,18 +139,22 @@
     $filter{'domainfilter'} = $dom;
     my %courses = &Apache::lonpickcourse::search_courses($r,$type,0,
                                                          \%filter);
-    if (keys(%courses) > 0) {
-        $r->print(&mt("Click a 'Select' button to view or modify settings for a [_1] which may only be modified by a [_2] in this domain.",lc($type),$dctitle).'<br /><br />');
-    }
-
     &Apache::lonpickcourse::display_matched_courses($r,$type,0,$action,
                                                     %courses);
     return;
 }
 
 sub print_modification_menu {
-    my ($r,$cdesc) = @_;
+    my ($r,$cdesc,$domdesc) = @_;
     &print_header($r,$cdesc);
+    my $type = 'Course';
+    my $action = '/adm/modifycourse';
+    my $cctitle = &Apache::lonnet::plaintext('cc',$type);
+    my $dctitle = &Apache::lonnet::plaintext('dc');
+    my %lt=&Apache::lonlocal::texthash(
+                    'some' => "Certain settings which control auto-enrollment of students from your institution's student information system.",
+                    'crqo' => 'The total disk space allocated for storage of portfolio files in all groups in a course.',
+    );
     my @menu =
         (
           { text  => 'Modify quota for group portfolio files',
@@ -174,8 +168,14 @@
             }
          );
     my $menu_html = '<h3>'.&mt('View/Modify settings for: ').$cdesc.'</h3>'."\n".
-                    '<form name="menu" method="post" action="/adm/modifycourse" />'."\n".
-                     &hidden_form_elements();
+              &mt('Although almost all course settings can be modified by a [_1], a number of settings exist which only a [_2] may change:',$cctitle,$dctitle).'
+<ul>
+  <li>'.$lt{'some'}.'</li>
+  <li>'.$lt{'crqo'}.'</li>
+</ul>
+<form name="menu" method="post" action="'.$action.'" />'."\n".
+    &hidden_form_elements();
+
     foreach my $menu_item (@menu) {
         $menu_html.='<p>';
         $menu_html.='<font size="+1">';
@@ -189,6 +189,16 @@
     return;
 }
 
+sub print_ccrole_selected {
+    my ($r,$cdesc,$domdesc) = @_;
+    &print_header($r);
+    my ($cdom,$cnum) = split(/_/,$env{'form.pickedcourse'});
+    $r->print('<form name="ccrole" method="post" action="/adm/roles">
+<input type="hidden" name="selectrole" value="1" />
+<input type="hidden" name="newrole" value="cc./'.$cdom.'/'.$cnum.'" />
+</form>');
+}
+
 sub print_settings_display {
     my ($r,$cdom,$cnum,$cdesc,$type) = @_;
     my %enrollvar = &get_enrollment_settings($cdom,$cnum);
@@ -239,7 +249,7 @@
 </p><p>
 <a href="javascript:changePage(document.viewparms,'."'menu'".')">'.$lt{'back'}.'</a>&nbsp;&nbsp;&nbsp;&nbsp;
 <a href="javascript:changePage(document.viewparms,'."'setparms'".')">'.&mt('Modify [_1]-only settings',$dctitle).'</a>'."\n".
-&hidden_form_elements().    
+&hidden_form_elements().
 '</form>');
 }
 
@@ -788,8 +798,14 @@
 </script>
 ENDSCRIPT
     }
+    my $starthash;
+    if ($env{'form.phase'} eq 'ccrole') {
+        $starthash = {
+           add_entries => {'onload' => "javascript:document.ccrole.submit();"},
+                     };
+    }
     $r->print(&Apache::loncommon::start_page('View/Modify Course Settings',
-					     $js));
+					     $js,$starthash));
     my $bread_text = "View/Modify Courses";
     if ($cdesc ne '') {
         $bread_text = "Course Settings: $cdesc"; 
@@ -861,8 +877,9 @@
 sub hidden_form_elements {
     my $hidden_elements = 
       &Apache::lonhtmlcommon::echo_form_input(['gosearch','coursecode',
-                                               'numlocalcc','courseowner',
-                                               'login','coursequota','intarg',                                               'locarg','krbarg','krbver']);
+          'prevphase','numlocalcc','courseowner','login','coursequota','intarg',
+          'locarg','krbarg','krbver','counter'])."\n".
+          '<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" />';
     return $hidden_elements;
 }
 
@@ -882,21 +899,24 @@
         &Apache::lonhtmlcommon::clear_breadcrumbs();
 
         my $phase = $env{'form.phase'};
-        &Apache::lonhtmlcommon::add_breadcrumb
+        if ($phase eq '') {
+            &Apache::lonhtmlcommon::add_breadcrumb
             ({href=>"/adm/modifycourse",
               text=>"Course search"});
-        if ($phase eq '') {
             &print_course_search_page($r,$dom,$domdesc);
         } else {
+            my $firstform = $phase;
+            if ($phase eq 'courselist') {
+                $firstform = 'filterpicker';
+            } 
             &Apache::lonhtmlcommon::add_breadcrumb
-            ({href=>"javascript:changePage(document.$phase,'courselist')",
+            ({href=>"javascript:changePage(document.$firstform,'')",
+              text=>"Course search"},
+              {href=>"javascript:changePage(document.$phase,'courselist')",
               text=>"Choose a course"});
             if ($phase eq 'courselist') {
                 &print_course_selection_page($r,$dom,$domdesc);
             } else {
-                &Apache::lonhtmlcommon::add_breadcrumb
-                ({href=>"javascript:changePage(document.$phase,'menu')",
-                  text=>"Pick action"});
                 my ($checked,$cdesc) = &check_course($r,$dom,$domdesc);
                 my $type = $env{'form.type'};
                 if ($type eq '') {
@@ -904,8 +924,19 @@
                 }
                 if ($checked eq 'ok') {
                     if ($phase eq 'menu') {
-                        &print_modification_menu($r,$cdesc);
+                        &Apache::lonhtmlcommon::add_breadcrumb
+                        ({href=>"javascript:changePage(document.$phase,'menu')",
+                          text=>"Pick action"});
+                        &print_modification_menu($r,$cdesc,$domdesc);
+                    } elsif ($phase eq 'ccrole') {
+                        &Apache::lonhtmlcommon::add_breadcrumb
+                         ({href=>"javascript:changePage(document.$phase,'ccrole')",
+                           text=>"Enter course"});
+                        &print_ccrole_selected($r,$cdesc,$domdesc);
                     } else {
+                        &Apache::lonhtmlcommon::add_breadcrumb
+                        ({href=>"javascript:changePage(document.$phase,'menu')",
+                          text=>"Pick action"});
                         my ($cdom,$cnum) = split(/_/,$env{'form.pickedcourse'});
                         if ($phase eq 'setquota') {
                             &Apache::lonhtmlcommon::add_breadcrumb
Index: loncom/interface/mydesk.tab
diff -u loncom/interface/mydesk.tab:1.89 loncom/interface/mydesk.tab:1.90
--- loncom/interface/mydesk.tab:1.89	Sun Dec 30 18:14:26 2007
+++ loncom/interface/mydesk.tab	Sun Dec 30 18:22:41 2007
@@ -79,7 +79,7 @@
 6:2:author:rau:res.gif:resource[_1]:space[_1]:go('/res/$udom/$uname/?launch=1');:Browse published resources:cnt
 6:2:author:rca:res.gif:co res[_1]:space[_2]:go('/res/$udom/$uname/?launch=1');:Browse published resources:cnt
 6:3:clear
-6:3:pccc:$requested_domain:mcrs.gif:modify:course:go('/adm/modifycourse');:Modify course settings:cmn
+6:3:pccc:$requested_domain:mcrs.gif:modify:course:go('/adm/modifycourse');:View or modify a course:cmn
 7:1:clear
 7:1:pwhn:$crs:new.gif:what is[_1]:new[_1]:go('/adm/whatsnew');:What's new?:cmn
 7:2:clear

--raeburn1199056961--