Howto set Parent Value with drop down list (resolved)
Hi, I was looking for a way to set Parent Value with drop down list when user edit a page... I found this solution: 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 **************** <select name="parent" class="panelselect"> <option value="$!tdoc.parent" selected="selected">$!tdoc.parent</option> <option value="">-Empty \*-</option> #foreach($subdoc in $xwiki.getSpaceDocsName("$doc.web")) <option value="$subdoc">$subdoc</option> #end </select> **************** The forms contain: **************** #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()
You could post this in the Code zone: http://www.xwiki.org/xwiki/bin/view/Code/Snippets On 7/9/07, pbasnews-tmp@yahoo.fr <pbasnews-tmp@yahoo.fr> wrote:
Hi, I was looking for a way to set Parent Value with drop down list when user edit a page... I found this solution: 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 **************** <select name="parent" class="panelselect"> <option value="$!tdoc.parent" selected="selected">$!tdoc.parent</option> <option value="">-Empty \*-</option> #foreach($subdoc in $xwiki.getSpaceDocsName("$doc.web")) <option value="$subdoc">$subdoc</option> #end </select> **************** The forms contain: **************** #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()
Sergiu -- http://purl.org/net/sergiu
Hop: http://www.xwiki.org/xwiki/bin/view/Code/SetParentValueWithList All comments are welcome.
Hi, We could integrate this in XWiki Core, as that would be an improvement over what we have (although your code snippet seem to only display the parent space and not pages, is that correct?) That said, we also have another issue related to this, which I think would be even better: http://jira.xwiki.org/jira/browse/XWIKI-1272 pbas (don't know your name), what do you think about XWIKI-1272? As a user would you like that? Thanks -Vincent On Jul 10, 2007, at 8:45 AM, pbasnews-tmp@yahoo.fr wrote:
Hop: http://www.xwiki.org/xwiki/bin/view/Code/SetParentValueWithList
All comments are welcome.
On Tue, July 10, 2007 3:58 am, Vincent Massol wrote:
Hi,
We could integrate this in XWiki Core, as that would be an improvement over what we have (although your code snippet seem to only display the parent space and not pages, is that correct?)
That said, we also have another issue related to this, which I think would be even better: http://jira.xwiki.org/jira/browse/XWIKI-1272
As was originally done (I think) it's important to keep list generation as simple (and fast!) as possible.. e.g. load only the documents for the space and perhaps Main.WebHome (and the parent of Space.WebHome) as possible parents... Erin -- Waste of a good apple. --Samwise Gamgee
On Jul 12, 2007, at 6:14 AM, Erin Schnabel wrote:
On Tue, July 10, 2007 3:58 am, Vincent Massol wrote:
Hi,
We could integrate this in XWiki Core, as that would be an improvement over what we have (although your code snippet seem to only display the parent space and not pages, is that correct?)
That said, we also have another issue related to this, which I think would be even better: http://jira.xwiki.org/jira/browse/XWIKI-1272
As was originally done (I think) it's important to keep list generation as simple (and fast!) as possible.. e.g. load only the documents for the space and perhaps Main.WebHome (and the parent of Space.WebHome) as possible parents...
I agree but how do I set a parent that is a page in another space? Thanks -Vincent
On Jul 12, 2007, at 6:14 AM, Erin Schnabel wrote:
On Tue, July 10, 2007 3:58 am, Vincent Massol wrote:
Hi,
As was originally done (I think) it's important to keep list generation as simple (and fast!) as possible.. e.g. load only the documents for the space and perhaps Main.WebHome (and the parent of Space.WebHome) as possible parents...
I agree but how do I set a parent that is a page in another space?
Thanks -Vincent
Maybe a checkbox or other dropdown for space? by default set to current.. if you change that it regens the list of pages? -- Waste of a good apple. --Samwise Gamgee
--- Erin Schnabel <erin.xwiki@ebullientworks.com> a écrit :
On Tue, July 10, 2007 3:58 am, Vincent Massol wrote:
Hi,
We could integrate this in XWiki Core, as that would be an improvement over what we have (although your code snippet seem to only display the parent space and not pages, is that correct?) No. To optimize I display all pages of current Space. With this way, a Page can "jump" many (2 or more) levels.
That said, we also have another issue related to
this, which I think
would be even better: http://jira.xwiki.org/jira/browse/XWIKI-1272 This feature look great ... but u must not forget ACL.
Thanks np -Vincent Pascal
As was originally done (I think) it's important to keep list generation as simple (and fast!) as possible.. e.g. load only the documents for the space and perhaps Main.WebHome (and the parent of Space.WebHome) as possible parents... You have rename a Page for that (Main.Webhome). And My list display <current Space>.Webhome.
PS: sorry if I sent too time my mail but I can't see my post in sympa Archive... _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
A new snipet waiting your comments: http://www.xwiki.org/xwiki/bin/view/Code/DisplayOnlyParentPagesInSpaceMenuSn... :-) _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
--- Erin Schnabel <erin.xwiki@ebullientworks.com> a écrit :
On Tue, July 10, 2007 3:58 am, Vincent Massol wrote:
Hi,
We could integrate this in XWiki Core, as that would be an improvement over what we have (although your code snippet seem to only display the parent space and not pages, is that correct?) No. To optimize I display all pages of current Space. With this way, a Page can "jump" many (2 or more) levels.
As was originally done (I think) it's important to keep list generation as simple (and fast!) as possible.. e.g. load only the documents for the space and perhaps Main.WebHome (and the parent of Space.WebHome) as possible parents...
You have rename a Page for that (Main.Webhome). And My list display <current Space>.Webhome.
PS: sorry if I sent too time my mail but I can't see my post in sympa Archive...
Well, we aren't talking about renaming the page, we're talking about supplying a list to choose parents from. I'm maintaining that presenting a list containing ALL pages in the wiki is not the best plan. We have thousands of documents in our wiki-- generating the AllDocs index takes a few minutes. It's too expensive to list every possible document for choosing a parent. -- Waste of a good apple. --Samwise Gamgee
--- Erin Schnabel <erin.xwiki@ebullientworks.com> a écrit :
--- Erin Schnabel <erin.xwiki@ebullientworks.com>
We could integrate this in XWiki Core, as that would be an improvement over what we have (although your code snippet seem to only display the parent space and not pages, is that correct?) No. To optimize I display all pages of current Space. With this way, a Page can "jump" many (2 or more) levels.
You have rename a Page for that (Main.Webhome). And My list display <current Space>.Webhome.
Well, we aren't talking about renaming the page, we're talking about supplying a list to choose parents from. I'm maintaining that presenting a list containing ALL pages in the wiki is not the best plan. We have thousands of documents in our wiki-- generating the AllDocs index takes a few minutes. It's too expensive to list every possible document for choosing a parent. Hum sorry but have you understand what my list snippet doing? :-) Have you test it? We talking about the SAME thing: my list snipet (http://www.xwiki.org/xwiki/bin/view/Code/SetParentValueWithList+Snippet) display all Pages of CURRENT Space! What I try to said (with my horrible english) is: The list must display ALL the Pages of current Space that's all. And if a user want to select a Parent in other Space, he can rename the Page in the new Space and select the list after. Pascal
_____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
--- Erin Schnabel <erin.xwiki@ebullientworks.com> a écrit :
...
Well, we aren't talking about renaming the page, we're talking about supplying a list to choose parents from. I'm maintaining that presenting a list containing ALL pages in the wiki is not the best plan. We have thousands of documents in our wiki-- generating the AllDocs index takes a few minutes. It's too expensive to list every possible document for choosing a parent.
Hum sorry but have you understand what my list snippet doing? :-) Have you test it? We talking about the SAME thing: my list snipet (http://www.xwiki.org/xwiki/bin/view/Code/SetParentValueWithList+Snippet) display all Pages of CURRENT Space! What I try to said (with my horrible english) is: The list must display ALL the Pages of current Space that's all. And if a user want to select a Parent in other Space, he can rename the Page in the new Space and select the list after. Pascal
I didn't read closely enough, it would appear. *blush* ;) -- Waste of a good apple. --Samwise Gamgee
participants (4)
-
Erin Schnabel -
pbasnews-tmp@yahoo.fr -
Sergiu Dumitriu -
Vincent Massol