home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2005 October / Gamestar_77_2005-10_dvd.iso / Programy / nsb-install-8-0.exe / chrome / aim.jar / content / aim / findAFriend1_2.js < prev    next >
Encoding:
JavaScript  |  2005-07-29  |  3.3 KB  |  113 lines

  1. /* 
  2.  * The contents of this file are subject to the Netscape Public
  3.  * License Version 1.1 (the "License"); you may not use this file
  4.  * except in compliance with the License. You may obtain a copy of
  5.  * the License at http://www.mozilla.org/NPL/
  6.  *  
  7.  * Software distributed under the License is distributed on an "AS
  8.  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  9.  * implied. See the License for the specific language governing
  10.  * rights and limitations under the License.
  11.  *  
  12.  * The Original Code is Mozilla Communicator client code, released
  13.  * March 31, 1998.
  14.  * 
  15.  * The Initial Developer of the Original Code is Netscape
  16.  * Communications Corporation. Portions created by Netscape are
  17.  * Copyright (C) 1998-1999 Netscape Communications Corporation. All
  18.  * Rights Reserved.
  19.  * 
  20.  * Contributor(s): 
  21.  *   Ben Goodger (03/11/99)
  22.  */
  23.  
  24. //var bundle = srGetStrBundle("chrome://communicator/locale/profile/newProfile1_2.properties");
  25. //var detect = false;
  26.  
  27. // the getting procedure is unique to each page, since each page can different
  28. // types of elements (not necessarily form elements). So each page must provide
  29. // its own GetFields function
  30. function GetFields()
  31. {
  32.   var emailaddr = "dummy"
  33.   var rv = { 
  34.     emailaddr: { id: "emailaddr",      value: emailaddr       },
  35.  
  36.   }
  37.   return rv; 
  38. }
  39.  
  40. // the setting procedure is unique to each page, and as such each page
  41. // must provide its own SetFields function
  42. function SetFields(element,set)
  43. {
  44.   //element = document.getElementById(element);
  45.   //dump("In SetFields(" + element + "," + set + ");\n");
  46.  //if(element.id == "emailaddr")
  47.    // element.value = set;
  48. }  
  49.  
  50. // function createProfileWizard.js::chooseFolder();
  51. // utility function responsible for displaying a folder selection dialog.
  52. function chooseFolder(string)
  53. {
  54.     var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
  55.  
  56.     fp.init(window, string, nsIFilePicker.modeFolder);
  57.     try {
  58.         var ret = fp.show();
  59.         if ( ret == nsIFilePicker.returnOK ) {
  60.             return fp.fileURL.spec;
  61.         }
  62.         else
  63.             return false;
  64.     } 
  65.     catch (ex) {
  66.         return false;
  67.     }
  68. }
  69.  
  70. function cmdAddBuddy()
  71. {
  72.   var targetValue = getSelectedUser();
  73.   if (targetValue) {
  74.     openDialog("chrome://aim/content/BuddyAddBuddy.xul", "", "modal=yes,titlebar,chrome", 
  75.                null, null, targetValue);
  76.   }
  77. }
  78.  
  79. function cmdSendIM()
  80. {
  81.   var targetValue = getSelectedUser();
  82.   if (targetValue) {
  83.     aimIMInvokeIMForm(targetValue);
  84.   }
  85. }
  86.  
  87. function getSelectedUser()
  88. {
  89.   var listbox = document.getElementById("emailsearchresultslist");
  90.   if (listbox.selectedItem)
  91.     return listbox.selectedItem.getAttribute("label");
  92.   else
  93.     return null;
  94. }
  95.  
  96. function showRes() 
  97. {
  98.     document.getElementById("usersnum").setAttribute("value", parent.numHits);
  99.     document.getElementById("emailaddress").setAttribute("value", parent.queryEmailAddress);
  100.  
  101.     var searchResults = document.getElementById('emailsearchresultslist');
  102.     var searchResultsArray = parent.containerArray;
  103.  
  104.     for(k = 0; k < searchResultsArray.length; ++k){
  105.         var item = document.createElement("listitem");
  106.         item.setAttribute("label", searchResultsArray[k]);
  107.         item.setAttribute("issearchresult","true");
  108.         searchResults.appendChild(item);
  109.     }
  110.     
  111.     searchResultsArray.length = 0;
  112. }
  113.