Changeset 623 in svn for branches/1.3/admin/xcache.tpl.php


Ignore:
Timestamp:
2009-07-05T08:41:16Z (6 years ago)
Author:
Xuefer
Message:

merged r514-r539 from trunk

Location:
branches/1.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3

  • branches/1.3/admin/xcache.tpl.php

    r604 r623  
    11<?php include("header.tpl.php"); ?>
    2 <a href="help.php" target="_blank" id="help"><?php echo _T("Help") ?> &raquo;</a>
    3 <span class="switcher"><?php echo switcher("type", $types); ?></span>
     2<div id="help">
     3    <a href="help.php"><?php echo _T("Help") ?> &raquo;</a>
     4</div>
     5<div class="switcher"><?php echo switcher("type", $types); ?></div>
    46<?php
    57$a = new Cycle('class="col1"', 'class="col2"');
    68$b = new Cycle('class="col1"', 'class="col2"');
    79?>
    8 <?php echo _T('Caches'); ?>:
    910<table cellspacing="0" cellpadding="4" class="cycles">
    10     <col />
    11     <col align="right" />
    12     <col align="right" />
    13     <col align="right" />
    14     <col />
    15     <col />
    16     <col align="right" />
     11    <caption><?php echo _T('Caches'); ?></caption>
     12    <col />
     13    <col align="right" />
     14    <col align="right" />
     15    <col align="right" />
     16    <col />
     17    <col />
     18    <col align="right" />
     19    <col align="right" />
     20    <col align="right" />
     21    <col />
    1722    <col align="right" />
    1823    <col align="right" />
     
    2833        <th><?php echo _T('Size'); ?></th>
    2934        <th><?php echo _T('Avail'); ?></th>
    30         <th><?php echo _T('%'); ?></th>
     35        <th><?php echo _T(isset($free_graph_width) ? '% Free' : '% Used'); ?></th>
    3136        <th><?php echo _T('Clear'); ?></th>
    3237        <th><?php echo _T('Compiling'); ?></th>
    3338        <th><?php echo _T('Hits'); ?></th>
     39        <th><?php echo _T('Hits/H'); ?></th>
     40        <th><?php echo _T('Hits 24H'); ?></th>
     41        <th><?php echo _T('Hits/S'); ?></th>
    3442        <th><?php echo _T('Misses'); ?></th>
    3543        <th><?php echo _T('Clogs'); ?></th>
     
    4856        echo "
    4957        <tr ", $a->next(), ">";
    50         $pavail = (int) ($ci['avail'] / $ci['size'] * 100);
    51         $pused = 100 - $pavail;
     58        $pvalue = (int) ($ci['avail'] / $ci['size'] * 100);
     59        $pempty = 100 - $pvalue;
     60        if (!isset($free_graph_width)) {
     61            // swap
     62            $tmp = $pvalue;
     63            $pvalue = $pempty;
     64            $pempty = $tmp;
     65        }
     66
     67        $w = $graph_width;
     68        if (empty($ci['istotal'])) {
     69            $graph = freeblock_to_graph($ci['free_blocks'], $ci['size']);
     70            $blocksgraph = "<div class=\"blocksgraph\" style=\"width: {$w}px\">{$graph}</div>";
     71        }
     72        else {
     73            $blocksgraph = '';
     74        }
    5275
    5376        $ci_slots = size($ci['slots']);
     
    5578        $ci_avail = size($ci['avail']);
    5679        $ci = number_formats($ci, $numkeys);
    57         $ci['compiling']    = $ci['type'] == $type_php ? ($ci['compiling'] ? 'yes' : 'no') : '-';
    58         $ci['can_readonly'] = $ci['can_readonly'] ? 'yes' : 'no';
     80
     81        $hits_avg_h     = number_format(array_avg($ci['hits_by_hour']), 2);
     82        $hits_avg_s     = number_format(array_avg($ci['hits_by_second']), 2);
     83        $hits_graph_h   = hits_to_graph($ci['hits_by_hour']);
     84        $hits_graph_h_w = count($ci['hits_by_hour']) * 2;
     85
     86        if (!empty($ci['istotal'])) {
     87            $ci['compiling']    = '-';
     88            $ci['can_readonly'] = '-';
     89        }
     90        else {
     91            $ci['compiling']    = $ci['type'] == $type_php ? ($ci['compiling'] ? 'yes' : 'no') : '-';
     92            $ci['can_readonly'] = $ci['can_readonly'] ? 'yes' : 'no';
     93        }
    5994        echo <<<EOS
    6095        <th>{$ci['cache_name']}</th>
     
    6297        <td title="{$ci['size']}">{$ci_size}</td>
    6398        <td title="{$ci['avail']}">{$ci_avail}</td>
    64         <td title="{$pavail} %"><div class="percent"><div style="height: {$pused}%" class="pused">&nbsp;</div><div style="height: {$pavail}%" class="pavail">&nbsp;</div></div></td>
    65         <td>
    66             <form method="post">
    67                 <div>
    68                     <input type="hidden" name="type" value="{$ci['type']}">
    69                     <input type="hidden" name="cacheid" value="{$ci['cacheid']}">
    70                     <input type="submit" name="clearcache" value="{$l_clear}" class="submit" onclick="return confirm('{$l_clear_confirm}');" />
    71                 </div>
    72             </form>
    73         </td>
     99        <td title="{$pvalue} %"
     100            ><div class="percent" style="width: {$w}px"
     101                ><div style="width: {$pvalue}%" class="pvalue"></div
     102                ><div style="width: {$pempty}%" class="pempty"></div
     103            ></div
     104        >{$blocksgraph}</td>
     105        <td
     106            ><form method="post" action=""
     107                ><div
     108                    ><input type="hidden" name="type" value="{$ci['type']}"
     109                    /><input type="hidden" name="cacheid" value="{$ci['cacheid']}"
     110                    /><input type="submit" name="clearcache" value="{$l_clear}" class="submit" onclick="return confirm('{$l_clear_confirm}');"
     111                /></div
     112            ></form
     113        ></td>
    74114        <td>{$ci['compiling']}</td>
    75115        <td>{$ci['hits']}</td>
     116        <td>{$hits_avg_h}</td>
     117        <td><div class="hitsgraph" style="width: {$hits_graph_h_w}px">{$hits_graph_h}</div></td>
     118        <td>{$hits_avg_s}</td>
    76119        <td>{$ci['misses']}</td>
    77120        <td>{$ci['clogs']}</td>
     
    89132    <?php } ?>
    90133</table>
    91 <div>
    92     <?php echo _T('Free Blocks'); ?>:
     134<div class="blockarea legends">
     135    <div class="legendtitle"><?php echo _T('Legends:'); ?></div>
     136    <div class="legend pvalue">&nbsp;&nbsp;</div>
     137    <div class="legendtitle"><?php echo _T(isset($free_graph_width) ? '% Free' : '% Used'); ?></div>
     138    <div class="legend" style="background: rgb(0,0,255)">&nbsp;&nbsp;</div>
     139    <div class="legendtitle"><?php echo _T(isset($free_graph_width) ? 'Free Blocks' : 'Used Blocks'); ?></div>
     140    <div class="legend" style="background: rgb(255,0,0)">&nbsp;&nbsp;</div>
     141    <div class="legendtitle"><?php echo _T('Hits'); ?></div>
    93142</div>
    94 <?php
    95 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     <?php
    102     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 <?php
    115 }
    116 ?>
    117 <div style="clear: both">&nbsp;</div>
    118143<?php
    119144
     
    125150    foreach (array('Cached' => $cachelist['cache_list'], 'Deleted' => $cachelist['deleted_list']) as $listname => $entries) {
    126151        $a->reset();
    127         echo "
    128         <caption>", _T("{$cachelist['type_name']} $listname"), "</caption>";
    129152        ?>
    130153
    131154    <form action="" method="post">
    132     <table cellspacing="0" cellpadding="4" class="cycles entrys" width="100%">
     155    <table cellspacing="0" cellpadding="4" class="cycles entries" width="100%">
     156        <caption><?php echo _T("{$cachelist['type_name']} $listname"); ?></caption>
    133157        <col />
    134158        <col />
Note: See TracChangeset for help on using the changeset viewer.