Newbie to ActiveWidgets
Hello All,
I just want to say that, this is the most amazing library that I have ever worked with. I belive it will changes the future of the web pages.
I must say, on a scale of 1-10, I have 4-html, 2-java script, -1 - CSS. So you can imagine the kind of pain I went through (without a good documentation) to understand how to use some of the components, and how every thing work. I've been so far experiementing with the free version of the library. However, I got my manager approval to purchase the library, so I will be purchasing a developer license tomorrow.
After some hard work, I managed to put together a demo to show to a customer. However, before I do that, I'd like to get some input/suggesions from the experts here. I also have couple of questions that I am hoping to get some answers.
1) I am using AW.XML.Table to populate the data in the grid, and to refresh this data, I am using XMLHTTPRequest to fetch the XML document and repopulate the table. This works very well, however I have a feeling that a combination of table.setURL(), and table.request() pretty much do the same thing. Am I correct in that assumption? If so, which way is better, using XMLHTTPRequest or table?
2) Does the AW.XML.Table.setTimeout(method, timeout) works same as javascript timeout?
3) Finally, the biggest question that I have is, would the html/javascript that I wrote works as it is on IE once I purchase the developer license? or Do I need to make any changes? I've been so far testing on firefox, and works like a charm.
Following is my html code. I'm sure that html that I have is probably not the most efficient code, so please feel free to make any suggessions on improving the code.
One final note, is there a tentative deadline on the documentation for the ActiveWidgets 2.0?
<html>
<head>
<link href="./runtime/styles/xp/aw.css" rel="stylesheet"></link>
<script src="./runtime/lib/aw.js"></script>
<style>
.aw-system-control {position: absolute}
#label {left: 6px; top: 6px; width: 30px; height: 10px;}
#tabs {left: 12px; top: 20px; width: 800px; height: 22px;}
#frame {left: 12px; top: 32px; width: 900px; height: 630px; border: 1px solid #999; background: #f9f8f4; position: absolute;}
#group1 {left: 20px; top: 45px; width: 880px; height: 330px;}
#grid1 {left: 25px; top: 60px; width: 870px; height: 310px;}
#group2 {left: 20px; top: 380px; width: 880px; height: 280px;}
#grid2 {left: 25px; top: 395px; width: 870px; height: 260px;}
.aw-column-0 {text-align: left;}
.aw-column-1 {text-align: left;}
.aw-column-2 {text-align: left;}
.aw-column-3 {text-align: left;}
.aw-column-4 {text-align: left;}
.aw-column-5 {text-align: left;}
.aw-column-6 {text-align: left;}
.aw-grid-cell {border-right: 1px solid threedshadow;}
.aw-grid-row {border-bottom: 1px solid threedlightshadow;}
</style>
</head>
<body>
<script>
var holdurl = "../cgi-bin/vxml/inbound_hold/DisplayHoldQueueXML.cgi?";
var opurl = "../cgi-bin/vxml/inbound_hold/DisplayOperatorQueueXML.cgi?";
var operator_phone = "1234567890";
var label = new AW.UI.Label;
label.setId("label");
label.setControlText("Queues");
label.setControlImage("favorites");
document.write(label);
var tabs = new AW.UI.Tabs;
tabs.setId("tabs");
tabs.setItemText(["4082307171", "9402397348"]);
tabs.setItemCount(2);
tabs.setSelectedItems([0]);
document.write(tabs);
var frame = new AW.HTML.DIV;
frame.setId("frame");
document.write(frame);
var container = new AW.HTML.SPAN;
document.write(container);
//--
var group1 = new AW.UI.Group;
group1.setId("group1");
group1.setControlText("Hold Queue");
var table1 = new AW.XML.Table;
table1.setURL(holdurl + 'operator_phone=' + operator_phone);
table1.request();
var columns1 = ["TXNID", "ACCOUNT", "FIRST", "LAST", "BALANCE","REASON","HOLD TIME [hh:mm:ss]"];
var grid1 = new AW.UI.Grid;
grid1.setId("grid1");
grid1.setHeaderText(columns1);
grid1.setColumnCount(7);
grid1.setColumnWidth(70,0);
grid1.setColumnWidth(80,1);
grid1.setColumnWidth(110,2);
grid1.setColumnWidth(110,3);
grid1.setColumnWidth(60,4);
grid1.setColumnWidth(160,5);
grid1.setColumnWidth(120,6);
grid1.setSelectorVisible(true);
grid1.setSelectorText(function(i){return this.getRowPosition(i)+1});
grid1.setSelectorWidth(15);
grid1.setSelectionMode("single-row");
var str = new AW.Formats.String;
var num = new AW.Formats.Number;
grid1.setCellFormat([num, num, str, str, num, str, str]);
grid1.onHeaderClicked = function(event,index){return 'disabled'};
grid1.setCellModel(table1);
//--
var group2 = new AW.UI.Group;
group2.setId("group2");
group2.setControlText("Operator Queue");
var table2 = new AW.XML.Table;
//table2.setURL(opurl + 'operator_phone=' + operator_phone);
//table2.request();
var columns2 = ["TXNID", "ACCOUNT", "FIRST", "LAST", "BALANCE","TRANSFER TIME [hh:mm:ss]"];
var grid2 = new AW.UI.Grid;
grid2.setId("grid2");
grid2.setHeaderText(columns2);
grid2.setColumnCount(6);
grid2.setColumnWidth(70,0);
grid2.setColumnWidth(80,1);
grid2.setColumnWidth(110,2);
grid2.setColumnWidth(110,3);
grid2.setColumnWidth(60,4);
grid2.setColumnWidth(150,5);
//grid2.setColumnWidth(90,6);
grid2.setSelectorVisible(true);
grid2.setSelectorText(function(i){return this.getRowPosition(i)+1});
grid2.setSelectorWidth(15);
grid2.setSelectionMode("single-row");
var str = new AW.Formats.String;
var num = new AW.Formats.Number;
grid2.setCellFormat([num, num, str, str, num, str, str]);
grid2.onHeaderClicked = function(event,index){return 'disabled'};
grid2.setCellModel(table2);
//--
var page1 = [group1, grid1, group2, grid2];
var page2 = [group1, grid1, group2, grid2];
var pages = [page1, page2];
var grids = [grid1, grid2];
var tabIndex = 0;
container.element().innerHTML = page1.join("");
tabs.onCurrentItemChanged = function(i) {
container.element().innerHTML = pages[i].join("");
if (container.$browser=="opera"){document.body.className += ""}
operator_phone = tabs.getItemText(i);
tabIndex = i;
//alert(tabs.getItemText(i));
}
//--
var httpReq1;
window.onload = function() {
httpReq1 = false;
// branch for native XMLHttpRequest object
if(window.XMLHttpRequest) {
try {
httpReq1 = new XMLHttpRequest();
} catch(e) {
httpReq1 = false;
}
// branch for IE/Windows ActiveX version
} else if(window.ActiveXObject) {
try {
httpReq1 = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
httpReq1 = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
httpReq1 = false;
}
}
}
if (httpReq1) {
setTimeout("updateHoldTable()", 1000);
}
}
var reqIndex = 0;
var url;
function updateHoldTable() {
//alert('reqIndex='+reqIndex + '<BR>' + 'tabIndex='+tabIndex);
reqIndex = tabIndex;
url = holdurl + 'operator_phone=' + operator_phone;
httpReq1.onreadystatechange = processHoldReqChange;
httpReq1.open("GET", url, true);
httpReq1.send("");
}
function processHoldReqChange() {
// only if httpReq1 shows "loaded"
if (httpReq1.readyState == 4 && reqIndex == tabIndex) {
// alert('reqIndex='+reqIndex);
// alert(httpReq1.responseText);
table1.setXML(httpReq1.responseXML);
grid1.setRowCount(table1.getCount());
grid1.refresh();
setTimeout("updateHoldTable()", 1000);
if (httpReq1.status == 200) {
} else {
alert("There was a problem retrieving the XML data:\n" +
httpReq1.statusText);
}
}
}
</script>
</body>
</html
I just want to say that, this is the most amazing library that I have ever worked with. I belive it will changes the future of the web pages.
I must say, on a scale of 1-10, I have 4-html, 2-java script, -1 - CSS. So you can imagine the kind of pain I went through (without a good documentation) to understand how to use some of the components, and how every thing work. I've been so far experiementing with the free version of the library. However, I got my manager approval to purchase the library, so I will be purchasing a developer license tomorrow.
After some hard work, I managed to put together a demo to show to a customer. However, before I do that, I'd like to get some input/suggesions from the experts here. I also have couple of questions that I am hoping to get some answers.
1) I am using AW.XML.Table to populate the data in the grid, and to refresh this data, I am using XMLHTTPRequest to fetch the XML document and repopulate the table. This works very well, however I have a feeling that a combination of table.setURL(), and table.request() pretty much do the same thing. Am I correct in that assumption? If so, which way is better, using XMLHTTPRequest or table?
2) Does the AW.XML.Table.setTimeout(method, timeout) works same as javascript timeout?
3) Finally, the biggest question that I have is, would the html/javascript that I wrote works as it is on IE once I purchase the developer license? or Do I need to make any changes? I've been so far testing on firefox, and works like a charm.
Following is my html code. I'm sure that html that I have is probably not the most efficient code, so please feel free to make any suggessions on improving the code.
One final note, is there a tentative deadline on the documentation for the ActiveWidgets 2.0?
<html>
<head>
<link href="./runtime/styles/xp/aw.css" rel="stylesheet"></link>
<script src="./runtime/lib/aw.js"></script>
<style>
.aw-system-control {position: absolute}
#label {left: 6px; top: 6px; width: 30px; height: 10px;}
#tabs {left: 12px; top: 20px; width: 800px; height: 22px;}
#frame {left: 12px; top: 32px; width: 900px; height: 630px; border: 1px solid #999; background: #f9f8f4; position: absolute;}
#group1 {left: 20px; top: 45px; width: 880px; height: 330px;}
#grid1 {left: 25px; top: 60px; width: 870px; height: 310px;}
#group2 {left: 20px; top: 380px; width: 880px; height: 280px;}
#grid2 {left: 25px; top: 395px; width: 870px; height: 260px;}
.aw-column-0 {text-align: left;}
.aw-column-1 {text-align: left;}
.aw-column-2 {text-align: left;}
.aw-column-3 {text-align: left;}
.aw-column-4 {text-align: left;}
.aw-column-5 {text-align: left;}
.aw-column-6 {text-align: left;}
.aw-grid-cell {border-right: 1px solid threedshadow;}
.aw-grid-row {border-bottom: 1px solid threedlightshadow;}
</style>
</head>
<body>
<script>
var holdurl = "../cgi-bin/vxml/inbound_hold/DisplayHoldQueueXML.cgi?";
var opurl = "../cgi-bin/vxml/inbound_hold/DisplayOperatorQueueXML.cgi?";
var operator_phone = "1234567890";
var label = new AW.UI.Label;
label.setId("label");
label.setControlText("Queues");
label.setControlImage("favorites");
document.write(label);
var tabs = new AW.UI.Tabs;
tabs.setId("tabs");
tabs.setItemText(["4082307171", "9402397348"]);
tabs.setItemCount(2);
tabs.setSelectedItems([0]);
document.write(tabs);
var frame = new AW.HTML.DIV;
frame.setId("frame");
document.write(frame);
var container = new AW.HTML.SPAN;
document.write(container);
//--
var group1 = new AW.UI.Group;
group1.setId("group1");
group1.setControlText("Hold Queue");
var table1 = new AW.XML.Table;
table1.setURL(holdurl + 'operator_phone=' + operator_phone);
table1.request();
var columns1 = ["TXNID", "ACCOUNT", "FIRST", "LAST", "BALANCE","REASON","HOLD TIME [hh:mm:ss]"];
var grid1 = new AW.UI.Grid;
grid1.setId("grid1");
grid1.setHeaderText(columns1);
grid1.setColumnCount(7);
grid1.setColumnWidth(70,0);
grid1.setColumnWidth(80,1);
grid1.setColumnWidth(110,2);
grid1.setColumnWidth(110,3);
grid1.setColumnWidth(60,4);
grid1.setColumnWidth(160,5);
grid1.setColumnWidth(120,6);
grid1.setSelectorVisible(true);
grid1.setSelectorText(function(i){return this.getRowPosition(i)+1});
grid1.setSelectorWidth(15);
grid1.setSelectionMode("single-row");
var str = new AW.Formats.String;
var num = new AW.Formats.Number;
grid1.setCellFormat([num, num, str, str, num, str, str]);
grid1.onHeaderClicked = function(event,index){return 'disabled'};
grid1.setCellModel(table1);
//--
var group2 = new AW.UI.Group;
group2.setId("group2");
group2.setControlText("Operator Queue");
var table2 = new AW.XML.Table;
//table2.setURL(opurl + 'operator_phone=' + operator_phone);
//table2.request();
var columns2 = ["TXNID", "ACCOUNT", "FIRST", "LAST", "BALANCE","TRANSFER TIME [hh:mm:ss]"];
var grid2 = new AW.UI.Grid;
grid2.setId("grid2");
grid2.setHeaderText(columns2);
grid2.setColumnCount(6);
grid2.setColumnWidth(70,0);
grid2.setColumnWidth(80,1);
grid2.setColumnWidth(110,2);
grid2.setColumnWidth(110,3);
grid2.setColumnWidth(60,4);
grid2.setColumnWidth(150,5);
//grid2.setColumnWidth(90,6);
grid2.setSelectorVisible(true);
grid2.setSelectorText(function(i){return this.getRowPosition(i)+1});
grid2.setSelectorWidth(15);
grid2.setSelectionMode("single-row");
var str = new AW.Formats.String;
var num = new AW.Formats.Number;
grid2.setCellFormat([num, num, str, str, num, str, str]);
grid2.onHeaderClicked = function(event,index){return 'disabled'};
grid2.setCellModel(table2);
//--
var page1 = [group1, grid1, group2, grid2];
var page2 = [group1, grid1, group2, grid2];
var pages = [page1, page2];
var grids = [grid1, grid2];
var tabIndex = 0;
container.element().innerHTML = page1.join("");
tabs.onCurrentItemChanged = function(i) {
container.element().innerHTML = pages[i].join("");
if (container.$browser=="opera"){document.body.className += ""}
operator_phone = tabs.getItemText(i);
tabIndex = i;
//alert(tabs.getItemText(i));
}
//--
var httpReq1;
window.onload = function() {
httpReq1 = false;
// branch for native XMLHttpRequest object
if(window.XMLHttpRequest) {
try {
httpReq1 = new XMLHttpRequest();
} catch(e) {
httpReq1 = false;
}
// branch for IE/Windows ActiveX version
} else if(window.ActiveXObject) {
try {
httpReq1 = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
httpReq1 = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
httpReq1 = false;
}
}
}
if (httpReq1) {
setTimeout("updateHoldTable()", 1000);
}
}
var reqIndex = 0;
var url;
function updateHoldTable() {
//alert('reqIndex='+reqIndex + '<BR>' + 'tabIndex='+tabIndex);
reqIndex = tabIndex;
url = holdurl + 'operator_phone=' + operator_phone;
httpReq1.onreadystatechange = processHoldReqChange;
httpReq1.open("GET", url, true);
httpReq1.send("");
}
function processHoldReqChange() {
// only if httpReq1 shows "loaded"
if (httpReq1.readyState == 4 && reqIndex == tabIndex) {
// alert('reqIndex='+reqIndex);
// alert(httpReq1.responseText);
table1.setXML(httpReq1.responseXML);
grid1.setRowCount(table1.getCount());
grid1.refresh();
setTimeout("updateHoldTable()", 1000);
if (httpReq1.status == 200) {
} else {
alert("There was a problem retrieving the XML data:\n" +
httpReq1.statusText);
}
}
}
</script>
</body>
</html
-Kris
March 3,