Ignore:
Timestamp:
2016-07-22T19:41:17+12:00 (8 years ago)
Author:
ak19
Message:

Bugfix to oversight: web document editor didn't reindex on removing metadata, only on setting it. This is because there wasn't corresponding Service on Java side to handle removing metadata. Now the Java code has a ModifyMetdata service and this is connected to both the set- and remove-metadata functions in the javascript. For now, the javascript metadataserver calls have been made synchronous by setting the async ajax-jquery property to false. Need to test whether the code still works asynchronous as before.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/javascript-global-functions.js

    r30014 r30617  
    424424function callMetadataServer(callingFunction, url, responseFunction)
    425425{
    426     // rewrite URLs to call GS2Construct's SetMetadata service instead.
     426    // If doing set- or remove- (not get-) metadata, then rewrite URLs to call GS2Construct's ModfiyMetadata service instead (which will ensure this only works when authenticated).
    427427    // From:
    428428    // <gs3server>/cgi-bin/metadata-server.pl?a=set-archives-metadata&c=smallcol&site=localsite&d=HASH01454f31011f6b6b26eaf8d7&metaname=Title&metavalue=Moo&prevmetavalue=Blabla&metamode=override
    429429    // To:
    430     // <gs3server>/library?a=g&rt=r&ro=1&s=SetMetadata&s1.a=set-archives-metadata&s1.collection=smallcol&s1.site=localsite&s1.d=HASH01454f31011f6b6b26eaf8d7&s1.metaname=Title&s1.metavalue=Moo&s1.prevmetavalue=Blabla&s1.metamode=override
    431 
    432     // if we're doing a set- metdata operation, then we'll be changing the URL to make sure we go through GS3's authentication
    433     if(url.indexOf("set-") != -1) {
     430    // <gs3server>/library?a=g&rt=r&ro=1&s=ModifyMetadata&s1.a=set-archives-metadata&s1.collection=smallcol&s1.site=localsite&s1.d=HASH01454f31011f6b6b26eaf8d7&s1.metaname=Title&s1.metavalue=Moo&s1.prevmetavalue=Blabla&s1.metamode=override
     431
     432    // if we're doing a set- or remove- metadata operations, then we'll be changing the URL to make sure we go through GS3's authentication
     433    if(url.indexOf("set-") != -1 || url.indexOf("remove-") != -1) {
     434   
    434435    url = url.replace("&c=",  "&collection="); // c is a special param name for GS2Construct
    435436    url = url.replace(/(&|\?)([^=]*=)/g, "$1"+"s1.$2"); // prefix param names with "s1."
    436     url = url.replace("cgi-bin/metadata-server.pl?",  gs.xsltParams.library_name + "?a=g&rt=r&ro=1&s=SetMetadata&");
    437 
     437    url = url.replace("cgi-bin/metadata-server.pl?",  gs.xsltParams.library_name + "?a=g&rt=r&ro=1&s=ModifyMetadata&");
    438438    console.log("@@@@@ URL is " + url);
    439439    } // otherwise, such as for get- metadata operation, we proceed as before, which will not require authentication
    440 
    441     $.ajax(url)
     440   
     441    $.ajax(url, {async: false})
    442442    .success(function(response)
    443443    {
Note: See TracChangeset for help on using the changeset viewer.