<html>

<%@page info="SearchCalendarData" language="java" pageEncoding="utf-8" contentType="text/html; charset=UTF-8"%>
<%@taglib uri="/WEB-INF/jato.tld" prefix="jato"%>

<%@include file="../../uwc/js/resourceBundleUtils.js"%>

<jato:useViewBean className="com.sun.uwc.calclient.SearchCalendarDataViewBean">

<head>
<title><jato:getDisplayFieldValue escape="false" name="ViewBanner"/></title>
<script src="../uwc/js/browserVersion.js" type="text/javascript"> </script>
<script src="../uwc/js/scripts.js" type="text/javascript"> </script>
<script src="../uwc/js/uwcUtils.js" type="text/javascript"> </script>
<script src="../uwc/js/date_utils.js" type="text/javascript"> </script>
<script type="text/javascript">
<!--
  if (is_ie5up) // IE5
  {
   document.write("<LINK href=<%= getLocalizedLabel(session, "skinModel", "Style-Sheet-IE", "../uwc/css/css_ie5win.css") %> type=text/css rel=stylesheet>")
  }
  else if (is_gecko) // Netscape 6/7 or Mozilla
  {
   document.write("<LINK href=<%= getLocalizedLabel(session, "skinModel", "Style-Sheet-NN", "../uwc/css/css_ns6up.css") %> type=text/css rel=stylesheet>")
  }
  else  // All others
  {
   document.write("<LINK href=<%= getLocalizedLabel(session, "skinModel", "Style-Sheet-NN", "../uwc/css/css_ns6up.css") %> type=text/css rel=stylesheet>")
  }
//-->
</script>

<script>
<!--
function handleEnter(event) {
     if (is_ie5up) {
         if(event.keyCode == 13) {
            var calsearchText = document.forms[0].elements["TextEnteredForSearchCalendar"].value;
            if((null == calsearchText) || ("" == trim(calsearchText))) {
                        UWCAlert('<%= getLocalizedLabel(session, "uwc-calclient-searchcalendar-BlankSearchString-alert", "Please enter a search string") %>');
            return false;
            }
            document.forms[0].elements["ButtonForSearchCalendar"].click();
          }
     }
     else {
        if(event.which == 13) {
            var calsearchText = document.forms[0].elements["TextEnteredForSearchCalendar"].value;
            if((null == calsearchText) || ("" == trim(calsearchText))) {
                        UWCAlert('<%= getLocalizedLabel(session, "uwc-calclient-searchcalendar-BlankSearchString-alert", "Please enter a search string") %>');
            return false;
            }
            document.forms[0].elements["ButtonForSearchCalendar"].click();
         }
     }
     return true
}
//-->
</script>

<script language="JavaScript">
<!--

var SEARCH_KEY = "search";
var SUBSCRIBE_KEY = "subscribe";
var search_click = 0;

function clearSearch() {
  if(0 == search_click) {
    document.SearchCalendarData.TextEnteredForSearchCalendar.value = "";
    search_click = 1;
  }
}

function selectCalendars(isChecked) {
  return;
}

function handleSearch() {
  var theStr = document.SearchCalendarData.TextEnteredForSearchCalendar.value;
  if((0 == search_click) || (null == theStr) || ("" == trim(theStr))) {
    UWCAlert('<%= getLocalizedLabel(session, "uwc-calclient-searchcalendar-BlankSearchString-alert", "Please enter a search string") %>');
    return;
  }
  document.SearchCalendarData.submitType.value = SEARCH_KEY;
  document.SearchCalendarData.submit();
}

function handleAddCalendars() {
  UWCAlert('<%= getLocalizedLabel(session, "uwc-calclient-searchcalendar-Add-PleaseSearchAndSelectTheCalendars-alert", "Please do search for calendars and select the calendars, then click on Add Calendar(s)") %>');
}   

function handleSubscribe() {
  UWCAlert('<%= getLocalizedLabel(session, "uwc-calclient-searchcalendar-Subscribe-PleaseSearchAndSelectTheCalendars-alert", "Please do search for calendars and select the calendars, then click on Subscribe to Calendar(s)") %>');
}   

//-->
</script>

</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" class="Popup">

<jato:form name="SearchCalendarData" method="post" defaultCommandChild="/Save">

<input type="hidden" name="submitType">
<jato:hidden name="ViewSearchMode"/>

  <!-- Page Title -->
  <table width="100%" border="0" cellspacing="0" cellpadding="0" title="">
  <tr>
      <td class="PopupTitle"><span class="PopupTitleText"><jato:getDisplayFieldValue escape="false" name="ViewBanner"/></span></td>
  </tr>
</table>

<!-- Search fields -->
<table class="FormInputTable" width="100%" border="0" cellspacing="0" cellpadding="0" title="">
  <tr> 
    <td><img src="../uwc/images/spacer.gif" width="1" height="10" alt=""></td>
  </tr>
  <tr> 
    <td class="PropLabel" nowrap>
      <jato:textField name="SearchText" elementId="TextEnteredForSearchCalendar" size="25" onClick="clearSearch(); return false;" defaultValue="Search for Calendar" onKeyPress="return handleEnter(event)" tabIndex="1"/>
      <input class="Btn1" type="button" name="SearchCalendar" id="ButtonForSearchCalendar" value=" <%= getLocalizedLabel(session, "uwc-common-search", "Search") %> " onMouseOver="if (this.disabled==0) this.className='Btn1Hov'" onFocus="if (this.disabled==0) this.className='Btn1Hov'" onMouseOut="if (this.disabled==0) this.className='Btn1'" onBlur="if (this.disabled==0) this.className='Btn1'" onClick="handleSearch(); return false;" title="<%= getLocalizedLabel(session, "uwc-calclient-searchcalendar-Search-title", "Search for Calendar") %>" tabindex="2">
      <br>
      <span class="inlineHelpText"><jato:getDisplayFieldValue escape="false" name="ViewIntro"/></span></td>
  </tr>
</table>

<!-- Table containing search results -->
<table border="0" cellpadding="0" cellspacing="0" width="100%" title="">
  <tr>
    <td><img src="../uwc/images/spacer.gif" width="10" height="1" alt=""></td>
    <td width="98%"> 
      <div class="TableDiv"> 
          <table border="0" cellpadding="0" cellspacing="0" class="Tbl" width="100%" summary="Table contains list of Events." title="">
            <tbody> 
            <tr> 
              <td class="TblTtlTd" colspan="4"><span class="TblTtlTxt"><%= getLocalizedLabel(session, "uwc-calclient-searchcalendar-CalendarsLabel", "Calendars") %></span></td>
            </tr>
            <tr> 
              <td class="TblActTd" colspan="2">&nbsp;</td>
              <td class="TblActTd" colspan="2" align="right" nowrap><%= getLocalizedLabel(session, "uwc-calclient-searchcalendar-ZeroCalendarsFoundLabel", "0 Calendars Found") %></td>
            </tr>
            <tr> 
              <th width="5%" nowrap class="TblThCl1">
                <div style="text-align:center"> 
                  <input name="SelectAllCalendars" type="image" value="SelectAllCalendars" src="<%= getLocalizedLabel(session, "skinModel", "uwc-calclient-Select-All-image", "../uwc/images/check_all.gif") %>" alt="<%= getLocalizedLabel(session, "uwc-common-SelectAll-title", "Select All Items Displayed in Table") %>" align="top" width="15" height="13" border="0" title="<%= getLocalizedLabel(session, "uwc-common-SelectAll-title", "Select All Items Displayed in Table") %>" onclick="selectCalendars(true); return false;">
                  <input name="DeselectAllCalendars" type="image" value="DeselectAllCalendars" src="<%= getLocalizedLabel(session, "skinModel", "uwc-calclient-Deselect-All-image", "../uwc/images/uncheck_all.gif") %>" alt="<%= getLocalizedLabel(session, "uwc-common-DeselectAll-title", "Deselect All Items Displayed in Table") %>" align="top" width="15" height="13" border="0" title="<%= getLocalizedLabel(session, "uwc-common-DeselectAll-title", "Deselect All Items Displayed in Table") %>" onclick="selectCalendars(false); return false;">
                </div>
              </th>
              <th scope="col" width="35%"><%= getLocalizedLabel(session, "uwc-calclient-searchcalendar-NameLabel", "Name") %></th>
              <th scope="col" width="40%"><%= getLocalizedLabel(session, "uwc-calclient-searchcalendar-DescriptionLabel", "Description") %></th>
              <th scope="col" width="20%"><%= getLocalizedLabel(session, "uwc-calclient-searchcalendar-OwnerLabel", "Owner") %></th>
            </tr>
            <tr> 
              <td class="TblTdCl1Lst" align="center">&nbsp;</td>
              <td colspan="3" class="TblTdLst"><%= getLocalizedLabel(session, "uwc-calclient-searchcalendar-SearchHintMessage", "Use Search to find calendars on this server or system...") %></td>
            </tr>
            <tr> 
              <td class="TblActTdLst" colspan="2">&nbsp; </td>
              <td class="TblActTdLst" colspan="2" align="right" nowrap><%= getLocalizedLabel(session, "uwc-calclient-searchcalendar-ZeroCalendarsFoundLabel", "0 Calendars Found") %></td>
            </tr>
            </tbody> 
          </table>
      </div>
    </td>
    <td><img src="../uwc/images/spacer.gif" width="10" height="1" alt=""></td>
  </tr>
</table>

<!-- Defined a hidden button called 'Save' which requires for triggering default form action or as a place holder for default command child to call handleSearch() method in assoicated view bean. This 'Save' button will *always* be *hidden* because it is put inside a non-visible div tag. -->
<div style="visibility: hidden;">
  <jato:button styleClass="Btn2" name="Save" onClick="handleSearch(); return false;" extraHtml="title=\"A hidden button for internal use\""/>
</div>

</jato:form>

</body>

</jato:useViewBean>

</html>
