line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- perl -*- |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# $Id: Obj.pm,v 1.10 2005/01/31 08:28:23 eserte Exp $ |
5
|
|
|
|
|
|
|
# Author: Slaven Rezic |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# Copyright (C) 2001 Online Office Berlin. All rights reserved. |
8
|
|
|
|
|
|
|
# Copyright (C) 2002,2005 Slaven Rezic. |
9
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under the |
10
|
|
|
|
|
|
|
# terms of the GNU General Public License, see the file COPYING. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# Mail: slaven@rezic.de |
14
|
|
|
|
|
|
|
# WWW: http://we-framework.sourceforge.net |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
package WE::Obj; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
WE::Obj - base object class for the web editor framework |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This is an abstract class. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
For member attributes there are accessors defined. To get the value of |
30
|
|
|
|
|
|
|
a member named B, use: |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$object->Id; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
To set the value of a member use: |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$object->Id($new_value); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Below is a list of member attributes which can be defined for each |
39
|
|
|
|
|
|
|
object. The semantics apply to the L |
40
|
|
|
|
|
|
|
database. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=over 4 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item Id |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
The identifier for this object. Normally, this identifier is numeric |
47
|
|
|
|
|
|
|
(but it does not have to). The normal user should not change the Id. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item Title |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
The title for this object. This is usually a normal string. If you |
52
|
|
|
|
|
|
|
want to set language-dependent titles, then look at |
53
|
|
|
|
|
|
|
L. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item Basename |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
An optional basename for this object. For backends using a |
58
|
|
|
|
|
|
|
pathname-like scheme, this can be used to construct the basename. See |
59
|
|
|
|
|
|
|
L. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item Name |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
An optional name for this object. This name should be unique in the |
64
|
|
|
|
|
|
|
database and will be used for name-based queries. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item Keywords |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Optional keywords for this object. This is usually a normal string. If you |
69
|
|
|
|
|
|
|
want to set language-dependent keywords, then look at |
70
|
|
|
|
|
|
|
L. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item TimeCreated |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
The time of the creation of the object. This attribute is set |
75
|
|
|
|
|
|
|
automatically and should not be changed. The returned value is an ISO |
76
|
|
|
|
|
|
|
date. See L for conversion functions for ISO dates. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item TimeModified |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
The time of the last modification of the object. Both attribute |
81
|
|
|
|
|
|
|
modification and content modification are taken into account. Like in |
82
|
|
|
|
|
|
|
C, the returned value is an ISO date. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item Owner |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This is the owner of the object. The owner is set automatically when |
87
|
|
|
|
|
|
|
creating the object (see L). See L below |
88
|
|
|
|
|
|
|
for more information. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item DocAuthor |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This is the original author of the object. This should be set only if |
93
|
|
|
|
|
|
|
the original author differs from the technical Owner of the object. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item Rights |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
For now, the value for the B member is a freely definable. Its |
98
|
|
|
|
|
|
|
value is not used nor it is inherited to other objects. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item TimeOpen |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This member can be set to an ISO date to indicate the start of |
103
|
|
|
|
|
|
|
publication for the object. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item TimeExpire |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This member can be set to an ISO date to indicate the end of |
108
|
|
|
|
|
|
|
publication for the object. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item Version_Owner |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This member is only set for versions and for checked out objects. It |
113
|
|
|
|
|
|
|
holds the user who made this version. This member is set |
114
|
|
|
|
|
|
|
automatically. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item Version_Time |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This member is only set for versions and for checked out objects. It |
119
|
|
|
|
|
|
|
holds the time when this version is made. This member is set |
120
|
|
|
|
|
|
|
automatically. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item Version_Comment |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This member is only set for versions and for checked out objects. It |
125
|
|
|
|
|
|
|
holds the (optional) log message (or comment) for this version. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item Version_Number |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This member is only set for versions and for checked out objects. It |
130
|
|
|
|
|
|
|
holds the version number for this version. Normally version numbers |
131
|
|
|
|
|
|
|
begin at "1.0" and are incremented by 0.1 (that is, the next would be |
132
|
|
|
|
|
|
|
"1.1", "1.2" and so on), but version numbers are not necessarily |
133
|
|
|
|
|
|
|
numbers. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item Version_Parent |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This member is only set for versions and for checked out objects. It |
138
|
|
|
|
|
|
|
holds the Id of the original object belonging to this version. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item Release_State |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
The following values are possible: |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=over |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item released |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
The object is released. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item inactive |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
The object should never be released. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item modified |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
The object was modified since the last release or it was never |
157
|
|
|
|
|
|
|
released. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=back |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item Release_* |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
The attributes Release_Author, Release_Flow, Release_Publishers, |
164
|
|
|
|
|
|
|
Release_ReviewedBy, and Release_TargetFolder are |
165
|
|
|
|
|
|
|
defined, but there is not functionality for these. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item LockedBy |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Holds the user who is locking this object. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item LockType |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
The LockType may be B or B. A permanent |
174
|
|
|
|
|
|
|
lock is valid over sessions. A session lock is only valid for the |
175
|
|
|
|
|
|
|
session of the locking user. If the locking user logs out (or the |
176
|
|
|
|
|
|
|
system can determine by some other means that the user is not logged |
177
|
|
|
|
|
|
|
in --- see L), then the lock is not valid anymore. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item Dirty |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Indicates that the object is changed after the last check in. This is |
182
|
|
|
|
|
|
|
the combination of B and B. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item DirtyAttributes |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Indicates that the attributes of the object changed after the last |
187
|
|
|
|
|
|
|
check in. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item DirtyContent |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Indicates that the content of the object changed after the last check |
192
|
|
|
|
|
|
|
in. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=back |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Other custom attributes may be set by accessing the object as a hash: |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
$object->{My_Attribute} = ["my value1", "my value2"]; |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
As you can see, the value may also be a complex perl data structure. |
201
|
|
|
|
|
|
|
It is a good idea to use a prefix (like "My_" in the sample above) to |
202
|
|
|
|
|
|
|
minimize the chance of name clashes. |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
For other standard attributes, look at the documentation of the sub |
205
|
|
|
|
|
|
|
classes of WE::Obj. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head2 METHODS |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=over 4 |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=cut |
212
|
|
|
|
|
|
|
|
213
|
17
|
|
|
17
|
|
44791
|
use base qw(Class::Accessor); |
|
17
|
|
|
|
|
121
|
|
|
17
|
|
|
|
|
4434
|
|
214
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors |
215
|
|
|
|
|
|
|
(qw(Id Title Basename Name Keywords |
216
|
|
|
|
|
|
|
TimeCreated TimeModified Owner DocAuthor Rights TimeOpen TimeExpire |
217
|
|
|
|
|
|
|
Version_Owner Version_Time Version_Comment Version_Number |
218
|
|
|
|
|
|
|
Version_Parent |
219
|
|
|
|
|
|
|
Release_Author Release_Flow Release_Publishers Release_ReviewedBy |
220
|
|
|
|
|
|
|
Release_State Release_TargetFolder |
221
|
|
|
|
|
|
|
LockedBy LockType LockTime |
222
|
|
|
|
|
|
|
Dirty DirtyAttributes DirtyContent)); |
223
|
|
|
|
|
|
|
|
224
|
17
|
|
|
17
|
|
6635
|
use strict; |
|
17
|
|
|
|
|
65
|
|
|
17
|
|
|
|
|
703
|
|
225
|
17
|
|
|
17
|
|
105
|
use vars qw($VERSION @all_classes); |
|
17
|
|
|
|
|
28
|
|
|
17
|
|
|
|
|
15118
|
|
226
|
|
|
|
|
|
|
$VERSION = sprintf("%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/); |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
@all_classes = qw(Sites Site Folder LangCluster Sequence Doc LangDoc); |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
sub new { |
231
|
1
|
|
|
1
|
1
|
14
|
my($class, %args) = @_; |
232
|
1
|
|
|
|
|
4
|
my $self = {%args}; |
233
|
1
|
|
|
|
|
5
|
bless $self, $class; |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item instantiable |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
Return true if the object is instantiable (e.g. only folders and |
239
|
|
|
|
|
|
|
documents). |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=cut |
242
|
|
|
|
|
|
|
|
243
|
0
|
|
|
0
|
1
|
0
|
sub instantiable { 0 } |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=item insertable_types |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
Return an array reference of class names which are insertable into |
248
|
|
|
|
|
|
|
this object. Applies only for folder-like objects. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=cut |
251
|
|
|
|
|
|
|
|
252
|
0
|
|
|
0
|
1
|
0
|
sub insertable_types { [] } |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=item use_classes(@classes) |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
Load into perl all given classes. C<:all> means: load all known |
257
|
|
|
|
|
|
|
classes. |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=cut |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
sub use_classes { |
262
|
14
|
|
|
14
|
1
|
232
|
my($self, @classes) = @_; |
263
|
14
|
|
|
|
|
42
|
foreach my $class (@classes) { |
264
|
|
|
|
|
|
|
# allow abbreviations |
265
|
112
|
100
|
33
|
|
|
537
|
if ($class !~ /^WE::Obj/ && $class !~ /^:/) { |
266
|
98
|
|
|
|
|
207
|
$class = "WE::Obj::$class"; |
267
|
|
|
|
|
|
|
} |
268
|
112
|
100
|
|
|
|
286
|
if ($class eq ':all') { |
269
|
14
|
|
|
|
|
59
|
push @classes, @all_classes; |
270
|
14
|
|
|
|
|
42
|
next; |
271
|
|
|
|
|
|
|
} |
272
|
98
|
|
|
|
|
6616
|
eval "require $class; $class->import"; |
273
|
98
|
50
|
|
|
|
1457
|
die $@ if $@; |
274
|
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=item object_is_insertable($obj) |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
Return true if the given object is insertable. |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=cut |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
sub object_is_insertable { |
284
|
0
|
|
|
0
|
1
|
0
|
my($self, $obj) = @_; |
285
|
0
|
|
|
|
|
0
|
foreach (@{$self->insertable_types}) { |
|
0
|
|
|
|
|
0
|
|
286
|
0
|
0
|
0
|
|
|
0
|
return 1 if $obj->isa($_) || $_ eq ':all'; |
287
|
|
|
|
|
|
|
} |
288
|
0
|
|
|
|
|
0
|
0; |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=item clone |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
Clone the given object. |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=cut |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
sub clone { |
298
|
1
|
|
|
1
|
1
|
2056
|
my($self) = @_; |
299
|
1
|
50
|
|
|
|
3
|
if (eval { local $SIG{__DIE__}; require Storable; 1 }) { |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
1175
|
|
|
1
|
|
|
|
|
3595
|
|
300
|
1
|
|
|
|
|
3
|
local $Storable::forgive_me = 1; |
301
|
1
|
|
|
|
|
164
|
Storable::dclone($self); |
302
|
|
|
|
|
|
|
} else { |
303
|
17
|
|
|
17
|
|
108
|
no strict 'vars'; # ignore $obj_copy |
|
17
|
|
|
|
|
35
|
|
|
17
|
|
|
|
|
10428
|
|
304
|
0
|
|
|
|
|
0
|
require Data::Dumper; |
305
|
0
|
|
|
|
|
0
|
my $dd = new Data::Dumper([$self],['obj_copy']); |
306
|
0
|
|
|
|
|
0
|
my $cloned = eval $dd->Dump; |
307
|
0
|
0
|
|
|
|
0
|
die $@ if $@; |
308
|
0
|
|
|
|
|
0
|
$cloned; |
309
|
|
|
|
|
|
|
} |
310
|
|
|
|
|
|
|
} |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
=item is_doc, is_folder, is_site |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
Return true if the object is a document, folder or site. |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=cut |
317
|
|
|
|
|
|
|
|
318
|
0
|
|
|
0
|
1
|
0
|
sub is_doc { $_[0]->isa('WE::Obj::DocObj') } |
319
|
0
|
|
|
0
|
1
|
0
|
sub is_folder { $_[0]->isa('WE::Obj::FolderObj') } |
320
|
0
|
|
|
0
|
1
|
0
|
sub is_site { $_[0]->isa('WE::Obj::Site') } |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=item is_sequence |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
Return true if the object is a sequence. Remember that a Sequence is |
325
|
|
|
|
|
|
|
always a FolderObj, so the return value of C will also be |
326
|
|
|
|
|
|
|
true. |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=cut |
329
|
|
|
|
|
|
|
|
330
|
0
|
|
|
0
|
1
|
0
|
sub is_sequence { $_[0]->isa('WE::Obj::Sequence') } |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=item field_is_date($fieldname) |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
Return true if the given field should be treated as a date/time field. |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=cut |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
sub field_is_date { |
339
|
4
|
|
|
4
|
1
|
10069
|
my($self, $field) = @_; |
340
|
4
|
100
|
|
|
|
214
|
$field =~ /^(TimeCreated|TimeModified|TimeOpen|TimeExpire|Version_Time|LockTime)$/ ? 1 : 0; |
341
|
|
|
|
|
|
|
} |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=item field_is_user($fieldname) |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
Return true if the given field should be treated as a username field. |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=cut |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
sub field_is_user { |
350
|
2
|
|
|
2
|
1
|
4
|
my($self, $field) = @_; |
351
|
2
|
100
|
|
|
|
16
|
$field =~ /^(Owner|Version_Owner|Release_Author|Release_ReviewedBy|LockedBy)$/ ? 1 : 0; |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
=item field_is_user($fieldname) |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
Return true if the given field should not be edited (e.g. Id field). |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=cut |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
sub field_is_not_editable { |
361
|
2
|
|
|
2
|
0
|
4
|
my($self, $field) = @_; |
362
|
2
|
100
|
|
|
|
13
|
$field =~ /^(Id)$/ ? 1 : 0; |
363
|
|
|
|
|
|
|
} |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=item is_time_restricted($now) |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
Return true if the object is restricted via C and |
368
|
|
|
|
|
|
|
C. To adjust the current time, set C<$now> to a unix epoch |
369
|
|
|
|
|
|
|
time in seconds. |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=cut |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
sub is_time_restricted { |
374
|
3
|
|
|
3
|
1
|
1001
|
my($self, $now) = @_; |
375
|
3
|
100
|
|
|
|
10
|
if (!defined $now) { |
376
|
1
|
|
|
|
|
715
|
require WE::Util::Date; |
377
|
1
|
|
|
|
|
28
|
$now = WE::Util::Date::epoch2isodate(time); |
378
|
|
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
|
380
|
3
|
|
50
|
|
|
10
|
my $timeopen = $self->TimeOpen || undef; |
381
|
3
|
100
|
66
|
|
|
48
|
return 1 if (defined $timeopen && $timeopen gt $now); |
382
|
2
|
|
50
|
|
|
6
|
my $timeexpire = $self->TimeExpire || undef; |
383
|
2
|
100
|
66
|
|
|
29
|
return 1 if (defined $timeexpire && $timeexpire lt $now); |
384
|
1
|
|
|
|
|
7
|
0; |
385
|
|
|
|
|
|
|
} |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
1; |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
__END__ |