<!DOCTYPE html>
<head>
  <title>Pacemaker/Corosync Configuration</title>
  <link rel="shortcut icon" type="image/png" href="/images/favicon.png"/>
  <link rel="stylesheet" type="text/css" href="/css/style.css" />
  <link rel="stylesheet" type="text/css" href="/css/overpass.css" />
  <link rel="stylesheet" type="text/css" href="/css/liberation.css" />
  <link rel="stylesheet" type="text/css" href="/css/jquery-ui-1.10.1.custom.css" />
  <script type="text/javascript">
	ENV = { "RAISE_ON_DEPRECATION": true, "VIEW_PRESERVES_CONTEXT": true,
	  "CP_DEFAULT_CACHEABLE": true};
  </script>
  <script src="/js/jquery-1.9.1.min.js"></script>
  <script src="/js/jquery-ui-1.10.1.custom.min.js"></script>
  <script src="/js/handlebars-v1.2.1.js"></script>
  <script src="/js/ember-1.4.0.js"></script>
  <script src="/js/tools.js"></script>
  <script src="/js/api.js"></script>
  <script src="/js/cluster-setup.js"></script>
  <script src="/js/cluster-destroy.js"></script>
  <script src="/js/node-add.js"></script>
  <script src="/js/node-remove.js"></script>
  <script src="/js/pcsd.js"></script>
  
  <!--
  <script src="/js/dev/dev.js"></script>

  <script src="/js/dev/cluster_status.mock.js"></script>
  <script src="/js/dev/tests-node-add.js"></script>
  <script src="/js/dev/tests-node-remove.js"></script>

  <script src="/js/dev/clusters-overview-mock.js"></script>
  <script src="/js/dev/tests-cluster-setup.js"></script>
  <script src="/js/dev/tests-cluster-destroy.js"></script>
  -->
  <script type="text/javascript">
    $(function () { // use jquery html tooltips
      $.widget("ui.tooltip", $.ui.tooltip, {
        options: {
          content: function () {
            return $(this).prop('title');
          },
          track: true
        }
      });
      $(document).tooltip();
    });
    var origMainTRHeight = 0;
    function resizeDialog() {
      $('#new_resource_agent').dialog('option','position','center');
    }
    function resizeTable(refresh) {
      if (refresh == true) {
	origMainTRHeight = $('#main > tbody > tr:nth-child(3)').height();
      }
      var wheight = $(window).height();
      var header = $('#header').height();
      var footer = $('#footer').height();
      var tr1 = $('#main > tbody > tr:nth-child(1)').height();
      var tr2 = $('#main > tbody > tr:nth-child(2)').height();
      var tr3 = $('#main > tbody > tr:nth-child(4)').height();
      var push = $('#push').height();
      var newheight = wheight - header - footer - tr1 - tr2 - tr3 - 25;
      if (origMainTRHeight <= newheight) {
	$('#main > tbody > tr:nth-child(3)').height(newheight);
	$('#content').height($('#main').height());
      }
    }
    $(window).resize(function() {
	resizeTable();
	});
    $(window).load(function() {
	resizeTable(true);
	$('#add_ra_type').trigger('change');
	$('#add_stonith_type').trigger('change');
	$('#new_resource_agent').ajaxStop(function() {
	  resizeDialog();
	  });
	});

  </script>
</head>
<html>
  <body>
  <script type="text/x-handlebars" data-template-name="components/resource-tree-view">
  <div style="width: 450px;">
    <table cellpadding="0" cellspacing="0" class="tree-view" style="width: 100%; border: none;">
      <tr>
        <th style="width:27px;"><input type="checkbox" onchange="checkBoxToggle(this,false)"></th><th style="width:47px;"></th><th>NAME</th><th style="width:220px;">TYPE</th><th style="width:18px;"></th>
      </tr>
      {{#each element in elements}}
      <tr><td colspan="5" style="padding-top: 0px; padding-bottom: 0px;">
          {{resource-tree-element node=element}}
      </td></tr>
      {{/each}}
      </table>
    </div>
  </script>

  <script type="text/x-handlebars" data-template-name="components/resource-tree-element">
    <table class="tree-element"  cellpadding="0" cellspacing="0" style="width: 100%; border: none;" {{bind-attr id=node.treeview_element_id}}>
    <tr class="tree-element-name" onclick="tree_view_onclick(get_tree_view_resource_id(this));" onmouseover="$(this).addClass('mouse_on_row');" onmouseout="$(this).removeClass('mouse_on_row');" {{bind-attr nodeID=node.id}}>
        <td style="width:20px;" class="node_list_check">
          <input type="checkbox" onchange="tree_view_checkbox_onchange(this)">
        </td>
        <td style="width:18px;" class="node_list_sprite">{{{node.status_icon}}}</td>
        <td class="resource_name" nowrap {{bind-attr node=node.style}}>
          <span {{bind-attr class=node.span_class}}>{{node._id}}</span>
        </td>
        <td style="width:200px;" class="resource_type" {{bind-attr style=node.style}}>{{node.resource_type}}</td>
        <td style="width:18px;">
          <div style="display: none;" class="arrow sprites"></div>
        </td>
    </tr>
      {{#if node.children.length}}
      <tr class="children" style="display: none;">
        <td colspan="5" style="padding-left: 10px; padding-top: 0px; padding-bottom: 0px;">
        {{#each child in node.children}}
          {{resource-tree-element node=child}}
        {{/each}}
        </td>
      </tr>
      {{/if}}
      </table>
  </script>

  <script type="text/x-handlebars" data-template-name="components/issues-table">
  {{#if issue_list.length}}
  <div class="issue_table">
  <span {{bind-attr style=table_name_style}}>{{table_name}}</span>
  <table style="width: 100%" {{bind-attr class=issue_class}}>
    {{#each issue in issue_list}}
      <tr><td>
        {{issue.message}}
      </td></tr>
    {{/each}}
  </table>
  </div>
  {{/if}}
  </script>

  <script type="text/x-handlebars" data-template-name="components/resource-edit">
  {{#if resource}}
    <div id="node_info_header">
      <div class="node_info_header_title" >Edit {{page_name}}&nbsp;</div>
      <div id="node_info_header_title_name">{{resource._id}}</div>
    </div>
    <div id="node_sub_info">
      <table>
        <tr>
          <td>
            <input disabled style="margin-right: 50px;" type="text" {{bind-attr value=resource._id}} size="35" class="text_field">
          </td>
          <td>
            {{{resource.status_icon}}}
          </td>
          <td nowrap>{{{resource.show_status}}}</td>
        </tr>
      </table>
    </div>
    <div id="node_options_buttons">
    <div>
    {{#if resource.stonith}}
      <div class="xdark sprites" style="float: left"></div>
      <div id="stonith_delete_link" class="link" onclick="verify_remove_fence_devices(curStonith());">Remove</div>
      {{#if Pcs.is_supported_resource_refresh_one_resource}}
        <div class="restart sprites" style="float: left"></div>
        <div id="stonith_cleanup_link" class="link" onclick="cleanup_stonith();">Cleanup</div>
        <div class="restart sprites" style="float: left"></div>
        <div id="stonith_refresh_link" class="link" onclick="refresh_stonith(true);">Refresh</div>
      {{else}}
        <div class="restart sprites" style="float: left"></div>
        <div id="stonith_refresh_link" class="link" onclick="refresh_stonith(false);">Refresh</div>
      {{/if}}
    {{else}}
      <div class="checkdark sprites" style="float: left"></div>
      <div id="resource_start_link" class="link" onclick="enable_resource();">Enable</div>
      <div class="cancel sprites" style="float: left"></div>
      <div id="resource_stop_link" class="link" onclick="disable_resource();">Disable</div>
      {{#if Pcs.is_supported_resource_refresh_one_resource}}
        <div class="restart sprites" style="float: left"></div>
        <div id="resource_cleanup_link" class="link" onclick="cleanup_resource();">Cleanup</div>
        <div class="restart sprites" style="float: left"></div>
        <div id="resource_refresh_link" class="link" onclick="refresh_resource(true);">Refresh</div>
      {{else}}
        <div class="restart sprites" style="float: left"></div>
        <div id="resource_refresh_link" class="link" onclick="refresh_resource(false);">Refresh</div>
      {{/if}}
      <div class="xdark sprites" style="float: left"></div>
      <div id="resource_delete_link" class="link" onclick="verify_remove_resources(curResource());">Remove</div>
      </div>
      <div>
      {{#if Pcs.is_supported_unmanaged_resource}}
        <div>
        <div class="checkdark sprites" style="float: left"></div>
        <div
          id="resource_manage_link"
          class="link"
          onclick="manage_resource(curResource());"
        >
          Manage
        </div>
        </div>
        <div>
        <div class="cancel sprites" style="float: left"></div>
        <div
          id="resource_unmanage_link"
          class="link"
          onclick="unmanage_resource(curResource());"
        >
          Unmanage
        </div>
        </div>
      {{/if}}
    {{/if}}
    </div>
      <!--
      <div class="move sprites" style="float: left"></div>
      <div id="resource_move_link" class="link">Move</div>
      <div class="history sprites" style="float: left"></div>
      <div id="resource_history_link" class="link">History</div>
      -->
    </div>
    <br>
    <div id="resource_issues">
      {{issues-table table_name="Errors" table_name_style="color:red;" issue_list=resource.error_list issue_class="error_table"}}
      {{issues-table table_name="Warnings" table_name_style="color:orange;" issue_list=resource.warning_list issue_class="warning_table"}}
    </div>
    <div id="node_details">
      <table style="margin-bottom:25px;">
        <tr>
          <td class="bold" nowrap>Type:</td>
          <td class="reg" nowrap>{{resource.res_type}}</td>
        </tr>
        {{#if resource.is_primitive}}
        {{#if resource.resource_agent.shortdesc}}
          <tr>
            <td>
              <div class="bold">Description:</div>
            </td>
            <td>
              <span class="reg" style="float:left;">
                {{resource.resource_agent.shortdesc}}
              </span>
              <span {{bind-attr title=resource.resource_agent.longdesc_html}} 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;">{{{resource.resource_agent.longdesc_html}}}</div>
            </td>
          </tr>
        {{/if}}
        {{/if}}
        {{#unless resource.stonith}}
        {{#if resource.is_primitive}}
          <tr>
            <td class="bold" nowrap>Current Location:</td>
            <td id="cur_res_loc" class="reg">{{resource.nodes_running_on_string}}</td>
          </tr>
          {{#unless resource.parent}}
            <tr>
              <td class="bold" nowrap>Clone:</td>
              <td id="cur_res_loc" class="reg" title="Makes the resource run multiple times on the cluster. By default the resource will run once on each of the nodes.">
                <input type="button" onclick="resource_clone(curResource());" value="Create clone">
              </td>
            </tr>
            {{#if Pcs.is_supported_resource_promotable}}
              <tr>
                <td class="bold" nowrap>Promotable Clone:</td>
                <td id="cur_res_loc" class="reg" title="Makes the resource run multiple times on the cluster and distinguish between Promoted and Demoted operating mode for each instance. By default the resource will run on one node in Promoted mode and on all other nodes in Demoted mode.">
                  <input type="button" onclick="resource_promotable(curResource());" value="Create promotable">
                </td>
              </tr>
            {{else}}
              <tr>
                <td class="bold" nowrap>Master/Slave:</td>
                <td id="cur_res_loc" class="reg" title="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.">
                  <input type="button" onclick="resource_master(curResource());" value="Create master/slave">
                </td>
              </tr>
            {{/if}}
            <tr>
              <td class="bold" nowrap>Group:</td>
              <td id="cur_res_loc" class="reg">
                {{group-selector resource_id=resource._id}}
              </td>
            </tr>
          {{else}}
            {{#if resource.parent.is_group}}
            {{#if resource.show_group_selector}}
            <tr>
              <td class="bold" nowrap>Group:</td>
              <td id="cur_res_loc" class="reg">
                {{group-selector resource_id=resource._id}}
              </td>
            </tr>
            {{/if}}
            {{/if}}
          {{/unless}}
        {{/if}}
        {{/unless}}
        {{#if resource.is_group}}
        {{#unless resource.parent}}
          <tr>
            <td class="bold" nowrap>Clone:</td>
            <td id="cur_res_loc" class="reg" title="Makes the resource run multiple times on the cluster. By default the resource will run once on each of the nodes.">
              <input type="button" onclick="resource_clone(curResource());" value="Create clone">
            </td>
          </tr>
          {{#if Pcs.is_supported_resource_promotable}}
            <tr>
              <td class="bold" nowrap>Promotable Clone:</td>
              <td id="cur_res_loc" class="reg" title="Makes the resource run multiple times on the cluster and distinguish between Promoted and Demoted operating mode for each instance. By default the resource will run on one node in Promoted mode and on all other nodes in Demoted mode.">
                <input type="button" onclick="resource_promotable(curResource());" value="Create promotable">
              </td>
            </tr>
          {{else}}
            <tr>
              <td class="bold" nowrap>Master/Slave:</td>
              <td id="cur_res_loc" class="reg" title="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.">
                <input type="button" onclick="resource_master(curResource());" value="Create master/slave">
              </td>
            </tr>
          {{/if}}
          {{#unless old_pcsd}}
            <tr>
              <td class="bold" nowrap>Group:</td>
              <td id="cur_res_loc" class="reg">
                <input type="button" onclick="resource_ungroup(curResource());" value="Ungroup">
              </td>
            </tr>
          {{/unless}}
        {{/unless}}
        {{/if}}
        {{#if resource.is_multi_instance}}
          <tr>
            <td class="bold" nowrap>Clone:</td>
            <td id="cur_res_loc" class="reg">
              <input type="button" onclick="resource_unclone(curResource());" value="Unclone">
            </td>
          </tr>
        {{/if}}
      </table>
      {{#unless resource.stonith}}
        {{location_constraints-table constraints=resource.location_constraints}}
        {{ordering_constraints-table constraints=resource.ordering_constraints resource_id=resource._id}}
        {{ordering_set_constraints-table constraints=resource.ordering_set_constraints}}
        {{colocation_constraints-table constraints=resource.colocation_constraints}}
        {{#if Pcs.is_supported_constraint_colocation_set}}
          {{colocation_set_constraints-table constraints=resource.colocation_set_constraints}}
        {{/if}}
        {{#if Pcs.is_ticket_constraints_supported}}
          {{ticket_constraints-table constraints=resource.ticket_constraints resource_id=resource._id}}
          {{ticket_set_constraints-table constraints=resource.ticket_set_constraints}}
        {{/if}}
        {{meta_attributes-table resource=resource}}
        {{#if utilization_support}}
          {{#if resource.is_primitive}}
            {{utilization-table
                entity=resource
                utilization=resource.utilization
                type="resource"
                table_id="resource_utilization_attributes"
            }}
          {{/if}}
        {{/if}}
        <br style="clear:left;">
      {{/unless}}
    </div>
    {{#if stonith}}
      <div style="clear:left; margin-top: 2em;" id="stonith_agent_form">
        {{fence-form
            resource=resource
            agent=resource.resource_agent
            table_id_suffix="_existing"
        }}
      </div>
    {{else}}
    {{#if resource.is_primitive}}
      <div style="clear:left; margin-top: 2em;" id="resource_agent_form">
        {{resource-form
            resource=resource
            agent=resource.resource_agent
            table_id_suffix="_existing"
        }}
      </div>
    {{/if}}
    {{/if}}
  {{else}}
    {{#if stonith}}
      NO FENCE DEVICE IN CLUSTER
    {{else}}
      NO RESOURCES IN CLUSTER
    {{/if}}
  {{/if}}
  </script>

  <script type="text/x-handlebars" data-template-name="components/location_constraints-table">
    <table style="clear:left;float:left">
		<tr><td style="display: block;" onclick="show_hide_constraints(this)" class="datatable_header hover-pointer" id="location_constraints"><span style="" class="downarrow sprites"></span><span style="display: none;" class="rightarrow sprites"></span>Resource Location Preferences ({{#if constraints}}{{constraints.length}}{{else}}0{{/if}})</td></tr>
		<tr><td>
		    <div id="locationdep">
		      <table class="datatable">
			<tr><th>Node/Rule</th><th>Score</th><th>Remove</th></tr>
			{{#each cons in constraints}}
			<tr>
			{{#if cons.rule_string}}
			  <td style="white-space: normal;">{{cons.rule_string}}</td>
			  <td>{{#if cons.score-attribute}}{{cons.score-attribute}}{{else}}{{cons.score}}{{/if}}</td>
			  <td {{bind-attr rule_id=cons.id}} style="text-align:center">
			    {{#unless cons.temp}}
				<a onclick="remove_constraint_rule($(this).parent().attr('rule_id'));return false;" href="#" class="remove">X</a>
			    {{/unless}}
			  </td>
			{{else}}
			  <td>{{cons.node}}</td>
			  <td>{{cons.score}}</td>
			  <td {{bind-attr constraint_id=cons.id}} style="text-align:center">
			    {{#unless cons.temp}}
				<a onclick="return remove_constraint_action(this);" href="#" class="remove">X</a>
			    {{/unless}}
			  </td>
			{{/if}}
			</tr>
			{{else}}
			<tr><td style="color: gray;">NONE</td><td></td><td></td></tr>
		        {{/each}}
			<tr id="new_res_loc">
			  <td><input type="text" name="node_id"></td>
			  <td><input type="text" name="score" size="5"></td>
			  <td><button type="button" onclick="add_constraint('#new_res_loc','loc', false);" name="add">Add</button></td>
			</tr>
		      </table>
		    </div>
		  </td>
		</tr>
    </table>
  </script>

  <script type="text/x-handlebars" data-template-name="components/ordering_constraints-table">
    <table style="clear:left;float:left;">
		<tr><td style="display: block;" onclick="show_hide_constraints(this)" class="datatable_header hover-pointer" id="ordering_constraints"><span style="" class="downarrow sprites"></span><span style="display: none;" class="rightarrow sprites"></span>Resource Ordering Preferences ({{#if constraints.length}}{{constraints.length}}{{else}}0{{/if}})</td></tr>
		<tr><td>
		    <div id="locationdep">
		      <table class="datatable">
			<tr><th>Resource</th><th>Action</th><th>Before/After</th><th>Action</th><th>Score</th><th>Remove</th></tr>
		        {{#each cons in constraints}}
			  <tr><td>{{cons.other_rsc}}</td>
			    {{#if cons.before}}
			      <td>{{#if cons.first-action}}{{cons.first-action}}s{{else}}starts{{/if}}</td>
			      <td>before {{then}}</td>
			      <td>{{#if cons.then-action}}{{cons.then-action}}s{{else}}starts{{/if}}</td>
			    {{else}}
			      <td>{{#if cons.then-action}}{{cons.then-action}}s{{else}}starts{{/if}}</td>
			      <td>after {{cons.first}}</td>
			      <td>{{#if cons.first-action}}{{cons.first-action}}s{{else}}starts{{/if}}</td>
			    {{/if}}
			    <td>{{cons.score}}</td>
			    <td {{bind-attr constraint_id=cons.id}} style="text-align:center">
				  <a onclick="return remove_constraint_action(this);" href="#" class="remove">X</a>
			    </td>
			  </tr>
			{{else}}
			<tr><td style="color: gray;">NONE</td><td></td><td></td><td></td><td></td><td></td></tr>
 			{{/each}}
			<tr id="new_res_orc">
			  <td><input type="text" name="target_res_id"></td>
			  <td>
			    <select name="target_action">
			      <option value="start">starts</option>
			      <option value="promote">promotes</option>
			      <option value="demote">demotes</option>
			      <option value="stop">stops</option>
			    </select>
			  </td>
			  <td>
			    <select name="order">
			      <option value="after">after</option>
			      <option value="before">before</option>
			    </select>
			    {{resource_id}}
			  </td>
			  <td>
			    <select name="res_action">
			      <option value="start">starts</option>
			      <option value="promote">promotes</option>
			      <option value="demote">demotes</option>
			      <option value="stop">stops</option>
			    </select>
			  </td>
			  <td><input type="text" name="score" size="5"></td>
			  <td><button type="button" onclick="add_constraint('#new_res_orc','ord', false);" name="add">Add</button></td>
			</tr>
		      </table>
		    </div>
		  </td>
		</tr>
	      </table>
  </script>

  <script type="text/x-handlebars" data-template-name="components/ordering_set_constraints-table">
    <table style="clear:left;float:left;">
          <tr><td style="display: block;" onclick="show_hide_constraints(this)" class="datatable_header hover-pointer" id="ordering_set_constraints"><span style="" class="downarrow sprites"></span><span style="display: none;" class="rightarrow sprites"></span>Resource Ordering Set Preferences ({{#if constraints.length}}{{constraints.length}}{{else}}0{{/if}})</td></tr>
          <tr><td>
            <div id="locationdep">
              <table class="datatable">
                <tr>
                  <th>Preference Name/Set of Resources</th>
                  <th style="text-align: center;">Remove</th>
                </tr>
                {{#each cons in constraints}}
                <tr>
                  <td>{{cons.id}}</td>
                  <td {{bind-attr constraint_id="cons.id"}} style="text-align:center;">
                    <a onclick="return remove_constraint_action(this);" href="#" class="remove">X</a>
                  </td>
                </tr>
                {{#each set in cons.sets}}
                <tr>
                  <td style="padding-left:2em;">Set:{{#each rsc in set.resources}} {{rsc}}{{/each}}</td>
                  <td></td>
                </tr>
                {{/each}}
                {{else}}
                <tr><td style="color: gray;">NONE</td><td></td></tr>
                {{/each}}
                <tr id="new_res_orc_set" title="Enter the resources you want to be in one set into the 'Set' field separated by space.
Use the 'New Set' button to create more sets.
Use the 'Add' button to submit the form.">
                  <td>Set: <input type="text" name="resource_ids[]"></td>
                  <td style="vertical-align: bottom;">
                    <button type="button" onclick="new_constraint_set_row('#new_res_orc_set');" name="new-row">New Set</button>
                    <button type="button" onclick="add_constraint_set('#new_res_orc_set', 'ord', false);" name="add">Add</button>
                  </td>
                </tr>
              </table>
            </div>
          </td></tr>
        </table>
  </script>

  <script
    type="text/x-handlebars"
    data-template-name="components/ticket_constraints-table"
  >
    <table style="clear:left;float:left;">
      <tr>
        <td
          style="display: block;"
          onclick="show_hide_constraints(this)"
          class="datatable_header hover-pointer"
          id="ticket_constraints"
        >
          <span style="" class="downarrow sprites"></span>
          <span style="display: none;" class="rightarrow sprites"></span>
          Resource Ticket Preferences
          ({{#if constraints.length}}{{constraints.length}}{{else}}0{{/if}})
        </td>
      </tr>
      <tr>
        <td>
          <div id="locationdep">
            <table class="datatable">
              <tr>
                <th>Ticket</th>
                <th>Resource Role</th>
                <th>Loss Policy</th>
                <th>Remove</th>
              </tr>
              {{#each cons in constraints}}
                <tr>
                  <td>{{cons.ticket}}</td>
                  <td>{{cons.rsc-role}}</td>
                  <td>{{cons.loss-policy}}</td>
                  <td
                    {{bind-attr constraint_id=cons.id}}
                    style="text-align:center"
                  >
                    <a
                      onclick="return remove_constraint_action(this);"
                      href="#"
                      class="remove"
                    >X</a>
                  </td>
                </tr>
              {{else}}
                <tr>
                  <td colspan="4" style="color: gray;">NONE</td>
                </tr>
              {{/each}}
              <tr id="new_ticket_constraint">
                <td class="constraint-ticket-add-attribute">
                  <input type="text" name="ticket"/>
                </td>
                <td class="constraint-ticket-add-attribute">
                  <select name="role"/>
                    <option value=""></option>
                    <option value="Stopped">Stopped</option>
                    <option value="Started">Started</option>
                    <option value="Master">Master</option>
                    <option value="Slave">Slave</option>
                  </selct>
                </td>
                <td class="constraint-ticket-add-attribute">
                  <select name="loss-policy"/>
                    <option value=""></option>
                    <option value="fence">fence</option>
                    <option value="stop">stop</option>
                    <option value="freeze">freeze</option>
                    <option value="demote">demote</option>
                  </selct>
                </td>
                <td>
                  <button type="button" name="add"
                    onclick="add_constraint(
                      '#new_ticket_constraint',
                      'ticket',
                      false
                    );"
                  >Add</button>
                </td>
              </tr>
            </table>
          </div>
        </td>
      </tr>
    </table>
  </script>

  <script
    type="text/x-handlebars"
    data-template-name="components/ticket_set_constraints-table"
  >
    <table style="clear:left;float:left;">
      <tr>
        <td
          id="ticket_set_constraints"
          class="datatable_header hover-pointer"
          style="display: block;"
          onclick="show_hide_constraints(this)"
        >
          <span style="" class="downarrow sprites"></span>
          <span style="display: none;" class="rightarrow sprites"></span>
          Resource Ticket Set Preferences
          ({{#if constraints.length}}{{constraints.length}}{{else}}0{{/if}})
        </td>
      </tr>
      <tr>
        <td>
          <div id="locationdep">
            <table class="datatable">
              <tr>
                <th>Preference Name/Set of Resources</th>
                <th>Ticket</th>
                <th>Loss Policy</th>
                <th style="text-align: center;">Remove</th>
              </tr>
              {{#each cons in constraints}}
                <tr>
                  <td>{{cons.id}}</td>
                  <td>{{cons.ticket}}</td>
                  <td>{{cons.loss-policy}}</td>
                  <td
                    {{bind-attr constraint_id="cons.id"}}
                    style="text-align:center;"
                  >
                    <a
                      onclick="return remove_constraint_action(this);"
                      href="#"
                      class="remove"
                    >X</a>
                  </td>
                </tr>
                {{#each set in cons.sets}}
                <tr>
                  <td style="padding-left:2em;" colspan="4">
                    Set:{{#each rsc in set.resources}} {{rsc}}{{/each}}
                  </td>
                </tr>
                {{/each}}
              {{else}}
                <tr><td style="color: gray;" colspan="4">NONE</td></tr>
              {{/each}}
              <tr id="new_ticket_constraint_resource_set" title="
                Enter the resources you want to be in one set into the 'Set'
                field separated by space.
                Use the 'New Set' button to create more sets.
                Use the 'Add' button to submit the form.
              ">
                <td>Set: <input type="text" name="resource_ids[]"></td>
                <td class="constraint-ticket-add-attribute">
                  <input type="text" name="ticket"/>
                </td>
                <td class="constraint-ticket-add-attribute">
                  <select name="loss-policy"/>
                    <option value=""></option>
                    <option value="fence">fence</option>
                    <option value="stop">stop</option>
                    <option value="freeze">freeze</option>
                    <option value="demote">demote</option>
                  </selct>
                </td>
                <td style="vertical-align: bottom;">
                  <button type="button" name="new-row"
                    onclick="new_constraint_set_row(
                      '#new_ticket_constraint_resource_set'
                    );"
                  >New Set</button>
                  <button type="button" name="add"
                    onclick="add_constraint_set(
                      '#new_ticket_constraint_resource_set',
                      'ticket',
                      false
                    );"
                  >Add</button>
                </td>
              </tr>
            </table>
          </div>
        </td>
      </tr>
    </table>
  </script>

  <script type="text/x-handlebars" data-template-name="components/colocation_constraints-table">
    <table style="clear:left;float:left">
		<tr><td onclick="show_hide_constraints(this)" class="datatable_header hover-pointer" id="colocation_constraints"><span style="" class="downarrow sprites"></span><span style="display: none;" class="rightarrow sprites"></span>Resource Colocation Preferences ({{#if constraints.length}}{{constraints.length}}{{else}}0{{/if}})</td></tr>
		<tr><td>
		    <div id="locationdep">
		      <table class="datatable">
			<tr><th>Resource</th><th>Together/Apart</th><th>Score</th><th>Remove</th></tr>
			{{#each cons in constraints}}
			  <tr><td>{{cons.other_rsc}}</td>
			    <td>{{cons.together}}</td>
			    <td>{{cons.score}}</td>
			    <td {{bind-attr constraint_id=cons.id}} style="text-align:center">
				  <a onclick="return remove_constraint_action(this);" href="#" class="remove">X</a>
			    </td>
			  </tr>
			  {{else}}
			  <tr><td style="color: gray;">NONE</td><td></td><td></td><td></td></tr>
              {{/each}}
			<tr id="new_res_col">
			  <td><input type="text" name="target_res_id"></td>
			  <td><select name="colocate"><option value="together">Together<option value="apart">Apart</select></td>
			  <td><input type="text" name="score" size="5"></td>
			  <td><button type="button" onclick="add_constraint('#new_res_col','col', false);" name="add">Add</button></td>
			</tr>

		      </table>
		    </div>
		  </td>
		</tr>
	      </table>
  </script>

  <script type="text/x-handlebars" data-template-name="components/colocation_set_constraints-table">
    <table style="clear:left;float:left;">
          <tr><td style="display: block;" onclick="show_hide_constraints(this)" class="datatable_header hover-pointer" id="colocation_set_constraints"><span style="" class="downarrow sprites"></span><span style="display: none;" class="rightarrow sprites"></span>Resource Colocation Set Preferences ({{#if constraints.length}}{{constraints.length}}{{else}}0{{/if}})</td></tr>
          <tr><td>
            <div id="locationdep">
              <table class="datatable">
                <tr>
                  <th>Preference Name/Set of Resources</th>
                  <th style="text-align: center;">Remove</th>
                </tr>
                {{#each cons in constraints}}
                <tr>
                  <td>{{cons.id}}</td>
                  <td {{bind-attr constraint_id="cons.id"}} style="text-align:center;">
                    <a onclick="return remove_constraint_action(this);" href="#" class="remove">X</a>
                  </td>
                </tr>
                {{#each set in cons.sets}}
                <tr>
                  <td style="padding-left:2em;">Set:{{#each rsc in set.resources}} {{rsc}}{{/each}}</td>
                  <td></td>
                </tr>
                {{/each}}
                {{else}}
                <tr><td style="color: gray;">NONE</td><td></td></tr>
                {{/each}}
                <tr id="new_res_col_set" title="Enter the resources you want to be in one set into the 'Set' field separated by space.
Use the 'New Set' button to create more sets.
Use the 'Add' button to submit the form.">
                  <td>Set: <input type="text" name="resource_ids[]"></td>
                  <td style="vertical-align: bottom;">
                    <button type="button" onclick="new_constraint_set_row('#new_res_col_set');" name="new-row">New Set</button>
                    <button type="button" onclick="add_constraint_set('#new_res_col_set', 'col', false);" name="add">Add</button>
                  </td>
                </tr>
              </table>
            </div>
          </td></tr>
        </table>
  </script>

  <script type="text/x-handlebars" data-template-name="components/meta_attributes-table">
    <table style="clear:left;float:left">
		<tr><td onclick="show_hide_constraints(this)" class="datatable_header hover-pointer" id="meta_attributes"><span style="" class="downarrow sprites"></span><span style="display: none;" class="rightarrow sprites"></span>Resource Meta Attributes ({{#if resource.meta_attr.length}}{{resource.meta_attr.length}}{{else}}0{{/if}})</td></tr>
		<tr><td>
		    <div id="locationdep">
		      <table class="datatable">
			<tr><th>Meta Attribute</th><th>Value</th><th>Remove</th></tr>
			{{#each meta in resource.meta_attr}}
			<tr><td>{{meta.name}}</td>
			    <td>{{meta.value}}</td>
			    <td {{bind-attr meta_attr_key=meta.name}} {{bind-attr meta_attr_res=resource.id}} style="text-align:center">
				  <a onclick="remove_meta_attr($(this).parent());return false;" href="#" class="remove">X</a>
			    </td>
			  </tr>
			  {{else}}
			  <tr><td style="color: gray;">NONE</td><td></td><td></td></tr>
			  {{/each}}
			<tr id="new_meta_col">
			  <td><input type="text" name="new_meta_key" size="20"></td>
			  <td><input type="text" name="new_meta_value" size="20"></td>
			  <td><button type="button" onclick="add_meta_attr('#new_meta_col');" name="add">Add</button></td>
			</tr>
		      </table>
		    </div>
		  </td>
		</tr>
    </table>
  </script>

  <script type="text/x-handlebars" data-template-name="components/utilization-table">
    <table style="clear:left; float:left;">
      <tr>
        <td
            {{action toggleBody}}
            {{bind-attr id=table_id}}
            class="datatable_header hover-pointer"
        >
          {{#if show_content}}
            <span class="downarrow sprites"></span>
          {{else}}
            <span class="rightarrow sprites"></span>
          {{/if}}
          <span style="text-transform: capitalize;">{{type}} Utilization Attributes ({{util_count}})</span>
        </td>
      </tr>
      {{#if show_content}}
      <tr>
        <td>
          <div class="utilization_table">
            <table class="datatable">
              <tr>
                <th>Utilization Attribute</th><th>Value</th><th>Remove</th>
              </tr>
              {{#each util in utilization}}
              <tr>
                <td>{{util.name}}</td>
                <td>{{util.value}}</td>
                <td style="text-align: center;">
                  <a {{action remove util.name}} class="remove" href="#">X</a>
                </td>
              </tr>
              {{else}}
              <tr>
                <td style="color: gray;">NONE</td><td></td><td></td>
              </tr>
              {{/each}}
              <tr {{bind-attr id=form_id}}>
                <td>
                  <input type="text" name="new_utilization_name" size="20">
                </td>
                <td>
                  <input type="text" name="new_utilization_value" size="20">
                </td>
                <td>
                  <button {{action add form_id}} type="button" name="add">Add</button>
                </td>
              </tr>
            </table>
          </div>
        </td>
      </tr>
      {{/if}}
    </table>
  </script>

  <script type="text/x-handlebars" data-template-name="components/parameters-table-element">
    <tr>
      <td class="reg">
        <span style="float: left;">
          {{param.name}}
        </span>
        {{#if param.description}}
          <span style="margin-left: 0.5em" class="infoicon sprites" {{bind-attr title=param.description}}></span>
        {{/if}}
      </td>
      <td>
        {{input
            size="30"
            type="text"
            name=param.form_name
            value=param.cur_val
            placeholder=param.default
        }}
      </td>
    </tr>
    {{#if param.deprecated}}
      <tr>
        <td colspan="2">
          <span class="status-warning">
            &apos;{{param.name}}&apos; is deprecated{{#if param.deprecated_by}}, use
              {{#each new_param in param.deprecated_by}}
                &apos;{{new_param}}&apos;
              {{/each}}
              instead
            {{/if}}
          </span>
        </td>
      </tr>
    {{/if}}
    {{#if param.pcs_deprecated_warning}}
      <tr>
        <td colspan="2">
          <span class="status-warning">{{param.pcs_deprecated_warning}}</span>
        </td>
      </tr>
    {{/if}}
  </script>

  <script type="text/x-handlebars" data-template-name="components/parameters-table">
  {{#if parameters}}
    <table style="clear:left; margin-top: 1em;" class="args-table">
      {{#if show_title}}
        <thead>
          <tr>
            <td
                {{action toggleBody}}
                {{bind-attr id=table_id_full}}
                colspan="2"
                nowrap
            >
              {{#if show_content}}
                <span class="downarrow sprites"></span>
              {{else}}
                <span class="rightarrow sprites"></span>
              {{/if}}
              <span class="bold">{{table_name}}</span>
            </td>
          </tr>
        </thead>
      {{/if}}
      <tbody {{bind-attr style=content_style}}>
        {{#each parameter in parameters}}
          {{parameters-table-element param=parameter}}
        {{/each}}
      </tbody>
    </table>
  {{/if}}
  </script>

  <script type="text/x-handlebars" data-template-name="components/resource-form">
    <div style="clear:left; margin-top: 1em;">
      <form method="post" action="/update_resource">
        {{#if resource}}
          <input type="hidden" name="resource_id" {{bind-attr value=resource.id}} />
        {{/if}}
        <input type="hidden" name="resource_type" {{bind-attr value=agent.name}} />
        {{#unless resource}}
          <div id="resource_group">
            <table class="args-table">
              <tbody>
                <tr>
                  <td>
                    <div class="bold">Description:</div>
                  </td>
                  <td>
                    <span class="reg" style="float:left;">
                      {{agent.shortdesc}}
                    </span>
                    <span {{bind-attr title=agent.longdesc_html}} 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;">{{{agent.longdesc_html}}}</div>
                  </td>
                </tr>
                <tr title="Select a group to add the resource to.">
                  <td nowrap>
                    <div class="bold">
                      Resource Group:
                    </div>
                  </td>
                  <td>
                    {{group-selector
                        group_list=Pcs.resourcesContainer.group_list
                        group_input_name="resource_group"
                    }}
                  </td>
                </tr>
                <tr title='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="">
                    <input type=checkbox name="resource_clone">
                  </td>
                </tr>
                {{#if Pcs.is_supported_resource_create_promotable}}
                  <tr title='Makes the resource run multiple times on the cluster and distinguish between Promoted and Demoted operating mode for each instance. By default the resource will run on one node in Promoted mode and on all other nodes in Demoted mode.'>
                    <td nowrap>
                      <div class="bold">
                        Promotable Clone:
                      </div>
                    </td>
                    <td>
                      <input type="hidden" name="_orig_resource_promotable" value="">
                      <input type=checkbox name="resource_promotable" >
                    </td>
                  </tr>
                {{else}}
                  <tr title='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="">
                      <input type=checkbox name="resource_ms" >
                    </td>
                  </tr>
                {{/if}}
                <tr title="Do not start the resource automatically after creating.">
                  <td nowrap>
                    <div class="bold"
                      >Disabled:
                    </div>
                  </td>
                  <td>
                    <input type=checkbox name="disabled">
                  </td>
                </tr>
                <tr>
                  <td class="reg">
                    Resource ID
                  </td>
                  <td>
                    <input style="margin-right: 50px;" type="text" name="name" size="30" class="text_field">
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
        {{/unless}}
        {{parameters-table
            table_id="required_args"
            table_id_suffix=table_id_suffix
            table_name="Required Arguments"
            parameters=agent.required_parameters
            show_content=true
        }}
        {{parameters-table
            table_id="optional_args"
            table_id_suffix=table_id_suffix
            table_name="Optional Arguments"
            parameters=agent.optional_parameters
        }}
        {{parameters-table
            table_id="advanced_args"
            table_id_suffix=table_id_suffix
            table_name="Advanced Arguments"
            parameters=agent.advanced_parameters
        }}
        {{#if resource}}
          {{#if agent.deprecated_parameters}}
            {{parameters-table
                table_id="deprecated_args"
                table_id_suffix=table_id_suffix
                table_name="Deprecated Arguments"
                parameters=agent.deprecated_parameters
            }}
          {{/if}}
        {{/if}}
        {{#if resource}}
          <input class="apply_changes" type="button" onclick="$(this).hide();create_resource($(this)
          .parents('form'),true); return false;" value="Apply Changes" style="margin-top: 1em;" />
          <input type="button" onclick="tree_view_onclick(curResource()); return false;"  value="Refresh" />
        {{else}}
          <center>
            <input class="apply_changes" type="button" onclick="$(this).hide();create_resource($(this)
            .parents('form'),false); return false;" value="Create Resource" style="margin-top: 1em;" />
          </center>
        {{/if}}
      </form>
    </div>
  </script>

  <script type="text/x-handlebars" data-template-name="components/fence-form">
    <div style="clear:left; margin-top: 2em;">
      <form method="post" action="/update_fence_device">
        {{#if resource}}
          <input type="hidden" name="resource_id" {{bind-attr value=resource.id}} />
        {{/if}}
        <input type="hidden" name="resource_type" {{bind-attr value=agent.name}} />
        {{#unless resource}}
          <table class="args-table">
            <tbody>
              {{#if agent.shortdesc}}
              <tr>
                <td>
                  <div class="bold">Description:</div>
                </td>
                <td>
                  <span class="reg" style="float:left;">
                    {{agent.shortdesc}}
                  </span>
                  <span {{bind-attr title=agent.longdesc_html}} 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;">{{{agent.longdesc_html}}}</div>
                </td>
              </tr>
              {{/if}}
              <tr>
                <td class="reg">
                  Fence Instance Name
                </td>
                <td>
                  <input style="margin-right: 50px;" type="text" name="name" size="30" class="text_field">
                </td>
              </tr>
            </tbody>
          </table>
        {{/unless}}
        {{parameters-table
            table_id="required_fenceargs"
            table_id_suffix=table_id_suffix
            table_name="Required Arguments"
            parameters=agent.required_parameters
            show_content=true
        }}
        {{parameters-table
            table_id="optional_fenceargs"
            table_id_suffix=table_id_suffix
            table_name="Optional Arguments"
            parameters=agent.optional_parameters
        }}
        {{parameters-table
            table_id="advanced_fenceargs"
            table_id_suffix=table_id_suffix
            table_name="Advanced Arguments"
            parameters=agent.advanced_parameters
        }}
        {{#if resource}}
          {{#if agent.deprecated_parameters}}
            {{parameters-table
                table_id="deprecated_fenceargs"
                table_id_suffix=table_id_suffix
                table_name="Deprecated Arguments"
                parameters=agent.deprecated_parameters
            }}
          {{/if}}
        {{/if}}
        {{#if resource}}
          <input class="apply_changes" type="button" onclick="$(this).hide();create_resource($(this).parents('form'), true, true); return false;" value="Apply Changes" style="margin-top: 1em;" />
          <input type="button" onclick="tree_view_onclick(curStonith()); return false;" value="Refresh" />
        {{else}}
          <center>
            <input class="apply_changes" type="button" type="submit" onclick="$(this).hide();create_resource($(this).parents('form'), false, true); return false;" value="Create Fence Instance" style="margin-top: 1em;" />
          </center>
        {{/if}}
      </form>
    </div>
  </script>

  <script type="text/x-handlebars" data-template-name="components/value-selector">
    {{selector-helper content value prompt}}
  </script>

  <script type="text/x-handlebars" data-template-name="components/cluster-property">
    <td>
      <span style="float: left;">
        {{prop.readable_name}}
      </span>
      <span style="margin-left: 0.5em" class="infoicon sprites" {{bind-attr title=prop.description}}></span>
    </td>
    <td>
      {{#if prop.is_boolean}}
        {{value-selector
            prompt="(Default)"
            content=boolean_options
            value=prop.cur_val
            name=prop.form_name
        }}
      {{else}}{{#if prop.is_enum}}
        {{value-selector
            prompt="(Default)"
            content=prop.enum_show
            value=prop.cur_val
            name=prop.form_name
        }}
      {{else}}
      {{input
          type="text"
          name=prop.form_name
          value=prop.cur_val
          placeholder=prop.default
      }}
      {{/if}}{{/if}}
    </td>
  </script>

  <script type="text/x-handlebars" data-template-name="components/group-selector">
    {{value-selector
        name=group_input_name
        content=group_select_content
        value=group_select_value
        prompt="None"
    }}
    {{#if Pcs.is_supported_moving_resource_in_group}}
    {{#if group_select_value}}
    {{#if resource_select_content}}
      {{value-selector
          name="in_group_position"
          content=position_select_content
          value=position_select_value
          prompt=""
      }}
      {{value-selector
          name="in_group_reference_resource_id"
          content=resource_select_content
          value=resource_select_value
          prompt=""
      }}
    {{/if}}
    {{/if}}
    {{/if}}
    {{#if resource_id}}
      <br/>
      <button
        onclick="
          resource_change_group(curResource(), $(this).parent().find('select'));
          return false;
        "
      >
        Update group
      </button>
      <button {{action refresh}}>Refresh</button>
    {{/if}}

  </script>

  <script type="text/x-handlebars">
<div id="wrapper">

<div id="header"><div id="topmenu">
  <table id="menu_controls">
    <tr>
      <td width="170" style="vertical-align: top;">
        <div id="logo">
          <img width="170" height="40" src="/images/HAM-logo.png" onclick="if (Pcs) { Pcs.update(); }">
        </div>
      </td>
      <td>
        <div id="menu_list">
          <table width="700">
            <tr>
              <td style="padding-bottom:8px;">
                <% if @clusters != nil %>
                  <div style="float:left;">
                    <div class="menuheader">
                      <div id="dropdownr" class="label"  style="white-space:nowrap" onclick="window.location='/manage'">
                        <table style="background: #000000">
                          <tr>
                            <td>
                              <%=@manage ? "Select Cluster" : "Cluster: " + @cluster_name%>
                            </td>
                            <td>
                              <div style="float:right;" class="downarrow sprites"></div>
                            </td>
                          </tr>
                        </table>
                      </div>
                      <div style="width:100%;" class="menu">
                        <% if not @manage %>
                          <a href="/manage" class="menu-item">Manage&nbsp;Clusters&nbsp;&nbsp;</a>
                        <% end %>
                        <% @clusters.each { |c| %>
                          <a href="<%=c.ui_address%>" class="menu-item"><%=c.name%>&nbsp;&nbsp;</a>
                        <% } %>
                      </div>
                    </div>
                  </div>
                <% end %>
              </td>
              <td style="padding-bottom:8px;">
                <% if @tornado_is_authenticated %>
                  <div style="float:right">
                    <div class="menuheader">
                      <div id="dropdownr" class="label"><%=@tornado_session_username%><div style="float:right;" class="downarrow sprites"></div></div>
                      <div style="width:100%" class="menu">
                        <a href="/logout" class="menu-item">Logout&nbsp;&nbsp;</a>
                      </div>
                    </div>
                    <!-- <div id="dropdownr">
                      <%=@tornado_session_username%><div style="float:right;" class="downarrow sprites"></div>
                    </div> -->
                  </div>
                <% end %>
              </td>
            </tr>
          </table>
          <table>
            <% if !@manage %>
              <tr>
                <td class="menuitem first">{{#link-to "Nodes" }}NODES{{/link-to}}</td>
                <td class="menuitem">{{#link-to "Resources" }}RESOURCES{{/link-to}}</td>
                <td class="menuitem">{{#link-to "Fence Devices" }}FENCE DEVICES{{/link-to}}</td>
                <td class="menuitem">{{#link-to "ACLs" }}ACLS{{/link-to}}</td>
                <td class="menuitem">{{#link-to "Configuration" }}CLUSTER PROPERTIES{{/link-to}}</td>
                <td class="menuitem"><a href="/manage">MANAGE CLUSTERS</a></td>
              </tr>
            <% else %>
              <tr>
                <td class="menuitem first"><a href="/manage">MANAGE CLUSTERS</a></td>
                <td class="menuitem"><a href="/permissions">PERMISSIONS</a></td>
              </tr>
            <% end %>
          </table>
        </div>
      </td>
      <td> </td>
    </tr>
  </table>
</div></div>

<div id="content">
  <%= yield %>
</div>

<div id="push">
</div>

</div>
    </script>
<!--  <div id="footer">
    <div id="copyright">&copy 2012</div>&nbsp;<a href="http://www.redhat.com">Red Hat, Inc.</a>  <a href="http://access.redhat.com/">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Red Hat Customer Portal</a>
    <div id="help"><a href="#">Help</a></div>
  </div> -->
  <div id="loading_screen" style="display:hidden;">
    <div id="loading_screen_progress_bar"></div>
  </div>
<table id="footer" style="display: none;">
  <tr>
    <td>&copy 2012&nbsp;<a href="http://www.redhat.com">Red Hat, Inc.</a>&nbsp;&nbsp;<a href="http://access.redhat.com/">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Red Hat Customer Portal</td>
    <td align=right><a href="#">Help</a></td>
  </tr>
</table>
</div>
</body>
  <script src="/js/nodes-ember.js"></script>
  <script type="text/javascript">
$(function() {
  disable_checkbox_clicks();
  setup_resource_class_provider_selection();
});

  </script>
<% if @error %>
  <script type="text/javascript">
    $(function() {
      $("#manage_error").dialog({
	title: "Warning",
	buttons: {
	  Ok: function() {
	    $(this).dialog("close");
	  }
	},
	autoOpen:true
      });
    });
  </script>
<% end %>

  </html>
