!import
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
1 //@line 41 "/home/visbrero/mnt/roisin/rev_control/hg/mozilla/mail/components/addrbook/content/addressbook.js"
2
3 const nsIAbListener = Components.interfaces.nsIAbListener;
4
5 var cvPrefs = 0;
6 var gSearchTimer = null;
7 var gStatusText = null;
8 var gQueryURIFormat = null;
9 var gSearchInput;
10 var gDirTree;
11 var gCardViewBox;
12 var gCardViewBoxEmail1;
13 var gPreviousDirTreeIndex = -1;
14
15 // Constants that correspond to choices
16 // in Address Book->View -->Show Name as
17 const kDisplayName = 0;
18 const kLastNameFirst = 1;
19 const kFirstNameFirst = 2;
20 const kLDAPDirectory = 0; // defined in nsDirPrefs.h
21 const kPABDirectory = 2; // defined in nsDirPrefs.h
22
23 // Note: We need to keep this listener as it does not just handle dir
24 // pane deletes but also deletes of address books and lists from places like
25 // the sidebar and LDAP preference pane.
26 var gAddressBookAbListener = {
onItemAdded
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
27 onItemAdded: function(parentDir, item) {
28 // will not be called
29 },
onItemRemoved
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
30 onItemRemoved: function(parentDir, item) {
31 // will only be called when an addressbook is deleted
32 try {
33 // If we don't have a record of the previous selection, the only
34 // option is to select the first.
35 if (gPreviousDirTreeIndex == -1) {
36 SelectFirstAddressBook();
37 }
38 else {
39 // Don't reselect if we already have a valid selection, this may be
40 // the case if items are being removed via other methods, e.g. sidebar,
41 // LDAP preference pane etc.
42 if (dirTree.currentIndex == -1) {
43 var directory = item.QueryInterface(Components.interfaces.nsIAbDirectory);
44
45 // If we are a mail list, move the selection up the list before
46 // trying to find the parent. This way we'll end up selecting the
47 // parent address book when we remove a mailing list.
48 //
49 // For simple address books we don't need to move up the list, as
50 // we want to select the next one upon removal.
51 if (directory.isMailList && gPreviousDirTreeIndex > 0)
52 --gPreviousDirTreeIndex;
53
54 // Now get the parent of the row.
55 var newRow = dirTree.view.getParentIndex(gPreviousDirTreeIndex);
56
57 // if we have no parent (i.e. we are an address book), use the
58 // previous index.
59 if (newRow == -1)
60 newRow = gPreviousDirTreeIndex;
61
62 // Fall back to the first adddress book if we're not in a valid range
63 if (newRow >= dirTree.view.rowCount)
64 newRow = 0;
65
66 // Now select the new item.
67 dirTree.view.selection.select(newRow);
68 }
69 }
70 }
71 catch (ex) {
72 }
73 },
onItemPropertyChanged
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
74 onItemPropertyChanged: function(item, property, oldValue, newValue) {
75 // will not be called
76 }
77 };
78
OnUnloadAddressBook
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
79 function OnUnloadAddressBook()
80 {
81 Components.classes["@mozilla.org/abmanager;1"]
82 .getService(Components.interfaces.nsIAbManager)
83 .removeAddressBookListener(gAddressBookAbListener);
84
85 RemovePrefObservers();
86 CloseAbView();
87 }
88
89 var gAddressBookAbViewListener = {
onSelectionChanged
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
90 onSelectionChanged: function() {
91 ResultsPaneSelectionChanged();
92 },
onCountChanged
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
93 onCountChanged: function(total) {
94 SetStatusText(total);
95 }
96 };
97
GetAbViewListener
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
98 function GetAbViewListener()
99 {
100 return gAddressBookAbViewListener;
101 }
102
103 const kPrefMailAddrBookLastNameFirst = "mail.addr_book.lastnamefirst";
104
105 var gMailAddrBookLastNameFirstObserver = {
observe
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
106 observe: function(subject, topic, value) {
107 if (topic == "nsPref:changed" && value == kPrefMailAddrBookLastNameFirst) {
108 UpdateCardView();
109 }
110 }
111 }
112
AddPrefObservers
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
113 function AddPrefObservers()
114 {
115 var prefService = Components.classes["@mozilla.org/preferences-service;1"]
116 .getService(Components.interfaces.nsIPrefService);
117 var prefBranch = prefService.getBranch(null).QueryInterface(Components.interfaces.nsIPrefBranch2);
118 prefBranch.addObserver(kPrefMailAddrBookLastNameFirst, gMailAddrBookLastNameFirstObserver, false);
119 }
120
RemovePrefObservers
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
121 function RemovePrefObservers()
122 {
123 var prefService = Components.classes["@mozilla.org/preferences-service;1"]
124 .getService(Components.interfaces.nsIPrefService);
125 var prefBranch = prefService.getBranch(null).QueryInterface(Components.interfaces.nsIPrefBranch2);
126 prefBranch.removeObserver(kPrefMailAddrBookLastNameFirst, gMailAddrBookLastNameFirstObserver);
127 }
128
129 // we won't show the window until the onload() handler is finished
130 // so we do this trick (suggested by hyatt / blaker)
OnLoadAddressBook
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
131 function OnLoadAddressBook()
132 {
133 setTimeout(delayedOnLoadAddressBook, 0); // when debugging, set this to 5000, so you can see what happens after the window comes up.
134 }
135
delayedOnLoadAddressBook
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
136 function delayedOnLoadAddressBook()
137 {
138 gSearchInput = document.getElementById("searchInput");
139
140 verifyAccounts(null); // this will do migration, if we need to.
141
142 InitCommonJS();
143
144 GetCurrentPrefs();
145
146 AddPrefObservers();
147
148 // FIX ME - later we will be able to use onload from the overlay
149 OnLoadCardView();
150
151 SetupAbCommandUpdateHandlers();
152
153 //workaround - add setTimeout to make sure dynamic overlays get loaded first
154 setTimeout('OnLoadDirTree()', 0);
155
156 // if the pref is locked disable the menuitem New->LDAP directory
157 if (gPrefs.prefIsLocked("ldap_2.disable_button_add"))
158 document.getElementById("addLDAP").setAttribute("disabled", "true");
159
160 // Add a listener, so we can switch directories if the current directory is
161 // deleted. This listener cares when a directory (= address book), or a
162 // directory item is/are removed. In the case of directory items, we are
163 // only really interested in mailing list changes and not cards but we have
164 // to have both.
165 Components.classes["@mozilla.org/abmanager;1"]
166 .getService(Components.interfaces.nsIAbManager)
167 .addAddressBookListener(gAddressBookAbListener,
168 nsIAbListener.directoryRemoved |
169 nsIAbListener.directoryItemRemoved);
170
171 var dirTree = GetDirTree();
172 dirTree.addEventListener("click",DirPaneClick,true);
173
174 // initialize the customizeDone method on the customizeable toolbar
175 var toolbox = document.getElementById("ab-toolbox");
176 toolbox.customizeDone = MailToolboxCustomizeDone;
177
178 var toolbarset = document.getElementById('customToolbars');
179 toolbox.toolbarset = toolbarset;
180
181 // Ensure we don't load xul error pages into the main window
182 window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
183 .getInterface(Components.interfaces.nsIWebNavigation)
184 .QueryInterface(Components.interfaces.nsIDocShell)
185 .useErrorPages = false;
186 }
187
OnLoadDirTree
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
188 function OnLoadDirTree() {
189 var treeBuilder = dirTree.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder);
190 treeBuilder.addObserver(abDirTreeObserver);
191
192 SelectFirstAddressBook();
193 }
194
GetCurrentPrefs
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
195 function GetCurrentPrefs()
196 {
197 // prefs
198 if ( cvPrefs == 0 )
199 cvPrefs = new Object;
200
201 cvPrefs.prefs = gPrefs;
202
203 // check "Show Name As" menu item based on pref
204 var menuitemID;
205 switch (gPrefs.getIntPref("mail.addr_book.lastnamefirst"))
206 {
207 case kFirstNameFirst:
208 menuitemID = 'firstLastCmd';
209 break;
210 case kLastNameFirst:
211 menuitemID = 'lastFirstCmd';
212 break;
213 case kDisplayName:
214 default:
215 menuitemID = 'displayNameCmd';
216 break;
217 }
218
219 var menuitem = top.document.getElementById(menuitemID);
220 if ( menuitem )
221 menuitem.setAttribute('checked', 'true');
222
223 // initialize phonetic
224 var showPhoneticFields =
225 gPrefs.getComplexValue("mail.addr_book.show_phonetic_fields",
226 Components.interfaces.nsIPrefLocalizedString).data;
227 // show phonetic fields if indicated by the pref
228 if (showPhoneticFields == "true")
229 document.getElementById("cmd_SortBy_PhoneticName")
230 .setAttribute("hidden", "false");
231
232 }
233
234
SetNameColumn
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
235 function SetNameColumn(cmd)
236 {
237 var prefValue;
238
239 switch ( cmd )
240 {
241 case 'firstLastCmd':
242 prefValue = kFirstNameFirst;
243 break;
244 case 'lastFirstCmd':
245 prefValue = kLastNameFirst;
246 break;
247 case 'displayNameCmd':
248 prefValue = kDisplayName;
249 break;
250 }
251
252 cvPrefs.prefs.setIntPref("mail.addr_book.lastnamefirst", prefValue);
253 }
254
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
255 function onFileMenuInit()
256 {
257 goUpdateCommand('cmd_printcard');
258 goUpdateCommand('cmd_printcardpreview');
259 }
260
CommandUpdate_AddressBook
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
261 function CommandUpdate_AddressBook()
262 {
263 goUpdateCommand('cmd_delete');
264 goUpdateCommand('button_delete');
265 goUpdateCommand('cmd_newlist');
266 }
267
ResultsPaneSelectionChanged
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
268 function ResultsPaneSelectionChanged()
269 {
270 UpdateCardView();
271 }
272
UpdateCardView
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
273 function UpdateCardView()
274 {
275 var cards = GetSelectedAbCards();
276
277 // display the selected card, if exactly one card is selected.
278 // either no cards, or more than one card is selected, clear the pane.
279 if (cards.length == 1)
280 OnClickedCard(cards[0])
281 else
282 ClearCardViewPane();
283 }
284
OnClickedCard
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
285 function OnClickedCard(card)
286 {
287 if (card)
288 DisplayCardViewPane(card);
289 else
290 ClearCardViewPane();
291 }
292
AbClose
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
293 function AbClose()
294 {
295 top.close();
296 }
297
AbPrintCardInternal
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
298 function AbPrintCardInternal(doPrintPreview, msgType)
299 {
300 var selectedItems = GetSelectedAbCards();
301 var numSelected = selectedItems.length;
302
303 if (!numSelected)
304 return;
305
306 var uri = GetSelectedDirectory();
307 if (!uri)
308 return;
309
310 var statusFeedback;
311 statusFeedback = Components.classes["@mozilla.org/messenger/statusfeedback;1"].createInstance();
312 statusFeedback = statusFeedback.QueryInterface(Components.interfaces.nsIMsgStatusFeedback);
313
314 var selectionArray = new Array(numSelected);
315
316 var totalCard = 0;
317
318 for (var i = 0; i < numSelected; i++)
319 {
320 var card = selectedItems[i];
321 var printCardUrl = CreatePrintCardUrl(card);
322 if (printCardUrl)
323 {
324 selectionArray[totalCard++] = printCardUrl;
325 }
326 }
327
328 printEngineWindow = window.openDialog("chrome://messenger/content/msgPrintEngine.xul",
329 "",
330 "chrome,dialog=no,all",
331 totalCard, selectionArray, statusFeedback,
332 doPrintPreview, msgType);
333
334 return;
335 }
336
AbPrintCard
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
337 function AbPrintCard()
338 {
339 AbPrintCardInternal(false, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINT_AB_CARD);
340 }
341
AbPrintPreviewCard
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
342 function AbPrintPreviewCard()
343 {
344 AbPrintCardInternal(true, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_AB_CARD);
345 }
346
CreatePrintCardUrl
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
347 function CreatePrintCardUrl(card)
348 {
349 var url = "data:application/xml;base64," + card.convertToBase64EncodedXML();
350 return url;
351 }
352
AbPrintAddressBookInternal
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
353 function AbPrintAddressBookInternal(doPrintPreview, msgType)
354 {
355 var uri = GetSelectedDirectory();
356 if (!uri)
357 return;
358
359 var statusFeedback;
360 statusFeedback = Components.classes["@mozilla.org/messenger/statusfeedback;1"].createInstance();
361 statusFeedback = statusFeedback.QueryInterface(Components.interfaces.nsIMsgStatusFeedback);
362
363 /*
364 turn "moz-abmdbdirectory://abook.mab" into
365 "addbook://moz-abmdbdirectory/abook.mab?action=print"
366 */
367
368 var abURIArr = uri.split("://");
369 var printUrl = "addbook://" + abURIArr[0] + "/" + abURIArr[1] + "?action=print"
370
371 printEngineWindow = window.openDialog("chrome://messenger/content/msgPrintEngine.xul",
372 "",
373 "chrome,dialog=no,all",
374 1, [printUrl], statusFeedback, doPrintPreview, msgType);
375
376 return;
377 }
378
AbPrintAddressBook
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
379 function AbPrintAddressBook()
380 {
381 AbPrintAddressBookInternal(false, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINT_ADDRBOOK);
382 }
383
AbPrintPreviewAddressBook
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
384 function AbPrintPreviewAddressBook()
385 {
386 AbPrintAddressBookInternal(true, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_ADDRBOOK);
387 }
388
AbExport
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
389 function AbExport()
390 {
391 try {
392 var selectedABURI = GetSelectedDirectory();
393 if (!selectedABURI) return;
394
395 var directory = GetDirectoryFromURI(selectedABURI);
396 Components.classes["@mozilla.org/abmanager;1"]
397 .getService(Components.interfaces.nsIAbManager)
398 .exportAddressBook(window, directory);
399 }
400 catch (ex) {
401 var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
402
403 if (promptService) {
404 var message;
405 switch (ex.result) {
406 case Components.results.NS_ERROR_FILE_ACCESS_DENIED:
407 message = gAddressBookBundle.getString("failedToExportMessageFileAccessDenied");
408 break;
409 case Components.results.NS_ERROR_FILE_NO_DEVICE_SPACE:
410 message = gAddressBookBundle.getString("failedToExportMessageNoDeviceSpace");
411 break;
412 default:
413 message = ex.message;
414 break;
415 }
416
417 promptService.alert(window,
418 gAddressBookBundle.getString("failedToExportTitle"),
419 message);
420 }
421 }
422 }
423
SetStatusText
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
424 function SetStatusText(total)
425 {
426 if (!gStatusText)
427 gStatusText = document.getElementById('statusText');
428
429 try {
430 var statusText;
431
432 if (gSearchInput && gSearchInput.value) {
433 if (total == 0)
434 statusText = gAddressBookBundle.getString("noMatchFound");
435 else
436 {
437 if (total == 1)
438 statusText = gAddressBookBundle.getString("matchFound");
439 else
440 statusText = gAddressBookBundle.getFormattedString("matchesFound", [total]);
441 }
442 }
443 else
444 statusText = gAddressBookBundle.getFormattedString("totalCardStatus", [gAbView.directory.dirName, total]);
445
446 gStatusText.setAttribute("label", statusText);
447 }
448 catch(ex) {
449 dump("failed to set status text: " + ex + "\n");
450 }
451 }
452
AbResultsPaneKeyPress
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
453 function AbResultsPaneKeyPress(event)
454 {
455 if (event.keyCode == 13)
456 AbEditSelectedCard();
457 }
458
AbResultsPaneDoubleClick
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
459 function AbResultsPaneDoubleClick(card)
460 {
461 AbEditCard(card);
462 }
463
onAdvancedAbSearch
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
464 function onAdvancedAbSearch()
465 {
466 var selectedABURI = GetSelectedDirectory();
467 if (!selectedABURI) return;
468
469 var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].
470 getService(Components.interfaces.nsIWindowMediator);
471 var existingSearchWindow = windowManager.getMostRecentWindow("mailnews:absearch");
472 if (existingSearchWindow)
473 existingSearchWindow.focus();
474 else
475 window.openDialog("chrome://messenger/content/ABSearchDialog.xul", "",
476 "chrome,resizable,status,centerscreen,dialog=no",
477 {directory: selectedABURI});
478 }
479
onEnterInSearchBar
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
480 function onEnterInSearchBar()
481 {
482 ClearCardViewPane();
483
484 if (!gQueryURIFormat)
485 gQueryURIFormat = gPrefs.getComplexValue("mail.addr_book.quicksearchquery.format",
486 Components.interfaces.nsIPrefLocalizedString).data;
487
488 var searchURI = GetSelectedDirectory();
489 if (!searchURI) return;
490
491 var sortColumn = gAbView.sortColumn;
492 var sortDirection = gAbView.sortDirection;
493
494 /*
495 XXX todo, handle the case where the LDAP url
496 already has a query, like
497 moz-abldapdirectory://nsdirectory.netscape.com:389/ou=People,dc=netscape,dc=com?(or(Department,=,Applications))
498 */
499 if (gSearchInput.value != "") {
500 // replace all instances of @V with the escaped version
501 // of what the user typed in the quick search text input
502 searchURI += gQueryURIFormat.replace(/@V/g, encodeURIComponent(gSearchInput.value));
503 }
504
505 SetAbView(searchURI, gSearchInput.value != "", sortColumn, sortDirection);
506
507 // XXX todo
508 // this works for synchronous searches of local addressbooks,
509 // but not for LDAP searches
510 SelectFirstCard();
511 }
512
SwitchPaneFocus
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
513 function SwitchPaneFocus(event)
514 {
515 var focusedElement = WhichPaneHasFocus();
516 var cardViewBox = GetCardViewBox();
517 var cardViewBoxEmail1 = GetCardViewBoxEmail1();
518 var searchBox = document.getElementById('search-container');
519 var dirTree = GetDirTree();
520 var searchInput = GetSearchInput();
521
522 if (event && event.shiftKey)
523 {
524 if (focusedElement == gAbResultsTree && searchBox)
525 searchInput.focus();
526 else if ((focusedElement == gAbResultsTree || focusedElement == searchBox) && !IsDirPaneCollapsed())
527 dirTree.focus();
528 else if (focusedElement != cardViewBox && !IsCardViewAndAbResultsPaneSplitterCollapsed())
529 {
530 if(cardViewBoxEmail1)
531 cardViewBoxEmail1.focus();
532 else
533 cardViewBox.focus();
534 }
535 else
536 gAbResultsTree.focus();
537 }
538 else
539 {
540 if (focusedElement == searchBox)
541 gAbResultsTree.focus();
542 else if (focusedElement == gAbResultsTree && !IsCardViewAndAbResultsPaneSplitterCollapsed())
543 {
544 if(cardViewBoxEmail1)
545 cardViewBoxEmail1.focus();
546 else
547 cardViewBox.focus();
548 }
549 else if (focusedElement != dirTree && !IsDirPaneCollapsed())
550 dirTree.focus();
551 else if (searchBox)
552 searchInput.focus();
553 else
554 gAbResultsTree.focus();
555 }
556 }
557
WhichPaneHasFocus
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
558 function WhichPaneHasFocus()
559 {
560 var cardViewBox = GetCardViewBox();
561 var searchBox = document.getElementById('search-container');
562 var dirTree = GetDirTree();
563
564 var currentNode = top.document.commandDispatcher.focusedElement;
565 while (currentNode)
566 {
567 var nodeId = currentNode.getAttribute('id');
568
569 if(currentNode == gAbResultsTree ||
570 currentNode == cardViewBox ||
571 currentNode == searchBox ||
572 currentNode == dirTree)
573 return currentNode;
574
575 currentNode = currentNode.parentNode;
576 }
577
578 return null;
579 }
580
GetDirTree
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
581 function GetDirTree()
582 {
583 if (!gDirTree)
584 gDirTree = document.getElementById('dirTree');
585 return gDirTree;
586 }
587
GetSearchInput
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
588 function GetSearchInput()
589 {
590 if (!gSearchInput)
591 gSearchInput = document.getElementById('searchInput');
592 return gSearchInput;
593 }
594
GetCardViewBox
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
595 function GetCardViewBox()
596 {
597 if (!gCardViewBox)
598 gCardViewBox = document.getElementById('CardViewBox');
599 return gCardViewBox;
600 }
601
GetCardViewBoxEmail1
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
602 function GetCardViewBoxEmail1()
603 {
604 if (!gCardViewBoxEmail1)
605 {
606 try {
607 gCardViewBoxEmail1 = document.getElementById('cvEmail1');
608 }
609 catch (ex) {
610 gCardViewBoxEmail1 = null;
611 }
612 }
613 return gCardViewBoxEmail1;
614 }
615
IsDirPaneCollapsed
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
616 function IsDirPaneCollapsed()
617 {
618 var dirPaneBox = GetDirTree().parentNode;
619 return dirPaneBox.getAttribute("collapsed") == "true" ||
620 dirPaneBox.getAttribute("hidden") == "true";
621 }
622
IsCardViewAndAbResultsPaneSplitterCollapsed
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
623 function IsCardViewAndAbResultsPaneSplitterCollapsed()
624 {
625 var cardViewBox = document.getElementById('CardViewOuterBox');
626 try {
627 return (cardViewBox.getAttribute("collapsed") == "true");
628 }
629 catch (ex) {
630 return false;
631 }
632 }
633
LaunchUrl
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
634 function LaunchUrl(url)
635 {
636 // Doesn't matter if this bit fails, window.location contains its own prompts
637 try {
638 window.location = url;
639 }
640 catch (ex) {}
641 }
642
AbIMSelected
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
643 function AbIMSelected()
644 {
645 var cards = GetSelectedAbCards();
646 var count = cards.length;
647
648 var screennames;
649 var screennameCount = 0;
650
651 for (var i=0;i<count;i++) {
652 var screenname = cards[i].aimScreenName;
653 if (screenname) {
654 if (screennameCount == 0)
655 screennames = screenname;
656 else
657 screennames += "," + screenname;
658
659 screennameCount++
660 }
661 }
662
663 var url = "aim:";
664
665 if (screennameCount == 0)
666 url += "goim";
667 else if (screennameCount == 1)
668 url += "goim?screenname=" + screennames;
669 else {
670 url += "SendChatInvite?listofscreennames=" + screennames;
671 url += "&message=" + gAddressBookBundle.getString("joinMeInThisChat");
672 }
673
674 LaunchUrl(url);
675 }
676
getMailToolbox
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
677 function getMailToolbox()
678 {
679 return document.getElementById("ab-toolbox");
680 }