Dear XWiki community,
I’m trying to add a custom object to diagram pages which essentially consists of three drop down list fields linked to properties of a custom class. However, when I add an instance of my class to the Diagram.DiagramTemplate document this seems to prevent anything from displaying when creating a new Diagram.
This is what I’ve done:
First I added a reference to a new sheet called “Content Manager.Code.Content Manager Reduced Edit Sheet” to “Diagram.DiagramSheet”
{{velocity}}
#if ($doc.getObject('Diagram.DiagramClass'))
#if ($xcontext.action == 'edit')
{{include reference="Diagram.DiagramEditSheet" /}}
#else
{{include reference="Diagram.DiagramViewSheet" /}}
#end
#end
{{include reference="Content Manager.Code.Content Manager Reduced Edit Sheet" /}}
{{/velocity}}
Where “Content Manager.Code.Content Manager Reduced Edit Sheet” contains the following:
{{velocity}}
#set($discard = $doc.use('Content Manager.Code.Content Manager Reduced Class'))
#set($class = $doc.getObject('Content Manager.Code.Content Manager Reduced Class').xWikiClass)
outside loop
#foreach($prop in $class.properties)
inside loop
## Only display the content when editing
#if ($xcontext.action == 'edit')
; $prop.prettyName
: $doc.display($prop.getName())
#end
#end
{{/velocity}}
Added XWiki.ClassSheetBinding = “Diagram.DiagramSheet” to “Content Manager.Code.Content Manager Reduced Class”
Added an instance of “Content Manager.Code.Content Manager Reduced Class” to “Diagram.DiagramTemplate”.
This last action seems to stop anything from displaying when creating a new Diagram. I just get the title of the document in view mode.
What am I missing?
As a more general case, is there a way I can add this class to every new document no matter what template is used? I would also like to add it to documents imported from Office but I can’t find the template that is used. This is important to me because I use the values of each of the properties in this class to determine the page rights.
Thank you,
Ben