Created
September 13, 2013 17:53
-
-
Save lipusz/6553906 to your computer and use it in GitHub Desktop.
http://issues.liferay.com/browse/LPS-39666 Hidden pages break page sorting in navigation bar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/portal-impl/src/com/liferay/portlet/layoutsadmin/action/UpdateLayoutAction.java b/portal-impl/src/com/liferay/portlet/layoutsadmin/action/UpdateLayoutAction.java | |
index 159fe2c..fec898f 100644 | |
@@ -29,6 +29,7 @@ import com.liferay.portal.model.Layout; | |
import com.liferay.portal.model.LayoutConstants; | |
import com.liferay.portal.model.LayoutPrototype; | |
import com.liferay.portal.security.permission.ActionKeys; | |
+import com.liferay.portal.service.LayoutLocalServiceUtil; | |
import com.liferay.portal.service.LayoutPrototypeServiceUtil; | |
import com.liferay.portal.service.LayoutServiceUtil; | |
import com.liferay.portal.service.ServiceContext; | |
@@ -288,7 +289,39 @@ public class UpdateLayoutAction extends JSONAction { | |
long groupId = ParamUtil.getLong(request, "groupId"); | |
boolean privateLayout = ParamUtil.getBoolean(request, "privateLayout"); | |
long layoutId = ParamUtil.getLong(request, "layoutId"); | |
- int priority = ParamUtil.getInteger(request, "priority"); | |
+ long nextLayoutId = ParamUtil.getLong(request, "nextLayoutId", -1); | |
+ long previousLayoutId = ParamUtil.getLong( | |
+ request, "previousLayoutId", -1); | |
+ | |
+ Layout nextLayout = null; | |
+ | |
+ if (nextLayoutId > -1) { | |
+ nextLayout = LayoutLocalServiceUtil.getLayout( | |
+ groupId, privateLayout, nextLayoutId); | |
+ } | |
+ | |
+ Layout previousLayout = null; | |
+ | |
+ if (previousLayoutId > -1) { | |
+ previousLayout = LayoutLocalServiceUtil.getLayout( | |
+ groupId, privateLayout, previousLayoutId); | |
+ } | |
+ | |
+ Layout layout = LayoutLocalServiceUtil.getLayout( | |
+ groupId, privateLayout, layoutId); | |
+ | |
+ int priority = layout.getPriority(); | |
+ | |
+ if ((nextLayout != null) && | |
+ (layout.getPriority() > nextLayout.getPriority())) { | |
+ | |
+ priority = nextLayout.getPriority(); | |
+ } | |
+ else if ((previousLayout != null) && | |
+ (layout.getPriority() < previousLayout.getPriority())) { | |
+ | |
+ priority = previousLayout.getPriority(); | |
+ } | |
if (plid <= 0) { | |
LayoutServiceUtil.updatePriority( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment