Index: /main/trunk/greenstone3/web/interfaces/default/transform/gslib.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/default/transform/gslib.xsl	(revision 37468)
+++ /main/trunk/greenstone3/web/interfaces/default/transform/gslib.xsl	(revision 37469)
@@ -419,5 +419,5 @@
   <xsl:template name="webswingGLILink">
     <div class="paramLabel">
-      <a href="/webswing-server/gli"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'webswinggli.title')"/></a>
+      <a href="{$library_name}/page/gli"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'webswinggli.title')"/></a>
   </div>
   <div class="paramValue">
Index: /main/trunk/greenstone3/web/interfaces/default/transform/layouts/header.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/default/transform/layouts/header.xsl	(revision 37468)
+++ /main/trunk/greenstone3/web/interfaces/default/transform/layouts/header.xsl	(revision 37469)
@@ -19,7 +19,11 @@
   <xsl:param name="cookie_consent"/>
   
+  <!-- does this collection allow webswing-based GLI editing? it's turned on by default, can turn off in config file-->
+  <xsl:variable name="isGLIEditingAllowed">
+    <xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='allowGLIEditing']) or /page/pageResponse/format[@type='display']/gsf:option[@name='allowGLIEditing']/@value='true'">1</xsl:if>
+  </xsl:variable>
   
   <!-- does this collection have editing allowed? it's turned on by default, can turn off in config file-->
-  <xsl:variable name="isEditingAllowed">
+  <xsl:variable name="isDocumentEditingAllowed">
     <xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='allowDocumentEditing']) or /page/pageResponse/format[@type='display']/gsf:option[@name='allowDocumentEditing']/@value='true'">1</xsl:if>
   </xsl:variable>
@@ -36,4 +40,5 @@
     <xsl:if test="/page/pageRequest/userInformation and (util:csvContains(/page/pageRequest/userInformation/@groups, 'administrator') or util:csvContains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:csvContains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">1</xsl:if>
   </xsl:variable>
+  
   <xsl:variable name="siteAdmin">
     <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'siteAdmin']"/>
@@ -177,7 +182,19 @@
 		</xsl:if>
 	
-	  </xsl:if>
-      <script type="text/javascript" src="interfaces/{$interface_name}/js/debug_scripts.js"><xsl:text> </xsl:text></script>
-      <script type="text/javascript" src="interfaces/{$interface_name}/js/visual-xml-editor.js"><xsl:text> </xsl:text></script>
+      </xsl:if>
+
+      <xsl:variable name="allowGreenbugEditing"><xsl:value-of select="/page/pageResponse/format/gsf:option[@name='allowGreenbugEditing']/@value"/></xsl:variable>
+
+      <xsl:if test="$allowGreenbugEditing != 'false'">
+	<!-- TLDR: explicitly set this option to false in your collection if you don't want it enabled -->
+	
+	<!-- For backwards compatibility, testing this way means that if <gsf:option name="greenbugEnable"/>
+	     isn't set at all, then it default to on ... the way things used to work before the option
+	     was introduced -->
+	
+	<script type="text/javascript" src="interfaces/{$interface_name}/js/debug_scripts.js"><xsl:text> </xsl:text></script>
+	<script type="text/javascript" src="interfaces/{$interface_name}/js/visual-xml-editor.js"><xsl:text> </xsl:text></script>
+      </xsl:if>
+      
     </xsl:if>
 
@@ -497,5 +514,5 @@
 	menu.append(settingsLink);
 	
-	</xsl:text><xsl:if test="/page/pageRequest/@action = 'd' and $isEditingAllowed = '1'"><xsl:text disable-output-escaping="yes">
+	</xsl:text><xsl:if test="/page/pageRequest/@action = 'd' and $isDocumentEditingAllowed = '1'"><xsl:text disable-output-escaping="yes">
 	var editingLink = $("&lt;a&gt;")
 	.attr("href", "javascript:;");
@@ -508,11 +525,11 @@
 	.on("click", function()
 	{
-	var c_url = gs.xsltParams.library_name + "?a=g&amp;rt=ro&amp;s=ChangeUserEditMode&amp;s1.username=" + gs.userInformation.username + "&amp;s1.enabled=" + ((gs.userInformation.editEnabled == "true") ? "false" : "true");
-	$.ajax(c_url)
-	.done(function(response)
-	{
-	//location.reload(true); // need to set docEdit=0 if we have just disabled editing
-	location.href= url + (hasQueryString ? "&amp;" : "?") + ((gs.userInformation.editEnabled == "true") ? "docEdit=0&amp;ed=0":"") + (hashPart ? hashPart : "");
-	});
+	  var c_url = gs.xsltParams.library_name + "?a=g&amp;rt=ro&amp;s=ChangeUserEditMode&amp;s1.username=" + gs.userInformation.username + "&amp;s1.enabled=" + ((gs.userInformation.editEnabled == "true") ? "false" : "true");
+	  $.ajax(c_url)
+	  .done(function(response)
+	  {
+	    //location.reload(true); // need to set docEdit=0 if we have just disabled editing
+	    location.href= url + (hasQueryString ? "&amp;" : "?") + ((gs.userInformation.editEnabled == "true") ? "docEdit=0&amp;ed=0":"") + (hashPart ? hashPart : "");
+	  });
 	});
 	</xsl:text></xsl:when><xsl:otherwise><xsl:variable name="reason"><xsl:choose><xsl:when test="$isEditingAvailable != '1'"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.error_unavailable')"/></xsl:when><xsl:when test="$userHasEditPermission != '1'"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.error_wrong_group')"/></xsl:when></xsl:choose><xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'de.error_contact_admin', $siteAdmin)"/></xsl:variable><xsl:text disable-output-escaping="yes">
@@ -520,6 +537,6 @@
 	.on("click", function()
 	{
-	alert("</xsl:text><xsl:value-of select="$reason"/><xsl:text disable-output-escaping='yes'>");
-	menu.hide();
+	  alert("</xsl:text><xsl:value-of select="$reason"/><xsl:text disable-output-escaping='yes'>");
+	  menu.hide();
 	});
         </xsl:text>
@@ -527,5 +544,24 @@
 	editingLink.append(editingButton);
 	menu.append(editingLink);
-      </xsl:text></xsl:if><xsl:text disable-output-escaping="yes">
+
+      </xsl:text></xsl:if>
+
+      <xsl:if test="$isGLIEditingAllowed = '1'"><xsl:text disable-output-escaping="yes">
+	var gliLink = $("&lt;a&gt;");
+	if (gs.cgiParams["c"]) {
+	  gliLink.attr("href", gs.xsltParams.library_name + "/collection/"+gs.cgiParams["c"]+"/page/gli");
+	}
+	else {
+	  gliLink.attr("href", gs.xsltParams.library_name + "/page/gli");
+	}
+	var gliButton = $("&lt;li&gt;")
+	.css("padding", "3px")
+	.html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.webswing_gli')"/><xsl:text disable-output-escaping="yes">")
+	.addClass("ui-state-default");
+	gliLink.append(gliButton);
+	menu.append(gliLink);
+      </xsl:text></xsl:if>
+
+      <xsl:text disable-output-escaping="yes">
 
         // Need to check for the situation where the user immediately logs out, having just logged in
Index: /main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl	(revision 37468)
+++ /main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl	(revision 37469)
@@ -46,5 +46,5 @@
 
 	<xsl:variable name="canDoEditing">
-	  <xsl:if test="$isEditingAllowed = '1' and (/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true' and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor)))">true</xsl:if>
+	  <xsl:if test="$isDocumentEditingAllowed = '1' and (/page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true' and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor)))">true</xsl:if>
 	</xsl:variable>
 	<xsl:variable name="editingTurnedOn">
Index: /main/trunk/greenstone3/web/interfaces/default/transform/pages/home.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/default/transform/pages/home.xsl	(revision 37468)
+++ /main/trunk/greenstone3/web/interfaces/default/transform/pages/home.xsl	(revision 37469)
@@ -69,7 +69,5 @@
 		-->
 
-		<!--
 		<gslib:webswingGLILink/><br/><br/>
-		-->
 
 		<gslib:aboutGreenstoneLink/><br/>
