</permacrud>
</class>
+ <class id="es" controller="open-ils.cstore" oils_obj:fieldmapper="config::strings" reporter:label="General translations" oils_persist:tablename="config.strings" reporter:lable="I18N Functional Strings">
+ <fields oils_persist:primary="purpose">
+ <field reporter:label="Purpose" name="purpose" reporter:datatype="text"/>
+ <field reporter:label="Key String" name="string" reporter:datatype="text" oils_persist:i18n="true"/>
+ </fields>
+ <links/>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <create permission="ADMIN_STRINGS" global_required="true"/>
+ <retrieve/>
+ <update permission="ADMIN_STRINGS" global_required="true"/>
+ <delete permission="ADMIN_STRINGS" global_required="true"/>
+ </actions>
+ </permacrud>
+ </class>
+
<class id="ateo" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="action_trigger::event_output" oils_persist:tablename="action_trigger.event_output" reporter:label="Event Output">
<fields oils_persist:primary="id" oils_persist:sequence="action_trigger.event_output_id_seq">
_initialize_parser($parser) unless $parser->initialization_complete;
#If this is a boolean search set the human readable operators
- if(exists $args{"_boolean"}) {
- $operators = retreave_boolean_keywords($args{"_boolean"});
-
- foreach my $op (keys %{$operators}){
- $parser->operator($op, $operators->{$op});
+ if($args{"_boolean"} eq 'true') {
+ for my $op ( @{ new_editor->search_config_strings( {purpose => {like => 'bool-op-%'}} ) } ) {
+ my $key = $op->purpose;
+ #strip off the purpose prefix leaving just the operator
+ $key =~ s/^bool-op-//;
+ $parser->operator( $key, $op->string );
}
}
cachable => 1,
);
-sub retreave_boolean_keywords {
- my $cache = OpenSRF::Utils::Cache->new;
- my $locale = shift;
- my $operators;
-
- #Reformat locale abreveation [en_us -> en-US]
- $locale =~ s/(\w\w)_(\w\w)/$1\-\U$2\E/g;
-
- #Check cache for localization valuse for the current locale
- $operators = $cache->get_cache("boolsearchlocale.${locale}");
-
- #unless there is a cached set of values load from disk and add to cache
- unless (defined($operators)){
- #there are no operators in the cache so load from the DB
- $operators = {};
- my $editor = new_editor;
- my $results = $editor->json_query({from => ["config.retrieve_keywords_by_locale", $locale]});
-
- foreach my $result (@{$results}){
- $operators->{$result->{operator}} = $result->{keyword};
- }
-
- $cache->put_cache("boolsearchlocale.${locale}", $operators);
- }
-
- #if operators is still empty default to basic english keywords
- if (!defined($operators)){
- $operators->{"and"} = " and ";
- $operators->{"or"} = " or ";
- $operators->{"disallowed"} = " not ";
- }
-
- return $operators;
-}
-
1;
#if this is a boolean search add flag so operators can be set later
if($cgi->param("_boolean")) {
- $args->{"_boolean"} = $ctx->{locale};
+ $args->{"_boolean"} = 'true';
}
if ($tag_circs) {
+++ /dev/null
-INSERT INTO config.boolean_keyword (translation, operator, keyword)
- VALUES ( 'en-US', 'and', ' and '),
- ( 'en-US', 'or', ' or '),
- ( 'en-US', 'disallowed', ' not '),
- ( 'fr-CA', 'and', ' et '),
- ( 'fr-CA', 'or', ' ou '),
- ( 'fr-CA', 'disallowed', ' pas ');
+++ /dev/null
-CREATE OR REPLACE FUNCTION config.retrieve_keywords_by_locale(locale text)
- RETURNS TABLE( operator text, keyword text ) AS
-$BODY$
-BEGIN
-
- RETURN QUERY
- SELECT bk.operator, bk.keyword FROM config.boolean_keyword bk WHERE translation = locale;
- RETURN;
-END;
-$BODY$
-LANGUAGE plpgsql;
+++ /dev/null
--- DROP TABLE config.boolean_keyword;
-
-CREATE TABLE config.boolean_keyword
-(
- id serial NOT NULL,
- translation text,
- operator text,
- keyword text,
- CONSTRAINT boolean_keyword_pk PRIMARY KEY (id),
- CONSTRAINT boolean_keyword_fk FOREIGN KEY (translation)
- REFERENCES config.i18n_locale (code) MATCH SIMPLE
- ON UPDATE NO ACTION ON DELETE NO ACTION
-)
-WITH (
- OIDS=FALSE
-);
-ALTER TABLE config.boolean_keyword
- OWNER TO evergreen;
--- /dev/null
+create table config.strings (
+ purpose text primary key, -- store a use case label here
+ string text not null -- store the en-US version here
+);
+
+insert into config.strings (purpose,string) values ('bool-op-and',' and ');
+insert into config.i18n_core (fq_field,identity_value,translation,string) values ('es.string',' and ','fr-CA',' et ');
+
+insert into config.strings (purpose,string) values ('bool-op-or',' or ');
+insert into config.i18n_core (fq_field,identity_value,translation,string) values ('es.string',' or ','fr-CA',' ou ');
+
+insert into config.strings (purpose,string) values ('bool-op-disallowed',' not ');
+insert into config.i18n_core (fq_field,identity_value,translation,string) values ('es.string',' not ','fr-CA',' pas ');