Channel Manager component with internal link picker field

255 views
Skip to first unread message

Alasdair Macrae

unread,
Mar 9, 2017, 6:34:25 AM3/9/17
to Hippo Community
I would like to create a component via the channel manager that an editor can define Strings that are the urls of other pages on the channel. I would like them to chose them via a Picker UI of sitemap items.

I know you can create pickers like image pickers using:

@Parameter(name = BACKGROUND_IMG_NAME, displayName = BACKGROUND_IMG_DISPLAY)
    @JcrPath(
            pickerConfiguration = "cms-pickers/images",
            pickerSelectableNodeTypes = {"hippogallery:imageset"},
            pickerInitialPath = "/content/gallery"
    )
    String getBackgroundImg();

Can the same be done for sitemapitems. I noticed the Hippo Essentials menu component can do this so was wondering if it could be done.

Mathijs den Burger

unread,
Mar 10, 2017, 8:46:10 AM3/10/17
to hippo-c...@googlegroups.com
Hi,

I'm afraid that's not possible. The menu component renders an "Edit menu" button [1] which has a specific UI attached to it (the 'menu editor'). That cannot be reused for component properties.

Mathijs


--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

Yaron Benjamin

unread,
Jun 14, 2017, 10:54:49 PM6/14/17
to Hippo Community
Hi mathijs.denburger Alasdair Macrae 

I was actually able to get this to work.  Though I am not sure how "supported" this approach is.  I basically created a new dialog module for pages in cms pickers.

What I did was under hippo:frontend > cms > cms-pickers I created a new frontend:plugincluster called pages-only - pointing root to the sitemap items (/hst:hst/hst:configurations/myhippoproject/hst:sitemap)  then under cms-tree-views I created a new frontend:plugincluster called pages were I added a filter for the sitemap item and changed all the roots to my hst:sitemap.  


@JcrPath(pickerConfiguration = "cms-pickers/pages-only",

        pickerSelectableNodeTypes = "hst:sitemapitem")
String getPage();

 


The end result was:

At first pass, when you select the hst sitemap item you only get the name but I be there is a way to get the whole path - 



XML from CMS Pickers:

<?xml version="1.0" encoding="UTF-8"?>

<sv:node sv:name="pages-only" xmlns:sv="http://www.jcp.org/jcr/sv/1.0">

  <sv:property sv:name="jcr:primaryType" sv:type="Name">

    <sv:value>frontend:plugincluster</sv:value>

  </sv:property>

  <sv:property sv:multiple="true" sv:name="frontend:properties" sv:type="String">

    <sv:value>root.path</sv:value>

  </sv:property>

  <sv:property sv:multiple="true" sv:name="frontend:services" sv:type="String">

    <sv:value>wicket.id</sv:value>

    <sv:value>wicket.model</sv:value>

    <sv:value>model.folder</sv:value>

  </sv:property>

  <sv:property sv:name="root.path" sv:type="String">

    <sv:value>/hst:hst/hst:configurations/myhippoproject/hst:sitemap</sv:value>

  </sv:property>

  <sv:node sv:name="navigator">

    <sv:property sv:name="jcr:primaryType" sv:type="Name">

      <sv:value>frontend:plugin</sv:value>

    </sv:property>

    <sv:property sv:name="browser.id" sv:type="String">

      <sv:value>${cluster.id}.browser</sv:value>

    </sv:property>

    <sv:property sv:name="browser.viewers" sv:type="String">

      <sv:value>cms-folder-views</sv:value>

    </sv:property>

    <sv:property sv:name="extension.list" sv:type="String">

      <sv:value>service.dialog.list</sv:value>

    </sv:property>

    <sv:property sv:name="model.default.path" sv:type="String">

      <sv:value>/hst:hst/hst:configurations/myhippoproject/hst:sitemap</sv:value>

    </sv:property>

    <sv:property sv:name="model.document" sv:type="String">

      <sv:value>${wicket.model}</sv:value>

    </sv:property>

    <sv:property sv:name="plugin.class" sv:type="String">

      <sv:value>org.hippoecm.frontend.plugins.cms.browse.Navigator</sv:value>

    </sv:property>

    <sv:property sv:name="search.viewers" sv:type="String">

      <sv:value>cms-search-views</sv:value>

    </sv:property>

    <sv:property sv:name="section.pages" sv:type="String">

      <sv:value>service.dialog.tree.page</sv:value>

    </sv:property>

    <sv:property sv:multiple="true" sv:name="sections" sv:type="String">

      <sv:value>section.pages</sv:value>

    </sv:property>

    <sv:property sv:name="wicket.variant" sv:type="String">

      <sv:value>picker</sv:value>

    </sv:property>

    <sv:node sv:name="browser.options">

      <sv:property sv:name="jcr:primaryType" sv:type="Name">

        <sv:value>frontend:pluginconfig</sv:value>

      </sv:property>

      <sv:property sv:name="list.page.size" sv:type="String">

        <sv:value>10</sv:value>

      </sv:property>

      <sv:property sv:name="list.view.size" sv:type="String">

        <sv:value>8</sv:value>

      </sv:property>

    </sv:node>

    <sv:node sv:name="yui.config.accordion">

      <sv:property sv:name="jcr:primaryType" sv:type="Name">

        <sv:value>frontend:pluginconfig</sv:value>

      </sv:property>

      <sv:property sv:name="ancestor.classname" sv:type="String">

        <sv:value>hippo-picker</sv:value>

      </sv:property>

      <sv:property sv:name="register.render.listener" sv:type="Boolean">

        <sv:value>false</sv:value>

      </sv:property>

      <sv:property sv:name="register.resize.listener" sv:type="Boolean">

        <sv:value>false</sv:value>

      </sv:property>

    </sv:node>

  </sv:node>

  <sv:node sv:name="pageTreeLoader">

    <sv:property sv:name="jcr:primaryType" sv:type="Name">

      <sv:value>frontend:plugin</sv:value>

    </sv:property>

    <sv:property sv:name="cluster.name" sv:type="String">

      <sv:value>cms-tree-views/pages</sv:value>

    </sv:property>

    <sv:property sv:name="plugin.class" sv:type="String">

      <sv:value>org.hippoecm.frontend.plugin.loader.PluginClusterLoader</sv:value>

    </sv:property>

    <sv:node sv:name="cluster.config">

      <sv:property sv:name="jcr:primaryType" sv:type="Name">

        <sv:value>frontend:pluginconfig</sv:value>

      </sv:property>

      <sv:property sv:name="bind.to.layout.unit" sv:type="Boolean">

        <sv:value>false</sv:value>

      </sv:property>

      <sv:property sv:name="root.path" sv:type="String">

        <sv:value>/hst:hst/hst:configurations/myhippoproject/hst:sitemap</sv:value>

      </sv:property>

      <sv:property sv:name="use.width.from.classname" sv:type="String">

        <sv:value>hippo-picker-tree</sv:value>

      </sv:property>

      <sv:property sv:name="wicket.id" sv:type="String">

        <sv:value>service.dialog.tree.page</sv:value>

      </sv:property>

      <sv:property sv:name="workflow.enabled" sv:type="Boolean">

        <sv:value>false</sv:value>

      </sv:property>

    </sv:node>

  </sv:node>

</sv:node>


XML from CMS Tree view:
<?xml version="1.0" encoding="UTF-8"?>
<sv:node sv:name="pages" xmlns:sv="http://www.jcp.org/jcr/sv/1.0">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>frontend:plugincluster</sv:value>
  </sv:property>
  <sv:property sv:multiple="true" sv:name="frontend:properties" sv:type="String">
    <sv:value>use.width.from.classname</sv:value>
    <sv:value>bind.to.layout.unit</sv:value>
    <sv:value>workflow.enabled</sv:value>
    <sv:value>root.path</sv:value>
  </sv:property>
  <sv:property sv:multiple="true" sv:name="frontend:references" sv:type="String">
    <sv:value>browser.id</sv:value>
    <sv:value>editor.id</sv:value>
  </sv:property>
  <sv:property sv:multiple="true" sv:name="frontend:services" sv:type="String">
    <sv:value>wicket.id</sv:value>
    <sv:value>model.folder</sv:value>
  </sv:property>
  <sv:property sv:name="model.folder" sv:type="String">
    <sv:value>${cluster.id}.model.folder</sv:value>
  </sv:property>
  <sv:property sv:name="root.path" sv:type="String">
    <sv:value>/hst:hst/hst:configurations/myhippoproject/hst:sitemap</sv:value>
  </sv:property>
  <sv:node sv:name="sectionPlugin">
    <sv:property sv:name="jcr:primaryType" sv:type="Name">
      <sv:value>frontend:plugin</sv:value>
    </sv:property>
    <sv:property sv:name="extension.tree" sv:type="String">
      <sv:value>${cluster.id}.tree</sv:value>
    </sv:property>
    <sv:property sv:name="model.folder.root" sv:type="String">
      <sv:value>${root.path}</sv:value>
    </sv:property>
    <sv:property sv:name="plugin.class" sv:type="String">
      <sv:value>org.hippoecm.frontend.plugins.cms.browse.section.SearchingSectionPlugin</sv:value>
    </sv:property>
    <sv:property sv:name="title" sv:type="String">
      <sv:value>section-pages</sv:value>
    </sv:property>
    <sv:property sv:multiple="true" sv:name="wicket.extensions" sv:type="String">
      <sv:value>extension.tree</sv:value>
      <sv:value>extension.addfolder</sv:value>
    </sv:property>
  </sv:node>
  <sv:node sv:name="pageBrowser">
    <sv:property sv:name="jcr:primaryType" sv:type="Name">
      <sv:value>frontend:plugin</sv:value>
    </sv:property>
    <sv:property sv:name="path" sv:type="String">
      <sv:value>/hst:hst/hst:configurations/myhippoproject/hst:sitemap</sv:value>
    </sv:property>
    <sv:property sv:name="plugin.class" sv:type="String">
      <sv:value>org.hippoecm.frontend.plugins.cms.browse.tree.FolderTreePlugin</sv:value>
    </sv:property>
    <sv:property sv:name="rootless" sv:type="String">
      <sv:value>false</sv:value>
    </sv:property>
    <sv:property sv:name="wicket.id" sv:type="String">
      <sv:value>${cluster.id}.tree</sv:value>
    </sv:property>
    <sv:property sv:name="wicket.model" sv:type="String">
      <sv:value>${model.folder}</sv:value>
    </sv:property>
    <sv:node sv:name="module.workflow">
      <sv:property sv:name="jcr:primaryType" sv:type="Name">
        <sv:value>frontend:plugin</sv:value>
      </sv:property>
      <sv:property sv:name="plugin.class" sv:type="String">
        <sv:value>org.hippoecm.addon.workflow.ContextWorkflowManagerPlugin</sv:value>
      </sv:property>
      <sv:property sv:multiple="true" sv:name="workflow.categories" sv:type="String">
        <sv:value>editor</sv:value>
      </sv:property>
    </sv:node>
    <sv:node sv:name="filters">
      <sv:property sv:name="jcr:primaryType" sv:type="Name">
        <sv:value>frontend:pluginconfig</sv:value>
      </sv:property>
      <sv:node sv:name="showSitemapItemsAsPages">
        <sv:property sv:name="jcr:primaryType" sv:type="Name">
          <sv:value>frontend:pluginconfig</sv:value>
        </sv:property>
        <sv:property sv:name="display" sv:type="Boolean">
          <sv:value>true</sv:value>
        </sv:property>
        <sv:property sv:name="name" sv:type="String">
          <sv:value>pages</sv:value>
        </sv:property>
        <sv:property sv:name="path" sv:type="String">
          <sv:value>/hst:sitemapitem</sv:value>
        </sv:property>
      </sv:node>
    </sv:node>
  </sv:node>
</sv:node>


On Friday, March 10, 2017 at 8:46:10 AM UTC-5, mathijs.denburger wrote:
Hi,

I'm afraid that's not possible. The menu component renders an "Edit menu" button [1] which has a specific UI attached to it (the 'menu editor'). That cannot be reused for component properties.

Mathijs

On Thu, Mar 9, 2017 at 12:34 PM, Alasdair Macrae <alasdair.j...@gmail.com> wrote:
I would like to create a component via the channel manager that an editor can define Strings that are the urls of other pages on the channel. I would like them to chose them via a Picker UI of sitemap items.

I know you can create pickers like image pickers using:

@Parameter(name = BACKGROUND_IMG_NAME, displayName = BACKGROUND_IMG_DISPLAY)
    @JcrPath(
            pickerConfiguration = "cms-pickers/images",
            pickerSelectableNodeTypes = {"hippogallery:imageset"},
            pickerInitialPath = "/content/gallery"
    )
    String getBackgroundImg();

Can the same be done for sitemapitems. I noticed the Hippo Essentials menu component can do this so was wondering if it could be done.

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-c...@googlegroups.com

RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.

Alasdair Macrae

unread,
Jun 15, 2017, 4:07:19 AM6/15/17
to Hippo Community
Oooooh - totally got to try this :)

Mathijs den Burger

unread,
Jun 15, 2017, 6:49:30 AM6/15/17
to hippo-c...@googlegroups.com
Hi Yaron,

Kudos for this creative solution :)

Creating custom picker configuration is actually something that should work fine (although it may be removed or changed in the very long run; but not for now).

But there are some caveats to be aware of. 

First, pickers are usually customized to show only (parts of) the content tree, and not so much a JCR tree outside /content. So I don't know what the 'isRelative' logic of the JcrPath annotation will do. I guess you want the path relative to the root of the sitemap item, so how to you get that? Some manual processing of the picked value?

Second, the sitemap may be split between the (static) HST configuration and the HST workspace (the latter contains the entries for the pages created in the Channel Manager). So unless you show both somehow you may not be able to pick all sitemap items.

Mathijs


To post to this group, send email to hippo-community@googlegroups.com

RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.

Dennis Vonk

unread,
Jan 17, 2018, 8:42:12 AM1/17/18
to Hippo Community
Hi All,

I was browsing through the Hippo Jira (improvements) and this request has an issue:
Maybe Hippo will provide a supported sollution in the near future.

Op donderdag 9 maart 2017 12:34:25 UTC+1 schreef Alasdair Macrae:
Reply all
Reply to author
Forward
0 new messages