<?xml version="1.0" encoding="UTF-8"?>
<!--
  Openbizx Cubi Application Platform
  LICENSE http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
  Copyright (c) 2005-2011, Openbiz Technology LLC
  Version $Id: AclRoleActionsForm.xml 3372 2012-05-31 06:19:06Z rockyswen@gmail.com $
-->
<EasyForm Name="AclRoleActionsForm"
          Icon="icon_roles_permissions_l.gif"
          Class="AclRoleActionsForm"
          FormType="List"
          jsClass="jbForm"
          Title="Role Permissions"
          Description="Manage the permissions of the given role by setting access level to resource actions"
          BizDataObj="system.do.AclRoleActionDO"
          PageSize="10"
          TemplateEngine="Smarty"
          TemplateFile="form_role_permission_grid.tpl.html"
          MessageFile="system.msg">
    <DataPanel>
        <Element Name="fld_Id" Class="common.element.ColumnTitle" FieldName="Id" Label="Action Id" Sortable="Y"/>
        <Element Name="fld_module" Class="ColumnText" FieldName="module" Label="Module" Sortable="Y"/>
        <Element Name="fld_resource" Class="ColumnText" FieldName="resource" Label="Resource" Sortable="Y"/>
        <Element Name="fld_action" Class="ColumnText" FieldName="action" Label="Action" Sortable="Y"/>
        <!--<Element Name="fld_access_level" Class="ColumnText" FieldName="access_level" Label="Access Level" Sortable="Y"/>-->
        <Element Name="access_level" Class="system.form.AccessListbox" FieldName="access_level" Label="Access Level" SelectFrom="system.lov.Selection(AccessLevel)"/>
    </DataPanel>
    <ActionPanel>
        <Element Name="btn_save" Class="Button" Text="Save" CssClass="button_gray_m">
            <EventHandler Name="edit_onclick" Event="onclick" Function="SaveAccessLevel()"/>
        </Element>
    </ActionPanel> 
    <NavPanel>
        <Element Name="page_selector" Class="PageSelector" Text="{@:currentPage}" Label="Go to Page" CssClass="input_select" cssFocusClass="input_select_focus">
        	<EventHandler Name="btn_page_selector_onchange" Event="onchange" Function="GotoSelectedPage(page_selector)"/>
        </Element>
        <Element Name="pagesize_selector" Class="PagesizeSelector" Text="{@:range}" Label="Show Rows" CssClass="input_select" cssFocusClass="input_select_focus">
        	<EventHandler Name="btn_pagesize_selector_onchange" Event="onchange" Function="SetPageSize(pagesize_selector)"/>
        </Element>
        <Element Name="btn_first"  Class="Button" Enabled="{(@:currentPage == 1)?'N':'Y'}" Text="" CssClass="button_gray_navi {(@:currentPage == 1)?'first_gray':'first'}">
            <EventHandler Name="first_onclick" Event="onclick" Function="GotoPage(1)"/>
        </Element>
        <Element Name="btn_prev" Class="Button" Enabled="{(@:currentPage == 1)?'N':'Y'}" Text="" CssClass="button_gray_navi {(@:currentPage == 1)?'prev_gray':'prev'}">
            <EventHandler Name="prev_onclick" Event="onclick" Function="GotoPage({@:currentPage - 1})" ShortcutKey="Ctrl+Shift+Left"/>
        </Element>
        <Element Name="txt_page" Class="LabelText" Text="{'@:currentPage of @:totalPages '}">
        </Element>
        <Element Name="btn_next" Class="Button" Enabled="{(@:currentPage == @:totalPages )?'N':'Y'}" Text="" CssClass="button_gray_navi {(@:currentPage == @:totalPages)?'next_gray':'next'}">
            <EventHandler Name="next_onclick" Event="onclick" Function="GotoPage({@:currentPage + 1})" ShortcutKey="Ctrl+Shift+Right"/>
        </Element>
        <Element Name="btn_last" Class="Button" Enabled="{(@:currentPage == @:totalPages )?'N':'Y'}" Text="" CssClass="button_gray_navi {(@:currentPage == @:totalPages)?'last_gray':'last'}">
            <EventHandler Name="last_onclick" Event="onclick" Function="GotoPage({@:totalPages})"/>
        </Element>
    </NavPanel> 
    <SearchPanel>
		<Element Name="module_filter"  BlankOption="All Modules" width="120" Class="Listbox" FieldName="module" Label="" SelectFrom="system.do.AclModuleListDO[module:module]" >
            <EventHandler Name="module_filter_onchange" Event="onchange" Function="RunSearch()"/>
        </Element>
    	<Element Name="resource_selector"  BlankOption="All Resources" width="120" Class="Listbox" FieldName="resource" Label="" SelectFrom="system.do.AclResourceListDO[resource:resource],[module]='{@:Elem[module_filter].Value}'" >
            <EventHandler Name="resource_selector_onchange" Event="onchange" Function="RunSearch()"/>
        </Element> 
        <Element Name="qry_module"  Class="AutoSuggest" FuzzySearch="Y" SelectFrom="system.do.AclRoleActionDO[module],[module] like '%{$_POST['qry_module']}%' GROUP BY [resource]" FieldName="module_alias" cssFocusClass="input_text_search_focus" CssClass="input_text_search" />
        <Element Name="btn_dosearch" Class="Button" text="Go" CssClass="button_gray">
            <EventHandler Name="search_onclick" Event="onclick" Function="RunSearch()" ShortcutKey="Enter"/>
        </Element>        
    </SearchPanel>
</EasyForm>