forked from marianol/JasperEmbedSample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple.html
executable file
·189 lines (173 loc) · 5.98 KB
/
simple.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!DOCTYPE html>
<!--
* ========================================================================
* index.html
*
* ========================================================================
* Copyright 2014
* Author: Mariano Luna
*
* Unless you have purchased a commercial license agreement from Jaspersoft Inc., the following license terms apply:
*
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU Affero General Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
* ======================================================================== */
-->
<html lang="en">
<head>
<title>Jasper Server Embedded Demo</title>
<script src="http://localhost:8080/jasperserver-pro/bif/visualize.js"></script>
<script type="text/JavaScript">
var jsRepository;
var jsReportUnit;
// Initialize Visualize.js
BIF.init({
domain: 'http://localhost:8080/jasperserver-pro',
mods: ['repository', 'reports']
}, function(Repo, Reports) {
jsRepository = Repo;
jsReportUnit = Reports;
initializeReports();
}
);
// some helpee funtions
function divVisibility(id, action) {
var e = document.getElementById(id);
if(action == 'hide')
e.style.display = 'none';
else
e.style.display = 'block';
}
function runReport(reportURI, targetDiv)
{
//alert(inputVal);
divVisibility('overlay', 'show');
//$('#container')
myReport = {
uri : reportURI ,
container : document.getElementById(targetDiv),
onReportFinished: function(status) {
//alert(status.totalPages);
myReport.gotoPage(0);
divVisibility('overlay', 'hide');
}
};
mReport = jsReportUnit.open(myReport);
};
function RepoList(path)
{
jsRepository.ls({type: 'reportUnit', limit: 100}).then(
function(data) {
$.each(data, function() {
$('#reportsList').append('<tr><td>' + this.label + '</td><td>' + this.creationDate
+ '</td>'
+ '<td>'
+ '<button id="buttong" onclick="runReport(\'' + this.uri + '\', \'report1\')" >RUN in One</button> '
+ '<button id="buttong" onclick="runReport(\'' + this.uri + '\', \'report2\')" >RUN in Two</button>'
+ '</td></tr>');
});
});
/*
+ ' - ' + this.uri
Response Sample:
creationDate: "2013-10-29 12:20:10"
description: "Sample HTML5 multi-axis column chart from Domain showing Sales, Units, and Sales/Square Feet by Country and Store Type with various filters"
label: "01. Geographic Results by Segment Report"
permissionMask: 1
resourceType: "reportUnit"
updateDate: "2013-08-21 22:42:28"
uri: "/public/Samples/Reports/1._Geographic_Results_by_Segment_Report"
version: 0
*/
}
function initializeReports() {
var uri_a = '/public/Samples/Reports/2_Sales_Mix_by_Demographic_Report';
var uri_b = '/public/Samples/Reports/1._Geographic_Results_by_Segment_Report';
runReport(uri_a, 'report1');
runReport(uri_b, 'report2');
}
</script>
<style type="text/css">
#repo h3 {
padding: 5px 0;
margin: 0;
}
#repo table {
border-collapse: collapse;
}
#repo td {
border: solid 1px #eee;
padding: 4px 0;
}
.fill { top:20; right:0; bottom:0; left:0}
#overlay { background: #333; opacity: 0.33}
#ajax-icon { width:64px; height: 64px; margin:auto; color: #fff; text-align: center}
.mygrid-wrapper-div {
overflow: scroll;
height: 400px;
}
#wrapper {
width: 100%;
overflow: hidden; /* add this to contain floated children */
}
#col-1 {
width: 49%;
float:left; /* add this */
border: 1px solid red;
}
#col-2 {
border: 1px solid green;
width: 49%;
float: left; /* add this */
}
</style>
</head>
<body onLoad="divVisibility('repo', 'hide');">
<h1 class="page-title">
<a href="#" class="navbar-brand">Jaspersoft Portal</a>
</h1>
<div class="navigation">
<ul class="navbar">
<li class="active"><a href="index.html">Home</a></li>
<li><a href="#" onclick="RepoList(); divVisibility('repo', 'show');" >Repository</a></li>
<li><a href="dashboard.html">Dashboard</a></li>
<li><a href="http://github.com/marianol/JasperEmbedSample">About</a></li>
</ul>
</div>
<div class="container" style="width:100%; ">
<div id="repo" >
<table id="reportsList" width="100%">
<tr><td colspan="3" style="background: #eee;"><h3>My Reports</h3></td></tr>
</table>
</div>
<div id="wrapper">
<div id="col-1">
<h3><a href="#">One</a></h3>
<div id="report1" class="fill">
<div id="overlay" class="fill">
<i class="icon-spinner icon-spin icon-3x"></i>
<p>Loading...</p>
</div>
</div>
</div>
<div id="col-2">
<h3><a href="#">Two</a></h3>
<div id="report2" class="fill2">
<div id="overlay" class="fill">
<i class="icon-spinner icon-spin icon-3x"></i>
<p>Loading...</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>