- Timestamp:
- 2018-09-18T15:52:17+12:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/transform/layouts/header.xsl
r32470 r32473 24 24 </xsl:variable> 25 25 26 <!-- does this collection have editing turned on - ->26 <!-- does this collection have editing turned on - turned on by default, can turn off in config file--> 27 27 <xsl:variable name="isEditingTurnedOn"> 28 <xsl:if test=" /page/pageResponse/format[@type='display']/gsf:option[@name='AllowDocumentEditing']/@value='true'">1</xsl:if>28 <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> 29 29 </xsl:variable> 30 30 <!-- is editing available for the collection? eg is there an archives folder? --> 31 <xsl:variable name="isEditingAvailable">1</xsl:variable> 31 <xsl:variable name="isEditingAvailable"> 32 <xsl:choose><xsl:when test="/page/pageResponse/collection/@no_archives">0</xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:variable> 32 33 <!-- is a user logged in, and do they have editing rights for this collection? --> 33 34 <xsl:variable name="userHasEditPermission"> … … 386 387 button.data("userMenu", menu); 387 388 389 // get the base url 390 var url = document.URL; 391 var hasQueryString = (url.indexOf("?") != -1); 392 var hashIndex = url.indexOf("#"); 393 394 var hashPart; 395 if(hashIndex != -1) 396 { 397 hashPart = url.substring(hashIndex); 398 url = url.substring(0, hashIndex); 399 } 400 388 401 var settingsLink = $("<a>") 389 402 .attr("href", gs.xsltParams.library_name + "/admin/AccountSettings?s1.username=</xsl:text><xsl:value-of select="/page/pageRequest/userInformation/@username"/><xsl:text disable-output-escaping="yes">"); … … 406 419 .click(function() 407 420 { 408 var url = gs.xsltParams.library_name + "?a=g&rt=ro&s=ChangeUserEditMode&s1.username=" + gs.userInformation.username + "&s1.enabled=" + ((gs.userInformation.editEnabled == "true") ? "false" : "true");409 $.ajax( url)421 var c_url = gs.xsltParams.library_name + "?a=g&rt=ro&s=ChangeUserEditMode&s1.username=" + gs.userInformation.username + "&s1.enabled=" + ((gs.userInformation.editEnabled == "true") ? "false" : "true"); 422 $.ajax(c_url) 410 423 .success(function(response) 411 424 { 412 location.reload(true); 425 //location.reload(true); // need to set docEdit=0 if we have just disabled editing 426 location.href= url + (hasQueryString ? "&" : "?") + ((gs.userInformation.editEnabled == "true") ? "docEdit=0&ed=0":"") + (hashPart ? hashPart : ""); 413 427 }); 414 428 }); … … 425 439 menu.append(editingLink); 426 440 </xsl:text></xsl:if><xsl:text disable-output-escaping="yes"> 427 var url = document.URL;428 var hasQueryString = (url.indexOf("?") != -1);429 var hashIndex = url.indexOf("#");430 431 var hashPart;432 if(hashIndex != -1)433 {434 hashPart = url.substring(hashIndex);435 url = url.substring(0, hashIndex);436 }437 441 438 442 var logoutLink = $("<a>")
Note:
See TracChangeset
for help on using the changeset viewer.