2 # (c) Zachary T Welch <zw@superlucidity.net>
8 use lib
qw(/home/repo/repomgr/cgi);
11 my $repo = Git
::RepoCGI
->new('Manage Watchdogs');
12 my $project = $repo->sparam('project');
13 my $branch = $repo->sparam('branch');
14 my $path = $repo->sparam('path');
15 my $user = $repo->sparam('user');
17 # check for submission
18 $repo->bye('Not yet implemented') if $repo->sparam('go');
20 # check for mutually exclusive parameters
21 $repo->bye("You may view either a project or a user, not both.")
24 # obtain minimal parameters
25 unless ($project or $user) {
28 To view watchdogs you must select a project or user.
31 <h3>View Project Watchdogs</h3>
33 <p>Project: <input type="text" name="project" /></p>
34 <p>Branch: <input type="text" name="branch" value="$branch" /></p>
35 <p>Path: <input type="text" name="path" value="$path" /></p>
36 <p><input type="submit" value="View" /></p>
39 <h3>View User Watchdogs</h3>
41 <p>Account: <input type="text" name="user" /></p>
42 <p><input type="submit" value="View" /></p>
48 # print on-line documentation
51 A watchdog set with empty branch and path fields will trigger for all
52 changes pushed to the repository. Regular expressions can be used in
53 these fields to restrict notifications to matching branch or tree paths.
56 When activity occurs in a project, users are sent notification when the
57 fields of one or more watchdog are triggered. These notification events
58 are aggregated for all projects and deliveried periodically via e-mail.
61 A single notification will be produced for each triggiering event, so
62 watchdogs using filter expressions that overlap do <em>not</em> generate
63 duplicate noticiations. All watchdog filters that match will be listed
64 as a source the of an activity's notification, so you can update your
65 settings to eliminate duplicate filters.
68 The number of filters on the system directly impacts the notification
69 period, so you should try to cull redundant filters from these lists.
73 # set up for display user or project specific parts of the page
74 my %for_user = ( title
=> 'Account', key
=> 'user', value
=> $user,
75 auth
=> 'User', no_dogs
=> "by $user",
76 url_args
=> "name=$user" );
77 my %for_proj = ( title
=> 'Project', key
=> 'project', value
=> $project,
78 auth
=> 'Admin', no_dogs
=> "to monitor $project",
79 url_args
=> "project=$project&branch=$branch&path=$path");
80 my ( %showing, %listing );
88 <h3>Contacting Watchers</h3>
90 If you have push access to a project, you can send messages to
91 registered watchers of a particular fork, branch, or path by clicking on
98 print "<h3>Watchdogs for $showing{title} $showing{value}</h3>\n";
100 my @dogs = Git
::RepoCGI
::load
(type
=> $showing{key
}, name
=> $showing{value
});
103 No watchdogs have been created $showing{no_dogs}. Do you want to
104 <a href="watchadd.cgi?$showing{url_args}">create one</a>?
106 $repo->bye($no_dogs);
113 <th>$listing{title}</th>
121 for my $dog ( @dogs ) {
122 my ( $u, $r, $b, $p ) = ( '', '', '', '' ); #TODO: @$dog;
123 my $key = "$u:$r:$b:$p";
124 my $url_value = $user ?
$r : $u;
125 my $url_args = $user ?
"project=$r.git&branch=$b&path=$p" : "name=$u";
126 my $url = "<a href=\"watchedit.cgi?$url_args\">$url_value</a>";
130 <td><input type="text" name="b" value="$b" /></td>
131 <td><input type="text" name="p" value="$p" /></td>
132 <td><a href="watchspam.cgi?project=$r&branch=$b&path=$p">contact</a>
133 <td><a href="watchdel.cgi?name=$u&project=$r&branch=$b&path=$p">delete</a>
140 <h3>$showing{auth} Authentication</h3>
141 <p>$showing{title}: <em>$showing{value}</em>
142 <input type="hidden" name="$showing{key}" value="$showing{value}" /></p>
143 <p>Password: <input type="password" name="cpwd" /></p>
144 <p><input type="submit" name="go" value="Watch" /></p>