--- loncom/interface/londocs.pm 2013/04/01 22:09:56 1.540 +++ loncom/interface/londocs.pm 2013/04/02 20:33:41 1.542 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.540 2013/04/01 22:09:56 raeburn Exp $ +# $Id: londocs.pm,v 1.542 2013/04/02 20:33:41 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -902,7 +902,7 @@ sub print_paste_buffer { my ($pasteform,$form_start,$buttons,$form_end); if ($pasteitems) { $pasteitems .= '
'; - $form_start = '
'; + $form_start = ''; if (@pasteable) { $buttons = ''.(' 'x2); } @@ -1009,6 +1009,7 @@ sub paste_popup_js { my %lt = &Apache::lonlocal::texthash( show => 'Show Options', hide => 'Hide Options', + none => 'No items selected from clipboard.', ); return <<"END"; @@ -1038,11 +1039,33 @@ function showOptions(caller,suffix) { return; } +function validateClipboard() { + var numchk = 0; + if (document.pasteform.pasting.length > 1) { + for (var i=0; i 0) { + return true; + } else { + alert("$lt{'none'}"); + return false; + } +} + END } - sub do_paste_from_buffer { my ($coursenum,$coursedom,$folder,$container,$errors) = @_; @@ -2351,24 +2374,30 @@ sub editor { my ($paste_res,$save_error,$pastemsgarray,$lockerror) = &do_paste_from_buffer($coursenum,$coursedom,$folder,$container, \%paste_errors); - if (ref($pastemsgarray) eq 'ARRAY') { - if (@{$pastemsgarray} > 0) { - - $r->print('

'. - join('
',@{$pastemsgarray}). - '

'); - } - } - if ($lockerror) { - $r->print('

'. - $lockerror. + if (ref($pastemsgarray) eq 'ARRAY') { + if (@{$pastemsgarray} > 0) { + $r->print('

'. + join('
',@{$pastemsgarray}). '

'); } - if ($save_error ne '') { - return $save_error; + } + if ($lockerror) { + $r->print('

'. + $lockerror. + '

'); + } + if ($save_error ne '') { + return $save_error; + } + if ($paste_res) { + my %errortext = &Apache::lonlocal::texthash ( + fail => 'Storage of folder contents failed', + failread => 'Reading folder contents failed', + failstore => 'Storage of folder contents failed', + ); + if ($errortext{$paste_res}) { + $r->print('

'.$errortext{$paste_res}.'

'); } - if ($paste_res ne 'ok') { - $r->print('

'.$paste_res.'

'); } if (keys(%paste_errors) > 0) { $r->print('

'."\n". @@ -3053,6 +3082,7 @@ ENDCUT $cutlink=(< $form_common + $lt{'ct'} $form_end ENDCUT @@ -3070,6 +3100,7 @@ ENDREM $removelink=(< $form_common + $lt{'rm'} $form_end ENDREM @@ -5276,10 +5307,14 @@ sub editing_js { p_rmr1 => 'WARNING: Removing a resource makes associated grades and scores inaccessible!', p_rmr2a => 'Remove[_99]', p_rmr2b => '?[_99]', + p_rmr3a => 'Remove those [_2]', + p_rmr3b => 'items?[_2]', p_ctr1a => 'WARNING: Cutting a resource makes associated grades and scores inaccessible!', p_ctr1b => 'Grades remain inaccessible if resource is pasted into another folder.', p_ctr2a => 'Cut[_98]', p_ctr2b => '?[_98]', + p_ctr3a => 'Cut those[_2]', + p_ctr3b => 'items?[_2]', rpck => 'Enter number to pick (e.g., 3)', imsfile => 'You must choose an IMS package for import', imscms => 'You must select which Course Management System was the source of the IMS package', @@ -5920,6 +5955,8 @@ function checkSubmits() { var numchanges = 0; var form = document.saveactions; var doactions = multiActions(); + var cutwarnings = 0; + var remwarnings = 0; if (doactions == 1) { var remidxlist = document.cumulativeactions.allremoveidx.value; if ((remidxlist != '') && (remidxlist != null)) { @@ -5929,6 +5966,11 @@ function checkSubmits() { if (document.getElementById('remove_'+remidxs[i]).checked) { form.multiremove.value += remidxs[i]+','; numchanges ++; + if (document.getElementById('skip_remove_'+remidxs[i])) { + if (document.getElementById('skip_remove_'+remidxs[i]).value == 0) { + remwarnings ++; + } + } } } } @@ -5941,6 +5983,11 @@ function checkSubmits() { if (document.getElementById('cut_'+cutidxs[i]).checked == true) { form.multicut.value += cutidxs[i]+','; numchanges ++; + if (document.getElementById('skip_cut_'+cutidxs[i])) { + if (document.getElementById('skip_cut_'+cutidxs[i]).value == 0) { + cutwarnings ++; + } + } } } } @@ -6003,8 +6050,25 @@ function checkSubmits() { } } if ((numchanges > 0) || (dosettings == 1)) { - form.submit(); - return true; + if (numchanges > 0) { + if ((cutwarnings > 0) || (remwarnings > 0)) { + if (remwarnings > 0) { + if (!confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr3a"} '+remwarnings+' $lt{"p_rmr3b"}')) { + return false; + } + } + if (cutwarnings > 0) { + if (!confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr3a"} '+cutwarnings+' $lt{"p_ctr3b"}')) { + return false; + } + } + } + form.submit(); + return true; + } else { + form.submit(); + return true; + } } return false; }