--- loncom/interface/londocs.pm 2009/01/30 10:02:46 1.331 +++ loncom/interface/londocs.pm 2009/06/05 10:51:13 1.369 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.331 2009/01/30 10:02:46 muellerd Exp $ +# $Id: londocs.pm,v 1.369 2009/06/05 10:51:13 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; } @@ -142,7 +142,7 @@ sub dumpcourse { my ($r) = @_; my $type = &Apache::loncommon::course_type(); $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space'). - '
'); + ''); $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space')); my ($home,$other,%outhash)=&authorhosts(); unless ($home) { return ''; } @@ -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').'
'; } @@ -321,9 +321,15 @@ sub exportcourse { open(OUTPUT, "zip -r $imszip * 2> /dev/null |"); close(OUTPUT); chdir $cwd; - $outcome .= &mt('Download the zip file from IMS '.lc($type).' archive
',$imszipfile,); + $outcome .= '

' + .&mt('Download the zip file from [_1]IMS '.lc($type).' archive[_2]' + ,'','') + .'

'; if ($copyresult) { - $outcome .= &mt('The following errors occurred during export - [_1]',$copyresult); + $outcome .= '

' + .&mt('The following errors occurred during export - [_1]' + ,$copyresult) + .'

'; } } else { $outcome = '
'.&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.').'
'; @@ -335,21 +341,23 @@ sub exportcourse { $r->print(&Apache::loncommon::end_page()); } else { my $display; - $display = ''."\n"; - $display .= &mt('Choose which items you wish to export from your '.$type.'.

'); - $display .= ''. - ''. - ''. - ''. - '
 Content items'. - ''; + $display .= '
'. + ''.&mt('Content items').''. + ''. - '  
  
 Discussion posts'. - '
'. + '
'. + ''.&mt('Discussion posts').''. + ''. - '  
'; + '  '. + '
'; my $curRes; my $depth = 0; my $count = 0; @@ -358,13 +366,17 @@ sub exportcourse { my %parent = (); my %children = (); my $lastcontainer = $startcount; - my @bgcolors = ('#F6F6F6','#FFFFFF'); - $display .= ''. - '' + .''; + $display .= '' + .&Apache::loncommon::end_data_table_header_row(); while ($curRes = $it->next()) { if (ref($curRes)) { $count ++; @@ -385,39 +397,46 @@ sub exportcourse { $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; } } - my $color = $count%2; - $display .=''; + $display .= ' '.$curRes->title().''."\n"; + + # Existing discussion posts? if ($discussiontime{$ressymb} > 0) { $boards ++; $currelem = $count+$boards+$startcount; - $display .= ''."\n"; + $display .= ''."\n"; } else { - $display .= ''."\n"; + $display .= ''."\n"; } + $display .= &Apache::loncommon::end_data_table_row(); } } + $display .= &Apache::loncommon::end_data_table(); my $scripttag = qq| - |; $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package', $scripttag)); $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); - $r->print($display.'
Export content item?
 '."\n"; + $display .= &Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_header_row() + .''.&mt('Export content item?').''; if ($numdisc > 0) { - $display.='Export discussion posts?'."\n"; + $display .= &mt('Export discussion posts?'); + } else { + $display .= ' '; } - $display.=' 
'."\n". - ''."\n" + .'is_sequence()) || ($curRes->is_page())) { my $checkitem = $count + $boards + $startcount; - $display .= 'onClick="javascript:propagateCheck('."'$checkitem'".')"'; + $display .= 'onclick="javascript:propagateCheck('."'$checkitem'".')"'; } $display .= ' />'."\n"; for (my $i=0; $i<$depth; $i++) { - $display .= ''."\n"; + $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; $children{$parent{$depth}} .= $currelem.':'; - $display .= ' '.$curRes->title().'  ' + .'' + .'  
'. - '

'. + $r->print($display. + '

'. '

'); } @@ -759,7 +778,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 +818,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 +871,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 +940,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 +963,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 +972,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 +1003,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; @@ -1004,15 +1023,14 @@ sub breadcrumbs { &Apache::lonhtmlcommon::add_breadcrumb( {'href'=>$url.$cpinfo, 'title'=>$name, - 'text'=>''. - $name.'', + 'text'=>$name, 'no_mt'=>1, }); $plain.=$name.' > '; } $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 +1143,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 +1194,7 @@ sub docs_change_log { if ($oldname ne '' && $oldname ne $newname) { $r->print(&LONCAPA::map::qtescape($newname)); } - } + } $r->print('

'); - } + } 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 +1678,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 +1733,7 @@ sub parse_supplemental_title { } if (wantarray) { return ($title,$foldertitle,$renametitle); - } + } return $title; } @@ -1736,7 +1754,7 @@ sub entryline { } my $orderidx=$LONCAPA::map::order[$index]; - + $renametitle=~s/\\/\\\\/g; $renametitle=~s/\"\;/\\\"/g; @@ -1763,19 +1781,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); @@ -1999,18 +2018,18 @@ 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 - + $form_end $form_start - + $form_end $form_start $rand_order_text $form_end @@ -2044,7 +2063,7 @@ sub tiehash { $hashtied=1; } } - } + } } sub untiehash { @@ -2093,7 +2112,7 @@ sub checkonthis { if (($errorcount) || ($warningcount)) { if ($errorcount) { - $r->print(''. + $r->print(''.&mt('bomb').''. &mt('[quant,_1,error]',$errorcount).''); } if ($warningcount) { @@ -2118,7 +2137,7 @@ sub checkonthis { unless ($url=~/\$/) { $r->print(''.&mt('not found').''); } else { - $r->print(''.&mt('unable to verify variable URL').''); + $r->print(''.&mt('unable to verify variable URL').''); } } else { $r->print(''.&mt('access denied').''); @@ -2252,7 +2271,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').'

'); @@ -2393,7 +2412,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; @@ -2404,7 +2423,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; @@ -2483,13 +2502,17 @@ 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". '
'. '

'. &mt($message,' '). + &mt('re-initializing '.$course_type).'" onclick="reinit(this.form)" />'). $help{'Caching'}.'

'."\n\n"); } @@ -2537,9 +2560,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 @@ -2615,15 +2638,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; @@ -2633,7 +2656,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)); @@ -2646,20 +2669,24 @@ sub handler { $script .= &editing_js($udom,$uname); } # -------------------------------------------------------------------- Body tag - $script = ''; + $script = ''; my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}]; $r->print(&Apache::loncommon::start_page("$type Documents", $script, {'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, @@ -2684,8 +2711,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} =~ /:/) { @@ -2721,8 +2748,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 @@ -2734,7 +2761,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); } } } @@ -2760,21 +2787,21 @@ 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' => 'Bulletin Board', - 'mypi' => 'My Personal Info', - 'grpo' => 'Group Files', + 'bull' => 'Discussion Board', + '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', 'comment' => 'Comment', 'parse' => 'Upload embedded images/multimedia files if HTML file!', - 'nd' => 'New Document', + 'nd' => 'Upload Document', 'pm' => 'Published Map', 'sd' => 'Special Document', 'mo' => 'More Options', @@ -2820,20 +2847,20 @@ FUFORM
$lt{'pubd'}
$uploadtag - +
- + $help{'Importing_LON-CAPA_Resource'}
- +

$lt{'copm'}

- $help{'Load_Map'}

@@ -2845,7 +2872,7 @@ SEDFFORM $uploadtag - $help{'Adding_External_Resource'}
@@ -2872,41 +2899,67 @@ ERFORM $containertag = ''; $uploadtag = ''; } - ##############alter hashaufruf - $r->print(&generate_admin_options($containertag,$uploadtag,\%lt,\%help,\%env)); - $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc', - &mt('Editing the Table of Contents for your '.$type))); + $r->print(< + + + + + $containertag + +
+ + $uploadtag +
+HIDDENFORM + } +# --------------------------------------------------------- Main tab structure + my $activeClass = 1; + my $active = ''; + $r->print('
'); # --------------------------------------------------------- Standard documents - $r->print(''); - - if (($standard) && ($allowed) && (!$forcesupplement)) { - $r->print(' - -'."\n". -'
'); -# '

'.&mt('Main Course Documents'). -# ($allowed?' '.$help{'Main_Course_Documents'}:'').'

'); + my $savefolderpath; + my $active = 'style="display: none;"'; + if($activeClass == 0){ + $active = 'style="display: block;"'; + } + $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 = ''; } my $postexec=''; if ($folder eq 'default') { - $r->print(''); + $r->print('' + ); } else { #$postexec='self.close();'; } - $hadchanges=0; - my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed, - $upload_output,$type); - if ($error) { - $r->print('

'.$error.'

'); - } - if ($hadchanges) { - &mark_hash_old(); - } - &changewarning($r,$postexec); my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. '.sequence'; my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. @@ -2921,14 +2974,14 @@ ERFORM my $recoverform=(< - + RFORM my $imspform=(< - + IMSPFORM @@ -2949,7 +3002,7 @@ NNFORM $help{'Simple Page'} + onclick="javascript:makesmppage();" /> $help{'Simple Page'} NSPFORM @@ -2960,7 +3013,7 @@ NSPFORM $help{'Simple Problem'} + onclick="javascript:makesmpproblem();" />$help{'Simple Problem'} @@ -2968,13 +3021,13 @@ NSPROBFORM my $newdropboxform=(< - $uploadtag + $uploadtag - + - - + onclick="javascript:makedropbox();" /> + + NDBFORM my $newexuploadform=(< + onclick="javascript:makeexamupload();" /> $help{'Score_Upload_Form'} @@ -2995,7 +3048,7 @@ NEXUFORM + onclick="javascript:makebulboard();" /> $help{'Bulletin Board'} @@ -3008,7 +3061,7 @@ NBFORM value="$plainname=/adm/$udom/$uname/aboutme" /> - $help{'My Personal Info'} + $help{'My Personal Information Page'} NAMFORM @@ -3019,7 +3072,7 @@ NAMFORM + onclick="javascript:makeabout();" /> NASOFORM @@ -3037,57 +3090,31 @@ NASOFORM NROSTFORM - $r->print(< - -
-$fileuploadform - -$simpleeditdefaultform -
-$recoverform -ENDFORM - unless ($env{'form.pagepath'}) { - $r->print(< -$extresourcesform -
-$imspform -ENDFORM - } - $r->print('
'); unless ($env{'form.pagepath'}) { my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); - - my $newpageform=(< $help{'Adding_Pages'} NPFORM - my $newfolderform=(< $help{'Adding_Folders'} @@ -3104,7 +3131,7 @@ NFFORM NSYLFORM - + my $newgroupfileform=(< $uploadtag @@ -3112,78 +3139,51 @@ NSYLFORM value="$lt{'grpo'}=/adm/$coursedom/$coursenum/aboutme" /> - $help{'Group Files'} + $help{'Group Portfolio'} NGFFORM - - my $specialdocumentsform=(< -$newfolderform -
-$newpageform -
-$newsylform -
-$newnavform -
-$newsmppageform -
-$newsmpproblemform -
-$newdropboxform -
-$newexuploadform -
-$newbulform -
-$newaboutmeform -
-$newaboutsomeoneform -
-$newgroupfileform -
-$newrosterform -ENDFORM - -$r->print($specialdocumentsform); + $specialdocumentsform="
$newpageform
$newsylform
$newgroupfileform"; + } + $specialdocumentsform.="
$newnavform
$newsmppageform +
$newsmpproblemform
$newdropboxform +
$newexuploadform
$newbulform +
$newaboutmeform
$newaboutsomeoneform +
$newrosterform"; +if($env{'form.pagepath'}) { + $specialdocumentsform="
$newsmpproblemform
$newexuploadform"; +} my %orderhash = ( - 'aa_eins' => 'New Document', - 'bb_zwei' => 'Published Documents', - 'cc_drei' => 'Special Documents', - 'dd_vier' => 'More Options', - 'zz_hide' => 'Hide all Option', + 'aa' => ['Upload 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 %namehash = ( - 'New Document' => $fileuploadform, - 'Published Documents' => $simpleeditdefaultform, - 'Special Documents' => $specialdocumentsform, - 'More Options' => $extresourcesform.'
'.$imspform.'
'.$recoverform, - 'drei' => 'dr', - ); -my $varcd = 'Course Documents'; -$r->print(&generate_edit_table($varcd,\%namehash,\%orderhash)); +my $tid='1'; +my $varcd = 'Main Course Documents'; +$r->print(&generate_edit_table($tid,$varcd,\%orderhash)); + $hadchanges=0; + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); + if ($error) { + $r->print('

'.$error.'

'); + } + if ($hadchanges) { + &mark_hash_old(); + } - } + &changewarning($r,''); +$r->print(''); if ($env{'form.pagepath'}) { - $r->print(< -$newexuploadform -ENDBLOCK } - $r->print('
'); -#$r->print(&generate_edit_table(\%namehash,\%orderhash)); - $r->print(''); - } # ----------------------------------------------------- Supplemental documents - if (!$forcestandard) { - $r->print(''); -# '

'.&mt('Supplemental Course Documents'). -# ($allowed?' '.$help{'Supplemental'}:'').'

'); + my $active = 'style="display: none;"'; + if($activeClass == 1){ + $active = 'style="display: block;"'; + } + $r->print('
'); my $folder=$env{'form.folder'}; unless ($folder=~/^supplemental/) { $folder='supplemental'; @@ -3192,11 +3192,10 @@ ENDBLOCK (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) { $env{'form.folderpath'} = 'supplemental&'. &escape(&mt('Supplemental '.$type.' Documents')); + }else{ + $env{'form.folderpath'} = $savefolderpath; } - my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); - if ($error) { - $r->print('

'.$error.'

'); - } + $env{'form.pagepath'} = ''; if ($allowed) { my $folderseq= '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time. @@ -3214,7 +3213,7 @@ ENDBLOCK

$lt{'comment'}:
-
@@ -3232,7 +3231,7 @@ SUPDOCFORM $help{'Adding_Folders'} @@ -3245,7 +3244,7 @@ SNFFORM $help{'Adding_External_Resource'} @@ -3270,35 +3269,30 @@ SNSFORM value="$plainname=/adm/$udom/$uname/aboutme" /> - $help{'My Personal Info'} + $help{'My Personal Information Page'} SNAMFORM - $r->print(< -
  • $lt{'nd'}
  • -
  • $lt{'sd'}
  • -
  • $lt{'hao'}
  • - - - - -
    -$supupdocform - -$supnewfolderform -
    -$supnewextform -
    -$supnewsylform -
    -$supnewaboutmeform -
    -ENDSUPFORM + + +my %suporderhash = ( + 'ee' => ['Upload Document',$supupdocform.'
    '.$supnewfolderform], + 'ff' => ['Special Documents',$supnewextform.'
    '.$supnewsylform.'
    '.$supnewaboutmeform], + 'zz' => ['Hide all Options'], + ); + +my $tid='2'; +my $varscd = 'Supplemental Course Documents'; + +$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('
    @@ -3308,7 +3302,6 @@ ENDSUPFORM
    '); } - } else { unless ($upload_result eq 'phasetwo') { # -------------------------------------------------------- This is showdoc mode @@ -3321,82 +3314,58 @@ ENDSUPFORM } $r->print(&Apache::loncommon::end_page()); return OK; -} +} sub generate_admin_options { - my ($containertag,$uploadtag,$lt_ref,$help_ref,$env_ref) = @_; - my %lt = %{$lt_ref}; + my ($containertag,$uploadtag,$help_ref,$env_ref) = @_; + my %lt=&Apache::lonlocal::texthash( + 'vc' => 'Verify Content', + 'cv' => 'Check/Set Resource Versions', + 'ls' => 'List Symbs', + 'sl' => 'Show Log' + ); my %help = %{$help_ref}; my %env = %{$env_ref}; my $dumpbut=&dumpbutton(); my $exportbut=&exportbutton(); return (< - - - - - $containertag - -
    - - $uploadtag -
    -
      -
    • - $help{'Verify_Content'} -
    • -
    • - $help{'Check_Resource_Versions'} -
    • -
    • + $help{'Verify_Content'}
      + $help{'Check_Resource_Versions'}
      $dumpbut -
    • -
    • $exportbut -
    • -
    • -
    • -
    • - +
      -
    • -
    -
     
    ENDOPTIONFORM } sub generate_edit_table { - my ($varcd,$namehash_ref,$orderhash_ref) = @_; - #my %optionhash = %{$optionhash_ref}; #id verlinkt mit inhalt - #my %tablehash = %{$tablehash_ref}; - my %namehash = %{$namehash_ref}; #name verlinkt mit id - my %orderhash = %{$orderhash_ref}; #name mit kürzel verlinkt mit name - #my %tablehash = %{$tablehash_ref}; + my ($tid,$varcd,$orderhash_ref) = @_; + my %orderhash = %{$orderhash_ref}; my $form; - #foreach my $id (keys(%tablehash)){ - $form = '

    '.&mt('Upload '.$varcd).'

    '; - - $form .= '
      '; + $form = '

      '.&mt($varcd).'

      '; + $form .= ''; + $form .= '
      '; + foreach my $field (keys(%orderhash)){ + if($field ne 'zz'){ + $form .= ''; + } } $form .= '
      '; -#} + return $form; } @@ -3409,12 +3378,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 Bulletin Board', - p_mab => "Enter user:domain for User's 'About Me' Page", - p_mab2 => "About [_99]", + p_mbb => 'Title for the Discussion Board', + 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', @@ -3462,7 +3431,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(); @@ -3471,7 +3440,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(); @@ -3480,7 +3449,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(); @@ -3489,7 +3458,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(); @@ -3514,103 +3483,116 @@ function makeabout() { if ((comp[0]) && (comp[1])) { this.document.forms.newaboutsomeone.importdetail.value= '$lt{"p_mab2"}'+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme'; - this.document.forms.newaboutsomeone.submit(); - } else { - alert("$lt{'p_mab_alrt1'}"); - } - } else { - alert("$lt{'p_mab_alrt2'}"); - } + this.document.forms.newaboutsomeone.submit(); + } else { + alert("$lt{'p_mab_alrt1'}"); } +} else { + alert("$lt{'p_mab_alrt2'}"); +} +} } function makeims() { - var caller = document.forms.ims.folder.value; - var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one"; - newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes"); - newWindow.location.href = newlocation; +var caller = document.forms.ims.folder.value; +var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one"; +newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes"); +newWindow.location.href = newlocation; } function finishpick() { - var title=this.document.forms.extimport.title.value; - var url=this.document.forms.extimport.url.value; - var form=this.document.forms.extimport.useform.value; - var residx=this.document.forms.extimport.residx.value; - eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();'); +var title=this.document.forms.extimport.title.value; +var url=this.document.forms.extimport.url.value; +var form=this.document.forms.extimport.useform.value; +var residx=this.document.forms.extimport.residx.value; +eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();'); } function changename(folderpath,index,oldtitle,container,pagesymb) { - var title=prompt('$lt{"p_chn"}',oldtitle); - if (title) { - this.document.forms.renameform.markcopy.value=-1; - this.document.forms.renameform.title.value=title; - this.document.forms.renameform.cmd.value='rename_'+index; - if (container == 'sequence') { - this.document.forms.renameform.folderpath.value=folderpath; - } - if (container == 'page') { - this.document.forms.renameform.pagepath.value=folderpath; - this.document.forms.renameform.pagesymb.value=pagesymb; - } - this.document.forms.renameform.submit(); - } +var title=prompt('$lt{"p_chn"}',oldtitle); +if (title) { +this.document.forms.renameform.markcopy.value=-1; +this.document.forms.renameform.title.value=title; +this.document.forms.renameform.cmd.value='rename_'+index; +if (container == 'sequence') { + this.document.forms.renameform.folderpath.value=folderpath; +} +if (container == 'page') { + this.document.forms.renameform.pagepath.value=folderpath; + this.document.forms.renameform.pagesymb.value=pagesymb; +} +this.document.forms.renameform.submit(); +} } function removeres(folderpath,index,oldtitle,container,pagesymb,skip_confirm) { - if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) { - this.document.forms.renameform.markcopy.value=-1; - this.document.forms.renameform.cmd.value='del_'+index; - if (container == 'sequence') { - this.document.forms.renameform.folderpath.value=folderpath; - } - if (container == 'page') { - this.document.forms.renameform.pagepath.value=folderpath; - this.document.forms.renameform.pagesymb.value=pagesymb; - } - this.document.forms.renameform.submit(); - } +if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) { +this.document.forms.renameform.markcopy.value=-1; +this.document.forms.renameform.cmd.value='del_'+index; +if (container == 'sequence') { + this.document.forms.renameform.folderpath.value=folderpath; +} +if (container == 'page') { + this.document.forms.renameform.pagepath.value=folderpath; + this.document.forms.renameform.pagesymb.value=pagesymb; +} +this.document.forms.renameform.submit(); +} } function cutres(folderpath,index,oldtitle,container,pagesymb,folder,skip_confirm) { - if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) { - this.document.forms.renameform.cmd.value='cut_'+index; - this.document.forms.renameform.markcopy.value=index; - this.document.forms.renameform.copyfolder.value=folder+'.'+container; - if (container == 'sequence') { - this.document.forms.renameform.folderpath.value=folderpath; - } - if (container == 'page') { - this.document.forms.renameform.pagepath.value=folderpath; - this.document.forms.renameform.pagesymb.value=pagesymb; - } - this.document.forms.renameform.submit(); - } +if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) { +this.document.forms.renameform.cmd.value='cut_'+index; +this.document.forms.renameform.markcopy.value=index; +this.document.forms.renameform.copyfolder.value=folder+'.'+container; +if (container == 'sequence') { + this.document.forms.renameform.folderpath.value=folderpath; +} +if (container == 'page') { + this.document.forms.renameform.pagepath.value=folderpath; + this.document.forms.renameform.pagesymb.value=pagesymb; +} +this.document.forms.renameform.submit(); +} } function markcopy(folderpath,index,oldtitle,container,pagesymb,folder) { - this.document.forms.renameform.markcopy.value=index; - this.document.forms.renameform.copyfolder.value=folder+'.'+container; - if (container == 'sequence') { - this.document.forms.renameform.folderpath.value=folderpath; - } - if (container == 'page') { - this.document.forms.renameform.pagepath.value=folderpath; - this.document.forms.renameform.pagesymb.value=pagesymb; - } - this.document.forms.renameform.submit(); +this.document.forms.renameform.markcopy.value=index; +this.document.forms.renameform.copyfolder.value=folder+'.'+container; +if (container == 'sequence') { +this.document.forms.renameform.folderpath.value=folderpath; +} +if (container == 'page') { +this.document.forms.renameform.pagepath.value=folderpath; +this.document.forms.renameform.pagesymb.value=pagesymb; +} +this.document.forms.renameform.submit(); } -function hideAll() { - currentData = document.getElementById('content'); - currentDivs = currentData.getElementsByTagName('div'); - for (i = 0; i < currentDivs.length; i++) { - currentDivs[i].style.display = 'none'; +function unselectInactive(nav) { +currentNav = document.getElementById(nav); +currentLis = currentNav.getElementsByTagName('LI'); +for (i = 0; i < currentLis.length; i++) { + currentLis[i].className = 'i'; +} +} + +function hideAll(current, nav, data) { +unselectInactive(nav); +current.className = 'active'; +currentData = document.getElementById(data); +currentDivs = currentData.getElementsByTagName('DIV'); +for (i = 0; i < currentDivs.length; i++) { + if(currentDivs[i].className == 'LC_ContentBox'){ + currentDivs[i].style.display = 'none'; } } +} -function showPage(current, pageId) { - hideAll(); +function showPage(current, pageId, nav, data) { + hideAll(current, nav, data); + unselectInactive(nav); current.className = 'active'; currentData = document.getElementById(pageId); currentData.style.display = 'block'; @@ -3642,7 +3624,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