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 |
|
|
$store => undef |
12 |
|
|
|
13 |
|
|
</%args> |
14 |
|
|
<%init> |
15 |
|
|
|
16 |
|
|
my $prj = $request->{project}; |
17 |
|
|
my $profile = $request->{project_profile}; |
18 |
|
|
my $root = $request->{project_section}; |
19 |
|
|
|
20 |
|
|
unless ( $store ) { |
21 |
|
|
my %cookies = Apache::Cookie->fetch; |
22 |
|
|
my $cookie = $cookies{card_id}; |
23 |
|
|
|
24 |
|
|
# Вытаскиваем SID из куки |
25 |
|
|
$store = $cookie->value() if $cookie; |
26 |
|
|
} |
27 |
|
|
my $document; |
28 |
|
|
|
29 |
|
|
if ( $store ) { |
30 |
|
|
$document = $keeper->get_document_by_id ( $store, |
31 |
|
|
class => 'promosuite::Postcard', |
32 |
|
|
); |
33 |
|
|
unless ( ref $document ) { |
34 |
|
|
$document = promosuite::Postcard->new ($keeper); |
35 |
|
|
$document->sections($root->id); |
36 |
|
|
$document->status(1); |
37 |
|
|
} |
38 |
|
|
|
39 |
|
|
my $greeting = $ARGS{greeting}; |
40 |
|
|
$greeting =~ s/</</sgi; |
41 |
|
|
$greeting =~ s/>/>/sgi; |
42 |
|
|
$document->name( $greeting ); |
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 |
|
|
return unless ref $document && $document->id; |
53 |
|
|
my $image = $document->get_image('picture'); |
54 |
|
|
if ( $state->development ) { |
55 |
|
|
$r->content_type('text/xml; charset=utf-8'); |
56 |
|
|
} else { |
57 |
|
|
$r->content_type('text/xml; charset=utf-8'); |
58 |
|
|
} |
59 |
|
|
$r->header_out ('X-Accel-Expires', 0); |
60 |
|
|
|
61 |
|
|
</%init> |