MODx — simple file archive FileDownload v2.6. Improved the system edit descriptions of files

Hello! Today I would like to talk about the creation of file archives on the website.

Unfortunately, I have not found a universal, there are many known FileDownload snippet v2.6, but last time it was updated in 2007. And I heard that the guys from one of the sites about MODx I write now archive and promised him to put in universal access. However, if the task is not particularly complex (for example, a trivial file list with descriptions for download in the "technical support" section), that is fine and FileDownload snippet.

image



For a start those who have not yet tried:

the

File Download 2.6

link to the snippet on modxcms.com
Description

Technical information:
Name: FileDownload
Version: 2.6
Supports: MODx Evo 1.x.x and below
Authors: Kyle Jaebker, Adam Strzelecki

The FileDownload snippet displays a list of files from specified directory for users to download. Can be used in conjunction with a FileDownload Plugin to ensure the generation of safe links (not pointing directly to a downloadable file), as well as to count the number of downloads.
The snippet supports templates and has enough parameters to modify for various purposes.

Main features of snippet:
• Count the number of downloads.
• Ability to display descriptions of files from chunk.
• Fully customizable appearance using chunks.
• Visitors can watch the subdirectory.
• The ability to serve a file.
• The ability to display the date of creation and file size.
• The possibility of differentiation of access to files in groups.

Installation:
• Download the filedownload folder to the installation directory of snippets (the folder should be 3 files: filedownload.class.inc.php, data.db.class.inc.php and filecount.txt).
• Create a new snippet — FileDownload.
• Copy the contents from a file FileDownload2.6.php in a new snippet.
• Create chunks that You will use.
• To display a list of files, call the snippet.

Sample call:
A simple call, with instructions of a directory with the files:
[!FileDownload? &getFolder=`assets/snippets/filedownload`!]
A simple call, with instructions of a directory with files and permission to use subdirectories:
[!FileDownload? &getFolder=`assets/snippets/filedownload` &browseDirectories=`1`!]

List of parameters "that would start":

&getFolder
default:
Value: a list of directories, separated by comma
Description: getFolder Parameter is used to define directories that will scan a snippet. If you specify multiple directories option &browseDirectories will not work. The symbol “/” in the set of directories is not needed.
note:
If used together with the plugin FileDownload Plugin, then the directory specified in the parameter TV FileDownloadFolder, not in the parameters when calling the snippet
Example: assets/snippets/filedownload

&browseDirectories
default: 0
Value: [ 1 | 0 ]
Description: This option allows users to view subdirectories of the directory that You specify in &getFolder. If You use this option then used the following in the template: parent & folder.

&getFile
default: null,
Value: file
Description: when filling in the snippet displays only the specified file. The getFolder parameter is still required and the file specified in getFile must be in the specified directory. Thus, the parameter allows you to download and consider download just one particular file in the directory.
Example: filedownload.php

&chkDesc
default: null,
Value: name of the chunk
Description: This option allows you to add a description to files. It specifies the name of the chunk. The syntax of the entry in the chunk should be: directory/file_name|description file||

Example:
Chunk name: fileDescription
assets/snippets/filedownload/test.pdf|This is a test pdf. It shows report stuff.||
assets/snippets/filedownload/options.gif|These are the options available to you.||


All these settings are sufficient to start to use the snippet. Other parameters You can look in the help file from the archive (in English), SDAs or in the archive FileDownload Module, which follows.

So, if You know a snippet or now tried it, I noticed that to edit the descriptions to the files is very inconvenient, especially to people dedicated (secretaries, for example). It looks like a chunk like this:
image

Well, for simple needs, can this business change, adding a simple module that I called FileDownload Module.

the

FileDownload Module

Is the Supplement, which was written for more convenient adding and editing descriptions to files.

Installation:
• Create a new module named, for example, the Editor of descriptions of the File archive.
• Copy the contents of file FileDownload Module v0.9b.php in the code window of the module. Don't forget to remove the tags <?php and ?> end of the code.
• Customize the module by changing the necessary parameters in the code.

Parameters:
$downloadFolder = 'the name of directories, separated by comma'; — a list of directories that will be scanned by the module. Specify all directories that You use when you call or various calls of the snippet.
$chunkname = 'chunk'; — the name of the chunk that stores or will store description.
$chunkid = 'chunk id'; — id of the chunk that stores or will store the description. Id of the chunk You can see in the Manage elements — > Chunks. In parentheses next to the name of the chunk will be specified Id.

How it looks:

We have in the module Manager to appear a new paragraph:
image

And when you click on it, panel modules, we will see that this simple interface:
image

All, now the customer who likes to do everything himself or through his Secretary won't round eyes, when You tell him about the system of change of descriptions to files.


so, downloads:

Module documentation
Module documentation and the snippet (all in one)

By the way, in the archive all-in-one has the bonus of icons for different file extensions, which is why, in the original archive was not.

I hope the article, the translation of the documentation snippet and the module will be useful to someone)
Article based on information from habrahabr.ru

Комментарии

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

Car navigation in detail

Google has launched an online training course advanced search

PostgreSQL: Analytics for DBA