OFBiz
  1. OFBiz
  2. OFBIZ-4502

Improved CMS tree: more functionality and faster for large trees

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Implemented
    • Affects Version/s: Trunk
    • Fix Version/s: Upcoming Branch
    • Component/s: content
    • Labels:
      None
    • Sprint:
      Bug Crush Event - 21/2/2015

      Description

      We here at Lusini did several improvements to the CMS backend to make it more useable for large CMS installations.

      • Improved performance of CMS tree
        • loading nodes dynamically using AJAX
          • Created ContentJsonEvents to handle the JSON calls
        • use OFBiz entity caches
        • removed duplicate execution of WebSitePublishPoint.groovy
          • removed reference from controller.xml as it is not used anywhere
      • Moving nodes in CMS tree possible now using drag'n'drop
        • ContentJsonEvents returns updated node attributes
        • Adjusted WebSiteCMSNav.ftl to update the moved node with the data from the ajax request
        • Needed to replace the jstree jQuery plugin by the current version available on the jstree website
      • Made nodes deleteable
        • added remove to context menu
        • We did not want to delete the WebSitePathAlias entities right away, so we added a fromDate and thruDate to it.
          • extended WebSitePathAlias entity definition: added fromDate and thruDate
          • now checking for date range everywhere when accessing path aliases
          • This also allows users to publish or unpublish contents under a certain URL automatically at some time in the future.
        • created event to "delete" a node
          • thruDate of all assocs pointing to this node are set to current timestamp
          • thruDate of WebSitePathAliases pointing to this content or any contents below are set to current timestamp
          • this way nothing is actually removed from the DB and a "undo" would be possible if necessary
        • extracted context menu to variable so it can be reused for all trees
      • fixed missing references to uiLabels in CMS menu bar
      • Activated cookie plugin so the selected node is remembered

      To migrate existing path aliases the following SQL statements can be used:

      BEGIN;

      UPDATE web_site_path_alias SET from_date=w.created_stamp FROM web_site_path_alias w WHERE w.path_alias=web_site_path_alias.path_alias;

      ALTER TABLE web_site_path_alias
      DROP CONSTRAINT pk_web_site_path_alias,
      ADD CONSTRAINT pk_web_site_path_alias PRIMARY KEY (web_site_id, path_alias, from_date);

      COMMIT;

      1. CMS-Tree-Improvement.patch
        480 kB
        Martin Kreidenweis
      2. CMS-Tree-Improvement-2.patch
        480 kB
        Christoph Neuroth
      3. OFBIZ-4502.patch
        64 kB
        james yong
      4. Image 109.png
        99 kB
        Jacques Le Roux
      5. OFBIZ-4502.showErrorTree.patch
        0.6 kB
        james yong

        Issue Links

          Activity

          Hide
          Jacques Le Roux added a comment -

          While completing https://cwiki.apache.org/confluence/display/OFBIZ/Revisions+Requiring+Data+Migration+-+upgrade+ofbiz

          I quickly tried this in EntitySQLProcessor, it does not work.

              BEGIN;
              UPDATE web_site_path_alias SET from_date=w.created_stamp FROM web_site_path_alias w WHERE w.path_alias=web_site_path_alias.path_alias;
              ALTER TABLE web_site_path_alias
                  DROP CONSTRAINT pk_web_site_path_alias,
                  ADD CONSTRAINT pk_web_site_path_alias PRIMARY KEY (web_site_id, path_alias, from_date);
              COMMIT;
          

          We need instead to provide a migrateWebSitePathAlias migrating service.

          Show
          Jacques Le Roux added a comment - While completing https://cwiki.apache.org/confluence/display/OFBIZ/Revisions+Requiring+Data+Migration+-+upgrade+ofbiz I quickly tried this in EntitySQLProcessor, it does not work. BEGIN; UPDATE web_site_path_alias SET from_date=w.created_stamp FROM web_site_path_alias w WHERE w.path_alias=web_site_path_alias.path_alias; ALTER TABLE web_site_path_alias DROP CONSTRAINT pk_web_site_path_alias, ADD CONSTRAINT pk_web_site_path_alias PRIMARY KEY (web_site_id, path_alias, from_date); COMMIT; We need instead to provide a migrateWebSitePathAlias migrating service.
          Hide
          Jacques Le Roux added a comment -

          The Web Site Errors/Web Site Add New Errors part now works again as it was before the new features.

          Show
          Jacques Le Roux added a comment - The Web Site Errors/Web Site Add New Errors part now works again as it was before the new features.
          Hide
          Jacques Le Roux added a comment -

          Thanks James,

          Your modified patch is in trunk at revision: 1738614

          I put back the cmseditor id for ELECTRONIC_TEXT in WebSiteCMSContent.ftl and added back the createEditor() call in callDocument function jQuerry Ajax Request

          Show
          Jacques Le Roux added a comment - Thanks James, Your modified patch is in trunk at revision: 1738614 I put back the cmseditor id for ELECTRONIC_TEXT in WebSiteCMSContent.ftl and added back the createEditor() call in callDocument function jQuerry Ajax Request
          Hide
          james yong added a comment -

          This patch should fix the missing error tree bug

          Show
          james yong added a comment - This patch should fix the missing error tree bug
          Hide
          Jacques Le Roux added a comment -

          BTW, forgot to say I made few changes in your patch

          • 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
          Show
          Jacques Le Roux added a comment - BTW, forgot to say I made few changes in your patch 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
          Hide
          Jacques Le Roux added a comment -

          So I wait a bit before closing this issue

          Show
          Jacques Le Roux added a comment - So I wait a bit before closing this issue
          Hide
          Jacques Le Roux added a comment - - edited

          James,

          I committed your modified patch in trunk at revisions: 1738588 + 1738590. There is still one thing which makes me wonder. It's about adding errors. It used to work this way in trunk

          But it's no longer working

          Show
          Jacques Le Roux added a comment - - edited James, I committed your modified patch in trunk at revisions: 1738588 + 1738590. There is still one thing which makes me wonder. It's about adding errors. It used to work this way in trunk But it's no longer working
          Hide
          Jacques Le Roux added a comment -

          Thanks James,

          After a 1st review and tests, it looks good, I will double-check...

          Show
          Jacques Le Roux added a comment - Thanks James, After a 1st review and tests, it looks good, I will double-check...
          Hide
          james yong added a comment -

          This updated patch is smaller; jsTree.js is not included as trunk could be more recent.

          Show
          james yong added a comment - This updated patch is smaller; jsTree.js is not included as trunk could be more recent.
          Hide
          james yong added a comment -

          I will try to create an updated patch

          Show
          james yong added a comment - I will try to create an updated patch
          Hide
          Jacques Le Roux added a comment -

          Unfortunately this patch no longer applies, it has been neglected for too long :/

          Show
          Jacques Le Roux added a comment - Unfortunately this patch no longer applies, it has been neglected for too long :/
          Hide
          Christoph Neuroth added a comment -

          We further improved the CMS Tree patch - it will now automatically open the parent of the new content and select it.

          What's your opinion on the patch? Any problems that block integrating our changes?

          Show
          Christoph Neuroth added a comment - We further improved the CMS Tree patch - it will now automatically open the parent of the new content and select it. What's your opinion on the patch? Any problems that block integrating our changes?
          Hide
          Christoph Neuroth added a comment -

          New version of our patch, applied against current trunk.

          Show
          Christoph Neuroth added a comment - New version of our patch, applied against current trunk.
          Hide
          Martin Kreidenweis added a comment -

          the patch

          Show
          Martin Kreidenweis added a comment - the patch

            People

            • Assignee:
              Jacques Le Roux
              Reporter:
              Martin Kreidenweis
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development

                  Agile