Ref: Displaying lists of wiki pages given a set of criteria

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Ref: Displaying lists of wiki pages given a set of criteria

goldring, richard
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
[hidden email]




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
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

Jean-Vincent Drean
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 <[hidden email]>:

> 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
> [hidden email]
>
>
>
>
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

goldring, richard
In reply to this post by goldring, richard
Thank you Jean-Vincent,

I'll try the code out once I've figured it out.

It would be useful to have someone who 'knows' to document/write one or more
tutorials on how to extract information from the XWiki database. It would
help XWiki users/developers to develop XWiki for all sort of applications:
* Task/process generation and tracking
* Work flow form based applications
* Issue tracking
* Help desk request/issue tracking
* Objective setting and planning
etc

Regards,

Richard

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]On Behalf Of
Jean-Vincent Drean
Sent: 03 October 2007 14:38
To: XWiki Developers
Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
set of criteria


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 <[hidden email]>:
> 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
> [hidden email]
>
>
>
>
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[hidden email]
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
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

Jean-Vincent Drean
In reply to this post by Jean-Vincent Drean
The snippet on xwiki.org :
http://www.xwiki.org/xwiki/bin/view/Code/PaginateSearch

2007/10/3, Jean-Vincent Drean <[hidden email]>:

> 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 <[hidden email]>:
> > 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
> > [hidden email]
> >
> >
> >
> >
> > 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
> > [hidden email]
> > http://lists.xwiki.org/mailman/listinfo/devs
> >
>
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

vmassol
Administrator
Hi JV,

On Oct 3, 2007, at 4:00 PM, Jean-Vincent Drean wrote:

> The snippet on xwiki.org :
> http://www.xwiki.org/xwiki/bin/view/Code/PaginateSearch

Is it the same as http://www.xwiki.org/xwiki/bin/view/Code/ 
PagedViewLinksMacro or is it different?

At very first glance they seem related.

Thanks
-Vincent

> 2007/10/3, Jean-Vincent Drean <[hidden email]>:
>> 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 <[hidden email]>:
>>> 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
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

Jean-Vincent Drean
2007/10/3, Vincent Massol <[hidden email]>:
>
> Is it the same as http://www.xwiki.org/xwiki/bin/view/Code/
> PagedViewLinksMacro or is it different?
>
> At very first glance they seem related.
>

They are different, I didn't knew this macro which seems a lot more
polished but doesn't rest on a HQL query. You should try both and see
which one covers your needs best.

JV.
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

vmassol
Administrator

On Oct 3, 2007, at 4:34 PM, Jean-Vincent Drean wrote:

> 2007/10/3, Vincent Massol <[hidden email]>:
>>
>> Is it the same as http://www.xwiki.org/xwiki/bin/view/Code/
>> PagedViewLinksMacro or is it different?
>>
>> At very first glance they seem related.
>>
>
> They are different, I didn't knew this macro which seems a lot more
> polished but doesn't rest on a HQL query. You should try both and see
> which one covers your needs best.

I guess your macro could use this macro for displaying the pagination.

-Vincent

_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

vmassol
Administrator
In reply to this post by goldring, richard

On Oct 3, 2007, at 3:53 PM, goldring, richard wrote:

> Thank you Jean-Vincent,
>
> I'll try the code out once I've figured it out.
>
> It would be useful to have someone who 'knows' to document/write  
> one or more
> tutorials on how to extract information from the XWiki database. It  
> would
> help XWiki users/developers to develop XWiki for all sort of  
> applications:
> * Task/process generation and tracking
> * Work flow form based applications
> * Issue tracking
> * Help desk request/issue tracking
> * Objective setting and planning
> etc

Yes, agreed. We know we need this. What we need is contributors  
willing to help at this point.

If users were contributing back what they succeed in doing (after  
asking on the list) we would have nice tutorials covering everything :)

Are you interested in contributing what you've succeeded in doing?  
Xwiki.org is a wiki so you can easily add stuff on there. I think the  
dev guide would be a logical place for putting this. WDYT?

Thanks
-Vincent

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]On  
> Behalf Of
> Jean-Vincent Drean
> Sent: 03 October 2007 14:38
> To: XWiki Developers
> Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
> set of criteria
>
>
> 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 <[hidden email]>:
>> 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
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

goldring, richard
In reply to this post by goldring, richard
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: [hidden email] [mailto:[hidden email]]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 <[hidden email]>:
> 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 <[hidden email]>:
> > 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
> > [hidden email]
> >
> >
> >
> >
> > 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
> > [hidden email]
> > http://lists.xwiki.org/mailman/listinfo/devs
> >
>
_______________________________________________
devs mailing list
[hidden email]
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
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

Jean-Vincent Drean
I've started documenting hql queries through public and privileged APIs here:
http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples

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 <[hidden email]>:

> 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: [hidden email] [mailto:[hidden email]]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 <[hidden email]>:
> > 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 <[hidden email]>:
> > > 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
> > > [hidden email]
> > >
> > >
> > >
> > >
> > > 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
> > > [hidden email]
> > > http://lists.xwiki.org/mailman/listinfo/devs
> > >
> >
> _______________________________________________
> devs mailing list
> [hidden email]
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

goldring, richard
In reply to this post by goldring, richard
Thanks Jean-Vincent,

What you've done helps ... but how does one list documents with a certain
object attached whom's properties = a certain value?

Regards,

Richard

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]On Behalf Of
Jean-Vincent Drean
Sent: 09 October 2007 12:34
To: XWiki Developers
Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
set of criteria


I've started documenting hql queries through public and privileged APIs
here:
http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples

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 <[hidden email]>:
> 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: [hidden email] [mailto:[hidden email]]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 <[hidden email]>:
> > 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 <[hidden email]>:
> > > 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
> > > [hidden email]
> > >
> > >
> > >
> > >
> > > 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
> > > [hidden email]
> > > http://lists.xwiki.org/mailman/listinfo/devs
> > >
> >
> _______________________________________________
> devs mailing list
> [hidden email]
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[hidden email]
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
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

Jean-Vincent Drean
Added here :
http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples#HGettingdocumentswhereobjects27propertiesequalssomevalue

JV.

2007/10/9, goldring, richard <[hidden email]>:

> Thanks Jean-Vincent,
>
> What you've done helps ... but how does one list documents with a certain
> object attached whom's properties = a certain value?
>
> Regards,
>
> Richard
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]On Behalf Of
> Jean-Vincent Drean
> Sent: 09 October 2007 12:34
> To: XWiki Developers
> Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
> set of criteria
>
>
> I've started documenting hql queries through public and privileged APIs
> here:
> http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples
>
> 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 <[hidden email]>:
> > 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: [hidden email] [mailto:[hidden email]]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 <[hidden email]>:
> > > 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 <[hidden email]>:
> > > > 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
> > > > [hidden email]
> > > >
> > > >
> > > >
> > > >
> > > > 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
> > > > [hidden email]
> > > > http://lists.xwiki.org/mailman/listinfo/devs
> > > >
> > >
> > _______________________________________________
> > devs mailing list
> > [hidden email]
> > 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
> > [hidden email]
> > http://lists.xwiki.org/mailman/listinfo/devs
> >
> _______________________________________________
> devs mailing list
> [hidden email]
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

goldring, richard
In reply to this post by goldring, richard
Hey it works!

I coded it thus:

1.1 Listing documents by searching on their object properties - XWikiUsers
and first name

#set ($list = $xwiki.search("select doc.fullName from XWikiDocument doc,
BaseObject obj, StringProperty prop where doc.fullName=obj.name and
obj.className='XWiki.XWikiUsers' and prop.id.id=obj.id and
prop.name='first_name' and prop.value='Graham'", 5, 0))

#includeForm("XWiki.Results")

1.1 Listing documents by searching on their object properties - Article and
title

#set ($list = $xwiki.search("select doc.fullName from XWikiDocument doc,
BaseObject obj, StringProperty prop where doc.fullName=obj.name and
obj.className='XWiki.ArticleClass' and prop.id.id=obj.id and
prop.name='title' and prop.value like 'Art%'", 5, 0))

#includeForm("XWiki.Results")

and it displays the results using the Results table (although with two
#includeForm("XWiki.Results") it displays the filter columns twice on the
first table and no fitler columns on the second table on the same page?).

So thanks again Jean-Vincent!!!! This is really going to help me (and
others) use XWiki to develop useful applications with it.

Best Regards,

Richard

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]On Behalf Of
Jean-Vincent Drean
Sent: 09 October 2007 13:12
To: XWiki Developers
Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
set of criteria


Added here :
http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples#HGettingdoc
umentswhereobjects27propertiesequalssomevalue

JV.

2007/10/9, goldring, richard <[hidden email]>:

> Thanks Jean-Vincent,
>
> What you've done helps ... but how does one list documents with a certain
> object attached whom's properties = a certain value?
>
> Regards,
>
> Richard
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]On Behalf Of
> Jean-Vincent Drean
> Sent: 09 October 2007 12:34
> To: XWiki Developers
> Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
> set of criteria
>
>
> I've started documenting hql queries through public and privileged APIs
> here:
> http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples
>
> 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 <[hidden email]>:
> > 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: [hidden email] [mailto:[hidden email]]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 <[hidden email]>:
> > > 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 <[hidden email]>:
> > > > 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
> > > > [hidden email]
> > > >
> > > >
> > > >
> > > >
> > > > 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
> > > > [hidden email]
> > > > http://lists.xwiki.org/mailman/listinfo/devs
> > > >
> > >
> > _______________________________________________
> > devs mailing list
> > [hidden email]
> > 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
> > [hidden email]
> > http://lists.xwiki.org/mailman/listinfo/devs
> >
> _______________________________________________
> devs mailing list
> [hidden email]
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[hidden email]
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
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

goldring, richard
In reply to this post by goldring, richard
Guillaume,
 
I'll make time and see what I can do.
 
Regards,
 
Richard
-----Original Message-----
From: [hidden email] [mailto:[hidden email]]On Behalf Of Guillaume Lerouge
Sent: 09 October 2007 14:09
To: XWiki Developers
Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a set of criteria

Hi Richard,

how would you feel about writing a tutorial about what you did and adding it to the tutorial page on the DevGuide with some screenshots? I'm sure this would be quite useful for a lot of us... And you would help set the tone towards more user-contributed documentation ;-)

(plus I'm sure you could be added to XWiki's Hall of Fame for doing this :-)

Many thanks in advance,

Guillaume

On 09/10/2007, goldring, richard <[hidden email]> wrote:
Hey it works!

I coded it thus:

1.1 Listing documents by searching on their object properties - XWikiUsers
and first name

#set ($list = $xwiki.search("select doc.fullName from XWikiDocument doc,
BaseObject obj, StringProperty prop where doc.fullName=obj.name and
obj.className='XWiki.XWikiUsers' and prop.id.id=obj.id and
prop.name='first_name' and prop.value='Graham'", 5, 0))

#includeForm("XWiki.Results")

1.1 Listing documents by searching on their object properties - Article and
title

#set ($list = $xwiki.search("select doc.fullName from XWikiDocument doc,
BaseObject obj, StringProperty prop where doc.fullName=obj.name and
obj.className='XWiki.ArticleClass' and prop.id.id=obj.id and
prop.name='title' and prop.value like 'Art%'", 5, 0))

#includeForm("XWiki.Results")

and it displays the results using the Results table (although with two
#includeForm("XWiki.Results") it displays the filter columns twice on the
first table and no fitler columns on the second table on the same page?).

So thanks again Jean-Vincent!!!! This is really going to help me (and
others) use XWiki to develop useful applications with it.

Best Regards,

Richard

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]On Behalf Of
Jean-Vincent Drean
Sent: 09 October 2007 13:12
To: XWiki Developers
Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
set of criteria


Added here :
http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples#HGettingdoc
umentswhereobjects27propertiesequalssomevalue

JV.

2007/10/9, goldring, richard <[hidden email]>:

> Thanks Jean-Vincent,
>
> What you've done helps ... but how does one list documents with a certain
> object attached whom's properties = a certain value?
>
> Regards,
>
> Richard
>
> -----Original Message-----
> From: [hidden email][mailto:[hidden email]]On Behalf Of
> Jean-Vincent Drean
> Sent: 09 October 2007 12:34
> To: XWiki Developers
> Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
> set of criteria
>
>
> I've started documenting hql queries through public and privileged APIs
> here:
> http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples
>
> 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 <[hidden email]>:
> > 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: [hidden email] [mailto:[hidden email]]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 <[hidden email]>:
> > > 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 <[hidden email]>:
> > > > 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
> > > > [hidden email]
> > > >
> > > >
> > > >
> > > >
> > > > 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
> > > > [hidden email]
> > > > http://lists.xwiki.org/mailman/listinfo/devs
> > > >
> > >
> > _______________________________________________
> > devs mailing list
> > [hidden email]
> > 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
> > [hidden email]
> > http://lists.xwiki.org/mailman/listinfo/devs
> >
> _______________________________________________
> devs mailing list
> [hidden email]
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[hidden email]
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
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs



--
http://wikibc.blogspot.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 D! ashwood Lang Road, The Bourne Business Park, Addlestone, Weybridge, Surrey KT15 2NX Registered in England No. 868273


_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

Guillaume Lerouge
In reply to this post by goldring, richard
Hi Richard,

how would you feel about writing a tutorial about what you did and adding it to the tutorial page on the DevGuide with some screenshots? I'm sure this would be quite useful for a lot of us... And you would help set the tone towards more user-contributed documentation ;-)

(plus I'm sure you could be added to XWiki's Hall of Fame for doing this :-)

Many thanks in advance,

Guillaume

On 09/10/2007, goldring, richard <[hidden email]> wrote:
Hey it works!

I coded it thus:

1.1 Listing documents by searching on their object properties - XWikiUsers
and first name

#set ($list = $xwiki.search("select doc.fullName from XWikiDocument doc,
BaseObject obj, StringProperty prop where doc.fullName=obj.name and
obj.className='XWiki.XWikiUsers' and prop.id.id=obj.id and
prop.name='first_name' and prop.value='Graham'", 5, 0))

#includeForm("XWiki.Results")

1.1 Listing documents by searching on their object properties - Article and
title

#set ($list = $xwiki.search("select doc.fullName from XWikiDocument doc,
BaseObject obj, StringProperty prop where doc.fullName=obj.name and
obj.className='XWiki.ArticleClass' and prop.id.id=obj.id and
prop.name='title' and prop.value like 'Art%'", 5, 0))

#includeForm("XWiki.Results")

and it displays the results using the Results table (although with two
#includeForm("XWiki.Results") it displays the filter columns twice on the
first table and no fitler columns on the second table on the same page?).

So thanks again Jean-Vincent!!!! This is really going to help me (and
others) use XWiki to develop useful applications with it.

Best Regards,

Richard

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]On Behalf Of
Jean-Vincent Drean
Sent: 09 October 2007 13:12
To: XWiki Developers
Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
set of criteria


Added here :
http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples#HGettingdoc
umentswhereobjects27propertiesequalssomevalue

JV.

2007/10/9, goldring, richard <[hidden email]>:

> Thanks Jean-Vincent,
>
> What you've done helps ... but how does one list documents with a certain
> object attached whom's properties = a certain value?
>
> Regards,
>
> Richard
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]On Behalf Of
> Jean-Vincent Drean
> Sent: 09 October 2007 12:34
> To: XWiki Developers
> Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
> set of criteria
>
>
> I've started documenting hql queries through public and privileged APIs
> here:
> http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples
>
> 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 <[hidden email]>:
> > 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: [hidden email] [mailto:[hidden email]]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 <[hidden email]>:
> > > 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 <[hidden email]>:
> > > > 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
> > > > [hidden email]
> > > >
> > > >
> > > >
> > > >
> > > > 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
> > > > [hidden email]
> > > > http://lists.xwiki.org/mailman/listinfo/devs
> > > >
> > >
> > _______________________________________________
> > devs mailing list
> > [hidden email]
> > 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
> > [hidden email]
> > http://lists.xwiki.org/mailman/listinfo/devs
> >
> _______________________________________________
> devs mailing list
> [hidden email]
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[hidden email]
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
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs



--
http://wikibc.blogspot.com/
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

goldring, richard
In reply to this post by goldring, richard
Jean-Vincent,

I've developed this code for searching and then displaying the properties
and property values of an documents object - only the line indicated doesn't
display the properties value - any ideas how to do this?

#set ($list = $xwiki.search("select doc.fullName from XWikiDocument doc,
BaseObject obj, StringProperty prop where doc.fullName=obj.name and
obj.className='XWiki.ArticleClass' and prop.id.id=obj.id and
prop.name='title' and prop.value like 'Art%'", 5, 0))

#foreach ($item in $list)
#set($bentrydoc = $xwiki.getDocument($item))

#set($class = $bentrydoc.getObject("XWiki.ArticleClass").xWikiClass)
$bentrydoc.name
<table border="1" cellspacing="0" cellpadding="2">
#foreach($prop in $class.properties)
<tr>
<td> *${prop.prettyName}* </td>
<td>Value: $doc.display($prop.value)</td> <--- this line!
</tr>
#end
</table>

Regards,

Richard

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]On Behalf Of
Jean-Vincent Drean
Sent: 09 October 2007 13:12
To: XWiki Developers
Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
set of criteria


Added here :
http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples#HGettingdoc
umentswhereobjects27propertiesequalssomevalue

JV.

2007/10/9, goldring, richard <[hidden email]>:

> Thanks Jean-Vincent,
>
> What you've done helps ... but how does one list documents with a certain
> object attached whom's properties = a certain value?
>
> Regards,
>
> Richard
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]On Behalf Of
> Jean-Vincent Drean
> Sent: 09 October 2007 12:34
> To: XWiki Developers
> Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
> set of criteria
>
>
> I've started documenting hql queries through public and privileged APIs
> here:
> http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples
>
> 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 <[hidden email]>:
> > 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: [hidden email] [mailto:[hidden email]]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 <[hidden email]>:
> > > 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 <[hidden email]>:
> > > > 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
> > > > [hidden email]
> > > >
> > > >
> > > >
> > > >
> > > > 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
> > > > [hidden email]
> > > > http://lists.xwiki.org/mailman/listinfo/devs
> > > >
> > >
> > _______________________________________________
> > devs mailing list
> > [hidden email]
> > 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
> > [hidden email]
> > http://lists.xwiki.org/mailman/listinfo/devs
> >
> _______________________________________________
> devs mailing list
> [hidden email]
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[hidden email]
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
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

ebullient
try this:

#set($obj = $bentrydoc.getObject("XWiki.ArticleClass"))
$doc.display($prop.name, "view", $obj)


On 10/9/07, goldring, richard <[hidden email]> wrote:

> Jean-Vincent,
>
> I've developed this code for searching and then displaying the properties
> and property values of an documents object - only the line indicated doesn't
> display the properties value - any ideas how to do this?
>
> #set ($list = $xwiki.search("select doc.fullName from XWikiDocument doc,
> BaseObject obj, StringProperty prop where doc.fullName=obj.name and
> obj.className='XWiki.ArticleClass' and prop.id.id=obj.id and
> prop.name='title' and prop.value like 'Art%'", 5, 0))
>
> #foreach ($item in $list)
> #set($bentrydoc = $xwiki.getDocument($item))
>
> #set($class = $bentrydoc.getObject("XWiki.ArticleClass").xWikiClass)
> $bentrydoc.name
> <table border="1" cellspacing="0" cellpadding="2">
> #foreach($prop in $class.properties)
> <tr>
> <td> *${prop.prettyName}* </td>
> <td>Value: $doc.display($prop.value)</td> <--- this line!
> </tr>
> #end
> </table>
>
> Regards,
>
> Richard
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]On Behalf Of
> Jean-Vincent Drean
> Sent: 09 October 2007 13:12
> To: XWiki Developers
> Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
> set of criteria
>
>
> Added here :
> http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples#HGettingdoc
> umentswhereobjects27propertiesequalssomevalue
>
> JV.
>
> 2007/10/9, goldring, richard <[hidden email]>:
> > Thanks Jean-Vincent,
> >
> > What you've done helps ... but how does one list documents with a certain
> > object attached whom's properties = a certain value?
> >
> > Regards,
> >
> > Richard
> >
> > -----Original Message-----
> > From: [hidden email] [mailto:[hidden email]]On Behalf Of
> > Jean-Vincent Drean
> > Sent: 09 October 2007 12:34
> > To: XWiki Developers
> > Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
> > set of criteria
> >
> >
> > I've started documenting hql queries through public and privileged APIs
> > here:
> > http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples
> >
> > 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 <[hidden email]>:
> > > 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: [hidden email] [mailto:[hidden email]]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 <[hidden email]>:
> > > > 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 <[hidden email]>:
> > > > > 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
> > > > > [hidden email]
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > 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
> > > > > [hidden email]
> > > > > http://lists.xwiki.org/mailman/listinfo/devs
> > > > >
> > > >
> > > _______________________________________________
> > > devs mailing list
> > > [hidden email]
> > > 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
> > > [hidden email]
> > > http://lists.xwiki.org/mailman/listinfo/devs
> > >
> > _______________________________________________
> > devs mailing list
> > [hidden email]
> > 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
> > [hidden email]
> > http://lists.xwiki.org/mailman/listinfo/devs
> >
> _______________________________________________
> devs mailing list
> [hidden email]
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>


--
'Waste of a good apple' -Samwise Gamgee
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

goldring, richard
In reply to this post by goldring, richard
Yes I've tried this, but XWiki doesn't execute this code it just displays:
$doc.display($prop.name, "view", $obj) as if its just any other text on the
page!

What's happening? Why won't it execute?

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]On Behalf Of
Erin Schnabel
Sent: 09 October 2007 18:15
To: XWiki Developers
Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
set of criteria


try this:

#set($obj = $bentrydoc.getObject("XWiki.ArticleClass"))
$doc.display($prop.name, "view", $obj)


On 10/9/07, goldring, richard <[hidden email]> wrote:
> Jean-Vincent,
>
> I've developed this code for searching and then displaying the properties
> and property values of an documents object - only the line indicated
doesn't

> display the properties value - any ideas how to do this?
>
> #set ($list = $xwiki.search("select doc.fullName from XWikiDocument doc,
> BaseObject obj, StringProperty prop where doc.fullName=obj.name and
> obj.className='XWiki.ArticleClass' and prop.id.id=obj.id and
> prop.name='title' and prop.value like 'Art%'", 5, 0))
>
> #foreach ($item in $list)
> #set($bentrydoc = $xwiki.getDocument($item))
>
> #set($class = $bentrydoc.getObject("XWiki.ArticleClass").xWikiClass)
> $bentrydoc.name
> <table border="1" cellspacing="0" cellpadding="2">
> #foreach($prop in $class.properties)
> <tr>
> <td> *${prop.prettyName}* </td>
> <td>Value: $doc.display($prop.value)</td> <--- this line!
> </tr>
> #end
> </table>
>
> Regards,
>
> Richard
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]On Behalf Of
> Jean-Vincent Drean
> Sent: 09 October 2007 13:12
> To: XWiki Developers
> Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
> set of criteria
>
>
> Added here :
>
http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples#HGettingdoc
> umentswhereobjects27propertiesequalssomevalue
>
> JV.
>
> 2007/10/9, goldring, richard <[hidden email]>:
> > Thanks Jean-Vincent,
> >
> > What you've done helps ... but how does one list documents with a
certain

> > object attached whom's properties = a certain value?
> >
> > Regards,
> >
> > Richard
> >
> > -----Original Message-----
> > From: [hidden email] [mailto:[hidden email]]On Behalf Of
> > Jean-Vincent Drean
> > Sent: 09 October 2007 12:34
> > To: XWiki Developers
> > Subject: Re: [xwiki-devs] Ref: Displaying lists of wiki pages given a
> > set of criteria
> >
> >
> > I've started documenting hql queries through public and privileged APIs
> > here:
> > http://www.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples
> >
> > 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 <[hidden email]>:
> > > 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: [hidden email] [mailto:[hidden email]]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 <[hidden email]>:
> > > > 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 <[hidden email]>:
> > > > > 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
> > > > > [hidden email]
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > 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
> > > > > [hidden email]
> > > > > http://lists.xwiki.org/mailman/listinfo/devs
> > > > >
> > > >
> > > _______________________________________________
> > > devs mailing list
> > > [hidden email]
> > > 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
> > > [hidden email]
> > > http://lists.xwiki.org/mailman/listinfo/devs
> > >
> > _______________________________________________
> > devs mailing list
> > [hidden email]
> > 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
> > [hidden email]
> > http://lists.xwiki.org/mailman/listinfo/devs
> >
> _______________________________________________
> devs mailing list
> [hidden email]
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>


--
'Waste of a good apple' -Samwise Gamgee
_______________________________________________
devs mailing list
[hidden email]
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
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

Jean-Vincent Drean
In reply to this post by goldring, richard
2007/10/9, goldring, richard <[hidden email]>:
> #set ($list = $xwiki.search("select doc.fullName from XWikiDocument doc,
> BaseObject obj, StringProperty prop where doc.fullName=obj.name and
> obj.className='XWiki.ArticleClass' and prop.id.id=obj.id and
> prop.name='title' and prop.value like 'Art%'", 5, 0))

Remember that you'll get only the 5 first results with this call :
http://build.xpertnet.biz/latestdoc/api/com/xpn/xwiki/api/XWiki.html#search(java.lang.String,%20int,%20int)

from : http://build.xpertnet.biz/latestdoc/api/com/xpn/xwiki/api/package-summary.html

> #foreach ($item in $list)
> #set($bentrydoc = $xwiki.getDocument($item))
>
> #set($class = $bentrydoc.getObject("XWiki.ArticleClass").xWikiClass)
> $bentrydoc.name
> <table border="1" cellspacing="0" cellpadding="2">
> #foreach($prop in $class.properties)
> <tr>
> <td> *${prop.prettyName}* </td>
> <td>Value: $doc.display($prop.value)</td> <--- this line!
> </tr>
> #end
> </table>

While you know the type of the object you want to display you don't
have to use the xWikiClass (which is privileged API).
You can consult the list of the class properties at :
/xwiki/bin/edit/XWiki/ArticleClass?editor=class (class editor,
accessible from the top menu).

I'd refactor your snippet like this :

#foreach ($item in $list)
  #set($bdoc = $xwiki.getDocument($item))
  $bdoc.title
  <table border="1" cellspacing="0" cellpadding="2">
    <tr>
      <td> *Title* </td>
      <td>$bdoc.display("title")</td>
    </tr>
    <tr>
      <td> *Category* </td>
      <td>$bdoc.display("category")</td>
    </tr>
    <tr>
      <td> *Content* </td>
      <td>$bdoc.display("content")</td>
    </tr>
  </table>
#end

JV.
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Ref: Displaying lists of wiki pages given a set of criteria

Jean-Vincent Drean
In reply to this post by goldring, richard
2007/10/10, goldring, richard <[hidden email]>:
> Yes I've tried this, but XWiki doesn't execute this code it just displays:
> $doc.display($prop.name, "view", $obj) as if its just any other text on the
> page!

Velocity displays the method call when the method call fail, ie :
1) return null (if $prop.name doesn't exist in $doc for example)
2) if the object is null (here $doc)
3) if it doesn't find the method in the object (here display with 3
args of 3 defined types)

You can try this (even if it's not the method i'd advise, cf previous mail) :

#set($obj = $bentrydoc.getObject("XWiki.ArticleClass"))
$bentrydoc.display($prop.name, "view", $obj)

The difference: display method called on bentrydoc (Article document)
and not the current document, which do not contains props I guess.

JV.
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
12