From 6cf964d0dc008621fb30fd2da28e2c44f29c6364 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 27 Jan 2005 10:21:18 +0000 Subject: DHTML progress bar for glacial rate adding and editing, closes: Bug#1100 --- httemplate/elements/qlib/button.js | 74 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 httemplate/elements/qlib/button.js (limited to 'httemplate/elements/qlib/button.js') diff --git a/httemplate/elements/qlib/button.js b/httemplate/elements/qlib/button.js new file mode 100644 index 000000000..05247d5f8 --- /dev/null +++ b/httemplate/elements/qlib/button.js @@ -0,0 +1,74 @@ +/** + * QLIB 1.0 Button Control + * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * http://qlib.quazzle.com + */ + +function QButton_update() { + with (this) { + image.src = ((!enabled && res.imgD) || (value ? res.imgP : res.imgN)).src; + } +} + +function QButton_doEvent() { + with (this) { + if (enabled) { + if (res.style == 1) { + this.value = value ? 0 : 1; + update(); + } + onClick(value, tag); + } + } + return false; +} + +function QButton_enable(state) { + this.enabled = state; + this.update(); +} + +function QButton_set(value) { + if (this.enabled) { + this.value = value ? 1 : 0; + this.update(); + } + return true; +} + +function QButton(parent, name, res, tooltip) { + this.init(parent, name); + if (res) { + this.res = res; + this.tip = tooltip || ""; + this.enabled = true; + this.value = 0; + this.set = QButton_set; + this.enable = QButton_enable; + this.update = QButton_update; + this.doEvent = QButton_doEvent; + this.onClick = QControl.event; + with (this) { + document.write(''); + this.image = document.images[id] || new Image(1, 1); + } + } else { + this.document.write("invalid resource"); + } +} +QButton.prototype = new QControl(); +QButton.NORMAL = 0; +QButton.CHECKBOX = 1; +QButton.WEB = 2; +QButton.SIGNAL = 3; -- cgit v1.2.1