[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS Update: gleipnir
- To: cvs@lists.cleannorth.org
- Subject: CVS Update: gleipnir
- From: Dan Brosemer <odin@cleannorth.org>
- Date: Sun, 10 Aug 2008 15:41:39 -0401 (EDT)
- List-help: <mailto:cvs-request@lists.cleannorth.org?subject=help>
- List-post: <mailto:cvs@lists.cleannorth.org>
- List-subscribe: <mailto:cvs-request@lists.cleannorth.org?subject=subscribe>
- List-unsubscribe: <mailto:cvs-request@lists.cleannorth.org?subject=unsubscribe>
- Resent-date: Sun, 10 Aug 2008 15:41:43 -0401 (EDT)
- Resent-from: cvs@lists.cleannorth.org
- Resent-message-id: <tLJeNB.A.7HF.NS0nIB@skroob.cleannorth.org>
- Resent-sender: cvs-request@lists.cleannorth.org
Log Message:
-----------
Ability to create a new address book entry.
Modified Files:
--------------
gleipnir/public_html/webmail:
addressbook.pl
Revision Data
-------------
Index: addressbook.pl
===================================================================
RCS file: /cvs/gleipnir/public_html/webmail/addressbook.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lpublic_html/webmail/addressbook.pl -Lpublic_html/webmail/addressbook.pl -u -r1.2 -r1.3
--- public_html/webmail/addressbook.pl
+++ public_html/webmail/addressbook.pl
@@ -47,7 +47,7 @@
do { print $gleipnir->output; exit } if ( $gleipnir->done );
-if ($cgi->param('uid') || ($cgi->param('action') eq 'New'))
+if (defined($cgi->param('uid')) || ($cgi->param('action') eq 'New'))
{
$gleipnir = Edit( -gleipnir => $gleipnir );
}
@@ -78,7 +78,22 @@
my $gleipnir = $options{-gleipnir};
my $cgi = $gleipnir->cgi;
- my $address = (grep { $_->{uid} eq $cgi->param('uid') } @{$gleipnir->rpc('addressbook_list')})[0];
+ my $ctime = undef;
+ my $imapid = undef;
+ my $address = undef;
+ my $uid = undef;
+ if ($cgi->param('uid'))
+ {
+ $address = (grep { $_->{uid} eq $cgi->param('uid') } @{$gleipnir->rpc('addressbook_list')})[0];
+ $ctime = $address->{ctime};
+ $imapid = $address->{imapid};
+ $uid = $address->{uid};
+ }
+ else
+ {
+ $ctime = strftime('%FT%TZ', localtime);
+ $uid = 'pas-id-'. join '', map { (split //, '1234567890ABCDEF')[int(rand(16))] } split //, ' 'x16;
+ };
if ($cgi->param('action') eq 'Save')
{
my $imap = new Gleipnir::IMAP($gleipnir->cfetch(webmail => 'imapserver'));
@@ -94,12 +109,12 @@
my $body = MIME::QuotedPrint::encode_qp($template->output);
$template = $gleipnir->template('webmail/kolab');
- $template->param(ctime => $address->{ctime});
+ $template->param(ctime => $ctime);
$template->param(mtime => strftime('%FT%TZ', localtime));
$template->param(first => $cgi->param('first'));
$template->param(last => $cgi->param('last'));
$template->param(email => $cgi->param('email'));
- $template->param(uid => $cgi->param('uid'));
+ $template->param(uid => $uid);
my $kolab = $template->output;
my $boundary = '===='.time().'====';
@@ -124,14 +139,14 @@
my %mail = (
From => $myaddr,
To => 'synckolab@no.tld',
- Subject => $cgi->param('uid'),
+ Subject => $uid,
Date => strftime('%a, %e %b %Y %T %z',localtime),
'X-Kolab-Type' => 'application/x-vnd.kolab.contact',
Message => $message,
);
$mail{'Content-Type'} = "multipart/mixed; boundary=\"$boundary\"";
- $imap->delete($address->{imapid});
+ $imap->delete($imapid) if defined($imapid);
$imap->append('INBOX.kolab.AddressBook', _msgformat(%mail));
$imap->expunge();
return $gleipnir->url('/webmail/addressbook.pl');
- Prev by Date: CVS Update: gleipnir
- Next by Date: CVS Update: gleipnir
- Previous by thread: CVS Update: gleipnir
- Next by thread: CVS Update: gleipnir
- Index(es):