|
62 | 62 | <Type>%Boolean</Type>
|
63 | 63 | </Property>
|
64 | 64 |
|
| 65 | +<Property name="ExcelExportClass"> |
| 66 | +<Type>%String</Type> |
| 67 | +</Property> |
| 68 | + |
65 | 69 | <Method name="%OnGetPortletName">
|
66 | 70 | <ClassMethod>1</ClassMethod>
|
67 | 71 | <ReturnType>%String</ReturnType>
|
|
94 | 98 | set pInfo($I(pInfo)) = $LB("EnableSearch", 1, "%Boolean", "Enable listing search", "Show search tools in listing mode")
|
95 | 99 | set pInfo($I(pInfo)) = $LB("StretchColumns", 0, "%Boolean", "Stretch columns", "Stretch columns to fill all available width")
|
96 | 100 | set pInfo($I(pInfo)) = $LB("ShowRowNumbers", 0, "%Boolean", "Show row nums", "Show row number in listing")
|
| 101 | + set pInfo($I(pInfo)) = $LB("ExcelExportClass", "_DeepSee.UI.MDXExcel.cls", "%String", "Excel export class", "Class which exports MDX to Excel") |
97 | 102 |
|
98 | 103 | quit $$$OK
|
99 | 104 | ]]></Implementation>
|
@@ -366,30 +371,53 @@ If LPT has been created before, method fires given callback immidiately.</Descri
|
366 | 371 | <ClientMethod>1</ClientMethod>
|
367 | 372 | <Implementation><![CDATA[
|
368 | 373 | var container = document.getElementById(this.id),
|
369 |
| - controller = this.getConnectedController(); |
| 374 | + controller = this.getConnectedController(), |
| 375 | + page = this.ExcelExportClass; |
370 | 376 |
|
371 | 377 | if (!this.LightPivotTable) return;
|
372 | 378 |
|
373 | 379 | if (true) { // *.XLS export, false - *.CSV.
|
374 | 380 |
|
375 | 381 | var controls = this.id.replace(/\/.*/, "") + "/control/",
|
376 |
| - i = 1, n, |
377 |
| - filter = document.getElementById(controls + i), |
| 382 | + control, i = 1, n, |
| 383 | + //filter = document.getElementById(controls + i), |
| 384 | + widget = this.parent.parent, |
378 | 385 |
|
379 | 386 | filterNames = [],
|
380 | 387 | filterValues = [];
|
381 | 388 |
|
382 |
| - if (filter) do { |
| 389 | + /*if (filter) do { |
383 | 390 | if ((n = (filter.getElementsByTagName("input")[0] || {}).name) === "$V_applyFilter" || n === "$V_setFilter") {
|
384 | 391 | filterNames.push((filter.parentNode.getElementsByClassName("zenLabel")[0] || {}).innerText || "");
|
385 | 392 | filterValues.push("SET");
|
386 | 393 | }
|
387 | 394 | filter = document.getElementById(controls + (++i));
|
388 |
| - } while (filter); |
| 395 | + } while (filter);*/ |
| 396 | +
|
| 397 | + for (j in widget.controlIndices) { |
| 398 | + control = zenPage.getComponent(widget.controlIndices[j]); |
| 399 | + if (control) { |
| 400 | + filterNames.push(control.label); |
| 401 | + filterValues.push(control.text); |
| 402 | + } |
| 403 | + } |
| 404 | +
|
| 405 | + var mdx = this.LightPivotTable.getActualMDX(), |
| 406 | + nonce, url; |
| 407 | +
|
| 408 | + if (zenPage.CreateQueryNonce) { |
| 409 | + nonce = zenPage.CreateQueryNonce(mdx); |
| 410 | + if (nonce.toString().indexOf('ERROR:') >= 0) { |
| 411 | + alert(nonce); |
| 412 | + return; |
| 413 | + } |
| 414 | + url = page + '?NONCE=' + encodeURIComponent(nonce); |
| 415 | + } else { |
| 416 | + url = page + '?MDX=' + encodeURIComponent(mdx); |
| 417 | + } |
389 | 418 |
|
390 | 419 | window.open(
|
391 |
| - (location.origin + location.pathname).replace(/\/[^\/]*$/, "/_DeepSee.UI.MDXExcel.zen?MDX=") |
392 |
| - + encodeURIComponent(this.LightPivotTable.getActualMDX()) |
| 420 | + url |
393 | 421 | + "&ROWTOTALS=" + container.getElementsByTagName("div")[0].getAttribute("show-summary")
|
394 | 422 | + "&ROWTOTALAGG=sum"
|
395 | 423 | + "&COLUMNTOTALAGG=sum"
|
|
0 commit comments