Latest version 1.0.11-pl from 15.02.2019
[Russian]
May be installed with Package Manager from official MODx repository http://modx.com/extras/package/fileattach.
Allows to upload files to resources in site manager. File list is held in a table. For every file it could be set description, privacy mode (accessibility by direct link), download count, SHA1 checksum.
Custom order may be set by enabling order column in editor and dragging selected rows.
Supports MySQL and SQLSrv DB schemes.
Support download range, download continuation, paginated output.
Minimal version PHP v5.3.
Component development is here: https://gitlab.com/13hakta/FileAttach
Allows to customize view of file item output.
Name | Description |
---|---|
name | File name. When private=false internal_name equal to name |
internal_name | Internal name. File name in file system |
hash | SHA1 checksum |
description | Description |
docid | Resource ID, where file uploaded |
ext | File extension, lowercased |
id | File ID |
path | Path in media source |
private | Privacy flag |
download | Download count |
size | File size in bytes |
rank | Order in file list. May be used for custom sorting |
timestamp | Unix timestamp in seconds |
tag | Tag |
Initial chunk content:
<p>[{+description:notempty=`<strong>[[+description]]</strong><br/>`]]
<a href="[[+url]]">[[+name]]</a> <span class="badge">[[+download]]</span>
[{+size:notempty=`<br/><small>Size: [[+size]] bytes</small>`]]
[{+hash:notempty=`<br/><small>SHA1: [[+hash]]</small>`]]</p>
Outputs file list.
Name | Description | Default value |
---|---|---|
&limit | The number of files to limit per page. Show all items if not set | 0 |
&totalVar | Name of placeholder to output count of rows. Works with non-empty &limit | total |
&offset | Offset in output | 0 |
&makeURL | Generate URL for file download | false |
&outputSeparator | A string to separate each row with. | |
&privateUrl | Force private url. Allows to count downloads even with open files | false |
&resource | Show files for resource id | 0 |
&showExt | Extract file extension | false |
&showSize | Retrieve file size | false |
&showTime | Retrieve file modification time stamp | false |
&sortBy | The field to sort by. | name |
&sortDir | The direction to sort by. | ASC |
&toPlaceholder | If set, will output the content to the placeholder specified in this property, rather than outputting the content directly. | false |
&tpl | The chunk to use for each row of files. | FileAttachTpl |
&groups | Limit file list displaying to user groups. Delemitter is comma. | |
&ext | Filter by extension. Enables with &showExt |
Methods:
Name | Description | Arguments |
---|---|---|
getPath | Get file path relatively to media source root | |
getFullPath | Get full file path | |
getUrl | Get file link | |
generateName | Generate new filename | length (int) = 32 |
sanitizeName | Filter unacceptable symbol combination in file name | name (str) |
rename | Rename file | name (str) |
setPrivate | Set privacy mode | private (bool) |
getSize | Get file size |
Name | Description | Default value |
---|---|---|
calchash | Calculate file hash at upload | false |
files_path | Path relative to media source root | |
mediasource | Media source ID | 1 |
private | Make file private at upload | false |
put_docid | Upload file in subfolder <ResourceID> / | false |
templates | List of templates to activate module | |
user_folders | Upload file in subfolder <UserID> / | false |
translit | Transliterate names of uploaded files. Requires additional configuration in system options "friendly urls" | false |
Permissions list
Name | Description |
---|---|
fileattach.doclist | Manage files in resource |
fileattach.totallist | Manage all files |
fileattach.download | Permission to download files |
fileattach.remove | Permission to delete files in frontend |
fileattach.list | Listing files in frontend |
To allow user file upload you should enable access:
In frontend by default allowed to remove own files corresponding to resource. For ability to remove not only owned files you should enable permission "fileattach.totallist".
During installation set of policies are created:
Title | Description |
---|---|
File Attach | Full access |
File Attach Download | Only download |
File Attach Frontend | Allows to use processors to manage files in frontend |
Fill brackets to execute snippet code;
In simple case just call snippet:
[FileAttach]
To force download count it's needed to open files through private link:
[FileAttach? &privateUrl=`1`]
Limit list access for Editors group:
[FileAttach? &groups=`Editors`]
Custom sorting:
[FileAttach? &sortBy=`rank`]
Filter by extension:
[FileAttach? &showExt=`1` &ext=`zip`]
Look in attach.
faupm-1071.zip 5576
Size: 9240 bytes
SHA1: 2b58a4317c5f2f8608f520c36cd21f71b3ecd7f4
Метки: