Index: main/branches/64_bit_Greenstone/greenstone2/cgi-bin/talkback-progressbar.pl
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/cgi-bin/talkback-progressbar.pl	(revision 23511)
+++ main/branches/64_bit_Greenstone/greenstone2/cgi-bin/talkback-progressbar.pl	(revision 23523)
@@ -230,4 +230,11 @@
     my $jar_dir= &util::filename_cat($gsdl_home, "bin", "java");
     my $java_classpath = &util::filename_cat($jar_dir,"GLIServer.jar");
+
+    if (!-f $java_classpath) {
+	my $progname = $0;
+	$progname =~ s/^.*[\/\\]//;
+	my $mess = "$progname:\nFailed to find $java_classpath\n";
+	$gsdl_cgi->generate_error($mess);
+    }
 
     my $java_args = "\"$zip_filename\" \"$import_dir\"";
@@ -428,14 +435,18 @@
 
     my $wait_dots = inc_wait_dots();
-    my $html = "$wait_dots<br>";
+    my $dots_html = "Waiting for transfer: $wait_dots<br>";
 
     my $filename = $gsdl_cgi->param('uploadedfile');
 
+    my $inner_html;
+
     if ((defined $filename) && ($filename ne "")) {
-	$html .= check_status_single_file($filename);
+	$inner_html = check_status_single_file($filename);
     }
     else {
-	$html .= check_status_all();
-    }
+	$inner_html = check_status_all();
+    }
+
+    my $html = ($inner_html ne "") ? $inner_html : $dots_html;
 
     return $html;
Index: main/branches/64_bit_Greenstone/greenstone2/cgi-bin/talkback-transfer.pl
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/cgi-bin/talkback-transfer.pl	(revision 23511)
+++ main/branches/64_bit_Greenstone/greenstone2/cgi-bin/talkback-transfer.pl	(revision 23523)
@@ -93,4 +93,11 @@
     my $java_classpath = &util::filename_cat($jar_dir,"GLIServer.jar");
 
+    if (!-f $java_classpath) {
+	my $progname = $0;
+	$progname =~ s/^.*[\/\\]//;
+	my $mess = "$progname:\nFailed to find $java_classpath\n";
+	$gsdl_cgi->generate_error($mess);
+    }
+
     my $zip_file = "$collect-$timestamp.zip";
     my $zip_file_path = &util::filename_cat($archive_dir,$zip_file);
Index: main/branches/64_bit_Greenstone/greenstone2/macros/authen.dm
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/macros/authen.dm	(revision 23511)
+++ main/branches/64_bit_Greenstone/greenstone2/macros/authen.dm	(revision 23523)
@@ -11,5 +11,9 @@
 _content_ {
 <br><br><br><br>
-<form name="login" method="post" action="_gwcgi_">
+_If_("_activateweb20_" eq "1",
+  <form name="login" method="get" action="_gwcgi_">
+,
+  <form name="login" method="post" action="_gwcgi_">
+)
 <input type=hidden name="e" value="_If_(_cgiarger_,_cgiarger_,_decodedcompressedoptions_)">
 _hiddenargs_
Index: main/branches/64_bit_Greenstone/greenstone2/macros/english.dm
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/macros/english.dm	(revision 23511)
+++ main/branches/64_bit_Greenstone/greenstone2/macros/english.dm	(revision 23523)
@@ -75,4 +75,7 @@
 _textdescrhelp_ {Help page}
 _textdescrpref_ {Preferences page}
+_textdescrlogin_ {Login page}
+_textdescrlogout_ {Logout as _cgiargun_}
+
 _textdescrgreenstone_ {Greenstone Digital Library Software}
 _textdescrusab_ {What did you find hard to use?}
@@ -211,4 +214,7 @@
 _linktextHELP_ {HELP}
 _linktextPREFERENCES_ {PREFERENCES}
+_linktextLOGIN_ {LOGIN}
+_linktextLOGGEDIN_ {(logged in as _cgiargun_)}
+_linktextLOGOUT_ {LOGOUT}
 
 
Index: main/branches/64_bit_Greenstone/greenstone2/macros/nav_css.dm
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/macros/nav_css.dm	(revision 23511)
+++ main/branches/64_bit_Greenstone/greenstone2/macros/nav_css.dm	(revision 23523)
@@ -14,8 +14,27 @@
 #######################################################################
 
-_globallinks_ {_If_("_cgiargu_" ne "1",_homelink_) _helplink_ _preflink_}
-_homelink_ {_navtaborig_(_httppagehome_,_linktextHOME_,_textdescrhome_)}
-_helplink_ {_navtaborig_(_httppagehelp_,_linktextHELP_,_textdescrhelp_)}
-_preflink_ {_navtaborig_(_httppagepref_,_linktextPREFERENCES_,_textdescrpref_)}
+_globallinks_ {_If_("_cgiargu_" ne "1",_homelink_) _helplink_ _preflink__optloginlink_}
+_homelink_  {_navtaborig_(_httppagehome_,_linktextHOME_,_textdescrhome_)}
+_helplink_  {_navtaborig_(_httppagehelp_,_linktextHELP_,_textdescrhelp_)}
+_preflink_  {_navtaborig_(_httppagepref_,_linktextPREFERENCES_,_textdescrpref_)}
+
+_optloginlink_ {
+  _If_("_activateweb20_" >= "1",_If_("x_cgiargun__cgiarguan_" ne "x1",_loginlink_))
+}
+
+_loginlink_ {
+
+    _If_(_cgiargun_,
+      _navtablogoutorig_(_linktextLOGOUT_,_textdescrlogout_) _linktextLOGGEDIN_
+      <script type="text/javascript">
+        appendUsernameArgs("logout","uan=&un=")
+      </script>
+    ,
+      _navtabloginorig_(_linktextLOGIN_,_textdescrlogin_)
+      <script type="text/javascript">
+        appendUsernameArgs("login","uan=1")
+      </script>
+    )
+}
 
 
@@ -41,4 +60,10 @@
 # 4. optional "selected" or not if it is the current tab
 _navtaborig_ {<a _If_("_4_" eq "selected",class="navlink_sel">_2_,class="navlink" href="_1_" title="_3_">_2_)</a>}
+
+# same sa above, but without _1_ as there is no hyperlink to go to (want to say on the same page)
+_navtabloginorig_ {<a _If_("_3_" eq "selected",class="navlink_sel postit">_1_,class="navlink postit" id="login" href="" title="_2_">_1_)</a>}
+
+# same sa above, but without _1_ as there is no hyperlink to go to (want to say on the same page)
+_navtablogoutorig_ {<a _If_("_3_" eq "selected",class="navlink_sel postit">_1_,class="navlink postit" id="logout" href="" title="_2_">_1_)</a>}
 
 # parameters are
Index: main/branches/64_bit_Greenstone/greenstone2/macros/seaweed.dm
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/macros/seaweed.dm	(revision 23511)
+++ main/branches/64_bit_Greenstone/greenstone2/macros/seaweed.dm	(revision 23523)
@@ -1,5 +1,5 @@
 package Global
 
-_seaweed_ {
+_seaweedscript_ {
 
 
@@ -27,5 +27,4 @@
 
 <script type="text/javascript" src="_httpscript_/seaweed.js"></script>
-<script type="text/javascript" src="_httpscript_/gsajaxapi.js"></script>
 
 
@@ -126,5 +125,5 @@
 
   window.onload=function()\{
-//      try \{
+      try \{
 	  de.init();
 	  if (window.addEventListener) \{
@@ -141,9 +140,8 @@
 	   \});
 		
-/*      \} 
+      \} 
       catch(err) \{
 		alert("SeaWeed failed to initialise: " + err.message);
       \}
-*/
   \}
 
@@ -197,6 +195,24 @@
 
 
+    
+  function seaweedReindexCollection() \{
+    var arc = document.getElementById("seaweedRC");
+    arc.innerHTML = "reindexing ...";
+    gsapi.reindexCollection("incremental",seaweedReindexCallback);
+  \}
+
+  function seaweedReindexCallback(xmlHttp) \{
+    var arc = document.getElementById("seaweedRC");
+    arc.innerHTML = "reindexing done.";
+  \}		    
+    
+
 </script>
 
-
 }
+
+_first-metadata-spanwrap_ {<span metapos="0" metaname="_1_" docoid="_2_" class="editable-metadata">}
+_/first-metadata-spanwrap_ {</span>}
+
+_first-metadata-divwrap_ {<div metapos="0" metaname="_1_" docoid="_2_" class="editable-metadata">}
+_/first-metadata-divwrap_ {</div>}
Index: main/branches/64_bit_Greenstone/greenstone2/macros/style.dm
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/macros/style.dm	(revision 23511)
+++ main/branches/64_bit_Greenstone/greenstone2/macros/style.dm	(revision 23523)
@@ -151,5 +151,7 @@
 <div class="bannerextra">_pagebannerextra_</div>
 <!-- end of page banner -->
-_If_("_cgiargtalkback_" eq "1",_talkback:uploadForm_)
+_If_("_activateweb20_" eq "2",
+  _If_("_activatetalkback_" eq "1",_talkback:uploadForm_)
+)
 }
 
@@ -162,5 +164,7 @@
 <p>
 <!-- end of page banner -->
-_If_("_cgiargtalkback_" eq "1",_talkback:uploadForm_)
+_If_("_activateweb20_" eq "2",
+  _If_("_activatetalkback_" eq "1",_talkback:uploadForm_)
+)
 }
 
@@ -191,10 +195,46 @@
 }
 
+_loginscript_ {
+   function appendUsernameArgs(id,addOn)
+   \{
+     var a=document.getElementById(id);
+     var url = a.getAttribute("href");
+     if (url == "") \{
+       url = document.location.toString();
+     \}
+
+     //alert("url before = " + url);
+
+     // clear out any earlier user name/authentication values
+     url = url.replace(/(&|\\\\?)uan=\\d\{0,1\}/g,"");
+     url = url.replace(/(&|\\\\?)un=[a-z0-9:\\-]*/g,"");
+     url = url.replace(/(&|\\\\?)pw=[a-z0-9:\\-]*/g,"");
+
+     //alert("url after = " + url);
+
+     var gwcgi = "_gwcgi_";
+
+     var tailUrl = url.substr(url.length-gwcgi.length);
+
+     url += (tailUrl == "_gwcgi_") ? "?" : "&";
+     url += addOn;
+
+     //alert("url with add on = " + url);
+
+     a.setAttribute("href",url);
+   \}
+}
+
+
 # imagescript only used in nav_ns4.dm
 _globalscripts_{
-
-_If_("_activateseaweed_" eq "1",_seaweed_)
+_If_("_activateweb20_" eq "2",
+  <script type="text/javascript" src="_httpscript_/gsajaxapi.js"></script>
+  _If_("_activateseaweed_" eq "1",_seaweedscript_)
+  _If_("_activatetalkback_" eq "1",_talkbackscript_)
+)
 _If_(_pagescriptfileextra_,_pagescriptfileextra_)
 <script language="javascript" type="text/javascript">
+_loginscript_
 _If_(_pagescriptextra_,_pagescriptextra_)
 _collectionspecificscript_
@@ -205,8 +245,15 @@
 
 _globalscripts_ [v=1] {
+_If_("_activateweb20_" eq "2",
+  <script type="text/javascript" src="_httpscript_/gsajaxapi.js"></script>
+  _If_("_activateseaweed_" eq "1",_seaweedscript_)
+  _If_("_activatetalkback_" eq "1",_talkbackscript_)
+)
+_If_(_pagescriptfileextra_,_pagescriptfileextra_)
 <script language="javascript" type="text/javascript">
 <!--
+_loginscript_
 _If_(_cgiargx_,_scriptdetach_)
-_pagescriptextra_
+_If_(_pagescriptextra_,_pagescriptextra_)
 _collectionspecificscript_
 // -->
Index: main/branches/64_bit_Greenstone/greenstone2/macros/talkback.dm
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/macros/talkback.dm	(revision 23511)
+++ main/branches/64_bit_Greenstone/greenstone2/macros/talkback.dm	(revision 23523)
@@ -1,7 +1,16 @@
+package Global
+
+# Currently nothing in talkbackscript
+_talkbackscript_ {
+}
+
+
 package talkback
 
-# The following values are typically set in <gsdlhome>/macro/extra.dm
-_talkfromcgi_ {}
-_talktocgi_   {}
+# The following values are typically set in <gsdlhome>/macro/zextra.dm
+# They are left commented out here so the error log does not get swamped
+# with 'redefined' warning
+#_talkfromcgi_ {}
+#_talktocgi_   {}
 
 _talktoCollect_   {}
@@ -14,4 +23,5 @@
 _talktoLibrary_ {_talktocgi_/library.cgi}
 _talktoUpload_  {_talktocgi_/talkback-progressbar.pl}
+
 
 
@@ -31,8 +41,36 @@
     </form>
 
+    <div id="talktoProgressBar" style="display: block;">
+      <iframe style="float: top;" width="600" height="100" frameborder="0" 
+         src="_talktoUpload_">
+      </iframe>
+    </div>
+
+
    <script type="text/javascript">
+
+
+     function talktoProgressBarHide(oid)
+     \{
+
+         var ttpb = document.getElementById("talktoProgressBar");
+	 ttpb.style.display = "none";
+     \}
+
      
      function talkbackUploadSubmit(oid)
      \{
+         var ttpb = document.getElementById("talktoProgressBar");
+	 ttpb.style.display = "block";
+
+	 //if (window.addEventListener) \{
+	 //    window.addEventListener('beforeunload',talktoProgressBarHide,true);
+         //\}
+	 //else \{
+	 //    window.attachEvent('onbeforeunload',talktoProgressBarHide);
+	 //\}
+
+	 //alert("away to submit");
+
          var uploadForm = document.uploadForm;
          uploadForm.oid.value = oid;
Index: main/branches/64_bit_Greenstone/greenstone2/perllib/unicode.pm
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/perllib/unicode.pm	(revision 23511)
+++ main/branches/64_bit_Greenstone/greenstone2/perllib/unicode.pm	(revision 23523)
@@ -633,5 +633,5 @@
     if ((defined $and_numeric_entities) && ($and_numeric_entities)) {
 	$text =~ s/\&\#x([0-9A-F]+);/pack('C', hex($1))/ige;
-	$text =~ s/\&\#([0-9]+);/pack('C', $1)/ige;
+	$text =~ s/\&\#u?([0-9]+);/pack('C', $1)/ige;
     }
 
@@ -764,5 +764,5 @@
 	= map { $_ > 255 ?                  # Needs to be represent in entity form
 		    sprintf("&#x%X;",$_) :  
-		    $_ > 128 ?              # Representable in %XX form
+		    $_>128 || $_==ord("%") ?              # Representable in %XX form
 		    sprintf("%%%2X", $_) :  
 		    chr($_)                 # otherwise, Ascii char
Index: main/branches/64_bit_Greenstone/greenstone2/runtime-src/src/recpt/formattools.cpp
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/runtime-src/src/recpt/formattools.cpp	(revision 23511)
+++ main/branches/64_bit_Greenstone/greenstone2/runtime-src/src/recpt/formattools.cpp	(revision 23523)
@@ -33,5 +33,6 @@
 #include <assert.h>
 
-static bool metadata_spanwrap = false;
+static bool metadata_wrap = false;
+static text_t metadata_wrap_type = "";
 
 // a few function prototypes
@@ -694,4 +695,10 @@
     formatlistptr->command = comEndMetadataSpanWrap;
 
+  else if (meta == "metadata-divwrap")
+    formatlistptr->command = comMetadataDivWrap;
+
+  else if (meta == "/metadata-divwrap")
+    formatlistptr->command = comEndMetadataDivWrap;
+
   else if (meta == "Summary")
     formatlistptr->command = comSummary;
@@ -980,9 +987,9 @@
 
 
-static text_t spanwrap_metatext(const text_t& metatext, const text_t& OID, 
+static text_t wrap_metatext(const text_t& metatext, const text_t& OID, 
 				const text_t metaname, int metapos=-1)
 {
 
-  text_t tag_type = (metaname == "Text") ? "div" : "span";
+  text_t tag_type = metadata_wrap_type;
   text_t editable_type = (metaname == "Text") ? "text" : "metadata";
 
@@ -1092,6 +1099,6 @@
       }
 
-      if (metadata_spanwrap) {
-	fresh_metatext = spanwrap_metatext(fresh_metatext,OID,meta.metaname,i);
+      if (metadata_wrap) {
+	fresh_metatext = wrap_metatext(fresh_metatext,OID,meta.metaname,i);
       }
       formatted_metatext += fresh_metatext;
@@ -1171,6 +1178,6 @@
     }
 
-    if (metadata_spanwrap) {
-      fresh_metatext = spanwrap_metatext(fresh_metatext,OID,meta.metaname,position);
+    if (metadata_wrap) {
+      fresh_metatext = wrap_metatext(fresh_metatext,OID,meta.metaname,position);
     }
 
@@ -1388,13 +1395,13 @@
   while (orptr != NULL) {
 
-    if (metadata_spanwrap) {
+    if (metadata_wrap) {
       // need to be a bit more careful about this
-      // => test for it *without* spanwrap, and if defined, then
-      // got back and generate it again, this time with spanwrap on
-
-      metadata_spanwrap = false;
+      // => test for it *without* spanwrap or divwrap, and if defined, then
+      // got back and generate it again, this time with spanwrap/divwrap on
+
+      metadata_wrap = false;
       text_t test_tmp = format_string (collection,collectproto,docinfo, disp, orptr, 
 				       options, logout);
-      metadata_spanwrap = true;
+      metadata_wrap = true;
       if (!test_tmp.empty()) {
 
@@ -1665,13 +1672,13 @@
   if (decision.command == dMeta) {
 
-    bool store_metadata_spanwrap = metadata_spanwrap;
-    metadata_spanwrap = 0;
-
-    // temporarily suspend metadata-spanwrap (if on) so can test if metadata item really exits or not
+    bool store_metadata_wrap = metadata_wrap;
+    metadata_wrap = 0;
+
+    // temporarily suspend metadata-XXXwrap (if on) so can test if metadata item really exits or not
     bool metadata_exists 
       = (get_meta (collection,collectproto,docinfo,disp,decision.meta,options,
 		   logout) != "");
 
-    metadata_spanwrap = store_metadata_spanwrap;
+    metadata_wrap = store_metadata_wrap;
 
     if (metadata_exists) {
@@ -1897,8 +1904,14 @@
 	break;
      case comMetadataSpanWrap:
-        metadata_spanwrap=true;  return "";
+        metadata_wrap=true;  metadata_wrap_type="span"; return "";
 	break;
      case comEndMetadataSpanWrap:
-	metadata_spanwrap=false; return "";
+	metadata_wrap=false; metadata_wrap_type="";     return "";
+	break;
+     case comMetadataDivWrap:
+        metadata_wrap=true;  metadata_wrap_type="div";  return "";
+	break;
+     case comEndMetadataDivWrap:
+	metadata_wrap=false; metadata_wrap_type="";     return "";
 	break;
      case comIf:
@@ -1960,6 +1973,6 @@
   }
 
-  if (metadata_spanwrap) {
-    text = spanwrap_metatext(text,docinfo.OID,"Text");
+  if (metadata_wrap) {
+    text = wrap_metatext(text,docinfo.OID,"Text");
   }
 
@@ -2012,6 +2025,6 @@
   summary.replace("\n","&#013;");
 
-  if (metadata_spanwrap) {
-    summary = spanwrap_metatext(summary,docinfo.OID,"Summary");
+  if (metadata_wrap) {
+    summary = wrap_metatext(summary,docinfo.OID,"Summary");
   }
 
Index: main/branches/64_bit_Greenstone/greenstone2/runtime-src/src/recpt/formattools.h
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/runtime-src/src/recpt/formattools.h	(revision 23511)
+++ main/branches/64_bit_Greenstone/greenstone2/runtime-src/src/recpt/formattools.h	(revision 23523)
@@ -35,4 +35,5 @@
 		comDoc, comHighlight, comEndHighlight, 
 		comMetadataSpanWrap, comEndMetadataSpanWrap,
+		comMetadataDivWrap, comEndMetadataDivWrap,
 		comRel, comHref, comSummary,
 		comTOC, comImage, comDocumentButtonDetach, comDocumentButtonHighlight,
