Skip to content

Commit 3cb01b3

Browse files
authored
Fb jsp print (#73)
1 parent 67e5fef commit 3cb01b3

File tree

2 files changed

+38
-36
lines changed

2 files changed

+38
-36
lines changed

src/org/labkey/trialshare/view/publicationDetails.jsp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
<%
2-
/*
3-
* Copyright (c) 2016 LabKey Corporation
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
8-
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
16-
*/
2+
/*
3+
* Copyright (c) 2016 LabKey Corporation
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
1717
%>
1818
<%@ page import="org.json.JSONObject" %>
19+
<%@ page import="org.labkey.api.util.JavaScriptFragment" %>
1920
<%@ page import="org.labkey.api.util.UniqueID" %>
2021
<%@ page import="org.labkey.api.view.HttpView" %>
2122
<%@ page import="org.labkey.api.view.JspView" %>
@@ -35,7 +36,7 @@
3536
3637
String renderId = "publication-details-" + UniqueID.getRequestScopedUID(HttpView.currentRequest());
3738
38-
String cubeObjectJson = bean.getCubeObject() == null ? "null" : new JSONObject(bean.getCubeObject()).toString(2);
39+
JavaScriptFragment cubeObjectJson = bean.getCubeObject() == null ? JavaScriptFragment.NULL : new JSONObject(bean.getCubeObject()).getJavaScriptFragment(2);
3940
%>
4041

4142
<labkey:errors/>
@@ -48,7 +49,7 @@
4849
mode: "<%=h(bean.getMode())%>",
4950
objectName : 'Publication',
5051
renderTo: <%=q(renderId)%>,
51-
cubeObject : <%= text( cubeObjectJson )%>,
52+
cubeObject : <%=cubeObjectJson%>,
5253
cubeContainerPath: "<%=h(bean.getCubeContainerPath())%>"
5354
});
5455
});

src/org/labkey/trialshare/view/studyDetails.jsp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
<%
2-
/*
3-
* Copyright (c) 2016 LabKey Corporation
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
8-
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
16-
*/
2+
/*
3+
* Copyright (c) 2016 LabKey Corporation
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
1717
%>
1818
<%@ page import="org.json.JSONArray" %>
1919
<%@ page import="org.json.JSONObject" %>
20+
<%@ page import="org.labkey.api.util.JavaScriptFragment" %>
2021
<%@ page import="org.labkey.api.util.UniqueID" %>
2122
<%@ page import="org.labkey.api.view.HttpView" %>
2223
<%@ page import="org.labkey.api.view.JspView" %>
@@ -39,7 +40,7 @@
3940
TrialShareController.CubeObjectDetailForm bean = me.getModelBean();
4041
4142
String renderId = "study-details-" + UniqueID.getRequestScopedUID(HttpView.currentRequest());
42-
String cubeObjectJson = bean.getCubeObject() == null ? "null" : new JSONObject(bean.getCubeObject()).toString(2);
43+
JavaScriptFragment cubeObjectJson = bean.getCubeObject() == null ? JavaScriptFragment.NULL : new JSONObject(bean.getCubeObject()).getJavaScriptFragment(2);
4344
List<StudyAccess> accessList = bean.getCubeObject() == null ? null :((StudyBean) bean.getCubeObject()).getStudyAccessList();
4445
4546
JSONArray jsonArray = new JSONArray();
@@ -51,7 +52,7 @@
5152
}
5253
}
5354
54-
String studyaccesslist = jsonArray.toString(2);
55+
JavaScriptFragment studyaccesslist = jsonArray.getJavaScriptFragment(2);
5556
%>
5657
<labkey:errors/>
5758
<div id="<%= h(renderId)%>" class="requests-editor"></div>
@@ -64,8 +65,8 @@
6465
objectName : 'Study',
6566
renderTo: <%=q(renderId)%>,
6667
accessListId : <%= bean.getAccessListId() %>,
67-
cubeObject : <%= text( cubeObjectJson )%>,
68-
studyaccesslist: <%= text( studyaccesslist )%>,
68+
cubeObject : <%= cubeObjectJson %>,
69+
studyaccesslist: <%= studyaccesslist %>,
6970
cubeContainerPath: "<%=h(bean.getCubeContainerPath())%>"
7071
});
7172
});

0 commit comments

Comments
 (0)