DHTML progress bar for glacial rate adding and editing, closes: Bug#1100
[freeside.git] / httemplate / elements / qlib / messagebox.js
diff --git a/httemplate/elements/qlib/messagebox.js b/httemplate/elements/qlib/messagebox.js
new file mode 100644 (file)
index 0000000..2e45839
--- /dev/null
@@ -0,0 +1,57 @@
+/**\r
+ * QLIB 1.0 Message Box Control\r
+ * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ * http://qlib.quazzle.com\r
+ */\r
+\r
+function QMessageBox_alert(msg) {\r
+    if (typeof(msg) == "string") {\r
+        this.label.set(this.value = msg);\r
+    }\r
+    this.center();\r
+    this.focus();\r
+    this.show(true);\r
+}\r
+\r
+function QMessageBox_close() {\r
+    with (this.parent) {\r
+        if (!onClose(tag)) show(false);\r
+    }\r
+}\r
+\r
+function QMessageBox_body() {\r
+    with (this) {\r
+        document.write('<table border="0" width="' + cwidth + '"><tr><td align="left" valign="top" unselectable="on">');\r
+        this.label = new QLabel(this, "label", value);\r
+        document.write('</td></tr><tr><td height="' + (bres.height + 14) + '" align="center" valign="bottom" unselectable="on">');\r
+        this.button = new QButton(this, "button", bres, "Close");\r
+        document.write('</td></tr></table>');\r
+        button.onClick = QMessageBox_close;\r
+    }\r
+}\r
+\r
+function QMessageBox(parent, name, box, btn, msg, effects, opacity) {\r
+    this.init(parent, name);\r
+    if ((this.res = box) && (this.bres = btn)) {\r
+        this.value = typeof(msg) == "string" ? msg : "";\r
+        this.width = Math.max(200, Math.floor(Math.sqrt(555 * this.value.length)));\r
+        this.height = null;\r
+        this.x = this.y = 0;\r
+        this.visible = false;\r
+        this.zindex = null;\r
+        this.body = QMessageBox_body;\r
+        var j = QMessageBox.arguments.length;\r
+        this.effects = j > 5 ? effects : (box.effects != null ? box.effects : 0);\r
+        this.opacity = j > 6 ? opacity : (box.opacity != null ? box.opacity : 100);\r
+        this.create();\r
+        this.alert = QMessageBox_alert;\r
+        this.onClose = QControl.event;\r
+    } else {\r
+        this.document.write("invalid resource");\r
+    }\r
+}\r
+QMessageBox.prototype = new QBoxCtrl();\r