MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / export_api

Function export_api

codebase/sources/dhtmlxscheduler.es.js:21466–21653  ·  view source on GitHub ↗
(scheduler2)

Source from the content-addressed store, hash-verified

21464 });
21465}
21466function export_api(scheduler2) {
21467 (function() {
21468 function defaults(obj, std) {
21469 for (var key in std)
21470 if (!obj[key])
21471 obj[key] = std[key];
21472 return obj;
21473 }
21474 function getElementSizes(element, scheduler3) {
21475 var sizes = {};
21476 element = scheduler3._els[element];
21477 if (element && element[0]) {
21478 sizes.x = element[0].scrollWidth;
21479 sizes.y = element[0].scrollHeight;
21480 } else {
21481 sizes.x = 0;
21482 sizes.y = 0;
21483 }
21484 return sizes;
21485 }
21486 if (!window.dhtmlxAjax) {
21487 window.dhtmlxAjax = { post: function(url2, data, callback) {
21488 return window.dhx4.ajax.post(url2, data, callback);
21489 }, get: function(url2, callback) {
21490 return window.ajax.get(url2, callback);
21491 } };
21492 }
21493 function add_export_methods(scheduler3) {
21494 scheduler3.exportToPDF = function(config) {
21495 config = defaults(config || {}, { name: "calendar.pdf", format: "A4", orientation: "landscape", dpi: 96, zoom: 1, rtl: scheduler3.config.rtl });
21496 config.html = this._export_html(config);
21497 config.mode = this.getState().mode;
21498 this._send_to_export(config, "pdf");
21499 };
21500 scheduler3.exportToPNG = function(config) {
21501 config = defaults(config || {}, { name: "calendar.png", format: "A4", orientation: "landscape", dpi: 96, zoom: 1, rtl: scheduler3.config.rtl });
21502 config.html = this._export_html(config);
21503 config.mode = this.getState().mode;
21504 this._send_to_export(config, "png");
21505 };
21506 scheduler3.exportToICal = function(config) {
21507 config = defaults(config || {}, { name: "calendar.ical", data: this._serialize_plain(null, config) });
21508 this._send_to_export(config, "ical");
21509 };
21510 scheduler3.exportToExcel = function(config) {
21511 config = defaults(config || {}, { name: "calendar.xlsx", title: "Events", data: this._serialize_plain(this.templates.xml_format, config), columns: this._serialize_columns() });
21512 this._send_to_export(config, "excel");
21513 };
21514 scheduler3._ajax_to_export = function(data, type, callback) {
21515 delete data.callback;
21516 var url2 = data.server || "https://export.dhtmlx.com/scheduler";
21517 window.dhtmlxAjax.post(url2, "type=" + type + "&store=1&data=" + encodeURIComponent(JSON.stringify(data)), function(loader) {
21518 var fail = loader.xmlDoc.status > 400;
21519 var info = null;
21520 if (!fail) {
21521 try {
21522 info = JSON.parse(loader.xmlDoc.responseText);
21523 } catch (e) {

Callers

nothing calls this directly

Calls 1

add_export_methodsFunction · 0.70

Tested by

no test coverage detected