<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="macros.html" />
<xi:include href="layout.html" />
<head>
<title>${_('Available Projects')}</title>
</head>
<body>
<div id="content">

<h1>${_('Available Projects')}</h1>
<p>このTrac上で利用しているプロジェクトのサマリです</p>

<div class="tram-project-list">
<py:for each="project in projects">

<div class="tram-project" style="width:280px;height: 120px;">
 <py:if test="project.href">

<div style="width:278px;">
   <a class="tram-title" href="$project.href" title="$project.description">
    $project.name</a>
    <span class="tram-description">$project.description</span>
</div>
    <div class="tram-data" style="width:220px;">
      <table style="text-align:left; width:210px; border-collapse:collapse">
        <tr><th></th><th>当月</th><th>${_('total')}</th></tr>
        <tr><td>コミット</td><td>${project['stats.changes_month']}</td><td>${project['stats.changes']}</td></tr>
        <tr><td>${_('Tickets')}</td><td>${project['stats.tickets_month']} (${project['stats.tickets_closed_month']})</td>
        <td>${project['stats.tickets']} (${project['stats.tickets_closed']})</td></tr>
      </table>
    </div> 

   <div class="tram-chart">
      <div class="tram-chart-month" style="background-color: ${bar_color}; width:${project['stats.score_month'] * 2 }px"><!-- dummy for IE --></div>
     <div class="tram-chart-total" style="background-color: ${bar_color}; width:${project['stats.score'] * 2 }px"><!-- dummy for IE --></div>
    </div>
     </py:if><py:if test="not project.href">

   <a name="dummy" class="tram-title">$project.name : <em>Error</em></a>
    <span class="tram-error">$project.description</span></py:if>

</div>

</py:for>
</div>

<div class="tram-beneath">
<p>チャートは各プロジェクトのアクティビティのレベルを示します。<br />
表の上段は1ヵ月の活動を示し、下段は全体の活動を示します。</p></div>
</div>
<py:if test="show_tickets_in_project_list">
<py:if test="authname != 'anonymous'">
<table border="0" cellpadding="3" cellspacing="0">
<tbody><tr>
<td id="mine" align="center"><a style="text-decoration:none;" href="?query=mine">${_('Show My Tickets')}</a></td>
<td id="reported_by_me" align="center"><a style="text-decoration:none;" href="?query=reported_by_me">${_('Tickets Reported by Me')}</a></td>
</tr>
</tbody></table>
<table border="0" cellpadding="15" cellspacing="0" height="200" width="100%">
<tbody><tr>
<td bgcolor="#ffffc0" valign="top">
<div id="mytickets">
<span id="loading"><img src="${tram_htdocs_location}chrome/tram/indicator.gif" /></span>
</div>
</td>
</tr>
</tbody></table>
<script type="text/javascript">
$(function (){
    $("span#loading").hide();
    $("span#loading").ajaxStart(function(){ $(this).show(); });
    $("span#loading").ajaxStop(function(){ $(this).hide(); });

    var display_func = function(){
        return function(data, status) {
            var temp_elem = $(document.createElement("div"));
            temp_elem.html(data);
            var res_elem = $("div#content",temp_elem);
            $('h1', res_elem).remove();
            $("div#mytickets").append(res_elem);
            if(${expand}){
              $("h2").click(function(){
                 $(this).next().toggle('fast');
                 return false;
              }).next().show();
            } else {
              $("h2").click(function(){
                 $(this).next().toggle('fast');
                 return false;
              }).next().hide();
            }
       }
    } 

    params=location.search.substr(1).split(unescape("%26"));
    if(params[0]=="query=reported_by_me") {
        query="reported_by_me";
        $("td#mine").addClass("tram-tab-inactive");
        $("td#reported_by_me").addClass("tram-tab-active");
    } else {
        query = "mine";
        $("td#mine").addClass("tram-tab-active");
        $("td#reported_by_me").addClass("tram-tab-inactive");
    } 
    var request_uri = "./all/query?query="+query;
    $.get(request_uri, display_func());
});
</script>
</py:if>
</py:if>
</body>
</html>
