Initial Commit Update Telerik
This commit is contained in:
163
LPWeb20/js/debug/usr/qb/Demo.js
Normal file
163
LPWeb20/js/debug/usr/qb/Demo.js
Normal file
@@ -0,0 +1,163 @@
|
||||
var Demo = function() {
|
||||
this.syntaxes = [
|
||||
["ANSI SQL-2003", false, []],
|
||||
["ANSI SQL-92", false, []],
|
||||
["ANSI SQL-89", false, []],
|
||||
["Firebird", false, [
|
||||
"Firebird 2.0",
|
||||
"Firebird 1.5",
|
||||
"Firebird 1.0"
|
||||
]],
|
||||
["IBM DB2", false, []],
|
||||
["IBM Informix", false, [
|
||||
"Informix 10",
|
||||
"Informix 9",
|
||||
"Informix 8"
|
||||
]],
|
||||
["Microsoft Access", false, [
|
||||
"MS Jet 4",
|
||||
"MS Jet 3"
|
||||
]],
|
||||
["Microsoft SQL Server", true, [
|
||||
"Auto",
|
||||
"SQL Server 2005",
|
||||
"SQL Server 2000",
|
||||
"SQL Server 7"
|
||||
]],
|
||||
["MySQL", false, [
|
||||
"5.0",
|
||||
"4.0",
|
||||
"3.0"
|
||||
]],
|
||||
["Oracle", false, [
|
||||
"Oracle 10",
|
||||
"Oracle 9",
|
||||
"Oracle 8",
|
||||
"Oracle 7"
|
||||
]],
|
||||
["PostgreSQL", false, []],
|
||||
["SQLite", false, []],
|
||||
["Sybase", false, [
|
||||
"ASE",
|
||||
"SQL Anywhere"
|
||||
]],
|
||||
["VistaDB", false, []],
|
||||
["Universal", false, []]
|
||||
];
|
||||
|
||||
var me = this;
|
||||
|
||||
this.toolbarSytnaxOnChange = function(event) {
|
||||
me.toolbarSytnaxVersionUpdate($(event.target));
|
||||
me.toolbarSytnaxChanged();
|
||||
};
|
||||
|
||||
this.getQueryStatistics = function(event) {
|
||||
me.QueryStatisticsDialog.html(QB.Web.Dto.Localizer.Strings.Loading);
|
||||
me.QueryStatisticsDialog.dialog('open');
|
||||
var command = {
|
||||
action:'QueryStatistics',
|
||||
data : {}
|
||||
};
|
||||
me.sendRequest(command);
|
||||
};
|
||||
|
||||
|
||||
this.processRequest = function (data) {
|
||||
if (data.Action == "update") {
|
||||
QB.Web.Application.fullUpdate();
|
||||
} else if (data.Action == "QueryStatistics") {
|
||||
me.QueryStatisticsDialog.html(data.Data);
|
||||
me.QueryStatisticsDialog.dialog('open');
|
||||
}
|
||||
};
|
||||
|
||||
this.sendRequest = function (command) {
|
||||
var data = $.toJSON(command);
|
||||
|
||||
$.ajax({
|
||||
url: 'handlers/DemoHandler.axd',
|
||||
type:'POST',
|
||||
dataType : "json",
|
||||
contentType : 'application/json',
|
||||
data: data,
|
||||
success: function (data) {
|
||||
me.processRequest(data);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.toolbarSytnaxChanged = function () {
|
||||
var $select = $("#qb-ui-syntax-selector-server");
|
||||
var $selectVersion = $("#qb-ui-syntax-selector-version");
|
||||
var syntax = $select.valEx();
|
||||
var syntaxVersion = $selectVersion.valEx();
|
||||
var command = {
|
||||
action:'ChangeSyntax',
|
||||
data : {
|
||||
Syntax : syntax,
|
||||
SyntaxVersion: syntaxVersion
|
||||
}
|
||||
};
|
||||
me.sendRequest(command);
|
||||
};
|
||||
|
||||
this.toolbarSytnaxVersionUpdate = function($select) {
|
||||
var $selectVersion = $("#qb-ui-syntax-selector-version");
|
||||
var val = $select.valEx();
|
||||
var options = [];
|
||||
for (var i = 0; i < this.syntaxes.length; i++) {
|
||||
var item = this.syntaxes[i];
|
||||
if (item[0] == val) {
|
||||
for (var j = 0; j < item[2].length; j++) {
|
||||
options.push('<option value="' + item[2][j] + '">' + item[2][j] + '</option>');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (options.length == 0) {
|
||||
options.push('<option value="">Auto</option>');
|
||||
$selectVersion.attr('disabled', 'disabled');
|
||||
} else {
|
||||
$selectVersion.removeAttr('disabled');
|
||||
}
|
||||
$selectVersion.html(options.join(''));
|
||||
};
|
||||
|
||||
this.init = function() {
|
||||
var me = this;
|
||||
var options = new Array(this.syntaxes.length);
|
||||
for (var i = 0; i < this.syntaxes.length; i++) {
|
||||
var item = this.syntaxes[i];
|
||||
var syntaxName = item[0];
|
||||
var syntaxSelected = item[1];
|
||||
options[i] = '<option' + (syntaxSelected ? ' selected' : '') + ' value="' + syntaxName + '">' + syntaxName + '</option>';
|
||||
}
|
||||
|
||||
var $select = $("#qb-ui-syntax-selector-server");
|
||||
$select.html(options.join(''));
|
||||
$select.bind('change', me.toolbarSytnaxOnChange);
|
||||
|
||||
var $selectVersion = $("#qb-ui-syntax-selector-version");
|
||||
$selectVersion.bind('change', me.toolbarSytnaxChanged);
|
||||
|
||||
this.toolbarSytnaxVersionUpdate($select);
|
||||
|
||||
$('#qb-ui-query-statistic').bind('click', me.getQueryStatistics);
|
||||
this.QueryStatisticsDialog = $('#qb-ui-query-statistic-dialog').dialog({
|
||||
autoOpen: false,
|
||||
zIndex: 4000,
|
||||
width: 600,
|
||||
height:300
|
||||
});
|
||||
};
|
||||
|
||||
this.init();
|
||||
};
|
||||
|
||||
setGlobalOnLoad(function() {
|
||||
jQuery(document).ready(function() {
|
||||
var demo = new Demo();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user