Hi Syed,
I've made a bit of progress in my quest here. I was unable to set anything with marteditor that set a filter on by default. But it was a minor mod to Web.pm that allowed me to do it. When creating a new session, I set a session param for the filtercollection to be 'on' if any of the associated filters in the collection had defaultOn set:
if($session->is_new()) {
#### If the URL string does not contain a session ID or an inexistent session ID then a
#### new session gets created and stored and script returns with out doing anything.
#### Then comes back again and tries to restore this session ID,
#### and this time around, finds it and restores it. weirdoooo
#### We will turn on any filter collection if one of the filters has defaultOn set.
foreach my $vs (@{$self->get_mart_registry->getAllVirtualSchemas}) {
foreach my $mt (@{$vs->getAllMarts()}) {
foreach my $ds (@{$mt->getAllDatasets()}) {
foreach my $ct (@{$ds->getAllConfigurationTrees()}) {
foreach my $ft (@{$ct->getAllFilterTrees()}) {
foreach my $gp (@{$ft->getAllFilterGroups()}) {
foreach my $cl (@{$gp->getAllCollections()}) {
foreach my $fi (@{$cl->getAllFilters()}) {
if ($fi->defaultOn) {
$session->param($ds->name.'__filtercollection.'.$cl->name,'on');
}
}
}
}
}
}
}
}
}
this
almost worked. I also needed to comment out some code in save_session:
# added this as now turned off checkboxes have no CGI param rather
# than value = "off" to save on the huge CGI object having to be sent
# across from client browser for every attribute and filter
my %session_hashref = %{$session->param_hashref()};
foreach my $param_name (keys %session_hashref){
if (($session->param($param_name) and $session->param($param_name) eq 'on') &&
!($cgi->param($param_name))){
$session->param($param_name,'off');
}
}
I wanted to ask about the thinking behind this block. (I know: it's hard for me to remember why I put some things in code last week. Forget about something as old as this.)
Was the thinking to remove some clutter in session parameters? The comment seems to hint that the problem lies in session parameters set to 'off' yet the code works with parameters set to 'on'.
Or was there some other implications that required this?
Thanks again,
Joe