diff options
| author | Andreas Brachold <vdr07@deltab.de> | 2009-11-08 16:24:19 +0000 |
|---|---|---|
| committer | Andreas Brachold <vdr07@deltab.de> | 2009-11-08 16:24:19 +0000 |
| commit | 37d9717fb3439bc94ab8abfd684ba91c35c45ec5 (patch) | |
| tree | 42c4a146985c312aae2eef6278a4ea46d98623b7 | |
| parent | fac412765bdf7d2dc96b64621df5d6b2b285efdb (diff) | |
| download | xxv-37d9717fb3439bc94ab8abfd684ba91c35c45ec5.tar.gz xxv-37d9717fb3439bc94ab8abfd684ba91c35c45ec5.tar.bz2 | |
* AJAX: adjust message response parsing {data:"msg",success=true}
* jason: add form based login
| -rw-r--r-- | skins/jason/autotimers.js | 4 | ||||
| -rw-r--r-- | skins/jason/channelspanel.js | 4 | ||||
| -rw-r--r-- | skins/jason/chronicle.js | 2 | ||||
| -rw-r--r-- | skins/jason/form.js | 2 | ||||
| -rw-r--r-- | skins/jason/login.js | 138 | ||||
| -rw-r--r-- | skins/jason/login.tmpl | 43 | ||||
| -rw-r--r-- | skins/jason/movetimers.js | 2 | ||||
| -rw-r--r-- | skins/jason/now.js | 2 | ||||
| -rw-r--r-- | skins/jason/pic/login.png | bin | 0 -> 17821 bytes | |||
| -rw-r--r-- | skins/jason/recordings.js | 8 | ||||
| -rw-r--r-- | skins/jason/remote.js | 2 | ||||
| -rw-r--r-- | skins/jason/timers.js | 4 | ||||
| -rw-r--r-- | skins/jason/users.js | 2 | ||||
| -rw-r--r-- | skins/jason/vdr.js | 2 |
14 files changed, 198 insertions, 17 deletions
diff --git a/skins/jason/autotimers.js b/skins/jason/autotimers.js index 08f3e32..0b3891b 100644 --- a/skins/jason/autotimers.js +++ b/skins/jason/autotimers.js @@ -247,7 +247,7 @@ Ext.extend(Ext.xxv.autotimerGrid, Ext.grid.EditorGridPanel, { var o = eval("("+response.responseText+")");
if(o && o.data && typeof(o.data) == 'string' - && o.param && o.param.state && o.param.state == 'success') { + && o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szDeleteSuccess, o.data); var gsm = this.getSelectionModel(); @@ -348,7 +348,7 @@ Ext.extend(Ext.xxv.autotimerGrid, Ext.grid.EditorGridPanel, { var o = eval("("+response.responseText+")");
if(o && o.data && typeof(o.data) == 'string' - && o.param && o.param.state && o.param.state == 'success') { + && o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szUpgradeSuccess, o.data); diff --git a/skins/jason/channelspanel.js b/skins/jason/channelspanel.js index 4739fcd..a827b39 100644 --- a/skins/jason/channelspanel.js +++ b/skins/jason/channelspanel.js @@ -296,7 +296,7 @@ Ext.extend(Ext.xxv.channelsPanel, Ext.tree.TreePanel, { if(!o || !o.data || typeof(o.data) != 'string') {
throw {message: "Ajax.read: Json message not found"};
} - if(o.param && o.param.state && o.param.state == 'success') { + if(o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szSwitchSuccess, o.data); }else { new Ext.xxv.MessageBox().msgFailure(this.szSwitchFailure, o.data); @@ -341,7 +341,7 @@ Ext.extend(Ext.xxv.channelsPanel, Ext.tree.TreePanel, { if(!o || !o.data || typeof(o.data) != 'string') {
throw {message: "Ajax.read: Json message not found"};
} - if(o.param && o.param.state && o.param.state == 'success') { + if(o.success) { this.root.removeChild(options.node); var record = this.store.getById(options.id); if(record) { diff --git a/skins/jason/chronicle.js b/skins/jason/chronicle.js index e4921af..70a4aaf 100644 --- a/skins/jason/chronicle.js +++ b/skins/jason/chronicle.js @@ -197,7 +197,7 @@ Ext.extend(Ext.xxv.chronicleGrid, Ext.grid.EditorGridPanel, { var o = eval("("+response.responseText+")");
if(o && o.data && typeof(o.data) == 'string' - && o.param && o.param.state && o.param.state == 'success') { + && o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szDeleteSuccess, o.data); var gsm = this.getSelectionModel(); diff --git a/skins/jason/form.js b/skins/jason/form.js index caf2fbc..9462ee2 100644 --- a/skins/jason/form.js +++ b/skins/jason/form.js @@ -316,7 +316,7 @@ Ext.extend(Ext.xxv.Question, Ext.Window, { this.el.unmask(); var o = eval("("+response.responseText+")"); if(o && o.data && typeof(o.data) == 'string' - && o.param && o.param.state && o.param.state == 'success') { + && o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szSuccess, o.data); this.hide(); if(this.parentstore) diff --git a/skins/jason/login.js b/skins/jason/login.js new file mode 100644 index 0000000..2cc3bfb --- /dev/null +++ b/skins/jason/login.js @@ -0,0 +1,138 @@ +Ext.LoginPanel = function() { + + Ext.LoginPanel.superclass.constructor.call(this, { + labelWidth:120 + ,url:'?cmd=login&ajax=json&__action=save' + ,frame:true + ,title:this.szTitle + ,defaultType:'textfield' + ,monitorValid:true + ,items:[ { + xtype:'box' + ,anchor:'' + ,isFormField:false + ,fieldLabel:'' + ,autoEl:{ + tag:'div' + ,style:'margin:0 0 0 0' + ,children:[{ + tag:'img' + ,src:'pic/login.png' + }] + } + },{ + fieldLabel:this.szUser + ,name:'__name' + ,allowBlank:false + },{ + fieldLabel:this.szPassword + ,name:'__password' + ,inputType:'password' + ,allowBlank:false + }] + ,buttons:[{ + text: this.szLogin + ,formBind: true + ,scope: this + ,handler:this.onSubmit + }] + }); +} + +Ext.extend(Ext.LoginPanel, Ext.FormPanel, { + szTitle: 'Please login' + ,szUser: 'Username' + ,szPassword:'Password' + ,szLogin: 'Login' + ,szFailed: 'Login failed!' + ,szWarning: 'Warning!' + ,szUnreachable: 'Authentication server is unreachable : ' + ,onSubmit:function() { + this.getForm().submit({ + method:'POST' + ,waitTitle:Ext.form.BasicForm.prototype.waitTitle + ,waitMsg:Ext.LoadMask.prototype.msg + ,scope: this + ,success:function(){ + var redirect = '?cmd=n'; + window.location = redirect; + } + ,failure:function(form, action){ + if(action.response && action.response.status === 200 ){ + var obj = Ext.util.JSON.decode(action.response.responseText); + Ext.Msg.show({ + title:this.szFailed, + msg: obj.data, + buttons: Ext.Msg.CANCEL, + icon: Ext.MessageBox.ERROR + }); + }else{ + if(action.failureType) { + switch (action.failureType) { + case Ext.form.Action.CLIENT_INVALID: + Ext.Msg.show({ + title:this.szWarning, + msg: Ext.form.Field.prototype.invalidText, + buttons: Ext.Msg.CANCEL, + icon: Ext.MessageBox.ERROR + }); + break; + case Ext.form.Action.CONNECT_FAILURE: + Ext.Msg.show({ + title:this.szWarning, + msg: this.szUnreachable + action.response.statusText, + buttons: Ext.Msg.CANCEL, + icon: Ext.MessageBox.ERROR + }); + break; + case Ext.form.Action.SERVER_INVALID: + Ext.Msg.show({ + title:this.szWarning, + msg: action.result.msg, + buttons: Ext.Msg.CANCEL, + icon: Ext.MessageBox.ERROR + }); + break; + } + } else { + Ext.Msg.show({ + title:this.szWarning, + msg: this.szUnreachable + action.response.statusText, + buttons: Ext.Msg.CANCEL, + icon: Ext.MessageBox.ERROR + }); + } + } + this.getForm().reset(); + } + }); + } +}); + +Ext.onReady(function(){ + Ext.QuickTips.init(); + + var win = new Ext.Window({ + layout:'fit', + width:330, + height:220, + closable: false, + resizable: false, + plain: true, + border: false, + items: [new Ext.LoginPanel()] + }); + + win.show(); + + setTimeout(function(){ + var l = Ext.get('loading'); + if(l) { + l.remove(); + } + var m = Ext.get('loading-mask'); + if(m) { + m.fadeOut({remove:true}); + } + }, 250); +}); diff --git a/skins/jason/login.tmpl b/skins/jason/login.tmpl new file mode 100644 index 0000000..118ba06 --- /dev/null +++ b/skins/jason/login.tmpl @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="<?% charset %?>"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<?% verbose = 0 %?> +<?% compressed = 0 %?> +<?% lang = locale.split('_') %?> +<html xmlns="http://www.w3.org/1999/xhtml" <?% IF lang.1 %?>xml:lang="<?% lang.0 %?>" lang="<?% lang.0 %?>"<?% ELSE %?>xml:lang="en" lang="en"<?% END %?>> +<head> + <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" /> + <link rel="stylesheet" type="text/css" href="extjs/resources/css/xtheme-default.css" id="theme" /> + <link rel="stylesheet" type="text/css" href="jason.css" /> + <meta name="generator" content="XXV System - Version: <?% version %?>" /> + <meta http-equiv="content-type" content="text/html; charset=<?% charset %?>" /> + <meta http-equiv="cache-control" content="cache" /> + <meta http-equiv="pragma" content="cache" /> + <meta name="robots" content="noindex,noarchive,nofollow" /> + <title>JaSON</title> +</head> +<body scroll="no"> +<?% IF verbose == 0 %?> +<div id="loading-mask"> +<div class="ext-el-mask-msg" id="loading"> +<div class="loading-indicator"><img src="extjs/resources/images/default/shared/blue-loading.gif" width="32" height="32" style="margin-right:8px;" align="absmiddle"/> +<span id="loading-text"> +<?% gettext("Please wait ...") %?> +</span> +</div> +</div> +</div> + +<?% END %?> +<?% scripts = [ 'extjs/adapter/ext/ext-base.js', 'extjs/ext-all.js','login.js' ] %?> +<?% IF verbose != 0;scripts.1 = "ext-3.0.0/ext-all-debug.js";END %?> +<?% FOREACH script = scripts %?> +<script type="text/javascript" src="<?% script %?>"></script> +<?% END %?> +<?% IF lang.1 %?> +<!-- Use : <?% lang.0 %?> --> +<script type="text/javascript" src="extjs/locale/ext-lang-<?% lang.0 %?>.js"></script> +<script type="text/javascript" src="locale/login-<?% lang.0 %?>.js"></script> +<?% END %?> +</body> +</html> diff --git a/skins/jason/movetimers.js b/skins/jason/movetimers.js index d9fed61..2a90cd8 100644 --- a/skins/jason/movetimers.js +++ b/skins/jason/movetimers.js @@ -176,7 +176,7 @@ Ext.extend(Ext.xxv.movetimersGrid, Ext.grid.EditorGridPanel, { var o = eval("("+response.responseText+")");
if(o && o.data && typeof(o.data) == 'string' - && o.param && o.param.state && o.param.state == 'success') { + && o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szDeleteSuccess, o.data); var gsm = this.getSelectionModel(); diff --git a/skins/jason/now.js b/skins/jason/now.js index 2f19e03..d856812 100644 --- a/skins/jason/now.js +++ b/skins/jason/now.js @@ -335,7 +335,7 @@ Ext.extend(Ext.xxv.NowGrid, Ext.grid.GridPanel, { if(!o || !o.data || typeof(o.data) != 'string') {
throw {message: "Ajax.read: Json message not found"};
} - if(o.param && o.param.state && o.param.state == 'success') { + if(o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szRecordSuccess, o.data); //this.timerstore.reload(); }else { diff --git a/skins/jason/pic/login.png b/skins/jason/pic/login.png Binary files differnew file mode 100644 index 0000000..1d3bbb3 --- /dev/null +++ b/skins/jason/pic/login.png diff --git a/skins/jason/recordings.js b/skins/jason/recordings.js index 4ff1dba..86df45f 100644 --- a/skins/jason/recordings.js +++ b/skins/jason/recordings.js @@ -814,7 +814,7 @@ Ext.extend(Ext.xxv.recordingsDataView, Ext.DataView, { var o = eval("("+response.responseText+")");
if(o && o.data && typeof(o.data) == 'string' - && o.param && o.param.state && o.param.state == 'success') { + && o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szCutSuccess, o.data); @@ -876,7 +876,7 @@ Ext.extend(Ext.xxv.recordingsDataView, Ext.DataView, { var o = eval("("+response.responseText+")");
if(o && o.data && typeof(o.data) == 'string' - && o.param && o.param.state && o.param.state == 'success') { + && o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szDeleteSuccess, o.data); @@ -963,7 +963,7 @@ Ext.extend(Ext.xxv.recordingsDataView, Ext.DataView, { if(!o || !o.data || typeof(o.data) != 'string') {
throw {message: "Ajax.read: Json message not found"};
} - if(o.param && o.param.state && o.param.state == 'success') { + if(o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szPlayBackSuccess, o.data); }else { new Ext.xxv.MessageBox().msgFailure(this.szPlayBackFailure, o.data); @@ -1032,7 +1032,7 @@ Ext.extend(Ext.xxv.recordingsDataView, Ext.DataView, { var o = eval("("+response.responseText+")");
if(o && o.data && typeof(o.data) == 'string' - && o.param && o.param.state && o.param.state == 'success') { + && o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szUpgradeSuccess, o.data); this.reload(); diff --git a/skins/jason/remote.js b/skins/jason/remote.js index 559be40..75c3f8a 100644 --- a/skins/jason/remote.js +++ b/skins/jason/remote.js @@ -131,7 +131,7 @@ Ext.extend(Ext.xxv.RemoteWindow, Ext.Window, { if(!o || !o.data || typeof(o.data) != 'string') {
throw {message: "Ajax.read: Json message not found"};
} - if(o.param && o.param.state && o.param.state == 'success') { + if(o.success) { //new Ext.xxv.MessageBox().msgSuccess(this.szRemoteSuccess, o.data); }else { new Ext.xxv.MessageBox().msgFailure(this.szRemoteFailure, o.data); diff --git a/skins/jason/timers.js b/skins/jason/timers.js index 14f164b..1f9410b 100644 --- a/skins/jason/timers.js +++ b/skins/jason/timers.js @@ -337,7 +337,7 @@ Ext.extend(Ext.xxv.timerGrid, Ext.grid.GridPanel, { // Ext.grid.EditorGridPanel var o = eval("("+response.responseText+")");
if(o && o.data && typeof(o.data) == 'object' - && o.param && o.param.state && o.param.state == 'success') { + && o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szToggleSuccess,''); //{ "data" : [ [ ID, ON, RUN, CONFLICT ], .... ] } for (var i = 0; i < o.data.length; i++) { @@ -408,7 +408,7 @@ Ext.extend(Ext.xxv.timerGrid, Ext.grid.GridPanel, { // Ext.grid.EditorGridPanel var o = eval("("+response.responseText+")");
if(o && o.data && typeof(o.data) == 'string' - && o.param && o.param.state && o.param.state == 'success') { + && o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szDeleteSuccess, o.data); var gsm = this.getSelectionModel(); diff --git a/skins/jason/users.js b/skins/jason/users.js index 06569a2..b85d954 100644 --- a/skins/jason/users.js +++ b/skins/jason/users.js @@ -181,7 +181,7 @@ Ext.extend(Ext.xxv.usersGrid, Ext.grid.EditorGridPanel, { var o = eval("("+response.responseText+")");
if(o && o.data && typeof(o.data) == 'string' - && o.param && o.param.state && o.param.state == 'success') { + && o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szDeleteSuccess, o.data); var gsm = this.getSelectionModel(); diff --git a/skins/jason/vdr.js b/skins/jason/vdr.js index 38fa447..596d6da 100644 --- a/skins/jason/vdr.js +++ b/skins/jason/vdr.js @@ -215,7 +215,7 @@ Ext.extend(Ext.xxv.vdrGrid, Ext.grid.EditorGridPanel, { var o = eval("("+response.responseText+")");
if(o && o.data && typeof(o.data) == 'string' - && o.param && o.param.state && o.param.state == 'success') { + && o.success) { new Ext.xxv.MessageBox().msgSuccess(this.szDeleteSuccess, o.data); var gsm = this.getSelectionModel(); |
