Project

General

Profile

« Previous | Next » 

Revision 4411

improve clarity of the available cart actions by:
-hiding/showing the logical options for a given screen (only allowed to remove when viewing the cart)
-refresh when cart changes - more positive feedback that pushing buttons actually did something.

View differences:

lib/style/skins/first/search.js
151 151
	for (var i=0; i < submitFormObj.length; i++) {
152 152
		var formElement = submitFormObj.elements[i];
153 153
		if (formElement.type == "checkbox" && formElement.checked) {
154
			//ignore certain other checkboxes, kind of a hack 
154
			//ignore certain other checkboxes, kind of a hack, but it's javascript...
155 155
			if (formElement.name == "includeQuestions") {
156 156
				continue;
157 157
			}
158
			if (formElement.name == "docid") {
159
				continue;
160
			}
158 161
			
159 162
			//send the request
160 163
			var myRequest = new Ajax.Request(
......
166 169
					field: formElement.name, 
167 170
					path: formElement.value},
168 171
				evalScripts: true, 
169
				//onSuccess: function(transport) {alert('Selections saved: ' + operation); window.document.getElementById("iframeheaderclass").src=window.document.getElementById("iframeheaderclass").src;}, 
172
				onSuccess: function(transport) {
173
					//alert('Selections saved: ' + operation); 
174
					//refresh after the save
175
					if (document.getElementById("ajaxCartResults")) {
176
						window.location.reload();
177
					}
178
					else {
179
						window.document.getElementById("iframeheaderclass").src=window.document.getElementById("iframeheaderclass").src;
180
					}
181
				}, 
170 182
				onFailure: function(transport) {alert('failure saving field: ' + formElement.name);}
171 183
			 });
172 184
		 	count++;
173 185
		}
174 186
	}
175 187
	
176
	window.document.getElementById("iframeheaderclass").src = window.document.getElementById("iframeheaderclass").src;
188
	//window.document.getElementById("iframeheaderclass").src = window.document.getElementById("iframeheaderclass").src;
177 189
	
178 190
	//alert(count + ' Field selections saved.'); 
179 191
	
lib/style/skins/first/first-assessment-resultset.xsl
150 150
				return false;
151 151
				
152 152
			}
153
			setControlVisibility = function() {
154
				if (document.getElementById("ajaxCartResults")) {
155
					new Effect.Appear("removeCart");
156
					//new Effect.Fade("addCart");
157
				}
158
				else {
159
					new Effect.Appear("addCart");
160
					//new Effect.Fade("removeCart");
161
				}
162
			}
163
			
153 164
			hideDiv = function(divId) {
154 165
				new Effect.Fade(divId);
155 166
				//Element.hide(divId);
......
167 178
            if there are not then don't show the query results -->
168 179

  
169 180
		<xsl:if test="count(resultset/document) &gt; 0">
181
			<script type="text/javascript" language="Javascript">
182
				<![CDATA[
183
					//call on load
184
					setControlVisibility();
185
				]]>	
186
			</script>
170 187
			<p>
171
				Download Selected (.csv):
172 188
				<a>
173 189
					<xsl:attribute name="href">javascript:{}</xsl:attribute>
174 190
					<xsl:attribute name="onclick">javascript:downloadMergedResponseData('assessmentForm', 'fieldForm')</xsl:attribute>
......
177 193
							<xsl:value-of select="$contextURL" />
178 194
							<xsl:text>/style/images/page_white_put.png</xsl:text>
179 195
						</xsl:attribute>
180
					</img>	
181
				</a>
182
			</p>
183
			<p>
184
				Edit Selected:
185
				<a>
186
					<xsl:attribute name="href">javascript:{}</xsl:attribute>
187
					<xsl:attribute name="onclick">javascript:editCart('assessmentForm', 'add')</xsl:attribute>
188
					<img border="none">
189
						<xsl:attribute name="src">
190
							<xsl:value-of select="$contextURL" />
191
							<xsl:text>/style/images/fav.gif</xsl:text>
192
						</xsl:attribute>
193 196
					</img>
194
					<xsl:text> Add to Cart</xsl:text>
197
					<xsl:text> Download Selection (.csv)</xsl:text>
195 198
				</a>
196
				/
197
				<a>
198
					<xsl:attribute name="href">javascript:{}</xsl:attribute>
199
					<xsl:attribute name="onclick">javascript:editCart('assessmentForm', 'remove')</xsl:attribute>
200
					<!--  <xsl:text>Remove </xsl:text> -->
201
					<img border="none">
202
						<xsl:attribute name="src">
203
							<xsl:value-of select="$contextURL" />
204
							<xsl:text>/style/images/delete.gif</xsl:text>
205
						</xsl:attribute>
206
					</img>
207
					<xsl:text> Remove from Cart</xsl:text>
208
				</a>
209 199
			</p>
200
			<div id="addCart" style="display:none;">
201
				<p/>
202
				<p>
203
					<a>
204
						<xsl:attribute name="href">javascript:{}</xsl:attribute>
205
						<xsl:attribute name="onclick">javascript:editCart('assessmentForm', 'add')</xsl:attribute>
206
						<img border="none">
207
							<xsl:attribute name="src">
208
								<xsl:value-of select="$contextURL" />
209
								<xsl:text>/style/images/fav.gif</xsl:text>
210
							</xsl:attribute>
211
						</img>
212
						<xsl:text> Add Selection to Cart</xsl:text>
213
					</a>
214
				</p>
215
			</div>
216
			<div id="removeCart" style="display:none;">
217
				<p/>
218
				<p>
219
					<a>
220
						<xsl:attribute name="href">javascript:{}</xsl:attribute>
221
						<xsl:attribute name="onclick">javascript:editCart('assessmentForm', 'remove')</xsl:attribute>
222
						<!--  <xsl:text>Remove </xsl:text> -->
223
						<img border="none">
224
							<xsl:attribute name="src">
225
								<xsl:value-of select="$contextURL" />
226
								<xsl:text>/style/images/delete.gif</xsl:text>
227
							</xsl:attribute>
228
						</img>
229
						<xsl:text> Remove Selection from Cart</xsl:text>
230
					</a>
231
				</p>
232
			</div>	
210 233
						
211 234
			<!-- for reading the assessment details -->
212 235
			<form action="{$contextURL}/metacat" method="POST" id="readForm" name="readForm" >

Also available in: Unified diff