Diff for /loncom/interface/lonrequestcourse.pm between versions 1.43 and 1.45

version 1.43, 2010/01/14 20:08:13 version 1.45, 2010/02/25 08:18:32
Line 176  sub handler { Line 176  sub handler {
         &get_breadcrumbs($dom,$action,\$state,\%states,\%trail);          &get_breadcrumbs($dom,$action,\$state,\%states,\%trail);
     if ($action eq 'display') {      if ($action eq 'display') {
         if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) {          if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) {
             my $namespace = 'courserequestqueue';  
             if ($env{'form.cnum'} ne '') {              if ($env{'form.cnum'} ne '') {
                 my $cnum = $env{'form.cnum'};                  my $cnum = $env{'form.cnum'};
                 my $reqkey = $cnum.'_approval';                  my $reqkey = $cnum.'_approval';
Line 275  sub handler { Line 274  sub handler {
             $jscript = &mainmenu_javascript();              $jscript = &mainmenu_javascript();
         } else {          } else {
             $jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored);              $jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored);
               if ($state eq 'courseinfo') {
                   $jscript .= &cloning_javascript();
               }
         }          }
     }      }
   
Line 354  function setAction(courseForm) { Line 356  function setAction(courseForm) {
 END  END
 }  }
   
   sub cloning_javascript {
       return <<"END";
   function setCloneDisplay(courseForm) {
       if (courseForm.cloning.length > 1) {    
           for (var i=0; i<courseForm.cloning.length; i++) {
               if (courseForm.cloning[i].checked) {
                   if (courseForm.cloning[i].value == 1) {
                       document.getElementById('cloneoptions').style.display="block";;
                   }
               }
           }
       }
   }
   END
   }
   
 sub get_breadcrumbs {  sub get_breadcrumbs {
     my ($dom,$action,$state,$states,$trail) = @_;      my ($dom,$action,$state,$states,$trail) = @_;
     my ($crumb,$newinstcode,$codechk,$checkedcode,$numtitles,$description);      my ($crumb,$newinstcode,$codechk,$checkedcode,$numtitles,$description);
Line 462  sub form_elements { Line 480  sub form_elements {
             },              },
             courseinfo => {              courseinfo => {
                 cdescr           => 'text',                  cdescr           => 'text',
                   cloning          => 'radio', 
                 clonecrs         => 'text',                  clonecrs         => 'text',
                 clonedom         => 'selectbox',                  clonedom         => 'selectbox',
                 datemode         => 'radio',                  datemode         => 'radio',
Line 597  sub onload_action { Line 616  sub onload_action {
         if ($state eq 'crstype') {          if ($state eq 'crstype') {
             $loaditems{'onload'} = 'javascript:setAction(document.mainmenu_action);javascript:setType(document.mainmenu_coursetype)';              $loaditems{'onload'} = 'javascript:setAction(document.mainmenu_action);javascript:setType(document.mainmenu_coursetype)';
         } else {          } else {
             $loaditems{'onload'} = 'javascript:setFormElements(document.requestcrs)';              $loaditems{'onload'} = 'javascript:setFormElements(document.requestcrs);';
           }
           if ($state eq 'courseinfo') {
               $loaditems{'onload'} .= 'javascript:setCloneDisplay(document.requestcrs);';
         }          }
     }      }
     return \%loaditems;      return \%loaditems;
Line 2169  sub print_review { Line 2191  sub print_review {
   
     my %ctxt = &clone_text();      my %ctxt = &clone_text();
     $inst_headers .= '<th>'.&mt('Clone From').'</th>';      $inst_headers .= '<th>'.&mt('Clone From').'</th>';
     if (($env{'form.clonecrs'} =~ /^$match_name$/) &&       if (($env{'form.cloning'}) &&
           ($env{'form.clonecrs'} =~ /^$match_name$/) && 
         ($env{'form.clonedom'} =~ /^$match_domain$/)) {          ($env{'form.clonedom'} =~ /^$match_domain$/)) {
         my $canclone = &Apache::loncoursequeueadmin::can_clone_course($env{'user.name'},          my $canclone = &Apache::loncoursequeueadmin::can_clone_course($env{'user.name'},
                            $env{'user.domain'},$env{'form.clonecrs'},$env{'form.clonedom'},                             $env{'user.domain'},$env{'form.clonecrs'},$env{'form.clonedom'},
Line 2351  function validateForm() { Line 2374  function validateForm() {
     }      }
     nextPage(document.$formname,'$next');      nextPage(document.$formname,'$next');
 }  }
   
   function toggleCloning() {
       var willclone;
       if (document.$formname.cloning.length > 1) {
           for (var i=0; i<document.$formname.cloning.length; i++) {
               if (document.$formname.cloning[i].checked) {
                   willclone = document.$formname.cloning[i].value;
               }
           }
       }
       if (willclone == 1) {
           document.getElementById('cloneoptions').style.display="block";
       } else {
           document.getElementById('cloneoptions').style.display="none";
           document.$formname.clonecrs.value = '';
       }
   }
   
 // ]]  // ]]
 </script>  </script>
   
Line 2361  ENDJS Line 2402  ENDJS
         $title = &mt('Brief Community Description');          $title = &mt('Brief Community Description');
         $clonetitle = &mt('Clone content and settings from an existing community?');          $clonetitle = &mt('Clone content and settings from an existing community?');
     }      }
     my $output .= $js_validate."\n".'<div>'.&Apache::lonhtmlcommon::start_pick_box().      my $output .= $js_validate."\n".&Apache::lonhtmlcommon::start_pick_box().
                   &Apache::lonhtmlcommon::row_headline().                    &Apache::lonhtmlcommon::row_headline().
                   '<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Description').'&nbsp;'.$title.'</h3>'.                    '<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Description').'&nbsp;'.$title.'</h3>'.
                   &Apache::lonhtmlcommon::row_closure(1).                    &Apache::lonhtmlcommon::row_closure(1).
Line 2377  ENDJS Line 2418  ENDJS
     $output .= $home_server_pick.      $output .= $home_server_pick.
                &Apache::lonhtmlcommon::row_closure().                 &Apache::lonhtmlcommon::row_closure().
                &Apache::lonhtmlcommon::row_headline().                 &Apache::lonhtmlcommon::row_headline().
                '<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Clone').'&nbsp;'.$clonetitle.'</h3>'.                  '<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Clone').'&nbsp;'.$clonetitle.
                  '<label><input type="radio" name="cloning" value="1" '.
                  'onclick="javascript:toggleCloning()" />'.
                  &mt('Yes').('&nbsp;'x2).'</label><label>'.
                  '<input type="radio" name="cloning" value="0" '.
                  'onclick="javascript:toggleCloning()" />'.&mt('No').'</label>'.
                  '</h3>'.
                &Apache::lonhtmlcommon::row_closure(1).                 &Apache::lonhtmlcommon::row_closure(1).
                  &Apache::lonhtmlcommon::row_headline().
                  '<div id="cloneoptions" style="display: none" >'.
                  &Apache::lonhtmlcommon::start_pick_box().
                &clone_form($dom,$formname,$crstype).                 &clone_form($dom,$formname,$crstype).
                &Apache::lonhtmlcommon::end_pick_box().'</div>'."\n";                 &Apache::lonhtmlcommon::end_pick_box().'</div>'.
                  &Apache::lonhtmlcommon::end_pick_box()."\n";
     return $output;      return $output;
 }  }
   
Line 2741  sub print_request_outcome { Line 2792  sub print_request_outcome {
     }      }
     my $clonecrs = '';      my $clonecrs = '';
     my $clonedom = '';      my $clonedom = '';
     if (($env{'form.clonecrs'} =~ /^($match_courseid)$/) &&       if (($env{'form.cloning'}) &&
           ($env{'form.clonecrs'} =~ /^($match_courseid)$/) && 
         ($env{'form.clonedom'} =~ /^($match_domain)$/)) {          ($env{'form.clonedom'} =~ /^($match_domain)$/)) {
         my $clonehome = &Apache::lonnet::homeserver($env{'form.clonecrs'},          my $clonehome = &Apache::lonnet::homeserver($env{'form.clonecrs'},
                                                     $env{'form.clonedom'});                                                      $env{'form.clonedom'});
Line 2934  sub print_request_outcome { Line 2986  sub print_request_outcome {
                 }                  }
             }              }
         }          }
         my ($statusresult);          ($storeresult,my $updateresult) = 
         if ($requestkey =~ /^($match_domain)_($match_courseid)$/) {              &Apache::loncoursequeueadmin::update_coursereq_status(\%reqhash,$dom,
             $storeresult = &Apache::lonnet::store_userdata(\%reqhash,$requestkey,                  $cnum,$reqstatus,'request');
                                                            'courserequests');  
             if ($storeresult eq 'ok') {  
                 my %status = (  
                                  'status:'.$dom.':'.$cnum => $reqstatus,  
                              );  
                 $statusresult = &Apache::lonnet::put('courserequests',\%status);  
             }  
         } else {  
             $storeresult = 'error: invalid requestkey format';   
         }  
         if ($storeresult ne 'ok') {  
             $output .=  '<span class="LC_warning">'.&mt('An error occurred saving a record of the details of your request: [_1].',$storeresult).'</span><br />';  
             &Apache::lonnet::logthis("Error saving course request - $requestkey for $env{'user.name'}:$env{'user.domain'} - $storeresult");  
         } elsif ($statusresult ne 'ok') {  
             $output .= '<span class="LC_warning">'.&mt('An error occurred saving a record of the status of your request: [_1].',$statusresult).'</span><br />';  
             &Apache::lonnet::logthis("Error saving course request status for  $requestkey (for $env{'user.name'}:$env{'user.domain'}) - $statusresult");  
         }  
         if ($modified && $queued && $storeresult eq 'ok') {          if ($modified && $queued && $storeresult eq 'ok') {
             if ($crstype eq 'community') {              if ($crstype eq 'community') {
                 $output .= '<p>'.&mt('Your community request has been updated').'</p>';                  $output .= '<p>'.&mt('Your community request has been updated').'</p>';
Line 2963  sub print_request_outcome { Line 2998  sub print_request_outcome {
             $output .= &notification_information($disposition,$req_notifylist,$cnum,$now);              $output .= &notification_information($disposition,$req_notifylist,$cnum,$now);
         }          }
         if ($validationerror ne '') {          if ($validationerror ne '') {
             $output .= '<span class="LC_warning">'.&mt('An error occurred validating your request with institutional data sources: [_1].',$validationerror).'</p>';              $output .= '<p class="LC_warning">'.&mt('An error occurred validating your request with institutional data sources: [_1].',$validationerror).'</p>';
           }
           if ($updateresult) {
               $output .= $updateresult;
         }          }
     }      }
     if ($creationresult ne '') {      if ($creationresult ne '') {
Line 3139  sub notification_information { Line 3177  sub notification_information {
                    '</div>';                     '</div>';
     } else {      } else {
         $output .= '<div class="LC_warning">'.          $output .= '<div class="LC_warning">'.
                    &mt('Your request status is: [_1].',$disposition).                      &mt('Your request status is: [_1].',$disposition).
                    '</div>'                     '</div>';
     }      }
     return $output;      return $output;
 }  }

Removed from v.1.43  
changed lines
  Added in v.1.45


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>