Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag script blocks with nonce #120

Merged
merged 6 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OConnor/resources/views/inventory_specimen_available.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id="a"></div>
<script type="text/javascript">
<script type="text/javascript" nonce="<%=scriptNonce%>">

// called once Ext is ready
var initSpecimenAvailable = function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<%=button("Search").submit(true)%>
</form>
</td></tr></table>
<script type="text/javascript">
<script type="text/javascript" nonce="<%=getScriptNonce()%>">
Ext.onReady(function(){
new Ext.form.TextField({
applyTo: 'wbsearch-id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
@BaseWebDriverTest.ClassTimeout(minutes = 5)
public class OConnorListTest extends BaseWebDriverTest implements PostgresOnlyTest
{
private static String PROJECT_NAME = "OConnorTestProject";
private static String FOLDER_ZIP_FILE = "OConnor_Test.folder.zip";
private static String[] MODULES = {"OConnor", "OConnorExperiments"};
private static String[] SPECIMEN_TYPES = {"type1", "type2", "type3", "type4"};
private static String[] EXPERIMENT_TYPES = {"name1", "name2", "name3", "name4"};
private static String[] DISABLED_SPECIMEN_TYPES = {"disabledtype1", "disabledtype2"};
private static String[] DISABLED_EXPERIMENT_TYPES = {"disabledname1", "disabledname2"};
private static final String PROJECT_NAME = "OConnorTestProject";
private static final String FOLDER_ZIP_FILE = "OConnor_Test.folder.zip";
private static final String[] MODULES = {"OConnor", "OConnorExperiments"};
private static final String[] SPECIMEN_TYPES = {"type1", "type2", "type3", "type4"};
private static final String[] EXPERIMENT_TYPES = {"name1", "name2", "name3", "name4"};
private static final String[] DISABLED_SPECIMEN_TYPES = {"disabledtype1", "disabledtype2"};
private static final String[] DISABLED_EXPERIMENT_TYPES = {"disabledname1", "disabledname2"};

@Nullable
@Override
Expand Down Expand Up @@ -176,7 +176,7 @@ public void testAvailableDDValues()
assertTextNotPresent(d_option);
}
//check available specimen types
beginAt("/oconnor/OConnorTestProject/inventory_specimen_available.view?");
beginAt("/OConnorTestProject/oconnor-inventory_specimen_available.view");
waitForText("Inventory Specimen Available");
shortWait().until(ExpectedConditions.elementToBeClickable(Locator.linkWithSpan("Add new specimens")));
click(Locator.linkWithSpan("Add new specimens"));
Expand Down
4 changes: 2 additions & 2 deletions genotyping/resources/views/illuminaSampleSheetExport.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script type="text/javascript">
<script type="text/javascript" nonce="<%=scriptNonce%>">
LABKEY.requiresExt4ClientAPI();
LABKEY.requiresScript('/genotyping/IlluminaExportPanel.js');
</script>
<script type="text/javascript">
<script type="text/javascript" nonce="<%=scriptNonce%>">

Ext4.onReady(function(){
var webpart = <%=webpartContext%>;
Expand Down
12 changes: 5 additions & 7 deletions genotyping/src/org/labkey/genotyping/GenotypingController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2247,7 +2247,7 @@ private String stripSubType(String name, STRDiscrepancies form)
return name;
}
// Strip off subtype suffix, if any
while (name.length() > 0 && !Character.isDigit(name.charAt(name.length() - 1)))
while (!name.isEmpty() && !Character.isDigit(name.charAt(name.length() - 1)))
{
name = name.substring(0, name.length() - 1);
}
Expand All @@ -2266,19 +2266,19 @@ public void addNavTrail(NavTree root)
public static class STRDiscrepancies extends ProtocolIdForm
{
private boolean ignoreSubtype;
private Map<String, Set<String>> discrepancies;
private final Map<String, Set<String>> discrepancies;

public STRDiscrepancies()
{
this.discrepancies = new TreeMap<>();
}

public void insertDiscrepancy(String name, String disrepancy)
public void insertDiscrepancy(String name, String discrepancy)
{
if (!discrepancies.containsKey(name))
discrepancies.put(name, new TreeSet<>());
//NOTE: this might be better as a set...
discrepancies.get(name).add(disrepancy);
discrepancies.get(name).add(discrepancy);
}

public boolean isEmpty()
Expand All @@ -2303,7 +2303,7 @@ public void setIgnoreSubtype(boolean ignoreSubtype)
}

@RequiresPermission(ReadPermission.class)
public class AggregatedResultsReportAction extends BaseAssayAction<ProtocolIdForm>
public static class AggregatedResultsReportAction extends BaseAssayAction<ProtocolIdForm>
{
private ExpProtocol _protocol;

Expand Down Expand Up @@ -2338,8 +2338,6 @@ public ModelAndView getView(AssignmentForm form, BindException errors)
if (form.getRowId() == -1)
errors.reject(ERROR_MSG, "Error: Please provide an rowId for the AnimalAnalysis table.");



return new JspView<>("/org/labkey/genotyping/view/editHaplotypeAssignment.jsp", form, errors);
}

Expand Down
2 changes: 1 addition & 1 deletion genotyping/src/org/labkey/genotyping/view/analyze.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<labkey:errors/>
<div id="form"></div>

<script type="text/javascript">
<script type="text/javascript" nonce="<%=getScriptNonce()%>">
var samples = [
<%
String sep = "";
Expand Down
2 changes: 1 addition & 1 deletion genotyping/src/org/labkey/genotyping/view/configure.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
ActionURL haplotypeEditDomainURL = PropertyService.get().getDomainKind(schema.getDomainURI(GenotypingQuerySchema.TableType.Haplotype.name())).urlCreateDefinition(GenotypingQuerySchema.NAME, GenotypingQuerySchema.TableType.Haplotype.name(), getContainer(), getUser());
haplotypeEditDomainURL.addReturnURL(getActionURL());
%>
<script type="text/javascript">
<script type="text/javascript" nonce="<%=getScriptNonce()%>">
var queries = {};

function update(query, hiddenId, divId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<%
}
%>
<script type="text/javascript">
<script type="text/javascript" nonce="<%=getScriptNonce()%>">

Ext4.onReady(function(){
LABKEY.Query.selectRows({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<br/>
<div id='<%=h(queryWebPartDivId)%>'></div>

<script type="text/javascript">
<script type="text/javascript" nonce="<%=getScriptNonce()%>">

Ext4.onReady(function(){
// lookup the Animal IDs if there were any selected from the results grid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
%>
<div id="<%=h(copyPasteDivId)%>"></div>

<script type="text/javascript">
<script type="text/javascript" nonce="<%=getScriptNonce()%>">
var expectedHeaders = [];
<%
for (Map.Entry<String, HaplotypeColumnMappingProperty> property : HaplotypeAssayProvider.getColumnMappingProperties(bean.getProtocol()).entrySet())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
<p>
<form method="GET" action="<%= h(reportURL)%>">
<input type="hidden" name="rowId" value="<%= model.getRowId() %>" />
<input type="checkbox" name="ignoreSubtype" <%= text(model.isIgnoreSubtype() ? "checked" : "") %> onclick="this.form.submit();" /> Ignore haplotype subtype distinctions ('a', 'b', 'c', etc suffixes on the haplotype names)
<input type="checkbox" name="ignoreSubtype" id="ignoreSubtype"<%=checked(model.isIgnoreSubtype())%>/> Ignore haplotype subtype distinctions ('a', 'b', 'c', etc suffixes on the haplotype names)
</form>
</p>

<%addHandler("ignoreSubtype", "click", "this.form.submit();");%>
<table class="labkey-data-region labkey-show-borders">
<tr>
<td class="labkey-column-header">Animal Id</td>
Expand Down