Changeset 38431


Ignore:
Timestamp:
2023-11-25T19:06:30+13:00 (6 months ago)
Author:
anupama
Message:
  1. For editing user comments with the document editor, I want to set metamode to override just once instead of for each docid (that is, for each docrecord). This didn't work before because the perl code didn't allow it as optional argument, although the actual set-metadata-array() perl subroutines were coded for it. 2. The Java code needs to allow an array of document records, without requiring that each docrecord contains a metatable field (a sub array of meta records). This is because the perl code set-metadata-array() subroutines allowed for this, but when set-metadata functionality started needing authentication/user editing powers (authentication goes through java, which then relays the command to perl), this pre-existing, optional way of setting metadata in the perl code wasn't opened up through java.
Location:
main/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cgiactions/modmetadataaction.pm

    r38395 r38431  
    8383    "set-metadata-array" => {
    8484        'compulsory-args' => [ "where", "json" ],
    85         'optional-args'   => [ ],
     85        'optional-args'   => [ "metamode" ],
    8686        'help-string' => [
    8787        'A simple example: metadata-server.pl?a=set-metadata-array&where=archives|index|import&c=demo&json=[{"docid":"HASHc5bce2d6d3e5b04e470ec9","metaname":"Title","metavalue":"Tralalala","metamode":"accumulate"},{"docid":"HASHbe483fa4df4e096335d1c8","metaname":"Title","metavalue":"Lala was here","metapos":0, "metamode":"override"}]',
     
    9797    "set-archives-metadata-array" => {
    9898        'compulsory-args' => [ "json" ],
    99         'optional-args'   => [ ] },
     99        'optional-args'   => [ "metamode" ] },
    100100       
    101101    "set-import-metadata-array" => {
    102102        'compulsory-args' => [ "json" ],
    103         'optional-args'   => [ ] },
     103        'optional-args'   => [ "metamode" ] },
    104104
    105105    "set-index-metadata-array" => {
    106106        'compulsory-args' => [ "json" ],
    107         'optional-args'   => [ ] },
     107        'optional-args'   => [ "metamode" ] },
    108108   
    109109    "set-live-metadata-array" => {
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java

    r38338 r38431  
    907907           
    908908            constructor.setQueryString(querystring.toString());
     909            //logger.info("@@@@ perl querystring: " + querystring.toString());
    909910        }
    910911
     
    11761177            }
    11771178            }
     1179        } else {
     1180            // can also have set-metadatat-array without metatable field, like
     1181            // json=[{"docid":"HASHc5bce2d6d3e5b04e470ec9","metaname":"Title","metavalue":"Tralalala","metamode":"accumulate"},{"docid":"HASHbe483fa4df4e096335d1c8","metaname":"Title","metavalue":"Lala was here","metapos":0, "metamode":"override"}]
     1182            // though we use the metatable way for setting user comments meta.
     1183            // The alternative way is described as example usage in perllib/cgiactions/modmetadataaction.pm
     1184            // and also the way it's already coded up there, so we need to allow it here.
     1185            docids[index] = docInfo.getString("docid");
     1186            String metaname = docInfo.getString("metaname");
     1187            if(!isAllowedToModifyMeta(metaname, filterFields)) {
     1188            return null;
     1189            }
    11781190        }
    11791191        }
     
    11871199    // meaning that the setmeta operation was a valid user comment operation.
    11881200    // In that case, we have a docid for which we need to add a user comment
    1189     // set-metadata-array can take more docids, but doesn't happen for a user comment. And one comment
    1190     // is added at a time, but 3 meta fields are set for each comment: username, usercomment and timestamp
    1191     // hence the use of set-meta-array.
     1201    // set-metadata-array can take more docids, but that doesn't happen when creating a user
     1202    // comment (though it now happens when editing existing user comments). And one comment is
     1203    // added at a time, but 3 meta fields are set for each comment: username, usercomment and
     1204    // timestamp, hence the use of set-meta-array.
    11921205    return docids;
    11931206
  • main/trunk/greenstone3/web/interfaces/default/js/documentedit_scripts_usercomments.js

    r38426 r38431  
    6868    docArray.push({
    6969        docid:docid,
    70         metatable:metatable,
    71         metamode:"override"
     70        metatable:metatable/*,
     71        metamode:"override"*/ // metamode set universally to override in
     72              // documentedit_scripts_util.js::processChangesLoop when change.type=editUserComments
    7273    });
    7374    }
Note: See TracChangeset for help on using the changeset viewer.