man Bric::App::Util () - A class to house general application functions.
NAME
Bric::App::Util - A class to house general application functions.
VERSION
$LastChangedRevision$
DATE
$LastChangedDate: 2004-10-06 10:42:25 -0700 (Wed, 06 Oct 2004) $
SYNOPSIS
use Bric::App::Util;
DESCRIPTION
Utility functions.
INTERFACE
Constructors
NONE
Destructors
Public Class Methods
- (1 || undef) = add_msg($txt)
- Add a new warning message to the current list of messages. Throws: NONE Side Effects: Adds the message to the session. Notes: NONE
- $txt = get_msg($num)
- Return warning message number '$num' or if CW$num is not given return all error messages. Throws: NONE Side Effects: NONE Notes: NONE
- ($txt || undef) = next_msg
- Returns the next warning message in the list. If there are no more messages, it will return undef. Throws: NONE Side Effects:
- *
- Sets global variable CW%HTML::Mason::Commands::session Notes: NONE
- $num = num_msg
- Returns the current number of warning messages. Throws: NONE Side Effects: NONE Notes: NONE
- clear_msg
- Clears out all the error messages remaining. This should be called after all messages have been processed. Throws: NONE Side Effects:
- *
- Sets global variable CW%HTML::Mason::Commands::session Notes: NONE Returns an array reference. If CW$arg is an anonymous array, it is simply returned. If it's a defined scalar, it's returned as the single value in an anonymous array. If it's undef, an empty anonymous array will be returned. Throws: NONE. Side Effects: NONE. Notes: NONE. Returns a preference value. Throws:
- *
- Unable to instantiate preference cache.
- *
- Unable to populate preference cache.
- *
- Unable to connect to database.
- *
- Unable to prepare SQL statement.
- *
- Unable to execute SQL statement.
- *
- Unable to bind to columns to statement handle.
- *
- Unable to fetch row from statement handle.
- *
- Unable to get cache value. Side Effects: NONE. Notes: Uses Bric::Util::Pref->lookup_val() internally. Returns the package name given a short name. Throws: NONE. Side Effects: NONE. Notes: NONE.
- (1 || 0) = set_redirect($loc)
- $loc = get_redirect
- $loc = del_redirect
- Get/Set/Delete a redirect to happen during the next page load that includes the 'header.mc' header element. Throws: NONE Side Effects:
- *
- Sets global variable CW%HTML::Mason::Commands::session Notes: This only works with pages that use the 'header.mc' element.
- (1 || 0) = do_queued_redirect
- If there is a redirected set, then redirect the browser, otherwise return. Throws: NONE Side Effects: NONE Notes: NONE
- (1 || 0) = redirect
- Redirect to a different location. Throws: NONE Side Effects: NONE Notes: NONE
- (1 || 0) = redirect_onload()
-
redirect('/'); redirect('/', $cbh);
Uses a JavaScript function call to redirect the browser to a different location. Will not clear out the buffer first, so stuff sent ahead will still draw in the browser. If a Params::Callback object is passed in as the second argument, the Apache request object will be used to send the JavaScript to the Browser and the callback handler object will be used to abort the request. Otherwise, the Mason request object will be used to send the JavaScript to the browser and to abort the request. Throws: NONE. Side Effects: Becuase CWredirect_onload() executes immediately, if it is called from a callback, note that no further callbacks will be executed, not even post-callback request callbacks. Notes: NONE. - status_msg($msg)
- severe_status_msg($msg)
- Sometimes there's a long process executing, and you want to send status messages to the browser so that the user knows what's happening. These functions will do this for you. Call CWstatus_msg() each time you want to send a status messages, and it'll take care of the rest for you. The CWsevere_status_msg() will do the same, but convert the message into a red, bold-fased message before sending it to the browser. When you're done sending status messages, you can either redirect to another page, or simply finish drawing the current page. It will draw in below the status messages. This function will work both in callbacks and in Mason UI code. Throws: NONE. Side Effects: NONE. Notes: NONE.
- log_history($args)
- Log the current URL for historical purposes. Throws: NONE Side Effects: Populates the history key of the session data. Notes: NONE
- $uri = last_page($n);
- Grab the CW$n-th page visited. Argument CW$n defaults to 1, or the very last page (A CW$n value of 0 is the current page). Only MAX_HISTORY pages are saved. Throws: NONE Side Effects: NONE Notes: NONE
- $uri = pop_page;
- Grab the CW$n-th page visited. Argument CW$n defaults to 1, or the very last page (A CW$n value of 0 is the current page). Only MAX_HISTORY pages are saved. Throws: NONE Side Effects: NONE Notes: NONE Returns CW$section (e.g. admin), CW$mode (e.g. manager, profile) and CW$type (e.g. user, media, etc). This is centralized here in case it becomes a complicated thing to do. And, centralizing is nice. Throws: NONE Side Effects: NONE Notes: Was comp/lib/util/parseUri.mc.
- $href = detect_agent;
- Returns an HTTP::BrowserDetect object. The object is cached for efficiency. Throws: NONE Side Effects: NONE Notes: Was comp/widgets/util/detectAgent.mc Returns a workflow of a particular type in a given site for which the user has a given permission to the documents and/or templates in that workflow. Returns CWundef if no workflow is found. Returns the desk in the given workflow for which the user has the permission to access its documents and/or templates. Returns CWundef if no desk is found. Returns a list or array reference of sites to which the user has the specified permission.
Public Instance Methods
NONE
Private Methods
NONE
Private Class Methods
NONE
Private Instance Methods
NONE
NOTES
NONE
AUTHOR
Garth Webb <garth@perijove.com> David Wheeler <david@wheeler.net>
SEE ALSO
perl, Bric