<% @pageName = @myView == "resource" ? "Resource" : "Fence Device" %>
<tr id="<%=@myView%>_title_row" {{bind-attr style="Pcs.<%=@myView%>_page"}}><td id="page_header" colspan=3>
<%= @myView == "resource" ? "RESOURCES" : "FENCE DEVICES" %>
    </td>
  </tr>
  <tr id="<%=@myView%>_header_row" {{bind-attr style="Pcs.<%=@myView%>_page"}}>
    <td id="remove_add" class="borderbottom">
      <div class="x sprites"></div><div class=link">&nbsp;
	<% if @myView == "resource" %>
	  <a href="#" onclick='verify_remove_resources(); return false;'>
	<% else %>
	  <a href="#" onclick='verify_remove_fence_devices(); return false;'>
	<% end %>
      Remove</a>&nbsp;&nbsp;&nbsp;&nbsp;</div>
  <div class="plus sprites"></div><div class="link">&nbsp;
    <% if @myView == "resource" %>
      <a href="#" onclick="$('#add_resource').dialog({title: 'Add Resource', modal:true, width: 'auto'});return false;">
    <% else %>
      <a href="#" onclick="$('#add_stonith').dialog({title: 'Add Fence Device', modal:true, width: 'auto'});return false;">
    <% end %>
  Add</a>&nbsp;&nbsp;&nbsp;&nbsp;</div>
    <% if @myView == "resource" %>
      <div class="plus sprites"></div><div class="link">&nbsp;<a href="#" onclick="create_group();return false;">Create Group</a></div>
    <% end %>
    </td>
    <td class="borderbottom">&nbsp;</td>
    <td id="tab_name" width="125">
      <div style="float: left">&nbsp;Edit <%= @pageName%>&nbsp;</div><div class="check sprites"></div>
    </td>
  </tr>
  <tr id="<%=@myView%>_list_row" {{bind-attr style="Pcs.<%=@myView%>_page"}}>
    <td id="<%=@myView%>_list" class="node_list">
      <%= erb :_resource_list %>
    </td>
	<td id="node_info" colspan=2>
	  <div id="<%=@myView%>_info_div">
		<% if @myView == "resource" %>
			{{resource-edit resource=Pcs.resourcesContainer.cur_resource page_name="Resource"}}
		<% else %>
			{{resource-edit resource=Pcs.resourcesContainer.cur_fence page_name="Fence device" stonith=1}}
		<% end %>
	  </div>
	  </td>
	</tr>
    <% if @myView == "resource" %>
      </div>
    </table>
    <div id="add_resource" style="display: none;">
      <table id="resource_selector" style="clear:left;float:left;margin-top:25px;">
	<tr>
	  <td class="bold">Class/Provider</td>
	  <td>
	    <%
	      class_providers = []
	      @resource_agents.keys.each {|k|
		class_providers << k[0,k.rindex(':')]
	      }
	      class_providers.uniq!
	      class_providers.sort!
	    %>
	    <select id="resource_class_provider_selector">
	      <% class_providers.each {|cp| %>
		<option <%= "selected" if cp == "ocf:heartbeat" %> value="<%=cp%>"><%=cp%></option>
	      <% } %>
	    </select>
	  </td>
	</tr>
	<tr>
	  <td class="bold">Type</td>
	  <td>
	    <select id="all_ra_types" style="display:none;">
	      <% @resource_agents.keys.sort_by{|a|a.downcase}.each { |key| %>
		<option width=250px  value="<%=key%>"><%=key[(key.rindex(':')+1)..-1]%></option>
	      <% } %>
	    </select>
	    <select id="add_ra_type" onchange="load_resource_form($('#new_resource_agent'), this.value);">
	      <% @resource_agents.keys.sort_by{|a|a.downcase}.each { |key| %>
		<option width=250px <%= key == "ocf::heartbeat:IPaddr2" ? "selected" : "" %> value="<%=key%>"><%=key%></option>
	      <% } %>
	    </select>
	  </td>
	</tr>
      </table>
      <div id="new_resource_agent">
      </div>
    </div>
    <div id="add_stonith" style="display: none;">
      <table id="stonith_selector" style="clear:left;float:left;margin-top:25px;">
	<tr>
	  <td class="bold">Type</td>
	  <td>
	    <select id="add_stonith_type" onchange="load_resource_form($('#new_stonith_agent'),this.value,true);">
	      <% @stonith_agents.keys.sort_by{|a|a.downcase}.each { |name| %>
		<option width=250px <%= @stonith_agents[name]["type"] == "fence_apc" ? "selected" : "" %> value="<%=@stonith_agents[name]["type"]%>"><%=@stonith_agents[name]["type"]%></option>
	    <% } %>
	    </select>
	  </td>
	</tr>
      </table>
      <div id="new_stonith_agent">
      </div>
    </div>
    <div id="add_group" style="display: none;">
      <form method=POST onkeypress="if (event.keyCode == 13) {$(this).parent().parent().find('.ui-dialog-buttonpane button:eq(1)').trigger('click');return false;} " action="/resource_group_add">
	<p style="font-size:12px;">Group Name:</p><input name="resource_group" type=text>
	<input id="resources_to_add_to_group"  type=hidden name="resources" value="">
      </form>
    </div>
    <% end %>
