--- loncom/interface/portfolio.pm 2005/01/18 02:18:29 1.71
+++ loncom/interface/portfolio.pm 2005/02/11 06:18:52 1.74
@@ -121,7 +121,7 @@ sub display_directory {
} else {
$r->print('
Rename |
- Meta
+ | Meta
| ');
}
$r->print(' | ');
@@ -206,191 +206,7 @@ sub display_file_select {
');
}
-sub prettyinput {
- my ($type,$value,$fieldname,$formname,
- $relatedsearchflag,$relatedsep,$relatedvalue,$size)=@_;
- if (! defined($size)) {
- $size = 80;
- }
- # Language
- if ($type eq 'language') {
- return &Apache::lonmeta::selectbox($fieldname,
- $value,
- \&Apache::loncommon::languagedescription,
- (&Apache::loncommon::languageids)).
- &relatedfield(0,$relatedsearchflag,$relatedsep);
- }
- # Copyright
- if ($type eq 'copyright') {
- return &Apache::lonmeta::selectbox($fieldname,
- $value,
- \&Apache::loncommon::copyrightdescription,
- (&Apache::loncommon::copyrightids)).
- &relatedfield(0,$relatedsearchflag,$relatedsep);
- }
- # Source Copyright
- if ($type eq 'sourceavail') {
- return &Apache::lonmeta::selectbox($fieldname,
- $value,
- \&Apache::loncommon::source_copyrightdescription,
- (&Apache::loncommon::source_copyrightids)).
- &relatedfield(0,$relatedsearchflag,$relatedsep);
- }
- # Gradelevels
- if (($type eq 'lowestgradelevel') ||
- ($type eq 'highestgradelevel')) {
- return &Apache::loncommon::select_level_form($value,$fieldname).
- &relatedfield(0,$relatedsearchflag,$relatedsep);
- }
- # Obsolete
- if ($type eq 'obsolete') {
- return ''.
- &relatedfield(0,$relatedsearchflag,$relatedsep);
- }
- # Obsolete replacement file
- if ($type eq 'obsoletereplacement') {
- return '".&mt('Select').''.
- &relatedfield(0,$relatedsearchflag,$relatedsep);
- }
- # Customdistribution file
- if ($type eq 'customdistributionfile') {
- return '".&mt('Select').''.
- &relatedfield(0,$relatedsearchflag,$relatedsep);
- }
- # Source Customdistribution file
- if ($type eq 'sourcerights') {
- return '".&mt('Select').''.
- &relatedfield(0,$relatedsearchflag,$relatedsep);
- }
- # Dates
- if (($type eq 'creationdate') ||
- ($type eq 'lastrevisiondate')) {
- return
- &Apache::lonhtmlcommon::date_setter($formname,$fieldname,$value).
- &relatedfield(0,$relatedsearchflag,$relatedsep);
- }
- # No pretty input found
- $value=~s/^\s+//gs;
- $value=~s/\s+$//gs;
- $value=~s/\s+/ /gs;
- $value=~s/\"/\"\;/gs;
- return
- ''.
- &relatedfield(1,$relatedsearchflag,$relatedsep,$fieldname,
- $relatedvalue);
-}
-
-sub relatedfield {
- my ($show,$relatedsearchflag,$relatedsep,$fieldname,$relatedvalue)=@_;
- if (! $relatedsearchflag) {
- return '';
- }
- if (! defined($relatedsep)) {
- $relatedsep=' ';
- }
- if (! $show) {
- return $relatedsep.' ';
- }
- return $relatedsep.'';
-}
-
-
-# The field names
-sub fieldnames {
- return &Apache::lonlocal::texthash
- (
- 'title' => 'Title',
- 'author' =>'Author(s)',
- 'authorspace' => 'Author Space',
- 'modifyinguser' => 'Last Modifying User',
- 'subject' => 'Subject',
- 'keywords' => 'Keyword(s)',
- 'notes' => 'Notes',
- 'abstract' => 'Abstract',
- 'lowestgradelevel' => 'Lowest Grade Level',
- 'highestgradelevel' => 'Highest Grade Level',
- 'standards' => 'Standards',
- 'mime' => 'MIME Type',
- 'language' => 'Language',
- 'creationdate' => 'Creation Date',
- 'lastrevisiondate' => 'Last Revision Date',
- 'owner' => 'Publisher/Owner',
- 'copyright' => 'Copyright/Distribution',
- 'customdistributionfile' => 'Custom Distribution File',
- 'sourceavail' => 'Source Available',
- 'sourcerights' => 'Source Custom Distribution File',
- 'obsolete' => 'Obsolete',
- 'obsoletereplacement' => 'Suggested Replacement for Obsolete File',
- 'count' => 'Network-wide number of accesses (hits)',
- 'course' => 'Network-wide number of courses using resource',
- 'course_list' => 'Network-wide courses using resource',
- 'sequsage' => 'Number of resources using or importing resource',
- 'sequsage_list' => 'Resources using or importing resource',
- 'goto' => 'Number of resources that follow this resource in maps',
- 'goto_list' => 'Resources that follow this resource in maps',
- 'comefrom' => 'Number of resources that lead up to this resource in maps',
- 'comefrom_list' => 'Resources that lead up to this resource in maps',
- 'clear' => 'Material presented in clear way',
- 'depth' => 'Material covered with sufficient depth',
- 'helpful' => 'Material is helpful',
- 'correct' => 'Material appears to be correct',
- 'technical' => 'Resource is technically correct',
- 'avetries' => 'Average number of tries till solved',
- 'stdno' => 'Total number of students who have worked on this problem',
- 'difficulty' => 'Degree of difficulty',
- 'disc' => 'Degree of discrimination',
- 'dependencies' => 'Resources used by this resource',
- );
-}
-
-sub edit_meta_data {
- my ($r,$uri) = @_;
- # Construction Space Call
- # Header
- my $disuri=$uri;
- my $fn=&Apache::lonnet::filelocation('',$uri);
- $disuri=~s/^\/\~/\/priv\//;
- $disuri=~s/\.meta$//;
- my $target=$uri;
- $target=~s/^\/\~/\/res\/$ENV{'request.role.domain'}\//;
- $target=~s/\.meta$//;
- $r->print('');
- my %lt=&fieldnames();
- my $output;
- foreach ('author','title','subject','keywords','abstract','notes',
- 'copyright','customdistributionfile','language',
- 'standards',
- 'lowestgradelevel','highestgradelevel','sourceavail','sourcerights',
- 'obsolete','obsoletereplacement') {
- if (defined($ENV{'form.new_'.$_})) {
- $Apache::lonpublisher::metadatafields{$_}=
- $ENV{'form.new_'.$_};
- }
- if (! $Apache::lonpublisher::metadatafields{'copyright'}) {
- $Apache::lonpublisher::metadatafields{'copyright'}=
- 'default';
- }
- $output.=(''.$lt{$_}.': '.
- &prettyinput($_,
- $Apache::lonpublisher::metadatafields{$_},
- 'new_'.$_,'defaultmeta').'
');
- }
- return $output;
-}
+
sub open_form {
my ($r)=@_;
my @files=&Apache::loncommon::get_env_multiple('form.selectfile');
@@ -686,18 +502,22 @@ sub handler {
my $portfolio_root = &Apache::loncommon::propath($ENV{'user.domain'},
$ENV{'user.name'}).
'/userfiles/portfolio';
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+ ['selectfile','currentpath','meta',
+ 'currentfile','action','fieldname','mode','rename']);
&Apache::loncommon::no_cache($r);
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
# Give the LON-CAPA page header
$r->print(''.
&mt('Portfolio Manager').
- "\n".
- &Apache::loncommon::bodytag('Portfolio Manager'));
+ "\n");
+ if ($ENV{"form.mode"} eq 'selectfile'){
+ $r->print(&Apache::loncommon::bodytag('Portfolio Manager',undef,undef,1));
+ } else {
+ $r->print(&Apache::loncommon::bodytag('Portfolio Manager'));
+ }
$r->rflush();
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['selectfile','currentpath','meta',
- 'currentfile','action','fieldname','mode','rename']);
if (($ENV{'form.storeupl'} eq 'Upload') & (!$ENV{'form.uploaddoc.filename'})){
$r->print(' No file was selected to upload.'.
'To upload a file, click Browse...'.
@@ -705,7 +525,7 @@ sub handler {
}
if ($ENV{'form.meta'}) {
&open_form($r);
- $r->print(&edit_meta_data($r, $ENV{'form.currentpath'}.$ENV{'form.selectfile'}));
+# $r->print(&edit_meta_data($r, $ENV{'form.currentpath'}.$ENV{'form.selectfile'}));
$r->print('Edit the meta data
');
&close_form($r);
}