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

version 1.44, 2010/02/21 23:38:51 version 1.46, 2010/03/08 13:42:18
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 750  END Line 773  END
  <option value="view">'.&mt('View/Modify/Cancel pending requests').'</option>   <option value="view">'.&mt('View/Modify/Cancel pending requests').'</option>
  <option value="log">'.&mt('View request history').'</option>   <option value="log">'.&mt('View request history').'</option>
 </select></form>'.  </select></form>'.
               &Apache::lonhtmlcommon::row_closure(1).                &Apache::lonhtmlcommon::row_closure().
               &Apache::lonhtmlcommon::row_title(&mt('Type')).'                &Apache::lonhtmlcommon::row_title(&mt('Type')).'
 <form name="mainmenu_coursetype" method="post" action="">  <form name="mainmenu_coursetype" method="post" action="">
 <select size="1" name="crstype">');  <select size="1" name="crstype">');
Line 1667  sub date_setting_table { Line 1690  sub date_setting_table {
     }      }
   
     $table = &Apache::lonhtmlcommon::row_title(&Apache::loncommon::help_open_topic($help_item{$prefix}{'start'}).      $table = &Apache::lonhtmlcommon::row_title(&Apache::loncommon::help_open_topic($help_item{$prefix}{'start'}).
              '&nbsp;'.$datetitles{'start'}).$startform.               '&nbsp;'.&mt($datetitles{'start'})).$startform.
              &Apache::lonhtmlcommon::row_closure(1).               &Apache::lonhtmlcommon::row_closure(1).
              &Apache::lonhtmlcommon::row_title(&Apache::loncommon::help_open_topic($help_item{$prefix}{'end'}).               &Apache::lonhtmlcommon::row_title(&Apache::loncommon::help_open_topic($help_item{$prefix}{'end'}).
              '&nbsp;'.$datetitles{'end'}).$endform.$perpetual.               '&nbsp;'.&mt($datetitles{'end'})).$endform.$perpetual.
              &Apache::lonhtmlcommon::row_closure($closure);               &Apache::lonhtmlcommon::row_closure($closure);
     return $table;      return $table;
 }  }
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.
                &Apache::lonhtmlcommon::row_closure(1).                 &Apache::lonhtmlcommon::row_closure(1).
                  &Apache::lonhtmlcommon::row_title(&mt('Clone?')).
                  '<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_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 2424  sub clone_text { Line 2478  sub clone_text {
 sub coursecode_form {  sub coursecode_form {
     my ($dom,$context,$codetitles,$cat_titles,$cat_order,$num) = @_;      my ($dom,$context,$codetitles,$cat_titles,$cat_order,$num) = @_;
     my $output;      my $output;
     my %rowtitle = (      my %rowtitle = &Apache::lonlocal::texthash (
                     instcode  => 'Course Category',                      instcode  => 'Course Category',
                     crosslist => 'Cross Listed Course',                      crosslist => 'Cross Listed Course',
                    );                     );
Line 2740  sub print_request_outcome { Line 2794  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.46


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