diff --git a/pmd/images/and_icon.png b/pmd/images/and_icon.png new file mode 100644 index 000000000..bb51726b5 Binary files /dev/null and b/pmd/images/and_icon.png differ diff --git a/pmd/images/or_icon.png b/pmd/images/or_icon.png new file mode 100644 index 000000000..fa76f3bb1 Binary files /dev/null and b/pmd/images/or_icon.png differ diff --git a/pmd/scripts/history.js b/pmd/scripts/history.js index 56460034d..69564450b 100644 --- a/pmd/scripts/history.js +++ b/pmd/scripts/history.js @@ -1,7 +1,10 @@ var history_array = []; var tab_array = []; -function panel() { - $(".toggle_container").hide(); +var g_index; +function panel(index) { + if (!index) { + $(".toggle_container").hide(); + } $("h2.tiger").click(function(){ $(this).toggleClass("active").next().slideToggle("slow"); }); @@ -26,11 +29,23 @@ function display(init,final) { for ( var i=0; i < history_array.length; i++){ var temp = history_array[i].get_tab() + '.' + history_array[i].get_obj_no(); str += '

' + temp + '

'; - str +='
\n'; + str += '
\n'; while((history_array[i].get_tab() + '.' + history_array[i].get_obj_no()) == temp) { - str +='
'; - str += ''; + str +='
' + history_array[i].get_column_name() + '
'; - str += history_array[i].get_type() + '
'; + str += ''; + } + else { + str +=''; + } + str +=''; + } + else { + str += ''; + } i++; if(i >= history_array.length) { break; @@ -43,7 +58,97 @@ function display(init,final) { return str; } - function history(ncolumn_name,nobj,ntab,nobj_no,ntype) { +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; var tab; @@ -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); diff --git a/pmd/scripts/move.js b/pmd/scripts/move.js index ff0acb806..ae077edaf 100644 --- a/pmd/scripts/move.js +++ b/pmd/scripts/move.js @@ -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; @@ -1040,13 +1040,13 @@ function add_object() { //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")); + history_array.push(new history(col_name,'GroupBy',tab_name,h_tabs[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],"Order By")); + history_array.push(new history(col_name,'OrderBy',tab_name,h_tabs[tab_name],"OrderBy")); sum = sum + 1; document.getElementById('orderby').checked = false; //make orderby @@ -1057,6 +1057,6 @@ function add_object() { var existingDiv = document.getElementById('ab'); existingDiv.innerHTML = display(init,history_array.length); Close_option(); - panel(); + panel(0); } \ No newline at end of file diff --git a/pmd/styles/default/style1.css b/pmd/styles/default/style1.css index d7e81e595..d1ef1fa6d 100644 --- a/pmd/styles/default/style1.css +++ b/pmd/styles/default/style1.css @@ -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; + 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; -} \ No newline at end of file +} + +.history_table { + text-align: center; + background-color: #9999CC; +} + +.history_table2 { + text-align: center; + background-color: #DBE4E8; +} diff --git a/pmd_general.php b/pmd_general.php index ba1f54ebe..d261a23ac 100644 --- a/pmd_general.php +++ b/pmd_general.php @@ -468,7 +468,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { - @@ -519,6 +519,172 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
'; + if(history_array[i].get_and_or()){ + str +='' + history_array[i].get_column_name(); + if (history_array[i].get_type() == "GroupBy" || history_array[i].get_type() == "OrderBy") { + str += '' + history_array[i].get_type() + '
' + history_array[i].get_type() + '
Value/
Subquery
+
Rename To
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
Rename To
New Name + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Aggregate
Operator + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
Where
Opeartor +
Value/
Subquery
+
+ + +
+
+ ';