+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 108

Thread: TODO Template on lyonsdemo site?

Hybrid View

  1. #1

    Question TODO Template on lyonsdemo site?

    On the lyonsdemo.mindtouch.com site there is a TODO template that seems to be driving this nice task list on the site.

    Should one be able to use this in Lyons 9.02 or is it custom or something?

    Would like to integrate it into our wiki but having no luck with simple cut and paste.

    Just wondering if its possible out of the box or if I need something to make it work other then just the template?

  2. #2
    Join Date
    Nov 2008
    Location
    Ludington, Mi (USA)
    Posts
    751

    Default

    That is an awesome task list. I am also getting an error when trying to use the template:

    /content/body/pre, reference to undefined name 'dekiapi': line 2, column 1 (click for details)

    Of course I usually copy in source mode but this time I had to use just straight select and copy since no edit capabilities so that is what may be causing it.
    Last edited by rberinger; 04-17-2009 at 01:18 PM.

  3. #3

    Default

    Hopefully someone with access to it can post it.

    It would be so nice to have and really add some value to the wiki internally.

    Also hope to get that messaging functionality they have on there as well. But the TODO is probably the most useful thing I have seen yet.

  4. #4
    Join Date
    Nov 2008
    Location
    Ludington, Mi (USA)
    Posts
    751

    Default

    Quote Originally Posted by pktloss View Post
    It would be so nice to have and really add some value to the wiki internally.
    Thats exactly the type of functionality I have been looking for. I see that it is utilizing the new page properties to store the information. But I'm not sure why I am getting the error on the dekiapi();. What error where you getting?


    Quote Originally Posted by pktloss View Post
    Also hope to get that messaging functionality they have on there as well. But the TODO is probably the most useful thing I have seen yet.
    I'm not quite sure about the benefit of this module (as of yet). I looks like it tracks the changes you do within the wiki which may be interesting but not sure of the value of someone else injecting something into that feed. Great example for development purposes though.

  5. #5
    Join Date
    Nov 2008
    Location
    Ludington, Mi (USA)
    Posts
    751

    Default

    OK after a bit more digging I don't think my API is setup right. Not sure whats wrong just yet but anything I try to do that has the include of dekiapi(); does not work. I am able to use the API from the desktop and I get API information back when I check the /@api/deki/@about page. So if your getting the same error as I am I think it has something to do with defining the api to the jQuery extension.

  6. #6

    Default

    I am getting this error:

    /content/body/pre, reference to undefined name 'jquery': line 3, column 1


    Details of the error:

    Code:
    MindTouch.Deki.Script.DekiScriptUndefinedNameException: reference to undefined name 'jquery': line 3, column 1
      at MindTouch.Deki.Script.DekiScriptVar.Evaluate (MindTouch.Deki.Script.DekiScriptEnv env) [0x00000] 
      at MindTouch.Deki.Script.DekiScriptAccess.Evaluate (MindTouch.Deki.Script.DekiScriptEnv env, Boolean evaluateProperties) [0x00000] 
      at MindTouch.Deki.Script.DekiScriptAccess.Evaluate (MindTouch.Deki.Script.DekiScriptEnv env) [0x00000] 
      at MindTouch.Deki.Script.DekiScriptCall.Evaluate (MindTouch.Deki.Script.DekiScriptEnv env) [0x00000] 
      at MindTouch.Deki.Script.DekiScriptSequence.Evaluate (MindTouch.Deki.Script.DekiScriptEnv env) [0x00000] 
      at MindTouch.Deki.Script.Dom.DekiScriptDomExpr.Evaluate (MindTouch.Deki.Script.DekiScriptEvalContext context, System.Xml.XmlNode parent, MindTouch.Deki.Script.DekiScriptEnv env) [0x00000]

    I went to the lyonsdemo.mindtouch.com site and then the "Mindtouch Lyons" page where the todo is. I selected edit page, then source and copied the following code:

    Code:
    <h1>Mindtouch Lyons</h1>
    <pre class="script">
    // includes
    dekiapi();
    jquery.ui('smoothness');
    &lt;div id="deki-todo"&gt;
    // input form
    &lt;form&gt;
        &lt;input id="todoid" type="hidden" value="" /&gt;
    &nbsp;&nbsp;&nbsp; &lt;div class="todo-assign"&gt;
    &nbsp;&nbsp;&nbsp; " Task: "; 
    &nbsp;&nbsp;&nbsp; &lt;/div&gt;
        &lt;div class="todo-who"&gt;
        " Who: ";
        &lt;select id="todowho"&gt;
            foreach(var u in site.users where !u.anonymous) {
                &lt;option value=(u.name) selected=((u.id == user.id) ? 'selected' : nil)&gt;u.name&lt;/option&gt;
            }
        &lt;/select&gt;
        &lt;/div&gt;
        &lt;div class="todo-what"&gt;
        "What: "; &lt;input id="todowhat" type="text" /&gt;
        &lt;/div&gt;
    &nbsp;&nbsp;&nbsp; &lt;div class="todo-when"&gt;
        " When: "; &lt;input id="todowhen" type="text" value=(date.format(date.now, 'MM/dd/yyyy')) ctor="$this.datepicker();" /&gt;
        &lt;/div&gt;
    &nbsp;&nbsp;&nbsp; &lt;div class="todo-submit"&gt;
    &nbsp;&nbsp;&nbsp;&nbsp;&lt;input id="todoadd" type="button" value="Add" ctor="
            when($this.click) {
                @todoupdate({ index: #todoid.val(), entry: { what: #todowhat.val(), who: #todowho.val(), when: #todowhen.val(), author: {{user.name}}, done: false }});
                #todoid.val('');
                #todowhat.val('');
                #todoadd.val('Add');
                #tododelete.hide();
                #todoadd.blur();
            }
            when(#tododelete.click) {
                @todoupdate({ index: #todoid.val(), entry: null });
                #todoid.val('');
                #todowhat.val('');
                #todoadd.val('Add');
                #tododelete.hide();
                #todoadd.blur();
            }
            when(@todoedit) {
                Deki.Api.ReadPageProperty(null, 'urn:custom.mindtouch.com#todo', function(result) {
                    var data = YAHOO.lang.JSON.parse(result.value || '[]');
                    #todoid.val(@todoedit.index);
                    #todowhat.val(data[@todoedit.index].what);
                    #todowhen.val(data[@todoedit.index].when);
                    #todowho.val(data[@todoedit.index].who);
                    #todoadd.val('Update');
                    #tododelete.show();
                }, function(result) {
                    alert('An error occurred trying to read the TODO list (status: ' + result.status + ' - ' + result.text + ')');
                });
            }
            when(@todoupdate) {
                Deki.Api.ReadPageProperty(null, 'urn:custom.mindtouch.com#todo', function(result) {
                    var data = eval('(' + (result.value || '[]') + ')');
                    if(@todoupdate.index !== '') {
                        if(@todoupdate.entry === null) {
                            data.splice(@todoupdate.index, 1);
                        } else {
                            Deki.$.extend(data[@todoupdate.index], @todoupdate.entry);
                        }
                    } else {
                        data.push(@todoupdate.entry);
                    }
                    if(result.etag) {
                        Deki.Api.UpdatePageProperty(result.href, YAHOO.lang.JSON.stringify(data), result.etag, function() {
                            Deki.Api.Reload(#todolist, null, function() { ToDoWireControls(); });
                        }, function(result) {
                            alert('An error occurred trying to update the TODO list (status: ' + result.status + ' - ' + result.text + ')');
                        });
                    } else {
                        Deki.Api.CreatePageProperty(null, 'urn:custom.mindtouch.com#todo', YAHOO.lang.JSON.stringify(data), function() {
                            Deki.Api.Reload(#todolist);
                        }, function(result) {
                            alert('An error occurred trying to create the TODO list (status: ' + result.status + ' - ' + result.text + ')');
                        });
                    }
                }, function(result) {
                    alert('An error occurred trying to read the TODO list (status: ' + result.status + ' - ' + result.text + ')');
                });
            }
        " /&gt;
        &lt;input id="tododelete" style="display: none;" type="button" value="Delete" /&gt;
    &nbsp;&nbsp;&nbsp; &lt;/div&gt;
    &lt;/form&gt;
    
    // todo list
    var todo = json.parse(page.properties["todo"].text ?? "") ?? [];
    let todo = [ item .. { index: __index } foreach var item in todo ];
    let todo = list.sort(todo, _, true, "date.compare($left.when, $right.when)");
    &lt;table id="todolist" cellspacing="0" cellpadding="0"&gt;
    &nbsp;&nbsp;&nbsp; &lt;colgroup&gt;
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;col width="20" /&gt;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;col width="20%" /&gt;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;col /&gt;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;col width="15%" /&gt;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;col width="75" /&gt;
    &nbsp;&nbsp;&nbsp; &lt;/colgroup&gt;
        &lt;tr&gt;
            &lt;th&gt;string.nbsp&lt;/th&gt;
            &lt;th&gt;"When"&lt;/th&gt;
            &lt;th&gt;"What"&lt;/th&gt;
            &lt;th&gt;"Who"&lt;/th&gt;
            &lt;th&gt;string.nbsp&lt;/th&gt;
        &lt;/tr&gt;
        foreach(var entry in todo) {
            var class = "";
            if(entry.done) let class..= "completed ";
            if(date.issameday(date.now, entry.when)) let class ..= "due-today ";
            else if(date.isafter(date.now, entry.when)) let class ..= "due-past ";
            var title = "Created by " .. entry.author;
            &lt;tr class=(class)&gt;
                &lt;td&gt;&lt;input type="checkbox" name="done" value=(entry.index) checked=(entry.done ? 'checked' : nil) /&gt;&lt;/td&gt;
                &lt;td title=(title)&gt;&lt;span&gt;entry.when&lt;/span&gt;&lt;/td&gt;
                &lt;td title=(title)&gt;&lt;span&gt;entry.what&lt;/span&gt;&lt;/td&gt;
                &lt;td title=(title)&gt;&lt;span&gt;entry.who&lt;/span&gt;&lt;/td&gt;
                &lt;td class="todo-edit"&gt;&lt;a href="#" rel=(entry.index)&gt;"edit"&lt;/a&gt;&lt;/td&gt;
            &lt;/tr&gt;
        }
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;script type="text/jem"&gt;"
    function ToDoWireControls() {
        Deki.$('#todolist a').bind('click', function() {
            @todoedit({ index: Deki.$(this).attr('rel') }); 
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  #todowhat.select();
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;
        });
        Deki.$('#todolist input').bind('change', function() {
            var $this = Deki.$(this);
            @todoupdate({ index: $this.val(), entry: { done: this.checked } });
        });
    }
    ToDoWireControls();
    "&lt;/script&gt;
    </pre>
    <p>
        <style type="text/css">/*<![CDATA[*/
    
    #deki-todo {
    	margin: 0;
    	padding: 4px; 
    	width: 98%;
    }
    #deki-todo table {
    	width: 100%; 
    	margin: 0;
    }
    #deki-todo table td {
    	border-bottom: 1px solid #000;
    	padding: 4px 2px;
    }
    #deki-todo tr td.todo-edit {
    	text-align: right;
    	padding-right: 8px;
    }
    #deki-todo tr.due-today td {
    	background-color: #ff0; 	
    }
    #deki-todo tr.completed td {
    	background-color: #fff;
    }
    #deki-todo tr.completed td span {
    	text-decoration: line-through;
    }
    #deki-todo tr.due-past td, 
    #deki-todo tr.due-past td.todo-edit a {
    	color: #777;	
    }
    #deki-todo table th {
    	font-size: 14px;
    	font-weight: bold;
    	text-align: left;
    	border-bottom: 2px solid #000;
    }
    #deki-todo form {
    	padding: 4px; 
    	background-color: #000;
    	color: #fff; 
    	overflow: hidden;
    	margin-bottom: 8px;
    }
    #deki-todo div.todo-assign {
    	font-weight: bold;
    }
    #deki-todo form, 
    #deki-todo form input, 
    #deki-todo form select {
    	font-size: 11px;
    }
    #deki-todo form div {
    	padding-right: 8px;	
    	float: left;
    }
    #deki-todo div.todo-submit {
    	float: right; 
    	padding-right: 0px;
    }
    #deki-todo div.todo-submit input {
    	margin-right: 4px;
    }
    #deki-todo table tr td.todo-edit a {
    	background: url(/skins/common/icons/silk/page_white_edit.png) no-repeat center left;
    	color: #000;
    	text-decoration: none;
    	padding: 3px 3px 3px 21px;
    	font-size: 11px;
    }
    #deki-todo table tr td.todo-edit a:hover {
    	text-decoration: underline;
    }
    /*]]>*/</style>
    </p>
    I have unsafehtml enabled. I then created a new page, switched to source and pasted content.

    Obviously I don't know what I am doing and just trying the obvious easy thing to do in order to try getting it.

  7. #7
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    FYI: moved thread to dekiscript & dek extensions forum.
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

  8. #8
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Posts
    175

    Default

    Huh. This just stopped working. Did something change in one of the dependency extensions? Error is:
    'MindTouch.Web' is null or not an object'
    AFAIK, nothing changed on my end; everything was working well, and then it wasn't. Server reboot didn't change anything, either.

    This brings up a another question, too: where is this todo data stored? It doesn't appear to be saved with the page, or at least, not in a place I'm looking for it. I ask because one of the byproducts of the failure is that when I clicked on a completed checkbox, all of my data disappeared. Bummer.

    My assumption, BTW, is that something hinky is going on with my system, either server or desktop-side, since that's the normal way things work. But this is one implementation in MT that defies versioning, apparently; good to keep in mind when dealing with important data.
    Last edited by laduncan; 06-08-2009 at 02:46 AM.

  9. #9
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    Hmm, yeah, something did change. Are you loading the extension from http://scripts.mindtouch.com? I just updated the code then on Friday, but it should have continued working as usual.

    The data is stored in a page property. You can see by going to 'Set Page Properties' and then click on the 'Avanced' tab. Properties are versioned like pages. So technically your data is still there, but I don't think there is an easy mechanism to access it.
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

  10. #10
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    Can you check the HTML source for the wiki page on which the TODO list is and verify that (a) it has a link to include mindtouch.web.js and (b) that this link returns a valid file. Thanks.
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts