Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • What if we want to push the fragment to more than one group? What if we wanted to push the fragment to Students OR Faculty? We can do this by using the <paren> directive's mode attributes OR, NOT, or AND.
    • Here are some examples of using <paren> and <attribute> together to target specific groups:
      Code Block
      <!-- Push this fragment to anyone who is a member of the Students OR Faculty group -->
      <dlm:audience evaluatorFactory='org.jasig.portal.layout.dlm.providers.GroupMembershipEvaluatorFactory'>
          <paren mode="OR">
            <attribute mode='memberOf' name='Students'/>
            <attribute mode='memberOf' name='Faculty'/>
          </paren>
        </dlm:audience>
      
      Code Block
      <!-- Push this fragment to members of the Students group who are NOT also members of the Faculty group -->
      <dlm:audience evaluatorFactory='org.jasig.portal.layout.dlm.providers.GroupMembershipEvaluatorFactory'>
          <paren mode="AND">
            <attribute mode='memberOf' name='Students'/>
            <paren mode="NOT">
              <attribute mode='memberOf' name='Faculty'/>
            </paren>
          </paren>
        </dlm:audience>
      
    • So as you can see from the above examples there is some flexibility to targeting specific groups of interest.
The 'precedence' Attribute

Each fragment must also declare an integer precedence value. This value is used during merging of fragments to position elements contributed from different fragments. It is also used to determine that precedence elements can override a lower precedence, movement-restricted element forcing it to a less valuable real-estate location. For example, the default dlm.xml file defines three fragments:

Guests

precedence = 10

Entertainment

precedence = 100

News

precedence = 80

  •  For complete documentation of how to target your audience take a look at the "define audiences" manual page for details.

...

  • Let's imagine that we want to setup a fragment named "Library". This library fragment will contain all information about library services that we wish to send out to only Faculty OR Student groups but NOT Staff groups. Here's what we would do:
  • Define our new fragment as follows in the dlm.xml file
Code Block
<dlm:fragment name='Library' ownerID='library-lo' precedence='40'>
    <dlm:audience evaluatorFactory='org.jasig.portal.layout.dlm.providers.GroupMembershipEvaluatorFactory'>
      <paren mode="OR">
         <attribute mode='memberOf' name='Students'/>
        <attribute mode='memberOf' name='Faculty'/>                  
        <paren mode="NOT">
          <attribute mode='memberOf' name='Staff'/>
        </paren>
      </paren>
    </dlm:audience>
  </dlm:fragment>
  • Setting the precedence attribute
    • Each fragment must also declare an integer precedence value. This value is used during merging of fragments to position elements contributed from different fragments. It is also used to determine which precedence elements can override a lower precedence.

                 

Step 3: Deploy your new fragment

...