* along with Fusionforge. If not, see <http://www.gnu.org/licenses/>.
*/
-require_once('Widget.class.php');
-require_once('common/tracker/ArtifactTypeFactory.class.php');
-require_once('common/tracker/ArtifactsForUser.class.php');
-require_once('common/tracker/Artifact.class.php');
-require_once('common/tracker/ArtifactFile.class.php');
-require_once('common/tracker/ArtifactType.class.php');
-require_once('common/tracker/ArtifactCanned.class.php');
+require_once 'Widget.class.php';
+require_once $gfcommon.'include/utils.php';
+require_once $gfwww.'include/html.php';
+require_once $gfcommon.'tracker/ArtifactTypeFactory.class.php';
+require_once $gfcommon.'tracker/ArtifactsForUser.class.php';
+require_once $gfcommon.'tracker/Artifact.class.php';
+require_once $gfcommon.'tracker/ArtifactFile.class.php';
+require_once $gfcommon.'tracker/ArtifactType.class.php';
+require_once $gfcommon.'tracker/ArtifactCanned.class.php';
/**
* Widget_MyArtifacts
*
- * Artifact assigned to or submitted by this person
+ * Artifact assigned to or submitted by or monitored by this person
*/
+
class Widget_MyArtifacts extends Widget {
var $_artifact_show;
- function Widget_MyArtifacts() {
+ function __construct() {
$this->Widget('myartifacts');
$this->_artifact_show = UserManager::instance()->getCurrentUser()->getPreference('my_artifacts_show');
if($this->_artifact_show === false) {
- $this->_artifact_show = 'AS';
+ $this->_artifact_show = 'ASM';
UserManager::instance()->getCurrentUser()->setPreference('my_artifacts_show', $this->_artifact_show);
}
}
function updatePreferences(&$request) {
$request->valid(new Valid_String('cancel'));
- $vShow = new Valid_WhiteList('show', array('A', 'S', 'N', 'AS'));
+ $vShow = new Valid_WhiteList('show', array('A', 'S', 'M', 'N', 'AS', 'AM', 'SM', 'ASM'));
$vShow->required();
if (!$request->exist('cancel')) {
if ($request->valid($vShow)) {
case 'S':
$this->_artifact_show = 'S';
break;
+ case 'M':
+ $this->_artifact_show = 'M';
+ break;
case 'N':
$this->_artifact_show = 'N';
break;
case 'AS':
- default:
$this->_artifact_show = 'AS';
+ break;
+ case 'AM':
+ $this->_artifact_show = 'AM';
+ break;
+ case 'SM':
+ $this->_artifact_show = 'SM';
+ break;
+ case 'ASM':
+ default:
+ $this->_artifact_show = 'ASM';
}
UserManager::instance()->getCurrentUser()->setPreference('my_artifacts_show', $this->_artifact_show);
}
}
function getPreferences() {
- $prefs = '';
- $prefs .= _("Display artifacts:").' <select name="show">';
- $prefs .= '<option value="A" '.($this->_artifact_show === 'A'?'selected="selected"':'').'>'._("assigned to me [A]");
- $prefs .= '<option value="S" '.($this->_artifact_show === 'S'?'selected="selected"':'').'>'._("submitted by me [S]");
- $prefs .= '<option value="AS" '.($this->_artifact_show === 'AS'?'selected="selected"':'').'>'._("assigned to or submitted by me [AS]");
- $prefs .= '</select>';
+ $optionsArray = array('A','S','M','AS','AM','SM', 'ASM');
+ $textsArray = array();
+ $textsArray[] = _('assigned to me'.' [A]');
+ $textsArray[] = _('submitted by me'.' [S]');
+ $textsArray[] = _('monitored by me'.' [M]');
+ $textsArray[] = _('assigned to or submitted by me'.' [AS]');
+ $textsArray[] = _('assigned to or monitored by me'.' [AM]');
+ $textsArray[] = _('submitted by or monitored by me'.' [SM]');
+ $textsArray[] = _('assigned to or submitted by or monitored by me'.' [ASM]');
+ $prefs = _("Display artifacts:").html_build_select_box_from_arrays($optionsArray, $textsArray, "show", $this->_artifact_show);
return $prefs;
}
function getContent() {
$atf = new ArtifactsForUser(@UserManager::instance()->getCurrentUser());
- $assigned = $atf->getAssignedArtifactsByGroup();
- $submitted = $atf->getSubmittedArtifactsByGroup();
- $all = $atf->getArtifactsFromSQLWithParams('SELECT * FROM artifact_vw av where (av.submitted_by=$1 OR av.assigned_to=$1) AND av.status_id=1 ORDER BY av.group_artifact_id, av.artifact_id DESC',array( UserManager::instance()->getCurrentUser()->getID()));
-
$my_artifacts = array();
- if($this->_artifact_show == 'AS'){
- $my_artifacts=$all;
+ if ($this->_artifact_show == 'ASM'){
+ $my_artifacts = $atf->getArtifactsFromSQLWithParams('SELECT * FROM artifact_vw av where (av.submitted_by=$1 OR av.assigned_to=$1 OR av.artifact_id IN (select artifact_monitor.artifact_id FROM artifact_monitor WHERE artifact_monitor.user_id = $1)) AND av.status_id=1 ORDER BY av.group_artifact_id, av.artifact_id DESC',array( UserManager::instance()->getCurrentUser()->getID()));
+ }
+ if ($this->_artifact_show == 'AS'){
+ $my_artifacts = $atf->getArtifactsFromSQLWithParams('SELECT * FROM artifact_vw av where (av.submitted_by=$1 OR av.assigned_to=$1) AND av.status_id=1 ORDER BY av.group_artifact_id, av.artifact_id DESC',array( UserManager::instance()->getCurrentUser()->getID()));
+ }
+ if ($this->_artifact_show == 'AM'){
+ $my_artifacts = $atf->getArtifactsFromSQLWithParams('SELECT * FROM artifact_vw av where (av.assigned_to=$1 OR av.artifact_id IN (select artifact_monitor.artifact_id FROM artifact_monitor WHERE artifact_monitor.user_id = $1)) AND av.status_id=1 ORDER BY av.group_artifact_id, av.artifact_id DESC',array( UserManager::instance()->getCurrentUser()->getID()));
+ }
+ if ($this->_artifact_show == 'SM'){
+ $my_artifacts = $atf->getArtifactsFromSQLWithParams('SELECT * FROM artifact_vw av where (av.submitted_by=$1 OR av.artifact_id IN (select artifact_monitor.artifact_id FROM artifact_monitor WHERE artifact_monitor.user_id = $1)) AND av.status_id=1 ORDER BY av.group_artifact_id, av.artifact_id DESC',array( UserManager::instance()->getCurrentUser()->getID()));
}
- if($this->_artifact_show== 'S') {
- $my_artifacts=$submitted;
+ if ($this->_artifact_show== 'S') {
+ $my_artifacts = $atf->getSubmittedArtifactsByGroup();
}
- if($this->_artifact_show== 'A') {
- $my_artifacts=$assigned;
+ if ($this->_artifact_show== 'A') {
+ $my_artifacts = $atf->getAssignedArtifactsByGroup();
+ }
+ if ($this->_artifact_show== 'M') {
+ $my_artifacts = $atf->getArtifactsFromSQLWithParams('SELECT * FROM artifact_vw av where (av.artifact_id IN (select artifact_monitor.artifact_id FROM artifact_monitor WHERE artifact_monitor.user_id = $1)) AND av.status_id=1 ORDER BY av.group_artifact_id, av.artifact_id DESC',array( UserManager::instance()->getCurrentUser()->getID()));;
}
if (count($my_artifacts) > 0) {
$tracker_name = "";
$artifact_types = array();
- $allIds=array();
+ $allIds = array();
$pm = ProjectManager::instance();
foreach ($list_trackers as $trackers_array ) {
//work on the tracker of the last round if there was one
if ($atid != $atid_old && $count_aids != 0) {
list($hide_now,$count_diff,$hide_url) =
- my_hide_url('artifact',$atid_old,$hide_item_id,$count_aids,$hide_artifact);
+ my_hide_url('artifact', $atid_old, $hide_item_id, $count_aids, $hide_artifact);
$html_hdr = '<tr class="boxitem"><td colspan="3">' .
- $hide_url.'<a href="/tracker/?group_id='.$group_id_old.'&atid='.$atid_old.'">'.
- $group_name." - ".$tracker_name.'</a> ';
+ $hide_url.
+ util_make_link('/tracker/?group_id='.$group_id_old, $group_name, array('class'=>'tabtitle-nw', 'title'=>_('Browse Trackers List for this project'))).
+ ' - '.
+ util_make_link('/tracker/?group_id='.$group_id_old.'&atid='.$atid_old, $tracker_name, array('class'=>'tabtitle', 'title'=>_('Browse this tracker for this project'))).
+ ' ';
$count_new = max(0, $count_diff);
$html_hdr .= my_item_count($count_aids,$count_new).'</td></tr>';
if (!$hide_now && $aid != $aid_old) {
- // Form the 'Submitted by/Assigned to flag' for marking
- if($trackers_array->getAssignedTo()== user_getid())
- {
- if($trackers_array->getSubmittedBy()== user_getid()) {
- $AS_flag = 'AS';
- }
- else {
- $AS_flag='A';
- }
+ // Form the 'Submitted by/Assigned/Monitored_by to flag' for marking
+ $AS_flag = '';
+ $AS_title = '';
+ if($trackers_array->getAssignedTo()== user_getid()) {
+ $AS_flag .= 'A';
+ $AS_title .= _('Assigned');
+ }
+ if ($trackers_array->getSubmittedBy()== user_getid()) {
+ $AS_flag .= 'S';
+ if (strlen($AS_title))
+ $AS_title .= ' / ';
+ $AS_title .= _('Submitted');
}
- elseif($trackers_array->getSubmittedBy()== user_getid()){
- $AS_flag='S';
+ if ($trackers_array->isMonitoring()) {
+ $AS_flag .= 'M';
+ if (strlen($AS_title))
+ $AS_title .= ' / ';
+ $AS_title .= _('Monitored');
}
- else {
- $AS_flag='N';
+ if (!strlen($AS_flag)) {
+ $AS_flag .= 'N';
}
if($AS_flag !='N') {
$html .= '
<tr '. $HTML->boxGetAltRowStyle($count_aids) .'>'.
'<td class="priority'.$trackers_array->getPriority().'">'.$trackers_array->getPriority().'</td>'.
- '<td><a href="/tracker/?func=detail&group_id='.
- $group_id.'&aid='.$aid.'&atid='.$atid.
- '">'. stripslashes($summary).'</a></td>'.
- '<td class="small">';
+ '<td>'.util_make_link('/tracker/?func=detail&group_id='.$group_id.'&aid='.$aid.'&atid='.$atid, stripslashes($summary), array("class"=>"tabtitle", "title"=>_('Browse this artefact'))).
+ '</td>'.
+ '<td class="small tabtitle-ne" title="'.$AS_title.'">';
$html .= ' '.$AS_flag.'</td></tr>';
}
//work on the tracker of the last round if there was one
if ($atid_old != 0 && $count_aids != 0) {
list($hide_now,$count_diff,$hide_url) = my_hide_url('artifact',$atid_old,$hide_item_id,$count_aids,$hide_artifact);
- $html_hdr = ($j ? '<tr class="boxitem"><td colspan="3">' : '').
- $hide_url.'<a href="/tracker/?group_id='.$group_id_old.'&atid='.$atid_old.'">'.
- $group_name." - ".$tracker_name.'</a> ';
+ $html_hdr = '<tr class="boxitem"><td colspan="3">'.
+ $hide_url.
+ util_make_link('/tracker/?group_id='.$group_id_old, $group_name, array('class'=>'tabtitle-nw', 'title'=>_('Browse Trackers List for this project'))).
+ ' - '.
+ util_make_link('/tracker/?group_id='.$group_id_old.'&atid='.$atid_old, $tracker_name, array('class'=>'tabtitle', 'title'=>_('Browse this tracker for this project'))).
+ ' ';
$count_new = max(0, $count_diff);
$html_hdr .= my_item_count($count_aids,$count_new).'</td></tr>';
}
function getDescription() {
- return _("List artifacts you have submitted or assigned to you, by project.");
+ return _("List artifacts you have submitted or assigned to you or you are monitoring, by project.");
}
}
-
-?>