Changeset 517
- Timestamp:
- 2008-02-17T11:52:38+01:00 (5 years ago)
- Location:
- trunk/admin
- Files:
-
- 5 edited
-
common.php (modified) (1 diff)
-
config.php.example (modified) (1 diff)
-
xcache.css (modified) (1 diff)
-
xcache.php (modified) (1 diff)
-
xcache.tpl.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/common.php
r418 r517 109 109 $lang = 'en-us'; 110 110 } 111 if (!isset($free_graph_width)) { 112 $free_graph_width = 120; 113 } 111 114 112 115 ?> -
trunk/admin/config.php.example
r161 r517 11 11 // developers only 12 12 $show_todo_strings = false; 13 14 // width of graph for free blocks 15 $free_graph_width = 120; 13 16 14 17 // this function is detected by xcache.tpl.php, and enabled if function_exists -
trunk/admin/xcache.css
r371 r517 20 20 .freeblocks td { text-align: right; } 21 21 form {margin: 0; padding: 0} 22 .percent { border: 1px solid black; width: 80%; height: 20px; } 23 .percent div { font-size: 1px; line-height: 1px; width: 100%;} 24 .percent .pavail { background: blue; } 22 23 .percent { height: 3px; margin-bottom: 1px; background: gray; border: 1px solid gray; border-top: 0px; border-bottom: 0px; } 24 .percent div { float: left; height: 100%; } 25 .percent .pavail { background: green; } 26 27 .usagegraph { height: 16px; } 28 .usagegraph div { float: left; height: 3px; width: 4px; border: solid gray; border-width: 0 0px 1px 0; } 29 .usagegraph { border: 1px solid gray; border-bottom: 0px; } 30 25 31 .switcher, h1, h2 { text-align: center; display: block; } 26 32 .switcher * { color: blue; } -
trunk/admin/xcache.php
r421 r517 73 73 74 74 return '0 s'; 75 } 76 77 function freeblock_to_graph($freeblocks, $size) 78 { 79 global $free_graph_width; 80 81 // cached in static variable 82 static $graph_initial; 83 if (!isset($graph_initial)) { 84 for ($i = 0; $i < $free_graph_width; $i ++) { 85 $graph_initial[$i] = 0; 86 } 87 } 88 $graph = $graph_initial; 89 foreach ($freeblocks as $b) { 90 $begin = $b['offset'] / $size * $free_graph_width; 91 $end = ($b['offset'] + $b['size']) / $size * $free_graph_width; 92 93 $graph[(int) $begin] += 1 - ($begin - (int) $begin); 94 $graph[(int) $end] += ($end - (int) $end); 95 for ($i = (int) $begin + 1, $e = (int) $end; $i < $e; $i ++) { 96 $graph[$i] = 1; 97 } 98 } 99 $html = array(); 100 $c = 255; 101 foreach ($graph as $k => $v) { 102 $v = (int) ($v * $c); 103 $r = $g = $c - $v; 104 $b = $c; 105 $html[] = '<div style="background: rgb(' . "$r,$g,$b" . ')"></div>'; 106 } 107 return implode('', $html); 75 108 } 76 109 -
trunk/admin/xcache.tpl.php
r456 r517 51 51 $pused = 100 - $pavail; 52 52 53 $graph = freeblock_to_graph($ci['free_blocks'], $ci['size']); 54 $w = $free_graph_width; 55 $tdwidth = $w + 2; 56 53 57 $ci_slots = size($ci['slots']); 54 58 $ci_size = size($ci['size']); … … 62 66 <td title="{$ci['size']}">{$ci_size}</td> 63 67 <td title="{$ci['avail']}">{$ci_avail}</td> 64 <td title="{$pavail} %"><div class="percent"><div style="height: {$pused}%" class="pused"> </div><div style="height: {$pavail}%" class="pavail"> </div></div></td> 68 <td title="{$pavail} %" width="{$tdwidth}" 69 ><div class="percent" style="width: {$w}px" 70 ><div style="width: {$pavail}%" class="pavail"></div 71 ><div style="width: {$pused}%" class="pused"></div 72 ></div 73 ><div class="usagegraph" style="width: {$w}px">{$graph}</div 74 ></td> 65 75 <td> 66 76 <form method="post"> … … 89 99 <?php } ?> 90 100 </table> 91 <div>92 <?php echo _T('Free Blocks'); ?>:93 </div>94 <?php95 foreach ($cacheinfos as $i => $ci) {96 $b->reset();97 ?>98 <table cellspacing="0" cellpadding="4" class="cycles freeblocks">99 <tr>100 <th><?php echo $ci['cache_name']; ?> <?php echo _T("size"); ?><br><?php echo _T("offset"); ?></th>101 <?php102 foreach ($ci['free_blocks'] as $block) {103 $size = size($block['size']);104 $offset = size($block['offset']);105 106 $c = $b->next();107 echo "108 <td $c><nobr>$size<br>$offset</nobr></td>";109 }110 ?>111 112 </tr>113 </table>114 <?php115 }116 ?>117 101 <div style="clear: both"> </div> 118 102 <?php
Note: See TracChangeset
for help on using the changeset viewer.

