code cleanup
[mkws-moved-to-github.git] / src / mkws-popup.js
1 /* generic function to open results in a popup window
2  *
3  */
4
5 // "use strict";
6
7 mkws.registerWidgetType('Popup', function() {
8   alert("running popup");
9
10   if (!mkws.$.ui) {
11       alert("Error: jquery-ui.js is missing, did you include it after jQuery core in the HTML file?");
12       return;
13   }
14
15   if (!this.config.popup_width) this.config.popup_width = "800";
16   if (!this.config.popup_height) this.config.popup_height = "600";
17   if (!this.config.auto_open) this.config.auto_open = "0";
18
19   $(this).dialog({
20       closeOnEscape: true,
21       autoOpen: parseInt(this.config.auto_open) ? true : false,
22       height: parseInt(this.config.popup_height),
23       width: parseInt(this.config.popup_width),
24       modal: true,
25       resizable: true,
26       buttons: {
27         Cancel: function() {
28           $(this).dialog("close");
29         }
30       },
31       close: function() { }
32   });
33
34 });
35