Permalink
Browse files

HTML cleanup. Use jQuery to replace native DOM calls.

  • Loading branch information...
Peter Piela
Peter Piela committed Jul 25, 2011
1 parent 30c99e4 commit 2c734a17fd6a80fccdf3588acf2834ea56c30dec
Showing with 22 additions and 22 deletions.
  1. +22 −22 ganglia-web/views.php
View
@@ -164,9 +164,9 @@
<link type="text/css" href="css/jquery.liveSearch.css" rel="stylesheet" />
<LINK rel="stylesheet" href="./styles.css" type="text/css">
<?php
-if ( isset($_GET['standalone']) && isset($_GET['view_name']) ) {
+if ( isset($_GET['view_name']) ) {
- print "<script>selectView('" . $_GET['view_name'] . "');</script>";
+ print "<script type=\"text/javascript\">selectView('" . $_GET['view_name'] . "');</script>";
}
?>
@@ -192,8 +192,8 @@
print '<a href="views.php?standalone=1" id="detach-tab-button">Detach Tab</a>';
}
?>
- <p> <div id="views_menu">
- Existing views:
+ <div id="views_menu">
+ <p>Existing views:</p>
<ul id="navlist">
<?php
@@ -202,9 +202,10 @@
$v = $view['view_name'];
print '<li><a href="#" id=\'' . viewId($v) . '\' onClick="selectView(\'' . $v . '\'); return false;">' . $v . '</a></li>';
}
+ print '</ul>';
?>
-<script>
+<script type="text/javascript">
$(function(){
$( "#view_range_chooser" ).buttonset();
<?php
@@ -214,12 +215,12 @@
<?php
}
?>
- document.getElementById('view_name').value = "default";
+ $('#view_name').val("default");
});
</script>
- </ul></div></td><td valign=top>
+ </div></td><td valign=top><div>
<div id=view_range_chooser>
<form id=view_timerange_form>
<input type="hidden" name=view_name id=view_name value="">
@@ -242,20 +243,19 @@
$checked = "checked=\"checked\"";
else
$checked = "";
-# $range_menu .= "<input OnChange=\"getViewsContentJustGraphs(document.getElementById('view_name').value);\" type=\"radio\" id=\"view-range-$v\" name=\"r\" value=\"$v\" $checked/><label for=\"view-range-$v\">$v</label>";
- $range_menu .= "<input OnChange=\"$.cookie('ganglia-view-range-' + window.name, '" . $v . "'); document.getElementById('view-cs').value = ''; document.getElementById('view-ce').value = ''; getViewsContentJustGraphs(document.getElementById('view_name').value, '" . $v . "', '','');\" type=\"radio\" id=\"view-range-$v\" name=\"r\" value=\"$v\" $checked/><label for=\"view-range-$v\">$v</label>";
+
+ $range_menu .= "<input OnChange=\"$.cookie('ganglia-view-range-' + window.name, '" . $v . "'); $('#view-cs').val(''); $('#view-ce').val(''); getViewsContentJustGraphs($('#view_name').val(), '" . $v . "', '','');\" type=\"radio\" id=\"view-range-$v\" name=\"r\" value=\"$v\" $checked/><label for=\"view-range-$v\">$v</label>";
}
print $range_menu;
?>
- &nbsp;&nbsp;or from
- <INPUT TYPE="TEXT" TITLE="Feb 27 2007 00:00, 2/27/2007, 27.2.2007, now -1 week, -2 days, start + 1 hour, etc." NAME="cs" ID="view-cs" SIZE="17"> to
- <INPUT TYPE="TEXT" TITLE="Feb 27 2007 00:00, 2/27/2007, 27.2.2007, now -1 week, -2 days, start + 1 hour, etc." NAME="ce" ID="view-ce" SIZE="17">
- <input type="button" onclick="getViewsContentJustGraphs(document.getElementById('view_name').value, '', document.getElementById('view-cs').value, document.getElementById('view-ce').value ); return false;" value="Go">
- <input type="button" value="Clear" onclick="document.getElementById('view-cs').value = ''; document.getElementById('view-ce').value = '' ; return false;">
- </form><p>
+ &nbsp;&nbsp;or <span class="nobr">from
+ <input type="text" title="Feb 27 2007 00:00, 2/27/2007, 27.2.2007, now -1 week, -2 days, start + 1 hour, etc." name="cs" id="view-cs" size="17"> to
+ <input type="text" title="Feb 27 2007 00:00, 2/27/2007, 27.2.2007, now -1 week, -2 days, start + 1 hour, etc." name="ce" id="view-ce" size="17">
+ <input type="button" onclick="alert($('#view_name').val());getViewsContentJustGraphs($('#view_name').val(), '', $('#view-cs').val(), $('#view-ce').val() ); return false;" value="Go">
+ <input type="button" value="Clear" onclick="$('#view-cs').val(''); $('#view-ce').val('') ; return false;">
+ </span></form><p>&nbsp;</p>
</div>
- </div>
<?php
@@ -275,16 +275,16 @@
$range_args = "";
if ( isset($_GET['r']) && $_GET['r'] != "" )
- $range_args .= "&r=" . $_GET['r'];
+ $range_args .= "&amp;r=" . $_GET['r'];
if ( isset($_GET['cs']) && isset($_GET['ce']) )
- $range_args .= "&cs=" . $_GET['cs'] . "&ce=" . $_GET['ce'];
+ $range_args .= "&amp;cs=" . $_GET['cs'] . "&amp;ce=" . $_GET['ce'];
if ( count($view_elements) != 0 ) {
foreach ( $view_elements as $id => $element ) {
$legend = isset($element['hostname']) ? $element['hostname'] : "Aggregate graph";
print "
- <A HREF=\"./graph_all_periods.php?" . $element['graph_args'] ."&z=large\">
- <IMG title=\"" . $legend . " - " . $element['name'] . "\" BORDER=0 SRC=\"./graph.php?" . $element['graph_args'] . "&z=medium" . $range_args . "\" style=\"padding:2px;\"></A>";
+ <a href=\"./graph_all_periods.php?" . htmlentities($element['graph_args']) ."&amp;z=large\">
+ <img title=\"" . $legend . " - " . $element['name'] . "\" border=0 SRC=\"./graph.php?" . htmlentities($element['graph_args']) . "&amp;z=medium" . $range_args . "\" style=\"padding:2px;\"></A>";
}
} else {
@@ -297,10 +297,10 @@
print "</div>";
if ( ! isset($_GET['just_graphs']) )
- print "</td></tr></table></form>";
+ print "</div></td></tr></table></form>";
if ( isset($_GET['standalone']) ) {
- print "</div>";
+ print "</div></body></html>";
}

0 comments on commit 2c734a1

Please sign in to comment.