Skip to content
Snippets Groups Projects
Commit 31872caa authored by Mike McKay's avatar Mike McKay
Browse files

XNAT-4436 Fixed bulk delete.

parent 725abd0f
No related branches found
No related tags found
No related merge requests found
...@@ -10,10 +10,6 @@ ...@@ -10,10 +10,6 @@
*/ */
package org.nrg.xnat.turbine.modules.screens; package org.nrg.xnat.turbine.modules.screens;
import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;
import org.apache.turbine.util.RunData; import org.apache.turbine.util.RunData;
import org.apache.velocity.context.Context; import org.apache.velocity.context.Context;
import org.nrg.xdat.search.DisplaySearch; import org.nrg.xdat.search.DisplaySearch;
...@@ -23,6 +19,10 @@ import org.nrg.xdat.turbine.utils.TurbineUtils; ...@@ -23,6 +19,10 @@ import org.nrg.xdat.turbine.utils.TurbineUtils;
import org.nrg.xft.XFTTable; import org.nrg.xft.XFTTable;
import org.nrg.xft.security.UserI; import org.nrg.xft.security.UserI;
import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;
public class BulkDeleteActionScreen extends SecureScreen { public class BulkDeleteActionScreen extends SecureScreen {
// Enumeration to determine what type of item is stored in an ItemContainer object. // Enumeration to determine what type of item is stored in an ItemContainer object.
...@@ -81,6 +81,7 @@ public class BulkDeleteActionScreen extends SecureScreen { ...@@ -81,6 +81,7 @@ public class BulkDeleteActionScreen extends SecureScreen {
}else{ }else{
context.put("errMsg", "There is nothing to delete."); context.put("errMsg", "There is nothing to delete.");
} }
context.put("turbineUtils", TurbineUtils.GetInstance());
} }
/** /**
...@@ -225,7 +226,7 @@ public class BulkDeleteActionScreen extends SecureScreen { ...@@ -225,7 +226,7 @@ public class BulkDeleteActionScreen extends SecureScreen {
public String canDelete(UserI u, String searchType){ public String canDelete(UserI u, String searchType){
try{ try{
// Is the user allowed to delete this item // Is the user allowed to delete this item
boolean canDelete = Permissions.canAny(u,this.xsi + "/project", this.project, "delete"); boolean canDelete = Permissions.canAny(u,this.xsi, this.project, "delete");
// The search type determines which items a user is allowed to delete. // The search type determines which items a user is allowed to delete.
if(searchType.equals("subject")){ if(searchType.equals("subject")){
......
...@@ -20,22 +20,24 @@ RestDeleter = function(_array,_config) { ...@@ -20,22 +20,24 @@ RestDeleter = function(_array,_config) {
t.width="100%"; t.width="100%";
var tb=t.appendChild(document.createElement("tbody")); var tb=t.appendChild(document.createElement("tbody"));
for(var aC=0;aC<this.a.length;aC++){ for(var aC=0;aC<this.a.length;aC++){
if(this.a[aC].canRead && (this.a[aC].allowDelete==undefined||this.a[aC].allowDelete==true)){ if(this.a[aC].canRead && (this.a[aC].allowDelete==undefined||this.a[aC].allowDelete==true)) {
var tr=tb.appendChild(document.createElement("tr")); if (!(this.a[aC].label == "Select All" && this.a[aC].xsiType == null)) {
tr.entry=this.a[aC]; var tr = tb.appendChild(document.createElement("tr"));
tr.entry = this.a[aC];
var td1=tr.appendChild(document.createElement("td"));
var td2=tr.appendChild(document.createElement("td")); var td1 = tr.appendChild(document.createElement("td"));
tr.td1=td1; var td2 = tr.appendChild(document.createElement("td"));
tr.td2=td2; tr.td1 = td1;
tr.td2 = td2;
td1.innerHTML=this.a[aC].label;
tr.pDivColor=td2.appendChild(document.createElement("div")); td1.innerHTML = this.a[aC].label;
tr.pDivColor.style.width="100%"; tr.pDivColor = td2.appendChild(document.createElement("div"));
tr.pDivColor.style.backgroundColor="gray"; tr.pDivColor.style.width = "100%";
tr.pDivColor.style.color="white"; tr.pDivColor.style.backgroundColor = "gray";
tr.pDivColor.innerHTML="&nbsp;waiting..."; tr.pDivColor.style.color = "white";
this.trArray.push(tr); tr.pDivColor.innerHTML = "&nbsp;waiting...";
this.trArray.push(tr);
}
} }
} }
var NUMSPACES=(this.config.defaultHeight/25)-4; var NUMSPACES=(this.config.defaultHeight/25)-4;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment