Re: [xwiki-users] get prop from a class...

2009-12-16 Thread Bubulina

...ah! you were right Anca, i forgot to add the object from that class. Danke 


lucaa wrote:
> 
> 
> 
> On 12/16/2009 03:58 PM, Josh wrote:
>> Hello,
>>
>> Bubulina wrote:
>>> Hello Sergiu,
>>>
>>> it was a typo when i wrote by hand the code here.
>>> I include the TestClass, that has the properties, but the line that
>>> should
>>> give me the object from it:
>>> #set($object = $document.getObject("spaceName.TestClass").xWikiClass)
>>> returns nothing...
>>>
>>
>> You don't need the .xWikiClass. Try just:
>> #set($object = $document.getObject("spaceName.TestClass")
> 
> 
> Unless you set the $document variable yourself (which you don't do in the 
> initial snippet I see), you should use $doc for that which is the name of
> the 
> variable holding the current document by default in the velocity context:
> 
> #set($object = $doc.getObject("spaceName.TestClass")
> 
> if it _still_ does not work, check if there is an object in there indeed
> by doing
> Edit -> Objects in the menu and looking for an object of class
> spaceName.TestClass .
> 
> Have fun!
> Anca
> 
>>
>> -Joshua
>>
>>>
>>> Sergiu Dumitriu-2 wrote:
 On 12/16/2009 02:08 PM, Bubulina wrote:
> Hello
>
> 1. i create a class and add n properties. besides the properties added
> i
> have this code:
> #set( $class = $doc.name.substring(0,$doc.name.indexOf("Class")))
> #set($defaultparent = "XWiki.${class}Class")
> #set($defaultweb = "Test")
> #includeForm("XWiki.ClassSheet")
>
> 2. i create doc where i include the class:
> #includeForm("$space.TestClass")
> because I wanna get those prop:
>
> #includeForm("$space.TestClass")
> #set($object = $doc.getObject("$space.TestCkass").xWikiClass)
 $space.TestCkass is wrong, not just because it's Ckass instead of
 Class,
 but because the dot is part of the Velocity syntax. So $space.TestClass
 is not expanded as ($space).TestClass, but as $space.get("TestClass"),
 which is the value of the "TestClass" property of that object. Try
 ${space}.TestClass. Even better, you know where the class is, you could
 just use 'Test.TestClass'.

> object - $object
>#foreach($prop in $object.properties)
>-- ${prop.prettyName}
>  : $doc.display($prop.getName())
> #end
>
> and my $object shows nothing. probably my favourite questionwhat
> am i
> missing here?
> Thanks
 --
 Sergiu Dumitriu
 http://purl.org/net/sergiu/
 ___
 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
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/get-prop-from-a-class-tp4175285p4175668.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


Re: [xwiki-users] get prop from a class...

2009-12-16 Thread Anca Luca


On 12/16/2009 03:58 PM, Josh wrote:
> Hello,
>
> Bubulina wrote:
>> Hello Sergiu,
>>
>> it was a typo when i wrote by hand the code here.
>> I include the TestClass, that has the properties, but the line that should
>> give me the object from it:
>> #set($object = $document.getObject("spaceName.TestClass").xWikiClass)
>> returns nothing...
>>
>
> You don't need the .xWikiClass. Try just:
> #set($object = $document.getObject("spaceName.TestClass")


Unless you set the $document variable yourself (which you don't do in the 
initial snippet I see), you should use $doc for that which is the name of the 
variable holding the current document by default in the velocity context:

#set($object = $doc.getObject("spaceName.TestClass")

if it _still_ does not work, check if there is an object in there indeed by 
doing
Edit -> Objects in the menu and looking for an object of class 
spaceName.TestClass .

Have fun!
Anca

>
> -Joshua
>
>>
>> Sergiu Dumitriu-2 wrote:
>>> On 12/16/2009 02:08 PM, Bubulina wrote:
 Hello

 1. i create a class and add n properties. besides the properties added i
 have this code:
 #set( $class = $doc.name.substring(0,$doc.name.indexOf("Class")))
 #set($defaultparent = "XWiki.${class}Class")
 #set($defaultweb = "Test")
 #includeForm("XWiki.ClassSheet")

 2. i create doc where i include the class:
 #includeForm("$space.TestClass")
 because I wanna get those prop:

 #includeForm("$space.TestClass")
 #set($object = $doc.getObject("$space.TestCkass").xWikiClass)
>>> $space.TestCkass is wrong, not just because it's Ckass instead of Class,
>>> but because the dot is part of the Velocity syntax. So $space.TestClass
>>> is not expanded as ($space).TestClass, but as $space.get("TestClass"),
>>> which is the value of the "TestClass" property of that object. Try
>>> ${space}.TestClass. Even better, you know where the class is, you could
>>> just use 'Test.TestClass'.
>>>
 object - $object
#foreach($prop in $object.properties)
-- ${prop.prettyName}
  : $doc.display($prop.getName())
 #end

 and my $object shows nothing. probably my favourite questionwhat am i
 missing here?
 Thanks
>>> --
>>> Sergiu Dumitriu
>>> http://purl.org/net/sergiu/
>>> ___
>>> 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


Re: [xwiki-users] get prop from a class...

2009-12-16 Thread Josh
Hello,

Bubulina wrote:
> Hello Sergiu,
> 
> it was a typo when i wrote by hand the code here.
> I include the TestClass, that has the properties, but the line that should
> give me the object from it:
> #set($object = $document.getObject("spaceName.TestClass").xWikiClass)
> returns nothing...
> 

You don't need the .xWikiClass. Try just:
#set($object = $document.getObject("spaceName.TestClass")

-Joshua

> 
> Sergiu Dumitriu-2 wrote:
>> On 12/16/2009 02:08 PM, Bubulina wrote:
>>> Hello
>>>
>>> 1. i create a class and add n properties. besides the properties added i
>>> have this code:
>>> #set( $class = $doc.name.substring(0,$doc.name.indexOf("Class")))
>>> #set($defaultparent = "XWiki.${class}Class")
>>> #set($defaultweb = "Test")
>>> #includeForm("XWiki.ClassSheet")
>>>
>>> 2. i create doc where i include the class:
>>> #includeForm("$space.TestClass")
>>> because I wanna get those prop:
>>>
>>> #includeForm("$space.TestClass")
>>> #set($object = $doc.getObject("$space.TestCkass").xWikiClass)
>> $space.TestCkass is wrong, not just because it's Ckass instead of Class, 
>> but because the dot is part of the Velocity syntax. So $space.TestClass 
>> is not expanded as ($space).TestClass, but as $space.get("TestClass"), 
>> which is the value of the "TestClass" property of that object. Try 
>> ${space}.TestClass. Even better, you know where the class is, you could 
>> just use 'Test.TestClass'.
>>
>>> object - $object
>>>   #foreach($prop in $object.properties)
>>>   -- ${prop.prettyName}
>>> : $doc.display($prop.getName())
>>> #end
>>>
>>> and my $object shows nothing. probably my favourite questionwhat am i
>>> missing here?
>>> Thanks
>> -- 
>> Sergiu Dumitriu
>> http://purl.org/net/sergiu/
>> ___
>> 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] get prop from a class...

2009-12-16 Thread Bubulina

Hello Sergiu,

it was a typo when i wrote by hand the code here.
I include the TestClass, that has the properties, but the line that should
give me the object from it:
#set($object = $document.getObject("spaceName.TestClass").xWikiClass)
returns nothing...


Sergiu Dumitriu-2 wrote:
> 
> On 12/16/2009 02:08 PM, Bubulina wrote:
>>
>> Hello
>>
>> 1. i create a class and add n properties. besides the properties added i
>> have this code:
>> #set( $class = $doc.name.substring(0,$doc.name.indexOf("Class")))
>> #set($defaultparent = "XWiki.${class}Class")
>> #set($defaultweb = "Test")
>> #includeForm("XWiki.ClassSheet")
>>
>> 2. i create doc where i include the class:
>> #includeForm("$space.TestClass")
>> because I wanna get those prop:
>>
>> #includeForm("$space.TestClass")
>> #set($object = $doc.getObject("$space.TestCkass").xWikiClass)
> 
> $space.TestCkass is wrong, not just because it's Ckass instead of Class, 
> but because the dot is part of the Velocity syntax. So $space.TestClass 
> is not expanded as ($space).TestClass, but as $space.get("TestClass"), 
> which is the value of the "TestClass" property of that object. Try 
> ${space}.TestClass. Even better, you know where the class is, you could 
> just use 'Test.TestClass'.
> 
>> object - $object
>>   #foreach($prop in $object.properties)
>>   -- ${prop.prettyName}
>> : $doc.display($prop.getName())
>> #end
>>
>> and my $object shows nothing. probably my favourite questionwhat am i
>> missing here?
>> Thanks
> 
> -- 
> Sergiu Dumitriu
> http://purl.org/net/sergiu/
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/get-prop-from-a-class-tp4175285p4175536.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


Re: [xwiki-users] get prop from a class...

2009-12-16 Thread Sergiu Dumitriu
On 12/16/2009 02:08 PM, Bubulina wrote:
>
> Hello
>
> 1. i create a class and add n properties. besides the properties added i
> have this code:
> #set( $class = $doc.name.substring(0,$doc.name.indexOf("Class")))
> #set($defaultparent = "XWiki.${class}Class")
> #set($defaultweb = "Test")
> #includeForm("XWiki.ClassSheet")
>
> 2. i create doc where i include the class: #includeForm("$space.TestClass")
> because I wanna get those prop:
>
> #includeForm("$space.TestClass")
> #set($object = $doc.getObject("$space.TestCkass").xWikiClass)

$space.TestCkass is wrong, not just because it's Ckass instead of Class, 
but because the dot is part of the Velocity syntax. So $space.TestClass 
is not expanded as ($space).TestClass, but as $space.get("TestClass"), 
which is the value of the "TestClass" property of that object. Try 
${space}.TestClass. Even better, you know where the class is, you could 
just use 'Test.TestClass'.

> object - $object
>   #foreach($prop in $object.properties)
>   -- ${prop.prettyName}
> : $doc.display($prop.getName())
> #end
>
> and my $object shows nothing. probably my favourite questionwhat am i
> missing here?
> Thanks

-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] get prop from a class...

2009-12-16 Thread Bubulina

Hello

1. i create a class and add n properties. besides the properties added i
have this code: 
#set( $class = $doc.name.substring(0,$doc.name.indexOf("Class")))
#set($defaultparent = "XWiki.${class}Class")
#set($defaultweb = "Test")
#includeForm("XWiki.ClassSheet")

2. i create doc where i include the class: #includeForm("$space.TestClass")
because I wanna get those prop:

#includeForm("$space.TestClass")
#set($object = $doc.getObject("$space.TestCkass").xWikiClass)
object - $object
 #foreach($prop in $object.properties)
 -- ${prop.prettyName} 
   : $doc.display($prop.getName())
#end

and my $object shows nothing. probably my favourite questionwhat am i
missing here? 
Thanks
-- 
View this message in context: 
http://n2.nabble.com/get-prop-from-a-class-tp4175285p4175285.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