1
# See bottom of file for copyright and license details
5
---+ package Foswiki::If::OP_istopic
9
package Foswiki::If::OP_istopic;
10
use base 'Foswiki::Query::UnaryOP';
16
return $class->SUPER::new( name => 'istopic', prec => 600 );
22
my $a = $node->{params}->[0];
24
my $session = $domain{tom}->session;
26
'No context in which to evaluate "' . $a->stringify() . '"' )
28
my ( $web, $topic ) = ( $session->{webName}, $a->_evaluate(@_) );
29
return 0 unless defined $topic; # null topic cannot possibly exist
30
( $web, $topic ) = $session->normalizeWebTopicName( $web, $topic );
32
return $session->{store}->topicExists( $web, $topic ) ? 1 : 0;
38
Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/, http://Foswiki.org/
40
# Copyright (C) 2008 Foswiki Contributors. All Rights Reserved.
41
# Foswiki Contributors are listed in the AUTHORS file in the root
42
# of this distribution. NOTE: Please extend that file, not this notice.
44
# Additional copyrights apply to some or all of the code in this
47
# Copyright (C) 2005-2007 TWiki Contributors. All Rights Reserved.
48
# TWiki Contributors are listed in the AUTHORS file in the root
49
# of this distribution. NOTE: Please extend that file, not this notice.
52
This program is free software; you can redistribute it and/or
53
modify it under the terms of the GNU General Public License
54
as published by the Free Software Foundation; either version 2
55
of the License, or (at your option) any later version. For
56
more details read LICENSE in the root of this distribution.
58
This program is distributed in the hope that it will be useful,
59
but WITHOUT ANY WARRANTY; without even the implied warranty of
60
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
62
As per the GPL, removal of this notice is prohibited.
64
Author: Crawford Currie http://c-dot.co.uk
65
# See bottom of file for copyright and license details
69
---+ package Foswiki::If::OP_istopic
73
package Foswiki::If::OP_istopic;
74
use base 'Foswiki::Query::UnaryOP';
80
return $class->SUPER::new( name => 'istopic', prec => 600 );
86
my $a = $node->{params}->[0];
88
my $session = $domain{tom}->session;
89
throw Error::Simple('No context in which to evaluate "'.
90
$a->stringify().'"') unless $session;
91
my( $web, $topic) = ( $session->{webName}, $a->_evaluate(@_));
92
return 0 unless defined $topic; # null topic cannot possibly exist
93
($web, $topic) = $session->normalizeWebTopicName($web, $topic);
95
return $session->{store}->topicExists($web, $topic) ? 1 : 0;
101
Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/, http://Foswiki.org/
103
# Copyright (C) 2008 Foswiki Contributors. All Rights Reserved.
104
# Foswiki Contributors are listed in the AUTHORS file in the root
105
# of this distribution. NOTE: Please extend that file, not this notice.
107
# Additional copyrights apply to some or all of the code in this
110
# Copyright (C) 2005-2007 TWiki Contributors. All Rights Reserved.
111
# TWiki Contributors are listed in the AUTHORS file in the root
112
# of this distribution. NOTE: Please extend that file, not this notice.
115
This program is free software; you can redistribute it and/or
116
modify it under the terms of the GNU General Public License
117
as published by the Free Software Foundation; either version 2
118
of the License, or (at your option) any later version. For
119
more details read LICENSE in the root of this distribution.
121
This program is distributed in the hope that it will be useful,
122
but WITHOUT ANY WARRANTY; without even the implied warranty of
123
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
125
As per the GPL, removal of this notice is prohibited.
127
Author: Crawford Currie http://c-dot.co.uk
128
# See bottom of file for copyright and license details
132
---+ package Foswiki::If::OP_istopic
136
package Foswiki::If::OP_istopic;
137
use base 'Foswiki::Query::UnaryOP';
143
return $class->SUPER::new( name => 'istopic', prec => 600 );
149
my $a = $node->{params}->[0];
151
my $session = $domain{tom}->session;
152
throw Error::Simple('No context in which to evaluate "'.
153
$a->stringify().'"') unless $session;
154
my( $web, $topic) = ( $session->{webName}, $a->_evaluate(@_));
155
return 0 unless defined $topic; # null topic cannot possibly exist
156
($web, $topic) = $session->normalizeWebTopicName($web, $topic);
158
return $session->{store}->topicExists($web, $topic) ? 1 : 0;
164
Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/, http://Foswiki.org/
166
# Copyright (C) 2008-2009 Foswiki Contributors. All Rights Reserved.
167
# Foswiki Contributors are listed in the AUTHORS file in the root
168
# of this distribution. NOTE: Please extend that file, not this notice.
170
# Additional copyrights apply to some or all of the code in this
173
# Copyright (C) 2005-2007 TWiki Contributors. All Rights Reserved.
174
# TWiki Contributors are listed in the AUTHORS file in the root
175
# of this distribution. NOTE: Please extend that file, not this notice.
178
This program is free software; you can redistribute it and/or
179
modify it under the terms of the GNU General Public License
180
as published by the Free Software Foundation; either version 2
181
of the License, or (at your option) any later version. For
182
more details read LICENSE in the root of this distribution.
184
This program is distributed in the hope that it will be useful,
185
but WITHOUT ANY WARRANTY; without even the implied warranty of
186
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
188
As per the GPL, removal of this notice is prohibited.
190
Author: Crawford Currie http://c-dot.co.uk