WebTool::UI - The main Guardian Digital WebTool user interface class.
This module contains the core WebTool user-interface API and is not
normally called directly. WebTool::UI::Std and WebTool::UI::Popup
inherit from this class, therefore all of the functions present in
this module are available in them.
- disable_construct_page()
This function disables current object's construct page
property.
Example usage:
my $page->disable_construct_page();
- enable_construct_page()
This function enables current object's construct page
property.
Example usage:
my $page->enable_construct_page();
- disable_http_header()
This function disables current object's 'show http header'
property.
Example usage:
my $page->disable_http_header();
- disable_page_top()
This function disables current object's 'show_top' property.
Its usually called to hide the top layout of page.
Example usage:
my $page->disable_page_top();
- disable_page_bottom()
This function disables current object's 'show_bottom'
property. Its usually called to hide the bottom layout of
page.
Example usage:
my $page->disable_page_bottom();
- set_page_title($)
This function sets current page's 'title' property. If this
optional argument is not passed than default page title from
global constant DEFAULT_PAGE_TITLE is set.
Example usage:
my $title = "Guardian Digital Inc.";
my $page->set_page_title($title);
- set_page_top($)
This function sets current page's top layout to data provided
as argument.
Example usage:
my $data = "Guardian Digital Inc.";
my $page->set_page_top($data);
- set_page_bottom($)
This function sets current page's bottom layout to data
provided as argument.
Example usage:
my $data = "Guardian Digital Inc.";
my $page->set_page_bottom($data);
- hide_selects()
This function enables javascript code which will hide SELECT
objects when the navigation bar is active.
Example usage:
$page->hide_selects();
- unhide_selects()
This function disables javascript code which will unhide
SELECT objects when the navigation bar is inactive.
Example usage:
$page->unhide_selects();
- enable_overlib()
This function is used to enable the javascript code which
shows purpol box "over" current page showing some extra
information.
Example usage:
$page->enable_overlib();
- disable_overlib()
This function is used to disable the javascript code which
shows purpol box "over" current page showing some extra
information.
Example usage:
$page->disable_overlib();
- tmpl_load($)
This function receives html template file as argument and
loads it.
Example usage:
$page->tmpl_load($tmpl_file);
- tmpl_set($$)
This function receives key and value as arguments and sets
html template's variables accordingly.
Example usage:
$page->tmpl_set('title' => 'Edit Local Group');
- tmpl_translate($)
This function takes a string as an argument and returns the
translated form of it as per the lang/<language> file.
Example usage:
$title = $page->tmpl_translate('viewstatustitle');
- send_http_header($)
This function is basically used for setting desired http
header(content type). This function receives one optional
argument header type. Default value is 'text/html'.
Example usage:
$page->send_http_header();
- draw_page()
According to the properties set, This function translates and
return the page if only asked to construct_page, otherwise
actually print it to the browser.
Example usage:
$page->draw_page();
- err($@@)
This function is used to display an error pop-up using
JavaScript. The first argument is the error message that you
want to appear in the pop-up. The other two option arguments
are whether or not it's fatal (default is true) and how far
back the JavaScript should take them (default is -1, or back
one page).
Example usage:
my $msg = "An error Occured";
$page->err($msg);
- close_popup()
This function is used to close the popup using javascript.
Example usage:
$page->close_popup();
- popup_button($$@@@)
This function creates HTML BUTTON(SUBMIT) element so that
pop-up window can be opened when its clicked. It receives
five arguments( 2 mandetory and 3 optional). From those link
and display(value property of button) are mandetory whereas
width, height and key are optional.
Example usage:
my $create = $page->popup_button('edit_route.cgi', 'create_route', 550, 250);
- popup_link($$@@@)
This function creates HTML HYPERLINK element so that pop-up
window can be opened when its clicked. It receives five
arguments( 2 mandetory and 3 optional). From them link and
display(text to be displayed) are mandetory whereas width,
height and key are optional.
Example usage:
$page->popup_link("edit_client.cgi", "edit client", 400, 300);
- make_button_link($$)
This function creates a HTML BUTTON(SUBMIT) element which
function like a link so that it opens a target location when
clicked. It receives target location and display string as
arguments.
Example usage:
my $button = $page->make_button_link('edit_interface.cgi','CLICK ME');
- make_overlib($@)
This function reformats it's argument into a format suitable
for being stuffed into overlib. Typically this involves
escaping any javaScript metacharacters (', ") and converting
any newlines (\r\n, \n) to <BR>eaks. It then returns
JavaScript code which is suitable for displaying the
overlib.It receives two arguments (content and width),
Default value for width is 200.
Example usage:
my $rv = $page->make_overlib($table, $size);
- make_link($$)
This function simply creates a HTML HYPERLINK ELEMENT. It
receives two arguments (target and display text).
Example usage:
$page->make_link("edit_slave_zone.cgi", $name);
- input_button($$)
This function creates a HTML BUTTON element. It receives two
button properties as arguments (name and value).
Example usage:
$page->input_button('create', 'Create Host');
- input_checkbox($$$)
This function creates HTML CHECKBOX element. It receives
three checkbox properties as arguments (name, value,
checked/unchecked).
Example usage:
$page->input_checkbox('shutdown_confirm', 1, 0));
- input_hidden($@)
This function creates HTML HIDDEN element. It receives two
properties as arguments (name, value).
Example usage:
$page->input_hidden('device_orig', $route->{'device'}));
- input_password($$@@)
This function creates HTML PASSWORD field. It receives four
property values as arguments (name, value,size and maximum
length).
Example usage:
$page->input_password('password1', '', 15));
- input_radio($$$)
This function creates HTML RADIOBUTTON element. It receives
three arguments (name, value, checked/unchecked).
Example usage:
$page->input_radio('usessl', 'yes', 'no');
- input_select($$$)
This function creates HTML SELECT element. It receives three
arguments. Name, default selected value and array reference
of all the selection option.
Example usage:
$page->input_select('language', $selected, \@languages);
- input_text($$$@)
This function creates HTML TEXT element. It receives four
arguments: name,value,size,maxlength.
Example usage:
$page->input_text('username', $username, 15, 20));
- input_textarea($$@@@)
This function creates HTML TEXTAREA element. It receives five
arguments: name,value,rows(default 6), columns(default 30)
and wrap(default 'virtual').
Example usage:
$page->input_textarea('allowfrom', '127.0.0.1/32', 4, 14));
- input_upload($)
This function creates HTML INPUTBOX of type FILE. It receives
name as an argument.
Example usage:
$page->input_upload('key_up');
- input_icb($@@@)
This function creates an interface chooser box. Basically it
returns a button that we show on page, clicking on this
button will show a pop up of all the interfaces currently
defined on the system. From pop up we can select an interface
and selection will be placed in input box of calling page.
Example usage:
$page->input_icb('iface', 'address', 0));
- input_gcb($@@)
This function creates an group chooser box. Basically it
returns a button that we show on page, clicking on this
button will show a pop up of all the groups the system. From
pop up we can select a group and selection will be placed in
input box of calling page.
Example usage:
$page->input_gcb('group', 0);
- input_ucb($@@)
This function creates an user chooser box. Basically it
returns a button that we show on page, clicking on this
button will show a pop up of all the users the system. From
pop up we can select a user and selection will be placed in
input box of calling page.
Example usage:
$page->input_ucb('recipient', 0, $cnt);
- make_textarea_array($)
This function receives data from textarea, removes newlines,
splits data on white spaces and gives back data in array
form.
Example usage:
my @dns_search = $page->make_textarea_array($textarea);
- process_form()
This function returns hash containing form element/data as
key/value pairs.
Example usage:
my %in = WebTool::UI::process_form();
- process_form_mime()
This function works the same as process_form but it handles
multipart/form-data encoded data, typically file uploads. It
parses form data and returns a hash containing key-value
pairs.
Example usage:
my %in = WebTool::UI::process_form_mime();
- redirect($)
This function redirects to page/url provided as argument.
Example usage:
WebTool::UI::redirect('list_groups.cgi');
- str_truncate($@)
This function truncates the string on the basis of parameters
passed and returns the truncated string. default truncation
length is 20.
Example usage:
my $gcos = $page->str_truncate($string, 20);
- kill_whitespace($)
This function removes the white spaces from passed argument
string.
Example usage:
my $s_comment = $page->kill_whitespace("Remove White Space From Me");
Ryan W. Maple <ryan@guardiandigital.com>
Copyright Guardian Digital, Inc., All Rights Reserved