[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonhtmlcommon.pm lonmeta.pm /publisher lonpublisher.pm
www
lon-capa-cvs@mail.lon-capa.org
Mon, 29 Dec 2003 21:17:00 -0000
This is a MIME encoded message
--www1072732620
Content-Type: text/plain
www Mon Dec 29 16:17:00 2003 EDT
Modified files:
/loncom/interface loncommon.pm lonhtmlcommon.pm lonmeta.pm
/loncom/publisher lonpublisher.pm
Log:
Small bugfixes, standards and gradelevel info on directory level
--www1072732620
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20031229161700.txt"
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.166 loncom/interface/loncommon.pm:1.167
--- loncom/interface/loncommon.pm:1.166 Mon Dec 29 12:11:53 2003
+++ loncom/interface/loncommon.pm Mon Dec 29 16:17:00 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.166 2003/12/29 17:11:53 www Exp $
+# $Id: loncommon.pm,v 1.167 2003/12/29 21:17:00 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -762,30 +762,43 @@
return $selectform;
}
+sub gradeleveldescription {
+ my $gradelevel=shift;
+ my %gradelevels=(0 => 'Not specified',
+ 1 => 'Grade 1',
+ 2 => 'Grade 2',
+ 3 => 'Grade 3',
+ 4 => 'Grade 4',
+ 5 => 'Grade 5',
+ 6 => 'Grade 6',
+ 7 => 'Grade 7',
+ 8 => 'Grade 8',
+ 9 => 'Grade 9',
+ 10 => 'Grade 10',
+ 11 => 'Grade 11',
+ 12 => 'Grade 12',
+ 13 => 'Grade 13',
+ 14 => '100 Level',
+ 15 => '200 Level',
+ 16 => '300 Level',
+ 17 => '400 Level',
+ 18 => 'Graduate Level');
+ return &mt($gradelevels{$gradelevel});
+}
+
sub select_level_form {
my ($deflevel,$name)=@_;
unless ($deflevel) { $deflevel=0; }
- return &select_form($deflevel,$name,(
- 0 => 'Not specified',
- 1 => 'Grade 1',
- 2 => 'Grade 2',
- 3 => 'Grade 3',
- 4 => 'Grade 4',
- 5 => 'Grade 5',
- 6 => 'Grade 6',
- 7 => 'Grade 7',
- 8 => 'Grade 8',
- 9 => 'Grade 9',
- 10 => 'Grade 10',
- 11 => 'Grade 11',
- 12 => 'Grade 12',
- 13 => 'Grade 13',
- 14 => '100 Level',
- 15 => '200 Level',
- 16 => '300 Level',
- 17 => '400 Level',
- 18 => 'Graduate Level'));
+ my $selectform = "<select name=\"$name\" size=\"1\">\n";
+ for (my $i=0; $i<=18; $i++) {
+ $selectform.="<option value=\"$i\" ".
+ ($i==$deflevel ? 'selected' : '').
+ ">".&gradeleveldescription($i)."</option>\n";
+ }
+ $selectform.="</select>";
+ return $selectform;
}
+
#-------------------------------------------
=pod
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.36 loncom/interface/lonhtmlcommon.pm:1.37
--- loncom/interface/lonhtmlcommon.pm:1.36 Mon Dec 29 14:01:27 2003
+++ loncom/interface/lonhtmlcommon.pm Mon Dec 29 16:17:00 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.36 2003/12/29 19:01:27 www Exp $
+# $Id: lonhtmlcommon.pm,v 1.37 2003/12/29 21:17:00 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -437,11 +437,11 @@
$Str .= ' size="'.$size.'" ';
$Str .= '>'."\n";
$Str .= '<option value="Active" '.$OpSel1.'>'.
- 'Currently Enrolled</option>'."\n";
+ &mt('Currently Enrolled').'</option>'."\n";
$Str .= '<option value="Expired" '.$OpSel2.'>'.
- 'Previously Enrolled</option>'."\n";
+ &mt('Previously Enrolled').'</option>'."\n";
$Str .= '<option value="Any" '.$OpSel3.'>'.
- 'Any Enrollment Status</option>'."\n";
+ &mt('Any Enrollment Status').'</option>'."\n";
$Str .= '</select>'."\n";
}
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.47 loncom/interface/lonmeta.pm:1.48
--- loncom/interface/lonmeta.pm:1.47 Mon Dec 29 14:01:27 2003
+++ loncom/interface/lonmeta.pm Mon Dec 29 16:17:00 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.47 2003/12/29 19:01:27 www Exp $
+# $Id: lonmeta.pm,v 1.48 2003/12/29 21:17:00 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -283,6 +283,11 @@
$value=~s/(\w+)(\:|\@)(\w+)/&authordisplay($1,$3)/gse;
return $value;
}
+# Gradelevel
+ if (($type eq 'lowestgradelevel') ||
+ ($type eq 'highestgradelevel')) {
+ return &Apache::loncommon::gradeleveldescription($value);
+ }
# Only for advance users below
unless ($ENV{'user.adv'}) { return '<i>- '.&mt('not displayed').' -</i>' };
# File
@@ -322,8 +327,72 @@
}
# ============================================== Pretty input of metadata field
+sub selectbox {
+ my ($name,$value,$functionref,@idlist)=@_;
+ my $selout='<select name="'.$name.'">';
+ foreach (@idlist) {
+ $selout.='<option value=\''.$_.'\'';
+ if ($_ eq $value) {
+ $selout.=' selected>'.&{$functionref}($_).'</option>';
+ }
+ else {$selout.='>'.&{$functionref}($_).'</option>';}
+ }
+ return $selout.'</select>';
+}
+
+
sub prettyinput {
- my ($type,$value,$fieldname)=@_;
+ my ($type,$value,$fieldname,$formname)=@_;
+# Language
+ if ($type eq 'language') {
+ return &selectbox($fieldname,
+ $value,
+ \&Apache::loncommon::languagedescription,
+ (&Apache::loncommon::languageids));
+ }
+# Copyright
+ if ($type eq 'copyright') {
+ return &selectbox($fieldname,
+ $value,
+ \&Apache::loncommon::copyrightdescription,
+ (&Apache::loncommon::copyrightids));
+ }
+# Gradelevels
+ if (($type eq 'lowestgradelevel') ||
+ ($type eq 'highestgradelevel')) {
+ return &Apache::loncommon::select_level_form($value,$fieldname);
+ }
+# Obsolete
+ if ($type eq 'obsolete') {
+ return '<input type="checkbox" name="'.$fieldname.'"'.
+ ($value?' checked="1"':'').' />';
+ }
+# Obsolete replacement file
+ if ($type eq 'obsoletereplacement') {
+ return '<input type="text" name="'.$fieldname.
+ '" size="60" value="'.$value.'" /><a href="javascript:openbrowser'.
+ "('".$formname."','".$fieldname."'".
+ ",'')\">".&mt('Select').'</a>';
+ }
+# Customdistribution file
+ if ($type eq 'customdistributionfile') {
+ return '<input type="text" name="'.$fieldname.
+ '" size="60" value="'.$value.'" /><a href="javascript:openbrowser'.
+ "('".$formname."','".$fieldname."'".
+ ",'rights')\">".&mt('Select').'</a>';
+ }
+# Dates
+ if (($type eq 'creationdate') ||
+ ($type eq 'lastrevisiondate')) {
+ return &Apache::lonhtmlcommon::date_setter($formname,
+ $fieldname,$value);
+ }
+# No pretty input found
+ $value=~s/^\s+//gs;
+ $value=~s/\s+$//gs;
+ $value=~s/\s+/ /gs;
+ $value=~s/\"/\&quod\;/gs;
+ return '<input type="text" name="'.$fieldname.'" size="80" value="'.$value.'" />';
}
# ================================================================ Main Handler
@@ -526,30 +595,23 @@
<html><head><title>Edit Catalog Information</title></head>
$bodytag
<h1>$displayfile</h1>
-<form method="post">
+<form method="post" name="defaultmeta">
ENDEDIT
+ $r->print('<script language="JavaScript">'.
+ &Apache::loncommon::browser_and_searcher_javascript.
+ '</script>');
my %lt=&fieldnames();
foreach ('author','title','subject','keywords','abstract','notes',
- 'copyright','customdistributionfile','language',
+ 'copyright','customdistributionfile','language','standards',
+ 'lowestgradelevel','highestgradelevel',
'obsolete','obsoletereplacement') {
- if ($ENV{'form.new_'.$_}) {
- $Apache::lonpublisher::metadatafields{$_}=$ENV{'form.new_'.$_};
- }
- if (m/copyright/) {
- $r->print(&Apache::lonpublisher::selectbox($lt{$_},'new_'.$_,
- ($Apache::lonpublisher::metadatafields{$_}?
- $Apache::lonpublisher::metadatafields{$_}:'default'),
- \&Apache::loncommon::copyrightdescription,
- (&Apache::loncommon::copyrightids)));
- } elsif (m/language/) {
- $r->print(&Apache::lonpublisher::selectbox($lt{$_},'new_'.$_,
- $Apache::lonpublisher::metadatafields{$_},
- \&Apache::loncommon::languagedescription,
- (&Apache::loncommon::languageids)));
- } else {
- $r->print(&Apache::lonpublisher::textfield($lt{$_},'new_'.$_,
- $Apache::lonpublisher::metadatafields{$_}));
+ $Apache::lonpublisher::metadatafields{$_}=$ENV{'form.new_'.$_};
+ unless ($Apache::lonpublisher::metadatafields{'copyright'}) {
+ $Apache::lonpublisher::metadatafields{'copyright'}='default';
}
+ $r->print('<p>'.$lt{$_}.': '.&prettyinput($_,
+ $Apache::lonpublisher::metadatafields{$_},
+ 'new_'.$_,'defaultmeta').'</p>');
}
if ($ENV{'form.store'}) {
my $mfh;
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.157 loncom/publisher/lonpublisher.pm:1.158
--- loncom/publisher/lonpublisher.pm:1.157 Mon Dec 29 14:13:23 2003
+++ loncom/publisher/lonpublisher.pm Mon Dec 29 16:17:00 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Publication Handler
#
-# $Id: lonpublisher.pm,v 1.157 2003/12/29 19:13:23 www Exp $
+# $Id: lonpublisher.pm,v 1.158 2003/12/29 21:17:00 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1234,7 +1234,7 @@
$scrout.=&textfield('Custom Distribution File','customdistributionfile',
$metadatafields{'customdistributionfile'}).
$copyright_help;
- my $uctitle=uc(&mt('Obsolete'));
+ my $uctitle=&mt('Obsolete');
$scrout.=
"\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
'</b></font> <input type="checkbox" name="obsolete" ';
--www1072732620--