+ Reply to Thread
Page 4 of 6 FirstFirst ... 2 3 4 5 6 LastLast
Results 31 to 40 of 52

Thread: Including recent changes on the home page

  1. #31
    Join Date
    Feb 2008
    Location
    Southern California
    Posts
    258

    Default

    Yes. In the wiki.getsearch function you can specify a path. For example where the function argument is currently:
    Code:
    wiki.getsearch('type:wiki OR type:document OR type:image', 10, '-date')
    change it to:
    Code:
    wiki.getsearch('type:wiki OR type:document OR type:image AND path:MyPath/*', 10, '-date')
    substituting what ever path you desire for MyPath.

    Regards,
    Mark C.

  2. #32
    Join Date
    Dec 2007
    Location
    Italy (Turin)
    Posts
    53

    Default

    Already done!

    As you can see, the new template accept 2 optional parameters:
    path = section to restrict search query (append an * to the end if you want to include all descendent pages)
    number = row to return

    Invoke it with
    HTML Code:
    {{template("Template:Xsys-modificherecenti"),{path:"Folder1/Folder2/*",number:"25"}) }}
    Tanks to all for your feedback, I also added files notification and (probably) removed error when a page is deleted, but it need more test!

    Past this code in a template page (html source code)
    HTML Code:
    <h1>Template:Xsys-modificherecenti</h1>
    <table block="
        var number = (args.number ?? 20);
        var msg=(#args.path!=0 ? 'Recent changes in '..args.path : 'Recent changes');
        var path=(#args.path!=0 ? 'path:'..args.path..'/*':'');
        var result = wiki.getsearch('type:wiki OR type:document OR type:image', number, '-date',path);" width="100%" border="1" cellpadding="4" cellspacing="0" class="feedtable">
        <tbody>
            <tr>
                <td valign="top" colspan="4" bgcolor="#cccccc" style="text-align: center; "><strong>{{msg}}</strong></td>
            </tr>
            <tr>
                <td bgcolor="#cccccc"><strong>Page</strong></td>
                <td bgcolor="#cccccc"><strong>Date</strong></td>
                <td bgcolor="#cccccc"><strong>Author</strong></td>
                <td bgcolor="#cccccc"><strong>Summary</strong></td>
            </tr>
            <tr foreach="var pa in result" class="{{__count % 2 == 0 ? 'feedroweven' : 'feedrowodd'}}">
                <td if="pa.uri!=nil" style="WORD-BREAK:BREAK-ALL" width="50%">{{pa.id ? web.link(pa.uri, pa.path):web.html("File "..web.link(pa.uri, pa.name).." in "..web.link(pa.page.uri,pa.page.path).."")}}</td>
                <td nowrap="" if="pa.uri!=nil"><small>{{date.format(pa.date,"dd/MM/yy - HH:mm")}}</small></td>
                <td if="pa.uri!=nil"><small>{{web.link("/Special:Contributions?target="..pa.author.name, pa.author.name)}}</small></td>
                <td if="pa.uri!=nil"><small>{{ pa.id? web.link('/index.php?title='..uri.encode(pa.path)..'&amp;action=history',pa.editsummary):''}}</small></td>
            </tr>
            <tr>
                <td valign="top" style="word-break: break-all; text-align: center; " colspan="4"><a title="/Special:Recentchanges" class="internal" href="mks://localhost/Special:Recentchanges">Recent changes</a>&nbsp;</td>
            </tr>
        </tbody>
    </table>
    <p>&nbsp;</p>
    Last edited by gianluca; 01-07-2009 at 06:57 PM.

  3. #33
    Join Date
    Jul 2008
    Location
    Washington
    Posts
    183

    Default

    Quote Originally Posted by gianluca View Post
    Already done!

    As you can see, the new template accept 2 optional parameters:
    path = section to restrict search query (append an * to the end if you want to include all descendent pages)
    number = row to return
    I tried that as you have it except for changing the path to /* but I get this:
    Code:
    /p[2]/span, line 1, column 43: EOF expected

  4. #34
    Join Date
    Feb 2008
    Location
    Southern California
    Posts
    258

    Default

    I believe your template call has an extra ")". Should it not be as follows?
    Code:
    {{template("Template:Xsys-modificherecenti",{path:"Folder1/Folder2/*",number:"25"}) }}
    Once removed it works great!

    Regards,
    Mark C.

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

    Default

    Also, I just commited a fix for bug 5451. The fix allows page feeds to include changes to sub-pages. This fix should address this common use case.
    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

  6. #36
    Join Date
    Jul 2008
    Location
    Washington
    Posts
    183

    Default

    Quote Originally Posted by SteveB View Post
    Also, I just commited a fix for bug 5451. The fix allows page feeds to include changes to sub-pages. This fix should address this common use case.
    Thanks! This is something that our users will really want to take advantage of. Email notices of changes is another related feature that has been requested.

  7. #37
    Join Date
    Jul 2008
    Location
    Washington
    Posts
    183

    Default

    Quote Originally Posted by mcraven View Post
    I believe your template call has an extra ")".
    You were right. Now it works great. The only downside is that it doesn't seem to pick new comments and recent changes.

  8. #38
    Join Date
    Dec 2007
    Location
    Italy (Turin)
    Posts
    53

    Default

    Comments are not include in lucen index, so I can't catch them in this script.

    I already asked in Lyons request page to add comment to Lucene index, this will allow us to search and extract comments.

  9. #39
    Join Date
    Sep 2008
    Posts
    195

    Default

    In Lyons comments are now separately indexed in lucene. You can go to trunk.mindtouch.com to check out the latest builds and play with it there.
    Arne Claassen - Software Architect
    Found a bug? Report it.
    Follow me on Twitter!

  10. #40
    Join Date
    Feb 2008
    Posts
    286

    Default

    Can someone show me how I would write a search that pulls the most recent comments and edits in one search? If I can get that, I'll take my recent changes template and test it out on trunk.

+ 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