Skip to content

Commit 0d0784e

Browse files
Issue 53306: Some LKS forms don't distinguish between fields properly (#900)
1 parent 44e73a1 commit 0d0784e

31 files changed

Lines changed: 150 additions & 130 deletions

elispotassay/src/org/labkey/elispot/query/ElispotRunDataTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public List<FieldKey> getDefaultVisibleColumns()
170170
FieldKey runPropFieldKey = FieldKey.fromParts("Run");
171171
fieldKeys.add(FieldKey.fromParts(runPropFieldKey, FieldKey.fromString("ProtocolName")));
172172
fieldKeys.add(FieldKey.fromParts(runPropFieldKey, FieldKey.fromString("PlateReader")));
173-
fieldKeys.add(FieldKey.fromParts(runPropFieldKey, FieldKey.fromString("Batch"), FieldKey.fromString("TargetStudy")));
173+
fieldKeys.add(FieldKey.fromParts(runPropFieldKey, FieldKey.fromString("Batch"), FieldKey.fromString(AbstractAssayProvider.TARGET_STUDY_PROPERTY_NAME)));
174174
return fieldKeys;
175175
}
176176

flow/src/org/labkey/flow/controllers/executescript/confirmRunsToImport.jsp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<%@ page import="java.util.LinkedHashMap" %>
3131
<%@ page import="java.util.Map" %>
3232
<%@ page import="java.util.Set" %>
33+
<%@ page import="org.labkey.api.assay.AbstractAssayProvider" %>
3334
<%@ page extends="org.labkey.api.jsp.JspBase" %>
3435
<%
3536
JspView<ImportRunsForm> me = HttpView.currentView();
@@ -86,8 +87,8 @@
8687
to look up specimen information from the target study's specimen repository.
8788
</p>
8889
<p class="labkey-indented">
89-
<label for="targetStudy">Optionally, choose a target study folder:</label><br>
90-
<select id="targetStudy" name="targetStudy">
90+
<label for="<%= h(AbstractAssayProvider.TARGET_STUDY_PROPERTY_NAME)%>">Optionally, choose a target study folder:</label><br>
91+
<select id="<%= h(AbstractAssayProvider.TARGET_STUDY_PROPERTY_NAME)%>" name="<%= h(AbstractAssayProvider.TARGET_STUDY_PROPERTY_NAME)%>">
9192
<labkey:options value="<%=unsafe(form.getTargetStudy())%>" map="<%=targetStudies%>"/>
9293
</select>
9394
</p>

flow/src/org/labkey/flow/controllers/executescript/importAnalysisChooseAnalysis.jsp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<%@ page import="java.util.List" %>
3737
<%@ page import="java.util.Map" %>
3838
<%@ page import="java.util.Set" %>
39+
<%@ page import="org.labkey.api.assay.AbstractAssayProvider" %>
3940
<%@ page extends="org.labkey.api.jsp.JspBase" %>
4041
<%@ taglib prefix="labkey" uri="http://www.labkey.org/taglib" %>
4142
<%
@@ -233,11 +234,8 @@ if (form.getKeywordDir() != null && form.getKeywordDir().length > 0 && StudyPubl
233234
<div style="padding-left: 2em; padding-bottom: 1em;">
234235
<br>
235236
Choose a target study folder:<br>
236-
<%=select().name("targetStudy").className(null).addOptions(targetStudies).selected(unsafe(form.getTargetStudy())).onChange("document.getElementById('studyChanged').value = true;")
237+
<%=select().name(AbstractAssayProvider.TARGET_STUDY_PROPERTY_NAME).className(null).addOptions(targetStudies).selected(unsafe(form.getTargetStudy())).onChange("document.getElementById('studyChanged').value = true;")
237238
%>
238-
<%-- <select id="targetStudy" name="targetStudy">--%>
239-
<%-- <labkey:options value="<%=text(form.getTargetStudy())%>" map="<%=targetStudies%>"/>--%>
240-
<%-- </select>--%>
241239
<br><br>
242240
</div>
243241
<%

flow/src/org/labkey/flow/controllers/executescript/importAnalysisConfirm.jsp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<%@ page import="java.util.Map" %>
4343
<%@ page import="java.util.Set" %>
4444
<%@ page import="static org.labkey.flow.controllers.executescript.AnalysisScriptController.BACK_BUTTON_ACTION" %>
45+
<%@ page import="org.labkey.api.assay.AbstractAssayProvider" %>
4546
<%@ page extends="org.labkey.api.jsp.JspBase" %>
4647
<%
4748
ImportAnalysisForm form = (ImportAnalysisForm)getModelBean();
@@ -93,7 +94,7 @@
9394
<input type="hidden" name="existingAnalysisId" id="existingAnalysisId" value="<%=form.getExistingAnalysisId()%>">
9495
<% } %>
9596

96-
<input type="hidden" name="targetStudy" id="targetStudy" value="<%=h(form.getTargetStudy())%>">
97+
<input type="hidden" name="<%= h(AbstractAssayProvider.TARGET_STUDY_PROPERTY_NAME)%>" id="<%= h(AbstractAssayProvider.TARGET_STUDY_PROPERTY_NAME)%>" value="<%=h(form.getTargetStudy())%>">
9798

9899
<p>You are about to import the analysis from the workspace with the following settings:</p>
99100
<%

flow/src/org/labkey/flow/data/FlowProperty.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.labkey.flow.data;
1818

19+
import org.labkey.api.assay.AbstractAssayProvider;
1920
import org.labkey.api.exp.PropertyType;
2021
import org.labkey.api.exp.property.SystemProperty;
2122

@@ -35,7 +36,7 @@ abstract public class FlowProperty
3536
static public final SystemProperty AnalysisEngine = new SystemProperty(PROPERTY_BASE + "AnalysisEngine", PropertyType.STRING);
3637

3738
// Property on FlowRun ExpRun object: container id of target study
38-
static public final SystemProperty TargetStudy = new SystemProperty(PROPERTY_BASE + "TargetStudy", PropertyType.STRING);
39+
static public final SystemProperty TargetStudy = new SystemProperty(PROPERTY_BASE + AbstractAssayProvider.TARGET_STUDY_PROPERTY_NAME, PropertyType.STRING);
3940

4041
// Property on FlowFCSFile ExpData object: true when the FlowFCSFile was created from an external analysis (extracted from FlowJo workspace or analysis archive)
4142
//static public final SystemProperty ExtraKeywordsFCSFile = new SystemProperty(PROPERTY_BASE + "ExtraKeywordsFCSFile", PropertyType.BOOLEAN);

flow/src/org/labkey/flow/query/FCSFileCoalescingColumn.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.labkey.flow.query;
1717

1818
import org.jetbrains.annotations.Nullable;
19+
import org.labkey.api.assay.AbstractAssayProvider;
1920
import org.labkey.api.data.ColumnInfo;
2021
import org.labkey.api.data.JdbcType;
2122
import org.labkey.api.data.SQLFragment;
@@ -74,7 +75,7 @@ public FCSFileCoalescingColumn(TableInfo parent, FieldKey key, JdbcType type, @N
7475
_dateFieldKeys = Pair.of(dateFieldKey, FlowSchema.rewriteAsOriginalFCSFile(dateFieldKey));
7576
}
7677

77-
FieldKey targetStudyFieldKey = relativeFromFCSFile ? FieldKey.fromParts("Run", "TargetStudy") : FieldKey.fromParts("FCSFile", "Run", "TargetStudy");
78+
FieldKey targetStudyFieldKey = relativeFromFCSFile ? FieldKey.fromParts("Run", AbstractAssayProvider.TARGET_STUDY_PROPERTY_NAME) : FieldKey.fromParts("FCSFile", "Run", "TargetStudy");
7879
_targetStudyFieldKeys = Pair.of(targetStudyFieldKey, FlowSchema.rewriteAsOriginalFCSFile(targetStudyFieldKey));
7980
}
8081

flow/src/org/labkey/flow/reports/FilterFlowReport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ void addScriptProlog(ViewContext context, StringBuffer sb)
197197
private String oldLegalName(FieldKey fkey)
198198
{
199199
String r = AliasManager.makeLegalName(StringUtils.join(fkey.getParts(), "_"), FlowManager.get().getSchema().getSqlDialect(), false);
200-
return ColumnInfo.propNameFromName(r).toLowerCase();
200+
return ColumnInfo.legalNameFromName(r).toLowerCase();
201201
}
202202

203203
protected void convertDateColumn(CachedResultSet rs, String fromCol, String toCol) throws SQLException

luminex/src/org/labkey/luminex/LuminexDataHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public class LuminexDataHandler extends AbstractExperimentDataHandler implements
141141
public static final String QC_FLAG_SINGLE_POINT_CONTROL_ID = "SinglePointControlId"; // Column name to use in createQCFlagEnabledSQLFragment
142142
public static final String POSITIVITY_THRESHOLD_COLUMN_NAME = "PositivityThreshold";
143143
public static final String POSITIVITY_THRESHOLD_DISPLAY_NAME = "Positivity Threshold";
144-
public static final String CALCULATE_POSITIVITY_COLUMN_NAME = "calculatePositivity";
144+
public static final String CALCULATE_POSITIVITY_COLUMN_NAME = "CalculatePositivity";
145145
public static final String NEGATIVE_CONTROL_COLUMN_NAME = "NegativeControl";
146146
public static final String NEGATIVE_BEAD_COLUMN_NAME = "NegativeBead";
147147
public static final String NEGATIVE_BEAD_DISPLAY_NAME = "Subtract Negative Bead";

luminex/src/org/labkey/luminex/LuminexRunUploadForm.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public List<Titration> getTitrations() throws ExperimentException
268268
titration.setName(titrationName);
269269
for (Titration.Type type : Titration.Type.values())
270270
{
271-
String propertyName = LuminexUploadWizardAction.getTitrationTypeCheckboxName(type, titration);
271+
String propertyName = LuminexUploadWizardAction.getTitrationTypeCheckboxNameAndId(type, titration);
272272
if (getViewContext().getRequest().getParameter(propertyName) != null)
273273
{
274274
String hiddenValue = getViewContext().getRequest().getParameter(propertyName);
@@ -293,7 +293,7 @@ public List<SinglePointControl> getSinglePointControls() throws ExperimentExcept
293293
{
294294
SinglePointControl singlePointControl = new SinglePointControl();
295295
singlePointControl.setName(singlePointControlName);
296-
String propertyName = LuminexUploadWizardAction.getSinglePointControlCheckboxName(singlePointControlName);
296+
String propertyName = LuminexUploadWizardAction.getSinglePointControlCheckboxNameAndId(singlePointControlName);
297297
if (StringUtils.isNotBlank(getViewContext().getRequest().getParameter(propertyName)))
298298
{
299299
result.add(singlePointControl);

luminex/src/org/labkey/luminex/LuminexUploadWizardAction.java

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import org.labkey.api.view.JspView;
6161
import org.labkey.api.view.VBox;
6262
import org.labkey.api.view.ViewServlet;
63+
import org.labkey.api.view.template.PageConfig;
6364
import org.labkey.api.writer.HtmlWriter;
6465
import org.labkey.luminex.model.Analyte;
6566
import org.labkey.luminex.model.SinglePointControl;
@@ -324,7 +325,7 @@ else if (analyteDefaultValue != null)
324325
}
325326

326327
Titration existingTitration = existingTitrations.get(titrationEntry.getKey());
327-
String propertyName = getTitrationTypeCheckboxName(Titration.Type.standard, titrationEntry.getValue());
328+
String propertyName = getTitrationTypeCheckboxNameAndId(Titration.Type.standard, titrationEntry.getValue());
328329
// If we have an existing titration as a baseline from the run we're replacing, use its value
329330
String defVal = existingTitration == null ? defaultWellRoleValues.get(propertyName) : Boolean.toString(existingTitration.isStandard());
330331

@@ -359,7 +360,7 @@ else if (titrationEntry.getValue().isStandard())
359360

360361
if (!titrationEntry.getValue().isUnknown())
361362
{
362-
propertyName = getTitrationTypeCheckboxName(Titration.Type.standard, titrationEntry.getValue());
363+
propertyName = getTitrationTypeCheckboxNameAndId(Titration.Type.standard, titrationEntry.getValue());
363364
// If we have an existing titration as a baseline from the run we're replacing, use its value
364365
defVal = existingTitration == null ? defaultWellRoleValues.get(propertyName) : Boolean.toString(existingTitration.isStandard());
365366
value = setInitialTitrationInput(errorReshow, propertyName, defVal, titrationEntry.getValue().isStandard()) ? "true" : "";
@@ -369,21 +370,21 @@ else if (titrationEntry.getValue().isStandard())
369370
value = toShowStandardCheckboxColumn(errorReshow, standardTitrations, titrationEntry.getValue()) ? "true" : "";
370371
view.getDataRegion().addHiddenFormField(getShowStandardCheckboxColumnName(titrationEntry.getValue()), value);
371372

372-
propertyName = getTitrationTypeCheckboxName(Titration.Type.qccontrol, titrationEntry.getValue());
373+
propertyName = getTitrationTypeCheckboxNameAndId(Titration.Type.qccontrol, titrationEntry.getValue());
373374
// If we have an existing titration as a baseline from the run we're replacing, use its value
374375
defVal = existingTitration == null ? defaultWellRoleValues.get(propertyName) : Boolean.toString(existingTitration.isQcControl());
375376
value = setInitialTitrationInput(errorReshow, propertyName, defVal, titrationEntry.getValue().isQcControl()) ? "true" : "";
376377
view.getDataRegion().addHiddenFormField(propertyName, value);
377378

378-
propertyName = getTitrationTypeCheckboxName(Titration.Type.othercontrol, titrationEntry.getValue());
379+
propertyName = getTitrationTypeCheckboxNameAndId(Titration.Type.othercontrol, titrationEntry.getValue());
379380
// If we have an existing titration as a baseline from the run we're replacing, use its value
380381
defVal = existingTitration == null ? defaultWellRoleValues.get(propertyName) : Boolean.toString(existingTitration.isOtherControl());
381382
value = setInitialTitrationInput(errorReshow, propertyName, defVal, titrationEntry.getValue().isOtherControl()) ? "true" : "";
382383
view.getDataRegion().addHiddenFormField(propertyName, value);
383384
}
384385
else
385386
{
386-
propertyName = getTitrationTypeCheckboxName(Titration.Type.unknown, titrationEntry.getValue());
387+
propertyName = getTitrationTypeCheckboxNameAndId(Titration.Type.unknown, titrationEntry.getValue());
387388
// If we have an existing titration as a baseline from the run we're replacing, use its value
388389
defVal = existingTitration == null ? defaultWellRoleValues.get(propertyName) : Boolean.toString(existingTitration.isUnknown());
389390
value = setInitialTitrationInput(errorReshow, propertyName, defVal, titrationEntry.getValue().isUnknown()) ? "true" : "";
@@ -400,7 +401,7 @@ else if (titrationEntry.getValue().isStandard())
400401

401402
boolean existingSinglePointControl = existingSinglePointControls.contains(singlePointControl);
402403

403-
propertyName = getSinglePointControlCheckboxName(singlePointControl);
404+
propertyName = getSinglePointControlCheckboxNameAndId(singlePointControl);
404405
// If we have an existing singlePointControl as a baseline from the run we're replacing, use its value
405406
defVal = existingSinglePointControl ? "true" : defaultWellRoleValues.get(propertyName);
406407
value = setInitialSinglePointControlInput(errorReshow, propertyName, defVal) ? "true" : "";
@@ -431,8 +432,9 @@ else if (titrationEntry.getValue().isStandard())
431432
@Override
432433
public void writeSameCheckboxCell(RenderContext ctx, HtmlWriter out)
433434
{
434-
String titrationCellName = PageFlowUtil.filter(getTitrationColumnCellName(titrationEntry.getValue().getName()));
435-
String groupName = ColumnInfo.propNameFromName(getColumns().get(0).getFormFieldName(ctx));
435+
String titrationCellName = PageFlowUtil.filter(getTitrationColumnCellNameAndId(titrationEntry.getValue().getName()));
436+
// DOM ids and JS function names can't have spaces
437+
String groupName = PageConfig.makeIdFromName(getColumns().get(0).getFormFieldName(ctx));
436438
String id = groupName + "CheckBox";
437439

438440
TD(
@@ -453,7 +455,8 @@ public void writeSameCheckboxCell(RenderContext ctx, HtmlWriter out)
453455
@Override
454456
public void writeCopyableJavaScript(RenderContext ctx, Writer out) throws IOException
455457
{
456-
String groupName = ColumnInfo.propNameFromName(getColumns().get(0).getFormFieldName(ctx));
458+
// DOM ids and JS function names can't have spaces
459+
String groupName = PageConfig.makeIdFromName(getColumns().get(0).getFormFieldName(ctx));
457460
out.write("function " + groupName + "Updated() {\n");
458461
out.write(" if (document.getElementById('" + groupName + "CheckBox') != null && document.getElementById('" + groupName + "CheckBox').checked) {\n");
459462
out.write(" var v = document.getElementsByName('" + getColumns().get(0).getFormFieldName(ctx) + "')[0].checked;\n");
@@ -550,7 +553,7 @@ private JspView<LuminexRunUploadForm> addExclusionWarning(LuminexRunUploadForm f
550553

551554
private String getShowStandardCheckboxColumnName(Titration standard)
552555
{
553-
String titrationCheckboxName = getTitrationTypeCheckboxName(Titration.Type.standard, standard);
556+
String titrationCheckboxName = getTitrationTypeCheckboxNameAndId(Titration.Type.standard, standard);
554557
return titrationCheckboxName + "_showcol";
555558
}
556559

@@ -691,19 +694,22 @@ protected RunStepHandler getRunStepHandler()
691694
return new LuminexRunStepHandler();
692695
}
693696

694-
public static String getTitrationTypeCheckboxName(Titration.Type type, Titration titration)
697+
public static String getTitrationTypeCheckboxNameAndId(Titration.Type type, Titration titration)
695698
{
696-
return ColumnInfo.propNameFromName("_titrationRole_" + type + "_" + titration.getName());
699+
// DOM ids and JS function names can't have spaces
700+
return PageConfig.makeIdFromName("_titrationRole_" + type + "_" + titration.getName());
697701
}
698702

699-
public static String getSinglePointControlCheckboxName(String singlePointControl)
703+
public static String getSinglePointControlCheckboxNameAndId(String singlePointControl)
700704
{
701-
return ColumnInfo.propNameFromName("_singlePointControl_" + singlePointControl);
705+
// DOM ids and JS function names can't have spaces
706+
return PageConfig.makeIdFromName("_singlePointControl_" + singlePointControl);
702707
}
703708

704-
public static String getTitrationColumnCellName(String titrationName)
709+
public static String getTitrationColumnCellNameAndId(String titrationName)
705710
{
706-
return ColumnInfo.propNameFromName("_titrationcell_" + titrationName);
711+
// DOM ids and JS function names can't have spaces
712+
return PageConfig.makeIdFromName("_titrationcell_" + titrationName);
707713
}
708714

709715
protected class LuminexRunStepHandler extends RunStepHandler
@@ -806,21 +812,21 @@ public boolean executeStep(LuminexRunUploadForm form, BindException errors) thro
806812
// add the name/value pairs for the titration well role definition section
807813
if (!titrationEntry.getValue().isUnknown())
808814
{
809-
propertyName = getTitrationTypeCheckboxName(Titration.Type.standard, titrationEntry.getValue());
815+
propertyName = getTitrationTypeCheckboxNameAndId(Titration.Type.standard, titrationEntry.getValue());
810816
value = getViewContext().getRequest().getParameter(propertyName).equals("true");
811817
defaultWellRoleValues.put(propertyName, Boolean.toString(value));
812818

813-
propertyName = getTitrationTypeCheckboxName(Titration.Type.qccontrol, titrationEntry.getValue());
819+
propertyName = getTitrationTypeCheckboxNameAndId(Titration.Type.qccontrol, titrationEntry.getValue());
814820
value = getViewContext().getRequest().getParameter(propertyName).equals("true");
815821
defaultWellRoleValues.put(propertyName, Boolean.toString(value));
816822

817-
propertyName = getTitrationTypeCheckboxName(Titration.Type.othercontrol, titrationEntry.getValue());
823+
propertyName = getTitrationTypeCheckboxNameAndId(Titration.Type.othercontrol, titrationEntry.getValue());
818824
value = getViewContext().getRequest().getParameter(propertyName).equals("true");
819825
defaultWellRoleValues.put(propertyName, Boolean.toString(value));
820826
}
821827
else
822828
{
823-
propertyName = getTitrationTypeCheckboxName(Titration.Type.unknown, titrationEntry.getValue());
829+
propertyName = getTitrationTypeCheckboxNameAndId(Titration.Type.unknown, titrationEntry.getValue());
824830
value = getViewContext().getRequest().getParameter(propertyName).equals("true");
825831
defaultWellRoleValues.put(propertyName, Boolean.toString(value));
826832
}
@@ -845,7 +851,7 @@ public boolean executeStep(LuminexRunUploadForm form, BindException errors) thro
845851
for (String singlePointControl : form.getParser().getSinglePointControls())
846852
{
847853
// add the name/value pairs for the singlePointControl well role definition section
848-
String propertyName = getSinglePointControlCheckboxName(singlePointControl);
854+
String propertyName = getSinglePointControlCheckboxNameAndId(singlePointControl);
849855
boolean value = getViewContext().getRequest().getParameter(propertyName).equals("true");
850856
defaultWellRoleValues.put(propertyName, Boolean.toString(value));
851857
}

0 commit comments

Comments
 (0)