Project

General

Profile

Revision 4493

update the status of search items WRT the cart when adding/removing from within the search results view (when you add an assessment, the icon changes to the "remove" icon)

View differences:

first-assessment-resultset.xsl
112 112
							}
113 113
							else {
114 114
								window.document.getElementById("iframeheaderclass").src=window.document.getElementById("iframeheaderclass").src;
115
								//now check the cart contents and update those icons (but wait a second)
116
								setTimeout("setAllCartIcons()", 1000);
115 117
							}
116 118
						}, 
117 119
						onFailure: function(transport) {alert('failure making ajax call');}
......
157 159
				if (document.getElementById("ajaxCartResults")) {
158 160
					new Effect.Appear("download");
159 161
				}
160
			}
161
			
162
			}	
162 163
			isInCart = function(docid) {
163 164
		
164 165
				var objs = window.document.getElementById("iframeheaderclass").contentDocument.getElementsByName("@packageId");
......
172 173
					}
173 174
				}
174 175
				return false;
175
			}
176
			
176
			}			
177 177
			hideDiv = function(divId) {
178
				new Effect.Fade(divId);
178
				new Effect.Puff(divId);
179 179
				//Element.hide(divId);
180 180
			}
181 181
			showDiv = function(divId) {
182 182
				new Effect.Appear(divId)
183 183
				//Element.show(divId);
184 184
			}
185
			setAllCartIcons = function() {
186
				var docids = document.getElementsByName('docid');
187
				for (var i=0; i< docids.length; i++) {
188
					var docid = docids[i].value;
189
					if (docid != "") {
190
						setCartIcon(docid);
191
					}	
192
				}
193
			}
194
			setCartIcon = function(docid) {
195
				//show or hide the div
196
				//alert("setting icon for: " + docid);
197
				if (isInCart(docid)) {
198
					hideDiv("ajaxDiv" + docid + "add");
199
					showDiv("ajaxDiv" + docid + "remove");
200
				}
201
				else {
202
					hideDiv("ajaxDiv" + docid + "remove");
203
					showDiv("ajaxDiv" + docid + "add");
204
				}
205
			}	
185 206
		 ]]>	
186 207
		</script>
187 208
        

Also available in: Unified diff