In-Portal Developers Guide

This is a wiki-based Developers Guide for In-Portal Open Source CMS. The purpose of this guide is to provide advanced users, web developers and programmers with documentation on how to expand, customize and improve the functionality and the code the In-Portal software. Please consider contributing to our documentation writing effort.

K4:Структура директорий

From In-Portal Developers Guide

Jump to: navigation, search
Line 22: Line 22:
-
Ниже применяются следующие сокращения:
+
The following abbreviations will be used below:
-
  '''prefix''' - префикс от [[K4:Unit Configs|unit config]] в '''единственном числе''', напр. event (в единственном числе, из-за правил английского языка)
+
  '''prefix''' - prefix of [[K4:Unit Configs|unit config]] in '''singular form''', for example, event (singular because of rules of the English language)
-
  '''prefixx''' - префикс от unit config, только во множественном числе
+
  '''prefixx''' - prefix from the unity config, only plural
-
  '''helper''' - класс помощник (наследник от класса kHelper)
+
  '''helper''' - class helper (child of class kHelper)
-
== Расположение файлов ==
+
== Location of Files ==
-
* для каждого префикса создаётся директория <code>'''prefixx'''</code> (напр. <code>'''themes'''</code>)
+
* a directory is created for each prefix <code>'''prefixx'''</code> (for example <code>'''themes'''</code>)
-
* в этой директории должен быть как минимум один файл - <code>'''''<directory_name>''_config.php'''</code>, содержащий unit config
+
* this directory must contain, minimally, one file - <code>'''''<directory_name>''_config.php'''</code>, which is the unit config
-
* все остальные файлы в директории называются согласно правилу названия файлов
+
* all other files in the directory are named corresponding to file naming conventions
-
* также, в директории <code>units</code> от модуля, можно создать 2 независимые директории <code>helpers</code> и <code>sections</code>. В директорию <code>helpers</code> надо класть все независимые (т.е., те с которыми будет работать не только один prefix) helpers. В директорию <code>sections</code> нужно класть все классы, которые заменяют другие классы. Для обеих директорий соответственно надо создать (или скопировать из другого проекта) unit configs.
+
* also, in the <code>units</code> directory of the module, it's allowed to create two independent directories <code>helpers</code> and <code>sections</code>. All the independent helpers (i.e. those with which more than one config may work) should be put in the <code>helpers</code> directory. All classes that are replacing other classes must be put in the <code>sections</code> directory. Correspondingly, unit configs must be created (or copied from another project) for both directories.
-
* в корневой директории модуля (напр. custom) можно создать файл '''constants.php''' в котором можно задать все необходимые для конкретного проекта [[K4:Константы|константы]].
+
* in the root directory of the module (for example, custom) a file can be created called '''constants.php''', in which all [[K4:Константы|constants]] necessary for the project can be placed.
-
== Какие файлы можно менять ==
+
== Which files can be changed ==
-
Допускается изменение файлов в следующих директориях:
+
Files can be changed only in the following directories:
-
* директория модуля <code>"custom"</code> (весь специфичный для проекта код) <source lang="bash"><project_name>/custom</source>
+
* files in the directory of the module <code>"custom"</code> (all code specific to the project) <source lang="bash"><project_name>/custom</source>
-
* директория с темой для Front-End <source lang="bash"><project_name>/themes/theme_<project_name></source>
+
* files in the directory for the Front-End theme <source lang="bash"><project_name>/themes/theme_<project_name></source>
-
{{InfoBox|Файлы в остальных папках изменять и делать commit запрещено.}}
+
{{InfoBox|Changing and committing files in other directories is prohibited}}
-
В отдельных случаях, напр. когда
+
In some cases there are exceptions to the above rules, for example when
-
* требуемой функциональности не достичь без изменения файлов K4
+
* the required functionality can't be realized without changes to K4 files
-
* требуется сделать частичный [[K4:Обновление проектов|upgrade]] проекта (для экономии времени)
+
* a partial [[K4:Обновление проектов|upgrade]] is being done for a project (to saved time), in which case all other files can be changed, but with care, and with permission of your management
-
можно менять остальные файлы, но предварительно требуется получить разрешение от своего руководителя.
+

Revision as of 22:20, 28 March 2009

Структура приложения Структура приложения
Статьи в этой категории

Projects written using K4 have a module-based structure. Each module is a directory in the root directory of the site. All modules have the same sub-directory structure, as described below:

название описание
module/admin_templates Directory that contains module templates used for the administrative console.
module/admin_templates/img Directory that contains images used by the module.
module/admin_templates/img/icons Directory where the icons used in the left tree menu and above grids in the administrative console are located. The specifics about how the files in this directory should be named are written here.
module/admin_templates/img/itemicons The directory which contains the icons that are show next to each record in the list of records (only for In-Portal). The names of the files in this directory must start with the prefix "icon16_" and follow naming convention rules.
module/admin_templates/img/toolbar This directory contains icons for each button in the toolbar, which is unique to each module. How to name icons used in the toolbar is written here.
module/install This directory contains files used for installation of the specific module.
module/units Directory that contains PHP code.


The following abbreviations will be used below:

prefix - prefix of unit config in singular form, for example, event (singular because of rules of the English language)
prefixx - prefix from the unity config, only plural
helper - class helper (child of class kHelper)

Location of Files

  • a directory is created for each prefix prefixx (for example themes)
  • this directory must contain, minimally, one file - <directory_name>_config.php, which is the unit config
  • all other files in the directory are named corresponding to file naming conventions
  • also, in the units directory of the module, it's allowed to create two independent directories helpers and sections. All the independent helpers (i.e. those with which more than one config may work) should be put in the helpers directory. All classes that are replacing other classes must be put in the sections directory. Correspondingly, unit configs must be created (or copied from another project) for both directories.
  • in the root directory of the module (for example, custom) a file can be created called constants.php, in which all constants necessary for the project can be placed.

Which files can be changed

Files can be changed only in the following directories:

  • files in the directory of the module "custom" (all code specific to the project)
    <project_name>/custom
  • files in the directory for the Front-End theme
    <project_name>/themes/theme_<project_name>
Image:Infobox Icon.gif Changing and committing files in other directories is prohibited

In some cases there are exceptions to the above rules, for example when

  • the required functionality can't be realized without changes to K4 files
  • a partial upgrade is being done for a project (to saved time), in which case all other files can be changed, but with care, and with permission of your management