[LON-CAPA-cvs] cvs: loncom /publisher lonpublisher.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 11 Oct 2004 17:40:46 -0000


albertel		Mon Oct 11 13:40:46 2004 EDT

  Modified files:              
    /loncom/publisher	lonpublisher.pm 
  Log:
  - bUG#3530, select/search on publish screen
  
  
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.179 loncom/publisher/lonpublisher.pm:1.180
--- loncom/publisher/lonpublisher.pm:1.179	Tue Oct  5 09:41:36 2004
+++ loncom/publisher/lonpublisher.pm	Mon Oct 11 13:40:46 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.179 2004/10/05 13:41:36 matthew Exp $
+# $Id: lonpublisher.pm,v 1.180 2004/10/11 17:40:46 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -329,6 +329,21 @@
            '<input type="text" name="'.$name.'" size=80 value="'.$value.'" />';
 }
 
+sub text_with_browse_field {
+    my ($title,$name,$value,$restriction)=@_;
+    $value=~s/^\s+//gs;
+    $value=~s/\s+$//gs;
+    $value=~s/\s+/ /gs;
+    $title=&mt($title);
+    $ENV{'form.'.$name}=$value;
+    return "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$title:".
+           "</b></font></p><br />".
+           '<input type="text" name="'.$name.'" size=80 value="'.$value.'" />'.
+	   '<a href="javascript:openbrowser(\'pubform\',\''.$name.'\',\''.$restriction.'\');">Select</a>&nbsp;'.
+	   '<a href="javascript:opensearcher(\'pubform\',\''.$name.'\');">Search</a>';
+	   
+}
+
 sub hiddenfield {
     my ($name,$value)=@_;
     $ENV{'form.'.$name}=$value;
@@ -1238,15 +1253,12 @@
 	my $copyright_help =
 	    Apache::loncommon::help_open_topic('Publishing_Copyright');
 	$intr_scrout =~ s/DISTRIBUTION:/'DISTRIBUTION: ' . $copyright_help/ge;
-	$intr_scrout.=&textfield('Custom Distribution File','customdistributionfile',
-				 $metadatafields{'customdistributionfile'}).
-				     $copyright_help;
+	$intr_scrout.=&text_with_browse_field('Custom Distribution File','customdistributionfile',$metadatafields{'customdistributionfile'},'rights').$copyright_help;
 	$intr_scrout.=&selectbox('Source Distribution','sourceavail',
 				 $defaultsourceoption,
 				 \&Apache::loncommon::source_copyrightdescription,
 				 (&Apache::loncommon::source_copyrightids));
-		 $intr_scrout.=&textfield('Source Custom Distribution File','sourcerights',
-					  $metadatafields{'sourcerights'});
+	$intr_scrout.=&text_with_browse_field('Source Custom Distribution File','sourcerights',$metadatafields{'sourcerights'},'rights');
 	my $uctitle=&mt('Obsolete');
 	$intr_scrout.=
 	    "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
@@ -1255,9 +1267,9 @@
 	    $intr_scrout.=' checked="1" ';
 	}
 	$intr_scrout.='/ ></p>'.
-	    &textfield('Suggested Replacement for Obsolete File',
-		       'obsoletereplacement',
-		       $metadatafields{'obsoletereplacement'});
+	    &text_with_browse_field('Suggested Replacement for Obsolete File',
+				    'obsoletereplacement',
+				    $metadatafields{'obsoletereplacement'});
     } else {
 	$intr_scrout.=&hiddenfield('copyright','private');
     }
@@ -1891,8 +1903,11 @@
 
     &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
-
-    $r->print('<html><head><title>LON-CAPA Publishing</title></head>');
+    
+    my $js=&Apache::loncommon::browser_and_searcher_javascript();
+    $r->print('<html><head><title>LON-CAPA Publishing</title>
+              <script type="text/javascript">'.$js.'
+              </script></head>');
     $r->print(&Apache::loncommon::bodytag('Resource Publication'));