summaryrefslogtreecommitdiff
path: root/app/Template
diff options
context:
space:
mode:
Diffstat (limited to 'app/Template')
-rw-r--r--app/Template/config/integrations.php54
-rw-r--r--app/Template/project/integrations.php74
-rw-r--r--app/Template/project/notifications.php20
-rw-r--r--app/Template/project/sidebar.php7
-rw-r--r--app/Template/user/integrations.php13
-rw-r--r--app/Template/user/sidebar.php3
6 files changed, 43 insertions, 128 deletions
diff --git a/app/Template/config/integrations.php b/app/Template/config/integrations.php
index b454fa86..bba85672 100644
--- a/app/Template/config/integrations.php
+++ b/app/Template/config/integrations.php
@@ -31,60 +31,6 @@
<?= $this->form->checkbox('integration_gravatar', t('Enable Gravatar images'), 1, $values['integration_gravatar'] == 1) ?>
</div>
- <h3><img src="<?= $this->url->dir() ?>assets/img/jabber-icon.png"/> <?= t('Jabber (XMPP)') ?></h3>
- <div class="listing">
- <?= $this->form->checkbox('integration_jabber', t('Send notifications to Jabber'), 1, $values['integration_jabber'] == 1) ?>
-
- <?= $this->form->label(t('XMPP server address'), 'integration_jabber_server') ?>
- <?= $this->form->text('integration_jabber_server', $values, $errors, array('placeholder="tcp://myserver:5222"')) ?>
- <p class="form-help"><?= t('The server address must use this format: "tcp://hostname:5222"') ?></p>
-
- <?= $this->form->label(t('Jabber domain'), 'integration_jabber_domain') ?>
- <?= $this->form->text('integration_jabber_domain', $values, $errors, array('placeholder="example.com"')) ?>
-
- <?= $this->form->label(t('Username'), 'integration_jabber_username') ?>
- <?= $this->form->text('integration_jabber_username', $values, $errors) ?>
-
- <?= $this->form->label(t('Password'), 'integration_jabber_password') ?>
- <?= $this->form->password('integration_jabber_password', $values, $errors) ?>
-
- <?= $this->form->label(t('Jabber nickname'), 'integration_jabber_nickname') ?>
- <?= $this->form->text('integration_jabber_nickname', $values, $errors) ?>
-
- <?= $this->form->label(t('Multi-user chat room'), 'integration_jabber_room') ?>
- <?= $this->form->text('integration_jabber_room', $values, $errors, array('placeholder="myroom@conference.example.com"')) ?>
-
- <p class="form-help"><?= $this->url->doc(t('Help on Jabber integration'), 'jabber') ?></p>
- </div>
-
- <h3><img src="<?= $this->url->dir() ?>assets/img/hipchat-icon.png"/> <?= t('Hipchat') ?></h3>
- <div class="listing">
- <?= $this->form->checkbox('integration_hipchat', t('Send notifications to Hipchat'), 1, $values['integration_hipchat'] == 1) ?>
-
- <?= $this->form->label(t('API URL'), 'integration_hipchat_api_url') ?>
- <?= $this->form->text('integration_hipchat_api_url', $values, $errors) ?>
-
- <?= $this->form->label(t('Room API ID or name'), 'integration_hipchat_room_id') ?>
- <?= $this->form->text('integration_hipchat_room_id', $values, $errors) ?>
-
- <?= $this->form->label(t('Room notification token'), 'integration_hipchat_room_token') ?>
- <?= $this->form->text('integration_hipchat_room_token', $values, $errors) ?>
-
- <p class="form-help"><?= $this->url->doc(t('Help on Hipchat integration'), 'hipchat') ?></p>
- </div>
-
- <h3><i class="fa fa-slack fa-fw"></i>&nbsp;<?= t('Slack') ?></h3>
- <div class="listing">
- <?= $this->form->checkbox('integration_slack_webhook', t('Send notifications to a Slack channel'), 1, $values['integration_slack_webhook'] == 1) ?>
-
- <?= $this->form->label(t('Webhook URL'), 'integration_slack_webhook_url') ?>
- <?= $this->form->text('integration_slack_webhook_url', $values, $errors) ?>
- <?= $this->form->label(t('Channel/Group/User (Optional)'), 'integration_slack_webhook_channel') ?>
- <?= $this->form->text('integration_slack_webhook_channel', $values, $errors) ?>
-
- <p class="form-help"><?= $this->url->doc(t('Help on Slack integration'), 'slack') ?></p>
- </div>
-
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
</div>
diff --git a/app/Template/project/integrations.php b/app/Template/project/integrations.php
index eb5faddf..c4d9385b 100644
--- a/app/Template/project/integrations.php
+++ b/app/Template/project/integrations.php
@@ -2,9 +2,10 @@
<h2><?= t('Integration with third-party services') ?></h2>
</div>
-<form method="post" action="<?= $this->url->href('project', 'integration', array('project_id' => $project['id'])) ?>" autocomplete="off">
+<form method="post" action="<?= $this->url->href('project', 'integrations', array('project_id' => $project['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
+ <?= $this->hook->render('template:project:integrations', array('values' => $values)) ?>
<h3><i class="fa fa-github fa-fw"></i>&nbsp;<?= t('Github webhooks') ?></h3>
<div class="listing">
@@ -12,86 +13,15 @@
<p class="form-help"><?= $this->url->doc(t('Help on Github webhooks'), 'github-webhooks') ?></p>
</div>
-
<h3><img src="<?= $this->url->dir() ?>assets/img/gitlab-icon.png"/>&nbsp;<?= t('Gitlab webhooks') ?></h3>
<div class="listing">
<input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->href('webhook', 'gitlab', array('token' => $webhook_token, 'project_id' => $project['id']), false, '', true) ?>"/><br/>
<p class="form-help"><?= $this->url->doc(t('Help on Gitlab webhooks'), 'gitlab-webhooks') ?></p>
</div>
-
<h3><i class="fa fa-bitbucket fa-fw"></i>&nbsp;<?= t('Bitbucket webhooks') ?></h3>
<div class="listing">
<input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->href('webhook', 'bitbucket', array('token' => $webhook_token, 'project_id' => $project['id']), false, '', true) ?>"/><br/>
<p class="form-help"><?= $this->url->doc(t('Help on Bitbucket webhooks'), 'bitbucket-webhooks') ?></p>
</div>
-
-
- <h3><img src="<?= $this->url->dir() ?>assets/img/jabber-icon.png"/> <?= t('Jabber (XMPP)') ?></h3>
- <div class="listing">
- <?= $this->form->checkbox('jabber', t('Send notifications to Jabber'), 1, isset($values['jabber']) && $values['jabber'] == 1) ?>
-
- <?= $this->form->label(t('XMPP server address'), 'jabber_server') ?>
- <?= $this->form->text('jabber_server', $values, $errors, array('placeholder="tcp://myserver:5222"')) ?>
- <p class="form-help"><?= t('The server address must use this format: "tcp://hostname:5222"') ?></p>
-
- <?= $this->form->label(t('Jabber domain'), 'jabber_domain') ?>
- <?= $this->form->text('jabber_domain', $values, $errors, array('placeholder="example.com"')) ?>
-
- <?= $this->form->label(t('Username'), 'jabber_username') ?>
- <?= $this->form->text('jabber_username', $values, $errors) ?>
-
- <?= $this->form->label(t('Password'), 'jabber_password') ?>
- <?= $this->form->password('jabber_password', $values, $errors) ?>
-
- <?= $this->form->label(t('Jabber nickname'), 'jabber_nickname') ?>
- <?= $this->form->text('jabber_nickname', $values, $errors) ?>
-
- <?= $this->form->label(t('Multi-user chat room'), 'jabber_room') ?>
- <?= $this->form->text('jabber_room', $values, $errors, array('placeholder="myroom@conference.example.com"')) ?>
-
- <p class="form-help"><?= $this->url->doc(t('Help on Jabber integration'), 'jabber') ?></p>
-
- <div class="form-actions">
- <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
- </div>
- </div>
-
-
- <h3><img src="<?= $this->url->dir() ?>assets/img/hipchat-icon.png"/> <?= t('Hipchat') ?></h3>
- <div class="listing">
- <?= $this->form->checkbox('hipchat', t('Send notifications to Hipchat'), 1, isset($values['hipchat']) && $values['hipchat'] == 1) ?>
-
- <?= $this->form->label(t('API URL'), 'hipchat_api_url') ?>
- <?= $this->form->text('hipchat_api_url', $values, $errors) ?>
-
- <?= $this->form->label(t('Room API ID or name'), 'hipchat_room_id') ?>
- <?= $this->form->text('hipchat_room_id', $values, $errors) ?>
-
- <?= $this->form->label(t('Room notification token'), 'hipchat_room_token') ?>
- <?= $this->form->text('hipchat_room_token', $values, $errors) ?>
-
- <p class="form-help"><?= $this->url->doc(t('Help on Hipchat integration'), 'hipchat') ?></a></p>
-
- <div class="form-actions">
- <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
- </div>
- </div>
-
-
- <h3><i class="fa fa-slack fa-fw"></i>&nbsp;<?= t('Slack') ?></h3>
- <div class="listing">
- <?= $this->form->checkbox('slack', t('Send notifications to a Slack channel'), 1, isset($values['slack']) && $values['slack'] == 1) ?>
-
- <?= $this->form->label(t('Webhook URL'), 'slack_webhook_url') ?>
- <?= $this->form->text('slack_webhook_url', $values, $errors) ?>
- <?= $this->form->label(t('Channel/Group/User (Optional)'), 'slack_webhook_channel') ?>
- <?= $this->form->text('slack_webhook_channel', $values, $errors) ?>
-
- <p class="form-help"><?= $this->url->doc(t('Help on Slack integration'), 'slack') ?></p>
-
- <div class="form-actions">
- <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
- </div>
- </div>
</form> \ No newline at end of file
diff --git a/app/Template/project/notifications.php b/app/Template/project/notifications.php
new file mode 100644
index 00000000..ac743087
--- /dev/null
+++ b/app/Template/project/notifications.php
@@ -0,0 +1,20 @@
+<div class="page-header">
+ <h2><?= t('Notifications') ?></h2>
+</div>
+<?php if (empty($types)): ?>
+ <p class="alert"><?= t('There is no notification method registered.') ?></p>
+<?php else: ?>
+ <form method="post" action="<?= $this->url->href('project', 'notifications', array('project_id' => $project['id'])) ?>" autocomplete="off">
+
+ <?= $this->form->csrf() ?>
+
+ <h4><?= t('Notification methods:') ?></h4>
+ <?= $this->form->checkboxes('notification_types', $types, $notifications) ?>
+
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
+ <?= t('or') ?>
+ <?= $this->url->link(t('cancel'), 'project', 'show', array('project_id' => $project['id'])) ?>
+ </div>
+ </form>
+<?php endif ?> \ No newline at end of file
diff --git a/app/Template/project/sidebar.php b/app/Template/project/sidebar.php
index 971ed950..fb5dd3bd 100644
--- a/app/Template/project/sidebar.php
+++ b/app/Template/project/sidebar.php
@@ -12,8 +12,11 @@
<li <?= $this->app->getRouterController() === 'project' && $this->app->getRouterAction() === 'share' ? 'class="active"' : '' ?>>
<?= $this->url->link(t('Public access'), 'project', 'share', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'project' && $this->app->getRouterAction() === 'integration' ? 'class="active"' : '' ?>>
- <?= $this->url->link(t('Integrations'), 'project', 'integration', array('project_id' => $project['id'])) ?>
+ <li <?= $this->app->getRouterController() === 'project' && $this->app->getRouterAction() === 'notifications' ? 'class="active"' : '' ?>>
+ <?= $this->url->link(t('Notifications'), 'project', 'notifications', array('project_id' => $project['id'])) ?>
+ </li>
+ <li <?= $this->app->getRouterController() === 'project' && $this->app->getRouterAction() === 'integrations' ? 'class="active"' : '' ?>>
+ <?= $this->url->link(t('Integrations'), 'project', 'integrations', array('project_id' => $project['id'])) ?>
</li>
<li <?= $this->app->getRouterController() === 'project' && $this->app->getRouterAction() === 'edit' ? 'class="active"' : '' ?>>
<?= $this->url->link(t('Edit project'), 'project', 'edit', array('project_id' => $project['id'])) ?>
diff --git a/app/Template/user/integrations.php b/app/Template/user/integrations.php
new file mode 100644
index 00000000..ef9d8e71
--- /dev/null
+++ b/app/Template/user/integrations.php
@@ -0,0 +1,13 @@
+<div class="page-header">
+ <h2><?= t('Integrations') ?></h2>
+</div>
+
+<form method="post" action="<?= $this->url->href('user', 'integrations', array('user_id' => $user['id'])) ?>" autocomplete="off">
+ <?= $this->form->csrf() ?>
+ <?php $hooks = $this->hook->render('template:user:integrations', array('values' => $values)) ?>
+ <?php if (! empty($hooks)): ?>
+ <?= $hooks ?>
+ <?php else: ?>
+ <p class="alert"><?= t('No external integration registered.') ?></p>
+ <?php endif ?>
+</form>
diff --git a/app/Template/user/sidebar.php b/app/Template/user/sidebar.php
index ca1e0621..167c8054 100644
--- a/app/Template/user/sidebar.php
+++ b/app/Template/user/sidebar.php
@@ -56,6 +56,9 @@
<li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'external' ? 'class="active"' : '' ?>>
<?= $this->url->link(t('External accounts'), 'user', 'external', array('user_id' => $user['id'])) ?>
</li>
+ <li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'integrations' ? 'class="active"' : '' ?>>
+ <?= $this->url->link(t('Integrations'), 'user', 'integrations', array('user_id' => $user['id'])) ?>
+ </li>
<?php endif ?>
<?php if ($this->user->isAdmin()): ?>