Skip to content

Commit

Permalink
Fixes #17397: Timeline Feature
Browse files Browse the repository at this point in the history
This feature provides users with the ability to know what is going on by co-workers and customers. It provides a timeline view of actions with ability to jump to the affected issues for more details.

Conflicts:
	my_view_page.php
  • Loading branch information
vboctor committed Jun 10, 2014
2 parents 378804a + 17c0337 commit 939ffe3
Show file tree
Hide file tree
Showing 13 changed files with 716 additions and 3 deletions.
1 change: 1 addition & 0 deletions admin/schema.php
Expand Up @@ -737,5 +737,6 @@ function installer_db_now() {
$upgrade[189] = array( 'AlterColumnSQL', array( db_get_table( 'project_hierarchy' ), "inherit_parent L $t_notnull DEFAULT '0'" ) );
$upgrade[190] = array( 'UpdateFunction', "check_project_hierarchy", array() );
$upgrade[191] = array( 'CreateIndexSQL', array('idx_project_hierarchy', db_get_table( 'project_hierarchy' ),'child_id,parent_id',array('UNIQUE')));
$upgrade[192] = array( 'CreateIndexSQL', array('idx_bug_history_date_modified', db_get_table('bug_history'), 'date_modified' ) );

# Release marker: 1.3.0
62 changes: 62 additions & 0 deletions core/classes/IssueAssignedTimelineEvent.class.php
@@ -0,0 +1,62 @@
<?php
# MantisBT - A PHP based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* Timeline event class for assignment of issues.
* @copyright Copyright 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
* @package MantisBT
*/

/**
* Timeline event class for assignment of issues.
*
* @package MantisBT
* @subpackage classes
*/
class IssueAssignedTimelineEvent extends TimelineEvent {
private $issue_id;
private $handler_id;

public function __construct( $p_timestamp, $p_user_id, $p_issue_id, $p_handler_id ) {
parent::__construct( $p_timestamp, $p_user_id, $p_issue_id );

$this->issue_id = $p_issue_id;
$this->handler_id = $p_handler_id;
}

function skip() {
if( !access_has_bug_level( config_get( 'view_handler_threshold' ), $this->issue_id ) ) {
return true;
}

return false;
}

public function html() {
if( $this->user_id == $this->handler_id ) {
$t_string = sprintf( lang_get( 'timeline_issue_assigned_to_self' ), user_get_name( $this->user_id ), string_get_bug_view_link( $this->issue_id ) );
} else {
$t_string = sprintf( lang_get( 'timeline_issue_assigned' ), user_get_name( $this->user_id ), string_get_bug_view_link( $this->issue_id ), user_get_name( $this->handler_id ) );
}

$t_html = $this->html_start();
$t_html .= '<div class="action">' . $t_string . '</div>';
$t_html .= $this->html_end();

return $t_html;
}
}
46 changes: 46 additions & 0 deletions core/classes/IssueCreatedTimelineEvent.class.php
@@ -0,0 +1,46 @@
<?php
# MantisBT - A PHP based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* Timeline event class for creation of issues.
* @copyright Copyright 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
* @package MantisBT
*/

/**
* Timeline event class for creation of issues.
*
* @package MantisBT
* @subpackage classes
*/
class IssueCreatedTimelineEvent extends TimelineEvent {
private $issue_id;

public function __construct( $p_timestamp, $p_user_id, $p_issue_id ) {
parent::__construct( $p_timestamp, $p_user_id, $p_issue_id );

$this->issue_id = $p_issue_id;
}

public function html() {
$t_html = $this->html_start();
$t_html .= '<div class="action">' . sprintf( lang_get( 'timeline_issue_created' ), user_get_name( $this->user_id ), string_get_bug_view_link( $this->issue_id ) ) . '</div>';
$t_html .= $this->html_end();

return $t_html;
}
}
50 changes: 50 additions & 0 deletions core/classes/IssueMonitorTimelineEvent.class.php
@@ -0,0 +1,50 @@
<?php
# MantisBT - A PHP based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* Timeline event class for users monitoring issues.
* @copyright Copyright 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
* @package MantisBT
*/

/**
* Timeline event class for users monitoring issues.
*
* @package MantisBT
* @subpackage classes
*/
class IssueMonitorTimelineEvent extends TimelineEvent {
private $issue_id;
private $monitor;

public function __construct( $p_timestamp, $p_user_id, $p_issue_id, $p_monitor ) {
parent::__construct( $p_timestamp, $p_user_id, $p_issue_id );

$this->issue_id = $p_issue_id;
$this->monitor = $p_monitor;
}

public function html() {
$t_string = $this->monitor ? lang_get( 'timeline_issue_monitor' ) : lang_get( 'timeline_issue_unmonitor' );

$t_html = $this->html_start();
$t_html .= '<div class="action">' . sprintf( $t_string, user_get_name( $this->user_id ), string_get_bug_view_link( $this->issue_id ) ) . '</div>';
$t_html .= $this->html_end();

return $t_html;
}
}
60 changes: 60 additions & 0 deletions core/classes/IssueNoteCreatedTimelineEvent.class.php
@@ -0,0 +1,60 @@
<?php
# MantisBT - A PHP based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* Timeline event class for creation of issues.
* @copyright Copyright 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
* @package MantisBT
*/

/**
* Timeline event class for creation of issues.
*
* @package MantisBT
* @subpackage classes
*/
class IssueNoteCreatedTimelineEvent extends TimelineEvent {
private $issue_id;
private $issue_note_id;

public function __construct( $p_timestamp, $p_user_id, $p_issue_id, $p_issue_note_id ) {
parent::__construct( $p_timestamp, $p_user_id, $p_issue_id );

$this->issue_id = $p_issue_id;
$this->issue_note_id = $p_issue_note_id;
}

public function skip() {
if( !bugnote_exists( $this->issue_note_id ) ) {
return true;
}

if( !access_has_bugnote_level( VIEWER, $this->issue_note_id ) ) {
return true;
}

return false;
}

public function html() {
$t_html = $this->html_start();
$t_html .= '<div class="action">' . sprintf( lang_get( 'timeline_issue_note_created' ), user_get_name( $this->user_id ), string_get_bug_view_link( $this->issue_id ) ) . '</div>';
$t_html .= $this->html_end();

return $t_html;
}
}
63 changes: 63 additions & 0 deletions core/classes/IssueStatusChangeTimelineEvent.class.php
@@ -0,0 +1,63 @@
<?php
# MantisBT - A PHP based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* Timeline event class for status change of issues.
* @copyright Copyright 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
* @package MantisBT
*/

/**
* Timeline event class for status change of issues.
*
* @package MantisBT
* @subpackage classes
*/
class IssueStatusChangeTimelineEvent extends TimelineEvent {
private $issue_id;
private $old_status;
private $new_status;

public function __construct( $p_timestamp, $p_user_id, $p_issue_id, $p_old_status, $p_new_status ) {
parent::__construct( $p_timestamp, $p_user_id, $p_issue_id );

$this->issue_id = $p_issue_id;
$this->old_status = $p_old_status;
$this->new_status = $p_new_status;
}

public function html() {
$t_resolved = config_get( 'bug_resolved_status_threshold' );
$t_closed = config_get( 'bug_closed_status_threshold' );

if( $this->old_status < $t_closed && $this->new_status >= $t_closed ) {
$t_string = sprintf( lang_get( 'timeline_issue_closed' ), user_get_name( $this->user_id ), string_get_bug_view_link( $this->issue_id ) );
} else if( $this->old_status < $t_resolved && $this->new_status >= $t_resolved ) {
$t_string = sprintf( lang_get( 'timeline_issue_resolved' ), user_get_name( $this->user_id ), string_get_bug_view_link( $this->issue_id ) );
} else if( $this->old_status >= $t_resolved && $this->new_status < $t_resolved ) {
$t_string = sprintf( lang_get( 'timeline_issue_reopened' ), user_get_name( $this->user_id ), string_get_bug_view_link( $this->issue_id ) );
} else {
return;
}

$t_html = $this->html_start();
$t_html .= '<div class="action">' . $t_string . '</div>';
$t_html .= $this->html_end();

return $t_html;
}
}
52 changes: 52 additions & 0 deletions core/classes/IssueTagTimelineEvent.class.php
@@ -0,0 +1,52 @@
<?php
# MantisBT - A PHP based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* Timeline event class for users tagging issues.
* @copyright Copyright 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
* @package MantisBT
*/

/**
* Timeline event class for users tagging issues.
*
* @package MantisBT
* @subpackage classes
*/
class IssueTagTimelineEvent extends TimelineEvent {
private $issue_id;
private $tag_name;
private $tag;

public function __construct( $p_timestamp, $p_user_id, $p_issue_id, $p_tag_name, $p_tag ) {
parent::__construct( $p_timestamp, $p_user_id, $p_issue_id );

$this->issue_id = $p_issue_id;
$this->tag_name = $p_tag_name;
$this->tag = $p_tag;
}

public function html() {
$t_string = $this->tag ? lang_get( 'timeline_issue_tagged' ) : lang_get( 'timeline_issue_tagged' );

$t_html = $this->html_start();
$t_html .= '<div class="action">' . sprintf( $t_string, user_get_name( $this->user_id ), string_get_bug_view_link( $this->issue_id ), $this->tag_name ) . '</div>';
$t_html .= $this->html_end();

return $t_html;
}
}

0 comments on commit 939ffe3

Please sign in to comment.