Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cookies and treeview

Status
Not open for further replies.

slatet

Programmer
Sep 11, 2003
116
US
I am trying to save the current state of a treeview to a cookie. In other words, how ever you last left a tree (pluses and minuses for viewing data) display that next time you enter the page. I am using as an example. I am having difficulty getting it to work because this is two instances of third party code that I am trying to marry. So does anyone else have a good example on how to do this?
 
not exactly a simple operation, but i'm bored so i wrote the whole dang thing.
Code:
<html>
	<head>
		<title>tree</title>

		<script type=&quot;text/javascript&quot;>
			function toggle(pDiv) {
				var pDivs = getParentDivs();
				var cDivs = getChildDivs();
				var iSpans = getIndicatorSpans();
				var index = pDiv.id.split(&quot;_&quot;)[1];
				var cDiv = document.getElementById(&quot;child_&quot; + index);
				var iSpan = document.getElementById(&quot;indicator_&quot; + index);

				//  toggle state of pDiv's child
				cDiv.style.display = 
					(cDiv.style.display == &quot;block&quot;) ?
					&quot;none&quot; : &quot;block&quot;;
				
				//  toggle pDiv's +- indicator
				iSpan.innerHTML = iSpan.innerHTML == &quot;+&quot; ? &quot;-&quot; : &quot;+&quot;;
				
				//  hide all other children, set indicator to &quot;+&quot;
				for (var x = 0; x < pDivs.length; x++) {
					if (pDivs[x].id != &quot;parent_&quot; + index) {
						cDivs[x].style.display = &quot;none&quot;;
						iSpans[x].innerHTML = &quot;+&quot;;
					}
				}
				
				//  store the tree state
				storeTreeState(pDiv, pDivs);
			}
			
			function getParentDivs() {
				var els = document.getElementsByTagName(&quot;div&quot;);
				var ar = [];
				for (var x = 0; x < els.length; x++) {
					if (els[x].className && els[x].className == &quot;parent_div&quot;)
						ar.push(els[x]);
				}
				return ar;
			}
			
			function getChildDivs() {
				var els = document.getElementsByTagName(&quot;div&quot;);
				var ar = [];
				for (var x = 0; x < els.length; x++) {
					if (els[x].className && els[x].className == &quot;child_div&quot;)
						ar.push(els[x]);
				}
				return ar;
			}
			
			function getIndicatorSpans() {
				var els = document.getElementsByTagName(&quot;span&quot;);
				var ar = [];
				for (var x = 0; x < els.length; x++) {
					if (els[x].className && els[x].className == &quot;indicator&quot;)
						ar.push(els[x]);
				}
				return ar;
			}
			
			function storeTreeState(pDiv, pDivs) {
				var state = &quot;&quot;;
				
				//  store a string of zeros, with a 1 for the open branch
				for (var x = 0; x < pDivs.length; x++) {
					state += (pDivs[x] == pDiv) ? &quot;1&quot; : &quot;0&quot;
				}
				
				var now = new Date();
				var expires = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);

				document.cookie = &quot;treeState=&quot; + state +
					&quot;;expires=&quot; + expires;
			}
			
			window.onload = function loadTree() {
				if (document.cookie) {
					var state = document.cookie.match(/treeState=([^;]+)/)[1];
					var pDivs = getParentDivs();
					
					for (var x = 0; x < pDivs.length; x++) {
						if (state.charAt(x) == &quot;1&quot;) {
							toggle(pDivs[x]);
							break;
						}
					}
				}
			}
		</script>

		<style type=&quot;text/css&quot;>
			.indicator {
				font-family:monospace;
			}
			.child_div {
				display:none;
				margin-left:20px;
			}
		</style>
	</head>

	<body>
		<div id=&quot;parent_1&quot; onclick=&quot;toggle(this);&quot; class=&quot;parent_div&quot;>
			<span id=&quot;indicator_1&quot; class=&quot;indicator&quot;>+</span>
			parent_1
			<div id=&quot;child_1&quot; class=&quot;child_div&quot;>child_1</div>
		</div>

		<div id=&quot;parent_2&quot; onclick=&quot;toggle(this);&quot; class=&quot;parent_div&quot;>
			<span id=&quot;indicator_2&quot; class=&quot;indicator&quot;>+</span>
			parent_2
			<div id=&quot;child_2&quot; class=&quot;child_div&quot;>child_2</div>
		</div>

		<div id=&quot;parent_3&quot; onclick=&quot;toggle(this);&quot; class=&quot;parent_div&quot;>
			<span id=&quot;indicator_3&quot; class=&quot;indicator&quot;>+</span>
			parent_3
			<div id=&quot;child_3&quot; class=&quot;child_div&quot;>child_3</div>
		</div>
	</body>
</html>


======================================================================================

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
btw, it's currently configured to remember the state for just one day. this can be changed in storeTreeState(), like

// remember for one month
var expires = new Date(now.getFullYear(), now.getMonth() + 1, now.getDate());

additionally, the functions getParentDivs(), getChildDivs() and getIndicatorSpans() can be replaced with these optimized versions for larger trees:
Code:
function getParentDivs() {
	//  cache for efficiency
	if (!self._pdivs) {
		var els = document.getElementsByTagName(&quot;div&quot;);
		var ar = [];
		for (var x = 0; x < els.length; x++) {
			if (els[x].className && els[x].className == &quot;parent_div&quot;)
				ar.push(els[x]);
		}
		self._pdivs = ar;
	}
	return self._pdivs;
}

function getChildDivs() {
	//  cache for efficiency
	if (!self._cdivs) {
		var els = document.getElementsByTagName(&quot;div&quot;);
		var ar = [];
		for (var x = 0; x < els.length; x++) {
			if (els[x].className && els[x].className == &quot;child_div&quot;)
				ar.push(els[x]);
		}
		self._cdivs = ar;
	}
	return self._cdivs;
}

function getIndicatorSpans() {
	//  cache for efficiency
	if (!self._ispans) {
		var els = document.getElementsByTagName(&quot;span&quot;);
		var ar = [];
		for (var x = 0; x < els.length; x++) {
			if (els[x].className && els[x].className == &quot;indicator&quot;)
				ar.push(els[x]);
		}
		self._ispans = ar;
	}
	return self._ispans;
}

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Your way does seem straight forward. I am working with 3rd party code very similar to yours. I will paste it below. the problem is that I am unfamiliar with this 3rd party code, dhtml and javascript. I know each just not that well. Would you (or anyone) be able to help me integrate these two? I am having problems writing the collapsed item to the cookie. I know I am very close. I will include the code from the hyperlink in my original question. This is all in a javascript file as opposed to the actual web page. Thank you in advance.



/* Initial Object Method Settings. */
document.onclick = handleClick;
document.ondblclick = handleDoubleClick;
window.onload = initMessageTreePrime;
window.onunload = saveswitchstate;
window.onresize = fixSize;
document.onmouseover = messageTreeOnMouseOver;
document.onmouseout = messageTreeOnMouseOut;fixSubPadding(5);
document.ondragstart = function cancelDrag(){return(false);}

/* Initial Variable Declarations. */
var lastclicked = null;
var objSelectedItem = null;
var sPageType = null;
var nTaskCount = null;
var commentWin = null;
var userWin = null;
var viewTaskWin = null;
var newTaskWin = null;
var lastBG = null;
var lastFG = null;
var confirmNotify = 0;
var confirmReissue = 0;
var enablepersist=&quot;on&quot; //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious=&quot;yes&quot; //Collapse previously open content when opening present? (yes/no)



/* Adjusts The Size Of The Scroll View According To Its Parent Document. */
function fixSize(){
try
{
if(sPageType==&quot;TaskViewMain&quot;) {
scrollDiv.style.height=Math.max(document.body.clientHeight-(messageHeader.offsetHeight * 2),0);
scrollDiv.style.width=Math.max(document.body.clientWidth,0);
Function(&quot;messageHeader.style.marginLeft = -scrollDiv.scrollLeft&quot;);
}
}
catch (exception)
{}
}



/* Event handler for a click on the document. */
function handleClick(){
try
{

//Find out if the user clicked on the plus sign by attempting to retrieve the plus SPAN element
var plusEl = getReal(window.event.srcElement,&quot;className&quot;,&quot;plus&quot;);

if(plusEl.className==&quot;plus&quot;&&plusEl.children.length>0){
//If the plus SPAN was found and it has an IMG element (inserted by fixPlusSign procedure)
//then either expand or collapse the display.
if(plusEl.children.tags(&quot;IMG&quot;)[0].src.indexOf(&quot;minus&quot;)!= -1) {
hideItem(plusEl);
}
else {
showItem(plusEl);
return;
}
}

//If the user clicked anywhere else on the row then attempt to retrieve the A element
var el = getReal(window.event.srcElement,&quot;tagName&quot;,&quot;A&quot;);
if(el.tagName==&quot;A&quot;){
if (el.taskid!=&quot;&quot;){
//Highlight the currently selected row and un-highlight the previously selected row
if(lastclicked!=null){
lastclicked.style.backgroundColor = lastBG;
lastclicked.style.color = lastFG;
}

lastBG = el.currentStyle.backgroundColor;
lastFG = &quot;black&quot;;

lastclicked = el;
el.style.background=&quot;highlight&quot;;
el.style.color=&quot;highlighttext&quot;;

//Cache values of the currently selected row in an object variable so it can by acted on by menu commands

initializeObjItem(el);

}
}
}
catch (exception)
{}

}

/* Event handler for a double click on the document. */
function handleDoubleClick(){
//Find out if the user clicked on the plus sign by attempting to retrieve the plus SPAN element
var plusEl = getReal(window.event.srcElement,&quot;className&quot;,&quot;plus&quot;);

if(plusEl.className==&quot;plus&quot;&&plusEl.children.length>0){
//If the plus SPAN was found and it has an IMG element (inserted by fixPlusSign procedure)
//then either expand or collapse the display.
if(plusEl.children.tags(&quot;IMG&quot;)[0].src.indexOf(&quot;minus&quot;)!= -1) {
hideItem(plusEl);
}
else {
showItem(plusEl);
return;
}
}

var el = getReal(window.event.srcElement,&quot;tagName&quot;,&quot;A&quot;);

if(el.tagName==&quot;A&quot;) {
if (el.taskid!=&quot;&quot;) {
viewEntry();
}
}

}

/* Highlights The Hovered Item. */
function messageTreeOnMouseOver(){
try
{
var fromEl = getReal(window.event.fromElement,&quot;tagName&quot;,&quot;A&quot;);
var toEl = getReal(window.event.toElement,&quot;tagName&quot;,&quot;A&quot;);

if(fromEl==toEl) return;

if(toEl.tagName==&quot;A&quot;){
if(lastclicked!=null&&lastclicked==toEl&&ieVersion()>=5){
toEl.style.color=&quot;highlighttext&quot;;
toEl.style.background=&quot;highlight&quot;;
}
else toEl.style.color=&quot;blue&quot;;
}

}
catch (exception)
{}
}


/* Unhighlights The Last Hovered Item. */
function messageTreeOnMouseOut(){
try
{
var fromEl = getReal(window.event.fromElement,&quot;tagName&quot;,&quot;A&quot;);
var toEl = getReal(window.event.toElement,&quot;tagName&quot;,&quot;A&quot;);

if(fromEl==toEl) return;

if(fromEl.tagName==&quot;A&quot;){
if(document.body.selectedItem!=null&&document.body.selectedItem==fromEl&&ieVersion()>=5){
fromEl.style.color=&quot;highlighttext&quot;;
fromEl.style.background=&quot;highlight&quot;;
}
else if(fromEl==lastclicked){
fromEl.style.background=&quot;highlight&quot;;
fromEl.style.color=&quot;highlighttext&quot;;
}
else fromEl.style.color=&quot;windowtext&quot;;
}
}
catch (exception)
{
}

}

function do_tree_onload()
{
getElementbyClass(&quot;switchcontent&quot;)
if (enablepersist==&quot;on&quot; && typeof ccollect!=&quot;undefined&quot;)
revivecontent()
}

function revivecontent()
{
contractcontent(&quot;omitnothing&quot;)
selectedItem=getselectedItem()
selectedComponents=selectedItem.split(&quot;|&quot;)
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents).style.display=&quot;block&quot;
}

function contractcontent(omit)
{
var inc=0
while (ccollect[inc])
{
if (ccollect[inc].id!=omit)
ccollect[inc].style.display=&quot;none&quot;
inc++
}
}

function getElementbyClass(classname)
{
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName(&quot;*&quot;)
for (i=0; i<alltags.length; i++)
{
if (alltags.className==classname)
ccollect[inc++]=alltags
}
}

function getselectedItem()
{
if (get_cookie(window.location.pathname) != &quot;&quot;){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return &quot;&quot;
}

function get_cookie(Name)
{
var search = Name + &quot;=&quot;
var returnvalue = &quot;&quot;;
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(&quot;;&quot;, offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function saveswitchstate()
{
var inc=0, selectedItem=&quot;&quot;
while (ccollect[inc]){
if (ccollect[inc].style.display==&quot;block&quot;)
selectedItem+=ccollect[inc].id+&quot;|&quot;
inc++
}

document.cookie=window.location.pathname+&quot;=&quot;+selectedItem+&quot;;expires=Wednesday, 05-Jan-05 00:00:00 GMT&quot;;
//strCookie = &quot;tracyscookies=12345&quot;;
//document.cookie = strCookie;

}



/* Initializes The Treeview. *///
function initMessageTreePrime(){

do_tree_onload()
try
{

if(scrollDiv) {
sPageType = scrollDiv.getAttribute(&quot;pageType&quot;);
}

parent.treeLoaded();
fixSize();
numberOfChildItems();

el = document.all.messageTree;
if(el.children.length>0){
el.tree=new Tree(el.children[0]);
el.tree.add(buildTree(el.children[0]));
}

scrollDiv.onscroll = new Function(&quot;messageHeader.style.marginLeft = -scrollDiv.scrollLeft&quot;);

fixExpandState();
checkTopUrl();

if(sPageType==&quot;TaskViewMain&quot; && document && document.XMLDocument && document.XMLDocument.documentElement && document.XMLDocument.documentElement.xml) {
var xmlString = document.XMLDocument.documentElement.xml;
var xmlData = new ActiveXObject(&quot;MSXML2.DOMDocument&quot;);

xmlData.async = false;
xmlData.loadXML(xmlString);

var nList = xmlData.selectNodes(&quot;/root/task&quot;);

if(!nList.length && document == parent.messageframe.document) {
var targetDoc = document;

targetDoc.all.taskDetail.innerHTML = &quot;&quot;;
alert('No tasks could be found.');
}
}
else if(parent.mainframe && parent.mainframe.document.all.taskAttributes) {
initializeObjItem(parent.mainframe.document.all.taskAttributes);
}

fixPlusSign();
ExpandSearchResults();
}
catch (exception)
{
}
}

var pluses=new Array();
/* Shows The Plus Image Next To Items With Children. */
function fixPlusSign(){
var index = 0;
var spans = document.all.tags(&quot;span&quot;);
var spansLength = spans.length;

for(var i=0;i<spansLength;i++){
if(spans.className==&quot;plus&quot;) pluses[index++]=spans;
}

var plusesLength = pluses.length;

if(nTaskCount) plusesLength = nTaskCount;

for(i=0;i<plusesLength;i++){
if(pluses.parentElement.parentElement.children.tags(&quot;div&quot;).length>0) pluses.innerHTML=plusString;
}

if(messageTree.children.length>0){
var topItems = messageTree.children[0].children;
var tpl = topItems.length;

for(var i=0;i<tpl;i++){
if(topItems.className==&quot;item&quot;){}
}
}
}

/* Fixes The Expand State. */
function fixExpandState(){
if(parent.tLoaded&&parent.toolframe.document.all.toggleExpandCollapseButton.value)
expandCollapse();
}

/* Expands Or Collapses Any Subitems. */
function expandCollapse(){
if(expandedTree){
for(var i=0;i<pluses.length;i++){
hideItem(pluses);
}
}
else{
for(var i=0;i<pluses.length;i++){
showItem(pluses);
}
}
expandedTree=!expandedTree;
}

/* Checks The Top Url. */
function checkTopUrl(){
if(parent.mLoaded&&parent.tLoaded){
if(parent.xLoaded) return;

var str = parent.location.href;
var displayIndex = str.indexOf(&quot;action=display&quot;);

if(displayIndex!= -1) {
var args = new Array();
var as = str.substr(displayIndex+15).split(&quot;&&quot;);

for(var i=0;i<as.length;i++) {
var tmp = as.split(&quot;=&quot;);
if(tmp.length!=2)return;args[tmp[0]]=tmp[1];
}

var id = args[&quot;id&quot;];
var group = args[&quot;group&quot;];

if(group!=null){
if(document.body.group!=group) {
parent.oeBar.loadTree(group);
parent.oeBar.setTimeout(&quot;selectRightItem()&quot;,100);
}
else {
var loc = str.substring(0,displayIndex)+&quot;action=preview&group=&quot;+group+&quot;&id=&quot;+id;loc=loc.replace(/\/\?action/g,&quot;/&quot;+cgiFile+&quot;?action&quot;);
var cm = findNode(document.all.messageTree.tree,loc);

if(cm==null) return;

parent.toolframe.toggle(parent.toolframe.document.all.toggleExpandCollapseButton);
parent.toolframe.makePressed(parent.toolframe.document.all.toggleExpandCollapseButton);
expandCollapse();
cm.html.children.tags(&quot;A&quot;)[0].click();
parent.setXLoaded();
}
}
}
}
else window.setTimeout(&quot;checkTopUrl()&quot;,100);
}

/* Create The Tree Object. */
function Tree(parent){
this.parent = parent;
this.children = new Array();
this.nextSibbling = int_nextSibbling;
this.add = int_add;
this.href = new String();
this.html = null;
this.index = 0;

var length = 0;

function int_add(t){
this.children[length]=t;
this.children[length].parent=this;
this.children[length].index=length++;
}

function int_nextSibbling(){
if(this.parent!=null) return this.parent.children[this.index+1];
}
}

/* Builds A New Tree Object. */
function buildTree(el){
var is = new Array();
var ic = 0;
var cs = el.children;
var csl = cs.length;

for(var i=0;i<csl;i++){
if(cs.className==&quot;item&quot;){
is[ic++]=cs;
}
}

var nTree = new Tree();

for(var j=0;j<ic;j++){
nTree.add(buildTree(is[j]));
nTree.children[j].href=is[j].all.tags(&quot;A&quot;)[0].href;
nTree.children[j].html=is[j];
}

return nTree;
}

/* Hide a specific Item. */
function hideItem(plusEl){
var el = plusEl.parentElement.parentElement;
var children = el.children;
var childrenLength = children.length;

for(var i=0;i<childrenLength;i++){
var child = children.item(i);

if(child.className==&quot;item&quot;){
child.style.display=&quot;none&quot;;
plusEl.innerHTML=plusString;
}
}
}


/* Show a specific Item. */
function showItem(plusEl){
var el = plusEl.parentElement.parentElement;
var children = el.children;
var childrenLength = children.length;

for(var i=0;i<childrenLength;i++){
var child = children.item(i);

if(child.className==&quot;item&quot;){
child.style.display=&quot;block&quot;;
//expandcontent(child.id)
plusEl.innerHTML=minusString;
}
}
}



function expandcontent(cid)
{
if (typeof ccollect!=&quot;undefined&quot;){
if (collapseprevious==&quot;yes&quot;)
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!=&quot;block&quot;)? &quot;block&quot; : &quot;none&quot;
}
}


/* Fills each Item with children with the number of children in parenthesis inside of the subject line. */
function numberOfChildItems(){
var itemDivs = new Array();
var index = 0;
var divs = document.all.tags(&quot;div&quot;);
var divsLength = divs.length;

for(var i=0;i<divsLength;i++){
if(divs.className==&quot;item&quot;) itemDivs[index++]=divs;
}

var itemsLength = itemDivs.length;

for(i=0;i<itemsLength;i++){
var itemChildren = getChildren(itemDivs);
var atag = itemDivs.children.tags(&quot;a&quot;)[0]

for(x=0;x<atag.children.length;x++) {
if(atag.children[x].className==&quot;subject&quot;) {
var subjectSpan = atag.children[x];

if(itemChildren>0&&showNumberOfReplys) {
subjectSpan.innerHTML+=replysStartTag+itemChildren+replysEndTag;
}
}
}
}
}

/* Return The Number Of Children The Specified Element Has. */
function getChildren(el){
var l = el.children.tags(&quot;DIV&quot;).length;

if(l==0) return 0;
else{
var ec = el.children.tags(&quot;DIV&quot;);
var ecl = ec.length;

for(var i=0;i<ecl;i++) {
l+=getChildren(ec);
}
return l;
}
}

/* Indents Any Expanded Children Item. */
function fixSubPadding(depth) {
var str2 = null;
var val = null;
var width = null;

for(var i=0;i<depth;i++){
str2=&quot;&quot;;
val=0;

for(var j=0;j<i;j++){
str2+=&quot;.item &quot;
val+=18;
}

document.styleSheets[0].addRule(str2+&quot;.subject&quot;,&quot;width: &quot;+(width)+&quot;; padding-left: &quot;+val+&quot;;&quot;);
}
}


/**
* Go through the xml of the document and find any nodes with the discovered tagname
* Then select and programatically expand each of the discovered items in the html.
*/
function ExpandSearchResults() {
if(parent.mainframe && document == parent.mainframe.document && document.XMLDocument && document.XMLDocument.documentElement) {
var xmlString = document.XMLDocument.documentElement.xml;
var xmlData = new ActiveXObject(&quot;MSXML2.DOMDocument&quot;);

xmlData.async = false;
xmlData.loadXML(xmlString);

var nList = xmlData.selectNodes(&quot;//discovered&quot;);

if(nList.length > 0) {
var nc = 0;
while(nc!=nList.length) {
if(nList[nc].getAttribute(&quot;taskid&quot;)) ExpandTreeItem(nList[nc].getAttribute(&quot;taskid&quot;));
nc++;
}
}
//window.status = &quot;Found &quot; + nList.length + &quot; tasks.&quot;;
}
}


/**
* Expands an indivisual tree item according to its ID.
*/
var pnArray = new Array();
function ExpandTreeItem(TaskID) {
var nl = document.getElementsByTagName(&quot;div&quot;);

for(var i =0;i<nl.length;i++) {
if(nl.getAttribute(&quot;id&quot;) == &quot;tid&quot; + TaskID) {
var myNodes = null;
var d = 1;
var pNode = nl;

//nl.style.backgroundColor =&quot;#FFFFF0&quot;;
subItem = nl.childNodes;
// subItem[1].style.backgroundColor=&quot;#FFFFF0&quot;;

while(d!=0) {
if(pNode.parentNode && pNode.parentNode.getAttribute(&quot;id&quot;)) {
pNode = pNode.parentNode;
if(pNode.getAttribute(&quot;id&quot;) && pNode.getAttribute(&quot;id&quot;).search(&quot;tid&quot;)!=-1) {
myNodes = pNode.childNodes;
if(!inside(pNode.getAttribute(&quot;id&quot;))) {
myNodes[0].click();
}
}
}
else {
d = 0;
}
}
}
}

function inside(tid) {
for(var i=0;i<pnArray.length; i++) {
if(pnArray == tid) return true;
}
pnArray.push(tid);
return false;
}
}


/* Displays the details of the Task inside of the messageFrame window. */
function ShowDetails(TaskID) {

var XMLsubmit = &quot;<request><taskid>&quot; + objSelectedItem.getTaskID() + &quot;</taskid></request>&quot;;
var XMLpost = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);

XMLpost.open(&quot;POST&quot;, &quot;GetTaskDetails.aspx&quot;, false);
XMLpost.send(XMLsubmit);

var XMLresponse = XMLpost.ResponseXML;

XMLresponse.async = false;

try
{
var responseNode = XMLresponse.selectSingleNode(&quot;//message&quot;);
var message = responseNode.text;
}
catch (e)
{
alert(&quot;The application could not retrieve the Message Details from the server.&quot;)
return
}

if(message == &quot;OK&quot;){
try
{
var selectedNode = XMLresponse.selectSingleNode(&quot;//task&quot;);
var xsltSheet = new ActiveXObject(&quot;MSXML2.DOMDocument&quot;);
xsltSheet.async = false
xsltSheet.load(&quot;XSL/TaskDetails.xsl&quot;);
if(parent.messageframe) {
var strHTML = selectedNode.transformNode(xsltSheet);
var targetDoc = parent.messageframe.document

targetDoc.all.taskDetail.innerHTML = strHTML

window.event.cancelBubble = true;
}
}
catch(e) {}
}
else {
alert(message);
}

/* Web Service Client Code Prototype
Resulted in &lt; , &gt; characters replacing all < , > characters in content within the <string></string> node.

if(TaskID == null) return

var XMLpost = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);

XMLpost.open(&quot;GET&quot;, &quot;GetTaskDetails.asmx/GetTaskDetails?TaskID=&quot; + TaskID, false);
XMLpost.send();

var XMLresponse = XMLpost.ResponseXML;
XMLresponse.async = false;
try
{
var responseNode = XMLresponse.selectSingleNode(&quot;//string&quot;);
alert(responseNode.xml)
var message = responseNode.selectSingleNode(&quot;//task&quot;);

}
catch (e)
{
alert(e)
//alert(&quot;STACS could not retrieve the Task Details from the STACS server.&quot;)
return
}

if(message == &quot;OK&quot;){
var selectedNode = XMLresponse.selectSingleNode(&quot;//task&quot;);
var xsltSheet = new ActiveXObject(&quot;MSXML2.DOMDocument&quot;);
xsltSheet.async = false
xsltSheet.load(&quot;XSL/TaskDetails.xsl&quot;);
if(parent.messageframe) {
var strHTML = selectedNode.transformNode(xsltSheet);
var targetDoc = parent.messageframe.document

targetDoc.all.taskDetail.innerHTML = strHTML

window.event.cancelBubble = true;
}

}
else {
alert(message);
}

*/

}

/* Default Values Used For Sorting And Filtering */
var strOrder = &quot;ascending&quot;;
var strField = &quot;@taskid&quot;;
var strDataType = &quot;number&quot;;
var strAttr = &quot;&quot;;
var strValue = &quot;&quot;;

// Sort tasks according to the specified field
function SortTasks(sSortField) {
if(parent.mainframe && document == parent.mainframe.document && document.XMLDocument) {

var xmlString = document.XMLDocument.documentElement.xml;
var xmlData = new ActiveXObject(&quot;MSXML2.DOMDocument&quot;);

xmlData.async = false;
xmlData.loadXML(xmlString);

var xsltSheet = new ActiveXObject(&quot;MSXML2.DOMDocument&quot;);

xsltSheet.async = false;

if (strOrder == &quot;ascending&quot;) strOrder = &quot;descending&quot;;
else strOrder = &quot;ascending&quot;;

switch(sSortField) {
case &quot;DateCreated&quot;:
strField = &quot;@dateissued&quot;;
strDataType = &quot;number&quot;;
break;

case &quot;Subject&quot;:
strField = &quot;@subject&quot;;
strDataType = &quot;text&quot;;
break;

case &quot;Status&quot;:
strField = &quot;@status&quot;;
strDataType = &quot;text&quot;;
break;

case &quot;Attachment&quot;:
strField = &quot;@attachment&quot;;
strDataType = &quot;number&quot;;
break;

case &quot;TaskID&quot;:
strField = &quot;@taskid&quot;;
strDataType = &quot;number&quot;;
break;

case &quot;SourceOffice&quot;:
strField = &quot;@sourceoffice&quot;;
strDataType = &quot;text&quot;;
break;

case &quot;From&quot;:
strField = &quot;@originator&quot;;
strDataType = &quot;text&quot;;
break;

case &quot;Lead&quot; :
strField = &quot;@lead&quot;;
strDataType = &quot;text&quot;;
break;

case &quot;DueDate&quot; :
strField = &quot;@datedue&quot;;
strDataType = &quot;number&quot;;
break;

case &quot;Support&quot; :
strField = &quot;@support&quot;;
strDataType = &quot;text&quot;;
break;

case &quot;Location&quot; :
strField = &quot;@location&quot;;
strDataType = &quot;text&quot;;
break;

default :
strField = &quot;@taskid&quot;;
strDataType = &quot;number&quot;;
}

var strXSLFile = &quot;XSL/TaskViewSort.asp?field=&quot; + strField + &quot;&dataType=&quot; + strDataType + &quot;&order=&quot; + strOrder;

if(strAttr) {
var nList = xmlData.selectNodes(&quot;/root/task[@&quot; + strAttr + &quot; = '&quot; + strValue + &quot;']&quot;);
var nCount = 0;

function walkChild(myNode) {
nCount = nCount + 1;

if(myNode && myNode.childNodes && myNode.childNodes.length > 0) {
var myNodesChildren = myNode.childNodes;

for(var l = 0;l<myNodesChildren.length;l++) walkChild(myNodesChildren);
}
}

for(var i=0;i<nList.length;i++) {
walkChild(nList);
}

nTaskCount = nCount;
strXSLFile = strXSLFile + &quot;&FilterID=&quot; + strAttr + &quot;&FilterValue=&quot; + strValue;

if(nList.length > 0 && parent.mainframe) {
xsltSheet.load(strXSLFile);
if(parent.menuframe) {
parent.menuframe.menuDenit();
//parent.menuframe.LoadInit();
}

var strHTML = xmlData.transformNode(xsltSheet);
var targetDoc = document;

targetDoc.all.messageTree.innerHTML = &quot;&quot;;
targetDoc.all.messageTree.innerHTML = strHTML;

initMessageTreePrime();
}
else {
var targetDoc = document;

targetDoc.all.messageTree.innerHTML = &quot;&quot;;
}
}
else {
xsltSheet.load(strXSLFile);
var strHTML = xmlData.transformNode(xsltSheet);
var targetDoc = document;

targetDoc.all.messageTree.innerHTML = &quot;&quot;;
targetDoc.all.messageTree.innerHTML = strHTML;

initMessageTreePrime();
}
}
}


/* Refresh the calling page to TaskView.aspx and refresh with server side xml data. */
function ReloadTaskView() {
//if(parent.menuframe) parent.menuframe.LoadInit();
location.href=&quot;TaskView.aspx&quot;;
}

/* Show all tasks from the current the xml document. */
function RefreshTaskView() {
if(parent.mainframe && parent.mainframe.document.XMLDocument && document == parent.mainframe.document) {
if(parent.menuframe) {
parent.menuframe.menuDenit();
//parent.menuframe.LoadInit();
}

var xmlString = document.XMLDocument.documentElement.xml;
var xmlData = new ActiveXObject(&quot;MSXML2.DOMDocument&quot;);

xmlData.async = false;
xmlData.loadXML(xmlString);

var xsltSheet = new ActiveXObject(&quot;MSXML2.DOMDocument&quot;);
var strXSLFile = &quot;XSL/TaskViewRefresh.xsl&quot;;

xsltSheet.async = false;
xsltSheet.load(strXSLFile);

var strHTML = xmlData.transformNode(xsltSheet);
var targetDoc = document;

targetDoc.all.messageTree.innerHTML = &quot;&quot;;
targetDoc.all.messageTree.innerHTML = strHTML;
strAttr = null;
strValue = null;
nTaskCount = null;

initMessageTreePrime();

window.status = &quot;Now showing all tasks.&quot;;
}
}



var searchWin = null;
var sw = 0;
/*Open a new search window. */
function startSearch() {
if(parent.menuframe) parent.menuframe.startSearch();
}

/*
Object used to interact with items in the tree view
ex:
// This code should be set in an item onClick event function
// objSelectedItem should be a global buffer object to hold the information of the current or last task clicked.
objSelectedItem = new objItem();
// sTaskId & sTaskType are passed to this function.
objSelectedItem.setTaskID(sTaskID);
objSelectedItme.setTaskType(sTaskType); // sTaskType should be linked to a global constant such as CONSTANT
*/

function initializeObjItem(el) {
// This code is used in the item onClick event function to identify which is the currently selected row on the screen
// objSelectedItem should be a global buffer object to hold the information of the current or last task clicked.
// sTaskType should be linked to a global constant such as CONSTANT
objSelectedItem = new objItem();

if(el.getAttribute(&quot;taskid&quot;)){
objSelectedItem.setTaskID(el.getAttribute(&quot;taskid&quot;));
objSelectedItem.setTaskType(el.getAttribute(&quot;tasktype&quot;));
objSelectedItem.setParentTaskID(el.getAttribute(&quot;parenttaskid&quot;));
objSelectedItem.setStatus(el.getAttribute(&quot;statusdisplay&quot;));
objSelectedItem.setOriginator(el.getAttribute(&quot;isoriginator&quot;));
objSelectedItem.setLead(el.getAttribute(&quot;islead&quot;));
objSelectedItem.setRouteType(el.getAttribute(&quot;routetype&quot;));
objSelectedItem.setIsCurrentSection(el.getAttribute(&quot;iscurrentsection&quot;));

if(sPageType==&quot;TaskViewMain&quot;) ShowDetails(el.getAttribute(&quot;taskid&quot;), el.getAttribute(&quot;tasktype&quot;));
}
}

function objItem() {
var sItemTaskID = null;
var sItemTaskType = null;
var sItemParentTaskID = null;
var sItemStatus = null;
var sItemOriginator = null;
var sItemLead = null;
var sRouteType = null;
var sIsCurrentSection = null;

this.setTaskID = setTaskIDFunc;
this.setTaskType = setTaskTypeFunc;
this.setParentTaskID = setParentTaskID;
this.setStatus = setStatusFunc;
this.setOriginator = setOriginatorFunc;
this.setLead = setLeadFunc;
this.setRouteType = setRouteTypeFunc;
this.setIsCurrentSection = setIsCurrentSectionFunc;
this.getTaskID = getTaskID;
this.getTaskType = getTaskType;
this.getParentTaskID = getParentTaskID;
this.getStatus = getStatus;
this.getOriginator = getOriginator;
this.getLead = getLead;
this.getRouteType = getRouteType;
this.getIsCurrentSection = getIsCurrentSection;

function setTaskIDFunc (sTaskID) {
this.sItemTaskID = sTaskID;
}

function setTaskTypeFunc ( sTaskType ) {
this.sItemTaskType = sTaskType;
}

function setParentTaskID ( sParentTaskID ) {
this.sItemParentTaskID = sParentTaskID;
}

function setStatusFunc (sStatus) {
this.sItemStatus = sStatus;
}

function setOriginatorFunc (sOriginator) {
this.sItemOriginator = sOriginator;
}

function setLeadFunc (sLead) {
this.sItemLead = sLead;
}

function setRouteTypeFunc (sRouteType) {
this.sRouteType = sRouteType;
}

function setIsCurrentSectionFunc (sIsCurrentSection) {
this.sIsCurrentSection = sIsCurrentSection;
}

function getTaskID () {
return this.sItemTaskID;
}

function getTaskType () {
return this.sItemTaskType;
}

function getParentTaskID () {
return this.sItemParentTaskID;
}

function getStatus () {
return this.sItemStatus;
}

function getOriginator () {
return this.sItemOriginator;
}

function getLead () {
return this.sItemLead;
}

function getRouteType () {
return this.sRouteType;
}

function getIsCurrentSection () {
return this.sIsCurrentSection;
}

}

/* View Either A Comment Or A Task. */
function viewEntry() {
if(objSelectedItem!=null) {
if(objSelectedItem.getTaskType()==&quot;2&quot; || objSelectedItem.getTaskType()==&quot;3&quot;) viewComment();
else viewTask();
}
else alert(&quot;Please select a message to view&quot;);
}

/* View a particular task. */
function viewTask () {
if(objSelectedItem!=null) {

viewTaskWin = window.open(&quot;tasker.aspx?targetpage=taskform.aspx&amp;mode=ViewTask&amp;xsl=ViewTask&amp;TaskID=&quot; + objSelectedItem.getTaskID(), 'ViewTask');
viewTaskWin.focus();
}
}
function createPackage() {

newTaskWin = window.open(&quot;tasker.aspx?targetpage=taskform.aspx&amp;mode=newpackage&amp;xsl=newpackage&quot;, 'NewPackage');
newTaskWin.focus();
}

function createCoordination() {

newTaskWin = window.open(&quot;tasker.aspx?targetpage=taskform.aspx&amp;mode=newcoord&amp;xsl=newcoordination&quot;, 'NewCoordination');
newTaskWin.focus();
}

/* Open A New Window To Create A Task */
function createTask () {

newTaskWin = window.open(&quot;tasker.aspx?targetpage=taskform.aspx&amp;mode=newtask&amp;xsl=newtask&quot;, 'NewTask');
newTaskWin.focus();
}

/* Open A New Window To Create A Comment. */
function newComment() {
if(objSelectedItem==null || !objSelectedItem){
alert(&quot;Please select a message to comment on.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;recalled&quot;){
alert(&quot;This task has been recalled and no further work can be done on it until it is re-issued.&quot;);
return;
}

var h = 500;
var w = 855;
var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

commentWin = window.open('Comment.aspx?Mode=CommentTask&amp;TaskID='+objSelectedItem.getTaskID()+'&amp;TaskType=2&amp;ParentTaskID='+objSelectedItem.getTaskID(), 'NewComment', config='height='+h+',width='+w+',scrollbars=no,status=no,top='+TopPosition+',left='+LeftPosition);
commentWin.focus();
}

/* Open A New Window To View A Comment. */
function viewComment() {
if(objSelectedItem!=null){
var h = 500;
var w = 855;
var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

commentWin = window.open('Comment.aspx?mode=ViewComment&amp;TaskID='+objSelectedItem.getTaskID(), 'ViewComment', config='height='+h+',width='+w+',scrollbars=no,status=no,top='+TopPosition+',left='+LeftPosition);
commentWin.focus();
}
}


/* Open A New Window To Edit A User. */
function EditUser() {
var h = 475;
var w = 650;
var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

userWin = window.open('UserSectionMain.aspx?mode=EditUser', 'EditUser', config='height='+h+',width='+w+',scrollbars=no,resizable=yes,status=no,top='+TopPosition+',left='+LeftPosition);
userWin.focus();
}

/* Open A New Window To Amend A Task. */
function amendTask() {
if (sPageType == &quot;TaskViewComments&quot;)
{
initializeObjItem(parent.mainframe.document.all.taskAttributes);
}

if(objSelectedItem==null){
alert(&quot;Please select a message to amend.&quot;);
return;
}

if(objSelectedItem.getTaskType()!=1){
alert(&quot;Only Tasks can be amended.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;completed&quot;){
alert(&quot;Completed messages cannot be amended.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;closed&quot;){
alert(&quot;Closed messages cannot be amended.&quot;);
return;
}

if(objSelectedItem.getOriginator()!=&quot;2&quot;){
alert(&quot;Only the Originating Section can amend a message.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;recalled&quot;){
alert(&quot;To amend a recalled message use the reissue command.&quot;);
return;
}

var sMode = &quot;&quot;

switch(objSelectedItem.getTaskType()) {
case &quot;1&quot;:
sMode = &quot;amendtask&quot;;
break;
}

if(!commentWin || commentWin.closed) {
var h = 500;
var w = 855;
var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

commentWin = window.open('Comment.aspx?mode=' + sMode + '&amp;TaskID='+objSelectedItem.getTaskID()+'&amp;TaskType=3&amp;ParentTaskID='+objSelectedItem.getTaskID(), 'AmendTask', config='height='+h+',width='+w+',scrollbars=no,status=no,top='+TopPosition+',left='+LeftPosition);
commentWin.focus();
}
}

function encodeChars(strTemp) {
strTemp = strTemp.replace(/&/g,&quot;&amp;&quot;);
// strTemp = strTemp.replace(&quot;<&quot;, &quot;&lt;&quot;);
// strTemp = strTemp.replace(&quot;>&quot;, &quot;&gt;&quot;);
// strTemp = strTemp.replace(&quot;'&quot;, &quot;&apos;&quot;);
// strTemp = strTemp.replace(&quot;\&quot;&quot;, &quot;&quot;&quot;);
return strTemp;
}

/* Open A Window To Close A Task. */
function closeTask (){
if (sPageType == &quot;TaskViewComments&quot;)
{
initializeObjItem(parent.mainframe.document.all.taskAttributes);
}

if(objSelectedItem==null){
alert(&quot;Please select a message to close.&quot;);
return;
}

if(objSelectedItem.getTaskType()!=1 && objSelectedItem.getTaskType()!=4 && objSelectedItem.getTaskType()!=5){
alert(&quot;Please select a message to close.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;closed&quot;){
alert(&quot;This message is already closed.&quot;);
return;
}

if(objSelectedItem.getOriginator()!=&quot;2&quot;){
alert(&quot;Only the Originating Section can close a message.&quot;);
return;
}

var confirmClose = confirm(&quot;Are you sure you want to close this message?&quot;)
if(!confirmClose) {
return;
}

execScript(&quot;confirmNotify = MsgBox('Do you want to Notify sections that the message has been closed?', 4, 'Close Message')&quot;, &quot;vbscript&quot;)

if(confirmNotify==6) {
confirmNotify = &quot;true&quot;
}
else {
confirmNotify = &quot;false&quot;
}

var sMode = &quot;&quot;

switch(objSelectedItem.getTaskType()) {
case &quot;1&quot;:
sMode = &quot;closetask&quot;;
break;
case &quot;4&quot;:
sMode = &quot;closepackage&quot;;
break;
case &quot;5&quot;:
sMode = &quot;closecoord&quot;;
break;
}

/* subject is encoded for XSLT */
var XMLsubmit = &quot;<request> <taskid>&quot; + objSelectedItem.getTaskID() + &quot;</taskid> <mode>&quot; + sMode + &quot;</mode> <routetype>&quot; + objSelectedItem.getRouteType() + &quot;</routetype><subject>&quot; + encodeChars(GetXMLTaskAttribute(objSelectedItem.getTaskID(), &quot;subject&quot;)) + &quot;</subject><notify>&quot; + confirmNotify + &quot;</notify></request>&quot;;
var XMLpost = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);

XMLpost.open(&quot;POST&quot;, &quot;UpdateTaskStatus.aspx&quot;, false);
XMLpost.send(XMLsubmit);

var XMLresponse = XMLpost.ResponseXML;

XMLresponse.async = false;

try
{
var responseNode = XMLresponse.selectSingleNode(&quot;//message&quot;);
var message = responseNode.text;
}
catch (e)
{
alert(&quot;The application could not close the task.&quot;)
return
}


if(message != &quot;OK&quot;){
alert(&quot;Error closing message: &quot; + message);
return;
}
else {
alert(&quot;Message &quot; + objSelectedItem.getTaskID() + &quot; Closed.&quot;);
}


if(sPageType==&quot;TaskViewMain&quot;) {

NavigatePage(&quot;&quot;);
}
else {
parent.opener.parent.location.reload(false);
parent.window.close();
}
}

/* Open A Window To Return A Task. */
function returnTask() {
if (sPageType == &quot;TaskViewComments&quot;)
{
initializeObjItem(parent.mainframe.document.all.taskAttributes);
}

if(objSelectedItem==null){
alert(&quot;Please select a message to return.&quot;);
return;
}

if(objSelectedItem.getTaskType()!=1 && objSelectedItem.getTaskType()!=4){
alert(&quot;Only Tasks and Staff Packages can be Returned/Rejected.&quot;);
return;
}

if(objSelectedItem.getTaskType()==1 && objSelectedItem.getRouteType()==&quot;2&quot;){
alert(&quot;Only Parallel Routed tasks can be returned.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;completed&quot;){
alert(&quot;Completed messages cannot be returned.&quot;);
return;
}

if(objSelectedItem.getTaskType()==1 && objSelectedItem.getStatus().toLowerCase()==&quot;returned&quot;){
alert(&quot;The message has already been Returned.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;recalled&quot;){
alert(&quot;Recalled messages cannot be returned.&quot;);
return;
}

if(objSelectedItem.getTaskType()==1 && objSelectedItem.getLead()!=&quot;2&quot;){
alert(&quot;Only the Lead Section can return a task.&quot;);
return;
}

if(objSelectedItem.getTaskType()==4 && objSelectedItem.getIsCurrentSection()!=&quot;2&quot;){
alert(&quot;A staff package can only be rejected by the current approver.&quot;);
return;
}

var sMode = &quot;&quot;

switch(objSelectedItem.getTaskType()) {
case &quot;1&quot;:
sMode = &quot;returntask&quot;;
break;
case &quot;4&quot;:
sMode = &quot;rejectpackage&quot;;
break;
}

if(!commentWin || commentWin.closed) {
var h = 500;
var w = 855;
var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

commentWin = window.open('Comment.aspx?mode=' + sMode + '&amp;TaskID='+objSelectedItem.getTaskID()+'&amp;TaskType=2&amp;ParentTaskID='+objSelectedItem.getTaskID(), 'ReturnTask', config='height='+h+',width='+w+',scrollbars=no,status=no,top='+TopPosition+',left='+LeftPosition);
commentWin.focus();
}
}


/* Open A New Window To Route A Task. */
function routeTask() {
if (sPageType == &quot;TaskViewComments&quot;)
{
initializeObjItem(parent.mainframe.document.all.taskAttributes);
}

if(objSelectedItem==null){
alert(&quot;Please select a message to route.&quot;);
return;
}

if(objSelectedItem.getTaskType()!=1 && objSelectedItem.getTaskType()!=4){
alert(&quot;Only Tasks and Staff Packages can be Routed.&quot;);
return;
}

if(objSelectedItem.getTaskType()==1 && objSelectedItem.getRouteType()==&quot;1&quot;){
alert(&quot;Only Serial Routed tasks can be routed.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;completed&quot;){
alert(&quot;Completed messages cannot be routed.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;closed&quot;){
alert(&quot;Closed messages cannot be routed.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;recalled&quot;){
alert(&quot;Recalled messages cannot be routed.&quot;);
return;
}

if(objSelectedItem.getTaskType()==4){
if( objSelectedItem.getIsCurrentSection()!=&quot;2&quot;){
alert(&quot;a staff package can only be routed by the current approver.&quot;);
return;
}

if(GetXMLTaskAttribute(objSelectedItem.getTaskID(), &quot;packageapprover&quot;)==GetXMLSystemAttribute(&quot;usersectionid&quot;)){
alert(&quot;The package cannot be forwarded by the final approving section.&quot;);
return;
}
}

var sMode = &quot;&quot;

switch(objSelectedItem.getTaskType()) {
case &quot;1&quot;:
sMode = &quot;routetask&quot;;
break;
case &quot;4&quot;:
sMode = &quot;forwardpackage&quot;;
break;
}

if(!commentWin || commentWin.closed) {
var h = 500;
var w = 855;
var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

commentWin = window.open('Comment.aspx?mode=' + sMode + '&amp;TaskID='+objSelectedItem.getTaskID()+'&amp;TaskType=2&amp;ParentTaskID='+objSelectedItem.getTaskID(), 'RouteTask', config='height='+h+',width='+w+',scrollbars=no,status=no,top='+TopPosition+',left='+LeftPosition);
commentWin.focus();
}
}


/* Function To Recall A Task. */
function recallTask (ValidateRequest) {
confirmReissue = 0;

if (ValidateRequest)
{

if (sPageType == &quot;TaskViewComments&quot;)
{
initializeObjItem(parent.mainframe.document.all.taskAttributes);
}

if(objSelectedItem==null){
alert(&quot;Please select a message to recall.&quot;);
return;
}

if(objSelectedItem.getTaskType()!=1 && objSelectedItem.getTaskType()!=4 && objSelectedItem.getTaskType()!=5) {
alert(&quot;Please select a message to recall.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;completed&quot;){
alert(&quot;Completed or Approved messages cannot be recalled.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;closed&quot;){
alert(&quot;Closed messages cannot be recalled.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;returned&quot;){
alert(&quot;Returned or Rejected messages cannot be recalled.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;recalled&quot;){
alert(&quot;This message has already been recalled.&quot;);
return;
}

if(objSelectedItem.getOriginator()!=&quot;2&quot;){
alert(&quot;Only the Originating Section can recall a message.&quot;);
return;
}

var confirmClose = confirm(&quot;Are you sure you want to recall this message?&quot;);

if(!confirmClose) return;

execScript(&quot;confirmReissue = MsgBox('Do you want to reissue the message after it is recalled?', 4, 'Recall Task')&quot;, &quot;vbscript&quot;)
}

var sMode = &quot;&quot;

switch(objSelectedItem.getTaskType()) {
case &quot;1&quot;:
sMode = &quot;recalltask&quot;;
break;
case &quot;4&quot;:
sMode = &quot;recallpackage&quot;;
break;
case &quot;5&quot;:
sMode = &quot;recallcoord&quot;;
break;
}

var XMLsubmit = &quot;<request> <taskid>&quot; + objSelectedItem.getTaskID() + &quot;</taskid> <mode>&quot; + sMode + &quot;</mode> <routetype>&quot; + objSelectedItem.getRouteType() + &quot;</routetype><subject>&quot; + encodeChars(GetXMLTaskAttribute(objSelectedItem.getTaskID(), &quot;subject&quot;)) + &quot;</subject><notify>false</notify></request>&quot;;
var XMLpost = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);

XMLpost.open(&quot;POST&quot;, &quot;UpdateTaskStatus.aspx&quot;, false);
XMLpost.send(XMLsubmit);

var XMLresponse = XMLpost.ResponseXML;

XMLresponse.async = false;
try
{
var responseNode = XMLresponse.selectSingleNode(&quot;//message&quot;);
var message = responseNode.text;
}
catch (e)
{
alert(e)//(&quot;STACS could not recall the task.&quot;)
return
}

if(message != &quot;OK&quot;){
alert(&quot;Error Recalling Message: &quot; + message);
return;
}
else {
alert(&quot;Message &quot; + objSelectedItem.getTaskID() + &quot; Recalled.&quot;);
}


if(confirmReissue == 6) {
reissueTask(false);
}

if(ValidateRequest==true && confirmReissue!=6) {
if(sPageType==&quot;TaskViewMain&quot;) {

NavigatePage(&quot;&quot;);
}
else {
parent.opener.parent.location.reload(false);
parent.window.close();
}
}

}

/* Function To Approve a package. */
function approvePackage () {

if (sPageType == &quot;TaskViewComments&quot;)
{
initializeObjItem(parent.mainframe.document.all.taskAttributes);
}

if(objSelectedItem==null){
alert(&quot;Please select a package to approve.&quot;);
return;
}

if(objSelectedItem.getTaskType()!=4) {
alert(&quot;Please select a package to approve.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;completed&quot;){
alert(&quot;This package has already been approved.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;closed&quot;){
alert(&quot;Closed packages cannot be approved.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;returned&quot;){
alert(&quot;Rejected packages cannot be approved.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;recalled&quot;){
alert(&quot;Recalled packages cannot be approved.&quot;);
return;
}

if(GetXMLTaskAttribute(objSelectedItem.getTaskID(), &quot;packageapprover&quot;)!=GetXMLSystemAttribute(&quot;usersectionid&quot;)){
alert(&quot;Only the final approving section can approve a package.&quot;);
return;
}

var confirmClose = confirm(&quot;Are you sure you want to approve this package?&quot;);

if(!confirmClose) return;


var XMLsubmit = &quot;<request> <taskid>&quot; + objSelectedItem.getTaskID() + &quot;</taskid> <mode>approvepackage</mode> <routetype>&quot; + objSelectedItem.getRouteType() + &quot;</routetype><subject>&quot; + encodeChars(GetXMLTaskAttribute(objSelectedItem.getTaskID(), &quot;subject&quot;)) + &quot;</subject><notify>false</notify></request>&quot;;
var XMLpost = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);

XMLpost.open(&quot;POST&quot;, &quot;UpdateTaskStatus.aspx&quot;, false);
XMLpost.send(XMLsubmit);

var XMLresponse = XMLpost.ResponseXML;

XMLresponse.async = false;
try
{
var responseNode = XMLresponse.selectSingleNode(&quot;//message&quot;);
var message = responseNode.text;
}
catch (e)
{
alert(e)//(&quot;STACS could not approve the task.&quot;)
return
}

if(message != &quot;OK&quot;){
alert(&quot;Error approving Package: &quot; + message);
return;
}
else {
alert(&quot;Package &quot; + objSelectedItem.getTaskID() + &quot; Approved.&quot;);
}


if(sPageType==&quot;TaskViewMain&quot;) {

NavigatePage(&quot;&quot;);
}
else {
parent.opener.parent.location.reload(false);
parent.window.close();
}
}


function answerPackage () {

var xmlData = document.XMLDocument;
var filterNode, filterValue, answerFunc, confirmMessage;

filterNode = xmlData.selectSingleNode(&quot;/root/search&quot;);
filterValue = filterNode.getAttribute(&quot;Filter&quot;);


if (filterValue != &quot;answered&quot;){

answerFunc = &quot;answerpackage&quot;;
confirmMessage = &quot;to&quot;;
}else{

answerFunc = &quot;unanswerpackage&quot;;
confirmMessage = &quot;from&quot;;
}

if (sPageType == &quot;TaskViewComments&quot;)
{
initializeObjItem(parent.mainframe.document.all.taskAttributes);
}

if(objSelectedItem==null){
alert(&quot;Please select a package to mark answered.&quot;);
return;
}

if(objSelectedItem.getTaskType()!=4){
alert(&quot;Please select a package to mark answered.&quot;);
return;
}

//if(objSelectedItem.getStatus().toLowerCase()==&quot;completed&quot;){
//alert(&quot;Completed tasks cannot be completed.&quot;);
//return;
//}

if(objSelectedItem.sItemOriginator == &quot;2&quot;){
alert(&quot;The issuing section cannot answer a package.\nYou must close it to remove it.&quot;);
return;
}

var XMLsubmit = &quot;<request><taskid>&quot; + objSelectedItem.getTaskID() + &quot;</taskid><routetype>&quot; + objSelectedItem.getRouteType() + &quot;</routetype><subject>&quot; + encodeChars(GetXMLTaskAttribute(objSelectedItem.getTaskID(), &quot;subject&quot;)) + &quot;</subject><notify>false</notify><mode>&quot; + answerFunc + &quot;</mode></request>&quot;;
var XMLpost = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);

XMLpost.open(&quot;POST&quot;, &quot;UpdateTaskStatus.aspx&quot;, false);
XMLpost.send(XMLsubmit);

var XMLresponse = XMLpost.ResponseXML;

XMLresponse.async = false;
try
{
var responseNode = XMLresponse.selectSingleNode(&quot;//message&quot;);
var message = responseNode.text;
}
catch (e)
{
alert(e)
return
}

if(message != &quot;OK&quot;){
alert(&quot;Error answering package: &quot; + message);
return;
}
else {
alert(&quot;Package &quot; + objSelectedItem.sItemTaskID + &quot; has been moved &quot; + confirmMessage + &quot; the answered list.&quot;);
}


if(sPageType==&quot;TaskViewMain&quot;) {

parent.location.reload(false);
}
else {
parent.opener.parent.location.reload(false);
parent.window.close();
}



/*
if(objSelectedItem.getRouteType()==&quot;2&quot;){
alert(&quot;Only Parallel Routed tasks can be completed.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;completed&quot;){
alert(&quot;Completed tasks cannot be completed.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;closed&quot;){
alert(&quot;Closed tasks cannot be completed.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;returned&quot;){
alert(&quot;Returned tasks cannot be completed.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;recalled&quot;){
alert(&quot;Recalled tasks cannot be completed.&quot;);
return;
}



var h = 500;
var w = 855;
var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;


commentWin = window.open('Comment.aspx?mode=completeTask&amp;TaskID='+objSelectedItem.getTaskID()+'&amp;TaskType=2&amp;ParentTaskID='+objSelectedItem.getTaskID(), 'CompleteTask', config='height='+h+',width='+w+',scrollbars=no,status=no,top='+TopPosition+',left='+LeftPosition);
commentWin.focus();
*/
}

/* ReIssue A Task. */
function reissueTask(ValidateRequest) {
var confirmRecall = false

if (ValidateRequest)
{
if (sPageType == &quot;TaskViewComments&quot;)
{
initializeObjItem(parent.mainframe.document.all.taskAttributes);
}

if(objSelectedItem==null){
alert(&quot;Please select a message to reissue.&quot;);
return;
}

if(objSelectedItem.getTaskType()!=1 && objSelectedItem.getTaskType()!=4 && objSelectedItem.getTaskType()!=5){
alert(&quot;Please select a message to reissue.&quot;);
return;
}

if(objSelectedItem.getOriginator()!=&quot;2&quot;){
alert(&quot;Only the Originating Section can reissue a message.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()!=&quot;recalled&quot; && objSelectedItem.getStatus().toLowerCase()!=&quot;returned&quot; && objSelectedItem.getStatus().toLowerCase()!=&quot;closed&quot;){
var confirmRecall = confirm(&quot;The selected message will be recalled and a new message will be issued. Do you want to continue?&quot;);
if(confirmRecall==true){
recallTask(false);
}
else {
return
}
}
}

var sMode = &quot;&quot;
var sXSL = &quot;&quot;

switch(objSelectedItem.getTaskType()) {
case &quot;1&quot;:
sMode = &quot;reissuetask&quot;;
sXSL = &quot;newtask&quot;;
break;
case &quot;4&quot;:
sMode = &quot;reissuepackage&quot;;
sXSL = &quot;newpackage&quot;;
break;
case &quot;5&quot;:
sMode = &quot;reissuecoord&quot;;
sXSL = &quot;newcoordination&quot;;
break;
}

if(sPageType==&quot;TaskViewMain&quot;) {
newTaskWin = window.open(&quot;tasker.aspx?targetpage=taskform.aspx&amp;mode=&quot; + sMode + &quot;&amp;xsl=&quot; + sXSL + &quot;&amp;TaskID=&quot; + objSelectedItem.getTaskID(), 'ReissueTask');
newTaskWin.focus();
}
else {
parent.window.navigate(&quot;tasker.aspx?targetpage=taskform.aspx&amp;mode=&quot; + sMode + &quot;&amp;xsl=&quot; + sXSL + &quot;&amp;TaskID=&quot; + objSelectedItem.getTaskID())

}
}

/* Mark A Task As Completed */
function completeTask() {
if (sPageType == &quot;TaskViewComments&quot;)
{
initializeObjItem(parent.mainframe.document.all.taskAttributes);
}

if(objSelectedItem==null){
alert(&quot;Please select a task to complete.&quot;);
return;
}

if(objSelectedItem.getTaskType()!=1){
alert(&quot;Please select a task to complete.&quot;);
return;
}

if(objSelectedItem.getRouteType()==&quot;2&quot;){
alert(&quot;Only Parallel Routed tasks can be completed.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;completed&quot;){
alert(&quot;Completed tasks cannot be completed.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;closed&quot;){
alert(&quot;Closed tasks cannot be completed.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;returned&quot;){
alert(&quot;Returned tasks cannot be completed.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;recalled&quot;){
alert(&quot;Recalled tasks cannot be completed.&quot;);
return;
}

if(objSelectedItem.getLead()!=&quot;2&quot;){
alert(&quot;Only the Lead Section can complete a task.&quot;);
return;
}

var h = 500;
var w = 855;
var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;


commentWin = window.open('Comment.aspx?mode=completeTask&amp;TaskID='+objSelectedItem.getTaskID()+'&amp;TaskType=2&amp;ParentTaskID='+objSelectedItem.getTaskID(), 'CompleteTask', config='height='+h+',width='+w+',scrollbars=no,status=no,top='+TopPosition+',left='+LeftPosition);
commentWin.focus();
}


/* Create new task as a copy of this task with this task as the parent */
function subTask() {

if (sPageType == &quot;TaskViewComments&quot;)
{
initializeObjItem(parent.mainframe.document.all.taskAttributes);
}

if(objSelectedItem==null){
alert(&quot;Please select a task to sub-task from.&quot;);
return;
}

if(objSelectedItem.getTaskType()!=1 && objSelectedItem.getTaskType()!=4 && objSelectedItem.getTaskType()!=5){
alert(&quot;Only tasks, coordinations and staff packages can be sub-tasked&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;completed&quot;){
alert(&quot;Completed messages cannot be sub-tasked.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;closed&quot;){
alert(&quot;Closed messages cannot be sub-tasked.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;returned&quot;){
alert(&quot;Returned/Recalled messages cannot be sub-tasked.&quot;);
return;
}

if(objSelectedItem.getOriginator()==&quot;2&quot;){
alert(&quot;The Originating Section cannot sub-task a message.&quot;);
return;
}

var h = 350;
var w = 550;
var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

newTaskWin = window.open(&quot;tasker.aspx?targetpage=taskform.aspx&amp;mode=subtask&amp;xsl=newtask&amp;TaskID=&quot; + objSelectedItem.getTaskID(), 'SubTask');
newTaskWin.focus();

}

/* Convert a task to a staff package */
function convertToTask() {

if (sPageType == &quot;TaskViewComments&quot;)
{
initializeObjItem(parent.mainframe.document.all.taskAttributes);
}

if(objSelectedItem==null){
alert(&quot;Please select a package to convert.&quot;);
return;
}

if(objSelectedItem.getTaskType()!=4){
alert(&quot;Only staff packages can be converted into tasks.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;completed&quot;){
alert(&quot;Approved packages cannot be converted.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;closed&quot;){
alert(&quot;Closed packages cannot be converted.&quot;);
return;
}

if(objSelectedItem.getStatus().toLowerCase()==&quot;returned&quot;){
alert(&quot;Returned/Recalled packages cannot be converted.&quot;);
return;
}

if(objSelectedItem.getOriginator()==&quot;2&quot;){
alert(&quot;The Originating Section cannot convert a package.&quot;);
return;
}

if( objSelectedItem.getIsCurrentSection()!=&quot;2&quot;){
alert(&quot;a staff package can only be converted by the current approver.&quot;);
return;
}
/* Commented out per NORTHCOM request 6-5-03
if(GetXMLTaskAttribute(objSelectedItem.getTaskID(), &quot;packageapprover&quot;)==GetXMLSystemAttribute(&quot;usersectionid&quot;)){
alert(&quot;The package cannot be converted by the final approving section.&quot;);
return;
}
*/
var h = 350;
var w = 550;
var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

newTaskWin = window.open(&quot;tasker.aspx?targetpage=taskform.aspx&amp;mode=converttotask&amp;xsl=newtask&amp;TaskID=&quot; + objSelectedItem.getTaskID(), 'SubTask');
newTaskWin.focus();

}
function HelpAbout() {
var h = 300;
var w = 300;
var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

window.open('MsgHandler.aspx?Mode=information&Msg=Tasking Management System v. 2.0', 'HelpAbout', config='height='+h+',width='+w+',resizable=no,top='+TopPosition+',left='+LeftPosition);
}

function ShowPreferences() {

var h = 200;
var w = 400;
var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

window.open('Preferences.aspx', 'winPref', config='height='+h+',width='+w+',resizable=no,top='+TopPosition+',left='+LeftPosition);

}

function OutlookExport(ExportType, ExportTaskID) {
//window.event.cancelBubble = true;

if(objSelectedItem==null && ExportTaskID == &quot;&quot;){
alert(&quot;Please select a task to export to Outlook&quot;);
return;
}

if(objSelectedItem.getTaskType()!=1){
alert(&quot;Please select a task to export to Outlook&quot;);
return;
}

if (ExportTaskID == &quot;&quot;)
{
ExportTaskID = objSelectedItem.getTaskID()
}

var strSubject = GetXMLTaskAttribute(ExportTaskID, &quot;subject&quot;)
var strStartDate = GetXMLTaskAttribute(ExportTaskID, &quot;dateissued&quot;)
var strEndDate = GetXMLTaskAttribute(ExportTaskID, &quot;datedue&quot;)
var strLink = GetXMLSystemAttribute(&quot;linkURL&quot;) + ExportTaskID
var strSection = GetXMLSystemAttribute(&quot;usersectionname&quot;)
var strOriginator = GetXMLTaskAttribute(ExportTaskID, &quot;originator&quot;)
var strLead = GetXMLTaskAttribute(ExportTaskID, &quot;lead&quot;)
var strRole = &quot;&quot;

if(strOriginator.indexOf(strSection) > -1) {
strRole = &quot;Originator&quot;
}
else {
if(strLead.indexOf(strSection) > -1) {
strRole = &quot;Lead&quot;
}
else {
strRole = &quot;Support&quot;
}
}

var strRouteType = GetXMLTaskAttribute(ExportTaskID, &quot;routetype&quot;)
if (strRouteType == &quot;1&quot;)
{
strRouteType = &quot;Parallel&quot;
}
else
{
strRouteType = &quot;Serial&quot;
}

var strCategories = strRole + &quot;, &quot; + strRouteType

if(ExportType ==&quot;cal&quot;) {

ExportToCalendar(strSubject, strStartDate, strEndDate, strLink, strCategories, true)

}

if(ExportType ==&quot;task&quot;) {

ExportToTasks(strSubject, strStartDate, strEndDate, strLink, strCategories, true)

}

}

function GetXMLTaskAttribute(TaskID, AttributeName) {
// **** Build my xpath to identify the current node in xml
var Xpath = &quot;//task[@taskid = '&quot; + TaskID + &quot;']&quot;;
var selectedNode = window.document.XMLDocument.selectSingleNode (Xpath);
var AttributeValue = selectedNode.getAttribute(AttributeName)


return AttributeValue
}

function GetXMLSystemAttribute(AttributeName) {
// **** Build my xpath to identify the current node in xml
var Xpath = &quot;//system&quot;;
var selectedNode = window.document.XMLDocument.selectSingleNode (Xpath);
var AttributeValue = selectedNode.getAttribute(AttributeName)


return AttributeValue
}

function NavigatePage(TargetPage) {
//alert(SearchQueryString())

if (TargetPage==&quot;&quot;)
{
var Xpath = &quot;//pages&quot;;
var selectedNode = window.document.XMLDocument.selectSingleNode (Xpath);
TargetPage = selectedNode.getAttribute(&quot;current&quot;)
}

parent.window.navigate(&quot;Main.aspx?TargetPage=TaskView.aspx&Page=&quot; + TargetPage + SearchQueryString())

}


function FilterTasks(FilterType) {

if (FilterType==&quot;&quot;)
{
parent.window.navigate(&quot;Main.aspx?TargetPage=TaskView.aspx&quot;)

}
else {
parent.window.navigate(&quot;Main.aspx?TargetPage=TaskView.aspx&Filter=&quot; + FilterType)
}
}

function SearchQueryString() {
var Xpath = &quot;//search&quot;;
var selectedNode = window.document.XMLDocument.selectSingleNode (Xpath);

var strQS = &quot;&ddSearchFields=&quot; + selectedNode.getAttribute(&quot;ddSearchFields&quot;) + &quot;&&quot;
strQS += &quot;Filter=&quot; + selectedNode.getAttribute(&quot;Filter&quot;) + &quot;&&quot;
strQS += &quot;txtSearchString=&quot; + selectedNode.getAttribute(&quot;txtSearchString&quot;) + &quot;&&quot;
strQS += &quot;txtDateCreatedFrom=&quot; + selectedNode.getAttribute(&quot;txtDateCreatedFrom&quot;) + &quot;&&quot;
strQS += &quot;txtDateCreatedTo=&quot; + selectedNode.getAttribute(&quot;txtDateCreatedTo&quot;) + &quot;&&quot;
strQS += &quot;txtDateDueTo=&quot; + selectedNode.getAttribute(&quot;txtDateDueTo&quot;) + &quot;&&quot;
strQS += &quot;txtAuthor=&quot; + selectedNode.getAttribute(&quot;txtAuthor&quot;) + &quot;&&quot;
strQS += &quot;txtSubject=&quot;+ selectedNode.getAttribute(&quot;txtSubject&quot;) + &quot;&&quot;
strQS += &quot;txtRemarks=&quot; + selectedNode.getAttribute(&quot;txtRemarks&quot;) + &quot;&&quot;
strQS += &quot;txtFromSection=&quot; + selectedNode.getAttribute(&quot;txtFromSection&quot;) + &quot;&&quot;
strQS += &quot;txtAssignedToSection=&quot; + selectedNode.getAttribute(&quot;txtAssignedToSection&quot;) + &quot;&&quot;
strQS += &quot;txtTaskID=&quot; + selectedNode.getAttribute(&quot;txtTaskID&quot;) + &quot;&&quot;
strQS += &quot;txtLegacyTaskID=&quot; + selectedNode.getAttribute(&quot;txtLegacyTaskID&quot;) + &quot;&&quot;
strQS += &quot;txtAttachmentName=&quot; + selectedNode.getAttribute(&quot;txtAttachmentName&quot;) + &quot;&&quot;
strQS += &quot;searchType=&quot; + selectedNode.getAttribute(&quot;searchType&quot;) + &quot;&&quot;
strQS += &quot;cbSearchedClosed=&quot; + selectedNode.getAttribute(&quot;cbSearchedClosed&quot;)
return strQS

}
 
I have taken you code and implemented it instead of the other example. I believe I am closer, but I am having difficulty because the source code uses XML instead of html. Do you have the same example using XML?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top