如何禁用Alfresco主菜单项

如何禁用Alfresco主菜单项

本文介绍了如何禁用Alfresco主菜单项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Alfresco Share应用程序的主菜单包含几个项目,我们部署的项目团队希望禁用这些项目。特别是我的文件和共享文件。隐藏就足够了,但是如果我们可以完全禁用它们,那将是最好的。这些功能是用户无法访问的。他们所有的互动都应该通过站点进行。

The main menu on the Alfresco Share app contains a couple of items that the project team for our deployment wants to have disabled. Specifically "My Files" and "Shared Files". Hiding would be good enough, but if we can disable them completely that would be best. Those are functions that the users are not to have any access to. All their interactions should be through the sites.

是否有Alfresco支持(例如在升级版本时不会中断)?

Is there an Alfresco supported (as in "won't break when we upgrade versions") way to do this?

推荐答案

您的博客文章描述了如何隐藏链接。后来发现,这种方法不适用于4.2.2以下的版本。您的社区版本(4.2e)也是如此。

You have blog post describing how to hide main menu items at this link. It turned out later that this approach wasn't working on versions below 4.2.2. which is the case with your community version (4.2e) too.

您可以使用链接。
下面是您需要的确切代码。
share-header.get.js 的底部添加以下内容

You can use workaround described at this link.Below is the exact code you need.At the bottom of share-header.get.js add following

var widget, widgetsToRemove = [ "HEADER_SHARED_FILES", "HEADER_MY_FILES" ], idx, max;

for (idx = 0, max = widgetsToRemove.length; idx < max; idx++)
{
    findAndRemoveIn(model.jsonModel.widgets, null, null, widgetsToRemove[idx]);
}


function findAndRemoveIn(obj, arrContext, arrIdx, id) {
var idx, max, key;
if (obj !== undefined && obj !== null) {
    if (Object.prototype.toString.apply(obj) === "[object Object]") {
        if (obj.hasOwnProperty("id") && obj.id === id) {
            if (arrContext !== null && arrIdx !== null)
            { arrContext.splice(arrIdx, 1); }

            else
            { logger .debug("Unexpected match outside of array structure: " + jsonUtils.toJSONString(obj)); }

        } else {
            for (key in obj) {
                if (obj.hasOwnProperty(key))
                { findAndRemoveIn(obj[key], null, null, id); }

            }
        }
    } else if (Object.prototype.toString.apply(obj) === "[object Array]") {
        for (idx = 0, max = obj.length; idx < max; idx++)
        { findAndRemoveIn(obj[idx], obj, idx, id); }

    }
  }
}

以后您可以在工作时编写扩展模块。
可以使用帮助器功能 widgetUtils.deleteObjectFromArray 从菜单中删除其他元素,例如HEADER_NAVIGATION_MENU_BAR,HEADER_TITLE_MENU,HEADER_TITLE。
最后一个选择是使用CSS。

Later you can write extension module when you get this working.Other elements such as HEADER_NAVIGATION_MENU_BAR, HEADER_TITLE_MENU, HEADER_TITLE can be removed from menu using widgetUtils.deleteObjectFromArray helper function.Last option is to use CSS.

这篇关于如何禁用Alfresco主菜单项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 04:01