Re: [xwiki-users] Context Macro Broken?

2015-01-13 Thread Thomas Mortagne
If those example don't work then indeed there seems to be some
regression in context macro. Would be great if you could create an
issue on http://jira.xwiki.org indicating in which XWiki version you
have the bug.

On Tue, Jan 13, 2015 at 7:58 PM, cmherman christi...@meridianlink.com wrote:
 It doesn't even work if I do something as simple as:

 {{context document=OtherSpace.WebHome}}
 [[WebHome]]
 {{/context}}

 or with an image. The image is broken when this is entered in, for example,
 Main.Context Test:

 {{context document=Sandbox.WebHome}}
 image:XWikiLogo.png
 {{/context}}



 --
 View this message in context: 
 http://xwiki.475771.n2.nabble.com/Context-Macro-Broken-tp7593647p7593660.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



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


Re: [xwiki-users] Context Macro Broken?

2015-01-13 Thread Thomas Mortagne
On Tue, Jan 13, 2015 at 8:09 PM, cmherman christi...@meridianlink.com wrote:
 Hm. If ($hasEdit) can't be recontextualized I guess I'll have to expand my
 options. Thanks for the link.

 BTW, the problem I had with opening and closing the velocity macro is that,
 in a panel, closing the velocity macro signals the end of the panel to the
 CSS.

Hmm this is not really related to {{velocity}} macro but to what
#panelheader produces actually (there is no way for the css to even
know there was a {{velocity}} macro at all). We really need a more
modern {{panel}} macro instead of that crappy velocity based
#panelheader/#panelfooter...

Anyway as I told you for the use case you described in your example
there is no needed to cut the velocity content if you use the proper
rights API.

 The entire contents of the panel appear in the sidebar but only the
 header is enclosed in the box. The rest of the panels contexts float in
 whitespace between the Product Wikis panel box and the next panel's box. So,
 functional but ugly.



 --
 View this message in context: 
 http://xwiki.475771.n2.nabble.com/Context-Macro-Broken-tp7593647p7593662.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



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


Re: [xwiki-users] Context Macro Broken?

2015-01-13 Thread cmherman
It doesn't even work if I do something as simple as:

{{context document=OtherSpace.WebHome}}
[[WebHome]]
{{/context}}

or with an image. The image is broken when this is entered in, for example,
Main.Context Test:

{{context document=Sandbox.WebHome}}
image:XWikiLogo.png
{{/context}}



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Context-Macro-Broken-tp7593647p7593660.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] Context Macro Broken?

2015-01-13 Thread cmherman
Hm. If ($hasEdit) can't be recontextualized I guess I'll have to expand my
options. Thanks for the link.

BTW, the problem I had with opening and closing the velocity macro is that,
in a panel, closing the velocity macro signals the end of the panel to the
CSS. The entire contents of the panel appear in the sidebar but only the
header is enclosed in the box. The rest of the panels contexts float in
whitespace between the Product Wikis panel box and the next panel's box. So,
functional but ugly.



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Context-Macro-Broken-tp7593647p7593662.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] Beginner's struggle with configuration

2015-01-13 Thread Marcin Kolenda
I am very interested about putting my own xwiki but I've been messing 
with it and some problems came out.
At first i thought it would be good to make subwiki's for Programming, 
Linux, Mathematics. I could make template wiki and derive extensions 
and settings from it but how can I install additional extension to all 
of wiki's then?
I have also modified my Preview page when I made my first article. 
I've clicked preview, saw typo, and clicked edit.. After some struggle 
with editing this article I've modified this preview page unwittingly. 
After some modifications I removed all previous revisions. What can I do 
in such cases besides reinstalling everything? I would like to solve 
such problems by myself in the future so if it's possible, please, give 
me workflow, not a single solution.

I want also to have navigation for entire wiki with subwikis like:
#Programming
- Language Scala
- Design patterns
#Linux
- Settings
- Tools
#Mathematics
- Linear algebra
- Calculus
where (# - wiki), (- - space)
I think I could make Navbar panel in global wiki and add 
xwiki:Panels.Navbar to all subwiki's.
But now the work needed to add it everywhere is overwhelming. Is it 
possible to do it in config file?
I do not like cms such as drupal for the problems with configuration by 
clicking. I could spend days to make everything ticking in my way. From 
the other way it's good for giving power to the users.


Best wishes,
for community and developers
xwiki seems to be professional and awesome.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Context Macro Broken?

2015-01-13 Thread Hamster
Does it work if you change...

{{context document=wiki1:Main.WebHome}}#if
($hasEdit){{/context}}[[Wiki1wiki1:Main.WebHome]]#end

..to:

{{context document=wiki1:Main.WebHome}}#if
($hasEdit)[[Wiki1wiki1:Main.WebHome]]#end{{/context}}



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Context-Macro-Broken-tp7593647p7593648.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] Add date of account creation (without time) in User Index problem

2015-01-13 Thread Pascal BASTIEN
Thxs a lot to explained me with clarity all of that and help me to understand 
better XWiki.
Then with what you give me, I tried to add a  format_date parameter () (or 
regexp) in columns properties to improve livetable.
I failed because I didn't manage to find where is store livetable macro :-))

Something like this and next add a format date parameter in user index 
customizer.
#set($columns = [_avatar, first_name, last_name, email, 
doc.creationDate, _actions])
#set($columnsProperties = {
   _avatar : { type : none, link : none, html : true, 
sortable:false },
   first_name : { type : text , size : 20, link : view},
   last_name : { type : text, link : view},
   email : { type : text },
    doc.creationDate : { type : date, dateformat:-mm }
})
#set($options = {
  className:XWiki.XWikiUsers,
  translationPrefix : xe.index.users.,
  tagCloud : true,
  rowCount: 10
})
#livetable(userdirectory $columns $columnsProperties $options)
  De : Clemens Klein-Robbenhaar c.robbenh...@espresto.com
 À : users@xwiki.org 
 Envoyé le : Mardi 13 janvier 2015 12h22
 Objet : Re: [xwiki-users] Add date of account creation (without time) in User 
Index problem
   
On 01/13/2015 10:45 AM, Pascal BASTIEN wrote:
 Hello,
 
 To make it work I add this new property in XWiki.XWikiUsers class:
 /bin/edit/XWiki/XWikiUsers?editor=class
 Name: doc.creationDate Type: String
 PrettyName: Creation date
 

I did not know that you can create class properties with a dot in it,
and that this even can be used to get the original document property, but I see 
it indeed works

 Custom Display:
 {{velocity}}
 {{html}}i$value/i{{/html}}
 {{/velocity}}
 
 The problem is that Custom display is not taking into account and not 
 rendering.

This actually does not work, because the livetable ones not use the custom 
displayer at all,
but treats 'doc.creationDate' special

Possible solutions:

 1)
  - create a dummy class property, which does *not* shadow a doc-property,
  e.g. Name : doccreationdate, Type: Date

  CustomDisplay
  {{velocity}}
  $xwiki.formatDate($doc.getCreationDate(),'/MM/dd')
  {{/velocity}}

 so the custom display does not display the value of the property at all, but 
the actual creation date

 - add 'doccreationdate' to the list of columns in the User Directory

This kinda works, except that you cannot sort by that fake creation date, as 
it is not really there.
(The filter searching the database does not know about the custom displayer and 
searches for the empty value in the DB instead.)


2) Another alternative is to edit the place where doc.creationDate is 
actually rendered ...
for this you would have to patch the main livetable rendering.
see:

 http://localhost:8080/xwiki/bin/view/XWiki/LiveTableResultsMacros?viewer=code

around line 230 there is a:
  #set($discard = $row.put('doc_creationDate', 
$xwiki.formatDate($itemDoc.creationDate)))

you could change that to:
  #set($discard = $row.put('doc_creationDate', 
$xwiki.formatDate($itemDoc.creationDate, '/MM/dd')))

and then add doc.creationDate to the list of displayed columns in the user 
directory.

However then all creation dates everywhere (well, everywhere in live tables) 
will be rendered day only.
(Oh, and I see one still needs to add a dummy 'doc.creationDate' field to the 
user class, as otherwise the field is ignored :(


3) Finally the third solution I can think of would be to add a new date 
property to the user class,
and set this property to doc.creationDate whenever a user is created, and show 
this property in the User Directory
.
This might even be the cleanest solution, except that one needs to touch all 
existing users to update this field.

Newly created users then would be set up by writing an event listener that 
listens to a DocumentCreatingEvent
and if the new document has an XWiki.XWikiUsers object, then set the new 
property to doc.creaionDate

Event listener would be components as explained here:
  http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutorial
  http://extensions.xwiki.org/xwiki/bin/view/Extension/WikiComponent+Module

This is somewhat more effort, but I guess this would be cleaner (no custom 
display needed, just use the date format of that property,
results can be sorted, as value is really stored in the DB, no patching of 
core XWiki pages ...)




 I know HTML is not interpreted but I want to remove time of Creation date 
 field but Custom Display is apparently not used on a database field.
 Here a screenshot on what I want: http://snag.gy/bWnu9.jpg
 Do you have an idea how I must do it?
 Is it normal than Custom Display is not used?
 
 Thxs for any help
 
 Pascal BASTIEN
 
 
 ___
 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 

[xwiki-users] List all registered macros

2015-01-13 Thread ICLED
How can I get a list of all *registered* macros?I know how to get a list of
the XWiki.WikiMacroClass with the * Query Generator
http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Generator  *
extension, but it will not show if the macro is properly registered or not.I
also want to get the attributes of a registered macros such as source
document or built in, language...



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/List-all-registered-macros-tp7593652.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] Add date of account creation (without time) in User Index problem

2015-01-13 Thread Clemens Klein-Robbenhaar
On 01/13/2015 10:45 AM, Pascal BASTIEN wrote:
 Hello,
 
 To make it work I add this new property in XWiki.XWikiUsers class:
 /bin/edit/XWiki/XWikiUsers?editor=class
 Name: doc.creationDate Type: String
 PrettyName: Creation date
 

I did not know that you can create class properties with a dot in it,
and that this even can be used to get the original document property, but I see 
it indeed works

 Custom Display:
 {{velocity}}
 {{html}}i$value/i{{/html}}
 {{/velocity}}
 
 The problem is that Custom display is not taking into account and not 
 rendering.

This actually does not work, because the livetable ones not use the custom 
displayer at all,
but treats 'doc.creationDate' special

Possible solutions:

 1)
  - create a dummy class property, which does *not* shadow a doc-property,
   e.g. Name : doccreationdate, Type: Date

  CustomDisplay
  {{velocity}}
  $xwiki.formatDate($doc.getCreationDate(),'/MM/dd')
  {{/velocity}}

 so the custom display does not display the value of the property at all, but 
the actual creation date

 - add 'doccreationdate' to the list of columns in the User Directory

This kinda works, except that you cannot sort by that fake creation date, as 
it is not really there.
(The filter searching the database does not know about the custom displayer and 
searches for the empty value in the DB instead.)


2) Another alternative is to edit the place where doc.creationDate is 
actually rendered ...
for this you would have to patch the main livetable rendering.
see:

 http://localhost:8080/xwiki/bin/view/XWiki/LiveTableResultsMacros?viewer=code

around line 230 there is a:
   #set($discard = $row.put('doc_creationDate', 
$xwiki.formatDate($itemDoc.creationDate)))

you could change that to:
   #set($discard = $row.put('doc_creationDate', 
$xwiki.formatDate($itemDoc.creationDate, '/MM/dd')))

and then add doc.creationDate to the list of displayed columns in the user 
directory.

However then all creation dates everywhere (well, everywhere in live tables) 
will be rendered day only.
(Oh, and I see one still needs to add a dummy 'doc.creationDate' field to the 
user class, as otherwise the field is ignored :(


3) Finally the third solution I can think of would be to add a new date 
property to the user class,
and set this property to doc.creationDate whenever a user is created, and show 
this property in the User Directory
.
This might even be the cleanest solution, except that one needs to touch all 
existing users to update this field.

Newly created users then would be set up by writing an event listener that 
listens to a DocumentCreatingEvent
and if the new document has an XWiki.XWikiUsers object, then set the new 
property to doc.creaionDate

Event listener would be components as explained here:
  http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutorial
  http://extensions.xwiki.org/xwiki/bin/view/Extension/WikiComponent+Module

This is somewhat more effort, but I guess this would be cleaner (no custom 
display needed, just use the date format of that property,
results can be sorted, as value is really stored in the DB, no patching of 
core XWiki pages ...)


 I know HTML is not interpreted but I want to remove time of Creation date 
 field but Custom Display is apparently not used on a database field.
 Here a screenshot on what I want: http://snag.gy/bWnu9.jpg
 Do you have an idea how I must do it?
 Is it normal than Custom Display is not used?
 
 Thxs for any help
 
 Pascal BASTIEN
 
 
 ___
 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] Add date of account creation (without time) in User Index problem

2015-01-13 Thread Pascal BASTIEN
Hello,

To make it work I add this new property in XWiki.XWikiUsers class:
/bin/edit/XWiki/XWikiUsers?editor=class
Name: doc.creationDate Type: String
PrettyName: Creation date

Custom Display:
{{velocity}}
{{html}}i$value/i{{/html}}
{{/velocity}}

The problem is that Custom display is not taking into account and not 
rendering.
I know HTML is not interpreted but I want to remove time of Creation date 
field but Custom Display is apparently not used on a database field.
Here a screenshot on what I want: http://snag.gy/bWnu9.jpg
Do you have an idea how I must do it?
Is it normal than Custom Display is not used?

Thxs for any help

Pascal BASTIEN


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


Re: [xwiki-users] Context Macro Broken?

2015-01-13 Thread Thomas Mortagne
What you have in your example cannot work, you have to understand how
Velocity macro work: it executes the Velocity in the macro content and
then the result is parsed and executed as wiki syntax, Velocity engine
does not have any idea what {{context}} mean, its just plain text for
it and will end up in the result of Velocity execution as it is.

To make the context macro work in your use case you should cut your
Velocity macro in pieces, something like:

{{velocity}}
#panelheader('Product Wikis')
{{/velocity}}

[[Company Mainurl:http://172.30.29.50:8080/xwiki/bin/view/Main/]]

{{context document=wiki1:Main.WebHome}}{{velocity}}#if
($hasEdit)[[Wiki1wiki1:Main.WebHome]]#end{{/velocity}}{{/context}}

{{context document=wiki2:Main.WebHome}}{{velocity}}#if
($hasEdit)[[Wiki2wiki2:Main.WebHome]]#end{{/velocity}}{{/context}}

{{context document=wiki3:Main.WebHome}}{{velocity}}#if
($hasEdit)[[Wiki3wiki3:Main.WebHome]]#end{{/velocity}}{{/context}}

{{velocity}}
#panelfooter()
{{/velocity}}

But unless you use case if more complex than testing $hasEdit you
should use right service API instead of switching the context like
that, see 
http://extensions.xwiki.org/xwiki/bin/view/Extension/Security+Module#HScriptingAPI28since6.1RC129.

On Tue, Jan 13, 2015 at 10:09 AM, Hamster teun...@hotmail.com wrote:
 Does it work if you change...

 {{context document=wiki1:Main.WebHome}}#if
 ($hasEdit){{/context}}[[Wiki1wiki1:Main.WebHome]]#end

 ..to:

 {{context document=wiki1:Main.WebHome}}#if
 ($hasEdit)[[Wiki1wiki1:Main.WebHome]]#end{{/context}}



 --
 View this message in context: 
 http://xwiki.475771.n2.nabble.com/Context-Macro-Broken-tp7593647p7593648.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



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


Re: [xwiki-users] Context Macro Broken?

2015-01-13 Thread Thomas Mortagne
Actually you have to use security service since $hasEdit is not going
to change whatever you put in the context macro because this is just a
Velociy variable set before this page is executed, it's not resetted
by context macro.

On Tue, Jan 13, 2015 at 1:17 PM, Thomas Mortagne
thomas.morta...@xwiki.com wrote:
 What you have in your example cannot work, you have to understand how
 Velocity macro work: it executes the Velocity in the macro content and
 then the result is parsed and executed as wiki syntax, Velocity engine
 does not have any idea what {{context}} mean, its just plain text for
 it and will end up in the result of Velocity execution as it is.

 To make the context macro work in your use case you should cut your
 Velocity macro in pieces, something like:

 {{velocity}}
 #panelheader('Product Wikis')
 {{/velocity}}

 [[Company Mainurl:http://172.30.29.50:8080/xwiki/bin/view/Main/]]

 {{context document=wiki1:Main.WebHome}}{{velocity}}#if
 ($hasEdit)[[Wiki1wiki1:Main.WebHome]]#end{{/velocity}}{{/context}}

 {{context document=wiki2:Main.WebHome}}{{velocity}}#if
 ($hasEdit)[[Wiki2wiki2:Main.WebHome]]#end{{/velocity}}{{/context}}

 {{context document=wiki3:Main.WebHome}}{{velocity}}#if
 ($hasEdit)[[Wiki3wiki3:Main.WebHome]]#end{{/velocity}}{{/context}}

 {{velocity}}
 #panelfooter()
 {{/velocity}}

 But unless you use case if more complex than testing $hasEdit you
 should use right service API instead of switching the context like
 that, see 
 http://extensions.xwiki.org/xwiki/bin/view/Extension/Security+Module#HScriptingAPI28since6.1RC129.

 On Tue, Jan 13, 2015 at 10:09 AM, Hamster teun...@hotmail.com wrote:
 Does it work if you change...

 {{context document=wiki1:Main.WebHome}}#if
 ($hasEdit){{/context}}[[Wiki1wiki1:Main.WebHome]]#end

 ..to:

 {{context document=wiki1:Main.WebHome}}#if
 ($hasEdit)[[Wiki1wiki1:Main.WebHome]]#end{{/context}}



 --
 View this message in context: 
 http://xwiki.475771.n2.nabble.com/Context-Macro-Broken-tp7593647p7593648.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



 --
 Thomas Mortagne



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


Re: [xwiki-users] Add date of account creation (without time) in User Index problem

2015-01-13 Thread Clemens Klein-Robbenhaar

On 01/13/2015 03:05 PM, Pascal BASTIEN wrote:
 Thxs a lot to explained me with clarity all of that and help me to understand 
 better XWiki.
 Then with what you give me, I tried to add a  format_date parameter () (or 
 regexp) in columns properties to improve livetable.
 I failed because I didn't manage to find where is store livetable macro :-))
 
 Something like this and next add a format date parameter in user index 
 customizer.
 #set($columns = [_avatar, first_name, last_name, email, 
 doc.creationDate, _actions])
 #set($columnsProperties = {
_avatar : { type : none, link : none, html : true, 
 sortable:false },
first_name : { type : text , size : 20, link : view},
last_name : { type : text, link : view},
email : { type : text },
 doc.creationDate : { type : date, dateformat:-mm }
 })

I am afraid that this does not work.
The supported options are documented here:

  http://extensions.xwiki.org/xwiki/bin/view/Extension/Livetable+Macro

and a 'dateformat' option is unfortunately not part of it.

The problem is that in the end the #livetable macro turns out to make an AJAX 
call
to the code at the page XWiki.LiveTableResults ,  which in turn uses the 
XWiki.LiveTableResultsMacros
and the latter just calls  $xwiki.formatDate($itemDoc.creationDate)) without 
any custom format.

What you can to is:

 - either again patch that line of code in the XWiki.LiveTableResultsMacros 
with a date format of your choice

 - or modify the results afterwards, as explained  
http://extensions.xwiki.org/xwiki/bin/view/Extension/Livetable+Macro#HCustomJSON
   (scroll down to the Starting with XWiki Enterprise 4.0 you can modify the 
default JSON ...)

the later would involve creating your own livetable result page, i.e. 
XWiki.LiveTableResultsNoTime
with e.g. the contents:

{{include reference=XWiki.LiveTableResultsMacros /}}

{{velocity wiki=false}}
#if($!{request.xpage} == 'plain')
 $response.setContentType('application/json')
#end
##==
## Initialize the map that will store the JSON data.
##==
#set($map = {})
##==
## Build the JSON in memory using the previous map
##==
#gridresult_buildJSON($!request.classname $request.collist.split(',') $map)
##==
## Modify the JSON data from the map or add new data.
##==
#foreach($row in $map.get('rows'))
 #if($row.get('doc_creationDate'))
#set($creation_date = $row.get('doc_creationDate'))
#set($time_sep_index = $creation_date.indexOf(' '))
#if($time_sep_index =0)
  #set($creation_date_without_time = $creation_date.substring(0, 
$time_sep_index))
  #set($discard = $row.put('doc_creationDate', $creation_date_without_time 
))
#end
 #end
#end
##==
## Serialize the map in the JSON format.
##==
$jsontool.serialize($map)
{{/velocity}}

this mostly copy  paste from the LiveTable docs, expect for the Modify the 
JSON data ... part,
where the creation date field is simply cut off after the first space - quite 
hackish, but should work
for most date formats.

Now when calling that page to get the results, everything must be put inside 
the 'url' option
so the $options change to:

#set($options = {
  url : $xwiki.getURL('XWiki.LiveTableResultsNoTime', 'get', 
'outputSyntax=plainclassname=XWiki.XWikiUserstransprefix=xe.userdirectory.collist=_avatar,first_name,last_name,email,doc.creationDate'),
  rowCount: 10
})

Afterwards it is just a matter of a few hours debugging with firebug etc until 
one finds the missing ')' or '' that keeps things from working ;)


Oh, and come to think of it, the simplest solution would be to change
the XWiki date format the XWiki Admin to exclude the time - that would remove
the time everywhere, but I know people who actually like it. ;)


 #set($options = {
   className:XWiki.XWikiUsers,
   translationPrefix : xe.index.users.,
   tagCloud : true,
   rowCount: 10
 })
 #livetable(userdirectory $columns $columnsProperties $options)
[...]
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Add date of account creation (without time) in User Index problem

2015-01-13 Thread Pascal BASTIEN
Yes I know that format_date parameter doesn't exist for the moment :-), I 
wanted to improve livetable macro (with pull request at the end I hope). I 
think I find where this macro 
is:https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/src/main/resources/flamingo/macros.vmLine
 1261
#macro(livetable $divid $collist $colprops $options)
I saw the Modify the JSON data ... solution but afraid about ...since it 
would slow down your wiki a lot as it loads DocThxs

  De : Clemens Klein-Robbenhaar c.robbenh...@espresto.com
 À : users@xwiki.org 
 Envoyé le : Mardi 13 janvier 2015 16h10
 Objet : Re: [xwiki-users] Add date of account creation (without time) in User 
Index problem
   

On 01/13/2015 03:05 PM, Pascal BASTIEN wrote:
 Thxs a lot to explained me with clarity all of that and help me to understand 
 better XWiki.
 Then with what you give me, I tried to add a  format_date parameter () (or 
 regexp) in columns properties to improve livetable.
 I failed because I didn't manage to find where is store livetable macro :-))
 
 Something like this and next add a format date parameter in user index 
 customizer.
 #set($columns = [_avatar, first_name, last_name, email, 
 doc.creationDate, _actions])
 #set($columnsProperties = {
    _avatar : { type : none, link : none, html : true, 
sortable:false },
    first_name : { type : text , size : 20, link : view},
    last_name : { type : text, link : view},
    email : { type : text },
    doc.creationDate : { type : date, dateformat:-mm }
 })

I am afraid that this does not work.
The supported options are documented here:

  http://extensions.xwiki.org/xwiki/bin/view/Extension/Livetable+Macro

and a 'dateformat' option is unfortunately not part of it.

The problem is that in the end the #livetable macro turns out to make an AJAX 
call
to the code at the page XWiki.LiveTableResults ,  which in turn uses the 
XWiki.LiveTableResultsMacros
and the latter just calls  $xwiki.formatDate($itemDoc.creationDate)) without 
any custom format.

What you can to is:

 - either again patch that line of code in the XWiki.LiveTableResultsMacros 
with a date format of your choice

 - or modify the results afterwards, as explained  
http://extensions.xwiki.org/xwiki/bin/view/Extension/Livetable+Macro#HCustomJSON
  (scroll down to the Starting with XWiki Enterprise 4.0 you can modify the 
default JSON ...)

the later would involve creating your own livetable result page, i.e. 
XWiki.LiveTableResultsNoTime
with e.g. the contents:

{{include reference=XWiki.LiveTableResultsMacros /}}

{{velocity wiki=false}}
#if($!{request.xpage} == 'plain')
 $response.setContentType('application/json')
#end
##==
## Initialize the map that will store the JSON data.
##==
#set($map = {})
##==
## Build the JSON in memory using the previous map
##==
#gridresult_buildJSON($!request.classname $request.collist.split(',') $map)
##==
## Modify the JSON data from the map or add new data.
##==
#foreach($row in $map.get('rows'))
 #if($row.get('doc_creationDate'))
    #set($creation_date = $row.get('doc_creationDate'))
    #set($time_sep_index = $creation_date.indexOf(' '))
    #if($time_sep_index =0)
      #set($creation_date_without_time = $creation_date.substring(0, 
$time_sep_index))
      #set($discard = $row.put('doc_creationDate', $creation_date_without_time 
))
    #end
 #end
#end
##==
## Serialize the map in the JSON format.
##==
$jsontool.serialize($map)
{{/velocity}}

this mostly copy  paste from the LiveTable docs, expect for the Modify the 
JSON data ... part,
where the creation date field is simply cut off after the first space - quite 
hackish, but should work
for most date formats.

Now when calling that page to get the results, everything must be put inside 
the 'url' option
so the $options change to:

#set($options = {
  url : $xwiki.getURL('XWiki.LiveTableResultsNoTime', 'get', 
'outputSyntax=plainclassname=XWiki.XWikiUserstransprefix=xe.userdirectory.collist=_avatar,first_name,last_name,email,doc.creationDate'),
  rowCount: 10
})

Afterwards it is just a matter of a few hours debugging with firebug etc until 
one finds the missing ')' or '' that keeps things from working ;)


Oh, and come to think of it, the simplest solution would be to change
the XWiki date format the XWiki Admin to exclude the time - that would remove
the time everywhere, but I know people who actually like it. ;)




 #set($options = {
  className:XWiki.XWikiUsers,
  translationPrefix : xe.index.users.,
  tagCloud : true,
  rowCount: 10
 })
 #livetable(userdirectory $columns $columnsProperties $options)
[...]
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


  
___
users mailing list
users@xwiki.org

Re: [xwiki-users] Context Macro Broken?

2015-01-13 Thread cmherman
I can't believe I didn't state my version. Geez.

Enterprise 6.3

Posting the JIRA issue link for reference: 
http://jira.xwiki.org/i#browse/XE-1459
http://jira.xwiki.org/i#browse/XE-1459  



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Context-Macro-Broken-tp7593647p7593664.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] XWiki utility for stripping HTML

2015-01-13 Thread Bryn Jeffries
I have a Groovy script that takes input from a form textarea. I'd like to 
prevent html (and JS) markup from being submitted and, if HTML is submitted, 
strip it out. Is there a tool already packaged within XWiki to do this, or 
should I look to an external package like Jericho?

Thanks,

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