<div id="resource_agent_<%=@resource.name%>" style="float:left;">
  <form method=POST action="/update_resource">
    <div id="resource_group">
      <table>
        <tr>
          <td><div class="bold">Description:</div></td>
	  <td><span class="reg" style="float:left;"><%=h(@resource.short_desc)%>&nbsp;</span>&nbsp;<span title="<%=nl2br(h(@resource.long_desc))%>" onclick="$(this).closest('table').find('.long_desc_div').toggle();" class="infoicon sprites" style="margin-top:2px;"></span></td>
        </tr>
        <tr>
          <td></td>
          <td><div class="long_desc_div reg" style="display:none; font-size:12px; max-width:350px;"><%= nl2br(h(@resource.long_desc))%></div></td>
        </tr>
	<% if @version != '2' %>
        <tr title="<%= h('Select a group to add the resource to.') %>">
	  <td nowrap><div class="bold">Resource Group:</div></td>
	  <td>
	    <select name="resource_group">
		<option value="">None</option>
	      <% @groups.each do |g| %>
		<option <%= "selected" if g == @cur_resource_group %> value="<%=g%>"><%=g%></option>
	      <% end %>
	    </select>
	    <input type=hidden name="_orig_resource_group" value="<%= @cur_resource_group if @cur_resource_group %>">
	  </td>
	</tr>
	<tr title='<%= h("Makes the resource run multiple times on the cluster. \
By default the resource will run once on each of the nodes.") %>'>
	  <td nowrap><div class="bold">Clone:</div></td>
	  <td>
	    <input type="hidden" name="_orig_resource_clone" value="<%= @cur_resource_clone if @cur_resource %>">
	    <input type=checkbox name="resource_clone" <%= "checked" if @cur_resource && @cur_resource_clone %>>
	  </td>
	</tr>
	<tr title='<%= h("Makes the resource run multiple times on the cluster and \
distinguish between Master and Slave operating mode for each instance. \
By default the resource will run on one node in Master mode and on all other \
nodes in Slave mode.") %>'>
	  <td nowrap><div class="bold">Master/Slave:</div></td>
	  <td>
	    <input type="hidden" name="_orig_resource_ms" value="<%= @cur_resource_ms if @cur_resource %>">
	    <input type=checkbox name="resource_ms" <%= "checked" if @cur_resource && @cur_resource_ms %>>
	  </td>
	</tr>
	<% end %>
	<% if not @existing_resource %>
	  <tr title="<%= h('Do not start the resource automatically after creating.') %>">
	    <td nowrap><div class="bold">Disabled:</div></td>
	    <td>
	      <input type=checkbox name="disabled">
	    </td>
	  </tr>
      <% end %>
      </table>
    </div>
    <table style="clear:left; float:left; margin-top: 25px;">
      <% if @new_resource %>
	<tr>
	  <td class="reg">
	    Resource ID
	  </td>
	  <td>
	    <input style="margin-right: 50px;" type="text" name="name" size="35" class="text_field">
	  </td>
	</tr>
      <% end %>

      <% if @existing_resource %>
	<input type="hidden" name="resource_id" value="<%=@cur_resource.id%>">
      <% end %>

      <input type="hidden" name="resource_type" value="<%=@resource.type%>">
      <% @resource.required_options.each { |name, desc|  %>
	<tr title="<%=h(desc[1])%>">
	  <td class="reg">
	    <%= name %>
	  </td>
	  <td>
	    <input placeholder="<%=desc[0]%>" style="margin-right: 50px;" type="text" name="<%= @cur_resource && @cur_resource.instance_attr[name] ? "_res_paramne_" : "_res_paramempty_"%><%=name%>" value="<%=h(@cur_resource.instance_attr[name].value) if @existing_resource && @cur_resource && @cur_resource.instance_attr[name] %>" size="35" class="text_field">
	  </td>
	</tr>
      <% } %>
      <tr>
	<td id="<%= @new_resource ? "optional_args_new" : "optional_args_existing" %>" nowrap class="reg" onclick="show_hide_constraints(this)" colspan=2>
	  <span class="rightarrow sprites"></span><span class="downarrow sprites" style="display: none;"></span>
	  <div class="bold">Optional Arguments:</div>
	</td>
      </tr>
      <% @resource.optional_options.each { |name, desc|  %>
	<tr title="<%=h(desc[1])%>" style="display:none;">
	  <td class="reg">
	    <%= name %>
	  </td>
	  <td>
	    <input placeholder="<%=desc[0]%>" style="margin-right: 50px;" type="text" name="<%= @cur_resource && @cur_resource.instance_attr[name] ? "_res_paramne_" : "_res_paramempty_"%><%=name%>" value="<%=h(@cur_resource.instance_attr[name].value) if @existing_resource && @cur_resource && @cur_resource.instance_attr[name] %>" size="35" class="text_field">
	  </td>
	</tr>
      <% } %>
      <tr class="stop"><td class="center" style="padding-top:20px;height:26px;" colspan=2>
	  <input class="apply_changes" type=submit class="text_field" onclick="$(this).hide();create_resource($(this).parents('form'),<%=@existing_resource ? 'true':'false'%>); return false;" value="<%= @existing_resource ? "Apply Changes" : "Create Resource" %>">
	</td>
      </tr>
    </table>
  </form>
</div>
