You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2016/04/11 16:17:30 UTC

svn commit: r1738588 [1/2] - in /ofbiz/trunk: applications/content/config/ applications/content/servicedef/ applications/content/src/org/ofbiz/content/cms/ applications/content/src/org/ofbiz/content/content/ applications/content/webapp/content/WEB-INF/...

Author: jleroux
Date: Mon Apr 11 14:17:30 2016
New Revision: 1738588

URL: http://svn.apache.org/viewvc?rev=1738588&view=rev
Log:
A modified patch from James Young based on a an original patch from Christoph Neuroth for "Improved CMS tree: more functionality and faster for large trees" - https://issues.apache.org/jira/browse/OFBIZ-4502

jleroux: I made few changes
* Use of UtilGenerics.cast() in new ContentJsonEvents.java rather than @SuppressWarnings("unchecked")
* Removal of the commented out block "Lusini: disable RTE". I see no reasons why we would not use elRTE. Notably in relation with adding errors where it's currently used in trunk demo
* I changed the line 
    var unmovableSubtrees = [false, "categoryChildren_LusiniBrowseRoot", "homeContentsRoot", "merchantContentsRoot"];
    We have no such subtrees OOTB but it's good to keep the idea, I just renamed categoryChildren_LusiniBrowseRoot to categoryChildren and put an explaining comment
* I have roughly added the labels ContentWebSiteErrors, ContentWebSiteAddNewErrors and ContentWebSiteAddError, though I have a doubt about how this works. At least it's different than on trunk demo where it seems to works better (despite having uncommented out elRTE in this commit). ALso I don't remember how to add a menu worked (if it worked).
* I checked the version of jstree we use is the same than in the original patch from Christoph Neuroth. BTW at r1559769 I tried to update jstree  to jstree 3 but gave up.
* I removed the jquery.cookie.js implemnentation and replaced link in WebSiteCMSNav.ftl. I already updted to jquery.cookie-1.4.0 at r1559769

Added:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/ContentJsonEvents.java   (with props)
Modified:
    ofbiz/trunk/applications/content/config/ContentUiLabels.xml
    ofbiz/trunk/applications/content/servicedef/secas.xml
    ofbiz/trunk/applications/content/servicedef/services_content.xml
    ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java
    ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java
    ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy
    ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml
    ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl
    ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSMeta.ftl
    ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl
    ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSPathAlias.ftl
    ofbiz/trunk/applications/content/widget/WebSiteScreens.xml
    ofbiz/trunk/applications/content/widget/website/WebSiteForms.xml
    ofbiz/trunk/applications/datamodel/entitydef/content-entitymodel.xml
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java
    ofbiz/trunk/framework/images/webapp/images/jquery/plugins/jsTree/jquery.jstree.js

Modified: ofbiz/trunk/applications/content/config/ContentUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/config/ContentUiLabels.xml?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/config/ContentUiLabels.xml (original)
+++ ofbiz/trunk/applications/content/config/ContentUiLabels.xml Mon Apr 11 14:17:30 2016
@@ -29,6 +29,11 @@
         <value xml:lang="zh">无法找到cmsform!</value>
         <value xml:lang="zh-TW">無法找到cmsform!</value>
     </property>
+    <property key="ConfirmDeleteContent">
+        <value xml:lang="de">Wollen Sie den Inhalt wirklich löschen?</value>
+        <value xml:lang="en">Do you really want to delete this content?</value>
+        <value xml:lang="fr">Voulez-vous vraiment supprimer ce document ?</value>
+    </property>
     <property key="ContenCommEventContentAssocNotFoundForDelete">
         <value xml:lang="en">CommEventContentAssoc entity not found for delete, communicationEventId: ${parameters.communicationEventId} and contentId: ${parameters.contentId}</value>
         <value xml:lang="fr">L'association avec la communication ${parameters.communicationEventId} et le document ${parameters.contentId} pour la suppression n'a pas été trouvée</value>
@@ -3721,6 +3726,15 @@
         <value xml:lang="zh">网站内容</value>
         <value xml:lang="zh-TW">網站內容</value>
     </property>
+    <property key="ContentWebSiteErrors">
+        <value xml:lang="en">Web Site Errors</value>
+    </property>
+    <property key="ContentWebSiteAddNewErrors">
+        <value xml:lang="en">Web Site Add New Errors</value>
+    </property>
+    <property key="ContentWebSiteAddError">
+        <value xml:lang="en">Web Site Add Error</value>
+    </property>
     <property key="ContentWebSiteGenerateMissingSeoUrl">
         <value xml:lang="en">Generate missing seo url's</value>
         <value xml:lang="ja">SEO URLの生成に失敗しました</value>
@@ -3772,7 +3786,7 @@
         <value xml:lang="zh-TW">歡迎使用內容管理程式!</value>
     </property>
     <property key="ErrorLoadingContent">
-        <value xml:lang="de">Ein Fehler beim Laden des Inhaltes ist aufgetrete!</value>
+        <value xml:lang="de">Ein Fehler beim Laden des Inhaltes ist aufgetreten!</value>
         <value xml:lang="en">An error occurred loading content!</value>
         <value xml:lang="fr">Erreur dans le chargement du document !</value>
         <value xml:lang="ja">コンテンツのロード中にエラーが発生しました!</value>
@@ -3781,6 +3795,11 @@
         <value xml:lang="zh">载入内容时发生错误!</value>
         <value xml:lang="zh-TW">載入內容時發生錯誤!</value>
     </property>
+    <property key="ErrorMovingContent">
+        <value xml:lang="de">Ein Fehler beim Verschieben des Inhaltes ist aufgetreten!</value>
+        <value xml:lang="en">An error occured moving content!</value>
+        <value xml:lang="fr">Erreur durant le déplacement du document !</value>
+    </property>
     <property key="FormFieldTitle_acroFormContentId">
         <value xml:lang="ar">AcroForm (PDF) Content ID</value>
         <value xml:lang="da">AcroForm (PDF) indholds ID</value>

Modified: ofbiz/trunk/applications/content/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/secas.xml?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/content/servicedef/secas.xml Mon Apr 11 14:17:30 2016
@@ -135,12 +135,12 @@ under the License.
     <eca service="createContent" event="commit">
         <condition field-name="contentAssocTypeId" operator="is-not-empty"/>
         <condition field-name="contentIdTo" operator="is-not-empty"/>
-        <action service="createContentAssoc" mode="sync" run-as-user="system"/>
+        <action service="createContentAssoc" mode="sync" run-as-user="system" result-to-result="true" />
     </eca>
     <eca service="createContent" event="commit">
         <condition field-name="contentAssocTypeId" operator="is-not-empty"/>
         <condition field-name="contentIdFrom" operator="is-not-empty"/>
-        <action service="createContentAssoc" mode="sync" run-as-user="system"/>
+        <action service="createContentAssoc" mode="sync" run-as-user="system" result-to-result="true" />
     </eca>
 
     <eca service="createContent" event="commit">
@@ -178,9 +178,10 @@ under the License.
     <eca service="updateContentAssoc" event="in-validate">
         <action service="checkContentAssocIds" mode="sync"/>
     </eca>
-    
+    <!--
     <eca service="createContent" event="commit">
         <condition field-name="contentId" operator="is-not-empty"/>
         <action service="createContentAlternativeUrl" mode="sync" run-as-user="system"/>
     </eca>
+     -->
 </service-eca>

Modified: ofbiz/trunk/applications/content/servicedef/services_content.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services_content.xml?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/servicedef/services_content.xml (original)
+++ ofbiz/trunk/applications/content/servicedef/services_content.xml Mon Apr 11 14:17:30 2016
@@ -45,7 +45,7 @@
         <attribute name="partyId" type="String" mode="IN" optional="true"/>
         <attribute name="mapKey" type="String" mode="IN" optional="true"/>
         <attribute name="contentId" type="String" mode="INOUT" optional="true"/>
-        <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/>
+        <attribute name="fromDate" type="Timestamp" mode="INOUT" optional="true"/>
         <attribute name="sequenceNum" type="Long" mode="IN" optional="true"/>
         <override name="contentTypeId" default-value="DOCUMENT"/>
         <override name="contentName" allow-html="any"/>

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java Mon Apr 11 14:17:30 2016
@@ -142,7 +142,7 @@ public class CmsEvents {
 
             GenericValue pathAlias = null;
             try {
-                pathAlias = EntityQuery.use(delegator).from("WebSitePathAlias").where("webSiteId", webSiteId, "pathAlias", pathInfo).cache().queryOne();
+                pathAlias = EntityQuery.use(delegator).from("WebSitePathAlias").where("webSiteId", webSiteId, "pathAlias", pathInfo).orderBy("-fromDate").cache().filterByDate().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
             }
@@ -173,6 +173,8 @@ public class CmsEvents {
             Locale locale = UtilHttp.getLocale(request);
 
             // get the contentId/mapKey from URL
+            /* We use path aliases for everything anyway, so don't interpret the pathInfo as contentId.
+             * This makes 404 pages much faster.
             if (contentId == null) {
                 if (Debug.verboseOn()) Debug.logVerbose("Current PathInfo: " + pathInfo, module);
                 String[] pathSplit = pathInfo.split("/");
@@ -182,16 +184,21 @@ public class CmsEvents {
                     mapKey = pathSplit[1];
                 }
             }
+            */
 
             // verify the request content is associated with the current website
             int statusCode = -1;
             boolean hasErrorPage = false;
 
-            try {
-                statusCode = verifyContentToWebSite(delegator, webSiteId, contentId);
-            } catch (GeneralException e) {
-                Debug.logError(e, module);
-                throw new GeneralRuntimeException(e.getMessage(), e);
+            if (contentId != null) {
+	            try {
+	                statusCode = verifyContentToWebSite(delegator, webSiteId, contentId);
+	            } catch (GeneralException e) {
+	                Debug.logError(e, module);
+	                throw new GeneralRuntimeException(e.getMessage(), e);
+	            }
+            } else {
+            	statusCode = HttpServletResponse.SC_NOT_FOUND;
             }
 
             // We try to find a specific Error page for this website concerning the status code
@@ -281,11 +288,11 @@ public class CmsEvents {
                     }
 
                 } catch (TemplateException e) {
-                    throw new GeneralRuntimeException("Error creating form renderer", e);
+                	throw new GeneralRuntimeException(String.format("Error creating form renderer while rendering content [%s] with path alias [%s]", contentId, pathInfo), e);
                 } catch (IOException e) {
-                    throw new GeneralRuntimeException("Error in the response writer/output stream: " + e.toString(), e);
+                	throw new GeneralRuntimeException(String.format("Error in the response writer/output stream while rendering content [%s] with path alias [%s]", contentId, pathInfo), e);
                 } catch (GeneralException e) {
-                    throw new GeneralRuntimeException("Error rendering content: " + e.toString(), e);
+                	throw new GeneralRuntimeException(String.format("Error rendering content [%s] with path alias [%s]", contentId, pathInfo), e);
                 }
 
                 return "success";

Added: ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/ContentJsonEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/ContentJsonEvents.java?rev=1738588&view=auto
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/ContentJsonEvents.java (added)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/ContentJsonEvents.java Mon Apr 11 14:17:30 2016
@@ -0,0 +1,184 @@
+package org.ofbiz.content.cms;
+
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.collections4.CollectionUtils;
+
+//import net.sf.json.JSONArray;
+//import net.sf.json.JSONObject;
+
+import org.apache.commons.io.IOUtils;
+import org.ofbiz.base.lang.JSON;
+import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilGenerics;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericEntityNotFoundException;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.transaction.TransactionUtil;
+import org.ofbiz.entity.util.EntityUtil;
+
+public class ContentJsonEvents {
+
+    public static final int CONTENT_NAME_MAX_LENGTH = 27;
+
+    public static String getContentAssocs(HttpServletRequest request, HttpServletResponse response) throws GenericEntityException, IOException {
+        Delegator delegator = (Delegator) request.getAttribute("delegator");
+
+        String contentId = request.getParameter("contentId");
+
+        EntityCondition condition = EntityCondition.makeCondition(
+            EntityCondition.makeCondition(UtilMisc.toMap("contentId", contentId)),
+            EntityUtil.getFilterByDateExpr()
+            );
+        List<GenericValue> assocs = delegator.findList("ContentAssoc", condition, null, null, null, false);
+
+        List<Map<String, Object>> nodes = new LinkedList<Map<String, Object>>();
+        for (GenericValue assoc : assocs) {
+            nodes.add(getTreeNode(assoc));
+        }
+
+        Collections.sort(nodes, new Comparator<Map<String, Object>>() {
+
+            @Override
+            public int compare(Map<String, Object> node1, Map<String, Object> node2) {
+                Map<String, Object> data1 = UtilGenerics.cast(node1.get("data"));
+                Map<String, Object> data2 = UtilGenerics.cast(node2.get("data"));
+                if (data1 == null || data2 == null) {
+                    return 0;
+                }
+
+                String title1 = (String) data1.get("title");
+                String title2 = (String) data2.get("title");
+                if (title1 == null || title2 == null) {
+                    return 0;
+                }
+
+                return title1.toLowerCase().compareTo(title2.toLowerCase());
+            }
+
+        });
+        IOUtils.write(JSON.from(nodes).toString(), response.getOutputStream());
+
+        return "success";
+    }
+
+    public static String moveContent(HttpServletRequest request, HttpServletResponse response) throws GenericEntityException, IOException {
+        final Delegator delegator = (Delegator) request.getAttribute("delegator");
+
+        final String contentIdTo = request.getParameter("contentIdTo");
+        final String contentIdFrom = request.getParameter("contentIdFrom");
+        final String contentIdFromNew = request.getParameter("contentIdFromNew");
+        final String contentAssocTypeId = request.getParameter("contentAssocTypeId");
+        final Timestamp fromDate = Timestamp.valueOf(request.getParameter("fromDate"));
+
+        final Timestamp now = UtilDateTime.nowTimestamp();
+        GenericValue assoc = TransactionUtil.inTransaction(new Callable<GenericValue>() {
+            @Override
+            public GenericValue call() throws Exception {
+                GenericValue oldAssoc = delegator.findOne("ContentAssoc", UtilMisc.toMap("contentIdTo", contentIdTo, "contentId", contentIdFrom, "contentAssocTypeId", contentAssocTypeId, "fromDate", fromDate), false);
+                if (oldAssoc == null) {
+                    throw new GenericEntityNotFoundException("Could not find ContentAssoc by primary key [contentIdTo: $contentIdTo, contentId: $contentIdFrom, contentAssocTypeId: $contentAssocTypeId, fromDate: $fromDate]");
+                }
+                GenericValue newAssoc = (GenericValue) oldAssoc.clone();
+
+                oldAssoc.set("thruDate", now);
+                oldAssoc.store();
+
+                newAssoc.set("contentId", contentIdFromNew);
+                newAssoc.set("fromDate", now);
+                newAssoc.set("thruDate", null);
+                delegator.clearCacheLine(delegator.create(newAssoc));
+
+                return newAssoc;
+            }
+        }, String.format("move content [%s] from [%s] to [%s]", contentIdTo, contentIdFrom, contentIdFromNew), 0, true).call();
+
+        IOUtils.write(JSON.from(getTreeNode(assoc)).toString(), response.getOutputStream());
+
+        return "success";
+    }
+
+    public static String deleteContent(HttpServletRequest request, HttpServletResponse response) throws GenericEntityException {
+        Delegator delegator = (Delegator) request.getAttribute("delegator");
+        String contentId = request.getParameter("contentId");
+
+        deleteContent(delegator, contentId);
+
+        return "success";
+    }
+
+    public static void deleteContent(Delegator delegator, String contentId) throws GenericEntityException {
+        Timestamp now = UtilDateTime.nowTimestamp();
+        EntityCondition condition = EntityCondition.makeCondition(
+            EntityCondition.makeCondition(UtilMisc.toMap("contentIdTo", contentId)),
+            EntityUtil.getFilterByDateExpr()
+        );
+        List<GenericValue> assocs = delegator.findList("ContentAssoc", condition, null, null, null, true);
+        for (GenericValue assoc : assocs) {
+            assoc.set("thruDate", now);
+            delegator.store(assoc);
+        }
+        deleteWebPathAliases(delegator, contentId);
+    }
+
+    private static void deleteWebPathAliases(Delegator delegator, String contentId) throws GenericEntityException {
+        Timestamp now = UtilDateTime.nowTimestamp();
+        EntityCondition condition = EntityCondition.makeCondition(
+            EntityCondition.makeCondition(UtilMisc.toMap("contentId", contentId)),
+            EntityUtil.getFilterByDateExpr()
+        );
+        List<GenericValue> pathAliases = delegator.findList("WebSitePathAlias", condition, null, null, null, true);
+        for (GenericValue alias : pathAliases) {
+            alias.set("thruDate", now);
+            delegator.store(alias);
+        }
+        List<GenericValue> subContents = delegator.findList("ContentAssoc", condition, null, null, null, true);
+        for (GenericValue subContentAssoc : subContents) {
+            deleteWebPathAliases(delegator, subContentAssoc.getString("contentIdTo"));
+        }
+    }
+
+    private static Map<String, Object> getTreeNode(GenericValue assoc) throws GenericEntityException {
+        GenericValue content = assoc.getRelatedOne("ToContent", true);
+        String contentName = assoc.getString("contentIdTo");
+        if (content != null && content.getString("contentName") != null) {
+            contentName = content.getString("contentName");
+            if (contentName.length() > CONTENT_NAME_MAX_LENGTH) {
+                contentName = contentName.substring(0, CONTENT_NAME_MAX_LENGTH);
+            }
+        }
+
+        Map<String, Object> data = UtilMisc.toMap(
+            "title", (Object) contentName
+        );
+
+        Map<String, Object> attr = UtilMisc.toMap(
+            "id", assoc.get("contentIdTo"),
+            "contentId", assoc.get("contentId"),
+            "fromDate", assoc.getTimestamp("fromDate").toString(),
+            "contentAssocTypeId", assoc.get("contentAssocTypeId")
+        );
+
+        Map<String, Object> node = UtilMisc.toMap("data", (Object) data, "attr", (Object) attr);
+
+        List<GenericValue> assocChildren  = content.getRelated("FromContentAssoc", null, null, true);
+        assocChildren = EntityUtil.filterByDate(assocChildren);
+        if (!CollectionUtils.isEmpty(assocChildren)) {
+            node.put("state", "closed");
+        }
+        return node;
+    }
+}
\ No newline at end of file

Propchange: ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/ContentJsonEvents.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/ContentJsonEvents.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/ContentJsonEvents.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java Mon Apr 11 14:17:30 2016
@@ -255,11 +255,13 @@ public class ContentMapFacade implements
                 // so we're only looking for a direct alias using contentId
                 if (webSiteId != null && delegator != null) {
                     try {
+                    	
                         GenericValue webSitePathAlias = EntityQuery.use(delegator).from("WebSitePathAlias")
                                 .where("mapKey", null,
                                         "webSiteId", webSiteId,
                                         "contentId", this.contentId)
-                                .cache().queryFirst();
+                                .orderBy("-fromDate")
+                                .cache().filterByDate().queryFirst();
                         if (webSitePathAlias != null) {
                             contentUri = webSitePathAlias.getString("pathAlias");
                         }

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy Mon Apr 11 14:17:30 2016
@@ -20,38 +20,26 @@
 import org.ofbiz.entity.condition.*
 import org.ofbiz.entity.util.*
 
-webSiteContent = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "PUBLISH_POINT").orderBy("-fromDate").filterByDate().queryFirst();
+webSiteContent = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "PUBLISH_POINT").orderBy("-fromDate").cache().filterByDate().queryFirst();
 if (webSiteContent) {
     content = webSiteContent.getRelatedOne("Content", false);
     contentRoot = content.contentId;
     context.content = content;
     context.contentRoot = contentRoot;
-
-    // get all sub content for the publish point
-    subsites = from("ContentAssoc").where("contentId", contentRoot).queryList();
-    context.subsites = subsites;
 }
 
-webSiteMenu = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "MENU_ROOT").orderBy("-fromDate").queryFirst();
+webSiteMenu = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "MENU_ROOT").orderBy("-fromDate").cache().queryFirst();
 if (webSiteMenu) {
     menu = webSiteMenu.getRelatedOne("Content", false);
     menuRoot = menu.contentId;
     context.menu = menu;
     context.menuRoot = menuRoot;
-
-    // get all sub content for the menu root
-    menus = from("ContentAssoc").where("contentId", menuRoot).queryList();
-    context.menus = menus;
 }
 
-webSiteError = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "ERROR_ROOT").orderBy("-fromDate").queryFirst();
+webSiteError = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "ERROR_ROOT").orderBy("-fromDate").cache().queryFirst();
 if (webSiteError) {
     error = webSiteError.getRelatedOne("Content", false);
     errorRoot = error.contentId;
     context.error = error;
     context.errorRoot = errorRoot;
-
-    // get all sub content for the error root
-    errors = from("ContentAssoc").where("contentId", errorRoot).queryList();
-    context.errors = errors;
 }

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml Mon Apr 11 14:17:30 2016
@@ -39,6 +39,16 @@ under the License.
     </postprocessor>
     -->
 
+    <!-- workaround for use of @ofbizContentUrl tags in WYSIWYG editor image tags
+     * prevents errors from showing up in the log
+     * shows the actual images in the editor by redirecting to the actual url
+    -->
+    <request-map uri="&lt;@ofbizContentUrl&gt;">
+        <security https="true" auth="true"/>
+        <event type="groovy" invoke="component://content/webapp/content/WEB-INF/events/OfbizContentUrlEvent.groovy"/>
+        <response name="success" type="none" />
+    </request-map>
+
     <request-map uri="chain">
         <event type="java" path="org.ofbiz.webapp.event.TestEvent" invoke="test"/>
         <response name="success" type="request" value="/view"/>
@@ -443,6 +453,24 @@ under the License.
         <response name="success" type="request" value="json"/>
         <response name="error" type="request" value="json"/>
     </request-map>
+    
+    <request-map uri="getContentAssocsJson">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.content.cms.ContentJsonEvents" invoke="getContentAssocs"/>
+        <response name="success" type="none" />
+    </request-map>
+
+    <request-map uri="moveContentJson">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.content.cms.ContentJsonEvents" invoke="moveContent"/>
+        <response name="success" type="none" />
+    </request-map>
+
+    <request-map uri="deleteContentJson">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.content.cms.ContentJsonEvents" invoke="deleteContent"/>
+        <response name="success" type="none" />
+    </request-map>
 
     <!-- ================ ContentType Requests ================= -->
     <request-map uri="EditContentType">
@@ -1821,6 +1849,12 @@ under the License.
         <response name="success" type="view" value="showContentPdf"/>
     </request-map>
     
+    <request-map uri="WebSiteCmsPreview">
+        <security auth="true" https="true"/>
+        <event invoke="execute" path="org.ofbiz.content.content.WebSiteCmsPreviewEvent" type="java"/>
+        <response name="success" type="none"/>
+    </request-map>
+    
     <!-- ================ Content keyword Search Requests ================= -->
     <request-map uri="ContentSearchOptions">
         <security https="true" auth="true"/>

Modified: ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl (original)
+++ ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl Mon Apr 11 14:17:30 2016
@@ -18,22 +18,12 @@
   -->
 
 <script type="text/javascript">
-    jQuery(document).ready(function() {
-        // override elRTE save action to make "save" toolbar button work
-        elRTE.prototype.save = function() {
-            this.beforeSave();
-            cmsSave();
-        }
-    });
+    // save new content id to JS scope so it can be used by the jstree in
+    // the WebSiteCmsNav view where the newContentId is not available
+    var newContentId = ${contentId?default("'a'")};
 
     function cmsSave() {
         var simpleFormAction = '<@o...@ofbizUrl>';
-        var editor = jQuery("#cmseditor");
-        if (editor.length) {
-            var cmsdata = jQuery("#cmsdata");
-            var data = editor.elrte('val');
-            cmsdata.val(data);
-        }
 
         // get the cmsform
         var form = document.cmsform;
@@ -80,7 +70,7 @@
 <#-- cms menu bar -->
 <div id="cmsmenu" style="margin-bottom: 8px;">
     <#if (content?has_content)>
-        <a href="javascript:void(0);" onclick="javascript:callDocument(true, '${content.contentId}', '', 'ELECTRONIC_TEXT');" class="tabButton">${uiLabelMap.ContentQuickSubContent}</a>
+        <a href="javascript:void(0);" onclick="javascript:callDocument(true, '${content.contentId}', '', '', '', 'ELECTRONIC_TEXT');" class="tabButton">${uiLabelMap.ContentQuickSubContent}</a>
         <a href="javascript:void(0);" onclick="javascript:callPathAlias('${content.contentId}');" class="tabButton">${uiLabelMap.ContentPathAlias}</a>
         <a href="javascript:void(0);" onclick="javascript:callMetaInfo('${content.contentId}');" class="tabButton">${uiLabelMap.ContentMetaTags}</a>
     </#if>
@@ -327,15 +317,6 @@
                 </select>
             </td>
           </tr>
-          <tr>
-            <td colspan="2">
-              <textarea id="cmsdata" name="textData" cols="40" rows="6" style="display: none;">
-                <#if (dataText?has_content)>
-                    ${StringUtil.wrapString(dataText.textData!)}
-                </#if>
-              </textarea>
-            </td>
-          </tr>
 
           <#-- this all depends on the dataResourceTypeId which was selected -->
           <#if (dataResourceTypeId == 'IMAGE_OBJECT' || dataResourceTypeId == 'OTHER_OBJECT' || dataResourceTypeId == 'LOCAL_FILE' ||
@@ -371,13 +352,12 @@
             </tr>
           <#elseif (dataResourceTypeId == 'ELECTRONIC_TEXT')>
             <tr>
+              <td colspan="2"><h1 style="margin-top:20px">${uiLabelMap.ContentText}</h1></td>
+            </tr>
+            <tr>
               <td colspan="2">
                 <div id="editorcontainer" class="nocolumns">
-                    <div id="cmseditor" style="margin: 0; width: 100%; border: 1px solid black;">
-                    <#if (dataText?has_content)>
-                      ${StringUtil.wrapString(dataText.textData!)} 
-                    </#if>
-                    </div>
+                   <textarea style="height: 350px; width: 99%; display: inline-block; " name="textData"><#if (dataText?has_content)>${dataText.textData!}</#if></textarea>
                 </div>
               </td>
             </tr>

Modified: ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSMeta.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSMeta.ftl?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSMeta.ftl (original)
+++ ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSMeta.ftl Mon Apr 11 14:17:30 2016
@@ -29,9 +29,9 @@
 <#-- cms menu bar -->
 <div id="cmsmenu" style="margin-bottom: 8px;">
     <#if (content?has_content)>
-        <a href="javascript:void(0);" onclick="javascript:callDocument(true, '${content.contentId}', '', 'ELECTRONIC_TEXT');" class="tabButton">Quick Sub-Content</a>
-        <a href="javascript:void(0);" onclick="javascript:callPathAlias('${content.contentId}');" class="tabButton">Path Alias</a>
-        <a href="javascript:void(0);" onclick="javascript:callMetaInfo('${content.contentId}');" class="selected">Meta Tags</a>
+        <a href="javascript:void(0);" onclick="javascript:callDocument(true, '${content.contentId}', '', '', '', 'ELECTRONIC_TEXT');" class="tabButton">${uiLabelMap.ContentQuickSubContent}</a>
+        <a href="javascript:void(0);" onclick="javascript:callPathAlias('${content.contentId}');" class="tabButton">${uiLabelMap.ContentPathAlias}</a>
+        <a href="javascript:void(0);" onclick="javascript:callMetaInfo('${content.contentId}');" class="selected">${uiLabelMap.ContentMetaTags}</a>
     </#if>
 </div>
 

Modified: ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl (original)
+++ ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl Mon Apr 11 14:17:30 2016
@@ -16,29 +16,44 @@
   specific language governing permissions and limitations
   under the License.
   -->
+<script language="javascript" type="text/javascript" src="<@o...@ofbizContentUrl>"></script>
 <script language="javascript" type="text/javascript" src="<@o...@ofbizContentUrl>"></script>
 <script language="javascript" type="text/javascript" src="<@o...@ofbizContentUrl>"></script>
 <#if language?has_content && language != "en">
 <script language="javascript" src="<@o...@ofbizContentUrl>" type="text/javascript"></script><#rt/>
 </#if>
-
 <link href="/images/jquery/plugins/elrte-1.3/css/elrte.min.css" rel="stylesheet" type="text/css">
 
 <script type="text/javascript">
+    function modifyJstreeCookieToSelectNewPage() {
+        // core.initally_load and ui.initially_select don't work with the cookies plugin,
+        // so we have to modify the cookie to achieve the same.
+        // the newContentId is set in the global scope in WebSiteCmsContent.ftl because I could
+        // not get it into the context of this view using the ofbiz xml vodoofoo.
+        var contentIdFrom = '#${requestParameters.contentIdFrom!}';
+        if (typeof newContentId !== 'undefined' && contentIdFrom !== '#') {
+            $.cookie('jstree_open', $.cookie('jstree_open') + ',' + contentIdFrom);
+            $.cookie('jstree_select', '#' + newContentId);
+        }
+    };
+
     jQuery(document).ready(loadTrees);
+    <#--
     jQuery(document).ready(createEditor);
+    -->
 
     var contentRoot = '${contentRoot!}';
+    var menuRoot = '${menuRoot!}';
+    var errorRoot = '${errorRoot!}';
     var webSiteId = '${webSiteId!}';
     var editorUrl = '<@o...@ofbizUrl>';
     var aliasUrl = '<@o...@ofbizUrl>';
     var metaUrl = '<@o...@ofbizUrl>';
 
-    function loadTrees() {
-        createSubsitesTree();
-        createMenusTree();
-        createErrorTree();
-    }
+    // No drag'n'drop for nodes in subtrees with these contentIds.
+    // Adding "false" prevents creating new "root" nodes.
+    // we have no such subtrees OOTB so those are only as examples
+    var unmovableSubtrees = [false, "homeContentsRoot", "merchantContentsRoot", "categoryChildren"];
 
     function cutNameLength(name) {
         var leng = 27;
@@ -130,23 +145,7 @@ var rawdata_errors = [
     </#if>
 ];
 
-<#-------------------------------------------------------------------------------------create Tree-->
-  function createSubsitesTree() {
-    jQuery(function () {
-        jQuery("#subsites").jstree({
-            "plugins" : [ "themes", "json_data", "ui", "contextmenu", "crrm"],
-            "core" : {
-                "html_titles" : true
-            },
-            "ui" : {
-                "initially_select" : ["${parameters.contentId!}"]
-            },
-            "json_data" : {
-                "data" : rawdata_subsites,
-                "progressive_render" : false
-            },
-            'contextmenu': {
-                'items': {
+var contextmenu = { 'items': {
                     'ccp' : false,
                     'create' : false,
                     'rename' : false,
@@ -154,180 +153,259 @@ var rawdata_errors = [
                     'create1' : {
                         'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceLongText}",
                         'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'ELECTRONIC_TEXT');
+                    callDocument(true, obj.attr('id'), '', 'ELECTRONIC_TEXT');
                         }
                     },
                     'create2' : {
                         'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceShortText}",
                         'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'SHORT_TEXT');
+                    callDocument(true, obj.attr('id'), '', 'SHORT_TEXT');
                         }
                     },
                     'create3' : {
                         'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceUrlResource}",
                         'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'URL_RESOURCE');
+                    callDocument(true, obj.attr('id'), '', 'URL_RESOURCE');
                         }
                     },
                     'create4' : {
                         'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentDataResourceImage}",
                         'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'IMAGE_OBJECT');
+                    callDocument(true, obj.attr('id'), '', 'IMAGE_OBJECT');
                         }
                     },
                     'create5' : {
                         'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceVideo}",
                         'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'VIDEO_OBJECT');
+                    callDocument(true, obj.attr('id'), '', 'VIDEO_OBJECT');
                         }
                     },
                     'create6' : {
                         'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceAudio}",
                         'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'AUDIO_OBJECT');
+                    callDocument(true, obj.attr('id'), '', 'AUDIO_OBJECT');
                         }
                     },
                     'create7' : {
                         'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceOther}",
                         'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'OTHER_OBJECT');
+                    callDocument(true, obj.attr('id'), '', 'OTHER_OBJECT');
+                        }
+                    },
+                    'delete' : {
+                        'label'  : "${uiLabelMap.CommonDelete}",
+                        'action' : function (obj) {
+                            <#assign message=StringUtil.wrapString(uiLabelMap.ConfirmDeleteContent) />
+                            if (!window.confirm('${message}')) { return false; }
+                            if(this.is_selected(obj)) { this.remove(); } else { this.remove(obj); }
                         }
                     }
                 }
             }
-        });
-    });
-  }
 
-  function createMenusTree() {
-    jQuery(function () {
-        jQuery("#menus").jstree({
-            "plugins" : [ "themes", "json_data", "ui", "contextmenu", "crrm"],
+<#-------------------------------------------------------------------------------------create Tree-->
+    function createSubsitesTree() {
+        <#if contentRoot?has_content>
+        jQuery("#${contentRoot}").jstree({
+            "plugins" : [ "themes", "json_data", "ui", "cookies", "contextmenu", "crrm", "dnd"],
             "core" : {
                 "html_titles" : true
             },
             "json_data" : {
-                "data" : rawdata_menus,
-                "progressive_render" : false
-            },
-            'contextmenu': {
-                'items': {
-                    'ccp' : false,
-                    'create' : false,
-                    'rename' : false,
-                    'remove' : false,
-                    'create1' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceLongText}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'ELECTRONIC_TEXT');
+                        "ajax" : {
+                            "url" : "<@o...@ofbizUrl>",
+                            "type" : "GET",
+                            "data" : function (n) {
+                                return {
+                                    "contentId" : n.attr ? n.attr("id") : contentRoot
+                                };
+                            }
                         }
-                    },
-                    'create2' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceShortText}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'SHORT_TEXT');
-                        }
-                    },
-                    'create3' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceUrlResource}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'URL_RESOURCE');
-                        }
-                    },
-                    'create4' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentDataResourceImage}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'IMAGE_OBJECT');
+            },
+            "ui" : {
+                select_limit: 1
+            },
+            "crrm": {
+                "move" : {
+                    "default_position" : "first",
+                    "check_move" : checkMove
+                }
+            },
+            'contextmenu': contextmenu
+        }).bind("move_node.jstree", moveContent).bind("remove.jstree", deleteContent).bind("select_node.jstree", selectNode);
+        </#if>
+    }
+
+    function loadTrees() {
+        modifyJstreeCookieToSelectNewPage();
+        createSubsitesTree();
+        createMenusTree();
+        createErrorTree();
+    }
+
+    function createMenusTree() {
+        <#if menuRoot?has_content>
+            jQuery(function () {
+                jQuery("#${menuRoot}").jstree({
+                    "plugins" : [ "themes", "json_data", "ui", "cookies", "contextmenu", "crrm", "dnd"],
+                    "core" : {
+                        "html_titles" : true
+                    },
+                    "json_data" : {
+                        "ajax" : {
+                            "url" : "<@o...@ofbizUrl>",
+                            "type" : "GET",
+                            "data" : function (n) {
+                                return {
+                                    "contentId" : n.attr ? n.attr("id") : menuRoot
+                                };
                         }
-                    },
-                    'create5' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceVideo}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'VIDEO_OBJECT');
                         }
                     },
-                    'create6' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceAudio}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'AUDIO_OBJECT');
-                        }
+                    "ui" : {
+                        select_limit: 1
                     },
-                    'create7' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceOther}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'OTHER_OBJECT');
-                        }
-                    }
-                }
-            }
+                    'contextmenu': contextmenu
+                }).bind("move_node.jstree", moveContent).bind("remove.jstree", deleteContent).bind("select_node.jstree", selectNode);
         });
-    });
+        </#if>
   }
 
   function createErrorTree() {
+        <#if errorRoot?has_content>
     jQuery(function () {
-        jQuery("#errors").jstree({
-            "plugins" : [ "themes", "json_data", "ui", "contextmenu", "crrm"],
+                jQuery("#${errorRoot}").jstree({
+                    "plugins" : [ "themes", "json_data", "ui", "cookies", "contextmenu", "crrm", "dnd"],
             "core" : {
                 "html_titles" : true
             },
             "json_data" : {
-                "data" : rawdata_errors,
-                "progressive_render" : false
-            },
-            'contextmenu': {
-                'items': {
-                    'ccp' : false,
-                    'create' : false,
-                    'rename' : false,
-                    'remove' : false,
-                    'create1' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceLongText}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'ELECTRONIC_TEXT');
+                        "ajax" : {
+                            "url" : "<@o...@ofbizUrl>",
+                            "type" : "GET",
+                            "data" : function (n) {
+                                return {
+                                    "contentId" : n.attr ? n.attr("id") : errorRoot
+                                };
+                            }
                         }
                     },
-                    'create2' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceShortText}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'SHORT_TEXT');
+                    "ui" : {
+                        select_limit: 1
+            },
+                    'contextmenu': contextmenu
+                }).bind("move_node.jstree", moveContent).bind("remove.jstree", deleteContent).bind("select_node.jstree", selectNode);
+            });
+        </#if>
+    }
+
+<#-------------------------------------------------------------------------------------selectNode function-->
+    function selectNode(event, data) {
+        var node = data.rslt.obj;
+
+        if (typeof node.attr === 'undefined') {
+            return;
+        }
+
+        callDocument('', node.attr('id'), node, '');
+    }
+
+<#-------------------------------------------------------------------------------------checkMove function-->
+    function checkMove(move) {
+        // do not allow copies
+        if (move.cy == true) {
+            return false;
+        }
+
+        // determine all nodes in the paths to the root from the original and new position of the node in the tree
+        var nodesToRoot = [];
+        // move.o gives us the original position
+        nodesToRoot = jQuery.merge(nodesToRoot, move.ot.get_path(move.o, true));
+        // move.r gives us the new position
+        nodesToRoot = jQuery.merge(nodesToRoot, move.ot.get_path(move.r, true));
+
+        if (move.cr === -1 && jQuery.inArray(false, unmovableSubtrees) >= 0) {
+            return false;
                         }
-                    },
-                    'create3' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceUrlResource}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'URL_RESOURCE');
+
+        for (var i = 0; i < unmovableSubtrees.length; i++) {
+            if (jQuery.inArray(unmovableSubtrees[i], nodesToRoot) >= 0) {
+               return false;
                         }
-                    },
-                    'create4' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentDataResourceImage}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'IMAGE_OBJECT');
                         }
-                    },
-                    'create5' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceVideo}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'VIDEO_OBJECT');
+        return true;
                         }
-                    },
-                    'create6' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceAudio}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'AUDIO_OBJECT');
-                        }
-                    },
-                    'create7' : {
-                        'label' : "${uiLabelMap.CommonNew} ${uiLabelMap.ContentResourceOther}",
-                        'action' : function(obj) {
-                            callDocument(true, obj.attr('id'), '', 'OTHER_OBJECT');
-                        }
-                    }
+<#-------------------------------------------------------------------------------------moveContent function-->
+    function moveContent(event, data) {
+        var tree = data.inst;
+        var node = data.rslt.o;
+        var newParent = data.rslt.np;
+        var oldParent = data.rslt.op
+
+        if (typeof node.attr === 'undefined') {
+            return;
+        }
+
+        var ctx = {};
+        ctx['contentIdTo'] = node.attr('id');
+        ctx['contentIdFrom'] = node.attr('contentId');
+        ctx['contentIdFromNew'] = newParent.attr('id');
+        ctx['fromDate'] = node.attr('fromDate');
+        ctx['contentAssocTypeId'] = node.attr('contentAssocTypeId');
+
+        //jQuerry Ajax Request
+        jQuery.ajax({
+            url:  '<@o...@ofbizUrl>',
+            type: 'POST',
+            data: ctx,
+            error: function(msg) {
+                jQuery.jstree.rollback(data.rlbk);
+                showErrorAlert("${uiLabelMap.CommonErrorMessage2}", "${uiLabelMap.ErrorMovingContent} : " + JSON.stringify(msg));
+            },
+            success: function(msg) {
+                if (msg._ERROR_MESSAGE_) {
+                    jQuery.jstree.rollback(data.rlbk);
+                    showErrorAlert("${uiLabelMap.CommonErrorMessage2}", "${uiLabelMap.ErrorMovingContent} : " + msg._ERROR_MESSAGE_);
+                } else {
+                    var result = JSON.parse(msg);
+                    node.attr('fromDate', result.attr.fromDate);
+                    node.attr('contentId', result.attr.contentId);
+                    tree.select_node(node, true, null);
                 }
             }
         });
-    });
+    }
+
+<#-------------------------------------------------------------------------------------deleteDocument function-->
+    function deleteContent(event, data) {
+        var tree = data.inst;
+        var node = data.rslt.obj;
+        var treeNode = jQuery(node).closest('div.jstree');
+
+        if (typeof node.attr === 'undefined') {
+            return;
+        }
+
+        var ctx = {};
+        ctx['contentRoot'] = treeNode.attr('contentId');
+        ctx['webSiteId'] = webSiteId;
+        ctx['contentId'] = node.attr('id');
+
+        //jQuerry Ajax Request
+        jQuery.ajax({
+            url: '<@o...@ofbizUrl>',
+            type: 'POST',
+            data: ctx,
+            error: function(msg) {
+                showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorDeletingContent} : " + JSON.stringify(msg));
+                jQuery.jstree.rollback(data.rlbk);
+            },
+            success: function(msg) {
+                callDocument(false, node.attr('contentId'), '', '')
+            }
+        });
   }
+
 <#-------------------------------------------------------------------------------------callDocument function-->
     function callDocument(sub, contentId, objstr, dataResourceTypeId) {
         var ctx = {};
@@ -359,13 +437,15 @@ var rawdata_errors = [
             type: 'POST',
             data: ctx,
             error: function(msg) {
-                showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg);
+                showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + JSON.stringify(msg));
             },
             success: function(msg) {
                 jQuery('#cmscontent').html(msg);
 
+<#--
                 // CREATE / LOAD Editor
                 createEditor();
+-->
             }
         });
      }
@@ -375,7 +455,7 @@ var rawdata_errors = [
         if($('#cmseditor').length) {
             var opts = {
                 cssClass : 'el-rte',
-                lang     : '${language}',
+                lang     : '${language!"en"}',
                 height   : 350,
                 toolbar  : 'maxi',
                 doctype  : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', //'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">',
@@ -393,7 +473,7 @@ function callMetaInfo(contentId) {
             type: 'POST',
             data: ctx,
             error: function(msg) {
-                showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg);
+                showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + JSON.stringify(msg));
             },
             success: function(msg) {
                 jQuery('#cmscontent').html(msg);
@@ -411,7 +491,7 @@ function callMetaInfo(contentId) {
             type: 'POST',
             data: ctx,
             error: function(msg) {
-                showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg);
+                showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + JSON.stringify(msg));
             },
             success: function(msg) {
                 jQuery('#cmscontent').html(msg);
@@ -458,15 +538,15 @@ function callMetaInfo(contentId) {
     }
 
 <#-------------------------------------------------------------------------------------pathRemove function-->
-    function pathRemove(websiteId, pathAlias, contentId) {
+    function pathRemove(websiteId, pathAlias, fromDate, contentId) {
         var remAliasUrl = '<@o...@ofbizUrl>';
 
         jQuery.ajax({
                 url: remAliasUrl,
                 type: 'POST',
-                data: {"pathAlias" : pathAlias, "webSiteId" : webSiteId},
+            data: { "webSiteId" : webSiteId, "pathAlias" : pathAlias, "fromDate": fromDate},
                 error: function(msg) {
-                    showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonUnspecifiedErrorOccurred} : " + msg);
+                showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonUnspecifiedErrorOccurred} : " + JSON.stringify(msg));
                 },
                 success: function(msg) {
                     callPathAlias(contentId);
@@ -484,13 +564,14 @@ function callMetaInfo(contentId) {
                 async: false,
                 data: jQuery(form).serialize(),
                 success: function(data) {
-                    // if the content id is set reload the contentScreen
+                    // if the content id is set reload the contentScreen and tree
                     if (contentId && contentId.length) {
-                        callDocument('', contentId, '', '');
+                        callDocument('', contentId, form.contentIdFrom.value, form.fromDate.value, form.contentAssocTypeId.value, '');
+                        jQuery("#${contentRoot}").jstree('refresh', '#'+form.contentIdFrom.value);
                     }
                 },
                 error: function(msg) {
-                    showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonErrorSubmittingForm} : " + msg);
+                    showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonErrorSubmittingForm} : " + JSON.stringify(msg));
                 }
             });
         }
@@ -507,8 +588,9 @@ function callMetaInfo(contentId) {
 </div>
 <div>&nbsp;</div>
 
-<div id="subsites"></div>
-<#if (!subsites?has_content)>
+<#if (content?has_content)>
+    <div id="${contentRoot}"></div>
+<#else>
     <a href="javascript:void(0);" class="buttontext">${uiLabelMap.ContentWebSiteAddTree}</a>
 </#if>
 <div class="label">
@@ -519,8 +601,9 @@ function callMetaInfo(contentId) {
 </div>
 <div>&nbsp;</div>
 
-<div id="menus"></div>
-<#if (!menus?has_content)>
+<#if (menus?has_content)>
+    <div id="${menuRoot}"></div>
+<#else>
     <a href="javascript:void(0);" class="buttontext">${uiLabelMap.ContentWebSiteAddMenu}</a>
 </#if>
 
@@ -534,7 +617,8 @@ function callMetaInfo(contentId) {
     ${uiLabelMap.ContentWebSiteAddNewErrors}
 </div>
 <div>&nbsp;</div>
-<div id="errors"></div>
-<#if (!errors?has_content)>
+<#if (errors?has_content)>
+    <div id="${errorRoot}"></div>
+<#else>
     <a href="javascript:void(0);" class="buttontext">${uiLabelMap.ContentWebSiteAddError}</a>
 </#if>

Modified: ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSPathAlias.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSPathAlias.ftl?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSPathAlias.ftl (original)
+++ ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSPathAlias.ftl Mon Apr 11 14:17:30 2016
@@ -20,9 +20,9 @@
 <#-- cms menu bar -->
 <div id="cmsmenu" style="margin-bottom: 8px;">
     <#if (content?has_content)>
-        <a href="javascript:void(0);" onclick="javascript:callDocument(true, '${content.contentId}', '', 'ELECTRONIC_TEXT');" class="tabButton">Quick Sub-Content</a>
-        <a href="javascript:void(0);" onclick="javascript:callPathAlias('${content.contentId}');" class="selected">Path Alias</a>
-        <a href="javascript:void(0);" onclick="javascript:callMetaInfo('${content.contentId}');" class="tabButton">Meta Tags</a>
+        <a href="javascript:void(0);" onclick="javascript:callDocument(true, '${content.contentId}', '', 'ELECTRONIC_TEXT');" class="tabButton">${uiLabelMap.ContentQuickSubContent}</a>
+        <a href="javascript:void(0);" onclick="javascript:callPathAlias('${content.contentId}');" class="selected">${uiLabelMap.ContentPathAlias}</a>
+        <a href="javascript:void(0);" onclick="javascript:callMetaInfo('${content.contentId}');" class="tabButton">${uiLabelMap.ContentMetaTags}</a>
     </#if>
 </div>
 
@@ -34,24 +34,24 @@
 
 <table>
   <tr><td>
-    <table border="1" cellpadding="2" cellspacing="0" class="calendarTable">
-      <tr class="header-row">
-        <td>Web Site ID</td>
-        <td>Path Alias</td>
-        <td>Alias To</td>
-        <td>Content ID</td>
-        <td>Map Key</td>
-        <td>&nbsp;</td>
-      </tr>
+    <table border="2" cellpadding="2" cellspacing="4" class="basic-table">
       <#if (aliases?has_content)>
+          <tr class="header-row">
+            <td>Content ID</td>
+            <td>Path Alias</td>
+            <td>Map Key</td>
+            <td>From Date</td>
+            <td>Thru Date</td>
+            <td>&nbsp;</td>
+          </tr>
         <#list aliases as alias>
             <tr>
-              <td>${alias.webSiteId}</td>
-              <td>${alias.pathAlias}</td>
-              <td>${alias.aliasTo?default("N/A")}</td>
-              <td>${alias.contentId?default("N/A")}</td>
-              <td>${alias.mapKey?default("N/A")}</td>
-              <td><a href="javascript:void(0);" onclick="javascript:pathRemove('${webSiteId}', '${alias.pathAlias}', '${contentId}');" class="buttontext">Remove</a></td>
+              <td class="alternate-row">${alias.contentId?default("")}</td>
+              <td class="alternate-row">${alias.pathAlias}</td>
+              <td class="alternate-row">${alias.mapKey?default("")}</td>
+              <td class="alternate-row">${alias.fromDate?default("")}</td>
+              <td class="alternate-row">${alias.thruDate?default("")}</td>
+              <td><a href="javascript:void(0);" onclick="javascript:pathRemove('${webSiteId}', '${alias.pathAlias}', '${alias.fromDate}', '${contentId}');" class="buttontext">Remove</a></td>
             </tr>
         </#list>
       <#else>
@@ -64,17 +64,13 @@
 
   <tr><td>
     <form name="cmspathform" method="post" action="<@o...@ofbizUrl>" style="margin: 0;">
+        <input type="hidden" name="webSiteId" value="${webSiteId}"/>
+        <input type="hidden" name="contentId" value="${contentId}"/>
         <table>
             <tr><td colspan="2">&nbsp;</td></tr>
             <tr>
-                <td class="label">Web Site</td>
-                <td>${webSite.siteName?default(webSite.webSiteId)}</td>
-                <input type="hidden" name="webSiteId" value="${webSiteId}"/>
-            </tr>
-            <tr>
                 <td class="label">Content</td>
                 <td>${content.contentName?default(content.contentId)}</td>
-                <input type="hidden" name="contentId" value="${contentId}"/>
             </tr>
             <tr><td colspan="2">&nbsp;</td></tr>
             <tr>
@@ -86,6 +82,14 @@
                 <td><input type="text" name="mapKey" value="" /></td>
             </tr>
             <tr>
+                <td class="label">From Date</td>
+                <td><@htmlTemplate.renderDateTimeField name="fromDate" event="" action="" className="" alert="" title="" value="${Static['org.ofbiz.base.util.UtilDateTime'].nowTimestamp()}" size="20" maxlength="50" id="fromDate" dateType="timestamp" shortDateInput=false timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/></td>
+            </tr>
+            <tr>
+                <td class="label">Thru Date</td>
+                <td><@htmlTemplate.renderDateTimeField name="thruDate" event="" action="" className="" alert="" title="" value="" size="20" maxlength="50" id="thruDate" dateType="timestamp" shortDateInput=false timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/></td>
+            </tr>
+            <tr>
                 <td colspan="2" align="center"><input id="submit" type="button" onclick="javascript:pathSave('${contentId}');" class="smallSubmit" value="Create"/></td>
             </tr>
         </table>

Modified: ofbiz/trunk/applications/content/widget/WebSiteScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/WebSiteScreens.xml?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/widget/WebSiteScreens.xml (original)
+++ ofbiz/trunk/applications/content/widget/WebSiteScreens.xml Mon Apr 11 14:17:30 2016
@@ -181,13 +181,6 @@ under the License.
 
     <screen name="WebSiteCMSNav">
         <section>
-            <actions>
-                <set field="webSiteId" from-field="parameters.webSiteId"/>
-                <entity-one entity-name="WebSite" value-field="webSite"/>
-
-                <script location="component://content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy"/>
-                <set field="language" from-field="userLogin.lastLocale" default-value="en"/>
-            </actions>
             <widgets>
                 <screenlet title="${uiLabelMap.PageTitleWebSiteCMSNav}">
                     <platform-specific><html><html-template location="component://content/webapp/content/website/WebSiteCMSNav.ftl"/></html></platform-specific>
@@ -203,8 +196,8 @@ under the License.
                 <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
                 <property-map resource="WorkEffortUiLabels" map-name="uiLabelMap" global="true"/>
 
-                <set field="contentAssocTypeId" from-field="parameters.contentAssocTypeId"/>
                 <set field="dataResourceTypeId" from-field="parameters.dataResourceTypeId"/>
+                <set field="newContentId" from-field="contentId" />
                 <set field="contentIdFrom" from-field="parameters.contentIdFrom"/>
                 <set field="webSiteId" from-field="parameters.webSiteId"/>
                 <set field="contentId" from-field="parameters.contentId"/>
@@ -217,7 +210,6 @@ under the License.
                 <entity-one entity-name="ElectronicText" value-field="dataText">
                     <field-map field-name="dataResourceId" from-field="content.dataResourceId"/>
                 </entity-one>
-                
                 <set field="parameters.fromDate" type="Timestamp" from-field="parameters.fromDate"/>
                 <entity-condition list="assocs" entity-name="ContentAssoc">
                     <condition-list>

Modified: ofbiz/trunk/applications/content/widget/website/WebSiteForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/website/WebSiteForms.xml?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/widget/website/WebSiteForms.xml (original)
+++ ofbiz/trunk/applications/content/widget/website/WebSiteForms.xml Mon Apr 11 14:17:30 2016
@@ -96,7 +96,6 @@ under the License.
             <hyperlink target="EditWebSitePathAlias?webSiteId=${webSiteId}&amp;pathAlias=${pathAlias}" description="${pathAlias}"></hyperlink>
         </field>        
         <field name="aliasTo" sort-field="true"><display/></field>
-        <field name="mapKey" sort-field="true"><display/></field>
         <field name="contentId" sort-field="true">
             <display-entity entity-name="Content" description="${contentName}">
                 <sub-hyperlink target="EditContent" description=" [${contentId}]">
@@ -104,6 +103,9 @@ under the License.
                 </sub-hyperlink>
             </display-entity>
         </field>
+        <field name="mapKey" sort-field="true"><display/></field>
+        <field name="fromDate" sort-field="true"><display/></field>
+        <field name="thruDate" sort-field="true"><display/></field>
         <field name="deleteLink" title=" " widget-style="buttontext">
             <hyperlink target="removeWebSitePathAlias" description="${uiLabelMap.CommonDelete}" also-hidden="false">
               <parameter param-name="webSiteId"/>

Modified: ofbiz/trunk/applications/datamodel/entitydef/content-entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/datamodel/entitydef/content-entitymodel.xml?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/datamodel/entitydef/content-entitymodel.xml (original)
+++ ofbiz/trunk/applications/datamodel/entitydef/content-entitymodel.xml Mon Apr 11 14:17:30 2016
@@ -1561,11 +1561,14 @@ under the License.
         title="Web Site Path Alias">
         <field name="webSiteId" type="id-ne"></field>
         <field name="pathAlias" type="id-vlong"></field>
+        <field name="fromDate" type="date-time"></field>
+        <field name="thruDate" type="date-time"></field>
         <field name="aliasTo" type="long-varchar"></field>
         <field name="contentId" type="id"></field>
         <field name="mapKey" type="name"></field>
         <prim-key field="webSiteId"/>
         <prim-key field="pathAlias"/>
+        <prim-key field="fromDate"/>
         <relation type="one" fk-name="WSPATH_WEBSITE" rel-entity-name="WebSite">
             <key-map field-name="webSiteId"/>
         </relation>

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java?rev=1738588&r1=1738587&r2=1738588&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java Mon Apr 11 14:17:30 2016
@@ -35,6 +35,7 @@ import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.collections.PagedList;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
@@ -45,13 +46,13 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.model.DynamicViewEntity;
 import org.ofbiz.entity.model.ModelKeyMap;
-import org.ofbiz.entity.util.EntityListIterator;
 import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.security.Security;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ServiceUtil;
+import org.ofbiz.widget.renderer.Paginator;
 
 /**
  * OrderLookupServices
@@ -66,10 +67,9 @@ public class OrderLookupServices {
         Security security = dctx.getSecurity();
 
         GenericValue userLogin = (GenericValue) context.get("userLogin");
-        Integer viewIndex = (Integer) context.get("viewIndex");
-        if (viewIndex == null) viewIndex = 1;
-        Integer viewSize = (Integer) context.get("viewSize");
-        if (viewSize == null) viewSize = UtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 20);
+        Integer viewIndex = Paginator.getViewIndex(context, "viewIndex", 1);
+        Integer viewSize = Paginator.getViewSize(context, "viewSize");
+
         String showAll = (String) context.get("showAll");
         String useEntryDate = (String) context.get("useEntryDate");
         Locale locale = (Locale) context.get("locale");
@@ -582,47 +582,29 @@ public class OrderLookupServices {
         int orderCount = 0;
 
         // get the index for the partial list
-        int lowIndex = (((viewIndex.intValue() - 1) * viewSize.intValue()) + 1);
-        int highIndex = viewIndex.intValue() * viewSize.intValue();
+        int lowIndex = 0;
+        int highIndex = 0;
 
         if (cond != null) {
-            EntityListIterator eli = null;
+            PagedList<GenericValue> pagedOrderList = null;
             try {
                 // do the lookup
-                eli = EntityQuery.use(delegator)
+                pagedOrderList = EntityQuery.use(delegator)
                         .select(fieldsToSelect)
                         .from(dve)
                         .where(cond)
                         .orderBy(orderBy)
                         .distinct() // set distinct on so we only get one row per order
-                        .maxRows(highIndex)
                         .cursorScrollInsensitive()
-                        .queryIterator();
-
-                orderCount = eli.getResultsSizeAfterPartialList();
-
-                // get the partial list for this page
-                eli.beforeFirst();
-                if (orderCount > viewSize.intValue()) {
-                    orderList = eli.getPartialList(lowIndex, viewSize.intValue());
-                } else if (orderCount > 0) {
-                    orderList = eli.getCompleteList();
-                }
+                        .queryPagedList(viewIndex - 1, viewSize);
 
-                if (highIndex > orderCount) {
-                    highIndex = orderCount;
-                }
+                orderCount = pagedOrderList.getSize();
+                lowIndex = pagedOrderList.getStartIndex();
+                highIndex = pagedOrderList.getEndIndex();
+                orderList = pagedOrderList.getData();
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
                 return ServiceUtil.returnError(e.getMessage());
-            } finally {
-                if (eli != null) {
-                    try {
-                        eli.close();
-                    } catch (GenericEntityException e) {
-                        Debug.logWarning(e, e.getMessage(), module);
-                    }
-                }
             }
         }