function all(&$request) { $html = ''; $servers = $this->server_factory->getAllServers(); if (count($servers)) { $title_arr = array($GLOBALS['Language']->getText('admin_servers', 'all_name'), $GLOBALS['Language']->getText('admin_servers', 'all_description'), 'HTTP', 'HTTPS', $GLOBALS['Language']->getText('admin_servers', 'all_is_master'), ''); $html .= html_build_list_table_top($title_arr); $row_num = 0; foreach ($servers as $key => $nop) { $html .= '<tr class="' . util_get_alt_row_color($row_num++) . '">'; $html .= '<td><a title="' . $GLOBALS['Language']->getText('admin_servers', 'all_edit', array(htmlentities($servers[$key]->getName(), ENT_QUOTES, 'UTF-8'))) . '" href="/admin/servers/edit/' . $servers[$key]->getId() . '">' . $servers[$key]->getId() . '. ' . $servers[$key]->getName() . '</a></td>'; $html .= '<td>' . $servers[$key]->getDescription() . '</td>'; $html .= '<td>' . $servers[$key]->getHttp() . '</td>'; $html .= '<td>' . $servers[$key]->getHttps() . '</td>'; $html .= '<td style="text-align:center">' . ($servers[$key]->isMaster() ? $GLOBALS['Language']->getText('admin_servers', 'all_master') : '-') . '</td>'; $html .= '<td>'; if (!$servers[$key]->isMaster()) { $html .= '<a title="' . $GLOBALS['Language']->getText('admin_servers', 'all_delete', array(htmlentities($servers[$key]->getName(), ENT_QUOTES, 'UTF-8'))) . '" href="/admin/servers/delete/' . $servers[$key]->getId() . '">' . $GLOBALS['Response']->getImage('ic/trash.png', array('alt' => 'Delete server')) . '</a>'; } else { $html .= '-'; } $html .= '</td>'; $html .= '</tr>'; } $html .= '</table>'; } else { $html .= '<p>No servers</p>'; } $html .= '<p><a href="/admin/servers/add">' . $GLOBALS['Language']->getText('admin_servers', 'all_add') . '</a> '; if (count($servers)) { $html .= '| <a href="/admin/servers/master">' . $GLOBALS['Language']->getText('admin_servers', 'all_choose') . '</a>'; } $html .= '</p>'; return $html; }
function getContent() { $html_my_bookmarks = ''; $result = db_query("SELECT bookmark_url, bookmark_title, bookmark_id from user_bookmarks where " . "user_id='" . user_getid() . "' ORDER BY bookmark_title"); $rows = db_numrows($result); if (!$result || $rows < 1) { $html_my_bookmarks .= $GLOBALS['Language']->getText('my_index', 'no_bookmark'); $html_my_bookmarks .= db_error(); } else { $purifier = Codendi_HTMLPurifier::instance(); $html_my_bookmarks .= '<table style="width:100%">'; for ($i = 0; $i < $rows; $i++) { $bookmark_url = $purifier->purify(db_result($result, $i, 'bookmark_url'), CODENDI_PURIFIER_CONVERT_HTML); if (my_has_URL_invalid_content($bookmark_url)) { $bookmark_url = ''; } $bookmark_title = $purifier->purify(db_result($result, $i, 'bookmark_title'), CODENDI_PURIFIER_CONVERT_HTML); $html_my_bookmarks .= '<TR class="' . util_get_alt_row_color($i) . '"><TD>'; $html_my_bookmarks .= '<A HREF="' . $bookmark_url . '">' . $bookmark_title . '</A> '; $html_my_bookmarks .= '<small><A HREF="/my/bookmark_edit.php?bookmark_id=' . db_result($result, $i, 'bookmark_id') . '">[' . $GLOBALS['Language']->getText('my_index', 'edit_link') . ']</A></SMALL></TD>'; $html_my_bookmarks .= '<td style="text-align:right"><A HREF="/my/bookmark_delete.php?bookmark_id=' . db_result($result, $i, 'bookmark_id') . '">'; $html_my_bookmarks .= '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" BORDER="0" ALT="DELETE"></A></td></tr>'; } $html_my_bookmarks .= '</table>'; } $html_my_bookmarks .= '<div style="text-align:center; font-size:0.8em;"><a href="/my/bookmark_add.php">[' . $GLOBALS['Language']->getText('my_index', 'add_bookmark') . ']</a></div>'; return $html_my_bookmarks; }
/** * create the html output to visualize what has been parsed * @param $users: array containing all the users (User Object) that are in the import file */ function showParseResults($parsed_users) { global $Language; echo $Language->getText('project_admin_userimport', 'ready') . "<br><br>\n"; //Display table containing the list of users to be imported $title_arr = array($Language->getText('project_admin_userimport', 'username'), $Language->getText('project_admin_userimport', 'mail_addr')); echo html_build_list_table_top($title_arr); $i = 0; foreach ($parsed_users as $current_user) { echo '<TR class="' . util_get_alt_row_color($i++) . '">' . "\n"; echo '<TD>' . $current_user->getName() . '</TD>' . "\n"; echo '<TD>' . $current_user->getEmail() . '</TD></TR>' . "\n"; } echo "</TABLE>\n"; // Add 'import' button to confirm import echo '<FORM NAME="acceptimportdata" action="?" method="POST" enctype="multipart/form-data"> <p align="left"><INPUT TYPE="SUBMIT" NAME="submit" VALUE="' . $Language->getText('project_admin_userimport', 'import') . '"></p> <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $this->group_id . '"> <INPUT TYPE="HIDDEN" NAME="func" VALUE="import"> <INPUT TYPE="HIDDEN" NAME="mode" VALUE="import">'; foreach ($parsed_users as $current_user) { echo '<INPUT TYPE="HIDDEN" NAME="parsed_users[]" VALUE="' . $current_user->getId() . '">'; } echo '</FORM><A href="/project/admin/userimport.php?group_id=' . $this->group_id . '"> [' . $Language->getText('global', 'back') . ']</A>'; }
function getContent() { $html = ''; $i = 1; $UH = UserHelper::instance(); $hp = Codendi_HTMLPurifier::instance(); while ($data = db_fetch_array($this->getLatestRevisions())) { $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($data) . '">#' . $data['revision'] . '</a>'; $html .= ' by '; if (isset($data['whoid'])) { $name = $UH->getDisplayNameFromUserId($data['whoid']); } else { $name = $UH->getDisplayNameFromUserName($data['who']); } $html .= $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML) . ' 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 .= '</div>'; $html .= '<div style="padding-left:20px; padding-bottom:4px; color:#555">'; $html .= util_make_links(substr($data['description'], 0, 255), $this->group_id); if (strlen($data['description']) > 255) { $html .= ' [...]'; } $html .= '</div>'; $html .= '</div>'; } $html .= '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">'; $html .= '<a href="' . $this->_getLinkToMore() . '">[ More ]</a>'; $html .= '</div>'; return $html; }
function getContent() { $hp = Codendi_HTMLPurifier::instance(); $content = ''; if ($this->rss_url) { require_once 'common/rss/libs/SimplePie/simplepie.inc'; if (!is_dir($GLOBALS['codendi_cache_dir'] . '/rss')) { mkdir($GLOBALS['codendi_cache_dir'] . '/rss'); } $rss = new SimplePie($this->rss_url, $GLOBALS['codendi_cache_dir'] . '/rss', null, $GLOBALS['sys_proxy']); $max_items = 10; $items = array_slice($rss->get_items(), 0, $max_items); $content .= '<table width="100%">'; $i = 0; foreach ($items as $item) { $content .= '<tr class="' . util_get_alt_row_color($i++) . '"><td WIDTH="99%">'; if ($image = $item->get_link(0, 'image')) { //hack to display twitter avatar $content .= '<img src="' . $hp->purify($image, CODENDI_PURIFIER_CONVERT_HTML) . '" width="48" height="48" style="float:left; margin-right:1em;" />'; } $content .= '<a href="' . $item->get_link() . '">' . $hp->purify($item->get_title(), CODENDI_PURIFIER_STRIP_HTML) . '</a>'; if ($item->get_date()) { $content .= '<span style="color:#999;" title="' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $item->get_date('U')) . '"> - ' . DateHelper::timeAgoInWords($item->get_date('U')) . '</span>'; } $content .= '</td></tr>'; } $content .= '</table>'; } return $content; }
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> '; $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%">' . ' - <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; }
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> '; $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%"> - <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; }
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 .= ' [...]'; } $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; }
function getReferenceRow($ref, $row_num) { $html = ''; if ($ref->isActive() && $ref->getId() != 100) { $html .= '<TR class="' . util_get_alt_row_color($row_num) . '">'; $html .= '<TD>' . $ref->getKeyword() . '</TD>'; $html .= '<TD>' . ReferenceAdministrationViews::getReferenceDescription($ref) . '</TD>'; $html .= '<TD>' . $ref->getLink() . '</TD>'; $html .= '</TR>'; } return $html; }
function getReferenceRow($ref, $row_num) { $html = ''; if ($ref->isActive() && $ref->getId() != 100) { $purifier = Codendi_HTMLPurifier::instance(); $html .= '<TR class="' . util_get_alt_row_color($row_num) . '">'; $html .= '<TD>' . $purifier->purify($ref->getKeyword()) . '</TD>'; $html .= '<TD>' . $purifier->purify(ReferenceAdministrationViews::getReferenceDescription($ref)) . '</TD>'; $html .= '<TD>' . $purifier->purify($ref->getLink()) . '</TD>'; $html .= '</TR>'; } return $html; }
function snippet_show_package_snippets($version) { global $Language; $version = (int) $version; //show the latest version $sql = "SELECT snippet.snippet_id, snippet_package_item.snippet_version_id, snippet_version.version,snippet.name,user.user_name, snippet_version.filesize " . "FROM snippet,snippet_version,snippet_package_item,user " . "WHERE snippet.snippet_id=snippet_version.snippet_id " . "AND user.user_id=snippet_version.submitted_by " . "AND snippet_version.snippet_version_id=snippet_package_item.snippet_version_id " . "AND snippet_package_item.snippet_package_version_id='" . db_ei($version) . "'"; $result = db_query($sql); $rows = db_numrows($result); echo ' <P> <H3>' . $Language->getText('snippet_add_snippet_to_package', 's_in_p') . '</H3> <P>'; $title_arr = array(); $title_arr[] = $Language->getText('snippet_utils', 'version_id'); $title_arr[] = $Language->getText('snippet_details', 's_version'); $title_arr[] = $Language->getText('snippet_browse', 'title'); $title_arr[] = $Language->getText('snippet_details', 'author'); echo html_build_list_table_top($title_arr, $links_arr); if (!$result || $rows < 1) { echo db_error(); echo ' <TR><TD COLSPAN="4"><H3>' . $Language->getText('snippet_add_snippet_to_package', 'no_s_in_p') . '</H3></TD></TR>'; } else { //get the newest version, so we can display it's code $newest_version = db_result($result, 0, 'snippet_version_id'); for ($i = 0; $i < $rows; $i++) { echo ' <TR class="' . util_get_alt_row_color($i) . '"> <TD><A HREF="/snippet/detail.php?type=snippet&id=' . db_result($result, $i, 'snippet_id') . '"><b><center>' . db_result($result, $i, 'snippet_version_id') . '</center></b></A></TD> <TD>'; echo '<A HREF="/snippet/download.php?type=snippet&id=' . db_result($result, $i, 'snippet_version_id') . '"><b><center>' . db_result($result, $i, 'version') . '</b></A>'; // For uploaded files, the user can choose between view or display the code snippet if (db_result($result, $i, 'filesize') != 0) { // View link : the file is forced to be displayed as a text echo ' <a href="/snippet/download.php?mode=view&type=snippet&id=' . db_result($result, $i, 'snippet_version_id') . '">'; echo '<img src="' . util_get_image_theme("ic/view.png") . '" border="0" alt="' . $Language->getText('snippet_details', 'view') . '" title="' . $Language->getText('snippet_details', 'view') . '"></a>'; // Download link : the file is forced to be downloaded echo ' <a href="/snippet/download.php?mode=download&type=snippet&id=' . db_result($result, $i, 'snippet_version_id') . '">'; echo '<img src="' . util_get_image_theme("ic/download.png") . '" border="0" alt="' . $Language->getText('snippet_details', 'download') . '" title="' . $Language->getText('snippet_details', 'download') . '"></a>'; } $user = UserManager::instance()->getUserByUserName(db_result($result, $i, 'user_name')); echo '</center></TD> <TD>' . db_result($result, $i, 'name') . '</TD><TD>' . UserHelper::instance()->getLinkOnUser($user) . '</TD></TR>'; } } echo '</TABLE>'; }
protected function displayAdminAllResponses(TrackerManager $tracker_manager, $request, $current_user) { $hp = Codendi_HTMLPurifier::instance(); $this->tracker->displayAdminItemHeader($tracker_manager, 'editcanned'); //Display existing responses $responses = Tracker_CannedResponseFactory::instance()->getCannedResponses($this->tracker); if (count($responses)) { echo '<h3>' . $GLOBALS['Language']->getText('plugin_tracker_include_canned', 'existing_responses') . '</h3>'; echo '<table cellspacing="0" cellpadding="4" border="0">'; $i = 0; foreach ($responses as $response) { echo '<tr class="' . util_get_alt_row_color($i++) . '" valign="top">'; //title echo '<td><a href="' . TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => 'admin-canned', 'edit' => (int) $response->id)) . '">'; echo '<strong>' . $hp->purify($response->title, CODENDI_PURIFIER_CONVERT_HTML) . '</strong></a>'; //excerpt echo '<pre>' . $hp->purify(substr($response->body, 0, 160), CODENDI_PURIFIER_CONVERT_HTML); echo strlen($response->body) > 160 ? '<b>...</b>' : ''; echo '</pre>'; echo '</td>'; //delete echo '<td><a href="' . TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => 'admin-canned', 'delete' => (int) $response->id)) . '" onClick="return confirm(\'' . addslashes($GLOBALS['Language']->getText('plugin_tracker_include_canned', 'delete_canned', $response->title)) . '\')">'; echo $GLOBALS['HTML']->getImage('ic/cross.png'); echo '</a></td></tr>'; } echo '</table>'; } else { echo '<h3>' . $GLOBALS['Language']->getText('plugin_tracker_include_canned', 'no_canned_response') . '</h3>'; } //Display creation form echo '<h3>' . $GLOBALS['Language']->getText('plugin_tracker_include_canned', 'create_response') . '</h3>'; echo '<p>'; echo $GLOBALS['Language']->getText('plugin_tracker_include_canned', 'save_time'); echo '<p>'; echo '<form action="' . TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => 'admin-canned')) . '" method="POST">'; echo '<b>' . $GLOBALS['Language']->getText('plugin_tracker_include_canned', 'title') . ':</b><br />'; echo '<input type="text" name="title" value="" size="50">'; echo '<p>'; echo '<b>' . $GLOBALS['Language']->getText('plugin_tracker_include_canned', 'message_body') . '</b><br />'; echo '<textarea name="body" rows="20" cols="65" wrap="hard"></textarea>'; echo '<p>'; echo '<input type="submit" name="create" value="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '" />'; echo '</from>'; $this->tracker->displayFooter($tracker_manager); }
function getContent() { $hp = Codendi_HTMLPurifier::instance(); $content = ''; if ($this->twitterfollow_user) { require_once 'common/rss/libs/SimplePie/simplepie.inc'; if (!is_dir($GLOBALS['codendi_cache_dir'] . '/rss')) { mkdir($GLOBALS['codendi_cache_dir'] . '/rss'); } $twitterfollow = new SimplePie($this->getFeedUrl($this->twitterfollow_user), $GLOBALS['codendi_cache_dir'] . '/rss', null, $GLOBALS['sys_proxy']); $max_items = 10; $items = array_slice($twitterfollow->get_items(), 0, $max_items); $content .= '<table width="100%">'; $i = 0; foreach ($items as $i => $item) { $content .= '<tr class="' . util_get_alt_row_color($i++) . '"><td WIDTH="99%">'; $content .= '<div style="float:right;">'; $content .= '<a title="Reply" href="' . $this->getReplyToUrl($this->twitterfollow_user, basename($item->get_link())) . '">'; $content .= $GLOBALS['HTML']->getImage('ic/twitter_reply.gif'); $content .= '</a>'; $content .= '</div>'; $content .= '<span'; if ($i == 1) { $content .= ' style="font-size:1.5em">'; if ($image = $item->get_link(0, 'image')) { //hack to display twitter avatar $image = preg_replace('/_normal\\.(jpg|png|gif)$/i', '_bigger.$1', $image); $content .= '<a href="http://twitter.com/' . urlencode($this->twitterfollow_user) . '">'; $content .= '<img src="' . $hp->purify($image, CODENDI_PURIFIER_CONVERT_HTML) . '" width="48" height="48" style="float:left; margin-right:1em;" />'; $content .= '</a>'; } } else { $content .= '>'; //end of <span } $content .= $item->get_title(); //Trust SimplePie for purifying if ($item->get_date()) { $content .= ' <span style="color:#999; white-space:nowrap;" title="' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $item->get_date('U')) . '">- ' . DateHelper::timeAgoInWords($item->get_date('U')) . '</span>'; } $content .= '</span>'; $content .= '</td></tr>'; } $content .= '</table>'; } return $content; }
function format_html_row($row, &$row_num) { echo "<tr class=\"" . util_get_alt_row_color($row_num++) . "\">\n"; foreach ($row as $cell) { $htmlattrs = ''; $value = ''; if (is_array($cell)) { if (isset($cell['value'])) { $value = $cell['value']; } if (isset($cell['html_attrs'])) { $htmlattrs = ' ' . $cell['html_attrs']; } } else { $value = $cell; } echo ' <td>' . $value . "</td>\n"; } echo "</tr>\n"; }
function showAvailableReports() { $hp = Codendi_HTMLPurifier::instance(); $g = $GLOBALS['ath']->getGroup(); $group_id = $g->getID(); $atid = $GLOBALS['ath']->getID(); $reports = $this->grf->getReports_ids(); echo '<H2>' . $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'tracker') . ' \'<a href="/tracker/admin/?group_id=' . $group_id . '&atid=' . $atid . '">' . $hp->purify($GLOBALS['ath']->getName()) . '</a>\'' . $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'report_admin') . '</H2>'; if ($reports) { // Loop through the list of all graphic reports $title_arr = array(); $title_arr[] = $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'report_name'); $title_arr[] = $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'desc'); $title_arr[] = $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'scope'); $title_arr[] = $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'delete'); echo '<p>' . $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'mod'); echo html_build_list_table_top($title_arr); for ($i = 0; $i < count($reports); $i++) { $r = new GraphOnTrackers_Report($reports[$i]); echo '<TR class="' . util_get_alt_row_color($i) . '"><TD>'; if ($r->getScope() == 'S' || !$GLOBALS['ath']->userIsAdmin() && $r->getScope() == 'P') { echo $hp->purify($r->getName()); } else { echo '<A HREF="/tracker/admin/?func=reportgraphic&group_id=' . $group_id . '&report_graphic_id=' . $r->getId() . '&atid=' . $GLOBALS['ath']->getID() . '">' . $hp->purify($r->getName()) . '</A>'; } echo "</td>" . "\n<td>" . $hp->purify($r->getDescription(), CODENDI_PURIFIER_BASIC) . '</td>' . "\n<td align=\"center\">" . $hp->purify($r->getScopeLabel($r->getScope())) . '</td>' . "\n<td align=\"center\">"; if ($r->getScope() == 'S' || !$GLOBALS['ath']->userIsAdmin() && $r->getScope() == 'P') { echo '-'; } else { $delete_report_text = $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'delete_report', $r->getName()); $delete_report_text_js = $hp->purify($delete_report_text, CODENDI_PURIFIER_JS_QUOTE); echo '<A HREF="/tracker/admin/?func=reportgraphic' . '&report_graphic_id=' . $r->getId() . '&group_id=' . $group_id . '&atid=' . $atid . '&delete_report_graphic=1"' . '" onClick="return confirm(\'' . $delete_report_text_js . '\')">' . '<img src="' . util_get_image_theme("ic/trash.png") . '" border="0"></A>'; } echo '</td></tr>'; } echo '</TABLE>'; } else { echo '<p><h3>' . $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'no_rep_def') . '</h3>'; } echo '<P> ' . $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'create_report', array('/tracker/admin/?func=reportgraphic&group_id=' . $group_id . '&atid=' . $atid . '&new_report_graphic=1')); }
/** * Display the artifact inverse dependencies list * * @param group_id: the group id * @param group_artifact_id: the artifact type ID * @param ascii: ascii mode * * @return void */ function showInverseDependencies($group_id, $group_artifact_id, $ascii = false) { $hp = Codendi_HTMLPurifier::instance(); global $sys_lf, $Language; // // format the dependencies list for this artifact // $result = $this->getInverseDependencies(); $rows = db_numrows($result); $out = ''; // Nobody in the dependencies list -> return now if ($rows <= 0) { if ($ascii) { $out = $Language->getText('tracker_include_artifact', 'no_depend') . "{$sys_lf}"; } else { $out = '<H4>' . $Language->getText('tracker_include_artifact', 'no_depend') . '</H4>'; } return $out; } // Header first an determine what the print out format is // based on output type (Ascii, HTML) if ($ascii) { $out .= $Language->getText('tracker_include_artifact', 'dep_list') . $sys_lf . str_repeat("*", strlen($Language->getText('tracker_include_artifact', 'dep_list'))) . "{$sys_lf}{$sys_lf}"; $fmt = "%-15s | %s (%s){$sys_lf}"; $out .= sprintf($fmt, $Language->getText('tracker_include_artifact', 'artifact'), $Language->getText('tracker_include_artifact', 'summary'), $Language->getText('global', 'status')); $out .= "------------------------------------------------------------------{$sys_lf}"; } else { $title_arr = array(); $title_arr[] = $Language->getText('tracker_include_artifact', 'artifact'); $title_arr[] = $Language->getText('tracker_include_artifact', 'summary'); $title_arr[] = $Language->getText('global', 'status'); $title_arr[] = $Language->getText('tracker_import_admin', 'tracker'); $title_arr[] = $Language->getText('tracker_include_artifact', 'group'); $out .= html_build_list_table_top($title_arr); $fmt = "\n" . '<TR class="%s"><td>%s</td><td>%s</td><td align="center">%s</td>' . '<td align="center">%s</td><td align="center">%s</td></tr>'; } // Loop through the denpendencies and format them for ($i = 0; $i < $rows; $i++) { $dependent_on_artifact_id = db_result($result, $i, 'artifact_id'); $summary = db_result($result, $i, 'summary'); $status = db_result($result, $i, 'status'); $tracker_label = db_result($result, $i, 'name'); $group_label = db_result($result, $i, 'group_name'); if ($ascii) { $out .= sprintf($fmt, $dependent_on_artifact_id, $summary, $status); } else { $out .= sprintf($fmt, util_get_alt_row_color($i), '<a href="/tracker/?func=gotoid&group_id=' . (int) $group_id . '&aid=' . (int) $dependent_on_artifact_id . '">' . (int) $dependent_on_artifact_id . '</a>', $hp->purify(util_unconvert_htmlspecialchars($summary), CODENDI_PURIFIER_CONVERT_HTML), $hp->purify($status, CODENDI_PURIFIER_CONVERT_HTML), $hp->purify(SimpleSanitizer::unsanitize($tracker_label), CODENDI_PURIFIER_CONVERT_HTML), $hp->purify(util_unconvert_htmlspecialchars($group_label), CODENDI_PURIFIER_CONVERT_HTML)); } // for } // final touch... $out .= $ascii ? "{$sys_lf}" : "</TABLE>"; return $out; }
/** * Display the list of attached files * * @param group_id: the group id * @param group_artifact_id: the artifact type ID * @param ascii: ascii mode * * @return void */ function showAttachedFiles($group_id, $group_artifact_id, $ascii = false, $pv = 0) { global $Language; $hp = $this->getHtmlPurifier(); // // show the files attached to this artifact // $result = $this->getAttachedFiles(); $rows = db_numrows($result); // No file attached -> return now if ($rows <= 0) { if ($ascii) { $out = $Language->getText('tracker_include_artifact', 'no_file_attached') . $GLOBALS['sys_lf']; } else { $out = '<H4>' . $Language->getText('tracker_include_artifact', 'no_file_attached') . '</H4>'; } return $out; } // Header first if ($ascii) { $out = $Language->getText('tracker_include_artifact', 'file_attachment') . $GLOBALS['sys_lf'] . str_repeat("*", strlen($Language->getText('tracker_include_artifact', 'file_attachment'))); } else { $title_arr = array(); $title_arr[] = $Language->getText('tracker_include_artifact', 'name'); $title_arr[] = $Language->getText('tracker_include_artifact', 'desc'); $title_arr[] = $Language->getText('tracker_include_artifact', 'size_kb'); $title_arr[] = $Language->getText('global', 'by'); $title_arr[] = $Language->getText('tracker_include_artifact', 'posted_on'); if ($pv == 0) { $title_arr[] = $Language->getText('tracker_include_canned', 'delete'); } $out = html_build_list_table_top($title_arr); } // Determine what the print out format is based on output type (Ascii, HTML) if ($ascii) { $fmt = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . "------------------------------------------------------------------" . $GLOBALS['sys_lf'] . $Language->getText('tracker_import_utils', 'date') . ": %s " . $Language->getText('tracker_include_artifact', 'name') . ": %s " . $Language->getText('tracker_include_artifact', 'size') . ": %dKB " . $Language->getText('global', 'by') . ": %s" . $GLOBALS['sys_lf'] . "%s" . $GLOBALS['sys_lf'] . "%s"; } else { $fmt = "" . $GLOBALS['sys_lf'] . '<TR class="%s"><td>%s</td><td>%s</td><td align="center">%s</td><td align="center">%s</td><td align="center">%s</td>'; if ($pv == 0) { $fmt .= '<td align="center">%s</td>'; } $fmt .= '</tr>'; } // Determine which protocl to use for embedded URL in ASCII format $server = get_server_url(); // Loop throuh the attached files and format them for ($i = 0; $i < $rows; $i++) { $artifact_file_id = db_result($result, $i, 'id'); $href = "/tracker/download.php?artifact_id=" . (int) $this->getID() . "&id=" . (int) $artifact_file_id; if ($ascii) { $out .= sprintf($fmt, format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 'adddate')), db_result($result, $i, 'filename'), intval(db_result($result, $i, 'filesize') / 1024), db_result($result, $i, 'user_name'), SimpleSanitizer::unsanitize(db_result($result, $i, 'description')), $server . $href); } else { // show CC delete icon if one of the condition is met: // (a) current user is group member // (b) the current user is the person who added a gieven name in CC list if (user_ismember($this->ArtifactType->getGroupID()) || user_getname(user_getid()) == db_result($result, $i, 'user_name')) { $html_delete = '<a href="?func=delete_file&group_id=' . (int) $group_id . "&atid=" . (int) $group_artifact_id . "&aid=" . (int) $this->getID() . "&id=" . (int) db_result($result, $i, 'id') . '" ' . ' onClick="return confirm(\'' . $Language->getText('tracker_include_artifact', 'delete_attachment') . '\')">' . '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" BORDER="0" ALT="' . $Language->getText('global', 'btn_delete') . '"></A>'; } else { $html_delete = '-'; } $out .= sprintf($fmt, util_get_alt_row_color($i), '<a href="' . $href . '">' . $hp->purify(db_result($result, $i, 'filename'), CODENDI_PURIFIER_CONVERT_HTML) . '</a>', $hp->purify(SimpleSanitizer::unsanitize(db_result($result, $i, 'description')), CODENDI_PURIFIER_BASIC, $group_id), intval(db_result($result, $i, 'filesize') / 1024), util_user_link(db_result($result, $i, 'user_name')), format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 'adddate')), $html_delete); } } // for // final touch... $out .= $ascii ? "" . $GLOBALS['sys_lf'] . "" : "</TABLE>"; return $out; }
protected function _showProjectAdmins() { $html = ''; $hp = Codendi_HTMLPurifier::instance(); $request = HTTPRequest::instance(); $vFunc = new Valid_WhiteList('plugin_admindelegation_func', array('show_admins')); $vFunc->required(); if ($request->valid($vFunc)) { $func = $request->get('plugin_admindelegation_func'); } else { $func = ''; } $vGroup = new Valid_String('plugin_admindelegation_group'); $vGroup->required(); if ($request->valid($vGroup)) { $pm = ProjectManager::instance(); $project = $pm->getProjectFromAutocompleter($request->get('plugin_admindelegation_group')); if ($project && $project->isActive()) { $groupValue = $project->getPublicName() . ' (' . $project->getUnixName() . ')'; } else { $groupValue = ''; } } else { $project = false; $groupValue = ''; } $html .= '<form method="post" action="?">'; $html .= '<label>' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_label') . '</label>'; $html .= '<input type="hidden" name="plugin_admindelegation_func" value="show_admins" />'; $html .= '<input type="text" name="plugin_admindelegation_group" value="' . $groupValue . '" size ="40" id="plugin_admindelegation_group" />'; $html .= ' '; $html .= '<input type="submit" value="' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_btn_search') . '"/>'; $html .= '</form>'; $js = "new ProjectAutoCompleter('plugin_admindelegation_group', '" . util_get_dir_image_theme() . "', false);"; $GLOBALS['HTML']->includeFooterJavascriptSnippet($js); if ($func == 'show_admins' && $project && $project->isActive()) { $allAdmins = array(); $users = $this->getProjectAdmins($project->getId()); if (count($users) > 0) { $uh = UserHelper::instance(); $html .= '<table width="100%">'; $html .= '<theader>'; $html .= '<tr>'; $html .= '<th>' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_name') . '</th>'; $html .= '<th>' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_email') . '</th>'; $html .= '</tr>'; $html .= '</theader>'; $html .= '<tbody>'; $i = 1; foreach ($users as $u) { $mailto = $u->getRealname() . ' <' . $u->getEmail() . '>'; $allAdmins[] = $mailto; $html .= '<tr class="' . util_get_alt_row_color($i++) . '">'; $html .= '<td>' . $hp->purify($uh->getDisplayNameFromUser($u)) . '</td>'; $html .= '<td><a href="mailto:' . $mailto . '">' . $u->getEmail() . '</a></td>'; $html .= '</tr>'; } $html .= '</tbody>'; $html .= '</table>'; // Mail to all admins $html .= '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">'; $html .= '<a href="mailto:' . implode(',', $allAdmins) . '?Subject=' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_mass_mail_subject', array($GLOBALS['sys_name'], $project->getPublicName())) . '">' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_mass_mail') . '</a>'; $html .= '</div>'; } } return $html; }
function show_commit_details($result) { global $group_id, $commit_id, $Language; /* Accepts a result set from the commits table. Should include all columns from the table, and it should be joined to USER to get the user_name. */ $rows = db_numrows($result); $url = "/cvs/?func=detailcommit&commit_id={$commit_id}&group_id={$group_id}&order="; $list_log = '<pre>' . util_make_links(util_line_wrap(db_result($result, 0, 'description')), $group_id) . '</pre>'; if ($commit_id) { $hdr = '[' . $Language->getText('cvs_commit_utils', 'commit') . $commit_id . '] - '; } else { $hdr = $Language->getText('cvs_commit_utils', 'checkin') . ' '; } echo '<h2>' . $hdr . uniformat_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, 0, 'c_when')) . '</h2></h2>'; echo '<table WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2"><tr class="' . util_get_alt_row_color(0) . '"><td>' . $list_log . '</td></tr></table>'; $crossref_fact = new CrossReferenceFactory($commit_id, ReferenceManager::REFERENCE_NATURE_CVSCOMMIT, $group_id); $crossref_fact->fetchDatas(); if ($crossref_fact->getNbReferences() > 0) { echo '<h3> ' . $Language->getText('cross_ref_fact_include', 'references') . '</h3>'; $crossref_fact->DisplayCrossRefs(); } echo '<h3>' . $Language->getText('cvs_commit_utils', 'impacted_file') . '</h3>'; $title_arr = array(); $title_arr[] = $Language->getText('cvs_commit_utils', 'file'); $title_arr[] = $Language->getText('cvs_commit_utils', 'rev'); $title_arr[] = $Language->getText('cvs_commit_utils', 'branch'); $title_arr[] = $Language->getText('cvs_commit_utils', 'type'); $title_arr[] = $Language->getText('cvs_commit_utils', 'added_line'); $title_arr[] = $Language->getText('cvs_commit_utils', 'removed_line'); $links_arr = array(); $links_arr[] = $url . 'filename'; $links_arr[] = $url . 'revision'; $links_arr[] = $url . 'branch'; $links_arr[] = $url . 'type'; $links_arr[] = $url . 'addedlines'; $links_arr[] = $url . 'removedlines'; echo html_build_list_table_top($title_arr, $links_arr); for ($i = 0; $i < $rows; $i++) { $commit_id = db_result($result, $i, 'id'); $type = db_result($result, $i, 'type'); $added = db_result($result, $i, 'addedlines'); $removed = db_result($result, $i, 'removedlines'); $revision = db_result($result, $i, 'revision'); $filename = db_result($result, $i, 'dir') . '/' . db_result($result, $i, 'file'); $type_text = $Language->getText('cvs_commit_utils', strtolower($type)); if ($type == "Change" && $added == 999 && $removed == 999) { // the default values // back to rcs to complete $repo = db_result($result, $i, 'repository'); $command = "rlog -r" . $revision . " " . $repo . "/" . $filename; $output = array(); exec($command, $output, $ret); $added = 0; $removed = 0; $l = 0; while ($l < count($output)) { // parse the rlog result till getting "state: Exp; lines:" $line = $output[$l]; $l++; if (ereg('state: +Exp; +lines: +\\+([0-9]*) +\\-([0-9]*)$', $line, $na)) { $added = $na[1]; $removed = $na[2]; $sql_up = "UPDATE cvs_checkins SET addedlines=" . $added . ", removedlines=" . $removed . " WHERE repositoryid=" . db_result($result, $i, 'repositoryid') . " AND dirid=" . db_result($result, $i, 'dirid') . " AND fileid=" . db_result($result, $i, 'fileid') . " AND revision=" . $revision; $res = db_query($sql_up); break; } } } if (!$filename) { $filename = ''; } else { if ($type == 'Remove') { $filename = makeCvsDirLink($group_id, db_result($result, $i, 'file'), $filename, db_result($result, $i, 'dir')); $rev_text = ''; } else { // Clean file path to remove duplicate separators $filename = preg_replace('/\\/\\//', '/', $filename); $filename = preg_replace('/\\.\\//', '', $filename); if ($type == 'Change') { // horrible hack to 'guess previous revision' to diff with $prev = explode(".", $revision); $lastIndex = sizeof($prev); $lastIndex = $lastIndex - 1; if ($prev[$lastIndex] != '1') { $prev[$lastIndex] = $prev[$lastIndex] - 1; $previous = join(".", $prev); } else { $index = 0; $new_prev = array(); while ($index <= $lastIndex - 2) { $new_prev[$index] = $prev[$index]; $index++; } $previous = join('.', $new_prev); } $type = makeCvsLink($group_id, $filename, $type_text, '', '&r1=' . $previous . '&r2=' . $revision); } $rev_text = makeCvsLink($group_id, $filename, $revision, $revision, '&view=markup'); $filename = makeCvsLink($group_id, $filename, $filename, '', '&view=log'); } } ##$commits_url = '<A HREF="/commits/download.php/Commits'.$commit_id.'.txt?commit_id='.$id.'">'.$filename.'</a>'; echo ' <TR class="' . util_get_alt_row_color($i) . '">' . '<TD class="small"><b>' . $filename . '</b></TD>' . '<TD class="small">' . $rev_text . '</TD>' . '<TD class="small">' . db_result($result, $i, 'branch') . '</TD>' . '<TD class="small">' . $type . '</TD>' . '<TD class="small">' . $added . '</TD>' . '<TD class="small">' . $removed . '</TD></TR>'; } /* Show extra rows for <-- Prev / Next --> */ echo ' <TR><TD COLSPAN="2" class="small">'; if ($offset > 0) { echo '<A HREF="?func=browse&group_id=' . $group_id . '&set=' . $set . '&offset=' . ($offset - 50) . '"><B>< ' . $Language->getText('global', 'prev') . '</B></A>'; } else { echo ' '; } echo '</TD><TD> </TD><TD COLSPAN="2" class="small">'; if ($rows == 50) { echo '<A HREF="?func=browse&group_id=' . $group_id . '&set=' . $set . '&offset=' . ($offset + 50) . '"><B>' . $Language->getText('global', 'prev') . ' 50 ></B></A>'; } else { echo ' '; } echo '</TD></TR></TABLE>'; }
function display_exported_fields($col_list, $lbl_list, $dsc_list, $sample_val, $mand_list = false) { global $Language; $title_arr = array(); $title_arr[] = $Language->getText('project_export_utils', 'label'); $title_arr[] = $Language->getText('project_export_utils', 'sample_val'); $title_arr[] = $Language->getText('project_admin_editugroup', 'desc'); echo html_build_list_table_top($title_arr); reset($col_list); $cnt = 0; while (list(, $col) = each($col_list)) { $star = $mand_list && isset($mand_list[$col]) && $mand_list[$col] ? ' <span class="highlight"><big>*</big></b></span>' : ''; echo '<tr class="' . util_get_alt_row_color($cnt++) . '">' . '<td><b>' . $lbl_list[$col] . '</b>' . $star . '</td><td>' . nl2br($sample_val[$col]) . '</td><td>' . $dsc_list[$col] . '</td></tr>'; } echo '</table>'; }
function svn_utils_show_revision_detail($result, $group_id, $group_name, $commit_id) { global $Language; /* Accepts a result set from the svn_checkins table. Should include all columns from the table, and it should be joined to USER to get the user_name. */ $rows = db_numrows($result); $url = "/svn/?func=detailrevision&commit_id={$commit_id}&group_id={$group_id}&order="; $list_log = '<pre>' . util_make_links(util_line_wrap(db_result($result, 0, 'description')), $group_id) . '</pre>'; $revision = db_result($result, 0, 'revision'); $hdr = '[' . $Language->getText('svn_browse_revision', 'rev') . ' #' . $revision . '] - '; echo '<h2>' . $hdr . format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, 0, 'date')) . '</h2></h2>'; echo '<table WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2"><tr class="' . util_get_alt_row_color(0) . '"><td>' . $list_log . '</td></tr></table>'; $crossref_fact = new CrossReferenceFactory($revision, ReferenceManager::REFERENCE_NATURE_SVNREVISION, $group_id); $crossref_fact->fetchDatas(); if ($crossref_fact->getNbReferences() > 0) { echo '<h3> ' . $Language->getText('cross_ref_fact_include', 'references') . '</h3>'; $crossref_fact->DisplayCrossRefs(); } echo '<h3> ' . $Language->getText('svn_utils', 'impacted_files') . '</h3>'; $title_arr = array(); $title_arr[] = $Language->getText('svn_utils', 'file'); $title_arr[] = $Language->getText('svn_browse_revision', 'rev'); $title_arr[] = $Language->getText('svn_utils', 'type'); //$title_arr[]='AddedLines'; To be implemented //$title_arr[]='RemovedLines'; To be implemented $links_arr = array(); $links_arr[] = $url . 'filename'; $links_arr[] = $url . ''; $links_arr[] = $url . 'type'; $pm = ProjectManager::instance(); $project = $pm->getProject($group_id); $root = $project->getUnixName(); echo html_build_list_table_top($title_arr, $links_arr); for ($i = 0; $i < $rows; $i++) { $type = db_result($result, $i, 'type'); $dirname = db_result($result, $i, 'dir'); $filename = db_result($result, $i, 'file'); $fullpath = $dirname . $filename; if ($filename) { // It' a file $viewfile_url = svn_utils_make_viewlink($group_name, $fullpath, $fullpath, "&pathrev={$revision}&view=log"); $viewrev_url = svn_utils_make_viewlink($group_name, $fullpath, $revision, "&revision={$revision}&pathrev={$revision}&view=markup"); } else { // It' a directory $viewfile_url = svn_utils_make_viewlink($group_name, $fullpath, $fullpath, "&pathrev={$revision}"); $viewrev_url = svn_utils_make_viewlink($group_name, $fullpath, $revision, "&pathrev={$revision}&view=log"); } if ($type == 'Change') { $viewtype_url = svn_utils_make_viewlink($group_name, $fullpath, $Language->getText('svn_utils', 'change'), "&r1=" . ($revision - 1) . "&r2={$revision}&diff_format=h&pathrev={$revision}"); } else { if ($type == 'Add') { $viewtype_url = $Language->getText('svn_utils', 'add'); } else { if ($type == 'Delete') { $viewtype_url = $Language->getText('svn_utils', 'del'); } } } echo ' <TR class="' . util_get_alt_row_color($i) . '">' . '<TD class="small"><b>' . $viewfile_url . '</b></TD>' . '<TD class="small" width="10%" align="center">' . $viewrev_url . '</TD>' . '<TD class="small" width="10%" align="center">' . $viewtype_url . '</TD>'; //'<TD class="small">'.$added.'</TD>'. // To be done //'<TD class="small">'.$removed.'</TD></TR>'; // To be done } echo '</TD></TR></TABLE>'; }
<FORM ACTION="?" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="post_changes" VALUE="y"> <INPUT TYPE="HIDDEN" NAME="change_status" VALUE="y"> <INPUT TYPE="HIDDEN" NAME="group_forum_id" VALUE="' . db_result($result, $i, 'group_forum_id') . '"> <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $group_id . '"> <TD> <FONT SIZE="-1"> <B>' . $Language->getText('forum_admin_index', 'is_public') . '</B><BR> <INPUT TYPE="RADIO" NAME="is_public" VALUE="1"' . (db_result($result, $i, 'is_public') == '1' ? ' CHECKED' : '') . '> ' . $Language->getText('global', 'yes') . '<BR> <INPUT TYPE="RADIO" NAME="is_public" VALUE="0"' . (db_result($result, $i, 'is_public') == '0' ? ' CHECKED' : '') . '> ' . $Language->getText('global', 'no') . '<BR> <INPUT TYPE="RADIO" NAME="is_public" VALUE="9"' . (db_result($result, $i, 'is_public') == '9' ? ' CHECKED' : '') . '> ' . $Language->getText('forum_admin_index', 'deleted') . '<BR> </TD><TD> <FONT SIZE="-1"> <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="' . $Language->getText('global', 'btn_submit') . '"> </TD></TR> <TR class="' . util_get_alt_row_color($i) . '"><TD COLSPAN="4"> <B>' . $Language->getText('forum_admin_index', 'forum_name') . ':</B><BR> <INPUT TYPE="TEXT" NAME="forum_name" VALUE="' . db_result($result, $i, 'forum_name') . '" SIZE="30" MAXLENGTH="50"><BR> <B>' . $Language->getText('forum_admin_index', 'description') . ':</B><BR> <INPUT TYPE="TEXT" NAME="description" VALUE="' . db_result($result, $i, 'description') . '" SIZE="60" MAXLENGTH="255"><BR> </TD></TR></FORM>'; } echo '</TABLE>'; } forum_footer(array()); } else { /* Show main page for choosing either moderotor or delete */ forum_header(array('title' => $Language->getText('forum_admin_index', 'forum_admin'), 'help' => 'communication.html#web-forums'));
/** * Display all reminders of the tracker * * @return Void */ public function displayAllReminders() { $titles = array($GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'tracker_date_reminder_send_to'), $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'tracker_date_reminder_notification_when'), $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'tracker_date_reminder_field'), $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'tracker_date_reminder_actions')); $i = 0; $trackerReminders = $this->dateReminderFactory->getTrackerReminders(true); if (!empty($trackerReminders)) { $output = html_build_list_table_top($titles, false, false, false); foreach ($trackerReminders as $reminder) { if ($reminder->getStatus() == 1) { $output .= '<tr class="' . util_get_alt_row_color($i++) . '">'; } else { $output .= '<tr class="tracker_date_reminder">'; } $output .= '<td>' . $reminder->getUgroupsLabel() . '</td>'; $output .= '<td>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'tracker_date_reminder_notification_details', array($reminder->getDistance(), $reminder->getNotificationTypeLabel())) . '</td>'; $output .= '<td>' . $reminder->getField()->getLabel() . '</td>'; $output .= '<td><span style="float:left;"><a href="?func=admin-notifications&tracker=' . (int) $this->tracker->id . '&reminder_id=' . (int) $reminder->getId() . '&action=update_reminder" id="update_reminder"> ' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'tracker_date_reminder_update_action') . ' ' . $GLOBALS['Response']->getimage('ic/edit.png') . '</a></span>'; $output .= ' <span style="float:right;"><a href="?func=admin-notifications&tracker=' . (int) $this->tracker->id . '&action=delete_reminder&reminder_id=' . $reminder->getId() . '" id="delete_reminder"> ' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'tracker_date_reminder_delete_action') . ' ' . $GLOBALS['Response']->getimage('ic/bin.png') . '</a></span></td>'; $output .= '</tr>'; } $output .= '</table>'; return $output; } }
protected function displayDependenciesMatrix($source_field, $target_field, $dependencies = null) { $source_field_values = $source_field->getVisibleValuesPlusNoneIfAny(); $target_field_values = $target_field->getVisibleValuesPlusNoneIfAny(); $nb_target_field_values = count($target_field_values); echo '<form action="' . TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'source_field' => $source_field->getId(), 'target_field' => $target_field->getId(), 'func' => 'admin-dependencies')) . '" method="POST">'; echo '<table id="tracker_field_dependencies_matrix">'; echo "<tr class=\"" . util_get_alt_row_color(1) . "\">\n"; echo "<td></td>"; foreach ($target_field_values as $target_field_value_id => $target_field_value) { echo '<td class="matrix_cell">' . $target_field_value->getLabel() . "</td>"; } echo "</tr>"; $dependencies = $this->getDependenciesBySourceTarget($this->tracker->id, $source_field->getId(), $target_field->getId()); $j = 0; //Display the available transitions foreach ($source_field_values as $source_field_value_id => $source_field_value) { echo "<tr class=\"" . util_get_alt_row_color($j) . "\">\n"; echo "<td>" . $source_field_value->getLabel() . "</td>"; foreach ($target_field_values as $target_field_value_id => $target_field_value) { $box_value = $source_field_value_id . '_' . $target_field_value_id; $this->displayCheckbox($source_field_value_id, $target_field_value_id, $dependencies, $box_value); } echo "</tr>\n"; $j++; } echo '</table>'; echo '<a href="' . TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => 'admin-dependencies')) . '">'; echo '« ' . $GLOBALS['Language']->getText('global', 'btn_cancel'); echo '</a> '; echo '<input type="submit" name="create_field_dependencies" value="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '" />'; echo '</FORM>'; }
protected function displayCSVImportOverview($project, $group_id, $user) { $hp = Codendi_HTMLPurifier::instance(); $breadcrumbs = array(); $toolbar = array(); $params = array(); $this->displayHeader($project, $GLOBALS['Language']->getText('plugin_tracker', 'trackers'), $breadcrumbs, $toolbar, $params); $html = ''; $tf = TrackerFactory::instance(); $trackers = $tf->getTrackersByGroupId($group_id); // Show all the fields currently available in the system echo '<table width="100%" border="0" cellspacing="1" cellpadding="2">'; echo ' <tr class="boxtable">'; echo ' <td class="boxtitle"> </td>'; echo ' <td class="boxtitle">'; echo ' <div align="center"><b>' . $GLOBALS['Language']->getText('plugin_tracker_import_admin', 'art_data_import') . '</b></div>'; echo ' </td>'; echo ' <td class="boxtitle">'; echo ' <div align="center"><b>' . $GLOBALS['Language']->getText('plugin_tracker_import_admin', 'import_format') . '</b></div>'; echo ' </td>'; echo ' </tr>'; $cpt = 0; foreach ($trackers as $tracker) { if ($tracker->userIsAdmin($user)) { echo '<tr class="' . util_get_alt_row_color($cpt) . '">'; echo ' <td><b>' . $GLOBALS['Language']->getText('plugin_tracker_import_admin', 'tracker') . ': ' . $hp->purify($tracker->getName(), CODENDI_PURIFIER_CONVERT_HTML) . '</b></td>'; echo ' <td align="center"><a href="' . TRACKER_BASE_URL . '/?tracker=' . (int) $tracker->getID() . '&func=admin-csvimport">' . $GLOBALS['Language']->getText('plugin_tracker_import_admin', 'import') . '</a></td>'; echo ' <td align="center"><a href="' . TRACKER_BASE_URL . '/?tracker=' . (int) $tracker->getID() . '&func=csvimport-showformat">' . $GLOBALS['Language']->getText('plugin_tracker_import_admin', 'show_format') . '</a></td>'; echo '</tr>'; } } echo '</table>'; $this->displayFooter($project); }
function stats_site_projects_weekly($span = 14) { global $Language; if (!$span) { $span = 14; } // Get information about the date $span days ago $begin_date = localtime(time() - $span * 86400, 1); $year = $begin_date["tm_year"] + 1900; $month = sprintf("%02d", $begin_date["tm_mon"] + 1); $day = $begin_date["tm_mday"]; $sql = "SELECT month,day,AVG(group_ranking),AVG(group_metric),SUM(downloads),SUM(site_views),SUM(subdomain_views),"; $sql .= "SUM(msg_posted),SUM(bugs_opened),SUM(bugs_closed),SUM(support_opened),"; $sql .= "SUM(support_closed),SUM(patches_opened),SUM(patches_closed),SUM(tasks_opened),"; $sql .= "SUM(tasks_closed),SUM(cvs_commits),SUM(cvs_adds),SUM(svn_access_count)"; $sql .= "FROM stats_project, groups "; $sql .= "WHERE groups.groups_id = stats_project.group_id AND groups.type = 1 AND "; $sql .= "( ( month = " . $year . $month . " AND day >= " . $day . " ) OR "; $sql .= "( month > " . $year . $month . " ) ) "; $sql .= "GROUP BY month,day ORDER BY month DESC, day DESC"; // Executions will continue until morale improves. $res = db_query($sql); print db_error($res); // if there are any weeks, we have valid data. if (($valid_days = db_numrows($res)) > 1) { print '<P><B>' . $Language->getText('stats_site_stats_utils', 'stats_for_past_x_days', $valid_days) . '</B></P>'; print '<P><TABLE width="100%" cellpadding=0 cellspacing=0 border=0>' . '<TR valign="top">' . '<TD><B>' . $Language->getText('stats_site_stats_utils', 'day_gmt') . '</B></TD>' . '<TD align="right"><B>' . $Language->getText('stats_site_stats_utils', 'site_views') . '</B></TD>' . '<TD align="right"><B>' . $Language->getText('stats_site_stats_utils', 'subdomain_views') . '</B></TD>' . '<TD align="right"><B>' . $Language->getText('stats_site_stats_utils', 'downl') . '</B></TD>' . '<TD align="right"><B>' . $Language->getText('stats_site_stats_utils', 'bugs') . '</B></TD>' . '<TD align="right"><B>' . $Language->getText('stats_site_stats_utils', 'support') . '</B></TD>' . '<TD align="right"><B>' . $Language->getText('stats_site_stats_utils', 'patches') . '</B></TD>' . '<TD align="right"><B>' . $Language->getText('stats_site_stats_utils', 'tasks') . '</B></TD>' . '<TD align="right"><B>' . $Language->getText('stats_site_stats_utils', 'cvs') . '</B></TD>' . '</TR>' . "\n"; while ($row = db_fetch_array($res)) { $i++; print '<TR class="' . util_get_alt_row_color($i) . '">' . '<TD>' . gmstrftime("%d %b %Y", mktime(0, 0, 1, substr($row["month"], 4, 2), $row["day"], substr($row["month"], 0, 4))) . '</TD>' . '<TD align="right">' . number_format($row["SUM(site_views)"]) . '</TD>' . '<TD align="right">' . number_format($row["SUM(subdomain_views)"]) . '</TD>' . '<TD align="right">' . number_format($row["SUM(downloads)"]) . '</TD>' . '<TD align="right"> ' . $row["SUM(bugs_opened)"] . " ( " . $row["SUM(bugs_closed)"] . ' )</TD>' . '<TD align="right"> ' . $row["SUM(support_opened)"] . " ( " . $row["SUM(support_closed)"] . ' )</TD>' . '<TD align="right"> ' . $row["SUM(patches_opened)"] . " ( " . $row["SUM(patches_closed)"] . ' )</TD>' . '<TD align="right"> ' . $row["SUM(tasks_opened)"] . " ( " . $row["SUM(tasks_closed)"] . ' )</TD>' . '<TD align="right"> ' . $row["SUM(cvs_checkouts)"] . " ( " . $row["SUM(cvs_commits)"] . ' )</TD>' . '</TR>' . "\n"; } print '</TABLE>'; } else { echo $Language->getText('stats_site_stats_utils', 'proj_not_exist'); } }
/** * * Displays the table of service evolution for a given period * for a specific project if the group_id is given else for all projects * * @param Date $startDate * @param Date $endDate * @param Integer $groupId * @param Boolean $colored * */ public function getServiceEvolutionForPeriod($startDate, $endDate, $groupId = NULL, $colored = false) { $res = $this->_dum->returnServiceEvolutionForPeriod($startDate, $endDate, $groupId); if ($res) { $services = $this->_dum->getProjectServices(); $titles = array('Service', 'Start size', 'End size', 'Size evolution', 'Rate evolution'); echo html_build_list_table_top($titles); $totalStartSize = 0; $totalEndSize = 0; $totalEvolution = 0; $i = 0; foreach ($res as $row) { echo '<tr class="' . util_get_alt_row_color($i++) . '">'; echo '<td>'; if ($colored) { $color = $GLOBALS['HTML']->getColorCodeFromColorName($this->_dum->getServiceColor($row['service'])); $color = $this->applyColorModifier($color . ':1.5'); echo '<span class="plugin_statistics_table_legend" style="background-color:' . $color . ';"> </span>'; } echo $services[$row['service']] . '</td>'; $totalStartSize += $row['start_size']; $totalEndSize += $row['end_size']; $totalEvolution += $row['evolution']; $this->_displayEvolutionData($row); echo '</tr>'; } echo '<tr class="' . util_get_alt_row_color($i++) . '">'; echo '<th>Total size</th>'; echo '<td>' . $this->sizeReadable($totalStartSize) . '</td>'; echo '<td>' . $this->sizeReadable($totalEndSize) . '</td>'; echo '<td>' . $this->sizeReadable($totalEvolution) . '</td>'; if ($totalEvolution == 0 || $totalStartSize == 0) { echo '<td>-</td>'; } else { echo '<td>' . sprintf('%01.2f %%', ($totalEndSize / $totalStartSize - 1) * 100) . '</td>'; } echo '</tr>'; echo '</tbody>'; echo '</table>'; } }
protected function displayAdminNotifications_Personnal($current_user) { $user_id = $current_user->getId(); $hp = Codendi_HTMLPurifier::instance(); // Build Wachees UI $arr_watchees = array(); foreach ($this->getWatcherDao()->searchWatchees($this->tracker->id, $current_user->getId()) as $row) { $arr_watchees[] = user_getname($row['watchee_id']); } $watchees = join(',', $arr_watchees); echo '<h3>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'perso_mail_notif') . '</h3>'; if ($this->tracker->userIsAdmin()) { // To watch other users you must have at least admin rights on the tracker echo ' <h4>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'users_to_watch') . ' ' . help_button('TrackerV5Administration.html#TrackerV5Watchers') . '</h4> <P>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'backup_person') . ' <p><INPUT TYPE="TEXT" NAME="watchees" VALUE="' . $hp->purify($watchees, CODENDI_PURIFIER_CONVERT_HTML) . '" SIZE="55" MAXLENGTH="255"><br></p> '; $watchers = ""; foreach ($this->getWatcherDao()->searchWatchers($this->tracker->id, $current_user->getId()) as $row) { $watcher_name = user_getname($row_watcher['user_id']); $watchers .= '<a href="/users/' . urlencode($watcher_name) . '">' . $hp->purify($watcher_name, CODENDI_PURIFIER_CONVERT_HTML) . '</a>,'; } $watchers = substr($watchers, 0, -1); // remove extra comma at the end if ($watchers) { echo "<p>" . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'watchers', $hp->purify($watchers, CODENDI_PURIFIER_CONVERT_HTML)); } else { echo "<p>" . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'no_watcher'); } echo '<br><br>'; } // Build Role/Event table $dar_roles = $this->getNotificationDao()->searchRoles($this->tracker->id); $num_roles = $dar_roles->rowCount(); $dar_events = $this->getNotificationDao()->searchEvents($this->tracker->id); $num_events = $dar_events->rowCount(); $arr_notif = array(); // By default it's all 'yes' foreach ($dar_roles as $role) { foreach ($dar_events as $event) { $arr_notif[$role['role_label']][$event['event_label']] = 1; } } foreach ($this->getNotificationDao()->searchNotification($this->tracker->id, $current_user->getId()) as $arr) { $arr_notif[$arr['role_label']][$arr['event_label']] = $arr['notify']; } // Rk: Can't use html_build_list_table_top because of the specific layout echo '<h4>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'event_settings') . ' ' . help_button('TrackerV5Administration.html#TrackerV5EventRoleBasedEmailNotification') . '</h4> <P>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tune_settings'); echo ' <table BORDER="0" CELLSPACING="1" CELLPADDING="2" class="small"> <tr class="boxtitle"> <td colspan="' . (int) $num_roles . '" align="center" width="50%"><b>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'role_is') . '</b></td> <td rowspan="2" width="50%"><b> ' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'notify_me') . '</b></td> </tr>'; $dar_roles->rewind(); foreach ($dar_roles as $role) { echo '<td align="center" width="10%"><b>' . $GLOBALS['Language']->getText('plugin_tracker_common_types', $role['short_description_msg']) . "</b></td>\n"; } echo "</tr>\n"; $dar_events->rewind(); $dar_roles->rewind(); $i = 0; foreach ($dar_events as $event) { $event_label = $event['event_label']; echo "<tr class=\"" . util_get_alt_row_color($i++) . "\">\n"; foreach ($dar_roles as $role) { $role_label = $role['role_label']; $cbox_name = 'cb_' . $role['role_id'] . '_' . $event['event_id']; if ($event_label == 'NEW_ARTIFACT' && $role_label != 'ASSIGNEE' && $role_label != 'SUBMITTER' || $event_label == 'ROLE_CHANGE' && $role_label != 'ASSIGNEE' && $role_label != 'CC') { // if the user is not a member then the ASSIGNEE column cannot // be set. If it's not an assignee or a submitter the new_artifact event is meaningless echo ' <td align="center"><input type="hidden" name="' . $cbox_name . '" value="1">-</td>' . "\n"; } else { echo ' <td align="center"><input type="checkbox" name="' . $cbox_name . '" value="1" ' . ($arr_notif[$role_label][$event_label] ? 'checked' : '') . "></td>\n"; } } echo ' <td> ' . $GLOBALS['Language']->getText('plugin_tracker_common_types', $event['description_msg']) . "</td>\n"; echo "</tr>\n"; } echo ' </table>'; }
/** * Display the field sets list * * @return void */ function displayFieldSetList() { global $ath, $art_fieldset_fact, $Language; $hp = Codendi_HTMLPurifier::instance(); echo '<h3>' . $Language->getText('tracker_include_type', 'list_all_fieldsets') . '</h3>'; echo '<p>' . $Language->getText('tracker_include_report', 'mod'); // Show all the fields currently available in the system $i = 0; $title_arr = array(); $title_arr[] = $Language->getText('tracker_include_type', 'fieldset_name'); $title_arr[] = $Language->getText('tracker_include_artifact', 'desc'); $title_arr[] = $Language->getText('tracker_include_type', 'fields_inside'); $title_arr[] = $Language->getText('tracker_include_type', 'rank_screen'); $title_arr[] = $Language->getText('tracker_include_canned', 'delete'); echo html_build_list_table_top($title_arr); // Build HTML ouput for Used fields $iu = 0; $fieldsets = $art_fieldset_fact->getAllFieldSets(); $html = ""; foreach ($fieldsets as $fieldset) { $rank = $fieldset->getRank() ? $fieldset->getRank() : "-"; $html .= '<tr class="' . util_get_alt_row_color($iu) . '">'; $html .= '<td><a href="?group_id=' . (int) $this->Group->getID() . "&atid=" . (int) $this->getID() . '&func=display_fieldset_update&fieldset_id=' . (int) $fieldset->getID() . '">' . $hp->purify(SimpleSanitizer::unsanitize($fieldset->getLabel()), CODENDI_PURIFIER_CONVERT_HTML) . '</A></td>'; $html .= '<td>' . $hp->purify(SimpleSanitizer::unsanitize($fieldset->getDescriptionText()), CODENDI_PURIFIER_BASIC, $this->getGroupId()) . '</td>'; $html .= '<td>'; $fields_contained = $fieldset->getArtifactFields(); if (count($fields_contained) > 0) { $html .= '<ul>'; foreach ($fields_contained as $field_contained) { $link_field_usage = '/tracker/admin/?func=display_field_update&group_id=' . (int) $this->Group->getID() . '&atid=' . (int) $this->getID() . '&field_id=' . (int) $field_contained->getID(); $html .= '<li>'; if ($field_contained->getUseIt()) { $html .= '<strong><a href="' . $link_field_usage . '">' . $hp->purify(SimpleSanitizer::unsanitize($field_contained->getLabel()), CODENDI_PURIFIER_CONVERT_HTML) . '</a></strong>'; } else { $html .= '<em><a href="' . $link_field_usage . '">' . $hp->purify(SimpleSanitizer::unsanitize($field_contained->getLabel()), CODENDI_PURIFIER_CONVERT_HTML) . '</a></em>'; } $html .= '</li>'; } $html .= '</ul>'; } else { $html .= '- - -'; // $Language-> getText('tracker_include_type','empty_fieldset'); } $html .= '</td>'; $html .= '<td align="center">' . $hp->purify($rank, CODENDI_PURIFIER_CONVERT_HTML) . '</td>'; $html .= '<td align="center">'; // Only possible to delete empty field sets (containing no fields inside) if (count($fields_contained) <= 0) { $html .= '<a href="/tracker/admin/?func=fieldset_delete&group_id=' . (int) $this->Group->getID() . '&atid=' . (int) $this->getID() . '&fieldset_id=' . (int) $fieldset->getID() . '"><img src="' . util_get_image_theme("ic/trash.png") . '" border="0" onClick="return confirm(\'' . $Language->getText('tracker_include_type', 'warning_delete_fieldset') . '\')"></a>'; } $html .= '</td>'; $html .= '</tr>'; $iu++; } echo $html; echo '</table>'; echo '<hr>'; }
function display($data) { echo '<p>' . $GLOBALS['Language']->getText('register_services', 'desc') . '</p>'; $sf = new ServerFactory(); $servers = $sf->getAllServers(); $can_display_servers = count($servers) > 1; $pm = ProjectManager::instance(); $p = $pm->getProject($data['project']['built_from_template']); $title_arr = array(); $title_arr[] = ''; //$GLOBALS['Language']->getText('project_admin_editservice','enabled'); $title_arr[] = $GLOBALS['Language']->getText('project_admin_editservice', 's_label'); $title_arr[] = $GLOBALS['Language']->getText('project_admin_editservice', 's_desc'); if ($can_display_servers) { $title_arr[] = $GLOBALS['Language']->getText('register_services', 'server'); } echo html_build_list_table_top($title_arr); $row_num = 0; foreach ($p->services as $key => $nop) { if (!in_array($p->services[$key]->getShortName(), array('summary', 'admin')) && $p->services[$key]->isActive() && !$p->services[$key]->isRestricted()) { $short_name = $p->services[$key]->getShortName(); $description = $p->services[$key]->getDescription(); $label = $p->services[$key]->getLabel(); $id = $p->services[$key]->getId(); $is_used = isset($data['project']['services'][$id]['is_used']) ? $data['project']['services'][$id]['is_used'] : $p->services[$key]->isUsed(); $matches = array(); if ($description == "service_" . $short_name . "_desc_key") { $description = $GLOBALS['Language']->getText('project_admin_editservice', $description); } elseif (preg_match('/(.*):(.*)/', $description, $matches)) { $description = $GLOBALS['Language']->getText($matches[1], $matches[2]); } if ($label == "service_" . $short_name . "_lbl_key") { $label = $GLOBALS['Language']->getText('project_admin_editservice', $label); } elseif (preg_match('/(.*):(.*)/', $label, $matches)) { $label = $GLOBALS['Language']->getText($matches[1], $matches[2]); } echo '<tr class="' . util_get_alt_row_color($row_num++) . '">'; //{{{ is_used echo '<td>'; $field_name = 'services[' . $id . '][is_used]'; $checked = $is_used ? 'checked="checked"' : ''; echo '<input type="hidden" name="' . $field_name . '" value="0" />'; echo '<input type="checkbox" id="project_register_service_is_used_' . $id . '" name="' . $field_name . '" value="1" ' . $checked . ' />'; echo '</td>'; //}}} echo '<td>' . $label . '</td>'; echo '<td>' . $description . '</td>'; //{{{ server if ($can_display_servers) { echo '<td style="text-align:center">'; if ($short_name == 'svn' || $short_name == 'file') { echo '<select name="services[' . $id . '][server_id]">'; foreach ($servers as $server_key => $nop) { $selected = $servers[$server_key]->getId() == $p->services[$key]->getServerId() ? 'selected="selected"' : ''; echo '<option value="' . $servers[$server_key]->getId() . '" ' . $selected . '>' . $servers[$server_key]->getName() . '</option>'; } echo '</select>'; } else { echo '-'; echo '<input type="hidden" name="services[' . $id . '][server_id]" value="' . $p->services[$key]->getServerId() . '" />'; } echo '</td>'; } //}}} echo '</tr>'; } } echo '</table>'; }