rendered paste body<xwt> <static> xwt.theme("xwt.standard", "org.xwt.themes.monopoly"); </static> <import name="xwt.standard.*"/> <import name="org.xwt.mail.*"/> <import name="org.gimp.tigert.icons.*"/> <template thisbox="frame" width="350" height="250" titlebar="Time Clock"> xwt.thread = function() { $username.disabled = true; $password.disabled = true; $username.focused = true; $username.disabled = false; $password.disabled = false; } lastusername = ""; _checkusername = function(x) { if(root.lastusername == $username.text) return; root.lastusername = $username.text; if($username.text != "") { xwt.thread = function() { root.whocares = false; $statusline.text = "Retrieving user information..."; var result = xwt.xmlrpc('http://xmlrpc.geeksanon.ca/tc.php').timeclock.Info($username.text); if(!root.whocares) $statusline.text = result.message; } } } _fieldsoff = function(x) { $clockin.disabled = x; $clockout.disabled = x; $report.disabled = x; $username.disabled = x; $password.disabled = x; if(!x) { xwt.thread = function() { var removeuser = $username.text; xwt.sleep(15000); if(removeuser == $username.text) { $username.text = ""; $password.text = ""; } } } } $clockin._click = function() { if($username.text == "" || $password.text == "") { $statusline.text = 'Username and password required.'; return; } xwt.thread = function() { root.whocares = true; root.fieldsoff = true; $statusline.text = "Contacting server to clock in '" + $username.text + "'..."; var result = xwt.xmlrpc('http://xmlrpc.geeksanon.ca/tc.php').timeclock.Clock.In($username.text, $password.text); $statusline.text = result.message; $username.focused = true; root.fieldsoff = false; } } $clockout._click = function() { if($username.text == "" || $password.text == "") { $statusline.text = 'Username and password required.'; return; } xwt.thread = function() { root.whocares = true; root.fieldsoff = true; $statusline.text = "Contacting server to clock out '" + $username.text + "'..."; var result = xwt.xmlrpc('http://xmlrpc.geeksanon.ca/tc.php').timeclock.Clock.Out($username.text, $password.text); $statusline.text = result.message; $username.focused = true; root.fieldsoff = false; } } $report._click = function() { if($username.text == "" || $password.text == "") { $statusline.text = 'Username and password required.'; return; } xwt.thread = function() { root.whocares = true; root.fieldsoff = true; $statusline.text = "Retrieving report for '" + $username.text + "'..."; var result = xwt.xmlrpc('http://xmlrpc.geeksanon.ca/tc.php').timeclock.Info($username.text); $statusline.text = result.message; $username.focused = true; root.fieldsoff = false; } } $exit._click = function() { root.Close = true; } <box id="input" orient="vertical" color="lightGray"> <vbox vshrink="true" hpad="10" vpad="10"> <box text="This is the time clock interface. Please login with your username and" vshrink="true"/> <box text="password to clock in, out or view a report of your times." vshrink="true"/> </vbox> <box height="5"/> <box hpad="10" vpad="10"> <grouper text="Employee Information" orient="vertical"> <vbox shrink="true" vpad="10"> <box> <box/> <box shrink="true" text="Username: "/> <bevel thickness="2" depth="down" width="200" id="bevuser"> <edit minwidth="200" color="white" editable="true" text="" disabled="false" multiline="false" id="username"> _focused = function(x) { root.checkusername = true; } </edit> </bevel> </box> <box> <box/> <box shrink="true" text="Password: "/> <bevel thickness="2" vpad="4" depth="down" width="200" id="bevpass" color="white"> <edit minwidth="200" color="white" text="" id="password" disabled="false" editable="true" multiline="false" font="org.xwt.fonts.password12"> _focused = function(x) { root.checkusername = true; } </edit> </bevel> </box><!-- <box> <box/> <box shrink="true" text="Company: "/> <pulldown editable="false" width="200"> _focused = function(x) { root.checkusername = true; } setselect(thisbox, 1); <box text="20/20 Seed Labs Inc."/> <box text="Another Internal Company"/> </pulldown> </box> --> </vbox> <box/> <box vshrink="true" vpad="5" hpad="5"> <box/> <button thickness="2" id="clockin" hpad="5" vpad="2" shrink="true"> _KeyPressed = function(k) { if (k == "i" and xwt.control) click = true; } <box image="org.gimp.tigert.icons.ok" sizetoimage="true"/> <box width="3"/> <box shrink="true" text="Clock In" hpad="3"/> </button> <box width="5"/> <button thickness="2" id="clockout" hpad="5" vpad="2" shrink="true"> _KeyPressed = function(k) { if (k == "o" and xwt.control) click = true; } <box image="org.gimp.tigert.icons.stop" sizetoimage="true"/> <box width="3"/> <box shrink="true" text="Clock Out" hpad="3"/> </button> <box width="5"/> <button thickness="2" id="report" hpad="5" vpad="2" shrink="true"> _KeyPressed = function(k) { if (k == "r" and xwt.control) click = true; } <box image="org.gimp.tigert.icons.ok" sizetoimage="true"/> <box width="3"/> <box shrink="true" text="Report" hpad="3"/> </button> <box width="5"/> <button thickness="2" id="exit" hpad="5" vpad="2" shrink="true"> _KeyPressed = function(k) { if (k == "escape") click = true; } <box image="org.gimp.tigert.icons.cancel" sizetoimage="true"/> <box width="3"/> <box shrink="true" text="Exit" hpad="3"/> </button> </box> </grouper> </box> <statusline id="statusline" text="Waiting for input..." width="350"/> </box> </template></xwt>