NAME

ePortal::Utils - useful global wide functions.

SYNOPSIS

Some functions are very useful anywhere. They are collected here.

METHODS

logline(loglevel,string,...)

Record the string in error log. There are a number of loglevels:

  • emerg

    Emergencies - system is unusable: Object creation errors.

  • alert

    Action must be taken immediately.

  • crit

    Critical Conditions.

  • error

    Error conditions.

  • warn

    Warning conditions.

  • notice

    Normal but significant condition.

  • info

    Informational: Redirects.

  • debug

    Debug-level messages: ACL checking

pick_lang(hash)

pick_lang( eng => "text in english",
           rus => "text in russian");

Chooses and returns a text for a current ePortal language.

href( uri, key => value, ...)

Constructs full URL with optional parameters.

uri is filename or URI to some file.

key-value pairs may be repeated. value may be array ref.

Returns a string like uri?key=value&key=value

plink(text, parameters, ...)

Constructs HTML code to make anchor like [link] (text in square brackets)

text is text to show as link.

Other parameters are passed directly to CGI::a() function. Most used are:

-href => 'http://server/file.htm'
-href => href('file.htm', param1 => value1)
-class => "someclass"
-target => "_top"
-title => "floating title"

empty_table( param => value )

Constructs HTML code to create empty table 100% width. A background of the table is filled with 1 pixel in size transparent picture. Parameters passed as hash are:

height table height in pixels

bgcolor HTML compatible color value

black adjust background picture and color values to make the table completly black

Returns HTML string in scalar of array context. If used in void contxet then $m->out() is used to output the string immediately .

empty_tr( param => value )

Contructs HTML code for empty row of table. Parameters passed as hash are:

height height in pixels

colspan make a cell as colspan. Used in multicolumn tables

bgcolor HTML compatible color value

black adjust all parameters to make the row completely black

Returns HTML string in scalar of array context. If used in void contxet then $m->out() is used to output the string immediately .

empty_td( param => value )

Contructs HTML code for empty cell of table. Parameters passed as hash are:

height height in pixels

width width in pixels

colspan make a cell as coluln span.

bgcolor HTML compatible color value

black adjust all parameters to make the row completely black

Returns HTML string in scalar of array context. If used in void contxet then $m->out() is used to output the string immediately .

img( param => value )

Contructs HTML code for image tag. Parameters passed as hash are:

src required. URI to image.

width, height if not passed then Image::Size is used for calculation at runtime. These attributes are calculated only once for each apache child. They are cached for speed.

alt alternative text for the image

id ID of the image

Some parameters are used to construct Link from the image:

href, target, title, onClick - they are self-expanatory, passed to CGI::a() function.

Returns HTML string in scalar of array context. If used in void contxet then $m->out() is used to output the string immediately .

filter_html($content)

Filters a content to cut some HTML tags like <HTML>

Accept as parameter:

any text - filters this text

/path/filename - reads this file and filters it

$m - calls fetch_next() and filters the output

AUTHOR

Sergey Rusakov, <rusakov_sa@users.sourceforge.net>