You may wish to check out:
- JQGridPlugin, which gives an editable grid interface to your topics
- MultiTopicSavePlugin, which doesn't currently have the feature to save
parent.name
metadata, but does work for formfield values. The author of the plugin would probably welcome a patch, or feature request.
- Documentation for the /bin/save script, if you want to update parts of topics other than the
parent.name
metadata
Courtesy of the
foswiki-discuss ML:
- Collect up a list of pages whose parent is a particular page?
- Collect up a list of pages whose parent page is in a particular web (say "Trash")?
- Given a list of pages, change the parent of the page to a given page?
We are going to use some techniques that are also used in
Tasks.Item10874 which includes an example of a SEARCH that also renders a UI to help with bulk-updating
form.name
values.
The problem for
parent.name
is almost exactly the same.
%STARTSECTION{"fixup"}%#FixUp
%SEARCH{
"%URLPARAM{"query" default="NOT parent.name" encode="quote"}%"
type="query"
header="| *Topic* | *Parent* | *#* |"
format="| [[$web.$topic]] | '$parent' | \
<form action='%SCRIPTURL{"save"}%/$web/$topic' method='post'>\
<input type='hidden' name='redirectto' value='%SCRIPTURL{"view"}%/%BASEWEB%.%BASETOPIC%?section=fix;query=%URLPARAM{"query" default="NOT parent.name"}%;parent=%URLPARAM{"parent" default="%HOMETOPIC%"}%#FixUp'/>\
<input type='input' name='topicparent' class='foswikiInputField' value='%URLPARAM{"parent" default="%HOMETOPIC%"}%'/>\
<input type='submit' class='foswikiSubmit' value='Update' display='inline'/>\
</form> |"
pager="on"
pagesize="25"
}%
%ENDSECTION{"fixup"}%
Here's a UI that allows you to build a query expression and supply a value to set for bulk updating:
%STARTSECTION{"fix"}%<form action="%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%#FixUp" method="GET">
| Query | <input type="text" name="query" class="foswikiInputField" value="%URLPARAM{"query" default="NOT parent.name"}%"/> |
| New parent | <input type="text" name="parent" class="foswikiInputField" value="%URLPARAM{"parent" default="%HOMETOPIC%"}%"/> |
<input type="hidden" name="section" value="fix"/>
<input type="submit" class='foswikiSubmit' value="Query"/>
</form>
*Results:*
%INCLUDE{"%TOPIC%" section="fixup"}%
%ENDSECTION{"fix"}%
Example queries to try:
* Search for topics parented to a specific topic:
* parent.name='WrongParent'
* Search for topics parented to a topic in Trash web:
* parent.name~'%TRASHWEB%*'
* Search for topics with no topic parent, or an empty one:
* NOT parent.name
Test:
Results:
Number of topics: 25
--
PaulHarvey - 08 Jul 2011
Great stuff Paul! Power/admin users will be most grateful.
--
FranzJosefGigler - 08 Jul 2011
Glad you think so! In fact I just used query of
TopicClassification='SupplementalDoc' AND parent.name!='SupplementalDoc'
to find mis-parented supplemental docs
Also fixed a bug where custom query/parent values weren't being carried across redirects.
--
PaulHarvey - 08 Jul 2011
This is very good. Much better than adjusting strikeone etc. IMO, things like this could very well be in the admin tools because there is a good treshold for new admins to make use of this and it's definitely a feature wanted.
--
LarsEik - 08 Jul 2011