为 SugarCRM 自定义模块创建管理设置

Create Admin settings for SugarCRM custom module

我在使用 SugarCRM 8.2 为自定义模块创建管理设置参数时遇到问题。首先,在关注 this post 时,我在管理页面上创建了一个新面板,其中包含一个 link link,方法是将此代码放入 custom\Extension\modules\Administration\Ext\Administration\MonitorSugar2SvcNowAdminPanel.php:

$admin_option_defs = array();
$admin_option_defs['Administration']['MonitorSugar2SvcNowConfiguration'] = array(
 "LBL_MONITORSUGAR2SVCNOW_ADMIN_LINK",
 "LBL_MONITORSUGAR2SVCNOW_ADMIN_LINK_TITLE",
 "LBL_MONITORSUGAR2SVCNOW_ADMIN_LINK_DESC",
 "./index.php?module=snow_Sugar2SvcNowIntegration&action=monitorSugar2SvcNow-settings"
);

$admin_group_header[]= array(
 'LBL_MONITORSUGAR2SVCNOW_ADMIN_PANEL_TITLE',
 '',
 false,
 $admin_option_defs,
 'LBL_MONITORSUGAR2SVCNOW_ADMIN_PANEL_DESC'
);

接下来,我尝试让管理面板中的 link 指向带有单个文本字段的表单,管理员将能够在其中输入自定义模块用于发送的电子邮件地址自动通知。自定义模块称为 snow_Sugar2SvcNowIntegration,设置由名为 MonitorSugar2SvcNowConfiguration 的计划作业使用。在遵循开发人员指南的 this post and the "Creating Layouts" page 时,我添加了这样的布局和视图文件:

布局在custom\clients\base\layouts\monitorSugar2SvcNow-settings\monitorSugar2SvcNow-settings.php

$viewdefs['base']['layout']['monitorSugar2SvcNow-settings'] = array(
    'type' => 'simple',
    'components' => array(
        array(
            'view' => 'monitorSugar2SvcNow-settings',
        ),
    ),
);

custom\clients\base\views\monitorSugar2SvcNow-settings\monitorSugar2SvcNow-settings.hbs

中查看
<p> Hello world.</p>

控制器在 custom\clients\base\views\monitorSugar2SvcNow-settings\monitorSugar2SvcNow-settings.js

{
    className: 'monitorSugar2SvcNow-settings',
});

我这里expect就是指着<my sugar URL>/#snow_Sugar2SvcNowIntegration/layout/monitorSugar2SvcNow-settings看"Hello world"。相反,我看到了一个空白的白页。 $admin_option_defs 中指定的路由(见上文)实际上是 <sugar URL>/#snow_Sugar2SvcNowIntegration/monitorSugar2SvcNow-settings。当我转到此 URL 时,出现 "page does not exist" 错误。有人可以指出我在这里遗漏了什么吗?

没关系,我修好了。 "layout" 必须像这样添加到 $admin_option_defs 中的路由:

"./index.php?module=snow_Sugar2SvcNowIntegration&action=layout/monitorSugar2SvcNow-settings"