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

version 1.44, 2010/02/21 23:38:51 version 1.45, 2010/02/25 08:18:32
Line 274  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 353  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 461  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 596  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 2168  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 2350  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 2360  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 2376  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 2740  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'});

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


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