Line # Revision Author
1 296 ahitrov <doc id="<% $document->id %>">
2 % if ( ref $image && exists $image->{filename} ) {
3 % my $img_dir = $state->images_directory;
4 % $img_dir =~ s/\/$//;
5 <img src="<% $img_dir.$image->{filename} %>"/>
6 % }
7 <text><% $document->name %></text>
8 </doc>
9 <%args>
10
11 $id => undef
12 $new => undef
13
14 </%args>
15 <%init>
16
17 &abort404 if $id && $id =~ /\D/;
18 my $prj = $request->{project};
19 my $profile = $request->{project_profile};
20 my $root = $request->{project_section};
21
22 if ( $new ) {
23 # $r->header_out ('X-Accel-Expires', 0);
24 }
25 if ( !$new && !$id ) {
26 my %cookies = Apache::Cookie->fetch;
27 my $cookie = $cookies{card_id};
28
29 # Вытаскиваем SID из куки
30 $id = $cookie->value() if $cookie;
31 }
32 my $document;
33 if ( $id && !$new ) {
34 $document = $keeper->get_document_by_id ( $id,
35 class => 'promosuite::Postcard',
36 );
37 }
38 unless ( ref $document ) {
39 # $r->header_out ('X-Accel-Expires', 0);
40 $document = promosuite::Postcard->new ($keeper);
41 $document->sections($root->id);
42 $document->status(1);
43 $document->store;
44 my $cookie = Apache::Cookie->new ($request->r(),
45 -name => 'card_id',
46 -expires=> '+7d',
47 -value => $document->id,
48 -path => '/',
49 );
50 $cookie->bake();
51 }
52 my $image = $document->get_image('picture');
53 if ( $state->development ) {
54 $r->content_type('text/xml; charset=utf-8');
55 } else {
56 $r->content_type('text/xml; charset=utf-8');
57 }
58
59 </%init>