Document module improvements, take 3.
-Can now store more than one level of directory structure within the documents directory.
(this information is stored in the new path_depth field in the documents sql table entry)
-Incorporated into Rod's pdf report creation in custom report and in the Document module
CCD/CCR document viewer.
-Also will use/create random directories (0-10000) when importing a document that is not
mapped to a patient to avoid all the documents being placed into one directory.
-Also created some document functions (such as addNewDocument()) in library/documents.php
to ease importing new documents in API etc.
-Incorporated addNewDocument() function in phimail direct module.
NOTE that there is a previous bug noted where documents within the CouchDB server will
not work in the Document module CCD/CCR viewer. I did not address this bug on this commit.