Index: portal-impl/src/com/liferay/portlet/ext/blogslastcomments/action/ConfigurationActionImpl.java
===================================================================
--- portal-impl/src/com/liferay/portlet/ext/blogslastcomments/action/ConfigurationActionImpl.java (revisión: 0)
+++ portal-impl/src/com/liferay/portlet/ext/blogslastcomments/action/ConfigurationActionImpl.java (revisión: 0)
@@ -0,0 +1,67 @@
+/**
+ * mmartinez
+ * 16/01/07 12:13
+ */
+package com.liferay.portlet.ext.blogslastcomments.action;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletPreferences;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import com.liferay.portal.kernel.portlet.ConfigurationAction;
+import com.liferay.portal.kernel.util.Constants;
+import com.liferay.portal.kernel.util.ParamUtil;
+import com.liferay.portlet.PortletPreferencesFactoryUtil;
+import com.liferay.util.servlet.SessionMessages;
+
+/**
+ * Save last comments blogs portlet configuration.
+ *
+ *
+ * - Total comments quantity to show
+ *
+ *
+ * @author Mario Martínez Sánchez
+ * @version $Id$
+ */
+public class ConfigurationActionImpl implements ConfigurationAction {
+
+ /* (non-Javadoc)
+ * @see com.liferay.portal.kernel.portlet.ConfigurationAction#processAction(javax.portlet.PortletConfig, javax.portlet.ActionRequest, javax.portlet.ActionResponse)
+ */
+ public void processAction(PortletConfig config, ActionRequest req,
+ ActionResponse res) throws Exception {
+
+ String cmd = ParamUtil.getString(req, Constants.CMD);
+
+ if (!cmd.equals(Constants.UPDATE)) {
+ return;
+ }
+
+ int commentsQuantity = ParamUtil.getInteger(req, "comments_quantity");
+ String portletResource = ParamUtil.getString(req, "portletResource");
+
+ PortletPreferences prefs =
+ PortletPreferencesFactoryUtil.getPortletSetup(
+ req, portletResource);
+
+ prefs.setValue("comments_quantity", String.valueOf(commentsQuantity));
+
+ prefs.store();
+
+ SessionMessages.add(req, config.getPortletName() + ".doConfigure");
+ }
+
+ /* (non-Javadoc)
+ * @see com.liferay.portal.kernel.portlet.ConfigurationAction#render(javax.portlet.PortletConfig, javax.portlet.RenderRequest, javax.portlet.RenderResponse)
+ */
+ public String render(PortletConfig config, RenderRequest req,
+ RenderResponse res) throws Exception {
+
+ return "/html/portlet/ext/blogs_last_comments/configuration.jsp";
+ }
+
+}
Index: portal-web/docroot/html/portlet/ext/blogs_last_comments/configuration.jsp
===================================================================
--- portal-web/docroot/html/portlet/ext/blogs_last_comments/configuration.jsp (revisión: 0)
+++ portal-web/docroot/html/portlet/ext/blogs_last_comments/configuration.jsp (revisión: 0)
@@ -0,0 +1,42 @@
+
+<%@ include file="/html/portlet/ext/blogs_last_comments/init.jsp" %>
+
+" method="post" name="fm">
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+ " onClick="submitForm(document.fm);" />
+
+
Index: portal-web/docroot/html/portlet/ext/blogs_last_comments/view.jsp
===================================================================
--- portal-web/docroot/html/portlet/ext/blogs_last_comments/view.jsp (revisión: 0)
+++ portal-web/docroot/html/portlet/ext/blogs_last_comments/view.jsp (revisión: 0)
@@ -0,0 +1,41 @@
+
+<%@ include file="/html/portlet/ext/blogs_last_comments/init.jsp" %>
+
+<%
+ List messages = MBMessageLocalServiceUtil.getCategoryMessages(0, 0, Integer.MAX_VALUE);
+%>
+
+
Index: portal-web/docroot/html/portlet/ext/blogs_last_comments/view_user.jspf
===================================================================
--- portal-web/docroot/html/portlet/ext/blogs_last_comments/view_user.jspf (revisión: 0)
+++ portal-web/docroot/html/portlet/ext/blogs_last_comments/view_user.jspf (revisión: 0)
@@ -0,0 +1,23 @@
+
+<%
+ long parentMessageId;
+ MBMessage parentMessage = null;
+ User bloggerUser;
+ String urlViewUser = "/web/guest/canallas?p_p_id=11&p_p_action=0&p_p_state=maximized&p_p_mode=view&_11_struts_action=%2Fdirectory%2Fedit_user&_11_redirect=%2Fweb%2Fguest%2Fcanallas%3Fp_p_id%3D11%26p_p_action%3D0%26p_p_state%3Dmaximized%26p_p_mode%3Dview%26_11_struts_action%3D%252Fdirectory%252Fview%26_11_tabs1%3Dusers%26_11_tabs2%3D%26_11_tabs3%3D&_11_p_u_i_d=" + messageUser.getUserId();
+%>
+
+
Index: portal-web/docroot/html/portlet/ext/blogs_last_comments/view_blogger.jspf
===================================================================
--- portal-web/docroot/html/portlet/ext/blogs_last_comments/view_blogger.jspf (revisión: 0)
+++ portal-web/docroot/html/portlet/ext/blogs_last_comments/view_blogger.jspf (revisión: 0)
@@ -0,0 +1,22 @@
+
+<%
+ parentMessageId = message.getParentMessageId();
+ while (parentMessageId != 0) {
+ parentMessage = MBMessageLocalServiceUtil.getMessage(parentMessageId);
+ parentMessageId = parentMessage.getParentMessageId();
+ }
+
+ if (parentMessage != null) {
+ bloggerUser = UserLocalServiceUtil.getUserById(parentMessage.getUserId());
+
+ if (bloggerUser != null) {
+%>
+
+
+
+<%
+ }
+ }
+%>
Index: portal-web/docroot/html/portlet/ext/blogs_last_comments/init.jsp
===================================================================
--- portal-web/docroot/html/portlet/ext/blogs_last_comments/init.jsp (revisión: 0)
+++ portal-web/docroot/html/portlet/ext/blogs_last_comments/init.jsp (revisión: 0)
@@ -0,0 +1,21 @@
+
+<%@ page import="com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil" %>
+<%@ page import="com.liferay.portlet.messageboards.model.MBMessage" %>
+
+<%@ include file="/html/portlet/init.jsp" %>
+
+<%
+
+// Get from portlet configuration the quantity elements to show
+PortletPreferences prefs = renderRequest.getPreferences();
+String portletResource = ParamUtil.getString(request, "portletResource");
+if (Validator.isNotNull(portletResource)) {
+ prefs = PortletPreferencesFactoryUtil.getPortletSetup(request, portletResource, true, true);
+}
+int commentsQuantity = GetterUtil.getInteger(prefs.getValue("comments_quantity", "10"));
+
+//Blogs comment elements have "N/A" value in subject property
+String blogsMessageSubject = "N/A";
+
+DateFormat dateFormatDateTime = DateFormats.getDateTime(locale, timeZone);
+%>
Index: portal-web/docroot/WEB-INF/liferay-portlet.xml
===================================================================
--- portal-web/docroot/WEB-INF/liferay-portlet.xml (revisión: 14031)
+++ portal-web/docroot/WEB-INF/liferay-portlet.xml (copia de trabajo)
@@ -1145,6 +1145,11 @@
1
true
+
+ blogs_last_comments
+ blogs_last_comments
+ com.disid.portlet.ext.blogslastcomments.action.ConfigurationActionImpl
+
administrator
Administrator
Index: portal-web/docroot/WEB-INF/liferay-display.xml
===================================================================
--- portal-web/docroot/WEB-INF/liferay-display.xml (revisión: 14031)
+++ portal-web/docroot/WEB-INF/liferay-display.xml (copia de trabajo)
@@ -38,6 +38,7 @@
+
Index: portal-web/docroot/WEB-INF/portlet-custom.xml
===================================================================
--- portal-web/docroot/WEB-INF/portlet-custom.xml (revisión: 14031)
+++ portal-web/docroot/WEB-INF/portlet-custom.xml (copia de trabajo)
@@ -2244,6 +2244,26 @@
user
+
+ blogs_last_comments
+ Last Comments Blogs
+ com.liferay.portlet.StrutsPortlet
+
+ view-action
+ /blogs_last_comments/view
+
+ 0
+
+ text/html
+
+ com.liferay.portlet.StrutsResourceBundle
+
+ power-user
+
+
+ user
+
+
exclusive
Index: portal-web/docroot/WEB-INF/struts-config.xml
===================================================================
--- portal-web/docroot/WEB-INF/struts-config.xml (revisión: 14031)
+++ portal-web/docroot/WEB-INF/struts-config.xml (copia de trabajo)
@@ -1451,6 +1451,12 @@
+
+
+
+
+
+<% + } + } + } + } +%> +