Was this page helpful?

MyStatus

    Table of contents
    1. 1. Usage
    2. 2. Demo
    3. 3. Chatter Output
    4. 4. Source Code

    The MyStatus template is a small DekiScript application that uses page comments to store user status messages.  It's entirely self-contained in the code below and only requires the Deki AJAX API extension to work.

    Note: Deki AJAX API and JEM are experimental features.  This sample requires MindTouch 2009 (Deki 9.02 "Lyons").

    Usage

    The status application can be embedded on any page by invoking the wiki template.

    {{ MyStatus() }}
    

    Demo


    Chatter Output


    laduncan
    hi
    posted: Mon, 01 Jun 2009 03:06:28 GMT

    intertesto
    ooooooo....
    posted: Sat, 30 May 2009 18:02:24 GMT

    flash39

    posted: Fri, 22 May 2009 11:20:12 GMT

    flash39
    jj
    posted: Fri, 22 May 2009 11:20:10 GMT

    flash39

    posted: Fri, 22 May 2009 11:20:07 GMT

    gabriel84
    hello world
    posted: Fri, 08 May 2009 21:37:47 GMT

    slizarraga
    Hello
    posted: Fri, 08 May 2009 21:34:46 GMT

    larsb
    test
    posted: Thu, 07 May 2009 14:01:48 GMT

    softwaremanager
    follow up!
    posted: Wed, 06 May 2009 15:29:16 GMT

    JasonK
    gg
    posted: Fri, 24 Apr 2009 19:26:06 GMT

    Source Code

    // includes
    dekiapi();
    
    // status input form
    <form id="chatter" name="chatter">
        <div>
            <textarea rows="3" cols="50" id="update" name="update" />
        </div>
        <input type="hidden" value=(page.api) name="pageAPI" /><br />
        <input type="button" value="Publish It" ctor="
            when($this.click) {
                Deki.Api.PostText(Deki.Env.PageApi + '/comments?title=MyStatus', #update.val(), function() {
                    #update.val('');
                    @update();
                }); 
            }" disabled=(user.anonymous ? 'disabled' : _)
        />
    </form>
    
    // status updates
    <h2>"Chatter Output"</h2>
    <div ctor="when(@update) Deki.Api.Reload(this);" id="results">
        <hr />
        foreach(var comment in list.reverse(page.comments) where __count < 10) {
            var user = comment.author;
            <div>
                <a href=(user.uri)><img src=(user.gravatar & { s: 30 }) alt="" />user.name</a><br />
                comment.text;<br />
                "posted: " .. comment.date;<br />
                <hr />
            </div>
        }
    </div>
    
    // initialization script
    <script type="text/javascript">"
        var pageURL = document.chatter.pageAPI.value + '/comments';
        Deki.$(function() { 
            Deki.$('.gallery, .pageInfo, .file, #comments').css('display','none'); 
        });
    "</script>
    
    Was this page helpful?
    Tag page
    Viewing 15 of 27 comments: view all
    More fun with a Gravatar account. :)
    (It's really, really hard not to like deki.)
    Posted 13:58, 20 Apr 2009
    what does this do?
    Posted 17:44, 21 Apr 2009
    ohhhh!
    Posted 17:44, 21 Apr 2009
    blah blah boo blah
    Posted 20:57, 21 Apr 2009
    Coucou
    Posted 00:01, 22 Apr 2009
    gg
    Posted 11:26, 24 Apr 2009
    follow up!
    Posted 07:29, 6 May 2009
    test
    Posted 06:01, 7 May 2009
    Hello
    Posted 13:34, 8 May 2009
    hello world
    Posted 13:37, 8 May 2009
    Posted 03:20, 22 May 2009
    jj
    Posted 03:20, 22 May 2009
    Posted 03:20, 22 May 2009
    ooooooo....
    Posted 10:02, 30 May 2009
    hi
    Posted 19:06, 31 May 2009
    Viewing 15 of 27 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by