モジュールローダ

出典: SugarForum.jp

モジュールローダは、独自モジュールのインストールだけでなく、最新パッチやテーマ、言語パック、ダッシュレットなどもインストールする事ができます。モジュールローダは、パッケージのルートディレクトリに配置された manifest.php の記述に従って、インストールを実行します。また、$upgrade_manifest を使うと、インストール済みのモジュールをアップグレードすることも可能です。

目次

マニフェストファイル

マニフェスト

$manifest 変数に記述します。

$manifest = array(
...
);
  • acceptable_sugar_flavors - Contains which Sugar Editions the package can be installed on. Accepted values are any combination of: OS (valid prior to Sugar 5.0.0), CE (valid after Sugar 5.0.0), PRO, and ENT.
  • acceptable_sugar_versions - This directive contains two arrays:
    • exact_matches: each element in this array should be one exact version string, i.e. “5.0.0e” or “5.1.0”
    • regex_matches: each element in this array should be one regular expression designed to match a group of versions, i.e. “5\\.0\\.0[a-z]”
  • author - Contains the author of the package, i.e. “SugarCRM Inc.”
  • copy_files - An array detailing the source and destination of files that should be copied during installation of the package. See the example manifest file below for details.
  • dependencies - A set of dependencies that must be satisfied to install the module. This contains two arrays:
    • id_name : the unique name found in $installdefs.
    • version: the version number.
  • description - A description of the package. Displayed during installation. Note: Apostrophes (') are not supported in your description and will cause a Module Loader error.
  • icon - A path (within the package ZIP file) to an icon image that will be displayed during installation. Examples include: “./patch_directory/icon.gif” and “./patch_directory/images/theme.gif”
  • is_uninstallable - Setting this directive to TRUE allows the Sugar administrator to uninstall the package. Setting this directive to FALSE disables the uninstall feature.
  • name - The name of the package. Displayed during installation. Note: Apostrophes (') are not supported in your description and will cause a Module Loader error.
  • published_date - The date the package was published. Displayed during installation.
  • type - The package type. Accepted values are:
    • langpack - Packages of type langpack will be automatically added to the “Language” dropdown on the Sugar Login screen. They are installed using the Upgrade Wizard.
    • module - Packages of type module are installed using the Module Loader.
    • patch - Packages of type patch are installed using the Upgrade Wizard.
    • theme - Packages of type theme will be automatically added to the “Theme” dropdown on the Sugar Login screen. They are installed using the Upgrade Wizard.
  • version - The version of the patch, i.e. “1.0” or “0.96-pre1” .

インストール定義

$installdef変数に記述します。

$installdef = array(
...
);
  • id - A unique name for your module, i.e. “Songs”
  • copy - An array detailing files to be copied to the Sugar directory. A source path and destination path must be specified for each file or directory. See the example manifest file below for details.
  • language - An array detailing individual language files for your module. The source path, destination file, and language pack name must be specified for each language file. See the example manifest file below for details.
  • layoutdefs - An array detailing individual layoutdef files, which are used primarily for setting up subpanels in other modules. The source path and destination module must be specified for each layoutdef file. See the example manifest file below for details.
  • layoutfields - An array detailing custom fields to be added to existing layouts. The fields will be added to the edit and detail views of target modules. See the example manifest file below for details.
  • vardefs - An array detailing individual vardef files, which are used primarily for defining fields and non many-to-many relationships in other modules. The source path and destination module must be specified for each vardef file. See the example manifest file below for details.
  • menu - An array detailing the menu file for your new module. A source path and destination module must be specified for each menu file. See the example manifest file below for details.
  • beans - An array specifying the bean files for your new module. The following subdirectives must be specified for each bean:
    • module: Your module’s name, e.g. “Songs”
    • class: Your module’s primary class name, e.g. “Song”
    • path: The path to your bean file where the above class is defined.
    • tab: Controls whether or not your new module appears as a tab.
  • relationships - An array detailing relationship files, used to link your new modules to existing modules. A module name, meta_data path, and module_vardefs path must be specified for each relationship. See the example manifest file below for details.
  • custom_fields - An array detailing custom fields to be installed for your new module. The following subdirectives must be specified for each custom field:
    • name: The internal name of your custom field. Note that your custom field will be referred to as <name>_c, as “_c” indicates a custom field.
    • label: The visible label of your custom field
    • type: The type of custom field. Accepted values include text, textarea, double, float, int, date, bool, enum, and relate.
    • max_size: The custom field’s maximum character storage size
    • require_option: Used to mark custom fields are either required or option. Accepted values include optional and required.
    • default_value: Used to specify a default value for your custom field
    • ext1: Used to specify a dropdown name (only applicable to enum type custom fields)
    • ext2: Unused
    • ext3: Unused
    • audited: Used to denote whether or not the custom field should be audited. Accepted values include 0 and 1.
    • module: Used to specify the module where the custom field will be added.

アップグレード定義

現在インストールされているモジュールのバージョンに合わせて、アップデートを定義できます。一つのインストーラで、初回インストールおよび、複数のバージョンからのアップグレードに対応可能です。

モジュールローダの制限について

manifest.php のサンプル


最終更新 07:38, 2010年5月8日 (土)。   このページは 3,469 回アクセスされました。