
<%@ page buffer="8kb" autoFlush="true" %>
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="zm" uri="com.zimbra.zm" %>
<%@ taglib prefix="app" uri="com.zimbra.htmlclient" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="com.zimbra.i18n" %>
<fmt:setBundle basename="/messages/ZhMsg" scope="request"/>

<c:catch var="ex">
	<zm:getMailbox var="mailbox"/>
	<app:skin mailbox="${mailbox}" />
	<c:set var="initialCallJustToCatchErrorsConnectingToTheVoiceServer" value="${zm:getFirstPhoneAccount(pageContext)}"/>
</c:catch>

<c:choose>
<c:when test="${!empty ex}">
	<body style="background-color:white">
		<zm:getException var="error" exception="${ex}"/>
		<c:choose>
			<c:when test="${error.code == 'voice.SECONDARY_NOT_ALLOWED'}">
				<div class='AccountsUpSell'>
					<iframe src="http://www.comcast.net/smartzone/szcc_cdv_secondary_access_msg_home" width="100%" scrolling="no" frameborder="0">
				</div>
			</c:when>
			<c:otherwise>
				<p><fmt:message key="${error.code}"/></p>
			</c:otherwise>
		</c:choose>
	</body>
</c:when>
<c:otherwise>
<app:head mailbox="${mailbox}" title=""/>
	<body style="background-color:#FFFFFF;">
		<div class="ZhHomeVoiceBody">
			<table class="ZhHomeVoiceTable" cellpadding=0 cellspacing=0 border=0>
				<zm:forEachPhoneAccount var="account">
					<c:set var="phone" value="${account.phone.name}"/>
					<zm:forEachFolder var="folder" parentfolder="${account.rootFolder}">
						<c:if test="${folder.isVoiceMailInbox}">
							<tr class="ZhHomeRow">
								<td class="ZhHomeCell" >
									<span style="font-weight:bold; font-size:12px;"><c:out value="${account.phone.display}"/><br></span>
									<c:choose>
										<c:when test="${account.hasVoiceMail}">
											<a style="text-decoration:none;" href='/h/search?st=voicemail&sq=phone:${phone}' target="_top">
												${folder.unreadCount}&nbsp;<fmt:message key="unheard"/>
											</a>
											| ${folder.messageCount}&nbsp;<fmt:message key="total"/>
										</c:when>
										<c:otherwise>
											<fmt:message key="noVoiceMail"/>
										</c:otherwise>
									</c:choose>
								</td>
							</tr>
						</c:if>
					</zm:forEachFolder>
    				</zm:forEachPhoneAccount>
			</table>
		</div>
	</body>
</c:otherwise>
</c:choose>
