--- loncom/interface/londocs.pm 2009/04/07 20:12:55 1.362 +++ loncom/interface/londocs.pm 2009/04/15 12:44:24 1.364 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.362 2009/04/07 20:12:55 ehlerst Exp $ +# $Id: londocs.pm,v 1.364 2009/04/15 12:44:24 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); } @@ -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 @@ -859,7 +859,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 +924,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". @@ -1176,7 +1176,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 +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; @@ -1811,7 +1811,7 @@ sub entryline { } my $copylink=' '; my $cutlink=' '; - + my $skip_confirm = 0; if ( $folder =~ /^supplemental/ || ($url =~ m{( /smppg$ @@ -1897,7 +1897,7 @@ END &Apache::lonnet::allowuploaded('/adm/coursedoc',$url); } } - + my $orig_url = $url; $orig_url=~s{http(:|:)//https(:|:)//}{https$2//}; my $external = ($url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/}); @@ -1932,7 +1932,7 @@ END } if ($container eq 'page') { my $symb=$env{'form.pagesymb'}; - + $url=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($symb))[2]); $url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb); } @@ -2045,7 +2045,7 @@ sub tiehash { $hashtied=1; } } - } + } } sub untiehash { @@ -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; @@ -2619,7 +2619,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) { @@ -2653,7 +2653,7 @@ sub handler { {'force_register' => $showdoc, 'bread_crumbs' => $brcrum}). &Apache::loncommon::help_open_menu('','',273,'RAT')); - + my %allfiles = (); my %codebase = (); my ($upload_result,$upload_output); @@ -2722,7 +2722,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})) { @@ -3100,7 +3100,7 @@ NFFORM NSYLFORM - + my $newgroupfileform=(< $uploadtag @@ -3125,21 +3125,15 @@ if($env{'form.pagepath'}) { } my %orderhash = ( - 'aa' => 'New Document', - 'bb' => 'Published Documents', - 'cc' => 'Special Documents', - 'dd' => 'Tools', - 'zz' => 'Hide all Options', - ); -my %namehash = ( - 'New Document' => $fileuploadform.'
'.$newfolderform, - 'Published Documents' => $simpleeditdefaultform, - 'Special Documents' => $specialdocumentsform, - 'Tools' => $extresourcesform.'
'.$imspform.'
'.$recoverform.'
'.&generate_admin_options($containertag,$uploadtag,\%help,\%env), + '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 $varcd = 'Main Course Documents'; -$r->print(&generate_edit_table($tid,$varcd,\%namehash,\%orderhash)); +$r->print(&generate_edit_table($tid,$varcd,\%orderhash)); $hadchanges=0; my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); if ($error) { @@ -3252,26 +3246,21 @@ SNAMFORM my %suporderhash = ( - 'ee' => 'New Document', - 'ff' => 'Special Documents', - 'zz' => 'Hide all Options', - ); - -my %supnamehash = ( - 'New Document' => $supupdocform.'
'.$supnewfolderform, - 'Special Documents' => $supnewextform.'
'.$supnewsylform.'
'.$supnewaboutmeform, + 'ee' => ['New 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,\%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(''); if ($allowed) { $r->print(' @@ -3294,7 +3283,7 @@ $r->print(''); } $r->print(&Apache::loncommon::end_page()); return OK; -} +} sub generate_admin_options { my ($containertag,$uploadtag,$help_ref,$env_ref) = @_; @@ -3324,8 +3313,7 @@ ENDOPTIONFORM sub generate_edit_table { - my ($tid,$varcd,$namehash_ref,$orderhash_ref) = @_; - my %namehash = %{$namehash_ref}; + my ($tid,$varcd,$orderhash_ref) = @_; my %orderhash = %{$orderhash_ref}; my $form; @@ -3333,18 +3321,20 @@ sub generate_edit_table { $form .= ''; $form .= '
'; - foreach my $field (keys(%namehash)){ - $form .= ''; - } + foreach my $field (keys(%orderhash)){ + if($field ne 'zz'){ + $form .= ''; + } + } $form .= '
'; - + return $form; }