Changeset 1796


Ignore:
Timestamp:
Dec 18, 2012, 2:11:35 PM (7 years ago)
Author:
Nicklas Nordborg
Message:

References #424: Select RNA items for library preparation

Added a context-menu popup with cut/copy/paste and a few other options to right or middle mouse button (depending on user setting).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/branches/ticket-422/resources/libprep/select_rna.jsp

    r1795 r1796  
    11961196}
    11971197
     1198/**
     1199  Reacts to 'mouseup' and 'contextmenu' events for the bioplate.
     1200  This should bring up the cut/copy/paste context menu depending on which
     1201  mouse button that was clicked.
     1202*/
     1203function contextEvent(event)
     1204{
     1205  var frm = document.forms['reggie'];
     1206  var showContext = false;
     1207 
     1208  if (frm.contextMenu[0].checked)
     1209  {
     1210    // Context menu on 'right' mouse button
     1211    // Can't just check the button since two events are sent ('mouseup' and 'contextmenu')
     1212    showContext = event.type == 'contextmenu' && event.button == 2;
     1213  }
     1214  else
     1215  {
     1216    // Context menu on 'middle' mouse button
     1217    showContext = event.button == 1;
     1218  }
     1219 
     1220  if (showContext)
     1221  {
     1222    event.preventDefault(); // Prevents the default right-click menu from appearing
     1223    var menu = document.getElementById('menuContext');
     1224    // 1 pixel offset to avoid losing well focus outline
     1225    contextX = event.clientX+1;
     1226    contextY = event.clientY+1;
     1227    // Need short delay since 'mouseup' are also sent as 'click' events
     1228    // to the 'document' object which BASE already have a Menu.hideAll()
     1229    // call which would hide the menu immediately
     1230    setTimeout(showContextMenu, 100);
     1231  }
     1232}
     1233
     1234var contextX;
     1235var contextY;
     1236function showContextMenu()
     1237{
     1238  Menu.showTopMenu(document.getElementById('menuContext'), contextX, contextY);
     1239}
    11981240
    11991241function goCreate()
     
    14521494  </m:menu>
    14531495 
     1496  <m:menu
     1497    id="menuContext"
     1498    style="display: none; font-weight: normal; text-align: left; xwidth: 8em;">
     1499    <m:menuitem
     1500      title="Cut&hellip;"
     1501      icon="<%=home+"/images/cut.png"%>"
     1502      onclick="cutSelected()"
     1503      tooltip="Clear the selected wells"
     1504    />
     1505    <m:menuitem 
     1506      title="Copy"
     1507      icon="<%=home+"/images/copy.png"%>"
     1508      onclick="copySelected()"
     1509      tooltip="Make a copy of the selected RNA"
     1510    />
     1511    <m:menuitem 
     1512      title="Paste"
     1513      icon="<%=home+"/images/paste.png"%>"
     1514      onclick="pasteToSelected()"
     1515      tooltip="Paste RNA into selected wells"
     1516    />
     1517    <m:menuitem 
     1518      title="Switch"
     1519      icon="<%=home+"/images/switch.png"%>"
     1520      onclick="switchSelected()"
     1521      tooltip="Switch the selected wells (if exactly two)"
     1522    />
     1523    <m:menuseparator />
     1524    <m:menuitem
     1525      title="Toggle QC"
     1526      icon="<%=home+"/images/mrnaqc.png"%>"
     1527      onclick="toggleQc()"
     1528      tooltip="Select/deselect RNA for QC"
     1529    />
     1530  </m:menu>
     1531
    14541532  <form name="reggie" onsubmit="return false;">
    14551533 
     
    14891567          </tr>
    14901568          </table>
     1569        </td>
     1570        <td class="help">Toggles visiblity of the selected information inside each well on the plate.</td>
     1571      </tr>
     1572      <tr style="vertical-align: top;">
     1573        <td class="prompt">Context menu</td>
     1574        <td class="input">
     1575          <input type="radio" name="contextMenu" id="contextMenuRight" checked><label for="contextMenuRight">Right</label>
     1576          <input type="radio" name="contextMenu" id="contextMenuMiddle"><label for="contextMenuMiddle">Middle</label> mouse button<br>
    14911577          <br>
    14921578        </td>
    1493         <td class="help"></td>
     1579        <td class="help">Use the selected mouse button to display a context-menu when clicking on the plate.</td>
    14941580      </tr>
    14951581      </table>
     
    15561642        />
    15571643      </tbl:toolbar>
    1558         <table class="plate hide-volumes hide-ndconc" style="margin: 1em 1em 0 1em;" id="plate">
     1644        <table class="plate hide-volumes hide-ndconc" style="margin: 1em 1em 0 1em;" id="plate"
     1645          onmouseup="contextEvent(event)"
     1646          oncontextmenu="contextEvent(event)"
     1647          >
    15591648        <%
    15601649        int columns = 12;
Note: See TracChangeset for help on using the changeset viewer.