watchman 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- watchman (0.0.4)
4
+ watchman (0.0.5)
5
5
  mechanize
6
6
 
7
7
  GEM
@@ -4,9 +4,6 @@ module Watchman
4
4
  @page = page
5
5
  end
6
6
 
7
- def incident_number
8
- end
9
-
10
7
  def raw_notes
11
8
  notes.map{|n| "#{n[:time]} #{n[:text]}"}.join("|")
12
9
  end
@@ -26,7 +23,19 @@ module Watchman
26
23
  end
27
24
 
28
25
  def nature
29
- xpath("/html/body/table/tr[1]/td[1]/table/tr[3]/td").text.strip.split("-").last
26
+ nature_cell_text.split("-").last
27
+ end
28
+
29
+ ResponseLevelMap = {"A"=>"Alpha",
30
+ "B"=>"Bravo",
31
+ "C"=>"Charlie",
32
+ "D"=>"Delta",
33
+ "E"=>"Echo",
34
+ "O"=>"Omega"}
35
+
36
+ def response_level
37
+ match = nature_cell_text.split("-").first.scan(/^\d+([A-O])/).first.first
38
+ ResponseLevelMap[match]
30
39
  end
31
40
 
32
41
  def apparatus
@@ -57,7 +66,54 @@ module Watchman
57
66
  s_notes
58
67
  end
59
68
 
60
- private
69
+ def cross_streets
70
+ [cross_street_1,cross_street_2]
71
+ end
72
+
73
+ def cross_street_1
74
+ xpath_text("#{main_table_path}/tr[7]/td")
75
+ end
76
+
77
+ def cross_street_2
78
+ xpath_text("#{main_table_path}/tr[8]/td")
79
+ end
80
+
81
+ def priority
82
+ xpath_text("#{main_table_path}/tr[4]/td[1]").to_i
83
+ end
84
+
85
+ def dispatch_code
86
+ xpath_text("#{main_table_path}/tr[4]/td[2]")
87
+ end
88
+
89
+ def grid
90
+ xpath_text("#{main_table_path}/tr[5]/td[1]")
91
+ end
92
+
93
+ def fire_area
94
+ xpath_text("#{main_table_path}/tr[6]/td")
95
+ end
96
+
97
+ def time_of_alarm
98
+ Time.parse(xpath_text("#{main_table_path}/tr[16]/td"))
99
+ end
100
+
101
+ def time_of_first_unit_on_scene
102
+ Time.parse(xpath_text("#{main_table_path}/tr[17]/td"))
103
+ end
104
+ private
105
+ def nature_cell_text
106
+ xpath_text("#{main_table_path}/tr[3]/td")
107
+ end
108
+
109
+ def main_table_path
110
+ "/html/body/table/tr[1]/td[1]/table"
111
+ end
112
+
113
+ def xpath_text(path)
114
+ xpath(path).text.strip
115
+ end
116
+
61
117
  def xpath(path)
62
118
  @page.parser.xpath(path)
63
119
  end
@@ -1,3 +1,3 @@
1
1
  module Watchman
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -225,647 +225,11 @@ class IstatusMocker
225
225
  </frame>
226
226
  <frame scrolling="no" allowtransparency="true" name="Top" noresize="" marginheight="0" marginwidth="0" frameborder="0" src="Dispatch_center.php">
227
227
  <html><head><!-- Included file for dropdown menu -->
228
- <script type="text/javascript">//&lt;![CDATA[
229
- //----------------------------------------------------------------------------
230
- // Code to determine the browser and version.
231
- //----------------------------------------------------------------------------
228
+ <script type="text/javascript">
232
229
 
233
- function Browser() {
234
- var ua, s, i;
235
- this.isIE = false; // Internet Explorer
236
- this.isOP = false; // Opera
237
- this.isNS = false; // Netscape
238
- this.version = null;
239
- ua = navigator.userAgent;
240
- s = "Opera";
241
- if ((i = ua.indexOf(s)) &gt;= 0) {
242
- this.isOP = true;
243
- this.version = parseFloat(ua.substr(i + s.length));
244
- return;
245
- }
246
- s = "Netscape6/";
247
- if ((i = ua.indexOf(s)) &gt;= 0) {
248
- this.isNS = true;
249
- this.version = parseFloat(ua.substr(i + s.length));
250
- return;
251
- }
252
-
253
- // Treat any other "Gecko" browser as Netscape 6.1.
254
- s = "Gecko";
255
- if ((i = ua.indexOf(s)) &gt;= 0) {
256
- this.isNS = true;
257
- this.version = 6.1;
258
- return;
259
- }
260
-
261
- s = "MSIE";
262
- if ((i = ua.indexOf(s))) {
263
- this.isIE = true;
264
- this.version = parseFloat(ua.substr(i + s.length));
265
- return;
266
- }
267
- }
268
-
269
- var browser = new Browser();
270
-
271
- //----------------------------------------------------------------------------
272
- // Code for handling the menu bar and active button.
273
- //----------------------------------------------------------------------------
274
- var activeButton = null;
275
-
276
- // Capture mouse clicks on the page so any active button can be
277
- // deactivated.
278
- if (browser.isIE)
279
- document.onmousedown = pageMousedown;
280
- else
281
- document.addEventListener("mousedown", pageMousedown, true);
282
-
283
- function pageMousedown(event) {
284
- var el;
285
-
286
- // If there is no active button, exit.
287
- if (activeButton == null)
288
- return;
289
-
290
- // Find the element that was clicked on.
291
- if (browser.isIE)
292
- el = window.event.srcElement;
293
- else
294
- el = (event.target.tagName ? event.target : event.target.parentNode);
295
-
296
- // If the active button was clicked on, exit.
297
- if (el == activeButton)
298
- return;
299
-
300
- // If the element is not part of a menu, reset and clear the active
301
- // button.
302
- if (getContainerWith(el, "DIV", "menu") == null) {
303
- resetButton(activeButton);
304
- activeButton = null;
305
- }
306
- }
307
-
308
-
309
- function buttonClick(event, menuId) {
310
- var button;
311
-
312
- // Get the target button element.
313
- if (browser.isIE)
314
- button = window.event.srcElement;
315
- else
316
- button = event.currentTarget;
317
-
318
- // Blur focus from the link to remove that annoying outline.
319
- button.blur();
320
-
321
- // Associate the named menu to this button if not already done.
322
- // Additionally, initialize menu display.
323
- if (button.menu == null) {
324
- button.menu = document.getElementById(menuId);
325
- if (button.menu.isInitialized == null)
326
- menuInit(button.menu);
327
- }
328
-
329
- // Set mouseout event handler for the button, if not already done.
330
- if (button.onmouseout == null)
331
- button.onmouseout = buttonOrMenuMouseout;
332
-
333
- // Exit if this button is the currently active one.
334
- if (button == activeButton)
335
- return false;
336
-
337
- // Reset the currently active button, if any.
338
- if (activeButton != null)
339
- resetButton(activeButton);
340
-
341
- // Activate this button, unless it was the currently active one.
342
- if (button != activeButton) {
343
- depressButton(button);
344
- activeButton = button;
345
- }
346
- else
347
- activeButton = null;
348
-
349
- return false;
350
- }
351
-
352
- function buttonMouseover(event, menuId) {
353
-
354
- var button;
355
-
356
- if (activeButton == null) {
357
- buttonClick(event, menuId);
358
- return;
359
- }
360
-
361
- // Find the target button element.
362
- if (browser.isIE)
363
- button = window.event.srcElement;
364
- else
365
- button = event.currentTarget;
366
-
367
- // If any other button menu is active, make this one active instead.
368
- if (activeButton != null &amp;&amp; activeButton != button)
369
- buttonClick(event, menuId);
370
- }
371
-
372
- function depressButton(button) {
373
- var x, y;
374
-
375
- // Update the button's style class to make it look like it's
376
- // depressed.
377
- button.className += " menuButtonActive";
378
-
379
- // Set mouseout event handler for the button, if not already done.
380
- if (button.onmouseout == null)
381
- button.onmouseout = buttonOrMenuMouseout;
382
- if (button.menu.onmouseout == null)
383
- button.menu.onmouseout = buttonOrMenuMouseout;
384
-
385
- // Position the associated drop down menu under the button and
386
- // show it.
387
- x = getPageOffsetLeft(button);
388
- y = getPageOffsetTop(button) + button.offsetHeight;
389
-
390
- // For IE, adjust position.
391
- if (browser.isIE) {
392
- x += button.offsetParent.clientLeft-5;
393
- y += button.offsetParent.clientTop+3;
394
- }
395
-
396
- button.menu.style.left = x + "px";
397
- button.menu.style.top = y + "px";
398
- button.menu.style.visibility = "visible";
399
-
400
- // For IE; size, position and show the menu's IFRAME as well.
401
- if (button.menu.iframeEl != null)
402
- {
403
- button.menu.iframeEl.style.left = button.menu.style.left;
404
- button.menu.iframeEl.style.top = button.menu.style.top;
405
- button.menu.iframeEl.style.width = button.menu.offsetWidth + "px";
406
- button.menu.iframeEl.style.height = button.menu.offsetHeight + "px";
407
- button.menu.iframeEl.style.display = "";
408
- }
409
- }
410
-
411
- function resetButton(button) {
412
-
413
- // Restore the button's style class.
414
- removeClassName(button, "menuButtonActive");
415
-
416
- // Hide the button's menu, first closing any sub menus.
417
- if (button.menu != null) {
418
- closeSubMenu(button.menu);
419
- button.menu.style.visibility = "hidden";
420
-
421
- // For IE, hide menu's IFRAME as well.
422
- if (button.menu.iframeEl != null)
423
- button.menu.iframeEl.style.display = "none";
424
- }
425
- }
426
-
427
- //----------------------------------------------------------------------------
428
- // Code to handle the menus and sub menus.
429
- //----------------------------------------------------------------------------
430
-
431
- function menuMouseover(event) {
432
-
433
- var menu;
434
-
435
- // Find the target menu element.
436
-
437
- if (browser.isIE)
438
- menu = getContainerWith(window.event.srcElement, "DIV", "menu");
439
- else
440
- menu = event.currentTarget;
441
-
442
- // Close any active sub menu.
443
-
444
- if (menu.activeItem != null)
445
- closeSubMenu(menu);
446
- }
447
-
448
- function menuItemMouseover(event, menuId) {
449
- var item, menu, x, y;
450
-
451
- // Find the target item element and its parent menu element.
452
- if (browser.isIE)
453
- item = getContainerWith(window.event.srcElement, "A", "menuItem");
454
- else
455
- item = event.currentTarget;
456
- menu = getContainerWith(item, "DIV", "menu");
457
-
458
- // Close any active sub menu and mark this one as active.
459
- if (menu.activeItem != null)
460
- closeSubMenu(menu);
461
- menu.activeItem = item;
462
-
463
- // Highlight the item element.
464
- item.className += " menuItemHighlight";
465
-
466
- // Initialize the sub menu, if not already done.
467
- if (item.subMenu == null) {
468
- item.subMenu = document.getElementById(menuId);
469
- if (item.subMenu.isInitialized == null)
470
- menuInit(item.subMenu);
471
- }
472
-
473
- // Set mouseout event handler for the sub menu, if not already done.
474
- if (item.subMenu.onmouseout == null)
475
- item.subMenu.onmouseout = buttonOrMenuMouseout;
476
-
477
- // Get position for submenu based on the menu item.
478
- x = getPageOffsetLeft(item) + item.offsetWidth;
479
- y = getPageOffsetTop(item);
480
-
481
- // Adjust position to fit in view.
482
- var maxX, maxY;
483
- if (browser.isIE) {
484
- maxX = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) +
485
- (document.documentElement.clientWidth != 0 ? document.documentElement.clientWidth : document.body.clientWidth);
486
- maxY = Math.max(document.documentElement.scrollTop, document.body.scrollTop) +
487
- (document.documentElement.clientHeight != 0 ? document.documentElement.clientHeight : document.body.clientHeight);
488
- }
489
- if (browser.isOP) {
490
- maxX = document.documentElement.scrollLeft + window.innerWidth;
491
- maxY = document.documentElement.scrollTop + window.innerHeight;
492
- }
493
- if (browser.isNS) {
494
- maxX = window.scrollX + window.innerWidth;
495
- maxY = window.scrollY + window.innerHeight;
496
- }
497
- maxX -= item.subMenu.offsetWidth;
498
- maxY -= item.subMenu.offsetHeight;
499
-
500
- if (x &gt; maxX)
501
- x = Math.max(0, x - item.offsetWidth - item.subMenu.offsetWidth
502
- + (menu.offsetWidth - item.offsetWidth));
503
- y = Math.max(0, Math.min(y, maxY));
504
-
505
- // Position and show the sub menu.
506
- item.subMenu.style.left = x + "px";
507
- item.subMenu.style.top = y + "px";
508
- item.subMenu.style.visibility = "visible";
509
-
510
- // For IE; size, position and display the menu's IFRAME as well.
511
- if (item.subMenu.iframeEl != null)
512
- {
513
- item.subMenu.iframeEl.style.left = item.subMenu.style.left;
514
- item.subMenu.iframeEl.style.top = item.subMenu.style.top;
515
- item.subMenu.iframeEl.style.width = item.subMenu.offsetWidth + "px";
516
- item.subMenu.iframeEl.style.height = item.subMenu.offsetHeight + "px";
517
- item.subMenu.iframeEl.style.display = "";
518
- }
519
-
520
- // Stop the event from bubbling.
521
- if (browser.isIE)
522
- window.event.cancelBubble = true;
523
- else
524
- event.stopPropagation();
525
- }
526
-
527
- function closeSubMenu(menu) {
528
- if (menu == null || menu.activeItem == null)
529
- return;
530
-
531
- // Recursively close any sub menus.
532
- if (menu.activeItem.subMenu != null) {
533
- closeSubMenu(menu.activeItem.subMenu);
534
- menu.activeItem.subMenu.style.visibility = "hidden";
535
-
536
- // For IE, hide the sub menu's IFRAME as well.
537
- if (menu.activeItem.subMenu.iframeEl != null)
538
- menu.activeItem.subMenu.iframeEl.style.display = "none";
539
-
540
- menu.activeItem.subMenu = null;
541
- }
542
-
543
- // Deactivate the active menu item.
544
- removeClassName(menu.activeItem, "menuItemHighlight");
545
- menu.activeItem = null;
546
- }
547
-
548
- // event on buttons and menus.
549
- function buttonOrMenuMouseout(event) {
550
- var el;
551
-
552
- // If there is no active button, exit.
553
- if (activeButton == null)
554
- return;
555
-
556
- // Find the element the mouse is moving to.
557
- if (browser.isIE)
558
- el = window.event.toElement;
559
- else if (event.relatedTarget != null)
560
- el = (event.relatedTarget.tagName ? event.relatedTarget : event.relatedTarget.parentNode);
561
-
562
- // If the element is not part of a menu, reset the active button.
563
- if (getContainerWith(el, "DIV", "menu") == null) {
564
- resetButton(activeButton);
565
- activeButton = null;
566
- }
567
- }
568
-
569
- //----------------------------------------------------------------------------
570
- // Code to initialize menus.
571
- //----------------------------------------------------------------------------
572
- function menuInit(menu) {
573
- var itemList, spanList;
574
- var textEl, arrowEl;
575
- var itemWidth;
576
- var w, dw;
577
- var i, j;
578
-
579
- // For IE, replace arrow characters.
580
- if (browser.isIE) {
581
- menu.style.lineHeight = "2.5ex";
582
- spanList = menu.getElementsByTagName("SPAN");
583
- for (i = 0; i &lt; spanList.length; i++)
584
- if (hasClassName(spanList[i], "menuItemArrow")) {
585
- spanList[i].style.fontFamily = "Webdings";
586
- spanList[i].firstChild.nodeValue = "4";
587
- }
588
- }
589
-
590
- // Find the width of a menu item.
591
- itemList = menu.getElementsByTagName("A");
592
- if (itemList.length &gt; 0)
593
- itemWidth = itemList[0].offsetWidth;
594
- else
595
- return;
596
-
597
- // For items with arrows, add padding to item text to make the
598
- // arrows flush right.
599
- for (i = 0; i &lt; itemList.length; i++) {
600
- spanList = itemList[i].getElementsByTagName("SPAN");
601
- textEl = null;
602
- arrowEl = null;
603
- for (j = 0; j &lt; spanList.length; j++) {
604
- if (hasClassName(spanList[j], "menuItemText"))
605
- textEl = spanList[j];
606
- if (hasClassName(spanList[j], "menuItemArrow"))
607
- arrowEl = spanList[j];
608
- }
609
- if (textEl != null &amp;&amp; arrowEl != null) {
610
- textEl.style.paddingRight = (itemWidth
611
- - (textEl.offsetWidth + arrowEl.offsetWidth)) + "px";
612
- // For Opera, remove the negative right margin to fix a display bug.
613
- if (browser.isOP)
614
- arrowEl.style.marginRight = "0px";
615
- }
616
- }
617
-
618
- // Fix IE hover problem by setting an explicit width on first item of
619
- // the menu.
620
- if (browser.isIE) {
621
- w = itemList[0].offsetWidth;
622
- itemList[0].style.width = w + "px";
623
- dw = itemList[0].offsetWidth - w;
624
- w -= dw;
625
- itemList[0].style.width = w + "px";
626
- }
627
-
628
- // Fix the IE display problem (SELECT elements and other windowed controls
629
- // overlaying the menu) by adding an IFRAME under the menu.
630
- if (browser.isIE) {
631
- var iframeEl = document.createElement("IFRAME");
632
- iframeEl.frameBorder = 0;
633
- iframeEl.src = "javascript:;";
634
- iframeEl.style.display = "none";
635
- iframeEl.style.position = "absolute";
636
- //iframeEl.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
637
- menu.iframeEl = menu.parentNode.insertBefore(iframeEl, menu);
638
- }
639
-
640
- // Mark menu as initialized.
641
- menu.isInitialized = true;
642
- }
643
-
644
- //----------------------------------------------------------------------------
645
- // General utility functions.
646
- //----------------------------------------------------------------------------
647
- function getContainerWith(node, tagName, className) {
648
- // Starting with the given node, find the nearest containing element
649
- // with the specified tag name and style class.
650
- while (node != null) {
651
- if (node.tagName != null &amp;&amp; node.tagName == tagName &amp;&amp;
652
- hasClassName(node, className))
653
- return node;
654
- node = node.parentNode;
655
- }
656
- return node;
657
- }
658
-
659
- function hasClassName(el, name) {
660
- var i, list;
661
- // Return true if the given element currently has the given class
662
- // name.
663
- list = el.className.split(" ");
664
- for (i = 0; i &lt; list.length; i++)
665
- if (list[i] == name)
666
- return true;
667
- return false;
668
- }
669
-
670
- function removeClassName(el, name) {
671
- var i, curList, newList;
672
- if (el.className == null)
673
- return;
674
-
675
- // Remove the given class name from the element's className property.
676
- newList = new Array();
677
- curList = el.className.split(" ");
678
- for (i = 0; i &lt; curList.length; i++)
679
- if (curList[i] != name)
680
- newList.push(curList[i]);
681
- el.className = newList.join(" ");
682
- }
683
-
684
- function getPageOffsetLeft(el) {
685
- var x;
686
- // Return the x coordinate of an element relative to the page.
687
- x = el.offsetLeft;
688
- if (el.offsetParent != null)
689
- x += getPageOffsetLeft(el.offsetParent);
690
- return x;
691
- }
692
-
693
- function getPageOffsetTop(el) {
694
- var y;
695
- // Return the x coordinate of an element relative to the page.
696
- y = el.offsetTop;
697
- if (el.offsetParent != null)
698
- y += getPageOffsetTop(el.offsetParent);
699
- return y;
700
- }
701
- //]]&gt;</script>
702
- <style type="text/css">
703
-
704
- div.menuBar,
705
- div.menuBar a.menuButton,
706
- div.menu,
707
- div.menu a.menuItem {
708
- font-family: Arial, "MS Sans Serif", sans-serif;
709
- font-size: 10pt;
710
- font-style: normal;
711
- font-weight: normal;
712
- color: #0066cc;
713
- text-align: left;
714
- }
715
-
716
- div.menuBar {
717
- background-color: #0066cc;
718
- /*border: 2px outset #e0e0e0;*/
719
- border: 0px;
720
- border: 2px solid;
721
- border-color: #0066cc #0066cc #0066cc #0066cc;
722
- padding: 4px 2px 4px 2px;
723
- text-align: left;
724
- top: 0px;
725
- left: 0px;
726
- }
727
-
728
- div.menuBar a.menuButton {
729
- background-color: transparent;
730
- border: 1px solid #0066cc;
731
- color: #ffffff;
732
- cursor: default;
733
- left: 0px;
734
- margin: 1px;
735
- padding: 2px 6px 2px 6px;
736
- position: relative;
737
- text-decoration: none;
738
- text-align: left;
739
- top: 0px;
740
- z-index: 100;
741
- }
742
- div.menuBar a.menuLink {
743
- background-color: transparent;
744
- font-family: Arial, "MS Sans Serif", sans-serif;
745
- font-size: 10pt;
746
- font-style: normal;
747
- font-weight: normal;
748
- color: #ffffff;
749
- text-align: right;
750
- text-decoration: none;
751
- margin: 1px;
752
- padding: 2px 6px 2px 6px;
753
- /*width: 150px;*/
754
- }
755
-
756
- div.menuBar a.menuLink:hover {
757
- background-color: 000080;
758
- border: 1px outset #e0e0e0;
759
- text-align:left;
760
- color: #ffffff;
761
- cursor: default;
762
- }
763
-
764
- div.menuBar a.menuButton:hover {
765
- background-color: 000080;
766
- border: 1px outset #e0e0e0;
767
- text-align:left;
768
- color: #ffffff;
769
- }
770
-
771
- div.menuBar a.menuButtonActive,
772
- div.menuBar a.menuButtonActive:hover {
773
- background-color: #0066cc;
774
- /*border: 1px inset #e0e0e0;*/
775
- color: #ffffff;
776
- /*left: 1px;*/
777
- /*top: 1px;*/
778
- text-align: left;
779
- }
780
-
781
- div.menu {
782
- background-color: #0066cc;
783
- /*border: 2px outset #e0e0e0;*/
784
- left: 0px;
785
- padding: 0px 1px 1px 0px;
786
- position: absolute;
787
- top: 28px;
788
- visibility: hidden;
789
- z-index: 101;
790
- text-align: left;
791
- }
792
-
793
- div.menu a.menuItem {
794
- color: #ffffff;
795
- cursor: default;
796
- display: block;
797
- padding: 3px 1em;
798
- text-decoration: none;
799
- text-align: left;
800
- white-space: nowrap;
801
- }
802
-
803
- div.menu a.menuItem:hover, div.menu a.menuItemHighlight {
804
- background-color: #000080;
805
- color: #ffffff;
806
- text-align: left;
807
- }
808
-
809
- div.menu a.menuItem span.menuItemText {}
810
-
811
- div.menu a.menuItem span.menuItemArrow {
812
- margin-right: -.75em;
813
- }
814
-
815
- div.menu div.menuItemSep {
816
- border: 1px inset #e0e0e0;
817
- margin: 4px 2px;
818
- }
819
- </style>
820
-
821
- <meta content="text/html; charset=windows-1252" http-equiv="Content-Type"><meta content="NO-CACHE" http-equiv="PRAGMA"><meta content="0" http-equiv="EXPIRES"><title>EnRoute I-STATUS</title></head><body onload="ClearSortCookie(); SendRequest();" onunload="ClearTimer()"><div style="position: relative;" class="menuBar"><a onmouseover="buttonMouseover(event, 'FireMenu');" class="menuButton">Fire</a><a onmouseover="buttonMouseover(event, 'AdminMenu');" class="menuButton">Admin</a><a target="_top" href="UserLogin.php" onclick="LogOffClicked(&quot;UserKey&quot;)" class="menuButton">Logoff</a><span style="width: 150px;">&nbsp;</span><a href="#" onclick="ToggleMode()" onmouseover="" class="menuLink">Night Mode</a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "<img style="position: absolute; top: -3px;" src="I-STATUS1.gif"></div><div onmouseover="menuMouseover(event)" class="menu" id="AmbMenu"></div><div onmouseover="menuMouseover(event)" class="menu" id="FireMenu"><a target="Top" href="Dispatch_center.php" class="menuItem">Active Fire/EMS Calls</a> <a target="Top" href="TruckStatus.php" class="menuItem">Apparatus</a> <a target="Top" href="SearchDStats.php" class="menuItem">Fire/EMS History</a> <a target="Top" href="ChgQuarters.php" class="menuItem">Coverage/Quarters</a> <a target="Top" href="FireRestricts.php" class="menuItem">Restrictions</a> </div><div onmouseover="menuMouseover(event)" class="menu" id="PoliceMenu"></div><div onmouseover="menuMouseover(event)" class="menu" id="AdminMenu"><a target="Top" href="UserPasswordMaint.php" class="menuItem">Change Password</a></div><script language="javascript">
822
- function popup(URL) {
823
- opts="'toolbar=0, scrollbars=0, location=0, menubar=0, resizable=0, width=160,"
824
- opts=opts + "height=200, top=60, left=60'"
825
- mywindow=window.open(URL, "newwin",opts);
826
- if (mywindow.opener == null)
827
- mywindow.opener=self;
828
- }
829
- function LogOffClicked(CN)
830
- {
831
- var cookiename=CN;
832
- /*alert("logoff clicked= " + cookiename);
833
- if (isset($_COOKIE['cookiename'])){
834
- alert("Cookie is set");
835
- setcookie ("cookiename", "", time()-60*60*24*100);
836
- }*/
837
- DeleteCookie(cookiename);
838
- }
839
- function ToggleMode() {
840
- var cname="NiteMode";
841
- var mode=ReadCookie(cname);
842
- if (mode == "") mode="Day";
843
- if (mode == "Day") {
844
- var newmode="Nite";
845
- } else {
846
- var newmode="Day";
847
- }
848
- WriteCookie(cname,newmode,1);
849
- if (window.parent.frames.length == 0) {
850
- window.self.location.href=window.self.location.href;
851
- } else {
852
- for (i=0; i&lt;window.parent.frames.length; i++)
853
- window.parent.frames(i).location.href=window.parent.frames(i).location.href;
854
- }
855
- }
856
230
  </script>
857
231
  <script src="JSFuncs.js" language="JavaScript"></script><script language="javascript">
858
- /// Function to return the value of a given cookie
859
- function cookieVal(cookieName){
860
- thisCookie=document.cookie.split("; ");
861
- var rtnval="";
862
- for (i=0; i&lt;thisCookie.length; i++){
863
- if (cookieName == thisCookie[i].split("=")[0]){
864
- rtnval=thisCookie[i].split("=")[1];
865
- }
866
- }
867
- return rtnval;
868
- }
232
+
869
233
  </script>
870
234
 
871
235
 
@@ -919,150 +283,7 @@ class IstatusMocker
919
283
  </form>
920
284
  <script src="Ajax.js" language="javascript"></script>
921
285
  <script language="javascript">
922
- window.onresize = SetDivSize;
923
- var instr;
924
- var fdtacs=cookieVal("FDTacs");
925
- var fdids=cookieVal("FDIDs");
926
- var fdgrids=cookieVal("FDGrids");
927
- var fdnats=cookieVal("FDNats");
928
- var fddsps=cookieVal("FDDsps");
929
-
930
- function SetDivSize(){
931
- //center Scrollable2
932
- var obj=document.getElementById("Scrollable2");
933
- obj.style.left=(document.body.clientWidth-540)/2;
934
-
935
- ht=document.body.clientHeight-d.offsetTop;
936
- d.style.height=ht-60;
937
- }
938
-
939
- function TruckScreen(scrn){
940
- WriteCookie("TScreen",scrn,"1");
941
- SendRequest()
942
- }
943
- // Create a request for data
944
- function CreateRequest(){
945
- try {
946
- request=new XMLHttpRequest();
947
- } catch (trymicrosoft) {
948
- try {
949
- request = new ActiveXObject("Msxml2.XMLHTTP");
950
- } catch (othermicrosoft) {
951
- try {
952
- request=new ActiveXObject("Microsoft.XMLHTTP");
953
- } catch (failed) {
954
- request=null;
955
- }
956
- }
957
- }
958
- if (request == null) alert("Error creating request object!");
959
- }
960
-
961
- // Send request for data to server
962
- function SendRequest(){
963
- CreateRequest();
964
- if (request != null){
965
- var url="AjaxTS2.php";
966
- request.open("GET",url,true);
967
- request.setRequestHeader("Content-Type","text/xml");
968
- request.onreadystatechange=UpdatePage;
969
- request.send(null);
970
- }
971
- RefreshTimer();
972
- }
973
-
974
- // Update page with returned data
975
- function UpdatePage(){
976
- rrs=request.readyState;
977
- if (rrs == 4){
978
- instr=request.responseText;
979
- // If the instr contains "UserLogin.php", which means
980
- // the page has timed out (code is in Global.php).
981
- if (instr.indexOf("UserLogin.php") != -1) {
982
- top.location="UserLogin.php";
983
- }
984
- BuildTable();
985
- }
986
- }
987
-
988
- function BuildTable(){
989
- var lctr;
990
- var outstr = new StringBuffer();
991
- var usort;
992
- var leftMargin;
993
- usort=cookieVal("TScreen");
994
- if (usort == "") usort=1;
995
-
996
- // Calculate left margin in order to center Scrollable2
997
- leftMargin=(document.body.clientWidth-540)/2;
998
- outstr.append('&lt;div id="Scrollable2" style="position:absolute; left:'+leftMargin+'px;"&gt;');
999
- outstr.append(instr);
1000
- outstr.append('&lt;/div&gt;');
1001
- h=document.getElementById("shead");
1002
- h.innerHTML="Apparatus Status - Screen "+usort;
1003
- d=document.getElementById("Scrollable");
1004
- d.innerHTML=outstr;
1005
- ht=document.body.clientHeight-d.offsetTop;
1006
- d.style.height=ht-60;
1007
-
1008
- }
1009
-
1010
- function ClearSortCookie(){
1011
- WriteCookie("SortFlg","xx","7");
1012
- }
1013
- // This function expand or collapse the unit legends
1014
- function DisplayLegends(id){
1015
- var ih="";
1016
- var cname="";
1017
- var ft="";
1018
- var fd="";
1019
- var fg="";
1020
- var fn="";
1021
- var dp="";
1022
-
1023
- switch (id){
1024
- case "legend":
1025
- ih="&lt;small&gt;"+"&lt;big&gt;-&lt;/big&gt; &lt;font color=#0066cc&gt;Primary&lt;/font&gt; &amp;nbsp; &amp;nbsp; "
1026
- +"&lt;big&gt;*&lt;/big&gt; &lt;font color=#0066cc&gt;Two person&lt;/font&gt; &amp;nbsp; &amp;nbsp; "
1027
- +"+ &lt;font color=#0066cc&gt;Primary and Two person&lt;/font&gt; &amp;nbsp; &amp;nbsp; "
1028
- +"&lt;b&gt;m&lt;/b&gt; &lt;font color=#0066cc&gt;MDT&lt;/font&gt;"
1029
- +"&lt;/small&gt;";
1030
- cname="UnitLegends";
1031
- break;
1032
- case "restricts":
1033
- ih="&lt;small&gt;&lt;font color=#FF0000&gt;";
1034
- if (ft != ""){
1035
- ih = ih + "Tacs: " + ft + "&lt;BR&gt;";
1036
- }
1037
- if (fd != ""){
1038
- ih=ih + "FDIDs: "+fd + "&lt;BR&gt;";
1039
- }
1040
- if (fg != ""){
1041
- ih=ih + "Grids: "+ fg + "&lt;BR&gt;";
1042
- }
1043
- if (fn != ""){
1044
- ih=ih + "Natures: "+ fn + "&lt;BR&gt;";
1045
- }
1046
- if (dp != ""){
1047
- ih=ih + "Dispatch: "+ dp + "&lt;BR&gt;";
1048
- }
1049
- ih=ih+"&lt;/font&gt;&lt;/small&gt;";
1050
- cname="FDRestrictions";
1051
- break;
1052
- default:
1053
- ih="";
1054
- cname="";
1055
- }
1056
- if (ih != ""){
1057
- if (document.getElementById(id).innerHTML == "") {
1058
- document.getElementById(id).innerHTML=ih;
1059
- WriteCookie(cname,"1",1);
1060
- } else {
1061
- document.getElementById(id).innerHTML="";
1062
- WriteCookie(cname,"0",1);
1063
- }
1064
- }
1065
- }
286
+
1066
287
  </script>
1067
288
  <script src="JSFuncs.js" language="JavaScript"></script>
1068
289
  </body></html>
@@ -1098,61 +319,80 @@ class IstatusMocker
1098
319
  Building</TH>
1099
320
  <TD CLASS='Detail' COLSPAN=3>
1100
321
  </TD>
1101
- </tr><tr><TH CLASS='Detail' align=left width=100px>
1102
- Nature</TH>
1103
- <TD CLASS='Detail' COLSPAN=3>
1104
- 69D9-SML NON DWEL STR FIRE</TD>
1105
- </tr><tr><TH CLASS='Detail' align=left width=100px>
1106
- Priority</TH>
1107
- <TD CLASS='Detail' width=110px>
1108
- 2</TD>
1109
- <TH CLASS='Detail' align=left width=100px>
1110
- Dispatch Code</TH>
1111
- <TD CLASS='Detail' >
1112
- BOX </TD>
1113
- </tr><tr><TH CLASS='Detail' align=left>
1114
- Grid</TH>
1115
- <TD CLASS='Detail' width=110px>
1116
- 34123B </TD>
1117
- <TH CLASS='Detail' align=left width=100px>
1118
- Map</TH>
1119
- <TD CLASS='Detail' >
1120
- </TD>
1121
- </tr><tr><TH CLASS='Detail' align=left>
1122
- Fire Area</TH>
1123
- <td class="Detail" COLSPAN="3">19-17B </td></tr><tr><TH CLASS='Detail' align=left>
1124
- Cross1</TH>
1125
- <td class="Detail" COLSPAN="3">RANGELINE RD S</td></tr><tr><TH CLASS='Detail' align=left>
1126
- Cross2</TH>
1127
- <td class="Detail" COLSPAN="3">HIGHWAY 63 S SB</td></tr><tr><th class="Detail" align="left">Hyd1</th><td class="Detail" width=$dw></td><th class="Detail" align="left" width=$cw>Hyd2</th><td class="Detail"></td></tr><tr><td colspan="4"><hr color=navy></td></tr><tr><TH CLASS='Detail' align=left width=100px>
1128
- Complainant</TH>
1129
- <TD CLASS='Detail' colspan=3>
1130
- JEROME</TD>
1131
- </tr><tr><TH CLASS='Detail' align=left width=100px>
1132
- Callback</TH>
1133
- <TD CLASS='Detail' colspan=3>
1134
- 5734410736</TD>
1135
- </tr><tr><th class="Detail" align="left" width=$cw>Dispatcher</th><td class="Detail" width=$dw>AMS </td><th class="Detail" align="left" width=$cw>CallTaker</th><td class="Detail">ALL </td></tr><tr><TH CLASS='Detail' align=left width=100px>
1136
- DispO</TH>
1137
- <TD CLASS='Detail' >
1138
- ND</TD>
1139
- <TH CLASS='Detail' align=left width=100px>
1140
- Meth. Alarm</TH>
1141
- <TD CLASS='Detail' >
1142
- 2 </TD>
1143
- </tr><tr><td colspan="4"><hr color=navy></td></tr><tr><TH CLASS='Detail' align=left width=100px>
1144
- Inc Date/Time</TH>
1145
- <TD CLASS='Detail' colspan=3>
1146
- 12/19/2010 14:15:05</TD>
1147
- </tr><tr><TH CLASS='Detail' align=left width=100px>
1148
- On Scene</TH>
1149
- <TD CLASS='Detail' colspan=3>
1150
- 12/19/2010 14:27:09</TD>
1151
- </tr><tr><TH CLASS='Detail' align=left width=100px>
1152
- Upgrade</TH>
1153
- <TD CLASS='Detail' colspan=3>
1154
- 00:00:00</TD>
1155
- </tr><tr><TH CLASS='Detail' align=left width=100px>
322
+ </tr>
323
+ <tr>
324
+ <TH CLASS='Detail' align=left width=100px>Nature</TH>
325
+ <TD CLASS='Detail' COLSPAN=3>23C7V-SML NON DWEL STR FIRE</TD>
326
+ </tr>
327
+ <tr>
328
+ <TH CLASS='Detail' align=left width=100px>Priority</TH>
329
+ <TD CLASS='Detail' width=110px>2</TD>
330
+ <TH CLASS='Detail' align=left width=100px>Dispatch Code</TH>
331
+ <TD CLASS='Detail' > BOX </TD>
332
+ </tr>
333
+ <tr>
334
+ <TH CLASS='Detail' align=left> Grid</TH>
335
+ <TD CLASS='Detail' width=110px> 34123B </TD>
336
+ <TH CLASS='Detail' align=left width=100px> Map</TH>
337
+ <TD CLASS='Detail' > </TD>
338
+ </tr>
339
+ <tr>
340
+ <TH CLASS='Detail' align=left> Fire Area</TH>
341
+ <td class="Detail" COLSPAN="3">19-17B </td>
342
+ </tr>
343
+ <tr>
344
+ <TH CLASS='Detail' align=left> Cross1</TH>
345
+ <td class="Detail" COLSPAN="3">RANGELINE RD S</td>
346
+ </tr>
347
+ <tr>
348
+ <TH CLASS='Detail' align=left> Cross2</TH>
349
+ <td class="Detail" COLSPAN="3">HIGHWAY 63 S SB</td>
350
+ </tr>
351
+ <tr>
352
+ <th class="Detail" align="left">Hyd1</th>
353
+ <td class="Detail" width=$dw></td>
354
+ <th class="Detail" align="left" width=$cw>Hyd2</th>
355
+ <td class="Detail"></td>
356
+ </tr>
357
+ <tr>
358
+ <td colspan="4"><hr color=navy></td>
359
+ </tr>
360
+ <tr>
361
+ TH CLASS='Detail' align=left width=100px> Complainant</TH>
362
+ <TD CLASS='Detail' colspan=3> JEROME</TD>
363
+ </tr>
364
+ <tr>
365
+ <TH CLASS='Detail' align=left width=100px> Callback</TH>
366
+ <TD CLASS='Detail' colspan=3> 5734410736</TD>
367
+ </tr>
368
+ <tr>
369
+ <th class="Detail" align="left" width=$cw>Dispatcher</th>
370
+ <td class="Detail" width=$dw>AMS </td>
371
+ <th class="Detail" align="left" width=$cw>CallTaker</th>
372
+ <td class="Detail">ALL </td>
373
+ </tr>
374
+ <tr>
375
+ <TH CLASS='Detail' align=left width=100px> DispO</TH>
376
+ <TD CLASS='Detail' > ND</TD>
377
+ <TH CLASS='Detail' align=left width=100px> Meth. Alarm</TH>
378
+ <TD CLASS='Detail' > 2 </TD>
379
+ </tr>
380
+ <tr>
381
+ <td colspan="4"><hr color=navy></td>
382
+ </tr>
383
+ <tr>
384
+ <TH CLASS='Detail' align=left width=100px> Inc Date/Time</TH>
385
+ <TD CLASS='Detail' colspan=3> 12/19/2010 14:15:05</TD>
386
+ </tr>
387
+ <tr>
388
+ <TH CLASS='Detail' align=left width=100px> On Scene</TH>
389
+ <TD CLASS='Detail' colspan=3> 12/19/2010 14:27:09</TD>
390
+ </tr>
391
+ <tr>
392
+ <TH CLASS='Detail' align=left width=100px> Upgrade</TH>
393
+ <TD CLASS='Detail' colspan=3> 00:00:00</TD>
394
+ </tr>
395
+ <tr><TH CLASS='Detail' align=left width=100px>
1156
396
  Pat Contact</TH>
1157
397
  <TD CLASS='Detail' colspan=3>
1158
398
  01/01/1970 00:00:00</TD>
@@ -24,10 +24,46 @@ describe "Watchman::CallWatcher" do
24
24
  IstatusMocker.fake_call_path(Client.host,"201023687")
25
25
  end
26
26
 
27
+ let(:call){ CallWatcher.new.info_for("201023687") }
28
+
27
29
  it "can find the address" do
28
- call = CallWatcher.new.info_for("201023687")
29
30
  call.address.should == "7750 HIGHWAY AB E"
31
+ end
32
+
33
+ it "can find the incident number" do
30
34
  call.incident_number.should == "201023687"
31
35
  end
36
+
37
+ it "can find the cross-streets" do
38
+ call.cross_streets.should == ["RANGELINE RD S","HIGHWAY 63 S SB"]
39
+ end
40
+
41
+ it "can extract the response level" do
42
+ call.response_level.should == "Charlie"
43
+ end
44
+
45
+ it "can harvest the priority level" do
46
+ call.priority.should == 2
47
+ end
48
+
49
+ it "extracts the dispatch_code" do
50
+ call.dispatch_code.should == "BOX"
51
+ end
52
+
53
+ it "can get the grid" do
54
+ call.grid.should == "34123B"
55
+ end
56
+
57
+ it "can get the fire_area" do
58
+ call.fire_area.should == "19-17B"
59
+ end
60
+
61
+ it "gets the time of alarm" do
62
+ call.time_of_alarm.should == Time.parse("12/19/2010 14:15:05")
63
+ end
64
+
65
+ it "gets the on-scene time" do
66
+ call.time_of_first_unit_on_scene == Time.parse("12/19/2010 14:27:09")
67
+ end
32
68
  end
33
69
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watchman
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ethan Vizitei
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-22 00:00:00 -06:00
18
+ date: 2010-12-25 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency