Opened 10 years ago

Closed 10 years ago

#608 closed enhancement (fixed)

Update Labenv to new scripting pattern

Reported by: Nicklas Nordborg Owned by: olle
Priority: major Milestone: LabEnv v1.3
Component: net.sf.basedb.labenv Keywords:
Cc:

Description (last modified by olle)

Similar to #564 and #571, but Labenv contains a lot more script than any of the other extensions.

First step is to make sure that Labenv code that appear in BASE (eg. the menu items) are fixed. When that is done Labenv should work with default BASE settings if released with <about safe-scripts="1" safe-resources="0">.

After that we can refactor each Labenv wizard one by one as there is to spare.

NOTE! Adding this to LabEnv 1.2, but should be moved to a later milestone if LabEnv 1.2 is released before BASE 3.3.

Change History (9)

comment:1 by olle, 10 years ago

Description: modified (diff)
Milestone: LabEnv v1.2LabEnv v1.3

Moved ticket to LabEnv v1.3.

comment:2 by olle, 10 years ago

Status: newassigned

Ticket accepted.

comment:3 by olle, 10 years ago

Traceability note:

  • The lab environment extension was introduced in Ticket #529 (Retrieve and store temperature and humidity measurements).
  • Reggie ticket #530 (Display logs from temperature and humidity measurements) is concerned with retrieving data from the lab environment data base for specific dates of interest for the sample preparation and sequencing.

LabEnv v1.1:

  • The lab environment extension was updated in Ticket #592 (Lab environment extension improved report routines).

LabEnv v1.2:

  • The lab environment extension was updated in Ticket #607 (Date /time format is different in configuration file and GUI).
  • The lab environment extension was updated in Ticket #610 (Mail server prints debug output as default).
  • The lab environment extension was updated in Ticket #612 (LabEnv overview display shows wrong time offsets when the latest data points are filtered away).
  • The lab environment extension was updated in Ticket #615 (Lab environment extension stability improvement and bug fixes for v1.1).
Last edited 10 years ago by olle (previous) (diff)

comment:4 by olle, 10 years ago

Design discussion:

  1. Each JSP file should be modified to not include <script> tags nor "onclick" attributes. The Javascript code in the current <script> tag should be placed in a separate Javascript file with the same base name (filename without file extension) as the JSP file, but with file extension ".js". The JSP file should refer to the corresponding Javascript file for functionality.
  2. JSP/Javascript code should be updated to the structure used in Reggie v.2.17, specifically Reggie v.2.17.2. This includes use of the "Wizard" functionality to control steps in the user interface.
  3. XML file extensions.xml in META-INF/ should be updated in "<about>" tags to set attributes "safe-scripts="1"" and "safe-resources="0"", where appropriate.

Comments on some code details:

  • In order to update the code structure to that used in Reggie v.2.17, Javascript library reggie.js should be exchanged for reggie-2.js, and CSS file reggie.css should be exchanged for reggie-2.css:
    a. Javascript library reggie-2.js gives access to the "Wizard" functionality.
    b. Class and id names in the JSP file must be modified to work with the reggie-2.css style sheets.
    c. The "<form>" tag in the JSP file must be updated to include attributes "id="wizard" class="wizard"", in order for the "Wizard" functionality to work, as well as to get the correct style from CSS file reggie-2.css.
    d. For the "Wizard" to be able to automatically display and hide different steps in the user interface appropriately, the JSP file must be updated to enclose code for each step in "<div>" tags with specific class and id names.
    e. Ajax calls should be made using function Wizard.asyncJsonRequest(url, callback, method, postdata) in Javascript library file reggie-2.js.
    f. Javascript library file reggie-2.js automatically prints Reggie program name and version number in the upper right corner of the web page. Since reggie-2.js here only works as a supporting Javascript library, this may be confusing in two ways; first since the real BASE extension name is "LabEnv", and second since another full Reggie BASE extension with another version number may be installed on the same BASE installation. Therefore the JSP file should be extended in the "<style>" tag to set "#reggie-version{display: none;}", in order to hide this entry.
Version 5, edited 10 years ago by olle (previous) (next) (diff)

comment:5 by olle, 10 years ago

(In [2989]) Refs #608. LabEnv updated to new scripting pattern:

  1. XML configuration file extensions.xml in META-INF updated in "<about>" tags to set attributes "safe-scripts="1"" and "safe-resources="0"", where appropriate.
  2. Updates in resources/:
    a. Javascript library file reggie.js exchanged for reggie-2.js.
    b. New Javascript library file print.js added.
    c. JSP print template file print_template.jsp updated to work with new Javascript and CSS files.
  3. Updates in resources/css/:
    a. CCS file reggie.css exchanged for reggie-2.css.
    b. CSS file printable.css updated with style for print button and print instructions.
    c. New CSS file report.css and SVG file filters.svg added.
  4. JSP files in resources/reports/ with combined layout and functionality have had the functionality placed in separate Javascript ".js" files, with the same base name (filename without file extension) as the JSP files:
    a. labenvironmentalarms.jsp
    b. labenvironmentdatabasedisplay.jsp
    c. labenvironmentdatabaseeventpopup.jsp
    d. labenvironmentdatabaseexport.jsp
    e. labenvironmentdatabasestatistics.jsp
    f. labsensorinfo.jsp
  5. Javascript library file boxplot.js in resources/reports/ updated by removal of unused functions.

comment:6 by olle, 10 years ago

(In [2992]) Refs #608. LabEnv updated to new scripting pattern:

  1. XML configuration file extensions.xml in META-INF updated in "<about>" tags to set attribute "safe-resources="1"", since this will enforce content security policy.

comment:7 by olle, 10 years ago

(In [2994]) Refs #608. LabEnv updated to new scripting pattern:

  1. XML configuration file extensions.xml in META-INF updated in top "<about>" tag to set attribute "safe-scripts="1"", in order to avoid content security policy warnings.

comment:8 by Nicklas Nordborg, 10 years ago

(In [3011]) References #608: Update Labenv to new scripting pattern

The "LabEnv" link was linking the Javascript file (*.js) instead of the JSP file.

comment:9 by olle, 10 years ago

Resolution: fixed
Status: assignedclosed

Ticket closed as the requested modifications have been added. If problems should occur, or more modifications be needed, this ticket will be re-opened or a new ticket created.

Note: See TracTickets for help on using tickets.