<#ftl ns_prefixes={ "bebop":"http://www.arsdigita.com/bebop/1.0", "cms":"http://www.arsdigita.com/cms/1.0", "nav":"http://ccm.redhat.com/navigation", "ppp":"http://www.arsdigita.com/PublicPersonalProfile/1.0", "ui": "http://www.arsdigita.com/ui/1.0"} > <#--filedoc Provides functions for proceesing public person profiles. --> <#--doc Gets the full owner name. @param model The model of the public personal profile to use. @return The full name of the profile owner. --> <#function getProfileOwnerFullName model> <#return model["./ppp:profile/ppp:ownerName"]> <#--doc Gets the model of the profile owner. @param model The model of the public personal profile to use. @return The model of the profile owner. --> <#function getProfileOwner data> <#return data["./profileOwner/owner"]> <#--doc Gets the surname of the profile owner. @param owner The profile owner model as returned by `getProfileOwner`. @return The surname of the profile owner. --> <#function getProfileOwnerSurname owner> <#return owner["./surname"]> <#--doc Gets the given name of the profile owner. @param owner The profile owner model as returned by `getProfileOwner`. @return The given name of the profile owner. --> <#function getProfileOwnerGivenName owner> <#return owner["./givenname"]> <#--doc Gets the name prefix of the profile owner. @param owner The profile owner model as returned by `getProfileOwner`. @return The name prefix of the profile owner. --> <#function getProfileOwnerTitlePre owner> <#return owner["./titlePre"]> <#--doc Gets the name suffix of the profile owner. @param owner The profile owner model as returned by `getProfileOwner`. @return The name suffix of the profile owner. --> <#function getProfileOwnerTitlePost owner> <#return owner["./titlePost"]> <#--doc Gets the value of the `position` property of the profile. @param model The model of the public personal profile to use. @return The value of the `position`property. --> <#function getProfilePosition data> <#return data["./position"]> <#--doc Gets the value of the `interests` property of the profile. @param model The model of the public personal profile to use. @return The value of the `interests`property. --> <#function getProfileInterests data> <#return data["./interests"]> <#--doc Gets the value of the `misc` property of the profile. @param model The model of the public personal profile to use. @return The value of the `misc`property. --> <#function getProfileMisc data> <#return data["./misc"]> <#--doc Gets the contact assoicated with the owner of the profile. The contact can be further processed using the functions provided by the ccm-cms-types-contact module. @param model The model of public personal profile to use. @return The model of the contact asssociated with the profile owner. --> <#function getProfileOwnerContact owner> <#return owner["./contacts/contact"]> <#--doc Gets the image associated with the profile. @param model The model of public personal profile to use. @return The model of the image associated with the profile. --> <#function getProfileImage data> <#if (data["./ppp:profile/ppp:profileImage"]?size > 0)> <#return data["./ppp:profile/ppp:profileImage/imageAttachments[1]/*"]> <#elseif (data["./nav:greetingdata/cms:data/profileOwner/owner/imageAttachments"]?size > 0)> <#return data["./nav:greetingdata/cms:data/profileOwner/owner/imageAttachments[1]/*"]> <#--doc Gets the URL of the profile image. @param data The model of the profile image as returned by `getProfileImage`. @return The URL of the profile image. --> <#function getProfileImageUrl data> <#if (data["./ppp:profile/ppp:profileImage"]?size > 0)> <#assign imageId=data["./ppp:profile/ppp:profileImage/imageAttachments[1]/image/id"]> <#return dispatcherPrefix + '/cms-service/stream/image/?image_id=' + imageId> <#elseif (data["./nav:greetingdata/cms:data/profileOwner/owner/imageAttachments"]?size > 0)> <#assign imageId=data["./nav:greetingdata/cms:data/profileOwner/owner/imageAttachments[1]/image/id"]> <#return dispatcherPrefix + '/cms-service/stream/image/?image_id=' + imageId> <#--doc Gets the name of the profile owner. @param data The model of the public personal profile to use. @return The name of the profile owner. --> <#function getProfileOwnerName data> <#return data["./ppp:profile/ppp:ownerName"]> <#--doc Gets the personal publications of the profile owner. @param data The model of the public personal profile to use. @return The models of the publications of the profile owner. --> <#function getPersonalPublications data> <#return data["./ppp:profile/personalPublications"]> <#--doc Gets the available publication groups. @param data The model of the public personal profile to use. @return The models of the available publication groups. --> <#function getPersonalPublicationsAvailablePublicationGroups data> <#return data["./ppp:profile/personalPublications/availablePublicationGroups/availablePublicationGroup"]> <#--doc Gets the ID of a publication group. @param The model of the publication group to use. @return The ID of the provided publication group. --> <#function getPublicationGroupId group> <#return group["./@name"]> <#--doc Gets the link for a publication group. @param The model of the publication group to use. @return The link for the provided publication group. --> <#function getPublicationGroupLink group> <#if (model["ppp:profile/personalPublications/publications/@all"]?size > 0 && model["ppp:profile/personalPublications/publications/@all"] == "all")> <#return "#" + group["./@name"]> <#else> <#return "?group=" + group["./@name"]> <#--doc Gets the available publication groups. @param data The model of the public personal profile to use. @return The models of the available publication groups. --> <#function getPublicationGroups data> <#return data["./ppp:profile/personalPublications/publications/publicationGroup"]> <#--doc Gets the publications in group.. @param data The model of the publication group to use. @return The models of the publication in the provided group. --> <#function getPublicationsOfGroup data> <#return data["./publications"]> <#--doc Checks if a paginator for the publications is available. @param profile The model of the public personal profile to use. @return `true` if a paginator is available, `false` otherwise. --> <#function hasPublicationsPaginator profile> <#return (model["/bebop:page/ppp:profile/personalPublications/publications/publicationGroup/nav:paginator"]?size > 0)> <#--doc Gets the base URL for the paginator. @param profile The model of the public personal profile to use. @return The base URL for the paginator. --> <#function getPublicationsPaginatorBaseUrl profile> <#if (model["/bebop:page/ppp:profile/personalPublications/publications/publicationGroup/nav:paginator/@baseURL"]?contains("?"))> <#return model["/bebop:page/ppp:profile/personalPublications/publications/publicationGroup/nav:paginator/@baseURL"] + "&"> <#else> <#return model["/bebop:page/ppp:profile/personalPublications/publications/publicationGroup/nav:paginator/@baseURL"] + "?"> <#--doc Gets the number of pages of the publications paginator. @param profile The model of the public personal profile to use. @return The number of pages. --> <#function getPublicationsPaginatorPageCount profile> <#return model["/bebop:page/ppp:profile/personalPublications/publications/publicationGroup/nav:paginator/@pageCount"]?number> <#--doc Gets the current page of the publications paginator. @param profile The model of the public personal profile to use. @return The current page. --> <#function getPublicationsPaginatorPageNumber profile> <#return model["/bebop:page/ppp:profile/personalPublications/publications/publicationGroup/nav:paginator/@pageNumber"]?number> <#--doc Gets the name of the `page` parameter of the publications paginator. @param profile The model of the public personal profile to use. @return The name of the `page` parameter. --> <#function getPublicationsPaginatorPageParam profile> <#return model["/bebop:page/ppp:profile/personalPublications/publications/publicationGroup/nav:paginator/@pageParam"]> <#--doc Gets the maximum number of publications per page. @param profile The model of the public personal profile to use. @return The maximum number of publications per page. --> <#function getPublicationsPaginatorPageSize profile> <#return model["/bebop:page/ppp:profile/personalPublications/publications/publicationGroup/nav:paginator/@pageSize"]?number> <#--doc Gets the index of the first publication shown. @param profile The model of the public personal profile to use. @return The index of the first publication. --> <#function getPublicationsPaginatorObjectBegin profile> <#return model["/bebop:page/ppp:profile/personalPublications/publications/publicationGroup/nav:paginator/@objectBegin"]?number> <#--doc Gets the number of publications. @param profile The model of the public personal profile to use. @return The number of publications. --> <#function getPublicationsPaginatorObjectCount profile> <#return model["/bebop:page/ppp:profile/personalPublications/publications/publicationGroup/nav:paginator/@objectCount"]?number> <#--doc Gets the index of the last publication shown. @param profile The model of the public personal profile to use. @return The index of the last publication. --> <#function getPublicationsPaginatorObjectEnd profile> <#return model["/bebop:page/ppp:profile/personalPublications/publications/publicationGroup/nav:paginator/@objectEnd"]?number> <#--doc Gets the link to the previous page. @param profile The model of the public personal profile to use. @return The link to the previous page. --> <#function getPublicationsPaginatorPrevPageLink profile> <#return getPublicationsPaginatorBaseUrl(profile) + getPublicationsPaginatorPageParam(profile) + "=" + (getPublicationsPaginatorPageNumber(profile) - 1)> <#--doc Gets the link to the first page. @param profile The model of the public personal profile to use. @return The link to the first page. --> <#function getPublicationsPaginatonFirstPageLink profile> <#return getPublicationsPaginatorBaseUrl(profile) + getPublicationsPaginatorPageParam(profile) + "=1"> <#--doc Gets the link to the next page. @param profile The model of the public personal profile to use. @return The link to the next page. --> <#function getPublicationsPaginatorNextPageLink profile> <#return getPublicationsPaginatorBaseUrl(profile) + getPublicationsPaginatorPageParam(profile) + "=" + (getPublicationsPaginatorPageNumber(profile) + 1)> <#--doc Gets the link to the last page. @param profile The model of the public personal profile to use. @return The link to the last page. --> <#function getPublicationsPaginatorLastPageLink profile> <#return getPublicationsPaginatorBaseUrl(profile) + getPublicationsPaginatorPageParam(profile) + "=" + getPublicationsPaginatorPageCount(profile)> <#--doc Gets the available project groups. @param data The model of the public personal profile to use. @return The models of the available project groups. --> <#function getAvailableProjectGroups data> <#return data["./ppp:profile/personalProjects/availableProjectGroups/availableProjectGroup"]> <#--doc Gets the ID of a project group. @param The model of the project group to use. @return The ID of the provided project group. --> <#function getProjectGroupId group> <#return group["./@name"]> <#--doc Gets the link for a project group. @param The model of the project group to use. @return The link for the provided project group. --> <#function getProjectGroupLink group> <#if (model["/bebop:page/ppp:profile/personalProjects/projects/@all"]?size > 0 && model["/bebop:page/ppp:profile/personalProjects/projects/@all"] == "all")> <#return "#" + group["./@name"]> <#else> <#return "?group=" + group["./@name"]> <#--doc Gets the available project groups. @param data The model of the public personal profile to use. @return The models of the available project groups. --> <#function getProjectGroups data> <#return data["./ppp:profile/personalProjects/projects/projectGroup"]> <#--doc Gets the project in group.. @param data The model of the project group to use. @return The models of the project in the provided group. --> <#function getProjectsOfGroup data> <#return data["./project"]> <#--doc Checks if a paginator for the projects is available. @param profile The model of the public personal profile to use. @return `true` if a paginator is available, `false` otherwise. --> <#function hasProjectsPaginator profile> <#return (model["./bebop:page/ppp:profile/personalProjects/projects/projectGroup/nav:paginator"]?size > 0)> <#--doc Gets the base URL for the paginator. @param profile The model of the public personal profile to use. @return The base URL for the paginator. --> <#function getProjectsPaginatorBaseUrl profile> <#if (model["/bebop:page/ppp:profile/personalProjects/projects/projectGroup/nav:paginator/@baseURL"]?contains("?"))> <#return model["/bebop:page/bebop:page/ppp:profile/personalProjects/projects/projectGroup/nav:paginator/@baseURL"] + "&"> <#else> <#return model["/bebop:page/ppp:profile/personalProjects/projects/projectGroup/nav:paginator/@baseURL"] + "?"> <#--doc Gets the number of pages of the projects paginator. @param profile The model of the public personal profile to use. @return The number of pages. --> <#function getProjectsPaginatorPageCount profile> <#return model["/bebop:page/ppp:profile/personalProjects/projects/projectGroup/nav:paginator/@pageCount"]?number> <#--doc Gets the current page of the projects paginator. @param profile The model of the public personal profile to use. @return The current page. --> <#function getProjectsPaginatorPageNumber profile> <#return model["/bebop:page/ppp:profile/personalProjects/projects/projectGroup/nav:paginator/@pageNumber"]?number> <#--doc Gets the name of the `page` parameter of the projects paginator. @param profile The model of the public personal profile to use. @return The name of the `page` parameter. --> <#function getProjectsPaginatorPageParam profile> <#return model["/bebop:page/ppp:profile/personalProjects/projects/projectGroup/nav:paginator/@pageParam"]> <#--doc Gets the maximum number of projects per page. @param profile The model of the public personal profile to use. @return The maximum number of projects per page. --> <#function getProjectsPaginatorPageSize profile> <#return model["/bebop:page/ppp:profile/personalProjects/projects/projectGroup/nav:paginator/@pageSize"]?number> <#--doc Gets the index of the first project shown. @param profile The model of the public personal profile to use. @return The index of the first project. --> <#function getProjectsPaginatorObjectBegin profile> <#return model["/bebop:page/ppp:profile/personalProjects/projects/projectGroup/nav:paginator/@objectBegin"]?number> <#--doc Gets the number of projects. @param profile The model of the public personal profile to use. @return The number of projects. --> <#function getProjectsPaginatorObjectCount profile> <#return model["/bebop:page/ppp:profile/personalProjects/projects/projectGroup/nav:paginator/@objectCount"]?number> <#--doc Gets the index of the last project shown. @param profile The model of the public personal profile to use. @return The index of the last project. --> <#function getProjectsPaginatorObjectEnd profile> <#return model["/bebop:page/ppp:profile/personalProjects/projects/projectGroup/nav:paginator/@objectEnd"]?number> <#--doc Gets the link to the previous page. @param profile The model of the public personal profile to use. @return The link to the previous page. --> <#function getProjectsPaginatorPrevPageLink profile> <#return getProjectsPaginatorBaseUrl(profile) + getProjectsPaginatorPageParam(profile) + "=" + (getProjectsPaginatorPageNumber(profile) - 1)> <#--doc Gets the link to the first page. @param profile The model of the public personal profile to use. @return The link to the first page. --> <#function getProjectsPaginatonFirstPageLink profile> <#return getProjectsPaginatorBaseUrl(profile) + getProjectsPaginatorPageParam(profile) + "=1"> <#--doc Gets the link to the next page. @param profile The model of the public personal profile to use. @return The link to the next page. --> <#function getProjectsPaginatorNextPageLink profile> <#return getProjectsPaginatorBaseUrl(profile) + getProjectsPaginatorPageParam(profile) + "=" + (getProjectsPaginatorPageNumber(profile) + 1)> <#--doc Gets the link to the last page. @param profile The model of the public personal profile to use. @return The link to the last page. --> <#function getProjectsPaginatorLastPageLink profile> <#return getProjectsPaginatorBaseUrl(profile) + getProjectsPaginatorPageParam(profile) + "=" + getProjectsPaginatorPageCount(profile)>