Changeset 6947


Ignore:
Timestamp:
Sep 8, 2015, 2:30:31 PM (6 years ago)
Author:
Nicklas Nordborg
Message:

References #1941: Store experimental factor values as part experiments

Implemented support for inheriting new annotations via the "Inherit" button. The 'Inherited annotations' tab has been removed from all dialogs.

Location:
trunk
Files:
1 deleted
35 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/AnnotationUtil.java

    r6729 r6947  
    2222package net.sf.basedb.clients.web;
    2323
     24import java.util.ArrayList;
     25import java.util.Date;
    2426import java.util.HashSet;
     27import java.util.List;
    2528import java.util.Set;
    2629
     30import net.sf.basedb.clients.web.formatter.FormatterFactory;
     31import net.sf.basedb.clients.web.util.HTML;
     32import net.sf.basedb.core.Annotatable;
     33import net.sf.basedb.core.Annotation;
    2734import net.sf.basedb.core.AnnotationType;
    2835import net.sf.basedb.core.AnnotationTypeCategory;
     
    3340import net.sf.basedb.core.ItemQuery;
    3441import net.sf.basedb.core.ItemSubtype;
     42import net.sf.basedb.core.Nameable;
    3543import net.sf.basedb.core.Type;
     44import net.sf.basedb.core.Unit;
    3645import net.sf.basedb.core.query.Expressions;
    3746import net.sf.basedb.core.query.Hql;
    3847import net.sf.basedb.core.query.Orders;
    3948import net.sf.basedb.core.query.Restrictions;
     49import net.sf.basedb.util.formatter.Formatter;
    4050
    4151import org.json.simple.JSONArray;
     
    148158  }
    149159 
     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
    150332}
  • trunk/src/clients/web/net/sf/basedb/clients/web/Base.java

    r6945 r6947  
    14441444        JSONObject jsonA = (JSONObject)jsonModified.get(entryNo);
    14451445        Number annotationId = (Number)jsonA.get("annotationId");
     1446        Number inheritedId = (Number)jsonA.get("inheritedId");
    14461447        Number annotationTypeId = (Number)jsonA.get("annotationTypeId");
    14471448        JSONArray jsonValues = (JSONArray)jsonA.get("values");
     
    14791480            if ("CONVERTED".equals(modifyType)) continue; // Only converted between types
    14801481          }
    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          }
    14821490        }
    14831491        else if (jsonValues != null && jsonValues.size() > 0)
    14841492        {
    1485           a = newAs.getAnnotation(at);
     1493          if (!"DELETE".equals(modifyType))
     1494          {
     1495            a = newAs.getAnnotation(at);
     1496          }
    14861497        }
    14871498       
    14881499        if (a == null) continue;
    14891500       
    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)
    14941502        {
    1495           newAs.removeAnnotation(at);
    1496         }
    1497         else
    1498         {
     1503          Type valueType = at.getValueType();
     1504          Number unitId = (Number)jsonA.get("unitId");
     1505          Unit unit = unitId == null ? null : Unit.getById(dc, unitId.intValue());
     1506         
    14991507          Object[] oValues = new Object[jsonValues.size()];
    15001508          Formatter<?> formatter = FormatterFactory.getTypeFormatter(dc.getSessionControl(), valueType);
     
    15051513          a.setValues(Arrays.asList(oValues), unit);
    15061514        }
    1507        
    1508        
    15091515      }
    15101516     
  • trunk/www/biomaterials/extracts/edit_extract.jsp

    r6605 r6947  
    603603    </t:tab>
    604604   
    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>
    613605    </t:tabcontrol>
    614606    </form>
  • trunk/www/biomaterials/extracts/extracts.js

    r6756 r6947  
    4141      // Tab validation
    4242      TabControl.addTabActivateListener('settings.annotations', extracts.loadAnnotationsFrame);
    43       TabControl.addTabActivateListener('settings.inheritedAnnotations', extracts.loadInheritedAnnotationsFrame);
    4443      TabControl.addTabValidator('settings.info', extracts.validateExtract);
    4544
     
    231230    {
    232231      Annotations.saveModifiedAnnotationsToForm(frm);
    233       Annotations.saveInheritedAnnotationsToForm(frm);
    234232      Link.exportActions('extracts');
    235233      frm.submit();
     
    246244      protocolId = Math.abs(parseInt(frm.protocol_id.value));       
    247245    }
    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  }
    256248 
    257249  extracts.getParents = function()
  • trunk/www/biomaterials/samples/edit_sample.jsp

    r6605 r6947  
    559559    </t:tab>
    560560   
    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>
    569561    </t:tabcontrol>
    570562    </form>
  • trunk/www/biomaterials/samples/samples.js

    r6756 r6947  
    4141      // Tab validation
    4242      TabControl.addTabActivateListener('settings.annotations', samples.loadAnnotationsFrame);
    43       TabControl.addTabActivateListener('settings.inheritedAnnotations', samples.loadInheritedAnnotationsFrame);
    4443      TabControl.addTabValidator('settings.info', samples.validateSample);
    4544
     
    205204    {
    206205      Annotations.saveModifiedAnnotationsToForm(frm);
    207       Annotations.saveInheritedAnnotationsToForm(frm);
    208206      Link.exportActions('samples');
    209207      frm.submit();
     
    294292      protocolId = Math.abs(parseInt(frm.protocol_id.value));       
    295293    }
    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());
    302295  }
    303296 
  • trunk/www/common/annotations/ajax.jsp

    r6696 r6947  
    2525  import="net.sf.basedb.core.DbControl"
    2626  import="net.sf.basedb.core.AnnotationType"
     27  import="net.sf.basedb.core.Annotation"
    2728  import="net.sf.basedb.core.Item"
    2829  import="net.sf.basedb.core.Type"
     
    3435  import="org.json.simple.JSONObject"
    3536  import="org.json.simple.JSONArray"
     37  import="java.util.HashSet"
    3638%>
    3739<%
     
    5355    AnnotationType at = AnnotationType.getById(dc, itemId);
    5456    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);
    5565  }
    5666  else
  • trunk/www/common/annotations/annotate.js

    r6946 r6947  
    3131  var CONVERTED = 'CONVERTED';
    3232  var DELETE = 'DELETE';
     33  var INHERITED = 'INHERITED';
    3334 
    3435  var annotations;
     36  var parents;
    3537  var selectedAnnotation;
    3638  var selectedIndex;
     
    4547    // Parse the current annotation information which contain value type, current values, etc.
    4648    annotations = Data.json('page-data', 'annotations');
     49    parents = Data.json('page-data', 'parents');
     50   
    4751    // Loop through all annotations and build the selection list
    4852    var numPrimary = 0;
    4953    for (var i = 0; i < annotations.length; i++)
    5054    {
    51       annotate.createAnnotationEntryInList(annotations[i], true);
     55      annotate.createAnnotationEntryInList(annotations[i], false);
    5256      if (annotations[i].source == 'PRIMARY') numPrimary++;
    5357    }
     
    107111    // Delete annotations
    108112    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);
    109117   
    110118    // Select the initial annotation
     
    129137    in the list.
    130138  */
    131   annotate.createAnnotationEntryInList = function(entry, firstInherited)
     139  annotate.createAnnotationEntryInList = function(entry, autoSort)
    132140  {
    133141    var ann = entry.annotation;
     
    157165   
    158166    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);
    160184  }
    161185 
     
    176200
    177201      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      }
    180207      else if (categoryId == -1)
    181208      {
     
    871898  annotate.deleteAnnotation = function(entry)
    872899  {
    873     App.debug(entry.id);
    874900    if (entry.source == 'PRIMARY')
    875901    {
     
    885911    }
    886912    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);
    8871020  }
    8881021 
     
    10451178        tmp.source = entry.source;
    10461179        tmp.modified = entry.modified;
    1047         tmp.values = entry.annotation.values;
    1048         tmp.annotationId = entry.annotation.id;
    10491180        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        }
    10511191      }
    10521192    }
  • trunk/www/common/annotations/annotate.jsp

    r6946 r6947  
    6060  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
    6161  import="net.sf.basedb.clients.web.formatter.FormatterSettings"
     62  import="net.sf.basedb.clients.web.AnnotationUtil"
    6263  import="net.sf.basedb.util.Values"
    6364  import="org.json.simple.JSONObject"
     
    7576<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
    7677<%@ 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 info
    81   // 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 values
    85   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 information
    95   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   // Enumeration
    122   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   // Units
    135   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       else
    149       {
    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   // Categories
    174   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 array
    227   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) format
    236       if (formatAll || value instanceof Date)
    237       {
    238         value = formatter.format(value);
    239       }
    240       jsonValues.add(value.toString());
    241     }
    242   }
    243  
    244 }
    245 
    246 %>
    24778<%
    24879final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
     
    25687int annotationTypeId = Values.getInt(request.getParameter("annotationtype_id"));
    25788final boolean standalone = Values.getBoolean(request.getParameter("standalone"));
     89
     90// Parent items may have been submitted by caller
     91// Each parameter is ITEMTYPE:ID:ID:...
     92String[] parents = request.getParameterValues("parents");
    25893
    25994final DbControl dc = sc.newDbControl();
     
    406241    Annotation a = primary.get(at);
    407242    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);
    409244    jsonAnnotations.add(json);
    410245  }
     
    412247  {
    413248    AnnotationType at = a.getAnnotationType();
    414     JSONObject json = makeJSON(dc, at, a, false, allCategories);
     249    JSONObject json = AnnotationUtil.createJsonForAnnotationTypeAndAnnotation(dc, at, a, null, false, allCategories);
    415250    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;
    416264  }
    417265  %>
     
    630478    %>
    631479    <div id="page-data" class="datacontainer"
     480      data-item-type="<%=itemType.name() %>"
     481      data-item-id="<%=itemId %>"
    632482      data-annotations="<%=HTML.encodeTags(jsonAnnotations.toJSONString()) %>"
     483      data-parents="<%=HTML.encodeTags(jsonParents.toJSONString()) %>"
    633484      data-annotation-type-id="<%=annotationTypeId%>"
    634485      data-annotation-id="<%=annotationId %>"
     
    687538        <div id="annotation-list" class="absolutefull parameterlist topborder"
    688539          style="top: 2em; bottom: 3em;">
    689           <tbl:toolbar subclass="bottomborder">
     540          <tbl:toolbar subclass="bottomborder" visible="<%=canInherit || annotationTypes.size()>0 || inherited.size()>0 %>">
    690541            <tbl:button id="btnAdd" title="Inherit&hellip;" image="add.png"
    691542              tooltip="Inherit more annotations..."
     543              disabled="<%=!canInherit%>"
    692544            />
    693545            <tbl:button id="btnDelete" title="Delete" image="remove.png"
     
    702554              />
    703555          </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>
    710556            <%
    711557            if (annotationTypes.size() == 0 && inherited.size() == 0)
     
    718564            }
    719565            %>
     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>
    720572          </div>
    721573          <div id="inherited-list">
  • trunk/www/common/annotations/batch_inherit.js

    r6926 r6947  
    7979  inherit.annotationTypeInfoLoaded = function(request)
    8080  {
    81     App.debug(request.responseText);
    8281    var response = JSON.parse(request.responseText);
    8382    if (response.status != 'ok')
  • trunk/www/common/annotations/inherit.js

    r6912 r6947  
    3232    // Buttons (on standalone dialog)
    3333    Buttons.addClickHandler('close', App.closeWindow);
    34     Buttons.addClickHandler('btnSave', inherit.save);
     34    Buttons.addClickHandler('btnOk', inherit.save);
    3535   
    3636    Events.addEventHandler('quickFilter', 'keyup', inherit.quickFilter);
     
    8080  }
    8181 
    82   inherit.saveInheritedAnnotationsToForm = function(frm)
     82  inherit.saveInheritedAnnotations = function()
    8383  {
    8484    var tree = Doc.element('joust');
     85    var target = window.top.opener.document.getElementById(Data.get('page-data', 'callback'));
    8586   
    86     var addedAnnotations = [];
    87     var removedAnnotations = [];
    88    
    89     var aFrm = document.forms['annotations'];
     87    var frm = document.forms['annotations'];
    9088    var menuElements = tree.getElementsByClassName('joustitem');
    9189    for (var menuNo = 0; menuNo < menuElements.length; menuNo++)
     
    9593     
    9694      var wasInherited = menuItem.inherited;
    97       var isInherited = aFrm[menuItem.id].checked;
     95      var isInherited = frm[menuItem.id].checked;
    9896      if (wasInherited != isInherited)
    9997      {
    10098        if (menuItem.type == 'annotation')
    10199        {
     100          var detail = {};
     101          detail.id = menuItem.externalId;
    102102          if (isInherited)
    103103          {
    104             addedAnnotations[addedAnnotations.length] = menuItem.externalId;
     104            Events.sendCustomEvent(target, 'inherit-annotation', detail);
    105105          }
    106106          else
    107107          {
    108             removedAnnotations[removedAnnotations.length] = menuItem.externalId;
     108            Events.sendCustomEvent(target, 'remove-annotation', detail); 
    109109          }
    110110        }
    111111      }
    112     }
    113     if (frm.addedAnnotations)
    114     {
    115       frm.addedAnnotations.value = addedAnnotations.join(',');
    116     }
    117     else
    118     {
    119       Forms.addHidden(frm, 'addedAnnotations', addedAnnotations.join(','));
    120     }
    121     if (frm.removedAnnotations)
    122     {
    123       frm.removedAnnotations.value = removedAnnotations.join(',');
    124     }
    125     else
    126     {
    127       Forms.addHidden(frm, 'removedAnnotations', removedAnnotations.join(','));
    128112    }
    129113  }
     
    158142  inherit.save = function()
    159143  {
    160     var frm = document.forms['modified'];
    161     inherit.saveInheritedAnnotationsToForm(frm);
    162     frm.submit();
     144    inherit.saveInheritedAnnotations();
     145    App.closeWindow();
    163146  }
    164147
  • trunk/www/common/annotations/inherit.jsp

    r6937 r6947  
    124124      HTML.encodeTags(((Nameable)item).getName()) + " <span class=\"itemsubtype\">(" + itemType + ")</span>";
    125125   
    126     ItemQuery<Annotation> query = as.getAnnotations();
     126    ItemQuery<Annotation> query = as.getAnnotations(Annotation.Source.PRIMARY);
    127127    query.restrict(Restrictions.eq(Hql.property("annotationType.disableInheritance"), Expressions.bool(false)));
    128128    List<Annotation> annotations = query.list(as.getDbControl());
    129129    if (annotations.size() == 0) continue; // With the next AnnotationSet/item
    130130     
    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;
    136132
    137133    SessionControl sc = as.getSessionControl();
     
    140136      Formatter formatter = FormatterFactory.getAnnotationFormatter(sc, a, null);
    141137      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     
    142149      AnnotationType at = a.getAnnotationType();
    143150      String annotationName = at.getName();
     
    190197final Item itemType = Item.valueOf(request.getParameter("item_type"));
    191198final 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"));
    193201
    194202final DbControl dc = sc.newDbControl();
     
    206214    loadParents(dc, parentAnnotations, parentItems, item);
    207215  }
    208   if (standalone)
    209   {
    210     sc.getCurrentContext(itemType).setObject("item", item);
    211   }
     216
    212217  String title = "Inherit annotations to " +
    213218    HTML.encodeTags((item instanceof Nameable ? ((Nameable)item).getName() :
     
    256261      ));
    257262   
     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       
    258275    inheritedQuery.order(Orders.asc(Hql.property("annotationSet")));
    259276    inheritedQuery.order(Orders.asc(Hql.property("annotationType.name")));
     
    286303  </base:head>
    287304  <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 
    297313  <form name="annotations">
    298314  <div class="absolutefull">
     
    352368  </div>
    353369  </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 
    372377  </base:body>
    373378  </base:page>
  • trunk/www/include/scripts/annotations.js

    r6944 r6947  
    5454    was called. DO NOT USE AS AN EVENT HANDLER.
    5555  */
    56   annotations.autoLoadEditFrame = function(protocolId, subtypeId)
     56  annotations.autoLoadEditFrame = function(protocolId, subtypeId, parents)
    5757  {
    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    }
    6066    editFrameLoaded = true;
    6167   
     
    6571    if (protocolId) url += '&protocol_id='+protocolId;
    6672    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
    6781    frames['annotations'].location.replace(url);
    6882  }
     
    7993  }
    8094 
    81   /**
    82     Automatically load or reload the 'Inherit annotations' frame. The
    83     frame is loaded if it has not previously been loaded, or if
    84     the parents parameter has changed since last time this method
    85     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. If
    111     the 'Inherit annotations' frame hasn't been loaded, this
    112     call is ignored.
    113   */
    114   annotations.saveInheritedAnnotationsToForm = function(frm)
    115   {
    116     if (!inheritFrameLoaded) return;
    117     frames['inheritedAnnotations'].Inherit.saveInheritedAnnotationsToForm(frm);
    118   }
    11995 
    12096  // Check if two arrays have the same elements
  • trunk/www/lims/arraybatches/batches.js

    r6695 r6947  
    4141      // Tab validation
    4242      TabControl.addTabActivateListener('settings.annotations', arrayBatches.loadAnnotationsFrame);
    43       TabControl.addTabActivateListener('settings.inheritedAnnotations', arrayBatches.loadInheritedAnnotationsFrame);
    4443      TabControl.addTabValidator('settings.info', arrayBatches.validateArrayBatch);
    4544
     
    148147    {
    149148      Annotations.saveModifiedAnnotationsToForm(frm);
    150       Annotations.saveInheritedAnnotationsToForm(frm);
    151149      frm.submit();
    152150    }
     
    155153  arrayBatches.loadAnnotationsFrame = function()
    156154  {
    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());
    163156  }
    164157
  • trunk/www/lims/arraybatches/edit_batch.jsp

    r6312 r6947  
    280280      </jsp:include>
    281281    </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>
    291282    </t:tabcontrol>
    292283    </form>
  • trunk/www/lims/arraydesigns/designs.js

    r6944 r6947  
    4141      // Tab validation
    4242      TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab);
    43       TabControl.addTabActivateListener('settings.inheritedAnnotations', Annotations.autoLoadInheritFrame);
    4443      TabControl.addTabActivateListener('settings.datafiles', arrayDesigns.loadDataFilesFrame);
    4544      TabControl.addTabValidator('settings.info', arrayDesigns.validateArrayDesign);
     
    148147    {
    149148      Annotations.saveModifiedAnnotationsToForm(frm);
    150       Annotations.saveInheritedAnnotationsToForm(frm);
    151149      DataFiles.writeFileActionsToForm(frm);
    152150      frm.submit();
  • trunk/www/lims/arraydesigns/edit_design.jsp

    r6312 r6947  
    284284      </jsp:include>
    285285    </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>
    295286    </t:tabcontrol>
    296287    </form>
  • trunk/www/lims/arrayslides/edit_slide.jsp

    r6312 r6947  
    206206      </jsp:include>
    207207    </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>
    217208    </t:tabcontrol>
    218209    </form>
  • trunk/www/lims/arrayslides/slides.js

    r6944 r6947  
    4040
    4141      // Tab validation
    42       TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab);
    43       TabControl.addTabActivateListener('settings.inheritedAnnotations', arraySlides.loadInheritedAnnotationsFrame);
     42      TabControl.addTabActivateListener('settings.annotations', arraySlides.loadAnnotationsFrame);
    4443      TabControl.addTabValidator('settings.info', arraySlides.validateArraySlide);
    4544     
     
    120119    {
    121120      Annotations.saveModifiedAnnotationsToForm(frm);
    122       Annotations.saveInheritedAnnotationsToForm(frm);
    123121      frm.submit();
    124122    }
    125123  }
    126124 
    127   arraySlides.loadInheritedAnnotationsFrame = function()
     125  arraySlides.loadAnnotationsFrame = function()
    128126  {
    129     Annotations.autoLoadInheritFrame(arraySlides.getParents());
     127    Annotations.autoLoadEditFrame(null, null, arraySlides.getParents());
    130128  }
    131129 
  • trunk/www/lims/plates/edit_plate.jsp

    r6312 r6947  
    211211      </jsp:include>
    212212    </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>
    222213    </t:tabcontrol>
    223214    </form>
  • trunk/www/lims/plates/plates.js

    r6944 r6947  
    4141      // Tab validation
    4242      TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab);
    43       TabControl.addTabActivateListener('settings.inheritedAnnotations', Annotations.autoLoadInheritFrame);
    4443      TabControl.addTabValidator('settings.info', plates.validatePlate);
    4544
     
    131130    {
    132131      Annotations.saveModifiedAnnotationsToForm(frm);
    133       Annotations.saveInheritedAnnotationsToForm(frm);
    134132      frm.submit();
    135133    }
  • trunk/www/lims/plates/wells/edit_well.jsp

    r6312 r6947  
    119119      </jsp:include>
    120120    </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>
    130121    </t:tabcontrol>
    131122    </form>
  • trunk/www/lims/plates/wells/wells.js

    r6944 r6947  
    4141      // Tab validation
    4242      TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab);
    43       TabControl.addTabActivateListener('settings.inheritedAnnotations', Annotations.autoLoadInheritFrame);
    4443      TabControl.addTabValidator('settings.info', wells.validateWell);
    4544    }
     
    112111    {
    113112      Annotations.saveModifiedAnnotationsToForm(frm);
    114       Annotations.saveInheritedAnnotationsToForm(frm);
    115113      frm.submit();
    116114    }
  • trunk/www/views/derivedbioassays/bioassays.js

    r6813 r6947  
    4141      // Tab validation
    4242      TabControl.addTabActivateListener('settings.annotations', bioassays.loadAnnotationsFrame);
    43       TabControl.addTabActivateListener('settings.inheritedAnnotations', bioassays.loadInheritedAnnotationsFrame);
    4443      TabControl.addTabActivateListener('settings.datafiles', bioassays.loadDataFilesFrame);
    4544      TabControl.addTabValidator('settings.info', bioassays.validateBioAssay);
     
    182181    {
    183182      Annotations.saveModifiedAnnotationsToForm(frm);
    184       Annotations.saveInheritedAnnotationsToForm(frm);
    185183      DataFiles.writeFileActionsToForm(frm);
    186184      if (Doc.element('physicalBioAssays'))
     
    198196  bioassays.loadAnnotationsFrame = function()
    199197  {
    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());
    206199  }
    207200
  • trunk/www/views/derivedbioassays/edit_bioassay.jsp

    r6314 r6947  
    538538      </jsp:include>
    539539    </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>
    549540    </t:tabcontrol>
    550541    </form>
  • trunk/www/views/experiments/bioassays/bioassays.js

    r6944 r6947  
    4141      // Tab validation
    4242      TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab);
    43       TabControl.addTabActivateListener('settings.inheritedAnnotations', Annotations.autoLoadInheritFrame);
    4443      TabControl.addTabValidator('settings.info', bioassays.validateBioAssay);
    4544    }
     
    158157    {
    159158      Annotations.saveModifiedAnnotationsToForm(frm);
    160       Annotations.saveInheritedAnnotationsToForm(frm);
    161159      frm.submit();
    162160    }
  • trunk/www/views/experiments/bioassays/edit_bioassay.jsp

    r6315 r6947  
    109109      </jsp:include>
    110110    </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>
    120111    </t:tabcontrol>
    121112    </form>
  • trunk/www/views/experiments/bioassaysets/bioassaysets.js

    r6944 r6947  
    4343      // Tab validation
    4444      TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab);
    45       TabControl.addTabActivateListener('settings.inheritedAnnotations', Annotations.autoLoadInheritFrame);
    4645      TabControl.addTabValidator('settings.info', bioassaysets.validateBioAssaySet);
    4746    }
     
    129128    {
    130129      Annotations.saveModifiedAnnotationsToForm(frm);
    131       Annotations.saveInheritedAnnotationsToForm(frm);
    132130      frm.submit();
    133131    }
  • trunk/www/views/experiments/bioassaysets/edit_bioassayset.jsp

    r6315 r6947  
    135135      </jsp:include>
    136136    </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>
    146137    </t:tabcontrol>
    147138    </form>
  • trunk/www/views/experiments/rootrawbioassays/bioassays.js

    r6944 r6947  
    4141      // Tab validation
    4242      TabControl.addTabActivateListener('settings.annotations', Annotations.onSwitchToAnnotationsTab);
    43       TabControl.addTabActivateListener('settings.inheritedAnnotations', Annotations.autoLoadInheritFrame);
    4443      TabControl.addTabValidator('settings.info', bioassays.validateBioAssay);
    4544    }
     
    9594    {
    9695      Annotations.saveModifiedAnnotationsToForm(frm);
    97       Annotations.saveInheritedAnnotationsToForm(frm);
    9896      frm.submit();
    9997    }
  • trunk/www/views/experiments/rootrawbioassays/edit_bioassay.jsp

    r6916 r6947  
    109109      </jsp:include>
    110110    </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>
    120111    </t:tabcontrol>
    121112    </form>
  • trunk/www/views/physicalbioassays/bioassays.js

    r6813 r6947  
    4141      // Tab validation
    4242      TabControl.addTabActivateListener('settings.annotations', bioassays.loadAnnotationsFrame);
    43       TabControl.addTabActivateListener('settings.inheritedAnnotations', bioassays.loadInheritedAnnotationsFrame);
    4443      TabControl.addTabValidator('settings.info', bioassays.validatePhysicalBioAssay);
    4544     
     
    174173    {
    175174      Annotations.saveModifiedAnnotationsToForm(frm);
    176       Annotations.saveInheritedAnnotationsToForm(frm);
    177175      Link.exportActions('extracts');
    178176      frm.submit();
     
    182180  bioassays.loadAnnotationsFrame = function()
    183181  {
    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());
    190183  }
    191184 
  • trunk/www/views/physicalbioassays/edit_bioassay.jsp

    r6372 r6947  
    494494      </jsp:include>
    495495    </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>
    505496    </t:tabcontrol>
    506497    </form>
  • trunk/www/views/rawbioassays/bioassays.js

    r6813 r6947  
    4141      // Tab validation
    4242      TabControl.addTabActivateListener('settings.annotations', bioassays.loadAnnotationsFrame);
    43       TabControl.addTabActivateListener('settings.inheritedAnnotations', bioassays.loadInheritedAnnotationsFrame);
    4443      TabControl.addTabActivateListener('settings.datafiles', bioassays.loadDataFilesFrame);
    4544      TabControl.addTabValidator('settings.info', bioassays.validateRawBioAssay);
     
    164163    {
    165164      Annotations.saveModifiedAnnotationsToForm(frm);
    166       Annotations.saveInheritedAnnotationsToForm(frm);
    167165      DataFiles.writeFileActionsToForm(frm);
    168166      frm.submit();
     
    181179  bioassays.loadAnnotationsFrame = function()
    182180  {
    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());
    189182  }
    190183
  • trunk/www/views/rawbioassays/edit_rawbioassay.jsp

    r6314 r6947  
    570570      </jsp:include>
    571571    </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>
    581572    </t:tabcontrol>
    582573    </form>
Note: See TracChangeset for help on using the changeset viewer.