Upload to Users CMP
Последнее обновление not available | История страницы | Улучшить эту страницу | Сообщить о проблеме
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$204 per month—let's make that $500!
Learn moreUpload to Users CMP¶
Custom Manager Page (CMP) для загрузки файлов зарегистрированным пользователям в указанную родительскую папку.
Extra: https://modx.com/extras/package/uploadtouserscmp . GitHub: https://github.com/goldsky/UploadToUsers .
Полезно для отдельных папок каждого пользователя и вывода через FileLister или FileDownload R (>=1.0.0-rc.4) по ID или username.
Examples¶
[[FileLister? &path=`assets/userfile/[[+modx.user.id]]/`]]
[[FileDownload? &getDir=`assets/userfile/[[+modx.user.username]]/`]]
С версии 1.0-pl добавлена таблица с метаданными файлов для замены имени в списке и описания.

Upload to Users Snippet¶
Сейчас только с FileDownload R, у ссылки свой placeholder.
Examples¶
Измените шаблон FileDownload с:
<tr[[+fd.class]]>
<td style="width:16px;"><img src="[[+fd.image]]" alt="[[+fd.image]]" /></td>
<td><a href="[[+fd.link]]"[[+fd.linkAttribute]]>[[+fd.filename]]</a>
<span style="font-size:80%">([[+fd.count]] downloads)</span>
</td>
<td>[[+fd.sizeText]]</td>
<td>[[+fd.date]]</td>
</tr>
[[-- This is the description row if the &chkDesc=`chunkName` is provided --]]
[[+fd.description:notempty=`<tr>
<td></td>
<td colspan="3">[[+fd.description]]</td>
</tr>`:default=``]]
на, например:
<tr[[+fd.class]]>
<td style="width:16px;"><img src="[[+fd.image]]" alt="[[+fd.image]]" /></td>
<td><a href="[[+fd.link]]"[[+fd.linkAttribute]]>
[[!uploadtousers:default=`[[+fd.filename]]`? &path=`[[+fd.fullPath]]` &field=`title`]]
</a>
<span style="font-size:80%">([[+fd.count]] downloads)</span>
</td>
<td>[[+fd.sizeText]]</td>
<td>[[+fd.date]]</td>
</tr>
<tr>
<td></td>
<td colspan="3">[[!uploadtousers? &path=`[[+fd.fullPath]]` &field=`description`]]</td>
</tr>
Вывод FileDownload изменится так:

Properties¶
| Name | Description | Default Value |
|---|---|---|
| path | полный путь к файлу/папке (mandatory) | |
| field | поле таблицы для чтения | title |
| toArray | dump вывода как array instead | |
| toPlaceholder | вывод в placeholder instead |
Поля: id, dir_path, name, title, description.
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$204 per month—let's make that $500!
Learn more










