1 |
diff -urN smeserver-domains-1.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dungog_domains.pm smeserver-domains-1.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dungog_domains.pm |
2 |
--- smeserver-domains-1.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dungog_domains.pm 1970-01-01 01:00:00.000000000 +0100 |
3 |
+++ smeserver-domains-1.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dungog_domains.pm 2020-07-22 09:14:00.000000000 +0100 |
4 |
@@ -0,0 +1,407 @@ |
5 |
+package SrvMngr::Controller::Dungog_domains; |
6 |
+#---------------------------------------------------------------------- |
7 |
+# heading : Administration |
8 |
+# description : Domain pseudonyms |
9 |
+# navigation : 4000 4736 |
10 |
+# |
11 |
+# name : Dungog_domainsget, method : get, url : /dungog_domains, ctlact : Dungog_domains#main |
12 |
+# name : Dungog_domainspost,method : post, url : /dungog_domains, ctlact : Dungog_domains#do_Save |
13 |
+# name : Dungog_domains1, method : get, url : /dungog_domains1, ctlact : Dungog_domains#do_Email |
14 |
+# name : Dungog_domains2, method : get, url : /dungog_domains2, ctlact : Dungog_domains#do_Options |
15 |
+# name : Dungog_domains3, method : get, url : /dungog_domains3, ctlact : Dungog_domains#do_AddPseudo |
16 |
+# name : Dungog_domains4, method : get, url : /dungog_domains4, ctlact : Dungog_domains#do_DelPseudo |
17 |
+# routes : end |
18 |
+# |
19 |
+# Documentation : https://wiki.contribs.org/Domains |
20 |
+#---------------------------------------------------------------------- |
21 |
+ |
22 |
+use strict; |
23 |
+use warnings; |
24 |
+use Mojo::Base 'Mojolicious::Controller'; |
25 |
+ |
26 |
+use Locale::gettext; |
27 |
+use SrvMngr::I18N; |
28 |
+use SrvMngr qw(theme_list init_session); |
29 |
+ |
30 |
+use Data::Dumper; |
31 |
+use esmith::util; |
32 |
+use esmith::HostsDB; |
33 |
+use esmith::AccountsDB; |
34 |
+ |
35 |
+our $db = esmith::ConfigDB->open(); |
36 |
+our $adb = esmith::AccountsDB->open(); |
37 |
+ |
38 |
+use constant FALSE => 0; |
39 |
+use constant TRUE => 1; |
40 |
+ |
41 |
+our $domaindb = esmith::ConfigDB->open('/home/e-smith/db/domains') |
42 |
+ or die "Unable to open domains db"; |
43 |
+ |
44 |
+our $dungogdb = esmith::ConfigDB->open('/home/e-smith/db/dungog') |
45 |
+ or die("Unable to open dungog db"); #Created by rpm |
46 |
+ |
47 |
+my %ddo_datas = (); |
48 |
+ |
49 |
+sub main { |
50 |
+ # |
51 |
+ # Main Panel |
52 |
+ # |
53 |
+ my $c = shift; |
54 |
+ $c->app->log->info( $c->log_req ); |
55 |
+ |
56 |
+ my $title = $c->l('ddo_title'); |
57 |
+ my $modul = ''; |
58 |
+ |
59 |
+ $ddo_datas{first} = 'ddo_Intro'; |
60 |
+ $ddo_datas{trt} = 'LIST'; |
61 |
+ |
62 |
+ my @domains = get_domain_table($c); |
63 |
+ my $empty = ( scalar @domains == 0 ); #Always be at least one? |
64 |
+ |
65 |
+ $c->stash( |
66 |
+ title => $title, |
67 |
+ modul => $modul, |
68 |
+ ddo_datas => \%ddo_datas, |
69 |
+ domains => \@domains, |
70 |
+ empty => $empty |
71 |
+ ); |
72 |
+ |
73 |
+ $c->render( template => 'dungog_domains' ); |
74 |
+ |
75 |
+} |
76 |
+ |
77 |
+sub do_Save { |
78 |
+ |
79 |
+ # |
80 |
+ # Save pressed |
81 |
+ # |
82 |
+ # Just Save data, restart email and log success |
83 |
+ # .. and return to main panel |
84 |
+ # |
85 |
+ my $c = shift; |
86 |
+ $c->app->log->info( $c->log_req ); |
87 |
+ |
88 |
+ my $title = $c->l('ddo_title'); |
89 |
+ my $modul = ''; |
90 |
+ my $domain = $c->param("domain"); |
91 |
+ #die("Save:$domain"); |
92 |
+ |
93 |
+ # Save it in here.. |
94 |
+ my $trt = $c->param("trt"); |
95 |
+ if ( $trt eq "SERVER" ) { |
96 |
+ my $MailServer = $c->param('MailServer') || ''; |
97 |
+ #die($MailServer); |
98 |
+ unless ( $MailServer eq 'skipMS' ) { |
99 |
+ if ( $MailServer eq '' ) { |
100 |
+ $domaindb->delete_prop( $domain, 'MailServer' ); |
101 |
+ } |
102 |
+ else { |
103 |
+ $domaindb->set_prop( $domain, 'MailServer', $MailServer ); |
104 |
+ } |
105 |
+ } |
106 |
+ |
107 |
+ system( "/sbin/e-smith/signal-event", "email-update" ) == 0 |
108 |
+ or die("Error occurred while restarting email.\n"); |
109 |
+ } |
110 |
+ elsif ( $trt eq 'OPTIONS' ) { |
111 |
+ my $owner = $c->param('Owner'); |
112 |
+ my $group = $c->param('Group'); |
113 |
+ |
114 |
+ #Check exists and create if necessary |
115 |
+ my $rec = $dungogdb->get($domain) |
116 |
+ || $dungogdb->new_record( $domain, { type => 'domain' } ); |
117 |
+ $dungogdb->set_prop( $domain, 'owner', $owner ); |
118 |
+ $dungogdb->set_prop( $domain, 'group', $group ); |
119 |
+ } |
120 |
+ elsif ( $trt eq 'EMAIL' ) { |
121 |
+ my $resmsg = perform_pseudo_save($c); |
122 |
+ if ( $resmsg ne "ok" ) { |
123 |
+ $ddo_datas{error} = $resmsg; #Error Message |
124 |
+ do_AddPseudo($c); |
125 |
+ return |
126 |
+ } else { |
127 |
+ $ddo_datas{success} = 'ddo_SUCCESS'; |
128 |
+ do_Email($c); |
129 |
+ return |
130 |
+ } |
131 |
+ |
132 |
+ } |
133 |
+ $ddo_datas{success} = 'ddo_SUCCESS'; |
134 |
+ $ddo_datas{trt} = 'LIST'; |
135 |
+ my @domains = get_domain_table($c); |
136 |
+ my $empty = ( scalar @domains == 0 ); #Always be at least one? |
137 |
+ $c->stash( |
138 |
+ title => $title, |
139 |
+ modul => $modul, |
140 |
+ ddo_datas => \%ddo_datas, |
141 |
+ domains => \@domains, |
142 |
+ empty => $empty |
143 |
+ ); |
144 |
+ $c->render( template => 'dungog_domains' ); |
145 |
+ |
146 |
+} |
147 |
+ |
148 |
+sub perform_pseudo_save { |
149 |
+ # |
150 |
+ # Save or create a new pseudonymn |
151 |
+ # mode = new or modify |
152 |
+ my $c = shift; |
153 |
+ my $domain = $c->param('domain'); |
154 |
+ my $acct = $c->param('LocalAccount'); |
155 |
+ my $pseu = $c->param('pseudo'); |
156 |
+ my $Pseudonym = "$pseu\@$domain"; |
157 |
+ my $mode = $c->param('mode') | 'modify'; |
158 |
+ my $oldpseudo = $c->param('oldpseudo'); |
159 |
+ |
160 |
+ # get all pseudonyms for this domain |
161 |
+ my @vdemail = (); |
162 |
+ foreach my $account ( $adb->get_all_by_prop($domain,type=>'pseudonym') ) { |
163 |
+ push( @vdemail, $account->key ); |
164 |
+ } |
165 |
+ |
166 |
+ #don't overwite existing users |
167 |
+ if ( $mode eq 'new' ) { |
168 |
+ foreach (@vdemail) { |
169 |
+ if ( $_ eq $pseu ) { |
170 |
+ return 'ddo_pseudo_already_exists'; |
171 |
+ } |
172 |
+ } |
173 |
+ } |
174 |
+ |
175 |
+ if ( $pseu =~ /^([a-zA-Z0-9][\-\_\.a-zA-Z0-9]*)$/ ) { |
176 |
+ $pseu = $1; |
177 |
+ } |
178 |
+ else { |
179 |
+ return $c->l( 'ddo_pseudo_unexpected_character', $pseu ); |
180 |
+ } |
181 |
+ |
182 |
+ if ( $acct eq '' ) { |
183 |
+ return 'ddo_need_local_account'; |
184 |
+ } |
185 |
+ |
186 |
+ #Create it if necessary |
187 |
+ my $rec = $adb->get($Pseudonym) |
188 |
+ || $adb->new_record( $Pseudonym, { type => 'pseudonym' } ); |
189 |
+ |
190 |
+ $adb->set_prop( $Pseudonym, 'Account', $acct ); |
191 |
+ |
192 |
+ #we changed the Pseudonym, so delete the old |
193 |
+ if ($oldpseudo ne ''){ |
194 |
+ if ( $mode eq 'modify' and $oldpseudo ne $pseu) { |
195 |
+ my $delpseudo = "$oldpseudo\@$domain"; |
196 |
+ if (my $delkey = $adb->get($delpseudo)) { |
197 |
+ $delkey->delete or die("Unable to delete $Pseudonym from accounts:".$delkey->key); |
198 |
+ } |
199 |
+ } |
200 |
+ } |
201 |
+ return "ok"; |
202 |
+} |
203 |
+ |
204 |
+sub do_Email { |
205 |
+ |
206 |
+ my $c = shift; |
207 |
+ $c->app->log->info( $c->log_req ); |
208 |
+ |
209 |
+ my %ddo_datas = (); |
210 |
+ my $title = $c->l('ddo_Email_Title'); |
211 |
+ my $modul = ''; |
212 |
+ |
213 |
+ my $domain = $c->param("domain"); |
214 |
+ my $MailServer = $domaindb->get_prop($domain, 'MailServer'); |
215 |
+ my @pseudos = get_domain_pseudonyms( $c, $domain ); |
216 |
+ my $empty = ( scalar @pseudos == 0 ); |
217 |
+ $ddo_datas{trt} = 'EMAIL'; |
218 |
+ $ddo_datas{mailserver} = $MailServer; |
219 |
+ |
220 |
+ $c->stash( |
221 |
+ title => $title, |
222 |
+ modul => $modul, |
223 |
+ ddo_datas => \%ddo_datas, |
224 |
+ pseudos => \@pseudos, |
225 |
+ empty => $empty |
226 |
+ ); |
227 |
+ $c->render( template => 'dungog_domains' ); |
228 |
+} |
229 |
+ |
230 |
+sub do_Options { |
231 |
+ |
232 |
+ my $c = shift; |
233 |
+ $c->app->log->info( $c->log_req ); |
234 |
+ |
235 |
+ my $title = $c->l('ddo_modify_options_TITLE'); |
236 |
+ my $modul = ''; |
237 |
+ |
238 |
+ #Data for selection controls |
239 |
+ my $domain = $c->param("domain"); |
240 |
+ my $owner = $dungogdb->get_prop( $domain, "owner" ) || 'admin'; |
241 |
+ my $group = $dungogdb->get_prop( $domain, "group" ) || 'everyone'; |
242 |
+ if ( $group eq 'Administrator' ) { |
243 |
+ $group = $owner; |
244 |
+ } |
245 |
+ |
246 |
+ my @userlist = ( 'admin', 'everyone' ); |
247 |
+ my @grouplist = ( 'everyone', 'Administrator' ); |
248 |
+ push( @userlist, '-- groups --' ); |
249 |
+ foreach ( sort $adb->get_all_by_prop( type => 'group' ) ) { |
250 |
+ push( @userlist, $_->key ); |
251 |
+ push( @grouplist, $_->key ); |
252 |
+ |
253 |
+ } |
254 |
+ push( @userlist, '-- users --' ); |
255 |
+ foreach ( sort $adb->get_all_by_prop( type => 'user' ) ) { |
256 |
+ push( @userlist, $_->key ); |
257 |
+ } |
258 |
+ |
259 |
+ $ddo_datas{trt} = 'OPTIONS'; |
260 |
+ $ddo_datas{owner} = $owner; |
261 |
+ $ddo_datas{group} = $group; |
262 |
+ |
263 |
+ $c->stash( |
264 |
+ title => $title, |
265 |
+ modul => $modul, |
266 |
+ ddo_datas => \%ddo_datas, |
267 |
+ grouplist => \@grouplist, |
268 |
+ userlist => \@userlist |
269 |
+ ); |
270 |
+ $c->render( template => 'dungog_domains' ); |
271 |
+} |
272 |
+ |
273 |
+sub do_DelPseudo { |
274 |
+ # |
275 |
+ # Delete pseudonym |
276 |
+ # |
277 |
+ my $c = shift; |
278 |
+ $c->app->log->info( $c->log_req ); |
279 |
+ |
280 |
+ my $title = $c->l('ddo_title'); |
281 |
+ my $modul = ''; |
282 |
+ |
283 |
+ # Delete it in here.. |
284 |
+ my $pseu = $c->param('pseudo'); |
285 |
+ my $domain = $c->param('domain'); |
286 |
+ my $Pseudonym = "$pseu\@$domain"; |
287 |
+ |
288 |
+ my $delkey = $adb->get("$Pseudonym") or die("Unable to find $Pseudonym in accounts"); |
289 |
+ $delkey->delete or die("Unable to delete $Pseudonym from accounts:".$delkey->key); |
290 |
+ |
291 |
+ $ddo_datas{success} = 'ddo_Delete_successful'; |
292 |
+ $ddo_datas{trt} = 'EMAIL'; |
293 |
+ |
294 |
+ do_Email($c); |
295 |
+} |
296 |
+ |
297 |
+sub do_AddPseudo { |
298 |
+ # |
299 |
+ # Add or edit pseudonym |
300 |
+ # |
301 |
+ |
302 |
+ my $c = shift; |
303 |
+ $c->app->log->info( $c->log_req ); |
304 |
+ |
305 |
+ my $title = $c->l('ddo_Edit_Title'); |
306 |
+ my $modul = ''; |
307 |
+ my $domain = $c->param("domain"); |
308 |
+ my @accts = get_accts( $c, $domain ); |
309 |
+ $c->stash( |
310 |
+ title => $title, |
311 |
+ modul => $modul, |
312 |
+ ddo_datas => \%ddo_datas, |
313 |
+ accts => \@accts |
314 |
+ ); |
315 |
+ $ddo_datas{trt} = 'ADD'; |
316 |
+ $c->render( template => 'dungog_domains' ); |
317 |
+ |
318 |
+} |
319 |
+ |
320 |
+sub get_domain_pseudonyms { |
321 |
+ my ( $c, $domain ) = @_; |
322 |
+ |
323 |
+ # get all pseudonyms |
324 |
+ my @vdemail = (); |
325 |
+ |
326 |
+ foreach my $record ( $adb->get_all_by_prop( type => 'pseudonym' ) ) { |
327 |
+ my $key = $record->key; |
328 |
+ push( @vdemail, $key ); |
329 |
+ } |
330 |
+ |
331 |
+ # find email for this domain |
332 |
+ my @vdemail2 = (); |
333 |
+ foreach (@vdemail) { |
334 |
+ ( my $u, my $d ) = split( /@/, $_ ); |
335 |
+ my $acct = $adb->get_prop( "$_", "Account" ) || ''; |
336 |
+ my %thisrow = ( 'Pseudonym' => $u, "user" => $acct ); |
337 |
+ push( @vdemail2, \%thisrow ) if ( $d eq $domain ); |
338 |
+ } |
339 |
+ |
340 |
+ return @vdemail2; |
341 |
+ |
342 |
+} |
343 |
+ |
344 |
+sub get_domain_table { |
345 |
+ # |
346 |
+ # Return full table of all domains OR just the details for the specified one |
347 |
+ # |
348 |
+ my ( $c, $findDomain ) = @_; #$c and domain to find |
349 |
+ $findDomain = FALSE if ( scalar(@_) <= 1 ); |
350 |
+ my $key; |
351 |
+ my @virtualDomains = (); |
352 |
+ foreach my $domain ( $domaindb->get_all_by_prop( type => 'domain' ) ) { |
353 |
+ $key = $domain->key; |
354 |
+ push( @virtualDomains, $key ); |
355 |
+ } |
356 |
+ my $numDomains = @virtualDomains; |
357 |
+ if ( $numDomains == 0 ) { return () } |
358 |
+ else { |
359 |
+ my $domain; |
360 |
+ my @virtualDomains2d = (); |
361 |
+ |
362 |
+ foreach $domain ( sort @virtualDomains ) { |
363 |
+ my %properties = $domaindb->get($domain)->props; |
364 |
+ my $test = $domaindb->get_prop( $domain, "dns" ) || ''; |
365 |
+ my $owner = $dungogdb->get_prop( $domain, "owner" ) || 'admin'; |
366 |
+ my $group = $dungogdb->get_prop( $domain, "group" ) || 'everyone'; |
367 |
+ my %thisrow; |
368 |
+ |
369 |
+ %thisrow = ( |
370 |
+ "Domain" => $domain, |
371 |
+ "Description" => $properties{'Description'}, |
372 |
+ |
373 |
+ #"Content" => $content, |
374 |
+ "Delegation" => "$owner" . '::' . "$group" |
375 |
+ ); |
376 |
+ push( @virtualDomains2d, \%thisrow ); |
377 |
+ |
378 |
+ if ($findDomain) { |
379 |
+ if ( $domain eq $findDomain ) { |
380 |
+ @virtualDomains2d = (); #Just return matching one |
381 |
+ push( @virtualDomains2d, \%thisrow ); |
382 |
+ last; |
383 |
+ } |
384 |
+ } #Found the one needed |
385 |
+ } |
386 |
+ return @virtualDomains2d; #Return the lot |
387 |
+ } |
388 |
+} |
389 |
+ |
390 |
+sub get_accts { |
391 |
+ my ( $c, $domain ) = @_; |
392 |
+ my $owner = $dungogdb->get_prop( $domain, "owner" ) || ''; |
393 |
+ my $group = $dungogdb->get_prop( $domain, "group" ) || 'everyone'; |
394 |
+ my @selected = []; |
395 |
+ my $userlist = $adb->get_prop($group,"Members") || ''; |
396 |
+ if ( $group eq 'everyone' ) { |
397 |
+ my @acctrecs = $adb->get_all_by_prop( type => "user" ); |
398 |
+ foreach my $acct (@acctrecs) { |
399 |
+ push( @selected, $acct->key ) |
400 |
+ } |
401 |
+ } |
402 |
+ elsif ( $group eq 'Administrator' ) { |
403 |
+ @selected = ($owner); |
404 |
+ } |
405 |
+ else { |
406 |
+ @selected = split( /,/, $userlist ); |
407 |
+ } |
408 |
+ return sort @selected; |
409 |
+} |
410 |
+ |
411 |
+1; |
412 |
diff -urN smeserver-domains-1.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dungog_domains/en.pm smeserver-domains-1.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dungog_domains/en.pm |
413 |
--- smeserver-domains-1.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dungog_domains/en.pm 1970-01-01 01:00:00.000000000 +0100 |
414 |
+++ smeserver-domains-1.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dungog_domains/en.pm 2020-07-22 09:09:00.000000000 +0100 |
415 |
@@ -0,0 +1,65 @@ |
416 |
+package SrvMngr::I18N::Modules::Dungog_domains::en; |
417 |
+use strict; |
418 |
+use warnings; |
419 |
+use utf8; |
420 |
+use Mojo::Base 'SrvMngr::I18N'; |
421 |
+ |
422 |
+use SrvMngr::I18N::Modules::General::en; |
423 |
+ |
424 |
+my %lexicon = ( |
425 |
+'ddo_title' =>'Domain Pseudonyms', |
426 |
+'ddo_Final_Save' => 'Settings saved and email restarted.', |
427 |
+'ddo_Intro' => 'Set pseudonyms specifically for a single domain,<br>This panel just shows the pseudonyms for a each single domain.<br>See also the <a href="/smanager/pseudonyms">Pseudonyms</a> panel to set global pseudonyms.<br>Documentation: <a href="https://wiki.contribs.org/Domains">https://wiki.contribs.org/Domains</a>', |
428 |
+'ddo_Current_List' => 'Current List of Domains.', |
429 |
+'ddo_Mail_Delivery' => ' Mail Delivery', |
430 |
+'ddo_Delegation' => 'Delegation', |
431 |
+'ddo_Need_Save' => '<strong>Save Settings</strong><br>Pseudonym settings are not activated until you save them here', |
432 |
+'ddo_Delegate_Domain' => 'Delegate the domain "[_1]"<br> |
433 |
+Forward all email for this domain to a remote mailserver, either use a FQDN mail.domain.net or an IP address. Or leave blank and forward domain specific pseudonyms below. |
434 |
+CAUTION. enable your remote server before delegating or you may create a mail loop.', |
435 |
+'ddo_Server_or_IP' => 'Server Name or IP', |
436 |
+'ddo_No_Pseudonyms' => 'There are no pseudonyms for the domain "[_1]"', |
437 |
+'ddo_Click_Here' => 'Click here', |
438 |
+'ddo_Click_Here_first' => ' to add your first pseudonym.', |
439 |
+'ddo_Click_Here_add' => ' to add another pseudonym.', |
440 |
+'ddo_Domain_Name' => 'Domain Name:[_1]', |
441 |
+'ddo_Alternative_Admin_description' => 'The alternative administrator is used delegate a domain to a user or group. |
442 |
+They can then add email addresses with userpanel-domains |
443 |
+First delegate them here, then delegate the userpanel with userpanel access. |
444 |
+For full access delegate this panel, dungog-domains.', |
445 |
+'ddo_Alternative_Admin' => 'Alternative administrator:', |
446 |
+'ddo_Restrict' => 'Restrict the userlist in the email dropdown box to the Administrator or members of a group', |
447 |
+'ddo_Alternative_Group' => 'Alternative group:', |
448 |
+'ddo_SUCCESS' => 'Successfully modified domain [_1].', |
449 |
+'ddo_NO_DOMAINS' => 'The are no domains in the system', |
450 |
+'ddo_Current_list_for' => 'Current List of pseudonyms for the domain "[_1]"', |
451 |
+'ddo_No_pseudonyms_for' => 'There are no pseudonyms for the domain "[_1]"', |
452 |
+'ddo_Email_Title' => 'Modify Domain Email', |
453 |
+'ddo_Edit_Title' => 'Modify Email Address', |
454 |
+'ddo_Local_User' => 'Local User', |
455 |
+'ddo_Pseudonyms' => 'Pseudonyms', |
456 |
+'ddo_Pseudonym' => 'Pseudonym', |
457 |
+'ddo_ENTER_a_pseudonym' => 'Enter a pseudonym.<br>NOTE. @[_1] is added for you.', |
458 |
+'ddo_Delete_successful' =>'Successfully removed Pseudonym.', |
459 |
+'ddo_pseudo_already_exists' => 'Error: Pseudonym already exists.', |
460 |
+'ddo_pseudo_unexpected_character'=>'Error: unexpected characters in Pseudonym [_1]', |
461 |
+'ddo_need_local_account' => "Error: please select a local account.", |
462 |
+'ddo_modify_options_TITLE'=>'Modify Domain pseudonyms - Options', |
463 |
+'ddo_alternate delegate'=>'The alternative administrator is used delegate a domain to a user or group.<br> |
464 |
+They can then add email addresses with userpanel-domains.<br> |
465 |
+First delegate them here, then delegate the userpanel with userpanel access.<br> |
466 |
+For full access delegate this panel, dungog-domains.', |
467 |
+'ddo_alternative_admin' => 'Alternative administrator:', |
468 |
+'ddo_restrict_to_group'=>'Restrict the userlist in the email dropdown box to the Administrator or members of a group', |
469 |
+'ddo_Alternative_group'=>'Alternative group:' |
470 |
+ |
471 |
+ |
472 |
+); |
473 |
+ |
474 |
+our %Lexicon = ( |
475 |
+ %{ SrvMngr::I18N::Modules::General::en::Lexicon }, |
476 |
+ %lexicon |
477 |
+); |
478 |
+ |
479 |
+ |
480 |
+1; |
481 |
diff -urN smeserver-domains-1.4.old/root/usr/share/smanager/themes/default/templates/dungog_domains.html.ep smeserver-domains-1.4/root/usr/share/smanager/themes/default/templates/dungog_domains.html.ep |
482 |
--- smeserver-domains-1.4.old/root/usr/share/smanager/themes/default/templates/dungog_domains.html.ep 1970-01-01 01:00:00.000000000 +0100 |
483 |
+++ smeserver-domains-1.4/root/usr/share/smanager/themes/default/templates/dungog_domains.html.ep 2020-07-06 17:19:00.000000000 +0100 |
484 |
@@ -0,0 +1,43 @@ |
485 |
+% layout 'default', title => "Sme server 2 - Domain Pseudonyms", share_dir => './'; |
486 |
+ |
487 |
+% content_for 'module' => begin |
488 |
+<div id="module"> |
489 |
+ |
490 |
+ % if ($config->{debug} == 1) { |
491 |
+ <p> |
492 |
+ %= dumper $c->current_route |
493 |
+ </p> |
494 |
+ % } |
495 |
+ |
496 |
+ <h1><%=$title%></h1> |
497 |
+ %= $modul |
498 |
+ |
499 |
+ %if ($ddo_datas->{first}) { |
500 |
+ %=$c->render_to_string(inline =>$c->l($ddo_datas->{first})) |
501 |
+ |
502 |
+ %} elsif ($ddo_datas->{success}) { |
503 |
+ <div class='sme-success'> |
504 |
+ <h2> Operation Status Report</h2> |
505 |
+ %= $c->l($ddo_datas->{success}); |
506 |
+ </div> |
507 |
+ |
508 |
+ %} elsif ($ddo_datas->{error}) { |
509 |
+ <div class='sme-error'> |
510 |
+ <h2> Operation Status Report - error</h2> |
511 |
+ %= $c->l($ddo_datas->{error}); |
512 |
+ </div> |
513 |
+ %} |
514 |
+ |
515 |
+ |
516 |
+ % if ($ddo_datas->{trt} eq 'EMAIL') { |
517 |
+ %= include 'partials/_ddo_modify_email' |
518 |
+ %} elsif ($ddo_datas->{trt} eq 'OPTIONS') { |
519 |
+ %= include 'partials/_ddo_modify_options' |
520 |
+ %} elsif ($ddo_datas->{trt} eq 'ADD') { |
521 |
+ %= include 'partials/_ddo_add_pseudonym' |
522 |
+ %} else { |
523 |
+ %= include 'partials/_ddo_domain_list' |
524 |
+ %} |
525 |
+ |
526 |
+</div> |
527 |
+%end |
528 |
diff -urN smeserver-domains-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_ddo_add_pseudonym.html.ep smeserver-domains-1.4/root/usr/share/smanager/themes/default/templates/partials/_ddo_add_pseudonym.html.ep |
529 |
--- smeserver-domains-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_ddo_add_pseudonym.html.ep 1970-01-01 01:00:00.000000000 +0100 |
530 |
+++ smeserver-domains-1.4/root/usr/share/smanager/themes/default/templates/partials/_ddo_add_pseudonym.html.ep 2020-07-22 09:20:00.000000000 +0100 |
531 |
@@ -0,0 +1,38 @@ |
532 |
+%# |
533 |
+%# Add/edit pseudonym |
534 |
+%# |
535 |
+<div class=""> |
536 |
+ % my $btn = l('SAVE'); |
537 |
+ %= form_for '/dungog_domains' => (method => 'POST') => begin |
538 |
+ %my $domain = $c->param("domain"); |
539 |
+ %my $acct = $c->param("acct") || ''; |
540 |
+ %my $pseudo = $c->param("pseudo") || ''; |
541 |
+ %=$c->l('ddo_Domain_Name',$domain) |
542 |
+ <br> |
543 |
+ %=$c->render_to_string(inline =>l('ddo_ENTER_a_pseudonym',$domain)) |
544 |
+ <br> |
545 |
+ <span class=label> |
546 |
+ %=l "ddo_Pseudonym" |
547 |
+ </span> |
548 |
+ <span class=data> |
549 |
+ %=text_field 'pseudo' =>$pseudo |
550 |
+ %="\@$domain" |
551 |
+ </span> |
552 |
+ <br><br> |
553 |
+ <span class=label> |
554 |
+ %=l "ddo_Local_User" |
555 |
+ </span> |
556 |
+ <span class=data> |
557 |
+ % param LocalAccount => "$acct"; |
558 |
+ %=select_field 'LocalAccount'=>$accts |
559 |
+ </span> |
560 |
+ %=hidden_field 'domain'=>$domain |
561 |
+ %=hidden_field 'acct'=>$acct |
562 |
+ %=hidden_field 'trt'=>'EMAIL' |
563 |
+ %=hidden_field 'oldpseudo'=>$pseudo |
564 |
+ |
565 |
+ <br> |
566 |
+ %= submit_button "$btn", class => 'action' |
567 |
+ <br> |
568 |
+ % end |
569 |
+</div> |
570 |
diff -urN smeserver-domains-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_ddo_domain_list.html.ep smeserver-domains-1.4/root/usr/share/smanager/themes/default/templates/partials/_ddo_domain_list.html.ep |
571 |
--- smeserver-domains-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_ddo_domain_list.html.ep 1970-01-01 01:00:00.000000000 +0100 |
572 |
+++ smeserver-domains-1.4/root/usr/share/smanager/themes/default/templates/partials/_ddo_domain_list.html.ep 2020-07-20 17:25:00.000000000 +0100 |
573 |
@@ -0,0 +1,56 @@ |
574 |
+%# |
575 |
+%# Initial Domain list |
576 |
+%# |
577 |
+<div id='ddo_list'> |
578 |
+ |
579 |
+ % my $btn = l('SAVE'); |
580 |
+ |
581 |
+ %= form_for '/dungog_domains' => (method => 'POST') => begin |
582 |
+ <br> |
583 |
+ %=$c->l('ddo_Current_List') |
584 |
+ |
585 |
+ % if ($empty){ |
586 |
+ <br> |
587 |
+ %=l 'ddo_NO_DOMAINS' |
588 |
+ % } else { |
589 |
+ |
590 |
+ <table class="sme-border"><tbody> |
591 |
+ <tr> |
592 |
+ <th class='sme-border'> |
593 |
+ %=l 'DOMAIN' |
594 |
+ </th> |
595 |
+ <th class='sme-border'> |
596 |
+ %=l 'DESCRIPTION' |
597 |
+ </th> |
598 |
+ <th class='sme-border'> |
599 |
+ %=l 'ddo_Mail_Delivery' |
600 |
+ </th> |
601 |
+ <th class='sme-border' '> |
602 |
+ %=l 'ddo_Delegation' |
603 |
+ </th> |
604 |
+ </tr> |
605 |
+ % foreach my $domain (@$domains) { |
606 |
+ <tr> |
607 |
+ %= t td => (class => 'sme-border') => $domain->{"Domain"} |
608 |
+ %= t td => (class => 'sme-border') => $domain->{"Description"} |
609 |
+ <td class=sme-border> |
610 |
+ <a href="/smanager/dungog_domains1?trt=EMAIL&domain=<%= $domain->{"Domain"}%>"><%=l 'MODIFY'%></a> |
611 |
+ </td> |
612 |
+ % my $delegation = $domain->{"Delegation"}; |
613 |
+ <td class=sme-border> |
614 |
+ <a href="/smanager/dungog_domains2?trt=OPTIONS&domain=<%= $domain->{"Domain"}%>"><%=l $delegation%></a> |
615 |
+ </td> |
616 |
+ </tr> |
617 |
+ %} |
618 |
+ </tbody> |
619 |
+ </table> |
620 |
+ % } |
621 |
+ |
622 |
+ %# This may not be needed - Save from the subservient panels should do the job. |
623 |
+ |
624 |
+ %#=$c->render_to_string(inline =>l('ddo_Need_Save')); |
625 |
+ <br> |
626 |
+ %#= submit_button "$btn", class => 'action' |
627 |
+ <br> |
628 |
+ % end |
629 |
+</div> |
630 |
diff -urN smeserver-domains-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_ddo_modify_email.html.ep smeserver-domains-1.4/root/usr/share/smanager/themes/default/templates/partials/_ddo_modify_email.html.ep |
631 |
--- smeserver-domains-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_ddo_modify_email.html.ep 1970-01-01 01:00:00.000000000 +0100 |
632 |
+++ smeserver-domains-1.4/root/usr/share/smanager/themes/default/templates/partials/_ddo_modify_email.html.ep 2020-07-20 17:23:00.000000000 +0100 |
633 |
@@ -0,0 +1,73 @@ |
634 |
+%# |
635 |
+%# Modify domain email |
636 |
+%# |
637 |
+<div class="ddo_email"> |
638 |
+ % my $btn = $c->l('SAVE'); |
639 |
+ % my $MailServer = $ddo_datas->{mailserver}; |
640 |
+ |
641 |
+ %= form_for '/dungog_domains' => (method => 'POST') => begin |
642 |
+ <br> |
643 |
+ % my $domain = $c->param('domain'); |
644 |
+ %=$c->render_to_string(inline =>l('ddo_Delegate_Domain',$domain)) |
645 |
+ <br> |
646 |
+ <span class=label> |
647 |
+ %=l "ddo_Server_or_IP" |
648 |
+ </span> |
649 |
+ <span class=data> |
650 |
+ %=text_field 'MailServer' =>$MailServer |
651 |
+ </span> |
652 |
+ <br><br> |
653 |
+ %if ($empty) { |
654 |
+ %=$c->l('ddo_No_pseudonyms_for',$domain); |
655 |
+ <br> |
656 |
+ <a href="/smanager/dungog_domains3?domain=<%=$domain %>&mode=new"><button type='button'><%= $c->l('ddo_Click_Here')%></button></a> |
657 |
+ %=$c->render_to_string(inline=>l('ddo_Click_Here_first')) |
658 |
+ <br> |
659 |
+ |
660 |
+ %} else { |
661 |
+ %=$c->l('ddo_Current_list_for',$domain); |
662 |
+ <br> |
663 |
+ <a href="/smanager/dungog_domains3?domain=<%=$domain %>&mode=new"><button type='button'><%= $c->l('ddo_Click_Here')%></button></a> |
664 |
+ %=$c->render_to_string(inline=>l('ddo_Click_Here_add')) |
665 |
+ <br><br> |
666 |
+ |
667 |
+ %#Table of pseudonyms: |
668 |
+ <table class="sme-border"><tbody> |
669 |
+ <tr> |
670 |
+ <th class='sme-border'> |
671 |
+ %=l 'ddo_Pseudonyms' |
672 |
+ </th> |
673 |
+ <th class='sme-border'> |
674 |
+ %=l 'ddo_Local_User' |
675 |
+ </th> |
676 |
+ <th class='sme-border'> |
677 |
+ </th> |
678 |
+ <th class='sme-border' '> |
679 |
+ </th> |
680 |
+ </tr> |
681 |
+ % foreach my $pseudo (@$pseudos) { |
682 |
+ <tr> |
683 |
+ %= t td => (class => 'sme-border') => $pseudo->{"Pseudonym"} |
684 |
+ %= t td => (class => 'sme-border') => $pseudo->{"user"} |
685 |
+ <td class=sme-border> |
686 |
+ <a href="/smanager/dungog_domains3?trt=EMAIL&pseudo=<%= $pseudo->{'Pseudonym'}%>&domain=<%= $domain%>"><%=l 'MODIFY'%></a> |
687 |
+ </td> |
688 |
+ <td class=sme-border> |
689 |
+ <a href="/smanager/dungog_domains4?trt=OPTIONS&pseudo=<%= $pseudo->{'Pseudonym'}%>&domain=<%= $domain%>"><%=l 'REMOVE'%></a> |
690 |
+ </td> |
691 |
+ </tr> |
692 |
+ %} |
693 |
+ </tbody> |
694 |
+ </table> |
695 |
+ %} |
696 |
+ %= hidden_field trt=>"SERVER" |
697 |
+ %= hidden_field domain=>$domain |
698 |
+ |
699 |
+ <br> |
700 |
+ %=$c->render_to_string(inline =>l('ddo_Need_Save')); |
701 |
+ <br> |
702 |
+ %= submit_button "$btn", class => 'action' |
703 |
+ % end |
704 |
+</div> |
705 |
+ |
706 |
+ |
707 |
diff -urN smeserver-domains-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_ddo_modify_options.html.ep smeserver-domains-1.4/root/usr/share/smanager/themes/default/templates/partials/_ddo_modify_options.html.ep |
708 |
--- smeserver-domains-1.4.old/root/usr/share/smanager/themes/default/templates/partials/_ddo_modify_options.html.ep 1970-01-01 01:00:00.000000000 +0100 |
709 |
+++ smeserver-domains-1.4/root/usr/share/smanager/themes/default/templates/partials/_ddo_modify_options.html.ep 2020-07-08 14:32:00.000000000 +0100 |
710 |
@@ -0,0 +1,35 @@ |
711 |
+%# |
712 |
+%# Modify domain options |
713 |
+%# |
714 |
+<div class="ddo_modify_options"> |
715 |
+ % my $btn = l('SAVE'); |
716 |
+ % my $domain = $c->param('domain'); |
717 |
+ % my $group = $ddo_datas->{group}; |
718 |
+ % my $owner = $ddo_datas->{owner}; |
719 |
+ %=l('ddo_Domain_Name',$domain) |
720 |
+ <br> |
721 |
+ %= $c->render_to_string(inline =>l('ddo_alternate delegate')) |
722 |
+ %= form_for '/dungog_domains' => (method => 'POST') => begin |
723 |
+ <span class=label> |
724 |
+ %=l "ddo_Alternative_Admin" |
725 |
+ </span> |
726 |
+ <span class=data> |
727 |
+ % param Owner => "$owner"; |
728 |
+ %=select_field 'Owner'=>$userlist |
729 |
+ </span> |
730 |
+ <br> |
731 |
+ %= l('ddo_restrict_to_group') |
732 |
+ <br> |
733 |
+ <span class=label> |
734 |
+ %=l "ddo_Alternative_Group" |
735 |
+ </span> |
736 |
+ <span class=data> |
737 |
+ % param Group => "$group"; |
738 |
+ %=select_field 'Group'=>$grouplist |
739 |
+ </span> |
740 |
+ %= hidden_field trt=>'OPTIONS' |
741 |
+ %= hidden_field domain=>$domain |
742 |
+ <br> |
743 |
+ %= submit_button "$btn", class => 'action' |
744 |
+ % end |
745 |
+</div> |