--- loncom/interface/londocs.pm 2009/04/07 20:12:55 1.362
+++ loncom/interface/londocs.pm 2009/05/16 21:01:07 1.367
@@ -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.367 2009/05/16 21:01:07 droeschl 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);
}
@@ -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
@@ -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 = '
');
- }
+ }
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 +1714,7 @@ sub parse_supplemental_title {
}
if (wantarray) {
return ($title,$foldertitle,$renametitle);
- }
+ }
return $title;
}
@@ -1736,7 +1735,7 @@ sub entryline {
}
my $orderidx=$LONCAPA::map::order[$index];
-
+
$renametitle=~s/\\/\\\\/g;
$renametitle=~s/\"\;/\\\"/g;
@@ -1811,7 +1810,7 @@ sub entryline {
}
my $copylink=' ';
my $cutlink=' ';
-
+
my $skip_confirm = 0;
if ( $folder =~ /^supplemental/
|| ($url =~ m{( /smppg$
@@ -1897,7 +1896,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 +1931,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 +2044,7 @@ sub tiehash {
$hashtied=1;
}
}
- }
+ }
}
sub untiehash {
@@ -2094,7 +2093,7 @@ sub checkonthis {
if (($errorcount) ||
($warningcount)) {
if ($errorcount) {
- $r->print('
'.
+ $r->print('
'.
&mt('[quant,_1,error]',$errorcount).'');
}
if ($warningcount) {
@@ -2119,7 +2118,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 +2393,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 +2618,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 +2652,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 +2721,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 +3099,7 @@ NFFORM
NSYLFORM
-
+
my $newgroupfileform=(<
$uploadtag
@@ -3125,21 +3124,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 +3245,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 +3282,7 @@ $r->print('');
}
$r->print(&Apache::loncommon::end_page());
return OK;
-}
+}
sub generate_admin_options {
my ($containertag,$uploadtag,$help_ref,$env_ref) = @_;
@@ -3324,8 +3312,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 +3320,20 @@ sub generate_edit_table {
$form .= '';
foreach my $name (sort(keys(%orderhash))){
if($name eq 'zz'){
- $form .= '- '.&mt($orderhash{$name}).'
';
+ $form .= '- '.&mt(${$orderhash{$name}}[0]).'
';
}else{
- $form .= '- '.&mt($orderhash{$name}).'
';
+ $form .= '- '.&mt(${$orderhash{$name}}[0]).'
';
}
}
$form .= '
';
$form .= '';
- foreach my $field (keys(%namehash)){
- $form .= '
'.$namehash{$field}.'
';
- }
+ foreach my $field (keys(%orderhash)){
+ if($field ne 'zz'){
+ $form .= '
'.${$orderhash{$field}}[1].'
';
+ }
+ }
$form .= '
';
-
+
return $form;
}