Index: /main/trunk/greenstone2/cgi-bin/talkback-progressbar.pl
===================================================================
--- /main/trunk/greenstone2/cgi-bin/talkback-progressbar.pl	(revision 23137)
+++ /main/trunk/greenstone2/cgi-bin/talkback-progressbar.pl	(revision 23138)
@@ -116,8 +116,6 @@
     if ($gsdl_cgi->param('process')) { 
 
-	my $rand_string  = $gsdl_cgi->param('rand_string');
 	my $uploadedfile = $gsdl_cgi->param('uploadedfile');
-	my $full_filename = &util::filename_cat($gsdl_tmp_dir,
-						"$rand_string-$uploadedfile");
+	my $full_filename = &util::filename_cat($gsdl_tmp_dir,$uploadedfile);
 
 	my $done_html = &talkback::generate_done_html($full_filename);
@@ -136,18 +134,12 @@
 	my $upload_html_form;
 
-	if (defined $gsdl_cgi->param('rand_string')) { 
-	    my $rand_string = $gsdl_cgi->param('rand_string');
-
-	    # Light-weight (hidden) form with progress bar
-
-	    $upload_html_form 
-		= &talkback::generate_upload_form_progressbar($rand_string);
-	}
-	else {
-	    print STDERR "Warning: Neither 'processing' nor 'rand_string' was set\n";
-	    $upload_html_form 
-		= &talkback::generate_malformed_args_html();
-	    
-	}
+	my $oid     = $gsdl_cgi->param('oid');
+	my $collect = $gsdl_cgi->param('collect');
+
+	my $uniq_file = "$collect-$oid-doc.xml";
+	# Light-weight (hidden) form with progress bar
+
+	$upload_html_form 
+	    = &talkback::generate_upload_form_progressbar($uniq_file);
 	
         print $perlAjax->build_html($gsdl_cgi, $upload_html_form);
Index: /main/trunk/greenstone2/cgi-bin/talkback-transfer.pl
===================================================================
--- /main/trunk/greenstone2/cgi-bin/talkback-transfer.pl	(revision 23137)
+++ /main/trunk/greenstone2/cgi-bin/talkback-transfer.pl	(revision 23138)
@@ -1,3 +1,3 @@
-#/usr/bin/perl -w
+#!/usr/bin/perl -w
 
 use strict;
@@ -18,4 +18,40 @@
 
 
+sub get_infodb_type
+{
+    my ($collect_home,$collect) = @_;
+
+    print STDERR "*** Need to implement extracting infodb_type from collect.cfg\n";
+    return "gdbm";
+}
+
+
+sub oid_to_docxml_filename
+{
+    my ($collect_home,$collect,$docid) = @_;
+
+    my $infodb_type = get_infodb_type($collect_home,$collect);
+
+    # Obtain the collect and archive dir    
+    my $archive_dir = &util::filename_cat($collect_home,$collect,"archives");
+
+    # Obtain the doc.xml path for the specified docID
+    my $arcinfo_doc_filename 
+	= &dbutil::get_infodb_file_path($infodb_type, "archiveinf-doc", 
+					$archive_dir);
+    my $doc_rec_string 
+	= &dbutil::read_infodb_entry($infodb_type, $arcinfo_doc_filename, 
+				     $docid);
+    my $doc_rec = &dbutil::convert_infodb_string_to_hash($doc_rec_string);    
+    my $doc_xml_file = $doc_rec->{'doc-file'}->[0];
+    
+    # The $doc_xml_file is relative to the archives, so now let's get the 
+    # full path
+    my $archives_dir = &util::filename_cat($collect_home,$collect,"archives");    
+    my $doc_xml_filename = &util::filename_cat($archives_dir,$doc_xml_file);
+
+    return $doc_xml_filename;
+}
+
 sub main
 {
@@ -24,29 +60,25 @@
     $gsdl_cgi->setup_gsdl();
 
+    my $gsdl_home = $gsdl_cgi->get_gsdl_home();
+    my $collect_home = &util::filename_cat($gsdl_home,"collect");
+
+    require dbutil;
     require talkback;
 
-    my $rand_string;
-    if (defined $gsdl_cgi->param('rand_string')) { 
-	$rand_string = $gsdl_cgi->param('rand_string');
-    }
-    else {
-	$rand_string = "b310f690273cdc025e5a9b49fca8eee8";
+    my $oid     = $gsdl_cgi->{'oid'};
+    my $collect = $gsdl_cgi->{'collect'};
+
+    # sanity check
+    if (!defined $oid || !defined $collect) {
+	print STDOUT "Content-type:text/plain\n\n";
+	print STDOUT "ERROR: Malformed CGI argments.  Neeed to specify 'oid' and 'collect'\n";
+	exit 0;
     }
 
-    my $uploadedfile;
-    if (defined $gsdl_cgi->param('uploadedfile')) { 
-	$uploadedfile = $gsdl_cgi->param('uploadedfile');
-    }
-    else {
-	$uploadedfile = "C:\\cygwin\\tmp\\test-medium.pdf";
-    }
+    my $uniq_prefix = "$collect-$oid";
 
-    my $talktoUploadURL;
-    if (defined $gsdl_cgi->param('talkbackUpload')) { 
-	$talktoUploadURL = $gsdl_cgi->param('talktoUpload');
-    }
-    else {
-	$talktoUploadURL = "http://www.nzdl.org/gsdl-new/cgi-bin/talkback-progressbar.pl";
-    }
+    my $docxml_filename = oid_to_docxml_filename($collect_home,$collect,$oid);
+
+    my $talktoUploadURL = $gsdl_cgi->param('talktoUpload');
 
     my $browser = LWP::UserAgent->new(agent => 'Perl File Upload');
@@ -56,6 +88,5 @@
 	   [ 'yes_upload'   => '1',
 	     'process'      => '1',
-	     'rand_string'  => $rand_string,
-	     'uploadedfile' => [$uploadedfile, "test-medium.pdf"] 
+	     'uploadedfile' => [$docxml_filename, "$uniq_prefix-doc.xml"] 
 	     ],
 	   'Content_Type' => 'form-data'
Index: /main/trunk/greenstone2/macros/talkback.dm
===================================================================
--- /main/trunk/greenstone2/macros/talkback.dm	(revision 23137)
+++ /main/trunk/greenstone2/macros/talkback.dm	(revision 23138)
@@ -4,7 +4,4 @@
 _talkfromcgi_ {}
 _talktocgi_   {}
-
-# Set by the runtime system
-_randString_ {}
 
 _talkfromLibrary_        {_talkfromcgi_/library.cgi}
@@ -24,5 +21,4 @@
       <input type="hidden" name="yes_upload" value="1" />
       <input type="hidden" name="process" value="1" />
-      <input type="hidden" name="rand_string" id="rand_string" value="_randString_" />
       <input type="hidden" name="collect" value="_cgiargc_" />
       <input type="hidden" name="oid" value="" />
@@ -47,5 +43,5 @@
   <div style="width: 450px;">
     <iframe frameborder="0" width="400" height="80"
-	  src="_talkfromUploadProgress_?rand\_string=_randString_">
+	  src="_talkfromUploadProgress_">
     </iframe>
   </div>
Index: /main/trunk/greenstone2/perllib/talkback.pm
===================================================================
--- /main/trunk/greenstone2/perllib/talkback.pm	(revision 23137)
+++ /main/trunk/greenstone2/perllib/talkback.pm	(revision 23138)
@@ -31,5 +31,5 @@
 sub generate_upload_form
 {
-    my ($rand_string) = @_;
+    my ($uniq_file) = @_;
 
     my $upload_html_form = <<EOF
@@ -44,5 +44,4 @@
       <input type="hidden" name="yes_upload" value="1" />
       <input type="hidden" name="process" value="1" />
-      <input type="hidden" name="rand_string" id="rand_string" value="$rand_string" />
 
       <p>
@@ -53,5 +52,5 @@
 
       <script language="Javascript"> 
-        setInterval("check_status(['check_upload__1', 'rand_string', 'uploadedfile'], ['statusbar']);", '1000');
+        setInterval("check_status(['check_upload__1', '', 'uploadedfile'], ['statusbar']);", '1000');
       </script> 
 
@@ -71,5 +70,5 @@
 sub generate_upload_form_progressbar
 {
-    my ($rand_string) = @_;
+    my ($uniq_file) = @_;
 
     my $upload_html_form = <<EOF
@@ -84,11 +83,10 @@
           action="talkback-progressbar.pl"
           enctype="multipart/form-data" method="post">
-      <input type="hidden" name="uploadedfile" value="test-medium.pdf" />
-      <input type="hidden" name="rand_string" id="rand_string" value="$rand_string" />
+      <input type="hidden" name="uploadedfile" value="$uniq_file" />
     </form>
 
 
     <script type="text/javascript"> 
-      setInterval("check_status(['check_upload__1', 'rand_string', 'uploadedfile'], ['statusbar']);", '1000');
+      setInterval("check_status(['check_upload__1', '$uniq_file', 'uploadedfile'], ['statusbar']);", '1000');
 
     </script> 
@@ -150,5 +148,5 @@
     <hr /> 
     <p> 
-     Malformed CGI arguments.  Need either CGI 'processing' or 'rand_string' set.
+     Malformed CGI arguments.
     </p>
   </body>
