--- loncom/interface/lonrequestcourse.pm 2010/02/21 23:38:51 1.44 +++ loncom/interface/lonrequestcourse.pm 2010/02/25 08:18:32 1.45 @@ -1,7 +1,7 @@ # The LearningOnline Network # Request a course # -# $Id: lonrequestcourse.pm,v 1.44 2010/02/21 23:38:51 raeburn Exp $ +# $Id: lonrequestcourse.pm,v 1.45 2010/02/25 08:18:32 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -274,6 +274,9 @@ sub handler { $jscript = &mainmenu_javascript(); } else { $jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored); + if ($state eq 'courseinfo') { + $jscript .= &cloning_javascript(); + } } } @@ -353,6 +356,22 @@ function setAction(courseForm) { END } +sub cloning_javascript { + return <<"END"; +function setCloneDisplay(courseForm) { + if (courseForm.cloning.length > 1) { + for (var i=0; i { cdescr => 'text', + cloning => 'radio', clonecrs => 'text', clonedom => 'selectbox', datemode => 'radio', @@ -596,7 +616,10 @@ sub onload_action { if ($state eq 'crstype') { $loaditems{'onload'} = 'javascript:setAction(document.mainmenu_action);javascript:setType(document.mainmenu_coursetype)'; } 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; @@ -2168,7 +2191,8 @@ sub print_review { my %ctxt = &clone_text(); $inst_headers .= ''.&mt('Clone From').''; - if (($env{'form.clonecrs'} =~ /^$match_name$/) && + if (($env{'form.cloning'}) && + ($env{'form.clonecrs'} =~ /^$match_name$/) && ($env{'form.clonedom'} =~ /^$match_domain$/)) { my $canclone = &Apache::loncoursequeueadmin::can_clone_course($env{'user.name'}, $env{'user.domain'},$env{'form.clonecrs'},$env{'form.clonedom'}, @@ -2350,6 +2374,24 @@ function validateForm() { } nextPage(document.$formname,'$next'); } + +function toggleCloning() { + var willclone; + if (document.$formname.cloning.length > 1) { + for (var i=0; i @@ -2360,7 +2402,7 @@ ENDJS $title = &mt('Brief Community Description'); $clonetitle = &mt('Clone content and settings from an existing community?'); } - my $output .= $js_validate."\n".'
'.&Apache::lonhtmlcommon::start_pick_box(). + my $output .= $js_validate."\n".&Apache::lonhtmlcommon::start_pick_box(). &Apache::lonhtmlcommon::row_headline(). '

'.&Apache::loncommon::help_open_topic('Course_Request_Description').' '.$title.'

'. &Apache::lonhtmlcommon::row_closure(1). @@ -2376,10 +2418,20 @@ ENDJS $output .= $home_server_pick. &Apache::lonhtmlcommon::row_closure(). &Apache::lonhtmlcommon::row_headline(). - '

'.&Apache::loncommon::help_open_topic('Course_Request_Clone').' '.$clonetitle.'

'. + '

'.&Apache::loncommon::help_open_topic('Course_Request_Clone').' '.$clonetitle. + ''. + '

'. &Apache::lonhtmlcommon::row_closure(1). + &Apache::lonhtmlcommon::row_headline(). + ''."\n"; + &Apache::lonhtmlcommon::end_pick_box().'
'. + &Apache::lonhtmlcommon::end_pick_box()."\n"; return $output; } @@ -2740,7 +2792,8 @@ sub print_request_outcome { } my $clonecrs = ''; my $clonedom = ''; - if (($env{'form.clonecrs'} =~ /^($match_courseid)$/) && + if (($env{'form.cloning'}) && + ($env{'form.clonecrs'} =~ /^($match_courseid)$/) && ($env{'form.clonedom'} =~ /^($match_domain)$/)) { my $clonehome = &Apache::lonnet::homeserver($env{'form.clonecrs'}, $env{'form.clonedom'});