--- loncom/interface/londocs.pm 2009/02/25 09:28:40 1.348 +++ loncom/interface/londocs.pm 2009/06/08 18:04:45 1.370 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.348 2009/02/25 09:28:40 weissno Exp $ +# $Id: londocs.pm,v 1.370 2009/06/08 18:04:45 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. @@ -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 ''; } @@ -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. + '

'. '

'); } @@ -859,7 +878,7 @@ sub extract_media { $repstatus = 'ok'; } } elsif ($caller eq 'uploaded') { - + $repstatus = &Apache::lonnet::getuploaded('GET',$embed_url,$cdom,$cnum,\$embed_content,$rtncode); } if ($repstatus eq 'ok') { @@ -924,7 +943,7 @@ sub group_import { 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". @@ -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 { @@ -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.').'

'); } @@ -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; @@ -1775,7 +1793,7 @@ sub entryline { ' '.&mt('Random Order').' '; +'; } if ($ispage) { my $pagename=&escape($pagetitle); @@ -2000,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 @@ -2045,7 +2063,7 @@ sub tiehash { $hashtied=1; } } - } + } } sub untiehash { @@ -2094,7 +2112,7 @@ sub checkonthis { if (($errorcount) || ($warningcount)) { if ($errorcount) { - $r->print(''. + $r->print(''.&mt('bomb').''. &mt('[quant,_1,error]',$errorcount).''); } if ($warningcount) { @@ -2119,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').''); @@ -2394,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; @@ -2484,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"); } @@ -2540,7 +2562,7 @@ sub handler { 'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages'); $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 @@ -2619,7 +2641,7 @@ sub handler { if (($env{'form.folder'}=~/^(?:group|default)_/) || ($env{'form.folder'} =~ m:^\d+/(pages|sequences)/:)) { $forcestandard = 1; - } + } $forcesupplement=($env{'form.folder'}=~/^supplemental_/); if ($allowed) { @@ -2647,13 +2669,17 @@ 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); @@ -2722,7 +2748,7 @@ 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; } if (exists($codebase{$item})) { @@ -2767,7 +2793,7 @@ sub handler { 'scuf' => 'Score Upload Form', 'bull' => 'Discussion Board', 'mypi' => 'My Personal Information Page', - 'grpo' => 'Group Files', + 'grpo' => 'Group Portfolio', 'rost' => 'Course Roster', 'abou' => 'Personal Information Page for a User', 'imsf' => 'Import IMS package', @@ -2775,7 +2801,7 @@ sub handler { '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', @@ -2821,20 +2847,20 @@ FUFORM
$lt{'pubd'}
$uploadtag - +
- + $help{'Importing_LON-CAPA_Resource'}
- +

$lt{'copm'}

$help{'Load_Map'}

@@ -2846,7 +2872,7 @@ SEDFFORM $uploadtag - $help{'Adding_External_Resource'}
@@ -2889,43 +2915,48 @@ HIDDENFORM } # --------------------------------------------------------- Main tab structure my $activeClass = 1; + my $active = ''; $r->print('
'); + $r->print('
  • '.&mt('Supplemental Course Documents').'
  • '); + $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 = ''; } my $postexec=''; if ($folder eq 'default') { - $r->print(''); + $r->print('' + ); } else { #$postexec='self.close();'; } @@ -2943,14 +2974,14 @@ HIDDENFORM my $recoverform=(< - + RFORM my $imspform=(< - + IMSPFORM @@ -2971,7 +3002,7 @@ NNFORM $help{'Simple Page'} + onclick="javascript:makesmppage();" /> $help{'Simple Page'} NSPFORM @@ -2982,7 +3013,7 @@ NSPFORM $help{'Simple Problem'} + onclick="javascript:makesmpproblem();" />$help{'Simple Problem'} @@ -2994,7 +3025,7 @@ NSPROBFORM + onclick="javascript:makedropbox();" /> NDBFORM @@ -3005,7 +3036,7 @@ NDBFORM + onclick="javascript:makeexamupload();" /> $help{'Score_Upload_Form'} @@ -3017,7 +3048,7 @@ NEXUFORM + onclick="javascript:makebulboard();" /> $help{'Bulletin Board'} @@ -3041,7 +3072,7 @@ NAMFORM + onclick="javascript:makeabout();" /> NASOFORM @@ -3060,6 +3091,7 @@ NASOFORM NROSTFORM my $specialdocumentsform; +my $newfolderform; unless ($env{'form.pagepath'}) { my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); @@ -3070,19 +3102,19 @@ my $specialdocumentsform; $help{'Adding_Pages'} NPFORM - my $newfolderform=(< $help{'Adding_Folders'} @@ -3099,7 +3131,7 @@ NFFORM NSYLFORM - + my $newgroupfileform=(< $uploadtag @@ -3107,12 +3139,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 +3156,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' => ['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 $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 +3178,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 +3192,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 +3213,7 @@ $r->print('
    ');

    $lt{'comment'}:
    -
    @@ -3206,7 +3231,7 @@ SUPDOCFORM $help{'Adding_Folders'} @@ -3219,7 +3244,7 @@ SNFFORM $help{'Adding_External_Resource'} @@ -3252,32 +3277,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' => ['Upload 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 +3314,7 @@ $r->print('
    '); } $r->print(&Apache::loncommon::end_page()); return OK; -} +} sub generate_admin_options { my ($containertag,$uploadtag,$help_ref,$env_ref) = @_; @@ -3316,56 +3330,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; - $form = '

    '.&mt($varcd).'

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

      '.&mt($varcd).'

      '; + $form .= ''; - $form .= '
      '; - foreach my $field (keys(%namehash)){ - $form .= ''; - } + $form .= '
      '; + foreach my $field (keys(%orderhash)){ + if($field ne 'zz'){ + $form .= ''; + } + } $form .= '
      '; - + return $form; } @@ -3378,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 Discussion Board', p_mab => "Enter user:domain for User's Personal Information Page", - p_mab2 => "Personal Information Page [_99]", + 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',