Difference between revisions of "How to make a Screen perform Actions"
Line 8: | Line 8: | ||
# Some ''action'' buttons | # Some ''action'' buttons | ||
# Some packages to process the actions | # Some packages to process the actions | ||
− | + | ## The routines could all be contained in the one package, or spread out over several packages | |
# Some ''action'' routines | # Some ''action'' routines | ||
## A ''allow'' routine | ## A ''allow'' routine |
Revision as of 10:32, 15 April 2010
Works in EPrints 3.2+
Please read the page on How_to_make_a_Screen_for_the_Admin_Section as this extends that information.
What's happening
The process has four parts:
- Some action buttons
- Some packages to process the actions
- The routines could all be contained in the one package, or spread out over several packages
- Some action routines
- A allow routine
- An action routine
- Where to go after the action completes
Making the buttons
The action buttons are the functionality that make the work... well, flow.
You need to define the "screen" (perl package) that contains the actions, and what the actions are.
The $s->render_action_buttons
function takes a hash, which describes the set of buttons to display:
my %buttons = ( cancel => $self->phrase( "action:cancel:title" ), # Is defined as "Cancel" update => $self->phrase( "action:update:title" ), # Is defined as "Update" _order => [ "update", "cancel" ], _class => "ep_form_button_bar" ); $f->appendChild( $s->render_action_buttons( %buttons ) );
cancel => $self->phrase( "action:cancel:title" )
describe one action button: the internal name for the action and the text to be used for that button. You may have any number of buttons._order
is a reference to a list defining the order for the buttons. With nothing defined, the order will be random._class
defines the css class to give to the div that contains the buttons.
The above code would produce the following (x)html:
<div class="ep_form_button_bar"> <input type="submit" class="ep_form_action_button" onclick="return EPJS_button_pushed( '_action_update' )" name="_action_update" value="Update"> <input type="submit" class="ep_form_action_button" onclick="return EPJS_button_pushed( '_action_cancel' )" name="_action_cancel" value="Cancel"> </div>