コード例 #1
0
 function getContent()
 {
     $request = HTTPRequest::instance();
     $user = UserManager::instance()->getCurrentUser();
     //group id of the user is member
     $projects_id_user = $user->getProjects();
     $html = '';
     $pm = ProjectManager::instance();
     foreach ($projects_id_user as $project_id) {
         $project = $pm->getProject($project_id);
         $project_unix_name = $project->getUnixName();
         $project_public_name = $project->getPublicName();
         $members_id_array = $project->getMembersUserNames();
         if (sizeof($members_id_array) > 1) {
             list($hide_now, $count_diff, $hide_url) = my_hide_url('im_group', $project_id, $request->get('hide_item_id'), count($members_id_array), $request->get('hide_im_group'));
             $html .= $hide_url;
             $html .= '<b>' . $project_public_name . '</b><br>';
             if (!$hide_now) {
                 $html .= '<div style="padding-left:20px;">';
                 foreach ($members_id_array as $member) {
                     $html .= $this->plugin->getDisplayPresence($member['user_id'], $member['user_name'], $member['realname']);
                     $html .= '<br>';
                 }
                 $html .= '</div>';
             }
         }
     }
     return $html;
 }
コード例 #2
0
 function getContent()
 {
     $frsrf = new FRSReleaseFactory();
     $html_my_monitored_fp = '';
     $sql = "SELECT groups.group_name,groups.group_id " . "FROM groups,filemodule_monitor,frs_package " . "WHERE groups.group_id=frs_package.group_id " . "AND frs_package.status_id !=" . $frsrf->STATUS_DELETED . " " . "AND frs_package.package_id=filemodule_monitor.filemodule_id " . "AND filemodule_monitor.user_id='" . user_getid() . "' ";
     $um =& UserManager::instance();
     $current_user =& $um->getCurrentUser();
     if ($current_user->isRestricted()) {
         $projects = $current_user->getProjects();
         $sql .= "AND groups.group_id IN (" . implode(',', $projects) . ") ";
     }
     $sql .= "GROUP BY group_id ORDER BY group_id ASC LIMIT 100";
     $result = db_query($sql);
     $rows = db_numrows($result);
     if (!$result || $rows < 1) {
         $html_my_monitored_fp .= $GLOBALS['Language']->getText('my_index', 'my_files_msg');
     } else {
         $html_my_monitored_fp .= '<table style="width:100%">';
         $request =& HTTPRequest::instance();
         for ($j = 0; $j < $rows; $j++) {
             $group_id = db_result($result, $j, 'group_id');
             $sql2 = "SELECT frs_package.name,filemodule_monitor.filemodule_id " . "FROM groups,filemodule_monitor,frs_package " . "WHERE groups.group_id=frs_package.group_id " . "AND groups.group_id={$group_id} " . "AND frs_package.status_id !=" . $frsrf->STATUS_DELETED . " " . "AND frs_package.package_id=filemodule_monitor.filemodule_id " . "AND filemodule_monitor.user_id='" . user_getid() . "'  LIMIT 100";
             $result2 = db_query($sql2);
             $rows2 = db_numrows($result2);
             $vItemId = new Valid_UInt('hide_item_id');
             $vItemId->required();
             if ($request->valid($vItemId)) {
                 $hide_item_id = $request->get('hide_item_id');
             } else {
                 $hide_item_id = null;
             }
             $vFrs = new Valid_WhiteList('hide_frs', array(0, 1));
             $vFrs->required();
             if ($request->valid($vFrs)) {
                 $hide_frs = $request->get('hide_frs');
             } else {
                 $hide_frs = null;
             }
             list($hide_now, $count_diff, $hide_url) = my_hide_url('frs', $group_id, $hide_item_id, $rows2, $hide_frs);
             $html_hdr = ($j ? '<tr class="boxitem"><td colspan="2">' : '') . $hide_url . '<A HREF="/project/?group_id=' . $group_id . '">' . db_result($result, $j, 'group_name') . '</A>&nbsp;&nbsp;&nbsp;&nbsp;';
             $html = '';
             $count_new = max(0, $count_diff);
             for ($i = 0; $i < $rows2; $i++) {
                 if (!$hide_now) {
                     $html .= '
                     <TR class="' . util_get_alt_row_color($i) . '">' . '<TD WIDTH="99%">&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<A HREF="/file/showfiles.php?group_id=' . $group_id . '">' . db_result($result2, $i, 'name') . '</A></TD>' . '<TD><A HREF="/file/filemodule_monitor.php?filemodule_id=' . db_result($result2, $i, 'filemodule_id') . '&group_id=' . $group_id . '" onClick="return confirm(\'' . $GLOBALS['Language']->getText('my_index', 'stop_file') . '\')">' . '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" ' . 'BORDER=0" ALT="' . $GLOBALS['Language']->getText('my_index', 'stop_monitor') . '"></A></TD></TR>';
                 }
             }
             $html_hdr .= my_item_count($rows2, $count_new) . '</td></tr>';
             $html_my_monitored_fp .= $html_hdr . $html;
         }
         $html_my_monitored_fp .= '</table>';
     }
     return $html_my_monitored_fp;
 }
コード例 #3
0
 public function getContent()
 {
     $html = '';
     $uh = UserHelper::instance();
     $request = HTTPRequest::instance();
     $hp = Codendi_HTMLPurifier::instance();
     $user = UserManager::instance()->getCurrentUser();
     $pm = ProjectManager::instance();
     $project_ids = $user->getProjects();
     foreach ($project_ids as $project_id) {
         $project = $pm->getProject($project_id);
         if ($project->usesSVN()) {
             list($hide_now, $count_diff, $hide_url) = my_hide_url('my_svn_group', $project_id, $request->get('hide_item_id'), count($project_ids), $request->get('hide_my_svn_group'));
             $html .= $hide_url;
             $html .= '<strong>' . $project->getPublicName() . '</strong>';
             if (!$hide_now) {
                 list($latest_revisions, $nb_revisions) = svn_get_revisions($project, 0, $this->_nb_svn_commits, '', $user->getUserName(), '', '', 0, false);
                 if (db_numrows($latest_revisions) > 0) {
                     $i = 0;
                     while ($data = db_fetch_array($latest_revisions)) {
                         $html .= '<div class="' . util_get_alt_row_color($i++) . '" style="border-bottom:1px solid #ddd">';
                         $html .= '<div style="font-size:0.98em;">';
                         $html .= '<a href="' . $this->_getLinkToCommit($project->getGroupId(), $data['revision']) . '">rev #' . $data['revision'] . '</a>';
                         $html .= ' ' . $GLOBALS['Language']->getText('my_index', 'my_latest_svn_commit_on') . ' ';
                         //In the db, svn dates are stored as int whereas cvs dates are stored as timestamp
                         $html .= format_date($GLOBALS['Language']->getText('system', 'datefmt'), is_numeric($data['date']) ? $data['date'] : strtotime($data['date']));
                         $html .= ' ' . $GLOBALS['Language']->getText('my_index', 'my_latest_svn_commit_by') . ' ';
                         if (isset($data['whoid'])) {
                             $name = $uh->getDisplayNameFromUserId($data['whoid']);
                         } else {
                             $name = $uh->getDisplayNameFromUserName($data['who']);
                         }
                         $html .= $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML);
                         $html .= '</div>';
                         $html .= '<div style="padding-left:20px; padding-bottom:4px; color:#555">';
                         $html .= util_make_links(substr($data['description'], 0, 255), $project->getGroupId());
                         if (strlen($data['description']) > 255) {
                             $html .= '&nbsp;[...]';
                         }
                         $html .= '</div>';
                         $html .= '</div>';
                     }
                     $html .= '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">';
                     $html .= '<a href="' . $this->_getLinkToMore($project->getGroupId(), $user->getUserName()) . '">[ More ]</a>';
                     $html .= '</div>';
                 } else {
                     $html .= '<div></div>';
                 }
             } else {
                 $html .= '<div></div>';
             }
         }
     }
     return $html;
 }
コード例 #4
0
 function getContent()
 {
     $html_my_monitored_forums = '';
     $sql = "SELECT groups.group_id, groups.group_name " . "FROM groups,forum_group_list,forum_monitored_forums " . "WHERE groups.group_id=forum_group_list.group_id " . "AND groups.status = 'A' " . "AND forum_group_list.is_public <> 9 " . "AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id " . "AND forum_monitored_forums.user_id='" . user_getid() . "' ";
     $um =& UserManager::instance();
     $current_user =& $um->getCurrentUser();
     if ($current_user->isRestricted()) {
         $projects = $current_user->getProjects();
         $sql .= "AND groups.group_id IN (" . implode(',', $projects) . ") ";
     }
     $sql .= "GROUP BY group_id ORDER BY group_id ASC LIMIT 100";
     $result = db_query($sql);
     $rows = db_numrows($result);
     if (!$result || $rows < 1) {
         $html_my_monitored_forums .= $GLOBALS['Language']->getText('my_index', 'my_forums_msg');
     } else {
         $request =& HTTPRequest::instance();
         $html_my_monitored_forums .= '<table style="width:100%">';
         for ($j = 0; $j < $rows; $j++) {
             $group_id = db_result($result, $j, 'group_id');
             $sql2 = "SELECT forum_group_list.group_forum_id,forum_group_list.forum_name " . "FROM groups,forum_group_list,forum_monitored_forums " . "WHERE groups.group_id=forum_group_list.group_id " . "AND groups.group_id={$group_id} " . "AND forum_group_list.is_public <> 9 " . "AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id " . "AND forum_monitored_forums.user_id='" . user_getid() . "' LIMIT 100";
             $result2 = db_query($sql2);
             $rows2 = db_numrows($result2);
             $vItemId = new Valid_UInt('hide_item_id');
             $vItemId->required();
             if ($request->valid($vItemId)) {
                 $hide_item_id = $request->get('hide_item_id');
             } else {
                 $hide_item_id = null;
             }
             $vForum = new Valid_WhiteList('hide_forum', array(0, 1));
             $vForum->required();
             if ($request->valid($vForum)) {
                 $hide_forum = $request->get('hide_forum');
             } else {
                 $hide_forum = null;
             }
             list($hide_now, $count_diff, $hide_url) = my_hide_url('forum', $group_id, $hide_item_id, $rows2, $hide_forum);
             $html_hdr = ($j ? '<tr class="boxitem"><td colspan="2">' : '') . $hide_url . '<A HREF="/forum/?group_id=' . $group_id . '">' . db_result($result, $j, 'group_name') . '</A>&nbsp;&nbsp;&nbsp;&nbsp;';
             $html = '';
             $count_new = max(0, $count_diff);
             for ($i = 0; $i < $rows2; $i++) {
                 if (!$hide_now) {
                     $group_forum_id = db_result($result2, $i, 'group_forum_id');
                     $html .= '
                 <TR class="' . util_get_alt_row_color($i) . '"><TD WIDTH="99%">' . '&nbsp;&nbsp;&nbsp;-&nbsp;<A HREF="/forum/forum.php?forum_id=' . $group_forum_id . '">' . stripslashes(db_result($result2, $i, 'forum_name')) . '</A></TD>' . '<TD ALIGN="center"><A HREF="/my/stop_monitor.php?forum_id=' . $group_forum_id . '" onClick="return confirm(\'' . $GLOBALS['Language']->getText('my_index', 'stop_forum') . '\')">' . '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" ' . 'BORDER=0 ALT="' . $GLOBALS['Language']->getText('my_index', 'stop_monitor') . '"></A></TD></TR>';
                 }
             }
             $html_hdr .= my_item_count($rows2, $count_new) . '</td></tr>';
             $html_my_monitored_forums .= $html_hdr . $html;
         }
         $html_my_monitored_forums .= '</table>';
     }
     return $html_my_monitored_forums;
 }
コード例 #5
0
 function _display_artifacts($list_trackers, $print_box_begin)
 {
     $request = HTTPRequest::instance();
     $vItemId = new Valid_UInt('hide_item_id');
     $vItemId->required();
     if ($request->valid($vItemId)) {
         $hide_item_id = $request->get('hide_item_id');
     } else {
         $hide_item_id = null;
     }
     $vArtifact = new Valid_WhiteList('hide_artifact', array(0, 1));
     $vArtifact->required();
     if ($request->valid($vArtifact)) {
         $hide_artifact = $request->get('hide_artifact');
     } else {
         $hide_artifact = null;
     }
     $j = $print_box_begin;
     $html_my_artifacts = "";
     $html = "";
     $html_hdr = "";
     $aid_old = 0;
     $atid_old = 0;
     $group_id_old = 0;
     $count_aids = 0;
     $group_name = "";
     $tracker_name = "";
     $artifact_types = array();
     $pm = ProjectManager::instance();
     while ($trackers_array = db_fetch_array($list_trackers)) {
         $atid = $trackers_array['group_artifact_id'];
         $group_id = $trackers_array['group_id'];
         // {{{ check permissions
         //create group
         $group = $pm->getProject($group_id);
         if (!$group || !is_object($group) || $group->isError()) {
             exit_no_group();
         }
         //Create the ArtifactType object
         if (!isset($artifact_types[$group_id])) {
             $artifact_types[$group_id] = array();
         }
         if (!isset($artifact_types[$group_id][$atid])) {
             $artifact_types[$group_id][$atid] = array();
             $artifact_types[$group_id][$atid]['at'] = new ArtifactType($group, $atid);
             $artifact_types[$group_id][$atid]['user_can_view_at'] = $artifact_types[$group_id][$atid]['at']->userCanView();
             $artifact_types[$group_id][$atid]['user_can_view_summary_or_aid'] = null;
         }
         //Check if user can view artifact
         if ($artifact_types[$group_id][$atid]['user_can_view_at'] && $artifact_types[$group_id][$atid]['user_can_view_summary_or_aid'] !== false) {
             if (is_null($artifact_types[$group_id][$atid]['user_can_view_summary_or_aid'])) {
                 $at = $artifact_types[$group_id][$atid]['at'];
                 //Create ArtifactFieldFactory object
                 if (!isset($artifact_types[$group_id][$atid]['aff'])) {
                     $artifact_types[$group_id][$atid]['aff'] = new ArtifactFieldFactory($at);
                 }
                 $aff = $artifact_types[$group_id][$atid]['aff'];
                 //Retrieve artifact_id field
                 $field = $aff->getFieldFromName('artifact_id');
                 //Check if user can read it
                 $user_can_view_aid = $field->userCanRead($group_id, $atid);
                 //Retrieve percent_complete field
                 $field = $aff->getFieldFromName('percent_complete');
                 //Check if user can read it
                 $user_can_view_percent_complete = $field && $field->userCanRead($group_id, $atid);
                 //Retriebe summary field
                 $field = $aff->getFieldFromName('summary');
                 //Check if user can read it
                 $user_can_view_summary = $field->userCanRead($group_id, $atid);
                 $artifact_types[$group_id][$atid]['user_can_view_summary_or_aid'] = $user_can_view_aid || $user_can_view_summary;
             }
             if ($artifact_types[$group_id][$atid]['user_can_view_summary_or_aid']) {
                 //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);
                     $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>&nbsp;&nbsp;&nbsp;&nbsp;';
                     $count_new = max(0, $count_diff);
                     $html_hdr .= my_item_count($count_aids, $count_new) . '</td></tr>';
                     $html_my_artifacts .= $html_hdr . $html;
                     $count_aids = 0;
                     $html = '';
                     $j++;
                 }
                 if ($count_aids == 0) {
                     //have to call it to get at least the hide_now even if count_aids is false at this point
                     $hide_now = my_hide('artifact', $atid, $hide_item_id, $hide_artifact);
                 }
                 $group_name = $trackers_array['group_name'];
                 $tracker_name = $trackers_array['name'];
                 $aid = $trackers_array['artifact_id'];
                 $summary = $trackers_array['summary'];
                 $atid_old = $atid;
                 $group_id_old = $group_id;
                 // If user is assignee and submitter of an artifact, it will
                 // appears 2 times in the result set.
                 if ($aid != $aid_old) {
                     $count_aids++;
                 }
                 if (!$hide_now && $aid != $aid_old) {
                     // Form the 'Submitted by/Assigned to flag' for marking
                     $AS_flag = my_format_as_flag2($trackers_array['assignee'], $trackers_array['submitter']);
                     //get percent_complete if this field is used in the tracker
                     $percent_complete = '';
                     if ($user_can_view_percent_complete) {
                         $sql = "SELECT afvl.value " . "FROM artifact_field_value afv,artifact_field af, artifact_field_value_list afvl, artifact_field_usage afu " . "WHERE af.field_id = afv.field_id AND af.field_name = 'percent_complete' " . "AND afv.artifact_id = {$aid} " . "AND afvl.group_artifact_id = {$atid} AND af.group_artifact_id = {$atid} " . "AND afu.group_artifact_id = {$atid} AND afu.field_id = af.field_id AND afu.use_it = 1 " . "AND afvl.field_id = af.field_id AND afvl.value_id = afv.valueInt";
                         $res = db_query($sql);
                         if (db_numrows($res) > 0) {
                             $percent_complete = '<TD class="small">' . db_result($res, 0, 'value') . '</TD>';
                         }
                     }
                     $html .= '
                         <TR class="' . get_priority_color($trackers_array['severity']) . '"><TD class="small"><A HREF="/tracker/?func=detail&group_id=' . $group_id . '&aid=' . $aid . '&atid=' . $atid . '">' . $aid . '</A></TD>' . '<TD class="small"' . ($percent_complete ? '>' : ' colspan="2">');
                     if ($user_can_view_summary) {
                         $html .= stripslashes($summary);
                     }
                     $html .= '&nbsp;' . $AS_flag . '</TD>' . $percent_complete . '</TR>';
                 }
                 $aid_old = $aid;
             }
         }
     }
     //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>&nbsp;&nbsp;&nbsp;&nbsp;';
         $count_new = max(0, $count_diff);
         $html_hdr .= my_item_count($count_aids, $count_new) . '</td></tr>';
         $html_my_artifacts .= $html_hdr . $html;
     }
     return $html_my_artifacts;
 }
コード例 #6
0
 function _getReviews($reviewer = true)
 {
     $hp = Codendi_HTMLPurifier::instance();
     require_once 'www/my/my_utils.php';
     $html = '';
     $content_html_id = 'plugin_docman_approval_' . ($reviewer ? 'reviewer' : 'requester');
     $html .= '<div style="font-weight:bold;">';
     $html .= $GLOBALS['HTML']->getImage('pointer_down.png', array('id' => $content_html_id . '_icon', 'onclick' => "plugin_docman_approval_toggle('{$content_html_id}', true)")) . ' ';
     if ($reviewer) {
         $html .= $GLOBALS['Language']->getText('plugin_docman', 'my_reviews_reviewer');
     } else {
         $html .= $GLOBALS['Language']->getText('plugin_docman', 'my_reviews_requester');
     }
     $html .= '</div>';
     $html .= '<div id="' . $content_html_id . '" style="padding-left:20px;">';
     $um =& UserManager::instance();
     $user =& $um->getCurrentUser();
     if ($reviewer) {
         $reviewsArray = Docman_ApprovalTableReviewerFactory::getAllPendingReviewsForUser($user->getId());
     } else {
         $reviewsArray = Docman_ApprovalTableReviewerFactory::getAllApprovalTableForUser($user->getId());
     }
     if (count($reviewsArray) > 0) {
         $request =& HTTPRequest::instance();
         // Get hide arguments
         $hideItemId = (int) $request->get('hide_item_id');
         $hideApproval = null;
         if ($request->exist('hide_plugin_docman_approval')) {
             $hideApproval = (int) $request->get('hide_plugin_docman_approval');
         }
         $prevGroupId = -1;
         $hideNow = false;
         $i = 0;
         $html .= '<table style="width:100%">';
         //$html .= '<TR><TD colspan="2">Reviewer - Requester</TD></TR>';
         foreach ($reviewsArray as $review) {
             if ($review['group_id'] != $prevGroupId) {
                 list($hideNow, $count_diff, $hideUrl) = my_hide_url('plugin_docman_approval', $review['group_id'], $hideItemId, 1, $hideApproval);
                 $docmanUrl = $this->pluginPath . '/?group_id=' . $review['group_id'];
                 $docmanHref = '<a href="' . $docmanUrl . '">' . $review['group'] . '</a>';
                 if ($prevGroupId != -1) {
                     if ($reviewer) {
                         $colspan = 2;
                     } else {
                         $colspan = 3;
                     }
                     $html .= '<tr class="boxitem"><td colspan="' . $colspan . '">';
                 }
                 $html .= '<strong>' . $hideUrl . $docmanHref . '</strong></td></tr>';
                 $i = 0;
             }
             if (!$hideNow) {
                 $html .= '<tr class="' . util_get_alt_row_color($i++) . '">';
                 // Document
                 $html .= '<td align="left">';
                 $html .= '<a href="' . $review['url'] . '">' . $hp->purify($review['title'], CODENDI_PURIFIER_CONVERT_HTML) . '</a>';
                 $html .= '</td>';
                 // For requester, precise the status
                 if (!$reviewer) {
                     $html .= '<td align="right">';
                     $html .= $review['status'];
                     $html .= '</td>';
                 }
                 // Date
                 $html .= '<td align="right">';
                 $html .= util_timestamp_to_userdateformat($review['date'], true);
                 $html .= '</td>';
                 $html .= '</tr>';
             }
             $prevGroupId = $review['group_id'];
         }
         $html .= '</table>';
     } else {
         if ($reviewer) {
             $html .= $GLOBALS['Language']->getText('plugin_docman', 'my_no_review');
         } else {
             $html .= $GLOBALS['Language']->getText('plugin_docman', 'my_no_request');
         }
     }
     $html .= '</div>';
     if (user_get_preference('hide_plugin_docman_approval_' . ($reviewer ? 'reviewer' : 'requester'))) {
         $html .= '<script type="text/javascript">';
         $html .= "document.observe('dom:loaded', function() \n                {\n                    plugin_docman_approval_toggle('{$content_html_id}', false);\n                }\n            );\n            </script>";
     }
     return $html;
 }