CGI-OptimalQuery
view release on metacpan or search on metacpan
}
color => '#cccccc'
specify the background color of the optimal query GUI.
useAjax => 1
Reload the data using ajax. Defaults to 1 unless not specified and
usePopups is set to 0.
NewButton => "<a href=record.pl class=OQnewBut>new</a>"
editButtonLabel => 'edit'
editLink => '/link/to/record'
OptimalQuery will automatically create an edit and new button if
this is defined. When creating the link, OptimalQuery appends
"?id=$$rec{U_ID};act=new;on_update=OQrefresh" or
"?id=$$rec{U_ID};act=load;on_update=OQrefresh" to the link so the
record module will know which view to load. "OQrefresh" is a
function defined by Optimal Query that an external record module can
call to update the Optimal Query window if a record has been
updated.
htmlFooter => "<h1>this is a footer</h1>"
htmlHeader => "<h1>this is a header</h1>"
httpHeader => CGI::header('text/html')
override httpHeader content. If you prefer to not have
InteractiveQuery send the header, set this value to empty string.
mutateRecord => sub { }
mutateRecord => sub {
my $rec = shift;
# add html links to the person record
# if user selected the NAME field
if (exists $$rec{NAME}) {
$$rec{NAME} = "<A HREF=/PersonRecord?id=$$rec{ID}>".
CGI::escapeHTML($$rec{NAME})."</A>";
}
}
noEscapeCol => ['NAME']
if certain columns should not be HTML escaped, let OptimalQuery know
by adding them to this array.
OQdataLCol => sub { }
OQdataRCol => sub { }
Specify custom code to print the first or last column element. This
is most often used to generate an view/edit button. If these
callbacks are used, the editLink, and buildEditLink are ignored.
OQdataLCol => sub {
my ($rec) = @_;
return "<button onclick=\"OQopwin('/ViewRecord?id=$$rec{U_ID};on_update=OQrefresh';\">".
"view</button>";
}
OQdocBottom => "bottom of the document (outside form)"
OQdocTop => "top of the doc (outside form)"
OQformBottom => "bottom of form"
OQformTop => "top of form"
usePopups => 1|0
use popups when opening a record form using the built in buttons The
default is 1. If this is set to 1, useAjax default is 1.
WindowHeight => INT
WindowWidth => INT
Specify popup window width, height.
OQscript => " some javascript code (see examples below) "
OQscript gives you unlimited power to alter the output of optimal
query by allowing you to enter javascript code that is executed
client side For example to add a new command button:
OQscript => "
var e = document.getElementById('OQcmds');
e.innerHTML = '".CGI::OptimalQuery::escape_js(q|<button type=button onclick="window.alert('hello there');">hello</button>|)."' + e.innerHTML;
SAVED SEARCHES
InteractiveQuery can optionally save searches to a database so users can
revisit them latter. To do this, saved searches are tied to a unique
user id. Developers should tell OptimalQuery the user id by defining
'savedSearchUserID' in their %CONFIG.
$config{savedSearchUserID} = $user_id;
Saved Searches are stored in a table in the database pointed to by the
database handle defined in $config{dbh}. The following table must exist
before using saved searches.
-- For mysql:
CREATE TABLE oq_saved_search (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
user_id INT UNSIGNED,
FOREIGN KEY fk_oqsavedsearch_userid (user_id)
REFERENCES XYZ(id) ON DELETE CASCADE,
uri VARCHAR(100) NOT NULL,
oq_title VARCHAR(1000) NOT NULL,
user_title VARCHAR(1000) NOT NULL,
params TEXT,
-- 0:disabled, 1:added, 2:removed, 4:present
alert_mask INT UNSIGNED NOT NULL DEFAULT 0,
alert_interval_min INT UNSIGNED,
alert_dow VARCHAR(7),
alert_start_hour INT UNSIGNED,
alert_end_hour INT UNSIGNED,
alert_last_dt DATETIME,
alert_err TEXT,
alert_uids LONGTEXT,
is_default TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT unq_oq_saved_search UNIQUE (user_id,uri,oq_title,user_title)
);
-- For Oracle:
CREATE TABLE oq_saved_search (
id NUMBER PRIMARY KEY,
user_id NUMBER NOT NULL REFERENCES XYZ(id) ON DELETE CASCADE,
uri VARCHAR2(100) NOT NULL,
oq_title VARCHAR2(1000) NOT NULL,
user_title VARCHAR2(1000) NOT NULL,
params CLOB,
-- 0:disabled, 1:added, 2:removed, 4:present
alert_mask NUMBER DEFAULT 0 NOT NULL,
alert_interval_min NUMBER,
alert_dow VARCHAR2(7),
alert_start_hour NUMBER,
alert_end_hour NUMBER,
alert_last_dt DATE,
( run in 0.838 second using v1.01-cache-2.11-cpan-364913b4093 )