Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4e070acf

Von Sven Schöling vor fast 9 Jahren hinzugefügt

  • ID 4e070acf473ae9992a3561594cce55123be0a7ec
  • Vorgänger c8c1042a
  • Nachfolger 92879200

TopQuickSearch: Konfiguration in client_config

Unterschiede anzeigen:

SL/Controller/ClientConfig.pm
16 16
use SL::Locale::String qw(t8);
17 17
use SL::PriceSource::ALL;
18 18
use SL::Template;
19
use SL::Controller::TopQuickSearch;
19 20

  
20 21
__PACKAGE__->run_before('check_auth');
21 22

  
22 23
use Rose::Object::MakeMethods::Generic (
23
  'scalar --get_set_init' => [ qw(defaults all_warehouses all_weightunits all_languages all_currencies all_templates all_price_sources h_unit_name
24
  'scalar --get_set_init' => [ qw(defaults all_warehouses all_weightunits all_languages all_currencies all_templates all_price_sources h_unit_name available_quick_search_modules
24 25
                                  all_project_statuses all_project_types
25 26
                                  posting_options payment_options accounting_options inventory_options profit_options balance_startdate_method_options) ],
26 27
);
......
191 192
  [ map { [ $_->name, $_->description ] } @classes ];
192 193
}
193 194

  
195
sub init_available_quick_search_modules {
196
  [ SL::Controller::TopQuickSearch->new->available_modules ];
197
}
198

  
194 199
#
195 200
# filters
196 201
#
SL/Controller/TopQuickSearch.pm
57 57
  map { $_->new } @available_modules;
58 58
}
59 59

  
60
sub enabled_modules {
61
  my %enabled_names = map {
62
    $_ => 1
63
  } @{ $::instance_conf->get_quick_search_modules };
64

  
65
  grep {
66
    $enabled_names{$_->name}
67
  } $_[0]->available_modules
68
}
69

  
60 70
sub active_modules {
61 71
  grep {
62 72
    $::auth->assert($_->auth, 1)
63
  } $_[0]->available_modules
73
  } $_[0]->enabled_modules
64 74
}
65 75

  
66 76
sub init_module {
......
118 128
This controller provides abstraction for different search plugins, and ensures
119 129
that all follow a common useability scheme.
120 130

  
121
Modules should be configurable, but currently are not. Diabling modules can be
122
done by removing them from available_modules.
131
Modules should be configurable per user, but currently are not. Disabling
132
modules can be done by removing them from available_modules or in client_config.
123 133

  
124 134
=head1 BEHAVIOUR REQUIREMENTS
125 135

  
......
161 171

  
162 172
=head1 INTERFACE
163 173

  
164
Plugins need to provide:
165

  
166
 - name
167
 - localized description for config
168
 - localized description for textfield
169
 - autocomplete callback
170
 - redirect callback
171

  
172
the frontend will only generate urls of the forms:
173
  action=TopQuickSearch/autocomplete&module=<module>&term=<term>
174
  action=TopQuickSearch/search&module=<module>&term=<term>
174
The full interface is described in L<SL::Controller::TopQuickSeach::Base>
175 175

  
176 176
=head1 TODO
177 177

  
178
 - filter available searches with auth
179 178
 - toggling with cofiguration doesn't work yet
180 179

  
181 180
=head1 BUGS
SL/Controller/TopQuickSearch/Base.pm
48 48

  
49 49
=item C<description_config>
50 50

  
51
Localized name used in the configuration (NYI)
51
Localized name used in the configuration.
52 52

  
53 53
=item C<description_field>
54 54

  
SL/Controller/TopQuickSearch/GLTransaction.pm
12 12

  
13 13
sub auth { 'general_ledger' }
14 14

  
15
sub name { 'gl_transction' }
15
sub name { 'gl_transaction' }
16 16

  
17 17
sub description_config { t8('GL search') }
18 18

  
SL/DB/MetaSetup/Default.pm
84 84
  project_type_id                           => { type => 'integer' },
85 85
  purchase_delivery_order_show_delete       => { type => 'boolean', default => 'true' },
86 86
  purchase_order_show_delete                => { type => 'boolean', default => 'true' },
87
  quick_search_modules                      => { type => 'array' },
87 88
  reqdate_interval                          => { type => 'integer', default => '0' },
88 89
  require_transaction_description_ps        => { type => 'boolean', default => 'false', not_null => 1 },
89 90
  requirement_spec_section_order_part_id    => { type => 'integer' },
locale/de/all
221 221
  'All clients'                 => 'Alle Mandanten',
222 222
  'All general ledger entries'  => 'Alle Hauptbucheinträge',
223 223
  'All groups'                  => 'Alle Gruppen',
224
  'All modules'                 => 'Alle Module',
224 225
  'All of the exports you have selected were already closed.' => 'Alle von Ihnen ausgewählten Exporte sind bereits abgeschlossen.',
225 226
  'All partsgroups'             => 'Alle Warengruppen',
226 227
  'All price sources'           => 'Alle Preisquellen',
......
1114 1115
  'Employees'                   => 'Benutzer',
1115 1116
  'Empty selection for warehouse will not be added, even if the old bin is still visible (use back and forth to edit again).' => 'Leere Lager-Auswahl wird ignoriert, selbst wenn noch ein Lagerplatz ausgewählt ist. Alle Daten können durch zurück und vorwärts korrigiert werden.',
1116 1117
  'Empty transaction!'          => 'Buchung ist leer!',
1118
  'Enabled Quick Searched'      => 'Aktivierte Schnellsuchen',
1119
  'Enabled modules'             => 'Aktivierte Module',
1117 1120
  'End date'                    => 'Enddatum',
1118 1121
  'Enter a description for this new draft.' => 'Geben Sie eine Beschreibung f&uuml;r diesen Entwurf ein.',
1119 1122
  'Enter longdescription'       => 'Langtext eingeben',
......
2184 2187
  'Quarterly'                   => 'quartalsweise',
2185 2188
  'Query Type'                  => 'Art der Abfrage',
2186 2189
  'Queue'                       => 'Warteschlange',
2190
  'Quick Searches that will be shown in the header in this client' => 'Schnellsuchen, die in der Kopfzeile in diesem Mandanten gezeigt werden sollen',
2187 2191
  'Quotation'                   => 'Angebot',
2188 2192
  'Quotation Date'              => 'Angebotsdatum',
2189 2193
  'Quotation Date missing!'     => 'Angebotsdatum fehlt!',
sql/Pg-upgrade2/defaults_add_quick_search_modules.sql
1
-- @tag: defaults_add_quick_search_modules
2
-- @description: Mandantenkonfiguration für Schnellsuche
3
-- @depends: release_3_4_0
4
-- @encoding: utf-8
5

  
6
ALTER TABLE defaults ADD COLUMN quick_search_modules TEXT[];
7

  
8
UPDATE defaults SET quick_search_modules = '{"contact","gl_transaction"}';
templates/webpages/client_config/_features.html
174 174
   <td>[% L.yes_no_tag('defaults.show_longdescription_select_item', SELF.defaults.show_longdescription_select_item) %]</td>
175 175
  </tr>
176 176

  
177
  <tr><td class="listheading" colspan="4">[% LxERP.t8("Enabled Quick Searched") %]</td></tr>
178
  <tr>
179
    <td align="right">[% 'Quick Searches that will be shown in the header in this client' | $T8 %]</td>
180
    <td colspan=2>
181
      <div class="clearfix">
182
       [% L.select_tag("defaults.quick_search_modules[]", SELF.available_quick_search_modules, value_key="name", title_key="description_config", id="defaults_quick_searches", multiple=1, default=SELF.defaults.quick_search_modules) %]
183
       [% L.multiselect2side("defaults_quick_searches", labelsx=LxERP.t8("All modules"), labeldx=LxERP.t8("Enabled modules")) %]
184
      </div>
185
    </td>
186
  </tr>
187

  
177 188
 </table>
178 189
</div>
templates/webpages/menu/header.html
6 6
    [<a href="controller.pl?action=LoginScreen/user_login" target="_blank" title="[% 'Open a further kivitendo window or tab' | $T8 %]">[% 'New window/tab' | $T8 %]</a>]
7 7
    [<a href="JavaScript:top.print();" title="[% 'Hardcopy' | $T8 %]">[% 'Print' | $T8 %]</a>]
8 8

  
9
[%- FOREACH search = quick_search.active_modules %]
9
[%- FOREACH search = quick_search.enabled_modules %]
10 10
    [<input id="top-quick-search-[% search.name %]" module="[% search.name %]" placeholder="[% search.description_field %]" maxlength="20">]
11 11
[%- END %]
12 12

  

Auch abrufbar als: Unified diff