Hi Rolf,

for use case 2:

 actually I did not realize that the main wiki:Main.Activity page
still uses my locally adapted "activity" macro ... that is why it worked for 
me, and not for you.

So, it seems we need to get our hands dirty and modify the "activity" Macro:

a) in the subwiki, go to the .../Main/Activity page
b) go to "Edit" -> "Objects"
c) click "Objects of type XWiki.WikiMacroClass
d) this opens several text fields;
   the big field for "Macro code" contains, unsurprisingly, the code for the 
macro
   which makes sure we only see messages from the local wiki.
  Here we need to make some changes:

d1) just at the start:

  {{velocity output=false}}
  ##

 add a line remembering the current wiki, so it looks instead like:

  {{velocity output=false}}
  #set($currentWiki = $xcontext.getDatabase())
  ##


d2) look for the code

 ## Always assume access to messages. For the rest of the documents, check 
access.
 #if 
($pageName.matches(".*:XWiki[.][0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}")
 || ($xwiki.hasAccessLevel('view', $xcontext.user, 
"${xcontext.database}:${pageName}") && 
!$iterationDocuments.contains($pageName)))

  insert five lines of code in between so it looks like:

 ## Always assume access to messages. For the rest of the documents, check 
access.
 #if 
($pageName.matches(".*:XWiki[.][0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}"))
   #set($myWiki = "xwiki")
 #else
   #set($myWiki = $currentWiki)
 #end
 #if 
($pageName.matches(".*:XWiki[.][0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}")
 || ($xwiki.hasAccessLevel('view', $xcontext.user, 
"${xcontext.database}:${pageName}") && 
!$iterationDocuments.contains($pageName)))

what it does: prepares to set the "right" wiki/database: if it is a message, 
look it up in the main wiki (which knows all messages), for all other events, 
stay at the local wiki

d3) look a few lines below for:

  #set ($discard = $subqueryParameters.addAll($filterParameters))
  #set ($events= $xwiki.activitystream.searchEvents("$!whereClause", false, 0, 
0, $subqueryParameters))

   in between them insert a line actually setting the wiki to look up the 
event; it should looks like

 #set ($discard = $subqueryParameters.addAll($filterParameters))
 #set ($discard = $xcontext.setDatabase($myWiki))
 #set ($events= $xwiki.activitystream.searchEvents("$!whereClause", false, 0, 
0, $subqueryParameters))

this actually sets the wiki to the one where the event is looked up.


d4) at the very end replace:

#end
{{/velocity}}

with:

#end
#set($discard =  $xcontext.setDatabase($currentWiki))
{{/velocity}}

this sets the "current wiki" back to the original wiki, just in case (I think 
XWiki does it for you, too, but I prefer to be polite and clean up after myself 
;))

press "Save and View"

If you see horrible, horrible error messages, something went wrong; to back to 
the object editor and try to find the missing " or ),
or use the page history, to get back to the last version before the edit.

If you do not see any error message ... you should see that nothing has 
changed, yet.
That is because by default the activity stream only looks up events for the 
subwiki ... we need to change this, too, but that goes without wild coding

Go to the "Dashboard", edit the page, and edit the Gadget "Activity stream"
Find the input field "wikis", and type in "xwiki,mysubwiki"  (replace mysubwiki 
with the name of the current wiki)

Close the dialog to edit the gadget, save the dashboard, and it should work.


hope it works this time. Sorry, if it is a bit complicated; that is why I did 
not post in my first reply




----- Ursprüngliche Nachricht -----
From: Rolf Lang
At:  Dienstag, 27.10.2015, 15:03
To: Xwiki Users
Subject: Re: [xwiki-users] xwiki as our Intranet


> Hi Clemens,
> 
> thanks for your advise.
> 
> 1. point
> Works great as you described (ok)
> 
> 
> 2. point "global xwiki send messages should be visible also at local xwiki"
> We follow your recommendations.
> 
> if we use "reference" : xwiki:Main.Activity 
> -     we see subWiki Activities (ok)
> -     but we miss the main Activities listed here
> 
> If we use a wrong "reference" : xwiki:MainXX.Activity
> -     we see a clear error msg on GUI (ok)
> 
> 
> We try to change "administration.users"
> The option 'what kind of users can access the wiki' to
> -     only global users
> 
> But it makes no difference.
> 
> 
> Kind regards
> Rolf LANG
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: users [mailto:users-boun...@xwiki.org] Im Auftrag von Clemens
> Klein-Robbenhaar
> Gesendet: Montag, 26. Oktober 2015 12:37
> An: users@xwiki.org
> Betreff: Re: [xwiki-users] xwiki as our Intranet
> 
> 
>> Hi
>> We like to use the xwiki as our Intranet solution.
>>
>>
>> Currently it's setup as one global xwiki where people find downloads and
> the
>> dashboard.
>> Also each department use a subWiki, which uses local dashboard and infos.
>>
>> Maybe we need some help on howto configure/setup these requirements:
>>
>> 1. subWiki send messages should be visible local only. Currently they are
>> seen also on global xwiki as copy.
> 
> This is the easy part :)
> 
> Go to the "Dashboard" in the main wiki, edit that page,
> open the gadgets showing the activity stream, look for the "Wikis"
> parameter, and fill in the value "xwiki"
> (which is the id of the main wiki)
> 
> After saving  the activity stream on the dashboard stream should only show
> events from the main wiki.
> 
>> 2. global xwiki send messages should be visible also at local xwiki
>> dashboard. If possible as Reference, not as copy.
>>
> 
> this turned out to be trickier, because the activity stream in the subwiki
> by default
> only looks for events in the subwiki.
> 
> One option is to go to the dashboard of the subwiki, and replace the
> activity by an include the activity stream for the main wiki (which then
> will display all messages, but only page edits from the subwiki):
> 
> To do this:
>  - edit the dashboard of the subwiki
>  - remove the existing activity stream (no worries, if things go wrong you
> can just restore it from the page history)
>  - add a new "include" gadget and fill in the values:
>  -- "Gadget Title" (whatever you want)
>  -- "context" : New
>  -- "reference" : xwiki:Main.Activity
>    and leave the other fields empty / at default
> 
> 
> This will work only if all your users have access to the main wiki, however.
> (Otherwise they just see an error message)
> 
> If this does not work, the alternative is to edit the "Activity" macro in
> the subwiki ... which is a bit more work and might cause problem when
> upgrading to an newer version.
> I could post hints how to do this, but it is a bit lengthy and technical,
> and I would prefer to see if the first option works.
> 
> 
> hope this helps,
> clemens
> 
> 
>>
>> Final question:
>> If the mailing list could give us some advise how to setup xwiki, GREAT. 
>> Otherwise we also may accept an on-site workshop, depending on the costs.
>>
>>
>> Kind regards
>> ___
>> Rolf LANG | Landesarchiv Baden-Württemberg | Zentrale Dienste | Ref. 13
>> Eugenstr. 7 | 70182 Stuttgart | Tel 0711/212-4275 | E-Mail
>> rolf.l...@la-bw.de
>>
>>
>> _______________________________________________
>> users mailing list
>> users@xwiki.org
>> http://lists.xwiki.org/mailman/listinfo/users
>>
> 
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
> 
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
> 

mit freundlichen Grüßen
Clemens Klein-Robbenhaar

-- 
Clemens Klein-Robbenhaar
Software Development
EsPresto AG
Breite Str. 30-31
10178 Berlin/Germany
Tel: +49.(0)30.90 226.763
Fax: +49.(0)30.90 226.760
robbenh...@espresto.com
www.espresto.de

HRB 77554 B - Berlin-Charlottenburg
Vorstand: Maya Biersack, Peter Biersack
Vorsitzender des Aufsichtsrats: Dipl.-Wirtsch.-Ing. Winfried Weber
Zertifiziert nach ISO 9001:2008
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to