[xwiki-users] Setting page name from field data
This is my first post so, hello everyone! I've been using xwiki for a few years but only now am I starting to have a play with applications. When creating a new document in an application, the user needs to enter a name before actually entering data in whatever fields have been defined. My question is, could I setup my application in such a way that the name of the new document would be defined by information in the fields. Basically skipping the whole Document name input phase. I've spent a good few hours browsing through this mailing list but could not find an answer to this particular problem. Thanks, Pedro
Hi Pedro, On 2 Mar 2014 at 21:05:49, Pedro Neto ([email protected](mailto:[email protected])) wrote:
This is my first post so, hello everyone!
I've been using xwiki for a few years but only now am I starting to have a play with applications.
When creating a new document in an application, the user needs to enter a name before actually entering data in whatever fields have been defined.
My question is, could I setup my application in such a way that the name of the new document would be defined by information in the fields. Basically skipping the whole Document name input phase.
I've spent a good few hours browsing through this mailing list but could not find an answer to this particular problem.
It seems what you’re after is how to create a new document programatically. See http://platform.xwiki.org/xwiki/bin/view/DevGuide/APIGuide#HCreateanewDocume... Thanks -Vincent Note to self: We need to add an example/tutorial/guide for creating forms on http://platform.xwiki.org/xwiki/bin/view/DevGuide/ (we have http://platform.xwiki.org/xwiki/bin/view/DevGuide/Creating+a+form+with+valid... but we need a simpler tutorial for creating simple forms too).
Hi Vincent, Thanks for your quick reply.
From what I understand I'll have to create a new layer to handle this. A one-document application to handle the creation of document entries on my original application. Is this correct?
Best regards, Pedro On Mon, Mar 3, 2014 at 8:15 AM, [email protected] <[email protected]>wrote:
Hi Pedro,
On 2 Mar 2014 at 21:05:49, Pedro Neto ([email protected](mailto: [email protected])) wrote:
This is my first post so, hello everyone!
I've been using xwiki for a few years but only now am I starting to have a play with applications.
When creating a new document in an application, the user needs to enter a name before actually entering data in whatever fields have been defined.
My question is, could I setup my application in such a way that the name of the new document would be defined by information in the fields. Basically skipping the whole Document name input phase.
I've spent a good few hours browsing through this mailing list but could not find an answer to this particular problem.
It seems what you're after is how to create a new document programatically.
See http://platform.xwiki.org/xwiki/bin/view/DevGuide/APIGuide#HCreateanewDocume...
Thanks -Vincent
Note to self: We need to add an example/tutorial/guide for creating forms on http://platform.xwiki.org/xwiki/bin/view/DevGuide/ (we have http://platform.xwiki.org/xwiki/bin/view/DevGuide/Creating+a+form+with+valid... we need a simpler tutorial for creating simple forms too).
Hello I think there are a wrong regexp in sendmail function in templates/shareinline.vm (xwiki 5.4.1) #if ($serverName.matches('\[.*\]|(\d{1,3}+\.){3}+\d{1,3}+')) #if ("$!{xwiki.getXWikiPreference('admin_email')}" != '') #set ($sender = "$!{escapetool.q($sender)} <$!{xwiki.getXWikiPreference('admin_email')}>") #else #set ($sender = "$!{escapetool.q($sender)} <[email protected]>") #end #else #set ($sender = "$!{escapetool.q($sender)} <noreply@$!{serverName}>") #end I filled admin_email and my my nameserver is "iwiki.cp2i.i2" but i tried with "iwiki.cp2i.fr" to. I don't understand very well the regexp (writing a regexp is simpler to read it) but when I send a mail with xwiki I felt in "#set ($sender = "$!{escapetool.q($sender)} <noreply@$!{serverName}>")" condition... Pascal B
Hello Pascal.
From what I understand, this regex validates either:
- A server name with brackets, so yours would be "[iwiki.cp2i.i2]" - An IP address (4 groups of 1 to 3 digits, dot separated) So maybe it will work if you add brackets to your server name? And yes, I find it a bit strange, me too. :-) Hope it helps, Guillaume Fenollar 2014-03-04 11:28 GMT+01:00 Pascal BASTIEN <[email protected]>:
Hello
I think there are a wrong regexp in sendmail function in templates/shareinline.vm (xwiki 5.4.1)
#if ($serverName.matches('\[.*\]|(\d{1,3}+\.){3}+\d{1,3}+')) #if ("$!{xwiki.getXWikiPreference('admin_email')}" != '') #set ($sender = "$!{escapetool.q($sender)} <$!{xwiki.getXWikiPreference('admin_email')}>") #else #set ($sender = "$!{escapetool.q($sender)} <[email protected]>") #end #else #set ($sender = "$!{escapetool.q($sender)} <noreply@$!{serverName}>") #end
I filled admin_email and my my nameserver is "iwiki.cp2i.i2" but i tried with "iwiki.cp2i.fr" to.
I don't understand very well the regexp (writing a regexp is simpler to read it) but when I send a mail with xwiki I felt in "#set ($sender = "$!{escapetool.q($sender)} <noreply@$!{serverName}>")" condition...
Pascal B _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
[...] is how IPv6 IPs are written. So the regexp detects if the hostname is an IPv4 or an IPv6 raw IP. The current logic is: is the server name an IP? ├ yes: is there a valid admin_email configured? │ ├ yes: use the admin_email │ └ no: use a generic nodomain.net └ no: use the actual domain name What you want: - always use the configured admin_email The only way to do that is to change the shareinline.vm template (see http://platform.xwiki.org/xwiki/bin/view/DevGuide/Skins for details about how to properly override a template) and change the order of the conditions. On 03/04/2014 11:26 AM, Guillaume Fenollar wrote:
Hello Pascal. From what I understand, this regex validates either:
- A server name with brackets, so yours would be "[iwiki.cp2i.i2]" - An IP address (4 groups of 1 to 3 digits, dot separated)
So maybe it will work if you add brackets to your server name? And yes, I find it a bit strange, me too. :-)
Hope it helps,
Guillaume Fenollar
2014-03-04 11:28 GMT+01:00 Pascal BASTIEN <[email protected]>:
Hello
I think there are a wrong regexp in sendmail function in templates/shareinline.vm (xwiki 5.4.1)
#if ($serverName.matches('\[.*\]|(\d{1,3}+\.){3}+\d{1,3}+')) #if ("$!{xwiki.getXWikiPreference('admin_email')}" != '') #set ($sender = "$!{escapetool.q($sender)} <$!{xwiki.getXWikiPreference('admin_email')}>") #else #set ($sender = "$!{escapetool.q($sender)} <[email protected]>") #end #else #set ($sender = "$!{escapetool.q($sender)} <noreply@$!{serverName}>") #end
I filled admin_email and my my nameserver is "iwiki.cp2i.i2" but i tried with "iwiki.cp2i.fr" to.
I don't understand very well the regexp (writing a regexp is simpler to read it) but when I send a mail with xwiki I felt in "#set ($sender = "$!{escapetool.q($sender)} <noreply@$!{serverName}>")" condition...
-- Sergiu Dumitriu http://purl.org/net/sergiu
Of course I modify shareinline.vm to use xwiki.getXWikiPreference('admin_email') value. But I think your test must be: is there a valid admin_email configured? (regexp to verify the mail format) ├ yes: use the admin_email └ no :is the server name an IP? └ yes: use a generic nodomain.net └ no: use the actual domain name ... but it is my advice :-) Thxs for yours answers. ________________________________ De : Sergiu Dumitriu <[email protected]> À : [email protected] Envoyé le : Mardi 4 mars 2014 19h27 Objet : Re: [xwiki-users] Wrong regexp in sendmail function? [...] is how IPv6 IPs are written. So the regexp detects if the hostname is an IPv4 or an IPv6 raw IP. The current logic is: is the server name an IP? ├ yes: is there a valid admin_email configured? │ ├ yes: use the admin_email │ └ no: use a generic nodomain.net └ no: use the actual domain name What you want: - always use the configured admin_email The only way to do that is to change the shareinline.vm template (see http://platform.xwiki.org/xwiki/bin/view/DevGuide/Skins for details about how to properly override a template) and change the order of the conditions. On 03/04/2014 11:26 AM, Guillaume Fenollar wrote:
Hello Pascal.
From what I understand, this regex validates either:
- A server name with brackets, so yours would be "[iwiki.cp2i.i2]" - An IP address (4 groups of 1 to 3 digits, dot separated)
So maybe it will work if you add brackets to your server name? And yes, I find it a bit strange, me too. :-)
Hope it helps,
Guillaume Fenollar
2014-03-04 11:28 GMT+01:00 Pascal BASTIEN <[email protected]>:
Hello
I think there are a wrong regexp in sendmail function in templates/shareinline.vm (xwiki 5.4.1)
#if ($serverName.matches('\[.*\]|(\d{1,3}+\.){3}+\d{1,3}+')) #if ("$!{xwiki.getXWikiPreference('admin_email')}" != '') #set ($sender = "$!{escapetool.q($sender)} <$!{xwiki.getXWikiPreference('admin_email')}>") #else #set ($sender = "$!{escapetool.q($sender)} <[email protected]>") #end #else #set ($sender = "$!{escapetool.q($sender)} <noreply@$!{serverName}>") #end
I filled admin_email and my my nameserver is "iwiki.cp2i.i2" but i tried with "iwiki.cp2i.fr" to.
I don't understand very well the regexp (writing a regexp is simpler to read it) but when I send a mail with xwiki I felt in "#set ($sender = "$!{escapetool.q($sender)} <noreply@$!{serverName}>")" condition...
-- Sergiu Dumitriu http://purl.org/net/sergiu _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (5)
-
Guillaume Fenollar -
Pascal BASTIEN -
Pedro Neto -
Sergiu Dumitriu -
vincent@massol.net