Creating a class?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating a class?

Frank Haefemeier
Hi,

I have created a class with the script on the document
'XWiki.XWikiClasses'. The new class is called
- Cook.RecipeClass with three properties
        * recipe
        * ingredients
        * description

- Cook.RecipeClassTemplate
<!-- replace MyName with the real class name -->
<!-- save this template using the save button at the top left -->
#includeForm("Cook.RecipeClassSheet")

- Cook.RecipeClassSheet
<!-- you can modify this page to customize the presentation of your
object -->
<!-- at first you should keep the default presentation -->
<!-- save this template using the save button at the top left -->

<!-- Change "title" to a field name contained in your Class -->
#set($class = $doc.getFirstObject("recipe").xWikiClass)

1 Kochrezept: $doc.name

<table border="1" cellspacing="0" cellpadding="2">
#foreach($prop in $class.properties)
<tr><td> *${prop.prettyName}* </td>
<td>$doc.display($prop.getName())</td>
</tr>
#end
</table>

If I now try to create a document with the form on Cook.RecipeClass
the document (e.g. Cook.Test) shows a new page with the following URL
xwiki/bin/inline/Cook/NameOfYourDocument?parent=Cook.RecipeClass&template=Cook.RecipeClassTemplate&sheet=1&webname=Cook&name=Test

On this page the header 'Kochrezept: Test' is shown but no table with
the properties. I can't see why it isn't working.

Any idea what's wrong.

Bye
        Frank
--
Dipl. Inform. Frank H?femeier <[hidden email]>
----------------------------------------------------




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Creating a class?

Shawn Lauzon

You probably need to add an object of the RecipeClass to the RecipeClassTemplate. Go to the RecipeClassTemplate page and click More actions -> Edit Objects. Choose the RecipeClass from the class list and click the button. So whenever the RecipeClassTemplate page is used as a template, you also get a new RecipeClass object.

Frank Haefemeier <[hidden email]> wrote on 08/18/2005 04:35:32 PM:

> Hi,
>
> I have created a class with the script on the document
> 'XWiki.XWikiClasses'. The new class is called
> - Cook.RecipeClass with three properties
>    * recipe
>    * ingredients
>    * description
>
> - Cook.RecipeClassTemplate
> <!-- replace MyName with the real class name -->
> <!-- save this template using the save button at the top left -->
> #includeForm("Cook.RecipeClassSheet")
>
> - Cook.RecipeClassSheet
> <!-- you can modify this page to customize the presentation of your object -->
> <!-- at first you should keep the default presentation -->
> <!-- save this template using the save button at the top left -->
>
> <!-- Change "title" to a field name contained in your Class -->
> #set($class = $doc.getFirstObject("recipe").xWikiClass)
>
> 1 Kochrezept: $doc.name
>
> <table border="1" cellspacing="0" cellpadding="2">
> #foreach($prop in $class.properties)
> <tr><td> *${prop.prettyName}* </td>
> <td>$doc.display($prop.getName())</td>
> </tr>
> #end
> </table>
>
> If I now try to create a document with the form on Cook.RecipeClass
> the document (e.g. Cook.Test) shows a new page with the following URL
> xwiki/bin/inline/Cook/NameOfYourDocument?parent=Cook.
> RecipeClass&template=Cook.RecipeClassTemplate&sheet=1&webname=Cook&name=Test
>
> On this page the header 'Kochrezept: Test' is shown but no table with
> the properties. I can't see why it isn't working.
>
> Any idea what's wrong.
>
> Bye
>    Frank
> --
> Dipl. Inform. Frank Häfemeier <[hidden email]>
> ----------------------------------------------------
>
>
>
> --
> You receive this message as a subscriber of the xwiki-
> [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws