On Thu, Sep 25, 2014 at 11:18 AM, Pascal BASTIEN
<pbasnews-xwiki(a)yahoo.fr> wrote:
"it's a kind of magic" for $stringtool
:-)
... but I didn't manage to use $user.getProperty('email').value or
$user.getValue('email')
I try this:
{{velocity}}
#set ($sql = ", BaseObject as obj where obj.name=doc.fullName and
obj.className='XWiki.XWikiUsers'")
#set ($allUsers = $xwiki.searchDocuments($sql))
#foreach ($user in $allUsers)
##cut ...
#if ($email != 'mailto:')
## $user -> $email
$user ->
$user.getProperty('email').value - $user.getValue('email')
You can always do $someVariable.class.name to see the Java class name
and then to look for the corresponding javadoc to see the available
method. In this case, $user is a plain Java string so it doesn't have
the 'getProperty' method. If you don't believe me, look for
'searchDocuments' in
http://platform.xwiki.org/xwiki/bin/view/SRD/Navigation?api=xwiki&xpage…
You need a Document object. See
http://platform.xwiki.org/xwiki/bin/view/SRD/Navigation?api=doc&xpage=e…
which has 'getValue'.
#set ($userDoc = $xwiki.getDocument($user))
$user.getValue('email')
#end
#end
{{/velocity}}
and this:
{{velocity}}
#set ($sql = ", BaseObject as obj where obj.name=doc.fullName and
obj.className='XWiki.XWikiUsers'")
#set ($allUsers = $xwiki.searchDocuments($sql))
#foreach ($user in $allUsers)
#set ($MyUser = $xwiki.getUser("$user"))
getUser return an object of type User,
http://maven.xwiki.org/site/docs/xwiki-javadoc-4.1.x/com/xpn/xwiki/api/User…
, which doesn't have any getProperty or getValue method but has
getEmail. You really need to check the type of objects you are using.
#if ($email != 'mailto:')
## $user -> $email
$user -> $MyUser.getProperty('email').value -
$MyUser.getValue('email')
#end
#end
{{/velocity}}
without success :-(
________________________________
De : "Guillaume "Louis-Marie" Delhumeau"
<gdelhumeau(a)xwiki.com>
À : XWiki Users <users(a)xwiki.org>
Envoyé le : Jeudi 25 septembre 2014 9h19
Objet : Re: [xwiki-users] Can I send email to a group with xwiki 6?
2014-09-24 22:27 GMT+02:00 Sergiu Dumitriu <sergiu(a)xwiki.org>rg>:
On 09/24/2014 10:15 AM, Pascal BASTIEN wrote:
Hello,
(freely inspired/adapted by:
http://extensions.xwiki.org/xwiki/bin/view/Extension/Test+Mail (Vincent)
and
http://xwiki.markmail.org/message/bksyjlpwezx4dgco?q=getAllMembersNamesForG…
(Sergiu)
Some questions:
to replace some text in velocity, I used $text.replaceAll(xxx,yyy).
Are they a way to use StringUtils tools in velocity?
http://commons.apache.org/proper/commons-lang/javadocs/api-3.1/org/apache/c…
If yes, how?
Yes, $stringtool
I failed to get email adress with
$userdoc.display("email","view",$user)
function but without
"mailto:" prefix ...
http://maven.xwiki.org/site/docs/xwiki-javadoc-4.1.x/com/xpn/xwiki/api/Docu…
Use $user.getProperty('email').value to access the raw value, display
methods generate HTML code.
Since 6.2, you can do $user.getValue('email') :)
Are they a tip with wrappingSyntaxId value? or I
must use regexp like i
did?
If there are too much email I don't know if my macro is safe... (Perhaps
there
are a way to insert a sleep instruction in velocity?)
Thxs
--
Sergiu Dumitriu
http://purl.org/net/sergiu
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Guillaume Delhumeau (gdelhumeau(a)xwiki.com)
Research & Development Engineer at XWiki SAS
Committer on the
XWiki.org project
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users