widget_list 1.2.9 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module WidgetList
2
- VERSION = "1.2.9"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -4,8 +4,8 @@ var debugContainer = '';
4
4
 
5
5
 
6
6
  /**
7
- * ListSearchAheadResponse()
8
- */
7
+ * ListSearchAheadResponse()
8
+ */
9
9
  var ListSearchAheadGlobalElement = '';
10
10
  var ListSearchAheadQueueElement = '';
11
11
  var ListSearchAheadInProgress = false;
@@ -20,18 +20,18 @@ var AjaxMaintainChecksRunning = false;
20
20
 
21
21
  function SearchWidgetList(url, listId, element)
22
22
  {
23
- var inputField = jQuery(element).closest('div.inputOuter').find('input.search-ahead');
23
+ var inputField = jQuery(element).closest('div.inputOuter').find('input.search-ahead');
24
24
 
25
- if(inputField.length)
26
- {
27
- ListSearchAheadQueue(url, listId, inputField);
28
- }
25
+ if(inputField.length)
26
+ {
27
+ ListSearchAheadQueue(url, listId, inputField);
28
+ }
29
29
  }
30
30
 
31
31
  //simple version
32
32
  function RefreshList(list_id, callback)
33
33
  {
34
- ListJumpMin(jQuery('#' + list_id + '_jump_url').val(), list_id, callback);
34
+ ListJumpMin(jQuery('#' + list_id + '_jump_url').val(), list_id, callback);
35
35
  }
36
36
 
37
37
  /**
@@ -42,18 +42,18 @@ function RefreshList(list_id, callback)
42
42
  */
43
43
  function Debug(what)
44
44
  {
45
- if(debugFlag >= 1)
46
- {
47
- if(window.document.getElementById(debugContainer))
48
- {
49
- var time = new Date();
45
+ if(debugFlag >= 1)
46
+ {
47
+ if(window.document.getElementById(debugContainer))
48
+ {
49
+ var time = new Date();
50
50
 
51
- element = window.document.getElementById(debugContainer);
51
+ element = window.document.getElementById(debugContainer);
52
52
 
53
- element.innerHTML += '<br/><span>' + time.getHours() + ':' + time.getMinutes() + ':' + time.getSeconds() + '</span> ' + what;
54
- element.scrollTop = element.scrollHeight;
55
- }
56
- }
53
+ element.innerHTML += '<br/><span>' + time.getHours() + ':' + time.getMinutes() + ':' + time.getSeconds() + '</span> ' + what;
54
+ element.scrollTop = element.scrollHeight;
55
+ }
56
+ }
57
57
  }
58
58
 
59
59
  /**
@@ -64,194 +64,194 @@ function Debug(what)
64
64
  */
65
65
  function Redirect(inUrl)
66
66
  {
67
- if(typeof(inUrl) == 'string')
68
- {
69
- if(inUrl.length > 0)
70
- {
71
- window.location = inUrl;
72
- }
73
- else
74
- {
75
- throw('Missing URL input for Redirect()');
76
- }
77
- }
78
- else
79
- {
80
- throw('Invalid URL type input for Redirect()');
81
- }
67
+ if(typeof(inUrl) == 'string')
68
+ {
69
+ if(inUrl.length > 0)
70
+ {
71
+ window.location = inUrl;
72
+ }
73
+ else
74
+ {
75
+ throw('Missing URL input for Redirect()');
76
+ }
77
+ }
78
+ else
79
+ {
80
+ throw('Invalid URL type input for Redirect()');
81
+ }
82
82
  }
83
83
 
84
84
  function ButtonFormPost(theForm)
85
85
  {
86
- try
87
- {
88
- if (typeof(theForm) == "object")
89
- {
90
- theForm.submit();
91
- }
92
- else
93
- {
94
- if (document.getElementById(theForm) && typeof(theForm) !="undefined" && typeof(theForm) != 'null') {
95
- document.getElementById(theForm).submit();
96
- } else {
97
- throw new Exception();
98
- }
86
+ try
87
+ {
88
+ if (typeof(theForm) == "object")
89
+ {
90
+ theForm.submit();
91
+ }
92
+ else
93
+ {
94
+ if (document.getElementById(theForm) && typeof(theForm) !="undefined" && typeof(theForm) != 'null') {
95
+ document.getElementById(theForm).submit();
96
+ } else {
97
+ throw new Exception();
99
98
  }
100
- }
101
- catch(e)
102
- {
103
- // -- id might not be there, so try the form by name
104
- try
99
+ }
100
+ }
101
+ catch(e)
102
+ {
103
+ // -- id might not be there, so try the form by name
104
+ try
105
+ {
106
+ eval('document.' + theForm + '.submit()');
107
+ }
108
+ catch(e)
109
+ {
110
+ if (document.forms.length == 1)
105
111
  {
106
- eval('document.' + theForm + '.submit()');
112
+ document.forms[0].submit();
107
113
  }
108
- catch(e)
114
+ else
109
115
  {
110
- if (document.forms.length == 1)
111
- {
112
- document.forms[0].submit();
113
- }
114
- else
115
- {
116
- return false;
117
- }
116
+ return false;
118
117
  }
119
- }
118
+ }
119
+ }
120
120
  }
121
121
 
122
122
 
123
123
  function ButtonLinkPost(inUrl)
124
124
  {
125
- try
126
- {
127
- Redirect(inUrl);
128
- }
129
- catch(e)
130
- {
131
- if(debugFlag)
132
- {
133
- Debug(e);
134
- }
135
- }
125
+ try
126
+ {
127
+ Redirect(inUrl);
128
+ }
129
+ catch(e)
130
+ {
131
+ if(debugFlag)
132
+ {
133
+ Debug(e);
134
+ }
135
+ }
136
136
  }
137
137
 
138
138
  function ajaxStatus(eToHide, fadeInOut)
139
139
  {
140
140
 
141
- if(document.getElementById(eToHide))
142
- {
143
- elmToHide = document.getElementById(eToHide);
141
+ if(document.getElementById(eToHide))
142
+ {
143
+ elmToHide = document.getElementById(eToHide);
144
144
 
145
- eHider = "loading" + eToHide;
145
+ eHider = "loading" + eToHide;
146
146
 
147
- if(document.getElementById(eHider))
147
+ if(document.getElementById(eHider))
148
+ {
149
+ elmHider = document.getElementById(eHider);
150
+ }
151
+ else
152
+ {
153
+ var radius = '';
154
+ if(document.getElementById(eToHide + '_radius'))
148
155
  {
149
- elmHider = document.getElementById(eHider);
156
+ var radiusValue = document.getElementById(eToHide + '_radius').value;
157
+ radius = '-moz-border-radius-bottomleft:' + radiusValue + ';-webkit-border-bottom-left-radius:' + radiusValue + ';border-bottom-left-radius:' + radiusValue + ';-moz-border-radius-bottomright:' + radiusValue + ';-webkit-border-bottom-right-radius:' + radiusValue + ';border-bottom-right-radius:' + radiusValue + ';-moz-border-radius-topright:' + radiusValue + ';-webkit-border-top-right-radius:' + radiusValue + ';border-top-right-radius:' + radiusValue + ';-moz-border-radius-topleft:' + radiusValue + ';-webkit-border-top-left-radius:' + radiusValue + ';border-top-left-radius:' + radiusValue + ';';
150
158
  }
151
- else
152
- {
153
- var radius = '';
154
- if(document.getElementById(eToHide + '_radius'))
155
- {
156
- var radiusValue = document.getElementById(eToHide + '_radius').value;
157
- radius = '-moz-border-radius-bottomleft:' + radiusValue + ';-webkit-border-bottom-left-radius:' + radiusValue + ';border-bottom-left-radius:' + radiusValue + ';-moz-border-radius-bottomright:' + radiusValue + ';-webkit-border-bottom-right-radius:' + radiusValue + ';border-bottom-right-radius:' + radiusValue + ';-moz-border-radius-topright:' + radiusValue + ';-webkit-border-top-right-radius:' + radiusValue + ';border-top-right-radius:' + radiusValue + ';-moz-border-radius-topleft:' + radiusValue + ';-webkit-border-top-left-radius:' + radiusValue + ';border-top-left-radius:' + radiusValue + ';';
158
- }
159
- var overLay = '<div style="position:relative;top:0px;"><div class="ajaxLoad" id="' + eHider + '" style="height:' + jQuery(elmToHide).height() + 'px;width:' + jQuery(elmToHide).width() + 'px;top:-' + jQuery(elmToHide).height() + 'px;' + radius + '"></div></div>';
159
+ var overLay = '<div style="position:relative;top:0px;"><div class="ajaxLoad" id="' + eHider + '" style="height:' + jQuery(elmToHide).height() + 'px;width:' + jQuery(elmToHide).width() + 'px;top:-' + jQuery(elmToHide).height() + 'px;' + radius + '"></div></div>';
160
160
 
161
- jQuery(elmToHide).append(overLay);
161
+ jQuery(elmToHide).append(overLay);
162
162
 
163
- elmHider = document.getElementById(eHider);
164
- }
163
+ elmHider = document.getElementById(eHider);
164
+ }
165
165
 
166
- if(typeof(fadeInOut) == 'number')
166
+ if(typeof(fadeInOut) == 'number')
167
+ {
168
+ if(fadeInOut > 0)
167
169
  {
168
- if(fadeInOut > 0)
169
- {
170
- fadeInOut = 1;
171
- jQuery(elmHider).fadeTo("fast", .20);
172
- }
173
- else
174
- {
175
- fadeInOut = 0;
176
- jQuery(elmHider).remove();
177
- }
170
+ fadeInOut = 1;
171
+ jQuery(elmHider).fadeTo("fast", .20);
178
172
  }
179
- }
173
+ else
174
+ {
175
+ fadeInOut = 0;
176
+ jQuery(elmHider).remove();
177
+ }
178
+ }
179
+ }
180
180
  }
181
181
 
182
182
 
183
183
  function ListChangeGrouping(listId, obj, extra)
184
184
  {
185
- if (typeof(extra) == 'undefined')
186
- {
187
- var extra = '';
188
- }
189
- ajaxStatus(listId, 1);
190
- HideAdvancedSearch(jQuery('#' + listId + '-group'));
191
- jQuery('#list_search_id_' + listId ).val('');
192
- InitInfoFields(jQuery('#list_search_id_' + listId));
193
- ListJumpMin(jQuery('#' + listId + '_jump_url').val() + '&searchClear=1&switch_grouping=' + jQuery('#list_group_id_' + listId ).val() + '&group_row_id=' + jQuery(obj).attr('id') + extra , listId);
185
+ if (typeof(extra) == 'undefined')
186
+ {
187
+ var extra = '';
188
+ }
189
+ ajaxStatus(listId, 1);
190
+ HideAdvancedSearch(jQuery('#' + listId + '-group'));
191
+ jQuery('#list_search_id_' + listId ).val('');
192
+ InitInfoFields(jQuery('#list_search_id_' + listId));
193
+ ListJumpMin(jQuery('#' + listId + '_jump_url').val() + '&searchClear=1&switch_grouping=' + jQuery('#list_group_id_' + listId ).val() + '&group_row_id=' + jQuery(obj).attr('id') + extra , listId);
194
194
  }
195
195
 
196
196
  function ListHome(listId)
197
197
  {
198
- ListJumpMin(jQuery('#' + listId + '_jump_url_original').val() + '&searchClear=1', listId, function(){
199
- InitInfoFields(jQuery('#list_search_id_' + listId));
200
- });
198
+ ListJumpMin(jQuery('#' + listId + '_jump_url_original').val() + '&searchClear=1', listId, function(){
199
+ InitInfoFields(jQuery('#list_search_id_' + listId));
200
+ });
201
201
  }
202
202
 
203
203
  function ListDrillDown(mode, data, listId, extra)
204
204
  {
205
- jQuery('#list_search_id_' + listId).val('');
206
- var grouping = '';
207
- if (jQuery('#list_group_id_' + listId))
208
- {
209
- grouping = '&switch_grouping=' + jQuery('#list_group_id_' + listId).val();
210
- }
211
- ListJumpMin(jQuery('#' + listId + '_jump_url').val() + '&drill_down=' + mode + '&filter=' + data + grouping + '&search_filter=' + extra, listId, function(){
212
- InitInfoFields(jQuery('#list_search_id_' + listId));
213
- });
205
+ jQuery('#list_search_id_' + listId).val('');
206
+ var grouping = '';
207
+ if (jQuery('#list_group_id_' + listId))
208
+ {
209
+ grouping = '&switch_grouping=' + jQuery('#list_group_id_' + listId).val();
210
+ }
211
+ ListJumpMin(jQuery('#' + listId + '_jump_url').val() + '&drill_down=' + mode + '&filter=' + data + grouping + '&search_filter=' + extra, listId, function(){
212
+ InitInfoFields(jQuery('#list_search_id_' + listId));
213
+ });
214
214
  }
215
215
 
216
216
  function ListDrillDownGetRowValue(obj)
217
217
  {
218
- return (typeof(jQuery(obj).next(".val-db").html()) != 'undefined') ? jQuery(obj).next(".val-db").html() : '';
218
+ return (typeof(jQuery(obj).next(".val-db").html()) != 'undefined') ? jQuery(obj).next(".val-db").html() : '';
219
219
  }
220
220
 
221
221
  function ListExport(listId)
222
222
  {
223
- document.location = jQuery('#' + listId + '_jump_url').val() + '&export_widget_list=1';
223
+ document.location = jQuery('#' + listId + '_jump_url').val() + '&export_widget_list=1';
224
224
  }
225
225
 
226
226
 
227
227
  /**
228
- * ListJumpResponse()
229
- */
228
+ * ListJumpResponse()
229
+ */
230
230
  function ListJumpResponse(response)
231
231
  {
232
- //ajaxStatus("loading" + response['list_id'], 0);
233
- jQuery(document.getElementById(response['list_id'])).after(response['list']).remove();
234
-
235
- if(typeof response['callback'] === 'string')
236
- {
237
- eval(response['callback'] + '()');
238
- }
239
-
240
- if(typeof response['search_bar'] === 'string')
241
- {
242
- jQuery('.' + response['list_id'] + '-search').replaceWith(response['search_bar']);
243
- InitInfoFields(jQuery('#list_search_id_' + response['list_id']));
244
- }
245
-
246
- if(typeof response['export_button'] === 'string')
247
- {
248
- jQuery('.' + response['list_id'] + '-export').replaceWith(response['export_button']);
249
- }
250
-
251
- if(typeof response['group_by_items'] === 'string')
252
- {
253
- jQuery('.' + response['list_id'] + '-group-by').replaceWith(response['group_by_items']);
254
- }
232
+ //ajaxStatus("loading" + response['list_id'], 0);
233
+ jQuery(document.getElementById(response['list_id'])).after(response['list']).remove();
234
+
235
+ if(typeof response['callback'] === 'string')
236
+ {
237
+ eval(response['callback'] + '()');
238
+ }
239
+
240
+ if(typeof response['search_bar'] === 'string')
241
+ {
242
+ jQuery('.' + response['list_id'] + '-search').replaceWith(response['search_bar']);
243
+ InitInfoFields(jQuery('#list_search_id_' + response['list_id']));
244
+ }
245
+
246
+ if(typeof response['export_button'] === 'string')
247
+ {
248
+ jQuery('.' + response['list_id'] + '-export').replaceWith(response['export_button']);
249
+ }
250
+
251
+ if(typeof response['group_by_items'] === 'string')
252
+ {
253
+ jQuery('.' + response['list_id'] + '-group-by').replaceWith(response['group_by_items']);
254
+ }
255
255
  }
256
256
 
257
257
  /**
@@ -259,51 +259,51 @@ function ListJumpResponse(response)
259
259
  */
260
260
  function ListMessagePopup(id, html, hieght, width)
261
261
  {
262
- jQuery('.ajaxLoad,.ajaxLoad2').remove();
263
- if (typeof(hieght) =="undefined")
264
- {
265
- var hieght = '200'
266
- }
267
- if (typeof(width) =="undefined")
268
- {
269
- var width = '400'
270
- }
262
+ jQuery('.ajaxLoad,.ajaxLoad2').remove();
263
+ if (typeof(hieght) =="undefined")
264
+ {
265
+ var hieght = '200'
266
+ }
267
+ if (typeof(width) =="undefined")
268
+ {
269
+ var width = '400'
270
+ }
271
271
 
272
- if(document.getElementById(id))
273
- {
274
- elmToHide = document.getElementById(id);
275
- var overLay = '<div style="position:relative;top:0px;"><div id="loading' + id + '" class="ajaxLoad" style="height:' + jQuery(elmToHide).height() + 'px;width:' + jQuery(elmToHide).width() + 'px;top:-' + jQuery(elmToHide).height() + 'px;"></div></div><div class="ajaxLoad2" id="message' + id + '" style="height:' + hieght + 'px;width:' + width + 'px;left:100px;top:200px;left:250px;z-index: 1000;background-position: 50% 50%;position: absolute;display: block;border:2px solid #dadada;box-shadow:0 2px 4px #c0c0c0;text-align:center;background-color:#FFFFFF;padding:15px;">' + html + '</div>';
272
+ if(document.getElementById(id))
273
+ {
274
+ elmToHide = document.getElementById(id);
275
+ var overLay = '<div style="position:relative;top:0px;"><div id="loading' + id + '" class="ajaxLoad" style="height:' + jQuery(elmToHide).height() + 'px;width:' + jQuery(elmToHide).width() + 'px;top:-' + jQuery(elmToHide).height() + 'px;"></div></div><div class="ajaxLoad2" id="message' + id + '" style="height:' + hieght + 'px;width:' + width + 'px;left:100px;top:200px;left:250px;z-index: 1000;background-position: 50% 50%;position: absolute;display: block;border:2px solid #dadada;box-shadow:0 2px 4px #c0c0c0;text-align:center;background-color:#FFFFFF;padding:15px;">' + html + '</div>';
276
276
 
277
- jQuery(elmToHide).append(overLay);
277
+ jQuery(elmToHide).append(overLay);
278
278
 
279
- jQuery('#message' + id).children( ).each( function( index )
280
- {
281
- jQuery( this ).addClass( 'tmp-popup-class' );
282
- });
279
+ jQuery('#message' + id).children( ).each( function( index )
280
+ {
281
+ jQuery( this ).addClass( 'tmp-popup-class' );
282
+ });
283
283
 
284
- jQuery('#loading' + id).fadeTo("fast", .20);
284
+ jQuery('#loading' + id).fadeTo("fast", .20);
285
285
 
286
- jQuery('html,body').animate({scrollTop: jQuery('#message' + id).offset().top - 100 }, 400);
287
- }
286
+ jQuery('html,body').animate({scrollTop: jQuery('#message' + id).offset().top - 100 }, 400);
287
+ }
288
+
289
+ jQuery("body").unbind('click');
288
290
 
289
- jQuery("body").unbind('click');
290
-
291
- setTimeout(function() {
292
- jQuery("body").click
293
- (
294
- function(e)
295
- {
296
- if(e.target.id == 'message' + id || e.target.className == 'tmp-popup-class')
297
- {
298
- return false;
299
- }
300
- if (jQuery('#' + e.target.id).parents('#message' + id).length == 0 || (e.target.id != 'message' + id && jQuery('#' + e.target.id).parents('#message' + id).length != 1))
301
- {
302
- jQuery('#message' + id + ', #loading'+ id).remove();
303
- }
304
- }
305
- );
306
- }, 1000);
291
+ setTimeout(function() {
292
+ jQuery("body").click
293
+ (
294
+ function(e)
295
+ {
296
+ if(e.target.id == 'message' + id || e.target.className == 'tmp-popup-class')
297
+ {
298
+ return false;
299
+ }
300
+ if (jQuery('#' + e.target.id).parents('#message' + id).length == 0 || (e.target.id != 'message' + id && jQuery('#' + e.target.id).parents('#message' + id).length != 1))
301
+ {
302
+ jQuery('#message' + id + ', #loading'+ id).remove();
303
+ }
304
+ }
305
+ );
306
+ }, 1000);
307
307
  }
308
308
 
309
309
  /**
@@ -311,90 +311,90 @@ function ListMessagePopup(id, html, hieght, width)
311
311
  */
312
312
  function ListMessageClose()
313
313
  {
314
- jQuery('.ajaxLoad,.ajaxLoad2').remove();
314
+ jQuery('.ajaxLoad,.ajaxLoad2').remove();
315
315
  }
316
316
 
317
317
 
318
318
  /**
319
- * ListJumpMin()
320
- */
319
+ * ListJumpMin()
320
+ */
321
321
  function ListJumpMin(url, id, callback, post)
322
322
  {
323
- if(document.getElementById(id))
324
- {
325
- ajaxStatus(id, 1);
326
- }
323
+ if(document.getElementById(id))
324
+ {
325
+ ajaxStatus(id, 1);
326
+ }
327
327
 
328
- if(document.getElementById(id))
329
- {
330
- try
331
- {
332
- jQuery.post(url, post, function(response)
333
- {
334
- ListJumpResponse(response);
335
- if (typeof(callback) == 'string')
336
- {
337
- eval(callback);
338
- }
339
- else if (typeof(callback) == 'function')
340
- {
341
- (callback)();
342
- }
343
- }, "json");
344
- }
345
- catch(e)
328
+ if(document.getElementById(id))
329
+ {
330
+ try
331
+ {
332
+ jQuery.post(url, post, function(response)
346
333
  {
347
- console.log(e);
348
- }
349
- }
334
+ ListJumpResponse(response);
335
+ if (typeof(callback) == 'string')
336
+ {
337
+ eval(callback);
338
+ }
339
+ else if (typeof(callback) == 'function')
340
+ {
341
+ (callback)();
342
+ }
343
+ }, "json");
344
+ }
345
+ catch(e)
346
+ {
347
+ console.log(e);
348
+ }
349
+ }
350
350
  }
351
351
 
352
352
  function ListSearchAheadResponse()
353
353
  {
354
- if(ListSearchAheadInProgress)
355
- {
356
- ListSearchAheadInProgress = false;
354
+ if(ListSearchAheadInProgress)
355
+ {
356
+ ListSearchAheadInProgress = false;
357
357
 
358
- if(ListSearchAheadQueueElement != '')
359
- {
360
- (ListSearchAheadQueueElement)(ListSearchAheadInProgressUrl,ListSearchAheadInProgressTarget,ListSearchAheadInProgressObj);
358
+ if(ListSearchAheadQueueElement != '')
359
+ {
360
+ (ListSearchAheadQueueElement)(ListSearchAheadInProgressUrl,ListSearchAheadInProgressTarget,ListSearchAheadInProgressObj);
361
361
 
362
- ListSearchAheadQueueElement = '';
363
- }
364
- }
362
+ ListSearchAheadQueueElement = '';
363
+ }
364
+ }
365
365
  }
366
366
 
367
367
  /**
368
- * ListSearchAhead()
369
- */
368
+ * ListSearchAhead()
369
+ */
370
370
  function ListSearchAhead(url, id, element)
371
371
  {
372
- if(! ListSearchAheadInProgress && jQuery(element).length && typeof(jQuery(element).val()) != 'undefined' && jQuery(element).val() != jQuery(element).attr('title'))
373
- {
374
- ListSearchAheadInProgress = true;
375
- ListJumpMin(url+ '&search_filter=' + jQuery(element).val(), id);
376
- }
372
+ if(! ListSearchAheadInProgress && jQuery(element).length && typeof(jQuery(element).val()) != 'undefined' && jQuery(element).val() != jQuery(element).attr('title'))
373
+ {
374
+ ListSearchAheadInProgress = true;
375
+ ListJumpMin(url+ '&search_filter=' + jQuery(element).val(), id);
376
+ }
377
377
  }
378
378
 
379
379
  /**
380
- * ListSearchAheadQueue()
381
- */
380
+ * ListSearchAheadQueue()
381
+ */
382
382
  function ListSearchAheadQueue(url, id, element)
383
383
  {
384
- if(! ListSearchAheadInProgress)
385
- {
386
- ListSearchAheadGlobalElement = element;
384
+ if(! ListSearchAheadInProgress)
385
+ {
386
+ ListSearchAheadGlobalElement = element;
387
387
 
388
- setTimeout("ListSearchAhead('"+url+"', '"+id+"', ListSearchAheadGlobalElement)", 500);
389
- }
390
- else
391
- {
392
- ListSearchAheadInProgressUrl = url;
393
- ListSearchAheadInProgressTarget = id;
394
- ListSearchAheadInProgressObj = element;
388
+ setTimeout("ListSearchAhead('"+url+"', '"+id+"', ListSearchAheadGlobalElement)", 500);
389
+ }
390
+ else
391
+ {
392
+ ListSearchAheadInProgressUrl = url;
393
+ ListSearchAheadInProgressTarget = id;
394
+ ListSearchAheadInProgressObj = element;
395
395
 
396
- ListSearchAheadQueueElement = ListSearchAhead;
397
- }
396
+ ListSearchAheadQueueElement = ListSearchAhead;
397
+ }
398
398
  }
399
399
 
400
400
  var WidgetSearchAheadQueuedRawDog = '';
@@ -404,58 +404,58 @@ var WidgetSearchAheadInProgressTarget;
404
404
  var WidgetSearchAheadInProgressObj;
405
405
 
406
406
  /**
407
- * WidgetSearchAheadResponse()
408
- *
409
- * @note searchTarget is the
410
- *
411
- * @todo session/token based WidgetSearchAheadQueuedRawDog?
412
- */
407
+ * WidgetSearchAheadResponse()
408
+ *
409
+ * @note searchTarget is the
410
+ *
411
+ * @todo session/token based WidgetSearchAheadQueuedRawDog?
412
+ */
413
413
  function WidgetSearchAheadResponse(response)
414
414
  {
415
- if(WidgetSearchAheadInProgress)
416
- {
417
- WidgetSearchAheadInProgress = false;
415
+ if(WidgetSearchAheadInProgress)
416
+ {
417
+ WidgetSearchAheadInProgress = false;
418
418
 
419
- if(WidgetSearchAheadQueuedRawDog != '')
420
- {
421
- (WidgetSearchAheadQueuedRawDog)(WidgetSearchAheadInProgressUrl,WidgetSearchAheadInProgressTarget,WidgetSearchAheadInProgressObj);
419
+ if(WidgetSearchAheadQueuedRawDog != '')
420
+ {
421
+ (WidgetSearchAheadQueuedRawDog)(WidgetSearchAheadInProgressUrl,WidgetSearchAheadInProgressTarget,WidgetSearchAheadInProgressObj);
422
422
 
423
- WidgetSearchAheadQueuedRawDog = '';
424
- }
425
- }
423
+ WidgetSearchAheadQueuedRawDog = '';
424
+ }
425
+ }
426
426
 
427
- var searchResults = '';
428
- var searchTarget = '';
427
+ var searchResults = '';
428
+ var searchTarget = '';
429
429
 
430
- //Capture the results
431
- //
432
- if(response && typeof(response['content']) != 'undefined' && response['content'] != '')
433
- {
434
- searchResults = response['content'];
435
- }
430
+ //Capture the results
431
+ //
432
+ if(response && typeof(response['content']) != 'undefined' && response['content'] != '')
433
+ {
434
+ searchResults = response['content'];
435
+ }
436
436
 
437
- if(response && typeof(response['target']) != 'undefined' && response['target'] != '')
438
- {
439
- var result = response['target'] + '_results';
440
- var searchTarget = document.getElementById(result);
441
- }
437
+ if(response && typeof(response['target']) != 'undefined' && response['target'] != '')
438
+ {
439
+ var result = response['target'] + '_results';
440
+ var searchTarget = document.getElementById(result);
441
+ }
442
442
 
443
- jQuery('.widget-search-content', searchTarget).html(searchResults);
443
+ jQuery('.widget-search-content', searchTarget).html(searchResults);
444
444
 
445
- if(searchResults != '')
446
- {
447
- if(! jQuery(searchTarget).is(':visible'));
448
- {
449
- jQuery(searchTarget).slideDown();
450
- }
451
- }
452
- else
453
- {
454
- if(jQuery(searchTarget).is(':visible'));
455
- {
456
- jQuery(searchTarget).slideUp();
457
- }
458
- }
445
+ if(searchResults != '')
446
+ {
447
+ if(! jQuery(searchTarget).is(':visible'));
448
+ {
449
+ jQuery(searchTarget).slideDown();
450
+ }
451
+ }
452
+ else
453
+ {
454
+ if(jQuery(searchTarget).is(':visible'));
455
+ {
456
+ jQuery(searchTarget).slideUp();
457
+ }
458
+ }
459
459
  }
460
460
 
461
461
  /**
@@ -463,178 +463,178 @@ function WidgetSearchAheadResponse(response)
463
463
  */
464
464
  function WidgetInputSearchAhead(url, target, obj)
465
465
  {
466
- if(! WidgetSearchAheadInProgress)
467
- {
468
- WidgetSearchAheadInProgress = true;
466
+ if(! WidgetSearchAheadInProgress)
467
+ {
468
+ WidgetSearchAheadInProgress = true;
469
469
 
470
- if(document.getElementById(target) && document.getElementById(target).value != document.getElementById(target).title)
470
+ if(document.getElementById(target) && document.getElementById(target).value != document.getElementById(target).title)
471
+ {
472
+ var targetElement = document.getElementById(target + '_results');
473
+
474
+ if(! jQuery('.widget-search-content', targetElement).html())
471
475
  {
472
- var targetElement = document.getElementById(target + '_results');
476
+ /* jQuery('.widget-search-content', targetElement).html(limeload);
473
477
 
474
- if(! jQuery('.widget-search-content', targetElement).html())
478
+ if(! jQuery(targetElement).is(':visible'));
475
479
  {
476
- /* jQuery('.widget-search-content', targetElement).html(limeload);
477
-
478
- if(! jQuery(targetElement).is(':visible'));
479
- {
480
- jQuery(targetElement).slideDown();
481
- }*/
482
- }
483
-
484
- jQuery.post(url, {target:target,value:document.getElementById(target).value}, WidgetSearchAheadResponse, 'json');
480
+ jQuery(targetElement).slideDown();
481
+ }*/
485
482
  }
486
- }
487
- else
488
- {
489
- WidgetSearchAheadInProgressUrl = url;
490
- WidgetSearchAheadInProgressTarget = target;
491
- WidgetSearchAheadInProgressObj = obj;
492
-
493
- WidgetSearchAheadQueuedRawDog = WidgetInputSearchAhead;
494
- }
483
+
484
+ jQuery.post(url, {target:target,value:document.getElementById(target).value}, WidgetSearchAheadResponse, 'json');
485
+ }
486
+ }
487
+ else
488
+ {
489
+ WidgetSearchAheadInProgressUrl = url;
490
+ WidgetSearchAheadInProgressTarget = target;
491
+ WidgetSearchAheadInProgressObj = obj;
492
+
493
+ WidgetSearchAheadQueuedRawDog = WidgetInputSearchAhead;
494
+ }
495
495
  }
496
496
 
497
497
  /**
498
- * WidgetInputSearchAhead()
499
- *
500
- * @todo Log last keyup and launch it if it exceeds the wait time of the pending request
501
- * @todo multiple search aheads on one page
502
- * @todo baseurl
503
- * @todo duration parameter
504
- */
498
+ * WidgetInputSearchAhead()
499
+ *
500
+ * @todo Log last keyup and launch it if it exceeds the wait time of the pending request
501
+ * @todo multiple search aheads on one page
502
+ * @todo baseurl
503
+ * @todo duration parameter
504
+ */
505
505
  function WidgetInputSearchAheadQueue(url, id, obj)
506
506
  {
507
- setTimeout("WidgetInputSearchAhead('"+url+"', '"+id+"', '"+obj+"')", 500);
507
+ setTimeout("WidgetInputSearchAhead('"+url+"', '"+id+"', '"+obj+"')", 500);
508
508
  }
509
509
 
510
510
 
511
511
  function WidgetAdvancedSearchReset(form_id, list_id, url)
512
512
  {
513
- var frm_elements = document.getElementById(form_id);
514
-
515
- for (i = 0; i < frm_elements.length; i++)
516
- {
517
- field_type = frm_elements[i].type.toLowerCase();
518
- switch (field_type)
519
- {
520
- case "text":
521
- case "password":
522
- case "textarea":
523
- frm_elements[i].value = "";
524
- break;
525
- case "radio":
526
- case "checkbox":
527
- if (frm_elements[i].checked)
528
- {
529
- frm_elements[i].checked = false;
530
- }
531
- break;
532
- case "select-one":
533
- case "select-multi":
534
- frm_elements[i].selectedIndex = 0;
535
- break;
536
- default:
537
- break;
538
- }
539
- }
540
-
541
- InitInfoFields();
542
- ListJumpMin(url, list_id);
513
+ var frm_elements = document.getElementById(form_id);
514
+
515
+ for (i = 0; i < frm_elements.length; i++)
516
+ {
517
+ field_type = frm_elements[i].type.toLowerCase();
518
+ switch (field_type)
519
+ {
520
+ case "text":
521
+ case "password":
522
+ case "textarea":
523
+ frm_elements[i].value = "";
524
+ break;
525
+ case "radio":
526
+ case "checkbox":
527
+ if (frm_elements[i].checked)
528
+ {
529
+ frm_elements[i].checked = false;
530
+ }
531
+ break;
532
+ case "select-one":
533
+ case "select-multi":
534
+ frm_elements[i].selectedIndex = 0;
535
+ break;
536
+ default:
537
+ break;
538
+ }
539
+ }
540
+
541
+ InitInfoFields();
542
+ ListJumpMin(url, list_id);
543
543
  }
544
544
 
545
545
 
546
546
  function BuildUrl(getVars)
547
547
  {
548
- var url = '';
549
- jQuery.each(getVars, function(field, value)
550
- {
551
- url += '&' + field + '=' + escape(value);
552
- });
553
- return url;
548
+ var url = '';
549
+ jQuery.each(getVars, function(field, value)
550
+ {
551
+ url += '&' + field + '=' + escape(value);
552
+ });
553
+ return url;
554
554
  }
555
555
 
556
556
  (function(ll)
557
557
  {
558
- jQuery(document).ready(
559
- function()
560
- {
561
- InitInfoFields();
562
- });
558
+ jQuery(document).ready(
559
+ function()
560
+ {
561
+ InitInfoFields();
562
+ });
563
563
  })(jQuery);
564
564
 
565
565
 
566
566
  function InjectInfoField(inField,message)
567
567
  {
568
- if(typeof(message) == 'undefined' || message == '')
569
- {
570
- var message = '';
571
- var color = 'black';
572
- }
573
- else
574
- {
575
- var color = 'red';
576
- }
577
- jQuery(inField).attr('title',message);
578
- InitInfoFields(inField);
579
- jQuery(inField).css('color',color);
568
+ if(typeof(message) == 'undefined' || message == '')
569
+ {
570
+ var message = '';
571
+ var color = 'black';
572
+ }
573
+ else
574
+ {
575
+ var color = 'red';
576
+ }
577
+ jQuery(inField).attr('title',message);
578
+ InitInfoFields(inField);
579
+ jQuery(inField).css('color',color);
580
580
  }
581
581
 
582
582
  /**
583
- * InitInfoFields()
584
- *
585
- * @todo assign the info-input class if an object is passed in to preserve the functionality
586
- */
583
+ * InitInfoFields()
584
+ *
585
+ * @todo assign the info-input class if an object is passed in to preserve the functionality
586
+ */
587
587
  function InitInfoFields(inField)
588
588
  {
589
- var theField = jQuery('.info-input');
589
+ var theField = jQuery('.info-input');
590
590
 
591
- if(typeof(inField) != 'undefined')
592
- {
593
- theField = inField;
594
- }
591
+ if(typeof(inField) != 'undefined')
592
+ {
593
+ theField = inField;
594
+ }
595
595
 
596
- if(jQuery(theField).length)
597
- {
598
- //Assign an inputs title to its values initially
599
- //
600
- jQuery(theField).each(
601
- function()
602
- {
603
- if(jQuery(this).val() == '')
604
- {
596
+ if(jQuery(theField).length)
597
+ {
598
+ //Assign an inputs title to its values initially
599
+ //
600
+ jQuery(theField).each(
601
+ function()
602
+ {
603
+ if(jQuery(this).val() == '')
604
+ {
605
605
  jQuery(this).val(jQuery(this).attr('title'));
606
606
 
607
607
  //Adjust its class to appear passive
608
608
  //
609
609
  jQuery(this).addClass('info-input-field-inactive');
610
- }
611
- });
610
+ }
611
+ });
612
612
 
613
- jQuery(theField).blur(
614
- function()
615
- {
616
- if(jQuery(this).val() != jQuery(this).attr('title'))
617
- {
613
+ jQuery(theField).blur(
614
+ function()
615
+ {
616
+ if(jQuery(this).val() != jQuery(this).attr('title'))
617
+ {
618
618
  jQuery(this).css('color','black');
619
619
  if(jQuery(this).val() == '')
620
620
  {
621
- jQuery(this).css('color','#b4b3b3');
622
- jQuery(this).removeClass('info-input-field-active');
623
- jQuery(this).val(jQuery(this).attr('title'));
624
- jQuery(this).addClass('info-input-field-inactive');
621
+ jQuery(this).css('color','#b4b3b3');
622
+ jQuery(this).removeClass('info-input-field-active');
623
+ jQuery(this).val(jQuery(this).attr('title'));
624
+ jQuery(this).addClass('info-input-field-inactive');
625
625
  }
626
- }
627
- else
628
- {
626
+ }
627
+ else
628
+ {
629
629
  jQuery(this).css('color','#b4b3b3');
630
- }
631
- });
630
+ }
631
+ });
632
632
 
633
- jQuery(theField).focus(
634
- function()
635
- {
636
- if(jQuery(this).val() == jQuery(this).attr('title'))
637
- {
633
+ jQuery(theField).focus(
634
+ function()
635
+ {
636
+ if(jQuery(this).val() == jQuery(this).attr('title'))
637
+ {
638
638
  jQuery(this).removeClass('info-input-field-inactive');
639
639
  jQuery(this).addClass('info-input-field-active');
640
640
 
@@ -642,86 +642,86 @@ function InitInfoFields(inField)
642
642
  //
643
643
  if(jQuery(this).val() != '' && jQuery(this).val() == jQuery(this).attr('title'))
644
644
  {
645
- jQuery(this).val('');
645
+ jQuery(this).val('');
646
646
  }
647
- }
648
- else
649
- {
647
+ }
648
+ else
649
+ {
650
650
  jQuery(this).css('color','black');
651
651
  jQuery(this).addClass('info-input-field-active');
652
- }
653
- });
654
- }
652
+ }
653
+ });
654
+ }
655
655
  }
656
656
 
657
657
  /**
658
- * AjaxMaintainChecks()
659
- *
660
- * @param obj
661
- * @param checkbox_class
662
- * @param list_id
663
- * @param url
664
- * @param check_all_id
665
- */
658
+ * AjaxMaintainChecks()
659
+ *
660
+ * @param obj
661
+ * @param checkbox_class
662
+ * @param list_id
663
+ * @param url
664
+ * @param check_all_id
665
+ */
666
666
  function AjaxMaintainChecks(obj, checkbox_class, list_id, url, check_all_id)
667
667
  {
668
- AjaxMaintainChecksRunning = true;
669
- var serializedChecks = '';
670
- var checkedAllBool = true;
671
- var checkedAllString = '1';
672
- var checkAllId = checkbox_class + '_all';
668
+ AjaxMaintainChecksRunning = true;
669
+ var serializedChecks = '';
670
+ var checkedAllBool = true;
671
+ var checkedAllString = '1';
672
+ var checkAllId = checkbox_class + '_all';
673
673
 
674
- /**
674
+ /**
675
675
  * Checking All
676
676
  */
677
- if(check_all_id && check_all_id != '' && jQuery('#' + check_all_id).length > 0)
678
- {
679
- //Overwrite assumed check-all checkbox id
680
- //
681
- checkAllId = check_all_id;
682
-
683
- //Check or uncheck check-all checkbox
684
- //
685
- jQuery('.' + checkbox_class).not(':disabled').attr('checked', jQuery('#' + checkAllId).is(':checked'));
686
- }
687
-
688
- /**
677
+ if(check_all_id && check_all_id != '' && jQuery('#' + check_all_id).length > 0)
678
+ {
679
+ //Overwrite assumed check-all checkbox id
680
+ //
681
+ checkAllId = check_all_id;
682
+
683
+ //Check or uncheck check-all checkbox
684
+ //
685
+ jQuery('.' + checkbox_class).not(':disabled').attr('checked', jQuery('#' + checkAllId).is(':checked'));
686
+ }
687
+
688
+ /**
689
689
  * Serialize all checkboxes both checked and unchecked
690
690
  */
691
- jQuery('.' + checkbox_class).not(':disabled').each(
691
+ jQuery('.' + checkbox_class).not(':disabled').each(
692
692
  function(key, value)
693
693
  {
694
- var checked = '0';
695
- if(this.checked)
696
- {
697
- checked = '1';
698
- }
699
- else
700
- {
701
- checkedAllBool = false;
702
- checkedAllString = '0';
703
- }
704
- serializedChecks += escape(this.value) + '=' + checked + '&';
694
+ var checked = '0';
695
+ if(this.checked)
696
+ {
697
+ checked = '1';
698
+ }
699
+ else
700
+ {
701
+ checkedAllBool = false;
702
+ checkedAllString = '0';
703
+ }
704
+ serializedChecks += escape(this.value) + '=' + checked + '&';
705
705
  }
706
- );
706
+ );
707
707
 
708
- /**
708
+ /**
709
709
  * Check All Checkbox Status. On/Off
710
710
  */
711
- jQuery('#' + checkAllId).attr('checked', checkedAllBool);
711
+ jQuery('#' + checkAllId).attr('checked', checkedAllBool);
712
712
 
713
- /**
713
+ /**
714
714
  * Check All for this view (page/sequence
715
715
  */
716
- serializedChecks += 'checked_all=' + checkedAllString;
716
+ serializedChecks += 'checked_all=' + checkedAllString;
717
717
 
718
- /**
718
+ /**
719
719
  * Record everything
720
720
  */
721
- jQuery.post(url, serializedChecks, function()
722
- {
723
- AjaxMaintainChecksRunning = false;
724
- }, "json");
721
+ jQuery.post(url, serializedChecks, function()
722
+ {
723
+ AjaxMaintainChecksRunning = false;
724
+ }, "json");
725
725
 
726
726
 
727
727
 
@@ -729,69 +729,69 @@ function AjaxMaintainChecks(obj, checkbox_class, list_id, url, check_all_id)
729
729
 
730
730
  function ToggleAdvancedSearch(searchElement)
731
731
  {
732
- var contentArea = jQuery(searchElement).closest('div.inputOuter').find('.widget-search-drilldown');
733
- var inputArrow = jQuery(searchElement).closest('div.inputOuter').find('.widget-search-arrow-advanced');
734
- var searchField = jQuery(searchElement).closest('div.inputOuter').find('.search-ahead');
732
+ var contentArea = jQuery(searchElement).closest('div.inputOuter').find('.widget-search-drilldown');
733
+ var inputArrow = jQuery(searchElement).closest('div.inputOuter').find('.widget-search-arrow-advanced');
734
+ var searchField = jQuery(searchElement).closest('div.inputOuter').find('.search-ahead');
735
735
 
736
- jQuery(contentArea).toggle();
736
+ jQuery(contentArea).toggle();
737
737
 
738
- if(jQuery(contentArea).is(':visible'))
739
- {
740
- jQuery(inputArrow).css('visibility', 'hidden');
741
- }
742
- else
743
- {
744
- jQuery(inputArrow).css('visibility', 'visible');
745
- }
738
+ if(jQuery(contentArea).is(':visible'))
739
+ {
740
+ jQuery(inputArrow).css('visibility', 'hidden');
741
+ }
742
+ else
743
+ {
744
+ jQuery(inputArrow).css('visibility', 'visible');
745
+ }
746
746
  }
747
747
 
748
748
  function SelectBoxResetSelectedRow(listId)
749
749
  {
750
- var currentSelection = jQuery('#list_group_id_' + listId).val();
751
- jQuery('.widget-search-results-row[title="' + currentSelection + '"]').addClass('widget-search-results-row-selected');
750
+ var currentSelection = jQuery('#list_group_id_' + listId).val();
751
+ jQuery('.widget-search-results-row[title="' + currentSelection + '"]').addClass('widget-search-results-row-selected');
752
752
  }
753
753
 
754
754
 
755
755
  function SelectBoxSetValue(value, listId)
756
756
  {
757
- jQuery('#list_group_id_' + listId).val(value);
758
- SelectBoxResetSelectedRow(listId);
757
+ jQuery('#list_group_id_' + listId).val(value);
758
+ SelectBoxResetSelectedRow(listId);
759
759
  }
760
760
 
761
761
 
762
762
 
763
763
  function HideAdvancedSearch(searchElement)
764
764
  {
765
- var contentArea = jQuery(searchElement).closest('div.inputOuter').find('.widget-search-drilldown');
766
- var inputArrow = jQuery(searchElement).closest('div.inputOuter').find('.widget-search-arrow-advanced');
765
+ var contentArea = jQuery(searchElement).closest('div.inputOuter').find('.widget-search-drilldown');
766
+ var inputArrow = jQuery(searchElement).closest('div.inputOuter').find('.widget-search-arrow-advanced');
767
767
 
768
- jQuery(contentArea).hide();
768
+ jQuery(contentArea).hide();
769
769
 
770
- jQuery(inputArrow).css('visibility', 'visible');
770
+ jQuery(inputArrow).css('visibility', 'visible');
771
771
  }
772
772
 
773
773
  jQuery(document).ready(function($) {
774
- jQuery(document).ajaxSend(function(e, xhr, options) {
775
- var sid = jQuery("meta[name='csrf-token']").attr("content");
776
- xhr.setRequestHeader("X-CSRF-Token", sid);
777
- });
774
+ jQuery(document).ajaxSend(function(e, xhr, options) {
775
+ var sid = jQuery("meta[name='csrf-token']").attr("content");
776
+ xhr.setRequestHeader("X-CSRF-Token", sid);
777
+ });
778
778
  });
779
779
 
780
780
  (function() {
781
781
 
782
- jQuery(function() {
783
- $('form').on('click', '.remove_fields', function(event) {
784
- $(this).closest('.field').remove();
785
- return event.preventDefault();
786
- });
787
- return $('form').on('click', '.add_fields', function(event) {
788
- var regexp, time;
789
- time = new Date().getTime();
790
- regexp = new RegExp($(this).data('id'), 'g');
791
- $(this).before($(this).data('fields').replace(regexp, time));
792
- return event.preventDefault();
793
- });
782
+ jQuery(function() {
783
+ jQuery('.advanced-search-container-inline li form').on('click', '.remove_fields', function(event) {
784
+ jQuery(this).closest('.field').remove();
785
+ return event.preventDefault();
786
+ });
787
+ return jQuery('.advanced-search-container-inline li form').on('click', '.add_fields', function(event) {
788
+ var regexp, time;
789
+ time = new Date().getTime();
790
+ regexp = new RegExp(jQuery(this).data('id'), 'g');
791
+ jQuery(this).before(jQuery(this).data('fields').replace(regexp, time));
792
+ return event.preventDefault();
794
793
  });
794
+ });
795
795
 
796
796
  }).call(this);
797
797