Plugin Personal Pages - Integration Manual v1.8.0


  1. Prerequisites
  2. Installation
  3. Graphic integration
  4. Attributes LDAP and indexing LDAP by default
  5. Definition of a new "person card" content type

Prerequisites

Your CMS user manager must be linked to a LDAP directory.

There are 2 LDAP managers:

  • org.ametys.runtime.plugins.core.Ldap
  • org.ametys.runtime.plugins.core.CredentialsAwareLdap
<org.ametys.runtime.user.UsersManager>org.ametys.runtime.plugins.core.Ldap</org.ametys.runtime.user.UsersManager>
<org.ametys.runtime.user.UsersManager>org.ametys.runtime.plugins.core.CredentialsAwareLdap</org.ametys.runtime.user.UsersManager>

Installation

  • Stop the server
  • Download jars from plugin and add them (ametys-plugin-mypage-1.8.0.jar and ametys- plugin-mypage-resources-1.780.jar) to your application's WEB-INF/lib directory. Ametys

  • Add buttons and menus for opening and managing personal pages in the file WEB-INF/params/cms-ribbon-default.xml. The identifiers are org.ametys.mypage.person.Open and org.ametys.mypage.person.SearchMenu.
    We recommend adding it to the Home tab, in the "Advanced tools" group.

    <group label="RIBBON_TABS_TAB_HOME_GROUPS_GROUP_ADVANCED_TOOL_LABEL" icon="">
           <large></large>
           <medium>
    			...
    			<control id="org.ametys.mypage.person.Open"/>
                <control id="org.ametys.mypage.person.SearchMenu"/>
           </medium>
           <small/>
     </group>
    
  • To enable users to edit their own page, a profile named "MYPAGE_PROFILE" must be created, with the following rights :
    • in the "Personal pages" category, select"Manage my personal page";
    • depending on the worfklow, all the rights required to modify, delete and advance content through the workflow to the state considered valid for publication on the website. In the demo application, these rights are: "Edit", "Propose", "Refuse", "Validate" and "Delete".
  • Personal pages are managed as a type of content. However, this type of content is not intended to be inserted into site pages.
    You must therefore explicitly remove it from the "Add content" menu. To do this, make sure that the content type org.ametys.plugins.mypage.Content.person belongs to the list of available content types defined by the WEB-INF/param/content-types-default.xml.

    <?xml version="1.0" encoding="UTF-8"?>
    
    <content-types mode="exclude">
          <content-type id="org.ametys.plugins.newsletter.Content.newsletter"/>
    	  <content-type id="org.ametys.plugins.mypage.Content.person"/>
    </content-types>
    
    
  • Restart the server

Graphic integration

This extension requires your layout to contain a "mypage" template with a main area named "default". You must create this template if it does not already exist in your charter.
For simple integration, the template.xsl of this new template can simply import the style sheet of the page template

 

<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
        xmlns:sitemap="http://www.ametys.org/inputdata/sitemap/3.0"
        xmlns:xalan="http://xml.apache.org/xalan"
        xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date"
        exclude-result-prefixes="sitemap">
 
    <xsl:import href="skin://templates/page/stylesheets/template.xsl" />
</xsl:stylesheet>

 

Attributes LDAP and indexing LDAP by default

The default "person record" content type defines 6 fields to be extracted from the LDAP directory, 4 of which are indexed for search purposes.

Field AmetysAttribute LDAPIndexed
lastnamesnyes
firstnamegivenNameyes
emailmailno
telephonetelephoneNumberno
rolesupannRoleyes
assignmentsupannAssignmentyes

Definition of a new "person card" content type

The plugin Personal Pages site introduces a new type of "person file" content, composed of fields from the LDAP directory and classic Ametys fields.

This content type is a special type of content that cannot be overloaded using the classic overload mechanism. Whenever you want to modify, add or delete fields (LDAP or Ametys) of this content type, you will have to redefine the content type entirely in your application.

To do this, declare in the plugin.xml of a plugin, a org.ametys.cms.contenttype.ContentTypeExtensionPoint using the org.ametys.plugins.mypage.contenttype.LdapPersonContentType

If you need to create a new plugin, follow the instructions on the Architecture page of plugin Ametys .

Take your inspiration from the content type org.ametys.plugins.mypage.Content.person defined by plugin Personal pages. We strongly recommend that you copy and paste your declaration and modify only the necessary fields.

<extension point="org.ametys.cms.contenttype.ContentTypeExtensionPoint"
           id="mycontenttypeperson"
           class="org.ametys.plugins.mypage.contenttype.LdapPersonContentType">
   <cms:content-type private="true">
        <cms:label i18n="true">plugin.mypage:PLUGINS_MYPAGE_CONTENT_TYPE_PERSON_LABEL</cms:label>
        <cms:description i18n="true">plugin.mypage:PLUGINS_MYPAGE_CONTENT_TYPE_PERSON_DESCRIPTION</cms:description>
        <cms:icons>
            <cms:small>img/person_16.png</cms:small>
            <cms:medium>img/person_32.png</cms:medium>
            <cms:large>img/person_48.png</cms:large>
        </cms:icons>

		<!-- Exemple de champ issu du LDAP -->
        <cms:directory-attribute name="lastname" alpha-search="true" order="1">
             <label i18n="true">plugin.mypage:PLUGINS_MYPAGE_CONTENT_PERSON_LASTNAME</label>
             <description i18n="true">plugin.mypage:PLUGINS_MYPAGE_CONTENT_PERSON_LASTNAME_DESC</description>
             <attribute>sn</attribute>
        </cms:directory-attribute>
		...

		<!-- Exemple de champ Ametys classique -->
		<cms:metadata name="fax" type="string">
             <label i18n="true">plugin.mypage:PLUGINS_MYPAGE_CONTENT_PERSON_FAX</label>
             <description i18n="true">plugin.mypage:PLUGINS_MYPAGE_CONTENT_PERSON_FAX_DESC</description>
        </cms:metadata>

        ...
        <!-- Exemple d'attribut LDAP à indexer pour la recherche -->
        <cms:ldap-indexation>
            <cms:attribute-ref name="lastname" />
            <cms:attribute-ref name="firstname" />
            <cms:attribute-ref name="role" />
            <cms:attribute-ref name="affectation" />
        </cms:ldap-indexation>
   </cms:content-type>
</extension>

To render your content type, add a pipeline to your plugin sitemap.xmap file:

<map:match pattern="mycontenttypeperson.*">
    <map:redirect-to uri="cocoon://_plugins/web/content-type.person.{1}?pluginName=mypage"/>
</map:match>

To then use your "person card" content type instead of the "org.ametys.plugins.mypage.Content.person"Create a person-content-type.xml in the WEB-INF/param file in your CMS application. This file must contain the following lines:

<?xml version="1.0" encoding="UTF-8"?>
<mypage>
    <person-content-type>mycontenttypeperson</person-content-type>
</mypage>

Finally, we need to deactivate the old "person card" content type extension. To do this, modify the runtime.xml in the WEB-INF/param de votre application CMS. Dans la partie <plugins> <exclude>, rajouter la ligne suivante :

<feature>mypage/org.ametys.mypage.content-type</feature>

 

 

.

Back to top

Personal pages