diff options
| author | Andreas Brachold <vdr07@deltab.de> | 2010-05-08 16:12:55 +0000 |
|---|---|---|
| committer | Andreas Brachold <vdr07@deltab.de> | 2010-05-08 16:12:55 +0000 |
| commit | de361f4a7bf6bd32ffe463c3bcf4dd142b791aff (patch) | |
| tree | 894e98fac3a21a0e5bb6653d74bab1c03f7a7c12 | |
| parent | 294aa2c6010daaea9c2a00cb826a7c7c7d0c90a2 (diff) | |
| download | xxv-de361f4a7bf6bd32ffe463c3bcf4dd142b791aff.tar.gz xxv-de361f4a7bf6bd32ffe463c3bcf4dd142b791aff.tar.bz2 | |
update localisation detection(Bug #17082)
| -rw-r--r-- | skins/jason/form.js | 528 | ||||
| -rw-r--r-- | skins/jason/index.tmpl | 8 |
2 files changed, 270 insertions, 266 deletions
diff --git a/skins/jason/form.js b/skins/jason/form.js index 5155ec3..2b3ab14 100644 --- a/skins/jason/form.js +++ b/skins/jason/form.js @@ -2,42 +2,42 @@ * jason - Javascript based skin for xxv
* Copyright(c) 2008-2009, anbr
*
- * http://xxv.berlios.de/ - * - * $Id$ + * http://xxv.berlios.de/
+ *
+ * $Id$
*/
- -Ext.xxv.Question = function(item,parentstore) { - - if(XXV.help.cmdDisabled(item.cmd)) { - new Ext.xxv.MessageBox().msgFailure(this.szCommandDeny, item.cmd); - return; - } - - this.parentstore = parentstore; - this.item = item; - - this.store = new Ext.data.Store({ +
+Ext.xxv.Question = function(item,parentstore) {
+
+ if(XXV.help.cmdDisabled(item.cmd)) {
+ new Ext.xxv.MessageBox().msgFailure(this.szCommandDeny, item.cmd);
+ return;
+ }
+
+ this.parentstore = parentstore;
+ this.item = item;
+
+ this.store = new Ext.data.Store({
reader: new Ext.xxv.jsonReader({
- fields: [ - {name: 'id',type: 'string'}, - {name: 'fieldLabel', type: 'string'}, + fields: [
+ {name: 'id',type: 'string'},
+ {name: 'fieldLabel', type: 'string'},
{name: 'type', type: 'string'},
- {name: 'valuedef', type: 'string'}, - {name: 'valuereq', type: 'boolean'}, - {name: 'readonly', type: 'boolean'}, - {name: 'choices'} - ] - }), + {name: 'valuedef', type: 'string'},
+ {name: 'valuereq', type: 'boolean'},
+ {name: 'readonly', type: 'boolean'},
+ {name: 'choices'}
+ ]
+ }),
proxy : new Ext.data.HttpProxy({
url: XXV.help.cmdAJAX(item.cmd,{ data:item.id })
- ,method: 'GET' + ,method: 'GET'
// ,params: { data:item.id }
- }) + })
});
- - Ext.xxv.Question.superclass.constructor.call(this, { - stateful: false +
+ Ext.xxv.Question.superclass.constructor.call(this, {
+ stateful: false
,title: item.title
,width: 600
//,height:500
@@ -45,288 +45,292 @@ Ext.xxv.Question = function(item,parentstore) { ,minWidth: 300
,minHeight: 100
,layout: 'anchor'
- ,plain:true + ,plain:true
//,bodyStyle:'padding:5px;'
,buttonAlign:'right'
,buttons: [{
text: this.szClose
,handler: this.destroy
- ,scope: this - },{ + ,scope: this
+ },{
text: this.szApply
,handler: this.onApply
- ,scope: this - }] - }); - - this.store.load({ scope: this - ,callback: this.onLoad - ,failure: this.onLoadException - }); -}; - -Ext.extend(Ext.xxv.Question, Ext.Window, { - - szClose : "Close" - ,szApply : "Apply" - ,szCommandDeny : "Command '{0}' not allowed!" - ,szLoadException : "Couldn't get data!\r\n{0}" - ,szFailure : "Couldn't save data!\r\n{0}" - ,szSuccess : "Data saved successful.\r\n{0}" - ,szComboEmpty : "Select ..." - - ,onLoadException : function( scope, o, arg, e) { - new Ext.xxv.MessageBox().msgFailure(this.szLoadException, e.message); - } - ,onLoad : function(r,options,success){ - - this.form = new Ext.form.FormPanel({ + ,scope: this
+ }]
+ });
+
+ this.store.load({ scope: this
+ ,callback: this.onLoad
+ ,failure: this.onLoadException
+ });
+};
+
+Ext.extend(Ext.xxv.Question, Ext.Window, {
+
+ szClose : "Close"
+ ,szApply : "Apply"
+ ,szCommandDeny : "Command '{0}' not allowed!"
+ ,szLoadException : "Couldn't get data!\r\n{0}"
+ ,szFailure : "Couldn't save data!\r\n{0}"
+ ,szSuccess : "Data saved successful.\r\n{0}"
+ ,szComboEmpty : "Select ..."
+
+ ,onLoadException : function( scope, o, arg, e) {
+ new Ext.xxv.MessageBox().msgFailure(this.szLoadException, e.message);
+ }
+ ,onLoad : function(r,options,success){
+
+ this.form = new Ext.form.FormPanel({
id: 'form-panel'
- ,stateful: false + ,stateful: false
,baseCls: 'x-plain'
,labelWidth: 200
- ,defaultType: 'textfield' - ,forceLayout: true - }); - - for(var i = 0, len = r.length; i < len; i++){ - var config = { + ,defaultType: 'textfield'
+ ,forceLayout: true
+ });
+
+ for(var i = 0, len = r.length; i < len; i++){
+ var config = {
name: r[i].data.id
,fieldLabel: Ext.util.Format.ellipsis(r[i].data.fieldLabel,30)
,value: r[i].data.valuedef
- ,anchor: '100%' // anchor width by percentage - ,stateful: false - ,tabIndex: i + 1 - }; + ,anchor: '100%' // anchor width by percentage
+ ,stateful: false
+ ,tabIndex: i + 1
+ };
if(r[i].data.valuereq){
config.allowBlank = false;
- } + }
switch(r[i].data.type){
- case 'hidden': - config.autoShow = false; - config.xtype = 'hidden'; - break; - case 'confirm': - config.name = null; - config.xtype = 'fieldset'; - config.hideLabel = true; - config.fieldLabel = null; - config.hideBorders = true; - config.autoHeight = true; - config.labelWidth = 1; - config.baseCls = ''; - config.style = 'border: 0px none;'; - config.items = [{ - xtype: 'checkbox' + case 'hidden':
+ config.autoShow = false;
+ config.xtype = 'hidden';
+ break;
+ case 'confirm':
+ config.name = null;
+ config.xtype = 'fieldset';
+ config.hideLabel = true;
+ config.fieldLabel = null;
+ config.hideBorders = true;
+ config.autoHeight = true;
+ config.labelWidth = 1;
+ config.baseCls = '';
+ config.style = 'border: 0px none;';
+ config.items = [{
+ xtype: 'checkbox'
,labelSeparator: ''
- ,boxLabel: Ext.util.Format.ellipsis(r[i].data.fieldLabel,80) - ,checked: r[i].data.valuedef == 'y' ? true : false + ,boxLabel: Ext.util.Format.ellipsis(r[i].data.fieldLabel,80)
+ ,checked: r[i].data.valuedef == 'y' ? true : false
,name: r[i].data.id
- } - ]; - break; - case 'checkbox': + }
+ ];
+ break;
+ case 'checkbox':
config.xtype = 'checkboxgroup';
- config.items = []; - for(var f = 0, flen = r[i].data.choices.length; f < flen; f++){ + config.items = [];
+ for(var f = 0, flen = r[i].data.choices.length; f < flen; f++){
config.items.push({
- name: r[i].data.choices[f], - boxLabel: Ext.util.Format.ellipsis(r[i].data.choices[f],15), + name: r[i].data.choices[f],
+ boxLabel: Ext.util.Format.ellipsis(r[i].data.choices[f],15),
checked: (config.value.match(r[i].data.choices[f]) ? true : false)
- }); + });
}
- break; - case 'password': - config.xtype = 'textfield'; - config.allowBlank = true; + break;
+ case 'password':
+ config.xtype = 'textfield';
+ config.allowBlank = true;
config.inputType = 'password';
- break; - case 'multilist': - config.xtype = 'multiselect'; + break;
+ case 'multilist':
+ config.xtype = 'multiselect';
config.allowBlank = true;
- - if(r[i].data.choices.length > 0) { - - var fields; - if(r[i].data.choices[0].length >= 3) { - fields = [ {name: 'display'} ,{name: 'value'}, {name: 'groups'} ]; - - var cls = 'ux-mselect'; - var tpl = '<tpl for=".">'; - tpl+= '<tpl if="this.isNewGroup(groups)"><div class="x-combo-list-hd">{groups}</div></tpl>'; - tpl+= '<div class="' + cls +'-item'; - if(Ext.isIE || Ext.isIE7) - tpl+='" unselectable=on'; - else - tpl+=' x-unselectable"'; - - tpl+='>{display}</div></tpl>'; - - config.tpl = new Ext.XTemplate(tpl, { - isNewGroup: function(groups){ - if(groups && (!this.lastgroups || groups != this.lastgroups)) - { this.lastgroups = groups; return 1; } - return 0; - } - }); - } else { - fields = [ {name: 'display'} ,{name: 'value'} ]; - config.tpl = null; - } +
+ if(r[i].data.choices.length > 0) {
+
+ var fields;
+ if(r[i].data.choices[0].length >= 3) {
+ fields = [ {name: 'display'} ,{name: 'value'}, {name: 'groups'} ];
+
+ var cls = 'ux-mselect';
+ var tpl = '<tpl for=".">';
+ tpl+= '<tpl if="this.isNewGroup(groups)"><div class="x-combo-list-hd">{groups}</div></tpl>';
+ tpl+= '<div class="' + cls +'-item';
+ if(Ext.isIE || Ext.isIE7)
+ tpl+='" unselectable=on';
+ else
+ tpl+=' x-unselectable"';
+
+ tpl+='>{display}</div></tpl>';
+
+ config.tpl = new Ext.XTemplate(tpl, {
+ isNewGroup: function(groups){
+ if(groups && (!this.lastgroups || groups != this.lastgroups))
+ { this.lastgroups = groups; return 1; }
+ return 0;
+ }
+ });
+ } else {
+ fields = [ {name: 'display'} ,{name: 'value'} ];
+ config.tpl = null;
+ }
config.store = new Ext.data.Store({
reader: new Ext.data.ArrayReader({}, fields),
data: r[i].data.choices
- }); - } - config.valueField = 'value'; - config.displayField = 'display'; - config.width = '100%'; - if(len == 1) { - config.hideLabel = true; - config.height = 430; - if(!this.title) { - this.title = config.fieldLabel; - } - } else { - config.height = 120; - } - config.minLength = 0; - config.maxLength = r[i].data.choices.length; - break; - case 'list': - config.xtype = 'combo'; - if(r[i].data.choices.length > 0) { - var fields; - if(r[i].data.choices[0].length >= 3) { - fields = [ {name: 'display'} ,{name: 'value'}, {name: 'groups'} ]; - config.tpl = new Ext.XTemplate( - '<tpl for=".">', - '<tpl if="this.isNewGroup(groups)"><div class="x-combo-list-hd">{groups}</div></tpl>', + });
+ }
+ config.valueField = 'value';
+ config.displayField = 'display';
+ config.width = '100%';
+ if(len == 1) {
+ config.hideLabel = true;
+ config.height = 430;
+ if(!this.title) {
+ this.title = config.fieldLabel;
+ }
+ } else {
+ config.height = 120;
+ }
+ config.minLength = 0;
+ config.maxLength = r[i].data.choices.length;
+ break;
+ case 'list':
+ config.xtype = 'combo';
+ if(r[i].data.choices.length > 0) {
+ var fields;
+ if(r[i].data.choices[0].length >= 3) {
+ fields = [ {name: 'display'} ,{name: 'value'}, {name: 'groups'} ];
+ config.tpl = new Ext.XTemplate(
+ '<tpl for=".">',
+ '<tpl if="this.isNewGroup(groups)"><div class="x-combo-list-hd">{groups}</div></tpl>',
'<div class="x-combo-list-item">{display}</div>',
- '</tpl>', { - isNewGroup: function(groups){ - if(groups && (!this.lastgroups || groups != this.lastgroups)) { this.lastgroups = groups; return 1; } - return 0; - } - }); - - } else { - fields = [ {name: 'display'} ,{name: 'value'} ]; - config.tpl = '<tpl for="."><div class="x-combo-list-item">{display}</div></tpl>'; - - } + '</tpl>', {
+ isNewGroup: function(groups){
+ if(groups && (!this.lastgroups || groups != this.lastgroups)) { this.lastgroups = groups; return 1; }
+ return 0;
+ }
+ });
+
+ } else {
+ fields = [ {name: 'display'} ,{name: 'value'} ];
+ config.tpl = '<tpl for="."><div class="x-combo-list-item">{display}</div></tpl>';
+
+ }
config.store = new Ext.data.Store({
reader: new Ext.data.ArrayReader({}, fields),
data: r[i].data.choices
- }); - - config.displayField = 'display'; - config.valueField = 'value'; - } - - config.triggerAction = 'all'; + });
+
+ config.displayField = 'display';
+ config.valueField = 'value';
+ }
+
+ config.triggerAction = 'all';
config.lazyRender = true;
- config.listClass = 'x-combo-list-small'; - config.mode = 'local'; - config.emptyText = this.szComboEmpty; - config.selectOnFocus = true; - config.editable = false; - + config.listClass = 'x-combo-list-small';
+ config.mode = 'local';
+ config.emptyText = this.szComboEmpty;
+ config.selectOnFocus = true;
+ config.editable = false;
+
break;
- case 'date': - var today = new Date(); - today.clearTime(); - config.xtype = 'datefield'; - config.minValue = today; - break; - case 'time': - config.xtype = 'timefield'; - config.increment = 15; - break; - case 'integer': - config.xtype = 'numberfield'; - config.allowDecimals = false; + case 'date':
+ var today = new Date();
+ today.clearTime();
+ config.xtype = 'datefield';
+ config.minValue = today;
+ break;
+ case 'time':
+ config.xtype = 'timefield';
+ config.increment = 15;
+ config.format = 'H:i';
+ break;
+ case 'integer':
+ config.xtype = 'numberfield';
+ config.allowDecimals = false;
break;
- case 'textfield': - config.xtype = 'textarea'; - break; - } + case 'textfield':
+ config.xtype = 'textarea';
+ break;
+ }
if(r[i].data.readonly){
- config.hideLabel = true; - config.height = 200; // anchor width by percentage and height by raw adjustment + config.hideLabel = true;
+ config.height = 200; // anchor width by percentage and height by raw adjustment
config.readOnly = true;
- } - this.form.add(config); - } - if(i) { - this.add(this.form); - this.show(); - } else { - new Ext.xxv.MessageBox().msgFailure(this.szLoadException, ""); - } - - }, - + }
+ this.form.add(config);
+ }
+ if(i) {
+ this.add(this.form);
+ this.show();
+ } else {
+ new Ext.xxv.MessageBox().msgFailure(this.szLoadException, "");
+ }
+
+ },
+
onApply: function() {
- this.el.mask(Ext.LoadMask.prototype.msg, 'x-mask-loading'); + this.el.mask(Ext.LoadMask.prototype.msg, 'x-mask-loading');
var params = {data:this.item.id,ajax:'json','__action':'save'};
- for(var i = 0, len = this.store.getCount(); i < len; i++){ - var record = this.store.getAt(i); + for(var i = 0, len = this.store.getCount(); i < len; i++){
+ var record = this.store.getAt(i);
if(record.data.readonly == 0) {
- var field = this.form.getForm().findField(record.data.id); - if(field) - switch(record.data.type){ - case 'confirm': - params['__'+record.data.id] = field.checked ? 'y' : 'n'; - break; - case 'checkbox': - var values = field.getValue(); - var boxes = []; - for(var f = 0, flen = values.length; f < flen; f++){ - boxes.push(values[f].name); - } - params['__'+record.data.id] = boxes.join(','); - break; - case 'date': - params['__'+record.data.id] = field.getRawValue(); - break; - default: - params['__'+record.data.id] = field.getValue(); - break; - } - } - } - Ext.Ajax.request({ + var field = this.form.getForm().findField(record.data.id);
+ if(field)
+ switch(record.data.type){
+ case 'confirm':
+ params['__'+record.data.id] = field.checked ? 'y' : 'n';
+ break;
+ case 'checkbox':
+ var values = field.getValue();
+ var boxes = [];
+ for(var f = 0, flen = values.length; f < flen; f++){
+ boxes.push(values[f].name);
+ }
+ params['__'+record.data.id] = boxes.join(',');
+ break;
+ case 'time':
+ params['__'+record.data.id] = field.getValue();
+ break;
+ case 'date':
+ params['__'+record.data.id] = field.getValue().dateFormat('Y-m-d');
+ break;
+ default:
+ params['__'+record.data.id] = field.getValue();
+ break;
+ }
+ }
+ }
+ Ext.Ajax.request({
url:'?' + Ext.urlEncode({cmd:this.item.cmd})
- ,method: 'POST' + ,method: 'POST'
,params: params
,success: this.onSuccess
,failure: this.onFailure
- ,scope: this + ,scope: this
});
- }, - + },
+
onFailure : function(response,options){
this.el.unmask();
- new Ext.xxv.MessageBox().msgFailure(this.szFailure,response.statusText); + new Ext.xxv.MessageBox().msgFailure(this.szFailure,response.statusText);
},
onSuccess : function(response, options){
- this.el.unmask(); - var o = eval("("+response.responseText+")"); - if(o && o.data && typeof(o.data) == 'string' - && o.success) { - new Ext.xxv.MessageBox().msgSuccess(this.szSuccess, o.data); - this.hide(); - if(this.parentstore) - this.parentstore.reload(); + this.el.unmask();
+ var o = eval("("+response.responseText+")");
+ if(o && o.data && typeof(o.data) == 'string'
+ && o.success) {
+ new Ext.xxv.MessageBox().msgSuccess(this.szSuccess, o.data);
+ this.hide();
+ if(this.parentstore)
+ this.parentstore.reload();
} else {
- var msg = ''; - if(o && o.data && typeof(o.data) == 'string') { - msg = o.data; - } - new Ext.xxv.MessageBox().msgFailure(this.szFailure, msg); - } + var msg = '';
+ if(o && o.data && typeof(o.data) == 'string') {
+ msg = o.data;
+ }
+ new Ext.xxv.MessageBox().msgFailure(this.szFailure, msg);
+ }
}
-}); +});
diff --git a/skins/jason/index.tmpl b/skins/jason/index.tmpl index add803d..87b2b10 100644 --- a/skins/jason/index.tmpl +++ b/skins/jason/index.tmpl @@ -1,6 +1,6 @@ <?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">
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?% verbose = 0 %?> <?% compressed = 0 %?> <?% lang = locale.split('_') %?> @@ -68,9 +68,9 @@ <script type="text/javascript" src="locale/lang-<?% lang.0 %?>.js"></script> <?% END %?> <?% # Fields required for history management %?> -<form id="history-form" class="x-hidden">
- <input type="hidden" id="x-history-field" />
- <iframe id="x-history-frame"></iframe>
+<form id="history-form" class="x-hidden"> + <input type="hidden" id="x-history-field" /> + <iframe id="x-history-frame"></iframe> </form> <?% # Template used for EPG Items %?> <div id="preview-tpl" style="display:none;"> |
