With uwosh.pfg.d2c objects we create in our workflow applications sometimes we need to look up a student ID.
We do not store those in Plone sites because of data security concerns.
Here is how you can add a button on your D2C objects to look up a student's ID. This is very easy to do on our Intranet Zope, ie. the Plone server that runs our campus Intranet and the workflow app sandboxes owned by campus units.
Here's what it looks like:
Requirements
Assumptions:
- You are doing this on the UW Oshkosh Intranet Zope, ie. either the campus Intranet or one of the many workflow application sandboxes
- Your form asks for and stores the student's official email address (by default, any PloneFormGen form you create is going to do this automatically)
- The student's email address is stored in a string field with the ID "replyto" (again, by default, this is what all new PloneFormGen forms do)
- Only those who have edit permission on the D2C object should see the "Display Student ID" button, to prevent unauthorized users from seeing student IDs
Add the Button
Go to the ZMI -> portal_actions -> object and add a CMFAction:
- Title: Display Student ID
- URL (Expression): python: 'display_emplid?email=' + context.getValue('replyto')
- Condition (Expression): python:(object.meta_type == 'FormSaveData2ContentEntry') and hasattr(object, 'replyto') and getattr(object, 'replyto', None)
- Permissions: Modify portal content
- Visible?: True
Add the External Method
Go to the ZMI -> portal_skins -> custom and add an External Method:
- Id: display_emplid
- Module Name: display_emplid
- Function Name: display_emplid
This works only on our Intranet Zope.