From 19916858396e3e916fd2cae2ed274324046900db Mon Sep 17 00:00:00 2001 From: Yung Han Khoe Date: Wed, 26 Apr 2006 12:56:18 +0000 Subject: [PATCH] Added default view property to SQLForm. Removed unused viewTemplateId from SQLForm table. Updated help and international. --- docs/upgrades/upgrade_6.8.8-6.99.0.pl | 2 +- lib/WebGUI/Asset/Wobject/SQLForm.pm | 26 +++++++++++++++++++++--- lib/WebGUI/Help/Asset_SQLForm.pm | 6 ++++++ lib/WebGUI/i18n/English/Asset_SQLForm.pm | 12 ++++++++++- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/docs/upgrades/upgrade_6.8.8-6.99.0.pl b/docs/upgrades/upgrade_6.8.8-6.99.0.pl index 4e4c1ba25..cca18d2a6 100644 --- a/docs/upgrades/upgrade_6.8.8-6.99.0.pl +++ b/docs/upgrades/upgrade_6.8.8-6.99.0.pl @@ -999,7 +999,7 @@ CREATE TABLE SQLForm ( assetId varchar(22) NOT NULL default '', formId varchar(22) default NULL, tableName varchar(255) default NULL, - viewTemplateId varchar(22) default NULL, + defaultView varchar(22) default NULL, searchTemplateId varchar(22) default NULL, editTemplateId varchar(22) default NULL, submitGroupId varchar(22) default NULL, diff --git a/lib/WebGUI/Asset/Wobject/SQLForm.pm b/lib/WebGUI/Asset/Wobject/SQLForm.pm index 0740dd6f1..828592bcf 100644 --- a/lib/WebGUI/Asset/Wobject/SQLForm.pm +++ b/lib/WebGUI/Asset/Wobject/SQLForm.pm @@ -838,6 +838,10 @@ sub definition { fieldType => 'databaseLink', defaultValue => 0, }, + defaultView => { + fieldType => 'selectBox', + defaultValue => 'normalSearch', + }, } }); return $class->SUPER::definition($session, $definition); @@ -964,6 +968,17 @@ sub getEditForm { -value => $self->get('searchTemplateId'), -namespace => 'SQLForm/Search', ); + $tabform->getTab('display')->selectBox( + -name => 'defaultView', + -label => $i18n->get('gef default view'), + -hoverHelp => $i18n->get('gef default view description'), + -value => [$self->get('defaultView')], + -options => { + 'normalSearch' => $i18n->get('s normal search'), + 'superSearch' => $i18n->get('s advanced search') + }, + -multiple => 0, + ); $tabform->getTab('security')->group( -name => 'submitGroupId', -label => $i18n->get('gef submit group'), @@ -1282,8 +1297,11 @@ sub view { my $self = shift; my ($output, @links); - - return $output .$self->www_search; + if ($self->get('defaultView') eq 'superSearch') { + return $output .$self->www_superSearch; + }else{ + return $output .$self->www_search; + } } #------------------------------------------------------------------- @@ -3382,7 +3400,6 @@ sub _constructSearchForm { 2 => $i18n->get('_csf normal and trash') ); - $self->session->style->setScript($self->session->config->get("extrasURL").'/'.'wobject/SQLForm/SQLFormSearch.js', {type => 'text/javascript'}); my $searchType = $self->session->form->process("searchType") || $self->session->scratch->get('SQLForm_'.$self->getId.'searchType') || 'or'; @@ -3486,6 +3503,7 @@ my $cmd = "WebGUI::Form::$searchElement".'($self->session, $parameters)'; $form .= ''.WebGUI::Form::submit($self->session, {value => $i18n->get('s search button')}).''; $form .= ''; $form .= WebGUI::Form::formFooter($self->session); + $form .= ''; $form .= ''; return $form; @@ -3838,6 +3856,8 @@ my $sth = $dbLink->db->unconditionalRead($sql); $var->{showMetaData} = $self->get('showMetaData'); $var->{managementLinks} = $self->_getManagementLinks; + # Only process style if search is called directly; + return $self->processTemplate($var, $self->getValue('searchTemplateId')) unless ($self->session->form->process("func") eq 'superSearch'); return $self->processStyle($self->processTemplate($var, $self->getValue('searchTemplateId'))); } diff --git a/lib/WebGUI/Help/Asset_SQLForm.pm b/lib/WebGUI/Help/Asset_SQLForm.pm index 802b39074..80e425933 100644 --- a/lib/WebGUI/Help/Asset_SQLForm.pm +++ b/lib/WebGUI/Help/Asset_SQLForm.pm @@ -53,6 +53,12 @@ our $HELP = { namespace => 'Asset_SQLForm', }, + { + title => 'gef default view', + description => 'gef default view description', + namespace => 'Asset_SQLForm', + }, + { title => 'gef submit group', description => 'gef submit group description', diff --git a/lib/WebGUI/i18n/English/Asset_SQLForm.pm b/lib/WebGUI/i18n/English/Asset_SQLForm.pm index 53452a925..43f9919da 100644 --- a/lib/WebGUI/i18n/English/Asset_SQLForm.pm +++ b/lib/WebGUI/i18n/English/Asset_SQLForm.pm @@ -829,7 +829,7 @@ not possible ta add fields. Please add at least one field type by going to|, 'gef table name description' => { message => q|

This is the name the table you want to attach should get in the database, or if you want to attach the SQLForm to an existing -table, the nam of that table.

|, +table, the name of that table.

|, lastUpdated => 0, }, @@ -908,6 +908,16 @@ search results.

|, lastUpdated => 0, }, + 'gef default view' => { + message => q|Default view|, + lastUpdated => 0, + }, + + 'gef default view description' => { + message => q|

This property switches the default view between normal and advanced search.

|, + lastUpdated => 0, + }, + 'gef submit group' => { message => q|Group to submit records|, lastUpdated => 0,