diff --git a/app/Controller/Config.php b/app/Controller/Config.php index bb6e860a9..3c884191d 100644 --- a/app/Controller/Config.php +++ b/app/Controller/Config.php @@ -44,7 +44,7 @@ class Config extends Base $values += array('subtask_restriction' => 0, 'subtask_time_tracking' => 0, 'subtask_forecast' => 0); } else if ($redirect === 'integrations') { - $values += array('integration_slack_webhook' => 0, 'integration_hipchat' => 0); + $values += array('integration_slack_webhook' => 0, 'integration_hipchat' => 0, 'integration_gravatar' => 0); } if ($this->config->save($values)) { diff --git a/app/Core/Helper.php b/app/Core/Helper.php index 013bf0f28..290034166 100644 --- a/app/Core/Helper.php +++ b/app/Core/Helper.php @@ -770,4 +770,21 @@ class Helper return 'fa-file-o'; } + + /** + * Display gravatar image + * + * @access public + * @param string $email + * @param string $alt + * @return string + */ + public function avatar($email, $alt = '') + { + if (! empty($email) && $this->config->get('integration_gravatar') == 1) { + return ''.$this->e($alt).''; + } + + return ''; + } } diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index d389b0e17..ac21f387a 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -834,4 +834,5 @@ return array( 'Room API ID or name' => 'Nom ou identifiant du salon de discussion', 'Room notification token' => 'Jeton de sécurité du salon de discussion', 'Help on Hipchat integration' => 'Aide sur l\'intégration avec Hipchat', + 'Enable Gravatar images' => 'Activer les images Gravatar', ); diff --git a/app/Model/Comment.php b/app/Model/Comment.php index a36f2b458..844f0c89c 100644 --- a/app/Model/Comment.php +++ b/app/Model/Comment.php @@ -47,7 +47,8 @@ class Comment extends Base self::TABLE.'.user_id', self::TABLE.'.comment', User::TABLE.'.username', - User::TABLE.'.name' + User::TABLE.'.name', + User::TABLE.'.email' ) ->join(User::TABLE, 'id', 'user_id') ->orderBy(self::TABLE.'.date', 'ASC') diff --git a/app/Model/ProjectActivity.php b/app/Model/ProjectActivity.php index c5fbbd38a..ae593da86 100644 --- a/app/Model/ProjectActivity.php +++ b/app/Model/ProjectActivity.php @@ -85,18 +85,19 @@ class ProjectActivity extends Base ->columns( self::TABLE.'.*', User::TABLE.'.username AS author_username', - User::TABLE.'.name AS author_name' + User::TABLE.'.name AS author_name', + User::TABLE.'.email' ) ->in('project_id', $project_ids) ->join(User::TABLE, 'id', 'creator_id') ->desc(self::TABLE.'.id') ->limit($limit); - if(!is_null($start)){ + if (!is_null($start)){ $query->gte('date_creation', $start); } - if(!is_null($end)){ + if (!is_null($end)){ $query->lte('date_creation', $end); } diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index f0e0d6b2b..4ea7b0410 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -6,7 +6,13 @@ use PDO; use Core\Security; use Model\Link; -const VERSION = 59; +const VERSION = 60; + +function version_60($pdo) +{ + $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); + $rq->execute(array('integration_gravatar', '0')); +} function version_59($pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index f7a0453da..93d8e869d 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -8,6 +8,12 @@ use Model\Link; const VERSION = 40; +function version_41($pdo) +{ + $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); + $rq->execute(array('integration_gravatar', '0')); +} + function version_40($pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index 3ad045e6f..3683acb65 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -6,7 +6,13 @@ use Core\Security; use PDO; use Model\Link; -const VERSION = 58; +const VERSION = 59; + +function version_59($pdo) +{ + $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); + $rq->execute(array('integration_gravatar', '0')); +} function version_58($pdo) { diff --git a/app/Template/comment/show.php b/app/Template/comment/show.php index 23389c060..98c29441b 100644 --- a/app/Template/comment/show.php +++ b/app/Template/comment/show.php @@ -1,9 +1,11 @@

+ + avatar($comment['email'], $comment['name'] ?: $comment['username']) ?> + e($comment['name'] ?: $comment['username']) ?> @

-
diff --git a/app/Template/config/integrations.php b/app/Template/config/integrations.php index 6f90e0ab4..e11b62f87 100644 --- a/app/Template/config/integrations.php +++ b/app/Template/config/integrations.php @@ -6,6 +6,11 @@ formCsrf() ?> +

+
+ formCheckbox('integration_gravatar', t('Enable Gravatar images'), 1, $values['integration_gravatar'] == 1) ?> +
+

formCheckbox('integration_hipchat', t('Send notifications to Hipchat'), 1, $values['integration_hipchat'] == 1) ?> diff --git a/app/Template/event/comment_create.php b/app/Template/event/comment_create.php index fd046fd11..79238aba4 100644 --- a/app/Template/event/comment_create.php +++ b/app/Template/event/comment_create.php @@ -1,3 +1,5 @@ +avatar($email, $author) ?> +

e($author), diff --git a/app/Template/event/comment_update.php b/app/Template/event/comment_update.php index 7149bacf9..5d22a2ce3 100644 --- a/app/Template/event/comment_update.php +++ b/app/Template/event/comment_update.php @@ -1,3 +1,5 @@ +avatar($email, $author) ?> +

e($author), diff --git a/app/Template/event/subtask_create.php b/app/Template/event/subtask_create.php index 1cc7585c1..4f33069a0 100644 --- a/app/Template/event/subtask_create.php +++ b/app/Template/event/subtask_create.php @@ -1,3 +1,5 @@ +avatar($email, $author) ?> +

e($author), diff --git a/app/Template/event/subtask_update.php b/app/Template/event/subtask_update.php index be06f7f50..19fe2e56f 100644 --- a/app/Template/event/subtask_update.php +++ b/app/Template/event/subtask_update.php @@ -1,3 +1,5 @@ +avatar($email, $author) ?> +

e($author), diff --git a/app/Template/event/task_assignee_change.php b/app/Template/event/task_assignee_change.php index 22ed936b3..38e2bca71 100644 --- a/app/Template/event/task_assignee_change.php +++ b/app/Template/event/task_assignee_change.php @@ -1,3 +1,5 @@ +avatar($email, $author) ?> +

diff --git a/app/Template/event/task_close.php b/app/Template/event/task_close.php index b5ad4d1d4..afedbef36 100644 --- a/app/Template/event/task_close.php +++ b/app/Template/event/task_close.php @@ -1,3 +1,5 @@ +avatar($email, $author) ?> +

e($author), diff --git a/app/Template/event/task_create.php b/app/Template/event/task_create.php index de9a7e0db..4b9202347 100644 --- a/app/Template/event/task_create.php +++ b/app/Template/event/task_create.php @@ -1,3 +1,5 @@ +avatar($email, $author) ?> +

e($author), diff --git a/app/Template/event/task_move_column.php b/app/Template/event/task_move_column.php index e56e92d7d..e97a3ab72 100644 --- a/app/Template/event/task_move_column.php +++ b/app/Template/event/task_move_column.php @@ -1,3 +1,5 @@ +avatar($email, $author) ?> +

e($author), diff --git a/app/Template/event/task_move_position.php b/app/Template/event/task_move_position.php index 412a94016..2ed4ffe80 100644 --- a/app/Template/event/task_move_position.php +++ b/app/Template/event/task_move_position.php @@ -1,3 +1,5 @@ +avatar($email, $author) ?> +

e($author), diff --git a/app/Template/event/task_open.php b/app/Template/event/task_open.php index 353f8dac1..9a4084499 100644 --- a/app/Template/event/task_open.php +++ b/app/Template/event/task_open.php @@ -1,3 +1,5 @@ +avatar($email, $author) ?> +

e($author), diff --git a/app/Template/event/task_update.php b/app/Template/event/task_update.php index 24b174463..0f81870b2 100644 --- a/app/Template/event/task_update.php +++ b/app/Template/event/task_update.php @@ -1,3 +1,5 @@ +avatar($email, $author) ?> +

e($author), diff --git a/assets/css/app.css b/assets/css/app.css index 79d61c6bb..e3797b1d1 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -62,7 +62,11 @@ hr { .chosen-select { min-height: 27px; /* Reserve some space to avoid re-layout due to chosen */ } -/* links */ + +.avatar { + float: left; + margin-right: 10px; +}/* links */ a { color: #3366CC; border: none; diff --git a/assets/css/src/base.css b/assets/css/src/base.css index d92df6128..10a3ee8e8 100644 --- a/assets/css/src/base.css +++ b/assets/css/src/base.css @@ -46,3 +46,8 @@ hr { .chosen-select { min-height: 27px; /* Reserve some space to avoid re-layout due to chosen */ } + +.avatar { + float: left; + margin-right: 10px; +} \ No newline at end of file