Difference between revisions of "AJAX Names"

From WolfTech
Jump to navigation Jump to search
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
To use the AJAX Names lookup utility ( as seen on http://www.wolftech.ncsu.edu/lookup/ )
 
To use the AJAX Names lookup utility ( as seen on http://www.wolftech.ncsu.edu/lookup/ )
 +
 +
You first need to create a file named "'''names_redirect.php'''". This file forwards requests by the AJAXnames tools back to the WolfTech scripts that generate the user lists.
 +
 +
"'''names_redirect.php'''" should consist of only the following code:
 +
 +
<pre><nowiki><?php
 +
header("Content-Type: text/xml");
 +
// Refer back to the WolfTech Employees file, which will always be the most accurate
 +
echo file_get_contents("http://www.wolftech.ncsu.edu/includes/AJAXnames/names_employees.php?{$_SERVER['QUERY_STRING']}");
 +
exit;
 +
?></nowiki></pre>
 +
 +
'''Note:''' This file needs to be placed web accessible location within the same domain as the page that will be holding the HTML code you'll be adding below.
 +
 +
----
  
 
You need to add the following lines of code to your page:
 
You need to add the following lines of code to your page:
  
<nowiki>
+
<pre><nowiki><link rel="stylesheet" href="http://www.wolftech.ncsu.edu/includes/AJAXnames/AJAXnames.css" type="text/css"></link></nowiki>
<link rel="stylesheet" href="http://www.wolftech.ncsu.edu/includes/AJAXnames/AJAXnames.css" type="text/css"></link></nowiki>
 
  
<nowiki><script type="text/javascript" src="http://www.wolftech.ncsu.edu/includes/AJAXnames/name_search.js"></script></nowiki>
+
<nowiki><script type="text/javascript" src="http://www.wolftech.ncsu.edu/includes/AJAXnames/name_search.js"></script></nowiki></pre>
  
 
----
 
----
Line 14: Line 28:
 
'''Unity ID Lookup'''
 
'''Unity ID Lookup'''
  
<pre><nowiki><input type="text" name="UnityID" id="UnityID" onkeyup="searchBox(event, this, 0, 'searchResults', 'U','Employees');" value="" size="8" autocomplete="off" /><br />
+
<pre><nowiki><input type="text" name="UnityID" id="UnityID" onkeyup="searchBox(event, this, 0, 'searchResults', 'U','', '!!!PATH TO names_redirect.php!!!');" value="" size="8" autocomplete="off" /><br />
 
<div id="searchResults" class="searchResults" style="position: absolute; display: none; width: 300px; border: 1px solid black; background-color: white;"></div></nowiki></pre>
 
<div id="searchResults" class="searchResults" style="position: absolute; display: none; width: 300px; border: 1px solid black; background-color: white;"></div></nowiki></pre>
  
Line 20: Line 34:
 
'''Last Name, First Name Lookup'''
 
'''Last Name, First Name Lookup'''
  
<nowiki><input type="text" name="userLookup" id="userLookup" onkeyup="searchBox(event, this, 0, 'lookupResults','N','UnityID','Employees');" value="" size="20" autocomplete="off" /><br />
+
<pre><nowiki><input type="text" name="userLookup" id="userLookup" onkeyup="searchBox(event, this, 0, 'lookupResults','N','UnityID','!!!PATH TO names_redirect.php!!!');" value="" size="20" autocomplete="off" /><br />
<div id="lookupResults" class="searchResults" style="position: absolute; display: none; width: 300px; border: 1px solid black; background-color: white;"></div></nowiki>
+
<div id="lookupResults" class="searchResults" style="position: absolute; display: none; width: 300px; border: 1px solid black; background-color: white;"></div></nowiki></pre>
 +
 
 +
'''Note:''' Replace the text '''!!!PATH TO names_redirect.php!!!''' in the above code with the web path to the '''names_redirect.php''' file you created. If the file is in the same directory as the file you are editing the HTML in, use '''./'''

Latest revision as of 14:07, 20 August 2007

To use the AJAX Names lookup utility ( as seen on http://www.wolftech.ncsu.edu/lookup/ )

You first need to create a file named "names_redirect.php". This file forwards requests by the AJAXnames tools back to the WolfTech scripts that generate the user lists.

"names_redirect.php" should consist of only the following code:

<?php
header("Content-Type: text/xml");
// Refer back to the WolfTech Employees file, which will always be the most accurate
echo file_get_contents("http://www.wolftech.ncsu.edu/includes/AJAXnames/names_employees.php?{$_SERVER['QUERY_STRING']}");
exit;
?>

Note: This file needs to be placed web accessible location within the same domain as the page that will be holding the HTML code you'll be adding below.


You need to add the following lines of code to your page:

<link rel="stylesheet" href="http://www.wolftech.ncsu.edu/includes/AJAXnames/AJAXnames.css" type="text/css"></link>

<script type="text/javascript" src="http://www.wolftech.ncsu.edu/includes/AJAXnames/name_search.js"></script>

Then for the two dropdown boxes, insert the following code:

Unity ID Lookup

<input type="text" name="UnityID" id="UnityID" onkeyup="searchBox(event, this, 0, 'searchResults', 'U','', '!!!PATH TO names_redirect.php!!!');" value="" size="8" autocomplete="off" /><br />
<div id="searchResults" class="searchResults" style="position: absolute; display: none; width: 300px; border: 1px solid black; background-color: white;"></div>


Last Name, First Name Lookup

<input type="text" name="userLookup" id="userLookup" onkeyup="searchBox(event, this, 0, 'lookupResults','N','UnityID','!!!PATH TO names_redirect.php!!!');" value="" size="20" autocomplete="off" /><br />
<div id="lookupResults" class="searchResults" style="position: absolute; display: none; width: 300px; border: 1px solid black; background-color: white;"></div>

Note: Replace the text !!!PATH TO names_redirect.php!!! in the above code with the web path to the names_redirect.php file you created. If the file is in the same directory as the file you are editing the HTML in, use ./