Skip to content

Commit 12ffb24

Browse files
committed
refactor and simplify Report widget.
1 parent 3eef9d0 commit 12ffb24

File tree

3 files changed

+260
-126
lines changed

3 files changed

+260
-126
lines changed

config/report.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
define([
2+
'esri/urlUtils',
23
'esri/layers/ImageParameters'
3-
], function (ImageParameters) {
4+
], function (urlUtils, ImageParameters) {
45
'use strict';
56

7+
urlUtils.addProxyRule({
8+
urlPrefix: 'http://gis.scwa.ca.gov',
9+
proxyUrl: '/proxy/proxy.ashx'
10+
});
11+
612
var imageParameters = new ImageParameters();
713
imageParameters.format = 'png32';
814

config/reportWidget.js

+42-22
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@ define([
55

66
return {
77
map: true,
8-
printTaskURL: 'https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task',
8+
9+
/*
10+
printTaskURL must be on the same same as application
11+
or the server must be configured for CORS
12+
or you can use a proxy
13+
*/
14+
printTaskURL: 'http://gis.scwa.ca.gov/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task',
15+
//'https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task',
916

1017
startup: function () {
11-
window.setTimeout(function () {
12-
topic.publish('reportWidget/createReport');
13-
}, 200);
18+
topic.publish('reportWidget/createReport');
1419
},
1520

1621
reportLayout: {
@@ -32,28 +37,34 @@ define([
3237
right: 30
3338
},
3439
font: {
35-
color: 20,
40+
color: [33, 33, 33],
3641
size: 11,
3742
font: 'helvetica',
3843
style: 'normal'
3944
},
4045
line: {
4146
width: 0.5,
42-
color: 0
47+
color: 30
4348
},
4449
border: {
4550
width: 0.5,
4651
color: 128
4752
},
4853
header: {
4954
text: 'City of Petaluma Parcel Report',
55+
left: 306, // page width = 612 pts
56+
top: 40,
57+
align: 'center',
5058
font: {
51-
color: [41, 128, 185],
52-
size: 20,
59+
color: [66, 66, 66],
60+
size: 24,
5361
style: 'bold'
5462
},
5563
line: {
56-
width: 1
64+
left: 60,
65+
top: 47,
66+
width: 1.5,
67+
color: 66
5768
}
5869
},
5970
footer: {
@@ -62,6 +73,7 @@ define([
6273
color: 66
6374
},
6475
date: {
76+
left: 35, // just inside the left margin
6577
includeTime: false,
6678
font: {
6779
color: [66, 66, 66],
@@ -71,6 +83,8 @@ define([
7183
},
7284
copyright: {
7385
text: 'Copyright 2015, City of Petaluma California',
86+
left: 575, // just inside the right margin
87+
align: 'right',
7488
font: {
7589
color: [66, 66, 66],
7690
size: 9,
@@ -79,27 +93,37 @@ define([
7993
}
8094
},
8195
map: {
82-
top: 55,
83-
left: 35,
96+
top: 85,
97+
left: 40,
8498
height: 250,
8599
width: 290,
86-
dpi: 360, //multiple of 72
100+
dpi: 144, //multiple of 72
87101
format: 'PNG32',
88102
preserveScale: true,
89103
border: true
90104
},
91-
images: [],
105+
images: [
106+
{
107+
top: 15,
108+
left: 15,
109+
width: 50,
110+
height: 50,
111+
url: '/proxy/proxy.ashx?https://xara1-4.cityofpetaluma.net/jsviewers/maplibrary/images/Petaluma1858verC2_graybg.bmp'
112+
}
113+
],
92114
text: [],
115+
lines: [],
116+
shapes: [],
93117
attributes: [
94118
{
95-
top: 67,
119+
top: 97,
96120
left: 350,
97121
height: 235,
98122
width: 225,
99123
title: {
100124
text: 'These are attributes',
101125
font: {
102-
color: 41,
126+
color: [66, 66, 66],
103127
size: 12,
104128
style: 'bold'
105129
}
@@ -160,25 +184,21 @@ define([
160184
]
161185
},
162186
{
163-
top: 350,
187+
top: 370,
164188
left: 35,
165189
right: 45,
166190
height: 270,
167191
title: {
168192
text: 'These are attributes two',
169193
font: {
170-
color: 40,
194+
color: [66, 66, 66],
171195
size: 12,
172196
style: 'bold'
173197
}
174198
},
175199
border: true,
176200
layout: 'table',
177-
fields: [
178-
{
179-
label: 'Tabular Attributes will go here'
180-
}
181-
]
201+
fields: []
182202
}
183203
]
184204

0 commit comments

Comments
 (0)