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

Migrate inline handlers #137

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 10 additions & 4 deletions OConnor/resources/views/BloodCalendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -280,22 +280,27 @@
theWindow.show();

}


LABKEY.Utils.onReady(function(){
document.getElementById('previousButton')['click'] = previous;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be onclick? The changes in this PR are inconsistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, should be onclick. Thanks... I've corrected here and a couple other places.

document.getElementById('nextButton')['click'] = next;
document.getElementById('jumpButton')['click'] = jump;
});
</script>
<body>
<div align="center">

<table>
<tr>
<td>
<input value='Previous' type='button' onclick='previous()'>
<input value='Previous' type='button' id='previousButton'>
</td>
<td id="week"></td>
<td>
<input value='Next' type='button' onclick='next()'>
<input value='Next' type='button' id='nextButton'>
</td>
<td>
<input value='Jump To' type='button' onclick='jump()'>
<input value='Jump To' type='button' id='jumpButton'>
</td>
</tr>
<tr>
Expand All @@ -309,6 +314,7 @@
</div>
<br>
<table width = '900 '><tr><td>*Unsubmitted</td></tr></table>
</div>

</body>
</html>
254 changes: 114 additions & 140 deletions OConnor/resources/views/Elispot_Matrix.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
});
}


var trad1 = '';
var trad2 = '';
var matrix1 = '';
Expand All @@ -26,10 +25,6 @@

Ext.onReady(main);





function main(){

var tradExps = LABKEY.ActionURL.getParameter('trad');
Expand Down Expand Up @@ -63,8 +58,7 @@
success: runPeptides,

});



function runPeptides(d){

matrixPeptides = [];
Expand Down Expand Up @@ -108,154 +102,134 @@
});
}

function getPeptides(d){

table = document.getElementById('dataregion_theTable');
rows = table.childNodes[3].getElementsByTagName('tr');
function getPeptides(d){
table = document.getElementById('dataregion_theTable');
rows = table.childNodes[3].getElementsByTagName('tr');

var tradArray = [];
var matrixArray = [];

for (var i = 0; i < d.rows.length; i++){
for (var t = 0; t < matrixPeptides.length; t++){
if(d.rows[i].peptide_number == matrixPeptides[t]){
var tempString = d.rows[i].pool_contents;
tempString = tempString.replace(/\s+/g,"");
matrixArray.push(tempString.split(','));
}
}
for (var t = 0; t < traditionalPeptides.length; t++){
if(d.rows[i].peptide_number == traditionalPeptides[t]){
var tempString = d.rows[i].pool_contents;
tempString = tempString.replace(/\s+/g,"");

if (tempString.indexOf('-') != -1){
var idx = tempString.indexOf('-');
var tempArray = [];

var start = +tempString.substring(0,idx);
var end = +tempString.substring(idx+1,tempString.length);

for(var p = start; p <= end; p++){
tempArray.push(p);
}

tradArray.push(tempArray);
}
else
{
tradArray.push(tempString.split(','));
}
}
}
}



var tradArray = [];
var matrixArray = [];

for(var i = 0; i < d.rows.length; i++){
for(var t = 0; t < matrixPeptides.length; t++){
if(d.rows[i].peptide_number == matrixPeptides[t]){
var tempString = d.rows[i].pool_contents;
tempString = tempString.replace(/\s+/g,"");
matrixArray.push(tempString.split(','));
}

}
for(var t = 0; t < traditionalPeptides.length; t++){
if(d.rows[i].peptide_number == traditionalPeptides[t]){
var tempString = d.rows[i].pool_contents;
tempString = tempString.replace(/\s+/g,"");

if (tempString.indexOf('-') != -1){
var idx = tempString.indexOf('-');
var tempArray = [];

var start = +tempString.substring(0,idx);
var end = +tempString.substring(idx+1,tempString.length);

for(var p = start; p <= end; p++){
tempArray.push(p);
}

tradArray.push(tempArray);

}else{
tradArray.push(tempString.split(','));
}
}

}
}



var allMatrix = [];

for(var i = 0; i < matrixArray.length; i++){
for(var t = 0; t < matrixArray[i].length; t++){
allMatrix.push(matrixArray[i][t]);
}
}

var allTrad = [];

for(var i = 0; i < tradArray.length; i++){
for(var t = 0; t < tradArray[i].length; t++){
allTrad.push(tradArray[i][t]);
}
}

var shared = [];

for(var i = 0; i < allMatrix.length; i++){
for(var t = 0; t < allTrad.length; t++){
if(allMatrix[i] == allTrad[t])
shared.push(allMatrix[i]);
}
}






for(var i = 0; i < matrixArray.length; i++)
highlight(matrixArray[i],"#00FF00");

for(var i = 0; i < tradArray.length; i++)
highlight(tradArray[i],"#FF3333");

highlight(shared,"#FFFF00");
var allMatrix = [];

makeQuery(shared);


function highlight(highPep,color){

for (var i = 0; i < rows.length; i++){
if(rows[i].className == 'labkey-row' || rows[i].className == 'labkey-alternate-row'){
for(var t = 0; t < rows[i].childNodes.length; t++){

for(var p = 0; p < highPep.length; p++){
if(rows[i].childNodes[t].innerHTML.indexOf(highPep[p]) != -1)
rows[i].childNodes[t].style.backgroundColor = color;
}
}

}

}

}


function makeQuery(peptides){

var qwp2 = new LABKEY.QueryWebPart({
renderTo: 'peptides',
schemaName: 'oconnor',
queryName: 'peptides',
containerPath: 'WNPRC/WNPRC_Laboratories/oconnor/',
frame: 'none',
buttonBarPosition: 'top',
allowChooseQuery: false,
showDeleteButton: false,
showInsertNewButton: false,
showUpdateColumn: false,
showDetailsColumn : false,
showRecordSelectors : true,
filterArray: [LABKEY.Filter.create('peptide_number', peptides.join(';'), LABKEY.Filter.Types.EQUALS_ONE_OF)],
containerPath: 'WNPRC/WNPRC_Laboratories/oconnor/',
for(var i = 0; i < matrixArray.length; i++){
for(var t = 0; t < matrixArray[i].length; t++){
allMatrix.push(matrixArray[i][t]);
}
}

});


}


}
var allTrad = [];

for(var i = 0; i < tradArray.length; i++){
for(var t = 0; t < tradArray[i].length; t++){
allTrad.push(tradArray[i][t]);
}
}

var shared = [];

for(var i = 0; i < allMatrix.length; i++){
for(var t = 0; t < allTrad.length; t++){
if(allMatrix[i] == allTrad[t])
shared.push(allMatrix[i]);
}
}

for(var i = 0; i < matrixArray.length; i++)
highlight(matrixArray[i],"#00FF00");

for(var i = 0; i < tradArray.length; i++)
highlight(tradArray[i],"#FF3333");

highlight(shared,"#FFFF00");

makeQuery(shared);

function highlight(highPep,color){

for (var i = 0; i < rows.length; i++){
if(rows[i].className == 'labkey-row' || rows[i].className == 'labkey-alternate-row'){
for(var t = 0; t < rows[i].childNodes.length; t++){

for(var p = 0; p < highPep.length; p++){
if(rows[i].childNodes[t].innerHTML.indexOf(highPep[p]) != -1)
rows[i].childNodes[t].style.backgroundColor = color;
}
}
}
}
}

function makeQuery(peptides){

var qwp2 = new LABKEY.QueryWebPart({
renderTo: 'peptides',
schemaName: 'oconnor',
queryName: 'peptides',
containerPath: 'WNPRC/WNPRC_Laboratories/oconnor/',
frame: 'none',
buttonBarPosition: 'top',
allowChooseQuery: false,
showDeleteButton: false,
showInsertNewButton: false,
showUpdateColumn: false,
showDetailsColumn : false,
showRecordSelectors : true,
filterArray: [LABKEY.Filter.create('peptide_number', peptides.join(';'), LABKEY.Filter.Types.EQUALS_ONE_OF)],
containerPath: 'WNPRC/WNPRC_Laboratories/oconnor/',
});
}
}
}

function newExps(){
matrixElispotSelection(null, matrix1, matrix2, trad1, trad2);
}


LABKEY.Utils.onReady(function(){
document.getElementById('newExps')['onclick'] = newExps;
});
</script>
<INPUT style="font-size:16px;" type="button" value="New Experiments" name="button6" onClick='newExps()'>
<INPUT style="font-size:16px;" type="button" value="New Experiments" name="button6" id='newExps'>
<span id="experiments" style="font-size:18px; line-height:16px; vertical-align:text-bottom;"></span>
<br></br>
<br>
<div id="matches" style="font-size:20px">
</div>
<div id="peptides"></div>
<br></br>
<br>
<div id="matrix"></div>
</html>

27 changes: 10 additions & 17 deletions OConnor/resources/views/WebPartRemoval.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
<html>
<script type="text/javascript" nonce="<%=scriptNonce%>">



function remove(){

var lastID;
LABKEY.Portal.getWebParts({
success: function(d){
LABKEY.Portal.removeWebPart({
updateDOM : true,
webPartId : d.body[d.body.length-2].webPartId

});
}

success: function(d){
LABKEY.Portal.removeWebPart({
updateDOM : true,
webPartId : d.body[d.body.length-2].webPartId
});
}
});

}




LABKEY.Utils.onReady(function(){
document.getElementById('removeLastWebPart')['onclick'] = remove;
});
</script>
<FORM>
<INPUT type="button" value="Remove Last WebPart" name="button6" onClick='remove()'>
<INPUT type="button" value="Remove Last WebPart" name="button6" id="removeLastWebPart">
</FORM>

</html>
Expand Down