]> gitweb.factorcode.org Git - factor.git/blob - extra/webapps/site-watcher/watching/watching.factor
core, basis, extra: Remove DOS line endings from files.
[factor.git] / extra / webapps / site-watcher / watching / watching.factor
1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors furnace.actions furnace.auth
4 furnace.redirection html.forms site-watcher site-watcher.db
5 validators webapps.site-watcher.common urls ;
6 IN: webapps.site-watcher.watching
7
8 CONSTANT: site-list-url URL" $site-watcher-app/watch-list"
9
10 : <watch-list-action> ( -- action )
11     <page-action>
12         { site-watcher-app "site-list" } >>template
13         [
14             ! Silly query
15             username watching-sites
16             "sites" set-value
17         ] >>init
18     <protected>
19         "list watched sites" >>description ;
20
21 : <add-watched-site-action> ( -- action )
22     <action>
23         [
24             { { "url" [ v-url ] } } validate-params
25         ] >>validate
26         [
27             username "url" value watch-site
28             site-list-url <redirect>
29         ] >>submit
30     <protected>
31         "add a watched site" >>description ;
32
33 : <remove-watched-site-action> ( -- action )
34     <action>
35         [
36             { { "url" [ v-url ] } } validate-params
37         ] >>validate
38         [
39             username "url" value unwatch-site
40             site-list-url <redirect>
41         ] >>submit
42     <protected>
43         "remove a watched site" >>description ;
44
45 : <check-sites-action> ( -- action )
46     <action>
47         [
48             watch-sites
49             site-list-url <redirect>
50         ] >>submit
51     <protected>
52         "check watched sites" >>description ;