new features in history tab
This commit is contained in:
BIN
pmd/images/and_icon.png
Normal file
BIN
pmd/images/and_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
pmd/images/or_icon.png
Normal file
BIN
pmd/images/or_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
@@ -1,7 +1,10 @@
|
||||
var history_array = [];
|
||||
var tab_array = [];
|
||||
function panel() {
|
||||
var g_index;
|
||||
function panel(index) {
|
||||
if (!index) {
|
||||
$(".toggle_container").hide();
|
||||
}
|
||||
$("h2.tiger").click(function(){
|
||||
$(this).toggleClass("active").next().slideToggle("slow");
|
||||
});
|
||||
@@ -28,9 +31,21 @@ function display(init,final) {
|
||||
str += '<h2 class="tiger"><a href="#">' + temp + '</a></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>';
|
||||
str +='<div class="block"> <table width ="250">';
|
||||
str += '<thead><tr><td>';
|
||||
if(history_array[i].get_and_or()){
|
||||
str +='<img src="pmd/images/or_icon.png" onclick="and_or('+i+')" title="OR"/></td>';
|
||||
}
|
||||
else {
|
||||
str +='<img src="pmd/images/and_icon.png" onclick="and_or('+i+')" title="AND"/></td>';
|
||||
}
|
||||
str +='<td style="padding-left: 5px;" align="right"><img src="./themes/original/img/b_sbrowse.png" title="column name"/></td><td width="175" style="padding-left: 5px">' + history_array[i].get_column_name();
|
||||
if (history_array[i].get_type() == "GroupBy" || history_array[i].get_type() == "OrderBy") {
|
||||
str += '</td><td align="center"><img src="themes/original/img/b_info.png" title="'+detail(i)+'"/><td title="' + detail(i) +'">' + history_array[i].get_type() + '</td></td><td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_delete('+ i +')><img src="themes/original/img/b_drop.png" title="Delete"></td></tr></thead>';
|
||||
}
|
||||
else {
|
||||
str += '</td><td align="center"><img src="themes/original/img/b_info.png" title="'+detail(i)+'"/></td><td title="' + detail(i) +'">' + history_array[i].get_type() + '</td><td <td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_edit('+ i +')><img src="themes/original/img/b_edit.png" title="Edit"/></td><td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_delete('+ i +')><img src="themes/original/img/b_drop.png" title="Delete"></td></tr></thead>';
|
||||
}
|
||||
i++;
|
||||
if(i >= history_array.length) {
|
||||
break;
|
||||
@@ -43,6 +58,96 @@ function display(init,final) {
|
||||
return str;
|
||||
}
|
||||
|
||||
function and_or(index) {
|
||||
if (history_array[index].get_and_or()) {
|
||||
history_array[index].set_and_or(0);
|
||||
}
|
||||
else {
|
||||
history_array[index].set_and_or(1);
|
||||
}
|
||||
var existingDiv = document.getElementById('ab');
|
||||
existingDiv.innerHTML = display(0,0);
|
||||
panel(1);
|
||||
}
|
||||
|
||||
function detail (index) {
|
||||
var type = history_array[index].get_type();
|
||||
var str;
|
||||
if (type == "Where") {
|
||||
str = 'Where ' + history_array[index].get_column_name() + history_array[index].get_obj().getrelation_operator() + history_array[index].get_obj().getquery();
|
||||
}
|
||||
if (type == "Rename") {
|
||||
str = 'Rename ' + history_array[index].get_column_name() + ' To ' + history_array[index].get_obj().getrename_to();
|
||||
}
|
||||
if (type == "Aggregate") {
|
||||
str = 'Select ' + history_array[index].get_obj().get_operator() + '( ' + history_array[index].get_column_name() + ' )';
|
||||
}
|
||||
if (type == "GroupBy") {
|
||||
str = 'GroupBy ' + history_array[index].get_column_name() ;
|
||||
}
|
||||
if (type == "OrderBy") {
|
||||
str = 'OrderBy ' + history_array[index].get_column_name() ;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
function history_delete(index) {
|
||||
history_array.splice(index,1);
|
||||
var existingDiv = document.getElementById('ab');
|
||||
existingDiv.innerHTML = display(0,0);
|
||||
panel(1);
|
||||
}
|
||||
|
||||
function history_edit(index) {
|
||||
g_index = index;
|
||||
var type = history_array[index].get_type();
|
||||
if (type == "Where") {
|
||||
document.getElementById('eQuery').value = history_array[index].get_obj().getquery();
|
||||
document.getElementById('erel_opt').value = history_array[index].get_obj().getrelation_operator();
|
||||
document.getElementById('query_where').style.left = '230px';
|
||||
document.getElementById('query_where').style.top = '330px';
|
||||
document.getElementById('query_where').style.visibility = 'visible';
|
||||
}
|
||||
if (type == "Rename") {
|
||||
//var left = screen.availWidth/2 ;
|
||||
document.getElementById('query_rename_to').style.left = '230px';
|
||||
document.getElementById('query_rename_to').style.top = '330px';
|
||||
document.getElementById('query_rename_to').style.visibility = 'visible';
|
||||
}
|
||||
if (type == "Aggregate") {
|
||||
var left = Glob_X - (document.getElementById('query_Aggregate').offsetWidth>>1);
|
||||
document.getElementById('query_Aggregate').style.left = left + 'px';
|
||||
document.getElementById('query_Aggregate').style.top = (screen.height / 4) + 'px';
|
||||
document.getElementById('query_Aggregate').style.visibility = 'visible';
|
||||
}
|
||||
}
|
||||
function edit(type) {
|
||||
if (type == "Rename") {
|
||||
if (document.getElementById('e_rename').value != "") {
|
||||
history_array[g_index].get_obj().setrename_to(document.getElementById('e_rename').value);
|
||||
document.getElementById('e_rename').value = "";
|
||||
}
|
||||
document.getElementById('query_rename_to').style.visibility = 'hidden';
|
||||
}
|
||||
if (type == "Aggregate") {
|
||||
if (document.getElementById('e_operator').value != '---') {
|
||||
history_array[g_index].get_obj().set_operator(document.getElementById('e_operator').value);
|
||||
document.getElementById('e_operator').value = '---';
|
||||
}
|
||||
document.getElementById('query_Aggregate').style.visibility = 'hidden';
|
||||
}
|
||||
if (type == "Where") {
|
||||
if (document.getElementById('erel_opt').value != '--' && document.getElementById('eQuery').value !="") {
|
||||
history_array[g_index].get_obj().setquery(document.getElementById('eQuery').value);
|
||||
history_array[g_index].get_obj().setrelation_operator(document.getElementById('erel_opt').value);
|
||||
document.getElementById('eQuery').value = "";
|
||||
document.getElementById('erel_opt').value = '--';
|
||||
}
|
||||
document.getElementById('query_where').style.visibility = 'hidden';
|
||||
}
|
||||
var existingDiv = document.getElementById('ab');
|
||||
existingDiv.innerHTML = display(0,0);
|
||||
panel(1);
|
||||
}
|
||||
function history(ncolumn_name,nobj,ntab,nobj_no,ntype) {
|
||||
var and_or;
|
||||
var obj;
|
||||
@@ -59,6 +164,9 @@ function display(init,final) {
|
||||
this.set_and_or = function(nand_or) {
|
||||
and_or = nand_or;
|
||||
};
|
||||
this.get_and_or = function() {
|
||||
return and_or;
|
||||
}
|
||||
this.get_relation = function() {
|
||||
return and_or;
|
||||
};
|
||||
@@ -107,7 +215,7 @@ var where = function (nrelation_operator,nquery) {
|
||||
return query;
|
||||
};
|
||||
this.getrelation_operator = function() {
|
||||
return relation_opearator;
|
||||
return relation_operator;
|
||||
};
|
||||
this.setquery(nquery);
|
||||
this.setrelation_operator(nrelation_operator);
|
||||
|
@@ -1014,12 +1014,12 @@ function add_object() {
|
||||
var sum = 0;
|
||||
var init = history_array.length;
|
||||
if (rel.value != '--') {
|
||||
if (document.getElementsByName('Query').value == "") {
|
||||
if (document.getElementById('Query').value == "") {
|
||||
document.getElementById('hint').innerHTML = "value/subQuery is empty" ;
|
||||
document.getElementById('hint').style.visibility = "visible";
|
||||
return;
|
||||
}
|
||||
var p = document.getElementsByName('Query');
|
||||
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"));
|
||||
sum = sum + 1;
|
||||
@@ -1057,6 +1057,6 @@ function add_object() {
|
||||
var existingDiv = document.getElementById('ab');
|
||||
existingDiv.innerHTML = display(init,history_array.length);
|
||||
Close_option();
|
||||
panel();
|
||||
panel(0);
|
||||
|
||||
}
|
@@ -411,7 +411,7 @@ right: 0;
|
||||
display: none;
|
||||
background: #FFF;
|
||||
border:1px solid #F5F5F5;
|
||||
width: auto;
|
||||
width: 350 px;
|
||||
height: auto;
|
||||
padding: 30px 170px 30px 30px;
|
||||
color:#FFF;
|
||||
@@ -457,20 +457,20 @@ z-index:999;
|
||||
}
|
||||
|
||||
h2.tiger{
|
||||
background-image: url(images/Header.png);
|
||||
background-repeat: repeat-x;
|
||||
padding: 1px;
|
||||
font-weight: bold;
|
||||
font-size:14px;
|
||||
padding: 50 20 50 20px;
|
||||
margin: 0 0 5px 0;
|
||||
width: 300px;
|
||||
width: 250px;
|
||||
float: left;
|
||||
color : #333;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h2.tiger a {
|
||||
background-image: url(images/Header.png);
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
color : #333;
|
||||
@@ -487,22 +487,32 @@ h2.active {
|
||||
background-repeat: repeat-x;
|
||||
padding: 1px;
|
||||
background-position: left bottom;
|
||||
} /*--When toggle is tigered, it will shift the image to the bottom to show its "opened" state--*/
|
||||
}
|
||||
|
||||
.toggle_container {
|
||||
margin: 0 0 5px;
|
||||
padding: 0;
|
||||
border-top: 1px solid #d6d6d6;
|
||||
background: #FFF ;
|
||||
width: 300px;
|
||||
width: 250px;
|
||||
overflow: hidden;
|
||||
font-size: 1.2em;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.toggle_container .block {
|
||||
background-color: #E7E7E7;
|
||||
background-color: #DBE4E8;
|
||||
padding:40 15 40 15px; /*--Padding of Container--*/
|
||||
border:1px solid #999;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
.history_table {
|
||||
text-align: center;
|
||||
background-color: #9999CC;
|
||||
}
|
||||
|
||||
.history_table2 {
|
||||
text-align: center;
|
||||
background-color: #DBE4E8;
|
||||
}
|
||||
|
168
pmd_general.php
168
pmd_general.php
@@ -468,7 +468,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap">Value/<br />Subquery</td>
|
||||
<td><textarea name="Query" value="" cols="15"></textarea>
|
||||
<td><textarea id="Query" value="" cols="18"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td align="center" nowrap="nowrap"><b>Rename To</b></td></tr>
|
||||
@@ -519,6 +519,172 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table id="query_rename_to" style="visibility:<?php echo $hidden ?>;"
|
||||
width="5%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="frams1" width="10px"></td>
|
||||
<td class="frams5" width="99%" ></td>
|
||||
<td class="frams2" width="10px"><div class="bor"></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="frams8"></td>
|
||||
<td class="input_tab">
|
||||
<table width="168" border="0" align="center" cellpadding="2" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="2" align="center" nowrap="nowrap"><strong>Rename To</strong></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="rename_to">
|
||||
<tr>
|
||||
<td width="58" nowrap="nowrap">New Name</td>
|
||||
<td width="102">
|
||||
<input type="text" value="" id="e_rename"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2" align="center" nowrap="nowrap">
|
||||
<input type="button" class="butt" name="Button"
|
||||
value="<?php echo __('OK'); ?>" onclick="edit('Rename')" />
|
||||
<input type="button" class="butt" name="Button"
|
||||
value="<?php echo __('Cancel'); ?>"
|
||||
onclick="document.getElementById('query_rename_to').style.visibility = 'hidden';" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td class="frams6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="frams4"><div class="bor"></div></td>
|
||||
<td class="frams7"></td>
|
||||
<td class="frams3"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table id="query_Aggregate" style="visibility:<?php echo $hidden ?>;"
|
||||
width="5%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="frams1" width="10px"></td>
|
||||
<td class="frams5" width="99%" ></td>
|
||||
<td class="frams2" width="10px"><div class="bor"></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="frams8"></td>
|
||||
<td class="input_tab">
|
||||
<table width="168" border="0" align="center" cellpadding="2" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="2" align="center" nowrap="nowrap"><strong>Aggregate</strong></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="58" nowrap="nowrap">Operator</td>
|
||||
<td width="102">
|
||||
<select name="operator" id="e_operator">
|
||||
<option value="---" selected="selected">---</option>
|
||||
<option value="sum" > Sum </option>
|
||||
<option value="min"> Min </option>
|
||||
<option value="max"> Max </option>
|
||||
<option value="avg"> Avg </option>
|
||||
<option value="avg"> Count </option>
|
||||
</select>
|
||||
</td></tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2" align="center" nowrap="nowrap">
|
||||
<input type="button" class="butt" name="Button"
|
||||
value="<?php echo __('OK'); ?>" onclick="edit('Aggregate')" />
|
||||
<input type="button" class="butt" name="Button"
|
||||
value="<?php echo __('Cancel'); ?>"
|
||||
onclick="document.getElementById('query_Aggregate').style.visibility = 'hidden';" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td class="frams6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="frams4"><div class="bor"></div></td>
|
||||
<td class="frams7"></td>
|
||||
<td class="frams3"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table id="query_where" style="visibility:<?php echo $hidden ?>;"
|
||||
width="5%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="frams1" width="10px"></td>
|
||||
<td class="frams5" width="99%" ></td>
|
||||
<td class="frams2" width="10px"><div class="bor"></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="frams8"></td>
|
||||
<td class="input_tab">
|
||||
<table width="168" border="0" align="center" cellpadding="2" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="2" align="center" nowrap="nowrap"><strong>Where</strong></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="rename_to">
|
||||
<tr>
|
||||
<td width="58" nowrap="nowrap">Opeartor</td>
|
||||
<td width="102"><select name="erel_opt" id="erel_opt">
|
||||
<option value="--" selected="selected"> -- </option>
|
||||
<option value="=" > = </option>
|
||||
<option value=">"> > </option>
|
||||
<option value="<"> < </option>
|
||||
<option value=">="> >= </option>
|
||||
<option value="<="> <= </option>
|
||||
<option value="NOT"> NOT </option>
|
||||
<option value="IN"> IN </option>
|
||||
<option value="EXCEPT"> Except </option>
|
||||
<option value="NOT IN"> Not In </option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap">Value/<br />Subquery</td>
|
||||
<td><textarea id="eQuery" value="" cols="18"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2" align="center" nowrap="nowrap">
|
||||
<input type="button" class="butt" name="Button"
|
||||
value="<?php echo __('OK'); ?>" onclick="edit('Where')" />
|
||||
<input type="button" class="butt" name="Button"
|
||||
value="<?php echo __('Cancel'); ?>"
|
||||
onclick="document.getElementById('query_where').style.visibility = 'hidden';" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td class="frams6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="frams4"><div class="bor"></div></td>
|
||||
<td class="frams7"></td>
|
||||
<td class="frams3"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
if($_REQUEST['query']) {
|
||||
echo '<div class="panel">';
|
||||
|
Reference in New Issue
Block a user