Difference between revisions of "API:EPrints/DataObj/Document"

From EPrints Documentation
Jump to: navigation, search
 
Line 8: Line 8:
 
'''EPrints::DataObj::Document''' - A single format of a record.
 
'''EPrints::DataObj::Document''' - A single format of a record.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_description -->
 
<!-- Pod2Wiki=head_description -->
 
==DESCRIPTION==
 
==DESCRIPTION==
Line 21: Line 18:
 
This class is a subclass of DataObj, with the following metadata fields:  
 
This class is a subclass of DataObj, with the following metadata fields:  
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* docid (text)
<span style='display:none'>User Comments</span>
+
: The unique ID of the document. This is a string of the format 123-02 where the first number is the eprint id and the second is the document number within that eprint.
<!-- Edit below this comment -->
+
  
 +
: This should probably have been and "int" but isn't. I later version of EPrints may change this.
  
<!-- Pod2Wiki= -->
+
* eprintid (itemref)
</div>
+
: The id number of the eprint to which this document belongs.
<!-- Pod2Wiki=item_docid -->
+
===docid (text)===
+
  
The unique ID of the document. This is a string of the format 123-02 where the first number is the eprint id and the second is the document number within that eprint.
+
* placement (int)
 +
: Placement of the document - the order documents should be shown in.
  
This should probably have been and "int" but isn't. I later version of EPrints may change this.
+
* format (namedset)
 +
: The format of this document. One of the types of the dataset "document".
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* formatdesc (text)
<span style='display:none'>User Comments</span>
+
: An additional description of this document. For example the specific version of a format.
<!-- Edit below this comment -->
+
  
 +
* language (namedset)
 +
: The ISO ID of the language of this document. The default configuration of EPrints does not set this.
  
<!-- Pod2Wiki= -->
+
* security (namedset)
</div>
+
: The security type of this document - who can view it. One of the types of the dataset "security".
<!-- Pod2Wiki=item_eprintid -->
+
===eprintid (itemref)===
+
  
The id number of the eprint to which this document belongs.
+
* main (text)
 +
: The file which we should link to. For something like a PDF file this is the only file. For an HTML document with images it would be the name of the actual HTML file.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* files (subobject, multiple)
<span style='display:none'>User Comments</span>
+
: A virtual field which represents the list of Files which are part of this record.
<!-- Edit below this comment -->
+
  
 +
* media
 +
: A compound field containing a description of the document media - dimensions, codec etc.
  
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_placement -->
 
===placement (int)===
 
 
Placement of the document - the order documents should be shown in.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
<!-- Pod2Wiki=item_format -->
 
===format (namedset)===
 
 
The format of this document. One of the types of the dataset "document".
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_formatdesc -->
 
===formatdesc (text)===
 
 
An additional description of this document. For example the specific version of a format.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_language -->
 
===language (namedset)===
 
 
The ISO ID of the language of this document. The default configuration of EPrints does not set this.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_security -->
 
===security (namedset)===
 
 
The security type of this document - who can view it. One of the types of the dataset "security".
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_main -->
 
===main (text)===
 
 
The file which we should link to. For something like a PDF file this is the only file. For an HTML document with images it would be the name of the actual HTML file.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_files -->
 
===files (subobject, multiple)===
 
 
A virtual field which represents the list of Files which are part of this record.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_media -->
 
===media===
 
 
A compound field containing a description of the document media - dimensions, codec etc.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
 
<!-- Pod2Wiki=head_methods -->
 
<!-- Pod2Wiki=head_methods -->
 
==METHODS==
 
==METHODS==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<!-- Pod2Wiki=head_get_system_field_info -->
<span style='display:none'>User Comments</span>
+
===get_system_field_info===
<!-- Edit below this comment -->
+
  
 +
<source lang="perl">$metadata = EPrints::DataObj::Document->get_system_field_info
  
<!-- Pod2Wiki= -->
+
</source>
</div>
+
<!-- Pod2Wiki=item_get_system_field_info -->
+
===get_system_field_info===
+
 
+
$metadata = EPrints::DataObj::Document-&gt;get_system_field_info
+
 
Return an array describing the system metadata of the Document dataset.
 
Return an array describing the system metadata of the Document dataset.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_get_dataset_id -->
<!-- Pod2Wiki=item_get_dataset_id -->
+
 
===get_dataset_id===
 
===get_dataset_id===
  
$dataset = EPrints::DataObj::Document-&gt;get_dataset_id
+
<source lang="perl">$dataset = EPrints::DataObj::Document->get_dataset_id
 +
 
 +
</source>
 
Returns the id of the [[API:EPrints/DataSet|EPrints::DataSet]] object to which this record belongs.
 
Returns the id of the [[API:EPrints/DataSet|EPrints::DataSet]] object to which this record belongs.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_get_defaults -->
<!-- Pod2Wiki=item_get_defaults -->
+
 
===get_defaults===
 
===get_defaults===
  
$defaults = EPrints::DataObj::Document-&gt;get_defaults( $session, $data )
+
<source lang="perl">$defaults = EPrints::DataObj::Document->get_defaults( $session, $data )
 +
 
 +
</source>
 
Return default values for this object based on the starting data.
 
Return default values for this object based on the starting data.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_clone -->
<!-- Pod2Wiki=item_clone -->
+
 
===clone===
 
===clone===
  
$newdoc = $doc-&gt;clone( $eprint )
+
<source lang="perl">$newdoc = $doc->clone( $eprint )
 +
 
 +
</source>
 
Attempt to clone this document. Both the document metadata and the actual files. The clone will be associated with the given EPrint.
 
Attempt to clone this document. Both the document metadata and the actual files. The clone will be associated with the given EPrint.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_remove -->
<!-- Pod2Wiki=item_remove -->
+
 
===remove===
 
===remove===
  
$success = $doc-&gt;remove
+
<source lang="perl">$success = $doc->remove
 +
 
 +
</source>
 
Attempt to completely delete this document
 
Attempt to completely delete this document
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_get_eprint -->
<!-- Pod2Wiki=item_get_eprint -->
+
 
===get_eprint===
 
===get_eprint===
  
$eprint = $doc-&gt;get_eprint
+
<source lang="perl">$eprint = $doc->get_eprint
 +
 
 +
</source>
 
Return the EPrint this document is associated with.
 
Return the EPrint this document is associated with.
  
 
This is a synonym for get_parent().
 
This is a synonym for get_parent().
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_get_baseurl -->
<!-- Pod2Wiki=item_get_baseurl -->
+
 
===get_baseurl===
 
===get_baseurl===
  
$url = $doc-&gt;get_baseurl( [$staff] )
+
<source lang="perl">$url = $doc->get_baseurl( [$staff] )
 +
 
 +
</source>
 
Return the base URL of the document. Overrides the stub in DataObj. $staff is currently ignored.
 
Return the base URL of the document. Overrides the stub in DataObj. $staff is currently ignored.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_is_public -->
<!-- Pod2Wiki=item_is_public -->
+
 
===is_public===
 
===is_public===
  
$boolean = $doc-&gt;is_public()
+
<source lang="perl">$boolean = $doc->is_public()
 +
 
 +
</source>
 
True if this document has no security set and is in the live archive.
 
True if this document has no security set and is in the live archive.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_path -->
<!-- Pod2Wiki=item_path -->
+
 
===path===
 
===path===
  
$path = $doc-&gt;path
+
<source lang="perl">$path = $doc->path
 +
 
 +
</source>
 
Returns the relative path to the document WITHOUT any file.
 
Returns the relative path to the document WITHOUT any file.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_file_path -->
<!-- Pod2Wiki=item_file_path -->
+
 
===file_path===
 
===file_path===
  
$path = $doc-&gt;file_path( [ $filename ] )
+
<source lang="perl">$path = $doc->file_path( [ $filename ] )
 +
 
 +
</source>
 
Returns the relative path to $filename stored in this document. If $filename is undefined returns the path to the main file.
 
Returns the relative path to $filename stored in this document. If $filename is undefined returns the path to the main file.
  
 
This is an efficient shortcut to this:
 
This is an efficient shortcut to this:
  
  my $file = $doc-&gt;stored_file( $filename );
+
<pre>  my $file = $doc-&gt;stored_file( $filename );
   my $path = $file-&gt;path;
+
   my $path = $file-&gt;path;</pre>
 
+
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<span style='display:none'>User Comments</span>
+
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_get_url -->
<!-- Pod2Wiki=item_get_url -->
+
 
===get_url===
 
===get_url===
  
$url = $doc-&gt;get_url( [$file] )
+
<source lang="perl">$url = $doc->get_url( [$file] )
 +
 
 +
</source>
 
Return the full URL of the document. Overrides the stub in DataObj.
 
Return the full URL of the document. Overrides the stub in DataObj.
  
 
If file is not specified then the "main" file is used.
 
If file is not specified then the "main" file is used.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_files -->
<!-- Pod2Wiki=item_files -->
+
 
===files===
 
===files===
  
%files = $doc-&gt;files
+
<source lang="perl">%files = $doc->files
 +
 
 +
</source>
 
Return a hash, the keys of which are all the files belonging to this document (relative to $doc-&gt;local_path). The values are the sizes of the files, in bytes.
 
Return a hash, the keys of which are all the files belonging to this document (relative to $doc-&gt;local_path). The values are the sizes of the files, in bytes.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_remove_file -->
<!-- Pod2Wiki=item_remove_file -->
+
 
===remove_file===
 
===remove_file===
  
$success = $doc-&gt;remove_file( $filename )
+
<source lang="perl">$success = $doc->remove_file( $filename )
 +
 
 +
</source>
 
Attempt to remove the given file. Give the filename as it is returned by get_files().
 
Attempt to remove the given file. Give the filename as it is returned by get_files().
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_set_main -->
<!-- Pod2Wiki=item_set_main -->
+
 
===set_main===
 
===set_main===
  
$doc-&gt;set_main( $main_file )
+
<source lang="perl">$doc->set_main( $main_file )
 +
 
 +
</source>
 
Sets the main file and adjusts format and mime type as necessary. Won't affect the database until a $doc-&gt;commit().
 
Sets the main file and adjusts format and mime type as necessary. Won't affect the database until a $doc-&gt;commit().
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_get_main -->
<!-- Pod2Wiki=item_get_main -->
+
 
===get_main===
 
===get_main===
  
$filename = $doc-&gt;get_main
+
<source lang="perl">$filename = $doc->get_main
 +
 
 +
</source>
 
Return the name of the main file in this document.
 
Return the name of the main file in this document.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_set_format -->
<!-- Pod2Wiki=item_set_format -->
+
 
===set_format===
 
===set_format===
  
$doc-&gt;set_format( $format )
+
<source lang="perl">$doc->set_format( $format )
 +
 
 +
</source>
 
Set format. Won't affect the database until a commit(). Just an alias  for $doc-&gt;set_value( "format" , $format );
 
Set format. Won't affect the database until a commit(). Just an alias  for $doc-&gt;set_value( "format" , $format );
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_set_format_desc -->
<!-- Pod2Wiki=item_set_format_desc -->
+
 
===set_format_desc===
 
===set_format_desc===
  
$doc-&gt;set_format_desc( $format_desc )
+
<source lang="perl">$doc->set_format_desc( $format_desc )
 +
 
 +
</source>
 
Set the format description.  Won't affect the database until a commit(). Just an alias for $doc-&gt;set_value( "format_desc" , $format_desc );
 
Set the format description.  Won't affect the database until a commit(). Just an alias for $doc-&gt;set_value( "format_desc" , $format_desc );
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_add_file -->
<!-- Pod2Wiki=item_add_file -->
+
 
===add_file===
 
===add_file===
  
$fileobj = $doc-&gt;add_file( $file, $filename [, $preserve_path] )
+
<source lang="perl">$fileobj = $doc->add_file( $file, $filename [, $preserve_path] )
 +
 
 +
</source>
 
$file is the full path to a file to be added to the document, with name $filename. $filename is passed through [[API:EPrints/System#sanitise|EPrints::System/sanitise]] before being written.
 
$file is the full path to a file to be added to the document, with name $filename. $filename is passed through [[API:EPrints/System#sanitise|EPrints::System/sanitise]] before being written.
  
Line 399: Line 281:
 
Returns the $fileobj created or undef on failure.
 
Returns the $fileobj created or undef on failure.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_add_archive -->
<!-- Pod2Wiki=item_add_archive -->
+
 
===add_archive===
 
===add_archive===
  
$success = $doc-&gt;add_archive( $file, $archive_format )
+
<source lang="perl">$success = $doc->add_archive( $file, $archive_format )
 +
 
 +
</source>
 
$file is the full path to an archive file, eg. zip or .tar.gz  
 
$file is the full path to an archive file, eg. zip or .tar.gz  
  
 
This function will add the contents of that archive to the document.
 
This function will add the contents of that archive to the document.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_add_directory -->
<!-- Pod2Wiki=item_add_directory -->
+
 
===add_directory===
 
===add_directory===
  
$success = $doc-&gt;add_directory( $directory )
+
<source lang="perl">$success = $doc->add_directory( $directory )
 +
 
 +
</source>
 
Upload the contents of $directory to this document. This will not set the main file.
 
Upload the contents of $directory to this document. This will not set the main file.
  
 
This method expects $directory to have a trailing slash (/).
 
This method expects $directory to have a trailing slash (/).
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_upload_url -->
<!-- Pod2Wiki=item_upload_url -->
+
 
===upload_url===
 
===upload_url===
  
$success = $doc-&gt;upload_url( $url )
+
<source lang="perl">$success = $doc->upload_url( $url )
 +
 
 +
</source>
 
Attempt to grab stuff from the given URL. Grabbing HTML stuff this way is always problematic, so (by default): only relative links will  be followed and only links to files in the same directory or  subdirectory will be followed.
 
Attempt to grab stuff from the given URL. Grabbing HTML stuff this way is always problematic, so (by default): only relative links will  be followed and only links to files in the same directory or  subdirectory will be followed.
  
 
This (by default) uses wget. The details can be configured in SystemSettings.
 
This (by default) uses wget. The details can be configured in SystemSettings.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_commit -->
<!-- Pod2Wiki=item_commit -->
+
 
===commit===
 
===commit===
  
$success = $doc-&gt;commit
+
<source lang="perl">$success = $doc->commit
 +
 
 +
</source>
 
Commit any changes that have been made to this object to the database.
 
Commit any changes that have been made to this object to the database.
  
 
Calls "set_document_automatic_fields" in the ArchiveConfig first to set any automatic fields that may be needed.
 
Calls "set_document_automatic_fields" in the ArchiveConfig first to set any automatic fields that may be needed.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_validate -->
<!-- Pod2Wiki=item_validate -->
+
 
===validate===
 
===validate===
  
$problems = $doc-&gt;validate( [$for_archive] )
+
<source lang="perl">$problems = $doc->validate( [$for_archive] )
 +
 
 +
</source>
 
Return an array of XHTML DOM objects describing validation problems with the entire document, including the metadata and repository config specific requirements.
 
Return an array of XHTML DOM objects describing validation problems with the entire document, including the metadata and repository config specific requirements.
  
 
A reference to an empty array indicates no problems.
 
A reference to an empty array indicates no problems.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_get_type -->
<!-- Pod2Wiki=item_get_type -->
+
 
===get_type===
 
===get_type===
  
$type = $doc-&gt;get_type
+
<source lang="perl">$type = $doc->get_type
 +
 
 +
</source>
 
Return the type of this document.
 
Return the type of this document.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_files_modified -->
<!-- Pod2Wiki=item_files_modified -->
+
 
===files_modified===
 
===files_modified===
  
$doc-&gt;files_modified
+
<source lang="perl">$doc->files_modified
 +
 
 +
</source>
 
This method does all the things that need doing when a file has been modified.
 
This method does all the things that need doing when a file has been modified.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_rehash -->
<!-- Pod2Wiki=item_rehash -->
+
 
===rehash===
 
===rehash===
  
$doc-&gt;rehash
+
<source lang="perl">$doc->rehash
 +
 
 +
</source>
 
Recalculate the hash value of the document. Uses MD5 of the files (in alphabetic order), but can use user specified hashing function instead.
 
Recalculate the hash value of the document. Uses MD5 of the files (in alphabetic order), but can use user specified hashing function instead.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_make_indexcodes -->
<!-- Pod2Wiki=item_make_indexcodes -->
+
 
===make_indexcodes===
 
===make_indexcodes===
  
$doc = $doc-&gt;make_indexcodes()
+
<source lang="perl">$doc = $doc->make_indexcodes()
 +
 
 +
</source>
 
Make the indexcodes document for this document. Returns the generated document or undef on failure.
 
Make the indexcodes document for this document. Returns the generated document or undef on failure.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_remove_indexcodes -->
<!-- Pod2Wiki=item_remove_indexcodes -->
+
 
===remove_indexcodes===
 
===remove_indexcodes===
  
$doc = $doc-&gt;remove_indexcodes()
+
<source lang="perl">$doc = $doc->remove_indexcodes()
 +
 
 +
</source>
 
Remove any documents containing index codes for this document. Returns the number of documents removed.
 
Remove any documents containing index codes for this document. Returns the number of documents removed.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_render_icon_link -->
<!-- Pod2Wiki=item_render_icon_link -->
+
 
===render_icon_link===
 
===render_icon_link===
  
$frag = $doc-&gt;render_icon_link( %opts )
+
<source lang="perl">$frag = $doc->render_icon_link( %opts )
 +
 
 +
</source>
 
Render a link to the icon for this document.
 
Render a link to the icon for this document.
  
 
Options:
 
Options:
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* new_window =&gt; 1
<span style='display:none'>User Comments</span>
+
: Make link go to _blank not current window.
<!-- Edit below this comment -->
+
  
 +
* preview =&gt; 1
 +
: If possible, provide a preview pop-up.
  
<!-- Pod2Wiki= -->
+
* public =&gt; 0
</div>
+
: Show thumbnail/preview only on public docs.
<!-- Pod2Wiki=item_new_window_1 -->
+
===new_window_1===
+
  
new_window =&gt; 1
+
* public =&gt; 1
Make link go to _blank not current window.
+
: Show thumbnail/preview on all docs if poss.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_render_preview_link -->
<!-- Pod2Wiki=item_preview_1 -->
+
===render_preview_link===
===preview_1===
+
  
preview =&gt; 1
+
<source lang="perl">$frag = $doc->render_preview_link( %opts )
If possible, provide a preview pop-up.
+
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
</source>
<span style='display:none'>User Comments</span>
+
<!-- Edit below this comment -->
+
 
+
 
+
<!-- Pod2Wiki= -->
+
</div>
+
<!-- Pod2Wiki=item_public_0 -->
+
===public_0===
+
 
+
public =&gt; 0
+
Show thumbnail/preview only on public docs.
+
 
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<span style='display:none'>User Comments</span>
+
<!-- Edit below this comment -->
+
 
+
 
+
<!-- Pod2Wiki= -->
+
</div>
+
<!-- Pod2Wiki=item_public_1 -->
+
===public_1===
+
 
+
public =&gt; 1
+
Show thumbnail/preview on all docs if poss.
+
 
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<span style='display:none'>User Comments</span>
+
<!-- Edit below this comment -->
+
 
+
 
+
<!-- Pod2Wiki= -->
+
</div>
+
<!-- Pod2Wiki=item_render_preview_link -->
+
===render_preview_link===
+
 
+
$frag = $doc-&gt;render_preview_link( %opts )
+
 
Render a link to the preview for this document (if available) using a lightbox.
 
Render a link to the preview for this document (if available) using a lightbox.
  
 
Options:
 
Options:
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* caption =&gt; $frag
<span style='display:none'>User Comments</span>
+
: XHTML fragment to use as the caption, defaults to empty.
<!-- Edit below this comment -->
+
 
+
 
+
<!-- Pod2Wiki= -->
+
</div>
+
<!-- Pod2Wiki=item_caption_frag -->
+
===caption_frag===
+
  
caption =&gt; $frag
+
* set =&gt; "foo"
XHTML fragment to use as the caption, defaults to empty.
+
: The name of the set this document belongs to, defaults to none (preview won't be shown as part of a set).
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_add_relation -->
<!-- Pod2Wiki=item_set_foo -->
+
===add_relation===
===set_foo===
+
  
set =&gt; "foo"
+
<source lang="perl">$doc->add_relation( $tgt, @types )
The name of the set this document belongs to, defaults to none (preview won't be shown as part of a set).
+
 
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<span style='display:none'>User Comments</span>
+
<!-- Edit below this comment -->
+
 
+
 
+
<!-- Pod2Wiki= -->
+
</div>
+
<!-- Pod2Wiki=item_add_relation -->
+
===add_relation===
+
  
$doc-&gt;add_relation( $tgt, @types )
+
</source>
 
Add one or more relations to $doc pointing to $tgt (does not modify $tgt).
 
Add one or more relations to $doc pointing to $tgt (does not modify $tgt).
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_remove_relation -->
<!-- Pod2Wiki=item_remove_relation -->
+
 
===remove_relation===
 
===remove_relation===
  
$doc-&gt;remove_relation( $tgt [, @types ] )
+
<source lang="perl">$doc->remove_relation( $tgt [, @types ] )
 +
 
 +
</source>
 
Removes the relations in $doc to $tgt. If @types isn't given removes all relations to $tgt. If $tgt is undefined removes all relations given in @types.
 
Removes the relations in $doc to $tgt. If @types isn't given removes all relations to $tgt. If $tgt is undefined removes all relations given in @types.
  
 
If you want to remove all relations do $doc-&gt;set_value( "relation", [] );
 
If you want to remove all relations do $doc-&gt;set_value( "relation", [] );
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_has_relation -->
<!-- Pod2Wiki=item_has_relation -->
+
 
===has_relation===
 
===has_relation===
  
$bool = $doc-&gt;has_relation( $tgt [, @types ] )
+
<source lang="perl">$bool = $doc->has_relation( $tgt [, @types ] )
 +
 
 +
</source>
 
Returns true if $doc has relations to $tgt. If @types is given checks that $doc satisfies all of the given types. $tgt may be undefined.
 
Returns true if $doc has relations to $tgt. If @types is given checks that $doc satisfies all of the given types. $tgt may be undefined.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_search_related -->
<!-- Pod2Wiki=item_search_related -->
+
 
===search_related===
 
===search_related===
  
$list = $doc-&gt;search_related( [ $type ] )
+
<source lang="perl">$list = $doc->search_related( [ $type ] )
 +
 
 +
</source>
 
Return a [[API:EPrints/List|EPrints::List]] that contains all documents related to this document. If $type is defined returns only those documents related by $type.
 
Return a [[API:EPrints/List|EPrints::List]] that contains all documents related to this document. If $type is defined returns only those documents related by $type.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_copyright -->
 
<!-- Pod2Wiki=head_copyright -->
 
==COPYRIGHT==
 
==COPYRIGHT==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #ccepadding: 0em 1em 0em 1em; font-size: 80%; '>
+
Copyright 2000-2011 University of Southampton.
<span style='display:none'>User Comments</span>
+
 
 +
This file is part of EPrints http://www.eprints.org/.
 +
 
 +
EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 +
 
 +
EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 +
 
 +
You should have received a copy of the GNU Lesser General Public License along with EPrints.  If not, see http://www.gnu.org/licenses/.
 +
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=_postamble_ -->
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->
+
<!-- Edit below this comment -->

Latest revision as of 09:57, 22 January 2013

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

Latest Source Code (3.3, 3.2) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::DataObj::Document - A single format of a record.


DESCRIPTION

Document represents a single format of an EPrint (eg. PDF) - the actual file(s) rather than the metadata.

This class is a subclass of DataObj, with the following metadata fields:

  • docid (text)
The unique ID of the document. This is a string of the format 123-02 where the first number is the eprint id and the second is the document number within that eprint.
This should probably have been and "int" but isn't. I later version of EPrints may change this.
  • eprintid (itemref)
The id number of the eprint to which this document belongs.
  • placement (int)
Placement of the document - the order documents should be shown in.
  • format (namedset)
The format of this document. One of the types of the dataset "document".
  • formatdesc (text)
An additional description of this document. For example the specific version of a format.
  • language (namedset)
The ISO ID of the language of this document. The default configuration of EPrints does not set this.
  • security (namedset)
The security type of this document - who can view it. One of the types of the dataset "security".
  • main (text)
The file which we should link to. For something like a PDF file this is the only file. For an HTML document with images it would be the name of the actual HTML file.
  • files (subobject, multiple)
A virtual field which represents the list of Files which are part of this record.
  • media
A compound field containing a description of the document media - dimensions, codec etc.


METHODS

get_system_field_info

$metadata = EPrints::DataObj::Document->get_system_field_info

Return an array describing the system metadata of the Document dataset.


get_dataset_id

$dataset = EPrints::DataObj::Document->get_dataset_id

Returns the id of the EPrints::DataSet object to which this record belongs.


get_defaults

$defaults = EPrints::DataObj::Document->get_defaults( $session, $data )

Return default values for this object based on the starting data.


clone

$newdoc = $doc->clone( $eprint )

Attempt to clone this document. Both the document metadata and the actual files. The clone will be associated with the given EPrint.


remove

$success = $doc->remove

Attempt to completely delete this document


get_eprint

$eprint = $doc->get_eprint

Return the EPrint this document is associated with.

This is a synonym for get_parent().


get_baseurl

$url = $doc->get_baseurl( [$staff] )

Return the base URL of the document. Overrides the stub in DataObj. $staff is currently ignored.


is_public

$boolean = $doc->is_public()

True if this document has no security set and is in the live archive.


path

$path = $doc->path

Returns the relative path to the document WITHOUT any file.


file_path

$path = $doc->file_path( [ $filename ] )

Returns the relative path to $filename stored in this document. If $filename is undefined returns the path to the main file.

This is an efficient shortcut to this:

  my $file = $doc->stored_file( $filename );
  my $path = $file->path;


get_url

$url = $doc->get_url( [$file] )

Return the full URL of the document. Overrides the stub in DataObj.

If file is not specified then the "main" file is used.


files

%files = $doc->files

Return a hash, the keys of which are all the files belonging to this document (relative to $doc->local_path). The values are the sizes of the files, in bytes.


remove_file

$success = $doc->remove_file( $filename )

Attempt to remove the given file. Give the filename as it is returned by get_files().


set_main

$doc->set_main( $main_file )

Sets the main file and adjusts format and mime type as necessary. Won't affect the database until a $doc->commit().


get_main

$filename = $doc->get_main

Return the name of the main file in this document.


set_format

$doc->set_format( $format )

Set format. Won't affect the database until a commit(). Just an alias for $doc->set_value( "format" , $format );


set_format_desc

$doc->set_format_desc( $format_desc )

Set the format description. Won't affect the database until a commit(). Just an alias for $doc->set_value( "format_desc" , $format_desc );


add_file

$fileobj = $doc->add_file( $file, $filename [, $preserve_path] )

$file is the full path to a file to be added to the document, with name $filename. $filename is passed through EPrints::System/sanitise before being written.

If $preserve_path is true then include path components in $filename.

Returns the $fileobj created or undef on failure.


add_archive

$success = $doc->add_archive( $file, $archive_format )

$file is the full path to an archive file, eg. zip or .tar.gz

This function will add the contents of that archive to the document.


add_directory

$success = $doc->add_directory( $directory )

Upload the contents of $directory to this document. This will not set the main file.

This method expects $directory to have a trailing slash (/).


upload_url

$success = $doc->upload_url( $url )

Attempt to grab stuff from the given URL. Grabbing HTML stuff this way is always problematic, so (by default): only relative links will be followed and only links to files in the same directory or subdirectory will be followed.

This (by default) uses wget. The details can be configured in SystemSettings.


commit

$success = $doc->commit

Commit any changes that have been made to this object to the database.

Calls "set_document_automatic_fields" in the ArchiveConfig first to set any automatic fields that may be needed.


validate

$problems = $doc->validate( [$for_archive] )

Return an array of XHTML DOM objects describing validation problems with the entire document, including the metadata and repository config specific requirements.

A reference to an empty array indicates no problems.


get_type

$type = $doc->get_type

Return the type of this document.


files_modified

$doc->files_modified

This method does all the things that need doing when a file has been modified.


rehash

$doc->rehash

Recalculate the hash value of the document. Uses MD5 of the files (in alphabetic order), but can use user specified hashing function instead.


make_indexcodes

$doc = $doc->make_indexcodes()

Make the indexcodes document for this document. Returns the generated document or undef on failure.


remove_indexcodes

$doc = $doc->remove_indexcodes()

Remove any documents containing index codes for this document. Returns the number of documents removed.


render_icon_link

$frag = $doc->render_icon_link( %opts )

Render a link to the icon for this document.

Options:

  • new_window => 1
Make link go to _blank not current window.
  • preview => 1
If possible, provide a preview pop-up.
  • public => 0
Show thumbnail/preview only on public docs.
  • public => 1
Show thumbnail/preview on all docs if poss.


render_preview_link

$frag = $doc->render_preview_link( %opts )

Render a link to the preview for this document (if available) using a lightbox.

Options:

  • caption => $frag
XHTML fragment to use as the caption, defaults to empty.
  • set => "foo"
The name of the set this document belongs to, defaults to none (preview won't be shown as part of a set).


add_relation

$doc->add_relation( $tgt, @types )

Add one or more relations to $doc pointing to $tgt (does not modify $tgt).


remove_relation

$doc->remove_relation( $tgt [, @types ] )

Removes the relations in $doc to $tgt. If @types isn't given removes all relations to $tgt. If $tgt is undefined removes all relations given in @types.

If you want to remove all relations do $doc->set_value( "relation", [] );


has_relation

$bool = $doc->has_relation( $tgt [, @types ] )

Returns true if $doc has relations to $tgt. If @types is given checks that $doc satisfies all of the given types. $tgt may be undefined.


search_related

$list = $doc->search_related( [ $type ] )

Return a EPrints::List that contains all documents related to this document. If $type is defined returns only those documents related by $type.


COPYRIGHT

Copyright 2000-2011 University of Southampton.

This file is part of EPrints http://www.eprints.org/.

EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.