Group edit the resources (documents) using MIGXDB

I wonder the opportunities offered by component MIGX from Bruno17 for MODX Revolution. While he looks clumsy and there are mistakes, but the critical problem. All that is written in this article important for MIGX version 2.5.8-pl (the latter at the moment).

/ > Many people use MIGX for creating photo galleries, but its functionality is not limited. A real designer to manage data of any database tables. You can even display a list of child resources (documents of MODX) in any container. This will be discussed in this article. Something I learned from documentation MIGDB but, as I understand, it is already rather outdated and much of what is described there simply doesn't work.



I will tell you how to make a table with nested resources:


1. Open "Components" -> "MIGX". Go to the tab "MIGX". Click "Add item".
2. On the "Settings" tab to enter a name (Name) of the configuration, for example "child_resources". Click "Run".
it could be a very long time to paint what where to click and where to enter, but make it simple. I'll let the final configuration, and you will adjust under yourself.
3. Click the right mouse button on the line of our configuration and select "Export/Import".

In the field in the window that appears, paste this JSON array:
Show
{

"formtabs":[
{
"MIGX_id":1,
"caption":"Basic data",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":1,
"field":"pagetitle",
"caption":"Title",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"",
"default":""
},
{
"MIGX_id":10,
"field":"alias",
"caption":"Nickname",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"",
"default":""
},
{
"MIGX_id":6,
"field":"introtext",
"caption":"Short description",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"textarea",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"",
"default":""
},
{
"MIGX_id":7,
"field":"image",
"caption":"Picture",
"description":"",
"description_is_code":"0",
"inputTV":"image",
"inputTVtype":"",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"",
"default":""
},
{
"MIGX_id":4,
"field":"price",
"caption":"Price",
"description":"",
"description_is_code":"0",
"inputTV":"price",
"inputTVtype":"",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"",
"default":""
},
{
"MIGX_id":5,
"field":"context_key",
"caption":"Context",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"listbox",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"catalog||web",
"default":"catalog"
},
{
"MIGX_id":2,
"field":"template",
"caption":"Template",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"hidden",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"",
"default":5
},
{
"MIGX_id":8,
"field":"show_in_tree",
"caption":"Show tree?"

"description_is_code":"0",
"inputTV":"",
"inputTVtype":"listbox",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"no==0||yes==1",
"default":""
},
{
"MIGX_id":9,
"field":"published",
"caption":"Published",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"hidden",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"",
"default":1
}
]
},
{
"MIGX_id":2,
"caption":"Detailed description",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":1,
"field":"content",
"caption":"Description",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"richtext",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"",
"default":""
}
]
}
],
"contextmenus":"recall_remove_delete",
"actionbuttons":"addItem||bulk||toggletrash",
"columnbuttons":"update||publish||unpublish||recall_remove_delete",
"filters":[
{
"MIGX_id":1,
"name":"search",
"label":"search",
"emptytext":"Search...",
"type":"textbox",
"getlistwhere":{
"pagetitle:LIKE":"%[[+search]]%",
"OR:longtitle:LIKE":"%[[+search]]%",
"OR:content:LIKE":"%[[+search]]%"
},
"getcomboprocessor":"",
"combotextfield":"",
"comboidfield":"",
"comboparent":"",
"default":""
}
],
"extended":{
"migx_add":"Add",
"formcaption":"Child resource",
"update_win_title":"",
"win_id":"child_resources",
"maxRecords":"",
"addNewItemAt":"bottom",
"multiple_formtabs":"",
"extrahandlers":"",
"packageName":"",
"classname":"modResource",
"task":"resconnections",
"getlistsort":"id",
"getlistsortdir":"desc",
"use_custom_prefix":"0",
"prefix":"",
"grid":"",
"gridload_mode":1,
"check_resid":"0",
"check_resid_TV":"",
"join_alias":"",
"has_jointable":"yes",
"getlistwhere":"",
"joins":"",
"cmpmaincaption":"",
"cmptabcaption":"",
"cmptabdescription":"",
"cmptabcontroller":"",
"winbuttons":"",
"onsubmitsuccess":"",
"submitparams":""
},
"columns":[
{
"MIGX_id":1,
"header":"ID",
"dataIndex":"id",
"width":50,
"sortable":true,
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"[]"
},
{
"MIGX_id":2,
"header":"Header",
"dataIndex":"pagetitle",
"width":300,
"sortable":true,
"show_in_grid":1,
"renderer":"this.renderRowActions",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"[]"
},
{
"MIGX_id":3,
"header":"Price",
"dataIndex":"price",
"width":100,
"sortable":true,
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"[]"
},
{
"MIGX_id":4,
"header":"Published",
"dataIndex":"published",
"width":100,
"sortable":"false",
"show_in_grid":1,
"renderer":"this.renderCrossTick",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"[]"
},
{
"MIGX_id":5,
"header":"Deleted",
"dataIndex":"deleted",
"width":"",
"sortable":"false",
"show_in_grid":"0",
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"[]"
}
]

}


Ready interface for resource management.
4. To create a configuration file /core/components/migx/configs/grid/grid.child_resources.config.inc.php with this content:

the
<?php

$this->customconfigs['idfield_local'] = 'parent';
$this->customconfigs['includeTVs'] = 1;
$this->customconfigs['includeTVList'] = 'price,image';

You guessed it, includeTVList this is a list of all TV that you need in the component.
5. Again click on the line configuration "child_resources" and select "Edit". Go "Formtabs" - > "Basic data" - > "Edit". Opens a list of all fields. Here it is necessary to configure the field names and TV that you need.
6. As you can see, for the field "image" is set to "TV Input" — "image". If such a TV-parameter (optional field) has not yet been created, then you need to create it, assign the input type "Image" and make it available for the desired template. As with the other TV.
7. To open the edit field "template", go to the tab "Input Options" and in the "Default Value" enter the ID of a template child resources, which we manage using our component. Also, you should configure the field "context_key". To put it right contexts.

To make available this TV for corresponding to container resources templates.
9. This might be the end, but since MIGX still damp I had to fix the processor in the folder "/processors/mgr/resconnections/". Take out is possible SDAs. Still need to update the code of the file migx.class.php.

Now everything should work as it should.
This way you can make the control for any data. Using MIGXDB you can create and edit your tables in the database. It is written SDAs.
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

Fresh hay from the cow, or 3000 icons submitted!

Knowledge base. Part 2. Freebase: make requests to the Google Knowledge Graph