Changeset 2209


Ignore:
Timestamp:
Feb 3, 2014, 8:36:18 AM (9 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #567: Update MEV extension to new scripting pattern

Location:
extensions/net.sf.basedb.mev/trunk
Files:
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.mev/trunk/.classpath

    r1540 r2209  
    88  <classpathentry kind="lib" path="resources/jar/mev-gui-impl.jar" sourcepath="/mev-4.4.1/source"/>
    99  <classpathentry kind="lib" path="resources/jar/HTTPClient.jar"/>
    10   <classpathentry kind="lib" path="lib/compile/base-core-3.1.0.jar"/>
    11   <classpathentry kind="lib" path="lib/compile/base-coreplugins-3.1.0.jar"/>
    12   <classpathentry kind="lib" path="lib/compile/base-webclient-3.1.0.jar"/>
    13   <classpathentry kind="lib" path="lib/compile/base-webservices-client-3.1.0.jar"/>
     10  <classpathentry kind="lib" path="lib/compile/base-core-3.3.0.jar"/>
     11  <classpathentry kind="lib" path="lib/compile/base-coreplugins-3.3.0.jar"/>
     12  <classpathentry kind="lib" path="lib/compile/base-webclient-3.3.0.jar"/>
     13  <classpathentry kind="lib" path="lib/compile/base-webservices-client-3.3.0.jar"/>
    1414  <classpathentry kind="output" path="bin"/>
    1515</classpath>
  • extensions/net.sf.basedb.mev/trunk/META-INF/extensions.xml

    r1705 r2209  
    11<?xml version="1.0" encoding="UTF-8" ?>
    22<extensions xmlns="http://base.thep.lu.se/extensions.xsd">
    3   <about>
     3  <about safe-scripts="1">
    44    <name>MEV Launcher package</name>
    55    <description>
     
    1212    <email>basedb-users@lists.sourceforge.net</email>
    1313    <url>http://baseplugins.thep.lu.se/wiki/net.sf.basedb.mev</url>
    14     <min-base-version>3.1.0</min-base-version>   
     14    <min-base-version>3.3.0</min-base-version>   
    1515  </about>
    1616  <plugin-definition id="PackageInstaller">
     
    7979          given the option to do so.
    8080        </tooltip>
    81         <onClick>MeV.launch($ID$)</onClick>
     81        <clazz>icon link auto-init</clazz>
     82        <data-auto-init>launch-mev</data-auto-init>
     83        <data-home>$HOME$</data-home>
    8284        <icon>~/images/tm4.png</icon>
    83         <script>~/scripts/mev.jsp</script>
     85        <script>~/scripts/mev.js</script>
    8486      </parameters>
    8587    </action-factory>
     
    103105        <title>MeV Launcher options&amp;hellip;</title>
    104106        <tooltip>Specify options for the MeV Launcher</tooltip>
    105         <onClick>Main.openPopup('$HOME$/options.jsp?ID='+getSessionId(), 'MeVLauncherOptions', 450, 300)</onClick>
     107        <data-url>$HOME$/options.jsp?ID=$SESSION-ID$</data-url>
     108        <data-popup>MeVLauncherOptions, 450, 300</data-popup>
    106109        <icon>~/images/tm4.png</icon>
    107110      </parameters>
  • extensions/net.sf.basedb.mev/trunk/build.xml

    r1705 r2209  
    2424  <property name="javac.encoding" value="UTF-8" />
    2525  <property name="depend.base-version"
    26     value="3.1.0"
     26    value="3.3.0"
    2727    description="The BASE version that this project depends on."
    2828  />
  • extensions/net.sf.basedb.mev/trunk/resources/launch_mev.jsp

    r1541 r2209  
    127127  {}
    128128%>
    129 <base:page type="popup" title="<%=title%>">
    130 <base:head>
    131   <script language="JavaScript">
    132   function launchMev(fileType)
    133   {
    134     var url = 'mev_jnlp.jsp?ID=<%=ID%>&bioassayset_id=<%=bioAssaySetId%>';
    135     url += '&filetype=' + fileType;
    136     window.opener.location.href = url;
    137     setTimeout('window.close()', 500);
    138   }
    139   function exportTdms()
    140   {
    141     var url = getRoot()+'common/plugin/index.jsp?ID='+getSessionId();
    142     url += '&cmd=NewJob&plugin_class=net.sf.basedb.mev.plugin.TdmsExporterPlugin';
    143     url += '&item_type=BIOASSAYSET&context_type=ITEM';
    144     url += '&job_name=' + encodeURIComponent('<%=HTML.javaScriptEncode(tdmsJobName)%>');
    145     url += '&parameter:saveAs='+encodeURIComponent('<%=HTML.javaScriptEncode(defaultPath+defaultTdmsFileName)%>');
    146     url += '&parameter:attachToBioAssaySet=true';
    147     Main.openPopup(url, 'CreateTDMSFile', 750, 500);
    148     window.close();
    149   }
    150   function exportCgh()
    151   {
    152     var frm = document.forms['mev'];
    153     var url = getRoot()+'common/plugin/index.jsp?ID='+getSessionId();
    154     url += '&cmd=NewJob&plugin_class=net.sf.basedb.mev.plugin.CghExporterPlugin';
    155     url += '&pluginconfiguration_id=' + frm.cgh_configuration[frm.cgh_configuration.selectedIndex].value;
    156     url += '&item_type=BIOASSAYSET&context_type=ITEM';
    157     url += '&job_name=' + encodeURIComponent('<%=HTML.javaScriptEncode(cghJobName)%>');
    158     url += '&parameter:saveAs='+encodeURIComponent('<%=HTML.javaScriptEncode(defaultPath+defaultCghFileName)%>');
    159     url += '&parameter:attachToBioAssaySet=true';
    160     Main.openPopup(url, 'CreateCGHFile', 750, 500);
    161     window.close();
    162   }
    163   </script>
    164 </base:head>
     129<base:page type="popup" title="<%=title%>" id="mev-launch">
     130<base:head scripts="~scripts/mev.js" />
    165131<base:body>
    166132  <h1><%=title%></h1>
     133 
     134  <div id="page-data" class="datacontainer"
     135    data-bioassayset-id="<%=bioAssaySetId%>"
     136  ></div>
    167137
    168138  <form name="mev">
     
    177147    <tbody>
    178148      <tr>
    179         <td style="padding-bottom: 1em;"><base:button title="Start MeV"
    180           onclick="launchMev('mev.anl')"
    181           image="<%=anlFile == null ? homeUrl + "/images/tm4_disabled.png" : homeUrl + "/images/tm4.png" %>"
     149        <td style="padding-bottom: 1em;"><base:button
     150          title="Start MeV"
     151          subclass="auto-init"
     152          data-auto-init="start-mev"
     153          data-mev-file-type="mev.anl"
     154          image="<%=homeUrl + "/images/tm4.png" %>"
    182155          disabled="<%=anlFile == null%>"/></td>
    183156        <td style="padding-bottom: 1em;">
     
    207180    <tbody>
    208181      <tr>
    209         <td><base:button title="Start MeV"
    210           onclick="launchMev('mev.tdms')"
    211           image="<%=tdmsFile == null ? homeUrl + "/images/tm4_disabled.png" : homeUrl + "/images/tm4.png" %>"
     182        <td><base:button
     183          title="Start MeV"
     184          subclass="auto-init"
     185          data-auto-init="start-mev"
     186          data-mev-file-type="mev.tdms"
     187          image="<%=homeUrl + "/images/tm4.png" %>"
    212188          disabled="<%=tdmsFile == null%>"/></td>
    213189        <td>
     
    230206      </tr>
    231207      <tr>
    232         <td style="padding-bottom: 1em;"><base:button title="Export"
    233           onclick="exportTdms()"
     208        <td style="padding-bottom: 1em;"><base:button
     209          id="export-tdms"
     210          title="Export"
    234211          disabled="<%=!allowCreateFile%>"
    235           image="<%=allowCreateFile ? "export.gif" : homeUrl + "/images/export_disabled.gif"%>" /></td>
     212          data-job-name="<%=HTML.encodeTags(tdmsJobName) %>"
     213          data-save-as="<%=HTML.encodeTags(defaultPath+defaultTdmsFileName)%>"
     214          image="export.png" /></td>
    236215        <td style="padding-bottom: 1em;">
    237216        <%
     
    259238    <tbody>
    260239      <tr>
    261         <td><base:button title="Start MeV"
    262           onclick="launchMev('mev.cgh')"
    263           image="<%=cghFile == null ? homeUrl + "/images/tm4_disabled.png" : homeUrl + "/images/tm4.png" %>"
     240        <td><base:button
     241          title="Start MeV"
     242          subclass="auto-init"
     243          data-auto-init="start-mev"
     244          data-mev-file-type="mev.cgh"
     245          image="<%=homeUrl + "/images/tm4.png" %>"
    264246          disabled="<%=cghFile == null%>"/></td>
    265247        <td>
     
    282264      </tr>
    283265      <tr>
    284         <td><base:button title="Export"
    285           onclick="exportCgh()"
     266        <td><base:button
     267          id="export-cgh"
     268          title="Export"
    286269          disabled="<%=!canCreateCGHFile%>"
    287           image="<%=canCreateCGHFile ? "export.gif" : homeUrl + "/images/export_disabled.gif"%>" /></td>
     270          data-job-name="<%=HTML.encodeTags(cghJobName) %>"
     271          data-save-as="<%=HTML.encodeTags(defaultPath+defaultCghFileName)%>"
     272          image="export.png" /></td>
    288273        <td>
    289274        <%
     
    335320
    336321  <base:buttongroup subclass="dialogbuttons">
    337     <base:button onclick="window.close();" title="Close" />
     322    <base:button id="close" title="Close" />
    338323  </base:buttongroup>
    339324
  • extensions/net.sf.basedb.mev/trunk/resources/options.jsp

    r1541 r2209  
    5353  int maxMemory = Values.getInt(sc.getUserClientSetting("net.sf.basedb.mev.launchmev.jvm.maxmemory"), 512);
    5454%>
    55 <base:page type="popup" title="<%="MeV Launcher options for "+HTML.encodeTags(user.getName())%>">
    56 <base:head scripts="tabcontrol.js" styles="tabcontrol.css">
    57   <script language="JavaScript">
    58   function validateOptions()
    59   {
    60     return true;
    61   }
    62   function saveSettings()
    63   {
    64     document.forms['mevoptions'].submit();
    65   }
    66   </script>
    67 </base:head>
     55<base:page type="popup" title="<%="MeV Launcher options for "+HTML.encodeTags(user.getName())%>" id="mev-options">
     56<base:head scripts="tabcontrol.js,~scripts/mev.js" styles="tabcontrol.css" />
    6857<base:body>
    6958
    7059  <h1>MeV Launcher options for <%=HTML.encodeTags(user.getName())%></h1>
    71   <form action="submit.jsp?ID=<%=ID%>" method="post" name="mevoptions" onsubmit="return false;">
     60  <form action="submit.jsp?ID=<%=ID%>" method="post" name="mevoptions">
    7261  <input type=hidden name="cmd" value="SaveOptions">
    7362 
     
    7766    <tr style="height: 3em;">
    7867      <th>JVM max memory</td>
    79       <td><input class="text" type="text" name="maxMemory"
    80           value="<%=maxMemory%>" style="width: 12em;" maxlength="6"
    81           onkeypress="return Numbers.integerOnly(event)"> MB</td>
     68      <td><input class="text" type="text" name="maxMemory" id="maxMemory"
     69          value="<%=maxMemory%>" style="width: 12em;" maxlength="6"> MB</td>
    8270    </tr>
    8371    </table>
     
    9381
    9482  <base:buttongroup subclass="dialogbuttons">
    95     <base:button onclick="saveSettings();" title="Save" />
    96     <base:button onclick="window.close();" title="Cancel" />
     83    <base:button id="btnSave" title="Save" />
     84    <base:button id="close" title="Cancel" />
    9785  </base:buttongroup>
    9886 
  • extensions/net.sf.basedb.mev/trunk/resources/scripts/mev.js

    r2208 r2209  
    1 <%@ page
    2   pageEncoding="UTF-8"
    3   session="false"
    4   contentType="text/javascript"
    5   import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
    6 %>
    7 <%!
    8   final String homeUrl = ExtensionsControl.getHomeUrl("net.sf.basedb.mev.launchmev");
    9 %>
    10 var MeV = new function()
     1
     2var MeV = function()
    113{
    12   this.launch = function(bioAssaySetId)
     4  var mev = {};
     5
     6  mev.initPage = function()
    137  {
    14     var url = '<%=homeUrl%>/launch_mev.jsp';
    15     url += '?ID='+getSessionId();
    16     url += '&bioassayset_id=' + bioAssaySetId;
    17     Main.openPopup(url, 'LaunchMev', 600, 400);
     8    var pageId = Doc.getPageId();
     9    if (pageId == 'mev-options')
     10    {
     11      Buttons.addClickHandler('close', App.closeWindow);
     12      Buttons.addClickHandler('btnSave', mev.saveOptions);
     13      Events.addEventHandler('maxMemory', 'keypress', Events.integerOnly);
     14    }
     15    else if (pageId == 'mev-launch')
     16    {
     17      Buttons.addClickHandler('close', App.closeWindow);
     18      Buttons.addClickHandler('export-tdms', mev.exportTdms);
     19      Buttons.addClickHandler('export-cgh', mev.exportCgh);
     20    }
     21  }
     22 
     23  mev.initElement = function(element, autoInit)
     24  {
     25    if (autoInit == 'launch-mev')
     26    {
     27      Events.addEventHandler(element, 'click', mev.launchDialog);
     28    }
     29    else if (autoInit == 'start-mev')
     30    {
     31      Buttons.addClickHandler(element, mev.startMev);
     32    }
    1833  }
    1934
    20 }
    21 ();
     35  mev.launchDialog = function(event)
     36  {
     37    var bioAssaySetId = Data.int(event.currentTarget, 'item-id');
     38    var homeUrl = Data.get(event.currentTarget, 'home');
     39    var url = homeUrl+'/launch_mev.jsp?ID='+App.getSessionId();
     40    url += '&bioassayset_id=' + bioAssaySetId;
     41    Dialogs.openPopup(url, 'LaunchMev', 600, 400);
     42  }
     43
     44  mev.startMev = function(event)
     45  {
     46    var fileType = Data.get(event.currentTarget, 'mev-file-type');
     47    var bioAssaySetId = Data.int('page-data', 'bioassayset-id');
     48   
     49    var url = 'mev_jnlp.jsp?ID='+App.getSessionId();
     50    url += '&bioassayset_id='+bioAssaySetId;
     51    url += '&filetype=' + fileType;
     52    window.opener.location.href = url;
     53    setTimeout(App.closeWindow, 500);
     54  }
     55
     56  mev.exportTdms = function(event)
     57  {
     58    var url = App.getRoot()+'common/plugin/index.jsp?ID='+App.getSessionId();
     59    url += '&cmd=NewJob&plugin_class=net.sf.basedb.mev.plugin.TdmsExporterPlugin';
     60    url += '&item_type=BIOASSAYSET&context_type=ITEM';
     61    url += '&job_name=' + encodeURIComponent(Data.get(event.currentTarget, 'job-name'));
     62    url += '&parameter:saveAs='+encodeURIComponent(Data.get(event.currentTarget, 'save-as'));
     63    url += '&parameter:attachToBioAssaySet=true';
     64    Dialogs.openPopup(url, 'CreateTDMSFile', 750, 500);
     65    window.close();
     66  }
     67 
     68  mev.exportCgh = function(event)
     69  {
     70    var frm = document.forms['mev'];
     71    var url = App.getRoot()+'common/plugin/index.jsp?ID='+App.getSessionId();
     72    url += '&cmd=NewJob&plugin_class=net.sf.basedb.mev.plugin.CghExporterPlugin';
     73    url += '&pluginconfiguration_id=' + frm.cgh_configuration[frm.cgh_configuration.selectedIndex].value;
     74    url += '&item_type=BIOASSAYSET&context_type=ITEM';
     75    url += '&job_name=' + encodeURIComponent(Data.get(event.currentTarget, 'job-name'));
     76    url += '&parameter:saveAs='+encodeURIComponent(Data.get(event.currentTarget, 'save-as'));
     77    url += '&parameter:attachToBioAssaySet=true';
     78    Dialogs.openPopup(url, 'CreateCGHFile', 750, 500);
     79    window.close();
     80  }
     81
     82  mev.saveOptions = function()
     83  {
     84    document.forms['mevoptions'].submit();
     85  }
     86
     87  return mev;
     88}();
     89
     90Doc.onLoad(MeV.initPage);
     91Doc.addElementInitializer(MeV.initElement);
  • extensions/net.sf.basedb.mev/trunk/src/server/net/sf/basedb/mev/factory/MevButtonFactory.java

    r1416 r2209  
    9999        action.setIcon(getIcon());
    100100        action.setId(getId());
    101         action.setOnClick(getOnClick().replace("$ID$", ID));
    102101        action.setStyle(getStyle());
    103102        action.setTitle(getTitle());
    104103        action.setTooltip(getTooltip());
    105104        action.setVisible(isVisible());
     105        action.setDynamicActionAttributesSource(this);
     106        setParameter("data-item-id", ID);
    106107        actions = new ButtonAction[] { action };
    107108      }
Note: See TracChangeset for help on using the changeset viewer.