Posts

Showing posts from February, 2013

About theme files in Liferay

portal-normal.vm –   which renders the whole page. portlet.vm       -   which renders one portlet. init_custom.vm   -   The other ones respectively define additional velocity variables. Navigation.vm    -   render the navigation bar. portal_pop_up.vm -   render the popup pages(portal_pop_up.vm).

Disabling some portlets in Liferay Portal

Disabling the Portlet in Control Panel Each portlet can be disabled by unchecking the Active checkbox on Control Panel | Plugins Configuration | targeted portlet page. If disabled, the portlet will not be displayed in the Add Application pop-up panel. In Programmatic Way Each portlet can also be disabled by setting show-portlet-inactive to false   in its corresponding section in ${PORTAL_ROOT_HOME}/WEB-INF/liferay-portlet.xml Note: This show-portlet-inactive setting can be overwritten by the Active checkbox setting in previous step.

Reading data from excel sheet using liferay/Java

Consider the situation where i need to read the data from EXCEL sheet. So , If you have an input of type "FILE" where you need to upload the Excel sheet and Submit button to submit the file as below code. In JSP page Create action URL and file type to submit the file as show the below PortletURL actionURL = renderResponse.createActionURL(); actionURL.setParameter("_spage", "/portlet_action/excel/excel"); <form method ="post" action = "${actionURL}" type"multipart/encrpt>     <input type ="file" name"filename"/>    <input type ="submit"/>                  </form>  In Class i am reading the Excel sheet as follows as , In Class boolean isMultipart = ServletFileUpload.isMultipartContent(request); if(isMultipart) {   //Checking the Type of file FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = n

getting blog entry by using user id

Here we are passing the user id of the user to reterive the blog int userId = Integer.parseInt(renderRequest.getParameter("userId")); List list = new ArrayList (); int count1 =BlogsEntryLocalServiceUtil.getBlogsEntriesCount(); // Getting the total blogs List blogsList= BlogsEntryLocalServiceUtil.getBlogsEntries(0, count1); for(BlogsEntry blogsEntry :blogsList){   // Iterating the blogs if(blogsEntry.getUserId()==userId)    // Checking the users list.add(blogsEntry); // Adding the particlular user in the list

Getting Tags from record(Blogs,Messageboard.....etc)

String tag = ParamUtil.getString(request, "tag"); // Getting the tag PortletURL portletURL = renderResponse.createRenderURL(); Set assestSet = new HashSet (); StringBundler sbtag = new StringBundler(); List articleEntryListEntries = BlogLocalServiceUtil.getBlogEntries(0,BlogEntriesLocalServiceUtil.getBlogEntriesCount()); for(Blogs articleEntry :articleEntryAllList){ AssetEntry assetEntry = null; try { assetEntry = AssetEntryLocalServiceUtil.getEntry(ArticleEntry.class.getName(),articleEntry.getArticleEntryId()); List assestTagList = assetEntry.getTags(); assestSet.addAll(assestTagList); } catch (Exception e){ e.printStackTrace(); } } if(assestSet.size()==0 &&assestSet.isEmpty()){

Portlet Perference

The PortletPreferences interface allows the portlet to store configuration data There are two different types of preferences: modifiable preferences - these preferences can be changed by the portlet in any standard portlet mode (EDIT, HELP, VIEW). Per default every preference is modifiable. read-only preferences - these preferences cannot be changed by the portlet in any standard portlet mode, but may be changed by administrative modes. Preferences are read-only, if the are defined in the deployment descriptor with read-only set to true, or if the portlet container restricts write access.