diff --git a/src/main/webapp/encounters/encounterMediaGallery.jsp b/src/main/webapp/encounters/encounterMediaGallery.jsp index 8a8d6f1f95..04c3d76f9f 100755 --- a/src/main/webapp/encounters/encounterMediaGallery.jsp +++ b/src/main/webapp/encounters/encounterMediaGallery.jsp @@ -45,6 +45,7 @@ String langCode=ServletUtilities.getLanguageCode(request); Properties encprops = ShepherdProperties.getProperties("encounter.properties", langCode,context); String encNum=""; boolean isOwner=false; +JSONObject MediaAssetOwner = new JSONObject(); @@ -96,7 +97,7 @@ List captionLinks = new ArrayList(); try { //we can have *more than one* encounter here, e.g. when used in thumbnailSearchResults.jsp !! - System.out.println("EncounterMediaGallery about to execute query "+query); + //System.out.println("EncounterMediaGallery about to execute query "+query); Collection c = (Collection) (query.execute()); ArrayList encs=new ArrayList(c); query.closeAll(); @@ -120,6 +121,7 @@ function forceLink(el) { <% List maAcms = new ArrayList(); List maIds = new ArrayList(); + boolean isEncounterOwner=isOwner; for(int f=0;f anns = enc.getAnnotations(); JSONObject iaTasks = new JSONObject(); @@ -155,6 +159,7 @@ function forceLink(el) { if (ma == null) continue; if ((ma.getAcmId() != null) && !maAcms.contains(ma.getAcmId())) maAcms.add(ma.getAcmId()); maIds.add(Integer.toString(ma.getId())); + MediaAssetOwner.put(Integer.toString(ma.getId()),isEncounterOwner); @@ -197,7 +202,7 @@ function forceLink(el) { //end caption render JSP side - // SKIPPING NON-TRIVIAL ANNOTATIONS FOR NOW! TODO + // SKIPPING NON-TRIVIAL ANNOTATIONS FOR NOW! //if (!ann.isTrivial()) continue; ///or not? @@ -248,8 +253,7 @@ function forceLink(el) { if ((ann.getFeatures() == null) || (ann.getFeatures().size() < 1)) continue; - //TODO here we skip unity feature annots. BETTER would be to look at detectionStatus and feature type etc! - // also: prob should check *what* is detected. :) somewhere.... + // here we skip unity feature annots. also: prob should check *what* is detected. if (ann.getFeatures().get(0).isUnity()) continue; //assume only 1 feature !! System.out.println("\n\n==== got detected frame! " + ma + " -> " + ann.getFeatures().get(0) + " => " + ann.getFeatures().get(0).getParametersAsString()); j.put("extractFPS", ma.getParameters().optDouble("extractFPS",0)); @@ -288,12 +292,13 @@ System.out.println("\n\n==== got detected frame! " + ma + " -> " + ann.getFeatur } out.println(""); + out.println(""); } JSONObject dups = new JSONObject(); //this is kinda hacky cuz it is sql-specific if (maAcms.size() > 0) { - String sql = "select \"MEDIAASSET\".\"ID\" as assetId, \"MEDIAASSET\".\"ACMID\" as assetAcmId, \"ENCOUNTER\".\"CATALOGNUMBER\" as encId, \"ENCOUNTER\".\"INDIVIDUALID\" as indivId from \"MEDIAASSET\" join \"MEDIAASSET_FEATURES\" on (\"ID\" = \"ID_OID\") join \"ANNOTATION_FEATURES\" using (\"ID_EID\") join \"ENCOUNTER_ANNOTATIONS\" on (\"ANNOTATION_FEATURES\".\"ID_OID\" = \"ENCOUNTER_ANNOTATIONS\".\"ID_EID\") join \"ENCOUNTER\" on (\"ENCOUNTER_ANNOTATIONS\".\"CATALOGNUMBER_OID\" = \"ENCOUNTER\".\"CATALOGNUMBER\") where \"MEDIAASSET\".\"ACMID\" in ('" + String.join("', '", maAcms) + "') AND \"MEDIAASSET\".\"ID\" not in (" + String.join(", ", maIds) + ");"; + String sql = "select \"MEDIAASSET\".\"ID\" as assetId, \"MEDIAASSET\".\"ACMID\" as assetAcmId, \"ENCOUNTER\".\"CATALOGNUMBER\" as encId, \"MARKEDINDIVIDUAL_ENCOUNTERS\".\"INDIVIDUALID_OID\" as indivId from \"MEDIAASSET\" join \"MEDIAASSET_FEATURES\" on (\"ID\" = \"ID_OID\") join \"ANNOTATION_FEATURES\" using (\"ID_EID\") join \"ENCOUNTER_ANNOTATIONS\" on (\"ANNOTATION_FEATURES\".\"ID_OID\" = \"ENCOUNTER_ANNOTATIONS\".\"ID_EID\") join \"ENCOUNTER\" on (\"ENCOUNTER_ANNOTATIONS\".\"CATALOGNUMBER_OID\" = \"ENCOUNTER\".\"CATALOGNUMBER\") left join \"MARKEDINDIVIDUAL_ENCOUNTERS\" on (\"ENCOUNTER\".\"CATALOGNUMBER\" = \"MARKEDINDIVIDUAL_ENCOUNTERS\".\"CATALOGNUMBER_EID\") where \"MEDIAASSET\".\"ACMID\" in ('" + String.join("', '", maAcms) + "') AND \"MEDIAASSET\".\"ID\" not in (" + String.join(", ", maIds) + ");"; // assetid | assetacmid | encid | individ Query q = imageShepherd.getPM().newQuery("javax.jdo.query.SQL", sql); List results = (List)q.execute(); @@ -956,7 +961,6 @@ console.info(' ===========> %o %o', el, enh); if (!opt.init) opt.init = []; //maybe created if logged in? opt.init.push( - //function(el, enh) { enhancerDisplayAnnots(el, enh); }, //TODO fix for scaled/watermark image function(el, enh) { enhancerCaption(el, enh); } ); @@ -1064,7 +1068,6 @@ function featureSortOrder(feat) { function enhancerDisplayFeature(el, opt, focusAnnId, feat, zdelta, mediaAssetId) { if (!feat.type) return; //unity, skip if (!feat.parameters) return; //wtf??? - //TODO other than boundingBox var scale = el.data('enhancerScale') || 1; console.log('FEAT!!!!!!!!!!!!!!! scale=%o feat=%o', scale, feat); let widthScale = el; //.width;// / el.naturalWidth; @@ -1127,7 +1130,6 @@ console.log('FEAT!!!!!!!!!!!!!!! scale=%o feat=%o', scale, feat); } function checkImageEnhancerResize() { -//TODO update enhancerScale when this happens! var needUpdate = false; $('.image-enhancer-wrapper').each(function(i,el) { var jel = $(el); @@ -1330,8 +1332,6 @@ function refreshKeywordsForMediaAsset(mid, data) { } } - //TODO do we need to FIXME this for when a single MediaAsset appears multiple times??? (gallery style) - console.log("in refreshKeywordsForMediaAsset, looking for #asset-id-"+mid); $('#asset-id-'+mid).each(function(i,el) { $(el).find('.image-enhancer-keyword-wrapper-hover').empty(); @@ -1415,26 +1415,26 @@ console.info("############## mid=%s -> %o", mid, ma); console.info("Have labeled keyword %o", kw); h += '
' + kw.label+': '+kw.readableName+''; - <% - if(isOwner){ - %> + + if(MediaAssetOwner[mid]){ + h+='X'; - <% + } - %> + h+='
'; } else { h+= '
' + ma.keywords[i].readableName; - <% - if(isOwner){ - %> + + if(MediaAssetOwner[mid]){ + h+=' X'; - <% + } - %> + h+='
'; } @@ -1448,9 +1448,9 @@ console.info("############## mid=%s -> %o", mid, ma); console.log("Labeled keywords %o", labelsToValues); let labeledAvailable = (labelsToValues.length>0); - <% - if(isOwner){ - %> + + + h +='
add new labeled keyword
'; if (!$.isEmptyObject(labelsToValues)) { @@ -1481,11 +1481,11 @@ console.info("############## mid=%s -> %o", mid, ma); } h += '
'; - <% - } + + - if(isOwner){ - %> + + h += '
add new keyword
'; if (wildbookGlobals.keywords) { @@ -1501,9 +1501,9 @@ console.info("############## mid=%s -> %o", mid, ma); } h += '
'; h += '
'; - <% - } - %> + + + // we need to attach this to the outer container now if (!hasWrapper) { @@ -1536,6 +1536,11 @@ function showKeywordList(el) { $(el).parent().attr('class').split(' ').map(function(className){ if (className.startsWith('image-enhancer-wrapper-mid-')) { let mid = className.replace('image-enhancer-wrapper-mid-', ''); + if(!MediaAssetOwner[mid]){ + $('.image-enhancer-keyword-wrapper-hover > .iek-new-wrapper:not(.labeled)').hide(); + } else { + $('.image-enhancer-keyword-wrapper-hover > .iek-new-wrapper:not(.labeled)').show(); + } $('.pswp__button--arrow--right').click(function(ev) { nextImageArrow(ev,mid); }); @@ -1689,8 +1694,7 @@ function _parseDetection(task) { rtn.msg = 'Detection task found, but no results. Possibly still processing?'; } else { for (var i = 0 ; i < task.results.length ; i++) { - if (!task.results[i].status) continue; //kinda cheap hack.. should probably investigate this TODO - //TODO actually check out what most recent has to say here.... + if (!task.results[i].status) continue; //kinda cheap hack rtn.state = 'complete'; rtn.msg = 'most recent result status _action=' + task.results[i].status._action; break;