Show
Ignore:
Timestamp:
21.02.2012 09:44:14 (8 years ago)
Author:
sjm84
Message:

Added in metamode and the ability to add metadata

Location:
main/trunk/greenstone3/web/interfaces/oran/js
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/oran/js/documentmaker_scripts_util.js

    r25104 r25105  
    181181    { 
    182182        var currentRow = _deletedMetadata[i]; 
    183         console.log(currentRow.parentNode); 
     183 
    184184        //Get document ID 
    185185        var currentElem = currentRow; 
     
    213213            while((currentElem = currentElem.parentNode).tagName != "TABLE"); 
    214214            var docID = currentElem.getAttribute("id").substring(4); 
    215              
     215 
    216216            //Get metadata name 
    217217            var row = changedElem.parentNode; 
     
    220220            var name = nameCell.innerHTML; 
    221221 
    222             gs.functions.setArchivesMetadata(gs.cgiParams.p_c /*bad*/, "localsite" /*bad*/, docID, name, null, changedElem.innerHTML, changedElem.originalValue, function(){console.log("SAVED ARCHIVES");}); 
     222            if(changedElem.originalValue) 
     223            { 
     224                gs.functions.setArchivesMetadata(gs.cgiParams.p_c /*bad*/, "localsite" /*bad*/, docID, name, null, changedElem.innerHTML, changedElem.originalValue, "override", function(){console.log("SAVED ARCHIVES");}); 
     225            } 
     226            else 
     227            { 
     228                gs.functions.setArchivesMetadata(gs.cgiParams.p_c /*bad*/, "localsite" /*bad*/, docID, name, null, changedElem.innerHTML, null, "accumulate", function(){console.log("SAVED ARCHIVES");}); 
     229            } 
    223230            changedElem.originalValue = changedElem.innerHTML; 
    224231            addCollectionToBuild(gs.cgiParams.p_c); 
  • main/trunk/greenstone3/web/interfaces/oran/js/javascript-global-functions.js

    r25104 r25105  
    203203*************************/ 
    204204 
    205 gs.functions.setImportMetadata = function(collection, site, documentID, metadataName, metadataValue, prevMetadataValue, responseFunction) 
    206 { 
    207     callMetadataServer("setImportMetadata", "cgi-bin/metadata-server.pl?a=set-import-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue + "&prevmetavalue=" + prevMetadataValue, responseFunction); 
    208 } 
    209  
    210 gs.functions.setArchivesMetadata = function(collection, site, documentID, metadataName, metadataPosition, metadataValue, prevMetadataValue, responseFunction) 
    211 { 
    212     if(metadataPosition != null) 
    213     { 
    214         callMetadataServer("setArchivesMetadata", "cgi-bin/metadata-server.pl?a=set-archives-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metapos=" + metadataPosition + "&metavalue=" + metadataValue + "&metamode=override", responseFunction); 
     205gs.functions.setImportMetadata = function(collection, site, documentID, metadataName, metadataValue, prevMetadataValue, metamode, responseFunction) 
     206{ 
     207    callMetadataServer("setImportMetadata", "cgi-bin/metadata-server.pl?a=set-import-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue + "&prevmetavalue=" + prevMetadataValue + "&metamode=" + metamode, responseFunction); 
     208} 
     209 
     210gs.functions.setArchivesMetadata = function(collection, site, documentID, metadataName, metadataPosition, metadataValue, prevMetadataValue, metamode, responseFunction) 
     211{ 
     212    if(metadataPosition != null) 
     213    { 
     214        callMetadataServer("setArchivesMetadata", "cgi-bin/metadata-server.pl?a=set-archives-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metapos=" + metadataPosition + "&metavalue=" + metadataValue + "&metamode=" + metamode, responseFunction); 
    215215    } 
    216216    else if(prevMetadataValue != null) 
    217217    { 
    218         callMetadataServer("setArchivesMetadata", "cgi-bin/metadata-server.pl?a=set-archives-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue + "&prevmetavalue=" + prevMetadataValue + "&metamode=override", responseFunction); 
    219     } 
    220 } 
    221  
    222 gs.functions.setIndexMetadata = function(collection, site, documentID, metadataName, metadataPosition, metadataValue, prevMetadataValue, responseFunction) 
    223 { 
    224     if(metadataPosition != null) 
    225     { 
    226         callMetadataServer("setIndexMetadata", "cgi-bin/metadata-server.pl?a=set-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metapos=" + metadataPosition + "&metavalue=" + metadataValue, responseFunction); 
     218        callMetadataServer("setArchivesMetadata", "cgi-bin/metadata-server.pl?a=set-archives-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue + "&prevmetavalue=" + prevMetadataValue + "&metamode=" + metamode, responseFunction); 
     219    } 
     220    else 
     221    { 
     222        callMetadataServer("setArchivesMetadata", "cgi-bin/metadata-server.pl?a=set-archives-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue + "&metamode=" + metamode, responseFunction); 
     223    } 
     224} 
     225 
     226gs.functions.setIndexMetadata = function(collection, site, documentID, metadataName, metadataPosition, metadataValue, prevMetadataValue, metamode, responseFunction) 
     227{ 
     228    if(metadataPosition != null) 
     229    { 
     230        callMetadataServer("setIndexMetadata", "cgi-bin/metadata-server.pl?a=set-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metapos=" + metadataPosition + "&metavalue=" + metadataValue + "&metamode=" + metamode, responseFunction); 
    227231    } 
    228232    else if(prevMetadataValue != null) 
    229233    { 
    230         callMetadataServer("setIndexMetadata", "cgi-bin/metadata-server.pl?a=set-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue + "&prevmetavalue=" + prevMetadataValue, responseFunction); 
    231     } 
    232 } 
    233  
    234 gs.functions.setMetadata = function(collection, site, documentID, metadataName, metadataValue, responseFunction) 
     234        callMetadataServer("setIndexMetadata", "cgi-bin/metadata-server.pl?a=set-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue + "&prevmetavalue=" + prevMetadataValue + "&metamode=" + metamode, responseFunction); 
     235    } 
     236} 
     237 
     238gs.functions.setMetadata = function(collection, site, documentID, metadataName, metadataValue, metamode, responseFunction) 
    235239{ 
    236240    var nameArray = ["setImportMetadata", "setArchivesMetadata", "setIndexMetadata"]; 
     
    239243    for(var i = 0; i < nameArray.length; i++) 
    240244    { 
    241         callMetadataServer(nameArray[i], "cgi-bin/metadata-server.pl?a=" + functionArray[i] + "&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue, responseFunction); 
     245        callMetadataServer(nameArray[i], "cgi-bin/metadata-server.pl?a=" + functionArray[i] + "&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue + "&metamode=" + metamode, responseFunction); 
    242246    } 
    243247}