Diff for /loncom/interface/loncourserespicker.pm between versions 1.7 and 1.13

version 1.7, 2013/11/12 14:36:07 version 1.13, 2015/06/09 21:22:56
Line 151  Inputs: 2. Line 151  Inputs: 2.
     
 Takes incoming title and replaces non-alphanumeric characters with underscore,  Takes incoming title and replaces non-alphanumeric characters with underscore,
 so title can be used as suggested file name (with appended extension) for file  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()  =item &enumerate_course_contents()
Line 162  map url, or symb, for an iteration throu Line 162  map url, or symb, for an iteration throu
 a Course Coordinator. Used to generate numerical IDs to facilitate  a Course Coordinator. Used to generate numerical IDs to facilitate
 (a) storage of lists of maps or resources to be blocked during an exam,  (a) storage of lists of maps or resources to be blocked during an exam,
 (b) processing selected form element during dumping of selected course  (b) processing selected form element during dumping of selected course
     content to Authoring space.      content to Authoring Space.
   
 Inputs: 7   Inputs: 7 
   
Line 245  sub create_picker { Line 245  sub create_picker {
     }      }
     if ($context eq 'dumpdocs') {      if ($context eq 'dumpdocs') {
         $info = '<span class="LC_fontsize_medium">'.          $info = '<span class="LC_fontsize_medium">'.
                 &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.').
                 '</span><br /><br />';                  '</span><br /><br />';
         $startcount = 3 + $numhome;          $startcount = 3 + $numhome;
         $onsubmit = ' onsubmit="return checkUnique(document.'.$formname.',document.'.$formname.'.archive);"';          $onsubmit = ' onsubmit="return checkUnique(document.'.$formname.',document.'.$formname.'.archive);"';
Line 459  sub create_picker { Line 459  sub create_picker {
         $display .= '</fieldset>'.          $display .= '</fieldset>'.
                     '</div><div style="padding:0;clear:both;margin:0;border:0"></div>'.                      '</div><div style="padding:0;clear:both;margin:0;border:0"></div>'.
                     '<div>'.                      '<div>'.
                     '<input type="submit" name="dumpcourse" value="'.&mt("Dump $crstype Content").'" />'.                      '<input type="submit" name="dumpcourse" value="'.&mt("Copy $crstype Content").'" />'.
                     '</div>';                      '</div>';
         $numcount = $count + $startcount;          $numcount = $count + $startcount;
     }      }
     $display .= '</form>';      $display .= '</form>';
     my $scripttag =       my $scripttag = 
         &respicker_javascript($startcount,$numcount,$context,$formname,\%children,          &respicker_javascript($startcount,$numcount,$context,$formname,\%children,
                               \%hierarchy,\@checked_maps);                                \%hierarchy,\@checked_maps,$numhome);
     if ($context eq 'dumpdocs') {      if ($context eq 'dumpdocs') {
         return $scripttag.$display;           return $scripttag.$display; 
     }      }
Line 484  sub create_picker { Line 484  sub create_picker {
         $output .= &Apache::lonhtmlcommon::breadcrumbs('IMS Export').          $output .= &Apache::lonhtmlcommon::breadcrumbs('IMS Export').
                    &Apache::londocs::startContentScreen('tools');                     &Apache::londocs::startContentScreen('tools');
     } elsif ($context eq 'dumpdocs') {      } elsif ($context eq 'dumpdocs') {
          $output .= &Apache::lonhtmlcommon::breadcrumbs('Dump to Authoring Space').           $output .= &Apache::lonhtmlcommon::breadcrumbs('Copying to Authoring Space').
                     &Apache::londocs::startContentScreen('tools');                      &Apache::londocs::startContentScreen('tools');
     }      }
     $output .= $display;      $output .= $display;
Line 498  sub create_picker { Line 498  sub create_picker {
   
 sub respicker_javascript {  sub respicker_javascript {
     my ($startcount,$numitems,$context,$formname,$children,$hierarchy,      my ($startcount,$numitems,$context,$formname,$children,$hierarchy,
         $checked_maps) = @_;          $checked_maps,$numhome) = @_;
     return unless ((ref($children) eq 'HASH') && (ref($hierarchy) eq 'HASH')      return unless ((ref($children) eq 'HASH') && (ref($hierarchy) eq 'HASH')
                    && (ref($checked_maps) eq 'ARRAY'));                     && (ref($checked_maps) eq 'ARRAY'));
     my ($elem,$nested,$nameforelem);      my ($elem,$nested,$nameforelem);
Line 591  EXTRA Line 591  EXTRA
     } elsif ($context eq 'dumpdocs') {      } elsif ($context eq 'dumpdocs') {
         my $blankmsg = &mt('An item selected has no filename set in the "Save as ..." column.');          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 $dupmsg = &mt('Items selected for copying need unique filenames in the "Save as ..." column.');
           my $homemsg = &mt('An Authoring Space needs to be selected.');
           &js_escape(\$blankmsg);
           &js_escape(\$dupmsg);
           &js_escape(\$homemsg);
         $scripttag .= <<"EXTRA";          $scripttag .= <<"EXTRA";
   
 function checkUnique(form,field) {  function checkUnique(form,field) {
     var duplicate = 0;      var duplicate = 0;
     var blank = 0;      var blank = 0;
       var numhome = '$numhome';
     if (field.length > 0) {      if (field.length > 0) {
         for (i=0; i<field.length; i++) {          for (i=0; i<field.length; i++) {
             if (field[i].checked) {              if (field[i].checked) {
Line 635  function checkUnique(form,field) { Line 640  function checkUnique(form,field) {
         alert('$dupmsg');          alert('$dupmsg');
         return false;          return false;
     }      }
       if (numhome > 1) {
           if (!form.authorspace.options[form.authorspace.selectedIndex].value) {
               alert('$homemsg');
               return false;
           }
       }
     return true;      return true;
 }  }
   
Line 685  function writeToOpener(maps,resources) { Line 696  function writeToOpener(maps,resources) {
                 }                  }
             }              }
             if (isResource == 1) {              if (isResource == 1) {
                 if (nesting[elemnum].length > 0) {                  if (nesting[elemnum] != null) {
                     var lastelem = nesting[elemnum].length-1;                      if (nesting[elemnum].length > 0) {
                     if (document.$formname.elements[nesting[elemnum][lastelem]].checked) {                          var lastelem = nesting[elemnum].length-1;
                         include = 0;                          if (document.$formname.elements[nesting[elemnum][lastelem]].checked) {
                               include = 0;
                           }
                     }                      }
                 }                  }
             }              }
Line 730  sub get_navmap_object { Line 743  sub get_navmap_object {
                                                        undef,{'only_body' => 1,}).                                                         undef,{'only_body' => 1,}).
                       '<h2>'.&mt('Resource Display Failed').'</h2>';                          '<h2>'.&mt('Resource Display Failed').'</h2>';  
         } elsif ($context eq 'dumpdocs') {          } elsif ($context eq 'dumpdocs') {
             $outcome = '<h2>'.&mt('Dump to Authoring Space unavilable');              $outcome = '<h2>'.&mt('Copying to Authoring Space unavailable');
         }          }
         $outcome .= '<div class="LC_error">';          $outcome .= '<div class="LC_error">';
         if ($crstype eq 'Community') {          if ($crstype eq 'Community') {
Line 750  sub get_navmap_object { Line 763  sub get_navmap_object {
             if ($context eq 'imsexport') {              if ($context eq 'imsexport') {
                 &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'});                  &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'});
             } else {              } 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') {          } elsif ($context eq 'examblock') {
             $outcome .=  '<href="javascript:window.close();">'.&mt('Close window').'</a>';                       $outcome .=  '<href="javascript:window.close();">'.&mt('Close window').'</a>';         

Removed from v.1.7  
changed lines
  Added in v.1.13


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