--- loncom/interface/loncourserespicker.pm 2013/11/12 14:36:07 1.7 +++ loncom/interface/loncourserespicker.pm 2015/04/09 17:57:05 1.12 @@ -1,6 +1,6 @@ # The LearningOnline Network # -# $Id: loncourserespicker.pm,v 1.7 2013/11/12 14:36:07 raeburn Exp $ +# $Id: loncourserespicker.pm,v 1.12 2015/04/09 17:57:05 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -151,7 +151,7 @@ Inputs: 2. Takes incoming title and replaces non-alphanumeric characters with underscore, so title can be used as suggested file name (with appended extension) for file -copied from course to Authoring space. +copied from course to Authoring Space. =item &enumerate_course_contents() @@ -162,7 +162,7 @@ map url, or symb, for an iteration throu a Course Coordinator. Used to generate numerical IDs to facilitate (a) storage of lists of maps or resources to be blocked during an exam, (b) processing selected form element during dumping of selected course - content to Authoring space. + content to Authoring Space. Inputs: 7 @@ -245,7 +245,7 @@ sub create_picker { } if ($context eq 'dumpdocs') { $info = ''. - &mt('Choose the uploaded course items and templated pages/problems to be copied to Authoring space.'). + &mt('Choose the uploaded course items and templated pages/problems to be copied to Authoring Space.'). '

'; $startcount = 3 + $numhome; $onsubmit = ' onsubmit="return checkUnique(document.'.$formname.',document.'.$formname.'.archive);"'; @@ -459,14 +459,14 @@ sub create_picker { $display .= ''. '
'. '
'. - ''. + ''. '
'; $numcount = $count + $startcount; } $display .= ''; my $scripttag = &respicker_javascript($startcount,$numcount,$context,$formname,\%children, - \%hierarchy,\@checked_maps); + \%hierarchy,\@checked_maps,$numhome); if ($context eq 'dumpdocs') { return $scripttag.$display; } @@ -484,7 +484,7 @@ sub create_picker { $output .= &Apache::lonhtmlcommon::breadcrumbs('IMS Export'). &Apache::londocs::startContentScreen('tools'); } elsif ($context eq 'dumpdocs') { - $output .= &Apache::lonhtmlcommon::breadcrumbs('Dump to Authoring Space'). + $output .= &Apache::lonhtmlcommon::breadcrumbs('Copying to Authoring Space'). &Apache::londocs::startContentScreen('tools'); } $output .= $display; @@ -498,7 +498,7 @@ sub create_picker { sub respicker_javascript { my ($startcount,$numitems,$context,$formname,$children,$hierarchy, - $checked_maps) = @_; + $checked_maps,$numhome) = @_; return unless ((ref($children) eq 'HASH') && (ref($hierarchy) eq 'HASH') && (ref($checked_maps) eq 'ARRAY')); my ($elem,$nested,$nameforelem); @@ -591,11 +591,13 @@ EXTRA } elsif ($context eq 'dumpdocs') { my $blankmsg = &mt('An item selected has no filename set in the "Save as ..." column.'); my $dupmsg = &mt('Items selected for copying need unique filenames in the "Save as ..." column.'); + my $homemsg = &mt('An Authoring Space needs to be selected.'); $scripttag .= <<"EXTRA"; function checkUnique(form,field) { var duplicate = 0; var blank = 0; + var numhome = '$numhome'; if (field.length > 0) { for (i=0; i 1) { + if (!form.authorspace.options[form.authorspace.selectedIndex].value) { + alert('$homemsg'); + return false; + } + } return true; } @@ -685,10 +693,12 @@ function writeToOpener(maps,resources) { } } if (isResource == 1) { - if (nesting[elemnum].length > 0) { - var lastelem = nesting[elemnum].length-1; - if (document.$formname.elements[nesting[elemnum][lastelem]].checked) { - include = 0; + if (nesting[elemnum] != null) { + if (nesting[elemnum].length > 0) { + var lastelem = nesting[elemnum].length-1; + if (document.$formname.elements[nesting[elemnum][lastelem]].checked) { + include = 0; + } } } } @@ -730,7 +740,7 @@ sub get_navmap_object { undef,{'only_body' => 1,}). '

'.&mt('Resource Display Failed').'

'; } elsif ($context eq 'dumpdocs') { - $outcome = '

'.&mt('Dump to Authoring Space unavilable'); + $outcome = '

'.&mt('Copying to Authoring Space unavailable'); } $outcome .= '
'; if ($crstype eq 'Community') { @@ -750,7 +760,7 @@ sub get_navmap_object { if ($context eq 'imsexport') { &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'}); } else { - &Apache::lonnet::logthis('Dump to Authoring Space failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'}); + &Apache::lonnet::logthis('Copying to Authoring Space failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'}); } } elsif ($context eq 'examblock') { $outcome .= ''.&mt('Close window').'';