浏览代码

Adding oncontextmenu callbacks to open forms in new tab

Andrej Studen 1 周之前
父节点
当前提交
ea0f82db8f
共有 2 个文件被更改,包括 10 次插入5 次删除
  1. 6 3
      web/crf/formPortalNew.js
  2. 4 2
      web/crf/participantOverview.js

+ 6 - 3
web/crf/formPortalNew.js

@@ -221,6 +221,8 @@ function(el,formList,roleAndSite,formId=null,idLabel=null,elError=null){
       let idLabel=crfSetup.getParticipantLabel(entry);
       let text=[entry['entryId'],user,idLabel,formStatus];
       fbox.onclick=function(){that.openForm(entry,roleAndSite,elError);};
+      //right click opens in new tab
+      fbox.oncontextmenu=function(){that.openForm(entry,roleAndSite,elError,"_blank");};
 
       for (let j=0;j<text.length;j++){
          crfHTML.createParagraph(text[j],null,fbox);
@@ -286,7 +288,7 @@ function(row,deletedForms){
 
 
 formPortal.openForm=
-function(crfEntry,roleAndSite,elError=null){
+function(crfEntry,roleAndSite,elError=null,target="_self"){
    let fName="[openForm]";
    if (!roleAndSite){
       if (elError) 
@@ -325,8 +327,9 @@ function(crfEntry,roleAndSite,elError=null){
    var wikiURL = LABKEY.ActionURL.buildURL("crf", formUrl , containerPath, params);
    this.print(fName+" redirecting to "+wikiURL);
 
-		 
-	window.location = wikiURL;
+   window.open(wikiURL,target);
+
+   
 }
 
 formPortal.createForm=

+ 4 - 2
web/crf/participantOverview.js

@@ -147,6 +147,7 @@ function(entryMap){
       let cell=crfHTML.createTblHeader(null,row);
       crfHTML.createTextNode(idLabel,null,cell);
       cell.onclick=function(){that.openParticipant(idLabel);};
+      cell.oncontextmenu=function(){that.openParticipant(idLabel,"_blank");};
       for (let i=0;i<formRows.length;i++){
          let form=formRows[i]['Key'];
          let count=new Object();
@@ -171,7 +172,7 @@ function(entryMap){
 }
 
 participantOverview.openParticipant=
-function(idLabel){
+function(idLabel,target="_self"){
 	let formUrl="participantPortal";
 	let params=new Object();
 	params.name=formUrl;
@@ -188,6 +189,7 @@ function(idLabel){
 	//let homeURL = LABKEY.ActionURL.buildURL("project", formUrl , containerPath, params);
 	let homeURL = LABKEY.ActionURL.buildURL("crf", formUrl , containerPath, params);
    this.print("Redirecting to "+homeURL);
-	window.location = homeURL;
+   window.open(homeURL,target);
+	//window.location = homeURL;
 
 }