Lines 34-40
sub set_lang {
Link Here
|
34 |
my ($self, $lang) = @_; |
34 |
my ($self, $lang) = @_; |
35 |
|
35 |
|
36 |
$self->{lang} = $lang; |
36 |
$self->{lang} = $lang; |
37 |
$self->{po_path_lang} = $self->{context}->config('intrahtdocs') . |
37 |
$self->{po_path_lang} = C4::Context->config('intrahtdocs') . |
38 |
"/prog/$lang/modules/admin/preferences"; |
38 |
"/prog/$lang/modules/admin/preferences"; |
39 |
} |
39 |
} |
40 |
|
40 |
|
Lines 43-51
sub new {
Link Here
|
43 |
|
43 |
|
44 |
my $self = { }; |
44 |
my $self = { }; |
45 |
|
45 |
|
46 |
my $context = C4::Context->new(); |
46 |
$self->{path_pref_en} = C4::Context->config('intrahtdocs') . |
47 |
$self->{context} = $context; |
|
|
48 |
$self->{path_pref_en} = $context->config('intrahtdocs') . |
49 |
'/prog/en/modules/admin/preferences'; |
47 |
'/prog/en/modules/admin/preferences'; |
50 |
set_lang( $self, $lang ) if $lang; |
48 |
set_lang( $self, $lang ) if $lang; |
51 |
$self->{pref_only} = $pref_only; |
49 |
$self->{pref_only} = $pref_only; |
Lines 76-92
sub new {
Link Here
|
76 |
$self->{langs} = \@langs; |
74 |
$self->{langs} = \@langs; |
77 |
|
75 |
|
78 |
# Map for both interfaces opac/intranet |
76 |
# Map for both interfaces opac/intranet |
79 |
my $opachtdocs = $context->config('opachtdocs'); |
77 |
my $opachtdocs = C4::Context->config('opachtdocs'); |
80 |
$self->{interface} = [ |
78 |
$self->{interface} = [ |
81 |
{ |
79 |
{ |
82 |
name => 'Intranet prog UI', |
80 |
name => 'Intranet prog UI', |
83 |
dir => $context->config('intrahtdocs') . '/prog', |
81 |
dir => C4::Context->config('intrahtdocs') . '/prog', |
84 |
suffix => '-staff-prog.po', |
82 |
suffix => '-staff-prog.po', |
85 |
}, |
83 |
}, |
86 |
]; |
84 |
]; |
87 |
|
85 |
|
88 |
# OPAC themes |
86 |
# OPAC themes |
89 |
opendir my $dh, $context->config('opachtdocs'); |
87 |
opendir my $dh, C4::Context->config('opachtdocs'); |
90 |
for my $theme ( grep { not /^\.|lib|xslt/ } readdir($dh) ) { |
88 |
for my $theme ( grep { not /^\.|lib|xslt/ } readdir($dh) ) { |
91 |
push @{$self->{interface}}, { |
89 |
push @{$self->{interface}}, { |
92 |
name => "OPAC $theme", |
90 |
name => "OPAC $theme", |
Lines 98-105
sub new {
Link Here
|
98 |
# MARC flavours (hardcoded list) |
96 |
# MARC flavours (hardcoded list) |
99 |
for ( "MARC21", "UNIMARC", "NORMARC" ) { |
97 |
for ( "MARC21", "UNIMARC", "NORMARC" ) { |
100 |
# search for strings on staff & opac marc files |
98 |
# search for strings on staff & opac marc files |
101 |
my $dirs = $context->config('intrahtdocs') . '/prog'; |
99 |
my $dirs = C4::Context->config('intrahtdocs') . '/prog'; |
102 |
opendir $fh, $context->config('opachtdocs'); |
100 |
opendir $fh, C4::Context->config('opachtdocs'); |
103 |
for ( grep { not /^\.|\.\.|lib$|xslt/ } readdir($fh) ) { |
101 |
for ( grep { not /^\.|\.\.|lib$|xslt/ } readdir($fh) ) { |
104 |
$dirs .= ' ' . "$opachtdocs/$_"; |
102 |
$dirs .= ' ' . "$opachtdocs/$_"; |
105 |
} |
103 |
} |
Lines 140-146
sub po_filename {
Link Here
|
140 |
my $self = shift; |
138 |
my $self = shift; |
141 |
my $suffix = shift; |
139 |
my $suffix = shift; |
142 |
|
140 |
|
143 |
my $context = C4::Context->new; |
|
|
144 |
my $trans_path = $Bin . '/po'; |
141 |
my $trans_path = $Bin . '/po'; |
145 |
my $trans_file = "$trans_path/" . $self->{lang} . $suffix; |
142 |
my $trans_file = "$trans_path/" . $self->{lang} . $suffix; |
146 |
return $trans_file; |
143 |
return $trans_file; |
Lines 377-384
sub install_installer {
Link Here
|
377 |
my $self = shift; |
374 |
my $self = shift; |
378 |
return unless ( $self->{installer} ); |
375 |
return unless ( $self->{installer} ); |
379 |
|
376 |
|
380 |
my $intradir = $self->{context}->config('intranetdir'); |
377 |
my $intradir = C4::Context->config('intranetdir'); |
381 |
my $db_scheme = $self->{context}->config('db_scheme'); |
378 |
my $db_scheme = C4::Context->config('db_scheme'); |
382 |
my $langdir = "$intradir/installer/data/$db_scheme/$self->{lang}"; |
379 |
my $langdir = "$intradir/installer/data/$db_scheme/$self->{lang}"; |
383 |
if ( -d $langdir ) { |
380 |
if ( -d $langdir ) { |
384 |
say "$self->{lang} installer dir $langdir already exists.\nDelete it if you want to recreate it." if $self->{verbose}; |
381 |
say "$self->{lang} installer dir $langdir already exists.\nDelete it if you want to recreate it." if $self->{verbose}; |
Lines 440-452
sub install_messages {
Link Here
|
440 |
system "$self->{msgfmt} -o $mofile $pofile"; |
437 |
system "$self->{msgfmt} -o $mofile $pofile"; |
441 |
|
438 |
|
442 |
my $js_locale_data = 'var json_locale_data = {"Koha":' . `$self->{po2json} $js_pofile` . '};'; |
439 |
my $js_locale_data = 'var json_locale_data = {"Koha":' . `$self->{po2json} $js_pofile` . '};'; |
443 |
my $progdir = $self->{context}->config('intrahtdocs') . '/prog'; |
440 |
my $progdir = C4::Context->config('intrahtdocs') . '/prog'; |
444 |
mkdir "$progdir/$self->{lang}/js"; |
441 |
mkdir "$progdir/$self->{lang}/js"; |
445 |
open my $fh, '>', "$progdir/$self->{lang}/js/locale_data.js"; |
442 |
open my $fh, '>', "$progdir/$self->{lang}/js/locale_data.js"; |
446 |
print $fh $js_locale_data; |
443 |
print $fh $js_locale_data; |
447 |
close $fh; |
444 |
close $fh; |
448 |
|
445 |
|
449 |
my $opachtdocs = $self->{context}->config('opachtdocs'); |
446 |
my $opachtdocs = C4::Context->config('opachtdocs'); |
450 |
opendir(my $dh, $opachtdocs); |
447 |
opendir(my $dh, $opachtdocs); |
451 |
for my $theme ( grep { not /^\.|lib|xslt/ } readdir($dh) ) { |
448 |
for my $theme ( grep { not /^\.|lib|xslt/ } readdir($dh) ) { |
452 |
mkdir "$opachtdocs/$theme/$self->{lang}/js"; |
449 |
mkdir "$opachtdocs/$theme/$self->{lang}/js"; |
453 |
- |
|
|