<!--
// ==============================================================================
// File Name           : indexing_schedule.htm 
// Description         : Indexing Schedule
// Author(s)           : Baskaran V
// Date created        : 2009.01.05
// Last reviewed by    : 
// Last date of review : 
// Copyright           : (c) 2008, Sharp Software Development India Pvt Ltd., All rights reserved.
//                       All rights are reserved. Reproduction or transmission in whole or in part, in
//                       any form or by an means, electronic, mechanical or otherwise, is prohibited
//                       without the prior written consent of the copyright owner.

// ==============================================================================

-->

<html xmlns:sds="">
<head>
	<title>Indexing Schedule</title>
	<link href="style.css" rel="stylesheet" type="text/css" />
	<script defer type="text/javascript" src="pngfix.js"></script>
	<style>
		@media all
		{
			  sds\:spinbox {behavior:url(spinbox.htc)}
		}
		</style>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
	<link rel="stylesheet" href="search.css"/>
	<script language="JavaScript" src="search_errors.js"></script>
	<script language="VBScript" src="vb_utils.js"></script>
	<script language="JavaScript" src="external_io.js"></script>
	<script language="JavaScript" src="ui_utils.js"></script>
	<script language="JavaScript" src="math_utils.js"></script>
	<script type="text/javascript" src="Themes.js"></script>
</head>
<body leftmargin="0" rightmargin="0" topmargin="0" class="Centerbg">
<script language="JavaScript" src="indexing_schedule.js"></script>
<script language="JavaScript" src="spinbox.js"></script>

<script language="JavaScript">
// define page scope variables
var schedule_on_off;  // scheduling turned on or off (on/off)
var schedule_option;  // daily scheduling (daily/weekly/idle)

function SetFieldDisplay(on_off, option)
{
  if(on_off == "off")
  {
    document.all.daily_schedule.style.display = "none";
	document.all.weekly_schedule.style.display = "none";
	document.all.idle_schedule.style.display   = "none";
	document.all.schedule_option_list.disabled = true;
  }
  else
  {
    document.all.schedule_option_list.disabled = false;
    if(option == "daily")
    {
      document.all.daily_schedule.style.display = "";
      document.all.weekly_schedule.style.display = "none";
      document.all.idle_schedule.style.display   = "none";      
    }
    else 
    {        
        if(option == "weekly")
        {
            document.all.daily_schedule.style.display = "none";
            document.all.weekly_schedule.style.display = "";
            document.all.idle_schedule.style.display   = "none";        
        }
        else
        { 
            if(option == "onidle")
            {
                document.all.daily_schedule.style.display = "none";
                document.all.weekly_schedule.style.display = "none";
                document.all.idle_schedule.style.display = "";
            }
        }
    }
  }
}

function OnLoadPage()
{
  // load all data displayed in this page
  var values = GetIndexingSchedule();
  var def_values = GetAppValues("Schedule");
  
  SetRadioButton(document.all.schedule_on_off, values["OnOff"]);
  SetListBox(document.all.schedule_option_list, values["Option"]);
  
  if(values["Option"] == "daily")
  {
    SetDateBox(document.all.daily_start_date, values["Daily/StartDate"]);
    SetTimeBox(document.all.daily_start_time, values["Daily/StartTime"]);
    SetSpinBox(document.all.daily_option, values["Daily/Option"]);
	
    SetDateBox(document.all.weekly_start_date, def_values["Weekly/StartDate"]);
    SetTimeBox(document.all.weekly_start_time, def_values["Weekly/StartTime"]);
    SetCheckBox(document.all.monday, def_values["Weekly/Monday"]);
    SetCheckBox(document.all.tuesday, def_values["Weekly/Tuesday"]);
    SetCheckBox(document.all.wednesday, def_values["Weekly/Wednesday"]);
    SetCheckBox(document.all.thursday, def_values["Weekly/Thursday"]);
    SetCheckBox(document.all.friday, def_values["Weekly/Friday"]);
    SetCheckBox(document.all.saturday, def_values["Weekly/Saturday"]);
    SetCheckBox(document.all.sunday, def_values["Weekly/Sunday"]);	
  }
  else if(values["Option"] == "weekly")
  {
    SetDateBox(document.all.daily_start_date, def_values["Daily/StartDate"]);
    SetTimeBox(document.all.daily_start_time, def_values["Daily/StartTime"]);
    SetSpinBox(document.all.daily_option, def_values["Daily/Option"]);
	
    SetDateBox(document.all.weekly_start_date, values["Weekly/StartDate"]);
    SetTimeBox(document.all.weekly_start_time, values["Weekly/StartTime"]);
    SetCheckBox(document.all.monday, values["Weekly/Monday"]);
    SetCheckBox(document.all.tuesday, values["Weekly/Tuesday"]);
    SetCheckBox(document.all.wednesday, values["Weekly/Wednesday"]);
    SetCheckBox(document.all.thursday, values["Weekly/Thursday"]);
    SetCheckBox(document.all.friday, values["Weekly/Friday"]);
    SetCheckBox(document.all.saturday, values["Weekly/Saturday"]);
    SetCheckBox(document.all.sunday, values["Weekly/Sunday"]);
  }
  else if(values["Option"] == "onidle")
  {
    SetDateBox(document.all.daily_start_date, def_values["Daily/StartDate"]);
    SetTimeBox(document.all.daily_start_time, def_values["Daily/StartTime"]);
    SetSpinBox(document.all.daily_option, def_values["Daily/Option"]);
    
    SetDateBox(document.all.weekly_start_date, def_values["Weekly/StartDate"]);
    SetTimeBox(document.all.weekly_start_time, def_values["Weekly/StartTime"]);
    SetCheckBox(document.all.monday, def_values["Weekly/Monday"]);
    SetCheckBox(document.all.tuesday, def_values["Weekly/Tuesday"]);
    SetCheckBox(document.all.wednesday, def_values["Weekly/Wednesday"]);
    SetCheckBox(document.all.thursday, def_values["Weekly/Thursday"]);
    SetCheckBox(document.all.friday, def_values["Weekly/Friday"]);
    SetCheckBox(document.all.saturday, def_values["Weekly/Saturday"]);    
    SetCheckBox(document.all.sunday, def_values["Weekly/Sunday"]);	

    //SetSpinBox(document.all.Idle_Time, values["SysIdleTime"]);
    //SetContinuousSpin(document.all.Idle_Time);        
    SetCheckBox(document.all.ceasetask, values["CeaseTask"]);    
  }

  // set visibility of fieldset areas
  schedule_on_off = values["OnOff"];  
  schedule_option = values["Option"];
  SetFieldDisplay(schedule_on_off, schedule_option);
  
  // set up spinning behavior of spinbox
  SetContinuousSpin(document.all.daily_option);
}

function OnSavePage()
{
  var values = new Array();
  
  values["OnOff"] = GetRadioButton(document.all.schedule_on_off);
  values["Option"] = GetListBox(document.all.schedule_option_list);
  
  if(values["Option"] == "daily")
  {
    values["Daily/StartDate"] = GetDateBox(document.all.daily_start_date);
    values["Daily/StartTime"] = GetTimeBox(document.all.daily_start_time);
    values["Daily/Option"] = GetSpinBox(document.all.daily_option);    
  }
  else if(values["Option"] == "weekly")
  {
    values["Weekly/StartDate"] = GetDateBox(document.all.weekly_start_date);
    values["Weekly/StartTime"] = GetTimeBox(document.all.weekly_start_time);
    values["Weekly/Monday"] = GetCheckBox(document.all.monday);
    values["Weekly/Tuesday"] = GetCheckBox(document.all.tuesday);
    values["Weekly/Wednesday"] = GetCheckBox(document.all.wednesday);
    values["Weekly/Thursday"] = GetCheckBox(document.all.thursday);
    values["Weekly/Friday"] = GetCheckBox(document.all.friday);
    values["Weekly/Saturday"] = GetCheckBox(document.all.saturday);
    values["Weekly/Sunday"] = GetCheckBox(document.all.sunday);    
	
    if(!IsDayOfWeekSelected(values))
	{
      //alert("At least one 'Day of the Week' must be selected.\n");
	   alert(/*IDS_E_NO_DAYOFTHEWEEK*/"Se debe seleccionar al menos un 'Da de la semana'.\n");
	  return;
	}
  }
  else if(values["Option"] == "onidle")
  {
    values["SysIdleTime"] = 15; //GetSpinBox(document.all.Idle_Time);    
    values["CeaseTask"]   = GetCheckBox(document.all.ceasetask);    
  }
  
  if(!SetIndexingSchedule(values))
    //alert("Indexing Schedule will not be saved.\n");	
	alert(/*IDS_E_INDEXING_NOT_SAVED*/"El programa de indexacin no se guardar.\n");	
  window.location = "default.htm";
}

// is at least one of days of week selected
function IsDayOfWeekSelected(values)
{
  if(values["Weekly/Monday"] == "true")
    return true;
  if(values["Weekly/Tuesday"] == "true")
    return true;
  if(values["Weekly/Wednesday"] == "true")
    return true;
  if(values["Weekly/Thursday"] == "true")
    return true;
  if(values["Weekly/Friday"] == "true")
    return true;
  if(values["Weekly/Saturday"] == "true")
    return true;
  if(values["Weekly/Sunday"] == "true")
    return true;

  return false;
}

function OnClickScheduleOnOff()
{
  schedule_on_off = GetRadioButton(document.all.schedule_on_off);
  SetFieldDisplay(schedule_on_off, schedule_option);
}

function OnChangeScheduleOption(selobj)
{
  schedule_option = selobj.options[selobj.selectedIndex].value;

  // set up visibility depending on Daily or Weekly option is selected
  SetFieldDisplay(schedule_on_off, schedule_option);
}
</script>

<script language="JavaScript" for="window" event="onload()">
OnLoadPage();
</script>

<script language="JavaScript" for="schedule_on_off" event="onclick()">
OnClickScheduleOnOff();
</script>

<script language="JavaScript" for="schedule_option_list" event="onchange()">
OnChangeScheduleOption(this);
</script>

<script language="JavaScript" for="save_button" event="onclick()">
OnSavePage();
</script>

<script language="JavaScript" for="cancel_button" event="onclick()">
//window.location = "default.htm";
GoToPage('default');
</script>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="53" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="Default_top" height="53" >
  <tr> 
    <td width="6%" height="31" align="center">
	  <a id="home_link" onClick="GoToPage('default')" class="Normaltext">
	    <img src="Images/search_home.png" border="0" title="Volver a la pgina de inicio de bsqueda" width="32" height="32" style="position:relative; top:2;" loc="title:id=IDS_BACK_TO_SEARCH_HOME"/></a>	</td>
    <td> 
      <div id="page_title_area" align="center">
	<b><loc id="IDS_INDEXING_SCHEDULE">Programa de indexacin</loc></b>
	  </div>
    </td>
    <td width="180" class="class1"> 
      <div id="page_link_area" align="right">

	  <a onClick="GoToPage('index_databases')" class="Normaltext"><loc id="IDS_INDEX_DATABASES">Bases de datos de ndices</loc> &nbsp; </a>
	  </div>
    </td>
  </tr>
</table>
</td>
  </tr>
  <tr>
  	<td align="center" class="bgcolor_3"  height="1"> </td>
  </tr>
    <tr>
  	<td align="center" height="5" > </td>
  </tr>

  <tr>
    <td height="55" align="left" valign="top" ><blockquote> 
   <input type="radio" name="schedule_on_off" value="on"/>
  <loc id="IDS_RADIO_PERFORM_INDEXING">Realizar indexacin</loc> 
  <select name="schedule_option_list" size="1">
    <option value="daily"><loc id="IDS_ITEM_DAILY">Diariamente</loc></option>
    <option value="weekly"><loc id="IDS_ITEM_WEEKLY">Semanalmente</loc></option>
    <option value="onidle">En inactivo</option>
  </select><br/>
  <input type="radio" name="schedule_on_off" value="off"/>
  <loc id="IDS_RADIO_SCHEDULE_OFF">Desactivar programa</loc>
</blockquote>

<div id="idle_schedule">
<blockquote>
  <fieldset><legend>&#160;Programacin de inactividad</legend> 
  <blockquote> 
   <!--<p>When the computer has been Idle for   
   <sds:spinbox id="Idle_Time" minvalue="1" maxvalue="999" size="2" MAXLENGTH=3 />
    minute(s) 
    </p> -->
    <p><input type="checkbox" CHECKED name="ceasetask" value="checkbox" />
            Parar la indexacin cuando el equipo ya no est inactivo</p>
  </blockquote>
  </fieldset>
</blockquote>
</div>

<div id="daily_schedule">
<blockquote>
    <fieldset><legend>&#160;<loc id="IDS_GROUP_DAILY_SCHEDULE">Programa diario</loc></legend> 
  <blockquote> 
    <p><loc id="IDS_EDIT_START_DATE">Fecha de inicio:</loc><br/>
      <object id="daily_start_date" class="date_entry" classid="clsid:D58612F4-2E23-4810-852F-745FBAA95D7A">
        <param name="DTFLAG" value="1"/>
      </object>
    </p>
    <p><loc id="IDS_EDIT_START_TIME">Hora de inicio:</loc><br/>
 	  <object id="daily_start_time" class="time_entry" classid="clsid:D58612F4-2E23-4810-852F-745FBAA95D7A">
        <param name="DTFLAG" value="2"/>
      </object>
    </p>
    <p><loc id="IDS_EDIT_PERFORM_INDEXING">Realizar indexacin:</loc>
	<br/> <loc id="IDS_EDIT_EVERY">Cada</loc> <sds:spinbox id="daily_option" minvalue="1" maxvalue="7" size="2" /> <loc id="IDS_EDIT_DAYS">Da(s)</loc>
    </p>
  </blockquote>
  </fieldset>

</blockquote>
</div>

<div id="weekly_schedule"> 
  <blockquote> <fieldset><legend>&#160;;<loc id="IDS_GROUP_WEEKLY_SCHEDULE">Programa semanal</loc></legend> 
    <blockquote> 
  <p><loc id="IDS_EDIT_START_DATE">Fecha de inicio:</loc><br/>
        <object id="weekly_start_date" class="date_entry" classid="clsid:D58612F4-2E23-4810-852F-745FBAA95D7A">
          <param name="DTFLAG" value="1"/>
        </object>
      </p>
      <p><loc id="IDS_EDIT_START_TIME">Hora de inicio:</loc><br/>
        <object id="weekly_start_time" class="time_entry" classid="clsid:D58612F4-2E23-4810-852F-745FBAA95D7A">
          <param name="DTFLAG" value="2"/>
        </object>
      </p>
      <loc id="IDS_EDIT_DAYSOFTHEWEEK">Da(s) de la semana:</loc>
      <table width="59%" border="0">
        <tr>
          <td width="49%"> 
            <input type="checkbox" name="monday" value="checkbox"/>
            <loc id="IDS_EDIT_MONDAY">Lunes</loc></td>
          <td width="51%"> 
            <input type="checkbox" name="saturday" value="checkbox"/>
            <loc id="IDS_EDIT_SATURDAY">Sbado</loc></td>
        </tr>
        <tr>
          <td width="49%" height="23"> 
            <input type="checkbox" name="tuesday" value="checkbox"/>
            <loc id="IDS_EDIT_TUESDAY">Martes</loc></td>
          <td width="51%" height="23"> 
            <input type="checkbox" name="sunday" value="checkbox"/>
            <loc id="IDS_EDIT_SUNDAY">Domingo</loc></td>
        </tr>
        <tr>
          <td width="49%"> 
            <input type="checkbox" name="wednesday" value="checkbox"/>
            <loc id="IDS_EDIT_WEDNESDAY">Mircoles</loc></td>
          <td width="51%"> </td>
        </tr>
        <tr>
          <td width="49%"> 
            <input type="checkbox" name="thursday" value="checkbox"/>
            <loc id="IDS_EDIT_THURSDAY">Jueves</loc></td>
          <td width="51%"> </td>
        </tr>
        <tr>
          <td width="49%" height="2"> 
            <input type="checkbox" name="friday" value="checkbox"/>
            <loc id="IDS_EDIT_FRIDAY">Viernes</loc> </td>
          <td width="51%" height="2"> </td>
        </tr>
      </table>
    </blockquote>
    </fieldset></blockquote>
</div>

<span id="save_cancel_area">
<hr/>
<table width="100%" border="0" cellspacing="5" cellpadding="5">
  <tr> 
    <td width="47%"> 
      <div align="right"> 
        <input  type="button" class="button_style" name="save_button" value="Guardar" loc="value:id=IDS_BUTTON_SAVE" />
      </div>
    </td>
	<td width="6%">
	</td>
    <td width="47%"> 
      <div align="left"> 
        <input type="button" class="button_style"  name="cancel_button" value="Cancelar" loc="value:id=IDS_BUTTON_CANCEL"/>
      </div>
    </td>
  </tr>
</table>
</span>
</td>
  </tr>
  <tr>
    <td height="55" align="left" valign="top">&nbsp;</td>
  </tr>
  <tr></tr>
</table>
</body>
</html>
