Re: [xwiki-users] Admin Tools database to filesystem porter error

2016-01-18 Thread Mark Sack
Solved
Thank you



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Admin-Tools-database-to-filesystem-porter-error-tp7597567p7597590.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] Data-Types in UIExtension parameters

2016-01-18 Thread Gerritjan Koekkoek
Hi


I wonder if it is possible to use velocity data-types (Number, Date/Time, Array 
or List, Object) in the parameters field of a UIExtension.


I get the impression it is always considered as string and we have to do a 
conversion?


Following example (for a List of items in a Array)

cdls.try.abc has the following parameters:


label=abc

target=Sandbox.try2

icon=gerritjan.png

test=["Item1", 'item2', "item3"]


{{velocity}}

$services.uix.getExtensions("cdls.try.abc")


#foreach ($extension in $services.uix.getExtensions("cdls.try.abc"))

  $services.rendering.render($extension.execute(), 'xhtml/1.0')

  #set($paramlist=$extension.getParameters().get('test'))

#end


paramlist is String?: $paramlist.class


##Would like it to be a list of items, but now I have to use velocity string 
functions to create the list...

#set($paramlistLengthMinusOne = $paramlist.length() - 1)

#set($items = $paramlist.substring(1, $paramlistLengthMinusOne).split(","))


#foreach($item in $items)

"$item.replace('"',"")"

#end

{{/velocity}}


Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website
Facebook
email



___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Page tree stopped working on Main wiki

2016-01-18 Thread Christoph Haas
Any further ideas?

Am 13.01.2016 um 11:27 schrieb Marius Dumitru Florea:
> Can you try the same with XWiki.DocumentTree page? (it includes
> XWiki.DocumentTreeMacros and I thought PR is checked on the included
> content).

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Data-Types in UIExtension parameters

2016-01-18 Thread vinc...@massol.net

On 18 Jan 2016 at 11:15:44, Gerritjan Koekkoek 
(gerrit...@cdlsworld.org(mailto:gerrit...@cdlsworld.org)) wrote:

>  
> Could I do this in the params:
>  
>  
> label=abc
>  
>  
> target=Sandbox.try2
>  
>  
> icon=gerritjan.png
>  
>  
> test=$stringtool.split("item1, item2, item3", “ ,”)
>  
> I tried to test it, but did not work?

It won’t work because the parameter values are not typed, they are strings.

So if you have:

#foreach ($uix in $services.uix.getExtensions(…))
  #set ($params = $uix.parameters)
...
#end

then $params is always a String.

Thanks
-Vincent

PS: Please always reply to the list ;)

 
> The velocity part was:
>  
>  
> #set($items=$extension.getParameters().get('test'))
>  
>  
>  
>  
>  
>  
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website(http://www.cdlsworld.org)
> Facebook(https://www.facebook.com/gerritjan.koekkoek)
> email(gerrit...@cdlsworld.org)
>  
>  
>  
>  
>  
> From: Vincent Massol on behalf of vinc...@massol.net  
> Sent: 18 January 2016 10:46
> To: XWiki Users
> Cc: Gerritjan Koekkoek
> Subject: Re: [xwiki-users] Data-Types in UIExtension parameters  
>  
>  
> Hi Gerritjan,
>  
> On 18 Jan 2016 at 09:34:22, Gerritjan Koekkoek 
> (gerrit...@cdlsworld.org(mailto:gerrit...@cdlsworld.org)) wrote:  
> > Hi
> >
> >
> > I wonder if it is possible to use velocity data-types (Number, Date/Time, 
> > Array or List, Object) in the parameters field of a UIExtension.
> >
> >
> > I get the impression it is always considered as string and we have to do a 
> > conversion?  
>  
> I’ve updated the UIX Module documentation at  
> http://extensions.xwiki.org/xwiki/bin/view/Extension/UIExtension+Module#HMoreDetails
>  
> So yes, the parameters field can contain velocity.  
>  
> > Following example (for a List of items in a Array)
> >
> > cdls.try.abc has the following parameters:
> >
> >
> > label=abc
> >
> > target=Sandbox.try2
> >
> > icon=gerritjan.png
> >
> > test=["Item1", 'item2', "item3"]
> >
> >
> > {{velocity}}
> >
> > $services.uix.getExtensions("cdls.try.abc")
> >
> >
> > #foreach ($extension in $services.uix.getExtensions("cdls.try.abc"))
> >
> > $services.rendering.render($extension.execute(), 'xhtml/1.0')
> >
> > #set($paramlist=$extension.getParameters().get('test'))
> >
> > #end
> >
> >
> > paramlist is String?: $paramlist.class
> >
> >
> > ##Would like it to be a list of items, but now I have to use velocity 
> > string functions to create the list...
> >
> > #set($paramlistLengthMinusOne = $paramlist.length() - 1)
> >
> > #set($items = $paramlist.substring(1, $paramlistLengthMinusOne).split(","))
> >
> >
> > #foreach($item in $items)  
>  
> [snip]  
>  
> That’s correct, UIX parameters are not typed (they’re strings).  
>  
> However you can simplify a lot your velocity code.  
>  
> In the UIX:  
> test=item1, item2, item3
>  
> In the calling code:  
> #set ($paramlist = $extension.getParameters().get('test'))
> #set ($items = $stringtool.split($paramList, “ ,”))
> …
>  
> Thanks  
> -Vincent
>  
> > Gerritjan Koekkoek
> > Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
>  

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Data-Types in UIExtension parameters

2016-01-18 Thread vinc...@massol.net
Hi Gerritjan,

On 18 Jan 2016 at 09:34:22, Gerritjan Koekkoek 
(gerrit...@cdlsworld.org(mailto:gerrit...@cdlsworld.org)) wrote:

> Hi
>  
>  
> I wonder if it is possible to use velocity data-types (Number, Date/Time, 
> Array or List, Object) in the parameters field of a UIExtension.
>  
>  
> I get the impression it is always considered as string and we have to do a 
> conversion?

I’ve updated the UIX Module documentation at
http://extensions.xwiki.org/xwiki/bin/view/Extension/UIExtension+Module#HMoreDetails

So yes, the parameters field can contain velocity.

> Following example (for a List of items in a Array)
>  
> cdls.try.abc has the following parameters:
>  
>  
> label=abc
>  
> target=Sandbox.try2
>  
> icon=gerritjan.png
>  
> test=["Item1", 'item2', "item3"]
>  
>  
> {{velocity}}
>  
> $services.uix.getExtensions("cdls.try.abc")
>  
>  
> #foreach ($extension in $services.uix.getExtensions("cdls.try.abc"))
>  
> $services.rendering.render($extension.execute(), 'xhtml/1.0')
>  
> #set($paramlist=$extension.getParameters().get('test'))
>  
> #end
>  
>  
> paramlist is String?: $paramlist.class
>  
>  
> ##Would like it to be a list of items, but now I have to use velocity string 
> functions to create the list...
>  
> #set($paramlistLengthMinusOne = $paramlist.length() - 1)
>  
> #set($items = $paramlist.substring(1, $paramlistLengthMinusOne).split(","))
>  
>  
> #foreach($item in $items)

[snip]

That’s correct, UIX parameters are not typed (they’re strings).

However you can simplify a lot your velocity code.

In the UIX:
test=item1, item2, item3

In the calling code:
#set ($paramlist = $extension.getParameters().get('test'))
#set ($items = $stringtool.split($paramList, “ ,”))
…

Thanks
-Vincent

> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Mocca calendar - display 'short description' instead of title in month/week/day view

2016-01-18 Thread Clemens Klein-Robbenhaar
Hi Mark,

> In our use of the calendar extension, I expect to have situations where the
> title is repeated (sometimes for what are really recurring events and
> sometimes not). For this reason, we'll leave the randomly generated string
> in the title field.

To start with, there is probably a bug here. The document where the event is 
stored should
have a name (which indeed has to be unique per calendar, but should only show 
up in the URL
if viewing the "detailed view" of that event) and a title - which is also 
displayed in the overview.

There should be a random generated component of the name, but this should not 
show up in the document title;
this field should initially be empty when creating a new event.

This looks very much like the following bug: 
http://jira.xwiki.org/browse/MOCCACAL-68

I cannot reproduce this with the current version (XWiki 7.4, MoccaCal 2.5). 
Which version of the Mocca Calendar are you using?
(This should be shown in the Wiki Admin, section "Installed Extensions")


> I've added a 'short description' field to the event
> class to use in place of the title. I would like to display the new field in
> the calendar month/week/day view instead of the title. Does anyone have
> suggestions on how to do this?
> 
> I'm using XWiki 7.4.
> 

Fetching the data which is displayed in the actual calendar happens in the page 
MoccaCalendar.JSONService
(You can find this page at /xwiki/bin/view/MoccaCalendar/JSONService )

If you edit it in the Wiki-editor you will see it contains ... quite some code 
handling the creation of unique document names,
and the query to fetch all events that should be shown to the current calendar 
display.
It is the second part that you will want to adapt.

 Scroll down and search for something like:

 #set($event = {"id" : $itemdoc.getDocumentReference().toString(), "title" : 
$itemdoc.getPlainTitle(),  ...

here the "title" is filled in as the document title.
If you want to get a field from the event, then this data is available as:  
$itemdoc.getValue('short_description')
(or whatever the name of the field is), so you can replace the 
$itemdoc.getPlainTitle() with that String.


This covers the "normal" calendar view. The "Agenda"-style view with the 
upcoming events is handled differently unfortunately;
here the JSON-Service this returns fully rendered HTML to be inserted into the 
page directly, and you need to chnage this part, too.

You can search for a  " ... + $escapetool.html($itemdoc.getPlainTitle()) + ... 
"  - that is the place where you want to add / insert your custom field,


hope this helps,
Clemens
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] XClass, BaseObject and class Space

2016-01-18 Thread Giordano Ninonà
Hi users,

I am writing because I have an object in my Java code to be represented in
XWiki. My idea is to create an XClass and a related style sheet, then I
would create a Base Object for each object to be represented with a wiki
page.
I need to update the wiki every time the data structure that I have in Java
is modified but I can't understand how to do what I've written above.

Thank you,
Giordano.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Admin Tools database to filesystem porter error

2016-01-18 Thread Caleb James DeLisle

Hi Mark,

My estimation of the problem is that a newer version of Groovy forbids the use
of a function called `main()`. I've updated the script to use a different name
for the main entry point function and you can access the new version here.

http://extensions.xwiki.org/xwiki/bin/download/Extension/Filesystem+Attachment+Porter/filesystemAttachmentPorterScript-2.3.xwiki20

Thanks,
Caleb

On 15/01/16 16:04, Mark Sack wrote:

When I try to execute the database to filesystem porter tool in xwiki 7.4, I
see the following error:

   Failed to execute the [groovy] macro. Click on this message
for details.

Can anyone suggest how to resolve or work around this problem?
My environment is Debian jessie, Postgresql 9.4, WAR file running on tomcat8
and openjdk-7

The details are below.

org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Script
Macro for content [import com.xpn.xwiki.doc.XWikiAttachment;
import com.xpn.xwiki.doc.XWikiDocument;
import com.xpn.xwiki.doc.DeletedAttachment;
import org.xwiki.store.legacy.doc.internal.ListAttachmentArchive;
import com.xpn.xwiki.store.XWikiAttachmentStoreInterface;
import org.xwiki.store.legacy.store.internal.FilesystemAttachmentStore;
import com.xpn.xwiki.store.AttachmentVersioningStore;
import org.xwiki.store.legacy.store.internal.XWikiHibernateTransaction;
import com.xpn.xwiki.store.AttachmentRecycleBinStore;
import com.xpn.xwiki.web.Utils;
import com.xpn.xwiki.XWikiContext;
import com.xpn.xwiki.XWiki;
import com.xpn.xwiki.XWikiException;
import org.xwiki.store.filesystem.internal.FilesystemStoreTools;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.hibernate.ObjectNotFoundException;

private void printIntro(final XWiki wiki)
{
 println("= Filesystem attachment storage porting script =");

 println("== Step 1: Switch to Filesystem attachments. ==");

 boolean ret = isFilesystemStore(wiki.getAttachmentStore()) \
 && isFilesystemStore(wiki.getAttachmentVersioningStore()) \
 && isFilesystemStore(wiki.getAttachmentRecycleBinStore());

 println(getStoreLine(isFilesystemStore(wiki.getAttachmentStore()),
  wiki.getAttachmentStore()));

println(getStoreLine(isFilesystemStore(wiki.getAttachmentVersioningStore()),
  wiki.getAttachmentVersioningStore()));

println(getStoreLine(isFilesystemStore(wiki.getAttachmentRecycleBinStore()),
  wiki.getAttachmentRecycleBinStore()));

 if (!ret) {
 println("Please edit your xwiki.cfg file by modifying "
 + "the attachment store lines to read as follows:");
 println("xwiki.store.attachment.hint = file");
 println("xwiki.store.attachment.versioning.hint = file");
 println("xwiki.store.attachment.recyclebin.hint = file");
 println("Also make sure they are not commented out.");
 }

 println("== Step 2: Add this directory to your backup routine. ==");
 println("This is your storage directory, "
 + "when filesystem attachments are enabled you have to back this up
"
 + "as part of your data backup routine.\n");

println(Utils.getComponent(FilesystemStoreTools.class).storageDir.getAbsolutePath());

 println("== Step 3: Copy attachments from database to filesystem. ==");
 println("Now you are ready to copy the data over from your database to
the filesystem. "
 + "It is prudent to leave the attachments in the database since this
is still experimental "
 + "and in most situations the attachment data is not bothersome just
sitting in the "
 + "database. As such, this script contains no facility to delete
entries from the database.");
 println("If anything goes wrong in this function, it will fail with an
error message, "
 + "you should get the stack trace (probably in the log file) and
keep it to "
 + "confuse and humiliate the developers with. No harm should be done
since this only loads "
 + "from the database and only saves to the filesystem.");
}

main();
private void main()
{
 final XWikiContext xc = xcontext.getContext();
 final XWiki wiki = xc.getWiki();

 int startAt = 0;
 int seconds = 20;
 boolean dryRun = true;
 boolean verbose = false;
 boolean go = request.getMethod().equals("POST") &&
request.getParameter("doIt") != null;
 boolean ajax = "plain".equals(request.getParameter("xpage"));
 int endedAt = 0;

 if (!ajax) {
 this.printIntro(wiki);
 }

 if (go) {
 startAt = Integer.parseInt(request.getParameter("startAt"));
 seconds = Integer.parseInt(request.getParameter("seconds"));
 dryRun = "on".equals(request.getParameter("dryRun"));
 verbose = "on".equals(request.getParameter("verbose"));
 endedAt = this.doIt(startAt, seconds, dryRun, verbose, ajax);
 if (ajax) {
 if (endedAt == -1) {
 this.printFooter();
 } 

[xwiki-users] How can I get event object through a form

2016-01-18 Thread Pascal BASTIEN
Hi,

I try to make an Admin form to delete some event from activity stream.
I manage:
- to list events in a checkbox list
- to delete an event
#foreach ($MonEvent in $xwiki.activitystream.getEventsForUser($MyUserr, false, 
300, 0))
  #if ($MonEvent.getPage()=='MySpace.MyPage')
* event deletion
$xwiki.activitystream.deleteActivityEvent($MonEvent)
  #end
#end
- but I didn't manage to pass an event id/object with form to my 
deleteActivityEvent method :-(

It doesn't work because when I get my event through 
$request.getParameterValues('IdEntry'), event ID is transformed in text and is 
not event object anymore.

I use velocity with xwiki 7.0.1 and my page contains this code:

**
{{velocity}}
{{html}}
## My form to select events to delete


  #foreach ($MonEvent in $xwiki.activitystream.getEvents(false, 200, 0 ))
##1. AAA $MonEvent - $MonEvent.getPage()
#set($MycheckBox="" + "$MonEvent.getPage() - 
$MonEvent.getDisplayDate() - $MonEvent.getType() - $MonEvent.getPriority() - 
$MonEvent.getUser() - $MonEvent.getEventId() - $MonEvent.getEvent() " + "")
$MycheckBox
  #end
  ##This is 
checkbox 

 
 
{{/html}}

## get select events ID 
$request.getParameterValues('IdEntry')

## i want to delete these ID
#foreach ($MyValue in $request.getParameterValues('IdEntry'))
  * try to delete this event with ID: $MyValue $MyValue.getPage()
  ## $MyValue.getPage() it doesn't work because $MyValue is not event anymore
  ## delete event method
  :-(
#end
**

To resume, do you have a way to give an event object to my deleteActivityEvent 
with form+velocity (because deleteActivityEvent accept only event object) ?

Thxs

Pascal B
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Page tree stopped working on Main wiki

2016-01-18 Thread Marius Dumitru Florea
On Mon, Jan 18, 2016 at 11:03 AM, Christoph Haas 
wrote:

> Any further ideas?
>

No :(, the message is pretty clear: the user that is the last content
author of XWiki.DocumentTree (or XWiki.DocumentTreeMacros) page doesn't
have PR. I would double check this.


>
> Am 13.01.2016 um 11:27 schrieb Marius Dumitru Florea:
> > Can you try the same with XWiki.DocumentTree page? (it includes
> > XWiki.DocumentTreeMacros and I thought PR is checked on the included
> > content).
>
> ___
> 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


[xwiki-users] Mocca calendar - display 'short description' instead of title in month/week/day view

2016-01-18 Thread Mark Sack
In our use of the calendar extension, I expect to have situations where the
title is repeated (sometimes for what are really recurring events and
sometimes not). For this reason, we'll leave the randomly generated string
in the title field. I've added a 'short description' field to the event
class to use in place of the title. I would like to display the new field in
the calendar month/week/day view instead of the title. Does anyone have
suggestions on how to do this?

I'm using XWiki 7.4.



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Mocca-calendar-display-short-description-instead-of-title-in-month-week-day-view-tp7597592.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] How can I get event object through a form

2016-01-18 Thread Eduard Moraru
Hi,

Did you try using searchEvents and building an HQL that retrieves the Event
object with the given IDs? Then, once you get the Event objects, you can
use deleteActivityEvent on each of them.

Hope this helps,
Eduard

On Mon, Jan 18, 2016 at 2:39 PM, Pascal BASTIEN 
wrote:

> Hi,
>
> I try to make an Admin form to delete some event from activity stream.
> I manage:
> - to list events in a checkbox list
> - to delete an event
> #foreach ($MonEvent in $xwiki.activitystream.getEventsForUser($MyUserr,
> false, 300, 0))
>   #if ($MonEvent.getPage()=='MySpace.MyPage')
> * event deletion
> $xwiki.activitystream.deleteActivityEvent($MonEvent)
>   #end
> #end
> - but I didn't manage to pass an event id/object with form to my
> deleteActivityEvent method :-(
>
> It doesn't work because when I get my event through
> $request.getParameterValues('IdEntry'), event ID is transformed in text and
> is not event object anymore.
>
> I use velocity with xwiki 7.0.1 and my page contains this code:
>
> **
> {{velocity}}
> {{html}}
> ## My form to select events to delete
> 
> 
>   #foreach ($MonEvent in $xwiki.activitystream.getEvents(false, 200, 0 ))
> ##1. AAA $MonEvent - $MonEvent.getPage()
> #set($MycheckBox="" + "$MonEvent.getPage() -
> $MonEvent.getDisplayDate() - $MonEvent.getType() - $MonEvent.getPriority()
> - $MonEvent.getUser() - $MonEvent.getEventId() - $MonEvent.getEvent() " +
> "")
> $MycheckBox
>   #end
>   ##   
> This is checkbox 
> 
>  
>  
> {{/html}}
>
> ## get select events ID
> $request.getParameterValues('IdEntry')
>
> ## i want to delete these ID
> #foreach ($MyValue in $request.getParameterValues('IdEntry'))
>   * try to delete this event with ID: $MyValue $MyValue.getPage()
>   ## $MyValue.getPage() it doesn't work because $MyValue is not event
> anymore
>   ## delete event method
>   :-(
> #end
> **
>
> To resume, do you have a way to give an event object to my
> deleteActivityEvent with form+velocity (because deleteActivityEvent accept
> only event object) ?
>
> Thxs
>
> Pascal B
> ___
> 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


[xwiki-users] Fw : Re: How can I get event object through a form

2016-01-18 Thread Pascal BASTIEN

> 
> Did you try using searchEvents and building an HQL that
> retrieves the Event object with the given IDs? Then, once
> you get the Event objects, you can use
> deleteActivityEvent on each of them.

That is what I was affraid of ... hql query. I though there was a simplier way 
like xcontext stuff or convert id in event object ;-)
Thxs I will give a try  (must found id field and table)



> 
> I try to make an Admin form to delete some event from
> activity stream.
> 
> I manage:
> 
> - to list events in a checkbox list
> 
> - to delete an event
> 
> #foreach ($MonEvent in
> $xwiki.activitystream.getEventsForUser($MyUserr, false, 300,
> 0))
> 
>       #if
> ($MonEvent.getPage()=='MySpace.MyPage')
> 
>         * event deletion
> 
>        
> $xwiki.activitystream.deleteActivityEvent($MonEvent)
> 
>       #end
> 
> #end
> 
> - but I didn't manage to pass an event id/object with
> form to my deleteActivityEvent method :-(
> 
> 
> 
> It doesn't work because when I get my event through
> $request.getParameterValues('IdEntry'), event ID is
> transformed in text and is not event object anymore.
> 
> 
> 
> I use velocity with xwiki 7.0.1 and my page contains this
> code:
> 
> 
> 
> **
> 
> {{velocity}}
> 
> {{html}}
> 
> ## My form to select events to delete
> 
>  id="DelActivityStream" onsubmit="return
> confirm('Are you sure?')">
> 
> 
> 
>   #foreach ($MonEvent in
> $xwiki.activitystream.getEvents(false, 200, 0 ))
> 
>     ##1. AAA $MonEvent - $MonEvent.getPage()
> 
>     #set($MycheckBox=" type='checkbox' name='IdEntry'
> value='")
> 
>     #set($MycheckBox=$MycheckBox +
> "$MonEvent")
> 
>     #set($MycheckBox=$MycheckBox + "'/>"
> + "$MonEvent.getPage() - $MonEvent.getDisplayDate() -
> $MonEvent.getType() - $MonEvent.getPriority() -
> $MonEvent.getUser() - $MonEvent.getEventId() -
> $MonEvent.getEvent() " + "")
> 
>     $MycheckBox
> 
>   #end
> 
>   ##    name="IdEntry"
> value="${doc.fullName}"/> This is checkbox
> 
> 
> 
> 
>       class="buttonwrapper"> type="submit" value="Supprimer les entrées
> du flux d'activité"
> class="button"/>
> 
>  
> 
> {{/html}}
> 
> 
> 
> ## get select events ID
> 
> $request.getParameterValues('IdEntry')
> 
> 
> 
> ## i want to delete these ID
> 
> #foreach ($MyValue in
> $request.getParameterValues('IdEntry'))
> 
>   * try to delete this event with ID: $MyValue
> $MyValue.getPage()
> 
>   ## $MyValue.getPage() it doesn't work because
> $MyValue is not event anymore
> 
>   ## delete event method
> 
>   :-(
> 
> #end
> 
> **
> 
> 
> 
> To resume, do you have a way to give an event object to my
> deleteActivityEvent with form+velocity (because
> deleteActivityEvent accept only event object) ?
> 
> 
> 
> Thxs
> 
> 
> 
> Pascal B
> 
> ___
> 
> 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


Re: [xwiki-users] Fw : Re: How can I get event object through a form

2016-01-18 Thread vinc...@massol.net
Also note that the AS has a buitin feature to delete old events, see your 
xwiki.cfg file:

#-# Number of days the events should be kept (0 or any negative value: infinite 
duration)
#-# Note: if this value is greater than 0 a scheduler job will be created, this 
job will then be fired every week to
#-# delete events older than the configured value.
#-# Default: 0
# xwiki.plugin.activitystream.daystokeepevents=0

If you still need to delete event manually you could check the code executed by 
the scheduler job.

Thanks
-Vincent

On 19 Jan 2016 at 07:33:20, Pascal BASTIEN (pbasnews-xw...@yahoo.fr) wrote:


>  
> Did you try using searchEvents and building an HQL that
> retrieves the Event object with the given IDs? Then, once
> you get the Event objects, you can use
> deleteActivityEvent on each of them.

That is what I was affraid of ... hql query. I though there was a simplier way 
like xcontext stuff or convert id in event object ;-)
Thxs I will give a try (must found id field and table)



>  
> I try to make an Admin form to delete some event from
> activity stream.
>  
> I manage:
>  
> - to list events in a checkbox list
>  
> - to delete an event
>  
> #foreach ($MonEvent in
> $xwiki.activitystream.getEventsForUser($MyUserr, false, 300,
> 0))
>  
>       #if
> ($MonEvent.getPage()=='MySpace.MyPage')
>  
>         * event deletion
>  
>        
> $xwiki.activitystream.deleteActivityEvent($MonEvent)
>  
>       #end
>  
> #end
>  
> - but I didn't manage to pass an event id/object with
> form to my deleteActivityEvent method :-(
>  
>  
>  
> It doesn't work because when I get my event through
> $request.getParameterValues('IdEntry'), event ID is
> transformed in text and is not event object anymore.
>  
>  
>  
> I use velocity with xwiki 7.0.1 and my page contains this
> code:
>  
>  
>  
> **
>  
> {{velocity}}
>  
> {{html}}
>  
> ## My form to select events to delete
>  
>  id="DelActivityStream" onsubmit="return
> confirm('Are you sure?')">
>  
> 
>  
>   #foreach ($MonEvent in
> $xwiki.activitystream.getEvents(false, 200, 0 ))
>  
>     ##1. AAA $MonEvent - $MonEvent.getPage()
>  
>     #set($MycheckBox=" type='checkbox' name='IdEntry'
> value='")
>  
>     #set($MycheckBox=$MycheckBox +
> "$MonEvent")
>  
>     #set($MycheckBox=$MycheckBox + "'/>"
> + "$MonEvent.getPage() - $MonEvent.getDisplayDate() -
> $MonEvent.getType() - $MonEvent.getPriority() -
> $MonEvent.getUser() - $MonEvent.getEventId() -
> $MonEvent.getEvent() " + "")
>  
>     $MycheckBox
>  
>   #end
>  
>   ##    name="IdEntry"
> value="${doc.fullName}"/> This is checkbox
> 
>  
> 
>  
>       class="buttonwrapper"> type="submit" value="Supprimer les entrées
> du flux d'activité"
> class="button"/>
>  
>  
>  
> {{/html}}
>  
>  
>  
> ## get select events ID
>  
> $request.getParameterValues('IdEntry')
>  
>  
>  
> ## i want to delete these ID
>  
> #foreach ($MyValue in
> $request.getParameterValues('IdEntry'))
>  
>   * try to delete this event with ID: $MyValue
> $MyValue.getPage()
>  
>   ## $MyValue.getPage() it doesn't work because
> $MyValue is not event anymore
>  
>   ## delete event method
>  
>   :-(
>  
> #end
>  
> **
>  
>  
>  
> To resume, do you have a way to give an event object to my
> deleteActivityEvent with form+velocity (because
> deleteActivityEvent accept only event object) ?
>  
>  
>  
> Thxs
>  
>  
>  
> Pascal B
>  
> ___
>  
> 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