Hello again, Guillaume. Thanks for all the help. I'm still trying to get this
working.
Guillaume, I
have gone into edit mode on the XWiki.ApprovalStatusClass, and
I see where I set the Values for the class, but I don't see where I can set
the default. Do you know of any examples you can point me to in the
documentation that might illustrate where I need to go and what I need to do
more thoroughly?
You can set a default value in the template document (since it's going to be
copied when creating a document that includes an object of your class).
Currently, the only thing in the template document that deals with this class is the bit I
added that reads:
{{include document="XWiki.ApprovalStatusSheet"/}}
Do I modify this line to set the default value? If so, how? I don't see any other ways
to set the default. Please forgive my code ignorance... I can look at some code and
probably come close to figuring out what it does, but I don't know settings, values,
commands, etc. at all.
This is what
is currently in the Xwiki.ApprovalStatusSheet sheet:
{{velocity}}
#set($class = $doc.getObject('XWiki.ApprovalStatusClass').xWikiClass)
#foreach($prop in $class.properties)
; $prop.prettyName
: $doc.display($prop.getName())
#end
{{/velocity}}
You would need to replace the generic code with something like this:
{{velocity}}
#set($class = $doc.getObject('XWiki.ApprovalStatusClass').xWikiClass)
#if($context.user.isUserInGroup('XWiki.SomeGroup'))
Status: $doc.display('status')
#end
{{/velocity}}
Okay, if I have two groups, XWikiUsersGroup and XWikiAdminGroup, do I need two lines where
I say:
#if($context.user.isUserInGroup('XWiki.NameOfGroup'))
Status: $doc.display('status')
So this status will display for each group? Am I even reading this right? Does doc.display
mean that the field will display on the document, or is it just setting the value based on
the group?
It sounds like
you're saying that the
$xwiki.isUserInGroup('XWiki.SomeGroup') API will do a check to see if the
user is in the correct group, and if so, then the subsequent lines of code
will execute, making that field visible. Is my understanding correct? Is
there a way to make the ApprovalStatus class display as a drop-down box for
supervisors/admins?
This can be controlled from the Class -> you can define how a given property
should be displayed in the options for that property as available from the
class editor.
I thought I had that operating correctly, Guillaume. In the class editor, I have the
following settings for the Status static list property:
Name: Status
Pretty Name: Status
Custom Display: Approval status:
Display Type: select
Size of the corresponding form element in edit mode: 1
Multiselect separators: ,|
Cache: checked
Values: In review|Approved|Rejected
Is there a setting I have missed or have overlooked in some way? Again, sorry for all the
questions, but this functionality is the last obstacle in getting this project really
going, and I feel like I'm so close to success here.
Thanks again,
John