Search:
Template:News/Forums/Polls/Q&A > Template:ForthcomingEvents

Template:ForthcomingEvents

    Table of contents
    No headers
    /**
        Author: Blake Harms
        additional tweaks by Neil Weinstock
        version: 1.0.7
        Tina - removed all the coding for the side bar (that can be found in template:News) 
       
        HOW TO USE:
        Create a dekiscript block and add: ForthcomingEvents();
    
       
        (Tina says - I have changed bblog to News Flash and replaced instanced of 'blog' with'Notice' in the code.
     Further I have removed the side bar .This is pure and simple news!! )
    
       Change the page permissions to whatever you would like. But if you only want you to be able to add a post, set it 
       to semi-public and give ONLY you permission to create.
    */
    /******************* Configurable options *********************/
    var postsPerPage = $0 ?? $postsPerPage ?? 5;                   // # of posts to show per page
    var path         = $4 ?? $path ?? page.path;                   // path of blog homepage
    /****************** /Configurable options  ******10*************/
    
    var startAt = __request.args.start ?? 0;
    
    <html><head>
    <style type="text/css">"
    /* main */
        #posts {    width:97%; float:left;margin-left:3%;    }
        .post {    padding-right:10px;    }
        .post .post-head a {    color:#663366!important;   }
        .post .post-subhead {     padding-left:50px;font-size:12px;    }
        .post .post-subhead .post-date {    padding:0px; margin:0px;    }
        .post .post-subhead .post-author {     padding:0px; margin:0px; font-weight:bold; font-size:14px;    }
        .post .post-subhead .post-author a {     color:#999999;    }
        .post .post-body {    padding:15px;    }
    /* paginate */
        #paginator {    padding:15px; clear:both;    }
        #paginator a.paginate-previous {    float:left; text-align:left;    }
        #paginator a.paginate-next {    float:right; text-align:right;    }
    "</style>
    </head></html>
    var homepage = wiki.getpage(path);
    var allNotice = list.sort([ p foreach var p in homepage.subpages ], _, true, "date.compare($left.date,$right.date)");
    var notice = allNotice;
    if(startAt > 0){
        if(startAt < #notice){
            let notice = List.splice(notice, 0, startAt);
        }
    }
    wiki.create("Post New Event",path,_,true,"Event No." .. #allNotice);
    <div id="notice-body">
        <div id="posts">
        if(#notice> 0){
            var shown = 0;
            foreach(var p in notice where __index < postsPerPage) {
            <div class="post">
                <div class="post-head">
                  /*  <h2> web.link(p.uri, p.title)</h2>
                                                           */
                  <h2> p.title</h2>
                               </div>
                <div class="post-subhead">
                    "by ";
                    <span class="post-author">
                        var author= p.revisions[0].author;
                        /*web.link(author.homepage.uri, author.name);
                                                                     */         
                        author.name</span>
                    " on ";
                    <span class="post-date">
                        p.revisions[0].date;
                    </span>
                </div>
                <div class="post-body">
                    wiki.page(p.path);
                </div>
                      </div>
                let shown+=1;
            }
        }
        else {
            "No posts";
        }
            <div id="paginator">
            if(startAt > 0){
                var previous = 0;
                if(startAt - postsPerPage > 0){
                    let previous = startAt - postsPerPage;
                }
                <a href=(uri.build(page.uri,_,{start:previous})) class="paginate-previous"> "<Previous"</a>
            }
            if(startAt + postsPerPage <= #homepage.subpages -1){
                var next = startAt + postsPerPage;
                <a href=(uri.build(page.uri,_,{start:next})) class="paginate-next"> "Next>"</a>
            }
            </div>
        </div>
      </div>;

    Files (0)

     

    Comments (0)

    You must login to post a comment.