diff --git a/api/scripts/mtz2map.sh b/api/scripts/mtz2map.sh
index 00542447d..1d25a72a4 100755
--- a/api/scripts/mtz2map.sh
+++ b/api/scripts/mtz2map.sh
@@ -14,6 +14,14 @@ else
fi
fi
+#export CCP4_MASTER=/dls_sw/apps/ccp4/
+export CCP4_MASTER=$5
+export CINCL=$CCP4_MASTER/include
+export CLIBD=$CCP4_MASTER/lib/data
+
+export CCP4_SCR=/tmp
+export root=$CCP4_MASTER/bin
+
if [ $3 == 'dimple' -o $3 == 'mrbump' ]; then
if [ -f $4 ]; then
@@ -28,14 +36,6 @@ else
fi
fi
-#export CCP4_MASTER=/dls_sw/apps/ccp4/
-export CCP4_MASTER=$5
-export CINCL=$CCP4_MASTER/include
-export CLIBD=$CCP4_MASTER/lib/data
-
-export CCP4_SCR=/tmp
-export root=$CCP4_MASTER/bin
-
if [ $3 == 'dimple' ]; then
if $root/mtzinfo $mtz | grep -q PH2FOFCWT; then
diff --git a/api/src/Page/Cell.php b/api/src/Page/Cell.php
index 80fbcc071..e0e0b7d4b 100644
--- a/api/src/Page/Cell.php
+++ b/api/src/Page/Cell.php
@@ -274,8 +274,8 @@ function _beamlines()
$pdb = $this->db->pq("SELECT TO_CHAR(p.pdbdate, 'YYYY') as year, $replace as bl, count(p.pdbentryid) as count
FROM pdbentry p
WHERE p.pdbdate > TO_DATE('2010-05', 'YYYY-MM')
- GROUP BY $replace, TO_CHAR(p.pdbdate, 'YYYY')
- ORDER BY TO_CHAR(p.pdbdate, 'YYYY')");
+ GROUP BY bl, year
+ ORDER BY year, bl");
$isp = $this->db->pq("SELECT TO_CHAR(p.pdbdate, 'YYYY') as year, CASE WHEN p.autoprocprogramid > 0 THEN UPPER(s.beamlinename) ELSE $replace END as bl, count(p.pdbentryid) as count
FROM pdbentry p
@@ -284,8 +284,8 @@ function _beamlines()
INNER JOIN datacollectiongroup dcg ON dcg.datacollectiongroupid = dc.datacollectiongroupid
INNER JOIN blsession s ON s.sessionid = dcg.sessionid
WHERE p.pdbdate > TO_DATE('2010-05', 'YYYY-MM')
- GROUP BY CASE WHEN p.autoprocprogramid > 0 THEN UPPER(s.beamlinename) ELSE $replace END, TO_CHAR(p.pdbdate, 'YYYY')
- ORDER BY TO_CHAR(p.pdbdate, 'YYYY')");
+ GROUP BY bl, year
+ ORDER BY year, bl");
foreach ($pdb as $i => &$s) {
$s['COUNT'] = intval(($s['COUNT']));
diff --git a/api/src/Page/DC.php b/api/src/Page/DC.php
index 34e59f5f2..165e53c6d 100644
--- a/api/src/Page/DC.php
+++ b/api/src/Page/DC.php
@@ -62,6 +62,8 @@ class DC extends Page
array('/dat/:id', 'get', '_plot'),
);
+ const EVTOA = 12398.4198;
+
# ------------------------------------------------------------------------
# Data Collection AJAX Requests
# This is pretty crazy, it will return unioned data collections, energy
@@ -422,9 +424,12 @@ function _data_collections($single = null)
dc.transmission,
dc.axisrange,
dc.wavelength,
+ ".self::EVTOA."/dc.wavelength as energy,
dc.comments,
1 as epk,
1 as ein,
+ 1 as wpk,
+ 1 as win,
dc.xtalsnapshotfullpath1 as x1,
dc.xtalsnapshotfullpath2 as x2,
dc.xtalsnapshotfullpath3 as x3,
@@ -556,9 +561,12 @@ function _data_collections($single = null)
min(dc.transmission) as transmission,
min(dc.axisrange) as axisrange,
min(dc.wavelength) as wavelength,
+ ".self::EVTOA."/min(dc.wavelength) as energy,
min(dc.comments) as comments,
1 as epk,
1 as ein,
+ 1 as wpk,
+ 1 as win,
min(dc.xtalsnapshotfullpath1) as x1,
min(dc.xtalsnapshotfullpath2) as x2,
min(dc.xtalsnapshotfullpath3) as x3,
@@ -705,17 +713,20 @@ function _data_collections($single = null)
es.energyscanid,
1,
es.element,
- es.peakfprime,
+ es.peakfprime as resolution,
es.exposuretime,
es.axisposition,
- es.peakfdoubleprime,
+ es.peakfdoubleprime as numimg,
es.starttime as st,
es.transmissionfactor,
- es.inflectionfprime,
- es.inflectionfdoubleprime,
+ es.inflectionfprime as axisrange,
+ es.inflectionfdoubleprime as wavelength,
+ 1 as energy,
es.comments,
es.peakenergy,
es.inflectionenergy,
+ ".self::EVTOA."/es.peakenergy as wpk,
+ ".self::EVTOA."/es.inflectionenergy as win,
'A',
'A',
'A',
@@ -805,10 +816,13 @@ function _data_collections($single = null)
TO_CHAR(xrf.starttime, 'DD-MM-YYYY HH24:MI:SS') as st,
xrf.beamtransmission,
1,
- xrf.energy,
+ ".self::EVTOA."/xrf.energy as wavelength,
+ xrf.energy as energy,
xrf.comments,
1,
1,
+ 1 as wpk,
+ 1 as win,
'A',
'A',
'A',
@@ -899,9 +913,12 @@ function _data_collections($single = null)
1,
1,
1,
+ 1 as energy,
'A',
1,
1,
+ 1 as wpk,
+ 1 as win,
r.xtalsnapshotbefore,
r.xtalsnapshotafter,
'A',
@@ -974,7 +991,7 @@ function _data_collections($single = null)
// Data collections
if ($dc['TYPE'] == 'data') {
- $nf = array(1 => array('AXISSTART', 'CHISTART', 'PHI', 'OVERLAP'), 2 => array('RESOLUTION', 'TRANSMISSION', 'AXISRANGE', 'TOTALDOSE'), 4 => array('WAVELENGTH', 'EXPOSURETIME'));
+ $nf = array(0 => array('ENERGY'), 1 => array('AXISSTART', 'CHISTART', 'PHI', 'OVERLAP'), 2 => array('RESOLUTION', 'TRANSMISSION', 'AXISRANGE', 'TOTALDOSE'), 4 => array('WAVELENGTH', 'EXPOSURETIME'));
$dc['DIRFULL'] = $dc['DIR'];
$dc['DIR'] = preg_replace('/.*\/' . $this->arg('prop') . '-' . $dc['VN'] . '\//', '', $dc['DIR']);
@@ -993,9 +1010,10 @@ function _data_collections($single = null)
$dc['DCT'] = 'Data Collection';
}
- if ($dc['DCT'] == 'Mesh')
+ if ($dc['DCT'] == 'Mesh' || $dc['DCT'] == 'Mesh3D' ||
+ ($dc['DCT'] != 'Serial Fixed' && $dc['DCT'] != 'Serial Jet' && $dc['AXISRANGE'] == 0 && $dc['NI'] > 1)
+ ) {
$dc['DCT'] = 'Grid Scan';
- if ($dc['DCT'] != 'Serial Fixed' && $dc['DCT'] != 'Serial Jet' && $dc['AXISRANGE'] == 0 && $dc['NI'] > 1) {
$dc['TYPE'] = 'grid';
}
//$this->profile('dc');
@@ -1010,12 +1028,12 @@ function _data_collections($single = null)
$dc['FILETEMPLATE'] = preg_replace('/.*\/' . $this->arg('prop') . '-' . $dc['VN'] . '\//', '', $dc['FILETEMPLATE']);
- $nf = array(2 => array('EXPOSURETIME', 'AXISSTART', 'RESOLUTION', 'TRANSMISSION'));
+ $nf = array(1 => array('EPK', 'EIN'), 2 => array('AXISRANGE', 'WAVELENGTH', 'EXPOSURETIME', 'AXISSTART', 'RESOLUTION', 'TRANSMISSION', 'NUMIMG'), 5 => array('WPK', 'WIN'));
$this->profile('edge');
// MCA Scans
} else if ($dc['TYPE'] == 'mca') {
- $nf = array(2 => array('EXPOSURETIME', 'WAVELENGTH', 'TRANSMISSION'));
+ $nf = array(0 => array('ENERGY'), 2 => array('EXPOSURETIME', 'TRANSMISSION'), 4 => array('WAVELENGTH'));
$dc['DIRFULL'] = $dc['DIR'];
$dc['DIR'] = preg_replace('/.*\/\d\d\d\d\/\w\w\d+-\d+\//', '', $dc['DIR']);
diff --git a/api/src/Page/Download.php b/api/src/Page/Download.php
index a1ed29bca..6333e6b0e 100644
--- a/api/src/Page/Download.php
+++ b/api/src/Page/Download.php
@@ -92,9 +92,7 @@ function _download_visit()
$this->_error('There doesnt seem to be a data archive available for this visit');
}
- # ------------------------------------------------------------------------
- # Download mtz/log file for Fast DP / XIA2
- # TODO: Delete me
+
# This method either returns a list of plots from MX auto processing tools (n_obs, n_uniq, completeness etc.)
# Or returns a specific plot based on auto processing attachment id (aid).
# Individual plotly format Graphs can be returned via an aid, but will not be included in the list of plots (as their format is different)
@@ -468,14 +466,14 @@ function _get_autoproc_archive()
$aps = $this->db->union(
array(
- "SELECT app.autoprocprogramid, app.processingprograms, app.processingstatus
+ "SELECT app.autoprocprogramid, app.processingprograms, app.processingstatus, dc.imageprefix, dc.datacollectionnumber
FROM autoprocintegration api
INNER JOIN autoprocprogram app ON api.autoprocprogramid = app.autoprocprogramid
INNER JOIN datacollection dc ON dc.datacollectionid = api.datacollectionid
INNER JOIN datacollectiongroup dcg ON dcg.datacollectiongroupid = dc.datacollectiongroupid
INNER JOIN blsession s ON s.sessionid = dcg.sessionid
WHERE s.proposalid=:1 AND app.autoprocprogramid=:2",
- "SELECT app.autoprocprogramid, app.processingprograms, app.processingstatus
+ "SELECT app.autoprocprogramid, app.processingprograms, app.processingstatus, dc.imageprefix, dc.datacollectionnumber
FROM autoprocprogram app
INNER JOIN processingjob pj on pj.processingjobid = app.processingjobid
INNER JOIN datacollection dc ON dc.datacollectionid = pj.datacollectionid
@@ -497,7 +495,7 @@ function _get_autoproc_archive()
}
$clean_program = preg_replace('/[^A-Za-z0-9\-]/', '', $ap['PROCESSINGPROGRAMS']);
- $zipName = $this->arg('AUTOPROCPROGRAMID') . '_' . $clean_program;
+ $zipName = $this->arg('AUTOPROCPROGRAMID') . '_' . $ap['IMAGEPREFIX'] . '_' . $ap['DATACOLLECTIONNUMBER'] . '_' . $clean_program;
$this->_streamZipFile($files, $zipName);
}
diff --git a/api/src/Page/Sample.php b/api/src/Page/Sample.php
index d1a051493..4d2093fff 100644
--- a/api/src/Page/Sample.php
+++ b/api/src/Page/Sample.php
@@ -195,6 +195,7 @@ class Sample extends Page
array('/pdbs(/pid/:pid)', 'get', '_get_pdbs'),
array('/pdbs', 'post', '_add_pdb'),
array('/pdbs(/:pdbid)', 'delete', '_remove_pdb'),
+ array('/pdbs/download/:pdbid', 'get', '_download_pdb'),
array('/concentrationtypes', 'get', '_concentration_types'),
array('/componenttypes', 'get', '_component_types'),
@@ -2062,6 +2063,21 @@ function _get_pdbs()
$this->_output($rows);
}
+ # ------------------------------------------------------------------------
+ # Download a pdb file
+ function _download_pdb()
+ {
+ if (!$this->has_arg('pdbid'))
+ $this->_error('No PDB id specified');
+
+ $pdb = $this->db->pq("SELECT name, contents FROM pdb WHERE pdbid = :1", array($this->arg('pdbid')));
+ $pdb = $pdb[0];
+
+ header('Content-Type:text/plain');
+ header('Content-Disposition:attachment;filename='.$pdb['NAME']);
+ print $pdb['CONTENTS'];
+ }
+
# ------------------------------------------------------------------------
# Add a new pdb
function _add_pdb()
diff --git a/api/src/Page/Shipment.php b/api/src/Page/Shipment.php
index fdb44b725..24fbeea13 100644
--- a/api/src/Page/Shipment.php
+++ b/api/src/Page/Shipment.php
@@ -484,10 +484,10 @@ function _add_history()
if (!$this->has_arg('BARCODE'))
$this->_error('No barcode specified');
- if (!$this->has_arg('LOCATION'))
- $this->_error('No location specified');
+ if (!$this->has_arg('LOCATION') && !$this->has_arg('STATUS'))
+ $this->_error('No location or status specified');
- $dew = $this->db->pq("SELECT CONCAT(pe.givenname, ' ', pe.familyname) as lcout, pe.emailaddress as lcoutemail, CONCAT(CONCAT(pe2.givenname, ' '), pe2.familyname) as lcret, pe2.emailaddress as lcretemail, CONCAT(p.proposalcode, p.proposalnumber, '-', e.visit_number) as firstexp, TO_CHAR(e.startdate, 'DD-MM-YYYY HH24:MI') as firstexpst, e.beamlinename, e.beamlineoperator, d.dewarid, d.trackingnumberfromsynchrotron, s.shippingid, s.shippingname, p.proposalcode, CONCAT(p.proposalcode, p.proposalnumber) as prop, d.barcode, d.facilitycode, d.firstexperimentid, d.dewarstatus
+ $dew = $this->db->pq("SELECT CONCAT(pe.givenname, ' ', pe.familyname) as lcout, pe.emailaddress as lcoutemail, CONCAT(CONCAT(pe2.givenname, ' '), pe2.familyname) as lcret, pe2.emailaddress as lcretemail, CONCAT(p.proposalcode, p.proposalnumber, '-', e.visit_number) as firstexp, TO_CHAR(e.startdate, 'DD-MM-YYYY HH24:MI') as firstexpst, e.beamlinename, e.beamlineoperator, d.dewarid, d.trackingnumberfromsynchrotron, s.shippingid, s.shippingname, p.proposalcode, CONCAT(p.proposalcode, p.proposalnumber) as prop, d.barcode, d.facilitycode, d.firstexperimentid, d.dewarstatus, d.storagelocation
FROM dewar d
INNER JOIN shipping s ON s.shippingid = d.shippingid
LEFT OUTER JOIN labcontact c ON s.sendinglabcontactid = c.labcontactid
@@ -505,15 +505,9 @@ function _add_history()
$track = $this->has_arg('TRACKINGNUMBERFROMSYNCHROTRON') ? $this->arg('TRACKINGNUMBERFROMSYNCHROTRON') : $dew['TRACKINGNUMBERFROMSYNCHROTRON'];
- // What was the last history entry for this dewar?
- // If it's come from a beamline, register flag so we can e-mail further down...
- $last_history_results = $this->db->pq("SELECT storageLocation FROM dewartransporthistory WHERE dewarId = :1 ORDER BY DewarTransportHistoryId DESC LIMIT 1", array($dew['DEWARID']));
-
- if (sizeof($last_history_results)) {
- $last_history = $last_history_results[0];
- // We only add data to dewar history in lower case from this method.
- // If that ever changes, update this to become case insensitive search
- $last_location = $last_history['STORAGELOCATION'];
+ if ($this->has_arg('LOCATION')) {
+ // If it's come from a beamline, register flag so we can e-mail further down...
+ $last_location = $dew['STORAGELOCATION'];
if (!isset($dewar_complete_email_locations) || !is_array($dewar_complete_email_locations)) {
$bls = $this->_get_beamlines_from_type('all');
$send_return_email = in_array($last_location, $bls);
@@ -521,99 +515,103 @@ function _add_history()
$email_location = $dewar_complete_email_locations[$last_location];
$send_return_email = preg_match($email_location, strtolower($this->arg('LOCATION')));
}
+ // If dewar status is dispatch-requested - don't change it.
+ // This way the dewar can be moved between storage locations and keep the record that a user requested the dispatch
+ // Default status is 'at-facility'
+ $dewarstatus = strtolower($dew['DEWARSTATUS']) == 'dispatch-requested' ? 'dispatch-requested' : 'at facility';
+ $dewarlocation = $this->arg('LOCATION');
+
} else {
- // No history - could be a new dewar, so not necessarily an error...
- if ($this->debug)
- error_log("No previous dewar transport history for DewarId " . $dew['DEWARID']);
+ // just a status given
+ $dewarstatus = $this->arg('STATUS');
+ $dewarlocation = $dew['STORAGELOCATION'];
}
- // If dewar status is dispatch-requested - don't change it.
- // This way the dewar can be moved between storage locations and keep the record that a user requested the dispatch
- // Default status is 'at-facility'
- $dewarstatus = strtolower($dew['DEWARSTATUS']) == 'dispatch-requested' ? 'dispatch-requested' : 'at facility';
- $this->db->pq("INSERT INTO dewartransporthistory (dewartransporthistoryid,dewarid,dewarstatus,storagelocation,arrivaldate) VALUES (s_dewartransporthistory.nextval,:1,lower(:2),lower(:3),CURRENT_TIMESTAMP) RETURNING dewartransporthistoryid INTO :id", array($dew['DEWARID'], $dewarstatus, $this->arg('LOCATION')));
+ $this->db->pq("INSERT INTO dewartransporthistory (dewartransporthistoryid,dewarid,dewarstatus,storagelocation,arrivaldate) VALUES (s_dewartransporthistory.nextval,:1,lower(:2),lower(:3),CURRENT_TIMESTAMP) RETURNING dewartransporthistoryid INTO :id", array($dew['DEWARID'], $dewarstatus, $dewarlocation));
$dhid = $this->db->id();
- $this->db->pq("UPDATE dewar set dewarstatus=lower(:4), storagelocation=lower(:2), trackingnumberfromsynchrotron=:3 WHERE dewarid=:1", array($dew['DEWARID'], $this->arg('LOCATION'), $track, $dewarstatus));
- $this->db->pq("UPDATE shipping set shippingstatus=lower(:2) WHERE shippingid=:1", array($dew['SHIPPINGID'], $dewarstatus));
-
- $containers = $this->db->pq("SELECT containerid
- FROM container
- WHERE dewarid=:1", array($dew['DEWARID']));
- foreach ($containers as $c) {
- $this->db->pq("INSERT INTO containerhistory (containerid,status) VALUES (:1,:2)", array($c['CONTAINERID'], 'at facility'));
- }
-
- // Email
- // EHCs, local contact(s), labcontact, dh, pa
- $dew['NOW'] = strftime('%d-%m-%Y %H:%M');
- $dew['INCONTACTS'] = $in_contacts;
- $dew['TRACKINGNUMBERFROMSYNCHROTRON'] = $track;
-
- if (strtolower($this->arg('LOCATION')) == 'stores-in' && $dew['LCOUTEMAIL']) {
- $lcs = $this->db->pq("SELECT p.login
- FROM person p
- INNER JOIN session_has_person shp ON shp.personid = p.personid
- WHERE shp.sessionid=:1 AND (shp.role = 'Local Contact' OR shp.role = 'Local Contact 2')", array($dew['FIRSTEXPERIMENTID']));
- $emails = array($dew['LCOUTEMAIL'], $arrival_email);
- foreach ($lcs as $lc) {
- array_push($emails, $this->_get_email($lc['LOGIN']));
- }
+ if ($this->has_arg('LOCATION')) {
+ $this->db->pq("UPDATE dewar set dewarstatus=lower(:4), storagelocation=lower(:2), trackingnumberfromsynchrotron=:3 WHERE dewarid=:1", array($dew['DEWARID'], $this->arg('LOCATION'), $track, $dewarstatus));
+ $this->db->pq("UPDATE shipping set shippingstatus=lower(:2) WHERE shippingid=:1", array($dew['SHIPPINGID'], $dewarstatus));
- $email = new Email($dew['PROPOSALCODE'] == 'in' ? 'dewar-stores-in-in' : 'dewar-stores-in', '*** Dewar Received for ' . $dew['PROP'] . ' at ' . $dew['NOW'] . ' ***');
- $email->data = $dew;
- $email->send(implode(', ', $emails));
- }
+ $containers = $this->db->pq("SELECT containerid
+ FROM container
+ WHERE dewarid=:1", array($dew['DEWARID']));
+ foreach ($containers as $c) {
+ $this->db->pq("INSERT INTO containerhistory (containerid,status) VALUES (:1,:2)", array($c['CONTAINERID'], 'at facility'));
+ }
- if (strtolower($this->arg('LOCATION')) == 'stores-out' && $dew['LCRETEMAIL']) {
- $email = new Email('dewar-stores-out', '*** Dewar ready to leave Synchrotron ***');
- $email->data = $dew;
- $email->send($dew['LCRETEMAIL']);
- }
+ // Email
+ // EHCs, local contact(s), labcontact, dh, pa
+ $dew['NOW'] = strftime('%d-%m-%Y %H:%M');
+ $dew['INCONTACTS'] = $in_contacts;
+ $dew['TRACKINGNUMBERFROMSYNCHROTRON'] = $track;
+
+ if (strtolower($this->arg('LOCATION')) == 'stores-in' && $dew['LCOUTEMAIL']) {
+ $lcs = $this->db->pq("SELECT p.login
+ FROM person p
+ INNER JOIN session_has_person shp ON shp.personid = p.personid
+ WHERE shp.sessionid=:1 AND (shp.role = 'Local Contact' OR shp.role = 'Local Contact 2')", array($dew['FIRSTEXPERIMENTID']));
+ $emails = array($dew['LCOUTEMAIL'], $arrival_email);
+ foreach ($lcs as $lc) {
+ array_push($emails, $this->_get_email($lc['LOGIN']));
+ }
- if (strpos(strtolower($this->arg('LOCATION')), '-rack') !== false && $dew['LCRETEMAIL']) {
- $dew['LOCATION'] = $this->arg('LOCATION');
+ $email = new Email($dew['PROPOSALCODE'] == 'in' ? 'dewar-stores-in-in' : 'dewar-stores-in', '*** Dewar Received for ' . $dew['PROP'] . ' at ' . $dew['NOW'] . ' ***');
+ $email->data = $dew;
+ $email->send(implode(', ', $emails));
+ }
- $email = new Email('dewar-rack', '*** Dewar now outside Beamline ***');
- $email->data = $dew;
- $email->send($dew['LCRETEMAIL']);
- }
+ if (strtolower($this->arg('LOCATION')) == 'stores-out' && $dew['LCRETEMAIL']) {
+ $email = new Email('dewar-stores-out', '*** Dewar ready to leave Synchrotron ***');
+ $email->data = $dew;
+ $email->send($dew['LCRETEMAIL']);
+ }
- if ($dew['LCRETEMAIL'] && $send_return_email) {
- // Any data collections for this dewar's containers?
- // Note this counts data collection ids for containers and uses the DataCollection.SESSIONID to determine the session/visit
- // Should work for UDC (where container.sessionid is set) as well as any normal scheduled session (where container.sessionid is not set)
- $rows = $this->db->pq("SELECT CONCAT(p.proposalcode, p.proposalnumber, '-', ses.visit_number) as visit, dc.sessionid, count(dc.datacollectionid) as dccount
- FROM Dewar d
- INNER JOIN Container c on c.dewarid = d.dewarid
- INNER JOIN BLSample bls ON bls.containerid = c.containerid
- INNER JOIN DataCollection dc ON dc.blsampleid = bls.blsampleid
- INNER JOIN BLSession ses ON dc.sessionid = ses.sessionid
- INNER JOIN Proposal p ON p.proposalid = ses.proposalid
- WHERE d.dewarid = :1
- GROUP BY dc.sessionid", array($dew['DEWARID']));
+ if (strpos(strtolower($this->arg('LOCATION')), '-rack') !== false && $dew['LCRETEMAIL']) {
+ $dew['LOCATION'] = $this->arg('LOCATION');
- if (sizeof($rows))
- $dew['DC'] = $rows;
+ $email = new Email('dewar-rack', '*** Dewar now outside Beamline ***');
+ $email->data = $dew;
+ $email->send($dew['LCRETEMAIL']);
+ }
- $cc = array($dewar_complete_email ? $dewar_complete_email : null);
+ if ($dew['LCRETEMAIL'] && $send_return_email) {
+ // Any data collections for this dewar's containers?
+ // Note this counts data collection ids for containers and uses the DataCollection.SESSIONID to determine the session/visit
+ // Should work for UDC (where container.sessionid is set) as well as any normal scheduled session (where container.sessionid is not set)
+ $rows = $this->db->pq("SELECT CONCAT(p.proposalcode, p.proposalnumber, '-', ses.visit_number) as visit, dc.sessionid, count(dc.datacollectionid) as dccount
+ FROM Dewar d
+ INNER JOIN Container c on c.dewarid = d.dewarid
+ INNER JOIN BLSample bls ON bls.containerid = c.containerid
+ INNER JOIN DataCollection dc ON dc.blsampleid = bls.blsampleid
+ INNER JOIN BLSession ses ON dc.sessionid = ses.sessionid
+ INNER JOIN Proposal p ON p.proposalid = ses.proposalid
+ WHERE d.dewarid = :1
+ GROUP BY dc.sessionid", array($dew['DEWARID']));
+
+ if (sizeof($rows))
+ $dew['DC'] = $rows;
+
+ $cc = array($dewar_complete_email ? $dewar_complete_email : null);
+
+ $owners = $this->db->pq("SELECT p.emailaddress
+ FROM Container c
+ INNER JOIN Person p ON c.ownerId = p.personId
+ WHERE c.dewarId = :1
+ GROUP BY p.emailaddress", array($dew['DEWARID']));
+
+ foreach ($owners as $owner) {
+ if ($owner['EMAILADDRESS'] != '') array_push($cc, $owner['EMAILADDRESS']);
+ }
- $owners = $this->db->pq("SELECT p.emailaddress
- FROM Container c
- INNER JOIN Person p ON c.ownerId = p.personId
- WHERE c.dewarId = :1
- GROUP BY p.emailaddress", array($dew['DEWARID']));
+ // Log the event if debugging
+ if ($this->debug) error_log("Dewar " . $dew['DEWARID'] . " back from beamline...");
- foreach ($owners as $owner) {
- if ($owner['EMAILADDRESS'] != '') array_push($cc, $owner['EMAILADDRESS']);
+ $email = new Email('storage-rack', '*** Visit finished, dewar awaiting instructions ***');
+ $email->data = $dew;
+ $email->send($dew['LCRETEMAIL'], implode(', ', $cc));
}
-
- // Log the event if debugging
- if ($this->debug) error_log("Dewar " . $dew['DEWARID'] . " back from beamline...");
-
- $email = new Email('storage-rack', '*** Visit finished, dewar awaiting instructions ***');
- $email->data = $dew;
- $email->send($dew['LCRETEMAIL'], implode(', ', $cc));
}
$this->_output(array('DEWARHISTORYID' => $dhid));
@@ -1147,6 +1145,7 @@ function _dispatch_dewar()
global $facility_country;
global $facility_courier_countries;
global $dispatch_email;
+ global $dispatch_email_regex;
global $dispatch_email_intl;
global $use_shipping_service;
global $shipping_service_links_in_emails;
@@ -1315,6 +1314,14 @@ function _dispatch_dewar()
$local_contact_email = $this->has_arg('LCEMAIL') ? $this->args['LCEMAIL'] : '';
if ($local_contact_email) $recpts .= ', ' . $local_contact_email;
+ if (!is_null($dispatch_email_regex)) {
+ foreach ($dispatch_email_regex as $address => $pattern) {
+ if (preg_match($pattern, $data['BARCODE'])) {
+ $recpts .= ', ' . $address;
+ }
+ }
+ }
+
$email->send($recpts);
// Update the dewar status and storage location
@@ -1343,6 +1350,7 @@ function _dispatch_dewar()
function _dispatch_dewar_confirmation()
{
global $dispatch_email;
+ global $dispatch_email_regex;
global $shipping_service_app_url;
if (!$this->has_arg('did'))
@@ -1405,6 +1413,14 @@ function _dispatch_dewar_confirmation()
$local_contact_email = $this->has_arg('LCEMAIL') ? $this->args['LCEMAIL'] : '';
if ($local_contact_email) $recpts .= ', ' . $local_contact_email;
+ if (!is_null($dispatch_email_regex)) {
+ foreach ($dispatch_email_regex as $address => $pattern) {
+ if (preg_match($pattern, $data['BARCODE'])) {
+ $recpts .= ', ' . $address;
+ }
+ }
+ }
+
$email->send($recpts);
// Also update the dewar status and storage location to keep it in sync with history...
diff --git a/client/src/js/models/protein.js b/client/src/js/models/protein.js
index 8cafd4338..2ef5f4758 100644
--- a/client/src/js/models/protein.js
+++ b/client/src/js/models/protein.js
@@ -16,7 +16,7 @@ define(['backbone', 'markdown'], function(Backbone, markdown) {
},
refreshOptions: function() {
- if (this.get('SEQUENCE')) this.attributes.SEQUENCEMD = markdown.toHTML(this.get('SEQUENCE'))
+ if (this.get('SEQUENCE')) this.set('SEQUENCEMD', markdown.toHTML(this.get('SEQUENCE')))
},
validation: {
diff --git a/client/src/js/models/visit.js b/client/src/js/models/visit.js
index ef8a86874..f62f49407 100644
--- a/client/src/js/models/visit.js
+++ b/client/src/js/models/visit.js
@@ -51,10 +51,10 @@ define(['backbone', 'backbone-validation', 'luxon'], function(Backbone, BackBone
addDate: function() {
var { DateTime } = luxon
- this.attributes.ENISO = DateTime.fromISO(this.get('ENISO'), { zone: this.dateTimeZone })
- this.attributes.STISO = DateTime.fromISO(this.get('STISO'), { zone: this.dateTimeZone })
- this.attributes.LEN = Number(this.attributes.ENISO.diff(this.attributes.STISO)/(3600*1000)).toFixed(2);
- this.attributes.VISITDETAIL = this.get('VISIT')+' ('+this.get('BL')+': '+this.get('ST')+')'
+ this.set('ENISO', DateTime.fromISO(this.get('ENISO'), { zone: this.dateTimeZone }))
+ this.set('STISO', DateTime.fromISO(this.get('STISO'), { zone: this.dateTimeZone }))
+ this.set('LEN', Number(this.get('ENISO').diff(this.get('STISO'))/(3600*1000)).toFixed(2))
+ this.set('VISITDETAIL', this.get('VISIT')+' ('+this.get('BL')+': '+this.get('ST')+')')
},
dateTimeZone: 'Europe/London'
diff --git a/client/src/js/modules/cell/views/beamlines.js b/client/src/js/modules/cell/views/beamlines.js
index d5481b991..1fd4470af 100644
--- a/client/src/js/modules/cell/views/beamlines.js
+++ b/client/src/js/modules/cell/views/beamlines.js
@@ -30,28 +30,27 @@ define(['marionette', 'utils',
})
var bl = []
+ var data = {}
_.each(bls, function(i, b) {
+ data[b] = {}
bl.push(b)
ticks.push([bl.length-1, b])
+ _.each(years, function(x, y) {
+ data[b][y] = 0
+ })
})
- _.each(this.model.get('data')[did], function(v, i) {
- var y = yrs.indexOf(v.YEAR)
- var b = bl.indexOf(v.BL)
- //console.log('d', y, b)
- d[y].data.push([b, v.COUNT])
- })
-
- function ascsort(a,b) {
- if (a[0] == b[0]) return 0
- else return (a[0] < b[0]) ? -1 : 1
- }
-
- _.each(d, function(d,i) {
- d.data.sort(ascsort)
- })
+ _.each(this.model.get('data')[did], function(v, i) {
+ data[v.BL][v.YEAR] = v.COUNT
+ })
- console.log(d)
+ _.each(data, function(el, beamline) {
+ _.each(el, function(count, year) {
+ var y = yrs.indexOf(year)
+ var b = bl.indexOf(beamline)
+ d[y].data.push([b, count])
+ })
+ })
var options = {
series: {
diff --git a/client/src/js/modules/dc/models/autointegration.js b/client/src/js/modules/dc/models/autointegration.js
index 6bf2df8e5..b47510ea2 100644
--- a/client/src/js/modules/dc/models/autointegration.js
+++ b/client/src/js/modules/dc/models/autointegration.js
@@ -13,13 +13,13 @@ define(['backbone'], function(Backbone){
var shells = this.get('SHELLS')
if (!shells) return
- this.attributes.CLASS = { RMERGE: {}, RMEAS: {}, COMPLETENESS: {} }
+ this.set('CLASS', { RMERGE: {}, RMEAS: {}, COMPLETENESS: {} })
_.each(['overall', 'innerShell', 'outerShell'], function(k) {
var c = shells[k] ? shells[k].COMPLETENESS : null
- this.attributes.CLASS.COMPLETENESS[k] = c > 95 ? 'active' : (c > 80 ? 'minor' : 'inactive')
+ this.set('CLASS[COMPLETENESS[k]]', c > 95 ? 'active' : (c > 80 ? 'minor' : 'inactive'))
var r = shells[k] ? shells[k].RMEAS : null
- this.attributes.CLASS.RMEAS[k] = r < 0.5 ? 'active' : (r < 0.6 ? 'minor' : 'inactive')
+ this.set('CLASS[RMEAS[k]]', r < 0.5 ? 'active' : (r < 0.6 ? 'minor' : 'inactive'))
}, this)
},
diff --git a/client/src/js/modules/dc/models/dccomment.js b/client/src/js/modules/dc/models/dccomment.js
index 2a7913eee..41e8bc75b 100644
--- a/client/src/js/modules/dc/models/dccomment.js
+++ b/client/src/js/modules/dc/models/dccomment.js
@@ -27,11 +27,11 @@ define(['backbone', 'markdown'], function(Backbone, markdown) {
},
addDate: function() {
- this.attributes.CREATETIMEISO = new Date(this.get('CREATETIME'))
- this.attributes.MODTIMEISO = new Date(this.get('MODTIME'))
- if (this.get('COMMENTS')) this.attributes.COMMENTSMD = markdown.toHTML(this.get('COMMENTS'))
+ this.set('CREATETIMEISO', new Date(this.get('CREATETIME')))
+ this.set('MODTIMEISO', new Date(this.get('MODTIME')))
+ if (this.get('COMMENTS')) this.set('COMMENTSMD', markdown.toHTML(this.get('COMMENTS')))
}
})
-})
\ No newline at end of file
+})
diff --git a/client/src/js/modules/dc/views/reprocess2.js b/client/src/js/modules/dc/views/reprocess2.js
index 6dee03148..0b1b13aff 100644
--- a/client/src/js/modules/dc/views/reprocess2.js
+++ b/client/src/js/modules/dc/views/reprocess2.js
@@ -162,8 +162,8 @@ define(['backbone', 'marionette', 'views/dialog',
if (e) e.preventDefault()
if (this.aps.length) {
- var e = this.aps.at(0)
- var c = e.get('CELL')
+ const a = this.aps.at(0)
+ const c = a.get('CELL')
this.ui.a.val(c['CELL_A']).trigger('change')
this.ui.b.val(c['CELL_B']).trigger('change')
@@ -172,7 +172,7 @@ define(['backbone', 'marionette', 'views/dialog',
this.ui.be.val(c['CELL_BE']).trigger('change')
this.ui.ga.val(c['CELL_GA']).trigger('change')
- this.ui.sg.val(e['SG']).trigger('change')
+ this.ui.sg.val(a['SG']).trigger('change')
}
},
@@ -300,11 +300,11 @@ define(['backbone', 'marionette', 'views/dialog',
}
var self = this
+ var reqs = []
// Integrate individually
if (this.ui.ind.is(':checked')) {
var jobs = 0
- var reqs = []
var rps = []
_.each(s, function(sw) {
var p = this.pipelines.findWhere({ VALUE: sw.get('PIPELINE') })
@@ -405,7 +405,6 @@ define(['backbone', 'marionette', 'views/dialog',
return
}
- var reqs = []
reqs.push(reprocessing.save({}, {
success: function() {
var reprocessingparams = new ReprocessingParameters()
diff --git a/client/src/js/modules/dc/views/reprocessoverview.js b/client/src/js/modules/dc/views/reprocessoverview.js
index 50970dc61..1f78946e1 100644
--- a/client/src/js/modules/dc/views/reprocessoverview.js
+++ b/client/src/js/modules/dc/views/reprocessoverview.js
@@ -53,14 +53,14 @@ define(['marionette',
},
render: function() {
- var columns = [
+ var pcolumns = [
{ name: 'PARAMETERKEY', label: 'Key', cell: 'string', editable: false },
{ name: 'PARAMETERVALUE', label: 'Value', cell: 'string', editable: false },
]
var ptable = new TableView({
collection: this.params,
- columns: columns,
+ columns: pcolumns,
loading: false,
pages: false,
backgrid: { emptyText: 'No parameters found' },
@@ -68,14 +68,14 @@ define(['marionette',
this.$el.html(ptable.render().$el)
- var columns = [
+ var scolumns = [
{ label: 'Files', cell: table.TemplateCell, editable: false, template: '<%-IMAGEDIRECTORY%><%-IMAGEPREFIX%>_<%-DATACOLLECTIONNUMBER%>' },
{ label: 'Image #', cell: table.TemplateCell, editable: false, template: '<%-STARTIMAGE%> - <%-ENDIMAGE%>' },
]
var stable = new TableView({
collection: this.sweeps,
- columns: columns,
+ columns: scolumns,
loading: false,
pages: false,
backgrid: { emptyText: 'No image sweeps found' },
diff --git a/client/src/js/modules/dc/views/samplechanger.js b/client/src/js/modules/dc/views/samplechanger.js
index a76a7c267..2ab1e9fd3 100644
--- a/client/src/js/modules/dc/views/samplechanger.js
+++ b/client/src/js/modules/dc/views/samplechanger.js
@@ -162,11 +162,11 @@ define(['marionette', 'utils/canvas', 'utils',
// Draw Grid
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)
//this.ctx.drawImage(this.numbers, 0, 0, this.canvas.width, this.canvas.height)
- for (var j = 0; j < this.sc; j++) {
+ for (var n = 0; n < this.sc; n++) {
this.ctx.fillStyle = '#000'
this.ctx.font = "11px Arial"
this.ctx.lineWidth = 1
- this.ctx.fillText(j+1,10,this.sh*j+this.tpad+4);
+ this.ctx.fillText(n+1,10,this.sh*n+this.tpad+4);
}
for (var i = 0; i < this.positions; i++) {
diff --git a/client/src/js/modules/dc/views/summary.js b/client/src/js/modules/dc/views/summary.js
index bf7116830..670ad84b4 100644
--- a/client/src/js/modules/dc/views/summary.js
+++ b/client/src/js/modules/dc/views/summary.js
@@ -125,7 +125,7 @@ define(['marionette',
{ label: 'Resolution', cell: APCell, template: '<%-SHELLS.overall.RLOW%> - <%-SHELLS.overall.RHIGH%>
<%-SHELLS.innerShell.RLOW%> - <%-SHELLS.innerShell.RHIGH%>
<%-SHELLS.outerShell.RLOW%> - <%-SHELLS.outerShell.RHIGH%>', editable: false },
{ label: 'Rmeas', cell: APCell, template: '<%-SHELLS.overall.RMEAS%>
<%-SHELLS.innerShell.RMEAS%>
<%-SHELLS.outerShell.RMEAS%>', editable: false },
{ label: 'Completeness', cell: APCell, template: '<%-SHELLS.overall.COMPLETENESS%>
<%-SHELLS.innerShell.COMPLETENESS%>
<%-SHELLS.outerShell.COMPLETENESS%>', editable: false },
- { label: '', cell: APCell, template: ' Download MTZ file', editable: false },
+ { label: '', cell: APCell, template: ' Download autoprocessing archive', editable: false },
]
diff --git a/client/src/js/modules/fault/models/component.js b/client/src/js/modules/fault/models/component.js
index 7f4a66ab7..54b26121d 100644
--- a/client/src/js/modules/fault/models/component.js
+++ b/client/src/js/modules/fault/models/component.js
@@ -8,15 +8,15 @@ define(['backbone'], function(Backbone) {
},
initialize: function(options) {
this.on('change', this._add_id, this)
- this._add_id()
+ this._add_id()
},
urlRoot: '/fault/com',
idAttribute: 'COMPONENTID',
_add_id: function() {
- this.attributes.ID = this.get('COMPONENTID')
+ this.set('ID', this.get('COMPONENTID'))
},
})
-})
\ No newline at end of file
+})
diff --git a/client/src/js/modules/fault/models/fault.js b/client/src/js/modules/fault/models/fault.js
index 9d9c94d1d..acf9dfd05 100644
--- a/client/src/js/modules/fault/models/fault.js
+++ b/client/src/js/modules/fault/models/fault.js
@@ -22,11 +22,11 @@ define(['backbone', 'markdown', 'models/wfile'], function(Backbone, markdown, Fi
},
refreshOptions: function() {
- this.attributes.RESOLVEDTEXT = this.resolvedOptions[this.get('RESOLVED')]
- this.attributes.BEAMTIMELOSTTEXT = this.btlOptions[this.get('BEAMTIMELOST')]
+ this.set('RESOLVEDTEXT', this.resolvedOptions[this.get('RESOLVED')])
+ this.set('BEAMTIMELOSTTEXT', this.btlOptions[this.get('BEAMTIMELOST')])
- if (this.get('DESCRIPTION')) this.attributes.DESCRIPTIONMD = markdown.toHTML(this.get('DESCRIPTION'))
- if (this.get('RESOLUTION')) this.attributes.RESOLUTIONMD = markdown.toHTML(this.get('RESOLUTION'))
+ if (this.get('DESCRIPTION')) this.set('DESCRIPTIONMD', markdown.toHTML(this.get('DESCRIPTION')))
+ if (this.get('RESOLUTION')) this.set('RESOLUTIONMD', markdown.toHTML(this.get('RESOLUTION')))
},
validation: {
diff --git a/client/src/js/modules/fault/models/subcomponent.js b/client/src/js/modules/fault/models/subcomponent.js
index f96e950af..1c6856212 100644
--- a/client/src/js/modules/fault/models/subcomponent.js
+++ b/client/src/js/modules/fault/models/subcomponent.js
@@ -8,12 +8,12 @@ define(['backbone'], function(Backbone) {
},
initialize: function(options) {
this.on('change', this._add_id, this)
- this._add_id()
+ this._add_id()
},
urlRoot: '/fault/scom',
idAttribute: 'SUBCOMPONENTID',
_add_id: function() {
- this.attributes.ID = this.get('SUBCOMPONENTID')
+ this.set('ID', this.get('SUBCOMPONENTID'))
},
})
-})
\ No newline at end of file
+})
diff --git a/client/src/js/modules/fault/models/system.js b/client/src/js/modules/fault/models/system.js
index bd4f02f6c..5a59cd5be 100644
--- a/client/src/js/modules/fault/models/system.js
+++ b/client/src/js/modules/fault/models/system.js
@@ -13,8 +13,8 @@ define(['backbone'], function(Backbone) {
urlRoot: '/fault/sys',
idAttribute: 'SYSTEMID',
_add_id: function() {
- this.attributes.ID = this.get('SYSTEMID')
+ this.set('ID', this.get('SYSTEMID'))
},
})
-})
\ No newline at end of file
+})
diff --git a/client/src/js/modules/imaging/views/queuecontainer.js b/client/src/js/modules/imaging/views/queuecontainer.js
index 9de3e613f..49c2dd2ef 100644
--- a/client/src/js/modules/imaging/views/queuecontainer.js
+++ b/client/src/js/modules/imaging/views/queuecontainer.js
@@ -692,10 +692,11 @@ define(['marionette',
},
applyModel: function(modelParameter, isLimitedToSelected) {
+ var models = null
if (isLimitedToSelected) {
- var models = this.qsubsamples.where({ isGridSelected: true })
+ models = this.qsubsamples.where({ isGridSelected: true })
} else {
- var models = this.qsubsamples.fullCollection.toArray()
+ models = this.qsubsamples.fullCollection.toArray()
}
_.each(models, function(model) {
if (modelParameter.get('EXPERIMENTKIND') !== model.get('EXPERIMENTKIND')) return
@@ -773,7 +774,7 @@ define(['marionette',
},
refreshSubSamples: function() {
- this.subsamples.fetch()
+ this.subsamples.fetch().done(this.onSubsamplesReady.bind(this))
},
initialize: function() {
diff --git a/client/src/js/modules/samples/views/pdbs.js b/client/src/js/modules/samples/views/pdbs.js
index 28708ce93..bbbd52b22 100644
--- a/client/src/js/modules/samples/views/pdbs.js
+++ b/client/src/js/modules/samples/views/pdbs.js
@@ -1,15 +1,28 @@
-define(['marionette'], function(Marionette) {
+define(['marionette', 'utils'], function(Marionette, utils) {
var UserItem = Marionette.ItemView.extend({
- template: _.template('<%-NAME%> <% if (CODE) { %>[CODE]<% } else { %>[File]<% } %> Delete'),
+ template: _.template(''),
tagName: 'li',
attributes: { 'data-testid': 'protein-pdb-list-item' },
events: {
- 'click a.delete': 'deleteUser',
+ 'click a.delete': 'deletePDB',
+ 'click a.download': utils.signHandler,
},
- deleteUser: function(e) {
+ render: function() {
+ UserItem.__super__.render.call(this)
+ const linkButton = ' EBI'
+ const deleteButton = ' Delete'
+ const downloadButton = ' Download'
+ if (this.model.get('CODE')) {
+ this.$el.append(this.model.get('NAME')+' [Code] '+linkButton+' '+deleteButton+'')
+ } else {
+ this.$el.append(this.model.get('NAME')+' [File] '+downloadButton+' '+deleteButton+'')
+ }
+ },
+
+ deletePDB: function(e) {
this.model.destroy()
},
})
@@ -30,4 +43,4 @@ define(['marionette'], function(Marionette) {
})
-})
\ No newline at end of file
+})
diff --git a/client/src/js/modules/shipment/models/containerreport.js b/client/src/js/modules/shipment/models/containerreport.js
index 29d7c8085..33cf734f3 100644
--- a/client/src/js/modules/shipment/models/containerreport.js
+++ b/client/src/js/modules/shipment/models/containerreport.js
@@ -14,7 +14,7 @@ define(['backbone', 'markdown', 'models/wfile'], function(Backbone, markdown, Fi
},
refreshOptions: function() {
- if (this.get('REPORT')) this.attributes.REPORTMD = markdown.toHTML(this.get('REPORT'))
+ if (this.get('REPORT')) this.set('REPORTMD', markdown.toHTML(this.get('REPORT')))
},
validation: {
diff --git a/client/src/js/modules/shipment/models/dewarreport.js b/client/src/js/modules/shipment/models/dewarreport.js
index b167c0c6d..6ace09e45 100644
--- a/client/src/js/modules/shipment/models/dewarreport.js
+++ b/client/src/js/modules/shipment/models/dewarreport.js
@@ -14,7 +14,7 @@ define(['backbone', 'markdown', 'models/wfile'], function(Backbone, markdown, Fi
},
refreshOptions: function() {
- if (this.get('REPORT')) this.attributes.REPORTMD = markdown.toHTML(this.get('REPORT'))
+ if (this.get('REPORT')) this.set('REPORTMD', markdown.toHTML(this.get('REPORT')))
},
validation: {
@@ -37,4 +37,4 @@ define(['backbone', 'markdown', 'models/wfile'], function(Backbone, markdown, Fi
}
}
}, File))
-})
\ No newline at end of file
+})
diff --git a/client/src/js/modules/shipment/views/containerregistry.js b/client/src/js/modules/shipment/views/containerregistry.js
index 4bfc20f89..e350702c7 100644
--- a/client/src/js/modules/shipment/views/containerregistry.js
+++ b/client/src/js/modules/shipment/views/containerregistry.js
@@ -116,7 +116,7 @@ define(['marionette',
this.listenTo(this.proposals, 'backgrid:selected', this.selectModel, this)
this.proposals.fetch()
- var columns = [
+ var columns2 = [
{ label: '', cell: 'select-row', headerCell: 'select-all', editable: false },
{ name: 'PROPOSALCODE', label: 'Code', cell: 'string', editable: false },
{ name: 'PROPOSALNUMBER', label: 'Number', cell: 'string', editable: false },
@@ -126,7 +126,7 @@ define(['marionette',
this.table2 = new TableView({
collection: this.proposals,
- columns: columns, tableClass: 'proposals', filter: 's', search: options.params.s, loading: true, noPageUrl: true, noSearchUrl: true,
+ columns: columns2, tableClass: 'proposals', filter: 's', search: options.params.s, loading: true, noPageUrl: true, noSearchUrl: true,
backgrid: { emptyText: 'No proposals found' }
})
@@ -175,4 +175,4 @@ define(['marionette',
}
})
-})
\ No newline at end of file
+})
diff --git a/client/src/js/modules/shipment/views/manifest.js b/client/src/js/modules/shipment/views/manifest.js
index ff40fd8db..748df41bc 100644
--- a/client/src/js/modules/shipment/views/manifest.js
+++ b/client/src/js/modules/shipment/views/manifest.js
@@ -57,14 +57,14 @@ define(['marionette',
var d = new Date()
_.each([d.getFullYear(), d.getFullYear()-1], function(y) {
_.each(_.range(1,13), function(m) {
- var m = (m < 10 ? ('0'+m) : m)+'-'+y
+ m = (m < 10 ? ('0'+m) : m)+'-'+y
this.ui.month.append('')
}, this)
}, this)
- var m = d.getMonth() +1
- var cur = (m < 10 ? ('0'+m) : m)+'-'+d.getFullYear()
+ var mon = d.getMonth() +1
+ var cur = (mon < 10 ? ('0'+mon) : mon)+'-'+d.getFullYear()
this.ui.month.val(cur)
var columns = [
@@ -95,4 +95,4 @@ define(['marionette',
})
-})
\ No newline at end of file
+})
diff --git a/client/src/js/modules/shipment/views/migrate.js b/client/src/js/modules/shipment/views/migrate.js
index a2fda3305..4710668e0 100644
--- a/client/src/js/modules/shipment/views/migrate.js
+++ b/client/src/js/modules/shipment/views/migrate.js
@@ -232,20 +232,20 @@ define(['marionette',
var validOnly = app.options.get('valid_components')
- if (!validOnly) {
- this.rprots.show(new TableView({
+ if (!validOnly) {
+ this.rprots.show(new TableView({
collection: this.proteins,
- columns: columns,
+ columns: columns,
tableClass: 'proteins',
filter: 's',
loading: true,
noSearchUrl: false,
backgrid: { emptyText: 'No proteins found' }
- }))
+ }))
}
- var columns = [
+ var columns2 = [
{ label: '', cell: 'select-row', headerCell: 'select-all', editable: false },
{ name: 'CARDNAME', label: 'Card Name', cell: 'string', editable: false },
{ name: 'GIVENNAME', label: 'First Name', cell: 'string', editable: false },
@@ -260,7 +260,7 @@ define(['marionette',
this.rconts.show(new TableView({
collection: this.contacts,
- columns: columns,
+ columns: columns2,
tableClass: 'labcontacts',
filter: 's',
loading: true,
diff --git a/client/src/js/modules/shipment/views/plate.js b/client/src/js/modules/shipment/views/plate.js
index f0bb321f5..b29f44f2f 100644
--- a/client/src/js/modules/shipment/views/plate.js
+++ b/client/src/js/modules/shipment/views/plate.js
@@ -192,9 +192,9 @@ define(['marionette', 'backbone', 'utils', 'backbone-validation'], function(Mari
var sampleid = i*this.pt.dropTotal()+did+1
var sample = this.collection.findWhere({ LOCATION: sampleid.toString() })
+ var im = null
- if (sample && (this.showImageStatus || this.showMaxScore) && this.inspectionimages) var im = this.inspectionimages.findWhere({ BLSAMPLEID: sample.get('BLSAMPLEID') })
- else var im = null
+ if (sample && (this.showImageStatus || this.showMaxScore) && this.inspectionimages) im = this.inspectionimages.findWhere({ BLSAMPLEID: sample.get('BLSAMPLEID') })
this.ctx.beginPath()
this.ctx.lineWidth = 1;
@@ -273,10 +273,12 @@ define(['marionette', 'backbone', 'utils', 'backbone-validation'], function(Mari
}
}
+ var isc = null
+
// Show image score
if (sample && this.showImageStatus) {
if (im) {
- var isc = im.get('SCORECOLOUR')
+ isc = im.get('SCORECOLOUR')
if (isc){
this.ctx.fillStyle = isc
this.ctx.fill()
@@ -287,7 +289,7 @@ define(['marionette', 'backbone', 'utils', 'backbone-validation'], function(Mari
// Show max image score
if (sample && this.showMaxScore) {
if (im) {
- var isc = im.get('MAXSCORECOLOUR')
+ isc = im.get('MAXSCORECOLOUR')
if (isc){
this.ctx.fillStyle = isc
this.ctx.fill()
diff --git a/client/src/js/modules/shipment/views/regdewar.js b/client/src/js/modules/shipment/views/regdewar.js
index 76252e088..69a2e053c 100644
--- a/client/src/js/modules/shipment/views/regdewar.js
+++ b/client/src/js/modules/shipment/views/regdewar.js
@@ -99,7 +99,7 @@ define(['marionette',
this.dewars.queryParams.all = 1
this.dewars.fetch().done(this.getHistory.bind(this))
- var columns = [
+ var columns2 = [
{ name: 'CODE', label: 'Name', cell: 'string', editable: false },
{ label: 'Shipment', cell: table.TemplateCell, editable: false, template: '<%-SHIPPINGNAME%>' },
{ name: 'EXP', label: 'First Exp', cell: 'string', editable: false },
@@ -113,12 +113,12 @@ define(['marionette',
if (app.mobile()) {
_.each([0,1,3,6,7], function(v) {
- columns[v].renderable = false
+ columns2[v].renderable = false
})
}
this.dewtable = new TableView({ collection: this.dewars,
- columns: columns, tableClass: 'dewars', loading: true,
+ columns: columns2, tableClass: 'dewars', loading: true,
backgrid: { emptyText: 'No dewars found' }
})
@@ -126,14 +126,14 @@ define(['marionette',
this.listenTo(this.reports, 'sync', this.setupPopups, this)
this.reports.fetch()
- var columns = [
+ var columns3 = [
{ name: 'BLTIMESTAMP', label: 'Time / Date', cell: 'string', editable: false },
{ name: 'REPORT', label: 'Report', cell: 'string', editable: false },
{ label: 'Image', cell: ImageCell, editable: false },
]
this.reptable = new TableView({ collection: this.reports,
- columns: columns, tableClass: 'samples', loading: true,
+ columns: columns3, tableClass: 'samples', loading: true,
backgrid: { emptyText: 'No reports found' }
})
@@ -141,7 +141,7 @@ define(['marionette',
this.proposals.queryParams.DEWARREGISTRYID = this.model.get('DEWARREGISTRYID')
this.proposals.fetch()
- var columns = [
+ var columns4 = [
{ name: 'PROPOSAL', label: 'Proposal', cell: 'string', editable: false },
{ name: 'GIVENNAME', label: 'Given Name', cell: 'string', editable: false },
{ name: 'FAMILYNAME', label: 'Family Name', cell: 'string', editable: false },
@@ -150,12 +150,12 @@ define(['marionette',
]
if (app.staff) {
- columns.push({ name: '', label: '', cell: DeleteCell, editable: false })
+ columns4.push({ name: '', label: '', cell: DeleteCell, editable: false })
}
this.proptable = new TableView({
collection: this.proposals,
- columns: columns,
+ columns: columns4,
})
},
diff --git a/client/src/js/modules/shipment/views/registeredcontainer.js b/client/src/js/modules/shipment/views/registeredcontainer.js
index c8779c2d2..3d30a56bb 100644
--- a/client/src/js/modules/shipment/views/registeredcontainer.js
+++ b/client/src/js/modules/shipment/views/registeredcontainer.js
@@ -175,7 +175,7 @@ define(['marionette',
this.containers.queryParams.all = 1
this.containers.fetch().done(this.getHistory.bind(this))
- var columns = [
+ var columns2 = [
// { label: 'Name', cell: table.TemplateCell, editable: false, template: '<%-NAME%>' },
{ name: 'NAME', label: 'Name', cell: 'string', editable: false },
{ name: 'BLTIMESTAMP', label: 'Created', cell: 'string', editable: false },
@@ -189,12 +189,12 @@ define(['marionette',
if (app.mobile()) {
_.each([4,6], function(v) {
- columns[v].renderable = false
+ columns2[v].renderable = false
})
}
this.conttable = new TableView({ collection: this.containers,
- columns: columns, tableClass: 'containers', loading: true,
+ columns: columns2, tableClass: 'containers', loading: true,
backgrid: { row: ClickableRow, emptyText: 'No containers found' }
})
@@ -202,7 +202,7 @@ define(['marionette',
this.listenTo(this.reports, 'sync', this.setupPopups, this)
this.reports.fetch()
- var columns = [
+ var columns3 = [
{ name: 'RECORDTIMESTAMP', label: 'Time / Date', cell: 'string', editable: false },
{ name: 'REPORTER', label: 'Reporter', cell: 'string', editable: false },
{ name: 'REPORT', label: 'Report', cell: 'string', editable: false },
@@ -210,7 +210,7 @@ define(['marionette',
]
this.reptable = new TableView({ collection: this.reports,
- columns: columns, tableClass: 'reports', loading: true,
+ columns: columns3, tableClass: 'reports', loading: true,
backgrid: { emptyText: 'No reports found' }
})
@@ -248,4 +248,4 @@ define(['marionette',
})
-})
\ No newline at end of file
+})
diff --git a/client/src/js/modules/summary/views/summary.vue b/client/src/js/modules/summary/views/summary.vue
index e57f83fed..9eb3ebcae 100644
--- a/client/src/js/modules/summary/views/summary.vue
+++ b/client/src/js/modules/summary/views/summary.vue
@@ -397,8 +397,8 @@
-
+
-->
diff --git a/client/src/js/modules/types/xpdf/views/plan.js b/client/src/js/modules/types/xpdf/views/plan.js
index b5e6c9819..9fb017219 100644
--- a/client/src/js/modules/types/xpdf/views/plan.js
+++ b/client/src/js/modules/types/xpdf/views/plan.js
@@ -558,7 +558,7 @@ define(['marionette',
this.asmps.show(this.table)
- var columns = [
+ var columns2 = [
{ label: '', cell: CollapseExpandCell, editable: false, template: '' },
{ label: '#', cell: table.TemplateCell, editable: false, template: '<%-parseInt(PLANORDER)+1%>' },
{ label: 'Instance', cell: table.TemplateCell, editable: false, template: '<%-SAMPLE%>' },
@@ -570,7 +570,7 @@ define(['marionette',
this.table2 = new SortableTableView({
collection: this.datacollectionplans,
- columns: columns,
+ columns: columns2,
tableClass: 'subsamples',
loading: true,
// Below overrides the SortableRow in the SortableTableView which breaks drag and drop events
diff --git a/client/src/js/templates/dc/dc.html b/client/src/js/templates/dc/dc.html
index 4237f4515..b23bb657a 100644
--- a/client/src/js/templates/dc/dc.html
+++ b/client/src/js/templates/dc/dc.html
@@ -24,7 +24,7 @@
<% if (SI != 1 ) { %> First Image: <%-SI%><% } %>
<% if ((KAPPA && KAPPA !=0) || (PHI && PHI != 0) || (CHISTART && CHISTART !=0)) { %><% if (KAPPA != null) { %>κ: <%-KAPPA%>°<% } %> <% if (PHI != null) { %>φ: <%-PHI%>°<% } %> <% if (CHISTART != null) { %>χ: <%-CHISTART%>°<% } %><% } %>
Resolution: <%-RESOLUTION%>Å
- Wavelength: <%-WAVELENGTH%>Å
+ Wavelength: <%-WAVELENGTH%>Å (<%-ENERGY%>eV)
Exposure: <%-EXPOSURETIME%>s
<%if (DCC > 1 && TOTALDOSE) { %>
Total Dose: <%-TOTALDOSE%>MGy
diff --git a/client/src/js/templates/dc/edge.html b/client/src/js/templates/dc/edge.html
index 1349e0ba5..4e2697a12 100644
--- a/client/src/js/templates/dc/edge.html
+++ b/client/src/js/templates/dc/edge.html
@@ -9,11 +9,11 @@
- - Scan File: <%-FILETEMPLATE%>
- - E(Peak): <%-EPK.toFixed(1) %>eV (<% print ((12398.4193/EPK).toFixed(4)) %>Å)
- - f’’: <%-NUMIMG%> / f’: <%-RESOLUTION%>e
- - E(Inf): <%-EIN.toFixed(1) %>eV (<% print((12398.4193/EIN).toFixed(4)) %>Å)
- - f’’: <%-WAVELENGTH%> / f’: <%-AXISRANGE%>e
+
+ - E(Peak): <%-EPK%>eV (<%-WPK%>Å)
+ - f’’: <%-NUMIMG%>e- / f’: <%-RESOLUTION%>e-
+ - E(Inf): <%-EIN%>eV (<%-WIN%>Å)
+ - f’’: <%-WAVELENGTH%>e- / f’: <%-AXISRANGE%>e-
- Exposure: <%-EXPOSURETIME%>s
- Transmission: <%-TRANSMISSION%>%
- Beamsize: <%-BSX%>x<%-BSY%>μm
diff --git a/client/src/js/templates/dc/grid.html b/client/src/js/templates/dc/grid.html
index 4232c7392..996258409 100644
--- a/client/src/js/templates/dc/grid.html
+++ b/client/src/js/templates/dc/grid.html
@@ -8,7 +8,7 @@
- &<%-ROTATIONAXIS%>; Start: <%-AXISSTART%>°
<% if ((KAPPA && KAPPA !=0) || (PHI && PHI != 0) || (CHISTART && CHISTART !=0)) { %>- <% if (KAPPA != null) { %>κ: <%-KAPPA%>°<% } %> <% if (PHI != null) { %>φ: <%-PHI%>°<% } %> <% if (CHISTART != null) { %>χ: <%-CHISTART%>°<% } %>
<% } %>
- Resolution: <%-RESOLUTION%>Å
- - Wavelength: <%-WAVELENGTH%>Å
+ - Wavelength: <%-WAVELENGTH%>Å (<%-ENERGY%>eV)
- Exposure: <%-EXPOSURETIME%>s
- Transmission: <%-TRANSMISSION%>%
- Beamsize: <%-BSX%>x<%-BSY%>μm
diff --git a/client/src/js/templates/dc/mca.html b/client/src/js/templates/dc/mca.html
index 69da71439..9bea88fde 100644
--- a/client/src/js/templates/dc/mca.html
+++ b/client/src/js/templates/dc/mca.html
@@ -10,11 +10,11 @@
- - Energy: <%-WAVELENGTH%>eV
+ - Energy: <%-ENERGY%>eV (<%-WAVELENGTH%>Å)
- Exposure: <%-EXPOSURETIME%>s
- Transmission: <%-TRANSMISSION%>%
- Beamsize: <%-BSX%>x<%-BSY%>μm
- Axis Position: <%-AXISSTART%>°
-
\ No newline at end of file
+
diff --git a/client/src/js/tpl.js b/client/src/js/tpl.js
index 593984020..cbca02479 100644
--- a/client/src/js/tpl.js
+++ b/client/src/js/tpl.js
@@ -92,7 +92,7 @@
source + '}';
return template;
- };
+ }
define(function () {
diff --git a/client/src/js/utils/editable.js b/client/src/js/utils/editable.js
index 622779b54..a33d32027 100644
--- a/client/src/js/utils/editable.js
+++ b/client/src/js/utils/editable.js
@@ -175,7 +175,9 @@ define(['marionette',
if (xhr.responseText) {
try {
json = $.parseJSON(xhr.responseText)
- } catch(err) {}
+ } catch(err) {
+ console.log('Error parsing JSON')
+ }
}
if (json.message) app.alert({ message: json.message })
else app.alert({ message: 'Something went wrong' })
diff --git a/client/src/js/utils/xhrimage.js b/client/src/js/utils/xhrimage.js
index 532c28363..63ca0244d 100644
--- a/client/src/js/utils/xhrimage.js
+++ b/client/src/js/utils/xhrimage.js
@@ -38,7 +38,7 @@ define(['marionette'], function() {
}
var h = xhr.getAllResponseHeaders()
- var m = h.match(/^Content-Type\:\s*(.*?)$/mi)
+ var m = h.match(/^Content-Type:\s*(.*?)$/mi)
var mimeType = m[1] || 'image/png';
var blob = new Blob([this.response], { type: mimeType })
@@ -80,4 +80,4 @@ define(['marionette'], function() {
return XHRImage
-})
\ No newline at end of file
+})
diff --git a/client/src/js/views/log.js b/client/src/js/views/log.js
index 258637569..a553e6a9f 100644
--- a/client/src/js/views/log.js
+++ b/client/src/js/views/log.js
@@ -47,7 +47,7 @@ define(['marionette', 'views/dialog'], function(Marionette, DialogView) {
}
var h = xhr.getAllResponseHeaders()
- var m = h.match(/^Content-Type\:\s*(.*?)$/mi)
+ var m = h.match(/^Content-Type:\s*(.*?)$/mi)
var mimeType = m[1] || 'image/png'
if (mimeType == 'application/pdf' || mimeType == 'image/png') {