#*
 * Aipo is a groupware program developed by Aimluck,Inc.
 * Copyright (C) 2004-2010 Aimluck,Inc.
 * http://aipostyle.com/
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *#

## ---------------------------------------------------------------------------
#set ($newUrl1 = $!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoFormScreen").addQueryData("entityid","new")))
#set ($newUrl2 = $!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoCategoryFormScreen").addQueryData("entityid","new")))
#set ($submenulist = [["ToDoを追加する","javascript:aipo.common.showDialog('$newUrl1','$!portlet.ID',aipo.todo.onLoadTodoDialog);","images/icon/icon_add.gif"], ["カテゴリを追加する","javascript:aipo.common.showDialog('$newUrl2','$!portlet.ID',aipo.todo.onLoadCategoryDialog);","images/icon/icon_add.gif"]])
#set ($tabs = [["未完了ToDo", "list","$!jslink.getPortletById($!portlet.ID).addQueryData('template','ToDoListScreen').addQueryData('tab','list')"], ["完了ToDo", "complete", "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ToDoListScreen').addQueryData('tab','complete')"]])
#set ($indicator_id = "indicator-list-")
## ---------------------------------------------------------------------------
#ALsubmenubar($submenulist "")
#ALajaxtabheader($tabs $!result.currentTab)
#ALspacebothheader()
#ALajaxIndicator("${indicator_id}" "$!{portlet.ID}" "")
<div id="listmessageDiv"></div>
#ALajaxlistformheader('ToDo')
#ALtableheaderSimpleWide()
#ALtdcaption('カテゴリ')
#ALtditemheader()
<select onchange="aipo.viewPage(this.options[this.selectedIndex].value, '$!portlet.ID')">
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoListScreen").addQueryData("filter","").addQueryData("filtertype","category"))">（全体）</option>
#foreach( $record in $result.CategoryList )
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoListScreen").addQueryData("filter",$!record.CategoryId).addQueryData("filtertype","category"))" #if ($!result.CurrentFilter && $!result.CurrentFilter == $!record.CategoryId.toString()) selected="selected" #end>$!record.CategoryName</option>
#end
</select>
#ALtditemfooter()
#ALtablefooter()
#if($result.List.size() == 0)
<div class="message">指定された条件に該当するToDoはありません。</div>
#else
#ALajaxpageview('ToDoListScreen' $result)
#ALtableheaderWide()
<tr>
#ALtdheadThin("#ALswitchCheckbox()")
#ALtdheadThin("#ALajaxsort('priority' '優先度' $result 'ToDoListScreen')")
#ALtdheadW33("#ALajaxsort('todo_name' 'ToDo名' $result 'ToDoListScreen')")
#ALtdheadW33("#ALajaxsort('category_name' 'カテゴリ' $result 'ToDoListScreen')")
#ALtdheadThin("#ALajaxsort('end_date' '締め切り日' $result 'ToDoListScreen')")
#ALtdheadThin("#ALajaxsort('state' '進捗' $result 'ToDoListScreen')")
#ALtdheadThin(' ')
</tr>
#foreach ($record in $result.List)
#if($!result.currentTab == "list")
#set($limitState = ${record.limitState.Value})
#if($result.isMatch(0, $limitState)) 
#set($lsStyle = ' style="background-color:#FFFFE5"')
#elseif($result.isMatch(1, $limitState))
#set($lsStyle = ' style="background-color:#FFE5E5"')
#else
#set($lsStyle = '')
#end
#else
#set($lsStyle = '')
#end
<tr $lsStyle>
#ALtdcellAtt("<input name='check$!record.TodoId' type='checkbox' value='$!record.TodoId'/>" 'align="center"')
#ALtdcellAtt("<img src='images/todo/$!record.PriorityImage' alt='$!record.PriorityString'  title='$!record.PriorityString'/>" 'align="center"')
#ALtdcellheader()
<a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoDetailScreen").addQueryData("entityid",$record.TodoId))');">$!record.TodoName</a>
#if(! $record.Public)
<img src="images/todo/todo_secret.gif" border="0" width="16" height="16" align="absmiddle" alt="非公開" title="非公開"/>
#end
#ALtdcellfooter()
#ALtdcellheader()
#if ($!record.CategoryId.toString() != "1")
<a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoCategoryDetailScreen").addQueryData("entityid",$record.CategoryId))');">$!record.CategoryName</a>
#else
$!record.CategoryName
#end
#ALtdcellfooter()
#ALtdcellAtt($!record.EndDate 'nowrap="nowrap"')
#ALtdcellheaderAtt('nowrap="nowrap"')
#if($!result.currentTab == "list")<img src='images/todo/$!record.StateImage' alt='$!record.StateString' title='$!record.StateString'/>&nbsp;#end<select onchange="aipo.viewPage(this.options[this.selectedIndex].value, '$!portlet.ID');aipo.portletReload('todo','$!portlet.ID');">
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoListScreen").addQueryData("mode","update").addQueryData("start","$result.CurrentPage").addQueryData("entityid", $!record.TodoId).addQueryData("secid","$secid").addQueryData("state", "0"))"   #if ($!record.State.toString() == "0" )  selected="selected" #end>未着手</option>
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoListScreen").addQueryData("mode","update").addQueryData("start","$result.CurrentPage").addQueryData("entityid", $!record.TodoId).addQueryData("secid","$secid").addQueryData("state", "10"))"  #if ($!record.State.toString() == "10")  selected="selected" #end>10%</option>
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoListScreen").addQueryData("mode","update").addQueryData("start","$result.CurrentPage").addQueryData("entityid", $!record.TodoId).addQueryData("secid","$secid").addQueryData("state", "20"))"  #if ($!record.State.toString() == "20")  selected="selected" #end>20%</option>
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoListScreen").addQueryData("mode","update").addQueryData("start","$result.CurrentPage").addQueryData("entityid", $!record.TodoId).addQueryData("secid","$secid").addQueryData("state", "30"))"  #if ($!record.State.toString() == "30")  selected="selected" #end>30%</option>
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoListScreen").addQueryData("mode","update").addQueryData("start","$result.CurrentPage").addQueryData("entityid", $!record.TodoId).addQueryData("secid","$secid").addQueryData("state", "40"))"  #if ($!record.State.toString() == "40")  selected="selected" #end>40%</option>
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoListScreen").addQueryData("mode","update").addQueryData("start","$result.CurrentPage").addQueryData("entityid", $!record.TodoId).addQueryData("secid","$secid").addQueryData("state", "50"))"  #if ($!record.State.toString() == "50")  selected="selected" #end>50%</option>
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoListScreen").addQueryData("mode","update").addQueryData("start","$result.CurrentPage").addQueryData("entityid", $!record.TodoId).addQueryData("secid","$secid").addQueryData("state", "60"))"  #if ($!record.State.toString() == "60")  selected="selected" #end>60%</option> 
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoListScreen").addQueryData("mode","update").addQueryData("start","$result.CurrentPage").addQueryData("entityid", $!record.TodoId).addQueryData("secid","$secid").addQueryData("state", "70"))"  #if ($!record.State.toString() == "70")  selected="selected" #end>70%</option>
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoListScreen").addQueryData("mode","update").addQueryData("start","$result.CurrentPage").addQueryData("entityid", $!record.TodoId).addQueryData("secid","$secid").addQueryData("state", "80"))"  #if ($!record.State.toString() == "80")  selected="selected" #end>80%</option>
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoListScreen").addQueryData("mode","update").addQueryData("start","$result.CurrentPage").addQueryData("entityid", $!record.TodoId).addQueryData("secid","$secid").addQueryData("state", "90"))"  #if ($!record.State.toString() == "90")  selected="selected" #end>90%</option>
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoListScreen").addQueryData("mode","update").addQueryData("start","$result.CurrentPage").addQueryData("entityid", $!record.TodoId).addQueryData("secid","$secid").addQueryData("state", "100"))" #if ($!record.State.toString() == "100") selected="selected" #end>完了</option>
</select>
#ALtdcellfooter()
#ALtdcellAtt("#ALajaxbuttonLinkCallback('編集' $!jslink.getPortletById($!portlet.ID).addQueryData('template','ToDoFormScreen').addQueryData('entityid', $!record.TodoId) 'images/icon/icon_edit.gif' $!portlet.ID 'aipo.todo.onLoadTodoDialog')" 'nowrap="nowrap"')
</tr>
#end
#ALtablefooter()
#ALbuttonheaderRight()
#if ($!result.currentTab == 'list')
選択した ToDo を #ALajaxbuttonCheckboxAction('完了にする' "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ToDoFormJSONScreen').addQueryData('mode','multi_complete')" "$indicator_id" "$!portlet.ID" "aipo.todo.onListReceiveMessage")#ALajaxbuttonCheckboxDelete('削除する' "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ToDoFormJSONScreen').addQueryData('mode','multi_delete')" "$indicator_id" "$!portlet.ID" "aipo.todo.onListReceiveMessage")
#else
選択した ToDo を #ALajaxbuttonCheckboxDelete('削除する' "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ToDoFormJSONScreen').addQueryData('mode','multi_delete')" "$indicator_id" "$!portlet.ID" "aipo.todo.onListReceiveMessage")
#end 
#ALbuttonfooterRight()
#ALajaxpageviewFooter('ToDoListScreen' $result)
#end
#ALformfooter()
#ALspacebothfooter()
#ALajaxtabfooter()
