(config, ok, cancel)
| 8734 | } |
| 8735 | } |
| 8736 | function _boxStructure(config, ok, cancel) { |
| 8737 | var box = document.createElement("div"); |
| 8738 | var contentId = utils.uid(); |
| 8739 | scheduler2._waiAria.messageModalAttr(box, contentId); |
| 8740 | box.className = " scheduler_modal_box dhtmlx_modal_box scheduler-" + config.type + " dhtmlx-" + config.type; |
| 8741 | box.setAttribute(boxAttribute, 1); |
| 8742 | var inner = ""; |
| 8743 | if (config.width) |
| 8744 | box.style.width = config.width; |
| 8745 | if (config.height) |
| 8746 | box.style.height = config.height; |
| 8747 | if (config.title) |
| 8748 | inner += '<div class="scheduler_popup_title dhtmlx_popup_title">' + config.title + "</div>"; |
| 8749 | inner += '<div class="scheduler_popup_text dhtmlx_popup_text" id="' + contentId + '"><span>' + (config.content ? "" : config.text) + '</span></div><div class="scheduler_popup_controls dhtmlx_popup_controls">'; |
| 8750 | if (ok) |
| 8751 | inner += button(getFirstDefined(config.ok, scheduler2.locale.labels.message_ok, "OK"), "ok", true); |
| 8752 | if (cancel) |
| 8753 | inner += button(getFirstDefined(config.cancel, scheduler2.locale.labels.message_cancel, "Cancel"), "cancel", false); |
| 8754 | if (config.buttons) { |
| 8755 | for (var i = 0; i < config.buttons.length; i++) { |
| 8756 | var btn = config.buttons[i]; |
| 8757 | if (typeof btn == "object") { |
| 8758 | var label = btn.label; |
| 8759 | var css = btn.css || "scheduler_" + btn.label.toLowerCase() + "_button dhtmlx_" + btn.label.toLowerCase() + "_button"; |
| 8760 | var value = btn.value || i; |
| 8761 | inner += button(label, css, value); |
| 8762 | } else { |
| 8763 | inner += button(btn, btn, i); |
| 8764 | } |
| 8765 | } |
| 8766 | } |
| 8767 | inner += "</div>"; |
| 8768 | box.innerHTML = inner; |
| 8769 | if (config.content) { |
| 8770 | var node = config.content; |
| 8771 | if (typeof node == "string") |
| 8772 | node = document.getElementById(node); |
| 8773 | if (node.style.display == "none") |
| 8774 | node.style.display = ""; |
| 8775 | box.childNodes[config.title ? 1 : 0].appendChild(node); |
| 8776 | } |
| 8777 | scheduler2.event(box, "click", function(event2) { |
| 8778 | var source = event2.target || event2.srcElement; |
| 8779 | if (!source.className) |
| 8780 | source = source.parentNode; |
| 8781 | if (dom_helpers.closest(source, ".scheduler_popup_button")) { |
| 8782 | var result = source.getAttribute("data-result"); |
| 8783 | result = result == "true" || (result == "false" ? false : result); |
| 8784 | callback(config, result, event2); |
| 8785 | } |
| 8786 | }); |
| 8787 | config.box = box; |
| 8788 | if (ok || cancel) |
| 8789 | _dhx_msg_cfg = config; |
| 8790 | return box; |
| 8791 | } |
| 8792 | function _createBox(config, ok, cancel) { |
| 8793 | var box = config.tagName ? config : _boxStructure(config, ok, cancel); |
no test coverage detected