@@ -8,17 +8,17 @@ require_once "../../include/forms.php";
88require_once "../../include/mlib.php " ;
99$ pgconn = iemdb ('iem ' );
1010
11- $ sortcol = isset ( $ _GET [ ' sortcol ' ]) ? xssafe ( $ _GET [ ' sortcol ' ]) : "valid " ;
11+ $ sortcol = get_str404 ( " sortcol " , "valid " ) ;
1212$ network = get_str404 ("network " , 'IA_DCP ' , 9 );
13- $ shef = isset ( $ _REQUEST [ ' shef ' ]) && $ _REQUEST [ ' shef ' ] == 'yes ' ;
13+ $ shef = get_str404 ( " shef " , " no " ) = == 'yes ' ;
1414
1515$ t ->title = "DCP/GOES Current Conditions " ;
1616$ t ->refresh = 600 ;
1717
1818$ t ->breadcrumbs = <<<EOM
19- <ol class="breadcrumb">
20- <li><a href="/DCP/">DCP Network</a></li>
21- <li class="active">Sortable Currents</li>
19+ <ol class="breadcrumb mb-0 ">
20+ <li class="breadcrumb-item" ><a href="/DCP/">DCP Network</a></li>
21+ <li class="breadcrumb-item active" aria-current="page ">Sortable Currents</li>
2222</ol>
2323EOM ;
2424$ cols = array (
@@ -33,7 +33,7 @@ $cols = array(
3333 'TWIZ ' => 'Water Temperature ' ,
3434);
3535if (!array_key_exists ($ sortcol , $ cols )) {
36- xssafe ( " </script> " );
36+ die405 ( );
3737}
3838
3939$ stname = iem_pg_prepare (
@@ -67,26 +67,55 @@ while ($row = pg_fetch_assoc($rs)) {
6767$ final = aSortBySecondIndex ($ obs , $ sortcol , "desc " );
6868
6969$ nselect = selectNetworkType ("DCP " , $ network );
70+ $ nselect = str_replace ('class="iemselect2" ' , 'class="iemselect2 form-select" ' , $ nselect );
71+ $ nselect = str_replace ('<select ' , '<select id="network-select" ' , $ nselect );
7072
7173$ ar = array ("no " => "No " , "yes " => "Yes " );
72- $ sselect = make_select ("shef " , $ shef , $ ar );
74+ $ sselect = make_select (
75+ "shef " ,
76+ $ shef ? "yes " : "no " ,
77+ $ ar ,
78+ "" ,
79+ "form-select " ,
80+ FALSE ,
81+ FALSE ,
82+ TRUE ,
83+ array ("id " => "shef-select " )
84+ );
7385
7486$ t ->current_network = "DCP " ;
75- $ baseurl2 = "current.phtml?network= $ network&sortcol= " ;
87+ $ shefqs = $ shef ? "&shef=yes " : "" ;
88+ $ baseurl2 = "current.phtml?network= $ network {$ shefqs }&sortcol= " ;
7689
7790$ content = <<<EOM
78- <form method="GET" action="current.phtml" name="myselector">
79- <input type="hidden" name="sortcol" value=" {$ sortcol }">
80- <strong>Select Network:</strong> {$ nselect }
81-
82- <strong>Show SHEF Codes:</strong> {$ sselect }
83-
84- <input type="submit" value="Go!">
85- </form>
86-
87- <p>Sorted by: {$ cols [$ sortcol ]}
88- <table class="table table-sm table-striped table-bordered">
89- <thead>
91+ <div class="card shadow-sm mb-3">
92+ <div class="card-body">
93+ <form method="GET" action="current.phtml" name="myselector" class="row g-3 align-items-end">
94+ <input type="hidden" name="sortcol" value=" {$ sortcol }">
95+ <div class="col-12 col-lg-6">
96+ <label for="network-select" class="form-label mb-1">Select Network</label>
97+ {$ nselect }
98+ </div>
99+ <div class="col-12 col-md-4 col-lg-3">
100+ <label for="shef-select" class="form-label mb-1">Show SHEF Codes</label>
101+ {$ sselect }
102+ </div>
103+ <div class="col-12 col-md-4 col-lg-3">
104+ <button type="submit" class="btn btn-primary w-100">Update View</button>
105+ </div>
106+ </form>
107+ </div>
108+ </div>
109+
110+ <div class="d-flex flex-column flex-md-row justify-content-between align-items-md-center gap-2 mb-2">
111+ <p class="mb-0">Sorted by: <span class="badge text-bg-light"> {$ cols [$ sortcol ]}</span></p>
112+ <p class="text-body-secondary small mb-0">Rows with stale observations are highlighted.</p>
113+ </div>
114+
115+ <div class="table-responsive">
116+ <table class="table table-sm table-striped table-bordered table-hover align-middle mb-0">
117+ <caption class="caption-top">Latest DCP/GOES observations for selected state.</caption>
118+ <thead class="table-light">
90119<tr>
91120 <th><a href=" {$ baseurl2 }station">SiteID:</a></th>
92121 <th><a href=" {$ baseurl2 }name">Station Name:</a></th>
@@ -104,15 +133,15 @@ $now = time();
104133foreach ($ final as $ site => $ value ) {
105134 $ url = sprintf ("/sites/site.php?station=%s&network=%s " , $ site , $ network );
106135 $ content .= "<tr><td><a href= \"$ url \"> $ site</a></td>
107- <td> " . $ value ["name " ] . "</font></ td> " ;
108- $ content .= "<td " ;
136+ <td> " . $ value ["name " ] . "</td> " ;
137+ $ content .= "<td class= \" text-nowrap " ;
109138 $ tdiff = $ now - $ value ["valid " ];
110139 $ dtfmt = "d M h:i A " ;
111140 if ($ tdiff > (6 * 3600 )) {
112141 $ dtfmt = "d M Y h:i A " ;
113- $ content .= 'bgcolor="red" ' ;
142+ $ content .= ' table-danger fw-semibold ' ;
114143 }
115- $ content .= "> " . date ($ dtfmt , $ value ["valid " ]) . "</td> " ;
144+ $ content .= "\" > " . date ($ dtfmt , $ value ["valid " ]) . "</td> " ;
116145
117146 if (array_key_exists ('HGIZ ' , $ value )) {
118147 $ content .= sprintf ("<td>%s</td> " , $ value ["HGIZ " ]);
@@ -153,7 +182,7 @@ foreach ($final as $site => $value) {
153182
154183 $ content .= "</tr> " ;
155184 if ($ shef ) {
156- $ content .= "<tr><td colspan= \"9 \"> " ;
185+ $ content .= "<tr class= \" table-secondary \" ><td colspan= \"9 \" class= \" small font-monospace \"> " ;
157186 foreach ($ value as $ k => $ v ) {
158187 if ($ k == 'name ' || $ k == 'valid ' ) continue ;
159188 $ content .= sprintf ("/%s %s " , $ k , $ v );
@@ -165,6 +194,7 @@ $content .= <<<EOM
165194</tbody><tfoot>
166195<tr><td colspan="9"> </td></tr>
167196</tfoot></table>
197+ </div>
168198EOM ;
169199$ t ->content = $ content ;
170200$ t ->render ('sortables.phtml ' );
0 commit comments