Вы здесь

Editview

Создание видов с редактируемыми прямо в них документами.

Модуль Editview является плагином модуля Views, который позволяет создавать виды с редактируемыми прямо в них документами; прямо из вида может быть добавлен и новый документ. Отметьте: модуль не использует JavaScript.

Установка модуля

  • Распакуйте проект в папку модулей
  • Включите Editview на странице модулей
  • Посмотрите папку patches в папке модуля и примените нужные патчи, которые позволят Editview работать с другими модулями

Использование модуля

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

Список документов будет показываться в таблице. Можно будет редактировать поля заголовка и содержания; добавлять и удалять документы.

  • Добавьте новый вид (тип вида должен быть «Документ»)
  • Добавьте поля «Документ: Заголовок» и «Документ: Содержание»
  • Добавьте критерий сортировки «Документ: Дата создания» (сортировка по убыванию)
  • Добавьте фильтр «Документ: Тип документа» и установите его значение равным page
  • Добавьте дисплей-страницу
  • Выберите для дисплея-страницы стиль «Editview»
  • Установите для дисплея-страницы путь, на котором он будет показываться

Просмотр, правка и добавление вложенных документов с основной страницы

This view uses cck, views, and editview to add the ability to see and edit a table of child nodes on a parent node page. We will relate children to parents using a cck node reference field to the child node type.

Steps:

1. Create the parent and child node types. In this example we will make organisation the parent type, and employee the child type:
1. Create organisation as a cck node type, giving it whatever fields you like.
2. Create employee as a ckk node type. One of its fields should be a node reference which you should limit to only be able to access nodes of type organisation. Make sure the node reference is a select list, not an auto-complete text field. We will be relying on not having to enter the reference manually.
3. For the node reference field, specify the following code for its default value:

            if (arg(0) == 'node' && is_numeric(arg(1))) {
              $organisation = node_load(arg(1));
              if ($organisation->type == 'organisation') {
                return array(0 => array('nid' => $organisation->nid));
              }
            }
            return array(array());

4. At this point you may want to create a few test organisations and assign each one a few employees.
2. Create a new node view, giving it a name and setting its View type to node:
1. In the default display, add all employee fields except the node reference fields
2. In the default display, add a filter on Node: type being equal to employee.
3. In the default display, add an argument on the node reference field. Select Provide default argument and use Node ID from URL.
4. Add a Block display and set its name to View Block and its title to Employees.
5. Add another Block display and set its name to Edit Block and its title to Employees.
6. For the edit block set within Basic Settings the Style to Editview. Remember to use the Override button. Set Node Type to Employee.
7. For both blocks, set within Basic Settings the Access to something sensible. Remember to use the Override button.
3. Go to the blocks admin page and enable both blocks:
1. Select a region for the view block. Configure it and select Show if the following PHP code returns TRUE with the following code:

              if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == '\ {
                $node = node_load(arg(1));
                if ($node->type == 'organisation') {
                  return true;
                }
              }
              return false;

This will only enable the block if you are viewing an organisation.
2. Select a region for the edit block. Configure it and select Show if the following PHP code returns TRUE with the following code:

              if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'edit') {
                $node = node_load(arg(1));
                if ($node->type == 'organisation') {
                  return true;
                }
              }
              return false;

This will only enable the block if you are editing an organisation.

Now when you go to an organisation node, you will see a table listing all of that organisation's employees, and when you click on its edit tab, the list of employees will become editable as well.

Зависит от: 
Группа проекта: