SearchPagingNext

Admin により 2011年 4月 14日, 03:02が変更された | 履歴
    目次
    ヘッダーがありません
    /**
     * Search Paging Control
     *
     * @param uri $uri - base uri (default: page.uri)
     * @param map $params - query params to preserve
     * @param num $showing - number of visible results
     * @param bool $next - are there more results?
     * @param num $perPage - number of results shown per page (default: 10)
     * @param str $key - query param to use for paging (default: "page")
     * @param num $page - current page being viewed (default: __request.args[$key])
     * @param str $showingKey - custom resource key to use for "showing results"
     */
    var uri = $uri ?? page.uri;
    var params = $params; // required!
    var showing = $showing; // required!
    var nextPage = $next ?? false;
    var perPage = $perPage ?? 10;
    var pageKey = $key ?? "page";
    var currentPage = $page ?? __request.args[pageKey];
    var localizeShowing = $showingKey ?? "MindTouch.Reports.paging.results";
    
    // compute paging
    if (!currentPage || currentPage < 1) {
        let currentPage = 1;
    }
    
    var setStart = (currentPage - 1) * perPage;
    var setEnd = setStart + showing;
    
    <form class="mt-search-paging" method="get" action=(uri)>
        foreach (var paramName:paramValue in params where paramName != pageKey) {
            <input type="hidden" name=(paramName) value=(paramValue) />
        }
        <div class="summary">
            if (showing < 1) {
                wiki.localize("MindTouch.Reports.paging.noresults");
            } else {
                wiki.localize(localizeShowing, [
                    (setStart+1),
                    setEnd
                ]);
            }
        </div>
        <div class="paging">
            if (currentPage > 1) {
                <span class="prev">
                    <a href=( uri & (params .. {(pageKey): (currentPage - 1)}) )>
                        wiki.localize("MindTouch.Reports.paging.prev");
                    </a>
                </span>
            } else {
                <span class="prev ui-state-disabled">wiki.localize("MindTouch.Reports.paging.prev")</span>
            }
    
            <span class="jump">wiki.localize("MindTouch.Reports.paging.jump")</span>
            <input class="jump" type="text" name=(pageKey) value=(currentPage) size="2" />
    
            if (nextPage) {
                <span class="next">
                    <a href=( uri & (params .. {(pageKey): (currentPage + 1)}) )>
                        wiki.localize("MindTouch.Reports.paging.next");
                    </a>
                </span>
            } else {
                <span class="next ui-state-disabled">wiki.localize("MindTouch.Reports.paging.next")</span>
            }
        </div>
    </form>
    
    
    
    
    タグ (タグ編集)
    • No tags
    ページ統計
    237 view(s), 1 edit(s) and 2867 character(s)

    コメント

    あなたはコメントを投稿するには ログイン しなければなりません。

    添付ファイル

    添付