<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      py:with="px_ti=25+ti_mrgn;px_hd=46;px_dw=36/zoom;px_ch=10;maxtic=len(tickets);px_left=3;px_top=13;px_height=px_top+px_ch;">
  <xi:include href="layout.html" />
  <xi:include href="macros.html" />
  <head>
    <script type="text/javascript" src="${chrome.htdocs_location}js/folding.js"></script>
    <script type="text/javascript">
      jQuery(document).ready(function($) {
        $("fieldset legend.foldable").enableFolding(false);
        /* Hide the filters for saved queries. */
        $("#options").toggleClass("collapsed");
      });
    </script>

    <style type="text/css">
      form fieldset.collapsed { 
        border-width: 0px;
        margin-bottom: 0px;
        padding: 0px .5em;
      }
      fieldset legend.foldable :link,
      fieldset legend.foldable :visited { 
        background: url(${chrome.htdocs_location}expanded.png) 0 50% no-repeat;
        border: none;
        color: #666;
        font-size: 110%;
        padding-left: 16px;
      }
      fieldset legend.foldable :link:hover, fieldset legend.foldable :visited:hover {
        background-color: transparent;
      }
      
      fieldset.collapsed legend.foldable :link, fieldset.collapsed legend.foldable :visited { 
        background-image: url(${chrome.htdocs_location}collapsed.png);  
      }
      fieldset.collapsed table, fieldset.collapsed div { display: none }
      table.list     {width:100%;border-collapse: collapse;margin-bottom: 6px;}
      table.list td  {padding:2px;}
      .border_line   {background-color: gray;}
      .hdr           {position: absolute;background-color: #eee;}
      .hdr_title     {display:block;position: absolute; width:100%;text-align:center;font-size:10px;}
      .bdy           {position: absolute;background-color: #fff;text-align: left;top:${px_hd}px;height:${maxtic*px_ti+px_height}px;}
      .bdy_elem      {position: absolute;font-size: 10px;left:1px;height:${px_ti-2}px;}
      .tic_summary   {position: absolute;font-size: 10px;color: #000; background-color: #fff; height: 11px; line-height: 11px}
      .stripe        {position: absolute; overflow: hidden; background: #f7f7f7;}
      .tip           {position: static;}
      .tip span.popup{position: absolute;visibility: hidden;background-color: #ffe;color: black;border: 1px solid #555;left: 20px;top: 30px;width: 400px; padding: 3px;}
      .tip:hover span.popup
                     {visibility: visible; z-index: 100;font-size: 11px;}

      .tic_done      {position: absolute; overflow: hidden; background:lightgreen;}
      .tic_late      {position: absolute; overflow: hidden; background:pink;}
      .tic_todo      {position: absolute; overflow: hidden; background:lightgrey;}
      .tic_done_bl   {position: absolute; overflow: hidden; background:green;}
      .tic_late_bl   {position: absolute; overflow: hidden; background:red;}
      .tic_todo_bl   {position: absolute; overflow: hidden; background:gray;}

      .baseline      {position: absolute; overflow: hidden; border-left: 1px dashed red;}
      div.milestone  {position: absolute; overflow: hidden; background-color: red;}
    </style>
  </head>
  <body py:with="weekdays = ['월', '화', '수', '목', '금', '토', '일']">
    <form id="query" method="get"
          py:with="field_names = sorted(fields.iterkeys(), key=lambda name: labels[name].lower())">
      <fieldset id="filters">
        <input py:if="'id' in constraints" type="hidden" name="id" value="${constraints['id']}" />
        <legend class="foldable">${_('Filters')}</legend>
        <table summary="${_('Query filters')}">
          <tbody>
            <tr style="height: 1px"><td colspan="4"></td></tr>
          </tbody>
          <py:for each="field_name in field_names" py:with="field = fields[field_name]">
            <py:for each="constraint_name, constraint in constraints.items()">
              <tbody py:if="field_name == constraint_name"
                py:with="multiline = field.type in ('select', 'text', 'textarea')">
                <py:for each="constraint_idx, constraint_value in enumerate(constraint['values'])">
                  <tr class="${field_name}" py:if="multiline or constraint_idx == 0">
                    <py:choose test="constraint_idx">
                      <py:when test="0">
                        <th scope="row"><label>$field.label</label></th>
                        <td py:if="field.type not in ('radio', 'checkbox')" class="mode">
                          <select name="${field_name}_mode">
                            <option py:for="mode in modes[field.type]" value="$mode.value"
                              selected="${mode.value == constraint.mode and 'selected' or None}">$mode.name
                            </option>
                          </select>
                        </td>
                      </py:when>
                      <py:otherwise><!--! not the first line of a multiline constraint -->
                        <th colspan="2"><label>or</label></th>   <!--! FIXME: splited_phrase -->
                      </py:otherwise>
                    </py:choose>

                    <td class="filter" colspan="${field.type in ('radio', 'checkbox') and 2 or None}"
                        py:choose="">

                      <py:when test="field.type == 'select'">
                        <select name="${constraint_name}">
                          <option></option>
                          <option py:for="option in field.options"
                            selected="${option == constraint_value and 'selected' or None}">$option
                          </option>
                        </select>
                      </py:when>

                      <py:when test="field.type == 'radio'">
                        <py:for each="option in field.options">
                          <input type="checkbox" id="${field_name}_$option" name="${field_name}"
                            value="$option"
                            checked="${any([(value == option) == (constraint.mode == '')
                                            for value in constraint['values']]) and 'checked' or None}" />
                          <label for="${field_name}_$option">${option or 'none'}</label>
                        </py:for>
                      </py:when>

                      <py:when test="field.type == 'checkbox'">
                        <input type="radio" id="${field_name}_on" name="$field_name" value="1"
                               checked="${constraint.mode != '!' or constraint_value == '1' or None}" />
                        <label for="${field_name}_on">${_('yes')}</label>
                        <input type="radio" id="${field_name}_off" name="$field_name" value="0"
                               checked="${constraint.mode == '!' or constraint_value != '1' or None}" />
                        <label for="${field_name}_off">${_('no')}</label>
                      </py:when>

                      <py:when test="field.type in ('text', 'textarea')">
                        <input type="text" name="${field_name}" value="$constraint_value" size="42" />
                      </py:when>

                    </td>
                    <td class="actions"
                        py:with="rm_idx = multiline and constraint_idx or len(constraint['values']) - 1"><input
                        type="submit" name="rm_filter_${field_name}${field.type != 'radio' and '_%d' % rm_idx or ''}"
                        value="-" /></td>
                  </tr>
                </py:for>
              </tbody>
            </py:for>
          </py:for>

          <tbody>
            <tr class="actions">
              <td class="actions" colspan="4" style="text-align: right">
                <label for="add_filter">${_('Add filter')}</label>&nbsp;
                <select id="add_filter">
                  <option></option>
                  <option py:for="field_name in field_names" py:with="field = fields[field_name]"
                          value="$field_name"
                          disabled="${(field.type == 'radio' and
                                       field_name in constraints and
                                       len(constraints[field_name])) or None}">
                    ${field.label}
                  </option>
                </select>
                <input type="submit" name="add" value="+" />
              </td>
            </tr>
          </tbody>
        </table>
      </fieldset>
      <fieldset id="options" style="font-size:100%">
        <legend class="foldable">${_('설정')}</legend>
        <table class="list">
          <tr>
            <td>
              ${_('기준일')} &nbsp;
              <input type="text" id="field-baseday" name="baseday" value="${baseday.strftime(dateFormat)}" length="10" style="font-size:100%"/>
            </td>
          </tr>
          <tr>
            <td>
              ${_('정렬기준')}
              <select name="sorted_field" style="font-size:100%">
                <option value="milestone" selected="${sorted_field=='milestone' or None}">${_('마일스톤')}</option>
                <option value="component" selected="${sorted_field=='component' or None}">${_('컴포넌트')}</option>
              </select><br/>
            </td>
          </tr>
          <tr>
            <td>
              ${_('조회대상')}
              ${_('마일스톤 = ')}
              <select name="selected_milestone">
              <py:for each="i in milestones.keys()">
                <option selected="${selected_milestone==i or None}" value="$i">$i</option>
              </py:for>
              </select>
              AND 
              ${_('컴포넌트 =')}
              <select name="selected_component">
              <py:for each="i in components">
                  <option selected="${selected_component==i.name or None}" value="${i.name}">${i.name}</option>
              </py:for>
              </select>
            </td>
          </tr>
          <tr>
            <td>
              <input type="checkbox" name="show_my_ticket" checked="$show_my_ticket" />${_('자신의 티켓만 조회')}
              <input type="checkbox" name="show_closed_ticket" checked="$show_closed_ticket" />${_('close한 티켓 포함')}
              &nbsp; &nbsp;
              <input type="checkbox" name="show_ticket_summary" checked="$show_ticket_summary" />${_('티켓 제목')}
              <input type="checkbox" name="show_ticket_status" checked="$show_ticket_status" />${_('티켓 상태')}<br/>
  
            </td>
            <td align="right" valign="bottom">
              <input type="submit" value="${_('조회하기')}" />
            </td>
          </tr>
        </table>
      </fieldset>
      <table class="list">
        <tr>
          <td>
            <input type="button" value="&lt;&lt; ${prev.month}${_('월')}" ACCESSKEY="J" onclick="form.year.value = ${prev.year}; form.month.value = ${prev.month}; form.submit();"/>
          </td>
          <td align="center">
            <select name="year">
              <option py:for="y in range(current.year-3,current.year+4)"
                     value="$y"
                     selected="${y==current.year or None}">$y</option>
            </select>
            ${_('년')}
            <select name="month">
              <option py:for="m in [1,2,3,4,5,6,7,8,9,10,11,12]"
                     value="$m" selected="${m==current.month or None}">$m</option>
            </select>
            ${_('월')}
            <input type="submit" value="${_('조회하기')}" />
            <label ACCESSKEY="M" onclick="form.year.value = ${date.today().year}; form.month.value = ${date.today().month}; form.submit();"/>
          <py:choose>
            <input py:when="zoom &gt; 1" type="image" ACCESSKEY="I" onclick="form.zoom.value = ${zoom-1};" src="${href.chrome('tc/img/zoom_in.png')}" alt="${_('확대')}"/>
            <input py:otherwise="" type="image" disabled="disabled" src="${href.chrome('tc/img/zoom_in_g.png')}"/>
          </py:choose>
            <label ACCESSKEY="N" onclick="form.zoom.value = ${normal}; form.submit();">${zoom}</label>
          <py:choose>
            <input py:when="zoom &lt; 6" type="image" ACCESSKEY="K" onclick="form.zoom.value = ${zoom+1};" src="${href.chrome('tc/img/zoom_out.png')}" alt="${_('축소')}"/>
            <input py:otherwise="" type="image" disabled="disabled" src="${href.chrome('tc/img/zoom_out_g.png')}"/>
          </py:choose>
            <input name="normal" type="hidden" value="${normal}" />
            <input name="zoom" type="hidden" value="${zoom}" />
          </td>
          <td align="right">
            <input type="button" value="${next.month}월 &gt;&gt;" ACCESSKEY="L" onclick="form.year.value = ${next.year}; form.month.value = ${next.month}; form.submit();"/>
          </td>
        </tr>
      </table>
    </form>
    <script type="text/javascript">
      var properties={
      <py:for each="(field_name, field), sep in separated(fields.iteritems())">
        $field_name: { type: "${javascript_quote(field.type)}", label: "${javascript_quote(field.label)}", name: "${javascript_quote(field.name)}"
        <py:if test="'options' in field">, options: [
          <py:for each="option, sep in separated(field.options)">"${javascript_quote(option)}"$sep
          </py:for>]
        </py:if>}$sep
      </py:for>
      };
      var modes = {
      <py:for each="(type_name, type_modes), sep in separated(modes.iteritems())">
        $type_name: [
        <py:for each="mode, sep in separated(type_modes)">
          {text: "${javascript_quote(mode.name)}", value: "${javascript_quote(mode.value)}"}$sep
        </py:for>
          ]$sep
      </py:for>
      };
      initializeFilters();
    </script>
    <div py:if="sum_estimatedhours != None" style="font-size:11px;">
      &nbsp; ${_('소요시간 합계')}: ${sum_totalhours}h &nbsp;/&nbsp; ${_('추정시간 합계')}: ${sum_estimatedhours}h
    </div>
    <!-- gantt -->
    <div style="position:relative;left:1px;top:1px;width:100%;height:${maxtic*px_ti+px_hd+1+40+px_height}px;">
      <!-- right side -->
      <div style="overflow:auto;margin-left:308px;margin-right:4px;position:relative;left:0px;top:1px;height:${maxtic*px_ti+px_hd+1+30+px_height}px;">
        <div class="border_line" style="left:0px;top:1px;width:${px_dw*days_term+1}px;height:${maxtic*px_ti+px_hd+1+px_height}px;">
          <!-- head and sun,sta,holiday -->
          <div class="bdy" style="position:relative;left:1px;top:${px_hd}px;width:${px_dw*days_term-1}px;height:${maxtic*px_ti+px_height}px;"/>
            <!-- back ground stripe -->
<py:for each="cnt in reversed(range(maxtic))">
  <py:if test="(cnt%2)!=0">
            <div class="stripe" style="left: 1px; top: ${px_ti*cnt+px_hd+px_top}px; width: ${px_dw*days_term-1}px; height: ${px_ti}px;"></div>
  </py:if>
</py:for>
<py:for each="cnt in reversed(range(days_term))" py:with="cur=first_date+timedelta(cnt);wk=cur.weekday()">
          <div py:if="cur.day == 1" py:with="days_thismonth=calendar.monthrange(cur.year,cur.month)[1];" class="hdr hdr_title" style="left:${px_dw*cnt+1}px;top:${(px_hd-4)/3*0+1}px;width: ${days_thismonth*px_dw-1}px;height:${(px_hd-4)/3}px;">${cur.year}/${cur.month}</div>
          <div py:if="wk==first_wkday and(cur-first_date).days+7&lt;=days_term" class="hdr hdr_title" style="left:${px_dw*cnt+1}px;top:${(px_hd-4)/3*1+2}px;width: ${px_dw*7-1}px;height:${(px_hd-4)/3}px;">${cur.month}/${cur.day}</div>
          <div py:if="wk==first_wkday and(cur-first_date).days+7&gt;days_term" class="hdr hdr_title" style="left:${px_dw*cnt+1}px;top:${(px_hd-4)/3*1+2}px;width: ${px_dw*(days_term-(cur-first_date).days)-1}px;height:${(px_hd-4)/3}px;"/>
        <py:choose>
          <div py:when="zoom &lt; 4" class="hdr hdr_title" style="left:${px_dw*cnt+1}px;top:${(px_hd-4)/3*2+3}px;width: ${px_dw-1}px;height:${(px_hd-4)/3}px;">${weekdays[wk]}</div>
          <div py:otherwise="" class="hdr hdr_title" style="left:${px_dw*cnt+1}px;top:${(px_hd-4)/3*2+3}px;width: ${px_dw-1}px;height:${(px_hd-4)/3}px;" />
        </py:choose>

  <py:with vars="holiday_desc = holidays.get(cur.isoformat());">
    <py:if test="cur.weekday()&gt;4or holiday_desc">
          <div class="border_line" style="position:absolute;top:${px_hd}px; left: ${px_dw*cnt}px; width: ${px_dw+1}px; height: ${maxtic*px_ti+1+px_height}px;">
            <div class="hdr" py:attrs="{'title':holiday_desc}" style="top:0px; left:1px; width: ${px_dw-1}px; height: ${maxtic*px_ti+px_height}px;"/>
          </div>
    </py:if>
  </py:with>
          <div py:if="zoom &lt; 3" class="hdr hdr_title" style="left:${px_dw*cnt+1}px;top:${px_hd}px;width: ${px_dw-1}px;height:${(px_hd-4)/3}px;">${cur.day}</div>
</py:for>
          <div py:if="first_date.weekday() &lt; first_wkday" class="hdr hdr_title" style="left:1px;top:${(px_hd-4)/3*1+2}px;width: ${px_dw*(first_wkday-first_date.weekday())-1}px;height:${(px_hd-4)/3}px;"/>
          <div py:if="first_date.weekday() &gt; first_wkday" class="hdr hdr_title" style="left:1px;top:${(px_hd-4)/3*1+2}px;width: ${px_dw*(first_wkday+7-first_date.weekday())-1}px;height:${(px_hd-4)/3}px;"/>
          <!-- chart -->
<py:def function="print_chart(kind)">
  <py:with vars="s=tickets[cnt].get('all_start');e=tickets[cnt].get(kind +'_end');t=tickets[cnt];">
    <py:if test="e!=None and e-s!= 0">
        <py:with vars="tic_due='(%d/%d ~ %d/%d)' % (t['due_assign'].month, t['due_assign'].day, t['due_close'].month, t['due_close'].day );
                       tic_tip='%s #%d: %s - %s %s%s' % (t['type'], t['id'], t['summary'], format_author(t['owner']), tic_due, (t['estimatedhours']!=None and ' '+ str(t['estimatedhours']) +'h' or '') );">
          <div class="${'tic_'+kind+'_bl'}" style="left:${int(s*px_dw+1)}px;top:${px_ti*cnt+px_hd+((px_ti-px_ch)/2)+(ti_mrgn/2)+px_top}px;width: ${int((e-s)*px_dw)}px;height:${px_ch}px;"/>
          <div class="${'tic_'+kind}" py:attrs="{'title':tic_tip}" style="left:${int(s*px_dw+2)}px;top:${px_ti*cnt+px_hd+((px_ti-px_ch)/2+1)+(ti_mrgn/2)+px_top}px;width: ${int((e-s)*px_dw)-2}px;height:${px_ch-2}px;"/>
        </py:with>
    </py:if>
  </py:with>
</py:def>
<py:def function="print_ticket_summary()">
  <py:with vars="s=tickets[cnt].get('all_start');e=tickets[cnt].get('all_end');t=tickets[cnt];">
    <py:if test="e!=None and e-s!= 0">
        <py:with vars="tic_due='(%d/%d ~ %d/%d)' % (t['due_assign'].month, t['due_assign'].day, t['due_close'].month, t['due_close'].day );
                       tic_tip='%s #%d: %s - %s %s%s' % (t['type'], t['id'], t['summary'], format_author(t['owner']), tic_due, (t['estimatedhours']!=None and ' '+ str(t['estimatedhours']) +'h' or '') );">
          <div py:if="show_ticket_summary == 'on'" py:attrs="{'title': _('상세설명:  %s') % (t['description'] )}" class="tic_summary" style="left:${int(s*px_dw+1)+2}px;top:${px_ti*cnt+px_hd+(px_ti-px_ch)/2+(ti_mrgn/2+1)}px;">
            <a href="${req.href.ticket()}/${t['id']}">
              ${t['type']} <s py:strip="t['status']!='closed'">#${t['id']}</s>: ${t['summary'][0:20]}<span py:if="len(t['summary'])>20">...</span>
              ${tic_due}<span py:if="t['estimatedhours']!=None"> ${t['estimatedhours']}h</span>
            </a>
          </div>
          <div py:if="show_ticket_status == 'on'" py:attrs="{'title':tic_tip}" py:choose="" class="tic_summary" style="left:${int(e*px_dw)+5}px;top:${px_ti*cnt+px_hd+(px_ti-px_ch)/2+(ti_mrgn/2-1)+px_top}px;">
            ${t['status']}<span py:when="t['status']!='closed'"> ${t['complete']}%</span><span py:otherwise="">: ${t['resolution']}</span><span py:if="t['estimatedhours']!=None"> ${t['totalhours']}h</span>
          </div>
        </py:with>
    </py:if>
  </py:with>
</py:def>
<py:if test="show_ticket_status == 'on' or show_ticket_summary == 'on'">
  <py:for each="cnt in range(maxtic)">
          ${print_ticket_summary()}
  </py:for>
</py:if>
<py:for each="cnt in reversed(range(maxtic))">
          ${print_chart('todo')}
          ${print_chart('late')}
          ${print_chart('done')}
  <py:if test="'MILESTONE_VIEW' in req.perm and (sorted_field == 'milestone' or (selected_milestone != '' and selected_milestone != None))">
    <py:if test="tickets[cnt].get('milestone')!= None and tickets[cnt].get('milestone') in milestones" py:with="d= milestones[tickets[cnt]['milestone']].get('due')">
      <py:if test="d!=None and 0 &lt;= (d-first_date).days+1 &lt; days_term" py:with="d=(d-first_date).days+1">
          <div py:if="show_ticket_summary != 'on'" class="milestone" style="left: ${d*px_dw}px; top: ${cnt*px_ti+px_hd+px_top}px;  width: 2px; height: ${px_ti}px;"></div>
      </py:if>
    </py:if>
  </py:if>
</py:for>
<py:with vars="base = (baseday-first_date).days+1">
          <!-- baseline -->
          <div py:if="base &lt; days_term" class="baseline" style="left:${base*px_dw}px;top:${px_hd}px; height:${maxtic*px_ti+px_height}px; width: 0px;"/>
</py:with>
        </div>
      </div>
      <!-- left side -->
      <div style="position:absolute;background-color:gray;left:1px;top:1px;width:304px;height:${maxtic*px_ti+px_hd+1+px_height}px;">
        <div py:choose="" class="hdr" style="left:1px;top:1px;width: 89px;height:${px_hd-2}px;">
          <span class="hdr_title" style="top:${(px_hd-2-16)/2}px;font-size:12px;">
            <span py:when="sorted_field=='milestone'">${_('마일스톤')}</span><span py:otherwise="">${_('컴포넌트')}</span>
          </span>
        </div>
        <div class="hdr" style="left:91px;top:1px;width:104px;height:${px_hd-2}px;"><span class="hdr_title" style="top:${(px_hd-2-16)/2}px;font-size:12px;">${_('티 켓')}</span></div>
        <div class="hdr" style="left:196px;top:1px;width:107px;height:${px_hd-2}px;"><span class="hdr_title" style="top:${(px_hd-2-16)/2}px;font-size:12px;">${_('담당자')}</span></div>

<py:def function="print_field(px_x,px_w,ticket_col,dupchk=False)">
        <div class="bdy" style="left:${px_x}px;width:${px_w}px;">
  <py:for each="cnt in reversed(range(maxtic))" py:with="t=tickets[cnt]">
    <py:choose>
      <py:when test="ticket_col=='ticket'">
        <py:if test="(cnt%2)!=0">
          <div class="stripe" style="top: ${cnt*px_ti+px_top}px;width: ${px_w}px; height: ${px_ti}px;"></div>
        </py:if>
          <div class="bdy_elem" style="top: ${cnt*px_ti+px_top}px;left: ${px_left-1}px;width: ${px_w-2}px;">
            <a class="tip" href="${req.href.ticket()}/${t['id']}"><s py:strip="t['status']!='closed'">#${t['id']}</s>:${t['summary'][0:10]}<span py:if="len(t['summary'])>10">...</span>
              <span class="popup">
                <br/>
                <s py:strip="t['status']!='closed'">  <span class="type">${t['type']}</span> #${t['id']}</s>: ${t['summary']}<br/>
                <br/>
                <strong>${_('시작일')}</strong> &nbsp; :      ${t['due_assign'].strftime(dateFormat)}
                  <span py:if="t['status']!='closed'">(<span class="status">${t['status']}</span> ${t['complete']}%)</span><br/>
                <strong>${_('완료기한')}</strong>:            ${t['due_close'].strftime(dateFormat)}
                  <span py:if="t['status']=='closed'">(<span class="status">${t['status']}</span>: <span class="resolution">${t['resolution']}</span>)</span><br/>
                <strong>${_('담당자')}</strong> &nbsp; :      ${format_author(t['owner'])}<br/>
                <strong>${_('우선순위')}</strong>:            <span class="priority">${t['priority']}</span><br/>
              <py:if test="t['estimatedhours']!=None">
                <strong>${_('소요시간')}</strong>: ${t['totalhours']}h &nbsp;/&nbsp; <strong>${_('추정시간')}</strong>: ${t['estimatedhours']}h<br/>
              </py:if>
                <pre> ${t['description']}</pre>
              </span>
            </a>
          </div>
      </py:when>
      <py:otherwise>
        <py:choose>
          <py:when test="dupchk">
            <py:if test="(cnt%2)!=0">
          <div class="stripe" style="top: ${cnt*px_ti+px_top}px;width: ${px_w}px; height: ${px_ti}px;"></div>
            </py:if>
          <div py:if="not cnt or t[ticket_col]!=tickets[cnt-1][ticket_col]" class="bdy_elem" style="top:${cnt*px_ti+px_top}px;left: ${px_left}px;width: ${px_w-2}px;">
              <span py:choose="">
                <span py:when="ticket_col=='milestone' and 'MILESTONE_VIEW' in req.perm">
                <a py:strip="t['milestone']=='*'" class="tip" href="${req.href.milestone()}/${t['milestone']}">${t['milestone']}
                  <span py:if="t['milestone']!='*'" py:with="m=milestones[t['milestone']]" class="popup">
                    <br/>
                    <img src="${href.chrome('tc/img/package.png')}" />${t['milestone']}<br/>
                    <br/>
                    <strong>${_('완료 기한')}</strong>: <span py:if="m['due'] != None">${m['due'].strftime(dateFormat)}</span><br/>
                    <pre> ${m['description']}</pre>
                  </span>
                </a>
                </span>
                <span py:otherwise="">${t[ticket_col]}</span>
              </span>
          </div>
          </py:when>
          <py:otherwise>
            <py:if test="(cnt%2)!=0">
          <div class="stripe" style="top: ${cnt*px_ti+px_top}px;width: ${px_w}px; height: ${px_ti}px;"></div>
            </py:if>
          <div class="bdy_elem" style="top: ${cnt*px_ti+px_top}px;left: ${px_left}px;width: ${px_w-2}px;">${ticket_col in ('owner','reporter') and format_author(t[ticket_col]) or t[ticket_col]}</div>
          </py:otherwise>
        </py:choose>
      </py:otherwise>
    </py:choose>
  </py:for>
        </div>
</py:def>

        ${print_field( 196,107,'owner')}
        ${print_field(  91,104,'ticket')}
        ${print_field(   1, 89,sorted_field,dupchk=True)}

      </div>
    </div>
    <!-- gantt -->
  </body>
</html>
