| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
5
|
|
|
5
|
|
17575
|
use strict; |
|
|
5
|
|
|
|
|
13
|
|
|
|
5
|
|
|
|
|
147
|
|
|
2
|
5
|
|
|
5
|
|
31
|
use warnings; |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
290
|
|
|
3
|
|
|
|
|
|
|
package Rubric::WebApp::URI; |
|
4
|
|
|
|
|
|
|
# ABSTRACT: URIs for Rubric web requests |
|
5
|
|
|
|
|
|
|
$Rubric::WebApp::URI::VERSION = '0.156'; |
|
6
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
|
7
|
|
|
|
|
|
|
#pod |
|
8
|
|
|
|
|
|
|
#pod This module provides methods for generating the URIs for Rubric requests. |
|
9
|
|
|
|
|
|
|
#pod |
|
10
|
|
|
|
|
|
|
#pod =cut |
|
11
|
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
30
|
use Rubric::Config; |
|
|
5
|
|
|
|
|
17
|
|
|
|
5
|
|
|
|
|
34
|
|
|
13
|
5
|
|
|
5
|
|
28
|
use Scalar::Util (); |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
5537
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#pod =head1 METHODS |
|
16
|
|
|
|
|
|
|
#pod |
|
17
|
|
|
|
|
|
|
#pod =head2 root |
|
18
|
|
|
|
|
|
|
#pod |
|
19
|
|
|
|
|
|
|
#pod the URI for the root of the Rubric; taken from uri_root in config |
|
20
|
|
|
|
|
|
|
#pod |
|
21
|
|
|
|
|
|
|
#pod =cut |
|
22
|
|
|
|
|
|
|
|
|
23
|
429
|
|
|
429
|
1
|
1973
|
sub root { Rubric::Config->uri_root } |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#pod =head2 stylesheet |
|
26
|
|
|
|
|
|
|
#pod |
|
27
|
|
|
|
|
|
|
#pod the URI for the stylesheet |
|
28
|
|
|
|
|
|
|
#pod |
|
29
|
|
|
|
|
|
|
#pod =cut |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub stylesheet { |
|
32
|
85
|
|
|
85
|
1
|
1904
|
my $href = Rubric::Config->css_href; |
|
33
|
85
|
50
|
|
|
|
291
|
return $href if $href; |
|
34
|
85
|
|
|
|
|
284
|
return Rubric::Config->uri_root . '/style/rubric.css'; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#pod =head2 logout |
|
38
|
|
|
|
|
|
|
#pod |
|
39
|
|
|
|
|
|
|
#pod URI to log out |
|
40
|
|
|
|
|
|
|
#pod |
|
41
|
|
|
|
|
|
|
#pod =cut |
|
42
|
|
|
|
|
|
|
|
|
43
|
13
|
|
|
13
|
1
|
141
|
sub logout { Rubric::Config->uri_root . '/logout' } |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
#pod =head2 login |
|
46
|
|
|
|
|
|
|
#pod |
|
47
|
|
|
|
|
|
|
#pod URI to form for log in |
|
48
|
|
|
|
|
|
|
#pod |
|
49
|
|
|
|
|
|
|
#pod =cut |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub login { |
|
52
|
36
|
|
|
36
|
1
|
424
|
my $uri = Rubric::Config->uri_root . '/login'; |
|
53
|
36
|
50
|
|
|
|
149
|
$uri =~ s/^http:/https:/i if Rubric::Config->secure_login; |
|
54
|
36
|
|
|
|
|
174
|
return $uri; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
#pod =head2 reset_password |
|
58
|
|
|
|
|
|
|
#pod |
|
59
|
|
|
|
|
|
|
#pod URI to reset user password |
|
60
|
|
|
|
|
|
|
#pod |
|
61
|
|
|
|
|
|
|
#pod =cut |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub reset_password { |
|
64
|
6
|
|
|
6
|
1
|
66
|
my ($class, $arg) = @_; |
|
65
|
6
|
|
|
|
|
23
|
my $uri = Rubric::Config->uri_root . '/reset_password'; |
|
66
|
6
|
50
|
33
|
|
|
31
|
if ($arg->{user} and defined $arg->{reset_code}) { |
|
67
|
0
|
|
|
|
|
0
|
$uri .= "/$arg->{user}/$arg->{reset_code}"; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
6
|
|
|
|
|
29
|
return $uri; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
#pod =head2 newuser |
|
73
|
|
|
|
|
|
|
#pod |
|
74
|
|
|
|
|
|
|
#pod URI to form for new user registration form; returns false if registration is |
|
75
|
|
|
|
|
|
|
#pod closed. |
|
76
|
|
|
|
|
|
|
#pod |
|
77
|
|
|
|
|
|
|
#pod =cut |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub newuser { |
|
80
|
60
|
50
|
|
60
|
1
|
728
|
return if Rubric::Config->registration_closed; |
|
81
|
60
|
|
|
|
|
161
|
return Rubric::Config->uri_root . '/newuser'; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
#pod =head2 entries(\%arg) |
|
85
|
|
|
|
|
|
|
#pod |
|
86
|
|
|
|
|
|
|
#pod URI for entry listing; valid keys for C<%arg>: |
|
87
|
|
|
|
|
|
|
#pod |
|
88
|
|
|
|
|
|
|
#pod user - entries for one user |
|
89
|
|
|
|
|
|
|
#pod tags - arrayref of tag names |
|
90
|
|
|
|
|
|
|
#pod |
|
91
|
|
|
|
|
|
|
#pod =cut |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub entries { |
|
94
|
382
|
|
|
382
|
1
|
123974
|
my ($class, $arg) = @_; |
|
95
|
382
|
|
100
|
|
|
1437
|
$arg->{tags} ||= {}; |
|
96
|
216
|
|
|
|
|
815
|
$arg->{tags} = { map { $_ => undef } @{$arg->{tags}} } |
|
|
207
|
|
|
|
|
529
|
|
|
97
|
382
|
100
|
|
|
|
1190
|
if ref $arg->{tags} eq 'ARRAY'; |
|
98
|
|
|
|
|
|
|
|
|
99
|
382
|
|
|
|
|
741
|
my $format = delete $arg->{format}; |
|
100
|
|
|
|
|
|
|
|
|
101
|
382
|
|
|
|
|
952
|
my $uri = $class->root . '/entries'; |
|
102
|
382
|
100
|
|
|
|
1128
|
$uri .= "/user/$arg->{user}" if $arg->{user}; |
|
103
|
382
|
100
|
|
|
|
24563
|
$uri .= '/tags/' . join('+', keys %{$arg->{tags}}) if %{$arg->{tags}}; |
|
|
233
|
|
|
|
|
904
|
|
|
|
382
|
|
|
|
|
1261
|
|
|
104
|
382
|
|
|
|
|
814
|
for (qw(has_body has_link)) { |
|
105
|
|
|
|
|
|
|
$uri .= "/$_/" . ($arg->{$_} ? 1 : 0) |
|
106
|
764
|
0
|
66
|
|
|
2727
|
if (defined $arg->{$_} and $arg->{$_} ne ''); |
|
|
|
50
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
} |
|
108
|
382
|
100
|
|
|
|
918
|
$uri .= "/urimd5/$arg->{urimd5}" if $arg->{urimd5}; |
|
109
|
382
|
100
|
|
|
|
895
|
$uri .= "?format=$format" if $format; |
|
110
|
382
|
|
|
|
|
3131
|
return $uri; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
#pod =head2 entry($entry) |
|
114
|
|
|
|
|
|
|
#pod |
|
115
|
|
|
|
|
|
|
#pod URI to view entry |
|
116
|
|
|
|
|
|
|
#pod |
|
117
|
|
|
|
|
|
|
#pod =cut |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub entry { |
|
120
|
45
|
|
|
45
|
1
|
545
|
my ($class, $entry) = @_; |
|
121
|
45
|
50
|
33
|
|
|
430
|
return unless Scalar::Util::blessed($entry) && $entry->isa('Rubric::Entry'); |
|
122
|
|
|
|
|
|
|
|
|
123
|
45
|
|
|
|
|
199
|
return Rubric::Config->uri_root . "/entry/" . $entry->id; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
#pod =head2 edit_entry($entry) |
|
127
|
|
|
|
|
|
|
#pod |
|
128
|
|
|
|
|
|
|
#pod URI to edit entry |
|
129
|
|
|
|
|
|
|
#pod |
|
130
|
|
|
|
|
|
|
#pod =cut |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub edit_entry { |
|
133
|
8
|
|
|
8
|
1
|
109
|
my ($class, $entry) = @_; |
|
134
|
8
|
50
|
33
|
|
|
82
|
return unless Scalar::Util::blessed($entry) && $entry->isa('Rubric::Entry'); |
|
135
|
|
|
|
|
|
|
|
|
136
|
8
|
|
|
|
|
31
|
return Rubric::Config->uri_root . "/edit/" . $entry->id; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
#pod =head2 delete_entry($entry) |
|
140
|
|
|
|
|
|
|
#pod |
|
141
|
|
|
|
|
|
|
#pod URI to delete entry |
|
142
|
|
|
|
|
|
|
#pod |
|
143
|
|
|
|
|
|
|
#pod =cut |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub delete_entry { |
|
146
|
1
|
|
|
1
|
1
|
20
|
my ($class, $entry) = @_; |
|
147
|
1
|
50
|
33
|
|
|
19
|
return unless Scalar::Util::blessed($entry) && $entry->isa('Rubric::Entry'); |
|
148
|
|
|
|
|
|
|
|
|
149
|
1
|
|
|
|
|
6
|
return Rubric::Config->uri_root . "/delete/" . $entry->id; |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
#pod =head2 post_entry |
|
153
|
|
|
|
|
|
|
#pod |
|
154
|
|
|
|
|
|
|
#pod URI for new entry form |
|
155
|
|
|
|
|
|
|
#pod |
|
156
|
|
|
|
|
|
|
#pod =cut |
|
157
|
|
|
|
|
|
|
|
|
158
|
29
|
|
|
29
|
1
|
431
|
sub post_entry { Rubric::Config->uri_root . "/post"; } |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
#pod =head2 by_date |
|
161
|
|
|
|
|
|
|
#pod |
|
162
|
|
|
|
|
|
|
#pod URI for by_date |
|
163
|
|
|
|
|
|
|
#pod |
|
164
|
|
|
|
|
|
|
#pod =cut |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub by_date { |
|
167
|
44
|
|
|
44
|
1
|
552
|
my ($class) = @_; |
|
168
|
44
|
|
|
|
|
84
|
shift; |
|
169
|
44
|
|
|
|
|
77
|
my $year = shift; |
|
170
|
44
|
|
|
|
|
80
|
my $month = shift; |
|
171
|
44
|
|
|
|
|
98
|
my $uri = '/calendar'; |
|
172
|
44
|
100
|
|
|
|
161
|
$uri .= "/$year" if ($year); |
|
173
|
44
|
100
|
|
|
|
209
|
$uri .= "/$month" if ($month); |
|
174
|
|
|
|
|
|
|
|
|
175
|
44
|
|
|
|
|
144
|
Rubric::Config->uri_root . $uri; |
|
176
|
|
|
|
|
|
|
} |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
#pod =head2 tag_cloud |
|
181
|
|
|
|
|
|
|
#pod |
|
182
|
|
|
|
|
|
|
#pod URI for all tags / tag cloud |
|
183
|
|
|
|
|
|
|
#pod |
|
184
|
|
|
|
|
|
|
#pod =cut |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
sub tag_cloud { |
|
187
|
42
|
|
|
42
|
1
|
508
|
my ($class) = @_; |
|
188
|
42
|
|
|
|
|
160
|
Rubric::Config->uri_root . "/tag_cloud"; |
|
189
|
|
|
|
|
|
|
} |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
#pod =head2 preferences |
|
192
|
|
|
|
|
|
|
#pod |
|
193
|
|
|
|
|
|
|
#pod URI for preferences form |
|
194
|
|
|
|
|
|
|
#pod |
|
195
|
|
|
|
|
|
|
#pod =cut |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
|
198
|
12
|
|
|
12
|
1
|
149
|
sub preferences { Rubric::Config->uri_root . "/preferences"; } |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
#pod =head2 verify_user |
|
201
|
|
|
|
|
|
|
#pod |
|
202
|
|
|
|
|
|
|
#pod URI for new entry form |
|
203
|
|
|
|
|
|
|
#pod |
|
204
|
|
|
|
|
|
|
#pod =cut |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
sub verify_user { |
|
207
|
0
|
|
|
0
|
1
|
0
|
my ($class, $user) = @_; |
|
208
|
0
|
|
|
|
|
0
|
Rubric::Config->uri_root . "/verify/$user/" . $user->verification_code; |
|
209
|
|
|
|
|
|
|
} |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
#pod =head2 doc($doc_page) |
|
212
|
|
|
|
|
|
|
#pod |
|
213
|
|
|
|
|
|
|
#pod URI for documentation page. |
|
214
|
|
|
|
|
|
|
#pod |
|
215
|
|
|
|
|
|
|
#pod =cut |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
sub doc { |
|
218
|
42
|
|
|
42
|
1
|
515
|
my ($class, $doc_page) = @_; |
|
219
|
42
|
|
|
|
|
132
|
Rubric::Config->uri_root . "/doc/" . $doc_page; |
|
220
|
|
|
|
|
|
|
} |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
1; |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
__END__ |