/[smecontribs]/rpms/smeserver-ezmlm-web/contribs7/smeserver-ezmlm-web-1.1.2-api.patch
ViewVC logotype

Contents of /rpms/smeserver-ezmlm-web/contribs7/smeserver-ezmlm-web-1.1.2-api.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Tue Nov 25 16:20:22 2008 UTC (16 years ago) by slords
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +0 -0 lines
Restore

1 diff -Nur -x '*.orig' -x '*.rej' smeserver-ezmlm-web-1.1.2/createlinks mezzanine_patched_smeserver-ezmlm-web-1.1.2/createlinks
2 --- smeserver-ezmlm-web-1.1.2/createlinks 2005-10-24 20:42:33.000000000 -0400
3 +++ mezzanine_patched_smeserver-ezmlm-web-1.1.2/createlinks 2006-02-17 16:20:54.000000000 -0500
4 @@ -1,15 +1,6 @@
5 #!/usr/bin/perl -w
6
7 -sub panel_link
8 -{
9 - my ($function, $panel) = @_;
10 -
11 - unlink "root/etc/e-smith/web/panels/$panel/cgi-bin/$function";
12 - symlink("../../../functions/$function",
13 - "root/etc/e-smith/web/panels/$panel/cgi-bin/$function")
14 - or die "Can't symlink to root/etc/e-smith/web/panels/$panel".
15 - "/cgi-bin/$function: $!";
16 -}
17 +use esmith::Build::CreateLinks qw(:all);
18
19 #--------------------------------------------------
20 # functions for manager panel
21 @@ -18,32 +9,19 @@
22
23 panel_link("mailinglists", $panel);
24
25 -sub event_link
26 -{
27 - my ($action, $event, $level) = @_;
28 -
29 - unlink "root/etc/e-smith/events/${event}/S${level}${action}";
30 - symlink("../actions/${action}",
31 - "root/etc/e-smith/events/${event}/S${level}${action}")
32 - or die "Can't symlink to root/etc/e-smith/events/${event}/S${level}${action}:".
33 - " $!";
34 -}
35 -
36 -#--------------------------------------------------
37 -# actions for bootstrap-console-save event
38 -#--------------------------------------------------
39 -# my $event = "bootstrap-console-save";
40 -
41 -#event_link("xxx-conf", $event, "60");
42 -
43 foreach my $event ( qw(create delete modify) )
44 {
45 - event_link("ezmlm-conf", "mailinglist-${event}", "10");
46 event_link("ezmlm-update", "mailinglist-${event}", "60");
47 - event_link("email-assign", "mailinglist-${event}", "90");
48 + templates2events("/var/qmail/users/assign", $event);
49 + safe_symlink("/var/qmail/bin/qmail-newu",
50 + "root/etc/e-smith/events/$event/S55email-assign");
51 }
52
53 -foreach my $event ( qw(bootstrap-console-save email-update) )
54 -{
55 - event_link("ezmlm-conf", "email-update", "90");
56 -}
57 +templates2events("/etc/ezmlm/ezmlmwebrc",
58 + qw(
59 + bootstrap-console-save
60 + email-update
61 + mailinglist-create
62 + mailinglist-update
63 + mailinglist-assign
64 + ));
65 diff -Nur -x '*.orig' -x '*.rej' smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-conf mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-conf
66 --- smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-conf 2005-10-24 20:42:33.000000000 -0400
67 +++ mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-conf 1969-12-31 19:00:00.000000000 -0500
68 @@ -1,34 +0,0 @@
69 -#!/usr/bin/perl -w
70 -#----------------------------------------------------------------------
71 -# copyright (C) 2000 Gormand Pty Ltd
72 -# copyright (C) 2001 Mitel Networks Corporation
73 -#
74 -# This program is free software; you can redistribute it and/or modify
75 -# it under the terms of the GNU General Public License as published by
76 -# the Free Software Foundation; either version 2 of the License, or
77 -# (at your option) any later version.
78 -#
79 -# This program is distributed in the hope that it will be useful,
80 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
81 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82 -# GNU General Public License for more details.
83 -#
84 -# You should have received a copy of the GNU General Public License
85 -# along with this program; if not, write to the Free Software
86 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
87 -#
88 -# Technical support for this program is available from Mitel Networks
89 -# Please visit our web site www.e-smith.com for details.
90 -#----------------------------------------------------------------------
91 -package esmith;
92 -
93 -use strict;
94 -use Errno;
95 -use esmith::config;
96 -use esmith::util;
97 -
98 -tie my %conf, 'esmith::config';
99 -
100 -esmith::util::processTemplate(\%conf, "/etc/ezmlm/ezmlmwebrc");
101 -
102 -exit (0);
103 diff -Nur -x '*.orig' -x '*.rej' smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-update mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-update
104 --- smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-update 2006-02-17 17:04:08.000000000 -0500
105 +++ mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-update 2006-02-17 16:44:04.000000000 -0500
106 @@ -1,7 +1,7 @@
107 #!/usr/bin/perl -w
108 #----------------------------------------------------------------------
109 # copyright (C) 2000-2002 Gormand Pty Ltd
110 -# copyright (C) 2002 Mitel Networks Corporation
111 +# copyright (C) 2002,2006 Mitel Networks Corporation
112 #
113 # This program is free software; you can redistribute it and/or modify
114 # it under the terms of the GNU General Public License as published by
115 @@ -17,24 +17,22 @@
116 # along with this program; if not, write to the Free Software
117 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
118 #
119 -# Technical support for this program is available from Mitel Networks
120 -# Please visit our web site www.mitel.com/sme/ for details.
121 #----------------------------------------------------------------------
122 package esmith;
123
124 use strict;
125 use Errno;
126 -use esmith::config;
127 +use esmith::ConfigDB;
128 +use esmith::AccountsDB;
129 use esmith::util;
130 -use esmith::db;
131
132 use File::Find;
133 use User::pwent;
134
135 use Mail::Ezmlm;
136
137 -tie my %conf, 'esmith::config';
138 -tie my %accounts, 'esmith::config', '/home/e-smith/db/accounts';
139 +my $conf = esmith::ConfigDB->open;
140 +my $accounts = esmith::AccountsDB->open;
141
142 my $event = $ARGV [0];
143 die "event argument missing." unless defined ($event);
144 @@ -53,7 +51,8 @@
145 -s /bin/false ezmlm)) == 0
146 or warn("Could not create user 'ezmlm'\n");
147
148 - db_set(\%accounts, "ezmlm", "system", { Uid => "80", Gid => "80" } );
149 + $accounts->new_record("ezmlm", "system", { Uid => "80", Gid => "80" } );
150 + unless ($accounts->get("ezmlm"));
151 }
152
153 my $pw = getpwnam("ezmlm") or die "User ezmlm not found";
154 @@ -67,10 +66,11 @@
155 $> = $pw->uid;
156 $) = $pw->gid;
157
158 +my $list = $accounts->get($listName) or die "$listName not found in accounts db";
159 die "$listName is not a mailing list account."
160 - unless (db_get_type(\%accounts, $listName) eq "mailinglist");
161 + unless ($list->prop('type') eq "mailinglist");
162
163 -my $listHost = db_get_prop(\%accounts, $listName, "Domain");
164 +my $listHost = $list->prop("Domain");
165
166 my $listHomeBase = "${ownerHome}/lists";
167
168 @@ -86,7 +86,7 @@
169 {
170 my $list = new Mail::Ezmlm;
171
172 - my $listOwner = db_get_prop(\%accounts, $listName, "Owner");
173 + my $listOwner = $list->prop("Owner");
174
175 $list->make(-dir => $listHome,
176 -qmail => $listAlias,
177 diff -Nur -x '*.orig' -x '*.rej' smeserver-ezmlm-web-1.1.2/root/etc/e-smith/templates/var/qmail/users/assign/90mailinglists mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/templates/var/qmail/users/assign/90mailinglists
178 --- smeserver-ezmlm-web-1.1.2/root/etc/e-smith/templates/var/qmail/users/assign/90mailinglists 2006-02-17 17:04:08.000000000 -0500
179 +++ mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/templates/var/qmail/users/assign/90mailinglists 2006-02-17 16:37:36.000000000 -0500
180 @@ -1,15 +1,14 @@
181 {
182 - use esmith::config;
183 - use esmith::db;
184 + use esmith::AccountsDB;
185
186 $OUT = '';
187
188 # Generate qmail user assignments for mailing lists. These will be handled
189 # by ~ezmlm/.qmail-listname and ~ezmlm/.qmail-listname-ext.
190
191 - my %accounts;
192 - tie %accounts, 'esmith::config', "/home/e-smith/db/accounts";
193 + my $adb = esmith::AccountsDB->open_ro;
194
195 + setpwent;
196 my (undef, undef, $uid, $gid, undef, undef, undef, $dir, undef)
197 = getpwnam("ezmlm");
198
199 @@ -32,9 +31,9 @@
200
201 my $ezmlm_assign = "ezmlm:${uid}:${gid}:${dir}";
202
203 - foreach my $listname (db_get(\%accounts))
204 + foreach my $list ($adb->get_all_by_prop(type => "mailinglist"))
205 {
206 - next unless db_get_type(\%accounts, $listname) eq "mailinglist";
207 + my $listname = $list->key;
208
209 # Assign mail for listname@
210 $OUT .= "=${listname}:${ezmlm_assign}:-:${listname}:\n";
211 @@ -42,15 +41,4 @@
212 # Assign mail for listname-ext@
213 $OUT .= "+${listname}-:${ezmlm_assign}:-${listname}-::\n";
214 }
215 -
216 - # Need to remove the final newline character. Blank lines in
217 - # /var/qmail/users/assign are prohibited.
218 -
219 - chomp($OUT);
220 -
221 - # Failsafe: /var/qmail/users/assign cannot have blank lines.
222 - # Therefore, if $OUT is empty, simply set up an assign for the
223 - # ezmlm user.
224 -
225 - $OUT = "=ezmlm:${ezmlm_assign}:::" unless $OUT;
226 }
227 diff -Nur -x '*.orig' -x '*.rej' smeserver-ezmlm-web-1.1.2/root/etc/e-smith/web/functions/mailinglists mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/web/functions/mailinglists
228 --- smeserver-ezmlm-web-1.1.2/root/etc/e-smith/web/functions/mailinglists 2006-02-17 17:04:08.000000000 -0500
229 +++ mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/web/functions/mailinglists 2006-02-17 17:02:57.000000000 -0500
230 @@ -6,7 +6,7 @@
231 # navigation : 3000 3600
232 #
233 # copyright (C) 2000 Gormand Pty Ltd
234 -# copyright (C) 2001 Mitel Networks Corporation
235 +# copyright (C) 2001,2006 Mitel Networks Corporation
236 #
237 # This program is free software; you can redistribute it and/or modify
238 # it under the terms of the GNU General Public License as published by
239 @@ -22,8 +22,8 @@
240 # along with this program; if not, write to the Free Software
241 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
242 #
243 -# Technical support for this program is available from Mitel Networks
244 -# Please visit our web site www.e-smith.com for details.
245 +# Technical support for this program is available from Gorman Pty Ltd
246 +# Please visit our web site www.gormand.com.au for contact details.
247 #----------------------------------------------------------------------
248
249 package esmith;
250 @@ -33,9 +33,10 @@
251 use CGI::Carp qw(fatalsToBrowser);
252
253 use esmith::cgi;
254 -use esmith::config;
255 +use esmith::ConfigDB;
256 +use esmith::AccountsDB;
257 +use esmith::DomainsDB;
258 use esmith::util;
259 -use esmith::db;
260 use User::pwent;
261
262 sub showInitial ($$);
263 @@ -65,14 +66,9 @@
264
265 use constant EZMLMWEB => '/common/ezmlm-web';
266
267 -my %conf;
268 -tie %conf, 'esmith::config';
269 -
270 -my %accounts;
271 -tie %accounts, 'esmith::config', '/home/e-smith/db/accounts';
272 -
273 -my %domains;
274 -tie %domains, 'esmith::config', '/home/e-smith/db/domains';
275 +my $conf = esmith::ConfigDB->open;
276 +my $accounts = esmith::AccountsDB->open;
277 +my $domains = esmith::DomainsDB->open;
278
279 #------------------------------------------------------------
280 # examine state parameter and display the appropriate form
281 @@ -115,7 +111,7 @@
282 }
283 else
284 {
285 - esmith::cgi::genStateError ($q, \%conf);
286 + esmith::cgi::genStateError ($q, undef);
287 }
288
289 exit (0);
290 @@ -136,12 +132,12 @@
291 if ($msg eq '')
292 {
293 esmith::cgi::genHeaderNonCacheable
294 - ($q, \%conf, 'Create, remove, or modify mailing lists');
295 + ($q, undef, 'Create, remove, or modify mailing lists');
296 }
297 else
298 {
299 esmith::cgi::genHeaderNonCacheable
300 - ($q, \%conf, 'Operation status report');
301 + ($q, undef, 'Operation status report');
302
303 print $q->p ($msg);
304 print $q->hr;
305 @@ -151,9 +147,7 @@
306 # Look up current lists
307 #------------------------------------------------------------
308
309 - my @mailingLists =
310 - grep { db_get_type(\%accounts, $_) eq "mailinglist" }
311 - keys %accounts;
312 + my @mailingLists = $accounts->get_all_by_prop('type' => 'mailinglist');
313
314 print $q->p ($q->a ({href => $q->url (-absolute => 1) . "?state=create"},
315 'Click here'),
316 @@ -180,12 +174,12 @@
317 $q->td (' ')
318 );
319
320 - foreach my $list (sort @mailingLists)
321 + foreach my $list (@mailingLists)
322 {
323 - my $domain = db_get_prop(\%accounts, $list, 'Domain');
324 - my $description = db_get_prop(\%accounts, $list, 'Description');
325 + my $domain = $list->prop('Domain');
326 + my $description = $list->prop('Description');
327
328 - print $q->Tr ( esmith::cgi::genSmallCell ($q, $list),
329 + print $q->Tr ( esmith::cgi::genSmallCell ($q, $list->key),
330 esmith::cgi::genSmallCell ($q, $domain),
331 esmith::cgi::genSmallCell ($q, $description),
332 esmith::cgi::genSmallCell ($q,
333 @@ -196,7 +190,7 @@
334 esmith::cgi::genSmallCell ($q,
335 $q->a ({href => $q->url (-absolute => 1)
336 . "?state=delete&list="
337 - . $list}, 'Remove...'))
338 + . $list->key}, 'Remove...'))
339 );
340 }
341
342 @@ -214,19 +208,14 @@
343 my ($q) = @_;
344
345 esmith::cgi::genHeaderNonCacheable
346 - ($q, \%conf, 'Create a new mailing list');
347 + ($q, undef, 'Create a new mailing list');
348
349 print $q->startform (-method => 'POST',
350 -action => $q->url (-absolute => 1));
351
352 - my @existingDomains = ( db_get(\%conf, "DomainName"),
353 - grep { db_get_type(\%domains, $_) eq "domain" }
354 - keys %domains
355 - );
356 -
357 - my @existingAccounts = ( "Administrator",
358 - grep { db_get_type(\%accounts, $_) eq "user" }
359 - keys %accounts );
360 + my @existingDomains = map { $_->key } $domains->domains;
361 +
362 + my @existingAccounts = ( "Administrator", map { $_->key } $accounts->users );
363
364 print $q->table ({border => 0, cellspacing => 0, cellpadding => 4},
365
366 @@ -327,11 +316,12 @@
367 #------------------------------------------------------------
368 # Looks good. Find out if this account has been taken
369 #------------------------------------------------------------
370 - if ( defined db_get_type(\%accounts, $listName) )
371 + my $list = $accounts->get($listName);
372 + if ($list)
373 {
374 showInitial ($q,
375 "Error: account \"$listName\" is an existing " .
376 - db_get_type(\%accounts, $listName) . " account.");
377 + $list->prop('type') . " account.");
378 return;
379 }
380
381 @@ -340,8 +330,10 @@
382 # mailinglist-create event.
383 #------------------------------------------------------------
384
385 - db_set( \%accounts, $listName, "mailinglist",
386 - { Domain => $listDomain,
387 + $accounts->new_record($listName,
388 + {
389 + type => 'mailinglist',
390 + Domain => $listDomain,
391 Description => $listDescription,
392 Owner => $listOwner,
393 } );
394 @@ -360,16 +352,17 @@
395 {
396 my ($q) = @_;
397
398 - esmith::cgi::genHeaderNonCacheable ($q, \%conf, 'Remove mailing list');
399 + esmith::cgi::genHeaderNonCacheable ($q, undef, 'Remove mailing list');
400
401 print $q->startform
402 (-method => 'POST', -action => $q->url (-absolute => 1));
403
404 - my $list = $q->param ('list');
405 + my $listName = $q->param ('list');
406
407 - if ( defined db_get(\%accounts, $list) )
408 + my $list = $accounts->get($listName);
409 + if ($list)
410 {
411 - print $q->p ("You are about to remove the mailing list \"$list\"");
412 + print $q->p ("You are about to remove the mailing list \"$listName\"");
413
414 print $q->p ('The mailing list address will no longer be usable',
415 'and current items and the list archives will be removed');
416 @@ -377,7 +370,7 @@
417 print $q->p ($q->b ('Are you sure you wish to remove this list?'));
418
419 print $q->submit (-name => 'action', -value => 'Remove');
420 - print $q->hidden (-name => 'list', -override => 1, -default => $list);
421 + print $q->hidden (-name => 'list', -override => 1, -default => $listName);
422
423 print $q->hidden (-name => 'state',
424 -override => 1,
425 @@ -400,13 +393,14 @@
426 #------------------------------------------------------------
427 # Attempt to delete list
428 #------------------------------------------------------------
429 - my $list = $q->param ('list');
430 -
431 - system ('/sbin/e-smith/signal-event', 'mailinglist-delete', $list) == 0
432 - or die ("Error occurred while deleting list.\n");
433 -
434 - delete $accounts {$list};
435 -
436 - showInitial ($q, "Successfully deleted mailing list $list.");
437 + my $listName = $q->param ('list');
438 + my $list = $accounts->get($listName);
439 + if ($list)
440 + {
441 + system ('/sbin/e-smith/signal-event', 'mailinglist-delete', $listName) == 0
442 + or die ("Error occurred while deleting list.\n");
443 + $list->delete;
444 + showInitial ($q, "Successfully deleted mailing list $list.");
445 + }
446 }
447

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed