PageSourceSearch

https://www.jjill.com/wcsstore/JJillStorefrontAssetStore//javascript/UserArea/AccountWishListDisplay.js

js jjill.com collected 2026-09-25 19:05:23 UTC 7,463 bytes, 199 lines download raw bytes

1//-----------------------------------------------------------------
2// Licensed Materials - Property of IBM
3//
4// WebSphere Commerce
5//
6// (C) Copyright IBM Corp. 2008, 2009 All Rights Reserved.
7//
8// US Government Users Restricted Rights - Use, duplication or
9// disclosure restricted by GSA ADP Schedule Contract with
10// IBM Corp.
11//-----------------------------------------------------------------
12
13
14	/** 
15	 * @fileOverview This file contains all the global variables and JavaScript functions needed for wish list page in My Account section.
16	 * This JavaScript file defines all the functions used  by the AccountWishDisplay.jsp file.
17	 * @version 1.0
18	 */
19
20
21	/* Declare the namespace if it does not already exist. */
22	 if (AccountWishListDisplay == null || typeof(AccountWishListDisplay) != "object") {
23	 	var AccountWishListDisplay = new Object();
24	 }
25
26	/**
27	 * @class This AccountWishListDisplay class defines all the variables and functions for the wish list page of My account section.
28	 * The wish list page displays all the wish list item of an user and provides functions like remove from the wish list, add to cart, etc.
29	 *
30	 */
31AccountWishListDisplay={	
32	/* Global variables used in the CompareProductDisplay page. */
33		
34	/** The contextChanged is a boolean flag indicating whether the context was changed and if there is a need to refresh the wish list result. */
35	contextChanged:false, 
36
37	/** The isHistory is a boolean flag used to determine whether the update of context is caused by a history event
37(back/forward). */
38	isHistory:false,
39	
40	/**
41	* This function sets the initial state of dojo browser history.  dojo API : dojo.undo.browser.setInitialState
42	* @param {string} elementId  the id of the widget.
43	* @param {string} changeUrl   the url used to load new context.	
44	*/	
45	initHistory:function(elementId, changeUrl){
46
47		var historyObject = new AccountWishListDisplay.HistoryTracker(elementId, changeUrl);
48		dojo.back.setInitialState(historyObject);	
49	},
50			
51	/**
52	* This function is used to check user input in the wish list email form, if user input is valid, it invokes the InterestItemListMessage service to send out the email.
53	* @param {string} formId  The formId of the email form.
54	*/	
55	checkEmailForm:function (formId){
56		var form = document.getElementById(formId);
57		
58		form.sender_name.value = form.sender_name.value.replace(/^\s+/g, "");
59		form.recipient.value = form.recipient.value.replace(/^\s+/g, "");	
60		
61		if (form.recipient.value == '') {
62			MessageHelper.formErrorHandleClient(document.getElementById('SendWishListForm_Recipient_Email').id, MessageHelper.messages["WISHLIST_MISSINGEMAIL"]);return;
63		}
64		if (! MessageHelper.isValidEmail(form.recipient.value)){
65			MessageHelper.formErrorHandleClient(document.getElementById('SendWishListForm_Recipient_Email').id, MessageHelper.messages["WISHLIST_INVALIDEMAILFORMAT"]);return;
66		}
67		if (form.sender_name.value == ''){
68			 MessageHelper.formErrorHandleClient(document.getElementById('SendWishListForm_Sender_Name').id, MessageHelper.messages["WISHLIST_MISSINGNAME"]);return;
69		}
70		if (! MessageHelper.isValidEmail(form.sender_email.value)){
71			MessageHelper.formErrorHandleClient(document.getElementById('SendWishListForm_Sender_Email').id, MessageHelper.messages["WISHLIST_INVALIDEMAILFORMAT"]);return;
72		}
73		if(form.listId.value==''){
74			// gets wish list ID from refresh area if it is not already defined
75			if((dojo.byId("interestItemListId")!=null && dojo.byId("interestItemListId")!='undefined')){
76				form.listId.value = dojo.byId("interestItemListId").value;
77			}	
78		}
79		if(form.listId.value==''){
80			MessageHelper.displayErrorMessage(MessageHelper.messages["WISHLIST_EMPTY"]);return;
81		}
82		
83		/* Handles multiple clicks */
84		if(!submitRequest()){
85			return;
86		}
87		
88		cursor_wait();
89		wc.service.getServiceById("InterestItemListMessage").formId = formId;
90		wc.service.invoke("InterestItemListMessage");
91			
92	},
93	
94	/**
95	* This function is used to invoke InterestItemDelete service. It prepares the parameters and then invokes the service.
96	* @param {string} params  the parameters to be sent to the InterestItemDelete service.
97	* @param {string} controllerURL  the URL value of the refresh controller. 
98	*/	
99	deleteInterestItem:function(params,controllerURL) {
100		if(controllerURL!= null && controllerURL!='undefined'){
101			CommonControllersDeclarationJS.setControllerURL("WishlistDisplay_Controller",controllerURL);
102		}
103		
104		/* Handles  multiple clicks */
105		if(!submitRequest()){
106			return;
107		}   			
108		cursor_wait();		
109		wc.service.invoke( "InterestItemDelete", params);
110		
111	},
112	
113	/**
114	* This function is used to clear some of the fields in the email form in wish list page after InterestItemListMessage is invoked.
115	* @param {string} formId  the id of the email form in WishList page.
116	*/	
117	clearWishListEmailForm:function(formId){
118		var form = document.getElementById(formId);
119		form.recipient.value = "";
120		form.sender_name.value = "";
121		form.sender_email.value = "";
122		form.wishlist_message.value="";
123	},
124
125	/**
126	* This function is used to load the value of the controller URL.
127	* @param {string} contentURL  the value of the controller URL.
128	*/
129	loadContentURL:function(contentURL){
130		/* Handles multiple clicks */
131		if(!submitRequest()){
132			return;
133		}   	
134		cursor_wait();
135		if(dijit.byId("WishlistDisplay_Widget") != null){
136			CommonControllersDeclarationJS.setControllerURL('WishlistDisplay_Controller',contentURL);		
137			wc.render.updateContext("WishlistDisplay_Context");
138		}
139
140		if(dijit.byId("SharedWishlistDisplay_Widget") != null) {
141			CommonControllersDeclarationJS.setControllerURL('SharedWishlistDisplay_Controller',contentURL);		
142			wc.render.updateContext("SharedWishlistDisplay_Context");
143		}
144	},
145
146	/**
147	* This function belong to HistoryTracking for receiving Back notifications.
148	*/
149	goBack:function(){
150	
151		AccountWishListDisplay.loadContentURL(this.historyUrl);
152		AccountWishListDisplay.isHistory=true;
153
154	},
155
156	/**
157	* This function belong to HistoryTracking for receiving forward notifications.	
158	*/
159	goForward:function(){
160
161		AccountWishListDisplay.loadContentURL(this.historyUrl);
162		isHistory=true;
163	},
164
165	/**
166	* This function sets the History state object for history tracking.
167	* @param {string} elementId  the id of the widget.
168	* @param {string} changeUrl   the url used to load new context.	
169	* @param {string} historyUrl the value of the hsitory URL.
170	*/
171	HistoryTracker:function(elementId, changeUrl, historyUrl){
172	
173		this.elementId = elementId; 
174		this.changeUrl =  changeUrl;
175		this.historyUrl = historyUrl; 
176
177	},
178	/**
179		* This function processes book mark URL and act accordingly. If there is query information in the url, extract the query string, 
180		* make AJAX call to request the wish list and update the wish list display division 
180with the results.
181		*/
182	processBookmarkURL : function(){
183		var bookmarkId = location.hash;	
184		if(bookmarkId){					        
185			bookmarkId = bookmarkId.substring(1, bookmarkId.length);
186		}   
187		if(bookmarkId){
188			var indexOfIdentifier = bookmarkId.indexOf("identifier", 0);
189			if ( indexOfIdentifier >= 0) {
190				var realUrl = bookmarkId.substring(0, indexOfIdentifier - 1);
191			}
192		}
193	}
194}
195
196/** Sets the  HistoryTracking for receiving Back notifications. */
197AccountWishListDisplay.HistoryTracker.prototype.back = AccountWishListDisplay.goBack;
198/** Sets the  HistoryTracking for receiving forward notifications. */
199AccountWishListDisplay.HistoryTracker.prototype.forward=AccountWishListDisplay.goForward;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.