cogSet the Parent Value from a drop down list when editing a page
TypeSnippet
Category
Developed by

Pascal Bastien

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents

Description

The quality of the English on this page needs to be improved to make the page legible. If someone understand what it does, please feel free to edit and improve. --VincentMassol

I modify the forms "Panels: DocumentInformation" (/xwiki/bin/inline/Panels/DocumentInformation) like this: I replace lines:

<input type="text" id="xwikidocparentinput2" name="parent" value="$!tdoc.parent"
size="30"/>

by a loop to display all pages of current space

With xwiki 1.1M2

Code

The forms "Panels: DocumentInformation" contain only:

#set($pages = $tdoc.includedPages)
#largepanelheader("XWiki document information")
<dl><dt><label
for="xwikidocparentinput2">$msg.get("parentfield"):</label></dt> <dd>
<select name="parent" class="panelselect">
<option value="$!tdoc.parent" selected="selected">$!tdoc.parent</option>
<option value="">-Vide \*-</option>
#foreach($subdoc in $xwiki.getSpaceDocsName("$doc.web"))
<option value="$subdoc">$subdoc</option>
#end
</select></dd>
#if($pages.size() != 0)
#if($pages.size() == 1)
<dt>$xwiki.parseMessage("editincludepagemsgone"):</dt>
#else
<dt>$xwiki.parseMessage("editincludepagemsgmore"):</dt>
#end
<dd>
<table summary="$msg.get("includeddocumentssummary")"
id="xwikiincludeddocuments">
<tbody>
#foreach ($page in $pages)
<tr><td><a href="$xwiki.getURL($page, "view")">$page</a></td>
<td class="xwikibuttonlink"><a href="$xwiki.getURL($page,
"edit")">$msg.get("edit")</a></td></tr>
#end
</tbody>
</table></dd>
#end
</dl>
#template("tagedit.vm")
#panelfooter()

Result

screenshot_dropdown_parent.jpg

     

Get Connected