Apache-MP3-Skin

 view release on metacpan or  search on metacpan

Skin.pm  view on Meta::CPAN


=item PARAM_param

(string) Returns the value of the param named 'param' from the URL's query string.  For
example	if the current url is http://www.apachemp3.com/demo/pop?cartopen=yes then
<TMPL_VAR NAME=PARAM_CARTOPEN> would return "yes".  This can be useful for complicated
skins that need to maintain state.

=item PLAY_ALL_PLAYLIST_URL

(string) URL to play all files in the playlist in order.

=item PLAY_ALL_SCRIPT

(string) Javascript that will play all the MP3s currently listed on page.  
Differs	from PLAY_ALL_THIS_DIR_URL which is directory context sensitive.

=item PLAY_SELECTED_PLAYLIST_SCRIPT

(string) JavaScript that will play all the selected files in the playlist. 	

=item PLAY_SELECTED_SCRIPT

(string) Javascript that will play all selected songs.

=item SELECT_ALL_MP3S_SCRIPT

(string) JavaScript that checks all the checkboxes generated by 
<TMPL_VAR NAME=CHECKBOX> for MP3 files. 

=item SELECT_ALL_PLAYLIST_SCRIPT

(string) JavaScript that checks all the checkboxes generated by 
<TMPL_VAR NAME=CHECKBOX> in the playlist.

=item SORT

(string) The current sort method. Returns "" if default, otherwise returns the field name
currently being used to sort See L<Apache::MP3::Sorted> for appropriate values.
This is the same as PARAM_sort since the sort field is contained in the query 
string. Default sort is defined by PerlSetVar SortFiles.  

=item SHUFFLE_ALL_PLAYLIST_URL

(string) URL to play all files in the playlist in a random order.  		

=item SHUFFLE_ALL_SCRIPT

(string) Javascript that will play all the MP3s currently listed on a page 
in a random order.  Not directory context sensitive.

=item SHUFFLE_SELECTED_SCRIPT

(string) Javascript that will play all selected songs in a random 
order. 

=item SKIN

(string) The current skin.  Append to URLs in the form of ?skin=<TMPL_VAR NAME=SKIN>
to maintain your skin if it is not the default.  Useful in skins that require
multiple files for framesets.

=item STREAM_TIMEOUT

(int) If anything but 0, this returns the number in seconds of how long a file
will stream before timing out, otherwise returns an empty string.  Set by 
PerlSetVar StreamTimeout.  Used for demos or in cases when streaming an entire 
song would not be appropriate or illegal.

=item UNSELECT_ALL_MP3S_SCRIPT

(string) JavaScript that Unchecks all the checkboxes generated by 
<TMPL_VAR NAME=CHECKBOX> for all MP3 files.     

=item UNSELECT_ALL_PLAYLIST_SCRIPT

(string) JavaScript that unchecks all the checkboxes generated by 
<TMPL_VAR NAME=CHECKBOX> in the playlist.

=item URL

(string) The URL path to DIR.  Similar to THIS_URL but does not change with
the directory context

=back

=head2 Directory Scoped variables

These variables' values are determined by the current directory context.  In the 
context of a directory loop -- PATH_FORWARD, PATH_BACKWARD, HOME_DIRS, and DIRS -- 
the values are those of directory for that loop iteration.  Outside of loops, the
directory context is that of the current browser request. These varables are
available everywhere as there is always a directory context.

=over 4

=item IS_LONG_PAGE

(1|0) Does the current directory have more files than the defined value 
in PerlSetVar LongList. Useful for adding a second set of buttons on a long 
page.

=item CONTAINS_MP3S

(int) Return the number of MP3s in the current directory. Useful in IF and 
UNLESS commands to test existance of any MP3s.

=item CONTAINS_DIRS

(int) Return the number of sub-directories in the current directory. Useful in IF
and UNLESS commands to test existance of any sub-directories.

=item IS_HOME

(1|0) Is the current directory the top (or root) directory as defined by
PerlSetVar HomePath.

=item COVER

(string) The full src path of an image.  Returns an empty string if there is no image.
The empty string is useful to test the existance of a cover image.  The image

Skin.pm  view on Meta::CPAN

to use a _SCRIPT as part of a url do something like this:

<a href="javascript: <TMPL_VAR NAME=SOME_SCRIPT>">



=head1 LOOP NAMES

A variety of loops are possible, and all can be nested inside of each other for some 
interesting and sometimes useless effects. Note that when looping through a series of 
directories, the current directory context changes. So multiple nested DIRS loops would result
in a directory tree because DIRS loops through the current directory context, and inside 
iterations change that same context.

Valid loop names are:

=over 4

=item PATH_FORWARD

Iterate through the path from the top (or home) directory as
defined by PerlSetVar to the current Directory.  Useful for making
breadcrumb trails.

=item PATH_BACKWARD

Same as PATH_FORWARD but the loops starts with the current
directory and goes up the file tree to the top (or home) directory.

=item HOME_DIRS

Loop through all the directories in the top (or home) directory.
Useful for creating persistent global nav.

=item MP3S

Loop through all the MP3s in the current directory.

=item DIRS

Loop through all the DIRs in the current directory.

=item PLAYLIST

Loop through all the MP3s in the current browser's playlist.

=item DIRS_AND_MP3S

Loop through all the directories and then all the MP3s in the current directory. Use 
the IS_DIR variable to test whether a given iteration is a directory or MP3.

=item MP3S_AND_DIRS

Same and DIRS_AND_MP3S except all the MP3s come before directories.

=back

=head1 ABOUT FRAMES

A skin can be composed of multiple template files.  The default template should contain the 
framset and the source's for each from should end with "?skin=thisframe.tmpl" where 
thisframe.tmpl is the name of the file to be used to skin that frame.  Links inside 
thisframe.tmpl will also need to end in "?skin=thisframe.tmpl" to maintain their look.

=head1 ABOUT FORMS

A open form and closing form tag is automatically added to every page.  Do not include
any forms tags in your skin files.  You can include form input fields and they will be part
of the apache_mp3_skin form.  Use document.apache_mp3_skin to refer to the form object
in any JavaScript that you have.

=head1 METHODS

Apache::MP3::Skin overrides the following methods:

=over 4

=item list_directory() 

Checks to see if this is a skin file, if not hands off to SUPER::list_directory().
If there is a skin files, gets it, processes it, adds in the <SCRIPT> and <FORM> 
tags and the prints it.

=item run()

Looks for the "Shuffle Selected" parameter and handles the request if there is one.
Otherwise, sends to SUPER::run().

=item process_playlist()

Same as SUPER::process_playlist with only one line changed.  If there is an 'Add to
Playlist' param.  file param values that begin with '/' are not prepended with the
current uri and are treated as document root relative.

=back

And adds the following:

=over 4

=item set_template_params()

Called by list_directory, this begins the process of filling in the template params.
set_template_params sets the current directory context to the uri of the request and 
calls set_dir_context_params.

=item set_dir_context_params()

Loops through the parameters required for the template, sending special loop variables to
set_loop_params and most of the rest to set_context_params

=item set_mp3_context_params()

Called by loop_mp3s and loop_playlist, set_mp3_context_params iterates through the
parameters being requested in each loop iteration.  Those that are file context are handled,
special loop variables are sent to set_loop_params, and the rest go to set_context_params.

=item set_loop_params()

Called by set_mp3_context_params and set_dir_context_params, set_loop_params takes the
name of a special loop variable, and the current loop count and return the appropriate
value for the special loop variable.



( run in 2.907 seconds using v1.01-cache-2.11-cpan-df04353d9ac )