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

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

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

View File

@@ -516,3 +516,68 @@ h2.active {
text-align: center;
background-color: #DBE4E8;
}
#filter {
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: #CCA;
z-index:10;
opacity:0.5;
filter: alpha(opacity=50);
}
#box {
display: none;
position: absolute;
top: 20%;
left: 30%;
width: 500px;
height: 220px;
padding: 48px;
margin:0;
border: 1px solid black;
background-color: white;
z-index:101;
overflow: visible;
}
#boxtitle {
position:absolute;
float:center;
top:0;
left:0;
width:593px;
height:20px;
padding:0;
padding-top:4px;
left-padding:8px;
margin:0;
border-bottom:4px solid #3CF;
background-color: #D0DCE0; //#09c;
color:black;
font-weight:bold;
padding-left: 2px;
font-family:"Times New Roman", Times, serif;
font-size:16px;
text-align:left;
}
#tblfooter {
background-color: D3DCE3;
float: right;
padding-top:10px;
color: black;
font-weight: normal;
}
input.btn {
color:#333;
font: bold 84%'trebuchet ms',helvetica,sans-serif;
background-color: #D0DCE0;
}

View File

@@ -27,6 +27,7 @@ $hidden = "hidden";
<link rel="icon" href="pmd/images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="pmd/images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="pmd/styles/<?php echo $GLOBALS['PMD']['STYLE'] ?>/style1.css" />
<link rel="stylesheet" type="text/css" href="../../../Users/Ankit/Desktop/lightbox-form.css" />
<title>Designer</title>
<script src="./js/jquery/jquery-1.4.2.js" type="text/javascript"></script>
<script type="text/javascript">
@@ -110,11 +111,15 @@ echo $script_tabs . $script_contr . $script_display_field;
class="M_butt" target="_self"
><img title="<?php echo __('Toggle small/big'); ?>" alt="key" src="pmd/images/bottom.png"
/></a><img class="M_bord" src="pmd/images/bord.png" alt=""
/><a href="javascript:build_query()" onmousedown="return false;"
/><a href="javascript:PDF_save();" onmousedown="return false;"
class="M_butt" target="_self"
><img src="pmd/images/pdf.png" alt="key" width="20" height="20"
title="<?php echo __('Import/Export coordinates for PDF schema'); ?>" /></a>
<a href="javascript:Top_menu_right(document.getElementById('key_Left_Right'));"
title="<?php echo __('Import/Export coordinates for PDF schema'); ?>" /></a
><a href="#" onClick="build_query('SQL Query on Database', 0)" onmousedown="return false;"
class="M_butt" target="_self"
><img src="pmd/images/query_builder.png" alt="key" width="20" height="20"
title="<?php echo __('Build Query'); ?>" /></a
><a href="javascript:Top_menu_right(document.getElementById('key_Left_Right'));"
onmousedown="return false;" class="M_butt last" target="_self">
<img src="pmd/images/2rightarrow_m.png" id="key_Left_Right" alt=">"
title="<?php echo __('Move Menu'); ?>" /></a>
@@ -694,7 +699,18 @@ if($_REQUEST['query']) {
echo '<div style="clear:both;"></div>';
echo '</div>';
echo '<a class="trigger" href="#">History</a>';
echo '<div id="filter"></div>';
echo '<div id="box">';
echo '<span id="boxtitle"></span>';
echo '<form method="GET" action="" target="_parent">';
echo '<textarea cols="80" name="sql_query" id="textSqlquery" rows="15"></textarea><div id="tblfooter">';
echo ' <input type="submit" name="submit" class="btn">';
echo ' <input type="button" name="cancel" value="Cancel" onClick="closebox()" class="btn">';
echo '</div></p>';
echo '</form></div>';
} ?>
<!-- cache images -->
<img src="pmd/images/2leftarrow_m.png" width="0" height="0" alt="" />
<img src="pmd/images/rightarrow1.png" width="0" height="0" alt="" />