--- loncom/interface/londocs.pm 2009/02/14 13:27:01 1.342 +++ loncom/interface/londocs.pm 2009/05/04 16:45:57 1.365 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.342 2009/02/14 13:27:01 ehlerst Exp $ +# $Id: londocs.pm,v 1.365 2009/05/04 16:45:57 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -72,7 +72,7 @@ sub storemap { &LONCAPA::map::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'. $map,1); if ($errtext) { return ($errtext,2); } - + $hadchanges=1; return ($errtext,0); } @@ -121,7 +121,7 @@ sub dumpbutton { if ($home) { return ''. - &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs'); + &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').'
'; } else { return '
'. &mt('Dump '.$type. @@ -133,7 +133,7 @@ sub dumpbutton { sub clean { my ($title)=@_; $title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs; - return $title; + return $title; } @@ -175,8 +175,8 @@ sub dumpcourse { my $fail=0; for (my $i=0;$i<$#dirs;$i++) { $makepath.='/'.$dirs[$i]; - unless (-e $makepath) { - unless(mkdir($makepath,0777)) { $fail=1; } + unless (-e $makepath) { + unless(mkdir($makepath,0777)) { $fail=1; } } } $r->print('
'.$item.' => '.$newfilename.': '); @@ -264,7 +264,7 @@ sub exportbutton { my $type = &Apache::loncommon::course_type(); return ''. - &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs'); + &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'
'; } @@ -397,10 +397,10 @@ sub exportcourse { $display .= ''."\n"; } if ($curRes->is_sequence()) { - $display .= ' '."\n"; + $display .= ' '."\n"; $lastcontainer = $count + $startcount + $boards; } elsif ($curRes->is_page()) { - $display .= ' '."\n"; + $display .= ' '."\n"; $lastcontainer = $count + $startcount + $boards; } my $currelem = $count+$boards+$startcount; @@ -427,7 +427,7 @@ function checkAll(field) { field.checked = true } } - + function uncheckAll(field) { if (field.length > 0) { for (i = 0; i < field.length; i++) { @@ -442,7 +442,7 @@ function propagateCheck(item) { if (document.exportdoc.elements[item].checked == true) { containerCheck(item) } -} +} function containerCheck(item) { document.exportdoc.elements[item].checked = true @@ -465,7 +465,7 @@ function containerCheck(item) { for (var j=0; j @@ -474,7 +474,7 @@ function containerCheck(item) { $scripttag)); $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); $r->print($display.''. - '

'. + '

'. '

'); } @@ -759,7 +759,7 @@ sub replicate_content { if ($caller eq 'templateupload') { $url = $symb; $url =~ s#//#/#g; - } else { + } else { ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); } my $content; @@ -799,9 +799,9 @@ sub replicate_content { $$message = 'Could not render '.$url.' server message - '.$rtncode."
\n"; } } elsif ($caller eq 'noedit') { -# Need to render the resource without the LON-CAPA Internal header and the Post discussion footer, and then set $content equal to this. +# Need to render the resource without the LON-CAPA Internal header and the Post discussion footer, and then set $content equal to this. $repstatus = 'ok'; - $content = 'Not the owner of this resource'; + $content = 'Not the owner of this resource'; } if ($repstatus eq 'ok') { print $copiedfile $content; @@ -852,14 +852,14 @@ sub extract_media { } } if ($caller eq 'resource') { - my $respath = $Apache::lonnet::perlvar{'lonDocRoot'}.'/res'; - my $embed_path = &Apache::lonnet::filelocation($respath,$embed_url); + my $respath = $Apache::lonnet::perlvar{'lonDocRoot'}.'/res'; + my $embed_path = &Apache::lonnet::filelocation($respath,$embed_url); $embed_content = &Apache::lonnet::getfile($embed_path); unless ($embed_content eq -1) { $repstatus = 'ok'; } } elsif ($caller eq 'uploaded') { - + $repstatus = &Apache::lonnet::getuploaded('GET',$embed_url,$cdom,$cnum,\$embed_content,$rtncode); } if ($repstatus eq 'ok') { @@ -921,10 +921,10 @@ sub group_import { while (@files) { my ($name, $url, $residx) = @{ shift(@files) }; - if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) + if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) && ($caller eq 'londocs') && (!&Apache::lonnet::stat_file($url))) { - + my $errtext = ''; my $fatal = 0; my $newmapstr = ''."\n". @@ -944,7 +944,7 @@ sub group_import { } } if ($url) { - if (!$residx + if (!$residx || defined($LONCAPA::map::zombies[$residx])) { $residx = &LONCAPA::map::getresidx($url,$residx); push(@LONCAPA::map::order, $residx); @@ -953,7 +953,7 @@ sub group_import { if ($url=~m{^http://} || $url=~m{^https://}) { $ext = 'true'; } $url = &LONCAPA::map::qtunescape($url); $name = &LONCAPA::map::qtunescape($name); - $LONCAPA::map::resources[$residx] = + $LONCAPA::map::resources[$residx] = join(':', ($name, $url, $ext, 'normal', 'res')); } } @@ -984,9 +984,9 @@ sub breadcrumbs { my $url='/adm/coursedocs?folderpath='. &escape($folderpath); my $name=&unescape($foldername); -# randompick number, hidden, encrypted, random order, is appended with ":"s to the foldername +# randompick number, hidden, encrypted, random order, is appended with ":"s to the foldername $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//; - if ($1 ne '') { + if ($1 ne '') { $randompick=$1; } else { $randompick=-1; @@ -1012,7 +1012,7 @@ sub breadcrumbs { } $plain=~s/\>\;\s*$//; return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp', - 'LC_docs_path'),$randompick,$ishidden,$isencrypted,$plain,$is_random_order); + 'LC_docs_path', undef, 1 ),$randompick,$ishidden,$isencrypted,$plain,$is_random_order); } sub log_docs { @@ -1125,7 +1125,7 @@ sub docs_change_log { foreach my $key (@changes) { $wholeentry.=':'.$docslog{$id}{'logentry'}{$key}; } - if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; } + if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; } } my $count = 0; my $time = @@ -1176,7 +1176,7 @@ sub docs_change_log { if ($oldname ne '' && $oldname ne $newname) { $r->print(&LONCAPA::map::qtescape($newname)); } - } + } $r->print('
    '); for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) { if ($docslog{$id}{'logentry'}{'after_order_res_'.$idx}) { @@ -1214,7 +1214,7 @@ sub update_paste_buffer { my ($errtext,$fatal) = &mapread($coursenum,$coursedom, $env{'form.copyfolder'}); - + return if ($fatal); # Mark for copying @@ -1223,7 +1223,7 @@ sub update_paste_buffer { &Apache::lonnet::appenv({'docs.markedcopy_supplemental' => $title}); ($title) = &parse_supplemental_title($title); } elsif ($env{'docs.markedcopy_supplemental'}) { - &Apache::lonnet::delenv('docs\\.markedcopy_supplemental'); + &Apache::lonnet::delenv('docs.markedcopy_supplemental'); } $url=~s{http(:|:)//https(:|:)//}{https$2//}; @@ -1327,7 +1327,7 @@ sub do_paste_from_buffer { } # published maps can only exists once, so remove it from paste buffer when done if (($url=~/\.(page|sequence)$/) && ($url=~m {^/res/})) { - &Apache::lonnet::delenv('docs\\.markedcopy'); + &Apache::lonnet::delenv('docs.markedcopy'); } if ($url=~ m{/smppg$}) { my $db_name = &Apache::lonsimplepage::get_db_name($url); @@ -1338,7 +1338,7 @@ sub do_paste_from_buffer { $db_name =~ s{_\d*$ }{_$now}x; my $result=&Apache::lonnet::put($db_name,\%contents, $coursedom,$coursenum); - $url =~ s{/(\d*)/smppg$ }{/$now/smppg}x; + $url =~ s{/(\d*)/smppg$ }{/$now/smppg}x; $title=&mt('Copy of').' '.$title; } } @@ -1352,7 +1352,7 @@ sub do_paste_from_buffer { if ($folder =~ /^supplemental/) { $title = $env{'docs.markedcopy_supplemental'}; } else { - (undef,undef,$title) = + (undef,undef,$title) = &parse_supplemental_title($env{'docs.markedcopy_supplemental'}); } } else { @@ -1376,7 +1376,7 @@ sub uniqueness_check { $url=&LONCAPA::map::qtescape($url); if ($newurl eq $url) { $unique = 0; - last; + last; } } return $unique; @@ -1402,7 +1402,7 @@ sub update_parameter { &remember_parms($idx,$which,'set',$value); } else { &LONCAPA::map::delparameter($idx,'parameter_'.$which); - + &remember_parms($idx,$which,'del'); } return 1; @@ -1430,7 +1430,7 @@ sub handle_edit_cmd { &LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); splice(@LONCAPA::map::order, $idx, 1); - } elsif ($cmd eq 'up' + } elsif ($cmd eq 'up' && ($idx) && (defined($LONCAPA::map::order[$idx-1]))) { @LONCAPA::map::order[$idx-1,$idx] = @LONCAPA::map::order[$idx,$idx-1]; @@ -1470,11 +1470,11 @@ sub editor { $LONCAPA::map::order[0]=$idx; $LONCAPA::map::resources[$idx]=''; } - + my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order)= &breadcrumbs($folder,$allowed,$type); $r->print($breadcrumbtrail); - + # ------------------------------------------------------------ Process commands # ---------------- if they are for this folder and user allowed to make changes @@ -1495,9 +1495,9 @@ sub editor { ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); return $errtext if ($fatal); } - + if ($env{'form.pastemarked'}) { - my $paste_res = + my $paste_res = &do_paste_from_buffer($coursenum,$coursedom,$folder); if ($paste_res eq 'ok') { ($errtext,$fatal) = &storemap($coursenum,$coursedom,$folder.'.'.$container); @@ -1541,7 +1541,7 @@ sub editor { return $errtext if ($fatal); } else { $r->print('

    '.&mt('No map selected.').'

    '); - + } } &log_differences($plain); @@ -1556,7 +1556,7 @@ sub editor { ($ishidden?'
  • '.&mt('contents hidden').'
  • ':''). ($isencrypted?'
  • '.&mt('URLs hidden').'
  • ':''). '

'); - } + } if ($randompick>=0) { $r->print('

'.&mt('Caution: this folder is set to randomly pick a subset of resources. Adding or removing resources from this folder will change the set of resources that the students see, resulting in spurious or missing credit for completed problems, not limited to ones you modify. Do not modify the contents of this folder if it is in active student use.').'

'); } @@ -1660,7 +1660,7 @@ sub process_file_upload { '; $phase_status = 'phasetwo'; - $$upload_output .= + $$upload_output .= 'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA.
'. &Apache::loncommon::ask_for_embedded_content( '/adm/coursedocs',$state,$allfiles,$codebase); @@ -1715,7 +1715,7 @@ sub parse_supplemental_title { } if (wantarray) { return ($title,$foldertitle,$renametitle); - } + } return $title; } @@ -1736,7 +1736,7 @@ sub entryline { } my $orderidx=$LONCAPA::map::order[$index]; - + $renametitle=~s/\\/\\\\/g; $renametitle=~s/\"\;/\\\"/g; @@ -1763,19 +1763,19 @@ sub entryline { my $incindex=$index+1; my $selectbox=''; if (($folder!~/^supplemental/) && - ($#LONCAPA::map::order>0) && + ($#LONCAPA::map::order>0) && ((split(/\:/, - $LONCAPA::map::resources[$LONCAPA::map::order[0]]))[1] - ne '') && + $LONCAPA::map::resources[$LONCAPA::map::order[0]]))[1] + ne '') && ((split(/\:/, - $LONCAPA::map::resources[$LONCAPA::map::order[1]]))[1] + $LONCAPA::map::resources[$LONCAPA::map::order[1]]))[1] ne '')) { $selectbox= ''. ' '.&mt('Random Order').' '; +'; } if ($ispage) { my $pagename=&escape($pagetitle); @@ -2000,9 +2000,9 @@ END 'hd' => 'Hidden', 'ec' => 'URL hidden'); my $enctext= - ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':''); + ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="checked"':''); my $hidtext= - ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':''); + ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="checked"':''); $line.=(< $form_start @@ -2045,7 +2045,7 @@ sub tiehash { $hashtied=1; } } - } + } } sub untiehash { @@ -2094,7 +2094,7 @@ sub checkonthis { if (($errorcount) || ($warningcount)) { if ($errorcount) { - $r->print(''. + $r->print(''. &mt('[quant,_1,error]',$errorcount).''); } if ($warningcount) { @@ -2253,7 +2253,7 @@ sub checkversions { if ($haschanged) { if (&Apache::lonnet::put('resourceversions',\%newsetversions, $env{'course.'.$env{'request.course.id'}.'.domain'}, - $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') { + $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') { $r->print('

'.&mt('Your Version Settings have been Saved').'

'); } else { $r->print('

'.&mt('An Error Occured while Attempting to Save your Version Settings').'

'); @@ -2394,7 +2394,7 @@ ENDHEADERS $lastold=$prevvers; } } - # + # # Code to figure out how many version entries should go in # each of the four columns my $entries_per_col = 0; @@ -2405,7 +2405,7 @@ ENDHEADERS $entries_per_col = $num_entries/4 + 1; } my $entries_count = 0; - $r->print(''); + $r->print(''); my $cols_output = 1; for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) { my $url=$root.'.'.$prevvers.'.'.$extension; @@ -2484,7 +2484,7 @@ sub changewarning { $message='Changes will become active for your current session after [_1], or the next time you log in.'; } $r->print("\n\n". -''."\n". +''."\n". '
'. '

'. @@ -2538,9 +2538,9 @@ sub handler { 'Option_Response_Simple'); $help{'Bulletin Board'} = &Apache::loncommon::help_open_topic( 'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages'); - $help{'My Personal Info'} = &Apache::loncommon::help_open_topic( + $help{'My Personal Information Page'} = &Apache::loncommon::help_open_topic( 'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages'); - $help{'Group Files'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files'); + $help{'Group Portfolio'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files'); $help{'Caching'} = &Apache::loncommon::help_open_topic('Caching'); # does this user have privileges to modify docs @@ -2616,15 +2616,15 @@ sub handler { $showdoc='/'.$1; } unless ($showdoc) { # got called from remote - if (($env{'form.folder'}=~/^(?:group|default)_/) || + if (($env{'form.folder'}=~/^(?:group|default)_/) || ($env{'form.folder'} =~ m:^\d+/(pages|sequences)/:)) { $forcestandard = 1; - } + } $forcesupplement=($env{'form.folder'}=~/^supplemental_/); - if ($allowed) { + if ($allowed) { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']); - $script=&Apache::lonratedt::editscript('simple'); + $script=&Apache::lonratedt::editscript('simple'); } } else { # got called in sequence from course $allowed=0; @@ -2634,7 +2634,7 @@ sub handler { my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'}; my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'}; -# get personal data +# get personal data my $uname=$env{'user.name'}; my $udom=$env{'user.domain'}; my $plainname=&escape(&Apache::loncommon::plainname($uname,$udom)); @@ -2653,14 +2653,14 @@ sub handler { {'force_register' => $showdoc, 'bread_crumbs' => $brcrum}). &Apache::loncommon::help_open_menu('','',273,'RAT')); - + my %allfiles = (); my %codebase = (); my ($upload_result,$upload_output); if ($allowed) { if (($env{'form.uploaddoc.filename'}) && ($env{'form.cmd'}=~/^upload_(\w+)/)) { -# Process file upload - phase one - upload and parse primary file. +# Process file upload - phase one - upload and parse primary file. undef($hadchanges); $upload_result = &process_file_upload(\$upload_output,$coursenum, $coursedom,\%allfiles, @@ -2685,8 +2685,8 @@ sub handler { $newname{$i} = &process_secondary_uploads(\$upload_output,$coursedom,$coursenum,'embedded_item_',$i,$residx); $origname{$i} = &unescape($env{'form.embedded_orig_'.$i}); if (exists($env{'form.embedded_codebase_'.$i})) { - $javacodebase = &unescape($env{'form.embedded_codebase_'.$i}); - $origname{$i} =~ s#^\Q$javacodebase\E/##; + $javacodebase = &unescape($env{'form.embedded_codebase_'.$i}); + $origname{$i} =~ s#^\Q$javacodebase\E/##; } my @attributes = (); if ($env{'form.embedded_attrib_'.$i} =~ /:/) { @@ -2722,8 +2722,8 @@ sub handler { $attrib_regexp = $attribs{$item}[0]; } if ($content =~ m#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#) { - } - $content =~ s#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#$1$newname{$item}$2#gi; + } + $content =~ s#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#$1$newname{$item}$2#gi; } if (exists($codebase{$item})) { $content =~ s/(codebase\s*=\s*["']?)\Q$codebase{$item}\E(["']?)/$1.$2/i; #' stupid emacs @@ -2735,7 +2735,7 @@ sub handler { my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'}; my $url = &Apache::lonnet::store_edited_file($primary_url,$content,$docudom,$docuname,\$saveresult); } else { - &Apache::lonnet::logthis('retrieval of uploaded file - '.$primary_url.' - for editing, failed: '.$getstatus); + &Apache::lonnet::logthis('retrieval of uploaded file - '.$primary_url.' - for editing, failed: '.$getstatus); } } } @@ -2761,15 +2761,15 @@ sub handler { 'extr' => 'External Resource', 'syll' => 'Syllabus', 'navc' => 'Navigate Contents', - 'sipa' => 'Simple Page', + 'sipa' => 'Simple Course Page', 'sipr' => 'Simple Problem', 'drbx' => 'Drop Box', 'scuf' => 'Score Upload Form', 'bull' => 'Discussion Board', - 'mypi' => 'My Personal Info', - 'grpo' => 'Group Files', + 'mypi' => 'My Personal Information Page', + 'grpo' => 'Group Portfolio', 'rost' => 'Course Roster', - 'abou' => 'About User', + 'abou' => 'Personal Information Page for a User', 'imsf' => 'Import IMS package', 'file' => 'File', 'title' => 'Title', @@ -2833,7 +2833,7 @@ FUFORM

$lt{'copm'}

- $help{'Load_Map'} @@ -2889,36 +2889,36 @@ HIDDENFORM } # --------------------------------------------------------- Main tab structure my $activeClass = 1; + my $active = ''; $r->print('

'); # --------------------------------------------------------- Standard documents - if (($standard) && ($allowed) && (!$forcesupplement)) { + my $savefolderpath; my $active = 'style="display: none;"'; if($activeClass == 0){ $active = 'style="display: block;"'; } - $r->print('
'); + $r->print('
'); $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc', &mt('Editing the Table of Contents for your '.$type))); my $folder=$env{'form.folder'}; - if ($folder eq '' || $folder eq 'supplemental') { + if ($folder eq '' || $folder=~/^supplemental/) { $folder='default'; + $savefolderpath = $env{'form.folderpath'}; $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents')); $uploadtag = ''; @@ -2990,13 +2990,13 @@ NSPROBFORM my $newdropboxform=(< - $uploadtag + $uploadtag - + - - + + NDBFORM my $newexuploadform=(< - $help{'My Personal Info'} + $help{'My Personal Information Page'} NAMFORM @@ -3060,6 +3060,7 @@ NASOFORM NROSTFORM my $specialdocumentsform; +my $newfolderform; unless ($env{'form.pagepath'}) { my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); @@ -3076,7 +3077,7 @@ my $specialdocumentsform; NPFORM - my $newfolderform=(< @@ -3099,7 +3100,7 @@ NFFORM NSYLFORM - + my $newgroupfileform=(< $uploadtag @@ -3107,12 +3108,12 @@ NSYLFORM value="$lt{'grpo'}=/adm/$coursedom/$coursenum/aboutme" /> - $help{'Group Files'} + $help{'Group Portfolio'} NGFFORM - $specialdocumentsform="
$newfolderform
$newpageform
$newsylform
$newgroupfileform"; + $specialdocumentsform="
$newpageform
$newsylform
$newgroupfileform"; } $specialdocumentsform.="
$newnavform
$newsmppageform
$newsmpproblemform
$newdropboxform @@ -3124,23 +3125,15 @@ if($env{'form.pagepath'}) { } my %orderhash = ( - 'aa' => 'New Document', - 'bb' => 'Published Documents', - 'cc' => 'Special Documents', - 'dd' => 'More Options', - 'zz' => 'Hide all Options', - ); -my %namehash = ( - 'New Document' => $fileuploadform, - 'Published Documents' => $simpleeditdefaultform, - 'Special Documents' => $specialdocumentsform, - 'More Options' => $extresourcesform.'
'.$imspform.'
'.$recoverform, + 'aa' => ['New Document',$fileuploadform.'
'.$newfolderform], + 'bb' => ['Published Documents',$simpleeditdefaultform], + 'cc' => ['Special Documents',$specialdocumentsform], + 'dd' => ['Tools',$extresourcesform.'
'.$imspform.'
'.$recoverform.'
'.&generate_admin_options($containertag,$uploadtag,\%help,\%env)], + 'zz' => ['Hide all Options'], ); my $tid='1'; -my $content='content'; -my $navigation='navigation'; my $varcd = 'Main Course Documents'; -$r->print(&generate_edit_table($tid,$content,$navigation,$varcd,\%namehash,\%orderhash)); +$r->print(&generate_edit_table($tid,$varcd,\%orderhash)); $hadchanges=0; my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); if ($error) { @@ -3154,9 +3147,7 @@ $r->print(&generate_edit_table($tid,$con $r->print('
'); if ($env{'form.pagepath'}) { } - } # ----------------------------------------------------- Supplemental documents - if (!$forcestandard) { my $active = 'style="display: none;"'; if($activeClass == 1){ $active = 'style="display: block;"'; @@ -3170,7 +3161,10 @@ $r->print('
'); (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) { $env{'form.folderpath'} = 'supplemental&'. &escape(&mt('Supplemental '.$type.' Documents')); + }else{ + $env{'form.folderpath'} = $savefolderpath; } + $env{'form.pagepath'} = ''; if ($allowed) { my $folderseq= '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time. @@ -3188,7 +3182,7 @@ $r->print('
');

$lt{'comment'}:
-
@@ -3244,7 +3238,7 @@ SNSFORM value="$plainname=/adm/$udom/$uname/aboutme" /> - $help{'My Personal Info'} + $help{'My Personal Information Page'} SNAMFORM @@ -3252,32 +3246,21 @@ SNAMFORM my %suporderhash = ( - 'ee' => 'New Document', - 'ff' => 'Special Documents', - 'zz' => 'Hide all Options', - ); - -my %supnamehash = ( - 'New Document' => $supupdocform, - 'Special Documents' => $supnewfolderform.'
'.$supnewextform.'
'.$supnewsylform.'
'.$supnewaboutmeform, + 'ee' => ['New Document',$supupdocform.'
'.$supnewfolderform], + 'ff' => ['Special Documents',$supnewextform.'
'.$supnewsylform.'
'.$supnewaboutmeform], + 'zz' => ['Hide all Options'], ); my $tid='2'; -my $content='content'; -my $navigation='navigation'; my $varscd = 'Supplemental Course Documents'; -$r->print(&generate_edit_table($tid,$content,$navigation,$varscd,\%supnamehash,\%suporderhash)); +$r->print(&generate_edit_table($tid,$varscd,\%suporderhash)); my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); if ($error) { $r->print('

'.$error.'

'); } $r->print('
'); - } - } -$r->print(''); + } $r->print('

'); if ($allowed) { $r->print(' @@ -3300,7 +3283,7 @@ $r->print(''); } $r->print(&Apache::loncommon::end_page()); return OK; -} +} sub generate_admin_options { my ($containertag,$uploadtag,$help_ref,$env_ref) = @_; @@ -3316,56 +3299,42 @@ sub generate_admin_options { my $exportbut=&exportbutton(); return (< -
    -
  • - $help{'Verify_Content'} -
  • -
  • - $help{'Check_Resource_Versions'} -
  • -
  • + $help{'Verify_Content'}
    + $help{'Check_Resource_Versions'}
    $dumpbut -
  • -
  • $exportbut -
  • -
  • -
  • -
  • - +
    -
  • -
- ENDOPTIONFORM } sub generate_edit_table { - my ($tid,$content,$navigation,$varcd,$namehash_ref,$orderhash_ref) = @_; - my %namehash = %{$namehash_ref}; + my ($tid,$varcd,$orderhash_ref) = @_; my %orderhash = %{$orderhash_ref}; - my $form; + my $form; $form = '

'.&mt($varcd).'

'; - $form .= '
    '; + $form .= ''; - $form .= '
    '; - foreach my $field (keys(%namehash)){ - $form .= ''; - } + $form .= '
    '; + foreach my $field (keys(%orderhash)){ + if($field ne 'zz'){ + $form .= ''; + } + } $form .= '
    '; - + return $form; } @@ -3378,12 +3347,12 @@ sub editing_js { p_mnp => 'Name of New Page', t_mnp => 'New Page', p_mxu => 'Title for the Uploaded Score', - p_msp => 'Title for the Page', + p_msp => 'Name of Simple Course Page', p_msb => 'Title for the Problem', p_mdb => 'Title for the Drop Box', p_mbb => 'Title for the Discussion Board', - p_mab => "Enter user:domain for User's 'About Me' Page", - p_mab2 => "About [_99]", + 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', p_mab_alrt2 => 'Please enter both user and domain in the format user:domain', p_chn => 'New Title', @@ -3431,7 +3400,7 @@ function edittext(targetname,residx,titl function makeexamupload() { var title=prompt('$lt{"p_mxu"}'); - if (title) { + if (title) { this.document.forms.newexamupload.importdetail.value= escape(title)+'=/res/lib/templates/examupload.problem'; this.document.forms.newexamupload.submit(); @@ -3440,7 +3409,7 @@ function makeexamupload() { function makesmppage() { var title=prompt('$lt{"p_msp"}'); - if (title) { + if (title) { this.document.forms.newsmppg.importdetail.value= escape(title)+'=/adm/$udom/$uname/$now/smppg'; this.document.forms.newsmppg.submit(); @@ -3449,7 +3418,7 @@ function makesmppage() { function makesmpproblem() { var title=prompt('$lt{"p_msb"}'); - if (title) { + if (title) { this.document.forms.newsmpproblem.importdetail.value= escape(title)+'=/res/lib/templates/simpleproblem.problem'; this.document.forms.newsmpproblem.submit(); @@ -3458,7 +3427,7 @@ function makesmpproblem() { function makedropbox() { var title=prompt('$lt{"p_mdb"}'); - if (title) { + if (title) { this.document.forms.newdropbox.importdetail.value= escape(title)+'=/res/lib/templates/DropBox.problem'; this.document.forms.newdropbox.submit(); @@ -3624,7 +3593,7 @@ Available help topics =item mapread() -Mapread read maps into LONCAPA::map:: global arrays +Mapread read maps into LONCAPA::map:: global arrays @order and @resources, determines status sets @order - pointer to resources in right order sets @resources - array with the resources with correct idx