Solstice::ButtonService - A service that tracks what buttons have been created for a page.


Solstice documentation  | view source Contained in the Solstice distribution.

Index


NAME

Top

Solstice::ButtonService - A service that tracks what buttons have been created for a page.

SYNOPSIS

Top

  use Solstice::ButtonService;

  my $button_service = new Solstice::ButtonService;

  $button_service->initialize($my_solstice_session);

  Functions for views: 
  Standard buttons
  my $button = $button_service->makeButton( {
    label => 'Text on button',
    title => 'Title, for text links',
    action => 'TheKeywordInState.xml',
    client_action => 'Name of a Javascript function to happen onClick',
    attributes => {
      keys => 'and values',
      that => 'will be retrievable in controller',
    },
  } );

  If you are creating a link to another application, add the application's url:
  my $button = $button_service->makeButton( {
    label => 'Text on button',
    title => 'Title, for text links',
    action => 'TheKeywordInState.xml',
    url    => '/tools/webq/',
    client_action => 'Name of a Javascript function to happen onClick',
    attributes => {
      keys => 'and values',
      that => 'will be retrievable in controller',
    },
  } );




  Flyout menus
  my $button = $button_service->makeFlyoutButton( {
    label => 'Text on button',
    title => 'Title, for text links',
    action => 'TheKeywordInState.xml',
    flyout_actions => [ {
        label => 'Text on button',
        title => 'Title, for text links',
        action => 'TheKeywordInState.xml',
    },
    {
        label => 'Text on button',
        title => 'Title, for text links',
        action => 'TheKeywordInState.xml',
    }, ... ],
  } );

  Pop-in buttons
  You may also use buttonservice to create "pop ins", as long as you create the Solstice::View::PopIns on the same page

  my $pop_in = $button_service->makePopinButton( {
    label => "Text on link",
  } );

  See Button.pm for details on how to use the button objects.

  Functions for controllers:
  my $button = $button_service->getSelectedButton();
  my $attribute = $button_service->getAttribute('keyname');

DESCRIPTION

Top

This manages all action objects on a page, including buttons, links, image links, and all of those as popups. Using ButtonService is required for actions to take place, otherwise the page a button was clicked on will just reload.

This must be initialized with a Solstice::Session, preferably the only one created in your application.

Superclass

Solstice::Service

Export

No symbols exported.

Methods

new()

Constructor.

initialize($session)

This is a required function to get functionality. This gets the session id from session.

makeButton($params)

This will create a Button object from the param hash. For a normal button, the following keys should be defined: label, action. The following keys can be defined: title, attributes, client_action, popup_attributes.

client_action is the name of a Javascript function. The name given will be appended with "(form)", where form is the form object of the page.

popup_attributes is a string that controls what a popup window will look like, if the button is rendered as a popup.

makeLoginButton($params)

This creates a button that forces the user to login. This button will override any action you give it with a special action used to force the login.

makePopinButton(\%params)
makeStaticButton(\%params)

Creates a button to a bookmarkable url.

makeFlyoutButton(\%params)

Create a button that contains child buttons.

commit()

This commits all of the created buttons to the database, and clears our global memory.

getSelectedButton()

Returns the button that was selected on the previous page, if a button was selected. Otherwise returns undef.

getAttribute('attribute_key')

If there was a selected button on the previous screen, and that button had the given attribute key, this will return the value attached to that key. Otherwise it will return undef. There will be a warning in the error log if there was no button selected.

Private Methods

_clear()

Undef all global data

_makeButton($class, \%params)
_generateButtonName()

Return a unique button name string.

_selectedButtonLookup($selected_button_name)
_storeButtonList(\@button_array, $commit_id)
_isButtonStorable($button)
setHasJavascript($bool)
_hasJavascript()
_getClassName()

Return the class name. Overridden to avoid a ref() in the superclass.

Modules Used

Solstice::Button, Solstice::Button::Disabled (Solstice::Button::Disabled), Solstice::Button::Flyout, Solstice::Service, Solstice::Database, Solstice::Session, Carp (Carp).

AUTHOR

Top

Catalyst Group, <catalyst@u.washington.edu>

VERSION

Top

$Revision: 3396 $

COPYRIGHT

Top


Solstice documentation  | view source Contained in the Solstice distribution.