Changeset 6256


Ignore:
Timestamp:
Mar 25, 2013, 10:48:46 AM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #1729 and #1730. Use lazy loading for the 'Data files' frame in the edit dialogs. Inline scipts has also been removed from the edit file dialog and view and download file links.

Location:
trunk
Files:
2 added
8 edited

Legend:

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

    r6180 r6256  
    16471647        separator = " ";
    16481648      }
    1649       link += " [<a href=\"javascript:Main.viewFile('" + ID + "', " + file.getId() + ")\"" +
    1650         " title=\"View the contents of this file (" + bytes + ")\">" + viewIcon + "</a>" +
     1649      link += " [<span class=\"link auto-init\" data-auto-init=\"view-file\" data-file-id=\"" + file.getId() + "\"" +
     1650        " title=\"View the contents of this file (" + bytes + ")\">" + viewIcon + "</span>" +
    16511651        separator +
    1652         "<a href=\"javascript:Main.downloadFile('" + ID + "', " + file.getId() + ")\"" + "" +
     1652        "<span class=\"link auto-init\" data-auto-init=\"download-file\" data-file-id=\"" + file.getId() + "\"" +
    16531653        " title=\"Download the contents of this file (" + bytes + ")\">" + downloadIcon + "</a>]";
    16541654    }
  • trunk/www/common/datafiles/select_files.jsp

    r6217 r6256  
    5757  import="net.sf.basedb.clients.web.formatter.FormatterSettings"
    5858  import="net.sf.basedb.util.Values"
     59  import="org.json.simple.JSONObject"
     60  import="org.json.simple.JSONArray"
    5961  import="java.util.ArrayList"
    6062  import="java.util.List"
     
    144146    Base.getDataFileTypes(itemType, item, platform, variant, itemSubtype);
    145147  List<DataFileType> fileTypes = fileTypeQuery.list(dc);
     148  boolean validationSupport = false;
     149  JSONArray jsonFileTypes = new JSONArray();
     150 
    146151  String title = "Select data files for " +
    147152    HTML.encodeTags((item instanceof Nameable ? ((Nameable)item).getName() :
    148153      (item == null ? " new item" : item.toString())));
    149 
    150  
    151  
    152154  %>
    153   <base:page type="popup" title="<%=title%>">
    154   <base:head >
    155  
    156   <script>
    157   function init()
    158   {
    159     if (document.body.addEventListener)
    160     {
    161       // Mozilla
    162       document.body.addEventListener('click', hideVisibleRecentFilesDiv, false);
    163     }
    164     else
    165     {
    166       // IE.
    167       document.body.onclick = hideVisibleRecentFilesDiv;
    168     }
    169   }
    170  
    171   var lastFileTypeId;
    172   var lastHasValidator = false;
    173   function addFilesOnClick(event, fileTypeId, extension, hasValidator)
    174   {
    175     var frm = document.forms['datafiles'];
    176     var url = '../../filemanager/index.jsp?ID=<%=ID%>&cmd=SelectMultiple&callback=addFileCallback';
    177     if (extension)
    178     {
    179       url += '&resetTemporary=1&tmpfilter:STRING:name='+escape('%.' + extension);
    180     }
    181     else
    182     {
    183       url += '&resetTemporary=1&filter:STRING:name=';
    184     }
    185     lastFileTypeId = fileTypeId;
    186     lastHasValidator = hasValidator;
    187     Main.openPopup(url, 'SelectFile', 1050, 700);
    188     if (event.stopPropagation)
    189     {
    190       event.stopPropagation();
    191     }
    192     else
    193     {
    194       event.cancelBubble = true;
    195     }
    196   }
    197   function addFileCallback(fileId, path)
    198   {
    199     addFile(lastFileTypeId, fileId, path, lastHasValidator);
    200   }
    201  
    202   function browseOnClick(event, fileTypeId, extension, hasValidator)
    203   {
    204     var frm = document.forms['datafiles'];
    205     var url = '../../filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&callback=setFileCallback';
    206     if (extension)
    207     {
    208       url += '&resetTemporary=1&tmpfilter:STRING:name='+escape('%.' + extension);
    209     }
    210     else
    211     {
    212       url += '&resetTemporary=1&filter:STRING:name=';
    213     }
    214     lastFileTypeId = fileTypeId;
    215     lastHasValidator = hasValidator;
    216     Main.openPopup(url, 'SelectFile', 1050, 700);
    217     if (event.stopPropagation)
    218     {
    219       event.stopPropagation();
    220     }
    221     else
    222     {
    223       event.cancelBubble = true;
    224     }
    225   }
    226   function setFileCallback(fileId, path)
    227   {
    228     setFile(lastFileTypeId, fileId, path, lastHasValidator);
    229   }
    230   function setFile(fileTypeId, fileId, path, hasValidator)
    231   {
    232     var frm = document.forms['datafiles'];
    233     var fileDiv = document.getElementById('filelist.'+fileTypeId);
    234     if (fileId)
    235     {
    236       fileDiv.innerHTML = '<div id="filelist.'+fileTypeId+'.'+fileId+'" class="file">'+path+'</div>';
    237     }
    238     else
    239     {
    240       fileDiv.innerHTML = '';
    241     }
    242     if (hasValidator) frm['datafiles.validate'].checked = true;
    243     new FileAction('setfile', fileTypeId, fileId);
    244   }
    245   function addFile(fileTypeId, fileId, path, hasValidator)
    246   {
    247     var frm = document.forms['datafiles'];
    248     var fileDiv = document.getElementById('filelist.'+fileTypeId+'.'+fileId);
    249     if (fileDiv) return;
    250    
    251     fileDiv = document.createElement('div');
    252     fileDiv.id = 'filelist.'+fileTypeId+'.'+fileId;
    253     var html = path + ' <span  class="icon link" title="Remove this file"';
    254     html += ' onclick="removeFileOnClick(event,'+fileTypeId + ',' + fileId + ',' + hasValidator +')">';
    255     html += '<img src="' + getRoot() + 'images/remove.png"></span>';
    256     fileDiv.innerHTML = html;
    257     document.getElementById('filelist.'+fileTypeId).appendChild(fileDiv);
    258     if (hasValidator) frm['datafiles.validate'].checked = true;
    259     new FileAction('addfile', fileTypeId, fileId);
    260   }
    261   function removeFileOnClick(event, fileTypeId, fileId, hasValidator)
    262   {
    263     var frm = document.forms['datafiles'];
    264     var fileDiv = document.getElementById('filelist.'+fileTypeId+'.'+fileId);
    265     document.getElementById('filelist.'+fileTypeId).removeChild(fileDiv);
    266     if (hasValidator) frm['datafiles.validate'].checked = true;
    267     new FileAction('removefile', fileTypeId, fileId);
    268     if (event.stopPropagation)
    269     {
    270       event.stopPropagation();
    271     }
    272     else
    273     {
    274       event.cancelBubble = true;
    275     }
    276   }
    277  
    278   var fileActions = new Array();
    279   function FileAction(action, fileTypeId, fileId)
    280   {
    281     this.action = action;
    282     this.fileTypeId = fileTypeId;
    283     this.fileId = fileId;
    284 
    285     for (var i = fileActions.length-1; i >= 0; i--)
    286     {
    287       var other = fileActions[i];
    288       var remove = false;
    289       if (action == 'setfile')
    290       {
    291         // Remove all other actions for the given file type
    292         remove = other.fileTypeId == this.fileTypeId;
    293       }
    294       else
    295       {
    296         // Remove all other actions for the given file type+file
    297         remove = other.fileTypeId == this.fileTypeId && other.fileId == this.fileId;
    298       }
    299       if (remove) fileActions.splice(i, 1);
    300     }
    301     fileActions[fileActions.length] = this;
    302   }
    303  
    304   function writeFileActionsToForm(toForm)
    305   {
    306     var frm = document.forms['datafiles'];
    307     if (frm['datafiles.validate'])
    308     {
    309       Forms.createHidden(toForm, 'datafiles.validate', frm['datafiles.validate'].checked ? 1 : 0);
    310     }
    311     for (var i = 0; i < fileActions.length; i++)
    312     {
    313       var action = fileActions[i];
    314       Forms.createHidden(toForm, action.action + '.' + action.fileTypeId, action.fileId);
    315     }
    316   }
    317  
    318   var visibleRecentFilesDiv = null;
    319   function recentFilesOnClick(event, fileTypeId)
    320   {
    321     var recentDiv = document.getElementById('recentfiles.'+fileTypeId);
    322     var currentDiv = visibleRecentFilesDiv;
    323     hideVisibleRecentFilesDiv();
    324     if (currentDiv == recentDiv) return;
    325    
    326     var fileContainer = document.getElementById('container.'+fileTypeId);
    327     var pos = Main.getElementPosition(fileContainer, true);
    328     Main.show('recentfiles.'+fileTypeId);
    329    
    330     recentDiv.style.top = (pos.bottom-2) + 'px';
    331     recentDiv.style.left = (pos.left) + 'px';
    332     recentDiv.style.width = (pos.width-2) + 'px';
    333 
    334     visibleRecentFilesDiv = recentDiv;
    335     if (event.stopPropagation)
    336     {
    337       event.stopPropagation();
    338     }
    339     else
    340     {
    341       event.cancelBubble = true;
    342     }
    343   }
    344 
    345   function selectRecentFile(fileTypeId, fileId, allowMultiple, hasValidator)
    346   {
    347     var path = document.getElementById('recentfile.'+fileTypeId+'.'+fileId).innerHTML;
    348     if (allowMultiple)
    349     {
    350       addFile(fileTypeId, fileId, path, hasValidator);
    351     }
    352     else
    353     {
    354       setFile(fileTypeId, fileId, path, hasValidator);
    355     }
    356   }
    357  
    358   function hideVisibleRecentFilesDiv()
    359   {
    360     if (visibleRecentFilesDiv)
    361     {
    362       visibleRecentFilesDiv.style.display = 'none';
    363       visibleRecentFilesDiv = null;
    364     }
    365   }
    366   </script>
     155  <base:page type="iframe" title="<%=title%>" id="select-datafiles">
     156  <base:head scripts="~datafiles.js">
    367157  <style>
    368158  .filelist
    369159  {
    370160    margin-top: 1px;
    371     cursor: pointer;
    372161  }
    373162
     
    447236  </style>
    448237  </base:head>
    449   <base:body onload="init()">
    450 
     238  <base:body>
    451239    <form name="datafiles">
    452240    <div class="absolutefull filled">
     
    454242    boolean hasNonPlatformFiles = false;     
    455243    boolean activateCheckBoxes = false;
    456     boolean validationSupport = false;
    457244    if (fileTypes.size() == 0)
    458245    {
     
    508295        boolean isRequired = usable == null ? false : usable.isRequired();
    509296        boolean allowMultiple = usable == null ? false : usable.getAllowMultiple();
    510         String extension = dft.getExtension();
    511297        boolean hasValidator = dft.hasActiveValidator(dc);
    512298        validationSupport |= hasValidator;
    513299        List<FileSetMember> files = members.get(dft);
    514300        List<File> recentFiles = (List<File>)cc.getRecent(dc, Item.FILE, dft.getExternalId());
     301       
     302        JSONObject jsonFileType = new JSONObject();
     303        jsonFileType.put("id", dft.getId());
     304        jsonFileType.put("name", dft.getName());
     305        jsonFileType.put("extension", dft.getExtension());
     306        jsonFileType.put("hasValidator", hasValidator);
     307        jsonFileType.put("allowMultiple", allowMultiple);
     308        jsonFileTypes.add(jsonFileType);
    515309        %>
    516310        <tr>
     
    530324            <%=HTML.encodeTags(label)%>
    531325          </th>
    532           <td onclick="<%="recentFilesOnClick(event, " + dftId + ")"%>">
     326          <td>
    533327            <div class="filelist <%=isRequired ? "required" : "" %>" id="container.<%=dftId%>">
    534328            <table style="width: 100%;">
     
    543337                  <div id="filelist.<%=dftId%>.<%=file.getId()%>" class="file">
    544338                  <%=file.getPath() %>
    545                   <base:icon image="remove.png" visible="<%=allowMultiple %>"
     339                  <base:icon
     340                    id="<%="remove." + dftId+"."+file.getId()%>"
     341                    data-file-id="<%=file.getId()%>"
     342                    image="remove.png" visible="<%=allowMultiple %>"
    546343                    tooltip="Remove this file"
    547                     onclick="<%="removeFileOnClick(event, " + dftId + "," + file.getId() + "," + hasValidator + ")" %>"
    548344                  />
    549345                  </div>
     
    554350              </td>
    555351              <td class="fileaction">
    556                 <base:icon image="mini_scroll_down.png"
     352                <base:icon
     353                  id="<%="showrecent." + dftId%>"
     354                  image="mini_scroll_down.png"
    557355                  visible="<%=recentFiles.size() >= 0 %>"
    558356                  tooltip="Select a recently used file"
    559                   onclick="<%="recentFilesOnClick(event, " + dftId + ")"%>"
    560357                />
    561                 <base:icon image="add.png"
    562                   onclick="<%="addFilesOnClick(event, "+dftId+", '" + HTML.javaScriptEncode(extension) + "', "+ hasValidator + ")"%>"
     358                <base:icon id="<%="addfile." + dftId%>"
     359                  image="add.png"
    563360                  visible="<%=allowMultiple %>"
     361                  tooltip="Browse for files in the BASE file system"
    564362                />
    565                 <base:icon image="browse.png"
    566                   onclick="<%="browseOnClick(event, "+dftId+", '" + HTML.javaScriptEncode(extension) + "', "+ hasValidator + ")"%>"
     363                <base:icon id="<%="browsefile." + dftId%>"
     364                  image="browse.png"
     365                  tooltip="Browse for a file in the BASE file system"
    567366                  visible="<%=!allowMultiple%>"
    568367                />
     
    574373            <div id="recentfiles.<%=dftId%>" style="display: none;" class="recentfiles">
    575374              <div class="recentfile"
    576                 onclick="selectRecentFile(<%=dftId%>, 0, false, <%=hasValidator%>)"
     375                data-file-id="0"
    577376                id="recentfile.<%=dftId%>.0"
    578377                ><i>- clear -</i></div>
     
    582381                %>
    583382                <div class="recentfile"
    584                   onclick="selectRecentFile(<%=dftId%>, <%=recent.getId()%>, <%=allowMultiple ? 1 : 0 %>, <%=hasValidator%>)"
     383                  data-file-id="<%=recent.getId()%>"
    585384                  id="recentfile.<%=dftId%>.<%=recent.getId()%>"
    586385                  ><%=HTML.encodeTags(recent.getPath().toString())%></div>
     
    642441    </div>
    643442    </form>
     443    <div id="page-data" class="datacontainer"
     444      data-filetypes="<%=HTML.encodeTags(jsonFileTypes.toJSONString()) %>"
     445      ></div>
    644446
    645447  </base:body>
  • trunk/www/filemanager/select_file.jsp

    r6137 r6256  
    8484  function returnSelected()
    8585  {
     86    var callback = '<%=callback%>';
     87    var notifyTarget = window.opener.document.getElementById(callback);
     88    var callbackMethod = window.opener[callback];
     89   
    8690    for (var i = 0; i < selected.length; i++)
    8791    {
    88       window.opener.<%=callback%>(selected[i].id, selected[i].path);
     92      if (notifyTarget)
     93      {
     94        // Send event to the target in the opener window
     95        Events.sendCustomEvent(notifyTarget, 'base-selected', {'id': selected[i].id, 'name': selected[i].path});
     96      }
     97      else if (callbackMethod)
     98      {
     99        // Call the callback method in the opener window
     100        callbackMethod.call(null, selected[i].id, selected[i].path);
     101      }
    89102    }
    90103    window.close();
  • trunk/www/include/scripts/main-2.js

    r6222 r6256  
    14061406}();
    14071407
    1408 
     1408var Files = function()
     1409{
     1410  var files = {};
     1411  var internal = {};
     1412
     1413  /**
     1414    Open a new browser window for viewing the file contents of
     1415    the file with the given id. If no window name is specified a
     1416    new window is always created.
     1417  */
     1418  files.viewFile = function(fileId, windowName)
     1419  {
     1420    var controller = Main.getController('FILE');
     1421    var url = App.getRoot() + controller.url;
     1422    url += '?ID='+App.getSessionId();
     1423    url += '&cmd=ViewFile&item_id'+fileId;
     1424    if (!windowName) windowName = '_blank';
     1425    window.open(url, windowName);
     1426  }
     1427 
     1428  /**
     1429    Open a popup window for downloading the file contents of
     1430    the file with the given id. The download should start
     1431    automatically.
     1432  */
     1433  files.downloadFile = function(fileId)
     1434  {
     1435    var controller = Main.getController('FILE');
     1436    var url = App.getRoot() + controller.url;
     1437    url += '?ID='+App.getSessionId();
     1438    url += '&cmd=DownloadFile&item_id'+fileId;
     1439    Main.openPopup(url, 'DownloadFile', 450, 300);
     1440  }
     1441 
     1442  /**
     1443    Event handler that call 'viewFile' when clicking
     1444    on the attached target. The file id should be stored
     1445    in the 'data-file-id' attribute.
     1446  */
     1447  files.viewFileOnClick = function(event)
     1448  {
     1449    files.viewFile(Data.get(event.currentTarget, 'file-id'));
     1450  }
     1451 
     1452  /**
     1453    Event handler that call 'downloadFile' when clicking
     1454    on the attached target. The file id should be stored
     1455    in the 'data-file-id' attribute.
     1456  */
     1457  files.downloadFileOnClick = function(event)
     1458  {
     1459    files.downloadFile(Data.get(event.currentTarget, 'file-id'));
     1460  }
     1461 
     1462  internal.initializeFileLinks = function(element, autoInit)
     1463  {
     1464    if (autoInit == 'view-file')
     1465    {
     1466      Events.addEventHandler(element, 'click', Files.viewFileOnClick);
     1467    }
     1468    else if (autoInit == 'download-file')
     1469    {
     1470      Events.addEventHandler(element, 'click', Files.downloadFileOnClick);
     1471    }
     1472  }
     1473  Doc.addElementInitializer(internal.initializeFileLinks);
     1474 
     1475  return files;
     1476}();
    14091477
    14101478var Forms = function()
  • trunk/www/include/scripts/main.js

    r6220 r6256  
    470470  this.viewFile = function(ID, fileId)
    471471  {
    472     var controller = this.getController('FILE');
    473     var url = getRoot() + controller.url + '?ID='+ID+'&cmd=ViewFile&item_id='+fileId;
    474     window.open(url, '_blank');
    475     //Main.openPopup(url, 'ViewFile', 800, 600, 'x');
     472    Files.viewFile(fileId);
    476473  }
    477474
    478475  this.downloadFile = function(ID, fileId)
    479476  {
    480     var controller = this.getController('FILE');
    481     var url = getRoot() + controller.url + '?ID='+ID+'&cmd=DownloadFile&item_id='+fileId;
    482     Main.openPopup(url, 'DownloadFile', 450, 300);
     477    Files.downloadFile(fileId);
    483478  }
    484479 
  • trunk/www/lims/arraydesigns/edit_design.jsp

    r6254 r6256  
    187187        Annotations.saveModifiedAnnotationsToForm(frm);
    188188        Annotations.saveInheritedAnnotationsToForm(frm);
    189         if (dataFilesLoaded)
    190         {
    191           frames.datafiles.writeFileActionsToForm(frm);
    192         }
     189        DataFiles.writeFileActionsToForm(frm);
    193190        frm.submit();
    194191      }
     
    205202    }
    206203   
    207     var dataFilesLoaded = false;
    208     var platformChanged = false;
    209204    function loadDataFilesFrame()
    210205    {
    211206      var frm = document.forms['design'];
    212       if (platformChanged || !dataFilesLoaded)
    213       {
    214         var platform = Platforms.getSelectedPlatform(frm.platform);
    215         var variant = Platforms.getSelectedVariant(frm.platform);
    216         Platforms.loadDataFilesFrame(frames.datafiles, '<%=ID%>', '<%=itemType.name()%>', <%=design == null ? 0 : design.getId()%>, platform == null ? 0 : platform.id, variant == null ? 0 : variant.id);
    217         dataFilesLoaded = true;
    218         platformChanged = false;
    219       }
    220     }
    221 
    222     function platformOnChange()
    223     {
    224       platformChanged = true;
     207      var platform = Platforms.getSelectedPlatform(frm.platform);
     208      var variant = Platforms.getSelectedVariant(frm.platform);
     209      DataFiles.autoLoadEditFrame(platform ? platform.id : 0, variant ? variant.id : 0, 0);
    225210    }
    226211
     
    291276        <th>Platform</th>
    292277        <td>
    293           <select name="platform" onchange="platformOnChange()" class="required"
     278          <select name="platform" class="required"
    294279            <%=deniedPlatform ? "disabled" : "" %>>
    295280          <%
     
    340325    </t:tab>
    341326
    342     <t:tab id="datafiles" title="Data files" helpid="datafiles.edit" activate="loadDataFilesFrame()"><iframe
    343       name="datafiles" id="idDatafiles" src="../../common/datafiles/wait.jsp"
    344       class="absolutefull" style="width: 100%; height: 100%;"></iframe></t:tab>
     327    <t:tab id="datafiles" title="Data files" helpid="datafiles.edit" activate="loadDataFilesFrame()">
     328      <jsp:include page="../../common/datafiles/select_frameset.jsp">
     329        <jsp:param name="item_type" value="<%=itemType.name()%>" />
     330        <jsp:param name="item_id" value="<%=itemId%>" />
     331        <jsp:param name="ID" value="<%=ID%>" />
     332      </jsp:include>
     333    </t:tab>
    345334
    346335    <t:tab id="annotations" title="Annotations" helpid="annotations.edit" activate="loadAnnotationsFrame()">
  • trunk/www/views/derivedbioassays/edit_bioassay.jsp

    r6254 r6256  
    268268        Annotations.saveModifiedAnnotationsToForm(frm);
    269269        Annotations.saveInheritedAnnotationsToForm(frm);
    270         if (dataFilesLoaded)
    271         {
    272           frames.datafiles.writeFileActionsToForm(frm);
    273         }
     270        DataFiles.writeFileActionsToForm(frm);
    274271        if (frm.addedPhysicalBioAssays)
    275272        {
     
    296293    }
    297294
    298     var subtypeChanged = false;
    299     var dataFilesLoaded = false;
    300    
    301295    function loadDataFilesFrame()
    302296    {
    303       if (subtypeChanged || !dataFilesLoaded)
    304       {
    305         var subtypeId = ItemSubtype.getSubtypeId('bioAssay');
    306         Platforms.loadDataFilesFrame(frames.datafiles, '<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, 0, 0, subtypeId);
    307         dataFilesLoaded = true;
    308         subtypeChanged = false;
    309       }
     297      var subtypeId = ItemSubtype.getSubtypeId('bioAssay');
     298      DataFiles.autoLoadEditFrame(0, 0, subtypeId);
    310299    }
    311300     
     
    351340      var frm = document.forms['bioAssay'];
    352341      var subtypeId = ItemSubtype.getSubtypeId('bioAssay');
    353       subtypeChanged = true;
    354342      var recentInfo = ItemSubtype.getRecentAndRelatedInfo(subtypeId, 'BIOASSAY', ['PROTOCOL', 'HARDWARE', 'SOFTWARE']);
    355343      ItemSubtype.updateSelectionList(frm.protocol_id, recentInfo.PROTOCOL['recent'], recentInfo.PROTOCOL['default']);
     
    893881    </t:tab>
    894882
    895     <t:tab id="datafiles" title="Data files" helpid="datafiles.edit" activate="loadDataFilesFrame()"><iframe
    896       name="datafiles" id="idDatafiles" src="../../common/datafiles/wait.jsp"
    897       class="absolutefull" style="width: 100%; height: 100%;"></iframe></t:tab>
     883    <t:tab id="datafiles" title="Data files" helpid="datafiles.edit" activate="loadDataFilesFrame()">
     884      <jsp:include page="../../common/datafiles/select_frameset.jsp">
     885        <jsp:param name="item_type" value="<%=itemType.name()%>" />
     886        <jsp:param name="item_id" value="<%=itemId%>" />
     887        <jsp:param name="ID" value="<%=ID%>" />
     888      </jsp:include>   
     889    </t:tab>
    898890
    899891    <t:tab id="annotations" title="Annotations &amp; parameters" helpid="annotations.edit" activate="loadAnnotationsFrame()">
  • trunk/www/views/rawbioassays/edit_rawbioassay.jsp

    r6254 r6256  
    356356        Annotations.saveModifiedAnnotationsToForm(frm);
    357357        Annotations.saveInheritedAnnotationsToForm(frm);
    358         if (dataFilesLoaded)
    359         {
    360           frames.datafiles.writeFileActionsToForm(frm);
    361         }
     358        DataFiles.writeFileActionsToForm(frm);
    362359        frm.submit();
    363360      }
     
    374371    }
    375372 
    376     var dataFilesLoaded = false;
    377     var platformChanged = false;
    378 
    379373    function loadDataFilesFrame()
    380374    {
    381375      var frm = document.forms['rawbioassay'];
    382       if (platformChanged || !dataFilesLoaded)
    383       {
    384         var platform = Platforms.getSelectedPlatform(frm.platform);
    385         var variant = Platforms.getSelectedVariant(frm.platform);
    386         Platforms.loadDataFilesFrame(frames.datafiles, '<%=ID%>', '<%=itemType.name()%>', <%=rawBioAssay == null ? 0 : rawBioAssay.getId()%>, platform == null ? 0 : platform.id, variant == null ? 0 : variant.id);
    387         dataFilesLoaded = true;
    388         platformChanged = false;
    389       }
     376      var platform = Platforms.getSelectedPlatform(frm.platform);
     377      var variant = Platforms.getSelectedVariant(frm.platform);
     378      DataFiles.autoLoadEditFrame(platform ? platform.id : 0, variant ? variant.id : 0, 0);
    390379    }
    391380   
     
    393382    {
    394383      var frm = document.forms['rawbioassay'];
    395       platformChanged = true;
    396384      var platform = Platforms.getSelectedPlatform(frm.platform);
    397385      var variant = Platforms.getSelectedVariant(frm.platform);
     
    879867    </t:tab>
    880868   
    881     <t:tab id="datafiles" title="Data files" helpid="datafiles.edit" activate="loadDataFilesFrame()"><iframe
    882       name="datafiles" id="idDatafiles" src="../../common/datafiles/wait.jsp"
    883       class="absolutefull" style="width: 100%; height: 100%;"></iframe></t:tab>
     869    <t:tab id="datafiles" title="Data files" helpid="datafiles.edit" activate="loadDataFilesFrame()">
     870      <jsp:include page="../../common/datafiles/select_frameset.jsp">
     871        <jsp:param name="item_type" value="<%=itemType.name()%>" />
     872        <jsp:param name="item_id" value="<%=itemId%>" />
     873        <jsp:param name="ID" value="<%=ID%>" />
     874      </jsp:include>
     875    </t:tab>
    884876
    885877    <t:tab id="annotations" title="Annotations &amp; parameters" helpid="annotations.edit" activate="loadAnnotationsFrame()">
Note: See TracChangeset for help on using the changeset viewer.