From 09da289c2fb18475f372bee24e885617da484e0b Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 17 Oct 2015 22:19:49 -0400 Subject: Move slack, hipchat and jabber integrations to plugins --- app/Template/config/integrations.php | 54 ------------------------- app/Template/project/integrations.php | 74 +--------------------------------- app/Template/project/notifications.php | 20 +++++++++ app/Template/project/sidebar.php | 7 +++- app/Template/user/integrations.php | 13 ++++++ app/Template/user/sidebar.php | 3 ++ 6 files changed, 43 insertions(+), 128 deletions(-) create mode 100644 app/Template/project/notifications.php create mode 100644 app/Template/user/integrations.php (limited to 'app/Template') 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 @@ form->checkbox('integration_gravatar', t('Enable Gravatar images'), 1, $values['integration_gravatar'] == 1) ?> -

-
- form->checkbox('integration_jabber', t('Send notifications to Jabber'), 1, $values['integration_jabber'] == 1) ?> - - form->label(t('XMPP server address'), 'integration_jabber_server') ?> - form->text('integration_jabber_server', $values, $errors, array('placeholder="tcp://myserver:5222"')) ?> -

- - form->label(t('Jabber domain'), 'integration_jabber_domain') ?> - form->text('integration_jabber_domain', $values, $errors, array('placeholder="example.com"')) ?> - - form->label(t('Username'), 'integration_jabber_username') ?> - form->text('integration_jabber_username', $values, $errors) ?> - - form->label(t('Password'), 'integration_jabber_password') ?> - form->password('integration_jabber_password', $values, $errors) ?> - - form->label(t('Jabber nickname'), 'integration_jabber_nickname') ?> - form->text('integration_jabber_nickname', $values, $errors) ?> - - form->label(t('Multi-user chat room'), 'integration_jabber_room') ?> - form->text('integration_jabber_room', $values, $errors, array('placeholder="myroom@conference.example.com"')) ?> - -

url->doc(t('Help on Jabber integration'), 'jabber') ?>

-
- -

-
- form->checkbox('integration_hipchat', t('Send notifications to Hipchat'), 1, $values['integration_hipchat'] == 1) ?> - - form->label(t('API URL'), 'integration_hipchat_api_url') ?> - form->text('integration_hipchat_api_url', $values, $errors) ?> - - form->label(t('Room API ID or name'), 'integration_hipchat_room_id') ?> - form->text('integration_hipchat_room_id', $values, $errors) ?> - - form->label(t('Room notification token'), 'integration_hipchat_room_token') ?> - form->text('integration_hipchat_room_token', $values, $errors) ?> - -

url->doc(t('Help on Hipchat integration'), 'hipchat') ?>

-
- -

 

-
- form->checkbox('integration_slack_webhook', t('Send notifications to a Slack channel'), 1, $values['integration_slack_webhook'] == 1) ?> - - form->label(t('Webhook URL'), 'integration_slack_webhook_url') ?> - form->text('integration_slack_webhook_url', $values, $errors) ?> - form->label(t('Channel/Group/User (Optional)'), 'integration_slack_webhook_channel') ?> - form->text('integration_slack_webhook_channel', $values, $errors) ?> - -

url->doc(t('Help on Slack integration'), 'slack') ?>

-
-
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 @@

-
+ form->csrf() ?> + hook->render('template:project:integrations', array('values' => $values)) ?>

 

@@ -12,86 +13,15 @@

url->doc(t('Help on Github webhooks'), 'github-webhooks') ?>

-

 


url->doc(t('Help on Gitlab webhooks'), 'gitlab-webhooks') ?>

-

 


url->doc(t('Help on Bitbucket webhooks'), 'bitbucket-webhooks') ?>

- - -

-
- form->checkbox('jabber', t('Send notifications to Jabber'), 1, isset($values['jabber']) && $values['jabber'] == 1) ?> - - form->label(t('XMPP server address'), 'jabber_server') ?> - form->text('jabber_server', $values, $errors, array('placeholder="tcp://myserver:5222"')) ?> -

- - form->label(t('Jabber domain'), 'jabber_domain') ?> - form->text('jabber_domain', $values, $errors, array('placeholder="example.com"')) ?> - - form->label(t('Username'), 'jabber_username') ?> - form->text('jabber_username', $values, $errors) ?> - - form->label(t('Password'), 'jabber_password') ?> - form->password('jabber_password', $values, $errors) ?> - - form->label(t('Jabber nickname'), 'jabber_nickname') ?> - form->text('jabber_nickname', $values, $errors) ?> - - form->label(t('Multi-user chat room'), 'jabber_room') ?> - form->text('jabber_room', $values, $errors, array('placeholder="myroom@conference.example.com"')) ?> - -

url->doc(t('Help on Jabber integration'), 'jabber') ?>

- -
- -
-
- - -

-
- form->checkbox('hipchat', t('Send notifications to Hipchat'), 1, isset($values['hipchat']) && $values['hipchat'] == 1) ?> - - form->label(t('API URL'), 'hipchat_api_url') ?> - form->text('hipchat_api_url', $values, $errors) ?> - - form->label(t('Room API ID or name'), 'hipchat_room_id') ?> - form->text('hipchat_room_id', $values, $errors) ?> - - form->label(t('Room notification token'), 'hipchat_room_token') ?> - form->text('hipchat_room_token', $values, $errors) ?> - -

url->doc(t('Help on Hipchat integration'), 'hipchat') ?>

- -
- -
-
- - -

 

-
- form->checkbox('slack', t('Send notifications to a Slack channel'), 1, isset($values['slack']) && $values['slack'] == 1) ?> - - form->label(t('Webhook URL'), 'slack_webhook_url') ?> - form->text('slack_webhook_url', $values, $errors) ?> - form->label(t('Channel/Group/User (Optional)'), 'slack_webhook_channel') ?> - form->text('slack_webhook_channel', $values, $errors) ?> - -

url->doc(t('Help on Slack integration'), 'slack') ?>

- -
- -
-
\ 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 @@ + + +

+ +
+ + form->csrf() ?> + +

+ form->checkboxes('notification_types', $types, $notifications) ?> + +
+ + + url->link(t('cancel'), 'project', 'show', array('project_id' => $project['id'])) ?> +
+
+ \ 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 @@
  • app->getRouterController() === 'project' && $this->app->getRouterAction() === 'share' ? 'class="active"' : '' ?>> url->link(t('Public access'), 'project', 'share', array('project_id' => $project['id'])) ?>
  • -
  • app->getRouterController() === 'project' && $this->app->getRouterAction() === 'integration' ? 'class="active"' : '' ?>> - url->link(t('Integrations'), 'project', 'integration', array('project_id' => $project['id'])) ?> +
  • app->getRouterController() === 'project' && $this->app->getRouterAction() === 'notifications' ? 'class="active"' : '' ?>> + url->link(t('Notifications'), 'project', 'notifications', array('project_id' => $project['id'])) ?> +
  • +
  • app->getRouterController() === 'project' && $this->app->getRouterAction() === 'integrations' ? 'class="active"' : '' ?>> + url->link(t('Integrations'), 'project', 'integrations', array('project_id' => $project['id'])) ?>
  • app->getRouterController() === 'project' && $this->app->getRouterAction() === 'edit' ? 'class="active"' : '' ?>> 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 @@ + + +
    + form->csrf() ?> + hook->render('template:user:integrations', array('values' => $values)) ?> + + + +

    + +
    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 @@
  • app->getRouterController() === 'user' && $this->app->getRouterAction() === 'external' ? 'class="active"' : '' ?>> url->link(t('External accounts'), 'user', 'external', array('user_id' => $user['id'])) ?>
  • +
  • app->getRouterController() === 'user' && $this->app->getRouterAction() === 'integrations' ? 'class="active"' : '' ?>> + url->link(t('Integrations'), 'user', 'integrations', array('user_id' => $user['id'])) ?> +
  • user->isAdmin()): ?> -- cgit v1.2.3