This repository has moved to GitHub. Please visit the new repository at https://github.com/Lombiq/Orchard-Download-As.

The CodePlex page is not maintained anymore, but still here for historical reference.

Documentation

This module depends on Helpful Libraries. Please install it first!

You can see a demo of the module on the Orchard Community meeting podcast.

Usage

Notice: due to an Orchard.OutputCache bug when output caching is enabled the files retuned will be blank. To circumvent this set up OutputCache to ignore file download URLs.

Keep in mind that different output types (e.g. HTML or PDF) are in separate features.

After installation you'll get a new content part, DownloadLinkPart. You can attach this to content types where you want to display an automatic list of download links at the items. Items can be downloaded directly by opening the download URL with the following pattern: /Lombiq.DownloadAs/Download/DownloadAs/<item ID>?Extension=<file extension, e.g. html>.

The module adds some configuration options to General settings.

Containers are flattened in the following way:
  • If an item contains other items, those other items will be added to the file output too. This happens recursively, i.e. items contained by contained items are also fetched.
  • By default all contained items are taken into account and their order is their creation order.
  • If contained items are linked from the container's HTML output then these links will take precedence in two ways: their order will determine the items' order and if an item is not linked it will be not included in the output despite being contained.

Files are generated by first creating the HTML output of content items. You can customize this HTML output, and through it the file outputs in the following ways:
  • The display type used when building the output of content items is "File-<extension", e.g. "File-html".
  • The display type used when building the output of an item to see whether its contained items are linked is "File-ContainerFlattening".
  • The document shape around the list of items is called "File.ContentsWrapper" and it has the following alternates: "FileContentsWrapper<extension>" (e.g. File.ContentsWrapper-html), "FileContentsWrapper<extension><content item ID>" (e.g. File.ContentsWrapper-html-32) and "FileContentsWrapper_<content item ID>" (e.g. File.ContentsWrapper-32).

Adding new file types

The module is extensible so you can add services for supporting other file types too. For this you have to write an IFileBuildWorker implementation. Take a look at the existing implementations in the module for examples.

Version history

  • v1.0 (00.00.2013):

Last edited Nov 25, 2015 at 12:09 PM by MilanKeszthelyi, version 6