#*
 * 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/>.
 *#

## ---------------------------------------------------------------------------
#if($result.Ptype)#set ($type = $!{result.Ptype})#end
#set($screenlink = "$jslink.getPortletById($!portlet.ID).addPathInfo('template','AccessControlFeaturesLiteJSONScreen')")
#set($tabs = [["アクセス権限", "",""]])
#set ($indicator_id = "indicator-dlg-")
## ---------------------------------------------------------------------------
#ALdialogheader("アクセス権限編集")
#ALajaxIndicator("$indicator_id" "$!portlet.ID" "")
#ALerrmsg($errmsgs)
<div id="messageDiv"></div>
#ALajaxscreenformheader("accessControlForm" $jslink $portlet "AccessControlFormJSONScreen" "aimluck.io.selectAllOptions(this.member_to);aimluck.io.submit(this,'$indicator_id', '$!portlet.ID',aipo.accessctl.onReceiveMessage)")
#if($mode=="new_form")
<input type="hidden" name="mode" value="insert" />
#else
<input type="hidden" name="mode" value="update" />
#end
#ALtableheaderWide()
#ALtdcaption("#ALrequired($!result.getFieldName('acl_role_name'))")
#ALtditem("#ALtextfield('acl_role_name' $!result.AclRoleName '90%' 50 'active')")
#ALtdcaption("#ALrequired('アクセス権限')")
#ALtditemheader()
#ALtableheaderSimpleWide()
#ALtdcaption('機能')
#ALtditemheader()
#set($screenlink = "$jslink.getPortletById($!portlet.ID).addPathInfo('template','PortletFeatureLiteJSONScreen')")
<select style="width: 90%;" name="feature_id" id="feature_id" onchange="aipo.accessctl.changeAcls('$!portlet.ID', '$screenlink', this.options[this.selectedIndex].value)">
#foreach( $record in $result.PortletFeatureList )
#if ($mode=="new_form")
    <option value="$!record.FeatureId"  selected="selected" >$!record.FeatureAliasName</option>
#else
#if ($!result.FeatureId.toString() == $!record.FeatureId.toString())
    <option value="$!record.FeatureId"  selected="selected" >$!record.FeatureAliasName</option>
#end
#end
#end
</select>
#ALtditemfooter()
#ALtablefooter()
<div id="aclsDiv"></div>
#ALtditemfooter()
#ALtdcaption("#ALrequired('所属メンバー')")
#ALtditemheader()
<div class="spaceTop spaceLeft small">左側にユーザーを追加してください。</div>
<div dojoType="aipo.widget.MemberNormalSelectList"
    id="membernormalselect"
    widgetId="membernormalselect"
    buttonAddId="button_member_add"
    buttonRemoveId="button_member_remove"
    memberFromId="tmp_member_from"
    memberToTitle="所属メンバー一覧"
    memberToId="member_to"
    memberFromUrl="$!jslink.getPortletById($!portlet.ID).addQueryData('template','UserLiteJSONScreen').addQueryData('mode','group').addQueryData('groupname','LoginUser')"
    memberFromOptionKey="name"
    memberFromOptionValue="aliasName"
    groupSelectId="tmp_group"
    groupSelectPreOptionKey="LoginUser"
    groupSelectPreOptionValue="（グループ全体）"
    groupSelectOptionKey="groupId"
    groupSelectOptionValue="name"
    memberGroupUrl="$!jslink.getPortletById($!portlet.ID).addQueryData('template','UserGroupLiteJSONScreen').addQueryData('mode','post')"
    changeGroupUrl="$!jslink.getPortletById($!portlet.ID).addQueryData('template','UserLiteJSONScreen').addQueryData('mode','group')">
</div>
<select size="5" multiple="multiple" style="display:none;" name="init_memberlist" id="init_memberlist">#foreach($record in $!result.MemberList)<option value="$!record.Name">$!record.AliasName</option>#end</select>
#ALtditemfooter()
#ALtdcaption($!result.getFieldName("note"))
#ALtditemheader()
#ALtextarea('note' $!result.Note 10 40)
#ALtditemfooter()
#ALtablefooter()
#ALbuttonheader()
#ALsubmit("eventSubmit_doAccessctl_update" "更新する" )#ALajaxbuttonClose()
#ALbuttonfooter()
<input type="hidden" id="urlacls$!portlet.ID" name="urlacls$!portlet.ID" value="$screenlink" />
#if($!result.FeatureId.toString() == "") #set($tmpfeatureid = "111") #else #set($tmpfeatureid = $!result.FeatureId.toString()) #end
<input type="hidden" id="initfeature$!portlet.ID" name="initfeature$!portlet.ID" value="$tmpfeatureid" />
#if($!result.AclList.toString() == "1")  <input type="hidden" id="initacllist$!portlet.ID" name="initacllist$!portlet.ID" value="checked"/>#end
#if($!result.AclDetail.toString() == "1")  <input type="hidden" id="initacldetail$!portlet.ID" name="initacldetail$!portlet.ID" value="checked"/>#end
#if($!result.AclInsert.toString() == "1")  <input type="hidden" id="initaclinsert$!portlet.ID" name="initaclinsert$!portlet.ID" value="checked"/>#end
#if($!result.AclUpdate.toString() == "1")  <input type="hidden" id="initaclupdate$!portlet.ID" name="initaclupdate$!portlet.ID" value="checked"/>#end
#if($!result.AclDelete.toString() == "1")  <input type="hidden" id="initacldelete$!portlet.ID" name="initacldelete$!portlet.ID" value="checked"/>#end
#if($!result.AclExport.toString() == "1")  <input type="hidden" id="initaclexport$!portlet.ID" name="initaclexport$!portlet.ID" value="checked"/>#end
#ALformfooter()
#ALdialogfooter()
