Changeset 6947
- Timestamp:
- Sep 8, 2015, 2:30:31 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/AnnotationUtil.java
r6729 r6947 22 22 package net.sf.basedb.clients.web; 23 23 24 import java.util.ArrayList; 25 import java.util.Date; 24 26 import java.util.HashSet; 27 import java.util.List; 25 28 import java.util.Set; 26 29 30 import net.sf.basedb.clients.web.formatter.FormatterFactory; 31 import net.sf.basedb.clients.web.util.HTML; 32 import net.sf.basedb.core.Annotatable; 33 import net.sf.basedb.core.Annotation; 27 34 import net.sf.basedb.core.AnnotationType; 28 35 import net.sf.basedb.core.AnnotationTypeCategory; … … 33 40 import net.sf.basedb.core.ItemQuery; 34 41 import net.sf.basedb.core.ItemSubtype; 42 import net.sf.basedb.core.Nameable; 35 43 import net.sf.basedb.core.Type; 44 import net.sf.basedb.core.Unit; 36 45 import net.sf.basedb.core.query.Expressions; 37 46 import net.sf.basedb.core.query.Hql; 38 47 import net.sf.basedb.core.query.Orders; 39 48 import net.sf.basedb.core.query.Restrictions; 49 import net.sf.basedb.util.formatter.Formatter; 40 50 41 51 import org.json.simple.JSONArray; … … 148 158 } 149 159 160 161 @SuppressWarnings("unchecked") 162 public static JSONObject createJsonForAnnotationTypeAndAnnotation(DbControl dc, AnnotationType at, 163 Annotation a, Annotation inherited, boolean isProtocolParameter, Set<AnnotationTypeCategory> allCategories) 164 { 165 // Create the JSON objects for holding all info 166 // The base object has 'id', 'source', 'annotationType' and 'annotation' 167 JSONObject json = new JSONObject(); 168 json.put("id", ""+at.getId() + (a!=null ? "-" + a.getId() : "")); 169 // If 'a' is null this is a primary annotation that has no current values 170 json.put("source", a == null ? (inherited == null ? "PRIMARY" : "INHERITED") : a.getSource().name()); 171 172 JSONObject jsonAt = new JSONObject(); 173 json.put("annotationType", jsonAt); 174 JSONObject jsonA = new JSONObject(); 175 json.put("annotation", jsonA); 176 JSONArray jsonValues = new JSONArray(); 177 jsonA.put("values", jsonValues); 178 179 // Load annotation type information 180 Type valueType = at.getValueType(); 181 Formatter formatter = FormatterFactory.getTypeFormatter(dc.getSessionControl(), valueType); 182 183 jsonAt.put("id", at.getId()); 184 jsonAt.put("name", at.getName()); 185 jsonAt.put("valueType", valueType.name()); 186 jsonAt.put("multiplicity", at.getMultiplicity()); 187 jsonAt.put("description", HTML.encodeTags(at.getDescription())); 188 jsonAt.put("removed", at.isRemoved()); 189 jsonAt.put("protocolParameter", isProtocolParameter); 190 191 if (valueType == Type.STRING) 192 { 193 jsonAt.put("maxLength", at.getMaxLength()); 194 } 195 else if (valueType == Type.INT || valueType == Type.LONG) 196 { 197 jsonAt.put("minValue", at.getMinValueLong()); 198 jsonAt.put("maxValue", at.getMaxValueLong()); 199 } 200 else if (valueType == Type.FLOAT || valueType == Type.DOUBLE) 201 { 202 jsonAt.put("minValue", at.getMinValueDouble()); 203 jsonAt.put("maxValue", at.getMaxValueDouble()); 204 } 205 206 // Enumeration 207 if (at.isEnumeration()) 208 { 209 List<?> values = at.getValues(); 210 JSONArray jsonEnum = new JSONArray(); 211 for (Object val : values) 212 { 213 jsonEnum.add(formatter.format(val)); 214 } 215 jsonAt.put("enumeration", jsonEnum); 216 jsonAt.put("displayAsList", at.getDisplayAsList()); 217 } 218 219 // Units 220 if (at.supportUnits()) 221 { 222 Unit defaultUnit = at.getDefaultUnit(); 223 jsonAt.put("defaultUnit", defaultUnit.getId()); 224 jsonAt.put("defaultSymbol", defaultUnit.getDisplaySymbol()); 225 226 if (!at.isEnumeration()) 227 { 228 ItemQuery<Unit> unitQuery = at.getUsableUnits(); 229 if (unitQuery.count(dc) == 0) 230 { 231 unitQuery = at.getQuantity().getUnits(); 232 } 233 else 234 { 235 unitQuery.reset(); 236 } 237 unitQuery.order(Orders.desc(Hql.property("referenceFactor"))); 238 unitQuery.order(Orders.asc(Hql.property("displaySymbol"))); 239 List<Unit> units = new ArrayList<Unit>(unitQuery.list(dc)); 240 if (!units.contains(defaultUnit)) units.add(defaultUnit); 241 242 Unit currentUnit = a != null ? a.getUnit() : null; 243 if (currentUnit != null && !units.contains(currentUnit)) units.add(currentUnit); 244 245 JSONArray jsonUnits = new JSONArray(); 246 for (Unit unit : units) 247 { 248 JSONObject jsonUnit = new JSONObject(); 249 jsonUnit.put("id", unit.getId()); 250 jsonUnit.put("description", HTML.encodeTags(unit.getName() + " - " + unit.getDescription())); 251 jsonUnit.put("symbol", HTML.encodeTags(unit.getDisplaySymbol())); 252 jsonUnits.add(jsonUnit); 253 } 254 jsonAt.put("units", jsonUnits); 255 } 256 } 257 258 // Categories 259 JSONArray jsonCategories = new JSONArray(); 260 ItemQuery<AnnotationTypeCategory> categoryQuery = at.getCategories(); 261 categoryQuery.include(Include.MINE, Include.OTHERS, Include.SHARED, Include.IN_PROJECT); 262 categoryQuery.join(Hql.innerJoin("annotationTypes", "atp")); 263 categoryQuery.restrict(Restrictions.eq(Hql.alias("atp"), Hql.entity(at))); 264 for (AnnotationTypeCategory category : categoryQuery.list(dc)) 265 { 266 if (allCategories != null) allCategories.add(category); 267 jsonCategories.add(category.getId()); 268 } 269 jsonAt.put("categories", jsonCategories); 270 271 272 if (a != null) 273 { 274 createJSON(jsonA, dc, a, formatter, false); 275 276 if (a.getSource() != Annotation.Source.PRIMARY) 277 { 278 inherited = a.getInheritedFrom(); 279 } 280 } 281 282 if (inherited != null) 283 { 284 JSONObject jsonInherited = new JSONObject(); 285 createJSON(jsonInherited, dc, inherited, formatter, true); 286 Annotatable inheritedFrom = inherited.getAnnotationSet().getItem(dc); 287 JSONObject jsonFrom = new JSONObject(); 288 jsonFrom.put("id", inheritedFrom.getId()); 289 jsonFrom.put("name", ((Nameable)inheritedFrom).getName()); 290 jsonFrom.put("type", inheritedFrom.getType().name()); 291 jsonInherited.put("from", jsonFrom); 292 json.put("inherited", jsonInherited); 293 } 294 295 return json; 296 } 297 298 @SuppressWarnings("unchecked") 299 static void createJSON(JSONObject json, DbControl dc, Annotation a, Formatter formatter, boolean formatAll) 300 { 301 json.put("id", a.getId()); 302 Date lastUpdate = a.getLastUpdate(); 303 if (lastUpdate != null) json.put("lastUpdate", lastUpdate.getTime()); 304 305 Unit currentUnit = a.getUnit(); 306 if (currentUnit != null) 307 { 308 json.put("unit", currentUnit.getId()); 309 json.put("unitSymbol", currentUnit.getDisplaySymbol()); 310 } 311 312 // Populate the values array 313 List values = a.getValues(null); 314 if (values != null) 315 { 316 JSONArray jsonValues = new JSONArray(); 317 json.put("values", jsonValues); 318 319 for (Object value : values) 320 { 321 // Dates should be formatted to strings using the current date(time) format 322 if (formatAll || value instanceof Date) 323 { 324 value = formatter.format(value); 325 } 326 jsonValues.add(value.toString()); 327 } 328 } 329 330 } 331 150 332 } -
trunk/src/clients/web/net/sf/basedb/clients/web/Base.java
r6945 r6947 1444 1444 JSONObject jsonA = (JSONObject)jsonModified.get(entryNo); 1445 1445 Number annotationId = (Number)jsonA.get("annotationId"); 1446 Number inheritedId = (Number)jsonA.get("inheritedId"); 1446 1447 Number annotationTypeId = (Number)jsonA.get("annotationTypeId"); 1447 1448 JSONArray jsonValues = (JSONArray)jsonA.get("values"); … … 1479 1480 if ("CONVERTED".equals(modifyType)) continue; // Only converted between types 1480 1481 } 1481 1482 } 1483 else if (inheritedId != null) 1484 { 1485 if (!"DELETE".equals(modifyType)) 1486 { 1487 Annotation inherited = Annotation.getById(dc, inheritedId.intValue()); 1488 a = newAs.inheritAnnotation(inherited, source == Annotation.Source.CLONED); 1489 } 1482 1490 } 1483 1491 else if (jsonValues != null && jsonValues.size() > 0) 1484 1492 { 1485 a = newAs.getAnnotation(at); 1493 if (!"DELETE".equals(modifyType)) 1494 { 1495 a = newAs.getAnnotation(at); 1496 } 1486 1497 } 1487 1498 1488 1499 if (a == null) continue; 1489 1500 1490 Type valueType = at.getValueType(); 1491 Number unitId = (Number)jsonA.get("unitId"); 1492 Unit unit = unitId == null ? null : Unit.getById(dc, unitId.intValue()); 1493 if (jsonValues == null || jsonValues.size() == 0) 1501 if (jsonValues != null && jsonValues.size() > 0) 1494 1502 { 1495 newAs.removeAnnotation(at);1496 }1497 else1498 {1503 Type valueType = at.getValueType(); 1504 Number unitId = (Number)jsonA.get("unitId"); 1505 Unit unit = unitId == null ? null : Unit.getById(dc, unitId.intValue()); 1506 1499 1507 Object[] oValues = new Object[jsonValues.size()]; 1500 1508 Formatter<?> formatter = FormatterFactory.getTypeFormatter(dc.getSessionControl(), valueType); … … 1505 1513 a.setValues(Arrays.asList(oValues), unit); 1506 1514 } 1507 1508 1509 1515 } 1510 1516 -
trunk/www/biomaterials/extracts/edit_extract.jsp
r6605 r6947 603 603 </t:tab> 604 604 605 <t:tab id="inheritedAnnotations" title="Inherited annotations"606 helpid="annotations.edit.inherited">607 <jsp:include page="../../common/annotations/inherit_frameset.jsp">608 <jsp:param name="item_type" value="<%=itemType.name()%>" />609 <jsp:param name="item_id" value="<%=itemId%>" />610 <jsp:param name="ID" value="<%=ID%>" />611 </jsp:include>612 </t:tab>613 605 </t:tabcontrol> 614 606 </form> -
trunk/www/biomaterials/extracts/extracts.js
r6756 r6947 41 41 // Tab validation 42 42 TabControl.addTabActivateListener('settings.annotations', extracts.loadAnnotationsFrame); 43 TabControl.addTabActivateListener('settings.inheritedAnnotations', extracts.loadInheritedAnnotationsFrame);44 43 TabControl.addTabValidator('settings.info', extracts.validateExtract); 45 44 … … 231 230 { 232 231 Annotations.saveModifiedAnnotationsToForm(frm); 233 Annotations.saveInheritedAnnotationsToForm(frm);234 232 Link.exportActions('extracts'); 235 233 frm.submit(); … … 246 244 protocolId = Math.abs(parseInt(frm.protocol_id.value)); 247 245 } 248 Annotations.autoLoadEditFrame(protocolId, ItemSubtype.getSubtypeId('subtype_id')); 249 } 250 251 extracts.loadInheritedAnnotationsFrame = function() 252 { 253 Annotations.autoLoadInheritFrame(extracts.getParents()); 254 } 255 246 Annotations.autoLoadEditFrame(protocolId, ItemSubtype.getSubtypeId('subtype_id'), extracts.getParents()); 247 } 256 248 257 249 extracts.getParents = function() -
trunk/www/biomaterials/samples/edit_sample.jsp
r6605 r6947 559 559 </t:tab> 560 560 561 <t:tab id="inheritedAnnotations" title="Inherited annotations"562 helpid="annotations.edit.inherited">563 <jsp:include page="../../common/annotations/inherit_frameset.jsp">564 <jsp:param name="item_type" value="<%=itemType.name()%>" />565 <jsp:param name="item_id" value="<%=itemId%>" />566 <jsp:param name="ID" value="<%=ID%>" />567 </jsp:include>568 </t:tab>569 561 </t:tabcontrol> 570 562 </form> -
trunk/www/biomaterials/samples/samples.js
r6756 r6947 41 41 // Tab validation 42 42 TabControl.addTabActivateListener('settings.annotations', samples.loadAnnotationsFrame); 43 TabControl.addTabActivateListener('settings.inheritedAnnotations', samples.loadInheritedAnnotationsFrame);44 43 TabControl.addTabValidator('settings.info', samples.validateSample); 45 44 … … 205 204 { 206 205 Annotations.saveModifiedAnnotationsToForm(frm); 207 Annotations.saveInheritedAnnotationsToForm(frm);208 206 Link.exportActions('samples'); 209 207 frm.submit(); … … 294 292 protocolId = Math.abs(parseInt(frm.protocol_id.value)); 295 293 } 296 Annotations.autoLoadEditFrame(protocolId, ItemSubtype.getSubtypeId('subtype_id')); 297 } 298 299 samples.loadInheritedAnnotationsFrame = function() 300 { 301 Annotations.autoLoadInheritFrame(samples.getParents()); 294 Annotations.autoLoadEditFrame(protocolId, ItemSubtype.getSubtypeId('subtype_id'), samples.getParents()); 302 295 } 303 296 -
trunk/www/common/annotations/ajax.jsp
r6696 r6947 25 25 import="net.sf.basedb.core.DbControl" 26 26 import="net.sf.basedb.core.AnnotationType" 27 import="net.sf.basedb.core.Annotation" 27 28 import="net.sf.basedb.core.Item" 28 29 import="net.sf.basedb.core.Type" … … 34 35 import="org.json.simple.JSONObject" 35 36 import="org.json.simple.JSONArray" 37 import="java.util.HashSet" 36 38 %> 37 39 <% … … 53 55 AnnotationType at = AnnotationType.getById(dc, itemId); 54 56 json.put("annotationType", AnnotationUtil.loadJsonForBatchInherit(dc, at)); 57 } 58 else if ("GetAnnotationInfoForInherit".equals(cmd)) 59 { 60 dc = sc.newDbControl(); 61 Annotation a = Annotation.getById(dc, itemId); 62 AnnotationType at = a.getAnnotationType(); 63 JSONObject jsonInfo = AnnotationUtil.createJsonForAnnotationTypeAndAnnotation(dc, at, null, a, false, new HashSet()); 64 json.put("info", jsonInfo); 55 65 } 56 66 else -
trunk/www/common/annotations/annotate.js
r6946 r6947 31 31 var CONVERTED = 'CONVERTED'; 32 32 var DELETE = 'DELETE'; 33 var INHERITED = 'INHERITED'; 33 34 34 35 var annotations; 36 var parents; 35 37 var selectedAnnotation; 36 38 var selectedIndex; … … 45 47 // Parse the current annotation information which contain value type, current values, etc. 46 48 annotations = Data.json('page-data', 'annotations'); 49 parents = Data.json('page-data', 'parents'); 50 47 51 // Loop through all annotations and build the selection list 48 52 var numPrimary = 0; 49 53 for (var i = 0; i < annotations.length; i++) 50 54 { 51 annotate.createAnnotationEntryInList(annotations[i], true);55 annotate.createAnnotationEntryInList(annotations[i], false); 52 56 if (annotations[i].source == 'PRIMARY') numPrimary++; 53 57 } … … 107 111 // Delete annotations 108 112 Buttons.addClickHandler('btnDelete', annotate.deleteAllChecked); 113 // Add inherited annotations 114 Buttons.addClickHandler('btnAdd', annotate.addInheritedAnnotations); 115 Events.addEventHandler('btnAdd', 'remove-annotation', annotate.onRemoveInheritedAnnotation); 116 Events.addEventHandler('btnAdd', 'inherit-annotation', annotate.onAddInheritedAnnotation); 109 117 110 118 // Select the initial annotation … … 129 137 in the list. 130 138 */ 131 annotate.createAnnotationEntryInList = function(entry, firstInherited)139 annotate.createAnnotationEntryInList = function(entry, autoSort) 132 140 { 133 141 var ann = entry.annotation; … … 157 165 158 166 Events.addEventHandler(div, 'click', annotate.annotationOnClick); 159 Doc.element(entry.source == 'PRIMARY' ? 'primary-list' : 'inherited-list').appendChild(div); 167 var list = Doc.element(entry.source == 'PRIMARY' ? 'primary-list' : 'inherited-list'); 168 var beforeChild = null; 169 if (autoSort) 170 { 171 var childNo = 0; 172 while (childNo < list.childNodes.length) 173 { 174 var child = list.childNodes[childNo]; 175 if (child.title && child.title > div.title) 176 { 177 beforeChild = child; 178 break; 179 } 180 childNo++; 181 } 182 } 183 list.insertBefore(div, beforeChild); 160 184 } 161 185 … … 176 200 177 201 var show = false; 178 if (entry.modified == 'DELETE' && entry.source != 'PRIMARY') 179 {} // Do not show deleted annotations that are not PRIMARY 202 if (entry.source != 'PRIMARY') 203 { 204 // INHERITED or CLONED annotations are visible unless DELETEd 205 show = entry.modified != 'DELETE'; 206 } 180 207 else if (categoryId == -1) 181 208 { … … 871 898 annotate.deleteAnnotation = function(entry) 872 899 { 873 App.debug(entry.id);874 900 if (entry.source == 'PRIMARY') 875 901 { … … 885 911 } 886 912 return true; 913 } 914 915 /** 916 Open a popup dialog for selecting parent annotations 917 that should be inherited. 918 */ 919 annotate.addInheritedAnnotations = function(event) 920 { 921 var url = 'inherit.jsp?ID='+App.getSessionId(); 922 url += '&item_type='+Data.get('page-data', 'item-type'); 923 url += '&item_id='+Data.get('page-data', 'item-id'); 924 url += '&callback='+event.currentTarget.id; 925 926 // Items marked for DELETE should show up in the dialog 927 var deleted = []; 928 for (var i = 0; i < annotations.length; i++) 929 { 930 var entry = annotations[i]; 931 if (entry.source != 'PRIMARY' && entry.modified == DELETE && entry.annotation.id) 932 { 933 deleted[deleted.length] = entry.annotation.id; 934 } 935 } 936 url += '&deleted='+deleted.join(','); 937 938 if (parents.length) 939 { 940 url += '&parents='+parents.join('&parents='); 941 } 942 943 Dialogs.openPopup(url, 'InheritAnnotations', 750, 500); 944 } 945 946 annotate.setParents = function(newParents) 947 { 948 parents = newParents; 949 } 950 951 /** 952 Event handler for removing an inherited annotation. 953 */ 954 annotate.onRemoveInheritedAnnotation = function(event) 955 { 956 var inheritedId = event.detail.id; 957 for (var i = 0; i < annotations.length; i++) 958 { 959 var entry = annotations[i]; 960 if (entry.inherited && entry.inherited.id == inheritedId) 961 { 962 annotate.deleteAnnotation(entry); 963 return; 964 } 965 } 966 } 967 968 /** 969 Event handler for adding an inherited annotation. Note 970 that the annotation may be an annotation that is already 971 inherited but has been marked for DELETE. In this case the 972 DELETE should be cancelled. 973 */ 974 annotate.onAddInheritedAnnotation = function(event) 975 { 976 Doc.show('inherited-list'); 977 var inheritedId = event.detail.id; 978 979 // Check if we have info about this annotation already 980 for (var i = 0; i < annotations.length; i++) 981 { 982 var entry = annotations[i]; 983 if (entry.inherited && entry.inherited.id == inheritedId) 984 { 985 entry.modified = INHERITED; 986 Doc.show(entry.id); 987 return; 988 } 989 } 990 991 // Load info about this annotation 992 var url = 'ajax.jsp?ID='+App.getSessionId(); 993 url += '&cmd=GetAnnotationInfoForInherit'; 994 url += '&item_id='+inheritedId; 995 996 var request = Ajax.getXmlHttpRequest(); 997 request.open("GET", url, true); 998 request.send(null); 999 Ajax.setReadyStateHandler(request, annotate.inheritInfoLoaded, annotate.inheritInfoLoaded); 1000 } 1001 1002 /** 1003 Callback after we have got information about an annotation 1004 that we should inherit. 1005 */ 1006 annotate.inheritInfoLoaded = function(request) 1007 { 1008 var response = JSON.parse(request.responseText); 1009 if (response.status != 'ok') 1010 { 1011 App.debug(request.responseText); 1012 return; 1013 } 1014 1015 var entry = response.info; 1016 entry.modified = INHERITED; 1017 1018 annotations[annotations.length] = entry; 1019 annotate.createAnnotationEntryInList(entry, true); 887 1020 } 888 1021 … … 1045 1178 tmp.source = entry.source; 1046 1179 tmp.modified = entry.modified; 1047 tmp.values = entry.annotation.values;1048 tmp.annotationId = entry.annotation.id;1049 1180 tmp.annotationTypeId = entry.annotationType.id; 1050 tmp.unitId = entry.annotation.unit; 1181 if (entry.annotation) 1182 { 1183 tmp.values = entry.annotation.values; 1184 tmp.annotationId = entry.annotation.id; 1185 tmp.unitId = entry.annotation.unit; 1186 } 1187 if (entry.inherited) 1188 { 1189 tmp.inheritedId = entry.inherited.id; 1190 } 1051 1191 } 1052 1192 } -
trunk/www/common/annotations/annotate.jsp
r6946 r6947 60 60 import="net.sf.basedb.clients.web.formatter.FormatterFactory" 61 61 import="net.sf.basedb.clients.web.formatter.FormatterSettings" 62 import="net.sf.basedb.clients.web.AnnotationUtil" 62 63 import="net.sf.basedb.util.Values" 63 64 import="org.json.simple.JSONObject" … … 75 76 <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> 76 77 <%@ taglib prefix="m" uri="/WEB-INF/menu.tld" %> 77 <%!78 private JSONObject makeJSON(DbControl dc, AnnotationType at, Annotation a, boolean isProtocolParameter, Set<AnnotationTypeCategory> allCategories)79 {80 // Create the JSON objects for holding all info81 // The base object has 'id', 'source', 'annotationType' and 'annotation'82 JSONObject json = new JSONObject();83 json.put("id", ""+at.getId() + (a!=null ? "-" + a.getId() : ""));84 // If 'a' is null this is a primary annotation that has no current values85 json.put("source", a == null ? "PRIMARY" : a.getSource().name());86 87 JSONObject jsonAt = new JSONObject();88 json.put("annotationType", jsonAt);89 JSONObject jsonA = new JSONObject();90 json.put("annotation", jsonA);91 JSONArray jsonValues = new JSONArray();92 jsonA.put("values", jsonValues);93 94 // Load annotation type information95 Type valueType = at.getValueType();96 Formatter formatter = FormatterFactory.getTypeFormatter(dc.getSessionControl(), valueType);97 98 jsonAt.put("id", at.getId());99 jsonAt.put("name", at.getName());100 jsonAt.put("valueType", valueType.name());101 jsonAt.put("multiplicity", at.getMultiplicity());102 jsonAt.put("description", HTML.encodeTags(at.getDescription()));103 jsonAt.put("removed", at.isRemoved());104 jsonAt.put("protocolParameter", isProtocolParameter);105 106 if (valueType == Type.STRING)107 {108 jsonAt.put("maxLength", at.getMaxLength());109 }110 else if (valueType == Type.INT || valueType == Type.LONG)111 {112 jsonAt.put("minValue", at.getMinValueLong());113 jsonAt.put("maxValue", at.getMaxValueLong());114 }115 else if (valueType == Type.FLOAT || valueType == Type.DOUBLE)116 {117 jsonAt.put("minValue", at.getMinValueDouble());118 jsonAt.put("maxValue", at.getMaxValueDouble());119 }120 121 // Enumeration122 if (at.isEnumeration())123 {124 List<?> values = at.getValues();125 JSONArray jsonEnum = new JSONArray();126 for (Object val : values)127 {128 jsonEnum.add(formatter.format(val));129 }130 jsonAt.put("enumeration", jsonEnum);131 jsonAt.put("displayAsList", at.getDisplayAsList());132 }133 134 // Units135 if (at.supportUnits())136 {137 Unit defaultUnit = at.getDefaultUnit();138 jsonAt.put("defaultUnit", defaultUnit.getId());139 jsonAt.put("defaultSymbol", defaultUnit.getDisplaySymbol());140 141 if (!at.isEnumeration())142 {143 ItemQuery<Unit> unitQuery = at.getUsableUnits();144 if (unitQuery.count(dc) == 0)145 {146 unitQuery = at.getQuantity().getUnits();147 }148 else149 {150 unitQuery.reset();151 }152 unitQuery.order(Orders.desc(Hql.property("referenceFactor")));153 unitQuery.order(Orders.asc(Hql.property("displaySymbol")));154 List<Unit> units = new ArrayList<Unit>(unitQuery.list(dc));155 if (!units.contains(defaultUnit)) units.add(defaultUnit);156 157 Unit currentUnit = a != null ? a.getUnit() : null;158 if (currentUnit != null && !units.contains(currentUnit)) units.add(currentUnit);159 160 JSONArray jsonUnits = new JSONArray();161 for (Unit unit : units)162 {163 JSONObject jsonUnit = new JSONObject();164 jsonUnit.put("id", unit.getId());165 jsonUnit.put("description", HTML.encodeTags(unit.getName() + " - " + unit.getDescription()));166 jsonUnit.put("symbol", HTML.encodeTags(unit.getDisplaySymbol()));167 jsonUnits.add(jsonUnit);168 }169 jsonAt.put("units", jsonUnits);170 }171 }172 173 // Categories174 JSONArray jsonCategories = new JSONArray();175 ItemQuery<AnnotationTypeCategory> categoryQuery = at.getCategories();176 categoryQuery.include(Include.MINE, Include.OTHERS, Include.SHARED, Include.IN_PROJECT);177 categoryQuery.join(Hql.innerJoin("annotationTypes", "atp"));178 categoryQuery.restrict(Restrictions.eq(Hql.alias("atp"), Hql.entity(at)));179 for (AnnotationTypeCategory category : categoryQuery.list(dc))180 {181 allCategories.add(category);182 jsonCategories.add(category.getId());183 }184 jsonAt.put("categories", jsonCategories);185 186 187 if (a != null)188 {189 createJSON(jsonA, dc, a, formatter, false);190 191 if (a.getSource() != Annotation.Source.PRIMARY)192 {193 Annotation inherited = a.getInheritedFrom();194 if (inherited != null)195 {196 JSONObject jsonInherited = new JSONObject();197 createJSON(jsonInherited, dc, inherited, formatter, true);198 Annotatable inheritedFrom = inherited.getAnnotationSet().getItem(dc);199 JSONObject jsonFrom = new JSONObject();200 jsonFrom.put("id", inheritedFrom.getId());201 jsonFrom.put("name", ((Nameable)inheritedFrom).getName());202 jsonFrom.put("type", inheritedFrom.getType().name());203 jsonInherited.put("from", jsonFrom);204 json.put("inherited", jsonInherited);205 }206 }207 208 }209 210 return json;211 }212 213 private void createJSON(JSONObject json, DbControl dc, Annotation a, Formatter formatter, boolean formatAll)214 {215 json.put("id", a.getId());216 Date lastUpdate = a.getLastUpdate();217 if (lastUpdate != null) json.put("lastUpdate", lastUpdate.getTime());218 219 Unit currentUnit = a.getUnit();220 if (currentUnit != null)221 {222 json.put("unit", currentUnit.getId());223 json.put("unitSymbol", currentUnit.getDisplaySymbol());224 }225 226 // Populate the values array227 List values = a.getValues(null);228 if (values != null)229 {230 JSONArray jsonValues = new JSONArray();231 json.put("values", jsonValues);232 233 for (Object value : values)234 {235 // Dates should be formatted to strings using the current date(time) format236 if (formatAll || value instanceof Date)237 {238 value = formatter.format(value);239 }240 jsonValues.add(value.toString());241 }242 }243 244 }245 246 %>247 78 <% 248 79 final SessionControl sc = Base.getExistingSessionControl(pageContext, true); … … 256 87 int annotationTypeId = Values.getInt(request.getParameter("annotationtype_id")); 257 88 final boolean standalone = Values.getBoolean(request.getParameter("standalone")); 89 90 // Parent items may have been submitted by caller 91 // Each parameter is ITEMTYPE:ID:ID:... 92 String[] parents = request.getParameterValues("parents"); 258 93 259 94 final DbControl dc = sc.newDbControl(); … … 406 241 Annotation a = primary.get(at); 407 242 if (at.isRemoved() && a == null) continue; 408 JSONObject json = makeJSON(dc, at, a, protocolParameters.contains(at), allCategories);243 JSONObject json = AnnotationUtil.createJsonForAnnotationTypeAndAnnotation(dc, at, a, null, protocolParameters.contains(at), allCategories); 409 244 jsonAnnotations.add(json); 410 245 } … … 412 247 { 413 248 AnnotationType at = a.getAnnotationType(); 414 JSONObject json = makeJSON(dc, at, a, false, allCategories);249 JSONObject json = AnnotationUtil.createJsonForAnnotationTypeAndAnnotation(dc, at, a, null, false, allCategories); 415 250 jsonAnnotations.add(json); 251 } 252 253 // Build JSON for parents submitted via request parameter 254 JSONArray jsonParents = new JSONArray(); 255 if (parents != null) 256 { 257 for (String p : parents) jsonParents.add(p); 258 } 259 boolean canInherit = jsonParents.size() > 0; 260 if (!canInherit && item != null) 261 { 262 Set<Annotatable> parentItems = item.getAnnotatableParents(); 263 canInherit = parentItems != null && parentItems.size() > 0; 416 264 } 417 265 %> … … 630 478 %> 631 479 <div id="page-data" class="datacontainer" 480 data-item-type="<%=itemType.name() %>" 481 data-item-id="<%=itemId %>" 632 482 data-annotations="<%=HTML.encodeTags(jsonAnnotations.toJSONString()) %>" 483 data-parents="<%=HTML.encodeTags(jsonParents.toJSONString()) %>" 633 484 data-annotation-type-id="<%=annotationTypeId%>" 634 485 data-annotation-id="<%=annotationId %>" … … 687 538 <div id="annotation-list" class="absolutefull parameterlist topborder" 688 539 style="top: 2em; bottom: 3em;"> 689 <tbl:toolbar subclass="bottomborder" >540 <tbl:toolbar subclass="bottomborder" visible="<%=canInherit || annotationTypes.size()>0 || inherited.size()>0 %>"> 690 541 <tbl:button id="btnAdd" title="Inherit…" image="add.png" 691 542 tooltip="Inherit more annotations..." 543 disabled="<%=!canInherit%>" 692 544 /> 693 545 <tbl:button id="btnDelete" title="Delete" image="remove.png" … … 702 554 /> 703 555 </tbl:toolbar> 704 <div id="primary-list">705 <div class="first-primary">706 <base:icon id="check-all-primary" image="check_uncheck.png" subclass="check-all"707 tooltip="Toggle all (use CTRL, ALT or SHIFT to check/uncheck)"708 />709 </div>710 556 <% 711 557 if (annotationTypes.size() == 0 && inherited.size() == 0) … … 718 564 } 719 565 %> 566 <div id="primary-list"> 567 <div class="first-primary"> 568 <base:icon id="check-all-primary" image="check_uncheck.png" subclass="check-all" 569 tooltip="Toggle all (use CTRL, ALT or SHIFT to check/uncheck)" 570 /> 571 </div> 720 572 </div> 721 573 <div id="inherited-list"> -
trunk/www/common/annotations/batch_inherit.js
r6926 r6947 79 79 inherit.annotationTypeInfoLoaded = function(request) 80 80 { 81 App.debug(request.responseText);82 81 var response = JSON.parse(request.responseText); 83 82 if (response.status != 'ok') -
trunk/www/common/annotations/inherit.js
r6912 r6947 32 32 // Buttons (on standalone dialog) 33 33 Buttons.addClickHandler('close', App.closeWindow); 34 Buttons.addClickHandler('btn Save', inherit.save);34 Buttons.addClickHandler('btnOk', inherit.save); 35 35 36 36 Events.addEventHandler('quickFilter', 'keyup', inherit.quickFilter); … … 80 80 } 81 81 82 inherit.saveInheritedAnnotations ToForm = function(frm)82 inherit.saveInheritedAnnotations = function() 83 83 { 84 84 var tree = Doc.element('joust'); 85 var target = window.top.opener.document.getElementById(Data.get('page-data', 'callback')); 85 86 86 var addedAnnotations = []; 87 var removedAnnotations = []; 88 89 var aFrm = document.forms['annotations']; 87 var frm = document.forms['annotations']; 90 88 var menuElements = tree.getElementsByClassName('joustitem'); 91 89 for (var menuNo = 0; menuNo < menuElements.length; menuNo++) … … 95 93 96 94 var wasInherited = menuItem.inherited; 97 var isInherited = aFrm[menuItem.id].checked;95 var isInherited = frm[menuItem.id].checked; 98 96 if (wasInherited != isInherited) 99 97 { 100 98 if (menuItem.type == 'annotation') 101 99 { 100 var detail = {}; 101 detail.id = menuItem.externalId; 102 102 if (isInherited) 103 103 { 104 addedAnnotations[addedAnnotations.length] = menuItem.externalId;104 Events.sendCustomEvent(target, 'inherit-annotation', detail); 105 105 } 106 106 else 107 107 { 108 removedAnnotations[removedAnnotations.length] = menuItem.externalId;108 Events.sendCustomEvent(target, 'remove-annotation', detail); 109 109 } 110 110 } 111 111 } 112 }113 if (frm.addedAnnotations)114 {115 frm.addedAnnotations.value = addedAnnotations.join(',');116 }117 else118 {119 Forms.addHidden(frm, 'addedAnnotations', addedAnnotations.join(','));120 }121 if (frm.removedAnnotations)122 {123 frm.removedAnnotations.value = removedAnnotations.join(',');124 }125 else126 {127 Forms.addHidden(frm, 'removedAnnotations', removedAnnotations.join(','));128 112 } 129 113 } … … 158 142 inherit.save = function() 159 143 { 160 var frm = document.forms['modified']; 161 inherit.saveInheritedAnnotationsToForm(frm); 162 frm.submit(); 144 inherit.saveInheritedAnnotations(); 145 App.closeWindow(); 163 146 } 164 147 -
trunk/www/common/annotations/inherit.jsp
r6937 r6947 124 124 HTML.encodeTags(((Nameable)item).getName()) + " <span class=\"itemsubtype\">(" + itemType + ")</span>"; 125 125 126 ItemQuery<Annotation> query = as.getAnnotations( );126 ItemQuery<Annotation> query = as.getAnnotations(Annotation.Source.PRIMARY); 127 127 query.restrict(Restrictions.eq(Hql.property("annotationType.disableInheritance"), Expressions.bool(false))); 128 128 List<Annotation> annotations = query.list(as.getDbControl()); 129 129 if (annotations.size() == 0) continue; // With the next AnnotationSet/item 130 130 131 JSONObject jsonJoust = newJoustEntry(null, icon, input+name, joustId); 132 jsonJoust.put("isOpen", 1); 133 jsonJoust.put("type", "annotation-set"); 134 jsonJoust.put("externalId", as.getId()); 135 json.add(jsonJoust); 131 JSONObject jsonJoust = null; 136 132 137 133 SessionControl sc = as.getSessionControl(); … … 140 136 Formatter formatter = FormatterFactory.getAnnotationFormatter(sc, a, null); 141 137 boolean inherited = inheritedAnnotations != null && inheritedAnnotations.contains(a); 138 if (inherited) continue; 139 140 if (jsonJoust == null) 141 { 142 jsonJoust = newJoustEntry(null, icon, input+name, joustId); 143 jsonJoust.put("isOpen", 1); 144 jsonJoust.put("type", "annotation-set"); 145 jsonJoust.put("externalId", as.getId()); 146 json.add(jsonJoust); 147 } 148 142 149 AnnotationType at = a.getAnnotationType(); 143 150 String annotationName = at.getName(); … … 190 197 final Item itemType = Item.valueOf(request.getParameter("item_type")); 191 198 final int itemId = Values.getInt(request.getParameter("item_id")); 192 final boolean standalone = Values.getBoolean(request.getParameter("standalone")); 199 200 //final boolean standalone = Values.getBoolean(request.getParameter("standalone")); 193 201 194 202 final DbControl dc = sc.newDbControl(); … … 206 214 loadParents(dc, parentAnnotations, parentItems, item); 207 215 } 208 if (standalone) 209 { 210 sc.getCurrentContext(itemType).setObject("item", item); 211 } 216 212 217 String title = "Inherit annotations to " + 213 218 HTML.encodeTags((item instanceof Nameable ? ((Nameable)item).getName() : … … 256 261 )); 257 262 263 // Ignore annotations marked for DELETE (so it is possible to re-select them) 264 String d = request.getParameter("deleted"); 265 if (d != null) 266 { 267 Integer[] deleted = Values.getInt(d.split(",")); 268 if (deleted.length > 0) 269 { 270 inheritedQuery.restrict(Restrictions.not(Restrictions.in(Hql.property("id"), Expressions.parameter("deleted")))); 271 inheritedQuery.setParameter("deleted", java.util.Arrays.asList(deleted), Type.INT); 272 } 273 } 274 258 275 inheritedQuery.order(Orders.asc(Hql.property("annotationSet"))); 259 276 inheritedQuery.order(Orders.asc(Hql.property("annotationType.name"))); … … 286 303 </base:head> 287 304 <base:body> 288 <% 289 if (standalone) 290 { 291 %> 292 <h1><%=title%> <base:help helpid="annotations.inherit" /></h1> 293 <div class="content bottomborder"> 294 <% 295 } 296 %> 305 306 <h1><%=title%> <base:help helpid="annotations.inherit" /></h1> 307 <div class="content bottomborder"> 308 309 <div id="page-data" class="datacontainer" 310 data-callback="<%=HTML.encodeTags(request.getParameter("callback"))%>" 311 ></div> 312 297 313 <form name="annotations"> 298 314 <div class="absolutefull"> … … 352 368 </div> 353 369 </form> 354 355 <% 356 if (standalone) 357 { 358 %> 359 </div> 360 <base:buttongroup subclass="dialogbuttons"> 361 <base:button id="btnSave" title="Save" /> 362 <base:button id="close" title="Cancel" /> 363 </base:buttongroup> 364 <form name="modified" method="post" action="index.jsp?ID=<%=ID%>"> 365 <input type="hidden" name="cmd" value="SaveAnnotations"> 366 <input type="hidden" name="item_type" value="<%=itemType.name()%>"> 367 <input type="hidden" name="item_id" value="<%=itemId%>"> 368 </form> 369 <% 370 } 371 %> 370 </div> 371 372 <base:buttongroup subclass="dialogbuttons"> 373 <base:button id="btnOk" title="Ok" /> 374 <base:button id="close" title="Cancel" /> 375 </base:buttongroup> 376 372 377 </base:body> 373 378 </base:page> -
trunk/www/include/scripts/annotations.js
r6944 r6947 54 54 was called. DO NOT USE AS AN EVENT HANDLER. 55 55 */ 56 annotations.autoLoadEditFrame = function(protocolId, subtypeId )56 annotations.autoLoadEditFrame = function(protocolId, subtypeId, parents) 57 57 { 58 if (editFrameLoaded && lastProtocolId == protocolId) return; 59 lastProtocolId = protocolId; 58 if (editFrameLoaded) 59 { 60 if (parents) 61 { 62 frames['annotations'].Annotate.setParents(parents); 63 } 64 return; 65 } 60 66 editFrameLoaded = true; 61 67 … … 65 71 if (protocolId) url += '&protocol_id='+protocolId; 66 72 if (subtypeId) url += '&subtype_id='+subtypeId; 73 if (parents && parents.length) 74 { 75 for (var i = 0; i < parents.length; i++) 76 { 77 url += '&parents='+parents[i]; 78 } 79 } 80 67 81 frames['annotations'].location.replace(url); 68 82 } … … 79 93 } 80 94 81 /**82 Automatically load or reload the 'Inherit annotations' frame. The83 frame is loaded if it has not previously been loaded, or if84 the parents parameter has changed since last time this method85 was called.86 */87 annotations.autoLoadInheritFrame = function(parents)88 {89 if (inheritFrameLoaded)90 {91 if (internal.equalArrays(parents, lastParents)) return;92 }93 lastParents = parents;94 inheritFrameLoaded = true;95 96 var url = App.getRoot()+'common/annotations/inherit.jsp?ID='+App.getSessionId();97 url += '&item_type='+Data.get('annotate-data', 'item-type');98 url += '&item_id='+Data.get('annotate-data', 'item-id');99 if (parents && parents.length)100 {101 for (var i = 0; i < parents.length; i++)102 {103 url += '&parents='+parents[i];104 }105 }106 frames['inheritedAnnotations'].location.replace(url);107 }108 109 /**110 Save all changes to inherited annotations to the given form. If111 the 'Inherit annotations' frame hasn't been loaded, this112 call is ignored.113 */114 annotations.saveInheritedAnnotationsToForm = function(frm)115 {116 if (!inheritFrameLoaded) return;117 frames['inheritedAnnotations'].Inherit.saveInheritedAnnotationsToForm(frm);118 }119 95 120 96 // Check if two arrays have the same elements -
trunk/www/lims/arraybatches/batches.js
r6695 r6947 41 41 // Tab validation 42 42 TabControl.addTabActivateListener('settings.annotations', arrayBatches.loadAnnotationsFrame); 43 TabControl.addTabActivateListener('settings.inheritedAnnotations', arrayBatches.loadInheritedAnnotationsFrame);44 43 TabControl.addTabValidator('settings.info', arrayBatches.validateArrayBatch); 45 44 … … 148 147 { 149 148 Annotations.saveModifiedAnnotationsToForm(frm); 150 Annotations.saveInheritedAnnotationsToForm(frm);151 149 frm.submit(); 152 150 } … … 155 153 arrayBatches.loadAnnotationsFrame = function() 156 154 { 157 Annotations.autoLoadEditFrame(arrayBatches.getProtocolId()); 158 } 159 160 arrayBatches.loadInheritedAnnotationsFrame = function() 161 { 162 Annotations.autoLoadInheritFrame(arrayBatches.getParents()); 155 Annotations.autoLoadEditFrame(arrayBatches.getProtocolId(), null, arrayBatches.getParents()); 163 156 } 164 157 -
trunk/www/lims/arraybatches/edit_batch.jsp
r6312 r6947 280 280 </jsp:include> 281 281 </t:tab> 282 283 <t:tab id="inheritedAnnotations" title="Inherited annotations"284 helpid="annotations.edit.inherited">285 <jsp:include page="../../common/annotations/inherit_frameset.jsp">286 <jsp:param name="item_type" value="<%=itemType.name()%>" />287 <jsp:param name="item_id" value="<%=itemId%>" />288 <jsp:param name="ID" value="<%=ID%>" />289 </jsp:include>290 </t:tab>291 282 </t:tabcontrol> 292 283 </form> -
trunk/www/lims/arraydesigns/designs.js
r6944 r6947 41 41 // Tab validation 42 42 TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab); 43 TabControl.addTabActivateListener('settings.inheritedAnnotations', Annotations.autoLoadInheritFrame);44 43 TabControl.addTabActivateListener('settings.datafiles', arrayDesigns.loadDataFilesFrame); 45 44 TabControl.addTabValidator('settings.info', arrayDesigns.validateArrayDesign); … … 148 147 { 149 148 Annotations.saveModifiedAnnotationsToForm(frm); 150 Annotations.saveInheritedAnnotationsToForm(frm);151 149 DataFiles.writeFileActionsToForm(frm); 152 150 frm.submit(); -
trunk/www/lims/arraydesigns/edit_design.jsp
r6312 r6947 284 284 </jsp:include> 285 285 </t:tab> 286 287 <t:tab id="inheritedAnnotations" title="Inherited annotations"288 helpid="annotations.edit.inherited">289 <jsp:include page="../../common/annotations/inherit_frameset.jsp">290 <jsp:param name="item_type" value="<%=itemType.name()%>" />291 <jsp:param name="item_id" value="<%=itemId%>" />292 <jsp:param name="ID" value="<%=ID%>" />293 </jsp:include>294 </t:tab>295 286 </t:tabcontrol> 296 287 </form> -
trunk/www/lims/arrayslides/edit_slide.jsp
r6312 r6947 206 206 </jsp:include> 207 207 </t:tab> 208 209 <t:tab id="inheritedAnnotations" title="Inherited annotations"210 helpid="annotations.edit.inherited">211 <jsp:include page="../../common/annotations/inherit_frameset.jsp">212 <jsp:param name="item_type" value="<%=itemType.name()%>" />213 <jsp:param name="item_id" value="<%=itemId%>" />214 <jsp:param name="ID" value="<%=ID%>" />215 </jsp:include>216 </t:tab>217 208 </t:tabcontrol> 218 209 </form> -
trunk/www/lims/arrayslides/slides.js
r6944 r6947 40 40 41 41 // Tab validation 42 TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab); 43 TabControl.addTabActivateListener('settings.inheritedAnnotations', arraySlides.loadInheritedAnnotationsFrame); 42 TabControl.addTabActivateListener('settings.annotations', arraySlides.loadAnnotationsFrame); 44 43 TabControl.addTabValidator('settings.info', arraySlides.validateArraySlide); 45 44 … … 120 119 { 121 120 Annotations.saveModifiedAnnotationsToForm(frm); 122 Annotations.saveInheritedAnnotationsToForm(frm);123 121 frm.submit(); 124 122 } 125 123 } 126 124 127 arraySlides.load InheritedAnnotationsFrame = function()125 arraySlides.loadAnnotationsFrame = function() 128 126 { 129 Annotations.autoLoad InheritFrame(arraySlides.getParents());127 Annotations.autoLoadEditFrame(null, null, arraySlides.getParents()); 130 128 } 131 129 -
trunk/www/lims/plates/edit_plate.jsp
r6312 r6947 211 211 </jsp:include> 212 212 </t:tab> 213 214 <t:tab id="inheritedAnnotations" title="Inherited annotations"215 helpid="annotations.edit.inherited">216 <jsp:include page="../../common/annotations/inherit_frameset.jsp">217 <jsp:param name="item_type" value="<%=itemType.name()%>" />218 <jsp:param name="item_id" value="<%=itemId%>" />219 <jsp:param name="ID" value="<%=ID%>" />220 </jsp:include>221 </t:tab>222 213 </t:tabcontrol> 223 214 </form> -
trunk/www/lims/plates/plates.js
r6944 r6947 41 41 // Tab validation 42 42 TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab); 43 TabControl.addTabActivateListener('settings.inheritedAnnotations', Annotations.autoLoadInheritFrame);44 43 TabControl.addTabValidator('settings.info', plates.validatePlate); 45 44 … … 131 130 { 132 131 Annotations.saveModifiedAnnotationsToForm(frm); 133 Annotations.saveInheritedAnnotationsToForm(frm);134 132 frm.submit(); 135 133 } -
trunk/www/lims/plates/wells/edit_well.jsp
r6312 r6947 119 119 </jsp:include> 120 120 </t:tab> 121 122 <t:tab id="inheritedAnnotations" title="Inherited annotations"123 helpid="annotations.edit.inherited">124 <jsp:include page="../../../common/annotations/inherit_frameset.jsp">125 <jsp:param name="item_type" value="<%=itemType.name()%>" />126 <jsp:param name="item_id" value="<%=itemId%>" />127 <jsp:param name="ID" value="<%=ID%>" />128 </jsp:include>129 </t:tab>130 121 </t:tabcontrol> 131 122 </form> -
trunk/www/lims/plates/wells/wells.js
r6944 r6947 41 41 // Tab validation 42 42 TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab); 43 TabControl.addTabActivateListener('settings.inheritedAnnotations', Annotations.autoLoadInheritFrame);44 43 TabControl.addTabValidator('settings.info', wells.validateWell); 45 44 } … … 112 111 { 113 112 Annotations.saveModifiedAnnotationsToForm(frm); 114 Annotations.saveInheritedAnnotationsToForm(frm);115 113 frm.submit(); 116 114 } -
trunk/www/views/derivedbioassays/bioassays.js
r6813 r6947 41 41 // Tab validation 42 42 TabControl.addTabActivateListener('settings.annotations', bioassays.loadAnnotationsFrame); 43 TabControl.addTabActivateListener('settings.inheritedAnnotations', bioassays.loadInheritedAnnotationsFrame);44 43 TabControl.addTabActivateListener('settings.datafiles', bioassays.loadDataFilesFrame); 45 44 TabControl.addTabValidator('settings.info', bioassays.validateBioAssay); … … 182 181 { 183 182 Annotations.saveModifiedAnnotationsToForm(frm); 184 Annotations.saveInheritedAnnotationsToForm(frm);185 183 DataFiles.writeFileActionsToForm(frm); 186 184 if (Doc.element('physicalBioAssays')) … … 198 196 bioassays.loadAnnotationsFrame = function() 199 197 { 200 Annotations.autoLoadEditFrame(bioassays.getProtocolId(), ItemSubtype.getSubtypeId('subtype_id')); 201 } 202 203 bioassays.loadInheritedAnnotationsFrame = function() 204 { 205 Annotations.autoLoadInheritFrame(bioassays.getParents()); 198 Annotations.autoLoadEditFrame(bioassays.getProtocolId(), ItemSubtype.getSubtypeId('subtype_id'), bioassays.getParents()); 206 199 } 207 200 -
trunk/www/views/derivedbioassays/edit_bioassay.jsp
r6314 r6947 538 538 </jsp:include> 539 539 </t:tab> 540 541 <t:tab id="inheritedAnnotations" title="Inherited annotations"542 helpid="annotations.edit.inherited">543 <jsp:include page="../../common/annotations/inherit_frameset.jsp">544 <jsp:param name="item_type" value="<%=itemType.name()%>" />545 <jsp:param name="item_id" value="<%=itemId%>" />546 <jsp:param name="ID" value="<%=ID%>" />547 </jsp:include>548 </t:tab>549 540 </t:tabcontrol> 550 541 </form> -
trunk/www/views/experiments/bioassays/bioassays.js
r6944 r6947 41 41 // Tab validation 42 42 TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab); 43 TabControl.addTabActivateListener('settings.inheritedAnnotations', Annotations.autoLoadInheritFrame);44 43 TabControl.addTabValidator('settings.info', bioassays.validateBioAssay); 45 44 } … … 158 157 { 159 158 Annotations.saveModifiedAnnotationsToForm(frm); 160 Annotations.saveInheritedAnnotationsToForm(frm);161 159 frm.submit(); 162 160 } -
trunk/www/views/experiments/bioassays/edit_bioassay.jsp
r6315 r6947 109 109 </jsp:include> 110 110 </t:tab> 111 112 <t:tab id="inheritedAnnotations" title="Inherited annotations"113 helpid="annotations.edit.inherited">114 <jsp:include page="../../../common/annotations/inherit_frameset.jsp">115 <jsp:param name="item_type" value="<%=itemType.name()%>" />116 <jsp:param name="item_id" value="<%=itemId%>" />117 <jsp:param name="ID" value="<%=ID%>" />118 </jsp:include>119 </t:tab>120 111 </t:tabcontrol> 121 112 </form> -
trunk/www/views/experiments/bioassaysets/bioassaysets.js
r6944 r6947 43 43 // Tab validation 44 44 TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab); 45 TabControl.addTabActivateListener('settings.inheritedAnnotations', Annotations.autoLoadInheritFrame);46 45 TabControl.addTabValidator('settings.info', bioassaysets.validateBioAssaySet); 47 46 } … … 129 128 { 130 129 Annotations.saveModifiedAnnotationsToForm(frm); 131 Annotations.saveInheritedAnnotationsToForm(frm);132 130 frm.submit(); 133 131 } -
trunk/www/views/experiments/bioassaysets/edit_bioassayset.jsp
r6315 r6947 135 135 </jsp:include> 136 136 </t:tab> 137 138 <t:tab id="inheritedAnnotations" title="Inherited annotations"139 helpid="annotations.edit.inherited">140 <jsp:include page="../../../common/annotations/inherit_frameset.jsp">141 <jsp:param name="item_type" value="<%=itemType.name()%>" />142 <jsp:param name="item_id" value="<%=itemId%>" />143 <jsp:param name="ID" value="<%=ID%>" />144 </jsp:include>145 </t:tab>146 137 </t:tabcontrol> 147 138 </form> -
trunk/www/views/experiments/rootrawbioassays/bioassays.js
r6944 r6947 41 41 // Tab validation 42 42 TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab); 43 TabControl.addTabActivateListener('settings.inheritedAnnotations', Annotations.autoLoadInheritFrame);44 43 TabControl.addTabValidator('settings.info', bioassays.validateBioAssay); 45 44 } … … 95 94 { 96 95 Annotations.saveModifiedAnnotationsToForm(frm); 97 Annotations.saveInheritedAnnotationsToForm(frm);98 96 frm.submit(); 99 97 } -
trunk/www/views/experiments/rootrawbioassays/edit_bioassay.jsp
r6916 r6947 109 109 </jsp:include> 110 110 </t:tab> 111 112 <t:tab id="inheritedAnnotations" title="Inherited annotations"113 helpid="annotations.edit.inherited">114 <jsp:include page="../../../common/annotations/inherit_frameset.jsp">115 <jsp:param name="item_type" value="<%=itemType.name()%>" />116 <jsp:param name="item_id" value="<%=itemId%>" />117 <jsp:param name="ID" value="<%=ID%>" />118 </jsp:include>119 </t:tab>120 111 </t:tabcontrol> 121 112 </form> -
trunk/www/views/physicalbioassays/bioassays.js
r6813 r6947 41 41 // Tab validation 42 42 TabControl.addTabActivateListener('settings.annotations', bioassays.loadAnnotationsFrame); 43 TabControl.addTabActivateListener('settings.inheritedAnnotations', bioassays.loadInheritedAnnotationsFrame);44 43 TabControl.addTabValidator('settings.info', bioassays.validatePhysicalBioAssay); 45 44 … … 174 173 { 175 174 Annotations.saveModifiedAnnotationsToForm(frm); 176 Annotations.saveInheritedAnnotationsToForm(frm);177 175 Link.exportActions('extracts'); 178 176 frm.submit(); … … 182 180 bioassays.loadAnnotationsFrame = function() 183 181 { 184 Annotations.autoLoadEditFrame(bioassays.getProtocolId(), ItemSubtype.getSubtypeId('subtype_id')); 185 } 186 187 bioassays.loadInheritedAnnotationsFrame = function() 188 { 189 Annotations.autoLoadInheritFrame(bioassays.getParents()); 182 Annotations.autoLoadEditFrame(bioassays.getProtocolId(), ItemSubtype.getSubtypeId('subtype_id'), bioassays.getParents()); 190 183 } 191 184 -
trunk/www/views/physicalbioassays/edit_bioassay.jsp
r6372 r6947 494 494 </jsp:include> 495 495 </t:tab> 496 497 <t:tab id="inheritedAnnotations" title="Inherited annotations"498 helpid="annotations.edit.inherited">499 <jsp:include page="../../common/annotations/inherit_frameset.jsp">500 <jsp:param name="item_type" value="<%=itemType.name()%>" />501 <jsp:param name="item_id" value="<%=itemId%>" />502 <jsp:param name="ID" value="<%=ID%>" />503 </jsp:include>504 </t:tab>505 496 </t:tabcontrol> 506 497 </form> -
trunk/www/views/rawbioassays/bioassays.js
r6813 r6947 41 41 // Tab validation 42 42 TabControl.addTabActivateListener('settings.annotations', bioassays.loadAnnotationsFrame); 43 TabControl.addTabActivateListener('settings.inheritedAnnotations', bioassays.loadInheritedAnnotationsFrame);44 43 TabControl.addTabActivateListener('settings.datafiles', bioassays.loadDataFilesFrame); 45 44 TabControl.addTabValidator('settings.info', bioassays.validateRawBioAssay); … … 164 163 { 165 164 Annotations.saveModifiedAnnotationsToForm(frm); 166 Annotations.saveInheritedAnnotationsToForm(frm);167 165 DataFiles.writeFileActionsToForm(frm); 168 166 frm.submit(); … … 181 179 bioassays.loadAnnotationsFrame = function() 182 180 { 183 Annotations.autoLoadEditFrame(bioassays.getProtocolId()); 184 } 185 186 bioassays.loadInheritedAnnotationsFrame = function() 187 { 188 Annotations.autoLoadInheritFrame(bioassays.getParents()); 181 Annotations.autoLoadEditFrame(bioassays.getProtocolId(), null, bioassays.getParents()); 189 182 } 190 183 -
trunk/www/views/rawbioassays/edit_rawbioassay.jsp
r6314 r6947 570 570 </jsp:include> 571 571 </t:tab> 572 573 <t:tab id="inheritedAnnotations" title="Inherited annotations"574 helpid="annotations.edit.inherited">575 <jsp:include page="../../common/annotations/inherit_frameset.jsp">576 <jsp:param name="item_type" value="<%=itemType.name()%>" />577 <jsp:param name="item_id" value="<%=itemId%>" />578 <jsp:param name="ID" value="<%=ID%>" />579 </jsp:include>580 </t:tab>581 572 </t:tabcontrol> 582 573 </form>
Note: See TracChangeset
for help on using the changeset viewer.