BMLT Root Server
bmlt_semantic.js
Go to the documentation of this file.
1 /*******************************************************************************************/
2 /**
3  \class BMLTSemanticResult
4 
5  \brief This keeps the state of the result of all that stuff going on in the workshop,
6  and will compile a resulting URI or shortcode.
7 
8  This file is part of the Basic Meeting List Toolbox (BMLT).
9 
10  Find out more at: https://bmlt.app
11 
12  BMLT is free software: you can redistribute it and/or modify
13  it under the terms of the MIT License.
14 
15  BMLT is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  MIT License for more details.
19 
20  You should have received a copy of the MIT License along with this code.
21  If not, see <https://opensource.org/licenses/MIT>.
22 
23  Version: 1.3.4
24 */
25 /*******************************************************************************************/
27  inRootServerURI,
28  inOwner
29 ) {
30  this.root_server_uri = inRootServerURI;
31  this.owner = inOwner;
32 };
33 
34 BMLTSemanticResult.prototype.owner = null; ///< The object that "owns" this.
35 BMLTSemanticResult.prototype.switcher = null; ///< The main "?switcher=" value.
36 BMLTSemanticResult.prototype.meeting_key = null; ///< The main "meeting_key=" value.
37 BMLTSemanticResult.prototype.meeting_key_value = null; ///< The value selected by the field select.
38 BMLTSemanticResult.prototype.root_server_uri = null; ///< The main Root Server URI.
39 BMLTSemanticResult.prototype.services = null; ///< The selected Service bodies. This is a CSV string of integer IDs.
40 BMLTSemanticResult.prototype.formats = null; ///< The selected formats. This is a CSV string of integer IDs.
41 BMLTSemanticResult.prototype.formats_comparison_operator = "AND";
42 BMLTSemanticResult.prototype.weekdays = null; ///< The selected weekdays (1-7). This is a CSV string of integer IDs.
43 BMLTSemanticResult.prototype.sb_id = null; ///< This contains the Service body used for the NAWS dump.
44 BMLTSemanticResult.prototype.change_start = null; ///< This will be the start date for getting changes.
45 BMLTSemanticResult.prototype.change_end = null; ///< This will be the end date for getting changes.
46 BMLTSemanticResult.prototype.change_id = null; ///< This will be the meeting ID for changes.
47 BMLTSemanticResult.prototype.change_sb_id = null; ///< This will be the Service body ID for changes.
48 BMLTSemanticResult.prototype.searchText = null; ///< The text to search for in meetings.
49 BMLTSemanticResult.prototype.searchTextModifier = null; ///< Any modifier for the text search.
50 BMLTSemanticResult.prototype.searchTextRadius = null; ///< A possible radius for the text (if location).
51 BMLTSemanticResult.prototype.searchMapRadius = -10; ///< A radius for the map. Default is auto-search 10 meetings.
52 BMLTSemanticResult.prototype.searchLongitude = null; ///< If using the map, the longitude.
53 BMLTSemanticResult.prototype.searchLatitude = null; ///< If using the map, the latitude.
54 BMLTSemanticResult.prototype.compiled_params = null; ///< This will contain the temporary compiled parameters.
55 BMLTSemanticResult.prototype.fields = Array(); ///< This will hold any specific fields to be returned.
56 BMLTSemanticResult.prototype.sorts = null; ///< This holds an array of objects that will indicate a chosen sort. The object schema will be: {"key":STRING,"order",INTEGER}
57 BMLTSemanticResult.prototype.weekdayHeader = null; ///< This will be set to nonzero if the BMLT_SIMPLE result will be separated by weekday.
58 BMLTSemanticResult.prototype.startTimeMin = null; ///< This will have an array, with the minimum start time. Hours will be element 0, minutes, element 1.
59 BMLTSemanticResult.prototype.startTimeMax = null; ///< This will have an array, with the maximum start time. Hours will be element 0, minutes, element 1.
60 BMLTSemanticResult.prototype.durationMin = null; ///< This will have an array, with the minimum duration. Hours will be element 0, minutes, element 1.
61 BMLTSemanticResult.prototype.durationMax = null; ///< This will have an array, with the minimum duration. Hours will be element 0, minutes, element 1.
62 BMLTSemanticResult.prototype.valid = null; ///< This will be non-null if the compiled result is valid (only after compile()).
63 
64 /*******************************************************************************************/
65 /**
66  \brief
67 */
68 /*******************************************************************************************/
69 BMLTSemanticResult.prototype.compile = function () {
70  if ( this.owner.getScopedElement('bmlt_semantic_form_main_mode_select').value == 'SHORTCODE_TABLE' ) {
71  this.compiled_params = '';
72  } else {
73  this.compiled_params = 'switcher=' + this.switcher;
74  };
75 
76  this.valid = null;
77 
78  switch ( this.switcher ) {
79  case 'GetSearchResults':
80  this.compileSearchResults();
81  break;
82 
83  case 'GetChanges':
84  this.compileChanges();
85  break;
86 
87  case 'GetFieldValues':
88  this.compileFieldValues();
89  break;
90 
91  case 'GetNAWSDump':
92  this.compileNAWSDump();
93  break;
94 
95  case 'GetFormats':
96  this.compileFormats();
97  break;
98 
99  default:
100  this.valid = true;
101  break;
102  };
103 
104  return this.compiled_params;
105 };
106 
107 /*******************************************************************************************/
108 /**
109  \brief
110 */
111 /*******************************************************************************************/
112 BMLTSemanticResult.prototype.compileFormats = function () {
113  var formatLangSelect = this.owner.getScopedElement('bmlt_semantic_formats_lang_select');
114 
115  if ( formatLangSelect && formatLangSelect.value ) {
116  this.compiled_params += '&lang_enum=' + formatLangSelect.value;
117  };
118 
119  this.valid = true;
120 };
121 
122 /*******************************************************************************************/
123 /**
124  \brief
125 */
126 /*******************************************************************************************/
127 BMLTSemanticResult.prototype.compileSearchResults = function () {
128  var responseTypeSelect = this.owner.getScopedElement('bmlt_semantic_form_response_type_select');
129  var mainSelect = this.owner.getScopedElement('bmlt_semantic_form_main_mode_select');
130  var getUsedCheckbox = this.owner.getScopedElement('bmlt_semantic_form_used_formats_checkbox');
131  var blockCheckbox = this.owner.getScopedElement('block_mode_checkbox');
132 
133  if ( (responseTypeSelect.value == 'xml') || (responseTypeSelect.value == 'json') ) {
134  if ( getUsedCheckbox && getUsedCheckbox.checked ) {
135  var getOnlyUsedCheckbox = this.owner.getScopedElement('bmlt_semantic_form_just_used_formats_checkbox');
136 
137  if ( this.compiled_params ) {
138  this.compiled_params += '&';
139  };
140 
141  this.compiled_params += 'get_used_formats=1';
142 
143  if ( getOnlyUsedCheckbox && getOnlyUsedCheckbox.checked ) {
144  if ( this.compiled_params ) {
145  this.compiled_params += '&';
146  };
147 
148  this.compiled_params += 'get_formats_only=1';
149  };
150  };
151  } else {
152  if ( (responseTypeSelect.value == 'simple-block') || (responseTypeSelect.value == 'simple') ) {
153  if ( getUsedCheckbox.checked ) {
154  this.compiled_params = 'switcher=GetFormats';
155  };
156  };
157  };
158 
159  if ( this.services && this.services.length ) {
160  if ( this.services.length > 1 ) {
161  for (i = 0; i < this.services.length; i++) {
162  if ( this.compiled_params ) {
163  this.compiled_params += '&';
164  };
165 
166  this.compiled_params += 'services[]=' + parseInt(this.services[i]);
167  };
168  } else {
169  if ( this.compiled_params ) {
170  this.compiled_params += '&';
171  };
172 
173  this.compiled_params += 'services=' + parseInt(this.services);
174  };
175  };
176 
177  if ( this.weekdays ) {
178  weekdays = this.weekdays.split(',');
179 
180  if ( weekdays.length > 1 ) {
181  for (i = 0; i < weekdays.length; i++) {
182  if ( this.compiled_params ) {
183  this.compiled_params += '&';
184  };
185 
186  this.compiled_params += 'weekdays[]=' + parseInt(weekdays[i]);
187  };
188  } else {
189  if ( this.compiled_params ) {
190  this.compiled_params += '&';
191  };
192 
193  this.compiled_params += 'weekdays=' + parseInt(this.weekdays);
194  };
195  };
196 
197  if ( this.formats ) {
198  var formats_array = this.formats.split(',');
199  var has_include_formats = false;
200 
201  if ( formats_array && formats_array.length ) {
202  if ( formats_array.length > 1 ) {
203  for (i = 0; i < formats_array.length; i++) {
204  var format = parseInt(formats_array[i]);
205 
206  if ( format ) {
207  if (format > 0) {
208  has_include_formats = true;
209  }
210 
211  if ( this.compiled_params ) {
212  this.compiled_params += '&';
213  };
214 
215  this.compiled_params += 'formats[]=' + format.toString();
216  };
217  };
218  } else {
219  if ( this.compiled_params ) {
220  this.compiled_params += '&';
221  };
222 
223  has_include_formats = parseInt(formats_array[0]) > 0;
224  this.compiled_params += 'formats=' + parseInt(formats_array[0]).toString();
225  };
226 
227  if (this.formats_comparison_operator !== "AND" && has_include_formats) {
228  this.compiled_params += '&formats_comparison_operator=OR'
229  };
230  };
231  };
232 
233  if ( this.meeting_key && this.meeting_key_value ) {
234  if ( this.compiled_params ) {
235  this.compiled_params += '&';
236  };
237 
238  this.compiled_params += 'meeting_key=' + this.meeting_key + '&meeting_key_value=' + encodeURIComponent(this.meeting_key_value);
239  };
240 
241  if ( this.searchText ) {
242  if ( this.compiled_params ) {
243  this.compiled_params += '&';
244  };
245 
246  this.compiled_params += 'SearchString=' + encodeURIComponent(this.searchText);
247  if ( this.searchTextModifier ) {
248  if ( this.compiled_params ) {
249  this.compiled_params += '&';
250  };
251 
252  this.compiled_params += this.searchTextModifier;
253 
254  if ( this.searchTextRadius ) {
255  if ( this.compiled_params ) {
256  this.compiled_params += '&';
257  };
258 
259  this.compiled_params += 'SearchStringRadius=' + parseFloat(this.searchTextRadius);
260  };
261  };
262  };
263 
264  if ( this.searchMapRadius ) {
265  var radiusUnitsSelect = this.owner.getScopedElement('bmlt_semantic_form_map_search_text_radius_units');
266 
267  if ( radiusUnitsSelect && radiusUnitsSelect.value ) {
268  if ( this.compiled_params ) {
269  this.compiled_params += '&';
270  };
271 
272  this.compiled_params += radiusUnitsSelect.value + '=' + encodeURIComponent(this.searchMapRadius);
273  this.compiled_params += '&long_val=' + encodeURIComponent(this.searchLongitude);
274  this.compiled_params += '&lat_val=' + encodeURIComponent(this.searchLatitude);
275  };
276  };
277 
278  if ( this.fields.length > 0 ) {
279  if ( this.compiled_params ) {
280  this.compiled_params += '&';
281  };
282 
283  this.compiled_params += 'data_field_key=' + this.fields.join(',');
284  };
285 
286  if ( this.sorts && this.sorts.length ) {
287  var sortKeys = Array();
288 
289  for (var i = 0; i < this.sorts.length; i++) {
290  sortKeys.push(this.sorts[i].key);
291  };
292 
293  if ( this.compiled_params ) {
294  this.compiled_params += '&';
295  };
296 
297  this.compiled_params += 'sort_keys=' + sortKeys.join(',');
298  };
299 
300  if ( this.weekdayHeader && (mainSelect.value == 'SHORTCODE_SIMPLE') ) {
301  if ( this.compiled_params ) {
302  this.compiled_params += '&';
303  };
304 
305  this.compiled_params += 'weekday_header=1';
306  };
307 
308  if ( this.startTimeMin && (this.startTimeMin[0] || this.startTimeMin[1]) ) {
309  if ( this.startTimeMin[0] ) {
310  if ( this.compiled_params ) {
311  this.compiled_params += '&';
312  };
313 
314  this.compiled_params += 'StartsAfterH=' + this.startTimeMin[0].toString();
315  };
316  if ( this.startTimeMin[1] ) {
317  if ( this.compiled_params ) {
318  this.compiled_params += '&';
319  };
320 
321  this.compiled_params += 'StartsAfterM=' + this.startTimeMin[1].toString();
322  };
323  };
324 
325  if ( this.startTimeMax && (this.startTimeMax[0] || this.startTimeMax[1]) ) {
326  if ( this.startTimeMax[0] ) {
327  if ( this.compiled_params ) {
328  this.compiled_params += '&';
329  };
330 
331  this.compiled_params += 'StartsBeforeH=' + this.startTimeMax[0].toString();
332  };
333  if ( this.startTimeMax[1] ) {
334  if ( this.compiled_params ) {
335  this.compiled_params += '&';
336  };
337 
338  this.compiled_params += 'StartsBeforeM=' + this.startTimeMax[1].toString();
339  };
340  };
341 
342  if ( this.endTimeMax && (this.endTimeMax[0] || this.endTimeMax[1]) ) {
343  if ( this.endTimeMax[0] ) {
344  if ( this.compiled_params ) {
345  this.compiled_params += '&';
346  };
347 
348  this.compiled_params += 'EndsBeforeH=' + this.endTimeMax[0].toString();
349  };
350  if ( this.endTimeMax[1] ) {
351  if ( this.compiled_params ) {
352  this.compiled_params += '&';
353  };
354 
355  this.compiled_params += 'EndsBeforeM=' + this.endTimeMax[1].toString();
356  };
357  };
358 
359  if ( this.durationMin && (this.durationMin[0] || this.durationMin[1]) ) {
360  if ( this.durationMin[0] ) {
361  if ( this.compiled_params ) {
362  this.compiled_params += '&';
363  };
364 
365  this.compiled_params += 'MinDurationH=' + this.durationMin[0].toString();
366  };
367  if ( this.durationMin[1] ) {
368  if ( this.compiled_params ) {
369  this.compiled_params += '&';
370  };
371 
372  this.compiled_params += 'MinDurationM=' + this.durationMin[1].toString();
373  };
374  };
375 
376  if ( this.durationMax && (this.durationMax[0] || this.durationMax[1]) ) {
377  if ( this.durationMax[0] ) {
378  if ( this.compiled_params ) {
379  this.compiled_params += '&';
380  };
381 
382  this.compiled_params += 'MaxDurationH=' + this.durationMax[0].toString();
383  };
384  if ( this.durationMax[1] ) {
385  if ( this.compiled_params ) {
386  this.compiled_params += '&';
387  };
388 
389  this.compiled_params += 'MaxDurationM=' + this.durationMax[1].toString();
390  };
391  };
392 
393  if ( blockCheckbox && blockCheckbox.checked && (mainSelect.value == 'SHORTCODE_SIMPLE') ) {
394  if ( this.compiled_params ) {
395  this.compiled_params += '&';
396  };
397 
398  this.compiled_params += 'block_mode=1';
399  };
400 
401  this.valid = true;
402 };
403 
404 /*******************************************************************************************/
405 /**
406  \brief
407 */
408 /*******************************************************************************************/
409 BMLTSemanticResult.prototype.compileChanges = function () {
410  if ( this.change_start ) {
411  this.compiled_params += '&start_date=' + this.change_start;
412  };
413 
414  if ( this.change_end ) {
415  this.compiled_params += '&end_date=' + this.change_end;
416  };
417 
418  if ( this.change_id ) {
419  this.compiled_params += '&meeting_id=' + this.change_id;
420  };
421 
422  if ( this.change_sb_id ) {
423  this.compiled_params += '&service_body_id=' + this.change_sb_id;
424  };
425 
426  this.valid = true;
427 };
428 
429 /*******************************************************************************************/
430 /**
431  \brief
432 */
433 /*******************************************************************************************/
434 BMLTSemanticResult.prototype.compileFieldValues = function () {
435  if ( this.meeting_key ) {
436  this.compiled_params += '&meeting_key=' + encodeURIComponent(this.meeting_key);
437 
438  if ( (this.meeting_key == 'formats') && this.formats ) {
439  this.compiled_params += '&specific_formats=' + this.formats;
440  };
441 
442  this.valid = true;
443  };
444 };
445 
446 /*******************************************************************************************/
447 /**
448  \brief
449 */
450 /*******************************************************************************************/
451 BMLTSemanticResult.prototype.compileNAWSDump = function () {
452  if ( this.sb_id ) {
453  this.compiled_params += '&sb_id=' + parseInt(this.sb_id);
454  this.valid = true;
455  };
456 };
457 
458 /*******************************************************************************************/
459 /**
460  \class BMLTSemantic
461 
462  \brief This is the controlling class for the BMLT interactive semantic workshop.
463 
464  \param inSuffix A constructor parameter that gives a suffix (for multiple forms).
465  \param inAJAXURI The base URI for AJAX callbacks.
466  \param inRootServerURI The initial URI for the Root Server.
467  \param inVersion The initial version for the Root Server.
468 */
469 /*******************************************************************************************/
470 function BMLTSemantic(
471  inSuffix,
472  inAJAXURI,
473  inRootServerURI,
474  inVersion
475 ) {
476  this.id_suffix = inSuffix;
477  this.ajax_base_uri = inAJAXURI;
478  this.state = new BMLTSemanticResult(inRootServerURI,this);
479  this.version = inVersion;
480 
481  this.setUpForm();
482 };
483 
484 BMLTSemantic.prototype.version = null;
485 BMLTSemantic.prototype.id_suffix = null;
486 BMLTSemantic.prototype.ajax_base_uri = null;
487 BMLTSemantic.prototype.format_objects = null;
488 BMLTSemantic.prototype.languages = null;
489 BMLTSemantic.prototype.field_keys = null;
490 BMLTSemantic.prototype.field_values = null;
491 BMLTSemantic.prototype.service_body_objects = null;
492 BMLTSemantic.prototype.temp_service_body_objects = null;
493 BMLTSemantic.prototype.state = null;
494 BMLTSemantic.prototype.mapObject = null;
495 BMLTSemantic.prototype.current_lat = 34.23592;
496 BMLTSemantic.prototype.current_lng = -118.563659;
497 BMLTSemantic.prototype.current_zoom = 11;
498 BMLTSemantic.prototype.serverInfo = null;
499 BMLTSemantic.prototype.coverageArea = null;
500 BMLTSemantic.prototype.coverageMapObject = null;
501 
502 /*******************************************************************************************/
503 /**
504  \brief A simple, generic AJAX request function.
505 
506  \param url The URL to be called
507  \param callback A function/lambda/block to be called upon success
508  The callback specified needs to have a signature of:
509  function myAJAXCallback ( inHTTPRequestObject );
510  The extraData parameter will be passed as inHTTPRequestObject.extraData.
511  \param method GET or POST (case-indifferent)
512  \param extraData A "RefCon", or data to be passed unchanged to the callback
513 
514  \returns a new XMLHTTPRequest object
515 */
516 /*******************************************************************************************/
517 BMLTSemantic.prototype.ajaxRequest = function (
518  url,
519  callback,
520  method,
521  extraData
522 ) {
523  /***************************************************************************************/
524  /**
525  \brief Create a generic XMLHTTPObject.
526 
527  This will account for the various flavors imposed by different browsers.
528 
529  \returns a new XMLHTTPRequest object.
530  */
531  /***************************************************************************************/
532  function createXMLHTTPObject()
533  {
534  var XMLHttpArray = [
535  function () {
536  return new XMLHttpRequest()},
537  function () {
538  return new ActiveXObject("Msxml2.XMLHTTP")},
539  function () {
540  return new ActiveXObject("Msxml2.XMLHTTP")},
541  function () {
542  return new ActiveXObject("Microsoft.XMLHTTP")}
543  ];
544 
545  var xmlhttp = false;
546 
547  for (var i=0; i < XMLHttpArray.length; i++) {
548  try {
549  xmlhttp = XMLHttpArray[i]();
550  } catch ( e ) {
551  continue;
552  };
553  break;
554  };
555 
556  return xmlhttp;
557  };
558 
559  var req = createXMLHTTPObject();
560 
561  req.finalCallback = callback;
562 
563  var sVars = null;
564 
565  if ( !method ) {
566  method= 'POST';
567  } else {
568  method = method.toUpperCase();
569  };
570 
571  // Split the URL up, if this is a POST.
572  if ( method == "POST" ) {
573  var rmatch = /^([^\?]*)\?(.*)$/.exec(url);
574  url = rmatch[1];
575  sVars = rmatch[2];
576 
577  // This horrible, horrible kludge, is because Drupal insists on having its q parameter in the GET list only.
578  var rmatch_kludge = /(q=admin\/settings\/bmlt)&?(.*)/.exec(rmatch[2]);
579 
580  if ( rmatch_kludge && rmatch_kludge[1] ) {
581  url += '?'+rmatch_kludge[1];
582  sVars = rmatch_kludge[2];
583  };
584  };
585 
586  req.extraData = extraData;
587 
588  req.open(method, url, true);
589 
590  if ( method == "POST" ) {
591  req.setRequestHeader("Method", "POST "+url+" HTTP/1.1");
592  req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
593  };
594 
595  req.onreadystatechange = function () {
596  if ( req.readyState != 4 ) {
597  return;
598  }
599  if ( req.status != 200 ) {
600  return;
601  }
602  callback(req);
603  req = null;
604  };
605 
606  req.send(sVars);
607 
608  return req;
609 };
610 
611 /*******************************************************************************************/
612 /**
613  \brief Sets up and performs an AJAX call to fetch the available formats.
614 */
615 /*******************************************************************************************/
616 BMLTSemantic.prototype.reloadFromServer = function () {
617  this.state.formats = null;
618  this.state.formats_comparison_operator = "AND";
619  this.state.meeting_key = null;
620  this.state.meeting_key_value = null;
621  this.state.services = null;
622  this.state.weekdays = null;
623  this.state.sb_id = null;
624  this.state.change_start = null;
625  this.state.change_end = null;
626  this.state.change_id = null;
627  this.state.compiled_params = null;
628  this.state.searchText = null;
629  this.state.searchTextModifier = null;
630  this.state.searchTextRadius = null;
631  this.state.searchMapRadius = null;
632  this.state.sorts = null;
633 
634  this.format_objects = null;
635  this.languages = null;
636  this.service_body_objects = null;
637  this.field_keys = null;
638  this.field_values = null;
639  this.temp_service_body_objects = null;
640 
641  this.fetchFormats();
642  this.fetchLangs();
643  this.fetchServiceBodies();
644  this.fetchFieldKeys();
645  this.clearWeekdays();
646  this.clearTextSearchItems();
647  this.clearSorts();
649 };
650 
651 /*******************************************************************************************/
652 /**
653  \brief Sets up and performs an AJAX call to fetch the available formats.
654 */
655 /*******************************************************************************************/
656 BMLTSemantic.prototype.fetchVersion = function () {
657  this.ajaxRequest(this.ajax_base_uri + '&GetVersion', this.fetchVersionCallback, 'get', this);
658 };
659 
660 /*******************************************************************************************/
661 /**
662  \brief Sets up and performs an AJAX call to fetch the server information.
663 */
664 /*******************************************************************************************/
665 BMLTSemantic.prototype.fetchServerInfo = function () {
666  this.serverInfo = null;
667  if ( this.version >= 2006020 ) {
668  this.ajaxRequest(this.ajax_base_uri + '&GetServerInfo', this.fetchServerInfoCallback, 'get', this);
669  };
670 };
671 
672 /*******************************************************************************************/
673 /**
674  \brief Sets up and performs an AJAX call to fetch the server information.
675 */
676 /*******************************************************************************************/
677 BMLTSemantic.prototype.fetchCoverageArea = function () {
678  this.serverInfo = null;
679  if ( this.version >= 2008016 ) {
680  this.ajaxRequest(this.ajax_base_uri + '&GetCoverageArea', this.fetchCoverageAreaCallback, 'get', this);
681  };
682 };
683 
684 /*******************************************************************************************/
685 /**
686  \brief Sets up and performs an AJAX call to fetch the available formats.
687 */
688 /*******************************************************************************************/
689 BMLTSemantic.prototype.fetchFormats = function () {
690  this.state.formats = null;
691  this.state.unformats = null;
692 
693  this.ajaxRequest(this.ajax_base_uri + '&GetInitialFormats', this.fetchFormatsCallback, 'get', this);
694 };
695 
696 /*******************************************************************************************/
697 /**
698  \brief Sets up and performs an AJAX call to fetch the available languages.
699 */
700 /*******************************************************************************************/
701 BMLTSemantic.prototype.fetchLangs = function () {
702  this.languages = null;
703  if ( this.version >= 2006020 ) {
704  this.ajaxRequest(this.ajax_base_uri + '&GetLangs', this.fetchLangsCallback, 'get', this);
705  };
706 };
707 
708 /*******************************************************************************************/
709 /**
710  \brief Sets up and performs an AJAX call to fetch the available Service bodies.
711 */
712 /*******************************************************************************************/
713 BMLTSemantic.prototype.fetchServiceBodies = function () {
714  this.state.services = null;
715  this.state.sb_id = null;
716 
717  this.ajaxRequest(this.ajax_base_uri + '&GetInitialServiceBodies', this.fetchServiceBodiesCallback, 'get', this);
718 };
719 
720 /*******************************************************************************************/
721 /**
722  \brief Sets up and performs an AJAX call to fetch the available field keys.
723 */
724 /*******************************************************************************************/
725 BMLTSemantic.prototype.fetchFieldKeys = function () {
726  this.getScopedElement('bmlt_switcher_field_value_div_formats').innerHTML = '';
727  this.getScopedElement('bmlt_switcher_field_value_div_no_selected_formats_blurb').hide();
728  this.getScopedElement('bmlt_semantic_form_meeting_fields_fieldset_contents_div').hide();
729  this.ajaxRequest(this.ajax_base_uri + '&GetFieldKeys', this.fetchFieldKeysCallback, 'get', this);
730 };
731 
732 /*******************************************************************************************/
733 /**
734  \brief Sets up and performs an AJAX call to fetch the available field keys.
735 */
736 /*******************************************************************************************/
737 BMLTSemantic.prototype.fetchFieldValues = function () {
738  this.getScopedElement('bmlt_semantic_form_meeting_fields_fieldset_contents_div').hide();
739  var key = this.state.meeting_key.toString();
740  var url = this.ajax_base_uri + '&GetFieldValues&meeting_key=' + key;
741  this.ajaxRequest(url, this.fetchFieldValuesCallback, 'get', this);
742 };
743 
744 /*******************************************************************************************/
745 /**
746  \brief The response.
747 */
748 /*******************************************************************************************/
749 BMLTSemantic.prototype.fetchVersionCallback = function (inHTTPReqObject
750  ) {
751  if ( inHTTPReqObject.responseText ) {
752  var context = inHTTPReqObject.extraData;
753  eval('context.version = parseInt ( ' + inHTTPReqObject.responseText + ' );');
754  context.validateVersion();
755  context.refreshURI();
756  };
757 };
758 
759 /*******************************************************************************************/
760 /**
761  \brief The response.
762 */
763 /*******************************************************************************************/
764 BMLTSemantic.prototype.fetchServerInfoCallback = function (inHTTPReqObject
765  ) {
766  if ( inHTTPReqObject.responseText ) {
767  var context = inHTTPReqObject.extraData;
768  eval('context.serverInfo = ' + inHTTPReqObject.responseText + '[0];');
769  context.current_lat = parseFloat(context.serverInfo.centerLatitude);
770  context.current_lng = parseFloat(context.serverInfo.centerLongitude);
771  context.current_zoom = parseInt(context.serverInfo.centerZoom, 10);
772  context.fetchCoverageArea();
773  };
774 };
775 
776 /*******************************************************************************************/
777 /**
778  \brief The response.
779 */
780 /*******************************************************************************************/
781 BMLTSemantic.prototype.fetchCoverageAreaCallback = function (inHTTPReqObject
782  ) {
783  if ( inHTTPReqObject.responseText ) {
784  var context = inHTTPReqObject.extraData;
785  eval('var coverageAreaRaw = ' + inHTTPReqObject.responseText + '[0];');
786 
787  context.coverageArea = new Object();
788  context.coverageArea.ne_corner = new google.maps.LatLng(parseFloat(coverageAreaRaw.nw_corner_latitude), parseFloat(coverageAreaRaw.se_corner_longitude));
789  context.coverageArea.sw_corner = new google.maps.LatLng(parseFloat(coverageAreaRaw.se_corner_latitude), parseFloat(coverageAreaRaw.nw_corner_longitude));
790  };
791 };
792 
793 
794 /*******************************************************************************************/
795 /**
796  \brief The response.
797 */
798 /*******************************************************************************************/
799 BMLTSemantic.prototype.fetchFormatsCallback = function (inHTTPReqObject
800  ) {
801  if ( inHTTPReqObject.responseText ) {
802  var context = inHTTPReqObject.extraData;
803  eval('context.format_objects = ' + inHTTPReqObject.responseText + ';');
804 
805  if ( context.getScopedElement('bmlt_semantic_form_switcher_type_select').value == 'GetFieldValues' ) {
806  context.populateFormatsSection(context.getScopedElement('bmlt_switcher_field_value_div_formats'), false);
807  } else {
808  context.populateFormatsSection(context.getScopedElement('bmlt_semantic_form_formats_fieldset_div'), false);
809  context.populateFormatsSection(context.getScopedElement('bmlt_semantic_form_not_formats_fieldset_div'), true);
810  };
811  };
812 };
813 
814 /*******************************************************************************************/
815 /**
816  \brief The response.
817 */
818 /*******************************************************************************************/
819 BMLTSemantic.prototype.fetchLangsCallback = function ( inHTTPReqObject
820  ) {
821  if ( inHTTPReqObject.responseText ) {
822  var context = inHTTPReqObject.extraData;
823  eval('var serverInfo = ' + inHTTPReqObject.responseText + ';');
824  context.languages = serverInfo[0].langs.toString().split(',');
825  };
826 };
827 
828 /*******************************************************************************************/
829 /**
830  \brief
831 */
832 /*******************************************************************************************/
833 BMLTSemantic.prototype.populateFormatsSection = function (
834  formatContainer,
835  unformat
836 ) {
837  this.sortByKey(this.format_objects, 'key_string');
838  formatContainer.innerHTML = '';
839  if ( this.format_objects && this.format_objects.length ) {
840  for (var i = 0; i < this.format_objects.length; i++) {
841  var formatObject = this.format_objects[i];
842  var newContainer = document.createElement('div');
843  newContainer.id = this.getScopedID(formatContainer.id + '_' + formatObject.id);
844  newContainer.className ='bmlt_checkbox_container';
845 
846  var newCheckbox = document.createElement('input');
847  newCheckbox.type = 'checkbox';
848  newCheckbox.formatObject = formatObject;
849  newCheckbox.id = this.getScopedID(formatContainer.id + '_checkbox_' + formatObject.id);
850  newCheckbox.value = unformat ? -parseInt(formatObject.id) : parseInt(formatObject.id);
851  newCheckbox.formHandler = this;
852 
853  newCheckbox.onchange = function () {
854  this.formHandler.handleFormatCheckbox(this) };
855 
856  newCheckbox.title = formatObject.name_string + ' - ' + formatObject.description_string;
857  newCheckbox.className ='bmlt_checkbox_input';
858  newContainer.appendChild(newCheckbox);
859 
860  var newCheckboxLabel = document.createElement('label');
861  newCheckboxLabel.htmlFor = newCheckbox.id;
862  newCheckboxLabel.id = this.getScopedID(formatContainer.id + '_label_' + formatObject.id);
863  newCheckboxLabel.className = 'bmlt_checkbox_label';
864  newCheckboxLabel.title = formatObject.name_string + ' - ' + formatObject.description_string;
865  newCheckboxLabel.appendChild(document.createTextNode(formatObject.key_string));
866  newContainer.appendChild(newCheckboxLabel);
867 
868  formatContainer.appendChild(newContainer);
869  };
870 
871  var breakerBreakerRubberDuck = document.createElement('div');
872  breakerBreakerRubberDuck.className ='clear_both';
873  formatContainer.appendChild(breakerBreakerRubberDuck);
874  };
875  this.refreshURI();
876 };
877 
878 /*******************************************************************************************/
879 /**
880  \brief The response.
881 */
882 /*******************************************************************************************/
883 BMLTSemantic.prototype.fetchServiceBodiesCallback = function (inHTTPReqObject
884  ) {
885  if ( inHTTPReqObject.responseText ) {
886  var context = inHTTPReqObject.extraData;
887  eval('context.temp_service_body_objects = ' + inHTTPReqObject.responseText + ';');
888  context.populateServiceBodiesSection();
889  };
890 };
891 
892 /*******************************************************************************************/
893 /**
894  \brief
895 */
896 /*******************************************************************************************/
897 BMLTSemantic.prototype.populateServiceBodiesSection = function () {
898  var sb_select1 = this.getScopedElement('bmlt_switcher_naws_dump_sb_select');
899  var sb_select2 = this.getScopedElement('bmlt_switcher_changes_sb_select');
900  var yesMen = this.getScopedElement('bmlt_semantic_form_sb_fieldset_div');
901  var noMam = this.getScopedElement('bmlt_semantic_form_sb_not_fieldset_div');
902  var yesMen_container = this.getScopedElement('bmlt_semantic_form_sb_fieldset');
903  var noMam_container = this.getScopedElement('bmlt_semantic_form_sb_not_fieldset');
904 
905  for (var i = sb_select1.options.length - 1; i > 0; i--) {
906  sb_select1.removeChild(sb_select1.options[i]);
907  };
908 
909  for (var i = sb_select2.options.length - 1; i > 0; i--) {
910  sb_select2.removeChild(sb_select2.options[i]);
911  };
912 
913  this.sortByKey(this.temp_service_body_objects, 'name');
914 
915  for (var i = 0; i < this.temp_service_body_objects.length; i++) {
916  var sb = this.temp_service_body_objects[i];
917  var newOption = document.createElement('option');
918  newOption.value = sb.id;
919  newOption.appendChild(document.createTextNode(sb.name));
920  sb_select1.appendChild(newOption);
921  var newOption = document.createElement('option');
922  newOption.value = sb.id;
923  newOption.appendChild(document.createTextNode(sb.name));
924  sb_select2.appendChild(newOption);
925  };
926 
927  if ( this.temp_service_body_objects.length < 2 ) {
928  yesMen_container.hide();
929  noMam_container.hide();
930  } else {
931  yesMen_container.show();
932  noMam_container.show();
933  };
934 
935  this.state.services = null;
936  this.organizeServiceBodies();
937 
938  if ( this.service_body_objects && this.service_body_objects.length ) {
939  this.createServiceBodyList(null, yesMen, false);
940  this.createServiceBodyList(null, noMam, true);
941  };
942 
943  this.refreshURI();
944 };
945 
946 /*******************************************************************************************/
947 /**
948  \brief
949 */
950 /*******************************************************************************************/
951 BMLTSemantic.prototype.createServiceBodyList = function (
952  inServiceBodyObject,
953  inContainerObject,
954  inMinus
955 ) {
956  if ( inContainerObject ) {
957  var sb_array = null;
958  var id = 0;
959  var newListContainer = null;
960  var not_extra = inMinus ? 'not_' : '';
961 
962  if ( inServiceBodyObject ) {
963  id = inServiceBodyObject.id;
964 
965  var checkboxElement = document.createElement('dt');
966  checkboxElement.id = this.getScopedID('bmlt_sb_dt_' + not_extra + id.toString());
967  checkboxElement.className = 'bmlt_sb_dt';
968  this.createServiceBodyCheckbox(inServiceBodyObject, checkboxElement, inMinus);
969  inContainerObject.appendChild(checkboxElement);
970 
971  if ( inServiceBodyObject.childServiceBodies ) {
972  newListContainer = document.createElement('dd');
973  newListContainer.id = this.getScopedID('bmlt_sb_dd_' + not_extra + id.toString());
974  newListContainer.className = 'bmlt_sb_dd';
975  inContainerObject.appendChild(newListContainer);
976  sb_array = inServiceBodyObject.childServiceBodies;
977  this.sortByKey(sb_array, 'name');
978  };
979  } else {
980  sb_array = this.service_body_objects;
981  this.sortByKey(sb_array, 'name');
982  newListContainer = inContainerObject;
983  newListContainer.innerHTML = '';
984  };
985 
986  if ( newListContainer && sb_array && sb_array.length ) {
987  var newSubList = document.createElement('dl');
988  newSubList.id = this.getScopedID('bmlt_sb_dl_' + not_extra + id.toString());
989  newSubList.className = 'bmlt_sb_dl';
990 
991  for (var i = 0; i < sb_array.length; i++) {
992  this.createServiceBodyList(sb_array[i], newSubList, inMinus);
993  };
994 
995  newListContainer.appendChild(newSubList);
996  };
997  };
998 };
999 
1000 /*******************************************************************************************/
1001 /**
1002  \brief Sort By Key
1003  */
1004 /*******************************************************************************************/
1005 BMLTSemantic.prototype.sortByKey = function (array, key) {
1006  return array.sort(function(a, b) {
1007  var x = a[key].toLowerCase(); var y = b[key].toLowerCase();
1008  return ((x < y) ? -1 : ((x > y) ? 1 : 0));
1009  });
1010 };
1011 
1012 /*******************************************************************************************/
1013 /**
1014  \brief
1015 */
1016 /*******************************************************************************************/
1017 BMLTSemantic.prototype.createServiceBodyCheckbox = function (
1018  inServiceBodyObject,
1019  inContainerObject,
1020  inMinus
1021 ) {
1022  var not_extra = inMinus ? 'not_' : '';
1023 
1024  var newCheckbox = document.createElement('input');
1025  newCheckbox.type = 'checkbox';
1026  newCheckbox.id = this.getScopedID('bmlt_semantic_form_sb_checkbox_' + not_extra + inServiceBodyObject.id);
1027  newCheckbox.value = (inMinus ? -1 : 1) * parseInt(inServiceBodyObject.id);
1028  newCheckbox.title = inServiceBodyObject.description;
1029  newCheckbox.className ='bmlt_checkbox_input';
1030  newCheckbox.formHandler = this;
1031  newCheckbox.serviceBody = inServiceBodyObject;
1032  newCheckbox.onchange = function () {
1033  this.formHandler.handleServiceBodyCheck(this) };
1034  inContainerObject.appendChild(newCheckbox);
1035 
1036  var newCheckboxLabel = document.createElement('label');
1037  newCheckboxLabel.htmlFor = newCheckbox.id;
1038  newCheckboxLabel.id = this.getScopedID('bmlt_semantic_form_sb_checkbox_label_' + not_extra + inServiceBodyObject.id);
1039  newCheckboxLabel.className = 'bmlt_checkbox_label';
1040  newCheckboxLabel.title = inServiceBodyObject.description;
1041  newCheckboxLabel.appendChild(document.createTextNode(inServiceBodyObject.name));
1042  inContainerObject.appendChild(newCheckboxLabel);
1043 };
1044 
1045 /*******************************************************************************************/
1046 /**
1047  \brief
1048 */
1049 /*******************************************************************************************/
1050 BMLTSemantic.prototype.organizeServiceBodies = function () {
1051  if ( this.temp_service_body_objects && this.temp_service_body_objects.length ) {
1052  this.service_body_objects = Array();
1053 
1054  for (var i = 0; i < this.temp_service_body_objects.length; i++) {
1055  var service_body = this.temp_service_body_objects[i];
1056 
1057  if ( parseInt(service_body.parent_id) == 0 ) {
1058  this.service_body_objects.push(service_body);
1059 
1060  this.getChildServiceBodies(service_body);
1061  };
1062  };
1063 
1064  this.temp_service_body_objects = null;
1065  };
1066 };
1067 
1068 /*******************************************************************************************/
1069 /**
1070  \brief
1071 */
1072 /*******************************************************************************************/
1073 BMLTSemantic.prototype.getChildServiceBodies = function (inParentObject
1074  ) {
1075  if ( this.temp_service_body_objects && this.temp_service_body_objects.length ) {
1076  for (var i = 0; i < this.temp_service_body_objects.length; i++) {
1077  var service_body = this.temp_service_body_objects[i];
1078 
1079  if ( parseInt(service_body.parent_id) == parseInt(inParentObject.id) ) {
1080  if ( !inParentObject.childServiceBodies ) {
1081  inParentObject.childServiceBodies = Array();
1082  };
1083  service_body.parentServiceBody = inParentObject;
1084  inParentObject.childServiceBodies.push(service_body);
1085  this.getChildServiceBodies(service_body);
1086  };
1087  };
1088  };
1089 };
1090 
1091 /*******************************************************************************************/
1092 /**
1093  \brief The response.
1094 */
1095 /*******************************************************************************************/
1096 BMLTSemantic.prototype.fetchFieldKeysCallback = function (inHTTPReqObject
1097  ) {
1098  if ( inHTTPReqObject.responseText ) {
1099  var context = inHTTPReqObject.extraData;
1100  eval('context.field_keys = ' + inHTTPReqObject.responseText + ';');
1101  context.setAllSortFieldFunctions();
1102  context.setAllSortFieldState();
1103  context.clearSorts();
1104  context.populateFieldSelect();
1105  };
1106 };
1107 
1108 /*******************************************************************************************/
1109 /**
1110  \brief The response.
1111 */
1112 /*******************************************************************************************/
1113 BMLTSemantic.prototype.populateFieldSelect = function () {
1114  var mainSelectElement = this.getScopedElement('bmlt_semantic_form_field_main_select');
1115  var meetingSelectElement = this.getScopedElement('bmlt_semantic_form_field_select');
1116 
1117  if ( mainSelectElement && mainSelectElement.options ) {
1118  for (var i = (mainSelectElement.options.length - 1); i > 0; i--) {
1119  mainSelectElement.removeChild(mainSelectElement.options[i]);
1120  };
1121  };
1122 
1123  if ( meetingSelectElement && meetingSelectElement.options ) {
1124  for (var i = (meetingSelectElement.options.length - 1); i > 0; i--) {
1125  meetingSelectElement.removeChild(meetingSelectElement.options[i]);
1126  };
1127  };
1128 
1129  for (var i = 0; i < this.field_keys.length; i++) {
1130  var key = this.field_keys[i].key;
1131 
1132  var newOption = document.createElement('option');
1133  newOption.value = key;
1134  newOption.appendChild(document.createTextNode(this.field_keys[i].description));
1135  mainSelectElement.appendChild(newOption);
1136 
1137  if ( (key != 'formats') && (key != 'weekday_tinyint') && (key != 'service_body_bigint') && (key != 'id_bigint') && (key != 'longitude') && (key != 'latitude') ) {
1138  newOption = document.createElement('option');
1139  newOption.value = key;
1140  newOption.appendChild(document.createTextNode(this.field_keys[i].description));
1141  meetingSelectElement.appendChild(newOption);
1142  };
1143  };
1144 
1145  mainSelectElement.selectedIndex = 0;
1146  meetingSelectElement.selectedIndex = 0;
1147  this.refreshURI();
1148 };
1149 
1150 /*******************************************************************************************/
1151 /**
1152  \brief The response.
1153 */
1154 /*******************************************************************************************/
1155 BMLTSemantic.prototype.fetchFieldValuesCallback = function (inHTTPReqObject
1156  ) {
1157  if ( inHTTPReqObject.responseText ) {
1158  var context = inHTTPReqObject.extraData;
1159  eval('context.field_values = ' + inHTTPReqObject.responseText + ';');
1160 
1161  context.field_values.sort(function (a,b) {
1162  eval('var textA = a.' + context.state.meeting_key.toString() + '.toString();var textB = b.' + context.state.meeting_key.toString() + '.toString();');
1163  ret = 0;
1164  if ( textA != 'NULL' ) {
1165  if ( textB == 'NULL' ) {
1166  ret = 1;
1167  } else {
1168  eval('var numA = parseFloat ( a.' + context.state.meeting_key + ' );var numB = parseFloat ( b.' + context.state.meeting_key + ' );');
1169  if ( !isNaN(numA) && !isNaN(numB) && numA > numB ) {
1170  ret = 1;
1171  } else {
1172  if ( !isNaN(numA) && !isNaN(numB) && numB > numA ) {
1173  ret = -1;
1174  } else {
1175  eval('var intA = parseInt ( a.' + context.state.meeting_key + ' );var intB = parseInt ( b.' + context.state.meeting_key + ' );');
1176  if ( intA > intB ) {
1177  ret = 1;
1178  } else {
1179  if ( intB > intA ) {
1180  ret = -1;
1181  } else {
1182  if ( textA > textB ) {
1183  ret = 1;
1184  } else {
1185  if ( textB > textA ) {
1186  ret = -1;
1187  };
1188  };
1189  };
1190  };
1191  };
1192  };
1193  };
1194  };
1195 
1196  return ret;
1197  });
1198 
1199  context.updateFieldValuesPopup();
1200  };
1201 };
1202 
1203 /*******************************************************************************************/
1204 /**
1205  \brief
1206 */
1207 /*******************************************************************************************/
1208 BMLTSemantic.prototype.updateFieldValuesPopup = function () {
1209  var select_object = this.getScopedElement('bmlt_semantic_form_value_select');
1210 
1211  for (var i = select_object.options.length - 1; i > 0; i--) {
1212  select_object.removeChild(select_object.options[i]);
1213  };
1214 
1215  if ( this.field_values && this.field_values.length ) {
1216  for (var i = 0; i < this.field_values.length; i++) {
1217  var value_object = this.field_values[i];
1218 
1219  eval('var value_text = value_object.' + this.state.meeting_key.toString() + '.toString();');
1220  if ( value_text != 'NULL' ) {
1221  var newOption = document.createElement('option');
1222  newOption.value = value_text;
1223  newOption.appendChild(document.createTextNode(value_text));
1224  select_object.appendChild(newOption);
1225  };
1226  };
1227 
1228  this.getScopedElement('bmlt_semantic_form_meeting_fields_fieldset_contents_div').show();
1229  };
1230 
1231  this.refreshURI();
1232 };
1233 
1234 /*******************************************************************************************/
1235 /**
1236  \brief
1237 */
1238 /*******************************************************************************************/
1239 BMLTSemantic.prototype.fieldValueChosen = function ( inSelect
1240  ) {
1241  this.getScopedElement('bmlt_semantic_form_value_text').value = inSelect.value;
1242  this.getScopedElement('bmlt_semantic_form_value_text').onchange(this.getScopedElement('bmlt_semantic_form_value_text'));
1243  this.getScopedElement('bmlt_semantic_form_value_text').focus();
1244  this.refreshURI();
1245 };
1246 
1247 /*******************************************************************************************/
1248 /**
1249  \brief Returns an ID that has been "scoped" for this instance.
1250 
1251  \param inID The ID that needs to be "scoped."
1252 
1253  \returns the ID with any necessary scope attached.
1254 */
1255 /*******************************************************************************************/
1256 BMLTSemantic.prototype.getScopedID = function ( inID
1257  ) {
1258  if ( this.id_suffix ) {
1259  inID += this.id_suffix.toString();
1260  };
1261 
1262  return inID;
1263 };
1264 
1265 /*******************************************************************************************/
1266 /**
1267  \brief Returns an element that has been "scoped" for this instance.
1268 
1269  \param inID The ID that needs to be "scoped."
1270 
1271  \returns the element requested.
1272 */
1273 /*******************************************************************************************/
1274 BMLTSemantic.prototype.getScopedElement = function ( inID
1275  ) {
1276  return document.getElementById(this.getScopedID(inID));
1277 };
1278 
1279 /*******************************************************************************************/
1280 /**
1281  \brief Called when a text item in the form changes.
1282 
1283  \param inTextItem The object that experienced change.
1284  \param inFocusState If true, then the item is now in focus. If false, it is not in focus.
1285 */
1286 /*******************************************************************************************/
1287 BMLTSemantic.prototype.handleTextInput = function (
1288  inTextItem,
1289  inFocusState
1290 ) {
1291  inTextItem.className = inTextItem.defaultClass.toString();
1292 
1293  if ( inTextItem.defaultValue && (inTextItem.value == inTextItem.defaultValue) ) {
1294  inTextItem.className += ' bmlt_semantic_form_disabled_text';
1295  } else {
1296  inTextItem.className += ' bmlt_semantic_form_enabled_text';
1297  };
1298 
1299  if ( (inTextItem.value == '') && !inFocusState ) {
1300  if ( inTextItem.defaultValue ) {
1301  inTextItem.value = inTextItem.defaultValue;
1302  };
1303 
1304  inTextItem.className += ' bmlt_semantic_form_disabled_text';
1305  } else {
1306  if ( inTextItem.defaultValue && (inTextItem.value == inTextItem.defaultValue) && inFocusState ) {
1307  inTextItem.value = '';
1308  inTextItem.className += ' bmlt_semantic_form_enabled_text';
1309  } else {
1310  var pattern = inTextItem.pattern;
1311 
1312  if ( pattern ) {
1313  var regex = new RegExp(pattern);
1314  if ( (inTextItem.value.length > 0) && !regex.test(inTextItem.value) ) {
1315  if ( inTextItem.value.length == 1 ) {
1316  inTextItem.previousValue = '';
1317  };
1318  inTextItem.value = inTextItem.previousValue;
1319  };
1320  };
1321  };
1322  };
1323 
1324  inTextItem.previousValue = inTextItem.value;
1325 
1326  if ( inTextItem.additionalHandler ) {
1327  inTextItem.additionalHandler();
1328  };
1329 
1330  this.refreshURI();
1331 };
1332 
1333 /*******************************************************************************************/
1334 /**
1335  \brief
1336 
1337  \param inSelect The object that experienced change.
1338 */
1339 /*******************************************************************************************/
1340 BMLTSemantic.prototype.handleMainSelectChange = function ( inSelect ) {
1341  this.setUpMainSelectors(inSelect);
1342  this.reloadFromServer();
1343 };
1344 
1345 /*******************************************************************************************/
1346 /**
1347  \brief
1348 
1349  \param inSelect The object that experienced change.
1350 */
1351 /*******************************************************************************************/
1352 BMLTSemantic.prototype.handleResponseSelectChange = function ( inSelect ) {
1353  this.setUpMainSelectors(inSelect);
1354  this.reloadFromServer();
1355 };
1356 
1357 /*******************************************************************************************/
1358 /**
1359  \brief
1360 
1361  \param inSelect The object that experienced change.
1362 */
1363 /*******************************************************************************************/
1364 BMLTSemantic.prototype.handleSwitcherSelectChange = function ( inSelect ) {
1365  this.setUpMainSelectors(inSelect);
1366  this.reloadFromServer();
1367 };
1368 
1369 /*******************************************************************************************/
1370 /**
1371  \brief
1372 
1373  \param inSelect The object that experienced change.
1374 */
1375 /*******************************************************************************************/
1376 BMLTSemantic.prototype.handleFieldKeySelectChange = function ( inSelect ) {
1377  var key = inSelect.value;
1378  this.state.meeting_key = key;
1379 
1380  if ( inSelect.id == this.getScopedID('bmlt_semantic_form_field_select') ) {
1381  this.getScopedElement('bmlt_semantic_form_value_text').value = this.getScopedElement('bmlt_semantic_form_value_text').defaultValue;
1382  this.getScopedElement('bmlt_semantic_form_value_text').focus();
1383  this.fetchFieldValues();
1384  };
1385 
1386  this.refreshURI();
1387 };
1388 
1389 /*******************************************************************************************/
1390 /**
1391  \brief
1392 
1393  \param inSelect The object that experienced change.
1394 */
1395 /*******************************************************************************************/
1396 BMLTSemantic.prototype.handleFieldKeyValueSelectChange = function ( inSelect ) {
1397  this.state.meeting_key_value = inSelect.value;
1398  this.refreshURI();
1399 };
1400 
1401 /*******************************************************************************************/
1402 /**
1403  \brief
1404 
1405  \param inCheckbox The object that experienced change.
1406 */
1407 /*******************************************************************************************/
1408 BMLTSemantic.prototype.handleWeekdayHeaderChange = function ( inCheckbox ) {
1409  this.state.weekdayHeader = inCheckbox.checked;
1410  this.refreshURI();
1411 };
1412 
1413 /*******************************************************************************************/
1414 /**
1415  \brief
1416 
1417  \param inSelect The object that experienced change.
1418 */
1419 /*******************************************************************************************/
1420 BMLTSemantic.prototype.handleServiceBodyCheck = function ( inCheckbox ) {
1421  this.updateServiceBodies(inCheckbox);
1422  this.refreshURI();
1423 };
1424 
1425 /*******************************************************************************************/
1426 /**
1427  \brief
1428 
1429  \param inSelect The object that experienced change.
1430 */
1431 /*******************************************************************************************/
1432 BMLTSemantic.prototype.updateServiceBodies = function ( inCheckboxObject ) {
1433  var service_body_object = inCheckboxObject.serviceBody;
1434  var sb_id = parseInt(inCheckboxObject.value);
1435  var childBodies = service_body_object.childServiceBodies;
1436 
1437  var found = false;
1438 
1439  if ( this.state.services && this.state.services.length ) {
1440  for (var i = 0; i < this.state.services.length; i++) {
1441  var serviceID = parseInt(this.state.services[i]);
1442 
1443  if ( Math.abs(serviceID) == Math.abs(sb_id) ) {
1444  if ( inCheckboxObject.checked ) {
1445  this.state.services[i] = parseInt(inCheckboxObject.value);
1446  found = true;
1447  } else {
1448  if ( serviceID == sb_id ) {
1449  this.state.services.splice(i, 1);
1450  found = true;
1451  };
1452  };
1453  break;
1454  };
1455  };
1456  } else {
1457  this.state.services = Array();
1458  };
1459 
1460  if ( !found && inCheckboxObject.checked ) {
1461  this.state.services.push(parseInt(inCheckboxObject.value));
1462  };
1463 
1464  if ( inCheckboxObject.checked ) {
1465  var not_extra = (parseInt(inCheckboxObject.value) > 0) ? 'not_' : '';
1466  this.getScopedElement('bmlt_semantic_form_sb_checkbox_' + not_extra + Math.abs(sb_id)).checked = false;
1467  };
1468 
1469  if ( childBodies ) {
1470  for (var i = 0; i < childBodies.length; i++) {
1471  var child = childBodies[i];
1472  var not_extra = sb_id < 0 ? 'not_' : '';
1473  var cb_element = this.getScopedElement('bmlt_semantic_form_sb_checkbox_' + not_extra + parseInt(childBodies[i].id));
1474 
1475  cb_element.checked = inCheckboxObject.checked;
1476 
1477  this.updateServiceBodies(cb_element);
1478  };
1479  };
1480 };
1481 
1482 /*******************************************************************************************/
1483 /**
1484  \brief
1485 */
1486 /*******************************************************************************************/
1487 BMLTSemantic.prototype.handleSortFieldChange = function ( inOptionObject ) {
1488  var sort = new Object();
1489 
1490  sort.key = inOptionObject.fieldKey.toString();
1491  sort.order = parseInt(inOptionObject.value);
1492 
1493  var selectObject = inOptionObject.parentNode;
1494  selectObject.className = selectObject.defaultClass;
1495 
1496  if ( !this.state.sorts ) {
1497  this.state.sorts = new Array(sort);
1498  } else {
1499  var found = false;
1500 
1501  for (var i = 0; i < this.state.sorts.length; i++) {
1502  if ( this.state.sorts[i].key == sort.key ) {
1503  found = true;
1504  if ( sort.order > 0 ) {
1505  this.state.sorts[i].order = sort.order;
1506  } else {
1507  this.state.sorts.splice(i, 1);
1508  };
1509 
1510  break;
1511  };
1512  };
1513 
1514  if ( !found ) {
1515  this.state.sorts.push(sort);
1516  };
1517  };
1518 
1519  var sortFunc = function ( inA, inB ) {
1520  var ret = 0;
1521 
1522  if ( inA.order < inB.order ) {
1523  ret = -1;
1524  } else {
1525  if ( inB.order < inA.order ) {
1526  ret = 1;
1527  };
1528  };
1529 
1530  return ret;
1531  };
1532 
1533  this.state.sorts.sort(sortFunc);
1534 
1535  if ( this.state.sorts.length == 1 ) {
1536  if ( this.state.sorts[0].order == 0 ) {
1537  this.state.sorts = null;
1538  } else {
1539  this.state.sorts[0].order = 1;
1540  };
1541  } else {
1542  if ( this.state.sorts.length > 1 ) {
1543  this.state.sorts[0].order = 1;
1544  for (var i = 1; i < this.state.sorts.length; i++) {
1545  this.state.sorts[i].order = (this.state.sorts[i - 1].order + 1);
1546  };
1547  };
1548  };
1549 
1550  this.setAllSortFieldState();
1551 
1552  this.refreshURI();
1553 };
1554 
1555 /*******************************************************************************************/
1556 /**
1557  \brief
1558 */
1559 /*******************************************************************************************/
1560 BMLTSemantic.prototype.handleFormatCheckbox = function ( inCheckboxObject ) {
1561  var id = parseInt(inCheckboxObject.value);
1562  var id_abs = Math.abs(id);
1563  var checked = inCheckboxObject.checked;
1564  var formatsArray = Array();
1565  var yes_container_id = this.getScopedID('bmlt_semantic_form_formats_fieldset_div');
1566  var not_container_id = this.getScopedID('bmlt_semantic_form_not_formats_fieldset_div');
1567  var yes_id = this.getScopedID(yes_container_id + '_checkbox_' + id_abs);
1568  var no_id = this.getScopedID(not_container_id + '_checkbox_' + id_abs);
1569 
1570  if ( this.state.formats ) {
1571  if ( inCheckboxObject.checked ) {
1572  if ( inCheckboxObject.id == yes_id ) {
1573  document.getElementById(no_id).checked = false;
1574  } else {
1575  if ( inCheckboxObject.id == no_id ) {
1576  document.getElementById(yes_id).checked = false;
1577  };
1578  };
1579  };
1580 
1581  var formatsArrayTemp = this.state.formats.split(',');
1582 
1583  this.state.formats = null;
1584 
1585  for (var i = 0; i < formatsArrayTemp.length; i++) {
1586  if ( parseInt(formatsArrayTemp[i]) && (Math.abs(parseInt(formatsArrayTemp[i])) != id_abs) ) {
1587  formatsArray.push(parseInt(formatsArrayTemp[i]));
1588  };
1589  };
1590  };
1591 
1592  if ( checked ) {
1593  formatsArray.push(parseInt(id));
1594  };
1595 
1596  formatsArray = formatsArray.sort(function ( a, b ) {
1597  return Math.abs(a) > Math.abs(b); });
1598 
1599  this.state.formats = formatsArray.join(',');
1600 
1601  this.refreshURI();
1602 };
1603 
1604 /*******************************************************************************************/
1605 /**
1606  \brief
1607 */
1608 /*******************************************************************************************/
1609 BMLTSemantic.prototype.handleFormatsComparisonOperatorRadioButton = function ( inRadioButtonObject ) {
1610  if (inRadioButtonObject) {
1611  this.state.formats_comparison_operator = inRadioButtonObject.value;
1612  }
1613  this.refreshURI();
1614 };
1615 
1616 /*******************************************************************************************/
1617 /**
1618  \brief
1619 */
1620 /*******************************************************************************************/
1621 BMLTSemantic.prototype.handleWeekdayCheckbox = function ( inCheckboxObject ) {
1622  this.scanWeekdays(inCheckboxObject.checked ? parseInt(inCheckboxObject.value) : 0);
1623  this.refreshURI();
1624 };
1625 
1626 /*******************************************************************************************/
1627 /**
1628  \brief
1629 */
1630 /*******************************************************************************************/
1631 BMLTSemantic.prototype.scanWeekdays = function ( value ) {
1632  this.state.weekdays = null;
1633  var abs = Math.abs(parseInt(value));
1634 
1635  if ( value > 0 ) {
1636  this.getScopedElement('bmlt_semantic_form_not_weekday_checkbox_' + abs).checked = false;
1637  } else {
1638  if ( value < 0 ) {
1639  this.getScopedElement('bmlt_semantic_form_weekday_checkbox_' + abs).checked = false;
1640  };
1641  };
1642 
1643  for (var i = 1; i < 8; i++) {
1644  if ( this.getScopedElement('bmlt_semantic_form_weekday_checkbox_' + i).checked ) {
1645  if ( this.state.weekdays ) {
1646  this.state.weekdays += ',' + i.toString();
1647  } else {
1648  this.state.weekdays = i.toString();
1649  };
1650  };
1651 
1652  if ( this.getScopedElement('bmlt_semantic_form_not_weekday_checkbox_' + i).checked ) {
1653  if ( this.state.weekdays ) {
1654  this.state.weekdays += ',' + (-i).toString();
1655  } else {
1656  this.state.weekdays = (-i).toString();
1657  };
1658  };
1659  };
1660 };
1661 
1662 /*******************************************************************************************/
1663 /**
1664  \brief
1665 */
1666 /*******************************************************************************************/
1667 BMLTSemantic.prototype.clearWeekdays = function ( ) {
1668  this.state.weekdays = null;
1669 
1670  for (var i = 1; i < 8; i++) {
1671  this.getScopedElement('bmlt_semantic_form_weekday_checkbox_' + i).checked = false;
1672  this.getScopedElement('bmlt_semantic_form_not_weekday_checkbox_' + i).checked = false;
1673  };
1674 };
1675 
1676 /*******************************************************************************************/
1677 /**
1678  \brief
1679 */
1680 /*******************************************************************************************/
1681 BMLTSemantic.prototype.clearSorts = function ( ) {
1682  if ( this.field_keys ) {
1683  for (var i = 0; i < this.field_keys.length; i++) {
1684  var selectObject = this.getScopedElement(this.getSortItemID(this.field_keys[i].key.toString()));
1685 
1686  if ( selectObject ) {
1687  selectObject.selectedIndex = 0;
1688  selectObject.className = selectObject.defaultClass;
1689  };
1690  };
1691  };
1692 };
1693 
1694 /*******************************************************************************************/
1695 /**
1696  \brief
1697 */
1698 /*******************************************************************************************/
1699 BMLTSemantic.prototype.handleUsedFormatsChange = function ( inElement
1700  ) {
1701  var getUsedCheckbox = inElement.formHandler.getScopedElement('bmlt_semantic_form_used_formats_checkbox');
1702  var getOnlyUsedCheckbox = inElement.formHandler.getScopedElement('bmlt_semantic_form_just_used_formats_checkbox');
1703 
1704  if ( getUsedCheckbox && getOnlyUsedCheckbox ) {
1705  if ( !getUsedCheckbox.checked ) {
1706  getOnlyUsedCheckbox.checked = false;
1707  getOnlyUsedCheckbox.disable();
1708  } else {
1709  getOnlyUsedCheckbox.enable();
1710  };
1711  };
1712 
1713  inElement.formHandler.refreshURI();
1714 };
1715 
1716 /*******************************************************************************************/
1717 /**
1718  \brief
1719 */
1720 /*******************************************************************************************/
1721 BMLTSemantic.prototype.clearFormatsComparisonOperator = function ( ) {
1722  this.state.formats_comparison_operator = "AND";
1723 
1724  var radioButton = document.getElementById("formats_comparison_operator_radio_and");
1725  if (radioButton) {
1726  radioButton.checked = true;
1727  }
1728 
1729  radioButton = document.getElementById("formats_comparison_operator_radio_or");
1730  if (radioButton) {
1731  radioButton.checked = false;
1732  }
1733 };
1734 
1735 
1736 /*******************************************************************************************/
1737 /**
1738  \brief
1739 */
1740 /*******************************************************************************************/
1741 BMLTSemantic.prototype.clearTextSearchItems = function ( ) {
1742  this.state.searchText = null;
1743  this.state.searchTextModifier = null;
1744  this.state.searchTextRadius = null;
1745 
1746  var bmlt_semantic_form_text_search_text = this.getScopedElement('bmlt_semantic_form_text_search_text');
1747  var bmlt_semantic_form_text_search_select = this.getScopedElement('bmlt_semantic_form_text_search_select');
1748  var bmlt_semantic_form_text_search_text_radius = this.getScopedElement('bmlt_semantic_form_text_search_text_radius');
1749 
1750  bmlt_semantic_form_text_search_text.value = bmlt_semantic_form_text_search_text.defaultValue;
1751  bmlt_semantic_form_text_search_text.className = bmlt_semantic_form_text_search_text.defaultClass.toString() + ' bmlt_semantic_form_disabled_text';
1752  bmlt_semantic_form_text_search_select.selectedIndex = 0;
1753  bmlt_semantic_form_text_search_text_radius.value = '';
1754 
1755  this.handleTextSearchText();
1756 };
1757 
1758 /*******************************************************************************************/
1759 /**
1760  \brief
1761 */
1762 /*******************************************************************************************/
1763 BMLTSemantic.prototype.handleNAWSDumpSelectChange = function ( inSelect ) {
1764  this.state.sb_id = parseInt(inSelect.value);
1765  this.refreshURI();
1766 };
1767 
1768 /*******************************************************************************************/
1769 /**
1770  \brief
1771 */
1772 /*******************************************************************************************/
1773 BMLTSemantic.prototype.handleChangesSBSelectChange = function ( inSelect ) {
1774  this.state.change_sb_id = parseInt(inSelect.value);
1775  this.refreshURI();
1776 };
1777 
1778 /*******************************************************************************************/
1779 /**
1780  \brief
1781 */
1782 /*******************************************************************************************/
1783 BMLTSemantic.prototype.handleValueText = function (inTextItem
1784  ) {
1785  this.state.meeting_key_value = (inTextItem.value != inTextItem.defaultValue) ? inTextItem.value : null;
1786  this.getScopedElement('bmlt_semantic_form_value_select').selectedIndex = 0;
1787 };
1788 
1789 /*******************************************************************************************/
1790 /**
1791  \brief
1792 */
1793 /*******************************************************************************************/
1794 BMLTSemantic.prototype.handleChangeText = function () {
1795  var start_date = this.getScopedElement('bmlt_semantic_form_changes_from_text');
1796  var end_date = this.getScopedElement('bmlt_semantic_form_changes_to_text');
1797  var meeting_id = this.getScopedElement('bmlt_semantic_form_changes_id_text');
1798 
1799  this.state.change_start = (start_date.value && (start_date.value != start_date.defaultValue)) ? start_date.value : null;
1800  this.state.change_end = (end_date.value && (end_date.value != end_date.defaultValue)) ? end_date.value : null;
1801  this.state.change_id = (meeting_id.value && (meeting_id.value != meeting_id.defaultValue)) ? meeting_id.value : null;
1802 
1803  this.refreshURI();
1804 };
1805 
1806 /*******************************************************************************************/
1807 /**
1808  \brief
1809 */
1810 /*******************************************************************************************/
1811 BMLTSemantic.prototype.handleStartText = function ( inTextItem
1812  ) {
1813  this.refreshURI();
1814 };
1815 
1816 /*******************************************************************************************/
1817 /**
1818  \brief
1819 */
1820 /*******************************************************************************************/
1821 BMLTSemantic.prototype.handleEndText = function ( inTextItem
1822  ) {
1823  this.refreshURI();
1824 };
1825 
1826 /*******************************************************************************************/
1827 /**
1828  \brief
1829 */
1830 /*******************************************************************************************/
1831 BMLTSemantic.prototype.handleDurationText = function ( inTextItem
1832  ) {
1833  this.refreshURI();
1834 };
1835 
1836 /*******************************************************************************************/
1837 /**
1838  \brief
1839 */
1840 /*******************************************************************************************/
1841 BMLTSemantic.prototype.handleMapCheckboxChange = function ( inCheckbox
1842  ) {
1843  var mapSection = this.getScopedElement('bmlt_semantic_form_map_wrapper_div');
1844 
1845  if ( inCheckbox.checked ) {
1846  mapSection.show();
1847  } else {
1848  mapSection.hide();
1849  };
1850 
1851  this.refreshURI();
1852 };
1853 
1854 /*******************************************************************************************/
1855 /**
1856  \brief
1857 */
1858 /*******************************************************************************************/
1859 BMLTSemantic.prototype.handleBlockCheckboxChange = function ( inCheckbox
1860  ) {
1861  this.refreshURI();
1862 };
1863 
1864 /*******************************************************************************************/
1865 /**
1866  \brief
1867 */
1868 /*******************************************************************************************/
1869 BMLTSemantic.prototype.handleFormatsLangSelectChange = function ( inSelect ) {
1870  this.refreshURI();
1871 };
1872 
1873 /*******************************************************************************************/
1874 /**
1875  \brief
1876 */
1877 /*******************************************************************************************/
1878 BMLTSemantic.prototype.handleSpecificFieldChange = function ( inCheckbox ) {
1879  var key = inCheckbox.value;
1880  var oldFields = Array();
1881 
1882  for (var i = 0; i < this.state.fields.length; i++) {
1883  var oldKey = this.state.fields[i];
1884  if ( oldKey != key ) {
1885  oldFields.push(oldKey);
1886  };
1887  };
1888 
1889  if ( inCheckbox.checked ) {
1890  oldFields.push(key);
1891  };
1892 
1893  this.state.fields = oldFields;
1894 
1895  this.refreshURI();
1896 };
1897 
1898 /*******************************************************************************************/
1899 /**
1900  \brief
1901 */
1902 /*******************************************************************************************/
1903 BMLTSemantic.prototype.handleTextSearchText = function () {
1904  var bmlt_semantic_form_text_search_text = this.getScopedElement('bmlt_semantic_form_text_search_text');
1905  var bmlt_semantic_form_text_search_select = this.getScopedElement('bmlt_semantic_form_text_search_select');
1906  var bmlt_semantic_form_text_search_text_radius = this.getScopedElement('bmlt_semantic_form_text_search_text_radius');
1907 
1908  this.state.searchText = null;
1909  this.state.searchTextModifier = null;
1910  this.state.searchTextRadius = null;
1911 
1912  this.getScopedElement('text_search_radius_input_div').hide();
1913  bmlt_semantic_form_text_search_select.disable();
1914 
1915  if ( bmlt_semantic_form_text_search_text.value && (bmlt_semantic_form_text_search_text.value != bmlt_semantic_form_text_search_text.defaultValue) ) {
1916  bmlt_semantic_form_text_search_select.enable();
1917  this.state.searchText = bmlt_semantic_form_text_search_text.value;
1918  this.state.searchTextModifier = bmlt_semantic_form_text_search_select.value;
1919  if ( bmlt_semantic_form_text_search_select.value == 'StringSearchIsAnAddress=1' ) {
1920  this.getScopedElement('text_search_radius_input_div').show();
1921  var radius = parseFloat(bmlt_semantic_form_text_search_text_radius.value);
1922 
1923  if ( radius < 0 ) {
1924  radius = parseInt(radius);
1925  if ( parseFloat(radius) != parseFloat(bmlt_semantic_form_text_search_text_radius.value) ) {
1926  bmlt_semantic_form_text_search_text_radius.value = radius;
1927  };
1928  };
1929 
1930  this.state.searchTextRadius = radius;
1931  };
1932  } else {
1933  bmlt_semantic_form_text_search_text_radius.value = '';
1934  };
1935 
1936  this.refreshURI();
1937 };
1938 
1939 /*******************************************************************************************/
1940 /**
1941  \brief Hides the form if we have a bad root server URI.
1942 */
1943 /*******************************************************************************************/
1944 BMLTSemantic.prototype.validateVersion = function () {
1945  if ( this.version == 0 ) {
1946  var bad_header = this.getScopedElement('bmlt_semantic_badserver_h1');
1947  var form = this.getScopedElement('bmlt_semantic_form');
1948 
1949  bad_header.style.display = 'block';
1950  form.style.display = 'none';
1951  } else {
1952  if ( this.version < 2006015 ) {
1953  this.getScopedElement('bmlt_semantic_form_switcher_type_select_fieldkey_option').disable();
1954  this.getScopedElement('bmlt_semantic_form_switcher_type_select_fieldval_option').disable();
1955  };
1956  };
1957 };
1958 
1959 /*******************************************************************************************/
1960 /**
1961  \brief Sets the basic text handler for text items (handles switching classes).
1962 
1963  \param inID The ID that needs to be "scoped."
1964 */
1965 /*******************************************************************************************/
1966 BMLTSemantic.prototype.setTextHandlers = function ( inID
1967  ) {
1968  this.setBasicFunctions(inID);
1969  var textItem = this.getScopedElement(inID);
1970 
1971  if ( textItem ) {
1972  textItem.className = textItem.defaultClass + ' bmlt_semantic_form_disabled_text';
1973 
1974  var oldOnChange = textItem.onchange;
1975 
1976  textItem.onchange = function () {
1977  this.formHandler.handleTextInput(this, true); };
1978  textItem.onkeyup = function () {
1979  this.formHandler.handleTextInput(this, true); };
1980  textItem.onblur = function () {
1981  this.formHandler.handleTextInput(this, false); };
1982  textItem.onfocus = function () {
1983  this.formHandler.handleTextInput(this, true); };
1984 
1985  if ( oldOnChange ) {
1986  textItem.additionalHandler = oldOnChange;
1987  };
1988  };
1989 };
1990 
1991 /*******************************************************************************************/
1992 /**
1993  \brief Sets up simple enable/disable/show/hide functions for a given item.
1994 
1995  \param inItemID The ID (unscoped) of the item.
1996 */
1997 /*******************************************************************************************/
1998 BMLTSemantic.prototype.setBasicFunctions = function ( inItemID
1999  ) {
2000  var item = this.getScopedElement(inItemID);
2001 
2002  if ( item ) {
2003  item.formHandler = this;
2004  item.oldDisplay = item.style.display;
2005  if ( item.oldDisplay == 'none' ) {
2006  item.oldDisplay = 'block';
2007  };
2008  item.defaultValue = item.value;
2009  item.defaultClass = item.className;
2010  item.disable = function () {
2011  this.disabled = true };
2012  item.enable = function () {
2013  this.disabled = false };
2014  item.hide = function () {
2015  this.style.display = 'none' };
2016  item.show = function () {
2017  this.style.display = this.oldDisplay };
2018  };
2019 };
2020 
2021 /*******************************************************************************************/
2022 /**
2023  \brief
2024 */
2025 /*******************************************************************************************/
2026 BMLTSemantic.prototype.getSortItemID = function ( inKey, inIndex ) {
2027  var baseID = 'bmlt_semantic_form_field_sort_select_' + inKey.toString();
2028 
2029  if ( null != inIndex ) {
2030  baseID += '_' + parseInt(inIndex).toString();
2031  };
2032 
2033  return baseID;
2034 };
2035 
2036 /*******************************************************************************************/
2037 /**
2038  \brief
2039 */
2040 /*******************************************************************************************/
2041 BMLTSemantic.prototype.setSortFieldFunctions = function ( inKey ) {
2042  this.setBasicFunctions(this.getSortItemID(inKey, null));
2043 
2044  for (var i = 0; i <= this.field_keys.length; i++) {
2045  var sortItemOptionID = this.getSortItemID(inKey, i);
2046  this.setBasicFunctions(sortItemOptionID);
2047  var sortItem = this.getScopedElement(sortItemOptionID);
2048  if ( sortItem ) {
2049  sortItem.fieldKey = inKey;
2050  };
2051  };
2052 };
2053 
2054 /*******************************************************************************************/
2055 /**
2056  \brief
2057 */
2058 /*******************************************************************************************/
2059 BMLTSemantic.prototype.setAllSortFieldFunctions = function ( ) {
2060  for (var i = 0; i < this.field_keys.length; i++) {
2061  this.setSortFieldFunctions(this.field_keys[i].key.toString());
2062  };
2063 };
2064 
2065 /*******************************************************************************************/
2066 /**
2067  \brief
2068 */
2069 /*******************************************************************************************/
2070 BMLTSemantic.prototype.setSortFieldState = function ( inKey, inMaxNum ) {
2071  inMaxNum++;
2072  for (var i = 1; i <= this.field_keys.length; i++) {
2073  var sortItemOptionID = this.getSortItemID(inKey, i);
2074  var optionElement = this.getScopedElement(sortItemOptionID);
2075 
2076  if ( optionElement ) {
2077  var sortItemSelect = optionElement.parentNode;
2078 
2079  if ( sortItemSelect ) {
2080  if ( (sortItemSelect.selectedIndex == 0) && (optionElement.value == inMaxNum) ) {
2081  optionElement.enable();
2082  } else {
2083  optionElement.disable();
2084  };
2085  };
2086  };
2087  };
2088 };
2089 
2090 /*******************************************************************************************/
2091 /**
2092  \brief
2093 */
2094 /*******************************************************************************************/
2095 BMLTSemantic.prototype.setAllSortFieldState = function ( ) {
2096  var maxNum = 0;
2097 
2098  if ( this.state.sorts && this.state.sorts.length ) {
2099  maxNum = this.state.sorts[this.state.sorts.length - 1].order;
2100 
2101  for (var i = 0; i < this.field_keys.length; i++) {
2102  var key = this.field_keys[i].key.toString();
2103  var selectID = this.getSortItemID(key);
2104  var selectObject = this.getScopedElement(selectID);
2105  selectObject.className = selectObject.defaultClass;
2106  for (var c = 0; c < this.state.sorts.length; c++) {
2107  var sortObject = this.state.sorts[c];
2108 
2109  if ( sortObject.key == key ) {
2110  selectObject.selectedIndex = sortObject.order;
2111  if ( sortObject.order > 0 ) {
2112  selectObject.className = selectObject.defaultClass + ' sortSelectHighlight';
2113  };
2114  };
2115  };
2116  };
2117  };
2118 
2119  for (var i = 0; i < this.field_keys.length; i++) {
2120  this.setSortFieldState(this.field_keys[i].key.toString(), maxNum);
2121  };
2122 };
2123 
2124 /*******************************************************************************************/
2125 /**
2126  \brief Sets up the map display for the instance.
2127 */
2128 /*******************************************************************************************/
2129 BMLTSemantic.prototype.setUpMap = function ( ) {
2130  var mapDiv = this.getScopedElement('bmlt_semantic_form_map_div');
2131  this.mapObject = null;
2132  mapDiv.innerHTML = '';
2133 
2134  var switcher_select = this.getScopedElement('bmlt_semantic_form_switcher_type_select');
2135 
2136  if ( switcher_select.value == 'GetSearchResults' ) {
2137  var position = new google.maps.LatLng(this.current_lat, this.current_lng);
2138  var myOptions = {
2139  'center': position,
2140  'zoom': this.current_zoom,
2141  'mapTypeId': google.maps.MapTypeId.ROADMAP,
2142  'mapTypeControlOptions': { 'style': google.maps.MapTypeControlStyle.DROPDOWN_MENU },
2143  'zoomControl': true,
2144  'mapTypeControl': true,
2145  'disableDoubleClickZoom' : true,
2146  'draggableCursor': "crosshair",
2147  'scaleControl' : true,
2148  'cursor': 'default',
2149  'scrollwheel': false
2150  };
2151 
2152  myOptions.zoomControlOptions = { 'style': google.maps.ZoomControlStyle.LARGE };
2153 
2154  this.mapObject = new google.maps.Map(mapDiv, myOptions);
2155 
2156  if ( this.mapObject ) {
2157  this.mapObject.map_marker = new google.maps.Marker(
2158  {
2159  'position': position,
2160  'map': this.mapObject,
2161  'clickable': false,
2162  'draggable': true
2163  }
2164  );
2165  var theContext = this;
2166  this.mapObject.map_marker.formHandler = this;
2167 
2168  google.maps.event.addListener(this.mapObject.map_marker, 'dragstart', function ( in_event ) {
2169  this.formHandler.hideRadiusCircle(); });
2170  google.maps.event.addListener(this.mapObject.map_marker, 'dragend', function ( in_event ) {
2171  BMLTSemantic.prototype.mapDragEnd(in_event, theContext); });
2172  google.maps.event.addListener(this.mapObject, 'click', function ( in_event ) {
2173  BMLTSemantic.prototype.mapClicked(in_event, theContext); });
2174  google.maps.event.addListener(this.mapObject, 'zoom_changed', function ( in_event ) {
2175  BMLTSemantic.prototype.mapZoomChanged(in_event, theContext); });
2176  };
2177 
2178  var longText = this.getScopedElement('bmlt_semantic_form_map_search_longitude_text');
2179  var latText = this.getScopedElement('bmlt_semantic_form_map_search_latitude_text');
2180 
2181  longText.value = this.current_lng.toString();
2182  latText.value = this.current_lat.toString();
2183  };
2184 };
2185 
2186 /*******************************************************************************************/
2187 /**
2188  \brief Sets up the map display for the instance.
2189 */
2190 /*******************************************************************************************/
2191 BMLTSemantic.prototype.setUpCoverageMap = function ( ) {
2192  if ( this.coverageMapObject == null ) {
2193  var mapDiv = this.getScopedElement('bmlt_semantic_coverage_area_fieldset_map_div');
2194  this.coverageMapObject = null;
2195  mapDiv.innerHTML = '';
2196 
2197  var position = new google.maps.LatLng(this.current_lat, this.current_lng);
2198  var myOptions = {
2199  'center': position,
2200  'zoom': this.current_zoom,
2201  'mapTypeId': google.maps.MapTypeId.ROADMAP,
2202  'mapTypeControlOptions': { 'style': google.maps.MapTypeControlStyle.DROPDOWN_MENU },
2203  'zoomControl': true,
2204  'mapTypeControl': true,
2205  'disableDoubleClickZoom' : true,
2206  'draggableCursor': "crosshair",
2207  'scaleControl' : true,
2208  'cursor': 'default',
2209  'scrollwheel': false
2210  };
2211 
2212  myOptions.zoomControlOptions = { 'style': google.maps.ZoomControlStyle.LARGE };
2213 
2214  this.coverageMapObject = new google.maps.Map(mapDiv, myOptions);
2215 
2216  if ( this.coverageMapObject ) {
2217  var bounds = new google.maps.LatLngBounds();
2218  bounds.extend(this.coverageArea.ne_corner);
2219  bounds.extend(this.coverageArea.sw_corner);
2220  this.coverageMapObject.fitBounds(bounds);
2221 
2222  var rectangle = new google.maps.Rectangle({
2223  strokeColor: '#000000',
2224  strokeOpacity: 0.0,
2225  strokeWeight: 0.0,
2226  fillColor: '#663300',
2227  fillOpacity: 0.25,
2228  map: this.coverageMapObject,
2229  bounds: bounds
2230  });
2231  };
2232  };
2233 };
2234 
2235 /*******************************************************************************************/
2236 /**
2237  \brief
2238 */
2239 /*******************************************************************************************/
2240 BMLTSemantic.prototype.handleMapSearchText = function () {
2241  var bmlt_semantic_form_map_search_text_radius = this.getScopedElement('bmlt_semantic_form_map_search_text_radius');
2242 
2243  this.state.searchMapRadius = null;
2244 
2245  if ( bmlt_semantic_form_map_search_text_radius.value && (bmlt_semantic_form_map_search_text_radius.value != bmlt_semantic_form_map_search_text_radius.defaultValue) ) {
2246  bmlt_semantic_form_map_search_text_radius.enable();
2247  var radius = parseFloat(bmlt_semantic_form_map_search_text_radius.value);
2248 
2249  if ( radius < 0 ) {
2250  radius = parseInt(radius);
2251  if ( parseFloat(radius) != parseFloat(bmlt_semantic_form_map_search_text_radius.value) ) {
2252  bmlt_semantic_form_map_search_text_radius.value = radius;
2253  };
2254  };
2255 
2256  this.state.searchMapRadius = radius;
2257  } else {
2258  bmlt_semantic_form_map_search_text_radius.value = '';
2259  };
2260 
2261  this.refreshURI();
2262 };
2263 
2264 /*******************************************************************************************/
2265 /**
2266  \brief
2267 */
2268 /*******************************************************************************************/
2269 BMLTSemantic.prototype.handleMapLongLatChange = function ( inTextItem
2270  ) {
2271  var longText = this.getScopedElement('bmlt_semantic_form_map_search_longitude_text');
2272  var latText = this.getScopedElement('bmlt_semantic_form_map_search_latitude_text');
2273  var position = new google.maps.LatLng(parseFloat(latText.value), parseFloat(longText.value));
2274 
2275  this.mapObject.panTo(position);
2276  this.mapObject.map_marker.setPosition(position);
2277  this.current_lng = parseFloat(parseFloat(longText.value));
2278  this.current_lat = parseFloat(parseFloat(latText.value));
2279 
2280  this.refreshURI();
2281 };
2282 
2283 /*******************************************************************************************/
2284 /**
2285  \brief
2286 */
2287 /*******************************************************************************************/
2288 BMLTSemantic.prototype.handleMapRadiusUnitsChange = function ( inSelect
2289  ) {
2290  this.refreshURI();
2291 };
2292 
2293 /*******************************************************************************************/
2294 /**
2295  \brief
2296 */
2297 /*******************************************************************************************/
2298 BMLTSemantic.prototype.hideRadiusCircle = function () {
2299  if ( this.mapObject && this.mapObject.radiusCircle ) {
2300  this.mapObject.radiusCircle.setMap(null);
2301  this.mapObject.radiusCircle = null;
2302  };
2303 };
2304 
2305 /*******************************************************************************************/
2306 /**
2307  \brief
2308 */
2309 /*******************************************************************************************/
2310 BMLTSemantic.prototype.createRadiusCircle = function () {
2311  this.hideRadiusCircle();
2312 
2313  var radius = this.getScopedElement('bmlt_semantic_form_map_search_text_radius').value;
2314 
2315  if ( radius > 0 ) {
2316  radius *= ((this.getScopedElement('bmlt_semantic_form_map_search_text_radius_units').value == 'geo_width') ? 1.60934 : 1.0) * 1000;
2317 
2318  var circleOptions = {
2319  strokeOpacity: 0,
2320  fillColor: '#000000',
2321  fillOpacity: 0.25,
2322  map: this.mapObject,
2323  clickable: false,
2324  center: new google.maps.LatLng(parseFloat(this.current_lat), parseFloat(this.current_lng)),
2325  radius: radius
2326  };
2327 
2328  // Add the circle for this city to the map.
2329  this.mapObject.radiusCircle = new google.maps.Circle(circleOptions);
2330  };
2331 };
2332 
2333 /*******************************************************************************************/
2334 /**
2335  \brief Reacts to a click in the map.
2336 
2337  \param inEvent The click event
2338  \param inContext The object that triggered the event.
2339 */
2340 /*******************************************************************************************/
2341 BMLTSemantic.prototype.mapClicked = function (
2342  inEvent,
2343  inContext
2344 ) {
2345  inContext.mapObject.panTo(inEvent.latLng);
2346  inContext.mapObject.map_marker.setPosition(inEvent.latLng);
2347  inContext.current_lng = parseFloat(inEvent.latLng.lng());
2348  inContext.current_lat = parseFloat(inEvent.latLng.lat());
2349  var longText = inContext.getScopedElement('bmlt_semantic_form_map_search_longitude_text');
2350  var latText = inContext.getScopedElement('bmlt_semantic_form_map_search_latitude_text');
2351  longText.value = inContext.current_lng.toString();
2352  latText.value = inContext.current_lat.toString();
2353 
2354  inContext.refreshURI();
2355 };
2356 
2357 /*******************************************************************************************/
2358 /**
2359  \brief Reacts to a drag in the map ending.
2360 
2361  \param inEvent The drag event
2362  \param inContext The object that triggered the event.
2363 */
2364 /*******************************************************************************************/
2365 BMLTSemantic.prototype.mapDragEnd = function (
2366  inEvent,
2367  inContext
2368 ) {
2369  inContext.current_lng = parseFloat(inEvent.latLng.lng());
2370  inContext.current_lat = parseFloat(inEvent.latLng.lat());
2371  inContext.mapObject.panTo(inEvent.latLng);
2372  var longText = inContext.getScopedElement('bmlt_semantic_form_map_search_longitude_text');
2373  var latText = inContext.getScopedElement('bmlt_semantic_form_map_search_latitude_text');
2374  longText.value = inEvent.latLng.lng().toString();
2375  latText.value = inEvent.latLng.lat().toString();
2376 
2377  inContext.refreshURI();
2378 };
2379 
2380 /*******************************************************************************************/
2381 /**
2382  \brief Reacts to the map zoom changing.
2383 
2384  \param inEvent The drag event
2385  \param inContext The object that triggered the event.
2386 */
2387 /*******************************************************************************************/
2388 BMLTSemantic.prototype.mapZoomChanged = function (
2389  inEvent,
2390  inContext
2391 ) {
2392  inContext.current_zoom = inContext.mapObject.getZoom();
2393 };
2394 
2395 /*******************************************************************************************/
2396 /**
2397  \brief Initialize the main fieldset.
2398 */
2399 /*******************************************************************************************/
2400 BMLTSemantic.prototype.setUpForm_MainFieldset = function () {
2401  this.setBasicFunctions('bmlt_semantic_form_main_mode_select');
2402  this.setBasicFunctions('bmlt_semantic_form_direct_url_div');
2403  this.setBasicFunctions('bmlt_switcher_div_no_options_blurb');
2404  this.setBasicFunctions('bmlt_switcher_naws_dump_div');
2405  this.setBasicFunctions('bmlt_semantic_form_meeting_search_div');
2406  this.setBasicFunctions('bmlt_semantic_form_changes_div');
2407  this.setBasicFunctions('bmlt_semantic_form_main_fields_fieldset');
2408  this.setBasicFunctions('bmlt_semantic_form_response_type_select');
2409  this.setBasicFunctions('bmlt_semantic_form_switcher_type_select');
2410  this.setBasicFunctions('bmlt_semantic_form_switcher_type_select_formats_option');
2411  this.setBasicFunctions('bmlt_semantic_form_switcher_type_select_sb_option');
2412  this.setBasicFunctions('bmlt_semantic_form_switcher_type_select_changes_option');
2413  this.setBasicFunctions('bmlt_semantic_form_switcher_type_select_fieldkey_option');
2414  this.setBasicFunctions('bmlt_semantic_form_switcher_type_select_fieldval_option');
2415  this.setBasicFunctions('bmlt_semantic_form_switcher_type_select_naws_option');
2416  this.setBasicFunctions('bmlt_semantic_form_response_type_select_kml_option');
2417  this.setBasicFunctions('bmlt_semantic_form_response_type_select_gpx_option');
2418  this.setBasicFunctions('bmlt_semantic_form_response_type_select_poi_option');
2419  this.setBasicFunctions('bmlt_semantic_form_switcher_type_select_schema_option');
2420  this.setBasicFunctions('bmlt_semantic_form_switcher_type_select_server_langs_option');
2421  this.setBasicFunctions('bmlt_semantic_info_div_download_line');
2422  this.setBasicFunctions('bmlt_semantic_info_div_shortcode_line');
2423  this.setBasicFunctions('bmlt_semantic_form_main_fields_fieldset_contents_div');
2424  this.setBasicFunctions('bmlt_semantic_form_meeting_fields_fieldset_contents_div');
2425  this.setBasicFunctions('bmlt_semantic_form_value_select');
2426  this.setBasicFunctions('bmlt_switcher_field_value_div_no_options_blurb');
2427  this.setBasicFunctions('bmlt_switcher_field_value_div_formats');
2428  this.setBasicFunctions('bmlt_switcher_field_value_div_no_selected_formats_blurb');
2429  this.setBasicFunctions('bmlt_semantic_info_div_url_Invalid_span');
2430  this.setBasicFunctions('bmlt_semantic_info_div_shortcode_Invalid_span');
2431  this.setBasicFunctions('bmlt_semantic_info_div_url_active_span');
2432  this.setBasicFunctions('bmlt_semantic_info_div_shortcode_active_span');
2433  this.setBasicFunctions('bmlt_switcher_changes_sb_select');
2434  this.setBasicFunctions('bmlt_semantic_form_text_search_select');
2435  this.setBasicFunctions('text_search_radius_input_div');
2436  this.setBasicFunctions('bmlt_semantic_form_map_wrapper_div');
2437  this.setBasicFunctions('bmlt_semantic_form_map_search_text_radius_units');
2438  this.setBasicFunctions('bmlt_semantic_form_map_search_longitude_text');
2439  this.setBasicFunctions('bmlt_semantic_form_map_search_latitude_text');
2440  this.setBasicFunctions('bmlt_semantic_form_schema_select_fieldset');
2441  this.setBasicFunctions('bmlt_semantic_form_used_formats_checkbox');
2442  this.setBasicFunctions('bmlt_semantic_form_just_used_formats_checkbox');
2443  this.setBasicFunctions('bmlt_semantic_form_used_formats_div');
2444  this.setBasicFunctions('bmlt_semantic_form_just_used_formats_checkbox_div');
2445  this.setBasicFunctions('bmlt_semantic_form_formats_fieldset_contents_div');
2446  this.setBasicFunctions('bmlt_semantic_form_weekday_header_checkbox_div');
2447  this.setBasicFunctions('bmlt_semantic_form_start_time_min_text');
2448  this.setBasicFunctions('bmlt_semantic_form_start_time_max_text');
2449  this.setBasicFunctions('bmlt_semantic_form_end_time_max_text');
2450  this.setBasicFunctions('bmlt_semantic_form_duration_min_text');
2451  this.setBasicFunctions('bmlt_semantic_form_duration_max_text');
2452  this.setBasicFunctions('bmlt_semantic_form_sb_fieldset');
2453  this.setBasicFunctions('bmlt_semantic_form_sb_not_fieldset');
2454  this.setBasicFunctions('block_mode_checkbox_div');
2455  this.setBasicFunctions('block_mode_checkbox');
2456  this.setBasicFunctions('bmlt_semantic_form_weekday_fieldset');
2457  this.setBasicFunctions('bmlt_semantic_form_not_weekday_fieldset');
2458  this.setBasicFunctions('bmlt_semantic_form_specific_fields_fieldset');
2459  this.setBasicFunctions('bmlt_semantic_form_sort_fields_fieldset');
2460  this.setBasicFunctions('bmlt_semantic_coverage_area_fieldset');
2461 
2462  if ( this.getScopedElement('bmlt_semantic_form_switcher_type_select_server_info_option') ) {
2463  this.setBasicFunctions('bmlt_semantic_form_switcher_type_select_server_info_option');
2464  };
2465 
2466  if ( this.getScopedElement('bmlt_semantic_form_switcher_type_select_coverage_area_option') ) {
2467  this.setBasicFunctions('bmlt_semantic_form_switcher_type_select_coverage_area_option');
2468  };
2469 
2470  for (var i = 1; i < 8; i++) {
2471  this.setBasicFunctions('bmlt_semantic_form_weekday_checkbox_' + i);
2472  };
2473 
2474  this.setTextHandlers('bmlt_semantic_form_changes_from_text');
2475  this.setTextHandlers('bmlt_semantic_form_changes_to_text');
2476  this.setTextHandlers('bmlt_semantic_form_changes_id_text');
2477  this.setTextHandlers('bmlt_semantic_form_value_text');
2478  this.setTextHandlers('bmlt_semantic_form_text_search_text');
2479  this.setTextHandlers('bmlt_semantic_form_text_search_text_radius');
2480  this.setTextHandlers('bmlt_semantic_form_map_search_text_radius');
2481  this.setTextHandlers('bmlt_semantic_form_map_search_longitude_text');
2482  this.setTextHandlers('bmlt_semantic_form_map_search_latitude_text');
2483  this.setTextHandlers('bmlt_semantic_form_start_time_min_text');
2484  this.setTextHandlers('bmlt_semantic_form_start_time_max_text');
2485  this.setTextHandlers('bmlt_semantic_form_end_time_max_text');
2486  this.setTextHandlers('bmlt_semantic_form_duration_min_text');
2487  this.setTextHandlers('bmlt_semantic_form_duration_max_text');
2488 
2489  this.getScopedElement('bmlt_semantic_form_start_time_min_text').additionalHandler = function () {
2490  this.formHandler.handleStartText(this) };
2491  this.getScopedElement('bmlt_semantic_form_start_time_max_text').additionalHandler = function () {
2492  this.formHandler.handleStartText(this) };
2493  this.getScopedElement('bmlt_semantic_form_end_time_max_text').additionalHandler = function () {
2494  this.formHandler.handleEndText(this) };
2495  this.getScopedElement('bmlt_semantic_form_duration_min_text').additionalHandler = function () {
2496  this.formHandler.handleDurationText(this) };
2497  this.getScopedElement('bmlt_semantic_form_duration_max_text').additionalHandler = function () {
2498  this.formHandler.handleDurationText(this) };
2499  this.getScopedElement('bmlt_semantic_form_changes_from_text').additionalHandler = function () {
2500  this.formHandler.handleChangeText(this) };
2501  this.getScopedElement('bmlt_semantic_form_changes_to_text').additionalHandler = function () {
2502  this.formHandler.handleChangeText(this) };
2503  this.getScopedElement('bmlt_semantic_form_changes_id_text').additionalHandler = function () {
2504  this.formHandler.handleChangeText(this) };
2505  this.getScopedElement('bmlt_semantic_form_value_text').additionalHandler = function () {
2506  this.formHandler.handleValueText(this) };
2507  this.getScopedElement('bmlt_semantic_form_value_text').additionalHandler = function () {
2508  this.formHandler.handleValueText(this) };
2509  this.getScopedElement('bmlt_semantic_form_text_search_text').additionalHandler = function () {
2510  this.formHandler.handleTextSearchText() };
2511  this.getScopedElement('bmlt_semantic_form_text_search_text_radius').additionalHandler = function () {
2512  this.formHandler.handleTextSearchText() };
2513  this.getScopedElement('bmlt_semantic_form_map_search_text_radius').additionalHandler = function () {
2514  this.formHandler.handleMapSearchText() };
2515  this.getScopedElement('bmlt_semantic_form_map_search_longitude_text').additionalHandler = function () {
2516  this.formHandler.handleMapLongLatChange(this) };
2517  this.getScopedElement('bmlt_semantic_form_map_search_latitude_text').additionalHandler = function () {
2518  this.formHandler.handleMapLongLatChange(this) };
2519 
2520  this.getScopedElement('bmlt_semantic_form_map_wrapper_div').hide = function () {
2521  this.style.display = 'none'; this.formHandler.mapObject = null; };
2522  this.getScopedElement('bmlt_semantic_form_map_wrapper_div').show = function () {
2523  this.style.display = this.oldDisplay; this.formHandler.setUpMap(); };
2524 
2525  this.getScopedElement('bmlt_semantic_form_map_search_text_radius').value = this.state.searchMapRadius;
2526 
2527  var main_fieldset_select = this.getScopedElement('bmlt_semantic_form_main_mode_select');
2528  main_fieldset_select.onchange = function () {
2529  this.formHandler.handleMainSelectChange(this) };
2530  main_fieldset_select.selectedIndex = 0;
2531 
2532  var bmlt_semantic_form_response_type_select = this.getScopedElement('bmlt_semantic_form_response_type_select');
2533  bmlt_semantic_form_response_type_select.onchange = function () {
2534  this.formHandler.handleResponseSelectChange(this) };
2535  bmlt_semantic_form_response_type_select.selectedIndex = 0;
2536 
2537  var bmlt_semantic_form_switcher_type_select = this.getScopedElement('bmlt_semantic_form_switcher_type_select');
2538  bmlt_semantic_form_switcher_type_select.onchange = function () {
2539  this.formHandler.handleSwitcherSelectChange(this) };
2540  bmlt_semantic_form_switcher_type_select.selectedIndex = 0;
2541 };
2542 
2543 /*******************************************************************************************/
2544 /**
2545  \brief This scans the main selectors, and does what is necessary.
2546 
2547  \param inItem This is the item that triggered this map.
2548 */
2549 /*******************************************************************************************/
2550 BMLTSemantic.prototype.setUpMainSelectors = function ( inItem
2551  ) {
2552  var bmlt_semantic_form_weekday_fieldset = this.getScopedElement('bmlt_semantic_form_weekday_fieldset');
2553  var bmlt_semantic_form_not_weekday_fieldset = this.getScopedElement('bmlt_semantic_form_not_weekday_fieldset');
2554  var bmlt_semantic_form_specific_fields_fieldset = this.getScopedElement('bmlt_semantic_form_specific_fields_fieldset');
2555  var bmlt_semantic_form_sort_fields_fieldset = this.getScopedElement('bmlt_semantic_form_sort_fields_fieldset');
2556  var main_fieldset_select = this.getScopedElement('bmlt_semantic_form_main_mode_select');
2557  var main_fieldset_direct_uri_div = this.getScopedElement('bmlt_semantic_form_direct_url_div');
2558  var response_type_select = this.getScopedElement('bmlt_semantic_form_response_type_select');
2559  var switcher_select = this.getScopedElement('bmlt_semantic_form_switcher_type_select');
2560  var switcher_type_select_formats_option = this.getScopedElement('bmlt_semantic_form_switcher_type_select_formats_option');
2561  var switcher_type_select_sb_option = this.getScopedElement('bmlt_semantic_form_switcher_type_select_sb_option');
2562  var switcher_type_select_changes_option = this.getScopedElement('bmlt_semantic_form_switcher_type_select_changes_option');
2563  var switcher_type_select_fieldkey_option = this.getScopedElement('bmlt_semantic_form_switcher_type_select_fieldkey_option');
2564  var switcher_type_select_fieldval_option = this.getScopedElement('bmlt_semantic_form_switcher_type_select_fieldval_option');
2565  var switcher_type_select_naws_option = this.getScopedElement('bmlt_semantic_form_switcher_type_select_naws_option');
2566  var bmlt_semantic_form_meeting_search_div = this.getScopedElement('bmlt_semantic_form_meeting_search_div');
2567  var bmlt_semantic_form_changes_div = this.getScopedElement('bmlt_semantic_form_changes_div');
2568  var bmlt_switcher_div_no_options_blurb = this.getScopedElement('bmlt_switcher_div_no_options_blurb');
2569  var bmlt_switcher_naws_dump_div = this.getScopedElement('bmlt_switcher_naws_dump_div');
2570  var bmlt_semantic_info_div_download_line = this.getScopedElement('bmlt_semantic_info_div_download_line');
2571  var bmlt_semantic_info_div_shortcode_line = this.getScopedElement('bmlt_semantic_info_div_shortcode_line');
2572  var bmlt_semantic_form_main_fields_fieldset = this.getScopedElement('bmlt_semantic_form_main_fields_fieldset');
2573  var bmlt_semantic_form_field_main_select = this.getScopedElement('bmlt_semantic_form_field_main_select');
2574  var text_search_radius_input_div = this.getScopedElement('text_search_radius_input_div');
2575  var map_search_radius_input_div = this.getScopedElement('map_search_radius_input_div');
2576  var bmlt_semantic_form_text_search_select = this.getScopedElement('bmlt_semantic_form_text_search_select');
2577  var bmlt_switcher_field_value_div_formats = this.getScopedElement('bmlt_switcher_field_value_div_formats');
2578  var bmlt_switcher_field_value_div_no_selected_formats_blurb = this.getScopedElement('bmlt_switcher_field_value_div_no_selected_formats_blurb');
2579  var bmlt_semantic_form_meeting_fields_fieldset_contents_div = this.getScopedElement('bmlt_semantic_form_meeting_fields_fieldset_contents_div');
2580  var bmlt_semantic_form_map_wrapper_div = this.getScopedElement('bmlt_semantic_form_map_wrapper_div');
2581  var bmlt_semantic_form_map_checkbox = this.getScopedElement('bmlt_semantic_form_map_checkbox');
2582  var bmlt_semantic_form_schema_select_fieldset = this.getScopedElement('bmlt_semantic_form_schema_select_fieldset');
2583  var bmlt_semantic_form_schema_select = this.getScopedElement('bmlt_semantic_form_schema_select');
2584  var switcher_type_select_schema_option = this.getScopedElement('bmlt_semantic_form_switcher_type_select_schema_option');
2585  var switcher_type_select_server_langs_option = this.getScopedElement('bmlt_semantic_form_switcher_type_select_server_langs_option');
2586  var switcher_type_select_server_info_option = this.getScopedElement('bmlt_semantic_form_switcher_type_select_server_info_option');
2587  var switcher_type_select_coverage_area_option = this.getScopedElement('bmlt_semantic_form_switcher_type_select_coverage_area_option');
2588  var getUsedCheckbox = this.getScopedElement('bmlt_semantic_form_used_formats_checkbox');
2589  var getOnlyUsedCheckbox = this.getScopedElement('bmlt_semantic_form_just_used_formats_checkbox');
2590  var bmlt_semantic_form_used_formats_div = this.getScopedElement('bmlt_semantic_form_used_formats_div');
2591  var bmlt_semantic_form_just_used_formats_checkbox_div = this.getScopedElement('bmlt_semantic_form_just_used_formats_checkbox_div');
2592  var bmlt_semantic_form_formats_fieldset_contents_div = this.getScopedElement('bmlt_semantic_form_formats_fieldset_contents_div');
2593  var bmlt_semantic_form_weekday_header_checkbox_div = this.getScopedElement('bmlt_semantic_form_weekday_header_checkbox_div');
2594  var blockModeDiv = this.getScopedElement('block_mode_checkbox_div');
2595  var blockModeCheckbox = this.getScopedElement('block_mode_checkbox');
2596  var bmlt_switcher_coverageAreaMapFieldset = this.getScopedElement('bmlt_semantic_coverage_area_fieldset');
2597  var coverageAreaMapElement = this.getScopedElement('bmlt_semantic_coverage_area_fieldset_map_div');
2598 
2599  switcher_type_select_formats_option.enable();
2600  switcher_type_select_sb_option.enable();
2601  switcher_type_select_changes_option.enable();
2602  switcher_type_select_schema_option.disable();
2603  switcher_type_select_server_langs_option.disable();
2604 
2605  if ( switcher_type_select_server_info_option ) {
2606  switcher_type_select_server_info_option.disable();
2607  };
2608 
2609  if ( switcher_type_select_coverage_area_option ) {
2610  switcher_type_select_coverage_area_option.disable();
2611  };
2612 
2613  bmlt_semantic_form_map_checkbox.checked = false;
2614  bmlt_semantic_form_map_wrapper_div.hide();
2615 
2616  if ( this.version >= 2006015 ) {
2617  switcher_type_select_fieldkey_option.enable();
2618  switcher_type_select_fieldval_option.enable();
2619  };
2620 
2621  switcher_type_select_naws_option.enable();
2622 
2623  if ( (inItem == switcher_select) && (switcher_select.value == 'GetFieldValues') ) {
2624  bmlt_semantic_form_field_main_select.selectedIndex = 0;
2625  bmlt_semantic_form_field_main_select.onchange(bmlt_semantic_form_field_main_select);
2626  };
2627 
2628  bmlt_semantic_info_div_download_line.hide();
2629  bmlt_semantic_info_div_shortcode_line.hide();
2630 
2631  if ( main_fieldset_select.value == 'DOWNLOAD' ) {
2632  bmlt_semantic_info_div_download_line.show();
2633 
2634  if ( main_fieldset_direct_uri_div.style.display == 'none' ) {
2635  main_fieldset_direct_uri_div.show();
2636  response_type_select.selectedIndex = 0;
2637  bmlt_switcher_field_value_div_formats.innerHTML = '';
2638  bmlt_switcher_field_value_div_no_selected_formats_blurb.hide();
2639  bmlt_semantic_form_meeting_fields_fieldset_contents_div.hide();
2640  };
2641  } else {
2642  if ( (switcher_select.value != 'GetSearchResults') && (switcher_select.value != 'GetFormats') ) {
2643  switcher_select.selectedIndex = 0;
2644  };
2645 
2646  bmlt_semantic_info_div_shortcode_line.show();
2647  main_fieldset_direct_uri_div.hide();
2648  };
2649 
2650  if ( (switcher_select.value == 'GetLangs') && ((response_type_select.value != 'xml') && !((response_type_select.value == 'json') && (this.version >= 2007005))) ) {
2651  switcher_select.selectedIndex = 0;
2652  };
2653 
2654  if ( (inItem != response_type_select) && (switcher_select.value == 'GetNAWSDump') && ((response_type_select.value != 'csv') || (main_fieldset_select.value != 'DOWNLOAD')) ) {
2655  response_type_select.selectedIndex = 0;
2656  bmlt_switcher_field_value_div_formats.innerHTML = '';
2657  bmlt_switcher_field_value_div_no_selected_formats_blurb.hide();
2658  bmlt_semantic_form_meeting_fields_fieldset_contents_div.hide();
2659  };
2660 
2661  if ( bmlt_switcher_coverageAreaMapFieldset && (switcher_select.value == 'GetCoverageArea') ) {
2662  bmlt_switcher_coverageAreaMapFieldset.show();
2663  this.setUpCoverageMap();
2664  } else {
2665  if ( bmlt_switcher_coverageAreaMapFieldset ) {
2666  bmlt_switcher_coverageAreaMapFieldset.hide();
2667  };
2668  };
2669 
2670  if ( (inItem != switcher_select) && (switcher_select.value == 'GetNAWSDump') && ((response_type_select.value != 'csv') || (main_fieldset_select.value != 'DOWNLOAD')) ) {
2671  switcher_select.selectedIndex = 0;
2672  } else {
2673  if ( (inItem != switcher_select) && (switcher_select.value != 'GetSearchResults') && ((response_type_select.value == 'kml') || (response_type_select.value == 'gpx') || (response_type_select.value == 'poi')) ) {
2674  switcher_select.selectedIndex = 0;
2675  } else {
2676  if ( (inItem != switcher_select) && (switcher_select.value != 'GetSearchResults') && (switcher_select.value != 'GetFormats') && (response_type_select.value == 'simple') ) {
2677  switcher_select.selectedIndex = 0;
2678  } else {
2679  if ( (inItem != switcher_select) && (switcher_select.value == 'GetCoverageArea') && (response_type_select.value != 'csv') && (response_type_select.value != 'xml') && (response_type_select.value != 'json') ) {
2680  switcher_select.selectedIndex = 0;
2681  };
2682  };
2683  };
2684  };
2685 
2686  bmlt_switcher_naws_dump_div.hide();
2687  bmlt_switcher_div_no_options_blurb.hide();
2688  bmlt_semantic_form_changes_div.hide();
2689  bmlt_semantic_form_main_fields_fieldset.hide();
2690  bmlt_semantic_form_meeting_search_div.hide();
2691  text_search_radius_input_div.hide();
2692  bmlt_semantic_form_schema_select_fieldset.hide();
2693  bmlt_semantic_form_used_formats_div.hide();
2694  bmlt_semantic_form_just_used_formats_checkbox_div.hide();
2695  bmlt_semantic_form_formats_fieldset_contents_div.hide();
2696  blockModeDiv.hide();
2697 
2698  if ( (switcher_select.value == 'GetSearchResults') && (main_fieldset_select.value != 'DOWNLOAD') ) {
2699  bmlt_semantic_form_weekday_header_checkbox_div.show();
2700  } else {
2701  bmlt_semantic_form_weekday_header_checkbox_div.hide();
2702  };
2703 
2704  if ( switcher_select.value == 'GetSearchResults' ) {
2705  bmlt_semantic_form_meeting_search_div.show();
2706  if ( bmlt_semantic_form_text_search_select.value == 'StringSearchIsAnAddress=1' ) {
2707  text_search_radius_input_div.show();
2708  };
2709 
2710  if ( (response_type_select.value == 'xml') || (response_type_select.value == 'json') ) {
2711  bmlt_semantic_form_used_formats_div.show();
2712  bmlt_semantic_form_just_used_formats_checkbox_div.show();
2713  if ( getUsedCheckbox && getOnlyUsedCheckbox ) {
2714  if ( !getUsedCheckbox.checked ) {
2715  getOnlyUsedCheckbox.checked = false;
2716  getOnlyUsedCheckbox.disable();
2717  } else {
2718  getOnlyUsedCheckbox.enable();
2719  };
2720  };
2721  } else {
2722  if ( (response_type_select.value == 'simple-block') || (response_type_select.value == 'simple') ) {
2723  bmlt_semantic_form_used_formats_div.show();
2724  };
2725  };
2726  } else {
2727  getUsedCheckbox.checked = false;
2728  getOnlyUsedCheckbox.checked = false;
2729  getOnlyUsedCheckbox.disable();
2730 
2731  if ( switcher_select.value == 'GetChanges' ) {
2732  bmlt_semantic_form_changes_div.show();
2733  } else {
2734  if ( switcher_select.value == 'GetFieldValues' ) {
2735  bmlt_semantic_form_main_fields_fieldset.show();
2736  this.fetchFieldKeys();
2737  } else {
2738  if ( switcher_select.value == 'GetNAWSDump' ) {
2739  bmlt_switcher_naws_dump_div.show();
2740  this.fetchServiceBodies();
2741  } else {
2742  if ( switcher_select.value == 'GetFormats' ) {
2743  bmlt_semantic_form_formats_fieldset_contents_div.show();
2744  } else {
2745  if ( switcher_select.value == 'XMLSchema' ) {
2746  bmlt_semantic_form_schema_select_fieldset.show();
2747  } else {
2748  bmlt_switcher_div_no_options_blurb.show();
2749  };
2750  };
2751  };
2752  };
2753  };
2754  };
2755 
2756  if ( main_fieldset_select.value == 'DOWNLOAD' ) {
2757  if ( switcher_select.value == 'GetSearchResults' ) {
2758  blockModeDiv.hide();
2759  bmlt_semantic_form_weekday_header_checkbox_div.hide();
2760  bmlt_semantic_form_specific_fields_fieldset.show();
2761  bmlt_semantic_form_sort_fields_fieldset.show();
2762  bmlt_semantic_form_weekday_fieldset.show();
2763  bmlt_semantic_form_not_weekday_fieldset.show();
2764  };
2765 
2766  if ( response_type_select.value != 'csv' ) {
2767  switcher_type_select_naws_option.disable();
2768  };
2769 
2770  if ( switcher_type_select_server_info_option && (main_fieldset_select.value == 'DOWNLOAD') && ((response_type_select.value == 'csv') || (response_type_select.value == 'xml') || (response_type_select.value == 'json')) ) {
2771  switcher_type_select_server_info_option.enable();
2772  };
2773 
2774  if ( switcher_type_select_coverage_area_option && (main_fieldset_select.value == 'DOWNLOAD') && ((response_type_select.value == 'csv') || (response_type_select.value == 'xml') || (response_type_select.value == 'json')) ) {
2775  switcher_type_select_coverage_area_option.enable();
2776  };
2777 
2778  if ( (main_fieldset_select.value == 'DOWNLOAD') && ((response_type_select.value == 'kml') || (response_type_select.value == 'gpx') || (response_type_select.value == 'poi')) ) {
2779  switcher_type_select_formats_option.disable();
2780  switcher_type_select_sb_option.disable();
2781  switcher_type_select_changes_option.disable();
2782  switcher_type_select_fieldkey_option.disable();
2783  switcher_type_select_fieldval_option.disable();
2784  switcher_type_select_naws_option.disable();
2785  switcher_type_select_coverage_area_option.disable();
2786  } else {
2787  if ( (main_fieldset_select.value == 'DOWNLOAD') && ((response_type_select.value == 'simple') || (response_type_select.value == 'simple-block')) ) {
2788  switcher_type_select_sb_option.disable();
2789  switcher_type_select_changes_option.disable();
2790  switcher_type_select_fieldkey_option.disable();
2791  switcher_type_select_fieldval_option.disable();
2792  switcher_type_select_naws_option.disable();
2793  switcher_type_select_coverage_area_option.disable();
2794  };
2795  };
2796  } else {
2797  if ( (switcher_select.value != 'GetSearchResults') && (switcher_select.value != 'GetFormats') ) {
2798  switcher_select.selectedIndex = 0;
2799  bmlt_semantic_form_meeting_search_div.show();
2800  };
2801 
2802  if ( main_fieldset_select.value == 'SHORTCODE_TABLE' ) {
2803  switcher_select.selectedIndex = 0;
2804  bmlt_semantic_form_meeting_search_div.show();
2805  switcher_type_select_formats_option.disable();
2806  switcher_type_select_sb_option.disable();
2807  switcher_type_select_changes_option.disable();
2808  bmlt_semantic_form_weekday_header_checkbox_div.hide();
2809  switcher_type_select_fieldkey_option.disable();
2810  switcher_type_select_fieldval_option.disable();
2811  switcher_type_select_naws_option.disable();
2812  blockModeDiv.hide();
2813  bmlt_semantic_form_used_formats_div.hide();
2814  bmlt_semantic_form_weekday_fieldset.hide();
2815  bmlt_semantic_form_not_weekday_fieldset.hide();
2816  bmlt_semantic_form_specific_fields_fieldset.hide();
2817  bmlt_semantic_form_sort_fields_fieldset.hide();
2818  } else {
2819  if ( main_fieldset_select.value == 'SHORTCODE_SIMPLE' ) {
2820  blockModeDiv.show();
2821  bmlt_semantic_form_weekday_header_checkbox_div.show();
2822  bmlt_semantic_form_specific_fields_fieldset.hide();
2823  bmlt_semantic_form_sort_fields_fieldset.show();
2824  bmlt_semantic_form_weekday_fieldset.show();
2825  bmlt_semantic_form_not_weekday_fieldset.show();
2826  };
2827 
2828  switcher_type_select_sb_option.disable();
2829  switcher_type_select_changes_option.disable();
2830  switcher_type_select_fieldkey_option.disable();
2831  switcher_type_select_fieldval_option.disable();
2832  switcher_type_select_naws_option.disable();
2833  };
2834  };
2835 
2836  if ( (main_fieldset_select.value == 'DOWNLOAD') && (response_type_select.value == 'xml') ) {
2837  switcher_type_select_schema_option.enable();
2838  switcher_type_select_server_langs_option.enable();
2839  } else {
2840  if ( (main_fieldset_select.value == 'DOWNLOAD') && ((response_type_select.value == 'json') && (this.version >= 2007005)) ) {
2841  switcher_type_select_server_langs_option.enable();
2842  } else {
2843  if ( switcher_select.value == 'XMLSchema' ) {
2844  switcher_select.selectedIndex = 0;
2845  bmlt_semantic_form_meeting_search_div.show();
2846  };
2847  };
2848  };
2849 
2850  this.refreshURI();
2851 };
2852 
2853 /*******************************************************************************************/
2854 /**
2855  \brief Called after all the various setup has been done, and "bakes in" the form.
2856 */
2857 /*******************************************************************************************/
2858 BMLTSemantic.prototype.setUpForm = function () {
2859  this.setUpForm_MainFieldset();
2860  this.reloadFromServer();
2861  this.fetchServerInfo();
2862 };
2863 
2864 /*******************************************************************************************/
2865 /**
2866  \brief
2867 */
2868 /*******************************************************************************************/
2869 BMLTSemantic.prototype.refreshURI = function () {
2870  var uri_invalid = this.getScopedElement('bmlt_semantic_info_div_url_Invalid_span');
2871  var shortcode_invalid = this.getScopedElement('bmlt_semantic_info_div_shortcode_Invalid_span');
2872  var uri_active = this.getScopedElement('bmlt_semantic_info_div_url_active_span');
2873  var shortcode_active = this.getScopedElement('bmlt_semantic_info_div_shortcode_active_span');
2874  var type = this.getScopedElement('bmlt_semantic_form_response_type_select').value;
2875  var bmlt_semantic_form_text_search_select = this.getScopedElement('bmlt_semantic_form_text_search_select');
2876  var mainSelectElement = this.getScopedElement('bmlt_semantic_form_switcher_type_select');
2877  var typeSelectElement = this.getScopedElement('bmlt_semantic_form_field_main_select');
2878  var blurbDiv = this.getScopedElement('bmlt_switcher_field_value_div_no_options_blurb');
2879  var formatsDiv = this.getScopedElement('bmlt_switcher_field_value_div_formats');
2880  var formatsBlurbDiv = this.getScopedElement('bmlt_switcher_field_value_div_no_selected_formats_blurb');
2881  var useMap = this.getScopedElement('bmlt_semantic_form_map_checkbox');
2882  var mapRadius = this.getScopedElement('bmlt_semantic_form_map_search_text_radius');
2883  var startMin = this.getScopedElement('bmlt_semantic_form_start_time_min_text');
2884  var startMax = this.getScopedElement('bmlt_semantic_form_start_time_max_text');
2885  var endMax = this.getScopedElement('bmlt_semantic_form_end_time_max_text');
2886  var durationMin = this.getScopedElement('bmlt_semantic_form_duration_min_text');
2887  var durationMax = this.getScopedElement('bmlt_semantic_form_duration_max_text');
2888 
2889  this.state.startTimeMin = null;
2890  this.state.startTimeMax = null;
2891  this.state.endTimeMax = null;
2892  this.state.durationMin = null;
2893  this.state.durationMax = null;
2894 
2895  if ( startMin && startMin.value ) {
2896  var time = startMin.value.toString().split(':');
2897  time[0] = Math.abs(parseInt(time[0]));
2898  if ( time[0] > 23 ) {
2899  time[0] = 23;
2900  };
2901 
2902  if ( time[1] ) {
2903  time[1] = Math.abs(parseInt(time[1]));
2904  if ( time[1] > 59 ) {
2905  time[1] = 59;
2906  };
2907  };
2908 
2909  if ( !time[1] ) {
2910  time[1] = 0;
2911  };
2912 
2913  this.state.startTimeMin = time;
2914  };
2915 
2916  if ( startMax && startMax.value ) {
2917  var time = startMax.value.toString().split(':');
2918 
2919  time[0] = Math.abs(parseInt(time[0]));
2920  if ( time[0] > 23 ) {
2921  time[0] = 23;
2922  };
2923 
2924  if ( time[1] ) {
2925  time[1] = Math.abs(parseInt(time[1]));
2926  if ( time[1] > 59 ) {
2927  time[1] = 59;
2928  };
2929  };
2930 
2931  if ( !time[1] ) {
2932  time[1] = 0;
2933  };
2934 
2935  this.state.startTimeMax = time;
2936  };
2937 
2938  if ( endMax && endMax.value ) {
2939  var time = endMax.value.toString().split(':');
2940 
2941  time[0] = Math.abs(parseInt(time[0]));
2942  if ( time[0] > 23 ) {
2943  time[0] = 23;
2944  };
2945 
2946  if ( time[1] ) {
2947  time[1] = Math.abs(parseInt(time[1]));
2948  if ( time[1] > 59 ) {
2949  time[1] = 59;
2950  };
2951  };
2952 
2953  if ( !time[1] ) {
2954  time[1] = 0;
2955  };
2956 
2957  this.state.endTimeMax = time;
2958  };
2959 
2960  if ( durationMin && durationMin.value ) {
2961  var time = durationMin.value.toString().split(':');
2962 
2963  time[0] = Math.abs(parseInt(time[0]));
2964  if ( time[0] > 23 ) {
2965  time[0] = 23;
2966  };
2967 
2968  if ( time[1] ) {
2969  time[1] = Math.abs(parseInt(time[1]));
2970  if ( time[1] > 59 ) {
2971  time[1] = 59;
2972  };
2973  };
2974 
2975  if ( !time[1] ) {
2976  time[1] = 0;
2977  };
2978 
2979  this.state.durationMin = time;
2980  };
2981 
2982  if ( durationMax && durationMax.value ) {
2983  var time = durationMax.value.toString().split(':');
2984 
2985  time[0] = Math.abs(parseInt(time[0]));
2986  if ( time[0] > 23 ) {
2987  time[0] = 23;
2988  };
2989 
2990  if ( time[1] ) {
2991  time[1] = Math.abs(parseInt(time[1]));
2992  if ( time[1] > 59 ) {
2993  time[1] = 59;
2994  };
2995  };
2996 
2997  if ( !time[1] ) {
2998  time[1] = 0;
2999  };
3000 
3001  this.state.durationMax = time;
3002  };
3003 
3004  if ( useMap && useMap.checked ) {
3005  this.state.searchMapRadius = parseFloat(mapRadius.value);
3006  this.state.searchLongitude = parseFloat(this.current_lng);
3007  this.state.searchLatitude = parseFloat(this.current_lat);
3008  this.createRadiusCircle();
3009  } else {
3010  this.state.searchMapRadius = 0;
3011  this.state.searchLongitude = 0;
3012  this.state.searchLatitude = 0;
3013  };
3014 
3015  if ( (mainSelectElement.value != 'GetFieldValues') || (typeSelectElement.value != 'formats') ) {
3016  blurbDiv.show();
3017  formatsDiv.hide();
3018  formatsBlurbDiv.hide();
3019  } else {
3020  blurbDiv.hide();
3021  formatsDiv.show();
3022  formatsBlurbDiv.show();
3023  };
3024 
3025  this.state.switcher = this.getScopedElement('bmlt_semantic_form_switcher_type_select').value;
3026 
3027  if ( (this.state.switcher != 'XMLSchema') && (this.state.switcher != 'GetLangs') ) {
3028  var compiled_arguments = this.state.compile();
3029  };
3030 
3031  if ( (this.state.switcher == 'GetLangs') && (type == 'xml') ) {
3032  uri = this.state.root_server_uri + '/client_interface/xml/GetLangs.php';
3033  var url_string = '<a target="_blank" href="' + uri + '">' + uri + '</a>';
3034  uri_active.innerHTML = url_string;
3035  uri_invalid.hide();
3036  uri_active.show();
3037  } else {
3038  if ( (this.state.switcher == 'GetLangs') && (type == 'json') ) {
3039  uri = this.state.root_server_uri + '/client_interface/json/GetLangs.php';
3040  var url_string = '<a target="_blank" href="' + uri + '">' + uri + '</a>';
3041  uri_active.innerHTML = url_string;
3042  uri_invalid.hide();
3043  uri_active.show();
3044  } else {
3045  if ( (this.state.switcher == 'XMLSchema') || this.state.valid ) {
3046  if ( this.getScopedElement('bmlt_semantic_form_main_mode_select').value == 'DOWNLOAD' ) {
3047  var extra_sauce = '';
3048  if ( type == 'simple-block' ) {
3049  type = 'simple';
3050  extra_sauce = '&block_mode=1'
3051  };
3052 
3053  var uri = '';
3054 
3055  if ( this.state.switcher == 'XMLSchema' ) {
3056  var schemaSelect = this.getScopedElement('bmlt_semantic_form_schema_select');
3057  if ( schemaSelect ) {
3058  var schemaType = this.getScopedElement('bmlt_semantic_form_schema_select').value;
3059 
3060  uri = this.state.root_server_uri + '/client_interface/xsd/' + schemaType + '.php';
3061  };
3062  } else {
3063  uri = this.state.root_server_uri + '/client_interface/' + type + '/?' + compiled_arguments + extra_sauce;
3064  };
3065 
3066  var url_string = '<a target="_blank" href="' + uri + '">' + uri + '</a>';
3067  uri_active.innerHTML = url_string;
3068  uri_invalid.hide();
3069  uri_active.show();
3070  } else {
3071  if ( this.getScopedElement('bmlt_semantic_form_main_mode_select').value == 'SHORTCODE_SIMPLE' ) {
3072  var shortcode_string = '[[BMLT_SIMPLE(' + compiled_arguments + ')]]';
3073  shortcode_active.innerHTML = shortcode_string;
3074  shortcode_invalid.hide();
3075  shortcode_active.show();
3076  } else {
3077  var shortcode_string = '[[BMLT_TABLE';
3078  if ( compiled_arguments ) {
3079  shortcode_string += '(' + compiled_arguments + ')';
3080  };
3081  shortcode_string += ']]';
3082  shortcode_active.innerHTML = shortcode_string;
3083  shortcode_invalid.hide();
3084  shortcode_active.show();
3085  };
3086  }
3087  } else {
3088  uri_invalid.show();
3089  uri_active.hide();
3090  shortcode_invalid.show();
3091  shortcode_active.hide();
3092  };
3093  };
3094  };
3095 };
BMLTSemanticResult prototype change_start
This will be the start date for getting changes.
var y
BMLTSemantic prototype clearFormatsComparisonOperator
BMLTSemantic prototype current_zoom
BMLTSemantic prototype setSortFieldState
BMLTSemanticResult prototype weekdays
The selected weekdays (1-7). This is a CSV string of integer IDs.
BMLTSemantic prototype current_lat
BMLTSemantic prototype serverInfo
BMLTSemantic prototype clearSorts
BMLTSemanticResult prototype durationMin
This will have an array, with the minimum duration. Hours will be element 0, minutes, element 1.
BMLTSemantic prototype languages
BMLTSemanticResult prototype root_server_uri
The main Root Server URI.
BMLTSemanticResult prototype change_end
This will be the end date for getting changes.
BMLTSemantic prototype clearTextSearchItems
BMLTSemantic prototype organizeServiceBodies
BMLTSemantic prototype hideRadiusCircle
BMLTSemantic prototype fetchFormats
Sets up and performs an AJAX call to fetch the available formats.
BMLTSemantic prototype scanWeekdays
BMLTSemantic prototype setAllSortFieldState
var x
BMLTSemantic prototype fetchServerInfo
Sets up and performs an AJAX call to fetch the server information.
BMLTSemanticResult prototype formats
The selected formats. This is a CSV string of integer IDs.
BMLTSemantic prototype updateServiceBodies
BMLTSemantic prototype field_values
BMLTSemanticResult prototype durationMax
This will have an array, with the minimum duration. Hours will be element 0, minutes, element 1.
BMLTSemantic prototype setUpCoverageMap
Sets up the map display for the instance.
BMLTSemantic prototype createRadiusCircle
BMLTSemanticResult prototype meeting_key
The main "meeting_key=" value.
var a
BMLTSemantic prototype setUpForm
Called after all the various setup has been done, and "bakes in" the form.
BMLTSemanticResult prototype owner
The object that "owns" this.
BMLTSemanticResult prototype startTimeMin
This will have an array, with the minimum start time. Hours will be element 0, minutes, element 1.
BMLTSemanticResult prototype formats_comparison_operator
BMLTSemantic prototype fetchFormatsCallback
The response.
BMLTSemanticResult prototype compiled_params
This will contain the temporary compiled parameters.
BMLTSemantic prototype ajax_base_uri
BMLTSemantic prototype fetchFieldKeysCallback
The response.
BMLTSemanticResult prototype searchMapRadius
A radius for the map. Default is auto-search 10 meetings.
function BMLTSemantic(inSuffix, inAJAXURI, inRootServerURI, inVersion)
BMLTSemantic prototype fetchLangsCallback
The response.
BMLTSemanticResult prototype searchTextRadius
A possible radius for the text (if location).
BMLTSemanticResult prototype compileFieldValues
BMLTSemantic prototype fetchLangs
Sets up and performs an AJAX call to fetch the available languages.
BMLTSemantic prototype handleTextSearchText
BMLTSemanticResult prototype change_id
This will be the meeting ID for changes.
BMLTSemanticResult prototype weekdayHeader
This will be set to nonzero if the BMLT_SIMPLE result will be separated by weekday.
BMLTSemanticResult prototype meeting_key_value
The value selected by the field select.
BMLTSemantic prototype getScopedElement
Returns an element that has been "scoped" for this instance.
BMLTSemanticResult prototype services
The selected Service bodies. This is a CSV string of integer IDs.
BMLTSemantic prototype fetchVersionCallback
The response.
BMLTSemantic prototype refreshURI
BMLTSemanticResult prototype compileChanges
BMLTSemanticResult prototype searchTextModifier
Any modifier for the text search.
BMLTSemantic prototype getScopedID
Returns an ID that has been "scoped" for this instance.
BMLTSemantic prototype getChildServiceBodies
BMLTSemanticResult prototype sb_id
This contains the Service body used for the NAWS dump.
function BMLTSemanticResult(inRootServerURI, inOwner)
BMLTSemantic prototype temp_service_body_objects
BMLTSemantic prototype service_body_objects
BMLTSemantic prototype field_keys
BMLTSemantic prototype version
BMLTSemantic prototype setUpMainSelectors
This scans the main selectors, and does what is necessary.
BMLTSemantic prototype fetchFieldValuesCallback
The response.
BMLTSemantic prototype state
BMLTSemanticResult prototype compileSearchResults
BMLTSemantic prototype fetchCoverageAreaCallback
The response.
BMLTSemantic prototype coverageMapObject
This is the controlling class for the BMLT interactive semantic workshop.
BMLTSemantic prototype coverageArea
function e
BMLTSemantic prototype fetchServerInfoCallback
The response.
var i
BMLTSemantic prototype fetchServiceBodies
Sets up and performs an AJAX call to fetch the available Service bodies.
BMLTSemantic prototype clearWeekdays
BMLTSemanticResult prototype sorts
This holds an array of objects that will indicate a chosen sort. The object schema will be: {"key":ST...
BMLTSemantic prototype getSortItemID
BMLTSemantic prototype id_suffix
BMLTSemantic prototype fetchServiceBodiesCallback
The response.
BMLTSemanticResult prototype compileFormats
BMLTSemantic prototype ajaxRequest
A simple, generic AJAX request function.
BMLTSemanticResult prototype fields
This will hold any specific fields to be returned.
BMLTSemantic prototype format_objects
BMLTSemantic prototype createServiceBodyList
BMLTSemanticResult prototype switcher
The main "?switcher=" value.
BMLTSemanticResult prototype valid
This will be non-null if the compiled result is valid (only after compile()).
BMLTSemantic prototype mapObject
BMLTSemantic prototype reloadFromServer
Sets up and performs an AJAX call to fetch the available formats.
var b
BMLTSemanticResult prototype startTimeMax
This will have an array, with the maximum start time. Hours will be element 0, minutes, element 1.
BMLTSemantic prototype setBasicFunctions
Sets up simple enable/disable/show/hide functions for a given item.
BMLTSemantic prototype createServiceBodyCheckbox
BMLTSemanticResult prototype searchLongitude
If using the map, the longitude.
var c
BMLTSemantic prototype setUpForm_MainFieldset
Initialize the main fieldset.
BMLTSemantic prototype sortByKey
Sort By Key.
BMLTSemantic prototype setTextHandlers
Sets the basic text handler for text items (handles switching classes).
BMLTSemanticResult prototype searchLatitude
If using the map, the latitude.
BMLTSemanticResult prototype change_sb_id
This will be the Service body ID for changes.
BMLTSemantic prototype setSortFieldFunctions
BMLTSemantic prototype fetchFieldKeys
Sets up and performs an AJAX call to fetch the available field keys.
BMLTSemantic prototype current_lng
BMLTSemanticResult prototype compileNAWSDump
This keeps the state of the result of all that stuff going on in the workshop, and will compile a res...
BMLTSemantic prototype fetchFieldValues
Sets up and performs an AJAX call to fetch the available field keys.
BMLTSemanticResult prototype searchText
The text to search for in meetings.