[PC-BSD Commits] r2192 - in websites: bsdstats.org/bsdstats/bin bsdstats.org/bsdstats/etc bsdstats.org/bsdstats/lib bsdstats.org/bsdstats/sbin bsdstats.org/bsdstats/tpl/bsdstats bsdstats.org/bsdstats/tpl/css bsdstats.org/bsdstats/tpl/js bsdstats.org/images/countries pbidir.com/bibivu/etc pbidir.com/bibivu/sbin
svn at pcbsd.org
svn at pcbsd.org
Fri Jun 27 20:00:45 PDT 2008
Author: fabry
Date: 2008-06-27 20:00:45 -0700 (Fri, 27 Jun 2008)
New Revision: 2192
Added:
websites/bsdstats.org/bsdstats/tpl/bsdstats/cpu.php
websites/bsdstats.org/bsdstats/tpl/js/functions.js
websites/bsdstats.org/images/countries/tj.png
Modified:
websites/bsdstats.org/bsdstats/bin/start.php
websites/bsdstats.org/bsdstats/etc/display.conf.php
websites/bsdstats.org/bsdstats/etc/uri.conf.php
websites/bsdstats.org/bsdstats/lib/bsdstats.php
websites/bsdstats.org/bsdstats/sbin/uri.php
websites/bsdstats.org/bsdstats/tpl/bsdstats/country.php
websites/bsdstats.org/bsdstats/tpl/bsdstats/foot_menu.php
websites/bsdstats.org/bsdstats/tpl/bsdstats/menu.php
websites/bsdstats.org/bsdstats/tpl/css/bsdstats.css
websites/pbidir.com/bibivu/etc/uri.conf.php
websites/pbidir.com/bibivu/sbin/uri.php
Log:
cpu page created for bsdstats
Modified: websites/bsdstats.org/bsdstats/bin/start.php
===================================================================
--- websites/bsdstats.org/bsdstats/bin/start.php 2008-06-27 21:00:23 UTC (rev 2191)
+++ websites/bsdstats.org/bsdstats/bin/start.php 2008-06-28 03:00:45 UTC (rev 2192)
@@ -15,6 +15,7 @@
//assigning common links
$this->display->assign('instructions_uri',$this->uri->create_uri(array(TASK_KEY=>'instructions')));
$this->display->assign('countries_uri',$this->uri->create_uri(array(TASK_KEY=>'countries')));
+ $this->display->assign('cpus_uri',$this->uri->create_uri(array(TASK_KEY=>'cpus')));
$task = $this->uri->get(TASK_KEY, '');
@@ -56,5 +57,14 @@
$this->display('country');
}
+ public function web_cpus(){
+ $tmp = load_library('bsdstats')->cpus();
+
+ $this->display->assign('cpu_stats', $tmp['cpu_stats']);
+ $this->display->assign('vendor_stats', $tmp['vendor_stats']);
+ $this->display->assign('title', 'CPU Stats');
+ $this->display('cpu');
+ }
+
}
?>
\ No newline at end of file
Modified: websites/bsdstats.org/bsdstats/etc/display.conf.php
===================================================================
--- websites/bsdstats.org/bsdstats/etc/display.conf.php 2008-06-27 21:00:23 UTC (rev 2191)
+++ websites/bsdstats.org/bsdstats/etc/display.conf.php 2008-06-28 03:00:45 UTC (rev 2192)
@@ -43,5 +43,14 @@
$display['link'][1]['href'] = TPLWEBPATH.'css/bsdstats.css';
$display['link'][1]['media'] = 'all';
+$display['script'][0]['type'] = 'text/javascript';
+$display['script'][0]['language'] = 'javascript';
+$display['script'][0]['src'] = 'http://code.jquery.com/jquery-latest.js';
+//$display['script'][0]['src'] = TPLWEBPATH.'js/jquery-1.2.1.pack.js';
+//$display['script'][0]['src'] = 'http://code.jquery.com/nightlies/jquery-nightly.pack.js';
+$display['script'][99]['type'] = 'text/javascript';
+$display['script'][99]['language'] = 'javascript';
+$display['script'][99]['src'] = TPLWEBPATH.'js/functions.js';
+
?>
\ No newline at end of file
Modified: websites/bsdstats.org/bsdstats/etc/uri.conf.php
===================================================================
--- websites/bsdstats.org/bsdstats/etc/uri.conf.php 2008-06-27 21:00:23 UTC (rev 2191)
+++ websites/bsdstats.org/bsdstats/etc/uri.conf.php 2008-06-28 03:00:45 UTC (rev 2192)
@@ -26,7 +26,6 @@
*/
$uri['hide_self'] = true;
-
/*
this decice to show or not the host server when referring to local pages.
default: false
@@ -36,4 +35,19 @@
you may want to hide it.
*/
$uri['hide_host'] = false;
+
+/*
+this is used in case you want to append an extension to the url created.
+This parameter will work only if "hide_self" is set to true
+for example:
+ /bt/category
+will be:
+ /bt/category
+
+default: .html
+
+if set to false it will not add an extension
+
+*/
+$uri['extension'] = '.html';
?>
\ No newline at end of file
Modified: websites/bsdstats.org/bsdstats/lib/bsdstats.php
===================================================================
--- websites/bsdstats.org/bsdstats/lib/bsdstats.php 2008-06-27 21:00:23 UTC (rev 2191)
+++ websites/bsdstats.org/bsdstats/lib/bsdstats.php 2008-06-28 03:00:45 UTC (rev 2192)
@@ -67,5 +67,25 @@
return array('countries'=>$countries,'countries_stats'=>$countries_stats, 'total'=>$total);
}
+
+ public function cpus(){
+ $tmps = $this->db->query('SELECT cpus, count(1) AS cnt FROM cpus GROUP BY cpus ORDER BY cpus;');
+ $cpu_stats = array();
+ while($tmp = $this->db->fetch_array($tmps)){
+ $cpu_stats[$tmp['cpus']] = $tmp['cnt'];
+ }
+
+ $tmps = $this->db->query('SELECT vendor, cpu_type, count(1) AS cnt FROM cpus GROUP BY vendor, cpu_type ORDER BY vendor, cnt DESC;');
+ $vendor_stats = array();
+ $i=0;
+ while($tmp = $this->db->fetch_array($tmps)){
+ $vendor_stats[$i]['vendor'] = $tmp['vendor'];
+ $vendor_stats[$i]['cpu_type'] = $tmp['cpu_type'];
+ $vendor_stats[$i]['total'] = $tmp['cnt'];
+ $i++;
+ }
+
+ return array('cpu_stats'=>$cpu_stats,'vendor_stats'=>$vendor_stats);
+ }
}
?>
\ No newline at end of file
Modified: websites/bsdstats.org/bsdstats/sbin/uri.php
===================================================================
--- websites/bsdstats.org/bsdstats/sbin/uri.php 2008-06-27 21:00:23 UTC (rev 2191)
+++ websites/bsdstats.org/bsdstats/sbin/uri.php 2008-06-28 03:00:45 UTC (rev 2192)
@@ -7,6 +7,7 @@
private $delimiter = '/';
private $hide_self = false;
private $hide_host = false;
+ private $extension = '.html';
/**
* Initialize the uri
@@ -21,6 +22,7 @@
$this->set_delimiter($config->get('uri_delimiter','/'));
$this->set_hide_self($config->get('uri_hide_self',false));
$this->set_hide_host($config->get('uri_hide_host',false));
+ $this->set_extension($config->get('extension','.html'));
$this->_fill_GET();
// $host = $_SERVER['HTTP_HOST'];
@@ -40,6 +42,9 @@
public function set_hide_host($hide_host=false){
$this->hide_host = (bool)$hide_host;
}
+ public function set_extension($extension='.html'){
+ $this->extension = $extension;
+ }
public function check_uri($uri){
if (trim($uri) == '' || (
@@ -130,7 +135,9 @@
''
)
);
-// $request_uri = isset($_SERVER['REQUEST_URI'])?$_SERVER['REQUEST_URI']:'';
+ if($this->hide_self && $this->extension!=false && $this->extension!='' && substr($request_uri,-1*strlen($this->extension))==$this->extension){
+ $request_uri = substr($request_uri,0,-1*strlen($this->extension));
+ }
//remove index
$query_string = preg_replace('/^'.preg_quote(WEBPATH,'/').'('.preg_quote(SELF,'/').'(\/)?)?/','',$request_uri);
if($query_string != '' && $query_string != '/'){
@@ -314,6 +321,9 @@
} else {
$ret = $host.$page.($query!=''?'/'.$query:'');
}
+ if($this->hide_self && $this->extension!=false && $this->extension!=''){
+ $ret .= $this->extension;
+ }
}
return $ret;
}
Modified: websites/bsdstats.org/bsdstats/tpl/bsdstats/country.php
===================================================================
--- websites/bsdstats.org/bsdstats/tpl/bsdstats/country.php 2008-06-27 21:00:23 UTC (rev 2191)
+++ websites/bsdstats.org/bsdstats/tpl/bsdstats/country.php 2008-06-28 03:00:45 UTC (rev 2192)
@@ -1,7 +1,7 @@
<!-- Countries -->
<div id="country">
<h3>Countries</h3>
-<table cellspacing="0" cellpadding="0" class="stats-simple stats-large country">
+<table cellspacing="0" cellpadding="0" class="stats-simple stats-small">
<thead>
<tr>
<th> </th><?php
@@ -17,8 +17,13 @@
</thead>
<tbody><?php
foreach($countries as $country){
+ if(trim($country)==''){
+ $flag = 'unknown';
+ } else {
+ $flag = strtolower($country);
+ }
?><tr>
- <th><img border="0" alt="<?php echo $country?>" src="/images/countries/<?php echo strtolower($country)?>.png"/> <?php echo $country?></th><?php
+ <th class="col_head"><img border="0" alt="<?php echo $country?>" src="/images/countries/<?php echo $flag?>.png"/> <?php echo $country?></th><?php
$tt = 0;
foreach($oss as $os){
?><td><?php
@@ -29,7 +34,7 @@
echo ' ';
}?></td><?php
}
- ?><th><?php echo $format->number($tt)?></th>
+ ?><th class="col_head total"><?php echo $format->number($tt)?></th>
</tr><?php
}
?></tbody>
Added: websites/bsdstats.org/bsdstats/tpl/bsdstats/cpu.php
Modified: websites/bsdstats.org/bsdstats/tpl/bsdstats/foot_menu.php
===================================================================
--- websites/bsdstats.org/bsdstats/tpl/bsdstats/foot_menu.php 2008-06-27 21:00:23 UTC (rev 2191)
+++ websites/bsdstats.org/bsdstats/tpl/bsdstats/foot_menu.php 2008-06-28 03:00:45 UTC (rev 2192)
@@ -6,7 +6,7 @@
<li><a href="#">Release Stats</a></li>
<li><a href="<?php echo $countries_uri?>">Country Stats</a></li>
<li><a href="#">Drivers/HW Stats</a></li>
- <li><a href="#">CPU Stats</a></li>
+ <li><a href="<?php echo $cpus_uri?>">CPU Stats</a></li>
<li><a href="#">Port Stats</a></li>
</ul>
</div>
Modified: websites/bsdstats.org/bsdstats/tpl/bsdstats/menu.php
===================================================================
--- websites/bsdstats.org/bsdstats/tpl/bsdstats/menu.php 2008-06-27 21:00:23 UTC (rev 2191)
+++ websites/bsdstats.org/bsdstats/tpl/bsdstats/menu.php 2008-06-28 03:00:45 UTC (rev 2192)
@@ -11,7 +11,7 @@
<li><a href="#">Release Stats</a></li>
<li><a href="<?php echo $countries_uri?>">Country Stats</a></li>
<li><a href="#">Drivers/HW Stats</a></li>
- <li><a href="#">CPU Stats</a></li>
+ <li><a href="<?php echo $cpus_uri?>">CPU Stats</a></li>
<li><a href="#">Port Stats</a></li>
</ul>
</div>
Modified: websites/bsdstats.org/bsdstats/tpl/css/bsdstats.css
===================================================================
--- websites/bsdstats.org/bsdstats/tpl/css/bsdstats.css 2008-06-27 21:00:23 UTC (rev 2191)
+++ websites/bsdstats.org/bsdstats/tpl/css/bsdstats.css 2008-06-28 03:00:45 UTC (rev 2192)
@@ -99,6 +99,14 @@
height: 50px;
}
+.col_head {
+ text-align:left;
+}
+
+.total{
+ text-align:right;
+}
+
.stats-simple {
border-collapse: collapse;
border: 2px solid #999999;
@@ -144,11 +152,11 @@
clear: both;
padding-top: 1em;
}
-.country th{
+.stats-small th{
font-size: 10px;
padding: 4px;
}
-.country td{
+.stats-small td{
font-size: 10px;
padding: 4px;
}
@@ -202,8 +210,8 @@
div.separ {
clear: both;
height: 3px;
- background: #003366;
border-bottom: 2px solid #eee;
+ width:100%;
}
#instructions{
float:left;
Added: websites/bsdstats.org/bsdstats/tpl/js/functions.js
Added: websites/bsdstats.org/images/countries/tj.png
Property changes on: websites/bsdstats.org/images/countries/tj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: websites/pbidir.com/bibivu/etc/uri.conf.php
===================================================================
--- websites/pbidir.com/bibivu/etc/uri.conf.php 2008-06-27 21:00:23 UTC (rev 2191)
+++ websites/pbidir.com/bibivu/etc/uri.conf.php 2008-06-28 03:00:45 UTC (rev 2192)
@@ -26,7 +26,6 @@
*/
$uri['hide_self'] = true;
-
/*
this decice to show or not the host server when referring to local pages.
default: false
@@ -36,4 +35,19 @@
you may want to hide it.
*/
$uri['hide_host'] = false;
+
+/*
+this is used in case you want to append an extension to the url created.
+This parameter will work only if "hide_self" is set to true
+for example:
+ /bt/category
+will be:
+ /bt/category
+
+default: .html
+
+if set to false it will not add an extension
+
+*/
+$uri['extension'] = '.html';
?>
\ No newline at end of file
Modified: websites/pbidir.com/bibivu/sbin/uri.php
===================================================================
--- websites/pbidir.com/bibivu/sbin/uri.php 2008-06-27 21:00:23 UTC (rev 2191)
+++ websites/pbidir.com/bibivu/sbin/uri.php 2008-06-28 03:00:45 UTC (rev 2192)
@@ -7,6 +7,7 @@
private $delimiter = '/';
private $hide_self = false;
private $hide_host = false;
+ private $extension = '.html';
/**
* Initialize the uri
@@ -21,6 +22,7 @@
$this->set_delimiter($config->get('uri_delimiter','/'));
$this->set_hide_self($config->get('uri_hide_self',false));
$this->set_hide_host($config->get('uri_hide_host',false));
+ $this->set_extension($config->get('extension','.html'));
$this->_fill_GET();
// $host = $_SERVER['HTTP_HOST'];
@@ -40,6 +42,9 @@
public function set_hide_host($hide_host=false){
$this->hide_host = (bool)$hide_host;
}
+ public function set_extension($extension='.html'){
+ $this->extension = $extension;
+ }
public function check_uri($uri){
if (trim($uri) == '' || (
@@ -130,7 +135,9 @@
''
)
);
-// $request_uri = isset($_SERVER['REQUEST_URI'])?$_SERVER['REQUEST_URI']:'';
+ if($this->hide_self && $this->extension!=false && $this->extension!='' && substr($request_uri,-1*strlen($this->extension))==$this->extension){
+ $request_uri = substr($request_uri,0,-1*strlen($this->extension));
+ }
//remove index
$query_string = preg_replace('/^'.preg_quote(WEBPATH,'/').'('.preg_quote(SELF,'/').'(\/)?)?/','',$request_uri);
if($query_string != '' && $query_string != '/'){
@@ -314,6 +321,9 @@
} else {
$ret = $host.$page.($query!=''?'/'.$query:'');
}
+ if($this->hide_self && $this->extension!=false && $this->extension!=''){
+ $ret .= $this->extension;
+ }
}
return $ret;
}
More information about the Commits
mailing list