<div class="pageFormContent" layoutH>
<@cms.vote id=id>
    <dl class="nowrap">
        <dt><@t.page 'title'/>:</dt>
        <dd class="exclude-translate">
            ${(object.title)!}
        </dd>
    </dl>
    <dl class="nowrap">
        <dt><@t.page 'description'/>:</dt>
        <dd class="exclude-translate">
            ${(object.description)!}
        </dd>
    </dl>
    <dl>
        <dt><@t.page 'start_date'/>:</dt>
        <dd>
            ${(object.startDate)!}
        </dd>
    </dl>
    <dl>
        <dt><@t.page 'end_date'/>:</dt>
        <dd>
            ${(object.endDate)!}
        </dd>
    </dl>
<#if !pageIndex?has_content || '1' != pageIndex>
    <@cms.voteItemList voteId=object.id pageSize=500>
        <#if page.totalCount gt 0>
    <fieldset>
        <legend><@t.page 'vote_item'/></legend>
        <div class="unit">
            <ol class="vote">
        <#list page.list as v>
                <li>
                    <div class="progress-box">
                        <div class="progress-bar" style="width:${(object.votes gt 0)?then(v.votes*100/object.votes,100)}%;"></div>
                        <div class="progress-text">
                            ${v.title} (${v.votes!}/${object.votes})
                        </div>
                    </div>
                </li>
        </#list>
            </ol>
        </div>
    </fieldset>
        </#if>
    </@cms.voteItemList>
</#if>
<@cms.userVoteList voteId=object.id pageIndex=pageIndex>
    <#if page.totalCount gt 0>
    <fieldset>
        <legend><@t.page 'vote'/></legend>
        <#list page.list as u>
            <#if !u.anonymous><@t.merge 'userIds' u.id.userId!/></#if>
            <@t.merge 'itemIds' u.itemId!/>
        </#list>
        <@sys.user ids=t.userIds!><#assign userMap=map!/></@sys.user>
        <@cms.voteItem ids=t.itemIds!><#assign itemMap=map!/></@cms.voteItem>
        <#list page.list as u>
        <dl class="nowrap">
            <dt>
                ${(itemMap[u.itemId?string].title)!}
            </dt>
            <dd>
                <#if u.anonymous><b><@t.page 'anonymous'/></b><#else><span class="exclude-translate">${(userMap[u.id.userId?string].nickname)!}</span></#if>
                <p>${(u.ip)!} ${(getIpRegion(u.ip).address)!}</p>
            </dd>
        </dl>
        </#list>
        <#if page.totalPage gt 1>
        <div>
            <#list 1..page.totalPage as p>
                <#if p = page.pageIndex>
                    ${p}
                <#else>
                    <a href="cmsVote/view.html?id=${object.id}&pageIndex=${p}" class="exclude-translate" target="dialog" rel="viewVote${object.id}" title="${object.title!}">${p}</a>
                </#if>
            </#list>
        </div>
        </#if>
    </fieldset>
    </#if>
</@cms.userVoteList>
</@cms.vote>
</div>
<div class="formBar">
    <ul>
        <li><button type="button" class="button close"><@t.page 'button.close'/></button></li>
    </ul>
</div>