query window

This commit is contained in:
ankitg
2010-07-14 04:16:25 +05:30
parent 0d58ceb962
commit 5fce10df15
5 changed files with 139 additions and 16 deletions

View File

@@ -342,7 +342,7 @@ var aggregate = function(noperator) {
this.set_operator(noperator);
};
function build_query() {
function build_query(formtitle, fadin) {
var q_select = "SELECT ";
var temp;
for(i = 0;i < select_field.length; i++) {
@@ -357,15 +357,28 @@ function build_query() {
q_select += select_field[i] + temp +",";
}
}
q_select = q_select.substring(0,q_select.length - 1); //PDF_save()
document.getElementById('hint').innerHTML = q_select;
document.getElementById('hint').style.visibility = "visible";
q_select = q_select.substring(0,q_select.length - 1);
var box = document.getElementById('box');
document.getElementById('filter').style.display='block';
var btitle = document.getElementById('boxtitle');
btitle.innerHTML = formtitle;
if(fadin)
{
gradient("box", 0);
fadein("box");
}
else
{
box.style.display='block';
}
document.getElementById('textSqlquery').innerHTML = q_select;
// document.getElementById('hint').style.visibility = "visible";
}
function check_aggregate(id_this) {
var i = 0;
for(i;i < history_array.length;i++) {
var temp = '\'' + history_array[i].get_tab() + '\'.\'' +history_array[i].get_column_name() +'\'';
var temp = '`' + history_array[i].get_tab() + '`.`' +history_array[i].get_column_name() +'`';
if(temp == id_this && history_array[i].get_type() == "Aggregate") {
return history_array[i].get_obj().get_operator() + '(' + id_this +')';
}
@@ -376,10 +389,37 @@ function check_aggregate(id_this) {
function check_rename(id_this) {
var i = 0;
for (i;i < history_array.length;i++) {
var temp = '\'' + history_array[i].get_tab() + '\'.\'' +history_array[i].get_column_name() +'\'';
var temp = '`' + history_array[i].get_tab() + '`.`' +history_array[i].get_column_name() +'`';
if(temp == id_this && history_array[i].get_type() == "Rename") {
return " AS \'" + history_array[i].get_obj().getrename_to() +"\',";
return " AS `" + history_array[i].get_obj().getrename_to() +"`";
}
}
return "";
}
}
function gradient(id, level)
{
var box = document.getElementById(id);
box.style.opacity = level;
box.style.MozOpacity = level;
box.style.KhtmlOpacity = level;
box.style.filter = "alpha(opacity=" + level * 100 + ")";
box.style.display="block";
return;
}
function fadein(id)
{
var level = 0;
while(level <= 1)
{
setTimeout( "gradient('" + id + "'," + level + ")", (level* 1000) + 10);
level += 0.01;
}
}
function closebox()
{
document.getElementById('box').style.display='none';
document.getElementById('filter').style.display='none';
}

View File

@@ -33,6 +33,7 @@ var timeoutID;
var layer_menu_cur_click = 0;
var step = 10;
var old_class;
var downer;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
@@ -986,6 +987,7 @@ function Close_option()
function Select_all(id_this,owner)
{
var parent= document.form1;
downer =owner;
var i;
for(i = 0; i < parent.elements.length; i++) {
if (parent.elements[i].type == "checkbox" && parent.elements[i].id.substring(0,(9 + id_this.length)) == 'select_' + id_this + '._') {
@@ -1069,32 +1071,32 @@ function add_object() {
}
var p = document.getElementById('Query');
var where_obj = new where(rel.value,p.value);//make where object
history_array.push(new history(col_name,where_obj,tab_name,h_tabs[tab_name],"Where"));
history_array.push(new history(col_name,where_obj,tab_name,h_tabs[downer + '.' + tab_name],"Where"));
sum = sum + 1;
rel.value = '--';
p.value = "";
}
if (document.getElementById('new_name').value !="") {
var rename_obj = new rename(document.getElementById('new_name').value);//make Rename object
history_array.push(new history(col_name,rename_obj,tab_name,h_tabs[tab_name],"Rename"));
history_array.push(new history(col_name,rename_obj,tab_name,h_tabs[downer + '.' + tab_name],"Rename"));
sum = sum + 1;
document.getElementById('new_name').value = "" ;
}
if (document.getElementById('operator').value != '---') {
var aggregate_obj = new aggregate(document.getElementById('operator').value) ;
history_array.push(new history(col_name,aggregate_obj,tab_name,h_tabs[tab_name],"Aggregate"));
history_array.push(new history(col_name,aggregate_obj,tab_name,h_tabs[downer + '.' + tab_name],"Aggregate"));
sum = sum + 1;
document.getElementById('operator').value = '---';
//make aggregate operator
}
if (document.getElementById('groupby').checked == true ) {
history_array.push(new history(col_name,'GroupBy',tab_name,h_tabs[tab_name],"GroupBy"));
history_array.push(new history(col_name,'GroupBy',tab_name,h_tabs[downer + '.' +tab_name],"GroupBy"));
sum = sum + 1;
document.getElementById('groupby').checked = false;
//make groupby
}
if (document.getElementById('orderby').checked == true) {
history_array.push(new history(col_name,'OrderBy',tab_name,h_tabs[tab_name],"OrderBy"));
history_array.push(new history(col_name,'OrderBy',tab_name,h_tabs[downer + '.' + tab_name],"OrderBy"));
sum = sum + 1;
document.getElementById('orderby').checked = false;
//make orderby