[xwiki-users] overwriting space-specific layouts with global layout
Hi guys, I once configured different layouts for my different spaces. Now I decided, that all spaces should look in a common way. Actually, changing the Global layout in the administration does not overwrite the space-specific layouts. How can I remove those specific layout configurations, so every space takes the global configuration? Thanx, Sebastian
Sebastian Kannengiesser wrote:
Hi guys,
I once configured different layouts for my different spaces. Now I decided, that all spaces should look in a common way. Actually, changing the Global layout in the administration does not overwrite the space-specific layouts. How can I remove those specific layout configurations, so every space takes the global configuration?
What do you understand by layout? The panels located on the left/right side? Try this: #foreach($spacePref in $xwiki.searchDocuments(", BaseObject prefs, StringProperty panels where doc.name = 'WebPreferences' and prefs.name = doc.fullName and prefs.className = 'XWiki.XWikiPreferences' and panels.id.id = prefs.id and (panels.id.name = 'leftPanels' or panels.id.name = 'rightPanels') and panels.value <> ''")) #set($spacePrefsDoc = $xwiki.getDocument($spacePrefs)) #set($spacePrefsObj = $spacePrefsDoc.getObject('XWiki.XWikiPreferences')) $spacePrefsObj.set('leftPanels', '') $spacePrefsObj.set('rightPanels', '') $spacePrefsDoc.save() #end -- Sergiu Dumitriu http://purl.org/net/sergiu/
Hi Sergiu, thanx for your reply. Your velocity code does not have any effect, at least, I didn't get the desired result :( With layout I mean the Panels. My globakl setting is to have a panel area only on the left side, whereas some spaces have two panel areas and a different selection of panels on them. Now, I'd like all spaces to have the exact panels I chose in the global layout administration and those to be placed only on the left hand side, also as set globally. Btw, to run your code I just created a page in Main space and entered the code. That should do it, right? I'd be grateful for any further suggestions. Thanx, Sebastian On Tue, Mar 10, 2009 at 1:02 PM, Sergiu Dumitriu <[email protected]> wrote:
Sebastian Kannengiesser wrote:
Hi guys,
I once configured different layouts for my different spaces. Now I decided, that all spaces should look in a common way. Actually, changing the Global layout in the administration does not overwrite the space-specific layouts. How can I remove those specific layout configurations, so every space takes the global configuration?
What do you understand by layout? The panels located on the left/right side?
Try this:
#foreach($spacePref in $xwiki.searchDocuments(", BaseObject prefs, StringProperty panels where doc.name = 'WebPreferences' and prefs.name = doc.fullName and prefs.className = 'XWiki.XWikiPreferences' and panels.id.id = prefs.id and (panels.id.name = 'leftPanels' or panels.id.name = 'rightPanels') and panels.value <> ''")) #set($spacePrefsDoc = $xwiki.getDocument($spacePrefs)) #set($spacePrefsObj = $spacePrefsDoc.getObject('XWiki.XWikiPreferences')) $spacePrefsObj.set('leftPanels', '') $spacePrefsObj.set('rightPanels', '') $spacePrefsDoc.save() #end
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
I just found that your #foreach loop isn't running at all. Placed some text inside. On Tue, Mar 10, 2009 at 1:36 PM, Sebastian Kannengiesser <[email protected]> wrote:
Hi Sergiu,
thanx for your reply. Your velocity code does not have any effect, at least, I didn't get the desired result :( With layout I mean the Panels. My globakl setting is to have a panel area only on the left side, whereas some spaces have two panel areas and a different selection of panels on them. Now, I'd like all spaces to have the exact panels I chose in the global layout administration and those to be placed only on the left hand side, also as set globally.
Btw, to run your code I just created a page in Main space and entered the code. That should do it, right?
I'd be grateful for any further suggestions.
Thanx, Sebastian
On Tue, Mar 10, 2009 at 1:02 PM, Sergiu Dumitriu <[email protected]> wrote:
Sebastian Kannengiesser wrote:
Hi guys,
I once configured different layouts for my different spaces. Now I decided, that all spaces should look in a common way. Actually, changing the Global layout in the administration does not overwrite the space-specific layouts. How can I remove those specific layout configurations, so every space takes the global configuration?
What do you understand by layout? The panels located on the left/right side?
Try this:
#foreach($spacePref in $xwiki.searchDocuments(", BaseObject prefs, StringProperty panels where doc.name = 'WebPreferences' and prefs.name = doc.fullName and prefs.className = 'XWiki.XWikiPreferences' and panels.id.id = prefs.id and (panels.id.name = 'leftPanels' or panels.id.name = 'rightPanels') and panels.value <> ''")) #set($spacePrefsDoc = $xwiki.getDocument($spacePrefs)) #set($spacePrefsObj = $spacePrefsDoc.getObject('XWiki.XWikiPreferences')) $spacePrefsObj.set('leftPanels', '') $spacePrefsObj.set('rightPanels', '') $spacePrefsDoc.save() #end
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Sebastian Kannengiesser wrote:
I just found that your #foreach loop isn't running at all. Placed some text inside.
Sorry, I was lazy and didn't try to run it first. The problem is that XWikiPreferences has custom mapping, so this is the right code: #foreach($spacePrefs in $xwiki.searchDocuments(", BaseObject obj, XWikiPreferences prefs where doc.name = 'WebPreferences' and obj.name = doc.fullName and prefs.id = obj.id and prefs.leftPanels <> ''")) #set($spacePrefsDoc = $xwiki.getDocument($spacePrefs)) #set($spacePrefsObj = $spacePrefsDoc.getObject('XWiki.XWikiPreferences')) $spacePrefsObj.set('leftPanels', '') $spacePrefsObj.set('rightPanels', '') $spacePrefsObj.set('showLeftPanels', '') $spacePrefsObj.set('showRightPanels', '') $spacePrefsDoc.save() #end
On Tue, Mar 10, 2009 at 1:36 PM, Sebastian Kannengiesser <[email protected]> wrote:
Hi Sergiu,
thanx for your reply. Your velocity code does not have any effect, at least, I didn't get the desired result :( With layout I mean the Panels. My globakl setting is to have a panel area only on the left side, whereas some spaces have two panel areas and a different selection of panels on them. Now, I'd like all spaces to have the exact panels I chose in the global layout administration and those to be placed only on the left hand side, also as set globally.
Btw, to run your code I just created a page in Main space and entered the code. That should do it, right?
Yes, put the code in a new page, view it once, then you can delete the page.
I'd be grateful for any further suggestions.
Thanx, Sebastian
On Tue, Mar 10, 2009 at 1:02 PM, Sergiu Dumitriu <[email protected]> wrote:
Sebastian Kannengiesser wrote:
Hi guys,
I once configured different layouts for my different spaces. Now I decided, that all spaces should look in a common way. Actually, changing the Global layout in the administration does not overwrite the space-specific layouts. How can I remove those specific layout configurations, so every space takes the global configuration? What do you understand by layout? The panels located on the left/right side?
-- Sergiu Dumitriu http://purl.org/net/sergiu/
Many thanx Sergiu, I love the mighty abilities you have in XWiki with velocity scripting, though it's hard for me by now to understand the full set of possibilities. But thanx to your help, I again learned something new. Cheers, Sebastian On Tue, Mar 10, 2009 at 2:19 PM, Sergiu Dumitriu <[email protected]> wrote:
Sebastian Kannengiesser wrote:
I just found that your #foreach loop isn't running at all. Placed some text inside.
Sorry, I was lazy and didn't try to run it first. The problem is that XWikiPreferences has custom mapping, so this is the right code:
#foreach($spacePrefs in $xwiki.searchDocuments(", BaseObject obj, XWikiPreferences prefs where doc.name = 'WebPreferences' and obj.name = doc.fullName and prefs.id = obj.id and prefs.leftPanels <> ''")) #set($spacePrefsDoc = $xwiki.getDocument($spacePrefs)) #set($spacePrefsObj = $spacePrefsDoc.getObject('XWiki.XWikiPreferences')) $spacePrefsObj.set('leftPanels', '') $spacePrefsObj.set('rightPanels', '') $spacePrefsObj.set('showLeftPanels', '') $spacePrefsObj.set('showRightPanels', '') $spacePrefsDoc.save() #end
On Tue, Mar 10, 2009 at 1:36 PM, Sebastian Kannengiesser <[email protected]> wrote:
Hi Sergiu,
thanx for your reply. Your velocity code does not have any effect, at least, I didn't get the desired result :( With layout I mean the Panels. My globakl setting is to have a panel area only on the left side, whereas some spaces have two panel areas and a different selection of panels on them. Now, I'd like all spaces to have the exact panels I chose in the global layout administration and those to be placed only on the left hand side, also as set globally.
Btw, to run your code I just created a page in Main space and entered the code. That should do it, right?
Yes, put the code in a new page, view it once, then you can delete the page.
I'd be grateful for any further suggestions.
Thanx, Sebastian
On Tue, Mar 10, 2009 at 1:02 PM, Sergiu Dumitriu <[email protected]> wrote:
Sebastian Kannengiesser wrote:
Hi guys,
I once configured different layouts for my different spaces. Now I decided, that all spaces should look in a common way. Actually, changing the Global layout in the administration does not overwrite the space-specific layouts. How can I remove those specific layout configurations, so every space takes the global configuration? What do you understand by layout? The panels located on the left/right side?
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (2)
-
Sebastian Kannengiesser -
Sergiu Dumitriu