<%@page info="ViewTaskData" 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.ViewTaskDataViewBean" fireChildDisplayEvents="true">
<html>
<head>
<% String isError = request.getParameter("errorCalView"); %>
<title>
<%=getLocalizedLabel(session, "uwc-calclient-task-view-pagetitle", "View Task - Sun&#8482;ONE Unified Messaging Client") %>
</title>
<script src="../uwc/js/browserVersion.js" type="text/javascript"> </script>
<script src="../uwc/js/uwcUtils.js" type="text/javascript"> </script>
<script type="text/javascript">
//<!--  
  if (is_ie5up) // IE5
  {
   document.write("<LINK href=<jato:getModelFieldValue modelClass="com.sun.uwc.common.model.UWCResourceBundleModel" modelName="skinModel" lookInSession="true" name="Style-Sheet-IE" defaultValue="../uwc/css/css_ie5win.css"/> type=text/css rel=stylesheet>") 
  }
  else if (is_gecko) // Netscape 6/7 or Mozilla
  {
   document.write("<LINK href=<jato:getModelFieldValue modelClass="com.sun.uwc.common.model.UWCResourceBundleModel" modelName="skinModel" lookInSession="true" name="Style-Sheet-NN" defaultValue="../uwc/css/css_ns6up.css"/> type=text/css rel=stylesheet>") 
  }
  else  // All others
  {
   document.write("<LINK href=<jato:getModelFieldValue modelClass="com.sun.uwc.common.model.UWCResourceBundleModel" modelName="skinModel" lookInSession="true" name="Style-Sheet-NN" defaultValue="../uwc/css/css_ns6up.css"/> type=text/css rel=stylesheet>") 
  }       
//-->
</script>
<script language=JavaScript type=text/javascript>
<!--
function setRepeatingSelectionModifier(theModifier) {
  if(CANCEL == theModifier) {
    return;
  }
  document.theForm.RecurrenceModifier.value = theModifier;  
  document.theForm.submit();
}

// RecurrenceModifier types
// Defualt modifier type for 'Delete' is CANCEL, 
// Defualt modifier type for 'Save' it is 'THIS_INSTANCE_ONLY'
//
var CANCEL = "Cancel";
var THIS_INSTANCE_ONLY = "ThisInstanceOnly";
var THIS_AND_ALL_INSTANCES = "ThisAndAll";

function isRecurrenceModifierExists() {
  if(undefined == document.theForm.elements["ViewTaskData.TaskRID"]) {
    return false;
  }
  else if(null == document.theForm.elements["ViewTaskData.TaskRID"]) {
    return false;
  }

  var rid = document.theForm.elements["ViewTaskData.TaskRID"].value;
  if(null == rid || (rid != null && rid == '')) {
    return false;
  }

  return true;
}

function handleDeleteTask() {  
  document.theForm.elements["ViewTaskData.ActionType"].value = "Delete";  
  if(isRecurrenceModifierExists()) 
  {
    window.open('<%=getContextURI(request)%>/uwc/js/DeleteTaskConfirmRepeatSelection.jsp', 'RepeatingSelection', 'scrollbars=yes,resizable=yes,width=550,height=150');
  }
  else if(UWCConfirm("<%= getLocalizedLabel(session, "uwc-calclient-tasks-DeleteTasksConfirmQuestion", "Are you sure you want to delete this task?") %>"))
  {
    setRepeatingSelectionModifier(THIS_INSTANCE_ONLY);
  }
  else 
  {
    setRepeatingSelectionModifier(CANCEL);
  }
  
}

function handleOpenEditTask() {
  var url = "<%=getContextURI(request)%>/calclient/EditTask?todoUid=" + document.theForm.elements["ViewTaskData.TaskUID"].value;
  url += "&calid=" + document.theForm.elements["ViewTaskData.CalID"].value;
  
  var rid = document.theForm.elements["ViewTaskData.TaskRID"].value;
  if( rid != null && rid != "" )
    url += "&rid=" + rid;
      
  parent.location = url;
  return document.MM_returnValue;
}

function handleCompleteTask() {
  document.theForm.elements["ViewTaskData.ActionType"].value = "CompleteTask";  
  if(isRecurrenceModifierExists()) 
  {
    window.open('<%=getContextURI(request)%>/uwc/js/SaveTaskConfirmRepeatSelection.jsp', 'RepeatingSelection', 'scrollbars=yes,resizable=yes,width=550,height=150');
  }
  else {
    setRepeatingSelectionModifier(THIS_INSTANCE_ONLY);
  }  
}

function openWinAutoHeight(theURL,winName,features) { //v2.0
	winHeight = screen.availHeight * .85
    window.open(theURL,winName,features + ', height=' + winHeight);
	}
	

function initPage() {
  var isError = "<%=isError%>";
  if( isError != null && isError == "true" ) {
    parent.location = parent.location.href + "&error=true";
    return;
  }

  parent.focus();
  var taskBottomURL = parent.taskbottom.location.href;
  var isOrganizer = document.theForm.elements["ViewTaskData.isOrganizer"].value;
  if( isOrganizer != null && isOrganizer == "false" ) {
    var i = taskBottomURL.indexOf("edit");
    var index = taskBottomURL.indexOf("?");
    if( i < 0 && index < 0 ) {
      taskBottomURL += "?edit=false";
    } else if( i > -1 ) {
      var j = taskBottomURL.indexOf("&", index);
      var temp = taskBottomURL.substring(0, i);
      temp += "edit=false";
      if( j > -1 )
        temp += taskBottomURL.substring(j);

      taskBottomURL = temp;
      parent.taskbottom.location = taskBottomURL;
      return;
    }
  } 

  var completedTask = document.theForm.elements["ViewTaskData.StatusValue"].value;

  if( completedTask != null && completedTask == "100" ) {
      var index = taskBottomURL.indexOf("?");

      if( index > -1 )
        taskBottomURL += "&completed=true";
      else 
        taskBottomURL += "?completed=true";
  }
  parent.taskbottom.location = taskBottomURL;
}
//-->
</script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" class="Popup" onLoad="initPage()">
<jato:form name="theForm" method="post" defaultCommandChild="/Action">
<input type="hidden" name="RecurrenceModifier" value="">
<jato:hidden name="ActionType"/>
<jato:hidden name="TimeZone"/>
<jato:hidden name="TaskUID"/>
<jato:hidden name="TaskRID" defaultValue=""/>
<jato:hidden name="CalID"/>
<jato:hidden name="StatusValue"/>
<jato:hidden name="isOrganizer"/>
<!-- Popup Title -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" title="">
  <tr>
    <td class="PopupTitle">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><span class="PopupTitleText"><jato:text name="Title"/></span></td>
      <td align="right" ><a href="javascript: void(0)" onClick="window.print()" class="PrintPageLnk" title="<%=getLocalizedLabel(session, "uwc-calclient-task-view-printthispage", "Print this page") %>" tabindex="1"><%=getLocalizedLabel(session, "uwc-calclient-task-view-printthispage", "Print Task") %></a>
    </tr>
    </table>
    </td>
    
  </tr>
</table>

<!-- Error pagelet -->
<jato:containerView name="errorPlugin">
    <%@include file="/uwc/common/error.jsp"%>
</jato:containerView>

<!-- Jump Link Section -->
<div class="ConJmpScnDiv">
    <table border="0" cellspacing="0" cellpadding="0">
      <tbody> 
      <tr> 
        <td valign="top"> 
          <div class="ConJmpLnkDiv"><a href="#details" class="JmpLnk" title='<%=getLocalizedLabel(session, "uwc-calclient-task-jumpto-detail-title", "Jump Down to the Task Details Section")%>'><img src="../uwc/images/to_anchor.gif" alt="Jump Down to the Tasks Details Section" width="16" height="10" border="0" tabindex="1"><%=getLocalizedLabel(session, "uwc-calclient-task-detail-headers", "Task Details")%></a></div>
        </td>
        <td valign="top"> 
          <div class="ConJmpLnkDiv"><a href="#recurrence" class="JmpLnk" title='<%=getLocalizedLabel(session, "uwc-calclient-event-viewEvent-Reminders-section-title", "Jump Down to the Recurrence Section")%>'><img src="../uwc/images/to_anchor.gif" alt="Jump Down to the Task Recurrence Section" width="16" height="10" border="0" tabindex="2"><%=getLocalizedLabel(session, "uwc-calclient-recurrence-headerLabel", "Recurrence")%></a></div>
        </td>
        <td valign="top"> 
          <div class="ConJmpLnkDiv"><a href="#reminders" class="JmpLnk" title='<%=getLocalizedLabel(session, "uwc-calclient-event-EditEvent-Recurrence-section-title", "Jump Down to the Task Reminders Section")%>'><img src="../uwc/images/to_anchor.gif" alt="Jump Down to the Task Reminders Section" width="16" height="10" border="0" tabindex="3"><%=getLocalizedLabel(session, "uwc-calclient-options-remindersHeaderLabel", "Reminders")%></a></div>
        </td>
      </tr>
      </tbody> 
    </table>
</div>

<a name="details" id="details"></a>
<!-- Sub-Section Header -->  
<table width="100%" border="0" cellspacing="0" cellpadding="0" title="">
  <tr> 
    <td><img src="../uwc/images/spacer.gif" width="10" height="5" alt=""></td>
    <td class="SectionDivider" width="100%"><img src="../uwc/images/spacer.gif" width="1" height="5" alt=""></td>
	<td><img src="../uwc/images/spacer.gif" width="10" height="5" alt=""></td>
  </tr>
  <tr> 
    <td colspan="3" class="SectionHeader"><span class="SectionHeader"><%=getLocalizedLabel(session, "uwc-calclient-task-detail-headers", "Task Details")%></span></td>
  </tr>
</table>
<!-- task Details Section -->
  <table class="FormInputTable" width="100%" border="0" cellspacing="0" cellpadding="0" title="">
    <tr> 
      <td class="PropLabel" valign="top"><span class="Lbl2"><%=getLocalizedLabel(session, "uwc-calclient-task-duedate-caption", "Due Date")%>:</span></td>
      <td class="PropInput" width="100%" valign="top"><span class="Lbl2"><jato:text name="DueDate"/></span></td>
    </tr>
    <tr> 
      <td class="PropLabel" valign="top"><span class="Lbl2"><%=getLocalizedLabel(session, "uwc-calclient-task-priority-caption", "Priority")%>:</span></td>
      <td class="PropInput" valign="top"><jato:text name="Priority"/></td>
    </tr>
    <tr> 
      <td class="PropLabel" valign="top"><span class="Lbl2"><%=getLocalizedLabel(session, "uwc-calclient-task-status-caption", "Status")%>:</span></td>
      <td class="PropInput" valign="top"><jato:text name="Status"/></td>
    </tr>
    <tr> 
      <td class="PropLabel" valign="top"><span class="Lbl2"><%=getLocalizedLabel(session, "uwc-calclient-searchcalendar-OwnerLabel", "Owner")%>:</span></td>
      <td class="PropInput" valign="top"><jato:text name="OwnerName"/></td>
    </tr>
    <tr> 
      <td class="PropLabel" valign="top"><span class="Lbl2"><%=getLocalizedLabel(session, "uwc-calclient-task-notes-caption", "Notes")%>:</span></td>
      <td class="PropInput" valign="top"><jato:text name="Notes"/></td>
    </tr>
    <tr> 
      <td class="PropLabel" valign="top"><span class="Lbl2"><%=getLocalizedLabel(session, "uwc-calclient-task-location-caption", "Location")%>:</span></td>
      <td class="PropInput" valign="top"><jato:text name="Location"/></td>
    </tr>
    <tr> 
      <td class="PropLabel" valign="top"><span class="Lbl2"><%=getLocalizedLabel(session, "uwc-calclient-task-calendar-caption", "Calendar")%>:</span></td>
      <td class="PropInput" valign="top"><jato:text name="CalName"/></td>
    </tr>
    <tr> 
      <td class="PropLabel" valign="top"><span class="Lbl2"><%=getLocalizedLabel(session, "uwc-calclient-task-type-caption", "Type")%>:</span></td>
      <td class="PropInput" valign="top"><jato:text name="Category"/></td>
    </tr>
    <tr> 
      <td class="PropLabel" valign="top"><span class="Lbl2"><%=getLocalizedLabel(session, "uwc-calclient-task-privacy-caption", "Privacy")%>:</span></td>
      <td class="PropInput" valign="top"><jato:text name="Privacy"/></td>
    </tr>
  </table>
<div class="ConJmpTopDiv"><a href="#top" class="JmpTopLnk" title='<%=getLocalizedLabel(session, "uwc-common-BackToTop-title", "Jump to Top of Page")%>'><img src="../uwc/images/to_top.gif" alt="Jump to Top of Page" width="11" height="10" border="0" tabindex="4"><%=getLocalizedLabel(session, "uwc-common-BackToTop", "Back to top")%></a></div>

<a name="recurrence" id="recurrence"></a>
<!-- Sub-Section Header -->  
<table width="100%" border="0" cellspacing="0" cellpadding="0" title="">
  <tr> 
    <td colspan="3"><img src="../uwc/images/spacer.gif" width="1" height="5" alt=""></td>
  </tr>
  <tr> 
    <td><img src="../uwc/images/spacer.gif" width="10" height="5" alt=""></td>
    <td class="SectionDivider" width="100%"><img src="../uwc/images/spacer.gif" width="1" height="5" alt=""></td>
	<td><img src="../uwc/images/spacer.gif" width="10" height="5" alt=""></td>
  </tr>
  <tr> 
    <td colspan="3" class="SectionHeader"><span class="SectionHeader"><%=getLocalizedLabel(session, "uwc-calclient-recurrence-headerLabel", "Recurrence")%></span></td>
  </tr>
</table>
<!-- Recurrence Properties -->
<table class="FormInputTable" width="100%" border="0" cellspacing="0" cellpadding="0" title="">
  <tr> 
    <td class="PropLabel" valign="top"><span class="Lbl2"><%=getLocalizedLabel(session, "uwc-calclient-recurrence-frequencyLabel", "Frequency:")%></span></td>
      <td class="PropInput" width="100%" valign="top"><jato:text name="Frequency"/></td>
  </tr>
</table>
<div class="ConJmpTopDiv"><a href="#top" class="JmpTopLnk" title='<%=getLocalizedLabel(session, "uwc-common-BackToTop-title", "Jump to Top of Page")%>'><img src="../uwc/images/to_top.gif" alt="Jump to Top of Page" width="11" height="10" border="0" tabindex="5"><%=getLocalizedLabel(session, "uwc-common-BackToTop", "Back to top")%></a></div>

<a name="reminders" id="reminders"></a>
<table width="100%" border="0" cellspacing="0" cellpadding="0" title="">
  <tr> 
    <td colspan="3"><img src="../uwc/images/spacer.gif" width="1" height="5" alt=""></td>
  </tr>
  <tr> 
    <td><img src="../uwc/images/spacer.gif" width="10" height="5" alt=""></td>
    <td class="SectionDivider" width="100%"><img src="../uwc/images/spacer.gif" width="1" height="5" alt=""></td>
	<td><img src="../uwc/images/spacer.gif" width="10" height="5" alt=""></td>
  </tr>
  <tr> 
      <td colspan="3" class="SectionHeader"><span class="SectionHeader"><%=getLocalizedLabel(session, "uwc-calclient-options-remindersHeaderLabel", "Reminders")%></span></td>
  </tr>
</table>

<jato:content name="NoReminder">
<table class="FormInputTable" width="100%" border="0" cellspacing="0" cellpadding="0" title="">
  <tr> 
      <td class="PropInput" valign="top"><%=getLocalizedLabel(session, "uwc-calclient-task-no-reminder", "This task does not have a reminder")%></td>      
  </tr>
</table>
</jato:content>
<jato:content name="HasReminder">
<table class="FormInputTable" width="100%" border="0" cellspacing="0" cellpadding="0" title="">
    <tr> 
      <td class="PropLabel" valign="top"><span class="Lbl2"><%=getLocalizedLabel(session, "uwc-calclient-options-reminderEmailLabel", "Email Address:")%></span></td>
      <td class="PropInput" width="90%" valign="top"><jato:text name="Email"/></td>
    </tr>
    <tr> 
      <td colspan="2"><img src="../uwc/images/spacer.gif" width="1" height="6" alt=""></td>
    </tr>
    <tr> 
      <td class="PropLabel" valign="top"><span class="Lbl2"><%=getLocalizedLabel(session, "uwc-calclient-options-reminderNumberLabel", "Send Reminder:")%></span></td>
      <td class="PropInput" valign="top"><jato:text name="DueSpan"/></td>
    </tr>
    <tr> 
      <td colspan="2"><img src="../uwc/images/spacer.gif" width="1" height="6" alt=""></td>
    </tr>
    <tr> 
      <td class="PropLabel" valign="top" nowrap><span class="Lbl2"><%=getLocalizedLabel(session, "uwc-calclient-reminder-message", "Reminder Message:")%></span></td>
      <td class="PropInput" valign="top"><jato:text name="Message"/></td>
    </tr>
  </table>
</jato:content>
<div class="ConJmpTopDiv"><a href="#top" class="JmpTopLnk" title='<%=getLocalizedLabel(session, "uwc-common-BackToTop-title", "Jump to Top of Page")%>'><img src="../uwc/images/to_top.gif" alt="Jump to Top of Page" width="11" height="10" border="0" tabindex="6"><%=getLocalizedLabel(session, "uwc-common-BackToTop", "Back to top")%></a></div>
<!-- Spacer -->
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" title="">
  <TR> 
    <TD><IMG src="../uwc/images/spacer.gif" width="1" height="20" alt=""></TD>
  </TR>
</TABLE>
<div style="visibility:hidden">
<jato:button style="width:0;height:0" name="Action" elementId="Action"/>
</div>
</jato:form>
</body>
</html>
</jato:useViewBean>
