#*
 * Aipo is a groupware program developed by Aimluck,Inc.
 * Copyright (C) 2004-2011 Aimluck,Inc.
 * http://www.aipo.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","AddressBookFormScreen").addQueryData("entityid","new")))
#set ($newUrl2 = $!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","AddressBookGroupFormScreen").addQueryData("entityid","new")))
#set ($newUrl3 = $!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","AddressBookCompanyFormScreen").addQueryData("entityid","new")))
#set ($submenulist = [["アドレスを追加する","javascript:aipo.common.showDialog('$newUrl1','$!portlet.ID',aipo.addressbook.onLoadAddressbookDialog);","images/icon/icon_add.gif"],["会社情報を追加する","javascript:aipo.common.showDialog('$newUrl3','$!portlet.ID',aipo.addressbook.onLoadAddressbookCompanyDialog);","images/icon/icon_add.gif"],["グループを追加する","javascript:aipo.common.showDialog('$newUrl2','$!portlet.ID',aipo.addressbook.onLoadAddressbookGroupDialog);","images/icon/icon_add.gif"]])
#if($!result.Index)
#set ($idx = $!result.Index)
#else
#set ($idx = "")
#end
## ---------------------------------------------------------------------------
#ALsubmenubar($submenulist "")

#macro(ALajaxsortaddressbook $key $name $result $screen)
#if($!result.CurrentSort && $!result.CurrentSort == "$key" && $!result.CurrentSortType && $!result.CurrentSortType == "asc")#set($sorttype ="desc")#set($sortHead ="headDown") #else #set($sorttype ="asc")#set($sortHead ="headUp")#end
#if($!result.Index && $result.Index.toString() != "")
<a#if($!result.CurrentSort && $!result.CurrentSort == "$key") class="$sortHead"#end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template",$screen).addQueryData("start","$result.CurrentPage").addQueryData("sort","$key").addQueryData("sorttype","$sorttype").addQueryData("idx","$result.Index"))', '$!portlet.ID');">$name</a>
#else
<a#if($!result.CurrentSort && $!result.CurrentSort == "$key") class="$sortHead"#end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template",$screen).addQueryData("start","$result.CurrentPage").addQueryData("sort","$key").addQueryData("sorttype","$sorttype"))', '$!portlet.ID');">$name</a>
#end
#end

#if($result.SearchWord && $result.SearchWord.toString() != "")
#set($link = "$!jslink.getPortletById($!portlet.ID).addQueryData('eventSubmit_doAddressbook_search_list','1')")
#set($pageviewscreen = "AddressBookWordScreen")
#else
#set($link = "$!jslink.getPortletById($!portlet.ID).addQueryData('eventSubmit_doAddressbook_list','1')")
#set($pageviewscreen = "AddressBookListScreen")
#end
#set($tabs = [["社外アドレス", "syagai", "$!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('tab','syagai')"], ["社内アドレス", "corp", "$!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('tab','corp')"]])
<form name="addressbook$!portlet.ID" id="addressbook$!portlet.ID"  method="post" onsubmit="aipo.addressbook.onSubmitSerchButton(this,'$!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('mode','ajaxsearch')','$!portlet.ID','$!result.currentTab'); return false;">
#ALtableheaderSimpleWide()
#ALtdcaption('検索')
#ALtditemheader()
#ALtextfield('sword' "$!result.SearchWord" "120px" 100 'active')
#ALsubmitJS('submit' ' 検索する ' 'setHiddenValue(this)')
#ALtditemfooter()
#ALtablefooter()
<input name="mode" type="hidden" value="ajaxsearch">
</form>
#ALajaxtabheader($tabs $!result.currentTab)
#ALspacebothheader()

#if(!($result.hasAuthorityList))
  アクセス権限がありません。管理者にお問い合わせください。
#else

#ALajaxlistformheader('AddressBook')

#if($result.SearchWord && $result.SearchWord.toString() != "")
<div style="padding-bottom: 5px;"><a href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen'))', '$!portlet.ID')">[一覧へ戻る]</a></div>
#else
#ALtableheaderSimpleWide()
#ALtdcaption("絞込み条件")
#ALtdcellheader()
<div style="padding:3px 3px 3px 3px;">
<div>グループの指定 ⇒
#ALselectpdheader("group" "90%" "aipo.viewPage(this.options[this.selectedIndex].value, '$!portlet.ID')")
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData("filter", "all").addQueryData("filtertype", "group"))">（グループ全体）</option>
#foreach( $record in $!result.MyGroupList )
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData("filter", $!{record.Name.toString()}).addQueryData("filtertype", "corp_group"))" #if($!result.CurrentFilter && $!result.CurrentFilter == $!record.Name.toString()) selected #end>$!record.AliasName</option>
#end
#if(($result.MyGroupList.size() > 0) && ($result.PostMap.size() > 0))
<option value="" #if ($!result.CurrentFilter && $!result.CurrentFilter == $!record.Name.toString()) selected #end>----------</option>
#end
#foreach( $record in $!result.PostMap )
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData("eventSubmit_doAddressbook_corp_list", "1").addQueryData("filter", $!{record.GroupName.toString()}).addQueryData("filtertype", "corp_group"))" #if($!result.CurrentFilter && $!result.CurrentFilter == $!record.GroupName.toString()) selected #end>$!record.PostName</option>
#end
#ALselectfooter()
</div>
<div style="padding-top: 3px;">
さらに索引で絞る ⇒
[<a #if($idx.equals("-1") || $idx.equals("")) style="color:darkorange;" #end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('idx', "-1"))', '$!portlet.ID')"> 全て </a>]
[<a #if($idx.equals("1")) style="color:darkorange;" #end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('idx', "1"))', '$!portlet.ID')"> あ </a>]
[<a #if($idx.equals("6")) style="color:darkorange;" #end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('idx', "6"))', '$!portlet.ID')"> か </a>]
[<a #if($idx.equals("11")) style="color:darkorange;" #end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('idx', "11"))', '$!portlet.ID')"> さ </a>]
[<a #if($idx.equals("16")) style="color:darkorange;" #end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('idx', "16"))', '$!portlet.ID')"> た </a>]
[<a #if($idx.equals("21")) style="color:darkorange;" #end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('idx', "21"))', '$!portlet.ID')"> な </a>]
[<a #if($idx.equals("26")) style="color:darkorange;" #end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('idx', "26"))', '$!portlet.ID')"> は </a>]
[<a #if($idx.equals("31")) style="color:darkorange;" #end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('idx', "31"))', '$!portlet.ID')"> ま </a>]
[<a #if($idx.equals("36")) style="color:darkorange;" #end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('idx', "36"))', '$!portlet.ID')"> や </a>]
[<a #if($idx.equals("41")) style="color:darkorange;" #end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('idx', "41"))', '$!portlet.ID')"> ら </a>]
[<a #if($idx.equals("46")) style="color:darkorange;" #end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('idx', "46"))', '$!portlet.ID')"> わ </a>]
[<a #if($idx.equals("52")) style="color:darkorange;" #end href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookListScreen').addQueryData('idx', "52"))', '$!portlet.ID')"> 英数 </a>]
</div>
</div>
#ALtditemfooter()
#ALtablefooter()
#end

#if($result.List.size() == 0)
指定された条件に該当するアドレスはありません。<br />
#else
#ALajaxpageview(${pageviewscreen} $result)
#ALtableheaderWide()
<tr>
#ALtdheadW25("#ALajaxsortaddressbook('name_kana' '名前' $result 'AddressBookListScreen')")
#ALtdhead('部署名')
#ALtdhead('役職')
#ALtdheadW25('メールアドレス')
#ALtdheadThin('電話番号（外線）')
#ALtdheadThin('電話番号（内線）')
</tr>
#foreach ($record in $result.List)
<tr>
#ALtdcellheader()
<a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","AddressBookDetailScreen").addQueryData("entityid",$record.AddressId).addQueryData("tab","$!result.currentTab"))');">$result.getStringCR($!record.Name)</a>
#if($!record.PublicFlag.toString() == 'F')
<img src="images/addressbook/addressbook_secret.gif" border="0" width="16" height="16" align="absmiddle" alt="非公開" title="非公開">
#end
</td>
#ALtdcellheader()
#set($pcount = 0)
#foreach($post in $record.PostList)
#if($pcount != 0)、&nbsp;#end
<a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","AccountPersonPostDetailScreen").addQueryData("entityid",$!post.GroupId))');">$!post.Name</a>
#set($pcount = $pcount + 1)
#end
#ALtdcellfooter()
#ALtdcell($result.getStringCR($!record.PositionName))
#ALtdcell("<a href='mailto:$!record.Email'>$!record.Email</a>")
#ALtdcellAtt("$!record.Telephone" "nowrap='nowrap'")
#ALtdcellAtt("$!record.InTelephone" "nowrap='nowrap'")
</tr>
#end
#ALtablefooter()
#ALajaxpageviewFooter(${pageviewscreen} $result)
#end
#ALformfooter()

#end

#ALspacebothfooter()
#ALajaxtabfooter()
