<%@ page buffer="8kb" autoFlush="true" %>
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="zm" uri="com.zimbra.zm" %>
<%@ taglib prefix="mo" uri="com.zimbra.mobileclient" %>
<%@ 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" %>
<c:if test="${param.ui != null && param.ui == '1'}">
    <jsp:forward page="mainx" />
</c:if>
<c:if test="${param.ui == null || param.ui == ''}">
    <c:set var="uiv" value="0" scope="session"/>
</c:if>
<mo:handleError>
    <zm:getMailbox var="mailbox"/>
    <c:choose>
    <c:when test="${not empty mailbox.prefs.locale}">
        <fmt:setLocale value='${mailbox.prefs.locale}' scope='request' />
    </c:when>
    <c:otherwise>
        <fmt:setLocale value='${pageContext.request.locale}' scope='request' />
    </c:otherwise>
    </c:choose>
    <fmt:setBundle basename="/messages/ZhMsg" scope="request"/>
    
    <mo:composeCheck/>
    <c:set var="action" value="${zm:cook(empty param.paction ? param.action : param.paction)}" scope="request"/>
</mo:handleError>
<mo:view title="${mailbox.name}" context="${null}" mailbox="${mailbox}">
    <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
            <td>
                <table width="100%" cellspacing="0" cellpadding="0">
                    <tr class='zo_toolbar'>
                        <td>
                            <table cellspacing="0" cellpadding="0">
                                <tr>
                                    <td>
                                        <c:url var="composeUrl" value="main?action=compose"/>
                                        <a href="${composeUrl}" class='zo_button'>
                                            <fmt:message key="compose"/>
                                        </a>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td align="right">
                            <table cellspacing="0" cellpadding="0">
                                <tr>
                                    <td>
                                        <c:url var="logoutUrl" value="/?loginOp=logout&client=mobile"/>
                                        <a href="${fn:escapeXml(logoutUrl)}" class='zo_button'>
                                            <fmt:message key="logOut"/>
                                        </a>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    <tr>
        <td class='zo_main_item'>
            <a href="mosearch">
                <mo:img src="startup/ImgMailApp.png" alt="mail"/>
                <fmt:message key="mail"/>
                <c:if test="${mailbox.inbox.hasUnread}">&nbsp;(${mailbox.inbox.unreadCount})</c:if>
            </a>
        </td>
    </tr>
        <c:if test="${mailbox.features.contacts}">
            <tr>
                <td class='zo_main_item'>
                <a href="moaddrbooks">
                    <mo:img src="contacts/ImgContact.png" alt="contacts"/>
                    <fmt:message key="addressBooks"/>
                </a>
                </td>
            </tr>
        </c:if>
        <c:if test="${mailbox.features.calendar}">
            <tr>
                <td class='zo_main_item'>
                <a href="mocalendar">
                    <mo:img src="startup/ImgCalendarApp.png" alt="calendar"/>
                    <fmt:message key="calendar"/>
                </a>
                </td>
            </tr>
        </c:if>
        <tr>
            <td class='zo_main_item'>
            <a href="mofolders">
                <mo:img src="mail/ImgMailFolder.png" alt="mail" />
                <fmt:message key="MO_mailFoldersTags"/>
            </a>
            </td>
        </tr>
        <tr>
            <td class='zo_main_item'>
            <a href="moquery">
                <mo:img src="startup/ImgSearch.png" alt="search"/>
                <fmt:message key="search"/>
            </a>
            </td>
        </tr>
        <%--
        <tr>
            <td class='zo_main_item'>
            <a href="?p=4">
                <mo:img src="common/ImgPreferences.png" />
                <fmt:message key="options"/>
            </a>
            </td>
        </tr>
        --%>
        <tr>
            <td align='center'>
            <div class='zo_main_info_cont'>
                <div class='zo_main_info'>
                <table>
                    <%--
                    <tr>
                        <td class='zo_main_fname'>
                            <fmt:message key="MO_username"/>:
                        </td>
                        <td class='zo_main_fvalue'>
                            ${fn:escapeXml(mailbox.name)}
                        </td>
                    </tr>
                    --%>
                    <tr>
                        <td class='zo_main_fname'>
                            <fmt:message key="MO_quota"/>:
                        </td>
                        <td class='zo_main_fvalue'>
                            <c:set var="max" value="${mailbox.attrs.zimbraMailQuota[0]}"/>
                            <fmt:message var="unlimited" key="unlimited"/>
                            <fmt:message key="MO_quotaUsage">
                                <fmt:param value="${zm:displaySizeFractions(pageContext,mailbox.size,2)}"/>
                                <fmt:param value="${max==0 ? unlimited : zm:displaySizeFractions(pageContext,max,2)}"/>
                            </fmt:message>
                        </td>
                    </tr>
                </table>
                </div>
                </div>
            </td>
        </tr>
     <tr>
        <td colspan="2" align="center" style="border-top:1px solid silver;color:silver;padding:5px;"><a class="zo_m_list_date" href="?ui=1">New Interface</a></td>
    </tr>
  </table>
</mo:view>
