Re: [xwiki-users] Error: The Context Component Manager should only be used for read access.

2015-01-27 Thread Bryn Jeffries
Vincent said: 
>> Using Utils.getRootComponentManager() worked for me, so many thanks. 
>> Even using a deprecated method lets me progress with the task.
>
> The recommended way is the one I’ve now documented at 
> http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HAccessfromScripts

Thanks very much. Using services.component.getComponentManager(null) worked 
fine. FWIW I see that the the related problem I observed on your website 
http://platform.xwiki.org/xwiki/bin/view/SRD/  was down to 
Utils.getComponentManager() being called from 
AppWithinMinutes.DynamicMessageTool, which has since been updated in XWiki 
6.3. It might be worth backporting a fix so that we can access the 
mentioned page.

Again, many thanks for the prompt help and responses.

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


Re: [xwiki-users] Manage rights for author

2015-01-27 Thread Guillaume Lerouge
Hi Marc,

by default, the creator of a page has edit rights on that page. If that
users switches to "advanced mode" on their user profile, then go back to
their page, they will be able to see an "Access rights" option in the
"Edit" button.

Thanks,

Guillaume

On Tue, Jan 27, 2015 at 9:31 AM, Marc AUDEFROY 
wrote:

> Hi all!
>
> How could an author manage the rights on the pages he created? How put
> this default behavior?
>
> Thanks!
>
> Marc
> ___
> 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] Refreshing a LiveTable

2015-01-27 Thread Clemens Klein-Robbenhaar
On 01/27/2015 02:52 AM, Bryn Jeffries wrote:
> Is there a "right" way to make a LiveTable refresh?
> 

I do not know of a "right way", but one that currently works is to fetch the 
livetable by its name, and refetch the current rows via some not-so obvious 
code,
like:

 var livetable = window['livetable_'+ id_of_livetable_here ] ;
 var end = livetable.limit;
 var start = Math.max(livetable.lastOffset, 1);
 livetable.clearCache();
 livetable.getRows(start, end, start, end);


That works in some little extension I wrote:

 
https://github.com/xwiki-contrib/application-reviewpages/blob/master/application-reviewpages-ui/src/main/resources/ReviewPages/Script.xml#L176

I think I even "borrowed" it from some other xwiki-contrib code, but cannot 
remember from where.
Certainly this is not "using any API" and it is expected to break without 
notice in any new XWiki version, but for now it does the job (for me at least).

Sure there is a better way, to do this, (or at least it should ;)) but I do not 
know about it.

> I have a page that includes a LiveTable to show the results of a query on an 
> external database, and a form triggers an AJAX call to modify the database 
> (e.g., insert a new row). I'd like the AJAX call to include an action within 
> OnSuccess to make the LiveTable refresh to show these modifications.
> 
> http://xwiki.475771.n2.nabble.com/Proposal-Hightlight-applied-filters-in-livetable-tp4936097p4942165.html
> and
> http://jira.xwiki.org/browse/XWIKI-5100
> appear to discuss something of this kind, but I couldn't find any 
> instructions. The closest thing was a line in livetable.js
> https://github.com/xwiki/xwiki-platform/blob/4f92c9fc4dc9d4bb7b42a54f3e289f42e833d986/xwiki-platform-core/xwiki-platform-web/src/main/webapp/resources/js/xwiki/table/livetable.js#L963
> where it looks like a refresh is triggered on event 
> "xwiki:livetable:mylivetable:filtersChanged". I have tried calling
> document.fire('xwiki:livetable:mylivetable:filtersChanged');
> from within a javascript function, but this did not appear to make the 
> "mylivetable" LiveTable update. Could anyone direct me further?
> 
> Thanks,
> 
> Bryn
> ___
> 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] [ANN] XWiki 6.2.5 released

2015-01-27 Thread Guillaume "Louis-Marie" Delhumeau
The XWiki development team is proud to announce the availability of XWiki
6.2.5.

This version is mostly a stabilization release which fix many bugs we have
discovered since XWiki 6.2.4. But it also brings some improvements on the
screen-width-responsiveness of the livetable in Flamingo.

You can download it here: http://www.xwiki.org/xwiki/bin/view/Main/Download

Make sure to review the release notes:
http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki625

Thanks
-The XWiki dev team
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Error: The Context Component Manager should only be used for read access.

2015-01-27 Thread vinc...@massol.net




On 27 Jan 2015 at 12:14:28, Bryn Jeffries 
(bryn.jeffr...@sydney.edu.au(mailto:bryn.jeffr...@sydney.edu.au)) wrote:

> Thanks Vincent,
>  
> Using Utils.getRootComponentManager() worked for me, so many thanks. Even 
> using a deprecated method lets me progress with the task.

The recommended way is the one I’ve now documented at 
http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HAccessfromScripts

Thanks
-Vincent


> Bryn
>  
> From: Vincent Massol [vmas...@gmail.com] on behalf of vinc...@massol.net 
> [vinc...@massol.net]
> Sent: 27 January 2015 21:55
> To: XWiki Users
> Cc: Bryn Jeffries
> Subject: Re: [xwiki-users] Error: The Context Component Manager should only 
> be used for read access.
>  
> Hi Bryn,  
>  
> Apparently we broke backward compat and this is bad… We used to return the 
> root Component Manager when calling Utils.getComponentManager()  
>  
> But it’s been modified and deprecated in XWiki 6.1M1 
> (http://jira.xwiki.org/browse/XWIKI-10352) to return the Context Component 
> Manager.  
>  
> Now, the new way of registering components has been to use the Component 
> Manager script service introduced in XWiki 4.1M2 (see 
> http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HAccessfromScripts).
>   
>  
> However I’ve just noticed that it’s also been modified to return the Context 
> CM instead of the Root CM.  
>  
> This means there’s now no way to dynamically register a new component from 
> Groovy without using a deprecated API…  
>  
> So right now the only workaround is to use the deprecated method:  
>  
> Utils.getRootComponentManager()  
>  
> I’ve created http://jira.xwiki.org/browse/XWIKI-11716  
>  
> Thanks  
> -Vincent
>  
>  

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


Re: [xwiki-users] Error: The Context Component Manager should only be used for read access.

2015-01-27 Thread Bryn Jeffries
Thanks Vincent,

Using Utils.getRootComponentManager() worked for me, so many thanks. Even using 
a deprecated method lets me progress with the task.

Bryn


From: Vincent Massol [vmas...@gmail.com] on behalf of vinc...@massol.net 
[vinc...@massol.net]
Sent: 27 January 2015 21:55
To: XWiki Users
Cc: Bryn Jeffries
Subject: Re: [xwiki-users] Error: The Context Component Manager should only be 
used for read access.

Hi Bryn,

Apparently we broke backward compat and this is bad… We used to return the root 
Component Manager when calling Utils.getComponentManager()

But it’s been modified and deprecated in XWiki 6.1M1 
(http://jira.xwiki.org/browse/XWIKI-10352) to return the Context Component 
Manager.

Now, the new way of registering components has been to use the Component 
Manager script service introduced in XWiki 4.1M2 (see 
http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HAccessfromScripts).

However I’ve just noticed that it’s also been modified to return the Context CM 
instead of the Root CM.

This means there’s now no way to dynamically register a new component from 
Groovy without using a deprecated API…

So right now the only workaround is to use the deprecated method:

Utils.getRootComponentManager()

I’ve created http://jira.xwiki.org/browse/XWIKI-11716

Thanks
-Vincent


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


Re: [xwiki-users] Error: The Context Component Manager should only be used for read access.

2015-01-27 Thread vinc...@massol.net
 




On 27 Jan 2015 at 12:02:01, Thomas Mortagne 
(thomas.morta...@xwiki.com(mailto:thomas.morta...@xwiki.com)) wrote:

> On Tue, Jan 27, 2015 at 11:55 AM, vinc...@massol.net wrote:
> > Hi Bryn,
> >
> > Apparently we broke backward compat and this is bad… We used to return the 
> > root Component Manager when calling Utils.getComponentManager()
> >
> > But it’s been modified and deprecated in XWiki 6.1M1 
> > (http://jira.xwiki.org/browse/XWIKI-10352) to return the Context Component 
> > Manager.
> >
> > Now, the new way of registering components has been to use the Component 
> > Manager script service introduced in XWiki 4.1M2 (see 
> > http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HAccessfromScripts).
> >
> > However I’ve just noticed that it’s also been modified to return the 
> > Context CM instead of the Root CM.
> >
> > This means there’s now no way to dynamically register a new component from 
> > Groovy without using a deprecated API…
>  
> You should look at the whole script service not only getComponentManager().

Indeed by bad, I checked but missed it.. Sorry about that.

I’ve now documented it at:
http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HAccessfromScripts

A real pity that issue http://jira.xwiki.org/browse/XWIKI-10352 has put N/A in 
the documentation field! That’s bad, it should have been documented at 
http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HAccessfromScripts

We still have broken some pretty important and used API.

Thanks
-Vincent

> >>
>  
> /**
> * Retrieves the component manager associated with a specific
> namespace. The namespace is generally of the form
> * prefix:subid where prefix is used to
> find the proper factory. : can be
> * escaped using \ and \ need to be
> escaped as well. There is a namespace for each
> * document, space, wiki and user. E.g. 'wiki:drafts' is the
> namespace corresponding to the 'drafts' wiki.
> * Namespaces can be nested in which case they inherit from the
> parent namespace. E.g. the component manager for a
> * specific document has access to the components registered
> specifically for that document or for any of its
> * namespace ancestors (space, wiki, root). The root (top level)
> component manager is returned if you pass
> * {@code null}.
> *
> * @param namespace a namespace or {@code null} for the root
> {@link ComponentManager}
> * @return the component manager associated with the specified
> namespace, if any, {@code null otherwise}
> */
> public ComponentManager getComponentManager(String namespace)
>  
> 
>  
> I.e. enforcing the best practice to explicitly indicate where exactly
> you want to register your component since most of the time you don't
> really want or need to register it from the whole farm.
>  
> >
> > So right now the only workaround is to use the deprecated method:
> >
> > Utils.getRootComponentManager()
> >
> > I’ve created http://jira.xwiki.org/browse/XWIKI-11716
> >
> > Thanks
> > -Vincent
> >
> >
> > On 27 Jan 2015 at 11:34:04, Bryn Jeffries 
> > (bryn.jeffr...@sydney.edu.au(mailto:bryn.jeffr...@sydney.edu.au)) wrote:
> >
> >> I tried to follow the example code given in:
> >> http://extensions.xwiki.org/xwiki/bin/view/Extension/Create+a+component+using+Groovy
> >>
> >> Saving and Viewing a page with the code without changes, I got a Groovy 
> >> macro error with the following exception in the stack trace:
> >> java.lang.RuntimeException: The Context Component Manager should only be 
> >> used for read access. Write operations should be done against specific 
> >> Component Managers.
> >>
> >> Could anyone explain what this means, and why this error now appears? I'm 
> >> using 6.3. I notice that the same error also currently shows up at 
> >> http://platform.xwiki.org/xwiki/bin/view/SRD/ running 6.2.2
> >>
> >> Thanks,
> >>
> >> Bryn
> > ___
> > users mailing list
> > users@xwiki.org
> > http://lists.xwiki.org/mailman/listinfo/users
>  
>  
>  
> --
> Thomas Mortagne
> ___
> 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] Error: The Context Component Manager should only be used for read access.

2015-01-27 Thread Thomas Mortagne
On Tue, Jan 27, 2015 at 11:55 AM, vinc...@massol.net  wrote:
> Hi Bryn,
>
> Apparently we broke backward compat and this is bad… We used to return the 
> root Component Manager when calling Utils.getComponentManager()
>
> But it’s been modified and deprecated in XWiki 6.1M1 
> (http://jira.xwiki.org/browse/XWIKI-10352) to return the Context Component 
> Manager.
>
> Now, the new way of registering components has been to use the Component 
> Manager script service introduced in XWiki 4.1M2 (see 
> http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HAccessfromScripts).
>
> However I’ve just noticed that it’s also been modified to return the Context 
> CM instead of the Root CM.
>
> This means there’s now no way to dynamically register a new component from 
> Groovy without using a deprecated API…

You should look at the whole script service not only getComponentManager().

>>

/**
 * Retrieves the component manager associated with a specific
namespace. The namespace is generally of the form
 * prefix:subid where prefix is used to
find the proper factory. : can be
 * escaped using \ and \ need to be
escaped as well. There is a namespace for each
 * document, space, wiki and user. E.g. 'wiki:drafts' is the
namespace corresponding to the 'drafts' wiki.
 * Namespaces can be nested in which case they inherit from the
parent namespace. E.g. the component manager for a
 * specific document has access to the components registered
specifically for that document or for any of its
 * namespace ancestors (space, wiki, root). The root (top level)
component manager is returned if you pass
 * {@code null}.
 *
 * @param namespace a namespace or {@code null} for the root
{@link ComponentManager}
 * @return the component manager associated with the specified
namespace, if any, {@code null otherwise}
 */
public ComponentManager getComponentManager(String namespace)



I.e. enforcing the best practice to explicitly indicate where exactly
you want to register your component since most of the time you don't
really want or need to register it from the whole farm.

>
> So right now the only workaround is to use the deprecated method:
>
> Utils.getRootComponentManager()
>
> I’ve created http://jira.xwiki.org/browse/XWIKI-11716
>
> Thanks
> -Vincent
>
>
> On 27 Jan 2015 at 11:34:04, Bryn Jeffries 
> (bryn.jeffr...@sydney.edu.au(mailto:bryn.jeffr...@sydney.edu.au)) wrote:
>
>> I tried to follow the example code given in:
>> http://extensions.xwiki.org/xwiki/bin/view/Extension/Create+a+component+using+Groovy
>>
>> Saving and Viewing a page with the code without changes, I got a Groovy 
>> macro error with the following exception in the stack trace:
>> java.lang.RuntimeException: The Context Component Manager should only be 
>> used for read access. Write operations should be done against specific 
>> Component Managers.
>>
>> Could anyone explain what this means, and why this error now appears? I'm 
>> using 6.3. I notice that the same error also currently shows up at 
>> http://platform.xwiki.org/xwiki/bin/view/SRD/ running 6.2.2
>>
>> Thanks,
>>
>> Bryn
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users



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


Re: [xwiki-users] Error: The Context Component Manager should only be used for read access.

2015-01-27 Thread vinc...@massol.net
Hi Bryn,

Apparently we broke backward compat and this is bad… We used to return the root 
Component Manager when calling Utils.getComponentManager()

But it’s been modified and deprecated in XWiki 6.1M1 
(http://jira.xwiki.org/browse/XWIKI-10352) to return the Context Component 
Manager.

Now, the new way of registering components has been to use the Component 
Manager script service introduced in XWiki 4.1M2 (see 
http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HAccessfromScripts).

However I’ve just noticed that it’s also been modified to return the Context CM 
instead of the Root CM.

This means there’s now no way to dynamically register a new component from 
Groovy without using a deprecated API…

So right now the only workaround is to use the deprecated method:

Utils.getRootComponentManager()

I’ve created http://jira.xwiki.org/browse/XWIKI-11716

Thanks
-Vincent


On 27 Jan 2015 at 11:34:04, Bryn Jeffries 
(bryn.jeffr...@sydney.edu.au(mailto:bryn.jeffr...@sydney.edu.au)) wrote:

> I tried to follow the example code given in:
> http://extensions.xwiki.org/xwiki/bin/view/Extension/Create+a+component+using+Groovy
>  
> Saving and Viewing a page with the code without changes, I got a Groovy macro 
> error with the following exception in the stack trace:
> java.lang.RuntimeException: The Context Component Manager should only be used 
> for read access. Write operations should be done against specific Component 
> Managers.
>  
> Could anyone explain what this means, and why this error now appears? I'm 
> using 6.3. I notice that the same error also currently shows up at 
> http://platform.xwiki.org/xwiki/bin/view/SRD/ running 6.2.2
>  
> Thanks,
>  
> Bryn
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] Error: The Context Component Manager should only be used for read access.

2015-01-27 Thread Bryn Jeffries
I tried to follow the example code given in:
http://extensions.xwiki.org/xwiki/bin/view/Extension/Create+a+component+using+Groovy

Saving and Viewing a page with the code without changes, I got a Groovy macro 
error with the following exception in the stack trace:
java.lang.RuntimeException: The Context Component Manager should only be used 
for read access. Write operations should be done against specific Component 
Managers.

Could anyone explain what this means, and why this error now appears? I'm using 
6.3. I notice that the same error also currently shows up at 
http://platform.xwiki.org/xwiki/bin/view/SRD/ running 6.2.2

Thanks,

Bryn


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


Re: [xwiki-users] Empty Document Title

2015-01-27 Thread Jeremie BOUSQUET
Hi,

2015-01-27 10:39 GMT+01:00 Matthias Wegner :

> Dear Jeremie,
>
> sorry for the distracting. The object is here not important. I only
> search for ALL documents which contain one object. From that document i
> want to read the title (if i get no value from the object). I tried now
> the queryModule with
>
> List foundReferences = new
> ArrayList();
>  try {
>  Query query = queryManager.createQuery("SELECT
> doc.space, doc.name FROM Document doc, doc.object(" + className + ") AS
> obj", Query.XWQL);
>  List queryResults = query.execute();
>  for (Object[] result : queryResults) {
>  foundReferences.add(new
> DocumentReference(context.getDatabase(), (String) result[0], (String)
> result[1]));
>  }
>  } catch (Exception e) {
>  e.printStackTrace();
>  }
>  if (foundReferences.size()>0) {
>  for (DocumentReference documentReference :
> foundReferences) {
>  XWikiDocument doc =
> context.getWiki().getDocument(documentReference, context);
>  System.out.println(doc.getTitle());
>  }
>  }
>
> That doens't help at all. I don't get the title from documents. Why is
> that? You have an idea? Should title = doc.getTitle(); not give back the
> title? It has nothing to do with the attachend object.
>
> PS: I created all the documents with "AppWithinAMinute". The documents
> show a title when i open the document in the browser, so why can i read
> the title with a query from java-side? If you have no idea, than it
> seems that it is a bug. Then i send an example-code which reproduce this
> to jira.
>

When you browse a page/document created with AppWithinMinutes, you see a
title, but please could you edit this page (in "wiki" edit mode), and check
if there is something in the "title" field at the top of the editor ?
There is a possibility that the "title" is automatically rendered by the
Sheet document generated by AppWithinMinutes, from a field in the object
(I'm not sure about this).


>
> Regards,
> Matthias
>
> Am 26.01.2015 um 10:23 schrieb jerem [via XWiki]:
> > Hi,
> >
> > You should be careful with Nabble (or such tools) formatting, that
> > generates syntax that is neither plain text nor html, and your code
> > samples
> > are then not displayed at all in regular email clients ...
> >
> > I put your samples back below:
> >
> > groovy:
> >
> >  String hql = "SELECT obj.name FROM BaseObject obj WHERE
> > obj.className='Space.SomeClass'";
> >  def results = xwiki.search(hql);
> >  for (int i = 0; i < results.size(); i++) {
> > if(!results.get(i).equals("Space.SomeClassTemplate")) {
> >Document doc = xwiki.getDocument(results.get(i));
> >Object obj = document.getObject("Space.SomeClass");
> >if (obj!=null) {
> >   Property property = obj.getProperty("title");
> >   if (property!=null) {
> >  title = property.getValue();
> >   } else {
> >  title = document.getTitle();
> >  }
> >  println(title)
> > }
> >  }
> >
> > java:
> >
> > String className = "Space.SomeClass";
> > String sql = "SELECT obj.name FROM BaseObject obj WHERE
> > obj.className='" +
> > className + "'";
> > List results = context.getWiki().search(sql, context);
> > if (results != null) {
> >for (Object object : results) {
> >  String docName = object.toString();
> >  XWikiDocument doc = context.getWiki().getDocument(docName, context);
> >  EntityReference entRef = doc.resolveClassReference(className);
> >  BaseObject baseObject = doc.getXObject(entRef);
> >  if (baseObject != null) {
> >   System.out.println(doc.getTitle()+ baseObject);
> >  }
> > }
> >
> > Note that you don't do the same thing regarding title in groovy and in
> > java, obj.getProperty("title") is not at all equivalent to
> > document.getTitle() ...
> > It's likely that your document has no title, and what "works" in
> > groovy is
> > to get a property "title" from an object of this doc. At least, I
> > don't see
> > any other reason for this empty title :)
> >
> > Side note, in java you could inject the QueryManager instead of using the
> > "search" api, as you only do a read-only query:
> >
> > @Inject
> > private QueryManager queryManager;
> >
> > See : http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module
> >
> > Hope this helps,
> >
> > Jeremie
> >
> >
> > 2015-01-23 17:39 GMT+01:00 Matthias Wegner <[hidden email]
> > >:
> >
> > > Hi All,
> > >
> > > i have a working groovy script which is:
> > >
> > > I use a class and add an object to a document. Everytime a object is
> > > attached i look for it with the query and do something with the
> > objects.
> > > the
> > > strange thing

Re: [xwiki-users] Empty Document Title

2015-01-27 Thread Matthias Wegner
Dear Jeremie,

sorry for the distracting. The object is here not important. I only 
search for ALL documents which contain one object. From that document i 
want to read the title (if i get no value from the object). I tried now 
the queryModule with

List foundReferences = new 
ArrayList();
 try {
 Query query = queryManager.createQuery("SELECT 
doc.space, doc.name FROM Document doc, doc.object(" + className + ") AS 
obj", Query.XWQL);
 List queryResults = query.execute();
 for (Object[] result : queryResults) {
 foundReferences.add(new 
DocumentReference(context.getDatabase(), (String) result[0], (String) 
result[1]));
 }
 } catch (Exception e) {
 e.printStackTrace();
 }
 if (foundReferences.size()>0) {
 for (DocumentReference documentReference : 
foundReferences) {
 XWikiDocument doc = 
context.getWiki().getDocument(documentReference, context);
 System.out.println(doc.getTitle());
 }
 }

That doens't help at all. I don't get the title from documents. Why is 
that? You have an idea? Should title = doc.getTitle(); not give back the 
title? It has nothing to do with the attachend object.

PS: I created all the documents with "AppWithinAMinute". The documents 
show a title when i open the document in the browser, so why can i read 
the title with a query from java-side? If you have no idea, than it 
seems that it is a bug. Then i send an example-code which reproduce this 
to jira.

Regards,
Matthias

Am 26.01.2015 um 10:23 schrieb jerem [via XWiki]:
> Hi,
>
> You should be careful with Nabble (or such tools) formatting, that
> generates syntax that is neither plain text nor html, and your code 
> samples
> are then not displayed at all in regular email clients ...
>
> I put your samples back below:
>
> groovy:
>
>  String hql = "SELECT obj.name FROM BaseObject obj WHERE
> obj.className='Space.SomeClass'";
>  def results = xwiki.search(hql);
>  for (int i = 0; i < results.size(); i++) {
> if(!results.get(i).equals("Space.SomeClassTemplate")) {
>Document doc = xwiki.getDocument(results.get(i));
>Object obj = document.getObject("Space.SomeClass");
>if (obj!=null) {
>   Property property = obj.getProperty("title");
>   if (property!=null) {
>  title = property.getValue();
>   } else {
>  title = document.getTitle();
>  }
>  println(title)
> }
>  }
>
> java:
>
> String className = "Space.SomeClass";
> String sql = "SELECT obj.name FROM BaseObject obj WHERE 
> obj.className='" +
> className + "'";
> List results = context.getWiki().search(sql, context);
> if (results != null) {
>for (Object object : results) {
>  String docName = object.toString();
>  XWikiDocument doc = context.getWiki().getDocument(docName, context);
>  EntityReference entRef = doc.resolveClassReference(className);
>  BaseObject baseObject = doc.getXObject(entRef);
>  if (baseObject != null) {
>   System.out.println(doc.getTitle()+ baseObject);
>  }
> }
>
> Note that you don't do the same thing regarding title in groovy and in
> java, obj.getProperty("title") is not at all equivalent to
> document.getTitle() ...
> It's likely that your document has no title, and what "works" in 
> groovy is
> to get a property "title" from an object of this doc. At least, I 
> don't see
> any other reason for this empty title :)
>
> Side note, in java you could inject the QueryManager instead of using the
> "search" api, as you only do a read-only query:
>
> @Inject
> private QueryManager queryManager;
>
> See : http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module
>
> Hope this helps,
>
> Jeremie
>
>
> 2015-01-23 17:39 GMT+01:00 Matthias Wegner <[hidden email] 
> >:
>
> > Hi All,
> >
> > i have a working groovy script which is:
> >
> > I use a class and add an object to a document. Everytime a object is
> > attached i look for it with the query and do something with the 
> objects.
> > the
> > strange thing is that i try to port it to a service to java. where i 
> get in
> > groovy an title of the document it is NOT given in java.
> > The java code of the service
> >
> > I didn't get it. Did i do something wrong? i never get a title of the
> > document. I can read the document, the object of the document, but i 
> did
> > not
> > get the title. I tried also to get translated documents because i use
> > locals
> > de and en. But even there i get the title back.
> >
> > You know why?
> >
> > Regards,
> > Matthias
> >
> >
> >
> > --
> > View this message in context:
> > http://xwiki.475771.n2.nabble.com/Empty-Document-Title-tp7593748.html
> > Sent from the XWiki- Users

[xwiki-users] Manage rights for author

2015-01-27 Thread Marc AUDEFROY
Hi all!

How could an author manage the rights on the pages he created? How put this 
default behavior? 

Thanks!

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