Default location for new pages in customized main space?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Default location for new pages in customized main space?

Lilianne E. Blaze-2
Hello,
Is there a way to customize default location for new pages?

(Added later - I figured it out, I'm leaving the previous steps of how
and why)

I set up a new XWiki (9.0) from scratch, created "Public" space,
configured it so non-admins don't see anything else, switched it to
default both in web.xml "homePage" param and Admin -> Descriptor ->
Homepage "Public.WebHome", everything works as intended, but when I'm at
host/bin/view/Public/ and I click "Plus icon (Create)" it offers to
create a new page at top level "home /", while I want it to select "home
/ Public /" by default, which I assume would be a reasonable behavior.
Is it possible?

From what I checked it's handled in file skins/flamingo/menus_content.vm ?
"#macro(displayCreateButton)
  <div class="dropdown" id="tmCreate">
    <a href="$doc.getURL('create')" role="button"
title="$services.localization.render('core.menu.create')"><span
class="glyphicon glyphicon-plus"></span></a>
  </div>
#end"

Any suggestions on how to change it?

I tried replacing the lines:

<div class="dropdown" id="tmCreate">
<a href="$doc.getURL('create')" role="button"
title="$services.localization.render('core.menu.create')">
<span class="glyphicon glyphicon-plus"></span></a>

</div>


With:

#set( $parentEqualsDocFullName =
"parent=$escapetool.url($doc.getFullName())" )

<div class="dropdown" id="tmCreate">

<a href="$doc.getURL('create', $parentEqualsDocFullName)" role="button"
title="$services.localization.render('core.menu.create')">
<span class="glyphicon glyphicon-plus"></span></a>

</div>

Turns out it just ends up being ignored.

(Added later) Also, as I understand now it would be redundant.

After some googling I found createinline.vm, lines 239-243

#if ($parentReference.equals($homeReference.lastSpaceReference))
## We want to discourage ending up with all the pages children of the
homepage so we
## default to top level documents, unless the user explicitly says
otherwise.

#set ($parentReference = $parentReference.wikiReference)

#end

Actually that's exactly what I want. I'm trying to comment out the 4th line.

Restarted, it worked.

It all seems a bit counterintuitive, could you please consider making it
configurable, in "xwiki.properties" maybe?

Why exactly is it "discouraged"? Is it only a matter of "style" or are
there any potential complications I'm unaware of?

Greetings, Lilianne