<tr id="acls_title_row" {{bind-attr style="Pcs.acls_page"}}><td id="page_header" colspan=3>
    ACLS
  </td>
</tr>
<tr {{bind-attr style="Pcs.acls_page"}}>
  <td id="remove_add" class="borderbottom">
    <div class="x sprites"></div>
    <div class="link" onclick="verify_remove_acl_roles();return false;">&nbsp;Remove&nbsp;&nbsp;&nbsp;&nbsp;</div>
    <div class="plus sprites"></div>
    <div class="link" onclick="$('#add_acl_role').dialog({
        title: 'Add ACL Role',
        modal: true,
        width: 'auto',
        buttons: {
          'Add Role': function() {
            $(this).hide();
            add_acl_role($('#add_acl_role'));
            $(this).show();
          },
          'Cancel': function() {
            $(this).dialog('close');
          },
        }
      }); return false;">&nbsp;Add</div>
  </td>
  <td class="borderbottom">&nbsp;</td>
  <td id="tab_name" width="125">
    <div style="float: left">&nbsp;Edit ACL Role&nbsp;</div>
    <div class="check sprites"></div>
  </td>
</tr>
<tr id="acls_list_row" {{bind-attr style="Pcs.acls_page"}}>
  <td id="acls_roles_list" class="node_list">
    <table cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <th><input type="checkbox" onchange="checkBoxToggle(this,false)"></th>
        <th></th>
        <th>ROLE&nbsp;NAME</th>
        <th></th>
      </tr>
      {{#each Pcs.aclsController}}
      <tr {{bind-attr onmouseover="onmouseover"}} {{bind-attr onmouseout="onmouseout"}} {{bind-attr class="trclass"}} {{bind-attr nodeID="name"}} onclick='Pcs.aclsController.load_role(this);'>
        <td class="node_list_check">
          {{view Ember.Checkbox checkedBinding="checked" class="node_list_check"}}
        </td>
        <td class="node_list_sprite">
          <div class="check sprites"></div>
        </td>
        <td class="node_name">{{name}}</td>
        <td>
          <div {{bind-attr style="showArrow"}} class="arrow sprites"></div>
        </td>
      </tr>
      {{/each}}
    </table>
  </td>
  <td id="node_info" colspan=2>
    <div id="role_info_div">
    <table>
      <tr><td>Role Name:</td><td><input disabled type="text" size="40" {{bind-attr value="Pcs.aclsController.cur_role.name"}}></td></tr>
      <tr><td>Role Description:</td><td><input disabled type="text" size="40" {{bind-attr value="Pcs.aclsController.cur_role.description"}}></td></tr>
    </table>
    <table>
      <tr><td colspan=2 style="display: block;" onclick="show_hide_constraints(this)" class="datatable_header hover-pointer"><span style="" class="downarrow sprites"></span><span style="display: none;" class="rightarrow sprites"></span>Permissions ({{#if Pcs.aclsController.cur_role.permissions.length}}{{Pcs.aclsController.cur_role.permissions.length}}{{else}}0{{/if}})</td></tr>
      <tr><td colspan=2>
          <div id="">
            <table class="datatable">
              <tr><th>Type</th><th>XPath/ID</th><th>Query/ID</th><th>Remove</th></tr>
                {{#each perm in Pcs.aclsController.cur_role.permissions}}
                <tr {{bind-attr acl_perm_id="perm.permission_id"}}>
                  <td>{{perm.type}}</td>
                  <td>{{perm.xpath_id}}</td>
                  <td>{{perm.query_id}}</td>
                  <td style="text-align:center;">
                    <a onclick="x=$(this);remove_acl_item($(this).closest('tr'),'perm');return false;" href="#" class="remove">X</a>
                  </td>
                </tr>
              {{/each}}
              {{#unless Pcs.aclsController}}
                <tr><td style="color: gray;">NONE</td><td></td><td></td></tr>
              {{/unless}}
              <tr id="new_acl_perm">
                <td>
                  <select name="role_type">
                    <option value="read">Read</option>
                    <option value="write">Write</option>
                    <option value="deny">Deny</option>
                  </select>
                </td>
                <td>
                  <select name="role_xpath_id">
                    <option value="xpath">XPath</option>
                    <option value="id">ID</option>
                  </select>
                </td>
                <td><input type="text" name="role_query_id"></td>
                <td><button type="button" onclick="add_acl_item('#new_acl_perm', 'perm');" name="add">Add</button></td>
              </tr>
            </table>
          </div>
        </td>
      </tr>
    </table>
    <table>
      <tr><td colspan=2 style="display: block;" onclick="show_hide_constraints(this)" class="datatable_header hover-pointer"><span style="" class="downarrow sprites"></span><span style="display: none;" class="rightarrow sprites"></span>Users Assigned ({{#if Pcs.aclsController.cur_role.user_list}}{{Pcs.aclsController.cur_role.user_list.length}}{{else}}0{{/if}})</td></tr>
      <tr><td colspan=2>
          <div id="">
            <table class="datatable">
              <tr><th>User Name</th><th>Remove</th></tr>
              {{#each user in Pcs.aclsController.cur_role.user_list}}
              <tr {{bind-attr usergroup_id="user"}} {{bind-attr role_id="Pcs.aclsController.cur_role.name"}}>
                  <td>{{user}}</td>
                  <td style="text-align:center;">
                    <a onclick="remove_acl_item($(this).closest('tr'),'user');return false;" href="#" class="remove">X</a>
                  </td>
                </tr>
              {{/each}}
              {{#unless Pcs.aclsController.cur_role.user_list}}
                <tr><td style="color: gray;">NONE</td><td></td></tr>
              {{/unless}}
              <tr id="new_acl_user">
                <td><input type="text" name="role_assign_user"></td>
                <td><button type="button" onclick="add_acl_item('#new_acl_user', 'user');" name="add">Add</button></td>
              </tr>
            </table>
          </div>
        </td>
      </tr>
    </table>
    <table>
      <tr><td colspan=2 style="display: block;" onclick="show_hide_constraints(this)" class="datatable_header hover-pointer"><span style="" class="downarrow sprites"></span><span style="display: none;" class="rightarrow sprites"></span>Groups Assigned ({{#if Pcs.aclsController.cur_role.group_list}}{{Pcs.aclsController.cur_role.group_list.length}}{{else}}0{{/if}})</td></tr>
      <tr><td colspan=2>
          <div id="">
            <table class="datatable">
              <tr><th>Group</th><th>Remove</th></tr>
              {{#each group in Pcs.aclsController.cur_role.group_list}}
              <tr {{bind-attr usergroup_id="group"}} {{bind-attr role_id="Pcs.aclsController.cur_role.name"}}>
                <td>{{group}}</td>
                <td style="text-align:center;">
                  <a onclick="remove_acl_item($(this).closest('tr'),'group');return false;" href="#" class="remove">X</a>
                </td>
              </tr>
              {{/each}}
              {{#unless Pcs.aclsController.cur_role.group_list}}
                <tr><td style="color: gray;">NONE</td><td></td></tr>
              {{/unless}}
              <tr id="new_acl_group">
                <td><input type="text" name="role_assign_user"></td>
                <td><button type="button" onclick="add_acl_item('#new_acl_group', 'group');" name="add">Add</button></td>
              </tr>
            </table>
          </div>
        </td>
      </tr>
    </table>
    </div>
  </td>
</tr>
<tr><td>
  <div id="add_acl_role" style="display: none;">
    <table>
      <tr>
        <td>Role Name:</td>
        <td><input type="text" name="name" size="40"></td>
      </tr>
      <tr>
        <td>Role Description:</td>
        <td><input type="text" name="description" size="40"></td>
      </tr>
    </table>
  </div>
  <%= erb :_dialogs %>
</td></td>
