{
xtype: 'modx-combo-browser'
,name: 'image'
,value: config.record.image
,basePath: 'assets/uploads/' + CMP.user.id + '/'
,baseUrl: 'assets/uploads/' + CMP.user.id + '/'
}
{
xtype: 'modx-combo-browser'
,name: 'image'
,value: config.record.image
,source: 3 // where source 3 = 'assets/uploads/'
,openTo: CMP.user.id + '/'
}
{
xtype: 'modx-combo-browser'
,name: 'image'
,value: config.record.image
,source: 3 // where source 3 = 'assets/uploads/'
,openTo: CMP.user.id + '/'
,rootId: CMP.user.id + '/'
}
<?php
if (!function_exists('processMediaPathes')) {
function processMediaPathes($path)
{
global $modx;
$chunk = $modx->newObject('modChunk');
$chunk->setContent($path);
$chunk->setCacheable(false);
return $chunk->process();
}
}
switch ($modx->event->name) {
case 'OnMediaSourceGetProperties':
$sourceUpdateActionID = 0;
if ($object = $modx->getObject('modAction', array('namespace' => 'core', 'controller' => 'source/update', ))) {
$sourceUpdateActionID = $object->get('id');
}
$params = $modx->fromJson($scriptProperties['properties']);
// don't manpulate-path if updating mediasource
if (empty($params['processPath']) || $_REQUEST['a'] == $sourceUpdateActionID) {
$modx->event->output($scriptProperties['properties']);
return;
}
//$path = $params['basePath']['value'];
//$modx->parser->processElementTags('',$path,true,true);
$params['basePath']['value'] = processMediaPathes($params['basePath']['value']);
$params['baseUrl']['value'] = processMediaPathes($params['baseUrl']['value']);
$modx->event->output($modx->toJson($params));
/*
$debug['http_referer'] = $_SERVER['HTTP_REFERER'];
$debug['basePath'] = $params['basePath']['value'];
$chunk = $modx->getObject('modChunk', array('name' => 'debug'));
$chunk->setContent($chunk->get('snippet') . print_r($debug, 1));
$chunk->save();
*/
break;
}
return; assets/images/[[getUserID]]/
name: processPath value: 1
if (is_object($modx->resource)){
$createdby = $modx->resource->get('createdby');
//at frontend or if created resource is active, return createdby
if (!empty($createdby)){
return $createdby;
}
}
// else (backend) return userid
return $modx->user->get('id'); {
xtype: 'modx-combo-browser'
,fieldLabel: _('printing.afbeelding')
,name: 'afbeelding'
,anchor: '100%'
,source: 2
,openTo:config.record.product_id+'/'
,rootId:config.record.product_id+'/'
}