Дерево страниц
Skip to end of metadata
Go to start of metadata

Вы просматриваете старую версию данной страницы. Смотрите текущую версию.

Сравнить с текущим просмотр истории страницы

« Предыдущий Версия 11 Следующий »

Статус

В РАБОТЕ

Автор
КомментарийДополнительный комментарий

На этой странице:



Постановка задачи

Создать справочник "Расширенный справочник" в прикладном модуле Внутренние документы.

Справочник состоит из полей:

  • Значение
  • Описание

Расширенный справочник должен находится в разделе "Справочники\Расширенные справочники".

Создать справочник может только пользователь с ролью ClassEditor.

Инструмент

Палитра инструментов

Реализация

Этап 1. Создание формы справочника

Данный этап разделяется на три части:

Создание схемы

Схема данных описывает структуру данных объекта. Элементом Схемы данных является Свойство схемы. Свойство схемы может соответствовать одному полю документа или может являться ссылкой на другую Схему данных, описывающую составную часть объекта.


Создать схему ExtendsDirectory, в качестве наследника указать схему TNObject.

Добавить в схему свойства, которые должны быть в справочнике.

ExtendsDirectory
<?xml version='1.0' encoding='UTF-8'?>
<schemas xmlns="http://www.intertrust.ru/schema/palette/tn-schema">
  <schema extends="TNObject" name="ExtendsDirectory">
    <meta>
      <documentation>Пример расширенного справочника</documentation>
    </meta>
    <string name="type" default-value="Расширенный справочник" computed="true"/>
    <string name="showIdent" computed="true" temporal="true">
      <calc-values>
        <script lang="SPEL" event="open"><![CDATA['Справочник']]></script>
      </calc-values>
    </string>
    <string name="value">
      <meta>
        <documentation>Значение</documentation>
      </meta>
      <storage-field name="value"/>
    </string>
    <string name="description">
      <meta>
        <documentation>Описание</documentation>
      </meta>
      <storage-field name="description"/>
    </string>
  </schema>
</schemas>

Создание формы

С помощью иерархической структуры Секций и Полей описывается структура интерфейса формы –отображение объекта, описанного Схемой данных, в web-клиенте. Секцию верхнего уровня, соответствующую Схеме самостоятельного объекта, можно назвать Формой объекта. Секция верхнего уровня обязательно сопоставляется со Схемой данных, а Поля формы сопоставляются со Свойствами указанной Схемы. Способ отображения полей в web-клиенте зависит от типа Свойства Схемы.


Создать форму ExtendsDirectoryForm на основании схемы ExtendsDirectory.

На форме создать три основные секции: Header (Шапка), RootMenu (Акции), Attributes (Реквизитная часть).

В Header подключить свойства схемы: type и showIdent

В Attributes подключить свойства схемы: value и description

В RootMenu создать штатный набор действий:

  • button.hideSystem.Save=Скрыть системную кнопку Сохранить (системная операция)
  • button.Create=Создать справочник (указать схему, по которой будет создаваться форма ExtendsDirectory)
  • button.SaveNew=Сохранить (добавить системные условие применения TNObjectIsShowSaveButtonForNew)
  • button.Save=Сохранить (добавить системные условие применения TNObjectIsShowSaveButton)
  • button.Edit=Редактировать (добавить условие применения, чтобы видели пользователи с ролью ClassEditor)
  • button.Delete=Удалить (добавить js-обработчик операций и условие применения, чтобы видели пользователи с ролью Supervisor и Trash)
ExtendsDirectoryForm
<?xml version='1.0' encoding='UTF-8'?>
<ui xmlns="http://www.intertrust.ru/schema/palette/tn-ui">
  <form id="ExtendsDirectoryForm" schema-ref="ExtendsDirectory" showtabs="true" projection="default">
    <properties>
      <hide condition-union="AND">
        <negative-condition-ref ref="edit" />
        <negative-condition-ref ref="read" />
      </hide>
    </properties>
    <component>
      <section id="Header">
        <component>
          <field attribute-ref="showIdent">
            <properties>
              <read-only condition-union="AND">
                <condition>true</condition>
              </read-only>
            </properties>
            <appearance importance="normal" align="left">
              <label-style unit="symbol" width="4" />
              <alt-appearancies>
                <alt-appearance>
                  <appearance-ref ref="css_headerElementWithIcon" />
                  <enable condition-union="AND">
                    <condition>true</condition>
                  </enable>
                </alt-appearance>
              </alt-appearancies>
            </appearance>
          </field>
          <section group="true" id="Header_Top">
            <component>
              <field attribute-ref="type">
                <properties>
                  <read-only condition-union="AND">
                    <condition>true</condition>
                  </read-only>
                </properties>
                <appearance importance="normal">
                  <label-style>
                    <style id="tunFontSize14"/>
                    <style id="tunBold" />
                  </label-style>
                </appearance>
              </field>
            </component>
            <appearance field-layout="horizontal" />
          </section>
        </component>
      </section>
      <section id="RootMenu">
        <component>
          <button name="${button.hideSystem.Save:Скрыть системную кнопку Сохранить}">
            <properties>
              <hide condition-union="AND">
                <condition-ref ref="openAtDirectory" />
                <condition>true</condition>
              </hide>
            </properties>
            <action>
              <system name="SAVE" />
            </action>
          </button>
          <button name="${button.Create:Создать справочник}">
            <icon code="90" />
            <properties>
              <hide condition-union="AND">
                <negative-condition-ref ref="read"/>
              </hide>
            </properties>
            <action>
              <custom>
                <create schema-ref="ExtendsDirectory">
                  <module-current>true</module-current>
                </create>
              </custom>
            </action>
          </button>
          <button name="${button.SaveNew:Сохранить}">
            <icon code="92" />
            <properties>
              <hide condition-union="AND">
                <negative-condition-ref ref="TNObjectIsShowSaveButtonForNew" />
              </hide>
            </properties>
            <action>
              <custom>
                <save />
              </custom>
            </action>
          </button>
          <button name="${button.Save:Сохранить}">
            <icon code="92" />
            <properties>
              <hide condition-union="AND">
                <negative-condition-ref ref="TNObjectIsShowSaveButton" />
              </hide>
            </properties>
            <action>
              <custom>
                <save-existing />
              </custom>
            </action>
          </button>
          <button name="${button.Edit:Редактировать}">
            <properties>
              <hide condition-union="AND">
                <condition-ref ref="isClassEditor" />
                <condition>true</condition>
              </hide>
            </properties>
            <action>
              <system name="EDIT" />
            </action>
          </button>
          <button name="${button.Delete:Удалить}">
            <properties>
              <hide condition-union="AND">
                <negative-condition-ref ref="classifierCanDelete"/>
              </hide>
            </properties>
            <icon code="94"/>
            <action position="12">
              <custom>
                <operation>
                  <handler-ref ref="DeleteClassifier"/>
                </operation>
              </custom>
            </action>
          </button>
        </component>
      </section>
      <section name="${tab.Attributes:Реквизиты}" id="Attributes">
        <component>
          <field attribute-ref="value" name="${field.Value:Значение:}">
            <properties>
              <requre condition-union="AND">
                <negative-condition-ref ref="edit" />
                <condition>true</condition>
              </requre>
            </properties>
            <appearance importance="normal">
              <limit max-lenght="512" />
            </appearance>
          </field>
          <field attribute-ref="description" name="${field.Description:Описание:}">
            <properties>
              <requre condition-union="AND">
                <negative-condition-ref ref="edit" />
                <condition>true</condition>
              </requre>
            </properties>
            <appearance importance="normal">
              <limit max-lenght="512" />
            </appearance>
          </field>
        </component>
      </section>
    </component>
  </form>
</ui>

Создание документа

С помощью документа система предоставляет пользователь создавать его.


В документе указать:

  • схема ExtendsDirectory,
  • имя формы TunableObjectClassifier,
  • модуль InternalDocs


Расширяемый справочник
<?xml version='1.0' encoding='UTF-8'?>
<catalog xmlns="http://www.intertrust.ru/schema/palette/cat-ui">
  <tunable-object form-name="TunableObjectClassifier" name="${ExtendsDirectory:Расширенный справочник}" schema-ref="ExtendsDirectory">
    <module ident="InternalDocs"/>
  </tunable-object>
</catalog>


Этап 2. Отображение данных справочника

Создание коллекции


  • Нет меток