<%
  import org.exoplatform.wcm.webui.selector.content.UIContentSearchForm;
  import org.exoplatform.web.application.JavascriptManager;

  def rcontext = _ctx.getRequestContext();
  def checkedRadioId = uicomponent.getCheckedRadioId();
  def jsManager = rcontext.getJavascriptManager();
  jsManager.importJavascript("eXo.wcm.frontoffice.private.CLV", "/eXoWCMResources/javascript");
  
  jsManager.addJavascript("eXo.ecm.CLV.initCheckedRadio('$checkedRadioId');");
  jsManager.addJavascript("eXo.ecm.CLV.initCondition('$uiform.id');");
  jsManager.addOnLoadJavascript("eXo.ecm.CLV.setHiddenValue");
%>

<div class="$uicomponent.id">
  <%uiform.begin();%>
    <div class="ContentSearchForm">
    <span><%= _ctx.appRes("UIContentSearchForm.title.Location")%>: </span> <%uiform.renderField(uiform.getChildById(uicomponent.LOCATION));%>
    </div>
    <input type="hidden" class="hidden" id="<%=uicomponent.CHECKED_RADIO_ID%>" name="<%=uicomponent.CHECKED_RADIO_ID%>" />
    <div class="ContentSearchForm"> 
      <input type="radio" checked="checked" class="radioboxes" id="<%=uicomponent.SEARCH_BY_NAME%>" name="<%=uicomponent.RADIO_NAME%>" value="<%=uicomponent.SEARCH_BY_NAME%>"/>
      <span><%= _ctx.appRes("UIContentSearchForm.title.SearchByName")%></span> <%uiform.renderField(uiform.getChildById(uicomponent.SEARCH_BY_NAME));%>
    </div>

    <div class="ContentSearchForm">		 
      <input type="radio" class="radioboxes" id="<%=uiform.SEARCH_BY_CONTENT%>" name="<%=uicomponent.RADIO_NAME%>" value="<%=uicomponent.SEARCH_BY_CONTENT%>"/>
      <span><%= _ctx.appRes("UIContentSearchForm.title.Fulltext")%>:</span> <%uiform.renderField(uiform.getChildById(uicomponent.SEARCH_BY_CONTENT));%>
    </div>

    <div class="ContentSearchForm">
      <input type="radio" class="radioboxes" id="<%=uicomponent.PROPERTY%>" name="<%=uicomponent.RADIO_NAME%>" value="<%=uicomponent.PROPERTY%>"/>
      <label class="Label"><span><%= _ctx.appRes("UIContentSearchForm.title.Property")%>:</span></label> <%uiform.renderField(uiform.getChildById(uicomponent.PROPERTY));%>
      <img class="IconConstraint AddMetadataTypeIcon" onclick="<%=uicomponent.event("AddMetadataType")%>" src="/eXoResources/skin/DefaultSkin/background/Blank.gif" alt="" title="Add metadata" />
      <label calss="Label"><span><%= _ctx.appRes("UIContentSearchForm.title.Contain")%> :</span> </label> <%uiform.renderField(uiform.getChildById(uicomponent.CONTAIN));%>
    </div>
 
    <div class="ContentSearchForm">
      <input style="float:left;" type="radio" class="radioboxes" id="<%=uicomponent.TIME_OPTION%>" name="<%=uicomponent.RADIO_NAME%>" value="<%=uicomponent.TIME_OPTION%>"/>
      <div style="float:left;"><%uiform.renderField(uiform.getChildById(uicomponent.TIME_OPTION));%> </div>
      <span class="TitleTextBox"><%= _ctx.appRes("UIContentSearchForm.title.FromDate")%></span>
      <div class="DateInput"><%uiform.renderField(uiform.getChildById(uicomponent.START_TIME));%></div>
      <span class="TitleTextBox"><%= _ctx.appRes("UIContentSearchForm.title.ToDate")%></span>
      <div class="DateInput"><%uiform.renderField(uiform.getChildById(uicomponent.END_TIME));%></div>
	  	<div style="clear:left;"><span></span></div>
    </div>
 
    <div class="ContentSearchForm">
      <input type="radio" class="radioboxes" id="<%=uicomponent.DOC_TYPE%>" name="<%=uicomponent.RADIO_NAME%>" value="<%=uicomponent.DOC_TYPE%>"/>
      <span><%= _ctx.appRes("UIContentSearchForm.title.DocumentType")%>:</span>
      <%uiform.renderField(uiform.getChildById(uicomponent.DOC_TYPE));%>
      <img class="IconConstraint AddMetadataTypeIcon" onclick="<%=uicomponent.event("AddNodeType")%>" src="/eXoResources/skin/DefaultSkin/background/Blank.gif" alt="" title="Add document type" />
    </div>
     
      <div class="UIAction">
            <% for(action in uicomponent.getActions()) { 
              String actionLabel = _ctx.appRes(uicomponent.getName() + ".action." + action) 
              String link = uicomponent.event(action) ;
            %>
            <a onclick="$link" class="ActionButton LightBlueStyle" href="javascript:void(0);">$actionLabel</a>
            <%}%>
           </div> 
   <%uiform.end();%>
</div>