Hi, I'm asking for help again.

I need to globally override how the names for documents are created.
By design/default the name is taken from title 1:1, which user enters when
she creates the page.

I would like to have url friendly names. How can I achieve this? Overriding
some component or what?

I noticed that for example FAQ application enables to create FAQs using
their UI with some code-behind, which uses this two lines of code:
#set ($newFAQReference = $services.model.createDocumentReference('', '',
"$question"))
$response.sendRedirect($xwiki.getURL($newFAQReference, 'inline',
"$!{request.queryString}&title=${escapetool.url($question)}"))

There are two options, either override createDocumentReference or override
the $xwiki.getUrl() method. This would probably solve all points, where is
some logic with creating pages.

Thanks

Best regards
Miroslav Galajda

On 6 September 2016 at 11:01, Miroslav Galajda <miroslav.gala...@gmail.com>
wrote:

> Hi, this is nice proposal, but I think this is just another workarround.
> It is not directly solving the problem and user have to think about it,
> when sharing the url.
> It is not straightforward and requires the user to work differently with
> urls in xwiki, different when browsing the other web sites.
>
> I would not force the user to think/to behave differently in xwiki. Please
> think about it. How you work with urls, you just simple copy and paste it
> to email, chat or other applications.
> The better would be to have url to be stripped out of the special url
> non-friendly characters when creating or renaming the page and you don't
> have to care about special handling urls after that. This is more suitable
> solution as it doesn't force the user to care about how to name the page or
> how to share the page. I hope you will have simmilar view on the matter.
>
> Best regards
> Mirec
>
> On 6 September 2016 at 10:45, Vincent Massol <vinc...@massol.net> wrote:
>
>>
>> > On 06 Sep 2016, at 10:19, Miroslav Galajda <miroslav.gala...@gmail.com>
>> wrote:
>> >
>> > Hi Vincent, yes the stripping would occure at the document creating
>> time,
>> > or when renaming the page.
>> >
>> > The workarround for this would be to have the user always think that
>> when
>> > creating the new page, enter the name without accents and without spaces
>> > and consequently change the page title to a desired name.
>> > Other way is to go to the rename page action, and there carrefully
>> change
>> > the page name and not page title, this is little tricky.
>> >
>> > The main reason for this is that the encoded urls looks ugly when
>> sharing
>> > it and copying directly to clipboard it out of the xwiki.
>>
>> ok that’s something for which I’d like to provide some option for.
>>
>> Some ideas:
>>
>> * Introduce the concept of alias, i.e. be able to have different URLs
>> pointing to the same document/page. Thus for example if you have some long
>> URL such as http://mywiki/…/page1/page2/…/pageN you would be able to
>> create an alias such as http://mywiki/…/MyNicePage and share it outside
>> of XWiki. This is http://design.xwiki.org/xwiki/
>> bin/view/Proposal/DocumentAliases
>>
>> * Introduce an extension that generates tinyurl-like URLs for any page
>> and that you can share (optionally allow the user to specify a suffix to
>> make the url recognizable, same as on http://tinyurl.com/). Basically
>> this is the same as using directly http://tinyurl.com/ but easier for
>> the user since he’d be able to get the URL directly from the xwiki UI
>> somewhere.
>>
>> Now I think it would be nice to offer an extension point in the Create
>> dialog box so that it can be extended safely and be used to transform the
>> input of the user (remove special chars, automatically append some text,
>> etc). This would be the first step. Second step could be to offer a
>> sanitize feature that could be configured in the Admin, using this
>> mechanism (it would be off by default).
>>
>> IMO you could create a jira issue for this.
>>
>> Thanks
>> -Vincent
>>
>> > On 6 September 2016 at 09:22, Vincent Massol <vinc...@massol.net>
>> wrote:
>> >
>> >> Hi Miroslav,
>> >>
>> >>> On 06 Sep 2016, at 09:04, Miroslav Galajda <
>> miroslav.gala...@gmail.com>
>> >> wrote:
>> >>>
>> >>> Hi, does anyone have idea, how to automatically modify/generate url
>> from
>> >>> page title so that the url doesn't contains accents or any special
>> >>> characters. I want to achieve simmilar approach used in CMS system
>> >> Umbraco.
>> >>> Which creates url based on page title but strips spaces and any
>> >> characters
>> >>> that requires url encoding.
>> >>>
>> >>> I've found xwiki.urlfactory.serviceclass in xwiki.cfg. What is
>> >>> responsibility of that class? What is it purpose? Can it be used to
>> solve
>> >>> my requirement?
>> >>
>> >> XWiki supports lots of languages out of the box (you just need to
>> >> configure the encoding properly). Actually we’ve gone to great length
>> to
>> >> ensure that any character is valid in page and space names! :)
>> >>
>> >> May I ask why you would want to strip some characters?
>> >>
>> >> Now you shouldn’t act at the level of the URLs since the URLs are just
>> >> used to find the corresponding document in XWiki. If you strip some
>> char
>> >> from the URL then you won’t be able to point a URL to an existing
>> document
>> >> anymore ;)
>> >>
>> >> So what you really want is instead to act at the level of document
>> >> creation (the Add Page dialog box) and do the stripping there IMO.
>> >>
>> >> However ATM we don’t provide any extension point for doing this so
>> you’d
>> >> need to modify the corresponding vm file (create.vm I think, which
>> calls
>> >> other vms) and do future merges of that file by hand whenever you
>> upgrade
>> >> your XWiki instance in the future.
>> >>
>> >> I recommend to reconsider going in that direction and instead letting
>> >> XWiki handle all chars.
>> >>
>> >> Thanks
>> >> -Vincent
>> >>
>> >>> Thanks
>> >>> Mirec
>> >>>
>> >>>
>> >>> On 11 July 2016 at 21:58, Miroslav Galajda <
>> miroslav.gala...@gmail.com>
>> >>> wrote:
>> >>>
>> >>>> Hi, I’m using XWiki in Slovak language which uses accents, which
>> >>>> consequently causes problems with urls. The urls becomes ugly
>> containing
>> >>>> encoded characters with accents. Does XWiki have integration point
>> out
>> >> of
>> >>>> the box to replace the page name with custom one, with stripped
>> accents
>> >>>> from it?
>> >>>>
>> >>>> Thank you
>> >>>>
>> >>>> Mirec
>>
>> _______________________________________________
>> users mailing list
>> users@xwiki.org
>> http://lists.xwiki.org/mailman/listinfo/users
>>
>
>

Reply via email to