--- loncom/interface/londocs.pm 2014/06/16 05:32:45 1.484.2.53 +++ loncom/interface/londocs.pm 2013/08/17 00:34:29 1.560 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.484.2.53 2014/06/16 05:32:45 raeburn Exp $ +# $Id: londocs.pm,v 1.560 2013/08/17 00:34:29 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -41,12 +41,9 @@ 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; -use File::MMagic; use Apache::lonlocal; use Cwd; use LONCAPA qw(:DEFAULT :match); @@ -144,28 +141,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) { @@ -184,407 +161,118 @@ ENDJS $r->print('

'.&mt('Copying Files').'

'); my $title=$env{'form.authorfolder'}; $title=&clean($title); - my ($navmap,$errormsg) = - &Apache::loncourserespicker::get_navmap_object($crstype,'dumpdocs'); - my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; - my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; - my (%maps,%resources,%titles); - if (!ref($navmap)) { - $r->print($errormsg. - &endContentScreen()); - return ''; - } else { - &Apache::loncourserespicker::enumerate_course_contents($navmap,\%maps,\%resources,\%titles, - 'dumpdocs',$cdom,$cnum); - } - my @todump = &Apache::loncommon::get_env_multiple('form.archive'); - my (%tocopy,%replacehash,%lookup,%deps,%display,%result,%depresult,%simpleproblems,%simplepages, - %newcontent,%has_simpleprobs); - foreach my $item (sort {$a <=> $b} (@todump)) { - my $name = $env{'form.namefor_'.$item}; - if ($resources{$item}) { - my ($map,$id,$res) = &Apache::lonnet::decode_symb($resources{$item}); - if ($res =~ m{^uploaded/$cdom/$cnum/\E((?:docs|supplemental)/.+)$}) { - $tocopy{$1} = $name; - $display{$item} = $1; - $lookup{$1} = $item; - } elsif ($res eq 'lib/templates/simpleproblem.problem') { - $simpleproblems{$item} = { - symb => $resources{$item}, - name => $name, - }; - $display{$item} = 'simpleproblem_'.$name; - if ($map =~ m{^\Quploaded/$cdom/$cnum/\E(.+)$}) { - $has_simpleprobs{$1}{$id} = $item; - } - } elsif ($res =~ m{^adm/$match_domain/$match_username/(\d+)/smppg}) { - my $marker = $1; - my $db_name = &Apache::lonsimplepage::get_db_name($res,$marker,$cdom,$cnum); - $simplepages{$item} = { - res => $res, - title => $titles{$item}, - db => $db_name, - marker => $marker, - symb => $resources{$item}, - name => $name, - }; - $display{$item} = '/'.$res; - } - } elsif ($maps{$item}) { - if ($maps{$item} =~ m{^\Quploaded/$cdom/$cnum/\E((?:default|supplemental)_\d+\.(?:sequence|page))$}) { - $tocopy{$1} = $name; - $display{$item} = $1; - $lookup{$1} = $item; - } - } else { - next; - } - } + my %replacehash=(); + foreach my $key (keys(%env)) { + if ($key=~/^form\.namefor\_(.+)/) { + $replacehash{$1}=$env{$key}; + } + } my $crs='/uploaded/'.$env{'request.course.id'}.'/'; $crs=~s/\_/\//g; - my $mm = new File::MMagic; - my $prefix = "/uploaded/$cdom/$cnum/"; - %replacehash = %tocopy; - foreach my $item (sort(keys(%simpleproblems))) { - my $content = &Apache::imsexport::simpleproblem($simpleproblems{$item}{'symb'}); - $newcontent{$display{$item}} = $content; - } - my $gateway = Apache::lonhtmlgateway->new('web'); - foreach my $item (sort(keys(%simplepages))) { - if (ref($simplepages{$item}) eq 'HASH') { - my $pagetitle = $simplepages{$item}{'title'}; - my %fields = &Apache::lonnet::dump($simplepages{$item}{'db'},$cdom,$cnum); - my %contents; - foreach my $field (keys(%fields)) { - if ($field =~ /^(?:aaa|bbb|ccc)_(\w+)$/) { - my $name = $1; - my $msg = $fields{$field}; - if ($name eq 'webreferences') { - if ($msg =~ m{^https?://}) { - $contents{$name} = ''.$msg.''; - } - } else { - $msg = &Encode::decode('utf8',$msg); - $msg = $gateway->process_outgoing_html($msg,1); - $contents{$name} = $msg; - } - } elsif ($field eq 'uploaded.photourl') { - my $marker = $simplepages{$item}{marker}; - if ($fields{$field} =~ m{^\Q$prefix\E(simplepage/$marker/.+)$}) { - my $filepath = $1; - my ($relpath,$fname) = ($filepath =~ m{^(.+/)([^/]+)$}); - if ($fname ne '') { - $fname=~s/\.(\w+)$//; - my $ext=$1; - $fname = &clean($fname); - $fname.='.'.$ext; - $contents{image} = 'Image'; - $replacehash{$filepath} = $relpath.$fname; - $deps{$item}{$filepath} = 1; - } - } - } - } - $replacehash{'/'.$simplepages{$item}{'res'}} = $simplepages{$item}{'name'}; - $lookup{'/'.$simplepages{$item}{'res'}} = $item; - my $content = ' - - -'.$pagetitle.' - -'; - if ($contents{title}) { - $content .= "\n".'

'.$contents{title}.'

'; - } - if ($contents{image}) { - $content .= "\n".$contents{image}; - } - if ($contents{content}) { - $content .= ' -
-

'.&mt('Content').'

'. -$contents{content}.' -
'; - } - if ($contents{webreferences}) { - $content .= ' -
-

'.&mt('Web References').'

'. -$contents{webreferences}.' -
'; - } - $content .= ' - - -'; - $newcontent{'/'.$simplepages{$item}{res}} = $content; - } - } - foreach my $item (keys(%tocopy)) { - unless ($item=~/\.(sequence|page)$/) { - my $currurlpath = $prefix.$item; - my $currdirpath = &Apache::lonnet::filelocation('',$currurlpath); - &recurse_html($mm,$prefix,$currdirpath,$currurlpath,$item,$lookup{$item},\%replacehash,\%deps); - } - } - foreach my $num (sort {$a <=> $b} (@todump)) { - my $src = $display{$num}; - next if ($src eq ''); - my @needcopy = (); - if ($replacehash{$src}) { - push(@needcopy,$src); - if (ref($deps{$num}) eq 'HASH') { - foreach my $dep (sort(keys(%{$deps{$num}}))) { - if ($replacehash{$dep}) { - push(@needcopy,$dep); - } - } - } - } elsif ($src =~ /^simpleproblem_/) { - push(@needcopy,$src); - } - next if (@needcopy == 0); - my ($result,$depresult); - for (my $i=0; $i<@needcopy; $i++) { - my $item = $needcopy[$i]; - my $newfilename; - if ($simpleproblems{$num}) { - $newfilename=$title.'/'.$simpleproblems{$num}{'name'}; - } else { - $newfilename=$title.'/'.$replacehash{$item}; - } - $newfilename=~s/\.(\w+)$//; - my $ext=$1; - $newfilename=&clean($newfilename); - $newfilename.='.'.$ext; - my ($newrelpath) = ($newfilename =~ m{^\Q$title/\E(.+)$}); - if ($newrelpath ne $replacehash{$item}) { - $replacehash{$item} = $newrelpath; - } - my @dirs=split(/\//,$newfilename); - my $path=$r->dir_config('lonDocRoot')."/priv/$cd/$ca"; - my $makepath=$path; - my $fail; - my $origin; - for (my $i=0;$i<$#dirs;$i++) { - $makepath.='/'.$dirs[$i]; - unless (-e $makepath) { - unless(mkdir($makepath,0755)) { - $fail = &mt('Directory creation failed.'); - } - } - } - if ($i == 0) { - $result = '
'.$item.' => '.$newfilename.': '; - } else { - $depresult .= '
  • '.$item.' => '.$newfilename.' '. - ''. - &mt('(dependency)').': '; - } - if (-e $path.'/'.$newfilename) { - $fail = &mt('Destination already exists -- not overwriting.'); - } else { - if (my $fh=Apache::File->new('>'.$path.'/'.$newfilename)) { - if (($item =~ m{^/adm/$match_domain/$match_username/\d+/smppg}) || - ($item =~ /^simpleproblem_/)) { - print $fh $newcontent{$item}; - } else { - my $fileloc = &Apache::lonnet::filelocation('',$prefix.$item); - if (-e $fileloc) { - if ($item=~/\.(sequence|page|html|htm|xml|xhtml)$/) { - if ((($1 eq 'sequence') || ($1 eq 'page')) && - (ref($has_simpleprobs{$item}) eq 'HASH')) { - my %changes = %{$has_simpleprobs{$item}}; - my $content = &Apache::lonclonecourse::rewritefile( - &Apache::lonclonecourse::readfile($env{'request.course.id'},$item), - (%replacehash,$crs => '') - ); - my $updatedcontent = ''; - my $parser = HTML::TokeParser->new(\$content); - $parser->attr_encoded(1); - while (my $token = $parser->get_token) { - if ($token->[0] eq 'S') { - if (($token->[1] eq 'resource') && - ($token->[2]->{'src'} eq '/res/lib/templates/simpleproblem.problem') && - ($changes{$token->[2]->{'id'}})) { - my $id = $token->[2]->{'id'}; - $updatedcontent .= '<'.$token->[1]; - foreach my $attrib (@{$token->[3]}) { - next unless ($attrib =~ /^(src|type|title|id)$/); - if ($attrib eq 'src') { - my ($file) = ($display{$changes{$id}} =~ /^\Qsimpleproblem_\E(.+)$/); - if ($file) { - $updatedcontent .= ' '.$attrib.'="'.$file.'"'; - } else { - $updatedcontent .= ' '.$attrib.'="'.$token->[2]->{$attrib}.'"'; - } - } else { - $updatedcontent .= ' '.$attrib.'="'.$token->[2]->{$attrib}.'"'; - } - } - $updatedcontent .= ' />'."\n"; - } else { - $updatedcontent .= $token->[4]."\n"; - } - } else { - $updatedcontent .= $token->[2]; - } - } - print $fh $updatedcontent; - } else { - print $fh &Apache::lonclonecourse::rewritefile( - &Apache::lonclonecourse::readfile($env{'request.course.id'},$item), - (%replacehash,$crs => '') - ); - } - } else { - print $fh - &Apache::lonclonecourse::readfile($env{'request.course.id'},$item); - } - } else { - $fail = &mt('Source does not exist.'); - } - } - $fh->close(); - } else { - $fail = &mt('Could not write to destination.'); - } - } - my $text; - if ($fail) { - $text = ''.&mt('fail').(' 'x3).$fail.''; - } else { - $text = ''.&mt('ok').''; - } - if ($i == 0) { - $result .= $text; - } else { - $depresult .= $text.'
  • '; - } - } - $r->print($result); - if ($depresult) { - $r->print(''); - } - } + foreach my $item (keys(%replacehash)) { + my $newfilename=$title.'/'.$replacehash{$item}; + $newfilename=~s/\.(\w+)$//; + my $ext=$1; + $newfilename=&clean($newfilename); + $newfilename.='.'.$ext; + my @dirs=split(/\//,$newfilename); + my $path=$r->dir_config('lonDocRoot')."/priv/$cd/$ca"; + my $makepath=$path; + my $fail=0; + for (my $i=0;$i<$#dirs;$i++) { + $makepath.='/'.$dirs[$i]; + unless (-e $makepath) { + unless(mkdir($makepath,0777)) { $fail=1; } + } + } + $r->print('
    '.$item.' => '.$newfilename.': '); + if (my $fh=Apache::File->new('>'.$path.'/'.$newfilename)) { + if ($item=~/\.(sequence|page|html|htm|xml|xhtml)$/) { + print $fh &Apache::lonclonecourse::rewritefile( + &Apache::lonclonecourse::readfile($env{'request.course.id'},$item), + (%replacehash,$crs => '') + ); + } else { + print $fh + &Apache::lonclonecourse::readfile($env{'request.course.id'},$item); + } + $fh->close(); + } else { + $fail=1; + } + if ($fail) { + $r->print(''.&mt('fail').''); + } else { + $r->print(''.&mt('ok').''); + } + } } else { - my ($navmap,$errormsg) = - &Apache::loncourserespicker::get_navmap_object($crstype,'dumpdocs'); - if (!ref($navmap)) { - $r->print($errormsg); - } else { - $r->print('
    '.&mt('Searching ...').'
    '); - $r->rflush(); - my ($preamble,$formname); - $formname = 'dumpdoc'; - unless ($home==1) { - $preamble = '
    '. - '
    '. - &mt('Select the Authoring Space'). - ''; - } else { - $preamble .= ''; - } - } - unless ($home==1) { - $preamble .= '
    '."\n"; - } - my $title=$origcrsdata{'description'}; - $title=~s/[\/\s]+/\_/gs; - $title=&clean($title); - $preamble .= '
    '. - '
    '.&mt('Folder in Authoring Space').''. - ''. - '
    '."\n"; - my %uploadedfiles; - &tiehash(); - foreach my $file (&Apache::lonclonecourse::crsdirlist($origcrsid,'userfiles')) { - my ($ext)=($file=~/\.(\w+)$/); -# FIXME Check supplemental here - my $title=$hash{'title_'.$hash{ - 'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$file}}; - if (!$title) { - $title=$file; - } else { - $title=~s|/|_|g; - } - $title=~s/\.(\w+)$//; - $title=&clean($title); - $title.='.'.$ext; -# $r->print("\n" - $uploadedfiles{$file} = $title; - } - &untiehash(); - $r->print(&Apache::loncourserespicker::create_picker($navmap,'dumpdocs',$formname,$crstype,undef, - undef,undef,$preamble,$home,\%uploadedfiles)); - } + $r->print(&mt('Searching ...').'
    '); + $r->rflush(); +# Input form + $r->print('
    '."\n"); + unless ($home==1) { + $r->print('
    '. + '
    '. + &mt('Select the Authoring Space'). + ''); + } else { + $r->print(''); + } + } + } + unless ($home==1) { + $r->print('
    '."\n"); + } + my $title=$origcrsdata{'description'}; + $title=~s/[\/\s]+/\_/gs; + $title=&clean($title); + $r->print('
    '. + '
    '.&mt('Folder in Authoring Space').''. + ''. + '

    '."\n"); + &tiehash(); + $r->print('

    '.&mt('Filenames in Authoring Space').'

    ' + .&Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_header_row() + .''.&mt('Internal Filename').'' + .''.&mt('Title').'' + .''.&mt('Save as ...').'' + .&Apache::loncommon::end_data_table_header_row()); + foreach my $file (&Apache::lonclonecourse::crsdirlist($origcrsid,'userfiles')) { + $r->print(&Apache::loncommon::start_data_table_row() + .''.$file.''); + my ($ext)=($file=~/\.(\w+)$/); + my $title=$hash{'title_'.$hash{ + 'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$file}}; + $r->print(''.($title?$title:' ').''); + if (!$title) { + $title=$file; + } else { + $title=~s|/|_|g; + } + $title=~s/\.(\w+)$//; + $title=&clean($title); + $title.='.'.$ext; + $r->print("\n" + .&Apache::loncommon::end_data_table_row()); + } + $r->print(&Apache::loncommon::end_data_table()); + &untiehash(); + $r->print( + '

    '); } $r->print(&endContentScreen()); } -sub recurse_html { - my ($mm,$prefix,$currdirpath,$currurlpath,$container,$item,$replacehash,$deps) = @_; - return unless ((ref($replacehash) eq 'HASH') && (ref($deps) eq 'HASH')); - my (%allfiles,%codebase); - if (&Apache::lonnet::extract_embedded_items($currdirpath,\%allfiles,\%codebase) eq 'ok') { - if (keys(%allfiles)) { - foreach my $dependency (keys(%allfiles)) { - next if (($dependency =~ m{^/(res|adm)/}) || ($dependency =~ m{^https?://})); - my ($depurl,$relfile,$newcontainer); - if ($dependency =~ m{^/}) { - if ($dependency =~ m{^\Q$currurlpath/\E(.+)$}) { - $relfile = $1; - if ($dependency =~ m{^\Q$prefix\E(.+)$}) { - $newcontainer = $1; - next if ($replacehash->{$newcontainer}); - } - $depurl = $dependency; - } else { - next; - } - } else { - $relfile = $dependency; - $depurl = $currurlpath; - $depurl =~ s{[^/]+$}{}; - $depurl .= $dependency; - ($newcontainer) = ($depurl =~ m{^\Q$prefix\E(.+)$}); - } - next if ($relfile eq ''); - my $newname = $replacehash->{$container}; - $newname =~ s{[^/]+$}{}; - $replacehash->{$newcontainer} = $newname.$relfile; - $deps->{$item}{$newcontainer} = 1; - my ($newurlpath) = ($depurl =~ m{^(.*)/[^/]+$}); - my $depfile = &Apache::lonnet::filelocation('',$depurl); - my $type = $mm->checktype_filename($depfile); - if ($type eq 'text/html') { - &recurse_html($mm,$prefix,$depfile,$newurlpath,$newcontainer,$item,$replacehash,$deps); - } - } - } - } - return; -} - sub group_import { my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_; my ($donechk,$allmaps,%hierarchy,%titles,%addedmaps,%removefrommap, @@ -667,7 +355,7 @@ $initialtext END $env{'form.output'}=$newhtml; - my $result = + my $result = &Apache::lonnet::finishuserfileupload($coursenum,$coursedom, 'output', "$filepath/$residx/$fname.html"); @@ -692,7 +380,7 @@ END removefrommap => \%removefrommap, removeparam => \%removeparam, ); - my ($result,$msgsarray,$lockerror) = + my ($result,$msgsarray,$lockerror) = &apply_fixups($folder,1,$coursedom,$coursenum,\%import_errors,\%updated); if (keys(%import_errors) > 0) { $fixuperrors = @@ -722,8 +410,6 @@ END unless ($fatal) { if ($folder =~ /^supplemental/) { &Apache::lonnet::get_numsuppfiles($coursenum,$coursedom,1); - my ($errtext,$fatal) = &mapread($coursenum,$coursedom, - $folder.'.'.$container); } } return ($errtext,$fatal,$fixuperrors); @@ -1024,7 +710,7 @@ sub update_paste_buffer { my $url = $env{'docs.markedcopy_url_'.$suffix}; if (($cid =~ /^$match_domain(?:_)$match_courseid$/) && ($url ne '')) { - $pasteurls{$cid.'_'.$url} = 1; + $pasteurls{$cid.'_'.$url}; } } } @@ -1088,7 +774,6 @@ sub update_paste_buffer { } &Apache::lonnet::appenv(\%addtoenv); delete($env{'form.markcopy'}); - return; } sub recurse_uploaded_maps { @@ -1126,7 +811,6 @@ sub print_paste_buffer { my @currpaste = split(/,/,$env{'docs.markedcopies'}); my ($pasteitems,@pasteable); - my $clipboardcount = 0; # Construct identifiers for current contents of user's paste buffer foreach my $suffix (@currpaste) { @@ -1135,7 +819,6 @@ sub print_paste_buffer { my $url = $env{'docs.markedcopy_url_'.$suffix}; if (($cid =~ /^$match_domain\_$match_courseid$/) && ($url ne '')) { - $clipboardcount ++; my ($is_external,$othercourse,$fromsupp,$is_uploaded_map,$parent, $canpaste,$nopaste,$othercrs,$areachange); my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1]; @@ -1229,23 +912,11 @@ sub print_paste_buffer { $pasteitems .= '
    '; $form_start = '
    '; if (@pasteable) { - my $value = &mt('Paste to current folder'); - if ($container eq 'page') { - $value = &mt('Paste to current page'); - } - $buttons = ''.(' 'x2); - } - $buttons .= ''.(' 'x2); - if ($clipboardcount > 1) { - $buttons .= - ''.(' 'x20).''.(' 'x2). - ''. - (' 'x2). - ''. - (' 'x2); + $buttons = ''.(' 'x2); } - $form_end = ''. - '
    '; + $buttons .= ''. + ''; + $form_end = ''; } else { $pasteitems = &mt('Clipboard is empty'); } @@ -1399,24 +1070,6 @@ function validateClipboard() { } } -function checkClipboard() { - if (document.pasteform.pasting.length > 1) { - for (var i=0; i1) { - for (var i=0; i{'src'}; + my $url = $dbref->{'src'}; if (ref($dbref) eq 'HASH') { if ($url =~ m{/(smppg|bulletinboard)$}) { my $prefix = $1; - if (($dbref->{'cdom'} =~ /^$match_domain$/) && + if (($dbref->{'cdom'} =~ /^$match_domain$/) && ($dbref->{'cnum'} =~ /^$match_courseid$/)) { my $db_name; my $marker = (split(m{/},$url))[4]; @@ -1930,7 +1584,7 @@ sub dbcopy { if ($prefix eq 'smppg') { $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a simple page [_1].',$url); } else { - $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a discussion board [_1].',$url); + $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a bulletin board [_1].',$url); } if ($error) { $errtext .= '
    '.$error; @@ -1944,12 +1598,12 @@ sub dbcopy { my $photo = $contents{'uploaded.photourl'}; my ($subdir,$fname) = ($photo =~ m{^/uploaded/$match_domain/$match_courseid/+(bulletin|simplepage)/(?:|\d+/)([^/]+)$}); - my $newphoto; + my $newphoto; if ($fname ne '') { my $content = &Apache::lonnet::getfile($photo); unless ($content eq '-1') { $env{'form.'.$suffix.'.photourl'} = $content; - $newphoto = + $newphoto = &Apache::lonnet::finishuserfileupload($coursenum,$coursedom,$suffix.'.photourl',"$subdir/$suffix/$fname"); delete($env{'form.'.$suffix.'.photourl'}); } @@ -1973,7 +1627,7 @@ sub dbcopy { $lockerrorsref->{$prefix} .= ' '.&mt('This will prevent creation of additional simple pages in this course.'); } else { - $lockerrorsref->{$prefix} .= ' '.&mt('This will prevent creation of additional discussion boards in this course.'); + $lockerrorsref->{$prefix} .= ' '.&mt('This will prevent creation of additional bulletin boards in this course.'); } $lockerrorsref->{$prefix} .= ' '.&mt('Please contact the [_1]helpdesk[_2] for assistance.', '',''). @@ -2094,7 +1748,7 @@ sub url_paste_fixups { } next if ($token->[2]->{'type'} eq 'external'); if ($token->[2]->{'type'} eq 'zombie') { - next if ($skip); + next if ($skip); $zombies->{$oldurl}{$id} = $ressrc; $changed = 1; } elsif ($ressrc =~ m{^/uploaded/($match_domain)/($match_courseid)/(.+)$}) { @@ -2540,7 +2194,7 @@ sub update_parameter { 'randomorder' => {}, ); foreach my $which (keys(%allchecked)) { - $env{'form.all'.$which} =~ s/,$//; + $env{'form.all'.$which} =~ s/,$//; if ($which eq 'randompick') { foreach my $item (split(/,/,$env{'form.all'.$which})) { my ($res,$value) = split(/:/,$item); @@ -2567,7 +2221,7 @@ sub update_parameter { foreach my $which (keys(%allchecked)) { if (($which eq 'randompick' || $which eq 'randomorder')) { next if (!$is_map); - } + } my $oldvalue = 0; my $newvalue = 0; if ($allchecked{$which}{$res}) { @@ -3026,11 +2680,11 @@ sub editor { if (@allidx > 0) { my $path; if ($env{'form.folderpath'}) { - $path = + $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); } if (@allidx > 1) { - $to_show .= + $to_show .= &Apache::loncommon::continue_data_table_row(). ' '. ''. @@ -3174,17 +2828,14 @@ sub process_file_upload { } my $quotatype = 'unofficial'; if ($crstype eq 'Community') { - $quotatype = 'community'; - } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.coursecode'}) { + $quotatype = 'community'; + } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.instcode'}) { $quotatype = 'official'; - } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.textbook'}) { - $quotatype = 'textbook'; } if (&Apache::loncommon::get_user_quota($coursenum,$coursedom,'course',$quotatype)) { $filesize = int($filesize/1000); #expressed in kb $$upload_output = &Apache::loncommon::excess_filesize_warning($coursenum,$coursedom,'course', - $env{'form.uploaddoc.filename'},$filesize, - 'upload',$quotatype); + $env{'form.uploaddoc.filename'},$filesize,'upload'); return if ($$upload_output); } my ($parseaction,$showupload,$nextphase,$mimetype); @@ -3282,8 +2933,7 @@ sub process_file_upload { $$upload_output .= &mt('No embedded items identified').'
    '; } $$upload_output = '
    '.$$upload_output.'
    '; - } elsif ((&Apache::loncommon::is_archive_file($mimetype)) && - ($env{'form.uploaddoc.filename'} =~ /\.(zip|tar|bz2|gz|tar.gz|tar.bz2|tgz)$/i)) { + } elsif (&Apache::loncommon::is_archive_file($mimetype)) { $nextphase = 'decompress_uploaded'; my $position = scalar(@LONCAPA::map::order)-1; my $noextract = &return_to_editor(); @@ -3345,7 +2995,7 @@ sub is_supplemental_title { sub entryline { my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom, $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups)=@_; - my ($foldertitle,$renametitle,$oldtitle); + my ($foldertitle,$renametitle); if (&is_supplemental_title($title)) { ($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title); } else { @@ -3359,8 +3009,6 @@ sub entryline { $renametitle=~s/\\/\\\\/g; $renametitle=~s/\"\;/\\\"/g; $renametitle=~s/ /%20/g; - $oldtitle = $renametitle; - $renametitle=~s/\'\;/\\\'/g; my $line=&Apache::loncommon::start_data_table_row(); my ($form_start,$form_end,$form_common,$form_param); # Edit commands @@ -3510,7 +3158,7 @@ ENDREM } } $renamelink=(<$lt{'rn'} +$lt{'rn'} ENDREN $line.=(< @@ -3644,13 +3292,13 @@ $form_common."\n". push(@{$filtersref->{'randomorder'}},$orderidx); } } - $formname = 'edit_rorder_'.$orderidx; + my $formname = 'edit_rorder_'.$orderidx; $rand_order_text = '
    '."\n". $form_param."\n". $form_common."\n". ''. -$form_end; +$form_end; } } elsif ($supplementalflag && !$allowed) { $url .= ($url =~ /\?/) ? '&':'?'; @@ -3847,14 +3495,14 @@ sub new_timebased_suffix { } elsif ($type eq 'smppg') { $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new simple page.'); } else { - $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new discussion board.'); + $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new bulletin board.'); } if ($error) { $errtext .= '
    '.$error; } } if ($freedlock ne 'ok') { - $locknotfreed = + $locknotfreed = '
    '. &mt('There was a problem removing a lockfile.').' '; if ($type eq 'paste') { @@ -3866,7 +3514,7 @@ sub new_timebased_suffix { &mt('This will prevent creation of additional simple pages in this course.'); } else { $locknotfreed .= - &mt('This will prevent creation of additional discussion boards in this course.'); + &mt('This will prevent creation of additional bulletin boards in this course.'); } unless ($type eq 'paste') { $locknotfreed .= @@ -4073,8 +3721,8 @@ sub devalidateversioncache { sub checkversions { my ($r) = @_; my $crstype = &Apache::loncommon::course_type(); - $r->print(&Apache::loncommon::start_page("Check $crstype Resource Versions")); - $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Resource Versions")); + $r->print(&Apache::loncommon::start_page("Check $crstype Document Versions")); + $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions")); $r->print(&startContentScreen('tools')); my $header=''; @@ -4230,30 +3878,10 @@ $lt{'sc'}:

    $lt{'vers'}

    + ENDHEADERS #number of columns for version history - my %changedbytime; - foreach my $key (keys(%changes)) { - #excludes not versionable problems from resource version history: - next if ($key =~ /^\/res\/lib\/templates/); - my $chg; - if ($env{'form.timerange'} eq 'all') { - my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); - $chg = &Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate'); - } else { - $chg = $changes{$key}; - next if ($chg < $starttime); - } - push(@{$changedbytime{$chg}},$key); - } - if (keys(%changedbytime) == 0) { - &untiehash(); - $r->print(&mt('No content changes in imported content in specified time frame'). - &endContentScreen()); - return; - } $r->print( - ''. &Apache::loncommon::start_data_table(). &Apache::loncommon::start_data_table_header_row(). ''.&mt('Resources').''. @@ -4263,25 +3891,26 @@ ENDHEADERS ''.&mt('History').''. &Apache::loncommon::end_data_table_header_row() ); - foreach my $chg (sort {$b <=> $a } keys(%changedbytime)) { - foreach my $key (sort(@{$changedbytime{$chg}})) { - my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); - my $currentversion=&Apache::lonnet::getversion($key); - if ($currentversion<0) { - $currentversion=''.&mt('Could not be determined.').''; - } - my $linkurl=&Apache::lonnet::clutter($key); - $r->print( - &Apache::loncommon::start_data_table_row(). - ''.&Apache::lonnet::gettitle($linkurl).'
    '. - ''.$linkurl.''. - ''.$currentversion.'
    ('. - &Apache::lonlocal::locallocaltime($chg).')
    '. - '' - ); - # Used in course - my $usedversion=$hash{'version_'.$linkurl}; - if (($usedversion) && ($usedversion ne 'mostrecent')) { + foreach my $key (sort(keys(%changes))) { + #excludes not versionable problems from resource version history: + next unless ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/); + my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); + my $currentversion=&Apache::lonnet::getversion($key); + if ($currentversion<0) { + $currentversion=''.&mt('Could not be determined.').''; + } + my $linkurl=&Apache::lonnet::clutter($key); + $r->print( + &Apache::loncommon::start_data_table_row(). + ''.&Apache::lonnet::gettitle($linkurl).'
    '. + ''.$linkurl.''. + ''.$currentversion.'
    ('. + &Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).')
    '. + '' + ); + # Used in course + my $usedversion=$hash{'version_'.$linkurl}; + if (($usedversion) && ($usedversion ne 'mostrecent')) { if ($usedversion != $currentversion) { $r->print(''.$usedversion.''); } else { @@ -4290,45 +3919,44 @@ ENDHEADERS } else { $r->print($currentversion); } - $r->print(''); - # Set version - $r->print(&Apache::loncommon::select_form( - $setversions{$linkurl}, - 'set_version_'.$linkurl, - {'select_form_order' => ['',1..$currentversion,'mostrecent'], - '' => '', - 'mostrecent' => &mt('most recent'), - map {$_,$_} (1..$currentversion)})); - my $lastold=1; - for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { - my $url=$root.'.'.$prevvers.'.'.$extension; - if (&Apache::lonnet::metadata($url,'lastrevisiondate')<$starttime) { - $lastold=$prevvers; - } - } - $r->print(''); - # List all available versions - $r->print(''); - for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) { - my $url=$root.'.'.$prevvers.'.'.$extension; - $r->print( - '' - .'' - .&mt('Version [_1]',$prevvers).'' - .' ('.&Apache::lonlocal::locallocaltime( + $r->print(''); + # Set version + $r->print(&Apache::loncommon::select_form( + $setversions{$linkurl}, + 'set_version_'.$linkurl, + {'select_form_order' => ['',1..$currentversion,'mostrecent'], + '' => '', + 'mostrecent' => &mt('most recent'), + map {$_,$_} (1..$currentversion)})); + my $lastold=1; + for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { + my $url=$root.'.'.$prevvers.'.'.$extension; + if (&Apache::lonnet::metadata($url,'lastrevisiondate')<$starttime) { + $lastold=$prevvers; + } + } + $r->print(''); + # List all available versions + $r->print(''); + for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) { + my $url=$root.'.'.$prevvers.'.'.$extension; + $r->print( + '' + .'' + .&mt('Version [_1]',$prevvers).'' + .' ('.&Apache::lonlocal::locallocaltime( &Apache::lonnet::metadata($url,'lastrevisiondate')) - .')'); - if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') { - $r->print( - ' &'). - '" target="diffs">'.&mt('Diffs').''); - } - $r->print('
    '); + .')'); + if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') { + $r->print( + ' &'). + '" target="diffs">'.&mt('Diffs').''); } - $r->print('
    '.&Apache::loncommon::end_data_table_row()); + $r->print('

    '); } + $r->print('
    '.&Apache::loncommon::end_data_table_row()); } $r->print( &Apache::loncommon::end_data_table(). @@ -4338,7 +3966,6 @@ ENDHEADERS &untiehash(); $r->print(&endContentScreen()); - return; } sub mark_hash_old { @@ -4393,13 +4020,13 @@ $help{'Caching'}.'

    '."\n\n"); sub init_breadcrumbs { - my ($form,$text,$help)=@_; + my ($form,$text)=@_; &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?tools=1", text=>&Apache::loncommon::course_type().' Editor', faq=>273, bug=>'Instructor Interface', - help => $help}); + help => 'Docs_Adding_Course_Doc'}); &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?".$form.'=1', text=>$text, faq=>273, @@ -4435,6 +4062,7 @@ sub startContentScreen { if (($mode eq 'navmaps') || ($mode eq 'supplemental')) { $output .= '    '.&mt('Content Overview').'    '."\n"; $output .= '     '.&mt('Content Search').'     '."\n"; + $output .= '      '.&mt('Content Index').'      '."\n"; $output .= '
  • '.&mt('Supplemental Content').'
  • '; } else { $output .= '
  •       '.&mt('Main Content Editor').'      
  • '."\n"; @@ -4482,8 +4110,9 @@ sub handler { 'Adding_Folders','Docs_Overview', 'Load_Map', 'Supplemental','Score_Upload_Form','Adding_Pages', 'Importing_LON-CAPA_Resource','Importing_IMS_Course', - 'Uploading_From_Harddrive','Course_Roster','Web_Page', - 'Dropbox','Simple_Problem') { + 'Uploading_From_Harddrive', + 'Check_Resource_Versions','Verify_Content', + 'Course_Roster','Web_Page','Dropbox') { $help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic); } # Composite help files @@ -4491,6 +4120,8 @@ sub handler { 'Docs_About_Syllabus,Docs_Editing_Templated_Pages'); $help{'Simple Page'} = &Apache::loncommon::help_open_topic( 'Docs_About_Simple_Page,Docs_Editing_Templated_Pages'); + $help{'Simple Problem'} = &Apache::loncommon::help_open_topic( + 'Option_Response_Simple'); $help{'Bulletin Board'} = &Apache::loncommon::help_open_topic( 'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages'); $help{'My Personal Information Page'} = &Apache::loncommon::help_open_topic( @@ -4505,9 +4136,13 @@ sub handler { $allowed = &Apache::lonnet::allowed('mdc',$env{'request.course.id'}); } - &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['inhibitmenu']); - if ($allowed && $env{'form.verify'}) { - &init_breadcrumbs('verify','Verify Content','Docs_Verify_Content'); + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['chooseserver', + 'inhibitmenu']); + if ($allowed && $env{'form.chooseserver'}) { + &choose_dump_server($r); + return OK; + } elsif ($allowed && $env{'form.verify'}) { + &init_breadcrumbs('verify','Verify Content'); &verifycontent($r); } elsif ($allowed && $env{'form.listsymbs'}) { &init_breadcrumbs('listsymbs','List Content IDs'); @@ -4520,10 +4155,10 @@ sub handler { } &docs_change_log($r,$coursenum,$coursedom,$folder,$allowed,$crstype,$iconpath); } elsif ($allowed && $env{'form.versions'}) { - &init_breadcrumbs('versions','Check/Set Resource Versions','Docs_Check_Resource_Versions'); + &init_breadcrumbs('versions','Check/Set Resource Versions'); &checkversions($r); } elsif ($allowed && $env{'form.dumpcourse'}) { - &init_breadcrumbs('dumpcourse','Copy '.&Apache::loncommon::course_type().' Content to Authoring Space'); + &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' Content to Authoring Space'); &dumpcourse($r); } elsif ($allowed && $env{'form.exportcourse'}) { &init_breadcrumbs('exportcourse','IMS Export'); @@ -4549,9 +4184,9 @@ sub handler { # supplementalflag=0: show standard documents # toolsflag=1: show utilities - my $unesc_folderpath = &unescape($env{'form.folderpath'}); - my $supplementalflag=($unesc_folderpath=~/^supplemental/); - if (($unesc_folderpath=~/^default/) || ($unesc_folderpath eq "")) { + $env{'form.folderpath'} = &unescape($env{'form.folderpath'}); + my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/); + if (($env{'form.folderpath'}=~/^default/) || ($env{'form.folderpath'} eq "")) { $supplementalflag=0; } if ($env{'form.forcesupplement'}) { $supplementalflag=1; } @@ -4691,11 +4326,9 @@ sub handler { $script .= &dump_switchserver_js(@hosts); } } else { - my $tid = 1; my @tabids; if ($supplementalflag) { @tabids = ('002','ee2','ff2'); - $tid = 2; } else { @tabids = ('aa1','bb1','cc1','ff1'); unless ($env{'form.folderpath'} =~ /\:1$/) { @@ -4707,7 +4340,7 @@ sub handler { $script .= &editing_js($udom,$uname,$supplementalflag). &history_tab_js(). &inject_data_js(). - &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr,$tid). + &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr). &Apache::lonextresedit::extedit_javascript(); $addentries = { onload => "javascript:resize_scrollbox('contentscroll','1','1');", @@ -4732,14 +4365,6 @@ sub handler { if ($showdoc) { $r->print(&Apache::loncommon::start_page("$crstype documents",undef, {'force_register' => $showdoc,})); - } elsif ($toolsflag) { - &Apache::lonhtmlcommon::add_breadcrumb({ - href=>"/adm/coursedocs",text=>"$crstype Contents"}); - $r->print(&Apache::loncommon::start_page("$crstype Contents", $script) - .&Apache::loncommon::help_open_menu('','',273,'RAT') - .&Apache::lonhtmlcommon::breadcrumbs( - 'Editing Course Contents') - ); } elsif ($r->uri eq '/adm/supplemental') { my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype); $r->print(&Apache::loncommon::start_page("Supplemental $crstype Content",undef, @@ -4832,7 +4457,7 @@ sub handler { 'navc' => 'Table of Contents', 'sipa' => 'Simple Course Page', 'sipr' => 'Simple Problem', - 'webp' => 'Blank Web Page (editable)', + 'webp' => 'Blank Web Page (editable)', 'drbx' => 'Drop Box', 'scuf' => 'External Scores (handgrade, upload, clicker)', 'bull' => 'Discussion Board', @@ -4848,11 +4473,7 @@ sub handler { 'title' => 'Title', 'comment' => 'Comment', 'parse' => 'Upload embedded images/multimedia files if HTML file', - 'bb5' => 'Blackboard 5', - 'bb6' => 'Blackboard 6', - 'angel5' => 'ANGEL 5.5', - 'webctce4' => 'WebCT 4 Campus Edition', - ); + ); # ----------------------------------------------------------------------------- my $fileupload=(< @@ -4883,10 +4504,10 @@ CHBO $lt{'cms'}: 

    @@ -5014,7 +4635,7 @@ HIDDENFORM my $newnavform=(< - + $pathitem @@ -5024,7 +4645,7 @@ HIDDENFORM NNFORM my $newsmppageform=(< - + $pathitem $lt{'sipa'} @@ -5038,7 +4659,7 @@ NSPFORM $pathitem $lt{'sipr'} - $help{'Simple_Problem'} + $help{'Simple Problem'} NSPROBFORM @@ -5065,7 +4686,7 @@ NEXUFORM my $newbulform=(< - + $pathitem $lt{'bull'} @@ -5075,7 +4696,7 @@ NBFORM my $newaboutmeform=(< - + $pathitem @@ -5086,7 +4707,7 @@ NAMFORM my $newaboutsomeoneform=(< - + $pathitem $lt{'abou'} @@ -5095,7 +4716,7 @@ NASOFORM my $newrosterform=(< - + $pathitem @@ -5116,7 +4737,7 @@ NROSTFORM } my $newwebpageform =(< - + $pathitem $lt{'webp'} @@ -5140,7 +4761,7 @@ my $newfolderb;
    - + $lt{'newp'} $help{'Adding_Pages'}
    @@ -5151,14 +4772,14 @@ NPFORM
    $pathitem - + $lt{'newf'}$help{'Adding_Folders'}
    NFFORM my $newsylform=(< - + $pathitem @@ -5170,7 +4791,7 @@ NSYLFORM my $newgroupfileform=(< - + $pathitem @@ -5287,7 +4908,7 @@ SUPDOCFORM my $supnewfolderform=(< - + $pathitem $lt{'newf'} @@ -5375,13 +4996,12 @@ my %suporderhash = ( foreach my $server (keys(%servers)) { next if (grep(/^\Q$server\E$/,@ids)); my $hashid=$coursenum.':'.$coursedom; - my $cachekey = &escape('suppcount').':'.&escape($hashid); - &Apache::lonnet::remote_devalidate_cache($server,[$cachekey]); + &Apache::lonnet::remote_devalidate_cache($server,'suppcount',$hashid); } &Apache::lonnet::get_numsuppfiles($coursenum,$coursedom,1); undef($suppchanges); - } - } + } + } } } elsif ($supplementalflag) { my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, @@ -5529,7 +5149,7 @@ sub remove_archive { my $currcmd = $env{'form.cmd'}; my $position = $env{'form.position'}; if ($position > 0) { - $env{'form.cmd'} = 'remove_'.$position; + $env{'form.cmd'} = 'del_'.$position; my ($title,$url,@rrest) = split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$position]]); if (&handle_edit_cmd($docuname,$docudom)) { @@ -5564,13 +5184,13 @@ sub generate_admin_menu { my ($crstype) = @_; my $lc_crstype = lc($crstype); my ($home,$other,%outhash)=&authorhosts(); - my %lt= ( # do not translate here + my %lt=&Apache::lonlocal::texthash ( 'vc' => 'Verify Content', 'cv' => 'Check/Set Resource Versions', 'ls' => 'List Resource Identifiers', 'imse' => 'Export contents to IMS Archive', - 'dcd' => "Copy $crstype Content to Authoring Space", - ); + 'dcd' => "Dump $crstype Content to Authoring Space", + ); my ($candump,$dumpurl); if ($home + $other > 0) { $candump = 'F'; @@ -5600,14 +5220,14 @@ sub generate_admin_menu { { linktext => $lt{'vc'}, url => "javascript:injectData(document.courseverify,'dummy','verify','$lt{'vc'}')", permission => 'F', - help => 'Docs_Verify_Content', + help => 'Verify_Content', icon => 'verify.png', linktitle => 'Verify contents can be retrieved/rendered', }, { linktext => $lt{'cv'}, url => "javascript:injectData(document.courseverify,'dummy','versions','$lt{'cv'}')", permission => 'F', - help => 'Docs_Check_Resource_Versions', + help => 'Check_Resource_Versions', icon => 'resversion.png', linktitle => "View version information for resources in your $lc_crstype, and fix/unfix use of specific versions", }, @@ -5632,7 +5252,7 @@ sub generate_admin_menu { { linktext => $lt{'dcd'}, url => $dumpurl, permission => $candump, - help => 'Docs_Dump_Course_Docs', + #help => '', icon => 'dump.png', linktitle => $lt{'dcd'}, }, @@ -5652,7 +5272,7 @@ sub generate_edit_table { my $form; my $activetab; my $active; - if (($env{'form.active'} ne '') && ($env{'form.active'} ne '00')) { + if (($env{'form.active'} ne '') && ($env{'form.active'} ne 'aa')) { $activetab = $env{'form.active'}; } my $backicon = $iconpath.'clickhere.gif'; @@ -5687,7 +5307,7 @@ sub generate_edit_table { $form .= '
  • '.&mt(${$orderhash{$name}}[0]).'
  • '."\n"; } else { - $form .= '
  • '.${$orderhash{$name}}[1].'
  • '."\n"; + $form .= '
  • '.${$orderhash{$name}}[1].'
  • '."\n"; } } @@ -5755,7 +5375,7 @@ sub editing_js { p_msb => 'Title for the Problem', p_mdb => 'Title for the Drop Box', p_mbb => 'Title for the Discussion Board', - p_mwp => 'Title for Web Page', + p_mwp => 'Title for Web Page', p_mab => "Enter user:domain for User's Personal Information Page", p_mab2 => 'Personal Information Page of ', p_mab_alrt1 => 'Not a valid user:domain', @@ -5869,7 +5489,7 @@ function makewebpage(type) { formname = this.document.forms.newwebpage; } if (title) { - var webpage = formname.importdetail.value; + var webpage = formname.importdetail.value; formname.importdetail.value = escape(title)+'='+webpage; formname.submit(); } @@ -6250,12 +5870,10 @@ for (i = 0; i < currentLis.length; i++) function hideAll(current, nav, data) { unselectInactive(nav); -if (current) { - if (current.className == 'right'){ +if(current.className == 'right'){ current.className = 'right active' - } else { + }else{ current.className = 'active'; - } } currentData = document.getElementById(data); currentDivs = currentData.getElementsByTagName('DIV'); @@ -6286,24 +5904,10 @@ function openTabs(pageId) { } function showPage(current, pageId, nav, data) { - currstate = current.className; hideAll(current, nav, data); openTabs(pageId); unselectInactive(nav); - if ((currstate == 'active') || (currstate == 'right active')) { - if (currstate == 'active') { - current.className = ''; - } else { - current.className = 'right'; - } - activeTab = ''; - toggleUpload(); - toggleMap(); - resize_scrollbox('contentscroll','1','0'); - return; - } else { - current.className = 'active'; - } + current.className = 'active'; currentData = document.getElementById(pageId); currentData.style.display = 'block'; activeTab = pageId; @@ -6691,9 +6295,9 @@ ENDINJECT sub dump_switchserver_js { my @hosts = @_; my %lt = &Apache::lonlocal::texthash( - dump => 'Copying content to Authoring Space requires switching server.', + dump => 'Dumping to Authoring Space requires switching server.', swit => 'Switch server?', - duco => 'Copying Content to Authoring Space', + duco => 'Dump content to Authoring Space', yone => 'You need to switch to a server housing an Authoring Space for which you are author or co-author.', chos => 'Choose server', );