Eric Lease Morgan > MyLibrary > MyLibrary::Stylesheet

Download:
MyLibrary-3.0.4.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

MyLibrary::Stylesheet

SYNOPSIS ^

        # require the necessary module
        use MyLibrary::Stylesheet;

        # create an undefined Stylesheet object
        my $stylesheet = MyLibrary::Stylesheet->new();

        # get stylesheet id
        my $stylesheet_id = $stylesheet->stylesheet_id();

        # set the attributes for the stylesheet
        $stylesheet->stylesheet_name('Gothic');
        $stylesheet->stylesheet_description('Dark colors, gothic script.');
        $stylesheet->stylesheet('CSS code');

        # commit stylesheet to database
        $stylesheet->commit();

        # get a list of stylesheet objects
        my @stylesheets = MyLibrary::Stylesheet->get_stylesheets();
        my @stylesheets = MyLibrary::Stylesheet->get_stylesheets(sort => 'name');

        # delete a stylesheet from the database
        $stylesheet->delete();

DESCRIPTION ^

This module simply allows for the creation and maniuplation of HTML CSS stylesheets. These stylesheets will be used to present data in various contexts throught the browser medium. It also allows for association of stylesheets with patron objects so that patrons can select various styles for the presentation of MyLibrary data. Stylesheets could also be used to syndicate content to other venues and can help to separate style and presentation from content.

METHODS ^

new()

This class method is the constructor for this package. The method is responsible for initializing all attributes associated with a given Stylesheet object. The method can also be used to create a Stylesheet object using stylesheet id or name. The stylesheet would thus need to already exist in the database for these parameters to have any effect.

stylesheet_id()

This method is used exclusively to retrieve an exising stylesheet object id. This method will only return a valid id if the stylesheet has been commited to the database. This accessor method cannot set a stylesheet id.

        # get stylesheet id
        my $stylesheet_id = $stylesheet->stylesheet_id();

stylesheet_name()

This accessor method simply sets and gets the name of the stylesheet.

        # set the stylesheet name
        $stylesheet->stylesheet_name('Gothic');
        
        # get the stylesheet name
        my $style_name = $stylesheet->stylesheet_name();

stylesheet_note()

Set or get the stylesheet note. This text will be used to describe the stylesheet in question.

        # set the stylesheet note
        $stylesheet->stylesheet_note('This style is slightly gothic with medieval overtones.');

        # get the stylesheet note
        my $style_desc = $stylesheet->stylesheet_note();

stylesheet()

Depending upon how you want your application to function, the content of this attribute can be either a pointer to a stylesheet located external to the database or it can be the text of a stylesheet itself.

        # set the stylesheet content
        $stylesheet->stylesheet('CONTENT');

        # retrieve the stylesheet content
        my $stylesheet = $stylesheet->stylesheet();

get_stylesheets()

This class method should be used to retrieve a list of all of the stylesheet object ids from the database. The list can be sorted according to stylesheet name. The sort parameter is optional. A default stylesheet should always be present in the database with a stylesheet id of '0'. This stylesheet is used if no other stylesheet has been created.

        # get a sorted list of stylesheets
        my @stylesheet_ids = MyLibrary::Stylesheet->get_stylesheets(sort => 'name');

commit()

Save the stylesheet to the database.

        # commit the stylesheet
        $stylesheet->commit();

delete()

Delete the stylesheet from the database.

        # delete the stlyesheet
        $stylesheet->delete();

SEE ALSO ^

For more information, see the MyLibrary home page: http://dewey.library.nd.edu/mylibrary/.

AUTHORS ^

Robert Fox <rfox2@nd.edu>

syntax highlighting: