<%@ 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" %>
<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"/>

    <fmt:message var="title" key="MO_mailFoldersTags"/>
    <c:set var="context_url" value="${requestScope.baseURL!=null?requestScope.baseURL:'zipad'}"/>
</mo:handleError>


<div class="tbl View">
    <div class="composeToolbar">
        <div class="header alignLeft" style="margin-left: 45%;">
            <div class="subject">
                <fmt:message key="moveAction"/>
            </div>
        </div>

        <div class="buttonRight button" onclick="return toggleCompose('compose-pop','veil');"><span><fmt:message key="cancel"/></span></div>
    </div>
    <form id="zMoveForm" action="${fn:escapeXml(context_url)}" method="post">
    <input name="crumb" type="hidden" value="${fn:escapeXml(mailbox.accountInfo.crumb)}"/>
    <input name="doMessageAction" value="1" type="hidden"/>
    <input name="anAction" id="mvTo" value="" type="hidden"/>
    <input name="moreActions" type="hidden" value="<fmt:message key="actionGo"/>"/>
    <input name="st" type="hidden" value="${param.st}"/>    
    
    <div class="Stripes cmp_container composeFields">
  
            <c:set var="count" value="${0}"/>
            <zm:forEachFolder var="folder">
                <c:if test="${count lt sessionScope.F_LIMIT and folder.id != param.sfi and folder.isMessageMoveTarget and !folder.isTrash and !folder.isSpam}">
                    
                        <div style="margin-left:10px; padding: 10px; border-bottom: 1px solid #dbdbdc; text-align: left;" onclick="return moveToFldr('moveTo_${folder.id}');">${zm:getFolderPath(pageContext, folder.id)}</div>
                    
                    <c:set var="count" value="${count+1}"/>
                </c:if>
            </zm:forEachFolder>
    </div>
    </form>    
</div>
<script type="text/javascript">
    var dlistEl = $('dlist-view');
    var checkedElmts = dlistEl.getElementsByClassName('chk');
    var chkIds = "";

    for(var i = 0; i < checkedElmts.length; i ++) {
       if(checkedElmts[i] && checkedElmts[i].checked) {
          var hideEl = document.createElement("input");
          hideEl.type = "hidden";
          hideEl.name = checkedElmts[i].name;
          hideEl.value = checkedElmts[i].value;

          $('zMoveForm').appendChild(hideEl); 
          //chkIds+=checkedElmts[i].value + ",";
       }
    }
    //alert(chkIds);
    //$('cidEl').value = chkIds;
</script>