Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function() {
- function formatResults(item){
- if(item.currentRotation == "1st"){
- currLocation = item.firstRotationLocation;
- offset = item.firstRotationAL.substring(item.firstRotationAL.indexOf("PERSON_ID")+14,item.firstRotationAL.indexOf("',FIRST_NAME"));
- offset = offset.length+3;
- currAL = item.firstRotationAL
- .substring(item.firstRotationAL.indexOf("PERSON_ID"),item.firstRotationAL.indexOf("size"));
- currAL = currAL.split("'");
- currAL[0] = item.firstRotationAL.substring(item.firstRotationAL.indexOf("id=")+offset,item.firstRotationAL.indexOf("id=")+offset+9);
- currAL = currAL[5] + ", " + currAL[3] + " (" + currAL[0] + ")";
- latlong = item.firstlatlong;
- }
- else if(item.currentRotation == "2nd"){
- currLocation = item.secondRotationLocation
- offset = item.secondRotationAL.substring(item.secondRotationAL.indexOf("PERSON_ID")+14,item.secondRotationAL.indexOf("',FIRST_NAME"));
- offset = offset.length+3;
- currAL = item.secondRotationAL
- .substring(item.secondRotationAL.indexOf("PERSON_ID"),item.secondRotationAL.indexOf("size"));
- currAL = currAL.split("'");
- currAL[0] = item.secondRotationAL.substring(item.secondRotationAL.indexOf("id=")+offset,item.secondRotationAL.indexOf("id=")+offset+9);
- currAL = currAL[5] + ", " + currAL[3] + " (" + currAL[0] + ")";
- latlong = item.secondlatlong;
- }
- else if(item.currentRotation == "3rd"){
- currLocation = item.thirdRotationLocation
- offset = item.thirdRotationAL.substring(item.thirdRotationAL.indexOf("PERSON_ID")+14,item.thirdRotationAL.indexOf("',FIRST_NAME"));
- offset = offset.length+3;
- currAL = item.thirdRotationAL
- .substring(item.thirdRotationAL.indexOf("PERSON_ID"),item.thirdRotationAL.indexOf("size"));
- currAL = currAL.split("'");
- currAL[0] = item.thirdRotationAL.substring(item.thirdRotationAL.indexOf("id=")+offset,item.thirdRotationAL.indexOf("id=")+offset+9);
- currAL = currAL[5] + ", " + currAL[3] + " (" + currAL[0] + ")";
- latlong = item.thirdlatlong;
- }
- else if(item.currentRotation == "4th"){
- currLocation = item.fourthRotationLocation
- offset = item.fourthRotationAL.substring(item.fourthRotationAL.indexOf("PERSON_ID")+14,item.fourthRotationAL.indexOf("',FIRST_NAME"));
- offset = offset.length+3;
- currAL = item.fourthRotationAL
- .substring(item.fourthRotationAL.indexOf("PERSON_ID"),item.fourthRotationAL.indexOf("size"));
- currAL = currAL.split("'");
- currAL[0] = item.fourthRotationAL.substring(item.fourthRotationAL.indexOf("id=")+offset,item.fourthRotationAL.indexOf("id=")+offset+9);
- currAL = currAL[5] + ", " + currAL[3] + " (" + currAL[0] + ")";
- latlong = item.fourthlatlong;
- }
- else{ currLocation = "Location information not available"
- alert(item.toString());
- };
- };
- $("#_results").focus(function() {
- if(!($(this).val()=="Loading....Please wait")){
- $(this).val("");
- }
- });
- $("#_results").blur(function() {
- if($(this).val()=="") {
- $(this).val("Search by Name, Location, Project or Keyword");
- }
- });
- var currLocation = "";
- var currAL = "";
- var imlpName = "";
- var offset = "";
- var latlong = "";
- function log(message) {
- $("<div/>").text(message).appendTo("#log");
- $("#log").attr("scrollTop", 0);
- }
- $("#_results").addClass( "ui-autocomplete-loading" );
- $("#_results").val( "Loading....Please wait" );
- $.ajax({
- url: "sup_dataform_viewall.asp.xml",
- dataType: "xml",
- success: function(xmlResponse) {
- var data = $("ROW", xmlResponse).map(function() {
- return {
- value: $("SC_DF_FIELD_35", this).text().replace(/ /g,"").substring($("SC_DF_FIELD_35", this).text().indexOf("FIRST_NAME")+15,$("SC_DF_FIELD_35", this).text().indexOf("LAST_NAME")-2) + " " + $("SC_DF_FIELD_35", this).text().replace(/ /g,"").substring($("SC_DF_FIELD_35", this).text().indexOf("LAST_NAME")+11,$("SC_DF_FIELD_35", this).text().indexOf(" size")-4) + " " + $("SC_DF_FIELD_1", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_2", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_3", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_4", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_5", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_6", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_7", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_8", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_9", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_10", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_11", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_12", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_13", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_14", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_15", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_16", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_17", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_18", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_19", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_20", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_21", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_22", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_24", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_26", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_28", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_26", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_27", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_28", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_29", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_30", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_31", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_32", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_33", this).text().replace(/ /g,"") + " " + $("SC_DF_FIELD_34", this).text().replace(/ /g,"") + $("SC_DF_SSO", this).text().replace(/ /g,"").substring(0,9),
- college: $("SC_DF_FIELD_1", this).text().replace(/ /g,""),
- fourthRotationTeam: $("SC_DF_FIELD_2", this).text().replace(/ /g,""),
- thirdRotationTeam: $("SC_DF_FIELD_3", this).text().replace(/ /g,""),
- secondRotationTeam: $("SC_DF_FIELD_4", this).text().replace(/ /g,""),
- firstRotationTeam: $("SC_DF_FIELD_5", this).text().replace(/ /g,""),
- fourthRotationBus: $("SC_DF_FIELD_6", this).text().replace(/ /g,""),
- thirdRotationBus: $("SC_DF_FIELD_7", this).text().replace(/ /g,""),
- secondRotationBus: $("SC_DF_FIELD_8", this).text().replace(/ /g,""),
- firstRotationBus: $("SC_DF_FIELD_9", this).text().replace(/ /g,""),
- fourthRotationType: $("SC_DF_FIELD_10", this).text().replace(/ /g,""),
- thirdRotationType: $("SC_DF_FIELD_11", this).text().replace(/ /g,""),
- secondRotationType: $("SC_DF_FIELD_12", this).text().replace(/ /g,""),
- firstRotationType: $("SC_DF_FIELD_13", this).text().replace(/ /g,""),
- fourthRotationDR: $("SC_DF_FIELD_14", this).text().replace(/ /g,""),
- thirdRotationDR: $("SC_DF_FIELD_15", this).text().replace(/ /g,""),
- secondRotationDR: $("SC_DF_FIELD_16", this).text().replace(/ /g,""),
- firstRotationDR: $("SC_DF_FIELD_17", this).text().replace(/ /g,""),
- fourthRotationAL: $("SC_DF_FIELD_18", this).text().replace(/ /g,""),
- thirdRotationAL: $("SC_DF_FIELD_19", this).text().replace(/ /g,""),
- secondRotationAL: $("SC_DF_FIELD_20", this).text().replace(/ /g,""),
- firstRotationAL: $("SC_DF_FIELD_21", this).text().replace(/ /g,""),
- firstRotationLocation: $("SC_DF_FIELD_22", this).text().replace(/ /g,""),
- firstlatlong:$("SC_DF_FIELD_23", this).text().replace(/ /g,""),
- secondRotationLocation: $("SC_DF_FIELD_24", this).text().replace(/ /g,""),
- secondlatlong:$("SC_DF_FIELD_25", this).text().replace(/ /g,""),
- thirdRotationLocation: $("SC_DF_FIELD_36", this).text().replace(/ /g,""),
- thirdlatlong:$("SC_DF_FIELD_37", this).text().replace(/ /g,""),
- fourthRotationLocation: $("SC_DF_FIELD_38", this).text().replace(/ /g,""),
- fourthlatlong:$("SC_DF_FIELD_39", this).text().replace(/ /g,""),
- firstMajProj: $("SC_DF_FIELD_26", this).text().replace(/ /g,""),
- secondMajProj: $("SC_DF_FIELD_27", this).text().replace(/ /g,""),
- thirdMajProj: $("SC_DF_FIELD_28", this).text().replace(/ /g,""),
- fourthMajProj: $("SC_DF_FIELD_29", this).text().replace(/ /g,""),
- firstRotationCommittees: $("SC_DF_FIELD_30", this).text().replace(/ /g,""),
- secondRotationCommittees: $("SC_DF_FIELD_31", this).text().replace(/ /g,""),
- thirdRotationCommittees: $("SC_DF_FIELD_32", this).text().replace(/ /g,""),
- fourthRotationCommittees: $("SC_DF_FIELD_33", this).text().replace(/ /g,""),
- currentRotation: $("SC_DF_FIELD_34", this).text().replace(/ /g,""),
- imlpName: $("SC_DF_FIELD_35", this).text().replace(/ /g,""),
- sso: $("SC_DF_SSO", this).text().replace(/ /g,"").substring(0,9),
- dataformEntry: $("ENTRY_VIEW_URL", this).text()
- };
- }).get(data);
- $("#_results").removeClass( "ui-autocomplete-loading" );
- $("#_results").val( "Search by Name, Location, Project or Keyword" );
- $("#_results").autocomplete({
- source: data,
- minLength: 0,
- select: function(event, ui) {
- $("#log").empty();
- $("#log").unbind("click");
- formatResults(ui.item);
- imlpName = ui.item.imlpName.split("'");
- imlpName = imlpName[5] + ", " + imlpName[3];
- log(imlpName + " " + ui.item.sso);
- log("Currently in " + ui.item.currentRotation + " rotation" + " located in " + currLocation);
- log("Graduated from: " + ui.item.college);
- log("Current AL is: " + currAL);
- log("--------------------------------------------------------");
- log("More details can be viewed by clicking here");
- $("#log").bind("click", function() {
- window.open(ui.item.dataformEntry, "_blank");
- });
- }
- }).data( "autocomplete" )._renderItem = function( ul, item ) {
- imlpName = item.imlpName.split("'");
- imlpName = imlpName[5] + ", " + imlpName[3];
- formatResults(item);
- return $( "<li></li>" )
- .data( "item.autocomplete", item )
- .append( "<a> <span class='apptitle'>" + imlpName + "</span> <br />" + "<span class='descrip'> SSO: " + item.sso + "<br />" + "Current location: " + currLocation + "<br />" + "AL: " + currAL + "</span></a> <br /> <hr width='80%' align='center'>")
- .appendTo( ul )
- };
- }
- });
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement