Plon:如何对文件夹项目进行排序

发布于 2024-09-18 01:16:44 字数 645 浏览 2 评论 0原文

我有一个名为 myfolder 的文件夹,其中包含一些项目,例如:item1item2item3 和 item2

当我将 portlet Navigation 添加到页面的左列,并进入文件夹 myfolder 时,它向我显示了 portlet 上的链接,如下所示

  • item1
  • item3

我希望 Navigation portlet 显示精确排序的链接:

  • item2
  • item1
  • item3

我知道我可以进入 myfolder 的 Content 选项卡在此处输入代码,然后将每个项目拖到我想要的位置。
但是使用这种方式,如果我在新的 Plone Site 上重新安装所有产品,我就会丢失我的配置。因此,我希望在我的产品上配置此导航顺序,而不是仅在已安装的克隆站点上配置,以便此更改永远保留。

我怎样才能做到这一点?

I have a folder called myfolder, that has some items inside, like: item1, item2, item3, and etc.

When I added the portlet Navigation to the left column of the page, and entered on the folder myfolder, it showed me the links on the portlet like this:

  • item1
  • item2
  • item3

I want that the Navigation portlet shows me links on this exact sort:

  • item2
  • item1
  • item3

I know that I can go on the Content tab of myfolderenter code here, and drag each item to the position that I want.
But using this way, if I reinstall all my product on a new Plone Site, I lost my configuration. So I want to have this navigation order configured on my product, instead of only on a installed plone site, so that this change stays forever.

How can I do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花想c 2024-09-25 01:16:44

已解决:我可以通过在产品安装下执行以下操作来解决此问题:

#file: Extensions/Install.py
def install(portal):

    #...another steps from install

    portal = getToolByName(portal, 'portal_url')
    portal = portal.getPortalObject()

    portal.moveObjectsToTop(['item2', 'item1', 'item3', ])
    portal.plone_utils.reindexOnReorder(portal)

就是这样。

Solved: I could solve this by doing under the installation of the product:

#file: Extensions/Install.py
def install(portal):

    #...another steps from install

    portal = getToolByName(portal, 'portal_url')
    portal = portal.getPortalObject()

    portal.moveObjectsToTop(['item2', 'item1', 'item3', ])
    portal.plone_utils.reindexOnReorder(portal)

Just this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文