Hi Piotr,
On Tue, Feb 1, 2011 at 15:00, Piotr Dziubecki <deepres(a)man.poznan.pl> wrote:
Hello,
thank you for your tips, with your help and a little googling I came to the
point I'm able to create a new
FAQ entry with the velocity code. Could someone review it - it works fine,
but maybe I'm doing something not
along with the xwiki design:
{{velocity}}
#if("$!request.engage" != '')
#set($uniqueName = "FAQ.aid_"+ ${util.generateRandomString(10)})
#set($ok = $xwiki.copyDocument("FAQ.FAQEntryTemplate", $uniqueName))
#set($newDocument = $xwiki.getDocument($uniqueName))
$newDocument.setParent("FAQ.WebHome")
$newDocument.setTitle("FAQ Entry")
#set($obj = $newDocument.getObject("FAQ.FAQEntryClass",0))
$obj.set("question","Piotr Dziubecki")
$obj.set("answer","ttt111234")
$newDocument.save()
#end
{{html}}
<form action="" id="newdoc" method="post">
<div>
<input type="hidden" name="engage" value="make it
so" class="withTip"
size="50"/>
<span class="buttonwrapper"><input type="submit"
value="New FAQ
Entry" class="button"/></span>
</div>
</form>
{{/html}}
{{/velocity}}
Also, I can write a new one or extend the FAQ tutorial if you want, I think
that this example could be
useful for the others as well.
Sure, please feel free to do that. You can create an account on
and then edit the FAQ tutorial page.
Guillaume
Now I'm getting to the phase of processing that excel file. You wrote:
What you can do is to use an Excel file, attach
it to a document inside
your
XWiki Enterprice instance, then get it with
Velocity, parse its content
(line by line) and inject the data into your instance.
Could you give me some initial clues about how to do that ? I tried to look
at the online API but it seems
that every link on that site is offline:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/API/
http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/co…
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance
downtime or capacity problems.
Please try again later.
Ok, so thank you for your help and I'm counting on some initial clues about
how to parse attachment's
content ( especially the one from Excel, but it could be csv if the Excell
is extra hard to use or something ).
Thanks,
Piotr
W dniu 11-01-31 15:03, Raluca Stavro wrote:
Hello,
On Mon, Jan 31, 2011 at 11:45 AM, Piotr Dziubecki<deepres(a)man.poznan.pl
wrote:
> Dear all,
>
> I'm trying to extend a FAQ application from the tutorial on xwiki site.
>
> I would like to add some FAQ entries from the external file in an
automated
> or semi-automated way.
>
> In the FAQ example there are: question, answer fields for every FAQ
entry.
Is it
possible to add new entries
basing on the external data user provided ?
like to take a data from a text area in a form like:
"question1", "answer1"
"question2", "answer2"
and then create 2 new FAQ objects ?
I've found such a code snippet and fixed it to have:
## Create an object
#set($obj = $doc.newObject("FAQ.FAQClass"))
$obj.set("question","q1")
$obj.set("answer", "a1")
## Save the object in the page
$doc.save()
As long as you have edit rights on the current document ($doc), the code
above should work fine.
Are you sure FAQ.FAQClas exists?
>
> Even with that it fails to add new object to the existing list. Any
clues
> how to accomplish that ?
>
> Just to recap, I have two questions :
>
> 1. Could someone provide a code snippet, or point me to a documentation
on
creating/adding new objects in
the xwiki ( like how to set parentSpace, basic fields in that object and
add it to the xwiki database ).
Check out the documentation for the current API:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/API/ .
For example, in order to set the parent of the current document, the
following code lines:
$doc.setParent('ParentSpaceName.ParentPageName')
$doc.save()
should do the trick.
>
> 2. Are there any scenarios on importing data in to the XWiki ( would
like
> to inject a lot of FAQ entries at
> once, tried to do that directly to the database but that failed, I guess
I
should do
that via velocity code ? ).
What you can do is to use an Excel file, attach it to a document inside
your
XWiki Enterprice instance, then get it with
Velocity, parse its content
(line by line) and inject the data into your instance.
Raluca.
Thanks a lot for any help :)
Regards,
Piotr
_______________________________________________
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
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users