--- loncom/interface/londocs.pm 2008/09/04 17:07:28 1.309 +++ loncom/interface/londocs.pm 2008/12/13 23:32:01 1.314.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.309 2008/09/04 17:07:28 raeburn Exp $ +# $Id: londocs.pm,v 1.314.2.1 2008/12/13 23:32:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -228,11 +228,19 @@ sub dumpcourse { my $title=$origcrsdata{'description'}; $title=~s/[\/\s]+/\_/gs; $title=&clean($title); - $r->print('<h3>'.&mt('Folder in Construction Space').'</h3><input type="text" size="50" name="authorfolder" value="'.$title.'" /><br />'); + $r->print('<h3>'.&mt('Folder in Construction Space').'</h3>' + .'<input type="text" size="50" name="authorfolder" value="'.$title.'" /><br />'); &tiehash(); - $r->print('<h3>'.&mt('Filenames in Construction Space').'</h3><table border="2"><tr><th>'.&mt('Internal Filename').'</th><th>'.&mt('Title').'</th><th>'.&mt('Save as ...').'</th></tr>'); + $r->print('<h3>'.&mt('Filenames in Construction Space').'</h3>' + .&Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_header_row() + .'<th>'.&mt('Internal Filename').'</th>' + .'<th>'.&mt('Title').'</th>' + .'<th>'.&mt('Save as ...').'</th>' + .&Apache::loncommon::end_data_table_header_row()); foreach (&Apache::lonclonecourse::crsdirlist($origcrsid,'userfiles')) { - $r->print('<tr><td>'.$_.'</td>'); + $r->print(&Apache::loncommon::start_data_table_row() + .'<td>'.$_.'</td>'); my ($ext)=($_=~/\.(\w+)$/); my $title=$hash{'title_'.$hash{ 'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$_}}; @@ -245,12 +253,13 @@ sub dumpcourse { $title=~s/\.(\w+)$//; $title=&clean($title); $title.='.'.$ext; - $r->print("\n<td><input type='text' size='60' name='namefor_".$_."' value='".$title."' /></td></tr>\n"); + $r->print("\n<td><input type='text' size='60' name='namefor_".$_."' value='".$title."' /></td>" + .&Apache::loncommon::end_data_table_row()); } - $r->print("</table>\n"); + $r->print(&Apache::loncommon::end_data_table()); &untiehash(); $r->print( - '<p><input type="submit" name="dumpcourse" value="'.&mt('Dump [_1] DOCS',$type).'" /></p></form>'); + '<p><input type="submit" name="dumpcourse" value="'.&mt("Dump $type DOCS").'" /></p></form>'); } } @@ -309,10 +318,10 @@ sub exportcourse { chdir $cwd; $outcome .= &mt('Download the zip file from <a href="[_1]">IMS '.lc($type).' archive</a><br />',$imszipfile,); if ($copyresult) { - $outcome .= 'The following errors occurred during export - '.$copyresult; + $outcome .= &mt('The following errors occurred during export - [_1]',$copyresult); } } else { - $outcome = '<br />Unfortunately you will not be able to retrieve an IMS archive of this posts at this time, because there was a problem creating a manifest file.<br />'; + $outcome = '<br />'.&mt('Unfortunately you will not be able to retrieve an IMS archive of this posts at this time, because there was a problem creating a manifest file.').'<br />'; } } $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package')); @@ -924,7 +933,7 @@ sub group_import { my $result=&Apache::lonnet::finishuserfileupload($coursenum,$coursedom, 'output',$1.$2); if ($result != m|^/uploaded/|) { - $errtext.='Map not saved: A network error occured when trying to save the new map. '; + $errtext.='Map not saved: A network error occurred when trying to save the new map. '; $fatal = 2; } if ($fatal) { @@ -1208,7 +1217,10 @@ sub update_paste_buffer { # Mark for copying my ($title,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$env{'form.markcopy'}]]); if (&is_supplemental_title($title)) { + &Apache::lonnet::appenv({'docs.markedcopy_supplemental' => $title}); ($title) = &parse_supplemental_title($title); + } elsif ($env{'docs.markedcopy_supplemental'}) { + &Apache::lonnet::delenv('docs\\.markedcopy_supplemental'); } $url=~s{http(:|:)//https(:|:)//}{https$2//}; @@ -1257,7 +1269,7 @@ ENDPASTE } sub do_paste_from_buffer { - my ($coursenum,$coursedom) = @_; + my ($coursenum,$coursedom,$folder) = @_; return 0 if (!$env{'form.pastemarked'}); @@ -1299,6 +1311,20 @@ sub do_paste_from_buffer { $url = &LONCAPA::map::qtunescape($url); # Now insert the URL at the bottom my $newidx = &LONCAPA::map::getresidx($url); + if ($env{'docs.markedcopy_supplemental'}) { + if ($folder =~ /^supplemental/) { + $title = $env{'docs.markedcopy_supplemental'}; + } else { + (undef,undef,$title) = + &parse_supplemental_title($env{'docs.markedcopy_supplemental'}); + } + } else { + if ($folder=~/^supplemental/) { + $title=time.'___&&&___'.$env{'user.name'}.'___&&&___'. + $env{'user.domain'}.'___&&&___'.$title; + } + } + $LONCAPA::map::resources[$newidx]= $title.':'.$url.':'.$ext.':normal:res'; push(@LONCAPA::map::order, $newidx); # Store the result @@ -1419,7 +1445,7 @@ sub editor { } if ($env{'form.pastemarked'}) { - &do_paste_from_buffer($coursenum,$coursedom); + &do_paste_from_buffer($coursenum,$coursedom,$folder); ($errtext,$fatal) = &storemap($coursenum,$coursedom,$folder.'.'.$container); return $errtext if ($fatal); } @@ -1496,7 +1522,9 @@ sub editor { $r->print('<tr><td>'.&mt('Currently no documents.').'</td></tr>'); } $r->print("\n</table>\n"); - &print_paste_buffer($r,$container); + if ($allowed) { + &print_paste_buffer($r,$container); + } return; } @@ -1876,7 +1904,7 @@ END my $ro_set= ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':''); $rand_order_text =' -<nobr><label><input type="checkbox" name="randomorder_'.$orderidx.'" onClick="this.form.changeparms.value=\'randomorder\';this.form.submit()" '.$ro_set.' /> '.&mt('Random Order').' </label></nobr>'; +<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" onClick="this.form.changeparms.value=\'randomorder\';this.form.submit()" '.$ro_set.' /> '.&mt('Random Order').' </label></span>'; } if ($ispage) { my $pagename=&escape($pagetitle); @@ -1971,6 +1999,9 @@ sub checkonthis { $r->rflush(); if (($url) && ($url!~/^\/uploaded\//) && ($url!~/\*$/)) { $r->print("\n<br />"); + if ($level==0) { + $r->print("<br />"); + } for (my $i=0;$i<=$level*5;$i++) { $r->print(' '); } @@ -1980,7 +2011,7 @@ sub checkonthis { my $result=&Apache::lonnet::repcopy( &Apache::lonnet::filelocation('',$url)); if ($result eq 'ok') { - $r->print('<font color="green">'.&mt('ok').'</font>'); + $r->print('<span class="LC_success">'.&mt('ok').'</span>'); $r->rflush(); &Apache::lonnet::countacc($url); $url=~/\.(\w+)$/; @@ -1990,7 +2021,7 @@ sub checkonthis { for (my $i=0;$i<=$level*5;$i++) { $r->print(' '); } - $r->print('- '.&mt('Rendering').': '); + $r->print('- '.&mt('Rendering:').' '); my ($errorcount,$warningcount)=split(/:/, &Apache::lonnet::ssi_body($url, ('grade_target'=>'web', @@ -1999,13 +2030,11 @@ sub checkonthis { ($warningcount)) { if ($errorcount) { $r->print('<img src="/adm/lonMisc/bomb.gif" /><span class="LC_error">'. - $errorcount.' '. - &mt('error(s)').'</span> '); + &mt('[quant,_1,error]',$errorcount).'</span>'); } if ($warningcount) { $r->print('<span class="LC_warning">'. - $warningcount.' '. - &mt('warning(s)').'</span>'); + &mt('[quant,_1,warning]',$warningcount).'</span>'); } } else { $r->print('<span class="LC_success">'.&mt('ok').'</span>'); @@ -2023,15 +2052,15 @@ sub checkonthis { $r->print('<span class="LC_error">'.&mt('connection down').'</span>'); } elsif ($result eq 'not_found') { unless ($url=~/\$/) { - $r->print('<span class="LC_error">'.&mt('not found').'</b></font>'); + $r->print('<span class="LC_error">'.&mt('not found').'</b></span>'); } else { $r->print('<span class="LC_unknown">'.&mt('unable to verify variable URL').'</span>'); } } else { $r->print('<span class="LC_error">'.&mt('access denied').'</span>'); } - } - } + } + } }