<%@ taglib uri="webwork" prefix="webwork" %>
<%@ taglib uri="webwork" prefix="ui" %>
<%@ taglib uri="sitemesh-page" prefix="page" %>

<div id="portlet-search-view-container" >

    <div id="portlet-search-view-control-panel">
    <%-- An initial / is contained in the searchRequestUrl so we don't need one between the context path and the value, in
         fact if you are running without a context path it will break --%>
        <a href="<%=request.getContextPath()%><webwork:property value="searchRequestUrl" />" class="lbAction" rel="insert" onclick="return false;" ><webwork:text name="'admin.common.words.view'"/></a>
        |
        <webwork:text name="'admin.common.words.configure'"/>
        |
        <a href="#" class="lbAction" rel="deactivate"><webwork:text name="'admin.common.words.close'"/></a>
    </div>

    <div id="portlet-search-view-picker">
        <webwork:text name="'navigator.search.request.view.chart.configureTitle'">
           <webwork:param name="'value0'"><strong></webwork:param>
           <webwork:param name="'value1'"></strong></webwork:param>
        </webwork:text>
    </div>

    <div id="portlet-search-view-portlet-name" >
        <form action="<%=request.getContextPath()%>/secure/SavePortletSearchViewConfiguration!default.jspa"
                method="post" class="lbAction" >
            <ui:component name="'decorator'" value="'none'" template="hidden.jsp"  />
            <ui:component name="'searchRequestUrl'" value="searchRequestUrl" template="hidden.jsp" />

            <table width="100%">
                <tr>
                    <td width="25%" align="right"><webwork:text name="'navigator.search.request.view.chart.type'"/></td>
                    <td>
                        <ui:select name="'portletIdStr'" list="portlets" label="'Chart Type'" listKey="'id'" listValue="'name'" value="portlet/id" >
                            <ui:param name="'class'" value="'lbAction'" />
                            <ui:param name="'nolabel'" value="'true'" />
                        </ui:select>
                    </td>
                </tr>
            </table>
        </form>
    </div>

    <div class="containerHeaderText">
        <webwork:text name="'navigator.search.request.view.chart.configureOptions'">
            <webwork:param name="'value0'"><strong></webwork:param>
            <webwork:param name="'value1'"></strong></webwork:param>
        </webwork:text>
    </div>
    <form action="<%=request.getContextPath()%>/secure/SavePortletSearchViewConfiguration.jspa"
          method="get" class="lbAction" onsubmit="return false;">

        <div id="portlet-search-view-configuration-form" >
            <ui:component name="'searchRequestUrl'" value="searchRequestUrl" template="hidden.jsp" />
            <ui:component name="'portletIdStr'" value="/portlet/id" template="hidden.jsp"  />
            <ui:component name="'decorator'" value="'none'" template="hidden.jsp"  />
            <ui:component name="'portletClass'" value="/portlet/class/name" template="hidden.jsp"  />

            <table cellspacing=0 cellpadding=0 width="100%">
                    <tr><td class="fieldLabelArea" style="height:4px"></td><td class="fieldValueArea" ></td></tr>
                <webwork:iterator value="nonSearchRequestFieldKeys">
                    <tr><%@ include file="/includes/panels/objectconfiguration_form.jsp"  %></tr>
                </webwork:iterator>
            </table>
        </div>

        <center>
            <input id="configurePortletViewButton" type="submit" disabled="true" value="<webwork:text name="'admin.common.words.view'"/>" />
            <a href="<%=request.getContextPath()%><webwork:property value="searchRequestUrl" />" class="lbAction" rel="insert" onclick="return false;">
                <input type="button" value="<webwork:text name="'admin.common.words.cancel'"/>" />
            </a>
        </center>
    </form>
</div>

<script type="text/javascript">

    // This is a hack so that the user can not press the view button until we have decorated the
    // form. The button is initially disabled and we enable it via this decoration code.
    var configurePortletViewButton = document.getElementById('configurePortletViewButton');
    if(configurePortletViewButton != null)
    {
        configurePortletViewButton.disabled = false;
    }
</script>