[Rt-commit] [svn] r1306 - in RTx-Atom: . html/Atom/0.3 html/Atom/0.3/Update lib/RT

autrijus at pallas.eruditorum.org autrijus at pallas.eruditorum.org
Tue Aug 3 22:14:40 EDT 2004


Author: autrijus
Date: Tue Aug  3 22:14:39 2004
New Revision: 1306

Modified:
   RTx-Atom/   (props changed)
   RTx-Atom/Changes
   RTx-Atom/html/Atom/0.3/Update/index
   RTx-Atom/html/Atom/0.3/dhandler
   RTx-Atom/lib/RT/Atom.pm
Log:
 r6788 at not:  autrijus | 2004-08-04T02:10:47.476087Z
 * This be 0.02.
 * Addressing user-defined Groups by name now works.
 * Update type 'Comment' and 'Correspond' now works, with either "Content"
   or "MIMEObj" keys.


Modified: RTx-Atom/Changes
==============================================================================
--- RTx-Atom/Changes	(original)
+++ RTx-Atom/Changes	Tue Aug  3 22:14:39 2004
@@ -1,3 +1,10 @@
+[Changes for 0.02 - August 4, 2004]
+
+Addressing user-defined Groups by name now works.
+
+Update type 'Comment' and 'Correspond' now works, with either "Content"
+or "MIMEObj" keys.
+
 [Changes for 0.01 - July 12, 2004]
 
 Made it working on Apache 1.3 + mod_perl.

Modified: RTx-Atom/html/Atom/0.3/Update/index
==============================================================================
--- RTx-Atom/html/Atom/0.3/Update/index	(original)
+++ RTx-Atom/html/Atom/0.3/Update/index	Tue Aug  3 22:14:39 2004
@@ -17,22 +17,33 @@
 <%INIT>
 my %args = $m->request_args;
 my $type = delete $args{type};
-
-# XXX - finish "Comment" and "Correspond" here
-die "$type not handled" if $type;
-
 my @results;
-foreach my $key (sort grep /^[A-Z]/, keys %args) {
-    my ($property, $method) = split(/-/, $key, 2);
-    $method ||= 'Set';
 
-    my $value = $args{$key};
-    push @results, [$m->comp(
-	"../Elements/\u\L$method\EProperty",
-	Object => $Object, 
-	Property => $property,
-	Value => $_,
-    )] for (UNIVERSAL::isa($value, 'ARRAY') ? @$value : $value);
+if ($type) {
+    die "$type not handled" unless $type =~ /^(?:Comment|Correspond)$/ and $Object->can($type);
+    if (exists $args{MIMEObj}) {
+        require MIME::Parser;
+        my $parser = MIME::Parser->new;
+        $parser->output_to_core(1);
+        $parser->tmp_to_core(1);
+        $args{MIMEObj} = $parser->parse_data(\$args{MIMEObj});
+    }
+    my ($trans, $msg, $obj) = $Object->$type( %args );
+    push @results, [($obj ? 200 : 400) => $msg];
+}
+else {
+    foreach my $key (sort grep /^[A-Z]/, keys %args) {
+        my ($property, $method) = split(/-/, $key, 2);
+        $method ||= 'Set';
+
+        my $value = $args{$key};
+        push @results, [$m->comp(
+            "../Elements/\u\L$method\EProperty",
+            Object => $Object, 
+            Property => $property,
+            Value => $_,
+        )] for (UNIVERSAL::isa($value, 'ARRAY') ? @$value : $value);
+    }
 }
 
 $r->status(207);

Modified: RTx-Atom/html/Atom/0.3/dhandler
==============================================================================
--- RTx-Atom/html/Atom/0.3/dhandler	(original)
+++ RTx-Atom/html/Atom/0.3/dhandler	Tue Aug  3 22:14:39 2004
@@ -301,7 +301,14 @@
     elsif ($part =~ /^(\w*)(?:\.(\w+))?$/ and !$obj) {
 	$property = $2;
 	$obj = $list->NewItem;
-	$obj->Load($1);
+
+        # XXX exception
+        if ($obj->can('LoadUserDefinedGroup')) {
+            $obj->LoadUserDefinedGroup($1);
+        }
+        else {
+            $obj->Load($1);
+        }
     }
     elsif ($part =~ /^([A-Z]\w*)(?:\.(\w+))?$/) {
 	$obj->can($1) or return $m->comp('Elements/Error', Status => 404);

Modified: RTx-Atom/lib/RT/Atom.pm
==============================================================================
--- RTx-Atom/lib/RT/Atom.pm	(original)
+++ RTx-Atom/lib/RT/Atom.pm	Tue Aug  3 22:14:39 2004
@@ -1,5 +1,5 @@
 package RT::Atom;
-$RT::Atom::VERSION = '0.01';
+$RT::Atom::VERSION = '0.02';
 
 use strict;
 


More information about the Rt-commit mailing list