// "use strict";
-mkws.registerWidgetType('Popup', function() {
- alert("running popup");
+$(document).ready(function () {
+ // mkws.registerWidgetType('PopupWindow', function() {
+ var $ = mkws.$;
+ var debug = mkws.log;
+ debug("init popup window");
- if (!mkws.$.ui) {
- alert("Error: jquery-ui.js is missing, did you include it after jQuery core in the HTML file?");
- return;
- }
+ if (!$.ui) {
+ alert("Error: jquery-ui.js is missing, did you include it after jQuery core in the HTML file?");
+ return;
+ }
- if (!this.config.popup_width) this.config.popup_width = "800";
- if (!this.config.popup_height) this.config.popup_height = "600";
- if (!this.config.auto_open) this.config.auto_open = "0";
+ var popup = $(".PopupWindow");
+ if (!popup) {
+ debug("no popup found");
+ return;
+ } else {
+ debug("found popup windows: " + popup.length);
+ }
- $(this).dialog({
- closeOnEscape: true,
- autoOpen: parseInt(this.config.auto_open) ? true : false,
- height: parseInt(this.config.popup_height),
- width: parseInt(this.config.popup_width),
- modal: true,
- resizable: true,
- buttons: {
- Cancel: function() {
- $(this).dialog("close");
- }
- },
- close: function() { }
- });
+ $(popup).each(function (i) {
+ var width = parseInt(this.attr("popup_width") || "800");
+ var height = parseInt(this.attr("popup_height") || "600");
+ var autoOpen = parseInt(this.attr("popup_autoOpen") || "0");
+ debug("Popup parameters: width: " + width + ", height: " + height + ", autoOpen: " + autoOpen);
+ $(this).dialog({
+ closeOnEscape: true,
+ autoOpen: autoOpen,
+ height: height,
+ width: width,
+ modal: true,
+ resizable: true,
+ buttons: {
+ Cancel: function () {
+ $(this).dialog("close");
+ }
+ },
+ close: function () {}
+ });
+ });
});
-