history tab few changes

This commit is contained in:
ankitg
2010-06-25 09:46:08 +05:30
parent f3d9b75c35
commit 8a672bad12
4 changed files with 215 additions and 79 deletions

View File

@@ -1,14 +1,59 @@
var history_array = [];
function history(ncolumn_name,nobj,ntab,nobj_no) {
var tab_array = [];
function panel() {
$(".toggle_container").hide();
$("h2.tiger").click(function(){
$(this).toggleClass("active").next().slideToggle("slow");
});
}
function display(init,final) {
var str,i,j,k,sto;
for (i = init;i < final;i++) {
sto = history_array[i];
var temp = history_array[i].get_tab() + '.' + history_array[i].get_obj_no();
for(j = 0;j < i;j++){
if(temp > (history_array[j].get_tab() + '.' + history_array[j].get_obj_no())) {
for(k = i;k > j;k--) {
history_array[k] = history_array[k-1];
}
history_array[j] = sto;
break;
}
}
}
str ='';
for ( var i=0; i < history_array.length; i++){
var temp = history_array[i].get_tab() + '.' + history_array[i].get_obj_no();
str += '<h2 class="tiger"><a href="#"></a>' + temp + '</h2>';
str +='<div class="toggle_container">\n';
while((history_array[i].get_tab() + '.' + history_array[i].get_obj_no()) == temp) {
str +='<div class="block"> <table>';
str += '<thead><tr><td>' + history_array[i].get_column_name() + '<td></tr></thead><tr><td>';
str += history_array[i].get_type() + '</td><td><img src=""/></td><td><img src="pmd/style/default/images/minus.png"></td></tr>';
i++;
if(i >= history_array.length) {
break;
}
str += '</table></div><br/>';
}
i--;
str += '</div><br/>';
}
return str;
}
function history(ncolumn_name,nobj,ntab,nobj_no,ntype) {
var and_or;
var obj;
var tab;
var column_name;
var obj_no;
this.setcolumn_name = function (ncolumn_name) {
var type;
this.set_column_name = function (ncolumn_name) {
column_name = ncolumn_name;
};
this.getcolumn_name = function() {
this.get_column_name = function() {
return column_name;
};
this.set_and_or = function(nand_or) {
@@ -27,7 +72,7 @@ var history_array = [];
tab = ntab;
};
this.get_tab = function() {
return obj;
return tab;
};
this.set_obj_no = function(nobj_no) {
obj_no = nobj_no;
@@ -35,12 +80,18 @@ var history_array = [];
this.get_obj_no = function() {
return obj_no;
};
this.set_type = function(ntype) {
type = ntype;
}
this.get_type = function() {
return type;
}
this.set_obj_no(nobj_no);
this.set_tab(ntab);
this.set_and_or(0);
this.set_obj(nobj);
this.setcolumn_name(ncolumn_name);
this.set_column_name(ncolumn_name);
this.set_type(ntype);
};
var where = function (nrelation_operator,nquery) {
@@ -77,5 +128,8 @@ var aggregate = function(noperator) {
this.set_operator = function(noperator) {
operator=noperator;
};
this.get_operator = function() {
return operator;
};
this.set_operator(noperator);
};

View File

@@ -966,18 +966,21 @@ function getColorByTarget( target )
return color;
}
function Click_option(id_this)
function Click_option(id_this,column_name,table_name)
{
var left = Glob_X - (document.getElementById(id_this).offsetWidth>>1);
var left = Glob_X - (document.getElementById(id_this).offsetWidth>>1);
document.getElementById(id_this).style.left = left + 'px';
// var top = Glob_Y - document.getElementById(id_this).offsetHeight - 10;
document.getElementById(id_this).style.top = (screen.height / 4) + 'px';
document.getElementById(id_this).style.visibility = "visible";
document.getElementById('option_col_name').innerHTML = 'column_name';
col_name = column_name;
tab_name = table_name;
}
function Close_option()
{
document.getElementById('pmd_options').style.visibility = "hidden";
document.getElementById('pmd_optionse').style.visibility = "hidden";
}
function Select_all(id_this)
@@ -1004,4 +1007,55 @@ function Table_onover(id_this,val)
document.getElementById("id_zag_" + id_this).className="tab_zag";
document.getElementById("id_zag_" + id_this + "_2").className="tab_zag";
}
}
function add_object() {
var rel = document.getElementById('rel_opt');
var sum = 0;
var init = history_array.length;
if (rel.value != '--') {
if (document.getElementsByName('Query').value == "") {
document.getElementById('hint').innerHTML = "value/subQuery is empty" ;
document.getElementById('hint').style.visibility = "visible";
return;
}
var w = document.getElementById('rel_opt').value;
var p = document.getElementsByName('Query');
var where_obj = new where(w,p.value);//make where object
history_array.push(new history(col_name,where_obj,tab_name,h_tabs[tab_name],"Where"));
sum = sum + 1;
}
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"));
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"));
sum = sum + 1;
//make aggregate operator
}
if (document.getElementById('groupby').checked == true ) {
history_array.push(new history(col_name,'GroupBy',tab_name,h_tabs[tab_name],"Group By"));
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],"Order By"));
sum = sum + 1;
document.getElementById('orderby').checked = false;
//make orderby
}
document.getElementById('hint').innerHTML = sum + "object created" ;
document.getElementById('hint').style.visibility = "visible";
//output sum new objects created
var existingDiv = document.getElementById('ab');
existingDiv.innerHTML = display(init,history_array.length);
Close_option();
panel();
}