Last active
February 3, 2023 01:48
-
-
Save touol/dc849fdf8de8b86e5f63d9b76e302764 to your computer and use it in GitHub Desktop.
user_migxdb_tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input id="tv{$tv->id}" type="hidden" class="datefield" | |
value="{$tv->value}" name="tv{$tv->id}" | |
onblur="MODx.fireResourceFormChange();"/> | |
<script> | |
// <![CDATA[ | |
{literal} | |
Ext.onReady(function() { | |
var fld = MODx.load({ | |
{/literal} | |
xtype: 'xdatetime' | |
,applyTo: 'tv{$tv->id}' | |
,name: 'tv{$tv->id}' | |
,dateFormat: MODx.config.manager_date_format | |
,timeFormat: MODx.config.manager_time_format | |
{if $params.disabledDays|default},disabledDays: {$params.disabledDays|default}{/if} | |
{if $params.minDateValue|default},minDateValue: '{$params.minDateValue|default}'{/if} | |
{if $params.maxDateValue|default},maxDateValue: '{$params.maxDateValue|default}'{/if} | |
{if $params.startDay|default},startDay: {$params.startDay|default}{/if} | |
{if $params.minTimeValue|default},minTimeValue: '{$params.minTimeValue|default}'{/if} | |
{if $params.maxTimeValue|default},maxTimeValue: '{$params.maxTimeValue|default}'{/if} | |
{if $params.timeIncrement|default},timeIncrement: {$params.timeIncrement|default}{/if} | |
{if $params.hideTime|default},hideTime: {$params.hideTime|default}{/if} | |
,dateWidth: 198 | |
,timeWidth: 198 | |
,allowBlank: {if $params.allowBlank == 1 || $params.allowBlank == 'true'}true{else}false{/if} | |
,value: '{$tv->value}' | |
,msgTarget: 'under' | |
{literal} | |
,listeners: { 'change': { fn:MODx.fireResourceFormChange, scope:this}} | |
}); | |
var mainPanel = Ext.getCmp("modx-panel-resource"); | |
if (mainPanel) Ext.getCmp('modx-panel-resource').getForm().add(fld); | |
}); | |
{/literal} | |
// ]]> | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<model package="history" baseClass="xPDOObject" platform="mysql" defaultEngine="InnoDB" phpdoc-package="" phpdoc-subpackage="" version="1.1"> | |
<object class="historyItem" table="history_items" extends="xPDOSimpleObject"> | |
<field key="resource_id" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" /> | |
<field key="date" dbtype="datetime" phptype="datetime" null="true" /> | |
<field key="deposit1" dbtype="varchar" phptype="string" precision="100" null="false" default="" /> | |
<field key="deposit2" dbtype="varchar" phptype="string" precision="100" null="false" default="" /> | |
<field key="deposit3" dbtype="varchar" phptype="string" precision="100" null="false" default="" /> | |
</object> | |
</model> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"formtabs":[ | |
{ | |
"MIGX_id":1, | |
"caption":"history", | |
"print_before_tabs":"0", | |
"fields":[ | |
{ | |
"MIGX_id":4, | |
"field":"date", | |
"caption":"\u0414\u0430\u0442\u0430", | |
"description":"", | |
"description_is_code":"0", | |
"inputTV":"", | |
"inputTVtype":"date", | |
"validation":"", | |
"configs":"", | |
"restrictive_condition":"", | |
"display":"", | |
"sourceFrom":"config", | |
"sources":"", | |
"inputOptionValues":"", | |
"default":"", | |
"useDefaultIfEmpty":"0", | |
"pos":1 | |
}, | |
{ | |
"MIGX_id":5, | |
"field":"deposit1", | |
"caption":"\u0421\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u044b\u0439 \u0432\u0437\u043d\u043e\u0441", | |
"description":"", | |
"description_is_code":"0", | |
"inputTV":"", | |
"inputTVtype":"", | |
"validation":"", | |
"configs":"", | |
"restrictive_condition":"", | |
"display":"", | |
"sourceFrom":"config", | |
"sources":"", | |
"inputOptionValues":"", | |
"default":"", | |
"useDefaultIfEmpty":"0", | |
"pos":2 | |
}, | |
{ | |
"MIGX_id":6, | |
"field":"deposit2", | |
"caption":"\u0427\u043b\u0435\u043d\u0441\u043a\u0438\u0439 \u0432\u0437\u043d\u043e\u0441", | |
"description":"", | |
"description_is_code":"0", | |
"inputTV":"", | |
"inputTVtype":"", | |
"validation":"", | |
"configs":"", | |
"restrictive_condition":"", | |
"display":"", | |
"sourceFrom":"config", | |
"sources":"", | |
"inputOptionValues":"", | |
"default":"", | |
"useDefaultIfEmpty":"0", | |
"pos":3 | |
}, | |
{ | |
"MIGX_id":7, | |
"field":"deposit3", | |
"caption":"\u041f\u0430\u0435\u0432\u043e\u0439 \u0432\u0437\u043d\u043e\u0441", | |
"description":"", | |
"description_is_code":"0", | |
"inputTV":"", | |
"inputTVtype":"", | |
"validation":"", | |
"configs":"", | |
"restrictive_condition":"", | |
"display":"", | |
"sourceFrom":"config", | |
"sources":"", | |
"inputOptionValues":"", | |
"default":"", | |
"useDefaultIfEmpty":"0", | |
"pos":4 | |
} | |
], | |
"pos":1 | |
} | |
], | |
"contextmenus":"update||remove", | |
"actionbuttons":"addItem", | |
"columnbuttons":"", | |
"filters":"", | |
"extended":{ | |
"migx_add":"", | |
"disable_add_item":"", | |
"add_items_directly":"", | |
"formcaption":"", | |
"update_win_title":"", | |
"win_id":"history", | |
"maxRecords":"", | |
"addNewItemAt":"bottom", | |
"media_source_id":"", | |
"multiple_formtabs":"", | |
"multiple_formtabs_label":"", | |
"multiple_formtabs_field":"", | |
"multiple_formtabs_optionstext":"", | |
"multiple_formtabs_optionsvalue":"", | |
"actionbuttonsperrow":4, | |
"winbuttonslist":"", | |
"extrahandlers":"", | |
"filtersperrow":4, | |
"packageName":"history", | |
"classname":"historyItem", | |
"task":"", | |
"getlistsort":"", | |
"getlistsortdir":"", | |
"sortconfig":"", | |
"gridpagesize":"", | |
"use_custom_prefix":"0", | |
"prefix":"", | |
"grid":"", | |
"gridload_mode":2, | |
"check_resid":1, | |
"check_resid_TV":"", | |
"join_alias":"", | |
"has_jointable":"yes", | |
"getlistwhere":"", | |
"joins":"", | |
"hooksnippets":"", | |
"cmpmaincaption":"\u0418\u0441\u0442\u043e\u0440\u0438\u044f", | |
"cmptabcaption":"\u0418\u0441\u0442\u043e\u0440\u0438\u044f", | |
"cmptabdescription":"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e", | |
"cmptabcontroller":"", | |
"winbuttons":"", | |
"onsubmitsuccess":"", | |
"submitparams":"" | |
}, | |
"permissions":{ | |
"apiaccess":"", | |
"view":"", | |
"list":"", | |
"save":"", | |
"create":"", | |
"remove":"", | |
"delete":"", | |
"publish":"", | |
"unpublish":"", | |
"viewdeleted":"", | |
"viewunpublished":"" | |
}, | |
"fieldpermissions":"", | |
"columns":[ | |
{ | |
"MIGX_id":3, | |
"header":"id", | |
"dataIndex":"id", | |
"width":"", | |
"sortable":"false", | |
"show_in_grid":1, | |
"customrenderer":"", | |
"renderer":"", | |
"clickaction":"", | |
"selectorconfig":"", | |
"renderchunktpl":"", | |
"renderoptions":"", | |
"editor":"" | |
}, | |
{ | |
"MIGX_id":4, | |
"header":"\u0414\u0430\u0442\u0430", | |
"dataIndex":"date", | |
"width":"", | |
"sortable":true, | |
"show_in_grid":1, | |
"customrenderer":"", | |
"renderer":"", | |
"clickaction":"", | |
"selectorconfig":"", | |
"renderchunktpl":"", | |
"renderoptions":"", | |
"editor":"" | |
}, | |
{ | |
"MIGX_id":5, | |
"header":"\u0421\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u044b\u0439 \u0432\u0437\u043d\u043e\u0441", | |
"dataIndex":"deposit1", | |
"width":"", | |
"sortable":true, | |
"show_in_grid":1, | |
"customrenderer":"", | |
"renderer":"", | |
"clickaction":"", | |
"selectorconfig":"", | |
"renderchunktpl":"", | |
"renderoptions":"", | |
"editor":"" | |
}, | |
{ | |
"MIGX_id":6, | |
"header":"\u0427\u043b\u0435\u043d\u0441\u043a\u0438\u0439 \u0432\u0437\u043d\u043e\u0441", | |
"dataIndex":"deposit2", | |
"width":"", | |
"sortable":true, | |
"show_in_grid":1, | |
"customrenderer":"", | |
"renderer":"", | |
"clickaction":"", | |
"selectorconfig":"", | |
"renderchunktpl":"", | |
"renderoptions":"", | |
"editor":"" | |
}, | |
{ | |
"MIGX_id":7, | |
"header":"\u041f\u0430\u0435\u0432\u043e\u0439 \u0432\u0437\u043d\u043e\u0441", | |
"dataIndex":"deposit3", | |
"width":"", | |
"sortable":true, | |
"show_in_grid":1, | |
"customrenderer":"", | |
"renderer":"", | |
"clickaction":"", | |
"selectorconfig":"", | |
"renderchunktpl":"", | |
"renderoptions":"", | |
"editor":"" | |
} | |
], | |
"category":"" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input id="tv{$tv->id}" name="tv{$tv->id}" | |
type="text" class="textfield" | |
value="{$tv->get('value')|escape}" | |
{$style|default} | |
tvtype="{$tv->type}" | |
/> | |
<script> | |
// <![CDATA[ | |
{literal} | |
Ext.onReady(function() { | |
var fld = MODx.load({ | |
{/literal} | |
xtype: 'textfield' | |
,applyTo: 'tv{$tv->id}' | |
,width: '99%' | |
,enableKeyEvents: true | |
,msgTarget: 'under' | |
,allowBlank: {if $params.allowBlank == 1 || $params.allowBlank == 'true'}true{else}false{/if} | |
{if $params.minLength|default},minLength: {$params.minLength|default}{/if} | |
{if $params.maxLength|default},maxLength: {$params.maxLength|default}{/if} | |
{if $params.regex|default},regex: new RegExp('{$params.regex|default}'){/if} | |
{if $params.regexText|default},regexText: '{$params.regexText|default}'{/if} | |
{literal} | |
,listeners: { 'keydown': { fn:MODx.fireResourceFormChange, scope:this}} | |
}); | |
var mainPanel = Ext.getCmp("modx-panel-resource"); | |
if (mainPanel) Ext.getCmp('modx-panel-resource').getForm().add(fld); | |
MODx.makeDroppable(fld); | |
}); | |
{/literal} | |
// ]]> | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// error_reporting(E_ALL); | |
// ini_set('display_errors', 1); | |
switch ($modx->event->name) { | |
case 'OnUserFormPrerender': | |
$controller = &$modx->controller; | |
//инициализация migx | |
require_once MODX_CORE_PATH . 'components/migx/model/migx/migx.class.php'; | |
$migx = new MIGX($modx); | |
$modx->lexicon->load('migx:default'); | |
//заносим имя конфигурации migx. У меня history | |
$migx->config['cmptabs'] = 'history'; | |
$modx->migx = &$migx; | |
$modx->regClientCSS($migx->config['cssUrl'] . 'mgr.css'); | |
$controller->addJavascript($migx->config['jsUrl'] . 'mgr/migx.js'); | |
$controller->addHtml('<script type="text/javascript"> | |
Ext.onReady(function() { | |
Migx.config = ' . $modx->toJSON($migx->config) . '; | |
}); | |
</script>'); | |
$tv = ''; | |
$migx->loadLang(); | |
$params = array(); | |
//получаем скрипты migx | |
$panelJs = $migx->prepareCmpTabs($params, $controller, $tv); | |
//заменяем resource_id в скриптах | |
$panelJs = str_replace("resource_id: ''","resource_id: ".(int)$_GET['id']."",$panelJs); | |
$controller->addJavascript($controller->modx->getOption('manager_url') . 'assets/modext/util/datetime.js'); | |
$controller->addJavascript($controller->modx->getOption('manager_url') . 'assets/modext/widgets/element/modx.panel.tv.renders.js'); | |
//выводим скрипты migx на страницу пользователя | |
$controller->addHtml('<script type="text/javascript">' . $panelJs . '</script>'); | |
//подключаем скрипты migx в таб пользователя | |
$controller->addHtml(" | |
<script> | |
Ext.ComponentMgr.onAvailable('modx-user-tabs', function() { | |
this.on('beforerender', function() { | |
this.add({ | |
title: 'История', | |
xtype: 'migx-panel-home' | |
,object_id: Migx.config.request.object_id | |
,configs: Migx.config.request.configs | |
}); | |
}); | |
}); | |
</script>" | |
); | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment