filedownloadについて

結局は使ってないです。

Muddydogpaws.com – Featuresによるfiledownloadスニペットの機能紹介
(なお、2.5版についての記述のようであるが、2.6版が新しいようだ。なお、これより以前の版についてセキュリティホールが指摘されたが、2.5版で修正されているようだ。また、これはMODxEvolution用になっており、Revolution用のものは別にFileDownloadPEというのが作成されたようだ。この日本語訳は2012.9に作成している。MODX :: Support/Comments for FileDownloadPE
MODx用のFileDownloadスニペットは、指定するディレクトリのファイルをダウンロードできるリストとして表示します。filedownloadプラグインとつなげて使うとダウンロード回数付のセキュアなダウンロードができます。組み込みのテンプレートがサポートされていますので、多数のパラメータを好きなだけカスタム化できます。

機能
・セキュアなダウンロード用にFileDownloadPluginと統合化。
・ユーザーがサブディレクトリを閲覧可能。
・各ファイルごとに出力に説明追加。
・一つのスニペット呼び出しを使って、表示するフォルダを複数指定してディレクトリをグループとして表示できます。
・フォルダやファイル用のテンプレートを含んで、テンプレートを完全にサポートします。
・データベースかファイルかにダウンロード回数を保管できます。
・テンプレートにカスタム化したクラス用のパラメータがあります(クラス拡張を含む)。
・複雑な出力オプション用に多数のプレースホルダを使えます。
・ファイル出力表示用にカスタム化した並び替えオプション。
・指定する拡張子だけを表示するフィルタ付出力。
・表示文の言語をカスタム化。
・イメージと拡張子の対応付けをチャンクに保存して、スニペット呼び出しごとに異なるイメージを設定可能。

インストール
による、インストール要領
1 snippetsディレクトリ下にfiledownloadという名前でディレクトリを作成します。
2 filedownload.class.inc.php, data.db.class.inc.php, and filecount.txt をそのディレクトリにコピーします。
3 FileDownload という名前でスニペットを作成します。
4 FileDownloadSnippet2.5.php の内容をそのスニペットのスニペット コード (php)にコピーします。
5 FileDownloadPluginを使う場合:
 FileDownloadPluginという名前のプラグインを作成します。
 FileDownloadPlugin1.0.phpの内容をそのプラグインのプラグイン コード (php)にコピーします。
 そのプラグインの設定タブで以下をプラグイン設定:のボックスに貼り付けます。
&countDownloads=Count Downloads;list;yes,no;yes
&useDbCount=Store Count Where;list;db,file;db

 設定オプションを必要に応じて設定します。
 システムイベントタブでOnWebPagePrerenderの所をチェックします。
 FileDownloadFolderという名前のテンプレート変数を作成し入力タイプをtextにします。
 FileDownloadスニペットを呼び出すドキュメントでは、テンプレート変数FileDownloadFolderに表示するディレクトリを設定します。
6 スニペット呼び出しをカスタマイズしてダウンロードリストを表示さえます。

基本的使い方
[!FileDownload? &getFolder=`assets/snippets/filedownload`!]

Muddydogpaws.com – Parameters
によるパラメータ説明

Parameters

&getFolder
default: null
values: comma delimited list of directoriesコンマで区切ったディレクトリのリスト
description: The getFolder parameter is used to specify which directories to display with the snippet. Multiple directories can be specified by seperating them with a comma. When specifying multiple directories the directory browsing functionality is no longer available. When typing a path do not include a trailing /. 表示するディレクトリを指定します。コンマで区切れば複数のディレクトリを指定できます。複数ディレクトリを指定した場合はディレクトリ閲覧機能は使えなくなります。パスを入力するのに、最後の/を入れないように。
example: assets/snippets/filedownload
&browseDirectories
default: 0
values: [ 1 | 0 ]
description: The browseDirectories parameter allows users to view subdirectories of the directory specified with the getFolder parameter. When using this feature the following templates get used: parent & folder. getFolderパラメータで指定したディレクトリのサブディレクトリのユーザーによる閲覧を可能にします。この機能を使う場合には以下のテンプレートが使われます:parent と folder。
&groupByDirectory
default: 0
values: [ 1 | 0 ]
description: When multiple directories are specified in the getFolder parameter, this parameter will group the files by folder. When grouped by folder, the directory template is used to output the path above each group. getFolderパラメータで複数のディレクトリを指定した場合、フォルダごとにファイルをグループ化するのがこのパラメータです。フォルダでグループ化された場合、各グループの下にパスを出力するのにdirectoryテンプレートが使われます。
&getFile
default: null
values: string
description: The getFile parameter will make the snippet output only the file specified. The getFolder parameter is still required and getFile should be a file inside of the directory. This allows for use of the download script and download counting with a single file. スニペットの出力を指定したファイルだけにさせるのがgetFileパラメータです。getFolderはまだ必須で、getFileはそのディレクトリ内のファイルにあるべきです。これにより、ダウンロードスクリプトを使用でき、単一ファイルのダウンロードカウントを可能にさせます。
example: filedownload.php
&chkDesc
default: null
values: the name of a chunk
description: The chkDesc parameter allows descriptions to be added to the file listing included in a chunk. All of the files and descriptions should be listed in the chunk using the following format: path to file/filename|description||
example:

chunk name: fileDescription
chunk content:
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.||
&userSort
default: filename; if &browseDirectories=`1` type,filename; if &groupByDirectory=`1` path,filename
values: [ filename | extension | path | size | sizetext | type | date | description | count ]
description: The userSort parameter allows the outputted files to be sorted by all of the fields listed above. To sort by multiple fields use a comma delimited list. When using the directory browsing feature the files will be sorted by type first, this will put the directories first in the list. When multiple folders are specified and the group by directory feature is used; the files are sorted by path first to keep the files in order by directory.
&sortOrder
default: asc
values: [ asc | desc ]
description: The sortOrder parameter makes it possible to sort files in ascending or descending order.
&showExt
default: null
values: comma delimited list of file extensions
description: The showExt parameter will limit the files displayed to files with a valid extension from the list.
example: zip,php,txt
&dateFormat
default: Y-m-d
values: PHP’s date formatting options.
description: The dateFormat parameter will change the format of the date displayed for each file in the output.
example: m/d/Y

Permissions

&downloadGroups
default: null
values: comma delimited list of web user groups
description: The downloadGroups parameter will make the download link active for users that belong to the specified groups. If a user is not logged in they will receive a JavaScript alert with the message contained in the noDownload language setting. Multiple groups can be specified by using a comma delimited list.
example: Registered Users,Admin
&deleteGroups
default: null
values: comma delimited list of web user groups
description: The parameter deleteGroups allows the specified web user groups to delete files from the listing. The link will only be displayed for users that are logged in and in the specified web user group.
example: Admin

Download Counting

&countDownloads
default: 1
values: [ 1 | 0 ]
description: With the countDownloads parameter set to 1, everytime a user downloads a file it will be tracked in a database table (fd_count) or in a file (fileCount).
&useDbCount
default: 1
values: [ 1 | 0 ]
description: The useDbCount parameter allows the count information to be stored in wither the database or in a file. The defualt setting is to include the counts in the database, to store the counts in a file set this to 0.
&skipTableCheck
default: 0
values: [ 1 | 0 ]
description: When using the database for counting downloads set this to 1 for an added speed boost. This will eliminate the check to see if the count table needs added. Do not set this to 1 when running the snippet for the first time, or the table will not get added.
&fileCount
default: assets/snippets/filedownload/filecount.txt
values: path to file
description: This is the location of the file used for download counting. When using filedownload multiple times this parameter can be changed to keep separate download counts.

Images

&imgLocat
default: null
values: path to images
description: The imgLocat parameter holds the path to the images to associate with each file extension. The images will be outputted with [+fd.image+] placeholder.
example: assets/images/icons
&imgTypes
default: null
values: name of a chunk
description: The imgTypes parameter allows for associations between file extensions and an image. The information on these associations should be put into a chunk similar to the example below. Associations should be in a comma delimited list with an equal sign between the extension and the image name. The parent extension is used for getting the image for the parent folder link when using directory browsing. The folder extension is used for getting the image to associate with a directory. The default extension is applied to all files with extensions not specified in the chunk.
example:

chunk name: fdImages
chunk content:
jpg=page_white_picture.png,
png=page_white_picture.png,
gif=page_white_picture.png,
php=page_white_php.png,
js=page_white_cup.png,
pdf=page_white_acrobat.png,
txt=page_white_text.png,
zip=page_white_zip.png,
html=page_white_world.png,
parent=arrow_up.png,
folder=folder.png,
default=page_white.png

Template & Style

&tplList
default:

<!-- This is the header template -->
<table>
<tr[+fd.class+]><td colspan="4"><strong>Path: [+fd.path+]</strong></td></tr>
<tr><th colspan="2">Filename</th><th>Filesize</th><th>Date</th></tr>
<!-- Fd:Splitter -->
<!-- This is the parent template -->
<tr[+fd.class+]>
	<td><img src="[+fd.image+]"/></td>
	<td colspan="3"><a href="[+fd.link+]">Up Level</a></td>
</tr>
<!-- Fd:Splitter -->
<!-- This is the folder template -->
<tr[+fd.class+]>
	<td><img src="[+fd.image+]"/></td>
	<td colspan="3"><a href="[+fd.link+]">[+fd.filename+]</a></td>
</tr>
<!-- Fd:Splitter -->
<!-- This is the file template -->
<tr[+fd.class+]>
	<td><img src="[+fd.image+]"/></td>
	<td><a href="[+fd.link+]">[+fd.filename+]</a> <span style="font-size:80%">([+fd.count+] downloads) [+fd.delete+]</span></td>
	<td>[+fd.sizetext+]</td>
	<td>[+fd.date+]</td>
</tr>
<tr><td></td><td colspan="3">[+fd.description+]</td></tr>
<!-- Fd:Splitter -->
<!-- This is the delete link template -->
<a href="[+fd.deletelink+]">Delete</a>
<!-- Fd:Splitter -->
<!-- This is the template used when &groupByDirectory=`1` -->
<tr[+fd.class+]>
	<td colspan="4"><strong>[+fd.directory+]</strong></td>
</tr>
<!-- Fd:Splitter -->
<!-- This is the footer template -->
</table>
values: chunk name with the above format
description: The templating for filedownload is all handled with one chunk. This chunk is split into seven sections: header, parent, folder, file, delete link, group by, and footer. All of these sections should be in the chunk template even if they are not all being used or it will not be processed correctly.
template sections:

  1. Header – Displayed at the top the filedownload output. When using directory browsing the current path is placed in this section using the following placeholders: [+fd.path+], [+fd.class+]
  2. Parent – This template is used for the link to the parent directory when directory browsing is used. Uses the same placeholders as the File template except for fd.delete and fd.filenumber.
  3. Folder – This template is used for each folder that is displayed when using the directory browsing. Uses the same placeholders as the File template except for fd.delete.
  4. File – This template is used for each file that is displayed. The following placeholders can be used: [+fd.filename+], [+fd.extension+], [+fd.path+], [+fd.size+], [+fd.sizetext+], [+fd.type+], [+fd.date+], [+fd.description+], [+fd.image+], [+fd.delete+], [+fd.count+], [+fd.link+], [+fd.class+], [+fd.filenumber+]
  5. Delete Link – This template is used to setup the link for file deleting. The template will be inserted into the [+fd.delete+] placeholder of the file template when a user has the correct permissions. The following placeholder can be used: [+fd.deletelink+]
  6. Group By – This template is used to display the path when multiple directories are called and &groupByDirectory=`1`. The following placeholders can be used: [+fd.directory+],[+fd.class+]
  7. Footer – Displayed at the bottom of the filedownload output. There are no placeholders for this template.
&splitter
default: <!– Fd:Splitter –>
values: string from tplList chunk
description: The splitter parameter should be set to the string used to seperate your templates in the chunk. If the default splitter is used or the default template is used this does not need changed.
&altCss
default: fd-alt
values: string
description: This parameter specifies the class that will be applied to every other file/folder so a ledger look can be styled.
&firstFolderCss
default: null
values: string
description: This parameter specifies the class that will be applied to the first folder.
&lastFolderCss
default: null
values: string
description: This parameter specifies the class that will be applied to the last folder.
&firstFileCss
default: null
values: string
description: This parameter specifies the class that will be applied to the first file.
&lastFileCss
default: null
values: string
description: This parameter specifies the class that will be applied to the last file.
&folderCss
default: fd-folder
values: string
description: This parameter specifies the class that will be applied to all folders.
&fileCss
default: fd-file
values: string
description: This parameter specifies the class that will be applied to all files.
&parentCss
default: fd-parent
values: string
description: This parameter specifies the class that will be applied to the parent item.
&directoryCss
default: fd-directory
values: string
description: This parameter specifies the class that will be applied to the directory for multi-folder grouping.
&pathCss
default: fd-path
values: string
description: This parameter specifies the class that will be applied to the path when using directory browsing.
&extCss
default: 0
values: [ 1 | 0 ]
description: With this parameter set to 1 a class will be added to each file with the files extension. For example, a pdf would get the class: fd-pdf.

Language

&delSuccess
default: You have deleted:
values: string
description: This message will be displayed after the successful deletion of a file. The name of the file will be appended to the end of the message.
&delError
default: There was an error deleting:
values: string
description: This message will be displayed if there was an error deleting a file. The name of the file will be appended to the end of the message.
&dirOpenError
default: Cannot open the directory:
values: string
description: This message will be displayed if the directory specified in the getFolder parameter cannot be opened.
&notaDir
default: The path specified is not a directory:
values: string
description: This message will be displayed if the directory specified in the getFolder parameter is not a directory.
&noDownload
default: You do not have permission to download this file.
values: string
description: This message will be inserted into the javascript alert if a user does not have access to download a file.

コメントを残す