Changeset 6260


Ignore:
Timestamp:
Mar 27, 2013, 9:22:17 AM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #1729 and #1730. Fixed for all biomaterial list pages.

Location:
trunk
Files:
11 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/tab/TabControl.java

    r6164 r6260  
    311311  {
    312312    numTabs++;
    313     if (((active == null) && (numTabs == 1)) || (active != null) && active.equals(tab.getId()))
     313    if ((active != null) && active.equals(tab.getId()))
    314314    {
    315315      initialTab = tab.getId();
  • trunk/www/biomaterials/bioplateeventtypes/list_eventtypes.jsp

    r6221 r6260  
    9696  ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext);
    9797  %>
    98   <base:page title="<%=title==null ? "Bioplate event types" : title%>" type="<%=mode.getPageType()%>">
    99   <base:head scripts="table.js" styles="table.css,toolbar.css">
     98  <base:page title="<%=title==null ? "Bioplate event types" : title%>" type="<%=mode.getPageType()%>" id="list-page">
     99  <base:head scripts="table.js,~bioplateeventtypes.js" styles="table.css,toolbar.css">
    100100    <ext:scripts context="<%=jspContext%>" />
    101101    <ext:stylesheets context="<%=jspContext%>" />
    102     <script>
    103     var submitPage = 'index.jsp';
    104     var formId = 'bioPlateEventTypes';
    105     function newItem()
    106     {
    107       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', 0, true);
    108     }
    109     function editItem(itemId)
    110     {
    111       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true);
    112     }
    113     function viewItem(itemId)
    114     {
    115       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false);
    116     }
    117     function itemOnClick(evt, itemId)
    118     {
    119       Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected);
    120     }
    121     function deleteItems()
    122     {
    123       var frm = document.forms[formId];
    124       if (Forms.numChecked(frm) == 0)
    125       {
    126         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    127         return;
    128       }
    129       frm.action = submitPage;
    130       frm.cmd.value = 'DeleteItems';
    131       frm.submit();
    132     }
    133     function restoreItems()
    134     {
    135       var frm = document.forms[formId];
    136       if (Forms.numChecked(frm) == 0)
    137       {
    138         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    139         return;
    140       }
    141       frm.action = submitPage;
    142       frm.cmd.value = 'RestoreItems';
    143       frm.submit();
    144     }
    145     function configureColumns()
    146     {
    147       Table.configureColumns(formId);
    148     }
    149     function runPlugin(cmd)
    150     {
    151       Table.submitToPopup(formId, cmd, 750, 500);
    152     }
    153     function returnSelected()
    154     {
    155       Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>);
    156       window.close();
    157     }
    158     </script>
    159102  </base:head>
    160103 
     
    162105    <h1><%=title==null ? "Bioplate event types" : title%></h1>
    163106    <div class="content">
    164 
    165107    <tbl:table
    166       id="bioPlateEventTypes"
     108      id="bioplateeventtypes"
    167109      columns="<%=cc.getSetting("columns")%>"
    168110      sortby="<%=cc.getSortProperty()%>"
     
    232174          >
    233175          <tbl:button
     176            id="btnNewItem"
    234177            disabled="<%=!createPermission%>"
    235178            image="new.png"
    236             onclick="newItem()"
    237179            title="New&hellip;"
    238180            tooltip="<%=createPermission ? "Create new bioplate event type" : "You do not have permission to create bioplate event types"%>"
    239181          />
    240182          <tbl:button
     183            id="btnDeleteItems"
    241184            image="delete.png"
    242             onclick="deleteItems()"
    243185            title="Delete"
    244186            tooltip="Delete the selected items"
    245187          />
    246188          <tbl:button
     189            id="btnRestoreItems"
    247190            image="restore.png"
    248             onclick="restoreItems()"
    249191            title="Restore"
    250192            tooltip="Restore the selected (deleted) items"
    251193          />
    252194          <tbl:button
     195            id="btnColumns"
    253196            image="columns.png"
    254             onclick="configureColumns()"
    255197            title="Columns&hellip;"
    256198            tooltip="Show, hide and re-order columns"
    257199          />
    258200          <tbl:button
     201            id="btnImport"
     202            data-plugin-type="IMPORT"
    259203            image="import.png"
    260             onclick="runPlugin('ImportItems')"
    261204            title="Import&hellip;"
    262205            tooltip="Import data"
     
    264207          />
    265208          <tbl:button
     209            id="btnExport"
     210            data-plugin-type="EXPORT"
    266211            image="export.png"
    267             onclick="runPlugin('ExportItems')"
    268212            title="Export&hellip;"
    269213            tooltip="Export data"
     
    271215          />
    272216          <tbl:button
     217            id="btnRunPlugin"
     218            data-plugin-type="OTHER"
    273219            image="runplugin.png"
    274             onclick="runPlugin('RunListPlugin')"
    275220            title="Run plugin&hellip;"
    276221            tooltip="Run a plugin"
     
    381326                    visible="<%=item.isRemoved()%>"
    382327                  />&nbsp;</tbl:header>
    383                 <tbl:cell column="name"><div class="link"
    384                   onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)"
     328                <tbl:cell column="name"><div
     329                  class="link table-item"
     330                  data-item-id="<%=itemId%>"
     331                  data-no-edit="<%=writePermission ? 0 : 1 %>"
     332                  tabindex="0"
    385333                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
    386334                <tbl:cell column="id"><%=item.getId()%></tbl:cell>
     
    411359   
    412360    <base:buttongroup subclass="dialogbuttons">
    413       <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" />
    414       <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
    415       <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" />
     361      <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" />
     362      <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
     363      <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" />
    416364    </base:buttongroup>
    417365   
  • trunk/www/biomaterials/bioplates/events/list_events.jsp

    r6221 r6260  
    109109  ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext);
    110110  %>
    111   <base:page title="<%=title%>" type="<%=mode.getPageType()%>">
    112   <base:head scripts="table.js,tabcontrol.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">
     111  <base:page title="<%=title%>" type="<%=mode.getPageType()%>" id="list-page">
     112  <base:head scripts="table.js,tabcontrol-2.js,~events.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">
    113113    <ext:scripts context="<%=jspContext%>" />
    114114    <ext:stylesheets context="<%=jspContext%>" />
    115     <script>
    116     var submitPage = 'index.jsp';
    117     var formId = 'events';
    118     function editItem(itemId)
    119     {
    120       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true);
    121     }
    122     function viewItem(itemId)
    123     {
    124       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false, '&bioplate_id=<%=bioPlateId%>');
    125     }
    126     function itemOnClick(evt, itemId)
    127     {
    128       Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected);
    129     }
    130     function deleteItems()
    131     {
    132       var frm = document.forms[formId];
    133       if (Forms.numChecked(frm) == 0)
    134       {
    135         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    136         return;
    137       }
    138       frm.action = submitPage;
    139       frm.cmd.value = 'DeleteItems';
    140       frm.submit();
    141     }
    142     function restoreItems()
    143     {
    144       var frm = document.forms[formId];
    145       if (Forms.numChecked(frm) == 0)
    146       {
    147         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    148         return;
    149       }
    150       frm.action = submitPage;
    151       frm.cmd.value = 'RestoreItems';
    152       frm.submit();
    153     }
    154     function setOwner()
    155     {
    156       Table.setOwnerOfItems(formId);
    157     }
    158     function shareItems()
    159     {
    160       Table.shareItems(formId);
    161     }
    162     function configureColumns()
    163     {
    164       Table.configureColumns(formId);
    165     }
    166     function runPlugin(cmd)
    167     {
    168       Table.submitToPopup(formId, cmd, 750, 500);
    169     }
    170     function returnSelected()
    171     {
    172       Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>);
    173       window.close();
    174     }
    175     function switchTab(tabControlId, tabId)
    176     {
    177       if (tabId == 'properties' || tabId == 'annotations' || tabId == 'overview' || tabId == 'history')
    178       {
    179         location.href = '../index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id=<%=bioPlateId%>&tab='+tabId;
    180       }
    181       else if (tabId == 'biowells')
    182       {
    183         location.href = '../wells/index.jsp?ID=<%=ID%>&bioplate_id=<%=bioPlateId%>';
    184       }
    185       else
    186       {
    187         TabControl.setActiveTab(tabControlId, tabId);
    188       }
    189     }
    190     </script>
    191115  </base:head>
    192  
    193116  <base:body>
    194117    <%
     
    214137      subclass="content mastertabcontrol"
    215138      notabs="<%=mode.isSelectionMode() %>"
    216       active="events" switch="switchTab">
     139      active="events">
    217140    <t:tab id="properties" title="Properties" />
    218141    <t:tab id="annotations" title="Annotations" />       
     
    366289          >
    367290          <tbl:button
     291            id="btnDeleteItems"
    368292            image="delete.png"
    369             onclick="deleteItems()"
    370293            title="Delete"
    371294            tooltip="Delete the selected items"
    372295          />
    373296          <tbl:button
     297            id="btnRestoreItems"
    374298            image="restore.png"
    375             onclick="restoreItems()"
    376299            title="Restore"
    377300            tooltip="Restore the selected (deleted) items"
    378301          />
    379302          <tbl:button
     303            id="btnShareItems"
    380304            image="share.png"
    381             onclick="shareItems()"
    382305            title="Share&hellip;"
    383306            tooltip="Share the selected items"
    384307          />
    385308          <tbl:button
     309            id="btnSetOwner"
    386310            image="take_ownership.png"
    387             onclick="setOwner()"
    388311            title="Set owner&hellip;"
    389312            tooltip="Change owner of the selected items"
    390313          />
    391314          <tbl:button
     315            id="btnColumns"
    392316            image="columns.png"
    393             onclick="configureColumns()"
    394317            title="Columns&hellip;"
    395318            tooltip="Show, hide and re-order columns"
    396319          />
    397320          <tbl:button
     321            id="btnImport"
     322            data-plugin-type="IMPORT"
    398323            image="import.png"
    399             onclick="runPlugin('ImportItems')"
    400324            title="Import&hellip;"
    401325            tooltip="Import data"
     
    403327          />
    404328          <tbl:button
     329            id="btnExport"
     330            data-plugin-type="EXPORT"
    405331            image="export.png"
    406             onclick="runPlugin('ExportItems')"
    407332            title="Export&hellip;"
    408333            tooltip="Export data"
     
    410335          />
    411336          <tbl:button
     337            id="btnRunPlugin"
     338            data-plugin-type="OTHER"
    412339            image="runplugin.png"
    413             onclick="runPlugin('RunListPlugin')"
    414340            title="Run plugin&hellip;"
    415341            tooltip="Run a plugin"
     
    530456                    visible="<%=item.isShared()%>"
    531457                  />&nbsp;</tbl:header>
    532                 <tbl:cell column="name"><div class="link"
    533                   onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)"
     458                <tbl:cell column="name"><div
     459                  class="link table-item"
     460                  data-item-id="<%=itemId%>"
     461                  data-no-edit="<%=writePermission ? 0 : 1 %>"
     462                  data-extra-url="&bioplate_id=<%=bioPlateId%>"
     463                  tabindex="0"
    534464                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
    535465                <tbl:cell column="id"><%=item.getId()%></tbl:cell>
     
    635565
    636566    <base:buttongroup subclass="dialogbuttons">
    637       <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" />
    638       <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
    639       <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" />
     567      <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" />
     568      <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
     569      <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" />
    640570    </base:buttongroup>
    641571
  • trunk/www/biomaterials/bioplates/list_bioplates.jsp

    r6221 r6260  
    133133  ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext);
    134134  %>
    135   <base:page title="<%=title==null ? "Bioplates" : title%>" type="<%=mode.getPageType()%>">
    136   <base:head scripts="table.js" styles="table.css,toolbar.css">
     135  <base:page title="<%=title==null ? "Bioplates" : title%>" type="<%=mode.getPageType()%>" id="list-page">
     136  <base:head scripts="table.js,~bioplates.js" styles="table.css,toolbar.css">
    137137    <ext:scripts context="<%=jspContext%>" />
    138138    <ext:stylesheets context="<%=jspContext%>" />
    139     <script>
    140     var submitPage = 'index.jsp';
    141     var formId = 'bioplates';
    142     function newItem()
    143     {
    144       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', 0, true);
    145     }
    146     function editItem(itemId)
    147     {
    148       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true);
    149     }
    150     function viewItem(itemId)
    151     {
    152       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false);
    153     }
    154     function itemOnClick(evt, itemId)
    155     {
    156       Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected);
    157     }
    158     function deleteItems()
    159     {
    160       var frm = document.forms[formId];
    161       if (Forms.numChecked(frm) == 0)
    162       {
    163         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    164         return;
    165       }
    166       frm.action = submitPage;
    167       frm.cmd.value = 'DeleteItems';
    168       frm.submit();
    169     }
    170     function restoreItems()
    171     {
    172       var frm = document.forms[formId];
    173       if (Forms.numChecked(frm) == 0)
    174       {
    175         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    176         return;
    177       }
    178       frm.action = submitPage;
    179       frm.cmd.value = 'RestoreItems';
    180       frm.submit();
    181     }
    182     function setOwner()
    183     {
    184       Table.setOwnerOfItems(formId);
    185     }
    186     function shareItems()
    187     {
    188       Table.shareItems(formId);
    189     }
    190     function configureColumns()
    191     {
    192       Table.configureColumns(formId);
    193     }
    194     function runPlugin(cmd)
    195     {
    196       Table.submitToPopup(formId, cmd, 750, 500);
    197     }
    198     function returnSelected()
    199     {
    200       Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>);
    201       window.close();
    202     }
    203     </script>
    204139  </base:head> 
    205140  <base:body>
     
    452387          >
    453388          <tbl:button
     389            id="btnNewItem"
    454390            disabled="<%=!createPermission%>"
    455391            image="new.png"
    456             onclick="newItem()"
    457392            title="New&hellip;"
    458393            tooltip="<%=createPermission ? "Create new bioplate" : "You do not have permission to create bioplate"%>"
    459394          />
    460395          <tbl:button
     396            id="btnDeleteItems"
    461397            image="delete.png"
    462             onclick="deleteItems()"
    463398            title="Delete"
    464399            tooltip="Delete the selected items"
    465400          />
    466401          <tbl:button
     402            id="btnRestoreItems"
    467403            image="restore.png"
    468             onclick="restoreItems()"
    469404            title="Restore"
    470405            tooltip="Restore the selected (deleted) items"
    471406          />
    472407          <tbl:button
     408            id="btnShareItems"
    473409            image="share.png"
    474             onclick="shareItems()"
    475410            title="Share&hellip;"
    476411            tooltip="Share the selected items"
    477412          />
    478413          <tbl:button
     414            id="btnSetOwner"
    479415            image="take_ownership.png"
    480             onclick="setOwner()"
    481416            title="Set owner&hellip;"
    482417            tooltip="Change owner of the selected items"
    483418          />
    484419          <tbl:button
     420            id="btnColumns"
    485421            image="columns.png"
    486             onclick="configureColumns()"
    487422            title="Columns&hellip;"
    488423            tooltip="Show, hide and re-order columns"
    489424          />
    490425          <tbl:button
     426            id="btnImport"
     427            data-plugin-type="IMPORT"
    491428            image="import.png"
    492             onclick="runPlugin('ImportItems')"
    493429            title="Import&hellip;"
    494430            tooltip="Import data"
     
    496432          />
    497433          <tbl:button
     434            id="btnExport"
     435            data-plugin-type="EXPORT"
    498436            image="export.png"
    499             onclick="runPlugin('ExportItems')"
    500437            title="Export&hellip;"
    501438            tooltip="Export data"
     
    503440          />
    504441          <tbl:button
     442            id="btnRunPlugin"
     443            data-plugin-type="OTHER"
    505444            image="runplugin.png"
    506             onclick="runPlugin('RunListPlugin')"
    507445            title="Run plugin&hellip;"
    508446            tooltip="Run a plugin"
     
    622560                    visible="<%=item.isShared()%>"
    623561                  />&nbsp;</tbl:header>
    624                 <tbl:cell column="name"><div class="link"
    625                   onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)"
     562                <tbl:cell column="name"><div
     563                  class="link table-item"
     564                  data-item-id="<%=itemId%>"
     565                  data-no-edit="<%=writePermission ? 0 : 1 %>"
     566                  tabindex="0"
    626567                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
    627568                <tbl:cell column="id"><%=item.getId()%></tbl:cell>
     
    741682
    742683    <base:buttongroup subclass="dialogbuttons">
    743       <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" />
    744       <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
    745       <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" />
     684      <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" />
     685      <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
     686      <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" />
    746687    </base:buttongroup>
    747688  </base:body>
  • trunk/www/biomaterials/bioplates/wells/list_biowells.jsp

    r6221 r6260  
    130130  ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext);
    131131  %>
    132   <base:page title="<%=title%>" type="<%=mode.getPageType()%>">
    133   <base:head scripts="table.js,tabcontrol.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">
     132  <base:page title="<%=title%>" type="<%=mode.getPageType()%>" id="list-page">
     133  <base:head scripts="table.js,tabcontrol-2.js,~biowells.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">
    134134    <ext:scripts context="<%=jspContext%>" />
    135135    <ext:stylesheets context="<%=jspContext%>" />
    136     <script>
    137     var submitPage = 'index.jsp';
    138     var formId = 'biowells';
    139 
    140     function editItem(itemId)
    141     {
    142       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true);
    143     }
    144     function itemOnClick(itemId)
    145     {
    146       Table.itemOnClick(formId, null, itemId, '<%=mode.getName()%>', null, null, returnSelected);
    147     }
    148     function configureColumns()
    149     {
    150       Table.configureColumns(formId);
    151     }
    152     function runPlugin(cmd)
    153     {
    154       Table.submitToPopup(formId, cmd, 750, 500);
    155     }
    156     function returnSelected()
    157     {
    158       Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>);
    159       window.close();
    160     }
    161     function switchTab(tabControlId, tabId)
    162     {
    163       if (tabId == 'properties' || tabId == 'annotations' || tabId == 'overview' || tabId == 'history')
    164       {
    165         location.href = '../index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id=<%=bioPlateId%>&tab='+tabId;
    166       }
    167       else if (tabId == 'events')
    168       {
    169         location.href = '../events/index.jsp?ID=<%=ID%>&bioplate_id=<%=bioPlateId%>';
    170       }
    171       else
    172       {
    173         TabControl.setActiveTab(tabControlId, tabId);
    174       }
    175     }
    176     </script>
    177136  </base:head>
    178  
    179137  <base:body>
    180138    <%
     
    195153    }
    196154    %>
    197 
    198155    <t:tabcontrol
    199156      id="main"
    200157      subclass="content mastertabcontrol"
    201       active="biowells" switch="switchTab"
     158      active="biowells"
    202159      notabs="<%=mode.isSelectionMode()%>"
    203160      >
     
    325282          >
    326283          <tbl:button
     284            id="btnColumns"
    327285            image="columns.png"
    328             onclick="configureColumns()"
    329286            title="Columns&hellip;"
    330287            tooltip="Show, hide and re-order columns"
    331288          />
    332289          <tbl:button
     290            id="btnImport"
     291            data-plugin-type="IMPORT"
    333292            image="import.png"
    334             onclick="runPlugin('ImportItems')"
    335293            title="Import&hellip;"
    336294            tooltip="Import data"
     
    338296          />
    339297          <tbl:button
     298            id="btnExport"
     299            data-plugin-type="EXPORT"
    340300            image="export.png"
    341             onclick="runPlugin('ExportItems')"
    342301            title="Export&hellip;"
    343302            tooltip="Export data"
     
    345304          />
    346305          <tbl:button
     306            id="btnRunPlugin"
     307            data-plugin-type="OTHER"
    347308            image="runplugin.png"
    348             onclick="runPlugin('RunListPlugin')"
    349309            title="Run plugin&hellip;"
    350310            tooltip="Run a plugin"
     
    470430                  {
    471431                    %>
    472                     <div class="link" onclick="itemOnClick(<%=itemId%>)" title="Select this item">
     432                    <div
     433                      class="link table-item"
     434                      data-item-id="<%=itemId%>"
     435                      tabindex="0"
     436                      title="Select this item">
    473437                      <tbl:cellvalue value="<%=item.getRow()%>" />
    474438                    </div>
     
    491455                  <base:icon
    492456                    visible="<%=editWellPermission%>"
     457                    subclass="link auto-init"
     458                    data-auto-init="item-link"
     459                    data-item-type="BIOWELL"
     460                    data-item-id="<%=itemId %>"
    493461                    image="edit.png"
    494462                    tooltip="<%=bioMaterial == null ? "Add biomaterial to this well" : "Change the biomaterial in this well"%>"
    495                     onclick="<%="editItem("+item.getId()+")"%>"
    496463                  />
    497464                  <base:icon
     
    537504
    538505    <base:buttongroup subclass="dialogbuttons">
    539       <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" />
    540       <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
    541       <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" />
     506      <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" />
     507      <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
     508      <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" />
    542509    </base:buttongroup>
    543510
    544  
    545511  </base:body>
    546512  </base:page>
  • trunk/www/biomaterials/bioplatetypes/list_platetypes.jsp

    r6221 r6260  
    123123  ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext);
    124124  %>
    125   <base:page title="<%=title==null ? "Bioplate types" : title%>" type="<%=mode.getPageType()%>">
    126   <base:head scripts="table.js" styles="table.css,toolbar.css">
     125  <base:page title="<%=title==null ? "Bioplate types" : title%>" type="<%=mode.getPageType()%>" id="list-page">
     126  <base:head scripts="table.js,~bioplatetypes.js" styles="table.css,toolbar.css">
    127127    <ext:scripts context="<%=jspContext%>" />
    128128    <ext:stylesheets context="<%=jspContext%>" />
    129     <script>
    130     var submitPage = 'index.jsp';
    131     var formId = 'bioPlateTypes';
    132     function newItem()
    133     {
    134       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', 0, true);
    135     }
    136     function editItem(itemId)
    137     {
    138       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true);
    139     }
    140     function viewItem(itemId)
    141     {
    142       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false);
    143     }
    144     function itemOnClick(evt, itemId)
    145     {
    146       Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected);
    147     }
    148     function deleteItems()
    149     {
    150       var frm = document.forms[formId];
    151       if (Forms.numChecked(frm) == 0)
    152       {
    153         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    154         return;
    155       }
    156       frm.action = submitPage;
    157       frm.cmd.value = 'DeleteItems';
    158       frm.submit();
    159     }
    160     function restoreItems()
    161     {
    162       var frm = document.forms[formId];
    163       if (Forms.numChecked(frm) == 0)
    164       {
    165         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    166         return;
    167       }
    168       frm.action = submitPage;
    169       frm.cmd.value = 'RestoreItems';
    170       frm.submit();
    171     }
    172     function configureColumns()
    173     {
    174       Table.configureColumns(formId);
    175     }
    176     function runPlugin(cmd)
    177     {
    178       Table.submitToPopup(formId, cmd, 750, 500);
    179     }
    180     function returnSelected()
    181     {
    182       Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>);
    183       window.close();
    184     }
    185     </script>
    186129  </base:head>
    187130 
     
    191134    <div class="content">
    192135    <tbl:table
    193       id="bioPlateTypes"
     136      id="bioplatetypes"
    194137      columns="<%=cc.getSetting("columns")%>"
    195138      sortby="<%=cc.getSortProperty()%>"
     
    293236          >
    294237          <tbl:button
     238            id="btnNewItem"
    295239            disabled="<%=!createPermission%>"
    296240            image="new.png"
    297             onclick="newItem()"
    298241            title="New&hellip;"
    299242            tooltip="<%=createPermission ? "Create new bioplate type" : "You do not have permission to create bioplate types"%>"
    300243          />
    301244          <tbl:button
     245            id="btnDeleteItems"
    302246            image="delete.png"
    303             onclick="deleteItems()"
    304247            title="Delete"
    305248            tooltip="Delete the selected items"
    306249          />
    307250          <tbl:button
     251            id="btnRestoreItems"
    308252            image="restore.png"
    309             onclick="restoreItems()"
    310253            title="Restore"
    311254            tooltip="Restore the selected (deleted) items"
    312255          />
    313256          <tbl:button
     257            id="btnColumns"
    314258            image="columns.png"
    315             onclick="configureColumns()"
    316259            title="Columns&hellip;"
    317260            tooltip="Show, hide and re-order columns"
    318261          />
    319262          <tbl:button
     263            id="btnImport"
     264            data-plugin-type="IMPORT"
    320265            image="import.png"
    321             onclick="runPlugin('ImportItems')"
    322266            title="Import&hellip;"
    323267            tooltip="Import data"
     
    325269          />
    326270          <tbl:button
     271            id="btnExport"
     272            data-plugin-type="EXPORT"
    327273            image="export.png"
    328             onclick="runPlugin('ExportItems')"
    329274            title="Export&hellip;"
    330275            tooltip="Export data"
     
    332277          />
    333278          <tbl:button
     279            id="btnRunPlugin"
     280            data-plugin-type="OTHER"
    334281            image="runplugin.png"
    335             onclick="runPlugin('RunListPlugin')"
    336282            title="Run plugin&hellip;"
    337283            tooltip="Run a plugin"
     
    442388                    visible="<%=item.isRemoved()%>"
    443389                  />&nbsp;</tbl:header>
    444                 <tbl:cell column="name"><div class="link"
    445                   onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)"
     390                <tbl:cell column="name"><div
     391                  class="link table-item"
     392                  data-item-id="<%=itemId%>"
     393                  data-no-edit="<%=writePermission ? 0 : 1 %>"
     394                  tabindex="0"
    446395                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
    447396                <tbl:cell column="id"><%=item.getId()%></tbl:cell>
     
    485434   
    486435    <base:buttongroup subclass="dialogbuttons">
    487       <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" />
    488       <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
    489       <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" />
     436      <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" />
     437      <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
     438      <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" />
    490439    </base:buttongroup>
    491440
  • trunk/www/biomaterials/events/list_events.jsp

    r6221 r6260  
    126126  ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext);
    127127  %>
    128   <base:page title="<%=title%>" type="<%=mode.getPageType()%>">
    129   <base:head scripts="table.js,tabcontrol.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">
     128  <base:page title="<%=title%>" type="<%=mode.getPageType()%>" id="list-page">
     129  <base:head scripts="table.js,tabcontrol-2.js,~events.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">
    130130    <ext:scripts context="<%=jspContext%>" />
    131131    <ext:stylesheets context="<%=jspContext%>" />
    132     <script>
    133     var submitPage = 'index.jsp';
    134     var formId = 'events';
    135     function newItem()
    136     {
    137       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', 0, true, '&biomaterial_type=<%=bioMaterialType.name()%>&biomaterial_id=<%=bioMaterial.getId()%>');
    138     }
    139     function editItem(itemId)
    140     {
    141       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true, '&biomaterial_type=<%=bioMaterialType.name()%>&biomaterial_id=<%=bioMaterial.getId()%>');
    142     }
    143     function viewItem(itemId)
    144     {
    145       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false, '&biomaterial_type=<%=bioMaterialType.name()%>&biomaterial_id=<%=bioMaterial.getId()%>');
    146     }
    147     function itemOnClick(evt, itemId)
    148     {
    149       Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected);
    150     }
    151     function deleteItems()
    152     {
    153       var frm = document.forms[formId];
    154       var numChecked = Forms.numChecked(frm);
    155       if (numChecked == 0)
    156       {
    157         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    158         return;
    159       }
    160       else
    161       {
    162         var rep = numChecked == 1 ? 'event' : 'events';
    163         if (!confirm('You are about to delete '+numChecked+' '+rep+'. This can\'t be undone. Continue?'))
    164         {
    165           return;
    166         }
    167       }
    168       frm.action = submitPage;
    169       frm.cmd.value = 'DeleteItems';
    170       frm.submit();
    171     }
    172     function configureColumns()
    173     {
    174       Table.configureColumns(formId);
    175     }
    176     function runPlugin(cmd)
    177     {
    178       Table.submitToPopup(formId, cmd, 750, 500);
    179     }
    180     function returnSelected()
    181     {
    182       Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>);
    183       window.close();
    184     }
    185     function switchTab(tabControlId, tabId)
    186     {
    187       if (tabId == 'properties' || tabId == 'annotations' || tabId == 'overview' || tabId == 'history')
    188       {
    189         location.href = '<%=viewPage%>?ID=<%=ID%>&cmd=ViewItem&item_id=<%=bioMaterialId%>&tab='+tabId;
    190       }
    191       else
    192       {
    193         TabControl.setActiveTab(tabControlId, tabId);
    194       }
    195     }
    196     </script>
    197132  </base:head>
    198133 
     
    206141      id="main"
    207142      subclass="mastertabcontrol content"
    208       active="events" switch="switchTab">
     143      active="events">
    209144    <t:tab id="properties" title="Properties" />
    210145    <t:tab id="annotations" title="Annotations &amp; parameters"
     
    347282          >
    348283          <tbl:button
     284            id="btnNewItem"
     285            data-extra-url="<%="&biomaterial_type="+bioMaterialType.name()+"&biomaterial_id="+bioMaterialId%>"
    349286            disabled="<%=!createPermission%>"
    350287            image="new.png"
    351             onclick="newItem()"
    352288            title="New&hellip;"
    353289            tooltip="<%=createPermission ? "Create new event" : "You do not have permission to create events"%>"
    354290          />
    355291          <tbl:button
     292            id="btnDeleteItems"
    356293            disabled="<%=!deletePermission%>"
    357294            image="delete.png"
    358295            title="Delete&hellip;"
    359             onclick="deleteItems()"
     296            data-confirm="1"
    360297            tooltip="<%=deletePermission ? "Delete the selected events" : "You do not have permission to delete events"%>"
    361298          />
    362299          <tbl:button
     300            id="btnColumns"
    363301            image="columns.png"
    364             onclick="configureColumns()"
    365302            title="Columns&hellip;"
    366303            tooltip="Show, hide and re-order columns"
    367304          />
    368305          <tbl:button
     306            id="btnImport"
     307            data-plugin-type="IMPORT"
    369308            image="import.png"
    370             onclick="runPlugin('ImportItems')"
    371309            title="Import&hellip;"
    372310            tooltip="Import data"
     
    374312          />
    375313          <tbl:button
     314            id="btnExport"
     315            data-plugin-type="EXPORT"
    376316            image="export.png"
    377             onclick="runPlugin('ExportItems')"
    378317            title="Export&hellip;"
    379318            tooltip="Export data"
     
    381320          />
    382321          <tbl:button
     322            id="btnRunPlugin"
     323            data-plugin-type="OTHER"
    383324            image="runplugin.png"
    384             onclick="runPlugin('RunListPlugin')"
    385325            title="Run plugin&hellip;"
    386326            tooltip="Run a plugin"
     
    448388              BioMaterialEvent.Type eventType = item.getEventType();
    449389              int itemId = item.getId();
     390              boolean writePermission = item.hasPermission(Permission.WRITE);
     391              String tooltip = mode.isSelectionMode() ?
     392                "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : "");
    450393              String name = "TODO";
    451394              index++;
     
    484427                  if (eventType == BioMaterialEvent.Type.OTHER)
    485428                  {
    486                     if (item.hasPermission(Permission.WRITE))
    487                     {
    488                       %>
    489                       <div class="link" onclick="itemOnClick(event, <%=itemId%>)"><%=eventType%></div>
    490                       <%
    491                     }
    492                     else
    493                     {
    494                       %>
    495                       <div class="link" onclick="viewItem(<%=itemId%>)"><%=eventType%></div>
    496                       <%
    497                     }
     429                    %>
     430                    <div
     431                      class="link table-item"
     432                      data-item-id="<%=itemId%>"
     433                      data-no-edit="<%=writePermission ? 0 : 1 %>"
     434                      data-extra-url="&biomaterial_type=<%=bioMaterialType.name()%>&biomaterial_id=<%=bioMaterialId%>"
     435                      tabindex="0"
     436                      title="<%=tooltip%>"><%=eventType%></div>
     437                    <%
    498438                  }
    499439                  else if (eventType == BioMaterialEvent.Type.CREATION)
     
    502442                    {
    503443                      %>
    504                       <div class="link" onclick="viewItem(<%=itemId%>)">
    505                       Created
    506                       </div>
     444                      <div
     445                        class="link table-item"
     446                        data-item-id="<%=itemId%>"
     447                        data-no-edit="1"
     448                        data-extra-url="&biomaterial_type=<%=bioMaterialType.name()%>&biomaterial_id=<%=bioMaterialId%>"
     449                        tabindex="0"
     450                        title="View this item">Created</div>
    507451                      <%
    508452                    }
     
    517461                      {}
    518462                      %>
    519                       <div class="link" onclick="viewItem(<%=itemId%>)">
    520                       Created <%=child == null ? "child" : child.getType().toString().toLowerCase() %>: <base:propertyvalue
     463                      <div
     464                        class="link table-item"
     465                        data-item-id="<%=itemId%>"
     466                        data-no-edit="1"
     467                        data-extra-url="&biomaterial_type=<%=bioMaterialType.name()%>&biomaterial_id=<%=bioMaterialId%>"
     468                        tabindex="0"
     469                        title="View this item">
     470                        Created <%=child == null ? "child" : child.getType().toString().toLowerCase() %>: <base:propertyvalue
    521471                            item="<%=item%>"
    522472                            property="bioMaterial"
     
    524474                            enablePropertyLink="<%=false%>"
    525475                          />
    526                       </div>
     476                        </div>
    527477                      <%
    528478                    }
     
    531481                  {
    532482                    %>
    533                     <div class="link" onclick="viewItem(<%=itemId%>)">
    534                     Bioassay: <base:propertyvalue
    535                               item="<%=item%>"
    536                               property="physicalBioAssay"
    537                               enableEditLink="<%=false%>"
    538                               enablePropertyLink="<%=false%>"
    539                             />
     483                    <div
     484                      class="link table-item"
     485                      data-item-id="<%=itemId%>"
     486                      data-no-edit="1"
     487                      data-extra-url="&biomaterial_type=<%=bioMaterialType.name()%>&biomaterial_id=<%=bioMaterialId%>"
     488                      tabindex="0"
     489                      title="View this item">
     490                        Bioassay: <base:propertyvalue
     491                            item="<%=item%>"
     492                            property="physicalBioAssay"
     493                            enableEditLink="<%=false%>"
     494                            enablePropertyLink="<%=false%>"
     495                          />
    540496                    </div>
    541497                    <%
  • trunk/www/biomaterials/extracts/list_extracts.jsp

    r6221 r6260  
    168168  ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext);
    169169  %>
    170   <base:page title="<%=title==null ? "Extracts" : title%>" type="<%=mode.getPageType()%>">
    171   <base:head scripts="table.js" styles="table.css,toolbar.css">
     170  <base:page title="<%=title==null ? "Extracts" : title%>" type="<%=mode.getPageType()%>" id="list-page">
     171  <base:head scripts="table.js,~extracts.js" styles="table.css,toolbar.css">
    172172    <ext:scripts context="<%=jspContext%>" />
    173173    <ext:stylesheets context="<%=jspContext%>" />
    174174    <script>
     175    /*
    175176    var submitPage = 'index.jsp';
    176177    var formId = 'extracts';
     
    261262      Table.submitToPopup(formId, 'PlaceOnPlate', 900, 600);
    262263    }
     264    */
    263265    </script>
    264266  </base:head>
     
    555557        >
    556558        <tbl:button
     559          id="btnNewItem"
    557560          disabled="<%=!createPermission%>"
    558561          image="new.png"
    559           onclick="newItem()"
    560562          title="New&hellip;"
    561563          tooltip="<%=createPermission ? "Create new extract" : "You do not have permission to create extracts"%>"
    562564        />
    563565        <tbl:button
     566          id="btnNewPooledItem"
    564567          disabled="<%=!createPermission%>"
    565568          image="new_pooled.png"
    566           onclick="newPooledItem()"
    567569          title="Pool&hellip;"
    568570          tooltip="<%=createPermission ? "Create new pooled extract" : "You do not have permission to create extracts"%>"
    569571        />
    570572        <tbl:button
     573          id="btnNewPhysicalBioAssay"
    571574          disabled="<%=createBioAssayPermission ? false : true%>"
    572575          image="add.png"
    573           onclick="newPhysicalBioAssay()"
    574576          title="New physical bioassay&hellip;"
    575577          tooltip="<%=createBioAssayPermission ? "Create new bioassay with the selected extracts" : "You do not have permission to create bioassays"%>"
    576578        />
    577579        <tbl:button
     580          id="btnDeleteItems"
    578581          image="delete.png"
    579           onclick="deleteItems()"
    580582          title="Delete"
    581583          tooltip="Delete the selected items"
    582584        />
    583585        <tbl:button
     586          id="btnRestoreItems"
    584587          image="restore.png"
    585           onclick="restoreItems()"
    586588          title="Restore"
    587589          tooltip="Restore the selected (deleted) items"
    588590        />
    589591        <tbl:button
     592          id="btnShareItems"
    590593          image="share.png"
    591           onclick="shareItems()"
    592594          title="Share&hellip;"
    593595          tooltip="Share the selected items"
    594596        />
    595597        <tbl:button
     598          id="btnSetOwner"
    596599          image="take_ownership.png"
    597           onclick="setOwner()"
    598600          title="Set owner&hellip;"
    599601          tooltip="Change owner of the selected items"
    600602        />
    601603        <tbl:button
     604          id="btnColumns"
    602605          image="columns.png"
    603           onclick="configureColumns()"
    604606          title="Columns&hellip;"
    605607          tooltip="Show, hide and re-order columns"
    606608        />
    607609        <tbl:button
     610          id="btnNewBioMaterialList"
    608611          image="add.png"
    609           onclick="newBioMaterialList()"
    610612          title="New biomaterial list&hellip;"
    611613          tooltip="Create a new biomaterial list from matching extracts"
     
    613615        />
    614616        <tbl:button
     617          id="btnPlaceOnPlate"
    615618          image="place_on_plate.png"
    616           onclick="placeOnPlate()"
    617619          title="Place on plate&hellip;"
    618620          tooltip="Place the selected/matching extracts on a bioplate"
    619621        />
    620622        <tbl:button
     623          id="btnImport"
     624          data-plugin-type="IMPORT"
    621625          image="import.png"
    622           onclick="runPlugin('ImportItems')"
    623626          title="Import&hellip;"
    624627          tooltip="Import data"
     
    626629        />
    627630        <tbl:button
     631          id="btnExport"
     632          data-plugin-type="EXPORT"
    628633          image="export.png"
    629           onclick="runPlugin('ExportItems')"
    630634          title="Export&hellip;"
    631635          tooltip="Export data"
     
    633637        />
    634638        <tbl:button
     639          id="btnRunPlugin"
     640          data-plugin-type="OTHER"
    635641          image="runplugin.png"
    636           onclick="runPlugin('RunListPlugin')"
    637642          title="Run plugin&hellip;"
    638643          tooltip="Run a plugin"
     
    755760                    visible="<%=item.isShared()%>"
    756761                  />&nbsp;</tbl:header>
    757                 <tbl:cell column="name"><div class="link"
    758                   onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)"
     762                <tbl:cell column="name"><div
     763                  class="link table-item"
     764                  data-item-id="<%=itemId%>"
     765                  data-no-edit="<%=writePermission ? 0 : 1 %>"
     766                  tabindex="0"
    759767                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
    760768                <tbl:cell column="id"><%=item.getId()%></tbl:cell>
     
    849857                  %>
    850858                  <base:icon
     859                    id="<%="newextract."+itemId%>"
    851860                    image="add.png"
    852                     onclick="<%="newExtract("+itemId+")"%>"
     861                    subclass="auto-init"
     862                    data-auto-init="new-extract"
     863                    data-item-id="<%=itemId %>"
    853864                    tooltip="Create new child extract"
    854865                    visible="<%=mode.hasEditLink() && createPermission && usePermission %>"
     
    911922                  %>
    912923                  <base:icon
     924                    id="<%="newRawBioAssay."+itemId%>"
    913925                    image="add.png"
    914                     onclick="<%="newRawBioAssay("+itemId+")"%>"
     926                    subclass="auto-init"
     927                    data-auto-init="new-raw-bioassay"
     928                    data-item-id="<%=itemId %>"
    915929                    tooltip="Create new raw bioassay from this extract"
    916930                    visible="<%=mode.hasEditLink() && createRawBioAssayPermission && usePermission %>"
     
    10311045    </div>
    10321046    <base:buttongroup subclass="dialogbuttons">
    1033       <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" />
    1034       <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
    1035       <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" />
     1047      <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" />
     1048      <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
     1049      <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" />
    10361050    </base:buttongroup>
    10371051   
  • trunk/www/biomaterials/lists/list_lists.jsp

    r6221 r6260  
    9898  ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext);
    9999  %>
    100   <base:page title="<%=title==null ? "Biomaterial lists" : title%>" type="<%=mode.getPageType()%>">
    101   <base:head scripts="table.js" styles="table.css,toolbar.css">
     100  <base:page title="<%=title==null ? "Biomaterial lists" : title%>" type="<%=mode.getPageType()%>" id="list-page">
     101  <base:head scripts="table.js,~lists.js" styles="table.css,toolbar.css">
    102102    <ext:scripts context="<%=jspContext%>" />
    103103    <ext:stylesheets context="<%=jspContext%>" />
    104     <script>
    105     var submitPage = 'index.jsp';
    106     var formId = 'lists';
    107     function newItem()
    108     {
    109       var controller = Main.getController('BIOMATERIALLIST');
    110       Table.submitToPopup(formId, 'NewItem', controller.width, controller.height);
    111     }
    112     function editItem(itemId)
    113     {
    114       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true);
    115     }
    116     function viewItem(itemId)
    117     {
    118       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false);
    119     }
    120     function itemOnClick(evt, itemId)
    121     {
    122       Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected);
    123     }
    124     function deleteItems()
    125     {
    126       var frm = document.forms[formId];
    127       if (Forms.numChecked(frm) == 0)
    128       {
    129         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    130         return;
    131       }
    132       frm.action = submitPage;
    133       frm.cmd.value = 'DeleteItems';
    134       frm.submit();
    135     }
    136     function restoreItems()
    137     {
    138       var frm = document.forms[formId];
    139       if (Forms.numChecked(frm) == 0)
    140       {
    141         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    142         return;
    143       }
    144       frm.action = submitPage;
    145       frm.cmd.value = 'RestoreItems';
    146       frm.submit();
    147     }
    148     function setOwner()
    149     {
    150       Table.setOwnerOfItems(formId);
    151     }
    152     function shareItems()
    153     {
    154       Table.shareItems(formId);
    155     }
    156     function configureColumns()
    157     {
    158       Table.configureColumns(formId);
    159     }
    160     function runPlugin(cmd)
    161     {
    162       Table.submitToPopup(formId, cmd, 750, 500);
    163     }
    164     function returnSelected()
    165     {
    166       Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>);
    167       window.close();
    168     }
    169     </script>
    170104  </base:head>
    171105 
     
    280214          >
    281215          <tbl:button
     216            id="btnNewItem"
    282217            disabled="<%=!createPermission%>"
    283218            image="new.png"
    284             onclick="newItem()"
    285219            title="New&hellip;"
    286220            tooltip="<%=createPermission ? "Create new biomaterial list" : "You do not have permission to create biomaterial lists"%>"
    287221          />
    288222          <tbl:button
     223            id="btnDeleteItems"
    289224            image="delete.png"
    290             onclick="deleteItems()"
    291225            title="Delete"
    292226            tooltip="Delete the selected items"
    293227          />
    294228          <tbl:button
     229            id="btnRestoreItems"
    295230            image="restore.png"
    296             onclick="restoreItems()"
    297231            title="Restore"
    298232            tooltip="Restore the selected (deleted) items"
    299233          />
    300234          <tbl:button
     235            id="btnShareItems"
    301236            image="share.png"
    302             onclick="shareItems()"
    303237            title="Share&hellip;"
    304238            tooltip="Share the selected items"
    305239          />
    306240          <tbl:button
     241            id="btnSetOwner"
    307242            image="take_ownership.png"
    308             onclick="setOwner()"
    309243            title="Set owner&hellip;"
    310244            tooltip="Change owner of the selected items"
    311245          />
    312246          <tbl:button
     247            id="btnColumns"
    313248            image="columns.png"
    314             onclick="configureColumns()"
    315249            title="Columns&hellip;"
    316250            tooltip="Show, hide and re-order columns"
    317251          />
    318252          <tbl:button
     253            id="btnImport"
     254            data-plugin-type="IMPORT"
    319255            image="import.png"
    320             onclick="runPlugin('ImportItems')"
    321256            title="Import&hellip;"
    322257            tooltip="Import data"
     
    324259          />
    325260          <tbl:button
     261            id="btnExport"
     262            data-plugin-type="EXPORT"
    326263            image="export.png"
    327             onclick="runPlugin('ExportItems')"
    328264            title="Export&hellip;"
    329265            tooltip="Export data"
     
    331267          />
    332268          <tbl:button
     269            id="btnRunPlugin"
     270            data-plugin-type="OTHER"
    333271            image="runplugin.png"
    334             onclick="runPlugin('RunListPlugin')"
    335272            title="Run plugin&hellip;"
    336273            tooltip="Run a plugin"
     
    451388                    visible="<%=item.isShared()%>"
    452389                  />&nbsp;</tbl:header>
    453                 <tbl:cell column="name"><div class="link"
    454                   onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)"
     390                <tbl:cell column="name"><div
     391                  class="link table-item"
     392                  data-item-id="<%=itemId%>"
     393                  data-no-edit="<%=writePermission ? 0 : 1 %>"
     394                  tabindex="0"
    455395                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
    456396                <tbl:cell column="id"><%=item.getId()%></tbl:cell>
     
    509449   
    510450    <base:buttongroup subclass="dialogbuttons">
    511       <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" />
    512       <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
    513       <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" />
     451      <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" />
     452      <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
     453      <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" />
    514454    </base:buttongroup>
    515455   
  • trunk/www/biomaterials/lists/members/list_members.jsp

    r6221 r6260  
    110110  %>
    111111  <base:page title="<%=title%>" type="<%=mode.getPageType()%>">
    112   <base:head scripts="table.js,tabcontrol.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">
     112  <base:head scripts="table.js,tabcontrol-2.js,~members.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">
    113113    <ext:scripts context="<%=jspContext%>" />
    114114    <ext:stylesheets context="<%=jspContext%>" />
    115115    <script>
    116     var submitPage = 'index.jsp';
    117     var formId = 'members';
    118     function editItem(itemId)
    119     {
    120       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true);
    121     }
    122     function viewItem(itemId)
    123     {
    124       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false);
    125     }
    126     function itemOnClick(evt, itemId)
    127     {
    128       Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected);
    129     }
    130     function addItems()
    131     {
    132       Main.openPopup('add_members_frameset.jsp?ID=<%=ID%>&list_id=<%=bioMaterialListId%>', 'AddMembers', 1050, 700);
    133     }
    134     function removeItems()
    135     {
    136       var frm = document.forms[formId];
    137       var numChecked = Forms.numChecked(frm);
    138       if (numChecked == 0)
    139       {
    140         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    141         return;
    142       }
    143       else
    144       {
    145         if (!confirm('You are about to remove '+numChecked+' item(s) from the list. Continue?'))
    146         {
    147           return;
    148         }
    149       }
    150       frm.action = submitPage;
    151       frm.cmd.value = 'RemoveMembers';
    152       frm.submit();
    153     }
    154     function deleteItems()
    155     {
    156       var frm = document.forms[formId];
    157       if (Forms.numChecked(frm) == 0)
    158       {
    159         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    160         return;
    161       }
    162       frm.action = submitPage;
    163       frm.cmd.value = 'DeleteItems';
    164       frm.submit();
    165     }
    166     function restoreItems()
    167     {
    168       var frm = document.forms[formId];
    169       if (Forms.numChecked(frm) == 0)
    170       {
    171         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    172         return;
    173       }
    174       frm.action = submitPage;
    175       frm.cmd.value = 'RestoreItems';
    176       frm.submit();
    177     }
    178     function configureColumns()
    179     {
    180       Table.configureColumns(formId);
    181     }
    182     function setOwner()
    183     {
    184       Table.setOwnerOfItems(formId);
    185     }
    186     function shareItems()
    187     {
    188       Table.shareItems(formId);
    189     }
    190     function runPlugin(cmd)
    191     {
    192       Table.submitToPopup(formId, cmd, 750, 500);
    193     }
    194     function returnSelected()
    195     {
    196       Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>);
    197       window.close();
    198     }
    199     function switchTab(tabControlId, tabId)
    200     {
    201       if (tabId == 'properties' || tabId == 'overview')
    202       {
    203         location.href = '../index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id=<%=bioMaterialListId%>&tab='+tabId;
    204       }
    205       else
    206       {
    207         TabControl.setActiveTab(tabControlId, tabId);
    208       }
    209     }
     116
    210117    function placeOnPlate()
    211118    {
     
    220127      /><p:pathelement title="<%=HTML.encodeTags(list.getName())%>"
    221128      /></p:path>
    222  
     129    <div id="page-data" class="datacontainer"
     130      data-item-type="<%=itemType.name()%>"
     131      ></div>
    223132    <t:tabcontrol
    224133      id="main"
    225134      subclass="content mastertabcontrol"
    226       active="members" switch="switchTab">
     135      active="members">
    227136    <t:tab id="properties" title="Properties" />
    228137   
     
    355264          >
    356265          <tbl:button
     266            id="btnAddMembers"
    357267            disabled="<%=addPermission ? false : true%>"
    358268            image="add.png"
    359             onclick="addItems()"
    360269            title="Add&hellip;"
    361270            tooltip="<%=addPermission ? "Add more biomaterials to this list" : "You do not have permission to add biomaterial" %>"
    362271          />
    363272          <tbl:button
     273            id="btnRemoveMembers"
    364274            disabled="<%=removePermission ? false : true%>"
    365275            image="remove.png"
    366             onclick="removeItems()"
    367276            title="Remove&hellip;"
    368277            tooltip="<%=removePermission ? "Remove the selected items from this list" : "You do not have permission to remove items" %>"
    369278          />
    370279          <tbl:button
     280            id="btnDeleteItems"
    371281            image="delete.png"
    372             onclick="deleteItems()"
    373282            title="Delete"
    374283            tooltip="Delete the selected items"
    375284          />
    376285          <tbl:button
     286            id="btnRestoreItems"
    377287            image="restore.png"
    378             onclick="restoreItems()"
    379288            title="Restore"
    380289            tooltip="Restore the selected (deleted) items"
    381290          />
    382291          <tbl:button
     292            id="btnShareItems"
    383293            image="share.png"
    384             onclick="shareItems()"
    385294            title="Share&hellip;"
    386295            tooltip="Share the selected items"
    387296          />
    388297          <tbl:button
     298            id="btnSetOwner"
    389299            image="take_ownership.png"
    390             onclick="setOwner()"
    391300            title="Set owner&hellip;"
    392301            tooltip="Change owner of the selected items"
    393302          />
    394303          <tbl:button
     304            id="btnColumns"
    395305            image="columns.png"
    396             onclick="configureColumns()"
    397306            title="Columns&hellip;"
    398307            tooltip="Show, hide and re-order columns"
    399308          />
    400309          <tbl:button
     310            id="btnPlaceOnPlate"
    401311            image="place_on_plate.png"
    402             onclick="placeOnPlate()"
    403312            title="Place on plate&hellip;"
    404313            tooltip="Place the selected/matching biomaterial on a bioplate"
     
    406315          />
    407316          <tbl:button
     317            id="btnImport"
     318            data-plugin-type="IMPORT"
    408319            image="import.png"
    409             onclick="runPlugin('ImportItems')"
    410320            title="Import&hellip;"
    411321            tooltip="Import data"
     
    413323          />
    414324          <tbl:button
     325            id="btnExport"
     326            data-plugin-type="EXPORT"
    415327            image="export.png"
    416             onclick="runPlugin('ExportItems')"
    417328            title="Export&hellip;"
    418329            tooltip="Export data"
     
    420331          />
    421332          <tbl:button
     333            id="btnRunPlugin"
     334            data-plugin-type="OTHER"
    422335            image="runplugin.png"
    423             onclick="runPlugin('RunListPlugin')"
    424336            title="Run plugin&hellip;"
    425337            tooltip="Run a plugin"
     
    539451                    visible="<%=item.isShared()%>"
    540452                  />&nbsp;</tbl:header>
    541                 <tbl:cell column="name"><div class="link"
    542                   onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)"
     453                <tbl:cell column="name"><div
     454                  class="link table-item"
     455                  data-item-id="<%=itemId%>"
     456                  data-no-edit="<%=writePermission ? 0 : 1 %>"
     457                  tabindex="0"
    543458                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
    544459                <tbl:cell column="id"><%=item.getId()%></tbl:cell>
     
    621536
    622537    <base:buttongroup subclass="dialogbuttons">
    623       <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" />
    624       <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
    625       <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" />
     538      <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" />
     539      <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
     540      <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" />
    626541    </base:buttongroup>
    627542
  • trunk/www/biomaterials/samples/edit_sample.jsp

    r6246 r6260  
    263263  ExtensionsInvoker invoker = EditUtil.useEditExtensions(jspContext);
    264264  %>
    265   <base:page type="popup" title="<%=title%>">
    266   <base:head scripts="tabcontrol.js,linkitems.js,subtypes.js" styles="tabcontrol.css">
     265  <base:page type="popup" title="<%=title%>" id="edit-page">
     266  <base:head scripts="tabcontrol-2.js,linkitems.js,subtypes.js,~samples.js" styles="tabcontrol.css">
    267267    <ext:scripts context="<%=jspContext%>" />
    268268    <ext:stylesheets context="<%=jspContext%>" />
    269269    <script>
    270     // Validate the "Sample" tab
    271     function validateSample()
    272     {
    273       var frm = document.forms['sample'];
    274       if (Main.trimString(frm.name.value) == '')
    275       {
    276         Forms.showNotification(frm.name, 'You must enter a name');
    277         return false;
    278       }
    279       if (Main.trimString(frm.bioplate_id.value) != 0 && Main.trimString(frm.biowell_id.value) == 0)
    280       {
    281         Forms.showNotification('biowell_id.select', 'You must choose a biowell from the bioplate');
    282         return false;
    283       }
    284       return true;
    285     }
    286 
    287     // Submit the form
    288     function saveSettings()
    289     {
    290       var frm = document.forms['sample'];
    291       if (TabControl.validateActiveTab('settings'))
    292       {
    293         Annotations.saveModifiedAnnotationsToForm(frm);
    294         Annotations.saveInheritedAnnotationsToForm(frm);
    295         frm.modifiedSamples.value = Link.exportModified(frm, 'S', true).join(',');
    296         frm.removedSamples.value = Link.getActionIds(-1, 'S').join(',');
    297         frm.submit();
    298       }
    299     }
    300    
    301     function loadAnnotationsFrame()
    302     {
    303       Annotations.autoLoadEditFrame(getProtocolId(), ItemSubtype.getSubtypeId('sample'));
    304     }
    305    
    306     function loadInheritedAnnotationsFrame()
    307     {
    308       Annotations.autoLoadInheritFrame(getParents());
    309     }
    310    
    311     function getProtocolId()
    312     {
    313       var frm = document.forms['sample'];
    314       var protocolId = 0;
    315       if (frm.protocol_id.length > 0 && !frm.protocol_id.disabled)
    316       {
    317         protocolId = Math.abs(parseInt(frm.protocol_id[frm.protocol_id.selectedIndex].value));       
    318       }
    319       return protocolId;
    320     }
     270   
    321271   
    322272    function getParents()
     
    340290    }
    341291   
    342     function subtypeOnChange()
    343     {
    344       var frm = document.forms['sample'];
    345       var subtypeId = ItemSubtype.getSubtypeId('sample');
    346       var recentInfo = ItemSubtype.getRecentAndRelatedInfo(subtypeId, 'SAMPLE', ['PROTOCOL', 'BIOPLATE', 'BIOSOURCE', 'SAMPLE']);
    347       ItemSubtype.updateSelectionList(frm.protocol_id, recentInfo.PROTOCOL['recent'], recentInfo.PROTOCOL['default']);
    348       ItemSubtype.updateSelectionList(frm.bioplate_id, recentInfo.BIOPLATE['recent']);
    349     }
    350    
    351     function selectProtocolOnClick()
    352     {
    353       var frm = document.forms['sample'];
    354       var url = '../../admin/protocols/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone';
    355       url += '&callback=setProtocolCallback&resetTemporary=1';
    356       url += ItemSubtype.createRelatedFilter('sample', 'PROTOCOL', <%=SystemItems.getId(Protocol.SAMPLING)%>);
    357       if (frm.protocol_id.length > 1)
    358       {
    359         var id = Math.abs(parseInt(frm.protocol_id[1].value));       
    360         url += '&item_id='+id;
    361       }
    362       Main.openPopup(url, 'SelectProtocol', 1050, 700);
    363     }
    364     function setProtocolCallback(id, name)
    365     {
    366       var frm = document.forms['sample'];
    367       var list = frm.protocol_id;
    368       if (list.length < 2 || list[1].value == '0') // >
    369       {
    370         Forms.addListOption(list, 1, new Option());
    371       }
    372       list[1].value = id;
    373       list[1].text = name;
    374       list.selectedIndex = 1;
    375     }
    376 
    377     function selectBioPlateOnClick()
    378     {
    379       var frm = document.forms['sample'];
    380       var url = '../bioplates/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setBioPlateCallback';
    381       if (frm.bioplate_id.length > 1)
    382       {
    383         var id = Math.abs(parseInt(frm.bioplate_id[1].value));       
    384         url += '&item_id='+id;
    385       }
    386       url += '&resetTemporary=1&tmpfilter:INT:bioPlateType.lockMode=<><%=BioWell.LockMode.LOCKED_AFTER_CREATE.getValue()%>';
    387       // Restrict to plates that can holds samples
    388       url += '&tmpfilter:INT:bioPlateType.bioMaterialType=|<%=itemType.getValue()%>';
    389       var subtypeId = ItemSubtype.getSubtypeId('sample');
    390       // Restrict to plates with the given subtype
    391       url += '&tmpfilter:INT:bioPlateType.itemSubtype='+(subtypeId ? '|' + subtypeId : '=');
    392       url += '&tmpfilter:BOOLEAN:destroyed=false';
    393       Main.openPopup(url, 'SelectBioplate', 1050, 700);
    394     }
    395     function setBioPlateCallback(id, name)
    396     {
    397       var frm = document.forms['sample'];
    398       var list = frm.bioplate_id;
    399       if (list.length < 2 || list[1].value == '0') // >
    400       {
    401         Forms.addListOption(list, 1, new Option());
    402       }
    403       list[1].value = id;
    404       list[1].text = name;
    405       list.selectedIndex = 1;
    406       frm.biowell_id.remove(1);
    407       frm.biowell_id.disabled = false;
    408     }
     292
    409293    function bioPlateOnChange()
    410294    {
     
    611495    <input type="hidden" name="cmd" value="UpdateItem">
    612496
     497    <div id="page-data" class="datacontainer"
     498      data-sampling-protocoltype-id="<%=SystemItems.getId(Protocol.SAMPLING)%>"
     499    ></div>
     500
    613501    <t:tabcontrol id="settings"
    614502      subclass="content dialogtabcontrol"
    615503      position="bottom"  remember="<%=sample != null%>"
    616504      extensions="<%=invoker%>">
    617     <t:tab id="info" title="Sample" validate="validateSample()" helpid="sample.edit">
     505    <t:tab id="info" title="Sample" helpid="sample.edit">
    618506      <table class="fullform input100">
    619507      <tr>
    620508        <th>Name</th>
    621         <td><input class="text required" type="text" name="name"
     509        <td><input class="text required auto-init" data-auto-init="<%=sample == null ? "focus-select" : "focus" %>"
     510          type="text" name="name"
    622511          value="<%=HTML.encodeTags(name)%>"
    623512          maxlength="<%=Sample.MAX_NAME_LENGTH%>"></td>
     
    627516        <th>Type</th>
    628517        <td>
    629           <select name="subtype_id"
     518          <select name="subtype_id" id="subtype_id"
    630519            <%=!readCurrentSubtype ? "disabled readonly class=\"disabled selectionlist\"" : "class=\"selectionlist\""%>
    631             onchange="subtypeOnChange()"
    632520            >
    633521          <%
     
    713601            defaultitems="<%=defaultProtocols%>"
    714602            newitem="<%=sample == null%>"
    715             onselect="selectProtocolOnClick()"
    716603            disabled="<%=lockEventProperties %>"
    717604          />
     
    730617            recent="<%=recentBioPlates%>"
    731618            newitem="<%=sample == null%>"
    732             onselect="selectBioPlateOnClick()"
    733619            onchange="bioPlateOnChange()"
    734620            disabled="<%=lockedWell%>"
     
    853739    </t:tab>
    854740
    855     <t:tab id="annotations" title="Annotations &amp; parameters" helpid="annotations.edit" activate="loadAnnotationsFrame()">
     741    <t:tab id="annotations" title="Annotations &amp; parameters" helpid="annotations.edit">
    856742      <jsp:include page="../../common/annotations/annotate_frameset.jsp">
    857743        <jsp:param name="item_type" value="<%=itemType.name()%>" />
     
    862748   
    863749    <t:tab id="inheritedAnnotations" title="Inherited annotations"
    864       helpid="annotations.edit.inherited" activate="loadInheritedAnnotationsFrame()">
     750      helpid="annotations.edit.inherited">
    865751      <jsp:include page="../../common/annotations/inherit_frameset.jsp">
    866752        <jsp:param name="item_type" value="<%=itemType.name()%>" />
     
    877763
    878764    <base:buttongroup subclass="dialogbuttons">
    879       <base:button onclick="saveSettings()" title="Save" />
    880       <base:button onclick="window.close()" title="Cancel" />
     765      <base:button id="btnSave" title="Save" />
     766      <base:button id="close" title="Cancel" />
    881767    </base:buttongroup>
    882768
  • trunk/www/biomaterials/samples/list_samples.jsp

    r6221 r6260  
    157157  ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext);
    158158  %>
    159   <base:page title="<%=title==null ? "Samples" : title%>" type="<%=mode.getPageType()%>">
    160   <base:head scripts="table.js" styles="table.css,toolbar.css,toolbar.css">
     159  <base:page title="<%=title==null ? "Samples" : title%>" type="<%=mode.getPageType()%>" id="list-page">
     160  <base:head scripts="table.js,~samples.js" styles="table.css,toolbar.css,toolbar.css">
    161161    <ext:scripts context="<%=jspContext%>" />
    162162    <ext:stylesheets context="<%=jspContext%>" />
    163     <script>
    164     var submitPage = 'index.jsp';
    165     var formId = 'samples';
    166     function newItem()
    167     {
    168       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', 0, true);
    169     }
    170     function newPooledItem()
    171     {
    172       Table.poolItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'NewPooledItem');
    173     }
    174     function editItem(itemId)
    175     {
    176       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true);
    177     }
    178     function viewItem(itemId)
    179     {
    180       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false);
    181     }
    182     function itemOnClick(evt, itemId)
    183     {
    184       Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected);
    185     }
    186     function newSample(sampleId)
    187     {
    188       Main.viewOrEditItem('<%=ID%>', 'SAMPLE', 0, true, '&sample_id='+sampleId);
    189     }
    190     function newExtract(sampleId)
    191     {
    192       Main.viewOrEditItem('<%=ID%>', 'EXTRACT', 0, true, '&sample_id='+sampleId);
    193     }
    194     function deleteItems()
    195     {
    196       var frm = document.forms[formId];
    197       if (Forms.numChecked(frm) == 0)
    198       {
    199         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    200         return;
    201       }
    202       frm.action = submitPage;
    203       frm.cmd.value = 'DeleteItems';
    204       frm.submit();
    205     }
    206     function restoreItems()
    207     {
    208       var frm = document.forms[formId];
    209       if (Forms.numChecked(frm) == 0)
    210       {
    211         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    212         return;
    213       }
    214       frm.action = submitPage;
    215       frm.cmd.value = 'RestoreItems';
    216       frm.submit();
    217     }
    218     function setOwner()
    219     {
    220       Table.setOwnerOfItems(formId);
    221     }
    222     function shareItems()
    223     {
    224       Table.shareItems(formId);
    225     }
    226     function configureColumns()
    227     {
    228       Table.configureColumns(formId);
    229     }
    230     function runPlugin(cmd)
    231     {
    232       Table.submitToPopup(formId, cmd, 750, 500);
    233     }
    234     function returnSelected()
    235     {
    236       Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>);
    237       window.close();
    238     }
    239     function newBioMaterialList()
    240     {
    241       var controller = Main.getController('BIOMATERIALLIST');
    242       Table.submitToPopup(formId, 'CreateBioMaterialList', controller.width, controller.height);
    243     }
    244     function placeOnPlate()
    245     {
    246       Table.submitToPopup(formId, 'PlaceOnPlate', 900, 600);
    247     }
    248     </script>
    249163  </base:head>
    250164 
     
    524438          >
    525439          <tbl:button
     440            id="btnNewItem"
    526441            disabled="<%=!createPermission%>"
    527442            image="new.png"
    528             onclick="newItem()"
    529443            title="New&hellip;"
    530444            tooltip="<%=createPermission ? "Create new sample" : "You do not have permission to create samples"%>"
    531445          />
    532446          <tbl:button
     447            id="btnNewPooledItem"
    533448            disabled="<%=!createPermission%>"
    534449            image="new_pooled.png"
    535             onclick="newPooledItem()"
    536450            title="Pool&hellip;"
    537451            tooltip="<%=createPermission ? "Create new pooled sample" : "You do not have permission to create samples"%>"
    538452          />
    539453          <tbl:button
     454            id="btnDeleteItems"
    540455            image="delete.png"
    541             onclick="deleteItems()"
    542456            title="Delete"
    543457            tooltip="Delete the selected items"
    544458          />
    545459          <tbl:button
     460            id="btnRestoreItems"
    546461            image="restore.png"
    547             onclick="restoreItems()"
    548462            title="Restore"
    549463            tooltip="Restore the selected (deleted) items"
    550464          />
    551465          <tbl:button
     466            id="btnShareItems"
    552467            image="share.png"
    553             onclick="shareItems()"
    554468            title="Share&hellip;"
    555469            tooltip="Share the selected items"
    556470          />
    557471          <tbl:button
     472            id="btnSetOwner"
    558473            image="take_ownership.png"
    559             onclick="setOwner()"
    560474            title="Set owner&hellip;"
    561475            tooltip="Change owner of the selected items"
    562476          />
    563477          <tbl:button
     478            id="btnColumns"
    564479            image="columns.png"
    565             onclick="configureColumns()"
    566480            title="Columns&hellip;"
    567481            tooltip="Show, hide and re-order columns"
    568482          />
    569483          <tbl:button
     484            id="btnNewBioMaterialList"
    570485            image="add.png"
    571             onclick="newBioMaterialList()"
    572486            title="New biomaterial list&hellip;"
    573487            tooltip="Create a new biomaterial list from matching samples"
     
    575489          />
    576490          <tbl:button
     491            id="btnPlaceOnPlate"
    577492            image="place_on_plate.png"
    578             onclick="placeOnPlate()"
    579493            title="Place on plate&hellip;"
    580494            tooltip="Place the selected/matching samples on a bioplate"
    581495          />
    582496          <tbl:button
     497            id="btnImport"
     498            data-plugin-type="IMPORT"
    583499            image="import.png"
    584             onclick="runPlugin('ImportItems')"
    585500            title="Import&hellip;"
    586501            tooltip="Import data"
     
    588503          />
    589504          <tbl:button
     505            id="btnExport"
     506            data-plugin-type="EXPORT"
    590507            image="export.png"
    591             onclick="runPlugin('ExportItems')"
    592508            title="Export&hellip;"
    593509            tooltip="Export data"
     
    595511          />
    596512          <tbl:button
     513            id="btnRunPlugin"
     514            data-plugin-type="OTHER"
    597515            image="runplugin.png"
    598             onclick="runPlugin('RunListPlugin')"
    599516            title="Run plugin&hellip;"
    600517            tooltip="Run a plugin"
     
    717634                    visible="<%=item.isShared()%>"
    718635                  />&nbsp;</tbl:header>
    719                 <tbl:cell column="name"><div class="link"
    720                   onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)"
     636                <tbl:cell column="name"><div
     637                  class="link table-item"
     638                  data-item-id="<%=itemId%>"
     639                  data-no-edit="<%=writePermission ? 0 : 1 %>"
     640                  tabindex="0"
    721641                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
    722642                <tbl:cell column="id"><%=item.getId()%></tbl:cell>
     
    845765                  %>
    846766                  <base:icon
     767                    id="<%="newsample."+itemId%>"
    847768                    image="add.png"
    848                     onclick="<%="newSample("+itemId+")"%>"
     769                    subclass="auto-init"
     770                    data-auto-init="new-sample"
     771                    data-item-id="<%=itemId %>"
    849772                    tooltip="Create new child sample"
    850773                    visible="<%=mode.hasEditLink() && createPermission && usePermission %>"
     
    879802                  %>
    880803                  <base:icon
     804                    id="<%="newsample."+itemId%>"
    881805                    image="add.png"
    882                     onclick="<%="newExtract("+itemId+")"%>"
     806                    subclass="auto-init"
     807                    data-auto-init="new-extract"
     808                    data-item-id="<%=itemId %>"
    883809                    tooltip="Create new extract"
    884810                    visible="<%=mode.hasEditLink() && createExtractPermission && usePermission %>"
     
    959885
    960886    <base:buttongroup subclass="dialogbuttons">
    961       <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" />
    962       <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
    963       <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" />
     887      <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" />
     888      <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
     889      <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" />
    964890    </base:buttongroup>
    965891  </base:body>
  • trunk/www/biomaterials/samples/view_sample.jsp

    r6255 r6260  
    9090final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
    9191final int itemId = cc.getId();
    92 final String tab = Values.getString(request.getParameter("tab"), "properties");
     92final String tab = Values.getStringOrNull(request.getParameter("tab"));
    9393final float scale = Base.getScale(sc);
    9494final DbControl dc = sc.newDbControl();
     
    117117  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
    118118  %>
    119   <base:page title="<%=title%>">
    120   <base:head scripts="table.js,tabcontrol.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">
     119<base:page title="<%=title%>" id="view-page">
     120  <base:head scripts="table.js,tabcontrol-2.js,~samples.js"
     121    styles="table.css,toolbar.css,headertabcontrol.css,path.css">
    121122    <ext:scripts context="<%=jspContext%>" />
    122123    <ext:stylesheets context="<%=jspContext%>" />
    123     <script>
    124     function editItem()
    125     {
    126       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);
    127     }
    128     function shareItem()
    129     {
    130       Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareSample', 600, 400);
    131     }
    132     function newExtract()
    133     {
    134       Main.viewOrEditItem('<%=ID%>', 'EXTRACT', 0, true, '&sample_id=<%=itemId%>');
    135     }
    136     function newSample()
    137     {
    138       Main.viewOrEditItem('<%=ID%>', 'SAMPLE', 0, true, '&sample_id=<%=itemId%>');
    139     }
    140     function deleteItem()
    141     {
    142       location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');
    143     }
    144     function restoreItem()
    145     {
    146       location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');
    147     }
    148     function deleteItemPermanently()
    149     {
    150       Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted');
    151     }
    152     function itemDeleted()
    153     {
    154       Main.listItems('<%=ID%>', '<%=itemType.name()%>');
    155     }
    156     function showUsingItems()
    157     {
    158       Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    159     }
    160     function setOwner()
    161     {
    162       Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 300);
    163     }
    164     function runPlugin(cmd)
    165     {
    166       Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500);
    167     }
    168     function viewEvents()
    169     {
    170       location.href = '../events/index.jsp?ID=<%=ID%>&cmd=List&biomaterial_id=<%=itemId%>&biomaterial_type=<%=itemType.name()%>';
    171     }
    172     function switchTab(tabControlId, tabId)
    173     {
    174       if (TabControl.isActive(tabControlId, tabId)) return;
    175       if (tabId == 'events')
    176       {
    177         viewEvents();
    178       }
    179       else
    180       {
    181         TabControl.setActiveTab(tabControlId, tabId);
    182       }
    183     }
    184     </script>
    185124  </base:head>
    186125  <base:body>
    187     <p:path><p:pathelement
    188       title="Samples" href="<%="index.jsp?ID="+ID%>" /><p:pathelement
    189       title="<%=HTML.encodeTags(sample.getName())%>" /></p:path>
    190    
    191     <t:tabcontrol id="main"
    192       subclass="content mastertabcontrol"
    193       active="<%=tab%>" switch="switchTab" remember="false">
     126    <p:path><p:pathelement title="Samples" href="<%="index.jsp?ID="+ID%>"
     127      /><p:pathelement title="<%=HTML.encodeTags(sample.getName())%>" /></p:path>
     128     
     129    <div id="page-data" data-item-id="<%=itemId%>"></div>
     130
     131    <t:tabcontrol id="main" subclass="content mastertabcontrol" active="<%=tab%>">
    194132    <t:tab id="properties" title="Properties">
    195 
    196133      <div>
    197134      <table class="fullform bottomborder">
    198135      <tr>
    199136        <th class="itemstatus">
    200           <base:icon
    201             image="shared.png"
     137          <base:icon image="shared.png"
    202138            visible="<%=sample.isShared()%>"
    203             tooltip="This item is shared to other users, groups and/or projects"
     139            tooltip="This item is shared to other users, groups and/or projects" 
    204140          />
    205141          <base:icon
    206             image="deleted.png"
    207             onclick="deleteItemPermanently()"
     142            id="btnDeletePermanently"
     143            image="deleted.png"
    208144            tooltip="This item has been flagged for deletion. Click to delete it now."
    209145            enabled="<%=deletePermanentlyPermission %>"
    210146            visible="<%=isRemoved%>"
    211147          />
    212           <base:icon image="used.png"
    213             onclick="showUsingItems()"
     148          <base:icon
     149            id="btnUsingItems"
     150            image="used.png"
    214151            tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one"
    215             visible="<%=isRemoved && isUsed%>" />
     152            visible="<%=isRemoved && isUsed%>"
     153          />
    216154        </th>
    217155        <td style="padding: 0px;">
    218 
    219         <tbl:toolbar subclass="bottomborder">
    220           <tbl:button
    221             disabled="<%=!writePermission%>"
    222             image="edit.png"
    223             onclick="editItem()"
    224             title="Edit&hellip;"
    225             tooltip="<%=writePermission ? "Edit this sample" : "You do not have permission to edit this sample"%>"
    226           />
    227           <tbl:button
    228             disabled="<%=!deletePermission%>"
    229             image="delete.png"
    230             onclick="deleteItem()"
    231             title="Delete"
    232             visible="<%=!sample.isRemoved()%>"
    233             tooltip="<%=deletePermission ? "Delete this sample" : "You do not have permission to delete this sample"%>"
    234           />
    235           <tbl:button
    236             disabled="<%=!writePermission%>"
    237             image="restore.png"
    238             onclick="restoreItem()"
    239             title="Restore"
    240             visible="<%=sample.isRemoved()%>"
    241             tooltip="<%=writePermission ? "Restore this sample" : "You do not have permission to restore this sample"%>"
    242           />
    243           <tbl:button
    244             disabled="<%=!sharePermission%>"
    245             image="share.png"
    246             onclick="shareItem()"
    247             title="Share&hellip;"
    248             tooltip="<%=sharePermission ? "Share this sample to other user, groups and projects" : "You do not have permission to share this sample"%>"
    249           />
    250           <tbl:button
    251             disabled="<%=!setOwnerPermission%>"
    252             image="take_ownership.png"
    253             onclick="setOwner()"
    254             title="Set owner&hellip;"
    255             tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    256           />
    257           <tbl:button
    258             image="add.png"
    259             onclick="newSample()"
    260             title="New child sample&hellip;"
    261             tooltip="Create a new child sample from this sample"
    262             visible="<%=sc.hasPermission(Permission.CREATE, Item.SAMPLE) && usePermission%>"
    263           />
    264           <tbl:button
    265             image="add.png"
    266             onclick="newExtract()"
    267             title="New child extract&hellip;"
    268             tooltip="Create a new extract from this sample"
    269             visible="<%=sc.hasPermission(Permission.CREATE, Item.EXTRACT) && usePermission%>"
    270           />
    271           <tbl:button
    272             image="import.png"
    273             onclick="runPlugin('ImportItem')"
    274             title="Import&hellip;"
    275             tooltip="Import data"
    276             visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
    277           />
    278           <tbl:button
    279             image="export.png"
    280             onclick="runPlugin('ExportItem')"
    281             title="Export&hellip;"
    282             tooltip="Export data"
    283             visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
    284           />
    285           <tbl:button
    286             image="runplugin.png"
    287             onclick="runPlugin('RunPlugin')"
    288             title="Run plugin&hellip;"
    289             tooltip="Run a plugin"
    290             visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
    291           /> 
    292           <ext:render extensions="<%=invoker%>" context="<%=jspContext%>"
    293             wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
    294           <tbl:button
    295             image="help.png"
    296             onclick="<%="Main.openHelp('" + ID +"', 'sample.view.properties')"%>"
    297             title="Help&hellip;"
    298             tooltip="Get help about this page"
    299           />   
     156          <tbl:toolbar subclass="bottomborder">
     157            <tbl:button
     158              id="btnEdit"
     159              disabled="<%=!writePermission%>"
     160              image="edit.png"
     161              title="Edit&hellip;"
     162              tooltip="<%=writePermission ? "Edit this sample" : "You do not have permission to edit this sample"%>"
     163            />
     164            <tbl:button
     165              id="btnDelete"
     166              disabled="<%=!deletePermission%>"
     167              image="delete.png"
     168              title="Delete"
     169              visible="<%=!sample.isRemoved()%>"
     170              tooltip="<%=deletePermission ? "Delete this sample" : "You do not have permission to delete this sample"%>"
     171            />
     172            <tbl:button
     173              id="btnRestore"
     174              disabled="<%=!writePermission%>"
     175              image="restore.png"
     176              title="Restore"
     177              visible="<%=sample.isRemoved()%>"
     178              tooltip="<%=writePermission ? "Restore this sample" : "You do not have permission to restore this sample"%>"
     179            />
     180            <tbl:button
     181              id="btnShare"
     182              disabled="<%=!sharePermission%>"
     183              image="share.png"
     184               title="Share&hellip;"
     185              tooltip="<%=sharePermission ? "Share this sample to other user, groups and projects" : "You do not have permission to share this sample"%>"
     186            />
     187            <tbl:button
     188              id="btnSetOwner"
     189              disabled="<%=!setOwnerPermission%>"
     190              image="take_ownership.png"
     191              title="Set owner&hellip;"
     192              tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
     193            />
     194            <tbl:button
     195              id="btnNewSample"
     196              image="add.png"
     197              title="New child sample&hellip;"
     198              tooltip="Create a new child sample from this sample"
     199              visible="<%=sc.hasPermission(Permission.CREATE, Item.SAMPLE) && usePermission%>"
     200            />
     201            <tbl:button
     202              id="btnNewExtract"
     203              image="add.png"
     204              title="New child extract&hellip;"
     205              tooltip="Create a new extract from this sample"
     206              visible="<%=sc.hasPermission(Permission.CREATE, Item.EXTRACT) && usePermission%>"
     207            />
     208            <tbl:button
     209              id="btnImport"
     210              image="import.png"
     211              data-plugin-type="IMPORT" 
     212              title="Import&hellip;"
     213              tooltip="Import data"
     214              visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
     215            />
     216            <tbl:button
     217              id="btnExport"
     218              image="export.png"
     219              data-plugin-type="EXPORT"
     220              title="Export&hellip;"
     221              tooltip="Export data"
     222              visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
     223            />
     224            <tbl:button
     225              id="btnRunPlugin"
     226              image="runplugin.png" 
     227              data-plugin-type="OTHER"
     228              title="Run plugin&hellip;"
     229              tooltip="Run a plugin"
     230              visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
     231            />
     232            <ext:render extensions="<%=invoker%>" context="<%=jspContext%>"
     233              wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>" />
     234            <tbl:button
     235              image="help.png"
     236              subclass="auto-init"
     237              data-auto-init="help"
     238              data-help-id="sample.view.properties"
     239              title="Help&hellip;"
     240              tooltip="Get help about this page"
     241            />
    300242          </tbl:toolbar>
    301243        </td>
     
    307249      <tr>
    308250        <th>Type</th>
    309         <td><base:propertyvalue item="<%=sample%>" property="itemSubtype" /></td>
     251        <td><base:propertyvalue item="<%=sample%>"
     252            property="itemSubtype" /></td>
    310253      </tr>
    311254      <tr>
     
    323266      <tr>
    324267        <th>Protocol</th>
    325         <td><base:propertyvalue item="<%=creationEvent%>" property="protocol" /></td>
     268        <td><base:propertyvalue item="<%=creationEvent%>"
     269            property="protocol" /></td>
    326270      </tr>
    327271      <tr>
     
    335279      <tr>
    336280        <th>Bioplate</th>
    337         <td>
    338           <base:propertyvalue item="<%=sample%>" property="bioWell.bioPlate" />
    339           <%
     281        <td><base:propertyvalue item="<%=sample%>"
     282            property="bioWell.bioPlate" /> <%
    340283          try
    341284          {
     
    343286            if (well != null)
    344287            {
    345               %>
    346               [<%=rowFormatter.format(well.getRow())%><%=columnFormatter.format(well.getColumn())%>]
    347               <base:icon image="locked.png"  visible="<%=sample.isLockedInWell()%>"/>
    348             <%
     288              %> [<%=rowFormatter.format(well.getRow())%><%=columnFormatter.format(well.getColumn())%>]
     289                <base:icon image="locked.png"
     290                  visible="<%=sample.isLockedInWell()%>" /> <%
    349291            }
    350292          }
     
    366308        <td><%=HTML.niceFormat(sample.getDescription())%></td>
    367309      </tr>
    368       </table>
    369       </div>
    370      
    371       <%
    372       SpecialQuery<BioMaterialEventSource> sourceQuery = creationEvent.getEventSources();
    373       sourceQuery.order(Orders.asc(Hql.property("bioMaterial.name")));
    374       ResultList<BioMaterialEventSource> sources = sourceQuery.list(dc);
    375       %>
    376       <base:section
    377         id="parentsSection"
    378         title="<%="Parent items (" + sources.size() + ")"%>"
    379         context="<%=cc%>"
    380         >
    381         <%
     310    </table>
     311  </div>
     312
     313  <%
     314  SpecialQuery<BioMaterialEventSource> sourceQuery = creationEvent.getEventSources();
     315  sourceQuery.order(Orders.asc(Hql.property("bioMaterial.name")));
     316  ResultList<BioMaterialEventSource> sources = sourceQuery.list(dc);
     317  %>
     318  <base:section id="parentsSection"
     319    title="<%="Parent items (" + sources.size() + ")"%>"
     320    context="<%=cc%>">
     321    <%
    382322        if (sources.size() == 0)
    383323        {
    384324          %>
    385           <div class="messagecontainer note">
    386           This sample doesn't have any parent items
    387           (or, you don't have permission to view them).
    388           </div>
     325          <div class="messagecontainer note">This sample doesn't have
     326            any parent items (or, you don't have permission to view them).</div>
    389327          <%
    390328        }
     
    392330        {
    393331          %>
    394           <tbl:table
    395             id="parents"
    396             columns="all"
    397           >
    398           <tbl:columndef
    399             id="name"
    400             title="Name"
    401           />
    402           <tbl:columndef
    403             id="type"
    404             title="Type"
    405           />
    406           <tbl:columndef
    407             id="quantity"
    408             title="Used quantity (µg)"
    409           />
    410           <tbl:columndef
    411             id="description"
    412             title="Description"
    413           />
    414           <tbl:data>
    415             <tbl:headers>
    416               <tbl:headerrow>
    417                 <tbl:columnheaders />
    418               </tbl:headerrow>
    419             </tbl:headers>
    420             <tbl:rows>
    421             <%
     332          <tbl:table id="parents" columns="all">
     333            <tbl:columndef id="name" title="Name" />
     334            <tbl:columndef id="type" title="Type" />
     335            <tbl:columndef id="quantity" title="Used quantity (µg)" />
     336            <tbl:columndef id="description" title="Description" />
     337            <tbl:data>
     338              <tbl:headers>
     339                <tbl:headerrow>
     340                  <tbl:columnheaders />
     341                </tbl:headerrow>
     342              </tbl:headers>
     343              <tbl:rows>
     344                <%
    422345            for (BioMaterialEventSource item : sources)
    423346            {
     
    432355              {}
    433356              %>
    434               <tbl:row>
    435                 <tbl:cell column="name"><base:icon
    436                     image="deleted.png"
    437                     tooltip="This item has been scheduled for deletion"
    438                     visible="<%=bm != null && bm.isRemoved()%>"
    439                   /><%=Base.getLinkedName(ID, bm, bm == null, true)%></tbl:cell>
    440                 <tbl:cell column="type">
    441                   <%
     357                <tbl:row>
     358                  <tbl:cell column="name">
     359                    <base:icon image="deleted.png"
     360                      tooltip="This item has been scheduled for deletion"
     361                      visible="<%=bm != null && bm.isRemoved()%>" /><%=Base.getLinkedName(ID, bm, bm == null, true)%></tbl:cell>
     362                  <tbl:cell column="type">
     363                    <%
    442364                  if (subtype != null)
    443365                  {
    444366                    %>
    445                     <%=Base.getLinkedName(ID, subtype, false, true)%> <span class="itemsubtype">(<%=bm.getType() %>)</span>
     367                    <%=Base.getLinkedName(ID, subtype, false, true)%>
     368                    <span class="itemsubtype">(<%=bm.getType() %>)
     369                    </span>
    446370                    <%
    447371                  }
     
    453377                  }
    454378                  %>
    455                 </tbl:cell>
    456                 <tbl:cell column="quantity"><%=Values.formatNumber(item.getUsedQuantity(), 2)%></tbl:cell>
    457                 <tbl:cell column="description"><%=HTML.encodeTags(bm == null ? "" : bm.getDescription())%></tbl:cell>
    458               </tbl:row>
    459               <%
     379                  </tbl:cell>
     380                  <tbl:cell column="quantity"><%=Values.formatNumber(item.getUsedQuantity(), 2)%></tbl:cell>
     381                  <tbl:cell column="description"><%=HTML.encodeTags(bm == null ? "" : bm.getDescription())%></tbl:cell>
     382                </tbl:row>
     383                <%
    460384            }
    461385            %>
    462             </tbl:rows>
    463           </tbl:data>
     386              </tbl:rows>
     387            </tbl:data>
    464388          </tbl:table>
    465389          <%
    466390        }
    467391        %>
    468       </base:section>
    469       <%
     392        </base:section>
     393        <%
    470394      SpecialQuery<BioMaterialEventSource> childQuery = sample.getChildCreationEvents();
    471395      childQuery.join(Hql.innerJoin("es", "event", "evt", true));
     
    474398      ResultList<BioMaterialEventSource> children = childQuery.list(dc);
    475399      %>
    476       <base:section
    477         id="childSection"
    478         title="<%="Child items (" + children.size() + ")"%>"
    479         context="<%=cc%>"
    480         >
    481         <%
     400        <base:section id="childSection"
     401          title="<%="Child items (" + children.size() + ")"%>"
     402          context="<%=cc%>">
     403          <%
    482404        if (children.size() == 0)
    483405        {
    484406          %>
    485           <div class="messagecontainer help">
    486           No child items have been created from this sample
    487           (or, you don't have permission to view them).
    488           </div>
     407          <div class="messagecontainer help">No child items have been
     408            created from this sample (or, you don't have permission to view
     409            them).</div>
    489410          <%
    490411        }
     
    492413        {
    493414          %>
    494           <tbl:table
    495             id="children"
    496            
    497             columns="all"
    498             >
    499             <tbl:columndef
    500               id="name"
    501               title="Name"
    502             />
    503             <tbl:columndef
    504               id="type"
    505               title="Type"
    506             />
    507             <tbl:columndef
    508               id="quantity"
    509               title="Used quantity (µg)"
    510             />
    511             <tbl:columndef
    512               id="description"
    513               title="Description"
    514             />
     415          <tbl:table id="children" columns="all">
     416            <tbl:columndef id="name" title="Name" />
     417            <tbl:columndef id="type" title="Type" />
     418            <tbl:columndef id="quantity" title="Used quantity (µg)" />
     419            <tbl:columndef id="description" title="Description" />
    515420            <tbl:data>
    516421              <tbl:headers>
     
    520425              </tbl:headers>
    521426              <tbl:rows>
    522               <%
     427                <%
    523428              for (BioMaterialEventSource item : children)
    524429              {
     
    534439                %>
    535440                <tbl:row>
    536                   <tbl:cell column="name"><base:icon
    537                       image="deleted.png"
    538                       tooltip="This item has been scheduled for deletion"
    539                       visible="<%=bm != null && bm.isRemoved()%>"
    540                     /><%=Base.getLinkedName(ID, bm, bm == null, true)%></tbl:cell>
     441                  <tbl:cell column="name">
     442                    <base:icon image="deleted.png"
     443                      tooltip="This item has been scheduled for deletion"
     444                      visible="<%=bm != null && bm.isRemoved()%>" /><%=Base.getLinkedName(ID, bm, bm == null, true)%></tbl:cell>
    541445                  <tbl:cell column="type">
    542446                    <%
     
    544448                    {
    545449                      %>
    546                       <%=Base.getLinkedName(ID, subtype, false, true)%> <span class="itemsubtype">(<%=bm.getType() %>)</span>
    547                       <%
     450                    <%=Base.getLinkedName(ID, subtype, false, true)%>
     451                    <span class="itemsubtype">(<%=bm.getType() %>)
     452                    </span>
     453                    <%
    548454                    }
    549455                    else
    550456                    {
    551457                      %>
    552                       <%=bm != null ? bm.getType() : "" %>
    553                       <%
     458                    <%=bm != null ? bm.getType() : "" %>
     459                    <%
    554460                    }
    555461                    %>
     
    560466                <%
    561467              }
    562               %>           
     468              %>
    563469              </tbl:rows>
    564470            </tbl:data>
     
    567473        }
    568474        %>
    569       </base:section>
    570      
    571       <jsp:include page="../../common/anytoany/list_anytoany.jsp">
    572         <jsp:param name="ID" value="<%=ID%>" />
    573         <jsp:param name="item_type" value="<%=itemType.name()%>" />
    574         <jsp:param name="item_id" value="<%=itemId%>" />
    575         <jsp:param name="title" value="Other items related to this sample" />
    576       </jsp:include>
    577      
    578       <jsp:include page="../../common/share/list_share.jsp">
    579         <jsp:param name="ID" value="<%=ID%>" />
    580         <jsp:param name="item_type" value="<%=itemType.name()%>" />
    581         <jsp:param name="item_id" value="<%=itemId%>" />
    582         <jsp:param name="title" value="Shared to" />
    583       </jsp:include>
     475        </base:section>
     476
     477        <jsp:include page="../../common/anytoany/list_anytoany.jsp">
     478          <jsp:param name="ID" value="<%=ID%>" />
     479          <jsp:param name="item_type" value="<%=itemType.name()%>" />
     480          <jsp:param name="item_id" value="<%=itemId%>" />
     481          <jsp:param name="title" value="Other items related to this sample" />
     482        </jsp:include>
     483
     484        <jsp:include page="../../common/share/list_share.jsp">
     485          <jsp:param name="ID" value="<%=ID%>" />
     486          <jsp:param name="item_type" value="<%=itemType.name()%>" />
     487          <jsp:param name="item_id" value="<%=itemId%>" />
     488          <jsp:param name="title" value="Shared to" />
     489        </jsp:include>
    584490      </t:tab>
    585      
    586       <t:tab id="annotations" title="Annotations &amp; parameters"
    587         tooltip="View annotation values and protocol parameters" clazz="white"
    588         activate="AnnotationsList.loadOnce()">
     491
     492      <t:tab id="annotations" title="Annotations &amp; parameters"
     493        tooltip="View annotation values and protocol parameters" clazz="white">
    589494        <jsp:include page="../../common/annotations/list_frameset.jsp">
    590495          <jsp:param name="item_type" value="<%=itemType.name()%>" />
     
    594499      </t:tab>
    595500      <t:tab id="events" title="Events" />
    596       <t:tab id="overview" title="Overview"
    597         tooltip="Display a tree overview of related items"
    598         activate="Overview.loadOnce()">
     501      <t:tab id="overview" title="Overview"
     502        tooltip="Display a tree overview of related items">
    599503        <jsp:include page="../../common/overview/overview.jsp">
    600504          <jsp:param name="item_type" value="<%=itemType.name()%>" />
     
    602506          <jsp:param name="ID" value="<%=ID%>" />
    603507        </jsp:include>
    604       </t:tab>     
    605       <t:tab id="history" title="Change history" 
     508      </t:tab>
     509      <t:tab id="history" title="Change history"
    606510        tooltip="Displays a log of all modifications made to this item"
    607         visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>"
    608         activate="History.loadOnce()">
     511        visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>">
    609512        <jsp:include page="../../common/history/frameset.jsp">
    610513          <jsp:param name="item_type" value="<%=itemType.name()%>" />
     
    612515          <jsp:param name="ID" value="<%=ID%>" />
    613516        </jsp:include>
    614       </t:tab>     
    615       </t:tabcontrol>
     517      </t:tab>
     518    </t:tabcontrol>
    616519
    617520  </base:body>
    618   </base:page>
    619   <%
     521</base:page>
     522<%
    620523}
    621524finally
  • trunk/www/biomaterials/tags/list_tags.jsp

    r6221 r6260  
    101101  ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext);
    102102  %>
    103   <base:page title="<%=title==null ? "Tags" : title%>" type="<%=mode.getPageType()%>">
    104   <base:head scripts="table.js" styles="table.css,toolbar.css">
     103  <base:page title="<%=title==null ? "Tags" : title%>" type="<%=mode.getPageType()%>" id="list-page">
     104  <base:head scripts="table.js,~tags.js" styles="table.css,toolbar.css">
    105105    <ext:scripts context="<%=jspContext%>" />
    106106    <ext:stylesheets context="<%=jspContext%>" />
    107     <script>
    108     var submitPage = 'index.jsp';
    109     var formId = 'taglist';
    110     function newItem()
    111     {
    112       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', 0, true);
    113     }
    114     function editItem(itemId)
    115     {
    116       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true);
    117     }
    118     function viewItem(itemId)
    119     {
    120       Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false);
    121     }
    122     function itemOnClick(evt, itemId)
    123     {
    124       Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected);
    125     }
    126     function deleteItems()
    127     {
    128       var frm = document.forms[formId];
    129       if (Forms.numChecked(frm) == 0)
    130       {
    131         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    132         return;
    133       }
    134       frm.action = submitPage;
    135       frm.cmd.value = 'DeleteItems';
    136       frm.submit();
    137     }
    138     function restoreItems()
    139     {
    140       var frm = document.forms[formId];
    141       if (Forms.numChecked(frm) == 0)
    142       {
    143         Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    144         return;
    145       }
    146       frm.action = submitPage;
    147       frm.cmd.value = 'RestoreItems';
    148       frm.submit();
    149     }
    150     function setOwner()
    151     {
    152       Table.setOwnerOfItems(formId);
    153     }
    154     function shareItems()
    155     {
    156       Table.shareItems(formId);
    157     }
    158     function configureColumns()
    159     {
    160       Table.configureColumns(formId);
    161     }
    162     function runPlugin(cmd)
    163     {
    164       Table.submitToPopup(formId, cmd, 750, 500);
    165     }
    166     function returnSelected()
    167     {
    168       Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>);
    169       window.close();
    170     }
    171     function newLabeledExtract(tagId)
    172     {
    173       Main.viewOrEditItem('<%=ID%>', 'LABELEDEXTRACT', 0, true, '&label_id='+tagId);
    174     }   
    175     </script>
    176107  </base:head>
    177108 
     
    287218          >
    288219          <tbl:button
     220            id="btnNewItem"
    289221            disabled="<%=!createPermission%>"
    290222            image="new.png"
    291             onclick="newItem()"
    292223            title="New&hellip;"
    293224            tooltip="<%=createPermission ? "Create new tag" : "You do not have permission to create tags"%>"
    294225          />
    295226          <tbl:button
     227            id="btnDeleteItems"
    296228            image="delete.png"
    297             onclick="deleteItems()"
    298229            title="Delete"
    299230            tooltip="Delete the selected items"
    300231          />
    301232          <tbl:button
     233            id="btnRestoreItems"
    302234            image="restore.png"
    303             onclick="restoreItems()"
    304235            title="Restore"
    305236            tooltip="Restore the selected (deleted) items"
    306237          />
    307238          <tbl:button
     239            id="btnShareItems"
    308240            image="share.png"
    309             onclick="shareItems()"
    310241            title="Share&hellip;"
    311242            tooltip="Share the selected items"
    312243          />
    313244          <tbl:button
     245            id="btnSetOwner"
    314246            image="take_ownership.png"
    315             onclick="setOwner()"
    316247            title="Set owner&hellip;"
    317248            tooltip="Change owner of the selected items"
    318249          />
    319250          <tbl:button
     251            id="btnColumns"
    320252            image="columns.png"
    321             onclick="configureColumns()"
    322253            title="Columns&hellip;"
    323254            tooltip="Show, hide and re-order columns"
    324255          />
    325256          <tbl:button
     257            id="btnImport"
     258            data-plugin-type="IMPORT"
    326259            image="import.png"
    327             onclick="runPlugin('ImportItems')"
    328260            title="Import&hellip;"
    329261            tooltip="Import data"
     
    331263          />
    332264          <tbl:button
     265            id="btnExport"
     266            data-plugin-type="EXPORT"
    333267            image="export.png"
    334             onclick="runPlugin('ExportItems')"
    335268            title="Export&hellip;"
    336269            tooltip="Export data"
     
    338271          />
    339272          <tbl:button
     273            id="btnRunPlugin"
     274            data-plugin-type="OTHER"
    340275            image="runplugin.png"
    341             onclick="runPlugin('RunListPlugin')"
    342276            title="Run plugin&hellip;"
    343277            tooltip="Run a plugin"
     
    458392                    visible="<%=item.isShared()%>"
    459393                  />&nbsp;</tbl:header>
    460                 <tbl:cell column="name"><div class="link"
    461                   onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)"
     394                <tbl:cell column="name"><div
     395                  class="link table-item"
     396                  data-item-id="<%=itemId%>"
     397                  data-no-edit="<%=writePermission ? 0 : 1 %>"
     398                  tabindex="0"
    462399                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
    463400                <tbl:cell column="id"><%=item.getId()%></tbl:cell>
     
    520457    </div>
    521458    <base:buttongroup subclass="dialogbuttons">
    522       <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" />
    523       <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
    524       <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" />
     459      <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" />
     460      <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
     461      <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" />
    525462    </base:buttongroup>
    526463  </base:body>
  • trunk/www/include/scripts/main-2.js

    r6256 r6260  
    702702    var itemType = Data.get(target, 'item-type');
    703703    var itemId = Data.get(target, 'item-id');
    704     Main.viewOrEditItem(App.getSessionId(), itemType, itemId, true);
     704    var extraUrl = Data.get(target, 'extra-url');
     705    Main.viewOrEditItem(App.getSessionId(), itemType, itemId, true, extraUrl);
    705706  }
    706707 
     
    714715    var target = event.currentTarget;
    715716    var itemType = Data.get(target, 'item-type');
    716     Main.viewOrEditItem(App.getSessionId(), itemType, 0, true);
     717    var extraUrl = Data.get(target, 'extra-url');
     718    Main.viewOrEditItem(App.getSessionId(), itemType, 0, true, extraUrl);
    717719  }
    718720 
     
    13811383    var itemId = Data.int(element, 'item-id');
    13821384    var noEdit = Data.int(element, 'no-edit', 0);
     1385    var extraUrl = Data.get(element, 'extra-url');
    13831386    var specialKey = event.altKey || event.ctrlKey || event.shiftKey;
    13841387    if (noEdit || !specialKey)
    13851388    {
    1386       Main.viewOrEditItem(App.getSessionId(), itemType, itemId, false);
     1389      Main.viewOrEditItem(App.getSessionId(), itemType, itemId, false, extraUrl);
    13871390    }
    13881391    else
    13891392    {
    1390       Main.viewOrEditItem(App.getSessionId(), itemType, itemId, true);
     1393      Main.viewOrEditItem(App.getSessionId(), itemType, itemId, true, extraUrl);
    13911394    }
    13921395  }
  • trunk/www/include/scripts/main.js

    r6256 r6260  
    497497    this.controllers['BIOPLATETYPE'] = { url:'biomaterials/bioplatetypes/index.jsp', width:600, height:400 };
    498498    this.controllers['BIOSOURCE'] = { url:'biomaterials/biosources/index.jsp', width:750, height:500 };
    499     this.controllers['BIOWELL'] = { url:'biomaterials/bioplates/wells/index.jsp', width:450, height:300 };
     499    this.controllers['BIOWELL'] = { url:'biomaterials/bioplates/wells/index.jsp', width:450, height:300, edit: true };
    500500    this.controllers['CLIENT'] = { url:'admin/clients/index.jsp', width:450, height:300 };
    501501    this.controllers['CHANGEHISTORY'] = { url:'common/history/index.jsp', width:600, height:400, edit:false, popup:true };
  • trunk/www/include/scripts/tabcontrol-2.js

    r6161 r6260  
    219219  {
    220220    if (autoInit != 'tabcontrol') return;
    221     var initialTab = tabControl.id + '.' + Data.get(tabControl, 'initial-tab');
     221    var initialTab = Data.get(tabControl, 'initial-tab');
    222222    var checkRemembered = Data.int(tabControl, 'remember-last');
    223     if (checkRemembered)
     223    if (initialTab)
     224    {
     225      // Prepend the tabcontrol id
     226      initialTab = tabControl.id + '.' + initialTab;
     227    }
     228    else if (checkRemembered)
    224229    {
    225230      var remembered = Data.getPageValue('last-tab.'+tabControl.id);
    226231      if (remembered) initialTab = remembered;
     232    }
     233    if (!initialTab)
     234    {
     235      // Locate the ID of the first defined tab and make that the initial tab
     236      var tabs = tabControl.getElementsByClassName('tab');
     237      if (tabs.length > 0) initialTab = tabs[0].id;
    227238    }
    228239    Doc.addFinalizer(function()
  • trunk/www/include/scripts/tabcontrol.js

    r6172 r6260  
    3737  this.setInitialTab = function(tabControlId, tabId, checkRemembered, switchFunction)
    3838  {
     39    var tabControl = document.getElementById(tabControlId);
    3940    if (checkRemembered)
    4041    {
    41       var tabControl = document.getElementById(tabControlId);
    4242      if (!tabControl.activeTab)
    4343      {
     
    4646        if (rememberedTabId) tabId = rememberedTabId
    4747      }
     48    }
     49    if (!tabId)
     50    {
     51      var tabs = tabControl.getElementsByClassName('tab');
     52      if (tabs.length > 0) tabId = tabs[0].id.substring(tabControlId.length+1);
    4853    }
    4954    if (switchFunction)
  • trunk/www/include/scripts/table.js

    r6222 r6260  
    504504    @param regexp A regular expression to use for matching checkboxes in the table,
    505505      if not specified all checkboxes with a numeric name are used
    506     @param confirm If set, ask for confirmation before deleting the items
    507   */
    508   table.deleteItems = function(tableDiv, regexp, confirm)
    509   {
    510     tableDiv = Doc.element(tableDiv);
    511     var frm = document.forms[tableDiv.id];
    512     var numSelected = Forms.numChecked(frm, regexp);
    513     if (numSelected == 0)
    514     {
    515       Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    516       return;
    517     }
    518     if (confirm)
     506    @param confirmFirst If set, ask for confirmation before deleting the items
     507  */
     508  table.deleteItems = function(tableDiv, regexp, confirmFirst)
     509  {
     510    tableDiv = Doc.element(tableDiv);
     511    var frm = document.forms[tableDiv.id];
     512    var numSelected = table.checkIfSelected(tableDiv, regexp);
     513    if (numSelected == 0) return;
     514    if (confirmFirst)
    519515    {
    520516      if (!confirm('You are about to delete '+numSelected+' items. This can\'t be undone. Continue?'))
     
    538534    tableDiv = Doc.element(tableDiv);
    539535    var frm = document.forms[tableDiv.id];
    540     var numSelected = Forms.numChecked(frm, regexp);
    541     if (numSelected == 0)
    542     {
    543       Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    544       return;
     536    if (!table.checkIfSelected(tableDiv, regexp))
     537    {
     538      return;
    545539    }
    546540    frm.cmd.value = 'RestoreItems';
     
    561555  {
    562556    tableDiv = Doc.element(tableDiv);
    563     var frm = document.forms[tableDiv.id];
    564     if (Forms.numChecked(frm, regexp) == 0)
    565     {
    566       Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    567       return;
     557    if (!table.checkIfSelected(tableDiv, regexp))
     558    {
     559      return;
    568560    }
    569561    table.submitToPopup(tableDiv, 'SetOwnerOfItems', 450, 300);
     
    582574  {
    583575    tableDiv = Doc.element(tableDiv);
    584     var frm = document.forms[tableDiv.id];
    585     if (Forms.numChecked(frm, regexp) == 0)
    586     {
    587       Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');
    588       return;
     576    if (!table.checkIfSelected(tableDiv, regexp))
     577    {
     578      return;
    589579    }
    590580    table.submitToPopup(tableDiv, 'ShareItems', 600, 400);
     
    677667  }
    678668
     669  table.checkIfSelected = function(tableDiv, regexp, messageIfNoneSelected)
     670  {
     671    tableDiv = Doc.element(tableDiv);
     672    var frm = document.forms[tableDiv.id];
     673    var numSelected = Forms.numChecked(frm, regexp);
     674    if (numSelected == 0)
     675    {
     676      if (!messageIfNoneSelected)
     677      {
     678        messageIfNoneSelected = 'Please select at least one item in the list';
     679      }
     680      Forms.showNotification('check.uncheck', messageIfNoneSelected, null, 'pointer-left');
     681    }
     682    return numSelected;
     683  }
    679684 
    680685  // ------- OLD CODE BELOW ------------------
Note: See TracChangeset for help on using the changeset viewer.