Add an option to specify a webhook URL for updates in the downloads section

and tweak the help texts for the original source web hook a bit. Also remove
the superfluous inline help code from the SourceConf form that was actually
not used.

This feature was sponsored by Scilab.
This commit is contained in:
Thomas Keller
2011-09-25 02:03:35 +02:00
parent dc50e9b316
commit b29acd71cb
7 changed files with 63 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
{extends "idf/admin/base.html"}
{block docclass}yui-t1{assign $inDownloads = true}{/block}
{block docclass}yui-t3{assign $inDownloads = true}{/block}
{block body}
<form method="post" action=".">
<table class="form" summary="">
@@ -16,6 +16,15 @@
</td>
</tr>
<tr>
<td>{$form.f.upload_webhook_url.labelTag}:<br />
{if $form.f.upload_webhook_url.errors}{$form.f.upload_webhook_url.fieldErrors}{/if}
{$form.f.upload_webhook_url|unsafe}<br>
</td>
</tr>
<tr>
<td>{trans 'Web-Hook authentication key:'} {$hookkey}</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="{trans 'Save Changes'}" name="submit" />
</td>
@@ -31,4 +40,29 @@
<p>Optionally, use an equals-sign to document the meaning of each status value.</p>
{/blocktrans}
</div>
<div class="issue-submit-info">
{blocktrans}<p>The webhook URL setting specifies an URL to which a HTTP <strong>PUT</strong>
request is sent after a new download has been added or to which a HTTP <strong>POST</strong>
request is sent after an existing download has been updated.
If this field is empty, notifications are disabled.</p>
<p>Only properly-escaped <strong>HTTP</strong> URLs are supported, for example:</p>
<ul>
<li><code>http://domain.com/upload</code></li>
<li><code>http://domain.com/upload?my%20param</code></li>
</ul>
<p>In addition, the URL may contain the following "%" notation, which
will be replaced with specific project values for each download:</p>
<ul>
<li><code>%p</code> - project name</li>
<li><code>%d</code> - download id</li>
</ul>
<p>For example, updating download 123 of project 'my-project' with
web hook URL <code>http://mydomain.com/%p/%d</code> would send a POST request to
<code>http://mydomain.com/my-project/123</code>.</p>{/blocktrans}</div>
{/block}