1313import org .labkey .api .security .User ;
1414import org .labkey .api .security .UserManager ;
1515import org .labkey .api .util .PageFlowUtil ;
16+ import org .labkey .api .view .HttpView ;
1617import org .labkey .api .view .template .ClientDependency ;
1718import org .labkey .mcc .MccManager ;
1819import org .labkey .mcc .security .MccFinalReviewPermission ;
@@ -32,6 +33,8 @@ public DisplayColumn createRenderer(ColumnInfo colInfo)
3233 {
3334 return new AbstractMccDisplayColumn (colInfo )
3435 {
36+ private boolean _hasRegisteredApprovedHandler = false ;
37+
3538 @ Override
3639 public void renderGridCellContents (RenderContext ctx , Writer out ) throws IOException
3740 {
@@ -94,7 +97,14 @@ else if (st == MccManager.RequestStatus.PendingDecision)
9497 }
9598 else if (st == MccManager .RequestStatus .Approved )
9699 {
97- out .write ("<br><a class=\" labkey-text-link\" onclick=\" MCC.window.ChangeStatusWindow.buttonHandler(" + PageFlowUtil .jsString (ctx .getCurrentRegion ().getName ()) + "," + requestRowId + ", 'Fulfilled')\" >Mark Fulfilled</a>" );
100+ out .write ("<br><a class=\" labkey-text-link rsadc-approved\" data-requestrowid=" + PageFlowUtil .jsString (String .valueOf (requestRowId )) + ">Mark Fulfilled</a>" );
101+
102+ if (!_hasRegisteredApprovedHandler )
103+ {
104+ HttpView .currentPageConfig ().addHandlerForQuerySelector ("a.rsadc-approved" , "click" , "MCC.window.ChangeStatusWindow.buttonHandler(" + PageFlowUtil .jsString (ctx .getCurrentRegion ().getName ()) + ", this.attributes.getNamedItem('data-requestrowid').value, 'Fulfilled'); return false;" );
105+
106+ _hasRegisteredApprovedHandler = true ;
107+ }
98108 }
99109 }
100110 catch (IllegalArgumentException e )
@@ -128,9 +138,4 @@ public void addQueryFieldKeys(Set<FieldKey> keys)
128138 }
129139 };
130140 }
131-
132- private String getWithdrawnLine (RenderContext ctx , int requestRowId )
133- {
134- return "<br><a class=\" labkey-text-link\" onclick=\" MCC.window.ChangeStatusWindow.buttonHandler(" + PageFlowUtil .jsString (ctx .getCurrentRegion ().getName ()) + "," + requestRowId + ", 'Withdrawn')\" >Withdraw Request</a>" ;
135- }
136141}
0 commit comments