NAME
AxKit::App::TABOO::Data::Article - Article Data object for TABOO
SYNOPSIS
use AxKit::App::TABOO::Data::Article;
[etc ... similar as for other Data objects]
DESCRIPTION
This Data class contains an mainly metadata for an article. These articles are of a more static nature than typical news stories.
METHODS
This class implements several methods, reimplements the load method, but inherits some from AxKit::App::TABOO::Data.
new(@dbconnectargs)
-
The constructor. Nothing special.
load(what => fields, limit => {filename => value, primcat => value, [...]})
-
This is a reimplementation of the load method, see the parent class for details. It needs to get the category and user information, which is not currently done very rigorously and will happen regardless of the
what
parameter. In the current implementation,filename
is sufficient to identify an article uniquely, that may change in the future, so you may want to supplyprimcat
too. populate($articles, $categories, $users)
-
This class reimplements the
populate
method and gives it a new interface.$articles
must be a hashref where the keys correspond to that of the data store.categories
must be an arrayref where the elements contain another arrayref, where the first element is thecatname
, i.e. identifier for the category, and the second is the field type, i.e. whether it is a primary category, free subject words, etc.$users
must contain an arrayref with theusername
s of the authors. save()
-
The
save()
method is reimplemented too, and it works similarly to that of the parent class, so it is straightforward to use. Note, however, that it is not able yet to update an existing record. adduserinfo()
-
When data has been loaded into an object of this class, it will contain a string only identifying a user, the authors of the article. This method will replace those strings with a reference to a AxKit::App::TABOO::Data::User-object, containing the needed user information.
addcatinfo()
-
Similarly to adding user info, this method will also add category information, for different types of categories, again by creating a reference to a AxKit::App::TABOO::Data::Category-object and calling its
load
-method with the string from the data loaded by the article as argument. addformatinfo()
-
Similarly to adding user info, this method will also add format (i.e. MIME type) information, for different types of categories, again by creating a reference to a AxKit::App::TABOO::Data::MediaType-object and calling its
load
-method with the string from the data loaded by the article as argument. date([$filename|Time::Piece])
-
The date method will retrieve or set the date of the article. If the date has been loaded earlier from the data storage (for example by the load method), you need not supply any arguments. If the date is not available, you must supply the filename identifier, the method will then load it into the data structure first.
The date method will return a Time::Piece object with the requested time information.
To set the date, you must supply a Time::Piece object, the date is set to the time given by that object.
editorok([($filename)])
-
This is similar to the date method in interface, but can't be used to set the value, only retrieves it. It returns the
editorok
, which is a boolean variable that can be used to see if an editor has approved a article.It takes arguments like the date method does, and it will return 1 if the article has been approved, 0 if not.
-
Identical to the
editorok
method, but will return 1 if the article has been approved by its authors, 0 if not. mimetype
-
Will return a MIME::Type object representing the MIME-type of the content of the article. In the present implementation, that's all it is does, it can't be used to set the MIME-type, also it has to be loaded allready before this method is called.
-
Will return an array containing the usernames of the authors of the article, if they have been loaded.
STORED DATA
The data is stored in named fields, and for certain uses, it is good to know them. If you want to subclass this class, you might want to use the same names, see the documentation of AxKit::App::TABOO::Data for more about this.
For those who didn't take my word for that the similarity between the named fields and column names in the database was a coincidence, well, too bad. The data of this class is more complex, and so this isn't true anymore here.
Nevertheless, it isn't less useful to know the names, so here goes:
filename - The filename of the content stored in the file system.
primcat - Primary categorization.
seccat - Secondary categorization, an array.
freesubject - Categorization in free subject terms, an array.
angles - Categorization in different viewing angles, an array.
authorok - If the authors have approved the article for publication, boolean.
editorok - If the editors have approved the article for publication, boolean.
authorids - The usernames of the article's author(s), an array.
title - Title of the article.
description - A description of the article.
publisher - URI (preferably) identifying the publisher.
date - Date of publication.
type - "The nature or genre of the content of the resource."
format - The MIME type of the content.
lang - Natural resource of the content.
coverage - "The extent or scope of the content of the resource."
rights - URIs describing copyright policy, e.g. Creative Commons.
See AxKit::App::TABOO::Data::Category for more about the different category types. Also, note that many of these fields are taken from the terms of the Dublin Core, including some of the labels.
XML representation
The write_xml()
method, implemented in the parent class, can be used to create an XML representation of the data in the object. The above names will be used as element names. The xmlelement()
, xmlns()
and xmlprefix()
methods can be used to set the name of the root element, the namespace URI and namespace prefix respectively. Usually, it doesn't make sense to change the defaults, that are
article
http://www.kjetil.kjernsmo.net/software/TABOO/NS/Article/Output
art
BUGS/TODO
This class is rather experimental at this point, and has not seen the same level of testing as the rest of TABOO. The save
method needs the ability to update records, and the load
method should check the what
parameter properly.
FORMALITIES
See AxKit::App::TABOO.