Adaptive Tag Magic with Publisher Data Entry Templates
Here’s a neat trick: ALUI Publisher allows any HTML in the “Instructions” field for properties in a Data Entry Template. Because this HTML is then included when creating or editing a Content Item, you can do all sorts of things with the page.
One of the cooler things you can do is leverage adaptive tags in this field. So, say you want a portlet that allows you to highlight various communities in your portal, and you want content managers to be able to just select a community from a list rather than looking up and typing in an ID. This is just one example; obviously you could select any object with the tree control, so use your imagination if you’d like to select users, portlets, or any other administrative object.
You can use the Unified Tree View adaptive tag in the “Instructions” field for a particular property, then use the Common Opener adaptive tag in your presentation template to automatically link to the community. Content Managers then don’t have to worry about all the nuances of creating links to other communities, and don’t have to remember community IDs when creating the Content Items.
For example, create a new portlet based off the “News” Portlet Template, and make some minor tweaks:
- Add a new Integer property called comm_id to the “News Article” Data Entry Template:
- Open the property and go to the “HTML” view for the instructions:
The instructions contain the tree view adaptive tag and a call-back function that changes the text of the property based off the item selected:
<script language=”JavaScript”>
function PickerSubmit(arrIn) {
document.getElementsByName(‘ptext4′)[0].value = arrIn[0].ObjectID;
}
</script><pt:standard.tree xmlns:pt=’http://www.plumtree.com/xmlschemas/ptui/’ value=”Pick a Community” class=”gContentSection” pt:windowName=’myWindow’ pt:windowFeatures=’location=no,menubar=no,height=500,width=300′ pt:RootID=’1′ pt:Multi=’false’ pt:SelectMd=’2′ pt:SubmitMd=’2′ pt:Submit=’PickerSubmit’ pt:Title=’Community’ pt:SubTitle=’Pick a Community’ pt:Class=’512′/>
- Finally, this property can be used in the “News Article” presentation template just like you would any other pcs:value; you can even include it inside a commonopener adaptive tag to automatically create a link to that community.
Now, when people go to create/edit the Content Item based off this DET, they’ll see a button underneath the property field where they would normally see “instructions”. Clicking it opens a popup to get the list of communities, and selecting a community populates the field!
