The privileged API will fit your need (don't forget to protect the
edition of your scripts pages by non-admins).
JV.
2007/10/9, goldring, richard <richard.goldring(a)uk.thalesgroup.com>om>:
Jean-Vincent,
Thanks - I tried it and it worked.
What I'd like to do now is to have a set of pages with objects attached and
to search those pages by the attributes on those objects.
So for example the pages could represent 'tasks', the objects would store
details of those tasks e.g. task status, task owner, task description, task
date, etc. On a browser page a search/filter could then be done on say task
status to list all uncompleted tasks.
Any idea how to do that?
Also is there any documentation on how to do these searches using:
$xwiki.xWiki.search("select count(doc) from XWikiDocument doc ${query}",
$context.context).get(0))
and
#set ($list = $xwiki.searchDocuments($query, $resultsPerPage, $start))
i.e. what database tables to search - a description of how these methods
work and how to use them, etc
If anyone has some more examples and explaination of these then it would
really help! Thanks!
Regards,
Richard
-----Original Message-----
From: devs-bounces(a)xwiki.org [mailto:devs-bounces@xwiki.org]On Behalf Of
Jean-Vincent Drean
Sent: 03 October 2007 15:00
To: XWiki Developers
Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
set of criteria
The snippet on
xwiki.org :
http://www.xwiki.org/xwiki/bin/view/Code/PaginateSearch
2007/10/3, Jean-Vincent Drean <jv(a)xwiki.com>om>:
Hi,
It's a recurrent need but AFAIK we don't have any generic solution.
I've made a 5' snippet, hope it will be useful.
This snippet requires programming rights ($xwiki.xWiki.search) so
you'll have to make sure that simple users can't edit this page.
-----------------------------------------------8<---------------------------
----------------------------------------
#macro(paginedSearch $query $currentPage
$resultsPerPage)
#set ($start = $resultsPerPage * $currentPage)
#set ($resultsnb = $xwiki.xWiki.search("select count(doc) from
XWikiDocument doc ${query}", $context.context).get(0))
#if ($resultsnb > $resultsPerPage)
#set ($pagesnb = $resultsnb / $resultsPerPage)
#foreach ($pagenb in [0..$pagesnb])
[$pagenb>$doc.fullName?page=$pagenb]
#end
#end
#set ($list = $xwiki.searchDocuments($query, $resultsPerPage, $start))
#foreach ($item in $list)
* $item
#end
#end
#if ($request.page)
#set ($desiredStart = $xwiki.parseInt($request.page))
#else
#set ($desiredStart = 0)
#end
#paginedSearch("where 1=1" $desiredStart 5)
-----------------------------------------------8<---------------------------
----------------------------------------
2007/10/3, goldring, richard <richard.goldring(a)uk.thalesgroup.com>om>:
> Anyone?
>
>
> Hi all,
>
> Does anyone know how to generate a list of links to wiki pages that meet
a
> set of defined features i.e. filter and sort
(features defined on the
> objects or tags on those pages)? Perhaps like the Google search, list
the
> first 20 or 30 pages and have a
next/previous, 1, 2, 3, etc buttons to
list
> the next selections of page links (to cope
with the display of large
numbers
> of page links).
>
> If anyones got any code snipits to get me started then that would be
really
> useful - thanks.
>
> The idea is perhaps to explore how to use XWiki to semi automatically
> generate pages to record tasks or issues, and then to list those pages
> (tasks/issues) according to say the status or owners of those
tasks/issues.
> For tasks I'm thinking XWiki might be
used to help guide users through
> business processes and semi-automatically document they have followed
those
> processes (for CMMI) so they can be simply
audited. Documents generated
> through users following the tasks/processes can then be generated from
> templates and stored within the wiki. If anyone else has any ideas/code
that
> could help perhaps realise this then let me
know!
>
> Regards,
>
> Richard Goldring
>
> TAO
> Wookey Hole Road
> Wells, Somerset
> BA5 1AA
>
> Direct Line: 01749 682694
> Switchboard: 01749 672081
> richard.goldring(a)uk.thalesgroup.com
>
>
>
>
> Thales UK Ltd (Wells) DISCLAIMER: The information contained in this
e-mail
> is confidential. It may also be legally
privileged. It is intended only
for
> the stated addressee(s) and access to it by
any other person is
> unauthorised. If you are not an addressee, you must not disclose, copy,
> circulate or in any other way use or rely on the information contained
in
> this e-mail. Such unauthorised use may be
unlawful. We may monitor all
> e-mail communications through our networks. If you have received this
e-mail
> in error, please inform us immediately on
+44 (0) 1749 672081 and delete
it
> and all copies from your system. We accept
no responsibility for changes
to
> any e-mail which occur after it has been
sent. Attachments to this
e-mail
> may contain software viruses which could
damage your system. We
therefore
> recommend you virus-check all attachments
before opening. A business of
> Thales UK Ltd. Registered Office: 2 Dashwood Lang Road, The Bourne
Business
Park,
Addlestone, Weybridge, Surrey KT15 2NX Registered in England No.
868273
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
Thales UK Ltd (Wells) DISCLAIMER: The information contained in this e-mail
is confidential. It may also be legally privileged. It is intended only for
the stated addressee(s) and access to it by any other person is
unauthorised. If you are not an addressee, you must not disclose, copy,
circulate or in any other way use or rely on the information contained in
this e-mail. Such unauthorised use may be unlawful. We may monitor all
e-mail communications through our networks. If you have received this e-mail
in error, please inform us immediately on +44 (0) 1749 672081 and delete it
and all copies from your system. We accept no responsibility for changes to
any e-mail which occur after it has been sent. Attachments to this e-mail
may contain software viruses which could damage your system. We therefore
recommend you virus-check all attachments before opening. A business of
Thales UK Ltd. Registered Office: 2 Dashwood Lang Road, The Bourne Business
Park, Addlestone, Weybridge, Surrey KT15 2NX Registered in England No.
868273
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs