Re: [xwiki-users] Memorize objects

2007-10-18 Thread David Israel
This example -
http://objectwebcon06.objectweb.org/xwiki/bin/view/XWiki/CFP?xpage=codedoes

#set($xwiki2 = $xwiki.xWiki)
 #set($context2 = $context.context)
 ## ID
 #set ($sql = select max(prop.value) from BaseObject as obj,
LongProperty as prop where obj.className='XWiki.CFPClass' and prop.name='id'
and obj.id=prop.id.id)
 #set($id=1)
 #foreach ($item in $xwiki.search($sql))
   #set($id=$item.intValue() + 1)
 #end
 #set($newdoc = $xwiki2.getDocument(CFP.No${id}, $context2))
 $xwiki2.saveDocument($newdoc, $context2)

I'm not sure exactly what you were attempting to do but maybe this trick of
getting the internal xWiki and context and using them for saveDocument can
help you.  My use case also requires doing fancy things with objects so
please help out the documentation if you are successful!

David

On 10/18/07, Vitantonio Messa [EMAIL PROTECTED] wrote:

 Ok, thanks. I'll go and have a look.

 Vito



 Vincent Massol wrote:
  On Oct 18, 2007, at 10:49 AM, Vitantonio Messa wrote:
 
  It doesn't seem to work: I still get a 0 from this function:
  $doc.getObjectNumbers(XWiki.ClassName))
 
  I've never done it myself but maybe someone else here can help.
 
  You could also check if you find examples in the source code or in
  the pages of XE.
 
  -Vincent
 
  Vincent Massol wrote:
  On Oct 18, 2007, at 10:35 AM, Vitantonio Messa wrote:
 
  Thanks Vincent,
 
  I'll try it. If it is working, of course, I'm going to put some
  information on xwiki.org. Thanks once again!
  hmm seems like the $xwiki.saveDocument() api is internal only.
 
  You should use the $mydocument.save() API instead.
 
  -Vincent
 
  Vincent Massol wrote:
  Hi Vito,
 
  On Oct 18, 2007, at 10:13 AM, Vitantonio Messa wrote:
 
  Hi,
 
  I have created my own class. In a document, I'm able to create a
  object
  of that class, write and read fields in that object, but I don't
  know
  how to memorize this object in the database: I was looking on the
  developer guide on xwiki.org and I found only this page
  http://www.xwiki.org/xwiki/bin/view/DevGuide/DatabaseTutorial
  (which is
  not complete, unfortunately for me).
  Can anyone help me, please?
  Have you called $xwiki.saveDocument()?
 
  Would be nice if you could put this code snippet for creating an
  object using scripting on the following page:
  http://www.xwiki.org/xwiki/bin/view/DevGuide/APIGuide
 
  Thanks
  -Vincent
  ___
  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 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




-- 
David Israel
cell) (408) 802-2267
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Memorize objects

2007-10-18 Thread Vitantonio Messa
Hi all,

here is the piece of code used to store a new object:

   ## Create a new object for this user
   #set($attendee = $doc.newObject(XWiki.AttendeeClass))
   $attendee.set(name,$usr)
   $attendee.set(answer,yes)
   ## Add a new object to the page
   # $doc.save()

Of course the XWiki.AttendeeClass class was created before.
It wasn't working at the first attempts because I was trying to create 
the object with the function $Class.newObject(), I have no idea why, but 
changing the creation of the object in $Document.newObject() makes 
everything work fine.

Hopefully today (in my spare time) I'm going to write this information 
in the www.xwiki.org.

Vito



Vincent Massol wrote:
 
 On Oct 18, 2007, at 5:00 PM, David Israel wrote:
 
 This example - 
 http://objectwebcon06.objectweb.org/xwiki/bin/view/XWiki/CFP?xpage=code; 
 http://objectwebcon06.objectweb.org/xwiki/bin/view/XWiki/CFP?xpage=code; 
 does

 #set($xwiki2 = $xwiki.xWiki)
  #set($context2 = $context.context)
  ## ID
  #set ($sql = select max(prop.value) from BaseObject as obj, 
 LongProperty as prop where obj.className='XWiki.CFPClass' and 
 prop.name='id' and obj.id=prop.id.id)
  #set($id=1)
  #foreach ($item in $xwiki.search($sql))
#set($id=$item.intValue() + 1)
  #end
  #set($newdoc = $xwiki2.getDocument(CFP.No${id}, $context2))
  $xwiki2.saveDocument($newdoc, $context2)

 I'm not sure exactly what you were attempting to do but maybe this 
 trick of getting the internal xWiki and context and using them for 
 saveDocument can help you.  My use case also requires doing fancy 
 things with objects so please help out the documentation if you are 
 successful!
 
 Checking the code it seems that this would be similar to $newdoc.save(). 
 Not sure why that's not working.
 
 Getting the internal object has 2 issues:
 
 1) It requires programming rights so if this page is edited and saved by 
 someone without programming rights it'll fail
 2) we are planning to completely modify the internal implementation in 
 the near future of xwiki so it shouldn't be used as much as possible. If 
 APIs are missing in the public API then we should add it there instead.
 
 Thanks
 -Vincent
 
 On 10/18/07, *Vitantonio Messa* [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:

 Ok, thanks. I'll go and have a look.

 Vito



 Vincent Massol wrote:
  On Oct 18, 2007, at 10:49 AM, Vitantonio Messa wrote:
 
  It doesn't seem to work: I still get a 0 from this function:
  $doc.getObjectNumbers(XWiki.ClassName))
 
  I've never done it myself but maybe someone else here can help.
 
  You could also check if you find examples in the source code or in
  the pages of XE.
 
  -Vincent
 
  Vincent Massol wrote:
  On Oct 18, 2007, at 10:35 AM, Vitantonio Messa wrote:
 
  Thanks Vincent,
 
  I'll try it. If it is working, of course, I'm going to put some
  information on xwiki.org http://xwiki.org. Thanks once again!
  hmm seems like the $xwiki.saveDocument() api is internal only.
 
  You should use the $mydocument.save() API instead.
 
  -Vincent
 
  Vincent Massol wrote:
  Hi Vito,
 
  On Oct 18, 2007, at 10:13 AM, Vitantonio Messa wrote:
 
  Hi,
 
  I have created my own class. In a document, I'm able to
 create a
  object
  of that class, write and read fields in that object, but I
 don't
  know
  how to memorize this object in the database: I was looking
 on the
  developer guide on xwiki.org http://xwiki.org and I found
 only this page
 
 http://www.xwiki.org/xwiki/bin/view/DevGuide/DatabaseTutorial
 http://www.xwiki.org/xwiki/bin/view/DevGuide/DatabaseTutorial
  (which is
  not complete, unfortunately for me).
  Can anyone help me, please?
  Have you called $xwiki.saveDocument()?
 
  Would be nice if you could put this code snippet for creating an
  object using scripting on the following page:
  http://www.xwiki.org/xwiki/bin/view/DevGuide/APIGuide
 
  Thanks
  -Vincent
  ___
  users mailing list
  users@xwiki.org mailto:users@xwiki.org
  http://lists.xwiki.org/mailman/listinfo/users
  ___
  users mailing list
  users@xwiki.org mailto:users@xwiki.org
  http://lists.xwiki.org/mailman/listinfo/users
 
  ___
  users mailing list
  users@xwiki.org mailto:users@xwiki.org
  http://lists.xwiki.org/mailman/listinfo/users
 http://lists.xwiki.org/mailman/listinfo/users
 ___
 users mailing list
 users@xwiki.org mailto:users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users
 http://lists.xwiki.org/mailman/listinfo/users




 -- 
 David Israel
 cell) (408) 

Re: [xwiki-users] Export/Import doesn't parse velocity macros

2007-10-18 Thread Marc Lijour
Hi Victor

I see you have jumped one step forward and you made the export script work 
within 0.9. I did not the issue you are mentionning (parsing code) -yet. My 
problem emerges when unpacking in the new wiki 1.1.1. Although the package 
looks like a valid zip file -and the XML descriptor file validates- the 
import script cannot list the documents arguing it cannot parse the XML file 
(see JIRA issue WIKI-1809).

Now my question: where do you get this information on the plugin? What does it 
do? Could you elaborate on what's useful in your case?

Thank you

Marc

On October 18, 2007 06:10:37 pm Víctor A. Rodríguez wrote:
 Víctor A. Rodríguez wrote:
  BTW,
 
  in v1.1 it doesn't works either.
  Of course export and import are already embedded in 1.1, in
  Administration tasks.
 
  Víctor A. Rodríguez wrote:
  Hi,
 
  working with http://old.xwiki.org/xwiki/bin/view/Test/ImportExport I
  could make it work a bit, but when select a couple of documents and
  press Export, the next output is shown:
 
  $export.setWithVersions(false) $export.setAuthorName($author)
  $export.setDescription($description)
 
  $export.setLicence($licence)
 
  $export.setName($packageName) $export.add($itemexp,
  $xwiki.parseInt($defaultAction)) $export.add($itemexp,
  $xwiki.parseInt($defaultAction)) $export.export()

 I'm pretty sure i found the missing link : the packaging plugin !!!
 What I'll try to do is setup my development environment and compile this
 plug-in
 (http://svn.xwiki.org/svnroot/xwiki/xwiki-platform/core/trunk/xwiki-core/sr
c/main/java/com/xpn/xwiki/plugin/packaging/)

 if anyones think that I'm in the wrong path or has a better/simpler
 answer, just let me know.


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