1: /*************************************************************
2: BEGIN SET THE DEFAULT VIEW OF ACTIVTY HISTORY TO ALL
3: **************************************************************/
4: if (crmForm.FormType==2 || crmForm.FormType==3 || crmForm.FormType==4)
5: {
6: var DEFAULT_VIEW = «All»;
7: /**************************************************************
8: * Change the default view of a view selection combo box
9: **************************************************************/
10: SetDefaultView = function(viewCombo, viewName) {
11:
12: /* If the view has already been set, we don’t need to do it again. */
13: if (viewCombo.value != viewName) {
14:
15: /* Set the new view */
16: viewCombo.value = viewName;
17:
18: /* Call FireOnChange to run the code in the appropriate HTML control.
19: * Without this call, only the selection in the combo box changes,
20: * but not the content of the grid */
21: viewCombo.FireOnChange();
22: }
23: }
24:
25: /**************************************************************
26: * Event handler. Called whenever the ready state of the
27: * areaActivityHistoryFrame changes.
28: **************************************************************/
29: areaActivityHistoryFrame_OnReadyStateChange = function() {
30:
31: /* Waiting until the frame has finished loading */
32: if (this.readyState == «complete») {
33:
34: /* This is the frame we’re interested in */
35: var frame = document.frames(«areaActivityHistoryFrame»);
36:
37: /* And this is the view combo box */
38: var viewCombo = frame.document.getElementById(«actualend»);
39:
40: /* The view combo box uses a style sheet that references a HTML
41: * control. We have to wait until the htc file is loaded,
42: * otherwise the call to FireOnChange in the SetDefaultView
43: * method will fail. */
44: if (viewCombo.readyState == «complete») {
45:
46: /* If the control already has finished loading, we can
47: * directly set the new view. */
48: SetDefaultView(viewCombo, DEFAULT_VIEW);
49: }
50:
51: else {
52: /* Otherwise we have to register another event handler
53: * waiting until all of the include files used by the
54: * combo box are loaded as well. */
55: viewCombo.onreadystatechange = function() {
56: if (this.readyState == «complete») {
57: SetDefaultView(this, DEFAULT_VIEW);
58: }
59: }
60: }
61: }
62: }
63:
64: /**************************************************************
65: * loadNavItem. Instead of using the function LoadArea
66: * available in the CRM intenal code we have to use this modified
67: * function to avoid a problem loading the breadcrumb.
68: **************************************************************/
69: loadNavItem = function (navItemName)
70: {
71: var o = document.getElementById(navItemName);
72: crmNavBar.down(o);
73: }
74:
75: /* Load the history area.*/
76: loadNavItem(‘navActivityHistory’);
77:
78: /* Immediately switch back to the main form. The previous line is needed
79: * to initialize the history frame. This line switches back immediately,
80: * so you see the main application form while the history frame is loaded
81: * in the background.
82: */
83: loadNavItem(‘navInfo’);
84:
85: /* We have to wait until the the history frame was completely loaded, so
86: /* we register a new event handler, calling the code above. */
87: document.frames(«areaActivityHistoryFrame»).document.onreadystatechange = areaActivityHistoryFrame_OnReadyStateChange;
88:
89: }
90: /*************************************************************
91: END SET THE DEFAULT VIEW OF ACTIVTY HISTORY TO ALL
92: **************************************************************/