From 74e89e680e01dcab4e4dedb622c7a10911067b3b Mon Sep 17 00:00:00 2001 From: Rolux Date: Mon, 1 Feb 2010 11:41:35 +0530 Subject: [PATCH] requests, errors, dialogs --- build/css/ox.ui.classic.css | 12 ++---------- build/css/ox.ui.css | 2 -- build/css/ox.ui.modern.css | 9 ++------- build/js/ox.ui.js | 33 ++++++++++++++++++--------------- demos/test/app.js | 2 ++ 5 files changed, 24 insertions(+), 34 deletions(-) diff --git a/build/css/ox.ui.classic.css b/build/css/ox.ui.classic.css index d6f0917..8dd5b35 100644 --- a/build/css/ox.ui.classic.css +++ b/build/css/ox.ui.classic.css @@ -26,22 +26,14 @@ Dialog .OxThemeClassic .OxDialog { background: rgba(224, 224, 224, 0.96); - //border: 1px solid rgba(128, 128, 128, 0.5); + -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5); + -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5); } .OxThemeClassic .OxDialog .OxTitle { color: rgb(48, 48, 48); } -.OxThemeClassic .OxDialog > .OxTitleBar { - //border-color: rgb(192, 192, 192); - //background: rgba(208, 208, 208, 0.96); -} - -.OxThemeClassic .OxDialog > .OxButtonsBar { - //background: rgba(192, 192, 192, 0.96); -} - /* ================================================================================ Forms diff --git a/build/css/ox.ui.css b/build/css/ox.ui.css index 7181464..49aee72 100644 --- a/build/css/ox.ui.css +++ b/build/css/ox.ui.css @@ -67,8 +67,6 @@ Dialog position: absolute; -moz-border-radius: 8px; -webkit-border-radius: 8px; - -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5); - -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5); } .OxDialog > .OxTitleBar { diff --git a/build/css/ox.ui.modern.css b/build/css/ox.ui.modern.css index 85987c9..0f7324d 100644 --- a/build/css/ox.ui.modern.css +++ b/build/css/ox.ui.modern.css @@ -26,13 +26,8 @@ Dialog .OxThemeModern .OxDialog { background: rgba(48, 48, 48, 0.96); -} -.OxThemeModern .OxDialog > .OxTitleBar { - //background: rgba(32, 32, 32, 0.96); -} - -.OxThemeModern .OxDialog > .OxButtonsBar { - //background: rgba(32, 32, 32, 0.96); + -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 1); + -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 1); } /* diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index d03099d..56a4e67 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -477,16 +477,19 @@ requires function error(request, status, error) { var data; - Ox.print("error", request, status, error); - try { - data = JSON.parse(request.responseText); - } catch (error) { - data = { - status: { - code: request.status, - text: request.statusText - } - }; + if (arguments.length == 1) { + data = arguments[0] + } else { + try { + data = JSON.parse(request.responseText); + } catch (err) { + data = { + status: { + code: request.status, + text: request.statusText + } + }; + } } if (data.status.code < 500) { callback(data); @@ -516,13 +519,13 @@ requires }) .append("Sorry, we have encountered an application error while handling your request. To help us find out what went wrong, you may want to report this error to an administrator. Otherwise, please try again later.") .open(); + // fixme: change this to Send / Don't Send Ox.print({ request: request, status: status, error: error }); } - pending[options.id] = false; } @@ -530,14 +533,15 @@ requires pending[options.id] = false; try { data = JSON.parse(data); - } catch(error) { - data = { + } catch (err) { + error({ status: { code: 500, text: "Internal Server Error" }, data: {} - }; + }); + return; } cache[req] = { data: data, @@ -1082,7 +1086,6 @@ requires .appendTo(that); that.$buttons = []; $.each(options.buttons, function(i, button) { - console.log(button) that.$buttons[i] = new Ox.Button({ size: "medium", value: button.value diff --git a/demos/test/app.js b/demos/test/app.js index e764618..a65a07a 100644 --- a/demos/test/app.js +++ b/demos/test/app.js @@ -25,6 +25,7 @@ $(function() { }); app.request("error"); //app.request("hello"); + /* app.request("login", {"username": "test", "password": "test"}, function(result) { Ox.print(result); if (result.status.code == 200) { @@ -39,4 +40,5 @@ $(function() { } else if (result.status.code == 500) { } }); + */ });