| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Goo::TrailManager; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
|
4
|
|
|
|
|
|
|
# Nigel Hamilton |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2005 |
|
7
|
|
|
|
|
|
|
# All Rights Reserved |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
|
10
|
|
|
|
|
|
|
# Filename: Goo::TrailManager.pm |
|
11
|
|
|
|
|
|
|
# Description: Manage a Trail of Goo Actions - memex style. |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
# Date Change |
|
14
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
|
15
|
|
|
|
|
|
|
# 19/08/2005 Auto generated file |
|
16
|
|
|
|
|
|
|
# 19/08/2005 Needed a way of talking to the GooTrail database. |
|
17
|
|
|
|
|
|
|
# 20/08/2005 Added method: createDatabase |
|
18
|
|
|
|
|
|
|
# 21/08/2005 Added method: getMostRecent |
|
19
|
|
|
|
|
|
|
# 21/08/2005 Added method: getPreviousAction |
|
20
|
|
|
|
|
|
|
# 24/08/2005 Added method: getLatestActions |
|
21
|
|
|
|
|
|
|
# |
|
22
|
|
|
|
|
|
|
############################################################################### |
|
23
|
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
498
|
use Goo::Action; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
25
|
|
|
27
|
1
|
|
|
1
|
|
6
|
use Goo::Loader; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
26
|
|
|
28
|
1
|
|
|
1
|
|
6
|
use Goo::Prompter; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
19
|
|
|
29
|
1
|
|
|
1
|
|
516
|
use Goo::Environment; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
23
|
|
|
30
|
1
|
|
|
1
|
|
516
|
use Goo::LiteDatabase; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
1027
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# 7 - keep the buffer small (thanks to miller's rule - 7 plus or minus 2) |
|
34
|
|
|
|
|
|
|
my $BUFFER_SIZE_LIMIT = 6; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
############################################################################### |
|
38
|
|
|
|
|
|
|
# |
|
39
|
|
|
|
|
|
|
# reset_last_action - set the last_actionid in the trail.goo back to 0 |
|
40
|
|
|
|
|
|
|
# |
|
41
|
|
|
|
|
|
|
############################################################################### |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub reset_last_action { |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# the user is no longer delving into the trail |
|
46
|
0
|
|
|
0
|
1
|
|
Goo::ConfigFile::write_to_file("trail.goo", "last_actionid", 0); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
############################################################################### |
|
52
|
|
|
|
|
|
|
# |
|
53
|
|
|
|
|
|
|
# find_context - find the most recent goo context for the current thing |
|
54
|
|
|
|
|
|
|
# |
|
55
|
|
|
|
|
|
|
############################################################################### |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub find_context { |
|
58
|
|
|
|
|
|
|
|
|
59
|
0
|
|
|
0
|
1
|
|
my ($thing) = @_; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# look up the goo trail for this Thing |
|
62
|
0
|
|
|
|
|
|
my $user = Goo::Environment::get_user(); |
|
63
|
0
|
|
|
|
|
|
my $filename = $thing->get_filename(); |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $query = Goo::LiteDatabase::execute_sql(<<EOSQL); |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
select max(stepid) as 'maxstepid' |
|
68
|
|
|
|
|
|
|
from gootrail |
|
69
|
|
|
|
|
|
|
where thing = "$filename" |
|
70
|
|
|
|
|
|
|
order by stepid desc |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
EOSQL |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
my $row = Goo::LiteDatabase::get_result_hash($query); |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# grab the step id |
|
77
|
|
|
|
|
|
|
# |
|
78
|
|
|
|
|
|
|
# if thing->is_pain() - show after the pain start |
|
79
|
|
|
|
|
|
|
# |
|
80
|
0
|
|
|
|
|
|
my $starting_stepid = $row->{maxstepid} - 3; |
|
81
|
0
|
|
|
|
|
|
my $ending_stepid = $row->{maxstepid} + 3; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
############################################################################### |
|
88
|
|
|
|
|
|
|
# |
|
89
|
|
|
|
|
|
|
# get_context - display the most recent goo context for the current thing |
|
90
|
|
|
|
|
|
|
# |
|
91
|
|
|
|
|
|
|
############################################################################### |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub get_context { |
|
94
|
|
|
|
|
|
|
|
|
95
|
0
|
|
|
0
|
1
|
|
my ($starting_actionid, $ending_actionid) = @_; |
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my $query = Goo::LiteDatabase::execute_sql(<<EOSQL); |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
select actionid, |
|
100
|
|
|
|
|
|
|
action, |
|
101
|
|
|
|
|
|
|
thing, |
|
102
|
|
|
|
|
|
|
who, |
|
103
|
|
|
|
|
|
|
strftime("%d/%m/%Y %H:%M:%S",actiontime) as 'actiontime' |
|
104
|
|
|
|
|
|
|
from gootrail |
|
105
|
|
|
|
|
|
|
where actionid between $starting_actionid and $ending_actionid |
|
106
|
|
|
|
|
|
|
and thing != "tail.trail" |
|
107
|
|
|
|
|
|
|
and action not like ('Z%') |
|
108
|
|
|
|
|
|
|
order by actionid desc |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
EOSQL |
|
111
|
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
my @context; |
|
113
|
|
|
|
|
|
|
my $seen_thing; |
|
114
|
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
my $buffer_max_size = 6; |
|
116
|
0
|
|
|
|
|
|
my $buffer_counter = 0; |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# return the context back |
|
119
|
0
|
|
|
|
|
|
while (my $row = Goo::LiteDatabase::get_result_hash($query)) { |
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
0
|
|
|
|
|
next if $seen_thing->{ $row->{thing} }; |
|
122
|
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
$buffer_counter++; |
|
124
|
|
|
|
|
|
|
|
|
125
|
0
|
0
|
|
|
|
|
last if $buffer_counter > $buffer_max_size; |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
#print "adding a new goo action - $row->{actionid} $row->{action} \n"; |
|
128
|
0
|
|
|
|
|
|
unshift(@context, Goo::Action->new($row)); |
|
129
|
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
$seen_thing->{ $row->{thing} } = 1; |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
return @context; |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
############################################################################### |
|
139
|
|
|
|
|
|
|
# |
|
140
|
|
|
|
|
|
|
# create_database - save the commands for creating the database |
|
141
|
|
|
|
|
|
|
# |
|
142
|
|
|
|
|
|
|
############################################################################### |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub create_database { |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
# each user must have their own goo trail |
|
147
|
|
|
|
|
|
|
#GooLiteDatabase::do_sql("drop table gootrail"); |
|
148
|
|
|
|
|
|
|
#GooLiteDatabase::do_sql("drop index gootrail_idx2"); |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
# the integer primary key will automatically increment under SQLite |
|
151
|
0
|
|
|
0
|
1
|
|
Goo::LiteDatabase::do_sql(<<EOSQL); |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
create table backlinks ( linked_to_thing char(50) not null, |
|
154
|
|
|
|
|
|
|
linked_from_thing char(50) not null) |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
EOSQL |
|
157
|
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
Goo::LiteDatabase::do_sql(<<EOSQL); |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
create table gootrail ( actionid integer primary key, |
|
161
|
|
|
|
|
|
|
actiontime date not null, |
|
162
|
|
|
|
|
|
|
action char(50) not null, |
|
163
|
|
|
|
|
|
|
thing char(50) not null, |
|
164
|
|
|
|
|
|
|
who char(20)) |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
EOSQL |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
# setting the DATETIME('NOW') |
|
169
|
0
|
|
|
|
|
|
Goo::LiteDatabase::do_sql("create index gootrail_idx2 on gootrail(thing, actiontime)"); |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
############################################################################### |
|
175
|
|
|
|
|
|
|
# |
|
176
|
|
|
|
|
|
|
# go_back_one - return the previous action from the gootrail |
|
177
|
|
|
|
|
|
|
# |
|
178
|
|
|
|
|
|
|
############################################################################### |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub go_back_one { |
|
181
|
|
|
|
|
|
|
|
|
182
|
0
|
|
|
0
|
1
|
|
my $config = Goo::ConfigFile->new("trail.goo"); |
|
183
|
|
|
|
|
|
|
|
|
184
|
0
|
|
|
|
|
|
my $actionid; |
|
185
|
|
|
|
|
|
|
|
|
186
|
0
|
0
|
|
|
|
|
if ($config->{last_actionid} > 0) { |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
# decrement the last trailid |
|
189
|
0
|
|
|
|
|
|
$actionid = $config->{last_actionid} - 1; |
|
190
|
|
|
|
|
|
|
} else { |
|
191
|
0
|
|
|
|
|
|
$actionid = get_max_actionid() - 1; |
|
192
|
|
|
|
|
|
|
} |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
# save the details to the config file |
|
195
|
0
|
|
|
|
|
|
Goo::ConfigFile::write_to_file("trail.goo", "last_actionid", $actionid); |
|
196
|
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
|
return Goo::Loader::load(get_thing($actionid)); |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
} |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
############################################################################### |
|
202
|
|
|
|
|
|
|
# |
|
203
|
|
|
|
|
|
|
# go_forward_one - go to the next action in the goo trail |
|
204
|
|
|
|
|
|
|
# |
|
205
|
|
|
|
|
|
|
############################################################################### |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
sub go_forward_one { |
|
208
|
|
|
|
|
|
|
|
|
209
|
0
|
|
|
0
|
1
|
|
my $config = Goo::ConfigFile->new("trail.goo"); |
|
210
|
|
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
|
my $actionid; |
|
212
|
|
|
|
|
|
|
|
|
213
|
0
|
0
|
|
|
|
|
if ($config->{last_actionid} > 0) { |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
# decrement the last trailid |
|
216
|
0
|
|
|
|
|
|
$actionid = $config->{last_actionid} + 1; |
|
217
|
|
|
|
|
|
|
} |
|
218
|
|
|
|
|
|
|
|
|
219
|
0
|
0
|
|
|
|
|
if ($actionid > get_max_actionid()) { |
|
220
|
0
|
|
|
|
|
|
$actionid = get_max_actionid(); |
|
221
|
|
|
|
|
|
|
} |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
# save the details to the config file |
|
224
|
0
|
|
|
|
|
|
Goo::ConfigFile::write_to_file("trail.goo", "last_actionid", $actionid); |
|
225
|
|
|
|
|
|
|
|
|
226
|
0
|
|
|
|
|
|
return Goo::Loader::load(get_thing($actionid)); |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
############################################################################### |
|
232
|
|
|
|
|
|
|
# |
|
233
|
|
|
|
|
|
|
# get_previous_thing - return the previous action from the gootrail |
|
234
|
|
|
|
|
|
|
# |
|
235
|
|
|
|
|
|
|
############################################################################### |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub get_previous_thing { |
|
238
|
|
|
|
|
|
|
|
|
239
|
0
|
|
|
0
|
1
|
|
my ($thing) = @_; |
|
240
|
|
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
|
my $query = Goo::LiteDatabase::execute_sql(<<EOSQL); |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
select max(actionid) as 'actionid' |
|
244
|
|
|
|
|
|
|
from gootrail |
|
245
|
|
|
|
|
|
|
where thing = "$thing->{filename}" |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
EOSQL |
|
248
|
|
|
|
|
|
|
|
|
249
|
0
|
|
|
|
|
|
my $row = Goo::LiteDatabase::get_result_hash($query); |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
# we need to deduct 2 because the act of pressing back causes an action |
|
252
|
|
|
|
|
|
|
# to be added to the trail log |
|
253
|
0
|
|
|
|
|
|
my $previous_position = $row->{actionid} - 2; |
|
254
|
|
|
|
|
|
|
|
|
255
|
0
|
|
|
|
|
|
my @context = get_context($previous_position, $previous_position); |
|
256
|
|
|
|
|
|
|
|
|
257
|
0
|
|
|
|
|
|
my $previous_action = shift(@context); |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
# Goo::Prompter::notify($previous->to_string()); |
|
260
|
0
|
|
|
|
|
|
return Goo::Loader::load($previous_action->get_thing()); |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
} |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
############################################################################### |
|
266
|
|
|
|
|
|
|
# |
|
267
|
|
|
|
|
|
|
# get_latest_actions - return the most recent actions that have happened |
|
268
|
|
|
|
|
|
|
# |
|
269
|
|
|
|
|
|
|
############################################################################### |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
sub get_latest_actions { |
|
272
|
|
|
|
|
|
|
|
|
273
|
0
|
|
|
0
|
1
|
|
my $query = Goo::LiteDatabase::execute_sql(<<EOSQL); |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
select max(actionid) as 'maxactionid' |
|
276
|
|
|
|
|
|
|
from gootrail |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
EOSQL |
|
279
|
|
|
|
|
|
|
|
|
280
|
0
|
|
|
|
|
|
my $row = Goo::LiteDatabase::get_result_hash($query); |
|
281
|
|
|
|
|
|
|
|
|
282
|
0
|
|
|
|
|
|
my $starting_position = $row->{maxactionid} - 100; |
|
283
|
|
|
|
|
|
|
|
|
284
|
0
|
0
|
|
|
|
|
if ($starting_position < 1) { $starting_position = 1; } |
|
|
0
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
|
|
286
|
0
|
|
|
|
|
|
my $ending_position = $row->{maxactionid}; |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
# print "starting position = $starting_position - $ending_position\n"; |
|
289
|
0
|
|
|
|
|
|
return get_context($starting_position, $ending_position); |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
} |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
############################################################################### |
|
295
|
|
|
|
|
|
|
# |
|
296
|
|
|
|
|
|
|
# get_max_actionid - return the last actionid |
|
297
|
|
|
|
|
|
|
# |
|
298
|
|
|
|
|
|
|
############################################################################### |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
sub get_max_actionid { |
|
301
|
|
|
|
|
|
|
|
|
302
|
0
|
|
|
0
|
1
|
|
my $query = Goo::LiteDatabase::execute_sql(<<EOSQL); |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
select max(actionid) as 'maxactionid' |
|
305
|
|
|
|
|
|
|
from gootrail |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
EOSQL |
|
308
|
|
|
|
|
|
|
|
|
309
|
0
|
|
|
|
|
|
my $row = Goo::LiteDatabase::get_result_hash($query); |
|
310
|
|
|
|
|
|
|
|
|
311
|
0
|
|
|
|
|
|
return $row->{maxactionid}; |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
} |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
############################################################################### |
|
317
|
|
|
|
|
|
|
# |
|
318
|
|
|
|
|
|
|
# get_thing - return the thing for a position in the trail |
|
319
|
|
|
|
|
|
|
# |
|
320
|
|
|
|
|
|
|
############################################################################### |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
sub get_thing { |
|
323
|
|
|
|
|
|
|
|
|
324
|
0
|
|
|
0
|
1
|
|
my ($actionid) = @_; |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
# connect to the local SQLite DB |
|
327
|
0
|
|
|
|
|
|
my $query = Goo::LiteDatabase::execute_sql(<<EOSQL); |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
select thing |
|
330
|
|
|
|
|
|
|
from gootrail |
|
331
|
|
|
|
|
|
|
where actionid = $actionid |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
EOSQL |
|
334
|
|
|
|
|
|
|
|
|
335
|
0
|
|
|
|
|
|
my $row = Goo::LiteDatabase::get_result_hash($query); |
|
336
|
0
|
|
|
|
|
|
return $row->{thing}; |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
} |
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
############################################################################### |
|
342
|
|
|
|
|
|
|
# |
|
343
|
|
|
|
|
|
|
# save_goo_action - save a step in the goo_trail |
|
344
|
|
|
|
|
|
|
# |
|
345
|
|
|
|
|
|
|
############################################################################### |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
sub save_goo_action { |
|
348
|
|
|
|
|
|
|
|
|
349
|
0
|
|
|
0
|
1
|
|
my ($thing, $action) = @_; |
|
350
|
|
|
|
|
|
|
|
|
351
|
0
|
|
|
|
|
|
my $user = Goo::Environment::get_user(); |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
# grab the filename |
|
354
|
0
|
0
|
|
|
|
|
my $filename = |
|
355
|
|
|
|
|
|
|
$thing->isa("Goo::FileThing") |
|
356
|
|
|
|
|
|
|
? $thing->get_full_path() |
|
357
|
|
|
|
|
|
|
: $thing->get_filename(); |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
# connect to the local SQLite DB |
|
360
|
0
|
|
|
|
|
|
Goo::LiteDatabase::execute_sql(<<EOSQL); |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
insert into gootrail(action, thing, who, actiontime) |
|
363
|
|
|
|
|
|
|
values ("$action", "$filename", "$user", datetime('now')) |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
EOSQL |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
} |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
1; |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
__END__ |
|
373
|
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
=head1 NAME |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
Goo::TrailManager - Manage a Trail of Goo Actions - Memex style. |
|
377
|
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
379
|
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
use Goo::TrailManager; |
|
381
|
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
=head1 METHODS |
|
387
|
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
=over |
|
389
|
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
=item 7 |
|
391
|
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
keep the buffer small (thanks to Miller's rule - 7 plus or minus 2) |
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
=item get_max_actionid |
|
395
|
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
return the id of the last action in the goo_trail |
|
397
|
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
=item get_thing |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
return the Thing that was the target of actionid |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
=item go_back_one |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
return the Thing that was the target of the previous action |
|
405
|
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
=item go_forward_one |
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
return the Thing that was the target of the next action |
|
409
|
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
=item reset_last_action |
|
411
|
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
set the actionid of the last action to max_actionid |
|
413
|
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
=item find_context |
|
415
|
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
find the most recent goo context for the current thing |
|
417
|
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
=item get_context |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
display the most recent goo context for the current thing |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
=item create_database |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
save the commands for creating the database |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
=item get_previous_thing |
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
return the previous action from the goo_trail |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
=item get_latest_actions |
|
431
|
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
return the most recent actions that have happened |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
=item save_goo_action |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
save a step in the goo_trail |
|
437
|
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=back |
|
440
|
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
=head1 AUTHOR |
|
442
|
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
Nigel Hamilton <nigel@trexy.com> |
|
444
|
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
446
|
|
|
|
|
|
|
|