Permalink
Browse files

Resyncing with SVN repository :-(

  • Loading branch information...
1 parent 590eb0e commit 6a32ba0c3a280dddb47fcc275980945f2ab65fbe @vvuksan vvuksan committed Mar 27, 2011
View
@@ -1,4 +1,4 @@
-Copyright (c) 2001-2010, The Regents of the University of California
+Copyright (c) 2001-2011, The Regents of the University of California
All rights reserved.
Redistribution and use in source and binary forms, with or without
View
@@ -5,6 +5,8 @@ General
- Centralize sanitization of user input (Extract this from get_context.php and graph.php, no other scripts
should use $_GET directly)
- Make indentation consistent - mixed usage of 2 spaces, 3 spaces, 4 spaces, or tabs makes code harder to read
+- In Cluster Report, when one clicks on the text box besides "Metric", it should bring up a dropbox with a
+ list of paginated metrics and continue to show metric name hints as you type
Graphs
@@ -1,5 +1,5 @@
<?php
- /* $Id: cluster_view.php 2476 2011-02-15 03:06:33Z vvuksan $ */
+ /* $Id: cluster_view.php 2535 2011-03-26 19:14:06Z vvuksan $ */
$tpl = new Dwoo_Template_File( template("cluster_view.tpl") );
$data = new Dwoo_Data();
$data->assign("extra", template("cluster_extra.tpl"));
@@ -1,5 +1,5 @@
<?php
-# $Id: conf.php.in 2476 2011-02-15 03:06:33Z vvuksan $
+# $Id: conf_default.php.in 2535 2011-03-26 19:14:06Z vvuksan $
#
# Gmetad-webfrontend version. Used to check for updates.
#
@@ -338,6 +338,8 @@ public function get($_tpl, $data = array(), $_compiler = null, $_output = false)
$this->data = $data->getData();
} elseif (is_array($data)) {
$this->data = $data;
+ } elseif ($data instanceof ArrayAccess) {
+ $this->data = $data;
} else {
throw new Dwoo_Exception('Dwoo->get/Dwoo->output\'s data argument must be a Dwoo_IDataProvider object (i.e. Dwoo_Data) or an associative array', E_USER_NOTICE);
}
@@ -1531,7 +1533,12 @@ public function setScope($scope, $absolute = false)
$this->scope =& $this->data;
$this->scopeTree = array();
} elseif (isset($this->scope[$bit])) {
- $this->scope =& $this->scope[$bit];
+ if($this->scope instanceof ArrayAccess) {
+ $tmp = $this->scope[$bit];
+ $this->scope =& $tmp;
+ } else {
+ $this->scope =& $this->scope[$bit];
+ }
$this->scopeTree[] = $bit;
} else {
unset($this->scope);
@@ -20,14 +20,16 @@ class Dwoo_Plugin_extends extends Dwoo_Plugin implements Dwoo_ICompilable
{
protected static $childSource;
protected static $l;
+ protected static $lraw;
protected static $r;
+ protected static $rraw;
protected static $lastReplacement;
public static function compile(Dwoo_Compiler $compiler, $file)
{
- list($l, $r) = $compiler->getDelimiters();
- self::$l = preg_quote($l,'/');
- self::$r = preg_quote($r,'/');
+ list(self::$lraw, self::$rraw) = $compiler->getDelimiters();
+ self::$l = preg_quote(self::$lraw,'/');
+ self::$r = preg_quote(self::$rraw,'/');
if ($compiler->getLooseOpeningHandling()) {
self::$l .= '\s*';
@@ -99,9 +101,11 @@ public static function compile(Dwoo_Compiler $compiler, $file)
// TODO parse blocks tree for child source and new source
// TODO replace blocks that are found in the child and in the parent recursively
- $newSource = preg_replace_callback('/'.self::$l.'block (["\']?)(.+?)\1'.self::$r.'(?:\r?\n?)(.*?)(?:\r?\n?)'.self::$l.'\/block'.self::$r.'/is', array('Dwoo_Plugin_extends', 'replaceBlock'), $newSource);
+ $firstL = preg_quote(self::$lraw[0], '/');
+ $restL = preg_quote(substr(self::$lraw, 1), '/');
+ $newSource = preg_replace_callback('/'.self::$l.'block (["\']?)(.+?)\1'.self::$r.'(?:\r?\n?)((?:[^'.$firstL.']*|'.$firstL.'(?!'.$restL.'\/block'.self::$r.'))*)'.self::$l.'\/block'.self::$r.'/is', array('Dwoo_Plugin_extends', 'replaceBlock'), $newSource);
- $newSource = $l.'do extendsCheck("'.$parent['resource'].':'.$parent['identifier'].'")'.$r.$newSource;
+ $newSource = self::$lraw.'do extendsCheck("'.$parent['resource'].':'.$parent['identifier'].'")'.self::$rraw.$newSource;
if (self::$lastReplacement) {
break;
@@ -114,14 +118,15 @@ public static function compile(Dwoo_Compiler $compiler, $file)
protected static function replaceBlock(array $matches)
{
- if (preg_match('/'.self::$l.'block (["\']?)'.preg_quote($matches[2],'/').'\1'.self::$r.'(?:\r?\n?)(.*?)(?:\r?\n?)'.self::$l.'\/block'.self::$r.'/is', self::$childSource, $override)) {
- $l = stripslashes(self::$l);
- $r = stripslashes(self::$r);
-
+ $matches[3] = self::cleanTrailingCRLF($matches[3]);
+ $firstL = preg_quote(self::$lraw[0], '/');
+ $restL = preg_quote(substr(self::$lraw, 1), '/');
+ if (preg_match('/'.self::$l.'block (["\']?)'.preg_quote($matches[2],'/').'\1'.self::$r.'(?:\r?\n?)((?:[^'.$firstL.']*|'.$firstL.'(?!'.$restL.'\/block'.self::$r.'))*)'.self::$l.'\/block'.self::$r.'/is', self::$childSource, $override)) {
+ $override[2] = self::cleanTrailingCRLF($override[2]);
if (self::$lastReplacement) {
return preg_replace('/'.self::$l.'\$dwoo\.parent'.self::$r.'/is', $matches[3], $override[2]);
} else {
- return $l.'block '.$matches[1].$matches[2].$matches[1].$r.preg_replace('/'.self::$l.'\$dwoo\.parent'.self::$r.'/is', $matches[3], $override[2]).$l.'/block'.$r;
+ return self::$lraw.'block '.$matches[1].$matches[2].$matches[1].self::$rraw.preg_replace('/'.self::$l.'\$dwoo\.parent'.self::$r.'/is', $matches[3], $override[2]).self::$lraw.'/block'.self::$rraw;
}
} else {
if (self::$lastReplacement) {
@@ -131,4 +136,15 @@ protected static function replaceBlock(array $matches)
}
}
}
+
+ protected static function cleanTrailingCRLF($input)
+ {
+ if (substr($input, -1) === "\n") {
+ if (substr($input, -2, 1) === "\r") {
+ return substr($input, 0, -2);
+ }
+ return substr($input, 0, -1);
+ }
+ return $input;
+ }
}
View
@@ -1,5 +1,5 @@
<?php
-/* $Id: footer.php 2362 2010-11-26 01:43:53Z vvuksan $ */
+/* $Id: footer.php 2334 2010-09-08 22:29:27Z bernardli $ */
$tpl = new Dwoo_Template_File( template("footer.tpl") );
$data = new Dwoo_Data();
$data->assign("webfrontend_version",$version["webfrontend"]);
View
@@ -1,5 +1,5 @@
<?php
-/* $Id: ganglia.php 2375 2010-11-30 00:15:37Z bernardli $ */
+/* $Id: ganglia.php 2535 2011-03-26 19:14:06Z vvuksan $ */
#
# Parses ganglia XML tree.
#
@@ -1,5 +1,5 @@
<?php
-/* $Id: get_context.php 2362 2010-11-26 01:43:53Z vvuksan $ */
+/* $Id: get_context.php 2535 2011-03-26 19:14:06Z vvuksan $ */
include_once "./functions.php";
@@ -1,5 +1,5 @@
<?php
-# $Id: get_ganglia.php 589 2005-10-10 07:42:26Z knobi1 $
+# $Id: get_ganglia.php 2510 2011-03-15 01:12:34Z vvuksan $
# Retrieves and parses the XML output from gmond. Results stored
# in global variables: $clusters, $hosts, $hosts_down, $metrics.
# Assumes you have already called get_context.php.
View
@@ -1,5 +1,5 @@
<?php
-/* $Id: graph.php 2510 2011-03-15 01:12:34Z vvuksan $ */
+/* $Id: graph.php 2535 2011-03-26 19:14:06Z vvuksan $ */
include_once "./eval_conf.php";
include_once "./get_context.php";
include_once "./functions.php";
View
@@ -1,5 +1,5 @@
#
-# $Id: gweb.spec.in 2468 2011-02-01 22:57:57Z bernardli $
+# $Id: gweb.spec.in 2539 2011-03-27 21:26:38Z vvuksan $
#
Summary: Ganglia Web Frontend
Name: gweb
@@ -54,7 +54,7 @@ written in the PHP5 language and uses the Dwoo templating engine.
#%dir %{web_prefixdir}/img
#%dir %{web_prefixdir}/js
%{web_prefixdir}/*
-%config(noreplace) %{web_prefixdir}/conf.php
+%config(noreplace) %{web_prefixdir}/conf_default.php
#%{web_prefixdir}/conf/*
#%{web_prefixdir}/css/*
#%{web_prefixdir}/dwoo/*
@@ -65,5 +65,7 @@ written in the PHP5 language and uses the Dwoo templating engine.
%__rm -rf $RPM_BUILD_ROOT
%changelog
+* Thu Mar 17 2011 Bernard Li <bernard@vanhpc.org>
+- Renamed conf.php -> conf_default.php
* Fri Dec 17 2010 Bernard Li <bernard@vanhpc.org>
- Spec file for gweb which is split from ganglia-web subpackage
View
@@ -1,5 +1,5 @@
<?php
-/* $Id: header.php 2423 2011-01-07 02:00:33Z vvuksan $ */
+/* $Id: header.php 2536 2011-03-27 20:32:28Z vvuksan $ */
# Check if this context is private.
include_once "./auth.php";
@@ -1,5 +1,5 @@
<?php
-/* $Id: host_view.php 2476 2011-02-15 03:06:33Z vvuksan $ */
+/* $Id: host_view.php 2510 2011-03-15 01:12:34Z vvuksan $ */
$tpl = new Dwoo_Template_File( template("host_view.tpl") );
$data = new Dwoo_Data();
View
@@ -1,5 +1,5 @@
<?php
-/* $Id: index.php 2375 2010-11-30 00:15:37Z bernardli $ */
+/* $Id: index.php 2525 2011-03-17 15:16:14Z vvuksan $ */
include_once "./eval_conf.php";
# ATD - function.php must be included before get_context.php. It defines some needed functions.
include_once "./functions.php";
@@ -1,5 +1,5 @@
<?php
-/* $Id: meta_view.php 2371 2010-11-29 17:42:15Z vvuksan $ */
+/* $Id: meta_view.php 2510 2011-03-15 01:12:34Z vvuksan $ */
$tpl = new Dwoo_Template_File( template("meta_view.tpl") );
$data = new Dwoo_Data();
@@ -1,5 +1,5 @@
<?php
-/* $Id: physical_view.php 2363 2010-11-26 05:34:11Z bernardli $ */
+/* $Id: physical_view.php 2510 2011-03-15 01:12:34Z vvuksan $ */
#
# Displays the cluster in a physical view. Cluster nodes in
# this view are located by Rack, Rank, and Plane in the physical
@@ -1,5 +1,5 @@
<?php
-# $Id: show_node.php 2363 2010-11-26 05:34:11Z bernardli $
+# $Id: show_node.php 2334 2010-09-08 22:29:27Z bernardli $
#
# Shows information on a particular node, specified by
# node host name. Used in concert with the physical_view page.

0 comments on commit 6a32ba0

Please sign in to comment.