text;
stringlengths 5
32.6k
|
---|
"the documents and media portlet is non-instanceable. on your portal can host at most one such portlet. multiple documents and media portlets to pages in the same site, these portlets will share the same data sets since they are scoped by site by default. you can add multiple documents and media display portlets to a page. can choose content from actual documents and media repositories to display. remember that users, by default, have their own personal sites with public and they can use their personal sites to host documents and media portlets for storing or sharing their own files figure 4.1 initial view of the documents and media portlet the default view of the documents and media portlet displays the contents of the the links on the left side of the portlet windows are filters. you can use these filters to choose what you want the main window of the portlet recent documents displays documents users have recently uploaded, my documents shows your documents; in other words, the basic document and the document types listed if you click on one of these filters, the main portlet window shows only documents that belong to the selected document type. when you add custom document types, which we discuss below, they are added to next, let's look at how to navigate around documents and media in the main window of the documents and media portlet, you can click on a document to view details about it. its version number, version history, status, as well as its uploader and the user who last edited it. document, some automatically extracted metadata may also be displayed, such as the document creator, author, title, content type, creation date and last in the case of audio or video files, the duration would also you can perform several actions on the document here download lets you download the document get url displays the url of the document on the server get webdav url displays the webdav url of the document on the server. specify this url as the file name when opening the document from microsoft edit lets you change contents of a document, point it to a different file, change its title, description or document type, or add tags, categories or move lets you choose a new location in the documents and media repository checkoutcheckin prevents others from modifying the document while you are other users can still view the current version of the document if they you can check the document back in when you're done working permissions allows you to configure file-specific permissions for the delete lets you remove the document from the documents and media library if comments are enabled, you can also view comments, add comments or subscribe comments are enabled by default the menu at the top of the documents and media portlet contains actions, add, there are also buttons for switching between icon view, descriptive view and list view. if there are lots of documents in the documents and media library, the search field can help you find the documents if your portlet contains more documents than it can display at once, you can use the navigation tool at the bottom of the portlet window to either switch your view to another page or configure the page to display more the actions menu will only be displayed if you have selected one or more cancel checkout lets you check in a document that you had checked out but using this option will prevent the documents and media portlet from incrementing the document's version number and saving an identical version of the document checkin lets you check in a document that you have edited. number will increment and the previous version will be saved checkout lets you check out a document that you would like to edit. option prevents anyone else from modifying it while you are working move allows you to choose a new location for a document or folder within you can move multiple documents and folders at the moving documents and folders is also possible via drag drop delete allows you to remove a document or folder from the portlet. delete multiple documents and folders at the same time from the add button, you can add documents, folders and shortcuts just like on folder lets you create a new location in your portlet's file system shortcut allows you to create a shortcut to any document that you have read you can set permissions on the shortcut to specify who can access the original document through the shortcut repository is a new feature of liferay 6.1. an entirely new repository to your documents and media portlet. need to specify the repository type and choose an id. atompub protocol you'll also have to specify the atompub url multiple documents allows you to upload several documents at once basic document allows you upload a single file that you would like the default document type, basic document, to apply to. documents are not described by any metadata sets the remaining items in the add menu are default document types that are each described by a unique metadata set. when you add a document belonging to a specific document type, you're presented with a form to not only specify the file to upload but also to fill out the fields defined by the document type's we describe the contract document type by way of example contract lets you upload a file that you would like the contract document this document type is intended to be used to describe legal by default, contracts are described by effective date, expiration date, contract type, status, legal reviewer, signing authority and deal name document types are discussed below any custom documents types that have been defined also appear in the add menu. if a document type has been created that matches the document you would like to upload, you can select that document type from the add menu. the metadata fields associated with the document type to your document and you will be asked to fill out the fields you can sort the items displayed in the main window of the documents and media portlet using the sort by menu. you can sort by title, create date, modified title lets you alphabetically sort documents by title create date lets you sort documents by the time they were created modified date lets you sort documents by the last time they were modified downloads lets you sort documents by the number of times they were size lets you sort documents by how much disk space they use the manage menu allows you to view the names of document types and metadata sets, as well as the last times they were edited document types shows you a list of defined document types metadata sets shows you a list of defined metadata sets as well as their";;
|
customizable document types and metadata sets are new features in liferay 6.1. when a user assigns a document type to a document, the user is required to fill out the fields defined by the metadata set of the document type. users not to forget to enter important information about their documents. example, you could create a copyrighted document type and require users to enter a license for all copyrighted documents. types and metadata sets can improve document searchability. users enter into the fields determined by their document type's metadata set become searchable entities within the portal. portlet to search for these terms. document types and metadata sets are accessible from the manage button at the top of the documents and media portlet you can add a new document type using the add button at the top of the dialog to do so, you need to define one or more metadata sets to associate with when creating a new document type, you can define main metadata fields or select additional metadata fields. are directly tied to their document type and cannot be made available to other additional metadata fields, by contrast, can be defined independently and can be used in many different document types. differentiate the document types that implement the same additional metadata set by defining different main metadata fields for them. metadata fields need to be defined and saved before creating a document type figure 4.4 adding a new document type as an example, we could create a document type called syllabus and define a what metadata should we associate with syllabi? our syllabi to have course title, professor, semester, course description and all syllabi in our portal should maintain entries this ensures that a syllabus will show up in a portal search if its course title, professor or semester is searched for. to use our metadata set for any document type other than syllabus, let's create our metadata set under the main metadata fields area. could create our metadata set independently using manage metadata sets add and then select it as an additional metadata field figure 4.5 selecting additional metadata sets you can view, edit or add metadata sets from the manage metadata a metadata set consists of a group of fields. button, you can use same ui for defining a metadata set that you used in the add figure 4.6 adding a new metadata set make sure the fields tab is selected on the left. set, just choose fields to use from the area on the left and drag and drop them the drag and drop interface allows for nested fields so you need to be careful about where you drop the fields. mouse-over tips, widths and other settings can be configured for most fields. configure these settings, just double-click on a field from the area on the this automatically selects the settings tab on the left. double-click on a value to edit. liferay supports the following kinds of fields a valid date format is required for the date field, but you don't have to enter a date manually. field a mini-calendar pops up which you can use to select a date the value will be persisted as a documents and media lets you select a file from one of the portal's file upload lets you select file to upload from your local system integer lets you enter an integer. the value will be persisted as an int number lets you enter a decimal number or an integer. persisted either as a double or an int, depending on the type of input the default number is three but only one option can be selected at a time select is just like the radio field except that the options are hidden and have to be accessed from a drop-down menu text lets you enter a single line of text text box is just like the text field except you can enter multiple lines of remember that metadata sets created independently are reusable. been created they can be included in any number of document types as additional next, let's take a look at tags. forms of web content that can be created in liferay, including documents.;;
|
by default, liferay stores documents and media files on the file system of the you can choose a specific location for the document library store's root directory by adding the following property to your url file and replacing the default path with your custom you can also use an entirely different method for storing documents and media the following documents and media library stores are available for example, you can store documents and media files in your liferay instance's to enable dbstore, add the following line to your remember to restart your liferay server after updating your url file in order for your customizations to take effect. please refer to the document library portlet section of your url file for a complete list of supported customizations. features such as the maximum allowed size of documents and media files, the list of allowed file extensions, which types of files should be indexed, and more next, let's look at mounting external repositories.;;
|
adding repositories in documents and media is a new feature in liferay 6.1. content management interoperability services cmis is a specification for improving interoperability between enterprise content management systems. documents and media allows users to connect to multiple third-party repositories that support cmis 1.0 with atompub and web services protocols some of the features supported with third-party repositories include there are some subtle differences in setting up the different kinds of third-party repositories for use in documents and media. lastly, keep in mind your third-party repository may require installation and deployment of an appropriate liferay plugin. documentum are available through liferay's marketplace let's go through those steps, starting with setting our portal properties the admin must ensure that the same credentials and authentication are being used in liferay and in the external repository. if you don't have ldap, you need to ensure manually that the credentials and authentication are the same. with the third-party repository, you need to store passwords for the user set the following portal property in your url next, we need to make sure the login and password for liferay are the same as this is easily accomplished by using identical screen names, so in url add the following alternatively, configure these properties in the control panel under portal once these properties are set, you must create a user in liferay with a screen name and password matching the administrative user of your external be sure to assign appropriate roles e.g. administrator to that sign out of liferay and sign in again as that new user. the management chapter on adding and managing users you can add new repositories from the ui by clicking the add button from the repositories can only be mounted in the home folder figure 4.7 adding a new repository all fields in this form are required, except for repository id. field blank, and a repository id is automatically generated by the system when finished, the repository is displayed in the left side of the window in the figure 4.8 viewing a repository using this information, we can now add an example repository. previously, there are several repositories that work well with liferay using one that is familiar to many users is sharepoint. we'll set up sharepoint as a documents and media repository with liferay portal you can connect to an external sharepoint server and add it as a documents and media repository. this lets users collaborate and share documents more easily between both environments. sharepoint repository via cmis atompub and sharepoint soap web services liferay uses a combination of soap and representational state transfer rest, based on the atom convention, to connect to the sharepoint repository. sharepoint provides various soap services for modifying and querying data from liferay uses axis2 to generate soap calls to the to use sharepoint as a liferay documents and media repository, we'll do the note that this section is geared towards portal system administrators and before you can use sharepoint as an external repository with liferay portal, you must verify that sharepoint is properly configured. set up on the sharepoint server before synchronizing with liferay sharepoint utilizes a cmis connector and a cmis producer to interface with the connector is installed with the sharepoint administrator toolkit using a solution package called a windows sharepoint file .wsp. don't have it already, install the sharepoint administrator toolkit for its cmis install and deploy the cmis connector as a farm solution on the folder content management interoperability services cmis connectors choose the appropriate deployment settings and when deployment completes, solution properties shows the solution is successfully deployed to all target sites. the producer makes sharepoint repositories available through the cmis connector. choose the sharepoint site containing the document libraries to be used as every document library in this site is made available as a repository through the cmis connector go to site actions site settings manage site features. enable the content management interoperability services cmis producer by now any document library created under this site is cmis enabled. leave our sharepoint console, let's take note of our sharepoint document acquiring your sharepoint document library's repository id, or list id, is important as it must be specified in the atompub url liferay uses to connect finding it, however, can be a little confusing. the easiest way to find the repository id is by accessing the sharepoint repository using a browser such as mozilla firefox follow these steps to get the repository id in sharepoint, open the desired library under library tools select library click on library settings, located to the far right the browser window refreshes displaying the repository id between curly braces'' and'' in the browser's address bar figure 4.9 the repository id can be found by displaying the repository's url in a firefox browser the repository id is highlighted in the figure above. example, the repository id is 6dfda9-b547-4d1d-bf85-976863cdf533. therefore, the atompub url you'd use when adding this repository in documents and media would resemble this be sure to copy down this url so you can use it to configure sharepoint as a repository in documents and media. next, let's enable basic authentication on for the cmis connector and producer to work, basic authentication on iis must be this lets liferay's sharepoint hook authenticate against the sharepoint enable basic authentication on your sharepoint host you are now prepared to mount sharepoint as an external repository with the sharepoint server configured, we now turn our attention to liferay. mentioned in the common steps for adding an external repository, be sure to adjust the portal properties and add any user accounts required by the here are the steps specific to configuring liferay to use sharepoint download and install the sharepoint hook from marketplace. downloading and installing apps section of the leveraging the liferay marketplace chapter of this document for more information add the documents and media portlet to a page, if you haven't done so in the documents and media portlet click add repository and enter the name enter an arbitrary name for the repository description describe the repository repository type select sharepoint atompub atompub url enter the applicable url using the format below, substituting the sharepoint server's host name for host and the sharepoint document library's repository id for repository id repository id leave this field empty. repository using the given parameters and sets this value to that site path enter data using the format below, the sharepoint server's host information for host and the sharepoint document library's repository name for repository path the left navigation panel of your documents and media portlet now lists your tip in the site path example below, notice how the repository path has a folder shared documents consisting of two words the space between the words in the repository name must be accounted for when setting the site path in liferay. replace the empty space with the string 20 so the site path value now looks like this this should be done for any multi-word repository name remember that connecting to an external sharepoint server and adding it as a documents and media repository is a great way to give users flexibility for sharing and collaborating on microsoft office documents to further enhance your use of microsoft office documents with documents and media, liferay provides integration directly with microsoft office.;;
|
liferay lets you open microsoft office files that reside in you can open the files from microsoft internet explorer or open them directly from your microsoft office applications. let's open a file from your browser first liferay lets you launch microsoft office right from folders in documents and first, find the microsoft office file that you want to edit. click the drop-down icon in the upper-left corner of the document's thumbnail and click the open in ms office link. and prompts you to log in using your portal credentials. file opens in your microsoft office application figure 4.10 open microsoft office files from within your internet explorer browser by clicking the open in ms office link when you save the file, it is stored automatically in the documents and media folder from which you opened it this feature currently limits you to opening documents and media files whose titles end in their file's extension e.g.,.doc,.docx,.xls,.xlsx,.ppt, or.pptx . note that 64-bit microsoft internet explorer and 64-bit microsoft office versions do not currently support this feature. microsoft internet explorer versions with 32-bit versions of microsoft office. next we'll show you how to navigate your documents and media folders and open a file from the microsoft office application liferay lets you access microsoft office files in documents and media directly from your microsoft office applications. sharepoint protocol to allow saving and retrieving documents from liferay portal as if it were a sharepoint server. you can conveniently update your microsoft office office files without having to exit your office program for example, if you are working in microsoft word locally on your machine, you can open a file from documents and media to view or edit it. simply select file open in word and enter in the file name field. figure 4.11 enter the url of your sharepoint location on liferay to access documents and media in the list of folders displayed, navigate to guest documentlibrary and select all files to see your documents and media files. open the desired word file to make changes. click save when you are finished now anyone with appropriate permission can see the latest version of the file liferay takes care of version control as well as file users can add comments, ratings, and tags the microsoft office integration feature is currently broken for windows 7 on liferay ce 6.1.1 ga2 and ee 6.1.20 ga2. liferay's integration with microsoft office lets users leverage documents and media in managing their office files. collaboration is simplified as users share their most up-to-date versions of office files now let's look at configuring the documents and media portlet.;;
|
any type of content in liferay is considered an asset. already examined liferay's most common type of asset web content. of assets include blog posts, wiki articles, message board posts, bookmarks, and it's possible for developers to define custom asset types that utilize liferay's asset framework. originally, the asset framework was created to provide a mechanism for adding tags to blog entries, wiki articles, and web content without reimplementing the same functionality multiple times. framework has been greatly extended since then and it now supports tags, categories, vocabularies, comments, ratings, and asset relationships this chapter covers the following topics the asset publisher portlet is designed to display multiple assets. a few configuration options which we'll cover in this chapter. abstracts previews of recently published assets are displayed by the asset publisher portlet and links to their full views are provided. the asset publisher portlet to display a table of assets, a list of asset titles, or the full content of assets. you can also configure the asset publisher to display only certain kinds of assets and you choose how many items the asset publisher portlet is very useful for displaying chosen types of content, for displaying recent content, and for allowing users to browse content by tags and categories. the asset publisher is designed to integrate with the tags navigation and categories navigation portlets to allow;;
|
"tags and categories are two important tools you can use to help organize information on your portal and make it easier for your users to find the content they're looking for through search or navigation. you can do it at the bottom of the same form you use to add if you open the categorization section of the form, you'll be presented with an interface for adding tags and categories figure 5.1 tagging and categorizing content can be done at the same time you the control panel contains an interface for managing tags and categories for this interface can be used to manage all your tags and it is important that you both tag and categorize your let's take a closer look at tags and categories tags are an important tool that you can use to help organize information on your portal and make it easier for your users to find content that they're looking tags are words or phrases that you can attach to any content on the tagging content will make your search results more accurate, and enable you to use tools like the asset publisher to display content in an organized there are two ways to create tags you can do it through the administrative console in the control panel, or on the fly as content is to create tags in the control panel, select the site that you want to create from this screen, you will be able to view any existing tags and make new ones. you'll then be asked for the name of the tag, and you'll have the ability to set permissions for viewing or managing the tag. you can also add properties to a properties basically act like tags for your tags. are key-value pairs associated with specific tags that provide information about you can edit existing tags from the tags window of on the control you can change the tag name, change the tag's permissions, delete the tags are not the only portal-wide mechanism for describing content you can also categories are similar in concept to tags, but are designed for use by administrators, not regular users. hierarchies of categories can be created, and categories can be grouped together in vocabularies. hoc method for users to group content together, categories exist to allow administrators to organize content in a more official, hierarchical structure. you can think of tags like the index of a book and categories like its table of both serve the same purpose to help users find the information adding vocabularies and categories is similar to adding tags. selected the site you want to work on, select categories from the content section of the control panel, and you will be presented with the categories clicking on a vocabulary on the left displays any categories that have been you can create new vocabularies simply by clicking add vocabulary and providing a name for it. in a similar fashion by choosing a vocabulary on the left, and then selecting like tags, you can also provide properties for categories. you have created some vocabularies and categories, you can take advantage of the full capabilities of categories by creating a nested hierarchy of categories. nest categories, select what you want to be the parent category, then drag any category that you want to become a child category onto it. sign appear next to the name of the category you are dragging if you can add it to the selected parent category; if you see a red x that means that you cannot add that category as a subcategory of parent category that you have selected once you have created a hierarchy of categories, your content creators will have them available to apply to content that they create. page of the control panel and click add content. from the right-side menu and click select on the vocabulary you would like to a dialog box will appear with your categories. categories by checking the box next to them, and they will be applied to the there are a several new enhancements to vocabularies and categories in liferay the three main features are targeted vocabularies, singlemulti-valued vocabularies, and separated widgets for every vocabulary.";;
|
targeted vocabularies allow you to decide which vocabularies can be applied to an asset type and which vocabularies are required for an asset type. configure these settings, go to the categories administration page and mouse over the vocabulary in the list until you see the edit icon to the right. the icon to reveal a dialog box like the one below figure 5.4 you can target vocabularies by checking the allow multiple categories checkbox and then selecting the the default value for associated asset types is all asset types. fine tune your choices by using the and - buttons, which narrows the scope of the vocabulary to specific assets. in the screenshot above, notice how the vocabulary famous noses is configured to be available for blogs and web content, but it is not required. it is mandatory, however, for documents and you can now decide if the user can choose one or more categories from the same vocabulary to categorize an asset. if a vocabulary is single-valued you can only choose one, and if it allows more, you can choose several categories figure 5.5 single-valued vocabularies, on the left, use radio buttons while setting vocabulary values is done through the categories administration page. edit a vocabulary and deselect the allow multiple categories checkbox to set single value vocabularies or use the default option to set multi-value the third important improvement is every vocabulary has its own separated these widgets appear in the categorization section of every asset and they allow users to easily select appropriate categories for that asset figure 5.6 now that vocabularies have their own widgets, it's easy to select it's important to use tags and categories with all your content, so that content let's look at one of the ways users will make use of tags and categories searching for content.;;
|
"to stay organized, i rs used to use a paper-based planner. sections for various areas of my life. its initial incarnation came from a commercial company, but over the years i tweaked it into something that worked this final version before i went digital had different tabs for different areas of my life that i wanted to keep track of daily items like tasks, notes, a spiritual section, and agenda pages that kept track of things i needed to go over with specific people. a planning section had tabs for projects, family, future items, and reference of course, since this was paper-based, it had its limitations. did i put the note i'd written about that new toy my daughter wanted in the notes section or in the family section? on my while out list, so i would remember to buy it before her birthday liferay content can be like this. that important information you remember seeingwas it in a wiki article, a message boards post, or web content? if you don't have this kind of information, browsing to the content you're looking for could be difficult. powerful, faceted search function, which means you can drill down through the different types of content, tags, and categories to refine your search and find to get started, drop the search portlet on a page and search for something. you'll see a page with results on the right and a collection of facets on the figure 5.7 the first set of facets is content types. specific types of content that contain the search terms you a facet is a combination of the information about a specific indexed field, its facets are typically named by the field in question. the default facets are asset types pictured above, asset tags, asset categories, and modified time range the frequency in which the term was found for each facet is listed in it may jog your memory to see that the term you searched for appears in a blog entry, and that may be all you need to find what if, however, your memory is more foggy than that, or you're searching for something you're not sure is actually there, then the asset tags or asset categories facets may be more helpful to you figure 5.8 asset tag facets provide you with more information about content that contains the terms for which you searched in this case, if you searched for a wireless phone, you may be more interested in content that has your search terms in it and has also been tagged by users. one or more of the tags may help you to find what you're looking for. the number of tags that appear is configurable by default it's 10, but there could be many more as a result of a particular search. configuration options later in the chapter. for now, let's see how drilling down to drill down into the search, click a facet to add it to the filter list, and the results to the right are refined by the facet you selected figure 5.9 drilling down creates a list of what you selected at the top of here we can see that we've selected one of the tags, liferay, to further the tag appears in a list at the top, and there's a red x next to it that lets us remove it from our filter as we work to increase the but maybe selecting only the tag isn't enough to filter our search into something small enough to sort through. further refine the search by selecting another facet, as below figure 5.10 selecting another facet further refines the now we've selected web content, which is one particular content type within liferay, and the list of potential hits on our search terms has been in this way, you can interactively tweak the search results to narrow them down, making it easier to find that proverbial needle searching can only be done on assets. as has already been described in this chapter, just about any entity in the portal is an asset and can be indexed and under the hood, this means that these entities use liferay's asset api developers can create custom searchable assets within the portal. for this reason, you may have additional asset types defined in your portal beyond the ones that liferay ships with by default. wish to tweak the frequency threshold and the max terms settings to increase the number of asset types displayed past the default of 10. the section below on search options if tags have been applied to any asset that appears in the result set, it may be displayed in the asset tag facet. tags are handled in a similar way to how asset types are handled not all tags may appear. the 10 tags listed, but the default configuration for this facet is to show the as with asset types, this can be modified by if categories have been applied to any asset that appears in the result set, they may be displayed in the asset categories facet. thing as the two sections above. that last sentence was written to check if let's move on to advanced searching the search portlet's search box is deceptively simple. single field for search, there's a search syntax inherited from that lets you create very powerful search queries. searching for specific fields by default, searches are performed against a sometimes you want results for a term within a particular this can be achieved using the field search syntax fieldterm. example, to search in the title field for liferay, use the following if you search for a phrase within a field, surround the term with double wildcards you can use wildcards in exactly the way you use them with your operating system for a single character wildcard, use?; for the multiple character wildcard, use boolean operators you can use logic operators, such as and, or, not, , the and operator matches assets in which the terms between the and operator exist. for example, to search for both liferay and kaleo workflow, use this query the or operator is the default; if there's no operator between two terms, the or finds matches if any term exists in an asset the operator requires that the term exists somewhere in some field in the if you wanted to search for something that must contain liferay and may contain portal, use this query the not operator excludes assets that contain the term after the not it requires that at least two terms be present the - operator is similar it excludes assets that contain the term after the grouping you can use parentheses within your queries to form sub-queries, in a similar fashion to an sql statement. for example, to search for liferay or social office and website, use this query as you can see, the search syntax is very powerful. it than what is listed here; to view the full syntax, visit the lucene url next, we'll look at how the search portlet can be configured as with liferay's other portlets, you can configure the search portlet via the configuration screen, which looks like the below illustration figure 5.11 basic search configuration is pretty straightforward display asset type facet toggles whether the asset type facet appears display asset tags facet toggles whether the asset tags facet appears display asset categories facet toggles whether the asset categories facet display modified range facet toggles whether the date modified range facet display results in document form never use this in production. use this feature to view search responses in their generic, document-based part of a developer's job when writing search indexers is to convert documents the objects that get indexed to the actual object and back again. this option allows developers to see how their objects are being indexed view in context when an asset is clicked, show it in the portlet to which display main query show the exact search query that the portlet generated again, never use this in production; this is for display open search results shows results from third party open search plugins, if they are installed. this is for backward compatibility only developers are encouraged to re-design their search code as described in liferay in action, and then custom assets are aggregated with native portal these are the basic options, but surely you didn't miss the fact that there are configuring advanced search requires a bit more technical acumen than you might expect, because there are so many properties to tweak. instances, you shouldn't need to change a thing. configuration is done through a json object if you don't know what a json object is, don't worry it's not a difficult is a software development term for anything that can be represented in code. objects have attributes, or sometimes these are called fields, and they are very similar to fields you'd find on a form that you're filling out. developers use the word object to refer generically to anything like this that they can describe in the software; for all intents and purposes, objects could just as easily have been called things. for example, one type of object a user can be represented in code, and it has many fields, such as a name, an email address, and more. the object we're concerned with is called facets. explanation of the settings follows the object below now that you've seen the object, don't be daunted by it. settings within the object that you can tweak classname this field must contain a string value which is the fqcn fully qualified class name of a java implementation class implementing the facet liferay provides the following implementations by default data this field takes an arbitrary json object a.k.a. for use by a as such, there is no fixed definition of the data each implementation is free to structure it as needed. here matches the implementation that's selected in the classname attribute displaystyle this field takes a string value and represents a particular template implementation which is used to render the facet. templates are normally jsp pages but can also be implemented as velocity or freemarker templates provided by a theme if the portal property the method of matching the string to a jsp is simply done by prefixing the string with htmlportletsearchfacets and appending the.jsp extension for example, displaystyle assettags maps to the jsp armed with this knowledge a crafty developer could create custom display styles by deploying custom new or overriding jsps using a jsp hook. developer's guide or liferay in action for more information on hook plugins fieldname this field takes a string value and defines the indexed field on for example, fieldname entryclassname indicates that the specified facet implementation operates on the entryclassname indexed field note you can identify available indexed fields by enabling the search portlet's display results in document form configuration setting and then expanding individual results by clicking the to the left of their titles label this field takes a string value and represents the language key that is used for localizing the title of the facet when it's rendered order this field takes a string value. ordervalueasc this tells the facet to sort it's results by the term values, orderhitsdesc this tells the facet to sort it's results by the term static this field takes a boolean value true or false . a value of true means that the facet should not actually be it also means that it should use pre-set values stored in its data field rather than inputs dynamically applied by the end user. allows for the creation of pre-configured search results imagine you would like to create a pre-configured search that returns only url.dlfileentry and the indexed field extension should contain the values bmp, gif, jpeg, jpg, odg, png, or svg. would need two static facets, one with fieldname entryclassname and another this could be represented using the following weight this field takes a floating point or double value and is used to determine the ordering of the facets in the facet column of the search portlet. facets are positioned with the largest values at the top. yes, the current implementation is counter-intuitive and perhaps could be reversed in future configuring search using a json object is a bit unusual, but as you can see, it's not as hard as it looks initially search is a powerful component of liferay portal's asset framework. proclivity of assets means that there is an extensible, robust, and configurable search mechanism throughout the portal that allows administrators to optimize the search experience of their users. users also get an easy to use search interface that makes use of the tags and categories that they themselves apply to various pieces of content, regardless of the type of content. liferay's search truly for the people. power users can learn an extended search syntax that lets them craft very these searches can be used on large installations with lots of data to find the proverbial needle in the proverbial haystack. can tune the configuration of search portlets so that they are optimized for the next, we'll look at how the asset publisher portlet makes even more extensive use of liferay's asset framework to bring relevant content to users.";;
|
as we create web content, it's important to keep in mind that to liferay, the pieces of content are assets, just like message board entries and blog posts. this allows you to publish your web content using liferay's asset publisher you can use the asset publisher to publish a mixed group of various kinds of assets such as images, documents, blogs, and of course, web content. in creating a more dynamic web site you can place user-created wiki entries, blog posts or message board messages in context with your content. the asset publisher portlet is a highly configurable application that lets you query for mixed types of content on the fly. control what and how content is displayed from one location, the asset publisher helps you to bubble up the most relevant content to your users to get to all the portlet's options, click the configuration link in the portlet's menu the wrench icon the ability to configure how content is displayed and selected by your users further demonstrates the flexibility of the asset publisher. you can select it manually for display in a similar way to the web content display portlet or you can set up predefined queries and filters and let the portal select the content for you, based on its type or its let's first look at how we might select content manually. very similar to the web content display portlet by selecting manual from the select box beneath asset selection, you tell the asset publisher that you want to select content manually. what you want to be published within the portlet, or you can create new content from within the asset publisher figure 5.12 selecting assets manually is very similar to the web content display portlet, except you have many other content types to choose clicking add new gives you a menu of options, enabling you to create the documents, images, and of course, web content. anything you create here is added to the list below of assets that are displayed by the portlet clicking select existing gives you a similar menu, except this time you can pick from existing content in the portal that either you or your users have has someone written an excellent wiki page that you want to highlight? select it here, and it will be displayed the asset publisher enables you to mix and match different content types in the once you have your content selected, you can move on to the display types to configure how the content appears most of the time, however, you'll likely be using the asset publisher to select the asset publisher's default behavior is to select assets dynamically according these rules can be stacked on top of each other so that they compliment each other to create a nice, refined query for your you have the following options for creating these rules scope choose the scopes from which the content should be selected. be either the scope of current site, the global scope, or both asset type choose whether you'll display any asset or only assets of a specific type, such as only web content, only wiki entries, or any combinations figure 5.13 you can filter by tags and categories, and you can set up as many filter rules add as many filters on tags or categories as you like. choose whether the content contains or does not contain any or all categories or once you've set up your filter rules for dynamically selecting your content, you can then decide how the content will be displayed the display settings section gives you precise control over the display of your there are a multitude of options available to configure how you want you can configure the style, length of abstracts, behavior of the asset link, maximum items to display, pagination type and file additionally, you can enable printing, flags, ratings, comments and comment ratings, and these work the same way they do in the web content display you can display the content returned by the filters above in order by title, create date, modified date, view count and more in ascending or descending for instance, you may have a series of how to articles that you want displayed in descending order based on whether the article was tagged with the or, you may want a series of video captures to display in ascending order based on a category called birds. vocabularies are groups of categories defined by administrators in the categories section of the control panel in the ordering and grouping section of the asset publisher, you have great control over how content is ordered and grouped in the list, but this is only one aspect of how your content will be displayed. through many other display settings note the following actions will have immediate effects in your asset publisher other changes in the rest of the options will come into effect after clicking save.;;
|
"the display settings section gives you precise control over the display of your there are a multitude of options available to configure how you want you can configure the style, length of abstracts, behavior of the asset link, maximum items to display, pagination type and file additionally, you can enable printing, flags, ratings, comments and comment ratings, and these work the same way they do in the web content display abstracts shows the first 200-500 characters of the content, defined by the table displays the content in an html table which can be styled by a theme title list the content's title as defined by the user who entered it full content the entire content of the entry asset link behavior the default value is show full content. value selected, when the link to an asset is clicked, the full asset is displayed in the current asset publisher. if the value view in a specific portlet is selected, clicking on an asset causes that asset to be displayed in the portlet to which the asset belongs. for example, a blog entry would be displayed in the blogs portlet where it was created. would be displayed in the message boards porlet where it was created. a generic web content instance would be displayed in the asset publisher of its see the secton below on display pages for more maximum items to display you can display 1-100 items pagination type select simple or regular. navigation; regular includes a way of selecting the page to which you'd like to exclude assets with 0 views if an asset has not been viewed, exclude it show available locales since content can be localized, you can have different versions of it based on locale. this will show the locales available, enabling the user to view the content in the language of his or her choice enable conversion to if you have enabled liferay portal's url integration, you can allow your users to convert the content to one of several below these options are the same ones in the web content display portlet enable show metadata allows you to select from the available metadata types see enable rss subscription this lets users subscribe to the content via rss the display settings section of the asset publisher has numerous options to help you configure how your content selections are displayed to your users. though there are many choices, it's easy to go through the options and quickly adjust the ones that apply to you. you'll want to use the asset publisher to query for mixed assets in the portal that have relevant information for your next, we'll look at display pages, an addition to the asset framework introduced if you've been using liferay for a while, or you've just spent a little bit of time with this guide, you might have noticed something about how liferay handles web contentcontent is never tied directly to a page. because it means that you don't have to recreate content if you want to display the same thing on multiple pages, it also means that you don't have a static url for any web content, which is bad for search engine optimization as an improvement, liferay has introduced the concept of display pages and each web content entry on the portal has a canonical url, which is the official location of the content that is referenced any time the content a display page can be any page with an asset publisher configured to display any content associated with the page. content instances, you can select a display page, but only pages with a configured asset publisher are available for selection to create a display page, you can create a page yourself, add an asset publisher portlet and configure it yourself. alternatively, you can use the content display page page template included with liferay. page manually, once you've added an asset publisher portlet to the page, open then check the set as the default asset publisher for also, for its display settings, set the display style to abstracts and the asset link behavior to view in a specific portlet you may now be thinking, wait, you just told me that each web content item has its own url, and that this is somehow related to pages where we display a whole bunch of content on the same page? watchcreate a display page called my web content display page somewhere on your portal, using the content display page template. click the add web content button, enter a title and some content, click on display page at the right, and select the display page you just created. figure 5.15 selecting a display in the asset publisher of the my web content display page, you can now click the read more link to display the content. notice that the canonical url for content appears in your browser's address bar. display page, any additional portlets that you place on the page are displayed along with the content when you access it via the canonical url. content display page page template for your display page, it not only features a configured asset publisher portlet but also a tags navigation, a categories navigation, and a search portlet. these tools help users to quickly identify let's move on to another new featured introduced by liferay 6.1.";;
|
"whether you plan to build a social network or enable social applications as part of your overall user experience, liferay portal has the tools to make those starting with a suite of applicationsincluding a profile summary, activities feeds, social requests, a wall, and moreand rounding things out with an api to handle relationships between users as well as publish their activities to each other, liferay portal helps you implement common features of social networks to enhance your existing site figure 1.7 liferay portal provides feeds of social activities. can contain entries from any of liferay's built-in applications or applications social relationships within liferay portal are ideally suited for many different kinds of implementations, whether you're building a public social network or want to enable social features in your corporate intranet. relationships within the system, allowing them to see updates from those whose that's far more powerful than having them subscribe to multiple individual rss feeds or visit multiple profiles, because the system keeps track of the updates from those with whom you have a relationship, more than this, however, liferay is a great integration platform for social it fully supports the opensocial framework. portal's built-in opensocial gadget editor to create and serve your own figure 1.8 liferay portal's opensocial gadget editor lets you rapidly create social applications that can be served across the web to any other opensocial liferay portal also supports the creation of facebook applications; in fact, no additional coding is necessary to publish your liferay applications on facebook you would, of course, need to use facebook's api to use facebook-specific featuressuch as posting on users' timelines. the only thing you need to do is get an api key and canvas page url from facebook figure 1.9 any liferay application can be published to multiple social as you can see, liferay portal is built for social applications adding social features to your web site, creating a social network of your own, creating social applications to be published on other web sites, or building a social as with social applications, liferay portal is also an easy to use, robust platform for any web application you're considering writing. this, liferay portal is easily configured to be used as a shared hosting let's look at the benefits you can reap by using liferay portal in these ways.";;
|
we can't even begin to imagine what you're thinking of building, but whatever it is, you're going to put your heart and soul into it. web platform can give you a leg up, by providing to you everything you need to support your application, so you can concentrate solely on what you're building, and not the rest of the features your users expect will come along imagine your application for a moment. does it require users to register with will they be able to comment on content contained within your is there some asset that users can tag or categorize? about the layout of the application, would it benefit from modularization? you make use of a rich javascript framework with many components built into it? how about securitywill you need to make information available to some users, liferay portal has all of this and more available to the developer, so you don't have to write it yourself liferay portal's development framework is a great help when you're building a while the framework itself is covered in other resources such as the liferay developer's guide or liferay in action, the strengths of liferay as a platform are also apparent once you've finished writing your for example, bug fixes to your applications are easy to apply, because liferay applications are hot deployed to the running server. you a ready-made shopping center for your applications. services and json architecture make it easy for you to share data from your applications to other systems running on different platforms you get all thisnot to mention the automatic facebook and opensocial integration mentioned abovesimply by using liferay's development platform. it's a very powerful platform, and certainly worth your investigation if you're building an enterprise system, portals were designed in the first place to be a single point of entry to your users' applications and content. since liferay portal integrates well with user directories such as ldap and active directory, and single sign-on systems such as saml and opensso, it fits well into your enterprise systems. this allows you to use it as an integration platform for existing applications liferay portal, since it adheres to the jsr standard for portlets, was designed from the ground up for application integration. application installed in the system on any page within the portal. use of any apis provided by other systems to integrate their data into an and applications you create with liferay's service builder api are web service-enabled from the start liferay portal excels as a multi-site hosting platform. multiple sites under the same overall architecture like facebook, myspace, or pinterest offer to their users, or you could host several completely different web sites based solely on liferay's ability to serve multiple instances of itself from the same physical installation in the first scenario, liferay portal's sites architecture lets you create multiple, different web sites that have public andor private sets of pages and as many pages within those sets as you'd like. users join the web site, and once they're members, they can join and leave open sites with one click. can be defined as restricted or private, and users can't access those unless they're added by site administrators. all of these sites can have canonical domain names such as url or url using this construct, you can build anything from facebook, to yahoo groups, to sourceforge, to the now-defunct-but-once-loved geocities. the number of sites you can have some liferay installations have only one or two, but others have many thousands in the second scenario, liferay portal lets you create completely separate instances of itself from the same installation. sites, and roles from each instance are kept completely separate. registers for a user id on one instance, he or she would have to register as a new user on another instance as well this lets you host many different, separate web sites from one liferay portal users of each instance have access to the same powerful content management, collaboration, social, and web development platform that they'd have if they were operating from a single, standalone installation.;;
|
web content management is a system which allows non-technical users to publish content to the web without having advanced knowledge of web technology or liferay wcm empowers you to publish your content with a simple point and click interface and it helps you to keep your site fresh. you'll find yourself easily creating, editing and publishing content within just a few minutes of being exposed to its features. sacrifice power for simplicity. if need be, you can use your developer skills to create complex presentation layer templates that make your content pop with once these templates have been deployed into the portal, your non-technical users can manage content using these templates as easily as they all of this makes liferay wcm an appropriate choice for sites with only a few pages or sites with gigabytes of content in this chapter, we'll cover the following topics as you'll see, liferay's wcm is a full-featured solution for managing your web we'll start with an overview of what it has to offer and then we'll dive note that web content is just one kind of asset on other types of content blog posts, wiki articles, message board posts, etc. are also considered assets. liferay provides a general framework for handling assets that includes tags, categories, comments, ratings, and more. please see chapter 5 for more information on liferay's asset framework.;;
|
with liferay's wcm you have the ability to create, edit, stage, publish and approve content with easy to learn yet powerful tools. the content creation process for end users. it's much faster to use liferay's wcm than it would be to create all the content for your site in html. liferay wcm makes this possible include once you get familiar with liferay wcm you'll wonder how you ever got along liferay's wcm has a host of features the makes managing the content of your site wysiwyg editor a complete html editor that allow you to modify fonts, add color, insert images and much more structure editor easily add and remove fields you want available to content creators and then dynamically move them around. an entire suite of form controls you can drag and drop onto your structure template editor import template script files that inform the system how to display the content within the fields determined by the structure web content display a portlet that allows you place web content on a asset publisher a portlet which can aggregate different types of scheduler lets you schedule when content is reviewed, displayed and workflow integration run your content through an approval or review staging use a separate staging server or stage your content locally so you can keep your changes separate from the live site liferay's web content management is a powerful and robust tool for creating and organizing content on your web site. let's begin by examining some basic concepts involving sites and pages.;;
|
with most products, you would learn what the software can do in terms of setting up your users and security model and then start building your system. design your infrastructure and get your server environment up and running while your developers write the applications that live on your web site. portal, however, you start farther ahead. liferay portal is more than just a container for applications with a robust security model. many of the applications you'll need, out of the box, ready to go and integrated with all the user management and security features you've already learned about nearly all liferay users use liferay's web content management system wcm. after all, all every web site has content that needs to be managed. wcm empowers you to manage all the content on your site quickly and easily beyond managing existing content, liferay wcm lets users easily create and manage everything from a simple article containing text and images to fully functional web sites. web publishing works alongside liferay portal's larger collection of applications, which means you can add shopping cart functionality, visitor polls, web forms, site collaboration tools and more. everything is done with our collection of easy-to-use tools with familiar rich-text editors and an intuitive interface in this section we'll cover some basic aspects of liferay wcm, including by the time we're done, you should be able to apply all these concepts to your to demonstrate liferay's content management features, we'll create and manage content on the portal for nose-ster, a new social network where people are connected based on what their noses look like if we're going to be nose-ster, our portal should also be called nose-ster. to set general information about your portal like the name and mail domain, go to the control panel and select portal settings under the portal heading. you could set up the configuration for you can also customize the logo in the top left corner of every page by selecting display settings under the miscellaneous tab on the panel to the once you've made the changes, we can begin creating pages you have a few options for accessing the page creation interface. this, we'll cover the dockbar's manage menu slightly out of order. two interfaces to be aware of site pages and page. depending on what you're editing and where you are on the portal, you'll use either the manage menu or the control panel to work with from the control panel, make sure you have the correct site selected in the context menu selector and click the site pages link in the content if you've already navigated to the site you wish to manage, click manage from the dockbar and select site pages. interface you see in the control panel. to manage the specific page of the site you've navigated to, click manage and select page figure 2.2 managing individual for convenience, you can also navigate to the sites page under the portal section of the control panel and click actions manage pages. quickly add a single page while to the site you're browsing, click add from just enter a name for the page and it's added click the name of the page in the navigation menu to visit it and site pages is an interface to view existing pages, create new pages, view pages and export or import pages using liferay archive lar files. you can switch between managing a set of pages and managing a single page using the left-hand side navigation menu. click on public pages or private pages to manage the group or click on an individual page to manage just that one. switching views like this changes the list of available tabs to the right. default, url, which we renamed to url, contains a single public liferay's page groups are always associated with sites. pages are part of their personal sites. all pages belong to one of two types of page sets public pages and private pages. accessible to anyone, even non-logged in users guests. accessible only to users who are members of the site which owns the pages. means the private pages of an organization's site would only be viewable by site members and members of the organization regardless of whether the pages are public or private, liferay uses the same let's look at this interface more closely from the manage site pages dialog box, you can add a page to the site by because public pages is selected on the left, clicking add page here adds a top level page next to the welcome page. can, however, nest pages as deeply as you like. welcome page, select the welcome page first and then create your page. later decide you don't like the order of your pages, you can drag and drop them in the list to put them in whatever order you want. another top level page and name it community. recent bloggers and wiki portlets when you create a new page, you can create either a blank page or a page prepopulated with portlets from a page template. of the page, you can select from a list of page templates that are currently to view the pages once you add them, click the view pages button. this is how you'd populate your pages with content and applications. if you're using the manage pages interface to create a new page, you'll have some additional options to create different types of pages. pages, panel pages, embedded pages, url pages and link to by default, all pages are created as portlet pages but in some situations you might want to use one of the other options portlet pages are the pages we're usually talking about. which you can drag and drop portlets into. most of the pages you create will be panel pages can have any number of portlets on them, as selected by an administrator, but only one will be displayed at a time. portlet they want to use from a menu on the left side of the page and the selected portlet takes up the entire page embedded pages display content from another website inside of your portal. an administrator can set a url from in the page management interface and that page will appear in the context and within the navigation of your liferay url pages are just redirects to any url specified by an administrator. can use url pages to create links to pages belonging to other sites of your portal or to pages of an external site. use url pages cautiously since blind redirects create a poor user experience link to page creates a portal page which functions as an immediate redirect to another page within the same site. you can select which page to link to from a dropdown in the page management interface. you could use a link to page to place a deeply nested page in the primary navigation menu of your site, for once you've created pages and populated them with content, liferay provides a way for you to back them up to separate files. next to the add page button in the manage site pages screen are two buttons the export button exports the pages you create into a single file, called a lar liferay archive. file into any server running liferay to re-create the pages. you would like to import, use the import button. is a great way to take content from one environment say, a development or qa environment and move it all in one shot to your production server. you should not make this a regular occurrence. pages from one server to another, you should use liferay's staging environment, lars are also a good way to back up your site's content. a specific location on your server which is backed up, and if you ever have to restore your site, all you need to do is import the latest lar file. limitation on lar files, however, is that they are version dependent, so you can't use an export from an old version of liferay and import it into a newer let's be good administrators and export a lar file for backup purposes. the export button and then name the file url. to determine what you'd like to export. for this initial export, select note that if you select the more options link, the list expands to include data from many of liferay's applications, including the documents and media library, message boards and web content. once you click export, your browser prompts you to save the file. have the file, you can copy it to a backup location for safekeeping or import it into another installation of liferay portal. revert back to this version of your site, you can import this file by clicking the import button from the manage site pages dialog box, browsing to it and next, we'll look at the options on the right side menu, starting with look and when you open the manage site pages dialog box it defaults to the look and feel on this tab, you're presented with an interface that allows you to choose a themes can transform the entire look of the portal. they are created by developers and are easily installed using the liferay since we don't have any themes beyond the default one installed yet, we'll use the default theme for our pages figure 2.6 look and feel interface many themes include more than one color scheme. existing look and feel while giving your site a different flavor. color scheme from blue to green by selecting green under color schemes. you now go back to the site by clicking back to url in the top left corner of the control panel, you'll see some parts of the page are now tinged if you apply a color scheme to a set of public or private pages it is, by default, applied to each page in the set. if, however, you open the manage pages dialog box for a particular page, you can select define a specific look and feel for this page to make the color scheme apply to this page only. use this feature to choose a different color scheme for a particular page than the one defined for the set of public or private pages to which it belongs there are a few more configurable settings for your theme. bullet style between dots and arrows and you can choose whether or not to show also notice themes can apply to regular browsers or mobile devices. create another site for mobile users attached to the url address and serve up a page designed for the smaller screens on phones the css section allows you to enter custom css that will also be served up by in this way, you can tweak a theme in real time by adding new styles the next option configures the logo that appears for your site if you want to use your own logo for a specific site, use the logo tab. custom logo is easy select the logo tab and browse to the location of your make sure your logo fits the space in the top left corner of the theme you're using for your web site. if you don't, you could wind up with a site that's difficult to navigate, as other page elements are pushed aside to make in the logo tab, you can also choose whether or not to display the site name on if you check the box labeled show site name the site name will appear in the the top right corner of the page. default and cannot be disabled if the allow site administrators to set their own logo option is disabled in portal settings. the default site only newly created sites and user pages have the option to if you click on javascript from the site pages interface for a page set either public pages or private pages, you'll find a window where you can enter javascript code the will be executed at the bottom of every page in the site. if your site's theme uses javascript as is usually the case, it's best to add custom javascript code to the theme and not in this window. your site's javascript code remains in one place using the javascript window of your site's site pages interface may be useful if your site's theme does not use javascript. in this case, the javascript window of your site's site pages interface will contain all of your site's javascript and you can add some dynamic features to your site's pages next, let's look at an advanced feature of the site pages interface merging the current site's pages with the pages of the default site if you click on advanced from the site pages interface for a public page set, you'll find an option to merge the public pages of your portal's default site with the public pages of the current site. if you enable this option, the pages of the default site appear in the current site's navigation bar, along with the also, the pages of the current site appear in the navigation bar of the default site, along with the default site's pages. merging of pages only affects the list of pages in the default site's and the current site's navigation bars. this allows users to more easily navigate from the current site to the default site, and vice versa. enabled for the public pages of both personal sites and regular sites note that this merging of pages is not a hard merge. that the site administrators of twenty different sites on your portal all enabled the merge default site's public pages option. these different sites be merged into each site's navigation bar? instead, the portal keeps track of the current scopegroupid the id of the current site and the previous scopegroupid the id of the if the merge default site's public pages option is enabled for either the current site or the previous site, the pages of the default site are merged in the pages of the other site for example, suppose that your portal has three sites the default site, site a, and site b. all three sites have some public pages. default site's public pages option enabled, site b does not. logs in, he's directed to the default site. the scopegroupid is that of the default site and there is no previous scopegroupid, so no additional pages appear in the default site's navigation bar. then suppose the user navigates to site a. site a has the merge default site's public pages option enabled, so the default site's pages are added to site a's navigation bar. goes back to the default site, site a becomes the previous site so site a's pages are added to the default site's navigation bar. site b, no additional pages appear in site b's navigation bar because site b does not have the merge default site's public pages option enabled. user navigates back to the default site, site b becomes the previous site, and, again, since site b does not have the merge default site's public pages option enabled, no additional pages are added to the default site's navigation menu next, let's examine how to configure individual pages when you select a single page, some different options appear. details lets you name the page for any localizations you need. set the html title that appears in the browser window for the page. set an easy to remember, friendly url for the page seo provides several means of optimizing the data the page provides to an indexer that's crawling the page. you can set the various meta tags for description, keywords and robots. there's also a separate robots section that lets you tell indexing robots how frequently the page is updated and how it if the page is localized, you can select a box to make liferay generate canonical links by language. if you want to set some of these settings for the entire site, you can specify them from the sitemaps and robots tabs of the manage site settings dialog box see below tip in previous versions of liferay, it was possible that a single page could be indexed multiple times. that direct to the same page will only create one entry in the index. of the url which provided additional information about the referring page had different entries in the index. as of liferay 6.1, each asset web content article, blog entry, etc. has a unique url. from the search engine's point of view, this will make your pages rank higher since any references to variations of a specific url will all be considered references to the same page. look and feel lets you set a page-specific theme layout lets you specify how portlets are arranged on a page. the available installed templates to modify the layout. developers to define custom layouts and add them to the list. more thoroughly in both the liferay developer's guide and in liferay in javascript gives you the ability to paste custom javascript code to be custom fields if custom fields have been defined for pages which can be done from the custom fields page of the control panel, they appear here. these are metadata about the page and can be anything you like, such as author advanced contains several optional features. this can become useful to web content templates, which you'll see in the next chapter. you can set a target for the page so that it either pops up in a particularly named window or appears in a frameset. you can set an icon for the page that appears in the navigation menu mobile rule groups allows you to apply rules for how this page should be rendered for various mobile devices. you can set these up in the mobile device rules section of the control panel customization settings lets you mark specific sections of the page you want note that the manage page layout menu directs you to the same layout page layouts allow you to arrange your pages so the content appears the way you liferay comes with many layouts already defined. create more and they can be deployed to your portal for your use to prepare for the portlets we'll soon be adding, let's change the layout of the to access layouts, select manage page layout from now, select the 2 columns 7030 layout and click save. return to the page and it'll seem as though nothing has happened. adding portlets, however, you'll notice the page is now equally divided into two you can stack portlets on top of each other in these columns. are, of course, more complicated layouts available and you can play around with them to get the layout you want sometimes a particular layout is almost what you want but not quite. case use the nested portlets portlet to embed a layout inside another layout. this portlet is a container for other portlets. the layouts installed in liferay, just like the layouts for a page. you virtually unlimited options for laying out your pages the next option in the manage menu is page customizations page customizations are a new feature in liferay 6.1. any user with the appropriate permissions can create personalized versions of before users can create personalized versions of pages, customizations must first be enabled by an administrator. activate or deactivate customizations for any row or column on any page. users customize a page, they have the option to use either their version or the users can't see alternate versions of pages other when an administrator activates page customizations for a page, any portlets that are in a customizable row or column can be moved around the page or users can add new portlets of their own choosing to these columns of the page and can also customize portlet configurations. time users determine they don't like their customizations, they can click reset my customizations to revert their pages back to the default. information about page customizations, please refer to the page customizations now that you know how to enable page customizations, let's look at the settings as with site pages, you can access site settings through the control panel or directly from the site using the dockbar manage site settings you'll find options to specify details and metadata about your site, set up friendly urls and virtual hosts, configure search engine optimization settings, turn staging on or off and specify a google analytics id. details allows an administrator to change the description and membership type of a site and also to specify tags and categories for the site. membership type can be set as open, restricted or private based on the privacy users can join and leave an open site at will. restricted site, a user has to be added by the site administrator. also request to be added through the sites section of the control panel. private site is like a restricted site but doesn't appear in the sites section of the control panel for users who aren't members pages from site settings, click on pages to manage some basic features of if no pages have been defined yet, you can set site templates for the public or private pages. if pages already exist, links are you can also change the site's application adapter, which is a special type of hook plugin that customizes out of the box functionality site url set a friendly url andor a virtual host for your site here. friendly url option lets you manage the path to your site in the portal's url. friendly urls are used for both public and private pages. friendly url is appended to friendly url is appended to to be a unique name, of course. having a human-readable friendly url assists indexing bots and is critical to good search engine optimization for example, suppose you were creating a portal for a bank called the best bank. if you set the friendly url of your portal's default site to best-bank, the url of your default site's public home page would change to if your portal's default site had private pages, the url of the default private home page would change to note that if you're adding a friendly url for your portal's home page, you should update your portal's home url field so that page requests to to do this, navigate to the portal settings page of the control panel and find the home url field in the navigation for our bank example, we would enter webbest-bankhome into the once you've entered this setting, page requests to localhost8080 will redirect to the friendly url of your portal's new homepage virtual hosts make web navigation much easier for your users by connecting a this tab allows you to define a domain name i.e., this can be a full domain or a subdomain. enables you to host a number of web sites as separate sites on one liferay for instance, if we set this up for nose-ster's development network, users in that site could use url to get to their site, provided nose-ster's network administrators created the domain name and pointed it to the to set this up, the dns name url should point to your virtual host tab for the developers site. this helps users quickly access their site without having to recall an extended url site template if you've created the site from a site template, this section displays information about the link between the site template and the site. specifically, you can see which site template was used and whether or not it allows modifications to the pages inherited from it by site administrators. you're not using site templates for this site, you can safely ignore this sitemap lets you send a sitemap to some search engines so they can crawl it uses the sitemap protocol, which is an industry standard. publish your site to yahoo or google and their web crawlers will use the sitemap liferay portal makes this very simple for administrators by generating the sitemap xml for all public web sites by selecting one of the search engine links, the sitemap will be sent to them. it's only necessary to do this once per site. periodically crawl the sitemap once you've made the initial request if you're interested in seeing what is being sent to the search engines, select the preview link to see the generated xml robots if you're using virtual hosting for this site, you can configure the robots page gives you the option to configure your url for both public and private pages on a site. don't have virtual hosting set up, this tab is rather boring staging enables you to edit and revise a page behind the scenes, then publish changes to your site once they have been completed and reviewed. full explanation of staging, see chapter 3 advanced web content management analytics allows you to integrate your pages with google analytics. provides seamless integration with google analytics, allowing you to place your id in one place, then it will get inserted on every page. to focus your efforts on building the page, rather than remembering to put the google analytics is a free service which lets you do all kinds of traffic analysis on your site so you can see who visits, where visitors are from and what pages they most often visit. this helps you tweak your site so you can provide the most relevant content to your users now that you know how to configure sites, let's look at page templates and site page templates and site templates are invaluable tools for building similar as you continue to add pages to sites in your portal, you'll notice repeatable patterns in the designs of those pages. enable you to preconfigure a single page and then apply it to any new page you site templates allow you to do the same thing but on the scale of a siteif you have multiple sites that use a similar structure of pages, you can create a single site template and use it to create as many sites as desired. a full explanation of page templates and site templates, see chapter 3 liferay 6.1 makes it easier to access web content management without using the you can now click manage and then site content to access the same web content controls featured in the control panel right from your portal you can manage the following kinds of content for details about liferay's social collaboration suite, see chapter 10 there are a lot of other things you can do beyond placing portlets on a page. let's start working on the nose-ster site. you can do this by going up to the dockbar and clicking go to nose-ster we'll use the community page you created earlier in the chapter. the community page and select manage page from the dockbar this screen should now be familiar to you but let's recap you can also enter custom meta tags or javascript to the page if you're a web additionally, if you click the permissions button, you can define which users, groups, roles or organizations can view or edit the page the children tab lets you create child pages underneath the page you've you can nest pages as deep as you like but for every page below the top level hierarchy you must provide navigation to it via a navigation or breadcrumb portlet, at least with most themes including the default. developers can create themes which have cascading menu bars which show the full some examples of that are in liferay's plugin repositories for now, click return to full page. you should be able to define and manage pages in liferay at this point so let's look at what you'd put on a page as we discussed earlier, liferay portal pages are composed of portlets. your site's functionality, from blogs to shopping, is composed of portlets adding portlets to a page is simple. let's add some to our collaboration page see how easy it is to add applications to your pages? further we've got the wiki portlet, the blogs aggregator portlet and then a nested portlet with a different layout and the alerts, search and dictionary figure 2.10 yeah, we're showoffs. but as you can see, your page layout you'll find it's easy to make your pages look exactly the way you want them to. if the layout options provided aren't enough, you can even develop your own. more information about that can be found in liferay's official guide to by default, public pages are just that public. and private pages are really only private from if someone has joined your site or is a member of your organization, that person can see all the private pages. modify the permissions on individual pages in either page group so only certain let's say we wanted to create a page only for administrators to see. this with the following procedure figure 2.11 permissions for admin you've just changed the permissions for this page so only site any users you add to this role can now see the page. other users, even members of this site, won't have permission to see it pages in liferay are as flexible as pages you'd create manually without a using a point and click interface, you can define your site any way you you can create and remove pages, export and import them, set their layouts, define how they are indexed by search engines and more. been introduced to liferay's concept of sites. interface, you can create multiple web sites and define how users can access them, whether they are linked to a domain name and create all of their pages you now understand how to manage pages in liferay portal. to adding content to those pages. liferay's web content management wcm is a highly powerful, yet flexible, set of tools that enables you to successfully you'll soon discover that liferay's wcm is easy to learn and highly if you already have experience with wcm, you'll see some new features and improvements to old ones. if you're new to liferay's wcm, then you'll be surprised at how fast you will be adding, editing and scheduling once you're familiar with portlets such as web content display and asset publisher, your ability to manage an immense site with a large amount of content will simply amaze you we'll be using liferay's wcm to publish simple pieces of content, develop templates to define how content is to be displayed, set up a workflow for content to be approved, schedule when content is to be published and much, much;;
|
"you've been assigned the task to build a web site for an innovative new social networking site called nose-ster. you've decided to take advantage of liferay portal and its rapid deployment features as well as its ability to get a fully functional, content-rich web site with integrated social features up and running together, we can get you started we'll walk through the creation of nose-ster's web site, starting by creating and publishing some simple content using liferay's built-in wysiwyg editor. we'll then take advantage of liferay's robust structure editor. templates to display the content and then explore some of the advanced publishing features such as the built-in workflow and asset publisher as we've stated above, content is the reason web sites exist. made it easier than ever to get content published to your site. portal is so flexible, you can use basic authoring tools right away or take advantage of the more advanced features. we'll begin by creating simple content using liferay's wysiwyg editor and then we'll publish it to the home page of nose-ster's web site. straightforward process that demonstrates how easy it is to create and publish let's learn about the web content section of the control panel so we can create and publish our first pieces of figure 2.12 choosing a site in the content when you manage web content from the control panel you can select the location for instance, you can add content that's available to a specific site or globally across the portal. control panel displays as its heading the name of the site you're currently this heading is called the context menu selector you can change the scope of where you'd like to view, edit or create content by using the drop-down selector attached to the heading once you have the nose-ster site selected, click on the web content link in next, click the add button under the web content tab. this is a highly customizable form that by default has two fields a title and a we could customize this form to contain whatever fields our content needs but let's keep things simple for now. advanced features such as structures, templates and content scheduling later in for now, type the words welcome to nose-ster in the name field. content can be localized in whatever language you want. localize checkbox, two select boxes appear which allow you to pick the language you're working in and the default language. of your content for any language in the list. the screenshot below shows this interface but for now, we won't be using it, so you can leave it unchecked. the content field, add a short sentence announcing the web site is up and figure 2.13 the web content editor provides many options for getting a new web site up and running is an exciting step for anyone, whether it is a large corporation or a small non-profit charity. momentous achievement at nose-ster, let's give our announcement some of the pomp and circumstance we think it deserves! using the editor, select all the text and then change the style to heading 1 you could insert an image here or even more text with a different style, as demonstrated in the screenshot below. you can also add bullets, numbering, links to another site or custom images. smiley face at the end of our announcement figure 2.14 view your content changes directly in the the wysiwyg editor is a flexible tool that gives you the ability to add text, images, tables, links and more. additionally, you can modify the display to match the purpose of the content. plus it's integrated with the rest of liferay portal for example, when you upload an image to be added to a page, that image can be viewed and manipulated in the documents and media portlet if you're html savvy, liferay wcm doesn't leave you out in the cold. click the source button and write your own html if you wish on the right of the new web content form are options that allow you to figure 2.15 new web content can be customized in various ways using the menu abstract lets you to create a brief summary of the web content. also pair the text with a small image categorization specifies the content type from a list of options. announcements, blogs, general, news, press release, and test. can also create tags to make the content easier to find in a search. these categories are defined by a property in the properties file; see the url property in chapter 20 for further information schedule customizes the date and time your content publishes andor display page lets you determine where the web contents are displayed when the concept of the canonical url is new to liferay 6.1. the canonical url is unique for articles that redirect the visitor to the imagine you have a newspaper with a sports section and a technology section. add a sports page and a tech page to your site, each one with a specific banner you want the articles to appear in the appropriate pages, but you know in liferay articles are not related to pages. often as you like in different web content display portlets or in configured but if you have a view in context link, where will you show this is where you'd use a default display page. a default display page defined are shown with other related articles in imagine you have 100 sports articles and 100 tech articles. of liferay you'd need to create a page for each article to show it. only one sports page and one tech page, you can show all articles in one place there are two ways of creating a display page. page template, which automatically creates everything you need, or you can the content display page template is found under page templates in the portal section of the control panel to create a display page manually, add an asset publisher to a page. it the default asset publisher for the page. this defines this asset publisher as the one that displays the content if several asset publishers are on the same set this up by clicking configuration on your asset publisher. setup tab, navigate to display settings and check the checkbox labeled set as the default asset publisher for this page once you've given an article its default display page, links to the article redirect the user to its default display page. asset publisher to another page, like the home page of the newspaper, and configure it to view in a specific portlet. you'll be redirected to the default display page of the article you now see that the link looks something like this this is an example of a canonical url, and it's a nice enhancement for search engine optimization seo because the article's url becomes the page url. search engine that's crawling your site, this means that the location of your and if you decide to use the content on another page in the future, the article is still available at this url. search results, in related assets and in asset publishers. on liferay's display pages, see chapter 5 related assets enables you to connect any number of assets within a site or across the portal, even if they don't share any tags and aren't in the same you can connect your content to a blogs entry, message boards message, web content, calendar event, bookmarks entry, documents and media document, and figure 2.16 this blog entry has links to three related assets one web content display and two blog entries you'll learn how to publish links to related assets using the related assets portlet in the defining content relationships section of chapter 5 permissions customize who has access to the content. viewable by anyone guest role. you can limit viewable permissions by selecting any role from the drop-down or in the list. provides the ability to customize permissions in more detail. options link next to the drop down button and you'll find the different activities you can grant or deny to your web content figure 2.17 permissions for web content allow you to fine-tune how your custom fields customize metadata about the web content. represent anything you like, such as the web content's author or creation date. if custom fields have been defined for web content which can be done from the custom fields page of the control panel, they appear here for more information on custom fields see the custom fields section in chapter for this piece of web content, we don't need to change anything. finished with permissions, click save as draft. once you're satisfied with your changes, select publish. makes the content available for display, but we still have some work to do to in liferay wcm, all content resides in a container, which is one of two portlets web content display or web content list. the most frequently used is the web content display portlet.";;
|
"now that we've created and published our first piece of web content for nose-ster, it's time to display it. first, add the web content display portlet to our welcome page by selecting add web content display from the figure 2.18 adding the web content display once the portlet appears, drag it to the position on the page where you want you can have as many web content display portlets on a page as you need, which gives you the power to lay out your content exactly the to add existing web content, select the gear icon on the lower left of the you will see the message please select a web content from the list naturally, if your content appears in the list, you can simply select it. there is lots of published content available, you could search for the content by name, id, type, version, content and site click the advanced link to see you can also show the available locales for your content. you're working on the page for a particular language, you can select the translation of your content that goes with your locale figure 2.19 publishing web content is a snap. select the content you wish to publish. you can also enable lots of optional features to let your users interact with your if you have enabled url integration with your portal, you can also this gives your users the ability to download your content in their format of choice. you are running a research or academically oriented site; users can very quickly download pdfs of your content for their research projects note that you also have other options, such as enabling a print button, enabling ratings so users can rate the content, enabling comments and enabling ratings on the print button pops the content up in a separate browser window that contains just the content, without any of the web site navigation. enabling ratings shows one of two ratings interfaces liferay has five stars or thumbs up and thumbs down. see chapter 12 for further information enabling comments creates a discussion forum attached to your content which users can use to discuss your content. enabling ratings on comments gives your users the ability to rate the comments. you may decide you want one, some or none of these features, which is why they're all implemented as simple check boxes to be enabled or disabled at need if you click the supported clients tab, you'll see you can choose the type of client to which you want to expose content. screens of users' computers for expansive graphics and lots of special effects or target the small screens of mobile devices with pertinent information and a for now, leave both checked and click the save button. can now close the configuration window to publish new content, select the page and green plus icon on the lower left this launches the same full-featured editor you've already seen in the control panel, which lets you add and edit content in place as you are this is another example of the flexibility that liferay portal offers. you may want to add content directly into the web content display portlet of the page you're managing, especially if you are in the process of building the page. at other times, you may want to use the control panel to create content, because at that moment you're more concerned with the creation of the content and not where the content will later be displayed. liferay wcm supports both processes editing content that's already been published is just as easy as creating new you'll use the same exact tools once the content is displayedwhether you've selected content or created it in the web content display portletyou can edit the content directly from the web content display portlet or from the control panel. content display portlet, select the pencil icon to the lower left of the this launches the wysiwyg editor and from there you can make any figure 2.20 edit, select and add icons of web content display when you publish your content this way, it becomes available immediately unless, of course, you have a workflow enabled, which we'll see below. happens whether you edit it in place or in the control panel note if you want to view your page the way your users will see it i.e., without all those portlet controls and icons, go up to the dockbar and select this makes all those extra controls you see as a portal if you need to use those controls again, just select that's pretty much all there is to simple content creation. but if you want to take advantage of the full power of liferay's wcm, you'll want to use structures and templates found in chapter 3. next, let's see how you can manage your content with an approval process called";;
|
workflow is essentially a predetermined sequence of connected steps. wcm, workflow is designed to manage the creation, modification and publication you can set up a workflow so content can't be published without going through an approval process you design. in this way, content is published to the site only after it has been reviewed and approved liferay's workflow engine is called kaleo workflow and it ships with liferay ce. if you have uninstalled it or are using ee, it needs to be installed and what came firstthe chicken or the egg? problem, for now, we'll assume it's installed and look at how you can take advantage of workflow in getting your content through any approval steps between creation and publication you may have noticed something appears to be missing from the staging process in particular, you might be asking the question, how do i starting with liferay 6.1, staging is integrated with liferay's to have a review process for staged pages, you need to make sure you have a workflow engine configured and you have staging set up in the to do this, select the workflow definition desired for page revisions when using a workflow, clicking submit for publication submits the staged once all necessary approvals have been completed, the page status is marked as ready for publication. schedule for publication options publish the last version of the selected pages marked as ready for publication to enable workflow for web content, navigate to the control panel and select from there, select a workflow that has been deployed figure 2.21 enabling workflow for content as you'll discover in chapter 10, you can design workflows to suit your organization's approval process. for nose-ster's implementation we'll use the single approver workflow which ships with the product let's set up liferay's workflow for the nose-ster web site. kaleo workflow plugin installed in order for the workflow categories to appear liferay's kaleo workflow engine ships with ce versions of for installation instructions for liferay ee, please see chapter 10 go to the control panel and select workflow configuration from the left from the select box, choose single approver for web content. note that you can add workflow to many of liferay's portlets that's all it takes to set up workflow for web content. enabled, publishing content works a little bit differently. process of publishing details for new class offerings at nose-ster. the home page and click the add web content icon on the web content display call the new content course offerings and enter some content. that the publish button is now gone. in its place is a submit for publication next, go to the workflow tasks in control panel and then select my workflow you will see the option to review content for sales goals. because you are logged in as an administrator. there is also a content approvers role which is defined by this workflow and anyone in this role can approve to approve the content, you must first take ownership of it. you should see the screen below taking ownership of, reviewing and approving content is very easy in a real world situation, you obviously wouldn't want the person who created the content to be the one who approves it. instead, you would have one or more roles designed for users who will be creating content and you would have specific users assigned to one or more roles for approving content. was of a very straightforward workflow, as it has only a single approver. workflow allows you to design workflows that go through as many steps as you need to conform to your business processes. we look at kaleo workflow in more;;
|
in the previous chapter we looked at some basic ways you can use liferay to in this chapter we'll delve deeper into slightly more but don't be alarmed, it's not too we'll cover the following topics we'll examine how web content structures and templates provide additional power and flexibility to the web content management system we saw in chapter 2. also learn how easy it is to set up and administer multiple sites in liferay. next, we'll learn how you can empower your users to create personal we'll also examine how you can use staging to manage the publication of pages and content on your site. sections on creating teams and rules for presenting site pages to mobile once finished with this chapter, you'll be the envy of your peers as they'll think you really know what you're doing.;;
|
if you've ever launched a web site, you know that as it grows, you can this is the case especially if you've given lots of people access to the site to make whatever changes they need to make. preset limitations, users can display content in any order and in any manner they desire think huge, flashing letters in a font nobody can read. can get stale, especially if those responsible for it don't maintain it like and sometimes, content is published that should never have seen the thankfully, liferay wcm helps you handle all of those situations. structures to define which fields are available to users when they create these can be coupled with templates that define how to display that content won't get stale, because you can take advantage of the scheduling feature to determine when content is displayed and when it's additionally, you can configure liferay's built-in workflow system to set up a review and publishing process so only what you want winds up on the liferay portal gives you the management tools you need to run everything from a simple, one-page web site to an enormous, content-rich site all of this starts with structures structures are the foundation for web content. they determine which fields are available to users as they create new items for display. improve manageability for the administrator, they also make it much easier for for example, say you're managing an online news magazine. to contain the same types of information a title, a subtitle, an author and one or more pages of text and images that comprise the body of the article. liferay only supported simple content as has been described above, you'd have no way to make sure your users entered a title, subtitle, and author. also get articles that don't match the look and feel of your site. supposed to be navy blue but they come in from your writers manually set to light blue, you need to spend time reformatting them before they are published structures give you the ability to provide a format for your content so your users know what needs to be entered to have a complete article. structures, you can provide a form for your users which spells out exactly what is required and can be formatted automatically using a template you create a structure by adding form controls such as text fields, text boxes, text areas html, check boxes, select boxes and multi-selection lists. can add specialized, liferay-specific application fields such as image uploader and documents and media right onto the structure. elements around by dragging them where you want them. to prototype different orders for your input fields. be grouped together into blocks which can then be repeatable. can then write a template which loops through these blocks and presents your content in innovative ways, such as in sliding navigation bars, content which let's look at how we can create and edit structures through the manage go back to the control panel and select web content from the content section. the first way to access the manage structures interface is simply by clicking this opens a popup showing all the web content structures that exist in your currently selected scope. web content structures, edit existing ones, manage the templates associated with a structure, edit the permissions of a structure, and copy or delete structures. copying web content structures can be useful if you'd like to create a new web content structure that's similar to an existing one, but you don't want to start liferay generates a unique portal id for the copied structure, but every other attribute of the copied structure, including the name, is the same once you've copied a web content structure, you should enter a new name for it to avoid confusing it with the original. web content structure, you'll be prompted to choose whether to copy any detail templates or list templates associated with the structure. detail templates and list templates, please refer to chapter 9 on dynamic data figure 3.1 you can access the manage structures interface by clicking manage structures from the web content page of the control panel the second way to access the manage structures interface is directly from the the web content page to add another piece of content to your portal. going right for the content, this time we'll first create a structure. the manage structures interface, simply click on select next to the structure heading near the top of the page. to create a new structure in your chosen scope, simply click on the add button in the manage structures popup it's very easy to create and edit structures all you have to do is drag elements into the structure and then give them names. checkbox element under the form controls tab and drag it onto the structure. you can do the same with any of the elements. to remove it from the structure, simply select the delete icon black circle with x in the upper right corner take a moment to add, delete and rearrange different elements liferay supports the following elements in structures text field used for items such a titles and headings text box used for the body of your content or long descriptions text area html an area that uses a wysiwyg editor to enhance the content checkbox allows you to add a checkbox onto your structure. developers can use this as a display rule selection list allows you to add a select box onto your structure multi-selection list allows you to add a multi-selection list onto your image uploader allows you to add the upload image application into your documents and media allows you to add the documents and media folder link to page inserts a link to another page in the same site selection break inserts a break in the content these form elements provide all you need to model any information type you would liferay customers have used structures to model everything from articles, to video metadata, to databases of wildlife. limited only by your imagination. to fire that imagination, let's look more when creating a new structure, it is essential that you set variable names. template writers can use these variables to refer to elements on your form. you don't set variable names, liferay generates random variable names and these can be difficult for a template writer to follow. you might create this field in your form but the underlying variable name in the structure might look something like textfield4882. template writer needs to create markup for your structure and place the author field in a certain spot in the markup. how will he or she know which field is author when they're all named randomly to solve this problem, all you need to do is set a variable name for each field as you add it to your structure. element text area html which has the field label instructions. wanted to give it the variable name steps, we can do it very easily at the bottom of every form element is a variable name field. name with the name you want to use. now your template writer has a variable by which he or she can refer to this field below each field is a button labeled edit options. field type changes the field type, in case you dragged the wrong field type field label changes the displayed label for index type choose how you want liferay to index your field for search. can have it indexed by keyword, which filters out common words such as and, but, the, and so on, or you can have it index the full text of the field. default, indexing is turned off predefined value specifying predefined values for structure forms is a way when a user creates a new web content article based on a structure that has predefined values for various fields, the predefined values appear in the form as defaults for those fields instructions for the user check this box and type a description of what the field is for to display it as a tooltip for the user repeatable if you want this field to be a repeatable element, check this your users can then add as many copies of this field as they like. example, if you're creating a structure for articles, you might want a repeatable author field in case you have multiple authors for a particular required check the box to mark the field required. users must enter a value for it in order to submit content using this structure for the nose-ster structure, type something in the instructions for the user field that helps users know what to put into the body element example this is an html text area for the body of your content . now, when users hover over the help icon near your title, your structure default values allow you to create one structure that uses common data returning to our newspaper scenario again, let's say you want all sports articles to have the same display page sports page, the same categories, or the instead of adding them for each article or wondering if your users are adding them to every web content, you can add these characteristics once for every sports article by creating default values for the structure. two ways to edit structure default values creating a new structure or editing for a new structure, you must first create the structure before editing its navigate to web content in the control panel and click the structures tab, then select the add structure button. definition section of the new structure form, use the add row button to create different types of fields for the structure. create the structure manually the launch editor button allows you to edit the xml for the structure if you wish to do it via code. save and continue to go to the structure default values form figure 3.3 you can create fields for structure default values via the xml schema definition section of the new structure to edit an existing structure, go to web content in the control panel and click the structures tab to see the structures list. for the desired structure and select edit default values from the menu to view this form allows you to manage the structure figure 3.4 you can edit default values via the actions button of the structure form every new web content you create with this structure is preloaded with the setting permissions on structures is done using the same procedure as permissions everywhere else in liferay. most users should not have the ability structures are coupled with templates, which require some web development knowledge to create. this is why only trusted developers should be able to create structures and templates. users, of course, should be able to the view permission enables them to make use of the structures figure 3.5 view permission for a structure you can grant or deny permissions based on roles and this is the recommended way to handle permissions for structures now that you understand what structures are used for, you need to understand the other half of liferay's web content management system templates developers create templates to display the elements of the structure in the content can then be styled properly using css, because markup is generated consistently by the template when structured content is displayed. in essence, templates are scripts that tell liferay how to display content in any changes to the structure require corresponding changes to the template, because new or deleted fields produce errors on the page. enter content into a structure, it must have a matching template. template, the portal has no idea how to display content which has been created let's look more closely at the types of templates liferay supports liferay supports templates written in four different templating languages, to support the skill sets of the largest number of developers. chances you can jump right in and use whichever one you've already used before. if you haven't yet been exposed to any of them, your best bet is velocity or freemarker, as they are less chatty than xsl and extremely simple to vm velocity macro velocity is a scripting language that lets you mix this is similar to other scripting languages, such as php, though velocity is much simpler. because it's been in the product the longest, it is probably the most widely used language for templates in liferay wcm. you haven't used any of the template languages before, we recommend using velocity you'll get up to speed the fastest xsl extensible style sheet language xsl is used in liferay templates to transform the underlying xml of a structure into markup suitable for the while it may not be as clean and compact as velocity or ftl, it's widely used for transforming xml into other formats and it's very likely your developers have already been exposed to it ftl freemarker template language freemarker is a templating language which could be considered a successor to velocity, though it is not yet as it has some advantages over velocity for which it sacrifices some simplicity, yet it is still easy to use css cascading style sheets you can use css if your structure is very straightforward and modifications are simple colors, fonts, layouts, etc.. your structure is more complex, however, you'll need to use one of the other liferay wcm makes it easy to create structures, templates and content from the let's go through the entire flow of how you'd create a structure, link it to a template and then create content using them both. use velocity for our template and we'll lay out the structure fields systematically to go along with the format we've defined for our content go back to the web content section of the control panel and click add click select next to the structures heading to access the manage structures name the structure news article and click save back on the manage structures interface, click actions manage templates next to the news article structure that you created enter the name news article and add a description make sure velocity is selected as the script language it's the default if you've written the script beforehand, you can select browse to upload otherwise, you can click launch editor to type the script directly into the small editor window that appears select the news article structure on the new web content form, you'll see the title, abstract, image, and body fields that you defined for the news article structure. template should also be selected populate the fields and click publish to publish your news article below is the template script for this structure. this template is pretty small but it actually does quite a bit. url which maximizes the portlet is created. once this is done, the template gets this is important to avoid url collisions with other urls that might be on the page after this, the template attempts to get a request parameter called readmore. whether or not this was successful is the key to the rest of the script if the template got the readmore parameter, it displays the abstract and the body below the title which is always displayed if the template didn't get the readmore parameter, it displays the image, the abstract and the link created above, which sets the readmore parameter when this template is rendered, it looks something like this figure 3.8 after clicking read more now that you've created a handsome template, it's time to decide who the lucky permissions for templates are similar to permissions for structures. structures, you only want specific developers editing and creating templates. you may, however, want to make the templates viewable to some content creators who understand the template scripting language but are not directly writing the you can determine who views the template by selecting from the viewable by select box beneath the permissions tab. you'll also want to determine how users can interact with the template. do this by selecting the more link from the more link, you can grant or deny permissions based on roles. instance, you may create a role with the ability to update the template and create a second role that can both update and delete. possible to assign permissions based on the roles and responsibilities within now that you understand the role structures and templates play in creating web content, let's look at how you can use liferay to manage multiple sites.;;
|
as stated in chapter 1, a site is a set of pages that can be used to publish sites can be independent or they can be associated with an organization and serve as the website for that organization. you can create as many different sites as you like within the context of a you can use sites in liferay to build many different kinds of websites. you're building a large corporate website, a company intranet, or a small site designed to facilitate collaboration among team members, liferay's framework provides all the tools you need. to support different kinds of collaboration and social scenarios, liferay's sites provide three membership types open users can become members of the site at any time. restricted users can request site membership but site administrators must approve requests in order for users to become members. private users are not allowed to join the site or request site membership. private sites don't appear in the my sites portlet. still manually select users and assign them as site members in addition to these memberships, when a site is associated with an organization, all the users of that organization are automatically considered members of a site can be given additional privileges within the site by using it is also possible to assign different roles within the site to different members. this can be done through site roles which are defined equally for all sites or teams which are unique for each liferay's sites have two categories of pages called page sets. kinds of page sets public pages and private pages. pages, only private pages or both. private pages can only be accessed by site public pages can be accessed by anyone, including users who haven't it's possible to restrict access to pages at the page set level or at the level of individual pages through the permission system. private pages have different urls and can have different content, applications, building a corporate intranet provides a typical use case for liferay sites. corporate intranet could have sites for all the organizations in the company sales, marketing, information technology, human resources and so on. about the corporate health and fitness center? that's something everybody in the company, regardless of organization, may want to join. candidate for an open and independent site. corporate intranet should probably be placed in an open independent site so any member of the portal can access it for other kinds of web sites, you may want to use independent sites to bring people together who share a common interest. sharing web site, you might have independent sites based on the types of photos for example, those who enjoy taking pictures of landscapes could join a landscapes site and those who enjoy taking pictures of sunsets liferay always provides one default site, which is also known as the main site this site does not have its own name but rather takes the name of by default the portal name is url but this value can be changed through the simple configuration of the setup wizard. can also be changed at any time through the control panel within portal tip prior to liferay 6.1, there were two ways of creating sites this has been simplified to provide more ease of use and allow for more flexibility. the main role of organizations is still to organize the users of the portal in a hierarchy but they can also have communities can still be created through independent sites but the new name reflects the fact that sites can be used for many different sites can be created through the control panel by a portal administrator. a site, click on sites under the portal section of the control panel and then if there is at least one site template available, a dropdown menu site templates provide a preconfigured set of pages, portlet applications, and content that can be used as the basis of a site's public or to create a site from scratch, select blank site. select the name of the site template you'd like to use. site from a site template, you have to choose whether to copy the site template's pages as your new site's public or private page set. templates are created, they will appear in the add menu as they become the following figure shows the form that needs to be filled when name is the name of the site you wish to create description describes the site's intended function membership type can be open, restricted or private. the my sites portlet and users can join and leave the site whenever they want. restricted site is the same except users must request membership. administrator must then explicitly grant or deny users' requests to join. private site does not appear in the my sites portlet and users must be added to it manually by a site administrator active determines whether a site is active or inactive. inaccessible but can be activated whenever a site administrator wishes once you've created a site, it appears in the sites page of the control panel. once the site has been created you can specify more details about the site using three categories basic information, search engine optimization and advanced details lets you edit the information you entered when you created the site and allows you to choose a site template for the public or private pages of your if you select a site template, leave the enable propagation of changes from the site template box checked to automatically update your site if the the update will only be done to pages which have not been changed within the specific site. recheck it later, the template pages are then reapplied to your site, overwriting any changes that may have been made. permission unlink site template will be able to disable the propagation of when the propagation is enabled, the site template might prevent modification of some or all pages to ensure the propagation occurs categorization allows you to apply categories and tags to the site site url lets you set friendly urls and virtual hosts for your web site site template provides additional information about the site template associated to the pages of the site if any sitemap lets you use the sitemap protocol to notify search engines your web robots lets you use a url file to specify certain pages and links you don't want to be indexed by search engines. staging lets you turn on either local live staging or remote live staging. to enable staging, the enable propagation of changes from the site template box on the details tab must be unchecked. with staging enabled, changes to the site template are automatically propagated to the staged site, not to the live the changes still must be approved before the site is published to live analytics lets you set a google analytics id that is used for your site when creating a site from a site template, the initial form provides a new option that lets you decide if you want to copy the pages from the template as public pages or as private pages. by default, the site is linked to the site template and changes to the site template propagate to any site based on it. checkbox appears that allows users to unlink the site template if the user has figure 3.11 when creating a site from a site template, you need to choose whether the site template should be copied into the site's public pages or private pages site templates are a powerful tool for managing many similar sites.;;
|
"site templates can be administered from the control panel. administrators to create multiple sites with the same default set of pages and site templates can contain multiple pages, each with its own theme, layout template, portlets, and portlet configurations. this allows administrators to use site templates to create new sites that are each created with the same default pages, after they've been created, these sites and their pages can be modified by site administrators. using site templates can save site administrators a lot of work even if each site that was created from a given site template ends up being very different to get started, click on site templates in the portal section of the control here, you can add, manage, or delete site templates. configure the permissions of site templates. as long as a site is linked to the site template it was created from, changes to the site template's pages, portlets, and portlet configurations are propagated to the site. site template's content, however, are not propagated to existing sites that are we discuss the propagation of changes between site templates and sites in more detail in the section on site templates use cases to manage the pages of a site template, click on site templates in the control panel and then click actions manage pages. remove pages from a site template or select themes and layout templates to apply click on a specific page if you'd like to select a different theme or layout template for that page. you can add specific portlets to each page of a site template and configure the preferences of each portlet. have any theme, any layout template, and any number of portlet applications, just like a page of a regular site. as with site pages, you can organize the pages of a site template into hierarchies. when you create a site using a site template, the configuration of pages and portlets is copied from the template to by default, all changes made to the site template are automatically copied to sites based on that template tip if you want to publish a piece of web content to many sites and ensure modifications are applied to all, don't use site template content for that instead, place the content in the global scope and then reference it from a web content display application in each site by default, the following site templates are provided community site provides a preconfigured site for building online the home of a community site provides message boards, search, a display of a poll and statistics of the activity of community members. site will also be created with a page for a community calendar and a page for intranet site provides a preconfigured site for an intranet. page displays the activities of the members of the site, search, a language chooser and a list of the recent content created in the intranet. provides 3 additional pages for documents and media, calendar and external news obtained through public feeds the following figure displays the form shown when editing the community site to view and manage the pages of a site template, click the open site template this opens the template in a new browser window or tab and it can be navigated or managed like a regular site suppose we need to create the following three sites for nose-ster's internal use engineering, marketing, and legal. these should be private sites that are only accessible to members of these respective departments. site separately but can save ourselves some work if we create a site template to to create a site template, navigate to the control panel and click site then click add and enter a name for your template we'll use leave the active and allow site administrators to modify the pages associated with this site template boxes checked. active box must be checked for your template to be usable. still a work in progress, you can uncheck it to ensure that no one uses it until checking allow site administrators to modify the pages associated with this site template allows site administrators to modify or remove the pages and portlets that the template introduces to their sitesif you want the templates to be completely static, you should uncheck this from the list of site templates, click on the department site template that then click on the open site template link to begin adding pages and portlets and configuring the layouts. when you click this link, the site template opens in a new browser tab or window. our site template to include four pages. first, we'd like a home page with the activities, announcements, and calendar portlets. and media page with the documents and media portlet. wiki page with the wiki and tag cloud portlets and a message boards page with the message boards and tag cloud portlets. configuring the pages of your site template, just close the browser tab or window that opened when you clicked open site template. templates are automatically saved as you make them, so you don't need to return to the site templates page of the control panel and select save figure 3.13 you can see the name of the site template you're currently editing next, let's use our site template to create our engineering, marketing and legal go to the control panel and click on sites. enter engineering for the site name and set the membership type recall that private sites don't appear in the my sites portlet so that regular portal users won't even know that the engineering site exists. also, the only way users can be added to a private site is via an invitation leave the active box checked so that your site can select the copy as private pages option since our engineering site is intended for internal use only. propagation of changes from the site template box checked so that the engineering site receives updates if the department site template is modified. finally, click save to create your the engineering site repeat these steps to create the marketing and legal sites. all the pages and portlets you created in the site template. of the new sites, click on sites in the control panel and then click on actions go to private pages next to one of your new sites. templates streamlines the site creation process for administrators, making it now each nose-ster department has its own calendar, documents and media library, wiki, and message boards application. although the pages and portlets of each department's site are the same, each site will quickly be filled with department-specific information as users add and share content within the sites. also, site administrators can add new pages, portlets, and content to their sites, further differentiating each department's it's possible for site template administrators to add, update, or delete site changes made to a site template can be propagated to sites whose pages sets are linked to the site template. such a link is created when you create a site based on a site template and leave the enable propagation of changes from the site template box checked. to disable or re-enable this link for a site, select the site in the control panel's context menu selector. click on site settings and uncheck or recheck the enable propagation of changes from the site template checkbox. you can can also access the site settings interface via the dockbar by clicking manage site settings. in this section, we explain the propagation of changes from site templates to sites and discuss the options available to site administrators and site template if a site's page set has been created from a site template and the propagation of changes from the site template is enabled, site administrators can add new pages but cannot remove or reorder the pages imported from the site template. if a site has both pages imported from a site template and custom site pages, the site template pages always appear first; custom pages added by site administrators appear after the site template pages. administrators can remove, reorder, or add site template pages. administrators can add or remove custom site pages. site pages as long as they're all positioned after the site template pages. template administrators cannot add, remove, or reorder custom site pages if a site administrator changes a page that was imported from a site template and refreshes the page, the following message appears if the site administrator clicks the reset button, changes are propagated from the site template page to the corresponding site page that was imported from the clicking the reset button makes two kinds of updates to a page. first, changes made by site administrators to the site page are undone. changes made by site template administrators to the site template page are note clicking the reset button only resets one if multiple site pages have been modified and you'd like to re-apply the site template pages to them, you'll need to click the reset button for each site template administrators can set preferences for portlets on site template when a portal administrator creates a site from a site template, the portlet preferences are copied from the site template's portlets, overriding any when merging site template and site changes, e.g., when resetting, portlet preferences are copied from site template portlets to only global portlet preferences or local portlet preferences which don't refer to ids are overwritten site administrators can also add data to site template portlets. site template administrators can add the wiki portlet to a site template page and use the wiki to create lots of articles. when a portal administrator creates a site from a site template, data is copied from the site template's portlets to the preferences of the site's portlets are updated with the for example, if a site is created from a site template that has a wiki portlet with lots of wiki articles, the wiki articles are copied from the site template's scope to the site's scope and site's wiki portlet is updated with the ids of the copied wiki articles. from a site template to a site when the site is first created; data is not copied copied during a site reset now that we've learned how site templates work, let's discuss how to use page";;
|
the syncmanagerdelegate class is required to use screenlets with offline mode. this class receives the events produced in the synchronization process. document describes the class's methods the following method is invoked when the synchronization process is started. number of items to be synced are passed the following method is invoked when an item synchronization is about to start the following method is invoked when an item synchronization is successfully the following method is invoked when an item synchronization fails the following method is invoked when an item synchronization detects a conflict. the method must invoke asynchronously a argument with the conflict action result supported values for resolve are;
|
click on page templates in the control panel to see a list of page templates. page templates function similarly to site templates but at the page level. page template provides a pre-configured page to reuse. it's possible to select a theme, a layout template, to add portlets to the page and to configure portlet preferences. both sites and site templates can utilize page templates for creating new pages you can edit or delete existing page templates, configure their permissions, or by default three sample page templates are provided blog provides a page with three applications related to blogging. two columns, the main left column contains the blogs portlet and the small right column provides two side portlets, tag cloud and recent bloggers. tag cloud application will show the tags used within the site and will allow navigating through the blog entries shown in the main blogs portlet content display page provides a page preconfigured to display content. has three auxiliary applications tags navigation, categories navigation, and search and an asset publisher. the most significant aspect of this page is that the asset publisher is preconfigured to be display any web content this means that you can select any page created from this page template as a display page for a web content article. choose a display page for a web content article when creating a new web content article or when editing an existing one. content article, a unique canonical url for the web content pointing to this wiki provides a page with three applications related to authoring a wiki. it also has two columns, the main left column with the wiki application and two right side portlets to allow navigating through pages by tags and leave the active button checked. and then identify your page template in the list. actions button to edit the page template. the open page template link opens a new browser window which you can use to configure your new page. make are automatically saved so you can close the new browser window once you're note that after a new page template has been created the default permissions are to only allow the creator to use the page template. to it, use the actions menu in the list of templates and choose permissions. once you see the matrix of roles and permissions, check the view permission for the role or roles needed to see the page template in the list of available page templates when creating a new page. if you want any user who can create a page to be able to use the page template, just check the view permission for figure 3.15 selecting a page template to use your template to create a new page, just navigate to a page over which you have site administrator privileges and select add page from the you'll be able to select a page template and type a name for the new alternatively, you can use the control panel. selector menu, select the site to which you'd like to add a page and then click then click the add page button, type a name, select your template from the drop down menu and click add page to finish figure 3.16 choosing whether or not to automatically apply page template changes to live pages note that by default, when a site administrator creates pages based on a page template, any future changes to the template are automatically propagated to site administrators can disable this behavior by unchecking the automatically apply changes done to the page template box if staging has been enabled, changes to the page template are automatically these changes still need to be approved before for this reason, the automatic propagation of page template changes to the staged page cannot be turned off and the automatically apply changes done to the page template checkbox does not we'll discuss staging in more detail later in this chapter. at importing and exporting templates if you want to export a site that uses site or page templates to a different environment through a lar file or remote publication, the templates must be exported and imported manually in advance or the import will fail to export a site using a site template, use the following process now the site can be exported and imported normally to this new environment for page templates, the process very similar the page template can now be imported normally to this new environment next, let's examine the tools liferay provides for handling translations.;;
|
web screenlet lets you display any web page. it also lets you customize the web page through injection of local and remote javascript and css files. using as backend, you can use in your page to customize its content from the server side the default theme uses an ios wkwebview for displaying the web page figure 1 web screenlet using the default theme to learn how to use web screenlet, follow the steps in the tutorial rendering web pages in your ios app. that tutorial gives detailed instructions for using the configuration items web screenlet has webscreenletconfiguration and webscreenletconfigurationbuilder objects that you can use together to supply the parameters that the screenlet needs to work. webscreenletconfigurationbuilder has the following methods, which let you supply the described configuration parameters note if you want to add comments in the scripts, use the notation url default displays a page that the user must therefore be logged in with screens via login screenlet or a sessioncontext method. url you must pass to the webscreenletconfigurationbuilder constructor is a for example, if the full url is url, then the url you must supply to the constructor is webguestblog must pass to the webscreenletconfigurationbuilder constructor is a full url, then you must supply that web screenlet delegates some events to an object that conforms to the this protocol lets you implement the following onwebloadurl called when the screenlet loads the page screenletonscriptmessagenamespaceonscriptmessage called when the screenletonerror called when an error occurs in the process. nserror object describes the error.;;
|
offline mode in liferay screens lets your apps function when connectivity is even though the steady march of technology makes connections more stable and prevalent, there are still plenty of places the areas with complex terrain, including cities with large buildings, often lack stable connections. using screens's offline mode in your apps gives your users flexibility in these situations this tutorial shows you how to use offline mode in screenlets. explanation of how offline mode works, see the tutorial architecture of offline mode in liferay screens. offline mode's architecture is the same on ios and android, although its use on if you want to enable the offline mode in any of your screenlets, you must configure the attribute offlinepolicy. this attribute can take four possible for a description of these values, see the section using policies with offline mode in the offline mode architecture tutorial. note that each screenlet behaves a bit differently with offline mode. under some scenarios, values stored in the local cache need to be synchronized for that purpose you must use the syncmanager class. this class is responsible for sending the information stored in the local cache that hasn't been sent to the portal yet use the following steps to start a synchronization process create an instance of the syncmanager class. you can get the current cache manager using this delegate object receives the events produced in the synchronization process. for more details on the delegate's methods, see the api reference documentation for the syncmanagerdelegate class make sure you keep a strong reference to the syncmanager object while the architecture of offline mode in liferay screens using screenlets in android apps;;
|
web content list screenlet can show lists of with configurable page size, and supports i18n in asset values screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the default theme uses a standard uitableview to show the scrollable list. other themes may use a different component, such as uicollectionview or figure 1 web content list screenlet using the default default theme this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet web content list screenlet delegates some events to an object that conforms to the webcontentlistscreenletdelegate protocol. this protocol lets you implement - screenletonwebcontentlistresponse called when a page of contents is note that this method may be called more than once one call for - screenletonwebcontentlisterror called when an error occurs in the the nserror object describes the error - screenletonwebcontentselected called when an item in the list is;;
|
the web content display screenlet shows web content elements in your app, rendering the inner html of the web content. the screenlet also supports i18n, rendering contents differently depending on the device's current locale screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the default theme uses a standard uiwebview to render the html. may use a different component, such as ios 8's for the web content display screenlet to function properly, there should be web content in the liferay instance your app connects to. content, please refer to the web content management section of the liferay user guide this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet you can alternatively use templateid or structureid with articleid the web content display screenlet delegates some events to an object that conforms to the webcontentdisplayscreenletdelegate protocol. lets you implement the following methods - screenletonwebcontentresponse called when the web content's html is - screenletonwebcontentdisplayerror called when an error occurs in the the nserror object describes the error.;;
|
"the asset list screenlet can be used to show lists of assets for example, you can use the screenlet to show a scrollable collection of assets. it also implements fluent pagination the asset list screenlet can show assets of the the asset list screenlet also supports i18n in asset values screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods the default theme uses a standard uitableview to show the scrollable list. other themes may use a different component, such as uicollectionview or figure 1 asset list screenlet using the default default theme this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet if you don't use classnameid, you must use this attribute the asset list screenlet delegates some events to an object that conforms to the this protocol lets you implement the - screenletonassetlistresponse called when a page of assets is note that this method may be called more than once; one call for - screenletonassetlisterror called when an error occurs in the process. the nserror object describes the error - screenletonassetselectedentry called when an item in the list is";;
|
"the ddl list screenlet enables the following features screenlets in liferay screens call json web services in the portal. screenlet calls the following services and methods dynamic data lists ddl and data types should be configured in the portal. more details, please refer to the liferay user guide sections this screenlet supports offline mode so it can function without a network for more information on how offline mode works, see the here are the offline mode policies that you can use with this screenlet the ddl list screenlet delegates some events in an object that conforms to the this protocol lets you implement the - screenletonddllistresponserecords called when a page of contents is note that this method may be called more than once; once for each - screenletonddllisterror called when an error occurs in the process. nserror object describes the error - screenletonddlselectedrecord called when an item in the list is";;
|
"if you're reading this, we're going to make a wild guess and say that you're probably looking for some software to help you run your web site. dynamic web site that's more than brochureware is complicated these days. have to think about all kinds of things like user registration, security, community-building, collaboration, and of course your own, unique functionality to create all this, you can pursue several different strategies. to build the whole thing yourself from scratch. pursuing this strategy is that you have the most freedom, since you can write a closer inspection, however, reveals that instead of freedom, you become a slave, writing all kinds of code that's not core to your you have to write code for user registration, login, security, and session management; code for standards support, such as facebook login, openid, opensocial, or rss feeds; and code for general features, such as comments, tags, you also take the most risk you andor your development team are responsible for every bug, glitch, user interface issue, or security holeand the consequences for thesethat can be found in your site. requires the most time to implement, because you're building everything from when considering this option, therefore, you really need to think hard about whether you and your development team have the time and the expertise to handle building everything from the ground up another option is to scrounge the web for software that has some of the features you want, and then glue it together into one integrated site. every site has some kind of content, so you might pick a content management but you want users to interact in some way, so you also grab forum prominent users might get a blog, so you'll need software to handle and, of course, don't forget that you have to write your own you're attempting to build a super app out of a collection of disparate, but best-of-breed individual applications. applications, and now your job is to integrate all of these together so that users only have to log in once, the forum software can power comments on your content, and blogs are published in a nice, customizable feed on the home page. as you work on this, you find that gluing all these applications together isn't you might get all of it working, but then you have a different problem down the road a maintenance nightmare. packages will be updated by their development teams separately, on different schedules, to fix bugs, add features, and plug security holes. customized them all, every upgrade of every software package you've chosen becomes an exercise in re-implementing your glue code to make it all work you could also try using something like a blog that has a lot of functionality that can kind of be used as a content management system. things don't work exactly as you'd like them to, and features you need are you either have to build those features and integrate them in, or do one final option, if you have a budget, is to buy something that mostly fits what you want to do, with the intention of customizing it to fit your needs. goal here is to get something up and running as quickly as possible, by taking advantage of someone's product and support. the devil here, though, is in the details it's the customizationparticularly with products that are not open sourcethat can be most difficult. license agreements need to be negotiated to get you access to non-documented, internal apis, and many products are simply not designed to be customized to the extent that you might want to have them it can take more time to customize than you though, and you usually run into some limitation that keeps you from building exactly what you need. alternatively, you may wind up having to pay expensive consultants to get the result that you want, and after that, you've paid more than you initially thought you would, and you have a complicated situation when it comes to as you can see, all of these options have pros and cons to them. when building from scratch makes sense, and there are times when integration or purchasing a solution make sense. but what if you could have all of these what if there was a product that gave you the freedom to create whatever you want, had tons of reusable functionality, was designed for customization, and was a single, unified product with a clear upgrade path this solution gives you all the freedom of creating your site from the ground up, all the benefits of existing, integrated, robust applications, and a development framework that makes your application a first class citizen.";;
|
liferay portal is a web experience platform that contains all of the common applications you'd use as building blocks for your web site. using liferay completely changes the way you'd approach building your site, because liferay includes all the functionality mentioned above and more. fact, depending on what you're building, it's possible to build some sites without writing any code at all! if you've got a great application in mind, then liferay is also a fantastic web application development platform that you can use to your advantage to release your application faster. focus on your application, and use the user management, security, standards support, and general features provided by liferay portal without having to write of course, there are more features than just those. functionality enabling users to connect with each other in social networks, to collaborate on whatever interests them, to create content, and so much more. fact, it'll take this whole book to describe fully what liferay can do, but we'll summarize it as best we can in the rest of this chapter in short, liferay portal is more than a development platform, more than a content management system, more than a social network, and more than a set of it's the best way to build a web site.;;
|
one of the most common uses of liferay portal is as a content management system. in fact, many use liferay portal just for content management, whether it be web content management or management of file-based content documents, media files, they do this because liferay portal's content management system is so powerful and feature-rich that it could be offered as a totally separate, of course, the fact that it's integrated with the rest of the applications in liferay portal makes it all the more attractive we'll answer that question, but take it in two parts. we'll look at liferay portal's role as a web content management system, and then we'll see how liferay portal excels at file-based content management the first thing you'll want to understand about liferay wcm is that it scales to work for the tiniest of sites all the way up to the largest of sites. example, on the small end of things you can fire up liferay portal, drop the web content display application onto a page, and immediately start typing content into a wysiwyg editor, in place. on the large scale of things, you can set up liferay portal to host many different web sites for many different purposes, all each site can take advantage of a separate staging server, where content and pages are created by teams of people using structures and templates, and updates to the production server are published on a schedule, only after having gone through a multi-step approval process by default, liferay portal starts with a single site that has a single page. can build any web site you wish out of this, complete with multi-nested page hierarchies, as the figure below shows figure 1.1 liferay's page hierarchies are easy to create, using a tree structure that's familiar to anyone who has used a file these pages can have any layout you like liferay portal ships with several built-in, and you can create your own custom layouts and deploy them easily. pages can be added, removed, or reordered any time, and you have the full flexibility of all the html page attributes, such as meta tags and robot file pages are also integrated with liferay's powerful permissions system, so it's easy to restrict access to certain portions of your site. individual users sites of their own, with public pages that have their content and blog, and private pages that contain their calendar and email if you're running a large web site where you'll be creating and managing lots of different sub-sites for individuals and groups, you can take advantage of page the former enables you to set up templates of pages with predefined layouts and applications already on them, and the latter enables you to create a whole site made up of multiple, predefined pages if you have a very large site, you might need multiple people and you certainly don't want the live site changing before your for that reason, liferay portal provides a feature called staging, that lets you place your changes in a holding area while they're you can have a local staging server, where the staged site resides on the same server as the live site, or you can have a remote staging server, where all web content work happens on a separate server from your live in either case, when you're ready, site changes can be pushed to the live site, either manually or on a schedule figure 1.2 staging supports publishing manually or on a liferay portal's web content creation tools are easy and intuitive to use at all if you need only basic content management capabilities for your site, from the dockbar, you can add the web content display application anywhere in your page layout and enter content in place. to go from this basic level of content management to more sophisticated levels for example, suppose you wanted to build an online news-oriented site. the content you'll publish is an article of some kind. management system lets you create a structure for this, so that you can capture all the information from your writers that you'd need in an article. figure below shows what this structure might look like to a journalist who'd be entering his or her article into the system figure 1.3 structures allow you to specify exactly the type of data that you can also include tooltips to help your users understand what each field is for as you can see, you can use structures to make sure writers provide the title of the story, what type of story it will be, and the byline i.e., the writer's you've made sure that all the relevant information for the story is web content is one example of what in liferay is called an asset. have meta-data attached to them, and that metadata can be used to aggregate similar assets together in searches or as published content. in the example above is that writers can tag and categorize their stories so they can be found more easily by users this is just one example, of course. but the concept is applicable to any kind for example, if you were building a site for a zoo, you could use web content structures to help users enter data about animals in the zoo, such as their common names, their scientific names, their species, their locations in the wild, and more when it comes time to publish content, structures are combined with templates. templates are instructions for how to display structures, written most of the time in velocity or freemarkerboth of which are well-known templating languages used for mixing html with programmatic elements. they're very easy to write, and can help you ensure that your site has a there is much more to web content. you can create abstracts, schedule when content is published and when it should be taken down or reviewed, define this is just the web content portion of liferay's content management system. liferay portal is also great at managing file-based content it's rare to find in an open source project a full-featured content management most of the time, you'll find web content management systems and file-based content management systems as separate projects. however, provides you with both. as shown above, the web content management system is as robust as any other you'll find, and its file-based content liferay portal keeps the ui of its file-based content management system in an application called documents and media library. the control panel or can be added to any page, and, as shown below, looks very much like the file manager that you're already familiar with from your operating figure 1.4 liferay portal's documents and media library was purposefully designed to be familiar to anyone who uses a computer like a file manager, you can browse files and folders in nested hierarchies. can also mount other repositories that you might have in your environment, such as documentum ee only or any system that implements content management it provides previews of just about every document type you can think of. and, like a file manager, you can copy and move files between folders by dragging and dropping them. want to use your operating system's file manager, you can, because liferay's documents and media library supports webdav, using the same credentials you use liferay portal's documents and media library, however, is much more robust than a file manager is, because it's a full content management system. ways of classifying files that may be of different types, but are meant for the for example, you can define metadata sets, which are groups of fields describing attributes of a file. one of these that ships with the product is called meeting metadata, and it contains fields such as meeting name, date, time, location, description, and participants. this is a generic set of fields that go together and that you'd want to use as a group. they provide a more natural way of for example, you might create a document type called meeting minutes, because this is how we as humans conceptualize our documents. doesn't really matter whether it's a microsoft word document, an html file, or a text filethe document contains meeting minutes. document type, you can attach the meeting metadata set that contains many of the fields you'd want, and you can also add extra fields, such as a field for action when users want to add a file containing their notes for meeting minutes, they can also add all the relevant metadata about the meeting such as the time, this captures the context information that goes with the document, and it provides a much more natural way of working with documents than just dumping them into a shared file system of course, the system goes much further than this. only certain document types can be added to them. added to folders to run files through an approval process that you define. short, liferay's file-based content management system gives you all the features you need to manage and share files in a group many liferay portal users see it as a robust content management system, and they use it primarily for that purpose. now, hopefully, you can see why. the system in-depth in the body of this book, but for now we need to look at some of the other ways you can use liferay portal, starting with its fantastic;;
|
many sites have grown organically. you may have grown your community by using separate tools first a forums application, and then a wiki for collaborative documentation, and maybe even a chat application. error-prone to integrate all of these applications so your users can use them thankfully, liferay includes a suite of collaborative applications you can use, and they're all integrated together liferay portal offers every standard collaborative application that's available. these applications range from personal productivity applications like a calendar and email, to community-building applications like message boards, polls, and figure 1.5 liferay portal's message boards are as fully featured as any standalone forum application, with the added benefit that they're integrated this is a suite of integrated applications with all the features of similar, for example, liferay portal's message boards include categories and subcategories, message threads, captcha, rss feeds, email notification, posting via email, and much more. applications are integrated with the rest of liferay portal's framework. log in, and their profiles are used automatically by the message boards and all the other collaborative applications. and as we'll see later, functionality from the built in applications can be added to your own to provide features like comments in your own software, and you don't have to write any code to do it liferay portal's wiki is another example of a full-featured collaborative it has support for authoring pages in a wyswyg editor, or more advanced users can use the easy-to-learn standard wiki creole syntax. comment on wiki articles, and it keeps a full history of every change that's been made, allowing users to revert back to any change. feeds just about every liferay application does so you can subscribe to see new articles as they are posted. each site can have one or more wikis, and each wiki can have one or more top-level nodes figure 1.6 liferay portal's wiki enables users to collaboratively create clicking the details link shows the full history of the article, including the author of each change we could go through all of liferay portal's collaborative applications in a similar fashion, but let's save that for the body of the book. suite of collaborative applications includes a blog complete with blog aggregation features so you can publish multiple users' blog entries in one place, a chat application for users who are online at the same time, message boards, a wiki, a knowledge base that you can use to publish a library of technical articles, a polling system you can use to have users vote on certain questions, and personal productivity applications like a calendar and email liferay portal includes every application you'll need to enable users to next, we'll see how you can use lifeay portal as a social platform.;;
|
"before diving into the details of developing for the marketplace, it is important to have a good grasp of new concepts introduced in the marketplace. the following list of questions will help in understanding the concepts that you will use over and over again as a marketplace developer as a liferay developer, you will undoubtedly already be familiar with the concept of plugins portlets, hooks, themes, etc. a liferay app sometimes just called an app is a collection of one or more of these plugins, packaged together to represent the full functionality of an application on the liferay platform. plugins contained within an app, apps have metadata such as names, descriptions, versions, and other ancillary information used to describe and track the app much like standard liferay plugins, liferay apps are also hot-deployable. you were to download an app from the marketplace, you would find that it is a special file type with a.lpkg extension. liferay's hot-deploy folder like any other plugin, and it is deployed into the running instance of liferay portal developers are not required to create the actual liferay app files. your app's individual plugins .war files are uploaded as part of the publish process, along with identifying information name, description, version, icon, this is described in detail later on in this chapter the concept of versioning is well known in software, and it is no different a version of an app represents the functionality of the app at a given when an app is first created, it is given an initial version when updates are needed for the app, a new version is created e.g. 1.1 , and new files are uploaded representing that version. cases, additional qualifiers can be found in the version specifier, to which developers often give special meaning. for example, a developer may declare that the version of their app is always in x.y.z format where the significance of in any case, as developer of your app, you have complete freedom in how you wish it is highly recommended that you stick to a well known and easy to understand format, such as 1.0, 1.1, 1.2, and so on. may also include alphabetical characters e.g 1.0 beta 2 or 6.3 patch 123235-01 , but this is not recommended, as it makes it difficult to understand how versions relate to one another keep in mind that the version of your app is completely up to you to specify, but the releases of liferay with which your app works must be specified using see the specify app packaging directives section below for details on how to specify the releases of liferay for which apps can be written to work across many different versions of liferay. example, suppose you wish to publish version 1.0 of your app, which you're supporting on liferay 6.1 and 6.2. it may not be possible to create a single binary.war file that works across both liferay versions, due to incompatibilities between these liferay versions. compile your app twice once against liferay 6.1 and once against 6.2, producing 2 different packages also called variations of your version 1.0 app. package has the same functionality, but they're different files, and it is these packages that you can upload in support of different versions of liferay, as you in this guide, packages are sometimes referred to when publishing an app, it is possible to publish it on behalf of yourself an individual or a company with which you are associated. determines who has access to the app, once published. of a marketplace user, admin, and company, and the ramifications of choosing one vs. the other, visit the liferay marketplace chapter in the user guide liferay apps are normal liferay plugins with additional information about therefore, most of the requirements are the same as those that exist for other liferay plugins that are detailed in the portlet development chapter of in addition to those, there are some marketplace-specific target the java 6 jre your app's byte code must be compatible with java 6 liferay's plugins sdk already targets java 6 via the url setting url.6; so don't override your app will be rejected if its byte code is not compatible wars must not contain any url file war file names must not contain any commas war file names must conform to the following naming convention contextname - alpha-numeric including - and short name of this name is used as the deployment context, and should not duplicate any other app's context you will see a warning if you use a context name of any other app on the marketplace plugintype - one of the following hook, layouttpl, a. b. c. d - the 4 digit version of your war file. important if you're developing a paid app or want your free app to satisfy liferay's plugin security manager, chapter 13 on plugin security management for give yourself adequate time to develop your app's pacl and time to test your app thoroughly with the security manager enabled now that you've learned the packaging and deployment requirements for your app, let's consider the versions of liferay you're targetting for your app and how to you must first develop your app using your preferred development tool for example, using liferay developer studio or the plugins sdk. consist of one or more liferay plugins. ensure your app is designed to work with if you wish to target multiple versions of liferay for example, you may wish to support both 6.1 ce ga3 and 6.1 ee ga3, ensure you have built binary images of your app for each supported minor family release, if if a single set of files will work across all supported liferay versions, you do not need to build multiple plugins. compatibility within a given minor release family, so your users can rest assured that your app will work with the minor release that you specify, along with all future maintenance releases of that minor release next, think of a good name and description of your app, along with a versioning take some screenshots, design an icon, create web sites for your app if they do not already exist, and have a support plan in place icons for your app must be exactly 90 pixels in both height and width and must be in png, jpg, or gif format. the image size cannot exceed 512kb. screenshots for your app must not exceed 1080 pixels in width x 678 pixels in height and must be in the jpg format. the file size of each screenshot must each screenshot should preferably be the same size each will be automatically scaled to match the aspect ratio of the above dimensions, and it is preferable if they are named sequentially, for example titles of apps in some views with marketplace, titles of applications longer than 18 characters will be shortened with ellipsis. titles must not be longer than 50 characters. description, tags, websites and version numbers descriptions, web sites and version numbers are to be as reflective to the product as possible. not use misleading names, information, or icons. a tags suggestion tool has been provided to aid with tagging your asset. descriptions should be as concise as ensure your icons, images, descriptions, and tags are free of profanity or other offensive material above and beyond these basics of creating apps in the form of liferay plugins, there are additional considerations to take into account when designing and liferay will ensure that apps meet a minimum set of requirements, such as liferay does not do source code reviews and will not ask for your source code. further, liferay is not responsible for the behavior or misbehavior of apps on for details regarding this, consult the liferay marketplace user agreement, liferay marketplace developer agreement, and the individual end user license agreements associated with each app of course, targeting the widest possible range of versions will ensure you a however, there are certain features in specific versions of liferay that you may wish to take advantage of. specify which versions your app is compatible with and you can have multiple files for your app designed for different versions of the liferay platform note that apps on the liferay marketplace must be designed for liferay 6.1 and that's not to say that they will not work with prior versions. only liferay 6.1 has support for installing apps directly from the marketplace and safeguards against malicious apps that will be ineffective on earlier if you wish to use an app for an earlier version, consult the documentation for that app, as it may or may not be supported on earlier read the specify app compatibility section below for details on how to specify which versions of liferay your app works with note if you haven't yet done so, be sure to read the chapter of using liferay portal! now that we have covered the basics, you're armed with enough knowledge to start creating apps on the marketplace, so let's see what that looks like in the next";;
|
let's jump right in with an example. in this section, we'll walk you through the creation and publication steps but we won't actually publish the app on the marketplace, since this example app isn't very useful!. this, you should understand how marketplace app development typically occurs before you can publish anything, you first have to create develop an app! are nothing more than collections of individual plugins, so the first step in development an app for the marketplace is to develop the functionality in the form of one or more liferay plugins. to create a sample app which will consist of a single portlet, follow the detailed instructions in the portlet development chapter of this guide. after creating and deploying your sample in the real world, apps usually consist of multiple components e.g. multiple.war file plugins, are spread across multiple plugin types, and present non-trivial functionality which in many cases requires some configuration. these advanced tasks are dealt with is out of scope for this section, but some tips and considerations for marketplace development can be found later in this when publishing your app, each plugin you upload is packaged into one or more packages for each liferay release you intend to support. plugins to the liferay marketplace, your app is scanned, and the embedded packaging directives you have specified are extracted and used to create different downloadable packages of your app for different liferay releases. you must insert this information into each plugin in your app before you can the packaging directives are related to the liferay releases with which your app in order to specify which release of liferay your app is compatible with and therefore which packages should be created for eventual download on the marketplace, you first need to understand how liferay releases are named and how they relate to the underlying liferay release version. can be found on the versioning policy accordingly, liferay 6.1 ce ga1 is designated as version 6.1.0. liferay 6.1 ee ga1 is designated as 6.1.10. follows a slightly different policy given then presence of fix packs and service for each plugin that makes up your app, packaging directives must be placed in the url file located in the web-inf directory of your plugin's.war file. within this file, you must specify a comma-separated list of liferay releases with which your app is compatible, and for which packages should be generated, using the liferay-versions keyword. marketplace will create packages that contain your plugins based on these packaging directives and will intelligently group them together as each plugin you should specify ce versions first, followed by ee versions, using this form liferay-versionsce,ce,ce,ee,ee,ee where ce and ee are replaced with the corresponding liferay releases with which your app is note if your app is compatible with both ce and ee, you must specify a set of versions for both ce and ee releases. if you only specify compatibility with ce, then your app will not be compatible with and will fail to deploy to any for example, to specify that a particular plugin in your app is compatible with liferay 6.1 ce ga3 and later, and 6.1 ee ga3 and later, add this line to this means that the app works with any 6.1 ce release starting with ce ga3, and and 6.1 ee release starting with ee ga3. marketplace will create two packages, one that is compatible with the 6.1 ce ga3 release and later, and another that is compatible with 6.1 ee ga3 release and later note any ce or ee versions you include in your packaging directives must be terminated with a version using the symbol. will be deployable onto future versions of liferay but does not guarantee your app will work in future versions. work, but liferay-versions6.1.1,6.1.2 will work. liferay-versions6.1.2,6.1.30,6.1.31 will not work as the ee versions are not properly terminated, but liferayversions6.1.2,6.1.30,6.1.31 will here are some additional examples you may find it advantageous to implement one of your app's plugins in multiple ways, customizing that plugin for different liferay releases. suppose your app consists of two plugins a portlet and a hook. standard api calls that work on all liferay 6.1 releases. other hand, needs to interact with ee ga3 differently than it does with ce ga3, because you want the hook to take advantage of an exclusive ee feature. app, how do you provide one version of your hook plugin for ee and another version of it for ce, while applying your portlet plugin to both ee and ce in this case, you'd specify versions liferay-versions6.1.2,6.1.30 for your portlet plugin, indicating that it is compatible with ce ga3 and later, and ee ga3 and later. you'd create and build two versions of it, one version of the hook to use with liferay ee and the other version of the hook to use with liferay ce. specify liferay-versions6.1.30 for your ee hook and liferay-versions6.1.2 for your ce hook. the ee hook would work exclusively with ee ga3 and later, while the ce hook would work exclusively with ce ga3 and you might think that it's difficult to arrange the packaging for an app that has plugins targeted to different liferay releases, but it's easy. marketplace takes care of it based on the liferay-versions values you when you upload your app's plugins, as demonstrated later on in this chapter, you'll notice that marketplace groups them into separate packages based on the respective releases each plugin supports. marketplace copies a plugin into each of the release packages corresponding to its list of liferay-versions values. if marketplace cannot verify the version of liferay the plugin supports, it your pluginperhaps because you are confident it can work on any liferay releasemarketplace will likely reject it, because it doesn't know of a 1.0 so take care in specifying the liferay version information now that you've developed your app and specified its packaging directives, it's time to get it to the marketplace! before you can publish anything to the marketplace, you must first have an visit url and click register in the upper-right corner of the screen. once you have registered, you can visit the the marketplace home page is shown below figure 15.1 the marketplace home page is where users go to find new and interesting apps this is the front page of the marketplace and is where users go to find new and you'll visit here often during the course of development, so it might be a good idea to bookmark it now. to get started, the first thing you want to do is visit your personal home page. there is a thin strip at the top in the drop-down menus of the dockbar, including a link titled go to my home. this is a link to your personal home page. more details about what you can find on your personal home and profile pages can be found in the liferay marketplace for now, go to your personal home page by clicking figure 15.2 use the my home page link from anywhere in liferay to navigate to your personal pages your home page contains links to often-used functionality of url, including app creation and management. there are several links on the left of your home page, including one titled app manager. manage the apps that you have either purchased or have been purchased for use in companies you are associated with or apps that you or your company have you'll use this page heavily, so a bookmark would be useful here. click app manager to visit this page figure 15.3 the app manager lets you maintain everything about apps you've purchased or published you'll notice three tabs across the top purchased this shows apps you have personally purchased, and those apps that have been purchased on behalf of companies you are associated with apps this shows apps you have personally published add an app this screen begins the process of publishing a new app since you have not purchased or published any apps, the first two tabs are to begin the process of publishing your app, click add an app. allowing you to fill in your app's details the first step is to enter the basic details about your app figure 15.4 add all the details about your app, including tags, categories, and links to your site this screen allows you to enter basic details about the app you are publishing name the name of your application. arguably the most important detail of your app, the name of your app should be a good title that conveys the function of the app but is not overly wordy or misleading. app is key to its success, so choose wisely! considerations chapter for more guidance on how to pick good names. include versions in the title unless it is a vital part of the name, for example each app on the marketplace must have a unique description like the name says, this is a description of your app. put anything you want here, but a good guideline is no more than 4-5 paragraphs. this field does not allow any markup tags or other textual adornmentsit's just icon the icon is a small image representation of the app. marketplace basics section of this chapter for detailed requirements for screen captures you can supply multiple screenshots of your app in action. the screenshots you upload here are displayed when your app is viewed on the marketplace, using a carousel of rotating images. section of this chapter for detailed requirements for screen captures tags a set of descriptive words that categorize your app. free-form and can help potential purchasers find your app through keyword searches, tag clouds, and other search mechanisms. suggestions to let marketplace suggest some tags for you based on the data click select to select from existing tags, or you can see the marketplace basics section of this chapter category choose the marketplace category that most accurately describes users looking for specific types of apps will often browse categories by clicking on a specific category name in the main marketplace home having your app listed under the appropriate category will help them find developer website this is a url that should reference the web site associated with the development of the app. for open source apps, this typically points at the project site where the source is maintained. a home page of information about this app would be appropriate support website this is a url that should reference a location where purchasers or users of the app can get support for the app demo website what better way to showcase the amazing capabilities of your app than to have a live, running version of it for potential buyers to see and this field can house a url pointing to exactly that app owner choose to whom the app belongs once it is uploadedeither yourself personal or a company. if you wish to publish your app on behalf of your company, but your company does not yet have a marketplace profile, you can enter the company name in the company name field. representative of your company, you can register your company by clicking the publishing on behalf of yourself is the default. yourself, the app appears in your app manager apps list, and your name appears in the marketplace as the publisherauthor. who can manage this app add new releases, new versions, edit details, etc publishing on behalf of a company effectively hands the keys over to the admins the app only appears on the company's app manager in addition to yourself, company admins can manage this app add new releases, new versions, edit details, etc. authoreddeveloped by the company, not you personally. company's public profile page under its list of apps make up some sample data to use during this example, and enter it into the form. once you have entered all your app's details, click next to move on to the figure 15.5 specify the version of your app here, following the guidelines on this screen, you must specify the version of your app. the what is a version section in this chapter to choose a good version for our example, since this is the first version, this screen allows you to upload different sets of plugin files variations to you must upload at least one plugin file before advancing beyond this screen. the screen is shown here as it initially figure 15.6 specify a set of files for each version of liferay portal you wish to support press the browse button, and select the plugins that make up your app. time you add plugins to the list, they will automatically begin uploading, and their compatibility information will be scanned read the specify app compatibility section above to understand what compatibility information is for this example, our app consists of a hook and a portlet. across all liferay releases, but the hook is built separately for ce and ee. therefore, we will upload 3 plugins that make up our app. uploaded, a check mark appears next to each plugin, and the plugins are displayed based on the compatibility information figure 15.7 your app has uploaded successfully this indicates that the files were successfully uploaded. portlet plugin was automatically copied for use in both the ee and ce variations, even though you only uploaded the portlet plugin once. whenever you make a change app details, adding files, adding new versions, you always wind up at a preview screen. this allows you to preview your app as it will appear in the marketplace, so you can confirm your changes figure 15.8 always preview your app before submitting it. you may see changes here that you want to make before you submit it for this example, review the information. edit to go back and continue making changes until you are satisfied once you are satisfied, click submit for review. this example on liferay's marketplace, don't do it, since this is only an the next section describes what happens when you submit apps or app when you submit apps to the marketplace, they are reviewed by liferay marketplace staff to ensure that your app meets the minimum standards described in the above requirements section of this chapter each of the following changes require a review by marketplace staff before the change is published to the marketplace while your submitted change is under review, you can view the status of your change by visiting home app manager apps. cancel your submission by clicking cancel submission on the preview screen once your app is approved by marketplace staff, congratulations! receive an email confirmation and at that moment, your app is in the the app is also shown on your public profile page, which lists all apps that you have personally developed and published if your app is rejected, an email will be sent to the email address associated with the app, along with a note explaining the reasons for rejection. point, you can make the requested changes, and re-submit the app for approval now that you have successfully published your first app, you'll likely get all kinds of feedback from users and yourself about what's right and wrong with it. in the next section, we'll explore how to make changes once you have published;;
|
after your app is published and approved, you will undoubtedly need to make one or more of these kinds of changes during the life of the app liferay marketplace supports all of the above operations as described below app details include the name, description, icon, screenshots, and other information that you supplied on the first screen during the app creation to make changes to this content for your app, navigate to home app manager apps, then click the action button next to the app you figure 15.9 editing an app is as simple as navigating to it and clicking edit this screen shows you what the app looks like on the marketplace. detail information, click the edit button at the bottom of the preview. allows you to edit details as well as add new files to your existing version. note that the current values as they appear in your app are used to pre-fill the make any changes as needed on this screen, and click next. need to edit any more variations, you can continue clicking next until you reach the final preview screen. click submit for review to submit your detail once approved, the changes you request appear on the if you need to add files in support of another liferay release, the process is navigate to home app manager apps, click on the action button next to the app for which you wish to add new files, and click click next to advance past the details screen making any changes as needed, and click next to advance past the version edit screen you can't actually edit the version number of an already-approved version, but you can edit the what's new information if needed once you advance past the version edit screen, you'll be at the file upload this screen should look familiarit's the same workflow used when you the difference is that you can't edit pre-approved files for specific liferay releases. you can only add new files for a different liferay release if you actually need to update existing files, you must create a new version of the appsee the later section on adding versions upload your new files ensuring that your new plugins have updated compatibility information, see the section on specify app compatibility for details on versioning, click next, and observe the newly-added files listed at the click submit for review to submit your requested the files will be reviewed by liferay, and once approved, the new package is available for download in the marketplace after time passes, you may wish to add new functionality to your app or fix a this can be accomplished by releasing a new version of your app. new versions offer your users new functionality and bugfixes, and users are generally encouraged to always use the latest version. version of your app becomes available, existing users are notified automatically through liferay's notification system new versions of your apps are created similarly to the way the initial version to add a new version, navigate to home app manager click the action button next to the app for which you wish to add a new version, and then click edit. you will be taken to the details screen. the bottom of the details screen, click the add new version button. button begins the process of adding a new version, starting with the app details in this case, the screen is pre-filled with data from the current version of the app, as shown below figure 15.10 adding a version is similar to creating a new app, except that the fields are filled in for you you can make any changes to the pre-filled data on this screen. new version of an existing app making major changes such as completely changing the name or description might be unsettling to your existing users. common that you'll want to upload new screenshots and refresh the icon. that you cannot change the app owner such as moving from a personally-developed app to a company-developed app clicking next takes you through the same screens you've already seen. add app version screen, you can specify a new version name for this version of also, note that when adding new versions to an existing app, you have the option to add what's new text. this is typically filled in with a list of changes for this version, such as significant new features or bugfix clicking next from here allows you to upload the files associated with the new version of the app. for a new version of the app, you must upload all files for all supported liferay versions again, even if they have not when the time comes to retire your app, you can deactivate it. app causes the app to no longer be downloadable from the marketplace for new customers and it won't appear in any public marketplace listings. customers that have already downloaded your app can continue downloading the legacy versions of the app they have already acquired, but they can't download any versions they've not already received. the app remains in your inventory, with all of its history, in case you need to re-activate or reference it in the to deactivate your app, navigate to home app manager apps, click on the actions button next to the app for which you want deactivate, and;;
|
one of the main reasons for developing and publishing apps into the marketplace is to drive downloads and adoption of your app. the marketplace enables you, as the developer of your app, to get detailed reports about the number of views, downloads, and installations of your apps. to access these metrics, navigate to home app manager apps, click on the actions button next to the app for which you want metrics, and select the metrics action figure 15.11 app metrics let you see graphically how many views, downloads, and installations your app has in the marketplace the view shown above is the default metrics view for a single app. top is a list of data series options views, downloads, or installations . below that, a date range can be chosen. in the middle, a graph is shown for the finally, the same data that is graphed is also shown in tabular format, in case you want to know the exact values making up the the different types of data available to view are described below when someone searches or browses the marketplace, they click on apps to see detailed views of the apps they're interested in. a view is recorded for the app, and this data is what is shown on the app metrics screen when views is selected at the top. the number of recorded views per day per user is a download is recorded for your app when someone downloads a specific package of a specific version of your app. the number of recorded downloads per day per the marketplace does a best effort in recording installations of your app on when a liferay administrator installs your app via the liferay administration console control panel, an install is recorded for;;
|
in this chapter we introduced concepts and instructions for developers to make their apps available on the liferay marketplace. publish, maintain, and track apps. url, using your own personal credentials and its next, we covered the requirements for publishing apps, which did not differ significantly from requirements for general liferay we then showed how you can publish a sample app on the marketplace and how you can modify it as the app evolves. finally, we looked at how to track the adoption of apps using view, download, and install metrics. information helps you understand how to develop apps for liferay! next, we'll take a look at some helpful plugin developer references. ready to bookmark plenty of links!;;
|
the following are useful reference resources for developers working with the liferay platform;
|
with liferay's frameworks, implementing complex functionality in your custom we covered security and permissions and the make sure you check back regularly to find more detailed descriptions of current frameworks and discover brand new frameworks that'll knock your socks off, or at least simplify your custom portlet development.;;
|
opensocial is a public specification for creating web applications using standard technologies like html, css, and javascript. developed by google, myspace and others to standardize common social networking api's but has evolved into a general platform for building web applications. whereas standard applications work with data on a per-user basis, social applications share data within well defined networks, facilitating communication of information between groups of users. opensocial applications, called gadgets, are similar to portlets because they can be added to your portal's pages and used for all kinds of tasks. gadgets are characterized as being simple, widely available, and easy to deploy in this chapter, we'll cover the following topics let's first look at the structure of an opensocial gadget and consider the concepts involved with opensocial gadgets.;;
|
an opensocial gadget is specified in an xml document that has two parts. first part of the document specifies meta-data declaring gadget dependencies, defining characteristics about the gadget, and specifying user preferences. meta-data can be broken up into module preferences and user preferences. the second part of the document contains the gadget content, defining the gadget's user interface and business logic. we'll spend time going over all figure 13.1 an opensocial gadget's xml consists of elements specifying gadget preferences, user preferences, and content below is an example opensocial gadget xml file for a map gadget for the official documentation on gadget anatomy, see google's anatomy of a convenience, however, let's consider gadget meta-data and content here to highlight their important aspects gadget meta-data specifies characteristics of the overall gadget and specifies controls for the user to customize the gadget. gadget preferences required define characteristics of the gadget. specified as attributes of and nested elements in the gadget's user preferences optional store user configuration values and allow users to give input to the application. the gadget preferences moduleprefs define characteristics of your gadget, including features that it uses, how it authenticates content, how it is displayed to the user, and how it is displayed in a gadget directory. preferences are wrapped in... tags within the moduleprefs, you specify the gadget's dependencies with tags and optional features with tags. a tag, the gadget only renders itself if the feature is available. if you specify a feature in an tag, the gadget renders despite moduleprefs can also be used to configure important features such as pubsub and the pubsub feature allows for communication between gadgets on the same page they can publish and subscribe on message channels. gadgets to communicate with portlets using the same mechanism. feature provides secure connections between your portal and third-party sites. these are just a couple of useful features that can be defined in the you'll learn more about them later in this chapter overall, this element allows you to register your gadget on a gadget directory and establish settings and tools to use in your gadget's for complete details on moduleprefs, see google's moduleprefs next, let's consider gadget user preferences when a gadget is configured to fit a specific page, it can really enhance the opensocial gadgets are capable of storing user preferences, allowing gadgets to present information and options tailored for individual the title userprefs can also be referred to as application preferences, since the preferences being changed only apply to the single gadget and not to each user that uses it. a gadget's user preferences are specified in... tags in the gadget's xml. a page can adjust permissions to allow certain users to change the user however, every time the userprefs are modified, every user that views the gadget has a modified gadget. as a user enters information and adjusts controls via a gadget's user interface, those changes are persisted in the database for that gadget instance. each time the gadget is reloaded, the userprefs are extracted from the database, fed back to the gadget, and rendered map gadgets, for example, are prime candidates for userprefs. bring up map gadgets, they are typically interested in their current location or a location of interestnot some random distant land. for a map gadget to take the user's location of interest as input. facilitate taking in this information, storing it, and processing it to present gadget user interfaces customized to the user. take in the user's latitude and longitude preferences, stores them, and displays lastly, we'll look at what a user sees in the gadget's user interface when userprefs can be displayed in many different ways and help your gadget become more adaptable to your users' ever changing expectations. extensive variety of userpref data types available to properly personalize your for complete details on userprefs see google's user within the... tags of your gadget, you define your the content can be implemented in html allows you to use javascript and gives you but if you simply want to leverage content found at a particular url, use the url content type to help you decide which content type is best for you, see google's choosing a but for convenience, let's consider basic aspects of these html is the default content type for opensocial gadgets. flexible and commonly used for gadgets, you may find yourself using it often note that all html content must be specified in a cdata section within your the following simple content example demonstrates proper also, it is forbidden to use,, or tags in your html content, as these tags conflict with the ones automatically generated by the this content type is convenient when you just want to reference content within an existing url, and nothing more. the gadget assumes all programming and user interface logic resides in your specified url. content type, you do not need any html or javascript. type has better consistency in the specification than the html content type here is a sample of what the url content type looks like for an example gadget both html and url content types offer beneficial traits and can be used the content type you use for your gadgets depends on your needs and now that you're fundamentally sound on the gadget basics, let's explore what gadgets offer you in liferay portal.;;
|
is there data on sites like evernote, facebook, google, netflix, photobucket, twitter, or yahoo you'd like to access in your opensocial gadgets? like to provide a gadget for portal users to add movies to their netflix queue or for users to display their photobucket pictures within gadgets in liferay you may be concerned that users would have to share their third-party application credentials with liferay portal in order to use the applications. oauth technology resolves the issue you can think of oauth as a handshake mechanism where, instead of requiring the exchange of personal information, your site redirects portal users directly to the service provider e.g. netflix, photobucket, etc. gadget's access to their resources on the external web applications. section in using liferay portal 6.1 for instructions on configuring and using to learn how to write oauth enabled gadgets, see google's let's now shift our focus to gadgetportlet communication with pubsub.;;
|
"have you ever wanted your gadgets to communicate with each other or with it is a messaging pattern in which publishers send messages to topics and subscribers receive the messages on those hence, the term pubsub is short for publish and subscribe. implemented in liferay to facilitate interaction between gadgets and interaction pubsub is a diverse messaging system that allows messages to be sent in the following manner with the use of pubsub, the worlds of gadgets and portlets blend together, facilitating their ability to communicate and interact with each other publishers don't send messages to subscribers directly; instead, they publish messages that are characterized into classes and sent across message channels therefore, the publishers have no knowledge of whom they are sending their messages to; they simply broadcast the messages over a channel. so you may ask how do subscribers receive messages if the messages are not subscribers express interest by subscribing to certain once subscribed, they receive messages sent to those channels. publishers, they have no knowledge of who sends the messages, they only know channels and receive messages coming in on those channels. it much easier for multiple gadgets and portlets to communicate with each other, without specifically stating with whom they are communicating pubsub can be compared to a tv station and your tv. directly send their material to your tv, but instead broadcasts the material you subscribe to that channel by tuning your tv to that channel this process of broadcasting and tuning into tv programs is similar to publishing and subscribing to messages sent via pubsub pubsub also offers the ability for portlets and gadgets to publish to and subscribe to multiple channels. although this may seem like a complex process, pubsub's use of message channels creates a network for gadgets to communicate across, and the network is easy to maintain and understand let's try out pubsub for ourselves to explore how pubsub works. fundamental example, we'll import two simple gadgets and send messages from one one acts as a publisher and the other as a subscriber. navigate to the control panel and select opensocial gadget publisher from select publish gadget and, for each gadget, enter the url and click save go back to a page on your site, navigate to add more..., and add click publish a random number on the pubsub publisher gadget. it publishes a number; but the pubsub subscriber gadget does not receive the figure 13.2 the subscriber cannot receive any messages from the publisher without being subscribed to the channel select subscribe on the subscriber gadget click publish a random number again from the publisher gadget. the random number received by the subscriber figure 13.3 when the subscriber is subscribed to the publisher's channel, the subscriber is able to receive messages select unsubscribe on the subscriber gadget as you would expect, the subscriber portlet no longer receives the random this simple example illustrates what pubsub does. through which publishers and subscribers can interact. noticed that while publishing and subscribing with your gadgets, there was no this is because the gadgets use ajax asynchronous this technology refreshes your applications automatically, allowing pubsub to work efficiently and effectively throughout i bet you are wondering how to implement pubsub messaging in your gadgets and in fact, we'll complete exercises demonstrating gadget to gadget interaction and portlet to gadget interaction for gadget to gadget communication, two independent gadgets are placed on a page these two gadgets are able to communicate with one another and provide tools that the user could not otherwise produce. complete a simple example for gadget to gadget communication where two gadgets work together to display an address on google maps. a publisher that enables the user to input a specific address and publish the the second gadget represents the subscriber who receives the address, displays the address, and locates the address on google maps. publish the google address and google map gadgets, as we had done figure 13.4 gadgets are easy to publish and some gadgets, like google's address and map gadgets, are automatically synced to communicate with each other note the address bar is already filled with an address. address is specified in the google address gadget's source code. edit this setting using liferay's gadget editor later in the chapter input an address into the address bar and then click update. now be able to see that address location displayed in the google map figure 13.5 after inputting a custom address in the google address gadget, you are able to see its physical location in the google map gadget your gadgets are communicating well with each other. simple example demonstrates two gadgets communicating with each other using we will now dive into the source code and analyze how this interaction first, we'll look at the contents of the google maps xml file the following excerpt from google maps xml file enables the gadget to use pubsub and specifies the channel topic to which the gadget publishes notice the opening, mandating the pubsub-2 topic url that the gadget publishes to. the topics parameter, you define all the topics your gadget uses for furthermore, the publishtrue attribute specifies the gadget's role as a publisher to the topic in the javascript of the gadget's content, the gadget publishes to the topic when the user clicks the gadget's publish button, the message is sent by the publishing gadget to the topic named url. broadcasts the message received on that topic to all subscribers, such as your each subscriber receives and processes the message. the case of your google maps gadget, the message, containing an address, is processed by the gadget to show the address location on its map next, we'll analyze the example's subscribing gadget's source code specified the subscriber source code is similar to that of the publisher. pubsub-2 feature for the gadget and specifies url as one of its topics, as you would expect. course, the only difference is the fact that this gadget subscribes to the topic, hence the attribute setting subscribetrue the following javascript from the gadget's content registers a callback on the the url function is called by the opensocial container once the gadget connects to the pubsub messaging hub. the gadget subscribes to the previously mentioned topic. this topic receive messages sent to it when a message is received, the gadget's callback function is executed. this example, the callback method sends the received message the address sent by the publisher and calls url to get the and finally, the locations are processed and displayed on the map in summary, subscriber gadgets need to specify a topic and register a callback function on that topic to handle the messages they receive as you can see, pubsub allows your site to run efficiently and enables otherwise unconnected gadgets to communicate and flourish within liferay portal gadgets are not limited to only communicating with other gadgets. section, we will demonstrate the capabilities of communication between portlets for this section, we will continue implementing the google map gadget on your if you have portlet applications that can take advantage of the functionality your maps gadgets have to offer, it would certainly be convenient for a user to allow communications between those gadgets and your portlets as a demonstration, we will send messages from a directory portlet to the for each user listed in the directory portlet, we will create a show in google maps link that, when selected, displays the location of the user's address in the google map gadget this portlet is much like liferay's directory portlet. to do is edit the portlet's url file to configure a google maps link as you know from explanations given earlier, the google map gadget is therefore, the directory portlet needs to take on a publisher role to enable communication. to enable the directory portlet to publish to the topic on which the google map gadget is subscribed, we insert the following javascript into the url file this code involves a publishaddress function that's called whenever you click on the show in google maps link. url function, passing in the name of the channel receiving the message and the user's address as the message. one thing to note is that when a portlet sends data to a gadget, there must be a gadget prefix before the this distinguishes who the messages are intended for when they are broadcast across a channel. notice that you don't need to change anything for your google map gadget, since it's already subscribed to that channel. only needed to define the directory portlet as a publisher to that channel note if you would like to broadcast messages to portlets, follow the same guidelines, but don't use the gadget prefix in your topic parameter value for after editing the jsp, you can add the directory portlet and google map gadget to a liferay page and test it out. figure 13.6 your modified directory portlet sends a user address to the google map gadget to display the address location in its map letting your portlets communicate with gadgets enhances your portlet applications and gives you a plethora of different ways you can enhance your we will now switch gears and dive into liferay's gadget editor!";;
|
as part of liferay's opensocial integration, the opensocial gadget editor is the gadget editor is a complete development environment for gadgets, providing syntax highlighting, preview functionality, undoredo options, and built in tabs for working on multiple gadgets at the same you can also organize and manage gadgets easily using the editor's file all of this gives you the convenience of creating and improving your gadgets right from within liferay portal within the editor, each gadget's xml file has a wrench icon allowing you to close, rename, delete, or publish the gadget, or to simply show the gadget's the publish button directs you to a screen, similar to the opensocial gadget publisher, allowing you to publish your gadget. through the editor are stored in the site's document and media library. show url button gives you the url so that the gadget may be shared with other these options offer a user-friendly and easy to use testing station for enhancing the gadgets on your sites figure 13.7 the wrench icon can be easily found to the right of your xml file note when you publish a new gadget, remember that your liferay portal installation is the new host when specifying for a brief exercise, we will improve the google address gadget using the as we referenced earlier, the google address gadget automatically displays the address 1400 montefino avenue, diamond bar, ca by using the opensocial gadget editor, you can edit the xml file and specify a customized address or remove the default address for our example, we will remove the default address entirely from our gadget's text window copy the gadget xml contents into the gadget editor. gadget publisher from under the portal heading and select the url for copy the xml content onto your clipboard navigate to the opensocial gadget editor from the control panel and paste your clipboard contents into the gadget editor click the floppy disk button to save your new gadget xml, naming your gadget press the green check button to save the file figure 13.8 it is easy to insert gadget content into liferay's opensocial gadget editor and save it as an opensocial gadget note liferay will not allow you to publish your new gadget without attaching.xml to the end of your file name select the preview tab from the toolbar and a preview of your gadget figure 13.9 the preview tab displays what your gadget would look like if it was added to a liferay page locate the following element in the gadget xml then, remove the value1400 montefino avenue, diamond bar, ca 91765 select the editor's preview mode and click the refresh button figure 13.10 the refresh button is easy to find in the upper right corner of the editor's preview pane as you would expect, the gadget's default address is now blank figure 13.11 your updated gadget now has a blank text window, thanks to the editing you've done in liferay's gadget editor publish your gadget for portal-wide use by selecting the wrench icon next to the url file and clicking publish figure 13.12 you can publish your opensocial gadgets directly from liferay's opensocial gadget editor a publish gadget screen opens up, showing your gadget's url and categories figure 13.13 a publish gadget window displays your gadget's url and a host of categories for you to consider for your gadget choose a category and click save your new gadget is now available for portal-wide use! the opensocial gadget editor allows you to create and improve gadgets within the comfort of your own liferay portal instance you can facilitate the social interactions on your sites and increase your portal content's popularity across your social network by leveraging the power;;
|
"opensocial gadgets offer a plethora of new features to liferay that present new opportunities for your portal customization. you've learned the anatomy of a gadget, how to access third-party applications from a gadget, and gadget also, you learned that liferay's gadget editor makes editing and customizing your gadgets easier than ever. give yourself a pat on the back; you're now a trained gadget guru! next, we'll explore the seemingly mysterious world of plugin security management.";;
|
we all wish cyberspace were free of malicious software and unwanted bugs. it isn't, we need to guard ourselves and our portals from these evils. liferay portal's plugin security manager! it's like a super-hero in a cape and in its quest for peace within your portal, the plugin security manager pledges let's go over some scenarios that could apply to you with regard to trying new plugins, and then maybe the importance of this will be clear these are just a few scenarios that may ring true for you. responsible for keeping your system running well 24x7, you can't be too cautious in protecting your portal, system and network.;;
|
when the plugin security manager is enabled for your plugin, it checks your plugin's portal access control list pacl. this list describes what apis the plugin accesses, so people deploying the plugin can review what it does without if the plugin tries to access anything that's not on this list, the plugin's request is stopped dead in its tracks with the security manager logging information on the attempt to access unauthorized apis or access to apis and resources is authorized by means of property values specified specified in your plugin's web-inf directory. properties are collectively known as the plugin's pacl as you develop plugins for liferay marketplace or for distribution within your organization, you'll need to set the security manager properties appropriately. before we dive into the intricacies of these properties, let's consider a plugin development approach that involves designing an app for the security manager;;
|
"at the start of plugin developement, you may not have a clear picture of all the aspects of the portal you'll need to access, and that's fine. suggest you go ahead and develop your plugin first and address your plugin's but, as you develop your plugin there are some common security pitfalls, highlighted in the next section, that we'll show you how to avoid. after you develop your plugin you'll dig whole-heartedly into security management by generating and fine-tuning you plugin's pacl. if you're developing a plugin as part of a free app, writing a pacl for your plugin and enabling the security manager are optional, and you can skip this here is the suggested approach for developing secure plugins let's go over each part of this approach as you develop your plugin, you need to anticipate your plugin's actions in light of liferay's secured environment. the security manager leverages the java so understanding java se security and learning the few requirements that liferay's security manager adds on top of it will benefit you the extensive java se security architecture documentation is available for you to read at but we'll highlight a couple common mistakes developers make that violate you wouldn't intentionally make these kinds of mistakes, but you'd be surprised at how easily you can make them if you're not being careful enough. consider scenarios that illustrate both of these mistakes and explain how to avoid making them in your plugin. let's consider security exceptions first when you're running on liferay portal with the security manager enabled, you must only access authorized resources. if you invoke a method declared as throwing a security exception i.e., url.securityexception and you're not authorized to access the resources the method uses, the method throws the security exception and the security manger stops your plugin dead in its tracks. security exceptions are unchecked, meaning that the compiler doesn't require but since methods that throw security exceptions are declared as throwing them, you should check their signatures as you're if they throw security exceptions, handle them appropriately with trycatch blocks. keep in mind that you not only need to handle security exceptions of methods your plugin invokes directly, but you also need to handle the security exceptions of the underlying methods your for example, you may be using a file utility that calls url.file's since the canread method can throw a securityexception, your plugin will violate security if it invokes the utility on a file that you're not authorized to access. so, be aware of all security exceptions thrown by methods your plugin calls directly and indirectly operations involving reflection, and similar activities, typically can throw the java se security documentation explains how to deal in many cases, you can declare your plugin's permissions to avoid we'll go over your plugin's permissions and security policies later in this chapter the second common mistake you should avoid is allowing your plugin to bring up classloaders unintentionally, via other frameworks or libraries. following spring configuration from a plugin it declares a factory bean that calls a method on a liferay class. unfortunately, spring tries to grab the classloader for the since the factory class does not belong to the plugin, the security manager balks at the plugin's attempt to access the classloader for the the security manager doesn't allow applications to get arbitrary classloaders because the classloaders can add, access, and modify classes that your plugin is unauthorized to access. using spring in this manner violates the how do you get around this issue? you could simply invoke the method directly but if you insist on using a spring factory bean, you can do the following write a class inside your plugin to act as a factory. should declare a class that wraps the type of instance your factory returns. your factory should also implement a method that returns the instance, wrapped in the class you declared configure a spring factory bean that uses your plugin's factory class here's what your plugin's new factory class could look like the code above declares a factory class named factoryutil that resides in a the factory declares an inner class named testuserlocalservicewrapper that extends liferay's userlocalservicewrapper class you want the factory to return. lastly, the getuserlocalservice method uses the original factory method, url, to get this instance is wrapped up in your factory's in your plugin, you've implemented a factory class to access the instances you want. your new spring factory bean would look like the following configuration now you know a couple alternatives to using the troublesome spring factory bean configuration that was accessing a classloader that didn't belong with regards to both of the use cases we've illustrated, the main point we're emphasizing is that you must be aware of the how the libraries you use behave with respect to your secured environment. the better you understand java se security and liferay's plugin security management, the easier it will be for you to write security-aware plugins. keeping this in mind, you can proceed confidently creating your plugin start creating your plugin the way you normally would. write code, unit test your code, have users beta test your code. everything you normally would do. do all of this with the plugin security manager disabled via your plugin's url file before the plugin security manager is enabled, you must specify the resources let's build a list of these resources in your plugin's rather than tediously figuring out all of the resources your plugin accesses, on your own, let liferay's pacl policy generation tool to give you a head start. the generation tool detects resources your plugin accesses and writes corresponding pacl properties to a policy file. properties from this policy file into your plugin's here's how you generate a pacl policy for your plugin make sure your liferay portal instance has liferay set as its security manager strategy value and that the security manager was activated during in your url file, make sure liferay portal's security manager strategy is specified as follows your app server may require that certain startup arguments be used for activiting the security manager. for example, tomcat requires that you pass in an option -security in order to activate the security manager. your app server's security manager documentation to make sure. some app servers, like tomcat, output a terminal message, like using security manager, indicating that it's using the security manager unless you already started liferay with the security manager enabled and activated as described above, you must restart liferay with these settings enable the security manager to generate a security policy for your plugin by setting the following property in your plugin's the pacl policy generation tool writes a pacl policy file with the following on deploying your plugin and as you exercise your plugin's features, liferay portal's security manager performs security checks on your plugin; but rather than throwing errors on failed checks, the generator tool writes suggested rules that specify access to the resources your plugin accesses unless you've turned off logging for the generator tool, messages like the ones below are logged, reporting the various authorization properties that lastly, merge the properties that the security manager wrote i.e., your newly generated pacl policy file it's just a matter of merging the properties that start with the security-manager- prefix now that your plugin has a thoroughly specified list of resources it accesses, let's enable the security manager and do final testing of your pacl properties. we cover enabling the security manager in the next section if you want to distribute plugins, either through the liferay marketplace or through your web site, you have to assume potential users will insist the security manager is enabled in your plugin. for this reason, you should enable to enable the security manger set the following then, re-deploy your plugin and re-test it's functionality. throws java security exceptions, if your plugin accesses resources that are not specified in your plugin's security policy. as you test, keep track of these java security exceptions, so you can authorize access to the respective resources in the pacl properties of your url save your changes to the file, re-deploy the plugin, and re-test. if not, there are more rules you must declare for your refer to the portal access control list properties section of this chapter to see the definitions of all the pacl properties and see example if you are not finding an adequate way to specify a security rule with pacl, you can specify it in a java security policy file. you see, it's almost impossible for liferay and pacl to be aware of every possible security implementation check, because developers, libraries, and the java security api can always call for new types of security checks. so, liferay provides a fallback to pacl, that lets you specify operations permissible within the context of your app's in case you need it for your plugin, let's get familiar with the java security if you cannot find a way to specify pacl permissions for an operation that your plugin must access, you can specify the permission in a java security policy you can create policy file url in your plugin's web-inf the policy file must follow policy file syntax as described in detail at like the rules you define in your plugin's pacl, the additional rules you define in your plugin's java policy file, url, only apply to that plugins aren't privy to each other's security policies importantly, the java policy file should only be used to specify rules liferay's pacl property implementation does not already support. any rules in a java policy file that you can specify in a pacl here's a scenario that calls for using a java security policy java has a security implementation called it checks a whole bunch of networking operations, that liferay's implementation in case you want to perform one of these operations, like using a custom stream handler, you can grant your plugin permission to do so in its this grant entry defines permission for the plugin's code to access the specifystreamhandler target operation of the url.netpermission class. the codebase value, in this example, specifies the following on reading this plugin's.jar file, the jvm creates a codebase for it. codebase uses properties that liferay sets for the plugin that say, in effect, if a file originates within the plugin, then this plugin can perform the specifystreamhandler operation on it. the codebase narrows the scope for the this plugin is permitted to perform the definited operation, specifystreamhandler, as long as it is done within the scope the plugin how do you add more permissions to a codebase? in this example, we've granted the plugin permission to invoke native code that's in some library url . this is another type of operation which liferay's pacl does not support. so, it makes sense to specify permission for it in the java security policy file with liferay's pacl policy and java security policy files, you can precisely specify all of the resources your plugin needs to access! the file path values that the pacl policy generation tool wrote to your as mentioned earlier in this chapter, we recommend using the pacl generation tool to give you a head start on specifying your plugin's security rules. the generator is only aware of file paths with respect to the current system, and therefore generates them as absolute file paths. security policy in production, it must use only relative file paths. final step after testing the generated pacl, you must massage the generated file paths into appropriate relative file paths. for example, you can specify paths relative to your liferay web portal directory in this example, we used a dash - character at the end of the paths. oracle defines wildcards for for use with java security, and liferay provides some too. let's consider some helpful wildcards you can use in pacl properties and java security policies for files and file paths, you can leverage the following wildcard characters let's say you want to match all of your theme files and folders, specify the star means every file in this single directory. everything in this folder and below the dash lets you read the contents of the folder, but not the folder itself. also, when defining the folder, do not include a trailing slash, otherwise the folder itself will not be included. below, we specify the themes folder and all of the contents under it for file path separators, you can use the alias you now know how to specify your policy's file paths appropriately for deployment on any server. once you've completed testing your plugin without getting any java security exceptions, you can distribute it as an you can do so with confidence, because you've specified all of the resources it uses in the application's pacl, and possibly its java security policy, and your application satisfies liferay portal's the sections that follow demonstrated how to enable the security manager which you've already done and provide descriptions for each type of pacl property.";;
|
if you want to distribute plugins, either on the liferay marketplace or through your web site, you have to assume users will insist the security manager is for this reason, you should enable it when testing your plugins and on packaging it for distribution it's very easy to activate the security manager. next, we'll look at exactly what apis the security manager protects, and how you can declare whether your application uses any of these properties.;;
|
liferay portal's plugin security manager checks all your plugin's api access attempts against the security manager properties specified in your plugin's if your plugin tries to access a portal resource that is not specified in these properties, the plugin security manager prevents it from happening. consider this a virtual finger waggin'. prevent this from happening, you have to tell the plugin security manager up-front the access your plugin needs the sections that follow describe the pacl properties explaining each property's purpose, its possible values, and the syntax to use in specifying its;;
|
specify the awt operations the plugin is permitted to access;
|
the liferay marketplace is an exciting new hub for sharing, browsing and as enterprises look for ways to build and enhance their existing platforms, developers and software vendors are searching for new avenues to reach this market. marketplace leverages the entire liferay ecosystem to release and share apps in a user-friendly, one-stop site this chapter covers topics related to developing for the liferay marketplace, this chapter focuses on the topics of interest to a liferay developer. highly recommended that you first read the chapter of using liferay portal, where you will find detailed information about the marketplace from an end user's perspective.;;
|
an application programming interface api is a protocol that, when invoked, performs an action or set of actions. you can invoke an api from your own code directly through a java invocation, or through web services. provides an overview of several essential liferay apis available to you for use in developing your liferay portal liferay comes with a host of apis that provide powerful portal and portlet the following table shows you the entities for which services are the ability to call liferay apis with a java method or web service invocation gives you the flexibility to implement client code in java or any language even a scripting language such as php that supports web service invocations. the apis can be called from within portlet or non-portlet code. calls to the apis locally from within the portal or remotely outside of the portal's java virtual machine jvm this chapter covers the following topics you can find liferay's services by searching for them in the javadocs below we'll show you how to search for portal services and portlet services let's start by finding a portal service.;;
|
liferay's javadocs are easy to browse and well-organized. in your browser, open up the javadocs under portal services, click the link for the url package, since the services for the organization entity belong to the find and click on the -serviceutil class in this case organizationlocalserviceutil in the class summary table or the list of similarly, if you want to search for one of liferay's built-in portlet services, but, when looking up the package, instead of clicking on the link for the service package of the portal, click on the link for the service the portlet service packages use the naming convention url.portlet-name.service, where portlet-name is replaced now you're ready to invoke liferay services.;;
|
each service provides a local interface to clients running in the same jvm as there are two ways to invoke a service api's methods spring injection if your application uses spring and has access to the portal -serviceutil classes these classes mask the complexity of service this is a good option if you're not familiar with spring let's invoke a service using its -serviceutil class. snippet demonstrates how to get a list of the most recent bloggers from an this jsp code invokes the static method getorganizationstatsusers from the note permission checks are not performed when you invoke services locally i.e., from the same jvm that's liferay portal runs on. checks are performed, use the remote variant of the api, even from a local next, find out how you can invoke liferay's service apis remotely.;;
|
remote clients run outside of the portal jvm or on a remote machine, but they can still access liferay's service apis. the main benefit of remotely accessing service apis is that security checks are performed. permission checking, develop your client even if it's local so it triggers the liferay's api follows a service oriented architecture supports java invocation and a variety of protocols including soap and json over a limited set of restful web services, based on the atompub protocol, are also supportedsee the portal atom collections wiki by igor spasi for more details. you can also use the api through options for leveraging liferay's api let's step back now and discuss the security layers of liferay's service oriented architecture and how you can configure them.;;
|
"liferay's remote services sit behind a layer of security that by default allows access to the remote apis must be enabled as a separate step in order to call them from a remote machine. is liferay's standard security model even if on the same machine, a user must have the proper permissions in liferay's permissions system to access remote the first layer of security a client encounters when calling a remote service is called invoker ip filtering. imagine you have have a batch job that runs on another machine in your network. this job polls a shared folder on your network and uploads documents to your site's documents and media portlet on a regular basis, using liferay's web services. to get your batch job through the ip filter, the portal administrator has to allow the machine on which the batch job is running access to liferay's remote service. job uses the soap web services to upload the documents, the portal administrator must add the ip address of the machine on which the batch job is running to the a typical entry might look like this if the ip address of the machine on which the batch job is running is listed as an authorized host for the service, it's allowed to connect to liferay's web services, pass in the appropriate user credentials, and upload the documents figure 11.1 liferay soa's first layer of security note the url file resides on the portal host machine and is controlled by the portal administrator. security settings for the axis servlet, the liferay tunnel servlet, the spring remoting servlet, the json servlet, the json web service servlet, and the webdav chapter of using liferay portal describes these properties liferay's security model is the second layer of security that's triggered when services are remotely invoked, and it's used for every object in the portal, whether accessing it locally or remotely. services remotely must have the proper permission to operate on the objects it's a remote exception is thrown if the user id isn't permitted. the portal administrator grants users access to these resources. imagine you created a documents and media library folder called documents in a site and created a role called document uploaders that has the rights to add documents to your new folder. if your batch job accesses liferay's web services to upload documents into the folder, you have to call the web service using a user id of a member of this group or the user id of a user with individual rights to add documents to this folder. figure 11.2 liferay soa's second layer of security with remote services, you can specify the user credentials using http basic since those credentials are specified unencrypted; it's recommended to use whenever accessing these services in an untrusted most http clients let you specify the basic authentication credentials in the urlthis is very handy for testing you'd use the following syntax to call the axis web service using credentials the user id is the user's id from the liferay database. logging in as the user and navigating to the my account page of the control on this page, the user id appears below the user's profile picture and let's pretend there's a user whose id is 2 and whose password is test. can get organization data with the following url note older liferay versions let you access services with this path has changed in liferay 6.1; if you enter it, you'll be redirected to the new one the authentication type specified for your liferay portal instance dictates the authentication type you'll use to access your web service. administrator can set the portal's authentication type to any of the following of using liferay portal should be reviewed, since they'll be enforced on your if the portal is enforcing password policies on its users e.g., requiring them to change their passwords on a periodic basis, an administrative id accessing liferay's web services in a batch job will have its to prevent a password from expiring, the portal administrator can add a new password policy that doesn't enforce password expiration and add your then your batch job can run as many times as you need it to, without your administrative id's password expiring to summarize, accessing liferay remotely requires you to pass two layers of next let's talk about liferay's soap web services.";;
|
you can access liferay's services via simple object access protocol soap the packaging protocol is soap and the transport protocol is as an example, let's look at the soap web service classes for liferay's company, user, and usergroup portal services to execute the following list each usergroup to which user test belongs add a new usergroup named mygroup we'll use these soap related classes can you see the naming convention for soap related classes? all have suffixes -servicesoapservicelocator, -servicesoap, and -soap. -servicesoapservicelocator class finds the -servicesoap by means of the the -servicesoap class is the interface to the services specified in the web services definition language wsdl file for the -soap classes are the serializable implementations of the let's look at how to determine the urls for these services you can see a list of the services deployed on your portal by opening your browser to a url following one of these formats for your secure services i.e., serevices requiring authentication use for your sevices that don't require authentication, use here's the list of secure web services for usergroup note liferay's developers use a tool called service builder to expose their services via soap automatically. if you're interested in using service builder, check out the service builder chapter in this guide each web service is listed with its name, operations, and a link to its wsdl the wsdl file is written in xml and provides a model for describing and here's the wsdl excerpt for the addusergroup operation of usergroup to use the service, you pass in the wsdl url along with your login credentials to the soap service locator for your service. we'll show you an example in the next, let's invoke the web service! a java web service client can easily be set up using eclipse ide. in eclipse, add a new web service client to your project for each service you plan to consume in your client code. for our purposes, the client we're building needs a web service client for the portal's company, user, and usergroup to add your web service clients in eclipse ide, click new other..., then expand the web services category. for each client you create, you're prompted to enter the service definition wsdl for the desired service. figure 11.3 service definition with the wsdl specified, eclipse automatically adds the auxiliary files and libraries required to consume that web service. here's the code that locates and invokes operations to add a new usergroup named myusergroup and assign to it a user with screen name test running this client should produce output like the following example the output tells us the user had no groups, but was added to usergroup you might be thinking, but an error was thrown! an error was thrown url.remoteexception , but we're sitting here as cool as an iced cream sandwich all the same. the exception was thrown simply because the usergroup check was invoked before the usergroup was created. because the very next line of the output says added user group named..., we're here are a few things to note about the url it's a secure authenticated url for the service. using http basic authentication, which isn't appropriate for a production environment, since the password is unencrypted. it's simply used for convenience the screen name and password are passed in as credentials the name of the service e.g. portalusergroupservice is specified at the remember that the service name can be found in the web the operations getcompanybyvirtualhost, getuseridbyscreenname, usergroupservicesoap in the wsdl files. parameter order, request type, response type, and return type are conveniently specified in the wsdl for each liferay web service. next let's implement a web service client implemented in php you can write your client in any language that supports web services invocation. let's invoke the same operations we did when we created our java client, this time using php and the php soap client it's worth repeating that you can use any language that supports use of soap web services to create your web services client. try it out on liferay's soap web next we'll explore liferay's json web services.;;
|
"you're on vacation, and you're just coming back from the beach after a day of frolicking on the sand and in the water. time to grill up some burgers and dogs to grill hamburgers and hot dogs, you have to have a proper procedure and apparatus for accomplishing the task. the procedure would be called an algorithm in computer science terms. that grill should be equipped with a heating mechanism; in the case of most grills, that's either charcoal or propane gas. it also has a metal frame, or grill, placed near the heat. such as a spatula, a plate to hold the meat, and if you're making chicken in addition to those burgers, a brush and some barbecue sauce all of these together form a framework for making grilled food on a hot all the tools you need are at your disposal; you just need to pick if the framework is already in place, it's obviously a lot easier and more timely to cook food than it would be if the framework liferay contains several frameworks that give you all the tools you need to perform various common tasks, such has handling permissions, letting users enter comments, categories, and tags, and other common tasks that liferay doesn't make you have to write yourself here's what we've got in store for you let's start by getting acquainted with a framework that nobody relishes having";;
|
"the java portlet standard defines a simple security scheme using portlet roles and on top of that, liferay provides a fine-grained permissions system you can use to implement access security in your custom here we'll give an overview of the standard java security system, liferay's permission system, and how to use them in your own portlets the jsr specification defines a means to specify roles used by portlets in their the role names themselves, however, are not standardized, so when these portlets run in liferay, you'll recognize familiar for example, the liferay blogs portlet definition references the guest, power-user, and user roles your url roles need to be mapped to specific roles in the portal. that way the portal can resolve conflicts between roles with the same name that are from different portlets e.g. portlets from different developers note each role named in a portlet's element is given permission to add the portlet to a page to map the roles to the portal, you'll have to use a liferay-specific configuration file called url. for an example, see the mapping defined inside url found in portal-webdocrootweb-inf if a portlet definition references the role power-user, that portlet is mapped to the liferay role called power user that's already in its database once roles are mapped to the portal, you can use methods as defined in portlet for example, you can use the following code to check if the current user has by default, liferay doesn't use the isuserinrole method in any built-in liferay uses its own permission system directly to achieve more next we'll describe liferay's permission system and how to use it in your portlets. we recommend using liferay's permission system, because it offers a much more robust way of tailoring your application's you can add permissions to your custom portlets using four easy steps also d efine all resources and their permissions r egister all defined resources in the permissions system. a ssociate the necessary permissions with resources before you start adding permissions to a portlet, make sure you understand these two critical terms used throughout this section it's important to know that permissions for portlet resources are implemented a little differently than for other resources like java classes and files. below, we'll describe permission implementation for the portlet resource first, followed by the model resource the first step is to define your resources and the actions that can be defined let's use the blogs portlet to demonstrate. portal-implsrcresource-actions and you'll see the following mapping of permissions in the blogs portlet are defined at two different levels the portlet level and the model level. the portlet level defines permissions on the the model level defines permissions on the model layer of the application, as defined by the entities in the application. coincides with a section of the resource-actions xml file in this case, at the level, actions and default permissions are defined on the portlet itself. changes to portlet level permissions are performed on a per-site basis, and define whether users can add the portlet to a page, edit the portlet's configuration, or view the portlet. are defined in the tag for the portlet resource's permissions. default portlet-level permissions for members of the site are defined in the in the case of the blogs portlet, site members can similarly, default guest permissions are defined in here, guests can't be given permission to configure the the section contains the next level of permissions, based on the scope of an individual instance of the portlet. refers to how widely the data from an instance of a portlet is shared. example, if you place a blogs portlet on a page in the guest site and place another blogs portlet on another page in the same site, the two blogs share the that happens because portlets are given a site level scope by if you reconfigure one of the two blogs and change its scope to be the current page, that blogs portlet instance no longer shares content with the other instance or any other blogs instance in that site. scope-based permissions can thus span an entire site or be restricted to a if you set the scope to the page, it's possible to have multiple distinct blog instances within a site, each with different permissions for site for example, a food site could have one blog open to posts from any site member, but also have a separate informational blog about the site itself restricted to posts from administrators after defining the portlet and portlet instance as resources, we need to define permissions on the models in the portlet. the model resource is surrounded by inside the tag, we first define the model name; the isn't the name of a java class, but the fully qualified name of the portlet's package e.g. the blog portlet's package this is the recommended convention for permissions that refer to an instance of the portlet as a whole. ability to add or subscribe to a blog entry are defined here, and affect the the value of references the name of the portlet to which the model resource belongs. resource can belong to multiple portlets referenced with multiple elements, but this is uncommon. model resource lets you define a list of supported actions that require you must list all the performable actions that require a for a blog entry, users must belong to appropriate roles for permission to do the following as with a portlet resource, the tag, tag, and tag define default permissions for site members and guests, respectively, for model resources after defining resource permissions for your custom portlet, you need to refer liferay to the resource-actions xml file that contains your definitions e.g. for liferay core, the resource-actions xml files are in the portalportal-implsrcresource-actions directory and the file named url file refers to each of these files. excerpt from url references the resource permission definition files for all built-in liferay portlets including the blogs portlet you should put your plugin's resource-actions xml files e.g. and url in a directory in your project's classpath. properties file typically named url for your portlet that references the the file that specifies your element in this portlet properties file, create a property named url with the relative path to your portlet's this property specification might look like check out a copy of the liferay source code from the liferay github repository to see an example of a portlet that defines its resources and permissions as we just described; start by looking at the definition files found in the permissions in the context of a portlet plugin, check out pluginstrunk and look at the portlet sample-permissions-portlet next we'll show you how to add resources after defining resources and actions, it's time to add resources into the resources are added at the same time entities are added to managing resources follows the same pattern you've seen throughout liferay there's a service to use. adding resources is as easy as calling the addresources... method of the resourcelocalserviceutil class. each entity that requires access permission must be added as a resource for example, every time a user adds a new entry to her blog, the addresources... method must be called to add the new entry object to the resource system. here's an example of the call from the in the addresources... method, the parameters companyid, groupid, and userid correspond to the portal instance, the site in which the entity is being saved, and the user who is saving it. you can let your users choose whether to add the default site permission andor the guest permission for your custom portlet resources liferay has a custom jsp tag that you can use to quickly add that you just insert the tag into the appropriate jsp and the checkboxes appear on that page. make sure that the tag is inside the appropriate tags, and that's all there is to it when you remove entities from the database, it's good practice to remove permissions mapped directly to the entity. taking up space in the resource database table, remember to remove them from the resource table when the resource no longer applies. the deleteresource... method of resourcelocalserviceservice. example of a blogs entry being removed now that you know how to work with resource permissions, we'll show you how to provide a user interface for managing resource permissions on the portlet level, no code needs to be written in order to have the permission system work for your custom portlet. permissions supported actions in your configuration file's portlet-resource tag, they're automatically added to a list of permissions in liferay's what good, however, are permissions that are available but can't to let a user set permissions on model resources, you must expose the permission just add these two liferay ui tags to your jsp returns a url to the permission settings configuration page shows an icon to the user. theme, and one of them see below is used for permissions this example demonstrates the use of both tags; it comes from the for the first tag, specify the following attributes there's an optional attribute called redirect that's available if you want to override the default behavior of the upper right arrow link. users can configure the permission settings for model resources next we'll show you how to implement permissions checking the last major step toward implementing permissions for your custom portlet is to ensure the configured permissions are enforced. permission checks to your application. check for permission before deleting a resource, or your user interface can hide a button that adds an entity e.g. a calendar event if the user doesn't have you need to implement checking of any custom permissions you defined in your in the blogs portlet, one supported custom action there are two places in the source code to check for this permission in your jsp files and in the business logic. want to wrap certain elements in permission checks, so they only appear for users with the permission to perform those functions. of the add entry button is contingent on whether the user has permission to add here's the addentry action in a jsp file the second place to check for the add entry permission is in the business if the check fails, a principalexception is thrown and the add entry request is aborted the permissionchecker class has a method haspermission... that checks whether a user making a resource request has the necessary access permission. if the user isn't signed in guest user, it checks for guest permissions. otherwise, it checks for user permissions. let's quickly review the parameters groupid represents the scope where the permission check is performed. liferay, many scopes are available, including a specific site, organization, personal site of a user, or a page in a site. user may be allowed to add blog entries in one site, but not in another. resources that don't belong to a scope extremely rare and unlikely, set the value of this parameter to 0. there are several ways you can obtain the groupid of the current scope jsp that uses the tag there's an implicit business logic class if you're using the servicecontext pattern, you can obtain the groupid by using url. you're not using the servicecontext pattern, your can obtain groupid from the theme display request object name the name of the resource as specified in the xml file of the primkey the primary key of the resource. doesn't exist as an entry in the database, so we use the groupid again. we were checking for a permission on a given blog entry, we'd use the primary key of that blog entry instead actionid the name of the action as it appears in the xml file. simplify searching for usages, consider creating a helper class that has constants for all the actions defined in the examples above, we're assuming there's a variable called liferay automatically creates a permissionchecker instance that has the necessary information from the user liferay also caches the security checks to ensure good there are several ways to obtain a permission checker in a jsp that uses the tag, there's an implicit variable called permissionchecker with service builder, every service implementation class can access the permissionchecker instance by using the method getpermissionchecker if you're not using service builder, permissionchecker can be obtained from the theme display request object next you'll optimize permission checking by creating helper classes to do most permissionchecker and the names of the resources for a specific portlet. is especially useful when there are complex parent-child relationships, or if your permission logic calls for checking multiple action types. blogspermission is an example of a permission helper class. blogspermission is used in a jsp now let's see how a serviceimpl class blogsentryserviceimpl uses the url..., a call is made to check whether the incoming request has permission to add an entry. if the check fails, it throws a principalexception and the add entry request aborts check out the parameters passed into the check... method. getpermissionchecker method is readily available in all serviceimpl the blogs entry id is available in the servicecontext, indicating that the permission check is against the blogs portlet. is a static string used to indicate the action requiring the permission check. likewise, you're encouraged to use custom portlet action keys let's review what we've just covered. portlet consists of four main steps define any custom resources and actions implement code to register or add any newly created resources, such as a provide an interface for the user to configure permission implement code to check permission before returning resources or showing the two major resources are portlets and entities. for you by providing a configuration file and a system of resources that let you check permissions wherever you need to in your application you're now equipped to implement security in your custom liferay portlets! next, let's learn how to use the asset framework.";;
|
"liferay's asset framework is a system that allow you to add common functionality for example, you might build an event management application that shows a list of upcoming events. tag or categorize those events to provide users with metadata describing more or you might want to let users comment on events this common functionality is what liferay's asset framework gives you. power of liferay's built-in message boards, tags, and categories, liferay lets you infuse your application with these features in no time the term asset is a generic term referring to any type of content, including text, an external file, a url, an image, or a record in an online consequently, when we use the term asset here, we're referring to some type of liferay content, like documents, blog entries, bookmarks, wiki pages, or anything you create in your applications here are the features you can reuse thanks to the asset framework at this point you might be saying, asset framework sounds great; but how do i leverage all these awesome functions? excellent question, young padawan, and perfect timing; we couldn't have said it better ourselves we'll describe the first two briefly here before we dive in head first next let's dive head first into the first step; informing the asset framework when you add, update, or delete assets whenever you create a new entity, you need to let the asset framework know. this sense, it's similar to permission resources. invoke a method of the asset framework that adds an assetentry so that liferay specifically, you should access these methods using either the static methods of assetlocalserviceutil or an instance of the assetentrylocalservice to simplify this section, we'll be using the static methods of assetlocalserviceutil, since it doesn't require any special setup in your the method to invoke when one of your custom content entries is added or updated is the same, and is called updateentry. here's an example of this method's invocation extracted from the built in here's a quick summary of the most important parameters of this method when one of your custom content entries is deleted, you should once again let that way it can clean up stored information and make sure that the asset publisher doesn't show any information for the content that has the signature of method to delete an asset entry is here's an example invocation extracted again from the blogs portlet now that you can create and modify assets, consider tagging and categorizing in the last section we let asset framework know about the tags and categories that we associated with a given asset; but how does a content author specify liferay provides a set of jsp tags you can use to make this task very easy. can put the following liferay ui tags in your forms to create content that can be associated with new or existing tags or predefined categories these two taglibs create appropriate form controls that allow the user to search for a tag or create a new one or select an existing category tip if you're using liferay's alloy ui form taglibs, creating fields to enter tags and categories is even simpler. once the tags and categories have been entered, you'll want to show them along here's how to display the tags and categories in both jsp tags, you can also specify a portleturl parameter; each tag that uses it will be a link containing the portleturl and tag or categoryid this supports tags navigation and categories navigation within your portlet. you'll need to implement the look-up functionality in your portlet code; do this by reading the values of those two parameters and using the assetentryservice to query the database for entries based on the specified tag or category you'll have no problem associating tags and categories with your before we go further with our example, let's take a look at more jsp tags you can use to leverage asset framework's features in addition to tags and categories, there are more features that asset framework these features allow users to do the following with your assets there are jsp tags, called liferay ui tags, associated with each feature. can find these tags used in the jsps for liferay's built-in portlets e.g. the here are some examples of the jsp tags with liferay's taglib tags, you can easily apply these features to your assets. so let's get the assets published in your portal a huge benefit of using the asset framework is that you can leverage the asset publisher portlet to publish lists of your custom asset types. to have users specify lists dynamically e.g., based on the asset tags or categories or have administrators do it statically to display your assets, the asset publisher needs to know how to access their you also need to provide the asset publisher templates for the types of views e.g. full view and abstract view available to display your you can provide all this to the asset publisher by implementing these let's look at an example of these two classes. portlet again, and we'll start by implementing assetrendererfactory here's the assetrenderer implementation in the render method, there's a forward to a jsp in the case of the abstract and the full content templates. the abstract isn't mandatory and if it isn't provided, the asset publisher shows the title and the summary from the appropriate methods of the renderer. the full content template should always be here's how it looks for blogs entries now it's time to get really fancy; if you need to extend the capabilities of the assetrendererfactory for one of liferay's core portlets, check out the by juan fernndez; he talks about doing just that now get out there and start enjoying the benefits of the asset framework in let's learn how to leverage liferay portal's file storage framework.";;
|
"the file storage framework lets you store files using the back end of the if you use this framework you won't have to worry about clustering or backups, since they'll already be taken care of for the document to see examples of this framework in action, check out the source code for the built in wiki and message boards portlets of liferay; the file storage framework stores their attached files in pages and posts,";;
|
"liferay has a variety of frameworks that simplify development of complex functionalities for your own applications. liferay's frameworks have evolved from its built in applications, so they're proven to work in the real world, even in high performance portals this section is a placeholder that provides a brief description of the main frameworks provided with liferay 6.1. the following list is a work in progress, since we'll add more sections to this chapter over time, and some of the current sections might evolve into their own chapters as we add more information and detailed instructions on how to use them check back in the near future; new editions of the developer's guide will have extended information on each of these frameworks.";;
|
"wouldn't it be nice to install and deploy your liferay artifacts to a maven lets you install your artifacts to your machine's local repository and even deploy them to remote repositories; so you can share them privately with your team or with the public for general consumption. your local repository holds your downloaded artifacts and those artifacts you remote repositories are for sharing artifacts either privately e.g., within your development team or publicly. maven also lets you configure a proxy server; it mediates your requests to public maven repositories and caches artifacts locally. proxyrepository helps you build projects faster and more reliably. this for two reasons accessing remote repositories is slower, and remote repositories are sometimes unavailable. most maven proxy servers can also host private repositories that hold only your private artifacts. in running your repository behind a proxy, see now that you've been introduced to maven repositories and proxy servers, let's consider using a repository management server to create and manage your maven you'll frequently want to share liferay artifacts and plugins with teammates, or manage your repositories using a gui. for this, you'll want nexus oss. maven repository management server that facilitates creating and managing release servers, snapshot servers, and proxy servers. in using nexus as a repository management server, feel free to skip this let's create a maven repository using nexus oss. to create a repository using nexus, follow these steps open your web browser; navigate to your nexus repository server e.g., and log in click on repositories and navigate to add... hosted repository figure 9.1 adding a repository to hold your liferay artifacts is easy with nexus oss note to learn more about each type of nexus repository, read sonatype's enter repository properties appropriate to the access you'll provide its we're installing release version artifacts into this repository, so specify release as the repository policy. you just created a maven repository accessible from your nexus oss repository let's create a maven repository to hold snapshots of each liferay plugin we creating a snapshot repository is almost identical to creating a the only difference is that we'll specify snapshot as go to your nexus repository server in your web browser specify repository properties like the following you not only have a repository for your liferay releases i.e., liferay-releases , you also have a repository for your liferay plugin let's configure your new repository servers in your maven environment so you can before using your repository servers andor any repository mirrors, you must specify them in your maven environment settings. maven to find the repository and get access to it for retrieving and installing note you only need to configure a repository server if you're installing downloaded liferay ceee artifacts from a zip file or if you want to share artifacts e.g., liferay artifacts andor your plugins with others. automatically installing liferay ce artifacts from the central repository and aren't interested in sharing artifacts, you don't need a repository server specified in your maven settings however, configuring a mirror in your maven settings is recommended as a best get more information on mirrors and their purpose in maven's guide on to configure your maven environment to access your liferay-releases repository navigate to your userhome.m2 directory if it doesn't yet exist, create it provide settings for your repository servers. url file that has liferay-releases and liferay-snapshots note the username admin and password admin123 are the credentials of if you changed these credentials for your nexus server, make sure to update url with these changes now that your repositories are configured, they're ready to receive all the liferay maven artifacts you'll download and the liferay plugin artifacts you'll now, let's install the liferay artifacts you'll need to create your plugins.";;
|
"to create liferay plugins using maven, you'll need the archives required by liferay e.g., required jar and war files. provides them as maven artifacts so how do you get the liferay artifacts? the exact process depends on whether you're building plugins for liferay ee or liferay ce. for liferay ee, you'll have to install the liferay artifacts manually from a zip you can do the same if you're building plugins for liferay ce, but there's a simpler option available you can automatically install ce artifacts alternatively for liferay ce, if you absolutely must the latest pre-release changes from our liferay ce source repository, you can build the liferay ce artifacts yourself. we'll demonstrate each of these note the ee and ce zip files are a means to install the artifacts to a maven repository of your choice. in the next few sections, we'll demonstrate the zip file and central repository installation options let's look at the manual process first, by downloading and installing liferay whether you're building plugins for liferay ee or ce, you can get the liferay artifacts by manually installing them from a zip file. you can download the liferay ee artifacts package from liferay's customer select liferay portal from the downloads panel inside filter by, select the appropriate liferay version in the first field and select the development value in the second field figure 9.2 you can download the liferay maven ee artifacts from the liferay customer portal click download under the desired liferay portal version maven the liferay maven ee artifacts package downloads to your machine get the artifacts for liferay ce from sourceforge by following these steps open your browser to liferay portal on sourceforge select the liferay version for which you need maven artifacts. figure 9.3 after selecting the liferay version, simply select the liferay portal maven zip file to download select the appropriate zip file. the liferay maven ce artifacts package downloads to your machine you can extract the liferay eece artifacts package zip file anywhere you like. the zip file not only includes the liferay artifacts, but also includes a convenient script to install and deploy the artifacts to your repositories if you're using a liferay ce and you want the latest pre-release artifacts from the liferay ce source repository, you can get thembut you'll have to build we'll show you how to build the artifacts from liferay's source code next downloading the liferay maven artifacts from liferay's customer portal ee or from sourceforge ce is useful if you're interested in using the artifacts for however, if you'd like to use the very latest liferay ce maven artifacts, you can build them from source. maven artifacts from source, follow these steps navigate to your local liferay portal ce source project. already have a local liferay portal ce source project on your machine, you can fork the liferay portal ce github repository, found at create an url.user name.properties file in your local liferay specify the following properties in of course, add the path of your application server's parent directory and the path of your application server itself after the appropriate equals also, replace app server name with the name of your application note that your url.app server name.dir directory doesn't need to exist yet; you can create it by invoking an ant target in the next for example, if you're running apache tomcat and your liferay home directory is homejbloggsliferaybundlesce-6.1.x, use if an application server doesn't already exist at the directory specified by your url.app server name.dir property, run ant -f url unzip-app server name to unzip a copy of your preferred application server to the specified directory for example, to unzip apache tomcat to the directory specified by your create a releases.user name.properties in your local liferay portal ce source project root directory and specify the following properties of course, replace the values specified above with your own gpg and maven if you don't have gpg installed and don't have a publicprivate gpg key, you should visit url and install gpg once you've installed gpg, generate a gpg key by running gpg --gen-key and following the instructions. key, you can find your gpg keyname by running gpg --list-keys note the releases.user name.properties is not required if you only plan to install the liferay artifacts locally and not deploy them open a command prompt, navigate to your liferay home directory, and build the liferay artifacts by running build the liferay portal war file by running deploy the liferay artifacts to your maven repository by running if you want the liferay artifacts to be installed locally but don't have a remote maven repository or don't want the artifacts to be remotely deployed, you can run the install target instead of the deploy finishes, you should have a time-stamped directory containing the artifacts in your local liferay portal ce source project's root directory e.g., warning during the process of packaging up the url files for your liferay artifacts, your machine may experience sluggish performance or an insufficient amount of java heap space. there are two solutions to this problem increase the memory available for the javadoc packaging process navigate to liferay home url and search for the javadoc target. find the maxmemory property and increase it as desired skip the javadoc packaging process navigate to liferay home url and find the prepare-maven target. this target, comment out the call to the jar-javadoc target, like below next, we'll show you how to install the required liferay release artifacts to these steps are applicable for installing artifacts that you downloaded and extracted from a zip file, and for installing artifacts that you let's install the liferay release artifacts to your local maven repository for if you downloaded a liferay artifacts zip file, navigate to the extracted from the liferay artifacts zip file. from source, navigate to the time-stamped directory containing the artifacts in your local liferay portal ce source project's root directory, e.g., to install the artifacts to your local repository, execute your console shows output from the artifacts being installed from the liferay maven package into your local repository, typically located in your userhome.m2repository directory your local repository now contains the liferay artifacts required to build if you want to share your liferay artifacts with teammates, you'll have to deploy them to a release repository server you may find it worthwhile to share your liferay artifacts with teammates make sure you've created a liferay-releases repository server to hold the if you haven't, see the managing maven repositories section for instructions ensure the repository to hold your liferay artifacts is specified as a configuring local maven settings section for instructions on adding an here's an example setting for a repository server named liferay-releases using your command prompt, navigate to the liferay-portal-maven-version directory, or to your time-stamped liferay portal artifacts directory. is the root directory extracted from the liferay artifacts zip file. navigate to your time-stamped liferay portal artifacts directory, if you built the artifacts from source url in your liferay-portal-maven-version in the new properties file, specify values for the properties repository's id and url, respectively here are some example property values note, if you created a repository in nexus oss, as demonstrated in the section managing maven repositories, you can specify that repository's id to deploy to your release repository server, execute your console shows output from the artifacts being deployed into your to verify your artifacts are deployed, navigate to the repositories page of your nexus oss server and select your repository figure 9.4 you can easily navigate to your liferay release repository in nexus notice a window appears below displaying the liferay artifacts now deployed figure 9.5 your repository server now provides access to your liferay maven artifacts you've downloaded the liferay artifacts, installed them to your local repository, and deployed them to your release repository server for if you're working with liferay ce, there's an alternative method of obtaining the necessary liferay maven artifacts you can let maven download them liferay offers an option for automatic download and installation of liferay ce they're publicly available on the central repository, located and are updated with each liferay release e.g., 6.1.0, 6.1.10, 6.1.20, etc.. the first time you use maven to compile a liferay plugin project, maven automatically downloads the required artifacts from the central repository into your local repository if they're not found in your local repository or any of your configured repository servers. you'll see it happen when you package your now that we have our maven artifacts set up, let's configure liferay ide with";;
|
wouldn't it be nice if you could manage your liferay maven projects from liferay liferay ide 2.0 introduces the maven project configurator m2e-liferay , or the added support of configuring maven projects as full let's explore what the maven project configurator does, how to install it, and how to install its dependencies in order to properly support maven projects in the ide, you first need a mechanism to recognize maven projects as liferay ide projects. recognized in eclipse as faceted web projects that include the appropriate therefore, all ide projects are also eclipse web projects faceted projects with web facet installed. in order for the ide to recognize the maven project and for it to be able to leverage java ee tooling features e.g., the servers view with the project, the project must be a flexible web liferay ide requires that the following eclipse plugins be installed in order for maven projects to meet these requirements when you install the m2e-liferay plugin, these dependencies are installed by we'll flesh out the installation process soon, but first, let's get a deeper understanding of how these plugins work to give us our idemaven the m2e-core plugin is the standard maven tooling support for eclipse. provides dependency resolution classpath management and an abstract project also, in order for a liferay maven project to be recognized as a flexible web project, the maven project must be mapped to the m2e-wtp plugin. provides project configuration mapping between the maven models described in the maven project's poms and the corresponding flexible web project supported in eclipse. integration features in place, the only remaining requirement is making sure that the m2e-core plugin can recognize the extra lifecycle metadata mappings necessary for supporting liferay's custom goals. mappings just a bit to get a better understanding of what this means both maven and eclipse have their own standard build project lifecycles that are therefore, for both to work together and run seamlessly within liferay ide, you need a lifecycle mapping to link both lifecycles into one combined lifecycle. normally, this would have to be done however, with the m2e-liferay plugin, the lifecycle metadata mapping and eclipse build lifecycles are automatically combined providing a seamless user experience. the lifecycle mappings for your project can be viewed by right-clicking your project and selecting properties figure 9.6 view your project's lifecycle mappings to verify successful plugin execution when first installing liferay ide, the installation startup screen lets you select whether you'd like to install the maven plugins automatically. to install the required maven plugins, navigate to help install new software. insert the following liferay ide repository - url if the m2e-liferay plugin does not appear, this means you already have it to verify, uncheck the hide items that are already installed checkbox and look for m2e-liferay in the list of installed plugins. you'd like to view everything that is bundled with the m2e-liferay plugin, uncheck the group items by category checkbox figure 9.7 you can install the m2e-liferay plugin by searching for software on liferay ide's repository the required maven plugins are installed and your ide instance is ready next, let's learn how to configure an existing maven project now your liferay ide instance is maven-ready and you have an existing maven let's investigate what is going on under the hood and configure your note, if you'd like to learn how to create a new maven project in the ide, visit the creating liferay plugins with maven section. can import an existing maven project by navigating to file import maven and selecting the location of your maven project source code note due to the lifecycle mapping of eclipse and maven, it is unsafe to manually insert or overwrite the.classpath and.project files and.settings folder. ide automatically generates these files when a project is imported and updates them appropriately the m2e-core plugin delegates your liferay maven plugin's project configuration to the m2e-liferay project configurator. configurator then converts your liferay war package into an eclipse flexible web next, the m2e-liferay configurator looks for the liferay maven plugin to be registered on the pom effective model for war type packages. maven plugin is configured on the effective pom for the project, project if the plugin is configured, the project configurator validates your project's configuration, checking it's pom, parent pom, and the the configurator detects invalid properties and reports them as errors in the ide's pom editor. there are a list of key properties that your project must specify in order for it to become a valid liferay ide project. the next section titled using a parent plugin project identifies these properties and explains how they are used there are various ways to satisfy these propertiesthe maven profile in the global url file recommended, in the user url file, in the parent url, or in the project url directly. these choices as a hierarchy for how your maven plugins receive their the project url overrides the parent url, the parent url overrides the user url file, and the user url file overrides the global url file global url provides configuration for all plugins belonging to user url provides configuration for all plugins belonging to a parent url provides configuration for all modules in the parent project url provides configuration for the single plugin project note that if a profile is active from your url, its values will override your properties in a pom. if you'd like to specify the properties in a pom, see the next section using a parent plugin project for more details here's an example of what a maven profile looks like inside the url once you have a maven profile configured in the userhome url file, you can activate the profile by right-clicking on your project properties maven and entering the profile ids that supply the necessary settings into the active maven profiles text field. reference the profile and properties we listed above, you'd enter sample for once you've specified all the values, the configurator m2e-liferay validates the properties. if there are errors in the url file, the configurator marks them in liferay ide's pom editor. project error, update the project to persist the fix by right-clicking the after your pom configuration meets the requirements, the configurator installs the liferay plugin facet and your maven project is officially a liferay ide once you have your maven project configured, you may want to execute a specific maven goal such as liferaybuild-lang or liferaybuild-db that is associated to access your project's maven goals and execute them, right-click your project liferay maven and select the goal to to learn more about maven's build lifecycle and plugin goals, visit when working with your url file in the ide, you'll notice several different viewing modes to work with url provides an editable pom as it appears on the file system effective pom provides a read-only version of your project pom merged with its parent poms, url, and the settings in eclipse for maven overview provides a graphical interface where you can add to and edit the dependencies provides a graphical interface for adding and editing dependencies in your project, as well as modifying the dependencymanagement dependency hierarchy provides hierarchical view of project dependencies and interactive list of resolved dependencies figure 9.8 liferay ide provides five interactive modes to help you edit and organize your pom by taking advantage of these interactive modes, modifying and organizing your pom and its dependencies has never been easier! next, we'll consider the benefits of using a maven parent project with your;;
|
"maven supports project inheritance. you can create a parent project that contains properties child projects have in common, and child projects inherit those properties from the parent project. don't need to specify those properties in each project. than one project, it makes sense to leverage project inheritance so that all projects can share properties they have in common our example demonstrates project inheritance; we'll build a project with a even if you're not going to leverage maven's project inheritance capabilities when you build your liferay plugins with maven, the process is the same for creating any liferay plugin with maven's liferay for more information on project inheritance, see maven's let's create our parent project, and then specify the general settings you'll need to build your plugins for liferay. the parent project is similar to the project root of the liferay plugins sdk. information to be used by any plugin projects that refer to it. specify information in each plugin's pom, but it's more convenient to use the parent project's pom for sharing common information let's create a parent project named sample-parent-project create a new directory for your parent project. the directory sample-parent-project. you can place the directory anywhere inside the sample-parent-project directory, create a url file and if you use this example pom, replace the values with the version of liferay applicable to the plugins you're developing you can also specify these key properties in your global or user to learn more about this method, visit the configuring modify the values of the properties to match your liferay environment with the path of your liferay bundle's deploy directory. auto-deploy directory you will eventually copy your plugin to deploy on fill in the... tags with the version your pom's properties should look similar to the following by specifying your liferay instance's deploy directory in the pom, you're telling maven exactly where to deploy your plugin artifacts your parent project now specifies common dependencies on required liferay maven all your parent project's modules i.e., projects that refer to this parent can leverage these dependencies note you could just as easily include such dependencies in the pom of each of your plugin projects, but specifying them in a parent project makes them accessible to child projects through inheritance now you're able to specify dependencies on required liferay artifacts; let's create a liferay plugin project using the archetypes provided by liferay.";;
|
if you've been writing software for a while, you probably have a set of tools this set of tools has been carefully collected over the years, and every tool is there for one reason to contribute to your many of us at liferay are like that, which is why our sdks are designed to work you can be productive on the liferay platform using to jumpstart your efforts, however, we also provide an ide environment fully integrated with eclipse. we've designed this carefully, so that it integrates well with our existing sdks, maven, and other tools that are liferay ide helps you manage many features of liferay's platform, there are editors for service builder files, workflow definitions, layout templates, and more. you'll find wizards for creating every kind of liferay project there is, snippets for tag libraries, and auto-deploy of whether you've been using liferay for a long time or are just getting started, it's worth your time to check out liferay ide and see whether it's another of those tools you can add to your toolbox. we think you'll be glad you did in this chapter we'll cover the following topics to install and set up liferay ide, follow the instructions below. using liferay developer studio which comes with liferay portal enterprise edition, skip to the section titled testinglaunching liferay tomcat server liferay ide is already configured in developer studio.;;
|
"liferay ide is a plugin for eclipse. you can install it in two ways bundled with eclipse this is the easiest way or into an existing eclipse installation if you want to install the bundled version, a prerequisite is a version of java as of this writing, the bundled version requires jdk 6 or once you've satisfied the prerequisite, it's an easy matter to install liferay go to liferay's downloads page and there's a separate download for each of the 32-bit and 64-bit variants of windows, linux, and mac os x. choose the one that matches your system and click the download button. to install liferay ide on your system, all you need to do is unzip it to if you already have eclipse installed, you can add liferay ide to it. do this in one of two ways install liferay ide via a url to the update site make sure you have a supported java jre and eclipse release liferay ide supports the following eclipse releases to install liferay ide and specify an eclipse update url, follow these steps install eclipse kepler, juno, or indigo from the run the eclipse executable file e.g., url when eclipse opens, go to help install new software... in the work with field, enter the update site url url ide2.0.0 ga1updatesite and press enter liferay ide features should be detected. after calculating dependencies, click next, accept the license agreement, and click finish to complete the installation restart eclipse to verify that liferay ide is properly installed after restarting eclipse, go to help about; if you see a liferay ide icon badge as in the screenshot below, it's properly installed figure 10.1 the liferay ide logo in eclipse to install liferay ide from a.zip file, follow these steps download the ide 2.0.zip file from in the add site dialog, click the archive button and browse to the location of the downloaded liferay ide.zip file let's set up liferay ide now that you have it installed.";;
|
"now that you have liferay ide installed, either from a downloaded zip file or from the update site appropriate for your eclipse version, you need to perform this section describes the setup steps to perform so you can develop your liferay portal and test your customizations before setting up liferay ide, let's make sure you have all the appropriate before setting up liferay ide, you need to have appropriate versions of liferay portal, liferay plugins sdk andor maven, and eclipse. liferay portal 6.0.5 or greater is downloaded and unzipped liferay plugins sdk 6.0.5 or greater is downloaded and unzipped, andor any if you're using the plugins sdk, make sure the plugins sdk version matches the liferay portal version you've installed an appropriate eclipse ide version for java ee development, and the liferay ide extensionsee the installation section if you haven't note earlier versions of liferay e.g., 5.2.x are not supported by liferay let's set up your liferay plugins sdk before you begin creating new liferay plugin projects, a supported liferay plugins sdk andor maven installation and liferay portal must be installed and configured in your liferay ide. if you're thinking, wait a second, buster! thought the plugins sdk and maven could be used without liferay ide!, then chapter, we'll explain how to use the plugins sdk on its own, with a text also, we'll explain how to use maven on its own in the developing here, we explain the easiest way to use the plugins sdk by running it click add to bring up the add sdk dialog browse to your plugins sdk installation. the default name is the directory name; you can change it if you want select ok and verify that your sdk was added to the list of installed note you can have multiple sdks in your preferences. sdk by checking its box in the list of installed liferay plugin sdks let's set up your liferay portal tomcat runtime and server in eclipse, go to window preferences server figure 10.2 choosing a runtime environment click add to add a new liferay runtime; find liferay v6.1 tomcat 7 under the liferay, inc. category and click next click browse and select your liferay-portal-6.1.x directory if you've selected the liferay portal directory and a bundle jre is present, it is automatically selected as the server's launch jre. is present, then you must select the jre to use for launch by clicking figure 10.3 choosing the jre bundle click finish; you should see your liferay portal runtime listed in click ok to save your runtime preferences if you haven't created a server, create one now from the servers view in liferay ide; then you can test the server figure 10.4 adding a runtime to the servers view scroll to the liferay, inc folder and select liferay v6... choose the liferay v6... runtime environment that you just created let's launch it and perform some tests!";;
|
once your liferay portal server is set up, you can launch it from the servers you have a few options for launching and stopping the server once it's selected in the servers tab once the server is launched, you can open liferay portal home from the servers tab by right clicking your liferay tomcat server and selecting open liferay next, you'll learn to create new liferay projects in liferay ide.;;
|
"creating liferay projects is a straightforward process, similar to creating plugins for liferay portal must be created inside a liferay project is essentially a root directory with a standardized structure containing the project's and each of its plugins' since each plugin type requires a different folder and file structure, let's create a project to illustrate the process if you've been following our liferay ide configuration instructions, your plugins sdk and liferay portal server have already been configured in liferay now let's create a new liferay plugin project in liferay ide. the event listing portlet project, which we'll use throughout this guide in the project creation wizard, you'll name and configure your project we'll create a plugin project that we'll use throughout this guide. first, we'll create a bare bones plugin project; then, we'll manually add an additional plugin to the project and add additional configurations provide both a project name, which is used to name the project's directory, and a display name, which is used to identify the plugin when adding it to a page in liferay portal. our demonstration project will have the project name event-listing-portlet and the display name event leave the use default location checkbox checked. default location is set to your current workspace. where your plugin project is saved in your file system, uncheck the box and select the ant liferay-plugins-sdk option for your build type. you'd like to use maven for your build type, navigate to the developing your newly configured sdk and liferay runtime should already be if you haven't yet pointed liferay ide to a plugins sdk, click configure sdks to open the installed plugin sdks management wizard. can also access the new server runtime environment wizard if you need to set up your runtime server; just click the new liferay runtime button next to the liferay portal runtime dropdown menu under plugin type, indicate which plugin type your project will hold by selecting one from the list. you can choose from portlet, service builder portlet, hook, layout template, theme, or ext. provides handy wizards for creating new liferay projects. project will hold service builder portlets for the nose-ster organization, so make sure service builder portlet is selected figure 10.5 the wizard for creating a new service builder portlet project uses the information you specify to customize various configuration files in the new project you've created a liferay portlet project! you can find more information on liferay's plugin frameworks in the chapter on in that chapter, we'll discuss the plugin creation wizard note we're creating the event-listing-portlet project now so that we can creating portlets, please see the chapter of this guide on portlets. for more information on themes, layout templates, hooks, or ext plugins, please refer to the appropriate chapter of this guide our event-listing-portlet plugin project should appear in the eclipse package the project was created in the plugins sdk you configured, under the directory corresponding to the plugin type the project contains. generalized directory structure for portlet projects created in liferay all projects, regardless of type, are created with a url and a url filewe've highlighted each of them with the note common project file in the directory structure above. url file allows liferay ide to use ant to automatically compile and this file contains important metadata for liferay ide's properties view gives you a simple interface to inspect or specify the file's fields, including your project's dependencies and deployment context, display name, and liferay version. project as an app to liferay marketplace, the value of the name property in url is used as the app's name. liferay-versions property is used on liferay marketplace to specify the versions of liferay on which your application is intended to run if you're following along with the creation of the event-listing-portlet, we're we still need to add additional plugins to our project, but first, let's deploy your new plugin project to your liferay server.";;
|
"you have a plugin project, but you need to deploy it onto your liferay there are two ways to do it, and the first is very select your project, drag it down, and drop it on your server. alternatively, you can use the following procedure select your new plugin project and right click the liferay server in select your plugin project and click add to deploy it to the server you should see the project get deployed to liferay tomcat server; in the console is a message indicating your new portlet is available for use figure 10.6 verifying the output in the console view if you've never started this instance of liferay before, open liferay portal home in most cases and follow the instructions in once you're logged in, click add more, expand the sample category, and click the add link next to your demo application. great, now you can create projects in liferay ide! create new plugins inside of existing projects in liferay ide.";;
|
here you'll find liferay's reference documentation for java, javascript including alloyui, tag libraries, deployment descriptors, and liferay faces describes liferay packages and classes for you to use in your liferay plugins these docs are for those hacking on liferay's core. referenced in this documentation should not be referenced directly from liferay liferay themes, liferay portlets, liferay security, and standard portlets the latest version of liferay faces jsf tag documentation in view declaration vdl docs for all versions of liferay faces are available liferay includes alloyui and all of its javascript apis are available within portlets, templates and themes liferay uses bootstrap natively and all of its css classes are available within describes the xml files used in configuring liferay apps, liferay plugins, and defines properties used for liferay plugins. the liferay plugin, declare its resources, and specify its security related;;
|
"if we can replace a jsp with a hook plugin, why learn another way to accomplish let's say you want to preserve the original jsp's content and functionality, but you want to add more to the jsp. upgrade liferay, you want to benefit from any changes made to that upgraded jsp. well, you can; simply include the original jsp and then add more stuff to it here's an example that customizes the search page of the blogs portlet. adds helpful text to aid the user in searching for content. involves string manipulation, it's mainly useful for making a small number of use the hook project we created earlier or create a new hook project open the url file from your project's docrootweb-inf folder in liferay ide and select the file's overview mode tab select the custom jsps folder from the outline to bring up the custom jsp select the checkbox customize liferay portal jsps and create the default custom jsp folder meta-infcustomjsps by clicking the icon that has the three yellow diamonds add to the listing of custom jsps by clicking the plus icon and specifying right-hand side within the custom jsp text field simplifies finding the jsp click ok and save the url file. the liferay portal jsp into your project so you can modify it liferay ide pulled into your project replace the jsp's code with the following notice how this code assigns the original jsp's html content to the variable we proceed to add some more content of our own to that html and then deploy the hook plugin and add the blogs portlet to a page the original jsp stays in the cache until the cache is cleared or liferay to clear the cache, navigate to control panel server administration and click on the appropriate clear content... add a blog and then use the blog portlet's search your custom message now shows below the search results next, we'll explore application adapters and what they can do for your sites and";;
|
all the hooks we've demonstrated so far are scoped to the portal. need to customize specific sites without propagating the customizations application adapters are special hooks that let you make changes at the site level. adapters are used for overriding jsps there's a sample application adapter in the liferay plugins how do we build an application adapter of our own to create an application adapter, you need a hook with custom jsps, and you need to turn the hook's global custom jsp setting off. url with the following directives when you deploy your hook, liferay installs the application adapter to your instance, under the name of the hook. an application adapter hook named foo becomes available to sites and site templates under the name foo hook now, let's discuss the perks of including the original jsp when overriding it if you override a jsp from the portal, we recommend you include the original as we already demonstrated, including the original jsp file for global hooks is accomplished by referencing the original jsp file from a tag and appending the suffix url to the here's what including the original navigation portlet's view jsp in a global hook looks like for application adapter hooks, we include the original jsp by setting the tag's usecustompage attribute to false, as below the view jsp is specified as url, not url as for global in the next section, we'll create and test an application adapter let's create an application adapter hook named example-hook. the navigation portlet's url, while including the original navigation portlet's jsp with some custom text after its contents modify your hook's url to specify the location of your custom jsp and set the global custom jsp setting to false create a new url file in your hook's docrootmeta-infcustomjspshtmlportletnavigation directory and insert code to include the original jsp open your liferay portal instance in your web browser and navigate to the site where you'll use the application adapter field's drop-down menu, select example. figure 7.5 your application adapters are easily accessible in your site's settings navigate back to your site's navigation portlet, and make sure that the modification message from your application adapter hook plugin's url navigate to a different site's navigation portlet to verify that only the content of the portlet's original url file displays using application adapter hook plugins to override liferay's core functionality you can also apply application adapters to site templates let's pretend you want to make an enterprise resource planning erp solution your erp solution requires an extension of liferay's wiki portlet, so you implement that extension as an application then, you incorporate the application adapter in a site template named erp site for the company's erp sites. the company's administrative user creates the sites by going to control panel sites and adding sites based on the erp site template. the added sites include your application that's it for application adapters. let's learn about performing custom actions;;
|
hooks are useful for triggering custom actions on common portal events, like user log in or system start up. the actions for each of these events are defined in url, so we'll need to extend this file to create a example-hookdocrootweb-infsrccomliferaysamplehook, and create the file url inside it with this content edit url inside example-hookdocrootweb-inf, adding the once deployment is complete, log out and back in, and you should see your custom message, my custom login action, displayed in the terminal window running liferay custom action hook plugins aren't limited to the log in event. custom actions for other events, too. for actions that require access to the others, extend url.simpleaction important for better forward compatibility, use hooks to customize struts actions rather than ext plugins. extending and overriding portal properties is just as easy, so let's do that;;
|
ext plugins are powerful tools for extending liferay. complexity of your liferay instance, you should only use an ext plugin if you're sure you can't accomplish your goal using a different tool. hooks for the available alternatives. if a hook won't suffice, keep reading to discover the use cases for ext plugins and how to set one up. about why you should avoid ext plugins when possible as someone once said, with great power comes great responsibility okay, many people have said that many times. before deciding to use an ext plugin, weigh the cost of using such a powerful tool. ext plugins allow the use of internal apis or even overwriting files from the liferay core. version of liferay even if it's a maintenance version or a service pack, you have to review all changes and manually modify your ext plugin to merge your additionally, ext plugins aren't hot deployable. deploy an ext plugin, you must restart your server. additional steps are required to deploy or redeploy to production systems now that you know the limitations of ext plugins, let's look at why you'd want with these use cases in mind, we'll discuss the following topics;;
|
"you can create ext plugins in liferay developer studio or in your terminal the ext plugin is stored in the ext directory of the plugins sdk see chapter 2, the plugins sdk fill in example for project name and example for the display name leave the use default location checkbox checked. default location is set to your current workspace. where your plugin project is saved in your file system, uncheck the box and select the ant liferay-plugins-sdk option for your build type. you'd like to use maven for your build type, navigate to the using liferay your configured sdk and liferay runtime should already be selected. haven't yet pointed liferay ide to a plugins sdk, click configure sdks to open the installed plugin sdks management wizard. new server runtime environment wizard if you need to set up your runtime server; just click the new liferay runtime button next to the liferay select ext for your plugin type figure 8.1 you can even create an ext plugin project with liferay ide the plugins sdk automatically appended -ext to the project name when naming the parent folder of your ext plugin. in developer studio, you can either create a completely new plugin or add a new plugin to an existing plugin project navigate to the ext directory in the liferay plugins sdk and enter the appropriate command for your operating system to create a new ext plugin a build successful message from ant tells you there's a new folder named example-ext inside the ext folder in your plugins sdk. automatically named the ext by appending -ext to the project name the structure of your new example-ext folder looks like this figure 8.2 here's the directory structure in the ext plugin's package explorer let's look at a few of the docrootweb-inf subdirectories in more detail ext-implsrc contains the url configuration file, custom implementation classes, and in advanced scenarios, classes that override ext-libglobal contains libraries that should be copied to the application server's global classloader upon deployment of the ext plugin ext-libportal contains libraries to be copied inside liferay's main these libraries are usually necessary because they are invoked from the classes added in ext-implsrc ext-servicesrc contains classes that should be available to other in advanced scenarios, this directory contains classes that overwrite service builder puts the interfaces of each ext-webdocroot contains the web application's configuration files, including url, which allows you to customize however, hooks are recommended for customizing a any jsps that you're customizing also belong here ext-util-bridges, ext-util-java and ext-util-taglib these folders are needed only in scenarios where you need to customize the classes of three libraries provided with liferay url, url and otherwise you can ignore these directories by default, several files are added to the plugin. url the ant build file for the ext plugin project the plugin, including display name, version, author, and license type configuration propertiesuse a hook plugin to override properties whenever an example where an ext plugin is necessary to override a property is when specifying a custom class as a portal property value. use a url file with each of your ext plugins, but don't override the same property from multiple url filesthe loading order isn't assured, and you can cause unintended system behavior as a tip after creating an ext plugin, remove the files you don't need to customize from docrootweb-infext-webdocrootweb-inf. the files deployed by each ext plugin and won't let you deploy multiple ext plugins that override the same file. if you remove unnecessary uncustomized files, you'll avoid collisions with ext plugins deployed alongside yours you've now created an ext plugin and are familiar with its directory structure and its most significant files. let's use your ext plugin to customize liferay";;
|
"an ext plugin changes liferay itself when deployed; it's not a separate component that can be easily removed at any time. plugin development process is different from other plugin types. important to remember that once an ext plugin is deployed, some of its files are copied inside the liferay installation; the only way to remove its changes is by redeploying an unmodified liferay application the plugins sdk lets you deploy and redeploy ext plugins during your redeployment involves cleaning i.e. removing your application server and unzipping your specified liferay bundle to start from that way any changes made to the ext plugin during development are properly applied, and files removed from your plugin by previous changes aren't left behind in the liferay application. this added complexity is why we recommend using another plugin type to accomplish your goals, whenever before digging in to the details, here's an overview of the steps required to now let's look at each step of the development proces in more detail before deploying an ext plugin, you must edit the build.username.properties file in the root folder of your plugins sdk. substitute username with your user id on your computer. once you've opened your build properties file, add the following propertiesmake sure the individual paths reflect the right locations on your your url property should specify the path to your liferay your work directory, specified by the url property, is where you've unzipped your liferay bundle runtime. url property should point to your application server's directory look in your liferay bundle at the path to the application server directory to determine the value to use for your for example, cwork could be your url value. set as the value for our url property, the relative path to the application server within our liferay bundle.zip file is cworkliferay-portal-6.1.2-ce-ga3tomcat-7.0.40 as our url note some liferay bundles come installed with a sample website. for showcasing certain features of liferay, but if you removed it, you likely don't want it reinstalled each time your bundle is unzipped. reinstallation of 7-cogs, unzip your bundle, delete the folder, then re-zip your bundle next we'll change our newly created ext plugin and deploy it our environment is set up and we're ready to start customizing. at a simple example that customizes the sections of a user profile. configuration can be made through the url configuration file, but a hook plugin won't let us modify the property we're customizing. open the url file and paste in we've removed the sections for user groups, personal sites, and categorizations this ensures that these sections won't be used in you can deploy your plugin from liferay developer studio or the terminal deploying in developer studio drag your example-ext project from your package explorer onto your server deploying in the terminal open a terminal window in your extexample-ext directory and enter one of these commands the direct-deploy target deploys all plugin changes directly to the appropriate directories in the liferay application. a.war file with your changes and then deploys it to your server. your server must be restarted after the deploy occurs. is usually preferred for deploying ext plugins during development. direct-deploy does not work in weblogic server or websphere application a build successful message indicates your plugin is now being deployed. switch to the console window running liferay, in few seconds you should see the if any changes applied through the ext plugin affect the deployment process itself, you must redeploy all other plugins. affect the deployment process, it's a best practice to redeploy all your other plugins following initial deployment of the ext plugin the ant deploy target builds a.war file with your changes and copies them to the auto-deploy directory inside the liferay installation. starts, it detects the.war file, inspects it, and copies its contents to the appropriate destinations inside the deployed and running liferay application restart your application server, and let's find out about publishing your to complete the deployment process, your ext plugin must be published to the as with deployment, you can publish using liferay developer publishing in developer studio select the liferay server in the servers view select the server's publish option figure 8.4 how to publish the ext plugin publishing in the terminal restart the liferay server let's try liferay portal, customized by your ext plugin. restarts, log in as an administrator and go to control panel users and edit an existing user and verify that the right navigation menu only shows the five sections that we referenced from the figure 8.5 you should see these five sections under the user information heading that was a simple application of an ext plugin. complex customization that illustrates the proper way to redeploy an ext plugin, which is different from initial deployment let's customize the details section of the user profile. its jsp, we'll use a more powerful method that lets us add new sections or even with liferay we can refer to custom sections from the url and implement them just by creating a jsp. the property url again and the property we removed the original details section and added a custom one called basic. when liferay portal's user administration reads the property, it looks for the implementation of each section based on the following conventions the section is implemented in a jsp inside the following directory the name of the jsp uses the name of the section, with the.jsp extension. if the section name has a dash, - , replace it with an underscore . for example, if the section is called my-info, the jsp should be named url to comply with jsp naming standards the section name that's shown to the user comes from the language bundles. when using a keyvalue that is not included with liferay, add it to both your ext plugin's url file and the language-specific properties file for each language variant you're providing a translation for. these files go in the ext-implsrc directory of your ext plugin for our example, we'll create a file in the ext plugin with the following path we can write the contents of the file from scratch or just copy the url file from liferay's source code and modify from there. the latter and then remove some fields, leaving the screen name, email address, first name, and last name fields to simplify user creation and user update. we don't need to add a new key to url, because an entry for the key named basic is already included in liferay's language bundle let's redeploy our ext plugin to review the changes we made so far, ext plugin development has been similar to the development of other you've now reached the point of divergence. first deployed, some of its files are copied into the liferay installation. after changing an ext plugin, you'll either redeploy or clean redeploy, depending on the specific modifications you made to your plugin following the let's talk about each redeployment method and when to use clean redeployment if you removed parts of your plugin, there are changes to your plugin that can affect the deployment of plugins, or you simply want to start with a clean liferay environment, undeploy your plugin and clean your application server before redeploying your ext plugins. application server, the existing liferay installation is removed and the bundle specified in your plugins sdk environment e.g., the value of url in build.username.properties is unzipped in its the exact steps you take differ based on whether you're developing in remove the plugin from the server. while selecting the ext plugin in the servers view, select the plugin's remove option figure 8.6 removing ext plugin from the server clean the application serverwhile selecting the ext plugin project in the package explorer view, select the plugin's liferay clean app figure 8.7 how to clean app server figure 8.8 start the liferay server drag the ext plugin and drop it into the liferay server while selecting the liferay server in the servers view, click the figure 8.10 publish your server for each ext plugin you're deploying, enter the following into your console redeployment if you only added to your plugin or made modifications that don't affect the plugin deployment process, you can redeploy using the following using developer studio right-click your plugin located underneath your figure 8.11 how to redeploy your ext plugin using the terminal redeploy in the terminal using the same procedure as open a terminal window in your extexample-ext directory and execute either ant deploy or ant direct-deploy see above in the initial deployment section if you're not sure which command after your example-ext plugin is published to liferay portal, check out your basic details page by choosing to add a user or view an existing user figure 8.12 you should only see user fields for screen name, email address, first name, and last name that completes the development process. let's learn how you can package your ext plugin for distribution and production once you're finished developing the plugin, you can package it in a.war file for distribution and production deployment using developer studio with your ext plugin project selected in the package explorer view, select the project's liferay sdk figure 8.13 accessing the war option using the terminal from your ext plugin's directory e.g., the.war file is written to your liferay-pluginsdist directory you really have the hang of building and packaging your ext plugins! next section covers jboss 7 requirements for packaging up an ext plugin if this doesn't apply to you, feel free to skip over it and to start reading about advanced customization techniques if you're developing an ext plugin that defines a new taglib, you need to take jboss's classloading behavior into account. before packaging this kind of ext plugin, create a url file in the ext plugin's web-inf folder and add the following contents to it also, add the following line to your ext plugin's url file, setting the url as a once you've made these updates, you can package your plugin and deploy it, per the normal process described previously in this chapter now that you've learned the basics of ext plugin development have covered this requirement for jboss customizations, let's look at some advanced customizations with ext plugins, you can change almost everything in liferay. some additional customization techniques made possible by ext plugins. always, be careful when using ext plugins with each new version of liferay, there can be changes to the implementation if you change liferay's source code directly, you'll have to merge your changes into the newer liferay version. to minimize such conflicts, the best approach is not to change anything. rather, you can extend the class you want to change and override the required methods. configuration files to reference your subclass as a replacement for the original in the following subsections, we'll cover these topics let's learn to use advanced configuration files next liferay uses several internal configuration files for its own architecture; in addition, there are configuration files for the libraries and frameworks liferay depends on, like struts and spring. configuration could be accomplished using fewer files with more properties in each, but maintenance and use is made easier by splitting up the configuration properties into several files. customization needs, it may be useful to override the configuration specified in liferay provides a clean way to do this from an ext plugin without modifying the original files below we list all the configuration files in liferay by their path in your ext we provide a description of what the file is for and the path to the original file in liferay portal let's learn how to configure a lucene analyzer next liferay uses lucene to facilitate search and indexing within the portal. versions of liferay, you could configure lucene analyzers from while convenient, it was problematic to have only a single analyzer for all portal-indexed fields. for example, it was difficult to provide correct behaviors for handling both keyword and text fields in liferay 6.1, you no longer configure lucene from url. instead, lucene analyzers are defined in spring configuration files. analyzer configuration is defined in liferay 6.1 introduced per-field analyzers, allowing lucene's query parser to identify the correct analyzer to there are two common scenarios where it's useful to configure lucene analyzers when creating custom language analyzers to override a liferay language analyzer, and when creating a custom indexer to index new fields. number of language analyzers in url out of the box and uses regular expression matching to map localized fields to specific analyzers. your language is not included among the defaults, or you're not satisfied with one of the default language analyzers, you can override it with a custom if you've created a custom indexer to index new fields, you can use the default analyzer for your new fields, select a specific one such as one of the keywordanalyzers , or define a custom analyzer to customize the lucene analyzer configuration, you must create an ext plugin. the analyzer classes reference the lucene apis directly, so it's not possible to configure lucene analyzers from a hook plugin. and declare the beans you'll override with a custom configuration here are a few of the pre-configured analyzers from the you can define custom analyzers for any fields, including custom fields let's learn to change the api of a core service next sometimes you might need to change the api of a method provided by one of liferay's services e.g., userlocalservice . this is an advanced customization is it even possible to change the api of a core service? worry, we didn't put this section here just to tell you it's not possible. changing a core service api under normal circumstances requires modifying liferay's source code directly and making manual changes to a slew of files. but that's not the liferay way there's a better way to do it the best way to extend an existing service is by creating a custom service that's complementary e.g., a myuserlocalservice that includes all the new your custom code can invoke this service instead of the default service, and the implementation of your service can invoke the original service this technique doesn't require an ext plugin since it can be done from portlet in fact, using service builder for an ext plugin is deprecated, but it's supported for migration from the old extension environment sometimes it's desirable to change the implementation of the original service to call your custom one; that's when you'll need an ext plugin. definition for userlocalserviceutil in url and point it to your myuserlocalserviceimpl instead of userlocalserviceimpl . myuserlocalserviceutil and userlocalserviceutil will use the same spring you can also replace core classes in portal-impl. if you're sure you need to change a core portal-impl class, and certain it can't be replaced in a configuration file, here's the best way to do it while avoiding conflicts when merging with a new portal version rename the original class e.g., deployutil mydeployutil create a new subclass with the old name e.g., deployutil extends mydeployutil override any methods you need to change use a logger with and appropriate class name for both classes e.g., this strategy will help you determine what you'll need to merge when a new tip this is an advanced technique; it may have a large impact on the maintainability of your code, especially if abused. you're sure this is your only option, think of it as a short term solution. contact liferay's developers about applying the necessary changes to the that's it for advanced customization techniques.";;
|
"often times you can't use ant to deploy web applications in production or additionally, some application servers such as websphere or weblogic have their own deployment tools, and liferay's autodeploy let's look at two methods for deploying and redeploying ext you can use this method in any application server that supports auto-deploy; tomcat and glassfish are two examples. that needs to be transferred to the production system is your ext plugin's.war file, produced using the ant war target. execute these steps on the server if this is your first time deploying your ext plugin to this server, skip otherwise, start by executing the same steps you first used to deploy liferay on your app server. if you're using a bundle, unzip it again. if you installed liferay manually on an existing application server, you'll need to redeploy the liferay.war file and copy both the libraries required globally by liferay and your ext plugin to the appropriate directory within the application server copy the ext plugin.war into the auto-deploy directory. liferay distribution, the deploy folder is in liferay's root folder of once the ext plugin is detected and deployed by liferay, restart your some application servers don't support auto-deploy; websphere and weblogic are with an aggregated war file, all ext plugins are merged before a single.war file will contain liferay plus the changes from all your ext plugins. before you deploy the liferay.war file, copy the dependency.jar files for liferay and all ext plugins to the global application server class loader in the production server. varies from server to server; see using liferay portal the details for your application server the first step in creating the aggregated.war file is to deploy your ext the remaining steps can differ depending on your application server; let's proceed by assuming you're using a liferay tomcat bundle. plugin, restart the server, then shut it down. the files are now aggregated in create a.war file by zipping the webappsroot folder of tomcat, then copy all the libraries from the libext directory of tomcat to your application server's global classpaththese files are associated with your once your.war file is aggregated, perform these actions on your server redeploy liferay using the aggregated war file stop the server and copy the new version of the global libraries to the appropriate directory in the application server next we'll show you how to migrate your extension environment from older verisons of liferay into ext plugins.";;
|
"because ext plugins are an evolution of the extension environment provided in liferay 5.2 and earlier, you might need to migrate your extension environment into ext plugins when upgrading liferay. if you need to do this, we have good news; migrating is automated and relatively easy tip when migrating an extension environment, first consider whether any of the extension environment's features can be moved into other types of plugins. portlets and hooks are designed to meet specific needs and they're easier to additionally, they're easier to maintain since they often require fewer changes when upgrading to a new version of liferay to successfully migrate, execute an ant target within the ext directory of the plugins sdk, pointing to the old extension environment and naming the new be sure to remove the line escape character from the following let's look at the three parameters we used above after executing the target, you should see the logs of several copy operations that will take files from the extension environment and copy them into the equivalent directory within the ext plugin see the section creating an ext plugin for an explanation of the main directories within the plugin with the migration process finished, you can upgrade your code to the new version of liferay by completing a few additional tasks. liferay portal is open source software licensed under the lgpl 2.1 license if you reuse any code snippet and redistribute it, whether publicly or to a specific customer, make sure your modifications are compliant with the license. one common way is to make the source code of your modifications available to the community under the same license. make sure you read the license text yourself to find the option that best fits your needs if your goal in making changes is fixing a bug or improving liferay, it could be of interest to a broader audience. consider contributing it back to the project. that benefits all users of the product, including you since you won't have to maintain the changes with each newly released version of liferay. liferay of bugs or improvements in instructions on how to contribute to liferay";;
|
ext plugins are a powerful way to extend liferay. you can use them to customize, so use them carefully. plugin, see if you can implement all or part of the desired functionality through a different plugin type portlets, hooks, and web plugins offer you a lot of extension capabilities themselves, without introducing the complexity that's inherent with ext plugins. if you need to use an ext plugin, make it as small as possible and follow the instructions in this guide carefully to avoid next we'll learn how to develop liferay using the maven build framework.;;
|
"once upon a midnight dreary, while i pondered weak and weary... here's the sceneyou're sitting in a luxurious armchair next to a dancing fire, shadows dance on the tapestry-covered wall, and your cat lenore ii is purring softly from her favorite perch atop the mantle ah, distinctly i remember it was in the bleak december... at least you're passing this cold december night in grand style in front of your computer customizing liferay portal, of course eagerly i wished the morrow;vainly i had sought to borrow from liferay surcease of sorrowsorrow for my last lenore we're sorry to hear your previous cat, the original lenore, has passed away. just take good care of lenore ii, would you and the silken sad uncertain rustling of each purple curtain thrilled mefilled me with ant astic terrors never felt before; okay now you're being melodramatic; nobody can disdain apache ant that what about customizing liferay portal using the ant-based plugins sdk could make you feel sadness and terror deep into that darkness peering, long i stood there wondering, fearing... you don't want to use our ant-based plugins sdk. open here i flung the shutter, when, with many a flirt and flutter, in there stepped a stately maven of the saintly days of yore. so, you'd rather use apache maven to develop your liferay plugins but apache maven still beguiling all my sad soul into smiling... edgar allen poe liked maven too, so you're in good company. but if your soul was made sad because you thought you had to use liferay's ant-based plugins sdk to develop your plugins, apache maven will make your sad and while you're at it, take care of lenore ii for all of us animal quoth the maven, let us proceed undaunted in exploration of these topics as an alternative to developing plugins using the plugins sdk, you can leverage the apache maven build management framework. maven's core installation is lightweight; there are core plugins for compiling source code and creating distributions, and there is an abundance of non-core plugins, letting you extend maven easily for your customizations many developers are switching from ant to maven because it offers a common maven's universal directory structure makes it easier for you to understand another developer's project more quickly. maven, there's a simple process to build, install, and deploy project artifacts maven uses a project object model pom to describe a software project. pom is specified as xml in a file named url. blueprint for your entire project; it describes your project's directories, required plugins, build sequence, and dependencies. once you create the url file and invoke the build process, maven does the rest, downloading your project's inferred dependencies and building your project artifacts. with how maven works, you can get familiar with maven's project object model by reading sonatype's documentation for it at maven provides a clear definition of a project's structure and manages a project from a single piece of informationits pom. understanding a maven project can be much easier than understanding an ant-based project's various build files. maven forces projects to conform to a standard build process, whereas ant projects can be built differently from project to project. an easy way to share artifacts e.g., jars, wars, etc. across projects via there are disadvantages to using maven. you might find the maven project structure too restrictive, or decide that reorganizing your projects to work maven is intended primarily for java-based projects, so it can be difficult to manage your project's non-java source code. consider maven's advantages and disadvantages, then decide how you want to after you're finished reading about maven here, you can read an in-depth book about maven at maven the complete reference by liferay provides maven archetypes to help you build plugins of various types, including liferay portlets, themes, hooks, layout templates, web plugins, and you can also install and deploy liferay artifacts to your repositories. we'll dive into all these topics in this chapter straight i wheeled a cushioned seat in front of computer desk once more; then, upon the velvet falling, i betook to maven installing...";;
|
recommend putting your maven installation's bin directory in your system's path, so you can run the maven executable mvn easily from your command let's learn about the types of repositories you can use with maven projects.;;
|
now that your theme is available in liferay, it's time to dress it up for a currently in the look and feel settings, your theme's to remedy this, create a 1080 pixels wide by 864 pixels high image to use as your theme's thumbnail. snapshot of your theme and resize it to these dimension. abide by these exact dimensions or your image will not display properly as a save the image as a.png file named url and place it in your theme's docrootdiffsimages directory create this directory if it on redeployment, your url file automatically displays as your theme's thumbnail now go to the look and feel settings. your theme's thumbnail should appear there, along with the classic theme's thumbnail tip to achieve the 1080x864 resolution in a new browser window, use the button provided in the resize browser web content article displayed on the let's talk about liferay's javascript library next.;;
|
liferay has its own javascript library called alloyui, an extension to yahoo's you can take advantage of alloyui or yui3 in your themes. your theme's url file, you'll find definitions for three javascript now let's make your theme configurable by defining settings.;;
|
by now, you've likely added portlets to a page by dragging them from the add menu and dropping them into place. are there times, though, when you find yourself limited by liferay's page layout options? pronounced fung shway senses are picking up on some negative energy? perhaps you find yourself adding the same portlets over and over again onto the break the monotony by creating your own layout template plugins let you design layouts that flow nicely, embed commonly used portlets, and apply css, velocity, and html to in this chapter, you'll learn everything you need to know about layout let's create a custom layout template!;;
|
with the plugins sdk you can deploy layout templates as plugins, and creating layout templates with liferay developer studio is easier than ever. enter columns-1-4-1 for the project name and columns 1 4 1 for the choose whichever build type you prefer ant or maven and select the appropriate plugins sdk and liferay runtime select layout template as your plugin type figure 6.1 creating a custom layout template project in studio using the terminal navigate to your plugins sdk's layouttpl folder, and execute the create script in your terminal. the create script, followed by operating system-specific commands developer studio's new project wizard and the create scripts generate layout template projects in your plugin sdk's layouttpl folder. project names must end with -layouttpl so when you enter columns-1-4-1 for the project name, -layouttpl is automatically appended to the project name.;;
|
let's look at the directory structure of a layout template project and learn navigate to your plugins sdk's layouttpl folder and you'll see that the plugins sdk automatically appended -layouttpl to your project's name. template project can contain multiple layout templates. is the same, but you'll have a.png,.tpl, and url file for each layout template in the docroot folder. the liferay- files describe the layout templates for packaging and deployment now that you're well-versed on the anatomy of a layout template, let's explore one or more layout template plugins can reside in a layout template project. let's see what each template file does figure 6.2 default layout template thumbnail let's move on to liferay configuration files in addition to the three template-specific files, a layout template project has now that you're familiar with the layout template's files and directory structure, let's deploy a layout template on the server if you've ever deployed a theme or portlet, you already know how to deploy use developer studio or the terminal to deploy your layout deploying in developer studio drag your layout template project onto deploying in the terminal if you're using ant, execute the following command from your layout template project directory if you're using maven, please refer to this guide's on deploying liferay plugins with maven when deploying your plugin, the server displays messages indicating that your plugin was read, registered, and is now available for use we can deploy the template, but we still haven't designed it. we'll need to add content to the tpl files that were generated when we created;;
|
initially, the layout template's generated tpl files are empty, a fresh canvas on which you design layout templates. if this seems overwhelming, don't worry. with the handy palette in developer studio's layout template editor, designing templates becomes fun! open your layout template's tpl file in developer studio's layout template editor to see it displayed in visual experimental mode click the triangle in the upper left corner of the editor to view the drag rows, columns, and even existing templates onto your start designing your new layout template by dragging an existing layout then modify it by adding, deleting, and adjusting after adding rows and columns, drag their edges to achieve the desired your layout isn't etched in stone. layout template whenever you need by using visual experimental mode in figure 6.3 visually adjusted template to fine tune your design's dimensions, switch to source view and edit figure 6.4 source view of the template for example, if you want each second-row column of the above template to be 25 of the page width, adjust that row's first column column-2 from 20 to 25 here's how the original 20 column width definition looks here's the column width definition modified to 25 it's hard to see, but we changed the column's class aui-w20 value to just like that, the rows and columns of the columns 1 4 1 layout template are now that we've generated some positive feng shui through the design of our layout, let's increase our control over the layout by embedding portlets.;;
|
are there portlets you need displayed in the same location on all pages using perhaps you want to prevent others from disrupting the feng shui you've generated with your design? layout templates, ensuring that specified portlets always display in consistent users can minimize embedded portlets but can't move or whether instanceable or non-instanceable, core portlets and custom portlets you created with the plugins sdk can be embedded in layout templates let's embed some portlets in our columns 1 4 1 layout template. the navigation portlet and search portlet in the first and last columns of additionally, we'll embed a custom portlet in the template's upper and lower rows first, specify some attributes of the embedded portlet figure 6.5 fully qualified portlet id fqpi for a custom portlet here's a description of the portlets we're embedding in the layout here's the tpl that implements embedding of these portlets what would a page using our columns 1 4 1 layout template look like? the following figure for a screenshot of our layout template with its embedded figure 6.6 page with portlets embedded in layout template see how simple it is to embed portlets in your pages wouldn't it be nice to have an organized reference of available layout template we'll dive into available variables next!;;
|
a number of variables are available for you to use in your custom tpl files. your convenience, we've listed all of them in the following table now your layout template toolbox is complete.;;
|
liferay hooks are the best plugin for customizing liferay's core features. possible, use hooks whenever you need to override liferay's core functionality. it's possible to use ext plugins for many of the same tasks, but hooks are hot-deployable and more forward compatible, so we urge you to use them in this chapter we'll learn to create hooks and discuss their most common uses our chapter topics include these items like portlets, layout templates, and themes, hooks are created and managed using the plugins sdk, or the terminal. let's create and deploy a hook using both;;
|
"regardless of whether you use the plugins sdk or your terminal to create hooks, hooks projects are stored in the plugins sdk's hooks directory assign a project name and display name. example-hook and example for the project name and display name, notice that upon entering example-hook as the project name, the wizard conveniently inserts example in grayed-out text as the the wizard derives the default display name from the project name, starts it in upper-case, and leaves off the plugin type suffix hook because the plugin type is automatically appended to the display name in liferay portal. the ide saves the you from repetitively appending the plugin type to the display name; in fact, the ide ignores any plugin type suffix if you happen to append it to the display name enter the following values for the project name and display name select the build type, plugins sdk, and liferay runtime if you select the maven build type, you'll be prompted to enter an artifact version, group id, and active profile for your project. otherwise, select the ant build type, a plugins sdk for this demonstration, make the following selections for more information, see sections installing the figure 7.1 creating your hook plugin the plugins sdk automatically named the hook by appending -hook to the project with developer studio, you can create a completely new plugin or add a new plugin to an existing plugin project using the terminal navigate to your plugins sdk directory in a terminal and enter the appropriate command for your operating system a build successful message from ant tells you there's a new folder named example-hook inside the plugins sdk's hooks folder. automatically named the hook by appending -hook to the project name now that you've created a hook, let's go ahead and deploy it using developer studio click and drag your hook project onto your server. upon deployment, your server displays messages indicating that your hook was read, registered and is now available for use if you ever need to redeploy your plugin while in developer studio, right-click your plugin's icon located underneath your server and select redeploy using the terminal open a terminal window in your hooksexample-hook a build successful message indicates your hook is now being deployed. switch to the terminal window running liferay, in a few seconds you should see the message hook for example-hook is available for use note when we created portlets and themes, they were fully functional upon hooks aren't like that, because they're liferay customizations, and the default customization is the original implementation! next, let's look at the anatomy of a liferay hook to make your hook useful, you need to customize something in liferay. by mirroring the structure of liferay's code that you plan to customize. plugin is built to contain this in developer studio's package explorer, here's what the hook structure looks figure 7.2 package explorer view of hook plugin the particular files you'll work on depend on what liferay feature you're let's start making hooks for the features developers override the most; web resources are a good place to start.";;
|
"hooks are commonly used to override web resources, found in portal-web in the you can use a hook to override jsp files, jspf files, javascript important a jspf change takes effect only when you modify a jsp that replacing a portal jsp is a simple task with hooks. hook to modify your portal's terms of use page use the hook project we created earlier or create a new hook project open the url file from your project's docrootweb-inf by default, it opens in overview mode. gives you a graphical user interface for developing your hook. toggle between overview mode and source mode via their respective tabs for select the custom jsps folder from the outline to bring up the custom jsp select the checkbox customize liferay portal jsps and create the default custom jsp folder meta-infcustomjsps, by clicking the icon that has the three yellow diamonds figure 7.3 liferay ide lets you specify a folder for the custom jsps you're developing. create the folder by clicking the icon that has the three yellow diamonds add to the listing of custom jsps by clicking the plus icon and specifying right-hand side within the custom jsp text field simplifies finding the jsp it lets you scroll through the jsps that are accessible and lets you specify key words to narrow your search figure 7.4 liferay ide simplifies adding a custom jsp to your hook by providing a powerful overview mode for editing your url file file and modify it as necessary deploy your hook and wait until it is deployed successfully the original jsp stays in the cache until the cache is cleared or liferay to clear the cache, navigate to control panel server administration and click on the appropriate clear content... the terms of use page should include the now there are two terms of use jsp files in the one is called url and another url is your hook's version, while to revert back to the original, your replacement jsp is removed, and the url file is automatically renamed, taking its place. you can override any jsp in the liferay core, while retaining thew ability to easily revert your changes. however, it's not possible to override the same jsp from multiple hooks; liferay won't know which version to use note we don't recommend changing the terms of use with a hook. replace the terms of use with web content simply by setting two properties in although our hook wasn't necessary, it was a good way to demonstrate overriding a jsp with a hook next, we'll look at a different way to customize a jsp.";;
|
"there are two ways to pass information from the action phase to the render the first way is through render parameters. you can invoke the setrenderparameter method to add a new parameter to the the render phase can read this from the render phase in our case, the jsp, this value is read like this it's important to be aware that when invoking an action url, the parameters specified in the url are only readable from the action phase that is within in order to pass parameter values to the render phase you must read them from the actionrequest and then invoke the setrenderparameter method for each parameter needed tip liferay offers a convenient extension to the portlet specification through the mvcportlet class to copy all action parameters directly as render you can achieve this by setting the following init-param in your one final note about render parameters the portal remembers them for all later executions of the portlet until the portlet is invoked with different that is, if a user clicks a link in our portlet and a render parameter is set, and then the user continues browsing through other portlets on the page, each time the page is reloaded, the portal renders our portlet using the render parameters that we initially set. in our example, then the success message will be shown not only right after saving, but also every time the portlet is rendered until the portlet is invoked again without that render parameter the second way of passing information from the action phase to the render phase is not unique to portlets, so it might be familiar to youusing the session. your code can set an attribute in the actionrequest that is then read from the in our case, the jsp would also immediately remove the attribute from the session so the message is only shown once. liferay provides a helper class and taglib to do this operation easily. in the processaction method, you need to next, in url, add the liferay-uisuccess jsp tag and add the taglib after this change, redeploy the portlet, go to the edit screen and save it. should see a nice message that looks like this figure 3.7 the sample my greeting portlet showing a success message there's also an equivalent utility class for error notification; it's commonly used after catching an exception in the processaction method. the error, if it exists, is shown in your url using the if an error occurred, you'd see this in your portlet figure 3.8 the sample my greeting portlet showing an error message the first message is automatically added by liferay.";;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.