在 Sugarcrm 自定义模块中创建文件类型字段 [英] making a file type field in sugarcrm custom module

查看:35
本文介绍了在 Sugarcrm 自定义模块中创建文件类型字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义模块样本管理.我想在 editviewdef.php 中创建一个文件类型字段,以便我可以上传文件并在需要时从详细视图下载它.有人能告诉我如何进行这项任务的步骤吗?

i have a custom module Sample Management. I want to create a file type field in editviewdef.php so that i can upload the file and download it from the detailed view whenever needed. Would anyone tell me the steps how to proceed for this task?

推荐答案

如果您是通过 Module Builder 创建模块,只需将 'file' => 1, 添加到 $config 变量 (config.php).然后您就可以向您的 editviewdefs.php 添加一个新的上传文件字段:

If you are creating the module through Module Builder, just add 'file' => 1, to the 'templates' array in $config variable (config.php). Then you'll be able to add a new upload file field to your editviewdefs.php:

      1 =>
      array (
        'name' => 'uploadfile',
        'displayParams' =>
        array (
          'onchangeSetFileNameTo' => 'document_name',
        ),
      ),

不要忘记将表单和javascript元素添加到editviewdefs.php中的templateMeta数组中:

Don't forget to add the form and javascript elements to the templateMeta array in editviewdefs.php:

  'form' =>
  array (
    'enctype' => 'multipart/form-data',
    'hidden' =>
    array (
    ),
  ),
  'javascript' => '<script type="text/javascript" src="include/javascript/popup_parent_helper.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>
    <script type="text/javascript" src="include/javascript/sugar_grp_jsolait.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>
    <script type="text/javascript" src="modules/Documents/documents.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>',

您还需要将uploadfile字段添加到detailvidefs.php:

You also need to add the uploadfile field to detailvidefs.php:

      1 =>
      array (
        'name' => 'uploadfile',
        'displayParams' =>
        array (
          'link' => 'uploadfile',
          'id' => 'id',
        ),
      ),

希望这会有所帮助!

这篇关于在 Sugarcrm 自定义模块中创建文件类型字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆