--- loncom/interface/londocs.pm 2013/12/27 15:11:25 1.484.2.45 +++ loncom/interface/londocs.pm 2013/03/13 00:29:09 1.536 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.484.2.45 2013/12/27 15:11:25 raeburn Exp $ +# $Id: londocs.pm,v 1.536 2013/03/13 00:29:09 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -41,8 +41,6 @@ use Apache::lonclonecourse; use Apache::lonnavmaps; use Apache::lonnavdisplay(); use Apache::lonextresedit(); -use Apache::lontemplate(); -use Apache::lonsimplepage(); use HTML::Entities; use HTML::TokeParser; use GDBM_File; @@ -58,7 +56,6 @@ my $hashtied; my %alreadyseen=(); my $hadchanges; -my $suppchanges; my %help=(); @@ -82,11 +79,7 @@ sub storemap { $map,1,$report); if ($errtext) { return ($errtext,2); } - if ($map =~ /^default/) { - $hadchanges=1; - } else { - $suppchanges=1; - } + $hadchanges=1; return ($errtext,0); } @@ -143,28 +136,8 @@ sub clean { sub dumpcourse { my ($r) = @_; my $crstype = &Apache::loncommon::course_type(); - my ($starthash,$js); - unless (($env{'form.authorspace'}) && ($env{'form.authorfolder'}=~/\w/)) { - $js = <<"ENDJS"; - -ENDJS - $starthash = { - add_entries => {'onload' => "hide_searching();"}, - }; - } - $r->print(&Apache::loncommon::start_page('Copy '.$crstype.' Content to Authoring Space',$js,$starthash)."\n". - &Apache::lonhtmlcommon::breadcrumbs('Copy '.$crstype.' Content to Authoring Space')."\n"); + $r->print(&Apache::loncommon::start_page('Dump '.$crstype.' Content to Authoring Space')."\n". + &Apache::lonhtmlcommon::breadcrumbs('Dump '.$crstype.' Content to Authoring Space')."\n"); $r->print(&startContentScreen('tools')); my ($home,$other,%outhash)=&authorhosts(); unless ($home) { @@ -183,407 +156,118 @@ ENDJS $r->print('
'.
- join('
',@{$pastemsgarray}).
+ if (ref($pastemsgarray) eq 'ARRAY') {
+ if (@{$pastemsgarray} > 0) {
+
+ $r->print('
'.
+ join('
',@{$pastemsgarray}).
+ '
'. + $lockerror. '
'); } - } - 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 ($save_error ne '') { + return $save_error; } + if ($paste_res ne 'ok') { + $r->print(''.$paste_res.'
'); } if (keys(%paste_errors) > 0) { - $r->print(''."\n". + $r->print('
'."\n". &mt('The following files are either dependencies of a web page or references within a folder and/or composite page which could not be copied during the paste operation:')."\n". '
'.$output.'
'); - } - } + } $r->print($upload_output); -# Rename, cut, copy or remove a single resource if (&handle_edit_cmd()) { my $contentchg; - if ($env{'form.cmd'} =~ m{^(del|cut)_}) { + if ($env{'form.cmd'} =~ /^(del|cut)_/) { $contentchg = 1; } ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container,$contentchg); return $errtext if ($fatal); } - -# Cut, copy and/or remove multiple resources - if ($env{'form.multichange'}) { - my %allchecked = ( - cut => {}, - remove => {}, - ); - my $needsupdate; - foreach my $which (keys(%allchecked)) { - $env{'form.multi'.$which} =~ s/,$//; - if ($env{'form.multi'.$which}) { - map { $allchecked{$which}{$_} = 1; } split(/,/,$env{'form.multi'.$which}); - if (ref($allchecked{$which}) eq 'HASH') { - $needsupdate += scalar(keys(%{$allchecked{$which}})); - } - } - } - if ($needsupdate) { - my $haschanges = 0; - my %curr_groups = &Apache::longroup::coursegroups(); - my $total = scalar(@LONCAPA::map::order) - 1; - for (my $i=$total; $i>=0; $i--) { - my $res = $LONCAPA::map::order[$i]; - my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]); - $name=&LONCAPA::map::qtescape($name); - $url=&LONCAPA::map::qtescape($url); - next unless ($name && $url); - my %denied = - &action_restrictions($coursenum,$coursedom,$url, - $env{'form.folderpath'},\%curr_groups); - foreach my $which (keys(%allchecked)) { - next if ($denied{$which}); - next unless ($allchecked{$which}{$res}); - if ($which eq 'remove') { - if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) && - ($url!~/$LONCAPA::assess_page_seq_re/)) { - &Apache::lonnet::removeuploadedurl($url); - } else { - &LONCAPA::map::makezombie($res); - } - splice(@LONCAPA::map::order,$i,1); - $haschanges ++; - } elsif ($which eq 'cut') { - &LONCAPA::map::makezombie($res); - splice(@LONCAPA::map::order,$i,1); - $haschanges ++; - } - } - } - if ($haschanges) { - ($errtext,$fatal) = - &storemap($coursenum,$coursedom,$folder.'.'.$container,1); - return $errtext if ($fatal); - } - } - } - # Group import/search if ($env{'form.importdetail'}) { my @imports; @@ -2919,17 +2167,8 @@ sub editor { $r->print(''); } - my ($to_show,$output,@allidx,@allmapidx,%filters,%lists,%curr_groups); - %filters = ( - canremove => [], - cancut => [], - cancopy => [], - hiddenresource => [], - encrypturl => [], - randomorder => [], - randompick => [], - ); - %curr_groups = &Apache::longroup::coursegroups(); + my ($to_show,$output); + &Apache::loncommon::start_data_table_count(); #setup a row counter foreach my $res (@LONCAPA::map::order) { my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]); @@ -2937,24 +2176,16 @@ sub editor { $url=&LONCAPA::map::qtescape($url); unless ($name) { $name=(split(/\//,$url))[-1]; } unless ($name) { $idx++; next; } - push(@allidx,$res); - if ($url =~ m{/uploaded/.+\.(page|sequence)$}) { - push(@allmapidx,$res); - } $output .= &entryline($idx,$name,$url,$folder,$allowed,$res, $coursenum,$coursedom,$crstype, - $pathitem,$supplementalflag,$container, - \%filters,\%curr_groups); + $pathitem,$supplementalflag,$container); $idx++; $shown++; } &Apache::loncommon::end_data_table_count(); - my $need_save; if (($allowed) || ($supplementalflag && $folder eq 'supplemental')) { - my $toolslink; - if ($allowed || &Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { - $toolslink = ''
+ my $toolslink = '
'; - } if ($shown) { if ($allowed) { $to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll') .&Apache::loncommon::start_data_table(undef,'contentlist') .&Apache::loncommon::start_data_table_header_row() .' | '.&mt('Move').' | ' - .''.&mt('Actions').' | ' - .''.&mt('Document').' | '; + .''.&mt('Actions').' | ' + .''.&mt('Document').' | '; if ($folder !~ /^supplemental/) { $to_show .= ''.&mt('Settings').' | '; } - $to_show .= &Apache::loncommon::end_data_table_header_row(); - if ($folder !~ /^supplemental/) { - $lists{'canhide'} = join(',',@allidx); - $lists{'canrandomlyorder'} = join(',',@allmapidx); - my @possfilters = ('canremove','cancut','cancopy','hiddenresource','encrypturl', - 'randomorder','randompick'); - foreach my $item (@possfilters) { - if (ref($filters{$item}) eq 'ARRAY') { - if (@{$filters{$item}} > 0) { - $lists{$item} = join(',',@{$filters{$item}}); - } - } - } - if (@allidx > 0) { - my $path; - if ($env{'form.folderpath'}) { - $path = - &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); - } - if (@allidx > 1) { - $to_show .= - &Apache::loncommon::continue_data_table_row(). - ''. - ' | '. - &multiple_check_form('actions',\%lists). - ' | '. - ''. - ' | '. - ' | '. - &multiple_check_form('settings',\%lists). - ' | '. - &Apache::loncommon::end_data_table_row(); - $need_save = 1; - } - } - } - $to_show .= $output.' ' + $to_show .= &Apache::loncommon::end_data_table_header_row() + .$output.' ' .&Apache::loncommon::end_data_table() .'
---|