Liferay Portal 6 Enterprise Intranets phần 9 docx

68 442 0
Liferay Portal 6 Enterprise Intranets phần 9 docx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Chapter 9 [ 525 ] The preceding code shows that the portlet Expando will appear in the category Portal and position 8, and it is systemable—that is, the portlet Expando is available only in a system called Control Panel. Customization As mentioned earlier, the icon Custom Fields under User and Organization of the Control Panel is the entry point for applying Expando columns on entities. You could nd the following code in both $PORTAL_ROOT_HOME/html/portlet/ enterprise_admin/user/toolbar.jsp and $PORTAL_ROOT_HOME/html/portlet/ enterprise_admin/organization/toolbar.jsp. <liferay-portlet:renderURL windowState="<%= WindowState.MAXIMIZED. toString() %>" var="expandoURL" portletName="<%= PortletKeys.EXPANDO %>"> <portlet:param name="struts_action" value="/expando/view_attributes" /> <portlet:param name="redirect" value="<%= currentURL %>" /> <portlet:param name="modelResource" value="<%= ${resource}.class. getName() %>" /> </liferay-portlet:renderURL> The preceding code species an entry to view custom elds and to add custom elds, where ${resource} could be the entities User or Organization. In general, the icon Edit next to resources under the Custom Fields of the Control Panel is an entry point for applying Expando columns on any entities that have the Custom Fields framework. What's happening? You could nd the following code in $PORTAL_ROOT_HOME/html/portlet/expando/view.jsp. <portlet:renderURL windowState="<%= WindowState.MAXIMIZED.toString() %>" var="rowURL"> <portlet:param name="struts_action" value="/expando/view_attributes" /> <portlet:param name="redirect" value="<%= currentURL %>" /> <portlet:param name="modelResource" value="<%= customAttributesDisplay.getClassName() %>" /> </portlet:renderURL> The preceding code species the entry for viewing and adding custom elds. customAttributesDisplay could be any entities with the Custom Fields framework. Obviously, customAttributesDisplay could be custom entities with the Custom Fields framework. Social Ofce, Hooks, and Custom Fields [ 526 ] In addition, you would be able to customize the behavior to add custom elds on resources in $PORTAL_ROOT_HOME/html/portlet/expando/edit-expando.jsp. Custom attribute display The Custom Fields framework allows us to use custom attributes (called custom elds) for our own entities (even for plugins). Firstly, create a CustomAttributeDisplay subclass and register it through $PORTAL_ROOT_HOME/ WEB-INF/liferay-portlet.xml. For example, the resource wiki portage is available for adding custom elds, since the portlet Wiki has the following specication. <custom-attributes-display> com.liferay.portlet.wiki.WikiPageCustomAttributesDisplay </custom-attributes-display> Then, use JSP tags liferay-ui:custom-attributes-available and liferay- ui:custom-attribute-list to show the custom eld values of form elds in the portlet's JSPs. For instance, the Wiki portlet uses the following code to show the custom eld values of form elds in $PORTAL_ROOT_HOME/html/portlet/wiki/ view.jsp. <liferay-ui:custom-attributes-available className="<%= WikiPage.class.getName() %>"> <div class="custom-attributes"> <liferay-ui:custom-attribute-list className="<%= WikiPage.class.getName() %>" classPK="<%= (wikiPage != null) ? wikiPage.getResourcePrimKey() : 0 %>" editable="<%= false %>" label="<%= true %>" /> </div> </liferay-ui:custom-attributes-available> Of courses, you would nd the same pattern in the Message Boards category, Message Boards messages, Calendar event, page, organization, user, organization, Web Content, Document Library documents, Document Library folders, Bookmarks entiesy, Bookmarks folders, Image Gallery images, Image Gallery folders, Blogs entiesy, and so on. Chapter 9 [ 527 ] Enhancement It is nice that custom attributes support types, both primitives (such as Boolean, Integer, String, Short, and so on) and presets (such as textbox, selection, and so on). But it would be better to extend the preceding types and let custom attributes support custom types, that is, Image Gallery images and Document Library documents. Thus, the target objects such as User and Organization can have references or called associations with Image Gallery images and Document Library documents via custom attributes. Moreover, the target objects such as Document Library documents can have special references like other Document Library documents via custom attributes. It would be much better if custom attributes were localizable. A web content structure would be a better system and custom attributes could use it; including all types, image gallery values, inheritance, and so on. Summary In this chapter, we were introduced to adding a participant for chatting, managing (viewing and deleting) participants in the Chat portlet, starting the chat, and setting up the Chat portlet. Then we moved on to discussing how to manage (checking, deleting, adding, replying, forwarding, and searching) e-mails and further, setting up the Mail portlet properly. We also saw how to manage the SMS Text Messenger portlet and to send SMS text messages. Then, we discussed how to build Social Ofce with so-theme, so-portlet together with hooks and other portlets. Finally, we learned how to apply custom elds on any asset. In this chapter, we have learned how to: • Check online friends and chat • Set up the portlet Chat • Set up e-mail accounts • Manage (check, delete, forward, reply, search) e-mails • Manage the SMS Text Messenger portlet • Build Social Ofce with themes, portlets, and hooks • Use hooks • Apply custom elds on any assets In the next chapter, we're going to see how to set up search, search engine optimization (SEO), Open-Search, WAP, CRM, reporting and auditing. Search, WAP, CRM, Widgets, Reporting and Auditing In the intranet website "bookpub.com" of the enterprise "Palm Tree Publications", it is necessary to query assets like Message Boards entries, Blogs posts, Wikis articles, users in Directory, Document Library documents, bookmark entries, Image Gallery images, and so on. Furthermore, a lot of content is stored and managed in third- party repositories. Thus, it is also necessary to search contents from these repositories in the intranet websites. Meanwhile, it would be helpful to have maps' search, CSZ search, Web Content search, WAP, widgets, reporting, and auditing. This chapter will introduce you to federated search, CSZ search, maps search, and OpenSearch concepts rst. The Web Content search portlet is also discussed in detail. Accordingly, it will discuss how to use the sitemap for search engines, how to set up pluggable enterprise search, and how to manage plugins. Finally, it will address WAP sites, CRM integration, widgets, and reporting and auditing in detail. In this chapter, you will learn how to: • Employ federated search, OpenSearch, CSZ search, and maps search • Employ Web Content search • Congure sitemap for search engines and pluggable enterprise search • Manage plugins • Build WAP sites • Report and audit • Integrate with CRM and Netvibes widgets Search, WAP, CRM, Widgets, Reporting and Auditing [ 530 ] Federated search Federated search is the simultaneous searching of multiple online databases or web resources, and it is an emerging feature of automated web-based library and information retrieval systems. Here, federated search refers to the portal. It is very useful to provide federated search abilities, such as searches for blog entries, users, organizations, Calendar entries, Bookmarks entries, Document Library documents, Image Gallery images, Message Boards messages, Wiki articles, Web Content articles, Directory, and so on. The portal provides a set of search portlets. In this section, we're going to take an in-depth look at these portlets. The Search portlet The Search portlet (portlet ID 3) is a JSR-286-compliant portlet that can be used for federated search. By default, the portal itself is the search provider. As shown in following screenshot, Search Portlet provides a federated search against Blogs entries, users, organizations, Calendar entries, Bookmarks entries, Document Library documents, Image Gallery images, Message Boards message, Wiki articles, Web Content articles, Directory, and so on. In addition, the Search Portlet provides a federated search against plugin portlets like the Alfresco Content portlet. The following is an example of how to use the Search portlet: • Add the Search portlet to the page Home of the community Guest where you want to carry out a search, if the Search portlet isn't already present • Enter the search criterion, for example My • Click on the Search icon Note that when searching for assets, you will have the ability to specify the scope of the search results: Everything or This Community. Everything would generate search results that will come from any group in the current portal instance such as communities, organizations, and my community. This Community will generate search results that come from the current group in the portal instance such as community Guest, organization "Palm Tree Enterprise", and My Community. Chapter 10 [ 531 ] The search results would cover Blogs entries, users, organizations, Calendar entries, Bookmarks entries, Document Library documents, Image Gallery images, Message Boards messages, Wiki articles, Web Content articles, Directory, and so on. Additionally, search results will include assets from plugin portlets like Alfresco Content portlet. As you can see, search results would be displayed as a title with a link. If you have the proper permission on an asset, you could click on the title of the asset (which is a link to it) and view the asset as well. But if you don't have proper permission on an asset, clicking on the title would bring up a permission error message. What's happening? The portal provides many portlets to support OpenSearch framework such as Message Boards, Blogs, Wikis, Directory and Document Library, Users, Organizations, and so on. In addition, plugins like the Alfresco Content portlet also support the OpenSearch framework. Normally, these portlets have the following OpenSearch framework conguration. <open-search-class>class-name</open-search-class> The Search portlet obtains an OpenSearch instance from each portlet that has the tag <open-search-class> denition. For example, the portlet Directory (portlet ID 11) allows users to search for other users, organizations, or user groups. OpenSearch has been specied for the portlet Directory in $PORTAL_ROOT_HOME/WEB-INF/liferay- portlet.xml as follows: <open-search-class> com.liferay.portlet.directory.util.DirectoryOpenSearchImpl </open-search-class> As shown in the preceding code, the open-search-class value must be a class that implements com.liferay.portal.kernel.search.OpenSearch, which is called to get search results in the OpenSearch standard. Besides the OpenSearch framework, the portal provides UI taglib to display search results. In $PORTAL_ROOT_HOME/html/portlet/search/view.jsp, you could nd the following code. <liferay-ui:search /> For more details on UI taglib <liferay-ui:search>, you can check JSP les start. jsp and end.jsp under the folder $PORTAL_ROOT_HOME/html/taglib/ui/search. In addition, the portal scopes OpenSearch results through the UI taglib <liferay- ui:search>. For example, the scope of search results, namely, Everything or This Community has been specied in $PORTAL_ROOT_HOME/html/taglib/ui/search/ start.jsp as follows: Search, WAP, CRM, Widgets, Reporting and Auditing [ 532 ] <select name="<%= namespace %>groupId"> <!—ignore details > <option value="<%= group.getGroupId() %>" <%= (groupId != 0) ? "selected" : "" %>><liferay-ui:message key='<%= "this-" + (group.isOrganization() ? "organization" : "community") %>' /> </option> </select> As you can see, the value of This Community would be an organization or community. By default, the OpenSearch implementation in the portal supports both formats: ATOM and RSS. The default format would be ATOM. Therefore, the search results from plugin portlets must be returned in the format ATOM. For example, in the portlet Alfresco Content, the format of search results must be ATOM. Why? The portlet Search has specied the following code in $PORTAL_ROOT_HOME/html/ portlet/search/open_search_description.jsp. <OpenSearchDescription xmlns="http://a9.com/-/spec/OpenSearch/1.1/"> <!—ignore details ><Url type="application/rss+xml" template="<%= themeDisplay.getPortalURL() %><%= PortalUtil.getPathMain() %>/ search/open_search?keywords={searchTerms}&amp p={startPage?}&amp c={count?}&amp format=rss" /> </OpenSearchDescription> In addition, the search results are displayed in pagination through the search container. Fortunately, search container is congurable. The portal has specied the following properties in portal.properties. search.container.page.delta.values=5,10,20,30,50,75 search.container.page.iterator.max.pages=25 As shown in the preceding code, the property search.container.page.delta. values sets the available values for the number of entries to be displayed per page. An empty value, or commenting out the value, will disable delta resizing. The default of 20 will apply in all cases. Note that you need to always include 20 because it is the default page size when no delta is specied. The absolute maximum allowed delta value is 200. The property search.container.page.iterator.max.pages sets the maximum number of pages, which are available before and / or after the currently displayed page. Of course, you could override these properties anytime in portal-ext.properties. Chapter 10 [ 533 ] Conguration As mentioned previously, OpenSearch in the Search portlet covers the in-and-out of Blogs, Calendar, Bookmarks, Document Library, Image Gallery, Message Boards, Wiki, Web Content, Directory, and so on. Fortunately, the portal adds the ability to remove these portlets from the list of portlets searched by the portlet Search as follows: com.liferay.portlet.blogs.util.BlogsOpenSearchImpl=true ## ignore details com.liferay.portlet.wiki.util.WikiOpenSearchImpl=true As shown in the preceding code, you can set any of these properties to false to disable the portlet from being searched by the Search portlet in portal-ext.properties. Customization In real cases, you may be required to use the portlet Search in different ways. You would be able to customize the portlet Search. Here we're going to discuss how to use the Search portlet in Social Ofce and how to use the Search portlet in themes. The Social Ofce overrides the UI taglib <liferay-ui:search> in the portlet so- portlet through JSP le hooks in $AS_WEB_APP_HOME/so-portlet/META-INF/ custom_jsps/html/taglib/ui/search/start.jsp as follows: <liferay-util:include page="/html/taglib/ui/search/start.portal.jsp" /> <c:if test="<%= group.isUser() %>"> <script type="text/javascript"> var searchOptions = jQuery('select[name=<%= namespace %> groupId] option') searchOptions.each( //ignore details ) </script> </c:if> As shown in the preceding code, the Social Ofce overrides the look and feel of the portlet Search. For example, it will remove search options. Of course, you can add the portlet Search as a runtime portlet in themes. You could add the Velocity template $theme.search() in the theme, specically in the VM le portal_normal.vm or the VM le included in portal_normal.vm. For example, Social Ofce species the following lines in the theme so-theme such as $AS_WEB_ APP_HOME/so-theme/templates/navigation_top.vm. #if ($is_signed_in) <div class="my-search">$theme.search()</div> #end Search, WAP, CRM, Widgets, Reporting and Auditing [ 534 ] As shown in the preceding code, when the user signs in, the Social Ofce will show the customized portlet Search in "my-search" style. OpenSearch in plugins In general, the portal provides an OpenSearch framework, so that a user can create an OpenSearch implementation in the plugin environment. The portal will try to call this OpenSearch implementation when you hit the Search portlet. The Search portlet goes through all registered implementations and tries to create an instance. We could search content from the Alfresco repository, just as we did for Blogs, Bookmarks, Calendar, Directory, and so on via the OpenSearch framework of the portlet Search. How does it work? How does it work? First of all, we need to install the Alfresco Web Client, and then we need to deploy the portlet Alfresco Content. By following these three steps, you would bring the Alfresco Web Client into Tomcat as well: 1. Download the latest Alfresco-Tomcat bundle from http://www.alfresco. com, and install it to the folder $ALFRESCO_HOME. 2. Locate the Alfresco Web Client application alfresco.war under the folder $ALFRESCO_HOME, and drop it to the folder $TOMCAT_AS_DIR/webapps. 3. Create a database alfresco in MySQL and restart Tomcat. drop database if exists alfresco create database alfresco character set utf8 grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option Then we could deploy the plugin Alfresco Content portlet. The following is an example of how to bring the portlet Alfresco Content into the portal. 1. Download the WAR le ${alfresco.content.portlet.war} from http:// liferay.cignex.com/palm_tree/book/0387/chapter12/alfresco- content-portlet-6.0.0.1.war. 2. Drop the WAR le ${alfresco.content.portlet.war} to the folder $LIFERAY_HOME/deploy when the portal is running. Chapter 10 [ 535 ] That's it! When you search for content again in the portlet Search, you will be able to see assets coming from the Alfresco Web Client. In addition, you would see a message like "Searched Alfresco Content, Blogs …" in the portlet Search. Web services As you can see, the Alfresco Content plugin displays content from the Alfresco repository. Two kinds of services are involved—web services and RESTful services. A web service is a software system designed to support interoperable machine-to- machine interaction over a network. With the portlet Alfresco Content, you could search or navigate content of the Alfresco repository via web services. You have to simply go to More | Conguration | Setup | Current of the portlet Alfresco Content rst. Then you should enter a User ID like "admin" and a password like "admin", and click on the Save button. Now, you will be able to see the root folder "Company Home". The following property is specied in the portlet Alfresco Content: $AS_WEB_APP_HOME/alfresco-content-portlet/WEB-INF/classes/portlet. properties content.server.url=http://localhost:8080 As shown in the preceding code, the property content.server.url sets the location of the Alfresco server URL. RESTful services Representational State Transfer (REST) is a style of software architecture for distributed hypermedia systems. Alfresco not only provides the ability to expose its search engines via OpenSearch, but it also provides an aggregate OpenSearch feature in the Alfresco Web Client through RESTful services. To summarize, Alfresco RESTful services-based keyword search mimics the keyword search of the Alfresco Web Client. The following search URL template is used for OpenSearch in the plugin Alfresco Content. http://<host>:<port>/alfresco/service/api/search/keyword.atom?q={searc hTerms}&p={startPage?}&c={count?}&l={language?} In the preceding code, the URL will have the following values: • searchTerms: The keyword or keywords to search • startPage (optional): The page number of search results desired by the client [...]... com .liferay. portal. deploy.auto.ExtAutoDeployListener,\ com .liferay. portal. deploy.auto.HookAutoDeployListener,\ com .liferay. portal. deploy.auto.LayoutTemplateAutoDeployListener,\ com .liferay. portal. deploy.auto.PortletAutoDeployListener,\ com .liferay. portal. deploy.auto.ThemeAutoDeployListener,\ com .liferay. portal. deploy.auto.WebAutoDeployListener,\ auto.deploy enabled=true auto.deploy.deploy.dir=$ {liferay. home}/deploy... /ehcache /liferay- multi-vm.xml for internal caches of multiple VMs In a clustered environment, you need to set the following in portal- ext.properties: ehcache.multi.vm.config.location=/ehcache/ liferay- multi-vm-clustered.xml In addition, the portal sets the property ehcache .portal. cache.manager.jmx enabled to true to enable JMX integration in com .liferay. portal. cache EhcachePortalCacheManager Moreover, the portal. .. This is because, in $PORTAL_ ROOT_HOME/WEB-INF /liferay- portlet.xml, the portlet Users (named as enterprise_ admin_users) has specified the following line: com .liferay. portlet.enterpriseadmin.util.UserIndexer As shown in the preceding code, the indexer-class value, which is the specified indexer framework, must be a class that implements com .liferay. portal. kernel search.Indexer... plugin in the portal How does it work? The following is an example of how you can bring the plugin solr-web into the portal The plugin solr-web is the Solr Search Engine implementation 1 Download the WAR file ${solr.web.war} from http:/ /liferay. cignex com/palm_tree/book/0387/chapter12/solr-web -6. 0.0.1.war 2 Drop the WAR file ${solr.web.war} to the folder $LIFERAY_ HOME/deploy when the portal is running... Hot Deploy [ 560 ] Chapter 10 In addition, you could also deploy a WAR file to the portal automatically, called Auto Deploy To do so, download the WAR file ${name.version.war} first, then drop the WAR file ${name.version.war} to the folder $LIFERAY_ HOME/deploy when the portal is running That's it! What's happening? The portal has specified auto deploy as follows, but not limited, in portal. properties... hibernate.xml hibernate-clustered.xml liferay- single-vm.xml liferay- multi-vm.xml liferay- multi-vm-clustered.xml 4 Set the following for a non-clustered environment in portal- ext.properties: net.sf.ehcache.configurationResourceName=/ext-ehcache/ hibernate.xml ehcache.single.vm.config.location=/ext-ehcache/ liferay- single-vm.xml ehcache.multi.vm.config.location=/ext-ehcache /liferay- multi-vm.xml 5 Otherwise,... http://lucene.apache.org for more information By default, the portal uses Lucene search and indexing Lucene search The portal sets the default Lucene index on start-up to false for faster performance, as follows, in portal. properties: index.read.only=false index.on.startup=false index.on.startup.delay =60 index.with.thread=true As you can see, the portal sets the property index.read.only to false to allow... stores could be in the filesystem, the database, or in RAM Anyway, the portal provides a set of properties to configure index storage as follows in portal. properties lucene.store.type=file lucene.store.jdbc.auto.clean.up=false lucene.store.jdbc.dialect.* lucene.dir=$ {liferay. home}/data/lucene/ lucene.file.extractor=com .liferay. portal. search lucene.LuceneFileExtractor lucene.file.extractor.regexp.strip=... implemented in Java, which the portal uses to provide distributed caching in a clustered environment EHCache is also used in a non-clustered environment to speed up repeated data retrievals The portal uses EHCache caching by default At the same time, the portal uses Hibernate caching as well The portal provides the capability to configure EHCache caching and Hibernate caching The portal has specified Hibernate... query factory, whereas the portal sets the property hibernate.generate_statistics to false Of course, you could set the property hibernate.generate_statistics to true to enable Hibernate cache monitoring in portal- ext.properties Setting up EHCache caching The portal has specified the following EHCache caching settings in portal. properties ehcache.single.vm.config.location=/ehcache /liferay- single-vm.xml . following code in both $PORTAL_ ROOT_HOME/html/portlet/ enterprise_ admin/user/toolbar.jsp and $PORTAL_ ROOT_HOME/html/portlet/ enterprise_ admin/organization/toolbar.jsp. < ;liferay- portlet:renderURL. specication. <custom-attributes-display> com .liferay. portlet.wiki.WikiPageCustomAttributesDisplay </custom-attributes-display> Then, use JSP tags liferay- ui:custom-attributes-available and liferay- ui:custom-attribute-list. OpenSearch has been specied for the portlet Directory in $PORTAL_ ROOT_HOME/WEB-INF /liferay- portlet.xml as follows: <open-search-class> com .liferay. portlet.directory.util.DirectoryOpenSearchImpl

Ngày đăng: 12/08/2014, 21:20

Mục lục

  • Chapter 9: Social Office, Hooks, and Custom Fields

    • Custom Fields

      • What's happening?

        • Customization

        • Chapter 10: Search, WAP, CRM, Widgets, Reporting and Auditing

          • Federated search

            • The Search portlet

              • What's happening?

              • OpenSearch in plugins

                • How does it work?

                • CSZ Search

                  • How does it work?

                  • What's happening?

                  • Maps search

                    • How does it work?

                    • What's happening?

                    • What's OpenSearch?

                      • Design principles

                      • What's happening?

                        • Configuration

                        • Search Engine Optimization

                          • Sitemap

                            • Customize sitemaps for pages

                            • What's happening?

                              • XML sitemap format

                              • Pluggable Enterprise Search

                                • Caching settings

                                  • Configure Hibernate caching

                                  • Solr search

                                    • Install Solr instance

                                    • Configuring the Solr plugin

                                    • What's happening?

                                    • Plugins management

                                      • Plugins installation

                                        • The Plugin Installer portlet

                                        • What's happening?

                                        • Plugins configuration

                                          • What's happening?

                                          • How does it work?

                                          • What's happening?

Tài liệu cùng người dùng

Tài liệu liên quan