Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/feature-dossier' into feature-…
Browse files Browse the repository at this point in the history
…backend

Conflicts:
	portlets/opencps-portlet/docroot/WEB-INF/src/org/opencps/processmgt/portlet/ProcessOrderMenuPortlet.java
  • Loading branch information
khoahp committed May 16, 2016
2 parents 6c0cc4e + aa6386f commit 41400f1
Show file tree
Hide file tree
Showing 10 changed files with 429 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ StringBundler pageTopSB = OutputTag.getData(request, WebKeys.PAGE_TOP);

<link class="lfr-css-file" href="<%= HtmlUtil.escapeAttribute(PortalUtil.getStaticResourceURL(request, themeDisplay.getPathThemeCss() + "/main.css")) %>" rel="stylesheet" type="text/css" />
<link href="<%= HtmlUtil.escapeAttribute(PortalUtil.getStaticResourceURL(request, themeDisplay.getCDNDynamicResourcesHost() + themeDisplay.getPathContext() + "/html/css/font-awesome.min.css")) %>" rel="stylesheet" type="text/css" />
<link href="<%= HtmlUtil.escapeAttribute(PortalUtil.getStaticResourceURL(request, themeDisplay.getCDNDynamicResourcesHost() + themeDisplay.getPathContext() + "/html/css/alpaca.min.css")) %>" rel="stylesheet" type="text/css" />
<%-- User Inputted Layout CSS --%>

<c:if test="<%= (layout != null) && Validator.isNotNull(layout.getCssText()) %>">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,5 +467,7 @@ for (String analyticsType : analyticsTypes) {
<!-- <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/3.0.3/handlebars.js"></script> -->
<script type="text/javascript" src="<%= themeDisplay.getCDNHost() %>/html/extensions/handlebars-v4.0.5.js"></script>
<!-- alpaca -->
<link type="text/css" href="//code.cloudcms.com/alpaca/1.5.17/bootstrap/alpaca.min.css" rel="stylesheet" />
<script type="text/javascript" src="//code.cloudcms.com/alpaca/1.5.17/bootstrap/alpaca.min.js"></script>
<!-- <link type="text/css" href="//code.cloudcms.com/alpaca/1.5.17/bootstrap/alpaca.min.css" rel="stylesheet" /> -->

<!-- <script type="text/javascript" src="//code.cloudcms.com/alpaca/1.5.17/bootstrap/alpaca.min.js"></script> -->
<script type="text/javascript" src="<%= themeDisplay.getCDNHost() %>/html/extensions/alpaca.min.js"></script>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public String getAssignToUserName() {
try {
user = UserLocalServiceUtil
.fetchUserById(this
.getActionUserId());
.getAssignToUsesrId());

}
catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/

package org.opencps.processmgt.portlet;

import java.io.IOException;
Expand All @@ -34,7 +33,7 @@
import org.opencps.processmgt.model.ProcessStep;
import org.opencps.processmgt.service.ProcessOrderLocalServiceUtil;
import org.opencps.processmgt.util.ProcessOrderUtils;
//import org.opencps.processmgt.util.ProcessOrderUtils;
// import org.opencps.processmgt.util.ProcessOrderUtils;
import org.opencps.util.WebKeys;

import com.liferay.portal.kernel.exception.PortalException;
Expand All @@ -46,98 +45,151 @@
import com.liferay.portal.kernel.portlet.LiferayPortletMode;
import com.liferay.portal.kernel.portlet.LiferayWindowState;
import com.liferay.portal.kernel.servlet.SessionMessages;
import com.liferay.portal.kernel.util.GroupThreadLocal;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.User;
import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portal.util.PortalUtil;
import com.liferay.portlet.PortletURLFactoryUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;


/**
* @author khoavd
*
*/
public class ProcessOrderMenuPortlet extends MVCPortlet{

private Log _log = LogFactoryUtil.getLog(ProcessOrderMenuPortlet.class);

public void menuAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException, SystemException, WindowStateException, PortletModeException, IOException {
String mvcPath = ParamUtil.getString(actionRequest, "mvcPath");

String active = ParamUtil.getString(actionRequest, WebKeys.MENU_ACTIVE);

ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

PortletURL renderUrl = PortletURLFactoryUtil.create(actionRequest, themeDisplay.getPortletDisplay().getId(), themeDisplay.getPlid(), PortletRequest.RENDER_PHASE);

renderUrl.setWindowState(LiferayWindowState.NORMAL);
renderUrl.setPortletMode(LiferayPortletMode.VIEW);
renderUrl.setParameter("mvcPath", mvcPath);

HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(actionRequest);

httpRequest.getSession().invalidate();
httpRequest.getSession().setAttribute(WebKeys.MENU_ACTIVE, active);

actionResponse.sendRedirect(renderUrl.toString());
public class ProcessOrderMenuPortlet extends MVCPortlet {

private Log _log = LogFactoryUtil
.getLog(ProcessOrderMenuPortlet.class);

public void menuAction(
ActionRequest actionRequest, ActionResponse actionResponse)
throws PortalException, SystemException, WindowStateException,
PortletModeException, IOException {

String mvcPath = ParamUtil
.getString(actionRequest, "mvcPath");

String active = ParamUtil
.getString(actionRequest, WebKeys.MENU_ACTIVE);

ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest
.getAttribute(WebKeys.THEME_DISPLAY);

PortletURL renderUrl = PortletURLFactoryUtil
.create(actionRequest, themeDisplay
.getPortletDisplay().getId(), themeDisplay
.getPlid(),
PortletRequest.RENDER_PHASE);

renderUrl
.setWindowState(LiferayWindowState.NORMAL);
renderUrl
.setPortletMode(LiferayPortletMode.VIEW);
renderUrl
.setParameter("mvcPath", mvcPath);

HttpServletRequest httpRequest = PortalUtil
.getHttpServletRequest(actionRequest);

httpRequest
.getSession().invalidate();
httpRequest
.getSession().setAttribute(WebKeys.MENU_ACTIVE, active);

actionResponse
.sendRedirect(renderUrl
.toString());
}
public void menuCounterAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException, SystemException {

public void menuCounterAction(
ActionRequest actionRequest, ActionResponse actionResponse)
throws PortalException, SystemException {

Map<String, String> par = new HashMap<String, String>();

User user = PortalUtil.getUser(actionRequest);

ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

long groupId = themeDisplay.getScopeGroupId();
User user = PortalUtil
.getUser(actionRequest);

ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest
.getAttribute(WebKeys.THEME_DISPLAY);

long groupId = themeDisplay
.getScopeGroupId();

// now read your parameters, e.g. like this:
// long someParameter = ParamUtil.getLong(request, "someParameter");

List<ProcessStep> list = ProcessOrderUtils
.getProcessSteps(groupId, user
.getRoleIds());

// now read your parameters, e.g. like this:
// long someParameter = ParamUtil.getLong(request, "someParameter");

List<ProcessStep> list = ProcessOrderUtils.getProcessSteps(groupId, user.getRoleIds());

long counterVal = 1;

for (ProcessStep item : list) {

counterVal = ProcessOrderLocalServiceUtil.countProcessOrder(item.getProcessStepId(), 0, 0);

par.put("badge_" + item.getProcessStepId(), String.valueOf(counterVal));


counterVal = ProcessOrderLocalServiceUtil
.countProcessOrder(item
.getProcessStepId(), themeDisplay.getUserId(), 0);

par
.put("badge_" + item
.getProcessStepId(), String
.valueOf(counterVal));

}
ajaxReturn(actionRequest ,actionResponse, par);

ajaxReturn(actionRequest, actionResponse, par);
}

private void ajaxReturn(ActionRequest actionRequest, ActionResponse actionResponse,Map<String, String> par) {

private void ajaxReturn(
ActionRequest actionRequest, ActionResponse actionResponse,
Map<String, String> par) {

try {

HttpServletResponse httpResponse = PortalUtil.getHttpServletResponse(actionResponse);

httpResponse.setContentType("text");

JSONObject payloadJSON = JSONFactoryUtil.createJSONObject();

for (Map.Entry<String,String> entry : par.entrySet()){

payloadJSON.put(entry.getKey(), HtmlUtil.escape(entry.getValue()));


HttpServletResponse httpResponse = PortalUtil
.getHttpServletResponse(actionResponse);

httpResponse
.setContentType("text");

JSONObject payloadJSON = JSONFactoryUtil
.createJSONObject();

for (Map.Entry<String, String> entry : par
.entrySet()) {

payloadJSON
.put(entry
.getKey(), HtmlUtil
.escape(entry
.getValue()));

}

httpResponse.getWriter().print(payloadJSON.toString());
httpResponse.flushBuffer();

SessionMessages.add(actionRequest,PortalUtil.getPortletId(actionRequest)
+ SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);
SessionMessages.add(actionRequest,PortalUtil.getPortletId(actionRequest)
+ SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_SUCCESS_MESSAGE);

} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();

httpResponse
.getWriter().print(payloadJSON
.toString());
httpResponse
.flushBuffer();

SessionMessages
.add(actionRequest, PortalUtil
.getPortletId(actionRequest) +
SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);
SessionMessages
.add(actionRequest, PortalUtil
.getPortletId(actionRequest) +
SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_SUCCESS_MESSAGE);

}
catch (Exception e) {
_log.error(e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,12 @@ public List searchProcessOrder(


/**
* @param actionUserId
* @param longinUserId
* @return
*/
public List getUserProcessStep(

long actionUserId) {
long longinUserId) {

Session session = null;
try {
Expand All @@ -336,9 +336,9 @@ public List getUserProcessStep(
.getInstance(q);

qPos
.add(actionUserId);
.add(longinUserId);
qPos
.add(actionUserId);
.add(longinUserId);

Iterator<Object[]> itr = (Iterator<Object[]>) QueryUtil
.list(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<%@page import="org.opencps.servicemgt.service.ServiceInfoLocalServiceUtil"%>
<%@page import="org.opencps.servicemgt.model.ServiceInfo"%>
<%
/**
* OpenCPS is the open source Core Public Services software
Expand Down Expand Up @@ -82,7 +84,13 @@
//id column
row.addText(String.valueOf(dossier.getDossierId()));
row.addText(DateTimeUtil.convertDateToString(dossier.getCreateDate(), DateTimeUtil._VN_DATE_TIME_FORMAT));
row.addText(String.valueOf(dossier.getSubjectId()));
ServiceInfo serviceInfo = null;
String serviceName = StringPool.DASH;
try{
serviceInfo = ServiceInfoLocalServiceUtil.getServiceInfo(dossier.getServiceInfoId());
serviceName = serviceInfo.getServiceName();
}catch(Exception e){}
row.addText(serviceName);
row.addText(dossier.getGovAgencyName());
row.addText(PortletUtil.getDossierStatusLabel(dossier.getDossierStatus(), locale));
row.addText(DateTimeUtil.convertDateToString(dossier.getReceiveDatetime(), DateTimeUtil._VN_DATE_TIME_FORMAT));
Expand Down
Loading

0 comments on commit 41400f1

Please sign in to comment.