Re: [xwiki-users] RSS feeds for Space-specific blogs

2015-02-05 Thread Clemens Klein-Robbenhaar
On 02/03/2015 06:07 PM, Jamal wrote:
 Hi,
 
 I've set up a blog for a single space using the blog inside an existing
 space option, so the blog URL is .../xwiki/bin/view/MySpace/Blog
 
 As per the documentation, I added the following line to the HTTP Meta Info
 section in the space's admin options:
 
 link rel=alternate type=application/rss+xml title=Blog RSS Feed
 href=$xwiki.getURL('Blog.BlogRss', 'view', 'xpage=plain') /
 
 Now how do I generate an RSS feed for only the space blog?
 
 When I try .../xwiki/bin/view/MySpace/Blog/BlogRss?xpage=plain I get an
 unformatted HTML page.
 
 What am I doing wrong?
 

 You are trying to glue things together in a way that does not work.
The URL for viewing pages always has a form like xwiki/bin/view/SPACE/PAGE
you cannot use it to resolve to xwiki/bin/view/SPACE/PAGE/VIEW or the 
like.

Instead you will have the call the 'Blog.BlogRSS' page and try to see
if you can somehow cause it to display entries from a different blog but the 
main one.

So if you look at the code in the page Blog.BlogRss at
 http://localhost:8080/xwiki/bin/view/Blog/BlogRss?viewer=code

You can see it includes macros from a page Blog.RssCode
and the first macro to be executed is '#getTargetBlog' ... this sounds 
promising :)

If you check the actual velocity macro code in 
http://localhost:8080/xwiki/bin/view/Blog/RssCode?viewer=code, you can see the 
Blog to be listed is fetched from the 'blog' request parameter.

So in your case you should be able to say:

 link rel=alternate type=application/rss+xml title=Blog RSS Feed 
href=$xwiki.getURL('Blog.BlogRss', 'view', 'xpage=plainblog=MySpace.Blog') /

I have to admit I have not tried if it really works, but I think it should ;)

Cheers
Clemens

 Thanks,
 
 J
 
 
 
 --
 View this message in context: 
 http://xwiki.475771.n2.nabble.com/RSS-feeds-for-Space-specific-blogs-tp7593861.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
 
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Server side validation / block save

2015-02-05 Thread Clemens Klein-Robbenhaar
On 02/03/2015 04:57 PM, Jason Clemons wrote:
 bump...please help :)
 
 On Jan 30, 2015, at 10:50 AM, Jason Clemons jason.clem...@live.com wrote:

 Hello all, 



 I'm hoping someone can give me a suggestion to save my skin.  When I was
 brand new to xwiki I quickly created an application for ticketing using
 AppWithinMinutes because it seemed like the easiest way for a newbie to
 create an application.  In doing so I created a form which had several
 controls on it (e.g.. around 20 or so).  In order to maintain business logic
 I wrote EXTENSIVE JavaScript which enforces business rules and prevents a
 save (basically cancelling the postback through JavaScript) if they aren't
 met.  Admittedly this isn't that great of a solution as now I'm having
 problems with JavaScript failures (mostly with other libraries being loaded
 with xwiki which prevents my JavaScript from running) which then allow the
 pages to be saved despite validation failures.   



 What I'm hoping is that there is some way to shim some server side code in
 using an event listener, or some sort of before save event in velocity or
 groovy that can evaluate the submitted page and prevent a save if the
 business logic rules are broken.  



 I don't really have the luxury of re-writing or refactoring the solution
 I've written because it's in production at this point and works 95% of the
 time, but I definitely need to do more in relation to validation since
 broken rules cause downstream impacts to other applications relying on clean
 data.  



 So, any help is GREATLY appreciated.  I have seen this
 http://platform.xwiki.org/xwiki/bin/view/DevGuide/Creating+a+form+with+valid
 ation+and+tooltips and reviewed it, but I can't really figure out how I
 would use it with an existing page or with AppWithinMinutes.  


There is no inherent magic in AppWithingMinutes created pages,
you can edit the generated pages the same as manually created ones.
(There is no guarantee these modifications will survive if you change the data 
structure via AppWithinMinutes;
I remember there is a step in the wizard which asks you if the wizard can update
the sheets - this is the place where the wizard lets you know the changes get 
lost ;))


So, anyway, ou should have a space containing your AppCode ... and there 
should be  the Sheet page containing the code for viewing your items, which 
includes the edit view.
If looking in the DocumentIndex for the page, it is one of these ending with 
Sheet ;) and yes, it is hidden, so fix up your settings first.

There you can add a input type=hidden name=xvalidation 
value=AppName.ValidationGroovy / in the part
which has a #if($xcontext.action =='edit')
and then create your  AppName.ValidationGroovy  script as advertised in the 
tutorial.







 Also, I already have an event listener configured which does some stuff that
 I might be able to use for this purpose.. but I think those events
 (DocumentCreatedEvent() and DocumentUpdatedEvent()) happens AFTER the save
 and I haven't really been able to find a way to block the save if it does
 happen before anyway.. 


There is also a DocumentCreatingEvent and DocumentUpdatingEvent
However listening to these event will not prevent the creation / update from 
happening, I think;
i.e. you cannot prevent saving a document from an event listener, but only 
update
some values that need to be automagically set before saving.





 I would need to invoke validation on save and update of documents too.. I'm
 hoping there might be some way of adding code to the AppWithinMinutes
 generated page that can do some post save validation and stop the save if it
 fails. 



 So help !!! :)



 ___
 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
 



hth

Clemens

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


Re: [xwiki-users] RSS feeds for Space-specific blogs

2015-02-05 Thread Jamal
OK, I see now. That' a nice, concise explanation. Thanks for taking the time
to walk me through that, Clemens. I'll give it a try shortly.



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/RSS-feeds-for-Space-specific-blogs-tp7593861p7593878.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