ArticleFileManager Class Reference
[File]

Class defining operations for article file management. More...

Inheritance diagram for ArticleFileManager:

FileManager

List of all members.

Public Member Functions

 ArticleFileManager ($articleId)
 copyAndRenameFile ($sourceFileId, $sourceRevision, $destType, $destFileId=null)
 copyAttachmentFile ($url, $mimeType, $fileId=null, $overwrite=true, $assocId=null)
 copyPublicFile ($url, $mimeType, $fileId=null, $overwrite=true)
 copySuppFile ($url, $mimeType, $fileId=null, $overwrite=true)
 copyToCopyeditFile ($fileId, $revision=null)
 copyToEditorFile ($fileId, $revision=null, $destFileId=null)
 copyToLayoutFile ($fileId, $revision=null)
 copyToReviewFile ($fileId, $revision=null, $destFileId=null)
 deleteArticleTree ()
 deleteFile ($fileId, $revision=null)
 downloadFile ($fileId, $revision=null, $inline=false)
generateDummyFile (&$article)
 generateFilename (&$articleFile, $type, $originalName)
getFile ($fileId, $revision=null)
 handleCopy ($url, $mimeType, $type, $fileId=null, $overwrite=false)
 handleUpload ($fileName, $type, $fileId=null, $overwrite=false)
 handleWrite ($fileName, &$contents, $mimeType, $type, $fileId=null, $overwrite=false)
 readFile ($fileId, $revision=null, $output=false)
 removePriorRevisions ($fileId, $revision)
 temporaryFileToArticleFile (&$temporaryFile, $type, $assocId=null)
 typeToPath ($type)
 uploadCopyeditFile ($fileName, $fileId=null)
 uploadEditorDecisionFile ($fileName, $fileId=null)
 uploadLayoutFile ($fileName, $fileId=null, $overwrite=true)
 uploadPublicFile ($fileName, $fileId=null, $overwrite=true)
 uploadReviewFile ($fileName, $fileId=null)
 uploadSubmissionFile ($fileName, $fileId=null, $overwrite=false)
 uploadSubmissionNoteFile ($fileName, $fileId=null, $overwrite=true)
 uploadSuppFile ($fileName, $fileId=null, $overwrite=true)
 viewFile ($fileId, $revision=null)
 writePublicFile ($fileName, &$contents, $mimeType, $fileId=null, $overwrite=true)
 writeSuppFile ($fileName, &$contents, $mimeType, $fileId=null, $overwrite=true)


Detailed Description

Class defining operations for article file management.

Article directory structure: [article id]/note [article id]/public [article id]/submission [article id]/submission/original [article id]/submission/review [article id]/submission/editor [article id]/submission/copyedit [article id]/submission/layout [article id]/supp [article id]/attachment

Definition at line 43 of file ArticleFileManager.inc.php.


Member Function Documentation

ArticleFileManager.ArticleFileManager ( articleId  ) 

Constructor. Create a manager for handling article file uploads.

Parameters:
$articleId int

Definition at line 59 of file ArticleFileManager.inc.php.

References DAORegistry.getDAO(), and Config.getVar().

ArticleFileManager.copyAndRenameFile ( sourceFileId,
sourceRevision,
destType,
destFileId = null 
)

Copies an existing ArticleFile and renames it.

Parameters:
$sourceFileId int
$sourceRevision int
$destType string
$destFileId int (optional)

Definition at line 371 of file ArticleFileManager.inc.php.

References FileManager.fileExists(), Core.getCurrentDate(), DAORegistry.getDAO(), FileManager.mkdirtree(), FileManager.parseFileExtension(), and typeToPath().

Referenced by copyToCopyeditFile(), copyToEditorFile(), copyToLayoutFile(), and copyToReviewFile().

ArticleFileManager.copyAttachmentFile ( url,
mimeType,
fileId = null,
overwrite = true,
assocId = null 
)

Copy an attachment file.

Parameters:
$url string The source URL/filename
$mimeType string The mime type of the original file
$fileId int
$overwrite boolean

Definition at line 205 of file ArticleFileManager.inc.php.

References handleCopy().

ArticleFileManager.copyPublicFile ( url,
mimeType,
fileId = null,
overwrite = true 
)

Copy a public file.

Parameters:
$url string The source URL/filename
$mimeType string The mime type of the original file
$fileId int
$overwrite boolean

Definition at line 171 of file ArticleFileManager.inc.php.

References handleCopy().

ArticleFileManager.copySuppFile ( url,
mimeType,
fileId = null,
overwrite = true 
)

Copy a supplemental file.

Parameters:
$url string The source URL/filename
$mimeType string The mime type of the original file
$fileId int
$overwrite boolean

Definition at line 194 of file ArticleFileManager.inc.php.

References handleCopy().

ArticleFileManager.copyToCopyeditFile ( fileId,
revision = null 
)

Copies an existing file to create a copyedit file.

Parameters:
$fileId int the file id of the editor file.
$revision int the revision of the editor file.
Returns:
int the file id of the new file.

Definition at line 331 of file ArticleFileManager.inc.php.

References copyAndRenameFile().

ArticleFileManager.copyToEditorFile ( fileId,
revision = null,
destFileId = null 
)

Copies an existing file to create an editor decision file.

Parameters:
$fileId int the file id of the review file.
$revision int the revision of the review file.
$destFileId int file ID to copy to
Returns:
int the file id of the new file.

Definition at line 321 of file ArticleFileManager.inc.php.

References copyAndRenameFile().

ArticleFileManager.copyToLayoutFile ( fileId,
revision = null 
)

Copies an existing file to create a layout file.

Parameters:
$fileId int the file id of the copyedit file.
$revision int the revision of the copyedit file.
Returns:
int the file id of the new file.

Definition at line 341 of file ArticleFileManager.inc.php.

References copyAndRenameFile().

ArticleFileManager.copyToReviewFile ( fileId,
revision = null,
destFileId = null 
)

Copies an existing file to create a review file.

Parameters:
$originalFileId int the file id of the original file.
$originalRevision int the revision of the original file.
$destFileId int the file id of the current review file
Returns:
int the file id of the new file.

Definition at line 310 of file ArticleFileManager.inc.php.

References copyAndRenameFile().

ArticleFileManager.deleteArticleTree (  ) 

Delete the entire tree of files belonging to an article.

Definition at line 271 of file ArticleFileManager.inc.php.

ArticleFileManager.deleteFile ( fileId,
revision = null 
)

Delete a file by ID. If no revision is specified, all revisions of the file are deleted.

Parameters:
$fileId int
$revision int (optional)
Returns:
int number of files removed

Definition at line 245 of file ArticleFileManager.inc.php.

References DAORegistry.getDAO().

Referenced by removePriorRevisions().

ArticleFileManager.downloadFile ( fileId,
revision = null,
inline = false 
)

Download a file.

Parameters:
$fileId int the file id of the file to download
$revision int the revision of the file to download
$inline print file as inline instead of attachment, optional
Returns:
boolean

Reimplemented from FileManager.

Definition at line 282 of file ArticleFileManager.inc.php.

References getFile().

Referenced by viewFile().

& ArticleFileManager.generateDummyFile ( &$  article  ) 

PRIVATE routine to generate a dummy file. Used in handleUpload.

Parameters:
$article object
Returns:
object articleFile

Definition at line 434 of file ArticleFileManager.inc.php.

References Core.getCurrentDate(), and DAORegistry.getDAO().

Referenced by handleCopy(), handleUpload(), handleWrite(), and temporaryFileToArticleFile().

ArticleFileManager.generateFilename ( &$  articleFile,
type,
originalName 
)

PRIVATE routine to generate a filename for an article file. Sets the filename field in the articleFile to the generated value.

Parameters:
$articleFile The article to generate a filename for
$type The type of the article (e.g. as supplied to handleUpload)
$originalName The name of the original file

Definition at line 474 of file ArticleFileManager.inc.php.

References FileManager.parseFileExtension().

Referenced by handleCopy(), handleUpload(), handleWrite(), and temporaryFileToArticleFile().

& ArticleFileManager.getFile ( fileId,
revision = null 
)

Retrieve file information by file ID.

Returns:
ArticleFile

Definition at line 213 of file ArticleFileManager.inc.php.

References DAORegistry.getDAO().

Referenced by downloadFile(), and readFile().

ArticleFileManager.handleCopy ( url,
mimeType,
type,
fileId = null,
overwrite = false 
)

PRIVATE routine to copy an article file and add it to the database.

Parameters:
$url original filename/url of the file
$mimeType string the mime type of the file
$type string identifying type
$fileId int ID of an existing file to update
$overwrite boolean overwrite all previous revisions of the file (revision number is still incremented)
Returns:
int the file ID (false if upload failed)

Definition at line 596 of file ArticleFileManager.inc.php.

References FileManager.copyFile(), generateDummyFile(), generateFilename(), Core.getCurrentDate(), DAORegistry.getDAO(), removePriorRevisions(), FileManager.truncateFileName(), and typeToPath().

Referenced by copyAttachmentFile(), copyPublicFile(), and copySuppFile().

ArticleFileManager.handleUpload ( fileName,
type,
fileId = null,
overwrite = false 
)

PRIVATE routine to upload the file and add it to the database.

Parameters:
$fileName string index into the $_FILES array
$type string identifying type
$fileId int ID of an existing file to update
$overwrite boolean overwrite all previous revisions of the file (revision number is still incremented)
Returns:
int the file ID (false if upload failed)

Definition at line 489 of file ArticleFileManager.inc.php.

References generateDummyFile(), generateFilename(), Core.getCurrentDate(), DAORegistry.getDAO(), FileManager.getUploadedFileName(), removePriorRevisions(), FileManager.truncateFileName(), typeToPath(), and FileManager.uploadFile().

Referenced by uploadCopyeditFile(), uploadEditorDecisionFile(), uploadLayoutFile(), uploadPublicFile(), uploadReviewFile(), uploadSubmissionFile(), uploadSubmissionNoteFile(), and uploadSuppFile().

ArticleFileManager.handleWrite ( fileName,
&$  contents,
mimeType,
type,
fileId = null,
overwrite = false 
)

PRIVATE routine to write an article file and add it to the database.

Parameters:
$fileName original filename of the file
$contents string contents of the file to write
$mimeType string the mime type of the file
$type string identifying type
$fileId int ID of an existing file to update
$overwrite boolean overwrite all previous revisions of the file (revision number is still incremented)
Returns:
int the file ID (false if upload failed)

Definition at line 543 of file ArticleFileManager.inc.php.

References generateDummyFile(), generateFilename(), Core.getCurrentDate(), DAORegistry.getDAO(), removePriorRevisions(), FileManager.truncateFileName(), typeToPath(), and FileManager.writeFile().

Referenced by writePublicFile(), and writeSuppFile().

ArticleFileManager.readFile ( fileId,
revision = null,
output = false 
)

Read a file's contents.

Parameters:
$output boolean output the file's contents instead of returning a string
Returns:
boolean

Definition at line 224 of file ArticleFileManager.inc.php.

References getFile().

ArticleFileManager.removePriorRevisions ( fileId,
revision 
)

PRIVATE routine to remove all prior revisions of a file.

Definition at line 457 of file ArticleFileManager.inc.php.

References deleteFile(), and DAORegistry.getDAO().

Referenced by handleCopy(), handleUpload(), handleWrite(), and temporaryFileToArticleFile().

ArticleFileManager.temporaryFileToArticleFile ( &$  temporaryFile,
type,
assocId = null 
)

Copy a temporary file to an article file.

Parameters:
TemporaryFile 
Returns:
int the file ID (false if upload failed)

Definition at line 646 of file ArticleFileManager.inc.php.

References FileManager.copyFile(), generateDummyFile(), generateFilename(), DAORegistry.getDAO(), removePriorRevisions(), and typeToPath().

ArticleFileManager.typeToPath ( type  ) 

Return type path associated with a type code.

Parameters:
$type string
Returns:
string

Definition at line 350 of file ArticleFileManager.inc.php.

Referenced by copyAndRenameFile(), ArticleFileDAO.getArticleFilesByAssocId(), handleCopy(), handleUpload(), handleWrite(), and temporaryFileToArticleFile().

ArticleFileManager.uploadCopyeditFile ( fileName,
fileId = null 
)

Upload a file to the copyedit file folder.

Parameters:
$fileName string the name of the file used in the POST form
$fileId int
Returns:
int file ID, is false if failure

Definition at line 104 of file ArticleFileManager.inc.php.

References handleUpload().

ArticleFileManager.uploadEditorDecisionFile ( fileName,
fileId = null 
)

Upload a file to the editor decision file folder.

Parameters:
$fileName string the name of the file used in the POST form
$fileId int
Returns:
int file ID, is false if failure

Definition at line 94 of file ArticleFileManager.inc.php.

References handleUpload().

ArticleFileManager.uploadLayoutFile ( fileName,
fileId = null,
overwrite = true 
)

Upload a section editor's layout editing file.

Parameters:
$fileName string the name of the file used in the POST form
$fileId int
$overwrite boolean
Returns:
int file ID, is null if failure

Definition at line 115 of file ArticleFileManager.inc.php.

References handleUpload().

ArticleFileManager.uploadPublicFile ( fileName,
fileId = null,
overwrite = true 
)

Upload a public file.

Parameters:
$fileName string the name of the file used in the POST form
$fileId int
$overwrite boolean
Returns:
int file ID, is false if failure

Definition at line 137 of file ArticleFileManager.inc.php.

References handleUpload().

ArticleFileManager.uploadReviewFile ( fileName,
fileId = null 
)

Upload a file to the review file folder.

Parameters:
$fileName string the name of the file used in the POST form
$fileId int
Returns:
int file ID, is false if failure

Definition at line 84 of file ArticleFileManager.inc.php.

References handleUpload().

ArticleFileManager.uploadSubmissionFile ( fileName,
fileId = null,
overwrite = false 
)

Upload a submission file.

Parameters:
$fileName string the name of the file used in the POST form
$fileId int
Returns:
int file ID, is false if failure

Definition at line 74 of file ArticleFileManager.inc.php.

References handleUpload().

ArticleFileManager.uploadSubmissionNoteFile ( fileName,
fileId = null,
overwrite = true 
)

Upload a note file.

Parameters:
$fileName string the name of the file used in the POST form
$fileId int
$overwrite boolean
Returns:
int file ID, is false if failure

Definition at line 148 of file ArticleFileManager.inc.php.

References handleUpload().

ArticleFileManager.uploadSuppFile ( fileName,
fileId = null,
overwrite = true 
)

Upload a supp file.

Parameters:
$fileName string the name of the file used in the POST form
$fileId int
$overwrite boolean
Returns:
int file ID, is false if failure

Definition at line 126 of file ArticleFileManager.inc.php.

References handleUpload().

Referenced by SuppFileForm.execute().

ArticleFileManager.viewFile ( fileId,
revision = null 
)

View a file inline (variant of downloadFile).

See also:
ArticleFileManager.downloadFile

Reimplemented from FileManager.

Definition at line 299 of file ArticleFileManager.inc.php.

References downloadFile().

ArticleFileManager.writePublicFile ( fileName,
&$  contents,
mimeType,
fileId = null,
overwrite = true 
)

Write a public file.

Parameters:
$fileName string The original filename
$contents string The contents to be written to the file
$mimeType string The mime type of the original file
$fileId int
$overwrite boolean

Definition at line 160 of file ArticleFileManager.inc.php.

References handleWrite().

ArticleFileManager.writeSuppFile ( fileName,
&$  contents,
mimeType,
fileId = null,
overwrite = true 
)

Write a supplemental file.

Parameters:
$fileName string The original filename
$contents string The contents to be written to the file
$mimeType string The mime type of the original file
$fileId int
$overwrite boolean

Definition at line 183 of file ArticleFileManager.inc.php.

References handleWrite().


The documentation for this class was generated from the following file:

Generated on Mon Jul 14 10:55:39 2008 for Open Journal Systems by  doxygen 1.5.6