Location: PHPKode > projects > Decider > decider/Discussion/forum.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><link rel="stylesheet" type="text/css" href="../common/styles.css" />
<script language="javascript">
//Ajax stuff here
function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		alert("Your Browser Sucks!\nIt's about time to upgrade don't you think?");
	}
}
//----------------------------------------------------

//----------------------------------------------------
var select_clientkp_req = getXmlHttpRequestObject();


function select_client_kp(txt) {
	//alert(txt);
if (select_clientkp_req.readyState == 4 ||select_clientkp_req.readyState == 0) {
		var str = escape(txt);
						
		select_clientkp_req.open("GET",'selectkp.php?client=' + str, true);
		select_clientkp_req.onreadystatechange = handleselect_clientkp; 
		select_clientkp_req.send(null);
		
		//alert(str);
		//document.getElementById("org").innerHTML="akila";	
	}		
}

function handleselect_clientkp() {

	if (select_clientkp_req.readyState == 4) {
		str=select_clientkp_req.responseText;
		//alert(str);
		 document.getElementById("kpName").innerHTML=str;		 
	}
}
//end of key person name handeling

var select_clientdesig_req = getXmlHttpRequestObject();
function select_designation(txt){
	if (select_clientdesig_req.readyState == 4 ||select_clientdesig_req.readyState == 0) {
		var str1 = escape(txt);
						//alert(txt);
		select_clientdesig_req.open("GET",'selectkpdesi.php?kp=' + str1, true);
		select_clientdesig_req.onreadystatechange = handleselect_kpdesig; 
		select_clientdesig_req.send(null);
		
	}		
}

function handleselect_kpdesig() {

	if (select_clientdesig_req.readyState == 4) {
			str=select_clientdesig_req.responseText;
		 document.getElementById("designation").value=str;		 
	}
}
//end of handling kp and their disignation.
//start of answer view....

var select_answerview_req = getXmlHttpRequestObject();

function select_answerview(txt){
	if (select_answerview_req.readyState == 4 ||select_answerview_req.readyState == 0) {
		var str2 = escape(txt);
		//alert("hello");
		//alert(txt);
		select_answerview_req.open("GET",'selectans.php?kp=' + str2, true);
		select_answerview_req.onreadystatechange = handleselect_ans; 
		select_answerview_req.send(null);
	}		
}

function handleselect_ans(){

	if (select_answerview_req.readyState == 4) {

		str=select_answerview_req.responseText;
		
		 document.getElementById("viewans").innerHTML=str;			 
	}

}
//end of answer view

//start of forum view
var select_forumview_req = getXmlHttpRequestObject();

function select_feedback(txt){
	if (select_forumview_req.readyState == 4 ||select_forumview_req.readyState == 0) {
		var str3 = escape(txt);
						//alert(txt);
		select_forumview_req.open("GET",'selectforum.php?client=' + str3, true);
		select_forumview_req.onreadystatechange = handleselect_feedback; 
		select_forumview_req.send(null);
		
	}		

}

function handleselect_feedback(){
	if (select_forumview_req.readyState == 4) {
		str=select_forumview_req.responseText;
		document.getElementById("feedbackview").innerHTML=str;			
		//alert("my response"+str); 
	}

}
//end of forum view

//-------------------------------
//this is a ajax part of changing comments
var add_comment_req = getXmlHttpRequestObject();

function insertconmment(txt){

	//alert(txt);
	if (add_comment_req.readyState == 4 ||add_comment_req.readyState == 0) {
		var str3 = escape(txt);
		var str4=document.getElementById("client").value;	
		//alert(str3 + str4)			
		add_comment_req.open("GET",'insertcomment.php?forum_field='+ str3 + '&client='+ str4, true);
		add_comment_req.onreadystatechange = handle_change; 
		add_comment_req.send(null);
		
	}		

}

function handle_change(){
	
	if (add_comment_req.readyState == 4) {
		str=add_comment_req.responseText;
		//alert(str);
		document.getElementById("forum_field").value='';
		document.getElementById("feedbackview").innerHTML=str;			
		//alert("my response"+str); 
	}

}


//---------------------------------
/*



*/
var clientval = getXmlHttpRequestObject();
/*
function set_client(txt){
	if (clientval.readyState == 4 ||clientval.readyState == 0) {
		var str = escape(txt);
		//alert(txt);
		clientval.open("GET",'client.php?clientname=' + str, true);
		clientval.onreadystatechange = handle_client; 
		clientval.send(null);
		
	}		
}

function handle_client(){
	if (clientval.readyState == 4) {
		str=clientval.responseText;
		//alert(str);
		document.getElementById("org1").value=str;			 
	}
}
*/

</script>
<!-- help code-->
<script language="javascript">
var id;
var txtname;
function handleSearchSuggest(txt) {
var str;

			id=txt;
			txtname=txt;		
			var ss = document.getElementById("help");
			ss.innerHTML = '';
			if(id=="discussionhelp"){
		    str = "This is very vital section in this application. Analyst can view other analyst’s comments, feed backs, etc. also he can put his comment, feed backs etc using answers given by key persons.";
			}
			
			var suggest = '<div onmouseover="javascript:helpOver(this);" ';
			suggest += 'onmouseout="javascript:helpOut(this);" ';
			suggest += 'onclick="javascript:closeBox(this.innerHTML);" ';
			suggest += 'class="suggest_link">'+ str + '</div>';
			ss.innerHTML += suggest;
			}

//Mouse over function
function helpOver(div_value) {
	div_value.className = 'help_over';
}
//Mouse out function
function helpOut(div_value) {
	div_value.className = 'help_out';
}
//Click function
function closeBox(value) {
	document.getElementById("help").innerHTML = '';
}

</script>
</head>

<body>

<div class="topic">Discussion View</div>
<form action="forumtab.php" method="post" id="forum">

<!-- <input type="hidden" id="org" name="org" value="">
<input type="text" id="org1" name="org1" class="select" disabled value="" > -->

<table>

	<tr><td align="center" height="40" width="10"></td> </tr>

	<tr><td class="label">Organization Name</td><td>

<select id="client"  name="client" class="select" onChange="javascript:select_client_kp(this.value),select_feedback(this.value); " >
	<option>-select-</option>
		<?php
		require("../common/database.php");
		 $result = mysql_query( "SELECT Name FROM client");
			 while($row=mysql_fetch_array($result)){
			 	?>
				<option value="<?php echo $row['Name']?>"><?php echo $row['Name']?></option>
				
				<?
			 }
			 
			?>
	</select>

</td><td><img src="../common/HelpIcon.gif" height="30" width="30" type="" name="Submit"  id="discussionhelp" onClick="handleSearchSuggest(this.id)" class="pointer"><div id="help" class="length" > </div>
</td></tr>
<tr><td class="label">Person Name:</td><td>
<select id="kpName" name="kpName" class="select" onChange="javascript:select_designation(this.value),select_answerview(this.value);">
<option value="">-select-</option>
</select></td><tr><td class="label">Designation:</td><td>
<input type="text" id="designation" name="designation" class="textbox1" disabled value="" >
</td></tr>

</table>
<br/>
<div class="topic">Answer View </div>
<table id="viewans" class="label"></table>

<form action="" method="post" id="forum">
<br />
<div class="topic">Analysts Feedback</div>
<table border=1 id="feedbackview" class="label"></table>

<br />
<div class="topic">Add Comments </div>
<textarea name="forum_field", id="forum_field" cols="50" rows="10" class="textboxarea2"></textarea>

<label></label>
<table>
<tr><td>
<input type="button" onClick="javascript:insertconmment(forum_field.value);" name="ADD" value="    Add    " id="ADD" class="button">
</td><td>
<input type="reset" name="reset" value="Reset" class="button">
</td></tr>
</table>
</form>

</form>

</body>
</html>
Return current item: Decider