--- loncom/interface/portfolio.pm	2005/01/18 02:18:29	1.71
+++ loncom/interface/portfolio.pm	2005/02/11 00:18:14	1.73
@@ -121,7 +121,7 @@ sub display_directory {
                 } else {
                     $r->print('<td><input type="checkbox" name="selectfile" value="'.$filename.'" />
                         <a href="/adm/portfolio?rename='.$filename.'&amp;currentpath='.$current_path.'">Rename</a></td>
-                        <td><a href="/adm/portfolio?meta='.$filename.'&amp;currentpath='.$current_path.'">Meta</a>
+                        <td><a href="/adm/portfolio'.$current_path.$filename.'.meta">Meta</a>
                         </td>');
                 }
                 $r->print('<td><img src="'.$iconpath.'unknown.gif"></td>');
@@ -206,191 +206,7 @@ sub display_file_select {
             <input type="hidden" name="currentpath" value="'.$current_path.'" />
     </form>');
 }
-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 '<input type="checkbox" name="'.$fieldname.'"'.
-	    ($value?' checked="1"':'').' />'.
-            &relatedfield(0,$relatedsearchflag,$relatedsep); 
-    }
-    # 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>'.
-            &relatedfield(0,$relatedsearchflag,$relatedsep); 
-    }
-    # 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>'.
-            &relatedfield(0,$relatedsearchflag,$relatedsep); 
-    }
-    # Source Customdistribution file
-    if ($type eq 'sourcerights') {
-	return '<input type="text" name="'.$fieldname.
-	    '" size="60" value="'.$value.'" /><a href="javascript:openbrowser'.
-	    "('".$formname."','".$fieldname."'".
-	    ",'rights')\">".&mt('Select').'</a>'.
-            &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/\"/\&quot\;/gs;
-    return 
-        '<input type="text" name="'.$fieldname.'" size="'.$size.'" '.
-        'value="'.$value.'" />'.
-        &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.'&nbsp;';
-    }
-    return $relatedsep.'<input type="checkbox" name="'.$fieldname.'_related"'.
-	($relatedvalue?' checked="1"':'').' />';
-}
-
-
-# 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('<script language="JavaScript">'.
-                  &Apache::loncommon::browser_and_searcher_javascript().
-                  '</script>');
-        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.=('<p>'.$lt{$_}.': '.
-                  &prettyinput($_,
-			   $Apache::lonpublisher::metadatafields{$_},
-			   'new_'.$_,'defaultmeta').'</p>');
-    }
-    return $output;
-}
+
 sub open_form {
     my ($r)=@_;
     my @files=&Apache::loncommon::get_env_multiple('form.selectfile');
@@ -683,9 +499,19 @@ sub createdir {
 sub handler {
     # this handles file management
     my $r = shift;
+    my $bodytag;
     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']);
+    if ($ENV{"form.mode"} eq 'selectfile'){
+        $bodytag = &Apache::loncommon::bodytag('Portfolio Manager',undef,undef,1);
+    } else {
+        $bodytag = &Apache::loncommon::bodytag('Portfolio Manager');
+    }
+
     &Apache::loncommon::no_cache($r);
     &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
@@ -693,11 +519,8 @@ sub handler {
     $r->print('<html><head><title>'.
               &mt('Portfolio Manager').
               "</title></head>\n".
-              &Apache::loncommon::bodytag('Portfolio Manager'));
+              $bodytag);
     $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('<font color="red"> No file was selected to upload.'.
    	            'To upload a file, click <strong>Browse...</strong>'.
@@ -705,7 +528,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<br />');
         &close_form($r);
     }