[title sub="Written by Chris Graham (ocProducts)"]Composr Tutorial: Advanced provision of downloads[/title]

This tutorial details advanced usage and features for the Composr download system.

[contents]decimal,lower-alpha[/contents]

[title="2"]Getting the downloads onto the site[/title]

[surround]
[media width="150" description="Attaching a file to a download, and charging for it" float="right"]data_custom/images/docs/tut_adv_downloads/adv_downloads_add.png[/media]
Composr provides multiple ways to get files into the download system, each appropriate for a different situation.

[title="3"]Uploading via web-form[/title]

The easiest way to add a file for a download is by attaching the file to the web-form, when the details of the download are defined. This is the most popular way, and is usually appropriate, however there are some major drawbacks (that are a result of the method, and not the fault of Composr):
 - Users with unreliable connections will not be able to resume the upload if it fails, and sometimes, it is hard to see if the upload has failed, or is just being slow
 - As far as we know none of the common web browsers show a progress monitor for the upload
 - PHP server settings often severely limit the maximum file size that may be uploaded

[title="3"]Uploading, and then referencing the URL[/title]

If a file is too large to comfortably upload by web-form, users with FTP or SFTP/SCP access to the server may wish to upload it using this, and then provide the 'Add download' form with an equivalent HTTP URL (or the direct FTP URL) to the location they upload to.
The drawbacks with this method are:
 - It is less convenient than attaching directly
 - FTP/SFTP/SCP access is required and for obvious security reasons, these details are rarely given freely. Note that there is no restriction on actually uploading the file to your website's own server, so people may reference separate web space: but this leaves the download database integrity at the mercy of this secondary web space
 - The file is not contained in Composr, and thus cannot be managed by it (for example, deleted when the download is deleted)
[/surround]

[title="3"]Batch adding from an FTP server[/title]

[media width="150" description="The FTP downloads screen" float="right"]data_custom/images/docs/tut_adv_downloads/adv_downloads_ftp_downloads.png[/media]
Composr includes a feature that allows staff to batch add files that are on an FTP server, into Composr, by FTP URL. By batch add, we mean adding large numbers of downloads in one go. This is particularly useful for adding large batches of downloads, where immediately making custom download descriptions available is not necessary.
The drawbacks with this method are:
 - Attractive descriptions have to be added separately
 - Only staff may perform this
 - The file is not contained in Composr, and thus cannot be managed by it (for example, deleted when the download is deleted)

[title="3"]Batch adding from a directory[/title]

Composr also includes a feature that allows staff to batch add files from a directory on the web server. For this to work, the directory must be accessible by URL.

The drawbacks with this method are:
 - Attractive descriptions have to be added separately
 - Only staff may perform this
 - The file is not contained in Composr, and thus cannot be managed by it (for example, deleted when the download is deleted)

[title="2"]Outmoding[/title]

When a download in the download database has a new version released, either as a direct upgrade, or by some other means (such as being bundled into a newer and wider package), the old download may be marked as 'outmoded' by the newer one.

'Outmoded' isn't a word everyone understands. Outmoded means "superseded" or "obsoleted".

To outmode a download, you need to edit the download (the original, older, download) such that the outmode field is set to refer to the newer one. When then viewed, the old download will provide a clear link to the new one.

The older download has now been 'outmoded' by the newer one.

[title="2"]Selling downloads[/title]

[surround]
[media width="150" description="A download 'for sale'" float="right"]data_custom/images/docs/tut_adv_downloads/adv_downloads_charge.png[/media]
The download system is integrated with the points system, which is useful for sites where members publish their own 'works' as downloads.

A common example of a community that would benefit from this, is a community based around the 'modding' of a computer game, where members release 'modifications' for download. Such games include 'Quake', 'The Sims', and many others.
Members may add downloads, and charge for those downloads, using the 'submitter gets points' option. Thus with this, the creators are awarded for their work by the users, using a simple form of currency; this works two ways, much like real world economies do: members are encouraged to become the 'rich members' (as entrepreneurs) as well as to generally earn points (contribute to society).

Another example is a community based upon subscription: points could be bought via a service such as PayPal (Composr at the time of writing provides no specific support for this, but staff could manually allocate points based on PayPal transactions) and the website could require spending of these points to download files.

Note that members are only charged once for a download. They may re-download (or resume), without any extra charges.
[/surround]

[title="2"]Moving download galleries[/title]

If you don't like that download galleries are placed underneath the root gallery, you can move them under a different gallery. Follow these steps:
1) Create a new container gallery from Content Management > Galleries > Add Gallery. Let's say you've given it a codename of [tt]downloads[/tt].
2) Change the "Create download galleries under" option from Admin Zone > Setup > Configuration > Feature options > Downloads, to [tt]downloads[/tt]
3) From Commandr, Admin Zone > Tools > Commandr, run this command to mass-move your existing galleries:[code="Commandr"]:$GLOBALS['SITE_DB']->query('UPDATE '.get_table_prefix().'galleries SET parent_id=\'downloads\' WHERE parent_id=\'root\' AND name LIKE \'download\_%\'');[/code]

The advantage to moving them is that then you can essentially forget about them. You can proceed to add images/videos via the direct link from when viewing a download.

[title="2"]Download licences[/title]

You may, optionally, add multiple licences to your site, and specify which licence any download uses. This is useful for sites that have copyrighted downloads, or if some kind of agreement must be agreed to before downloading.

[concepts
 1_key="Outmode"   1_value="Mark an entry as having been replaced by another one"
]Concepts[/concepts]

[title="2"]See also[/title]

 - [page="_SEARCH:tut_downloads"]Providing downloads[/page]

{$SET,tutorial_tags,Downloads,downloads,Content,regular}{$SET,tutorial_add_date,Aug 2008}{$SET,tutorial_summary,We go through some of the advanced features in the downloads system, such as batch importing, and download selling.}[block]main_tutorial_rating[/block]
