function getContent() { $content = ''; $uh = UserHelper::instance(); if (is_a($this->item, 'Docman_File')) { $content .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions') . '</h3>'; $version_factory =& new Docman_VersionFactory(); $approvalFactory =& Docman_ApprovalTableFactory::getFromItem($this->item); if ($versions = $version_factory->getAllVersionForItem($this->item)) { if (count($versions)) { $titles = array(); $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_version'); $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_date'); $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_author'); $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_label'); $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_changelog'); $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_approval'); $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_delete_version'); $content .= html_build_list_table_top($titles, false, false, false); $odd_even = array('boxitem', 'boxitemalt'); $i = 0; foreach ($versions as $key => $nop) { $download = Docman_View_View::buildUrl($this->url, array('action' => 'show', 'id' => $this->item->getId(), 'version_number' => $versions[$key]->getNumber())); $delete = Docman_View_View::buildUrl($this->url, array('action' => 'confirmDelete', 'id' => $this->item->getId(), 'version' => $versions[$key]->getNumber())); $user = $versions[$key]->getAuthorId() ? $uh->getDisplayNameFromUserId($versions[$key]->getAuthorId()) : $GLOBALS['Language']->getText('plugin_docman', 'details_history_anonymous'); $content .= '<tr class="' . $odd_even[$i++ % count($odd_even)] . '">'; $content .= '<td align="center"><a href="' . $download . '">' . $versions[$key]->getNumber() . '</a></td>'; $content .= '<td>' . html_time_ago($versions[$key]->getDate()) . '</td>'; $content .= '<td>' . $this->hp->purify($user) . '</td>'; $content .= '<td>' . $this->hp->purify($versions[$key]->getLabel()) . '</td>'; $content .= '<td>' . $this->hp->purify($versions[$key]->getChangelog(), CODENDI_PURIFIER_LIGHT) . '</td>'; $table = $approvalFactory->getTableFromVersion($versions[$key]); if ($table != null) { $appTable = Docman_View_View::buildUrl($this->url, array('action' => 'details', 'section' => 'approval', 'id' => $this->item->getId(), 'version' => $versions[$key]->getNumber())); $content .= '<td align="center"><a href="' . $appTable . '">' . ($titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_approval_show') . '</a></td>'); } else { $content .= '<td></td>'; } $content .= '<td align="center"><a href="' . $delete . '"><img src="' . util_get_image_theme("ic/trash.png") . '" height="16" width="16" border="0"></a></td>'; $content .= '</tr>'; } $content .= '</table>'; } else { $content .= '<div>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_no') . '</div>'; } } else { $content .= '<div>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_error') . '</div>'; } } if ($this->logger) { $content .= $this->logger->fetchLogsForItem($this->item->getId(), $this->display_access_logs); } return $content; }
/** * Display the follow-up comment update form * * @param comment_id: id of the follow-up comment * * @return void */ function displayEditFollowupComment($comment_id) { $hp = Codendi_HTMLPurifier::instance(); $group = $this->ArtifactType->getGroup(); $group_artifact_id = $this->ArtifactType->getID(); $group_id = $group->getGroupId(); $followUp = $this->getFollowUpDetails($comment_id); $result_fields = $GLOBALS['art_field_fact']->getAllUsedFields(); $summary = $this->getValue('summary'); $artTitle = '[ ' . $hp->purify($this->ArtifactType->getItemName(), CODENDI_PURIFIER_CONVERT_HTML); $field_artifact_id = $result_fields['artifact_id']; if ($field_artifact_id->userCanRead($group_id, $group_artifact_id, user_getid())) { $artTitle .= " #" . $hp->purify($this->getID(), CODENDI_PURIFIER_CONVERT_HTML); } $artTitle .= ' ] ' . $hp->purify(util_unconvert_htmlspecialchars($summary), CODENDI_PURIFIER_CONVERT_HTML); $link = '<a href="?func=detail&aid=' . $this->getID() . '&atid=' . $group_artifact_id . '&group_id=' . $group_id . '">' . $artTitle . '</a>'; echo '<H2>' . $link . ' - ' . $GLOBALS['Language']->getText('tracker_edit_comment', 'upd_followup') . ' #' . $comment_id . '</H2>'; echo '<p>' . $GLOBALS['Language']->getText('tracker_edit_comment', 'upd_followup_details', array(html_time_ago($followUp['date']), UserHelper::instance()->getLinkOnUserFromUserId($followUp['mod_by']))) . '</p>'; echo '<FORM ACTION="/tracker/?group_id=' . (int) $group_id . '&atid=' . (int) $group_artifact_id . '&func=updatecomment" METHOD="post"> <INPUT TYPE="hidden" NAME="artifact_history_id" VALUE="' . (int) $comment_id . '"> <INPUT TYPE="hidden" NAME="artifact_id" VALUE="' . (int) $this->getID() . '"> <P><DIV ID="followup_update_label"></DIV><TEXTAREA NAME="followup_update" id="tracker_artifact_comment" ROWS="10" style="width:700px;" WRAP="SOFT">' . $hp->purify(util_unconvert_htmlspecialchars($followUp['new_value']), CODENDI_PURIFIER_CONVERT_HTML) . '</TEXTAREA> <P><INPUT CLASS="btn btn-primary" TYPE="submit" VALUE="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '"> </FORM>'; $GLOBALS['Response']->includeFooterJavascriptFile('/scripts/trackerv3_artifact.js'); }
/** * Return the string to display the follow ups comments * * @param Integer group_id: the group id * @param Integer output By default set to OUTPUT_BROWSER, the output is displayed on browser * set to OUTPUT_MAIL_TEXT, the followups will be sent in mail * else is an export csv/DB * @return string the follow-up comments to display in HTML or in ascii mode */ function showFollowUpComments($group_id, $pv, $output = self::OUTPUT_BROWSER) { $hp = $this->getHTMLPurifier(); $uh = UserHelper::instance(); // // Format the comment rows from artifact_history // global $Language; //$group = $this->ArtifactType->getGroup(); $group_artifact_id = $this->ArtifactType->getID(); //$group_id = $group->getGroupId(); $result = $this->getFollowups(); $rows = db_numrows($result); // No followup comment -> return now if ($rows <= 0) { if ($output == self::OUTPUT_EXPORT || $output == self::OUTPUT_MAIL_TEXT) { $out = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . " " . $Language->getText('tracker_import_utils', 'no_followups') . $GLOBALS['sys_lf']; } else { $out = '<H4>' . $Language->getText('tracker_import_utils', 'no_followups') . '</H4>'; } return $out; } $out = ''; // Header first if ($output == self::OUTPUT_EXPORT || $output == self::OUTPUT_MAIL_TEXT) { $out .= $Language->getText('tracker_include_artifact', 'follow_ups') . $GLOBALS['sys_lf'] . str_repeat("*", strlen($Language->getText('tracker_include_artifact', 'follow_ups'))); } else { if ($rows > 0) { $out .= '<div style="text-align:right">'; $out .= '<script type="text/javascript"> function tracker_expand_all_comments() { $H(tracker_comment_togglers).values().each(function (value) { (value)(null, true, true); }); } function tracker_collapse_all_comments() { $H(tracker_comment_togglers).values().each(function (value) { (value)(null, true, false); }); } var matches = location.hash.match(/#comment_(\\d*)/); var linked_comment_id = matches ? matches[1] : null; </script>'; $out .= '<a href="#expand_all" onclick="tracker_expand_all_comments(); return false;">' . $Language->getText('tracker_include_artifact', 'expand_all') . '</a> | <a href="#expand_all" onclick="tracker_collapse_all_comments(); return false;">' . $Language->getText('tracker_include_artifact', 'collapse_all') . '</a></div>'; } } // Loop throuh the follow-up comments and format them $last_visit_date = user_get_preference('tracker_' . $this->ArtifactType->getId() . '_artifact_' . $this->getId() . '_last_visit'); for ($i = 0; $i < $rows; $i++) { $comment_type = db_result($result, $i, 'comment_type'); $comment_type_id = db_result($result, $i, 'comment_type_id'); $comment_id = db_result($result, $i, 'artifact_history_id'); $field_name = db_result($result, $i, 'field_name'); $orig_subm = $this->getOriginalCommentSubmitter($comment_id); $orig_date = $this->getOriginalCommentDate($comment_id); $value = db_result($result, $i, 'new_value'); $isHtml = db_result($result, $i, 'format'); if ($comment_type_id == 100 || $comment_type == "") { $comment_type = ''; } else { $comment_type = '[' . SimpleSanitizer::unsanitize($comment_type) . ']'; } if ($output == self::OUTPUT_EXPORT || $output == self::OUTPUT_MAIL_TEXT) { $fmt = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . "------------------------------------------------------------------" . $GLOBALS['sys_lf'] . $Language->getText('tracker_import_utils', 'date') . ": %-30s" . $Language->getText('global', 'by') . ": %s" . $GLOBALS['sys_lf'] . "%s"; //The mail body $comment_txt = $this->formatFollowUp($group_id, $isHtml, $value, $output); $out .= sprintf($fmt, format_date(util_get_user_preferences_export_datefmt(), db_result($orig_date, 0, 'date')), db_result($orig_subm, 0, 'mod_by') == 100 ? db_result($orig_subm, 0, 'email') : user_getname(db_result($orig_subm, 0, 'mod_by')), ($comment_type != '' ? $comment_type . $GLOBALS['sys_lf'] : '') . $comment_txt); } else { $style = ''; $toggle = 'ic/toggle_minus.png'; if ($last_visit_date > db_result($orig_date, 0, 'date') && $i > 0) { $style = 'style="display:none;"'; $toggle = 'ic/toggle_plus.png'; } $out .= "\n" . ' <div class="followup_comment" id="comment_' . $comment_id . '"> <div class="' . util_get_alt_row_color($i) . ' followup_comment_header"> <div class="followup_comment_title">'; $out .= '<script type="text/javascript">document.write(\'<span>'; $out .= $GLOBALS['HTML']->getImage($toggle, array('id' => 'comment_' . (int) $comment_id . '_toggle', 'style' => 'vertical-align:middle; cursor:hand; cursor:pointer;', 'title' => addslashes($GLOBALS['Language']->getText('tracker_include_artifact', 'toggle')))); $out .= '</span>\');</script>'; $out .= '<script type="text/javascript">'; $out .= "tracker_comment_togglers[" . (int) $comment_id . "] = function (evt, force, expand) {\n var toggle = \$('comment_" . (int) $comment_id . "_toggle');\n var element = \$('comment_" . (int) $comment_id . "_content');\n if (element) {\n if (!force || (expand && !element.visible()) || (!expand && element.visible())) {\n Element.toggle(element);\n \n //replace image\n var src_search = 'toggle_minus';\n var src_replace = 'toggle_plus';\n if (toggle.src.match('toggle_plus')) {\n src_search = 'toggle_plus';\n src_replace = 'toggle_minus';\n }\n toggle.src = toggle.src.replace(src_search, src_replace);\n }\n }\n if (evt) {\n Event.stop(evt);\n }\n return false;\n };\n Event.observe(\$('comment_" . (int) $comment_id . "_toggle'), 'click', tracker_comment_togglers[" . (int) $comment_id . "]);"; $out .= '</script>'; $out .= '<span><a href="#comment_' . (int) $comment_id . '" title="Link to this comment - #' . (int) $comment_id . '" onclick="tracker_comment_togglers[' . (int) $comment_id . '](null, true, true);">'; $out .= $GLOBALS['HTML']->getImage('ic/comment.png', array('border' => 0, 'style' => 'vertical-align:middle', 'title' => 'Link to this comment - #' . (int) $comment_id)); $out .= '</a> </span>'; $out .= '<span class="followup_comment_title_user">'; if (db_result($orig_subm, 0, 'mod_by') == 100) { $out .= db_result($orig_subm, 0, 'email'); } else { $out .= '<a href="/users/' . urlencode(user_getname(db_result($orig_subm, 0, 'mod_by'))) . '">' . $hp->purify($uh->getDisplayNameFromUserId(db_result($orig_subm, 0, 'mod_by')), CODENDI_PURIFIER_CONVERT_HTML) . '</a>'; } $out .= ' </span>'; $out .= '<span class="followup_comment_title_date">'; $out .= html_time_ago(db_result($orig_date, 0, 'date')); $out .= '</span>'; if ($field_name != "comment") { $out .= " (" . $GLOBALS['Language']->getText('tracker_include_artifact', 'last_edited') . " "; $out .= '<span class="followup_comment_title_edited_user">'; if (db_result($result, $i, 'mod_by') == 100) { $out .= db_result($result, $i, 'email'); } else { $out .= '<a href="/users/' . urlencode(user_getname(db_result($result, $i, 'mod_by'))) . '">' . $hp->purify(user_getname(db_result($result, $i, 'mod_by')), CODENDI_PURIFIER_CONVERT_HTML) . '</a>'; } $out .= ' </span>'; $out .= '<span class="followup_comment_title_date">'; $out .= html_time_ago(db_result($result, $i, 'date')); $out .= '</span>' . ")"; } $out .= "\n</div><!-- followup_comment_title -->\n"; $out .= '<div class="followup_comment_title_toolbar">'; if (db_result($orig_subm, 0, 'mod_by') == 100) { $user_quoted = db_result($orig_subm, 0, 'email'); } else { $user_quoted = $uh->getDisplayNameFromUserId(db_result($orig_subm, 0, 'mod_by')); } $user_quoted = addslashes(addslashes($user_quoted)); if ($pv == 0) { $out .= '<script type="text/javascript">document.write(\'<a href="#quote" onclick="tracker_quote_comment(\\\'' . $user_quoted . '\\\', \\\'' . (int) $comment_id . '\\\'); return false;" title="quote">'; $out .= $GLOBALS['HTML']->getImage('ic/quote.png', array('border' => 0, 'alt' => 'quote')); $out .= '</a>\');</script>'; } if ($this->userCanEditFollowupComment($comment_id) && !$pv) { $out .= '<a href="/tracker/?func=editcomment&group_id=' . (int) $group_id . '&aid=' . (int) $this->getID() . '&atid=' . (int) $group_artifact_id . '&artifact_history_id=' . (int) $comment_id . '" title="' . $GLOBALS['Language']->getText('tracker_fieldeditor', 'edit') . '">'; $out .= $GLOBALS['HTML']->getImage('ic/edit.png', array('border' => 0, 'alt' => $GLOBALS['Language']->getText('tracker_fieldeditor', 'edit'))); $out .= '</a>'; $out .= '<a href="/tracker/?func=delete_comment&group_id=' . (int) $group_id . '&aid=' . (int) $this->getID() . '&atid=' . (int) $group_artifact_id . '&artifact_history_id=' . (int) $comment_id . '" '; $out .= ' onClick="return confirm(\'' . $GLOBALS['Language']->getText('tracker_include_artifact', 'delete_comment') . '\')" title="' . $GLOBALS['Language']->getText('tracker_include_artifact', 'del') . '">'; $out .= $GLOBALS['HTML']->getImage('ic/close.png', array('border' => 0, 'alt' => $GLOBALS['Language']->getText('tracker_include_artifact', 'del'))); $out .= '</a>'; } $out .= "\n</div><!-- followup_comment_title_toolbar -->\n"; $out .= '<div style="clear:both;"></div>'; $out .= "\n</div><!-- followup_comment_header -->\n"; $out .= '<div class="followup_comment_content" ' . $style . ' id="comment_' . (int) $comment_id . '_content">'; if ($comment_type != "") { $out .= '<div class="followup_comment_content_type"><b>' . $hp->purify($comment_type, CODENDI_PURIFIER_CONVERT_HTML) . '</b></div>'; } $out .= $this->formatFollowUp($group_id, $isHtml, $value, $output); $out .= '</div>'; $out .= '</div>'; $out .= '<script type="text/javascript"> if (linked_comment_id == ' . (int) $comment_id . ') { tracker_comment_togglers[' . (int) $comment_id . '](null, true, true); } </script>'; } } if ($output == self::OUTPUT_BROWSER) { if ($rows > 0) { $out .= '<div style="text-align:right">'; $out .= '<a href="#expand_all" onclick="tracker_expand_all_comments(); return false;">' . $Language->getText('tracker_include_artifact', 'expand_all') . '</a> | <a href="#expand_all" onclick="tracker_collapse_all_comments(); return false;">' . $Language->getText('tracker_include_artifact', 'collapse_all') . '</a></div>'; } } // final touch... $out .= $output != self::OUTPUT_BROWSER ? $GLOBALS['sys_lf'] : ""; return $out; }
/** * REPO VIEW */ public function view() { $gitphp = ''; $params = $this->getData(); if (empty($params['repository'])) { $this->getController()->redirect('/plugins/git/?action=index&group_id=' . $this->groupId); return false; } $repository = $params['repository']; $repoId = $repository->getId(); $repoName = $repository->getName(); $initialized = $repository->isInitialized(); $creator = $repository->getCreator(); $parent = $repository->getParent(); $access = $repository->getAccess(); $description = $repository->getDescription(); $creatorName = ''; if (!empty($creator)) { $creatorName = UserHelper::instance()->getLinkOnUserFromUserId($creator->getId()); } $creationDate = html_time_ago(strtotime($repository->getCreationDate())); if ($initialized) { ob_start(); $this->getView($repository); $gitphp = ob_get_contents(); ob_end_clean(); } //download if ($this->request->get('noheader') == 1) { die($gitphp); } echo '<br />'; if (!$initialized) { echo '<div class="feedback_warning">' . $this->getText('help_init_reference_msg') . '</div>'; $this->help('init', array('repository' => $repository)); } $this->_getBreadCrumb(); // Access type $accessType = $this->fetchAccessType($access, $repository->getBackend() instanceof Git_Backend_Gitolite); // Actions $repoActions = '<ul id="plugin_git_repository_actions">'; if ($this->getController()->isAPermittedAction('repo_management')) { $repoActions .= '<li>' . $this->linkTo($this->getText('admin_repo_management'), '/plugins/git/?action=repo_management&group_id=' . $this->groupId . '&repo_id=' . $repoId, 'class="repo_admin"') . '</li>'; } /** Disable fork of gitshell repositories **/ /* if ($initialized && $this->getController()->isAPermittedAction('clone') && !($repository->getBackend() instanceof Git_Backend_Gitolite)) { $repoActions .= '<li>'.$this->linkTo($this->getText('admin_fork_creation_title'), '/plugins/git/?action=fork&group_id='.$this->groupId.'&repo_id='.$repoId, 'class="repo_fork"').'</li>'; } */ $repoActions .= '</ul>'; echo '<div id="plugin_git_reference">'; echo '<h2>' . $accessType . $repository->getFullName() . '</h2>'; echo $repoActions; ?> <form id="repoAction" name="repoAction" method="POST" action="/plugins/git/?group_id=<?php echo $this->groupId; ?> "> <input type="hidden" id="action" name="action" value="edit" /> <input type="hidden" id="repo_id" name="repo_id" value="<?php echo $repoId; ?> " /> <?php echo '<p id="plugin_git_reference_author">' . $this->getText('view_repo_creator') . ' ' . $creatorName . ' ' . $creationDate . '</p>'; ?> <?php if (!empty($parent)) { ?> <p id="plugin_git_repo_parent"><?php echo $this->getText('view_repo_parent'); ?> : <span><?php echo $this->_getRepositoryPageUrl($parent->getId(), $parent->getName()); ?> </span> </p> <?php } if (!empty($description)) { echo '<p id="plugin_git_description">' . $this->HTMLPurifier->purify($description, CODENDI_PURIFIER_CONVERT_HTML, $this->groupId) . '</p>'; } ?> <p id="plugin_git_clone_url"><?php echo $this->getText('view_repo_clone_url'); ?> : <input id="plugin_git_clone_field" type="text" value="git clone <?php echo $repository->getAccessURL(); ?> " /> </p> </form> <?php echo '</div>'; if ($initialized) { echo $gitphp; } }
case 'show_one_user': // Prepare params $urlParam = ''; echo '<h2>' . $GLOBALS['Language']->getText('plugin_statistics_show_one_user', 'user_growth') . '</h2>'; echo '<form name="progress_by_user" method="get" action="?">'; echo '<input type="hidden" name="func" value="show_one_user" />'; echo '<label>User: </label>'; echo '<input type="text" name="user_id" id="plugin_statistics_project" value="' . $userId . '" />'; echo '<label>Group by:</label>'; echo html_build_select_box_from_array($groupByDate, 'group_by', $selectedGroupByDate, 1) . '<br />'; echo '<label>Start: </label>'; list($timestamp, ) = util_date_to_unixtime($startDate); echo html_field_date('start_date', $startDate, false, 10, 10, 'progress_by_user', false) . ' <em>' . html_time_ago($timestamp) . '</em><br />'; echo '<label>End: </label>'; list($timestamp, ) = util_date_to_unixtime($endDate); echo html_field_date('end_date', $endDate, false, 10, 10, 'progress_by_user', false) . ' <em>' . html_time_ago($timestamp) . '</em><br />'; $sel = ''; if ($relative) { $sel = ' checked="checked"'; $urlParam .= '&relative=true'; } echo '<input type="checkbox" name="relative" value="true" ' . $sel . '/>'; echo '<label>Relative Y-axis (depend of data set values):</label><br/>'; echo '<input type="submit" value="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '"/>'; echo '</form>'; if ($userId && $startDate && $endDate) { echo '<h3>' . $GLOBALS['Language']->getText('plugin_statistics_show_one_user', 'user_detail') . '</h3>'; $duHtml->getUserDetails($userId); $urlParam .= 'start_date=' . $startDate . '&end_date=' . $endDate; $urlParam .= '&group_by=' . $selectedGroupByDate; $urlParam .= '&user_id=' . $userId;
function showPendingItems($res, $groupId, $nbItems, $offset, $limit) { $hp = Codendi_HTMLPurifier::instance(); require_once 'Docman_ItemFactory.class.php'; $itemFactory = new Docman_ItemFactory($groupId); $uh = UserHelper::instance(); $html = ''; $title = array(); $title[] = $GLOBALS['Language']->getText('plugin_docman', 'item_id'); $title[] = $GLOBALS['Language']->getText('plugin_docman', 'filters_item_type'); $title[] = $GLOBALS['Language']->getText('plugin_docman', 'doc_title'); $title[] = $GLOBALS['Language']->getText('plugin_docman', 'location'); $title[] = $GLOBALS['Language']->getText('plugin_docman', 'owner'); $title[] = $GLOBALS['Language']->getText('plugin_docman', 'delete_date'); $title[] = $GLOBALS['Language']->getText('plugin_docman', 'purge_date'); $title[] = $GLOBALS['Language']->getText('plugin_docman', 'restore_item'); if ($nbItems > 0) { $html .= '<H3>' . $GLOBALS['Language']->getText('plugin_docman', 'deleted_item') . '</H3><P>'; $html .= html_build_list_table_top($title); $i = 1; foreach ($res as $row) { $purgeDate = strtotime('+' . $GLOBALS['sys_file_deletion_delay'] . ' day', $row['date']); $html .= '<tr class="' . html_get_alt_row_color($i++) . '">' . '<td>' . $row['id'] . '</td>' . '<td>' . $itemFactory->getItemTypeAsText($row['item_type']) . '</td>' . '<td>' . $hp->purify($row['title'], CODENDI_PURIFIER_BASIC, $groupId) . '</td>' . '<td>' . $hp->purify($row['location']) . '</td>' . '<td>' . $hp->purify($uh->getDisplayNameFromUserId($row['user'])) . '</td>' . '<td>' . html_time_ago($row['date']) . '</td>' . '<td>' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $purgeDate) . '</td>' . '<td align="center"><a href="/plugins/docman/restore_documents.php?group_id=' . $groupId . '&func=confirm_restore_item&id=' . $row['id'] . '" ><IMG SRC="' . util_get_image_theme("ic/convert.png") . '" onClick="return confirm(\'Confirm restore of this item\')" BORDER=0 HEIGHT=16 WIDTH=16></a></td></tr>'; } $html .= '</TABLE>'; $html .= '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">'; if ($offset > 0) { $html .= '<a href="?group_id=' . $groupId . '&focus=item&offsetItem=' . ($offset - $limit) . '">[ ' . $GLOBALS['Language']->getText('plugin_docman', 'previous') . ' ]</a>'; $html .= ' '; } if ($offset + $limit < $nbItems) { $html .= ' '; $html .= '<a href="?group_id=' . $groupId . '&focus=item&offsetItem=' . ($offset + $limit) . '">[ ' . $GLOBALS['Language']->getText('plugin_docman', 'next') . ' ]</a>'; } $html .= '<br>' . ($offset + $i - 2) . '/' . $nbItems . '</br>'; $html .= '</div>'; } else { $html .= $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_docman', 'no_pending_items')); } return $html; }
protected function fetchGitRepositoryRow(GitRepository $repository, $name, $depth) { $trclass = 'boxitem'; $label = $repository->getBasenameHTMLLink($this->url_manager); $description = $repository->getDescription(); $lastPush = ' '; if (isset($this->lastPushes[$repository->getId()])) { $row = $this->lastPushes[$repository->getId()]; $lastPushDate = html_time_ago($row['push_date']); $who = UserHelper::instance()->getLinkOnUserFromUserId($row['user_id']); $lastPush = $GLOBALS['Language']->getText('plugin_git', 'tree_view_by', array($lastPushDate, $who)); } return $this->fetchHTMLRow($trclass, $depth, $label, $description, $lastPush); }
function wiki_attachment_restore_view($group_id, &$idArray, &$nomArray, &$htmlArray) { $wikiAttachment = new WikiAttachment($group_id); $attachments = $wikiAttachment->listPendingAttachments($group_id, 0, 0); $tabbed_content = ''; $tabbed_content .= '<div class="contenu_onglet" id="contenu_onglet_wiki_attachment">'; $i = 1; if ($attachments->rowCount() > 0) { $titles = array('Attachment name', 'Delete date', 'Forcast purge date', 'Restore'); $tabbed_content .= html_build_list_table_top($titles); foreach ($attachments as $wiki_attachment) { $nonRestorableAttachments = $wikiAttachment->getDao()->getIdFromFilename($group_id, $wiki_attachment['name']); if ($nonRestorableAttachments->rowCount()) { $tabbed_content .= '<tr class="boxitemgrey">'; $tabbed_content .= '<td>' . $wiki_attachment['name'] . '</td>'; $tabbed_content .= '<td align="center" colspan="2">Non-restorable attachment</td>'; $tabbed_content .= '<td align="center"><img src="' . util_get_image_theme("ic/convert-grey.png") . '" border="0" height="16" width="16"></td>'; } else { $purgeDate = strtotime('+' . $GLOBALS['sys_file_deletion_delay'] . ' day', $wiki_attachment['delete_date']); $tabbed_content .= '<tr class="' . html_get_alt_row_color($i++) . '">'; $tabbed_content .= '<td>' . $wiki_attachment['name'] . '</td>'; $tabbed_content .= '<td>' . html_time_ago($wiki_attachment['delete_date']) . '</td>'; $tabbed_content .= '<td>' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $purgeDate) . '</td>'; $tabbed_content .= '<td align="center"><a href="?group_id=' . $group_id . '&func=confirm_restore_wiki_attachment&id=' . $wiki_attachment['id'] . '"><img src="' . util_get_image_theme("ic/convert.png") . '" onClick="return confirm(\'Confirm restore of this attachment\')" border="0" height="16" width="16"></a></td>'; } $tabbed_content .= '</tr>'; } } if ($i == 1) { $tabbed_content .= '<center>No restorable Attachments found</center>'; } if ($i > 1) { $tabbed_content .= '</table>'; } $tabbed_content .= '</div>'; $idArray[] = 'wiki_attachment'; $nomArray[] = $GLOBALS['Language']->getText('admin_groupedit', 'archived_wiki'); $htmlArray[] = $tabbed_content; }
echo $Language->getText('account_options', 'auth_attempt_prev_success'); ?> </td><td> <?php echo html_time_ago($userInfo['last_auth_success']); ?> </td></tr> <tr><td> <?php echo $Language->getText('include_user_home', 'member_since'); ?> : </td><td> <?php echo html_time_ago($user->getAddDate()); ?> </td></tr> <?php if (isset($GLOBALS['sys_enable_user_skills']) && $GLOBALS['sys_enable_user_skills']) { echo '<tr><td>'; echo $Language->getText('include_user_home', 'user_prof') . ': '; echo '</td><td>'; echo '<a href="/people/viewprofile.php?user_id=' . $user->getId() . '">' . $Language->getText('include_user_home', 'see_skills') . '</a>'; echo '</td></tr>'; } ?> <?php
function news_fetch_a_news_summary_block($data, $group_id, $limit, $show_projectname, $hide_nb_comments) { global $Language; $uh = new UserHelper(); $html = ''; $arr = explode("\n", $data['details']); if (strlen($arr[0]) < 200 && isset($arr[1]) && isset($arr[2]) && strlen($arr[1] . $arr[2]) < 300 && strlen($arr[2]) > 5) { $details = util_make_links($arr[0] . '<BR>' . $arr[1] . '<BR>' . $arr[2], $group_id); } else { $details = util_make_links($arr[0], $group_id); } $proj_name = ''; if ($show_projectname && $limit) { //show the project name $proj_name = ' · <a href="/projects/' . strtolower($data['unix_group_name']) . '/">' . $data['group_name'] . '</a>'; } if (!$limit) { $html .= '<li><span class="news_summary"><a href="/forum/forum.php?forum_id=' . $data['forum_id'] . '">' . $data['summary'] . '</a></span> '; $html .= '<small><span class="news_date">' . html_time_ago($data['date']) . '</span></small></li>'; } else { $comments_txt = ''; if (!$hide_nb_comments) { $num_comments = (int) $data['num_comments']; $comments_txt .= ' <a href="/forum/forum.php?forum_id=' . $data['forum_id'] . '">(' . $num_comments . ' '; if ($num_comments == 1) { $comments_txt .= $Language->getText('news_utils', 'comment'); } else { $comments_txt .= $Language->getText('news_utils', 'comments'); } $comments_txt .= ')</a>'; } $html .= '<div class="news">'; $html .= '<span class="news_summary"><a href="/forum/forum.php?forum_id=' . $data['forum_id'] . '"><h4>' . $data['summary'] . '</h4></a></span>'; $html .= '<blockquote>'; $html .= '<div>' . $details . '</div>'; $html .= '<small> <span class="news_author">' . $uh->getLinkOnUserFromUserId($data['submitted_by']) . '</span> <span class="news_date">' . html_time_ago($data['date']) . '</span>' . $comments_txt . $proj_name . '</small>'; $html .= '</blockquote>'; $html .= '<hr width="100%" size="1" noshade>'; $html .= '</div>'; } return $html; }
function fetchLogsForItem($item_id, $display_access_logs) { $html = ''; $uh = UserHelper::instance(); $hp = Codendi_HTMLPurifier::instance(); $html .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_logs') . '</h3>'; $dar = $this->dao->searchByItemIdOrderByTimestamp($item_id); if ($dar && !$dar->isError()) { if ($dar->valid()) { $titles = array(); $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_logs_when'); $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_logs_who'); $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_logs_what'); $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_logs_old_value'); $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_logs_new_value'); $html .= html_build_list_table_top($titles, false, false, false); $odd_even = array('boxitem', 'boxitemalt'); $i = 0; $_previous_date = -1; $_previous_auth = -1; while ($dar->valid()) { $row = $dar->current(); if ($row['type'] != PLUGIN_DOCMAN_EVENT_ACCESS || $display_access_logs) { $user = $row['user_id'] ? $hp->purify($uh->getDisplayNameFromUserId($row['user_id'])) : $GLOBALS['Language']->getText('plugin_docman', 'details_history_anonymous'); $html .= '<tr class="' . $odd_even[$i++ % count($odd_even)] . '">'; $html .= '<td>' . html_time_ago($row['time']) . '</td>'; $html .= '<td>' . $user . '</td>'; if ($row['type'] == PLUGIN_DOCMAN_EVENT_METADATA_UPDATE) { $_old_v = $row['old_value']; $_new_v = $row['new_value']; $mdFactory = new Docman_MetadataFactory($row['group_id']); $md =& $mdFactory->getFromLabel($row['field']); if ($md->getType() == PLUGIN_DOCMAN_METADATA_TYPE_LIST) { $mdlovebo = new Docman_MetadataListOfValuesElementFactory(); $_old_e =& $mdlovebo->getByElementId($row['old_value'], $md->getLabel()); $_new_e =& $mdlovebo->getByElementId($row['new_value'], $md->getLabel()); if ($_old_e !== null) { $_old_v = $_old_e->getName(); } if ($_new_e !== null) { $_new_v = $_new_e->getName(); } } else { if ($md->getType() == PLUGIN_DOCMAN_METADATA_TYPE_DATE) { $_old_v = format_date($GLOBALS['Language']->getText('system', 'datefmt'), $_old_v); $_new_v = format_date($GLOBALS['Language']->getText('system', 'datefmt'), $_new_v); } } $html .= '<td>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_logs_change_field', array($md->getName())) . '</td>'; $html .= '<td>' . $_old_v . '</td>'; $html .= '<td>' . $_new_v . '</td>'; } elseif ($row['type'] == PLUGIN_DOCMAN_EVENT_WIKIPAGE_UPDATE) { $old_version = $row['old_value']; $new_version = $row['new_value']; $dIF = $this->_getItemFactory($row['group_id']); $pagename = $dIF->getItemFromDb($item_id)->getPageName(); $difflink = '/wiki/index.php?group_id=' . $row['group_id']; $difflink .= '&pagename=' . urlencode($pagename) . '&action=diff'; $difflink .= '&versions%5b%5d=' . $old_version . '&versions%5b%5d=' . $new_version; $html .= '<td colspan>' . $this->getText($row['type']) . '</td>'; $html .= '<td colspan="2" align="center"><a href=' . $difflink . '>diffs</a>'; } elseif ($row['type'] == PLUGIN_DOCMAN_EVENT_SET_VERSION_AUTHOR) { $newUser = $row['new_value']; $html .= '<td>' . $this->getText($row['type']) . '</td>'; $html .= "<td> </td>"; $html .= "<td>{$newUser}</td>"; } elseif ($row['type'] == PLUGIN_DOCMAN_EVENT_SET_VERSION_DATE) { $newDate = format_date($GLOBALS['Language']->getText('system', 'datefmt'), $row['new_value']); $html .= '<td>' . $this->getText($row['type']) . '</td>'; $html .= "<td> </td>"; $html .= "<td>{$newDate}</td>"; } elseif ($row['type'] == PLUGIN_DOCMAN_EVENT_DEL_VERSION) { $old_version = $row['old_value']; $html .= '<td>' . $this->getText($row['type']) . '</td>'; $html .= '<td colspan="2" align="center">' . $old_version . '</td>'; } elseif ($row['type'] == PLUGIN_DOCMAN_EVENT_RESTORE_VERSION) { $versionNumber = $row['old_value']; $html .= '<td>' . $this->getText($row['type']) . '</td>'; $html .= '<td colspan="2" align="center">' . $versionNumber . '</td>'; } else { $html .= '<td colspan>' . $this->getText($row['type']) . '</td><td colspan="2"> </td>'; } $html .= '</tr>'; $_previous_date = $row['time']; $_previous_auth = $row['user_id']; } $dar->next(); } $html .= '</table>'; } else { $html .= '<div>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_logs_no') . '</div>'; } } else { $html .= '<div>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_logs_error') . '</div>'; $html .= $dar->isError(); } return $html; }
private function getLinkVersions() { $uh = UserHelper::instance(); $content = '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions') . '</h3>'; $version_factory = new Docman_LinkVersionFactory(); $versions = $version_factory->getAllVersionForItem($this->item); if ($versions) { $titles = array($GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_version'), $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_date'), $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_author'), $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_label'), $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_changelog')); $content .= html_build_list_table_top($titles, false, false, false); $odd_even = array('boxitem', 'boxitemalt'); $i = 0; foreach (array_keys($versions) as $key) { $download = Docman_View_View::buildUrl($this->url, array('action' => 'show', 'id' => $this->item->getId(), 'version_number' => $versions[$key]->getNumber())); $user = $versions[$key]->getAuthorId() ? $uh->getDisplayNameFromUserId($versions[$key]->getAuthorId()) : $GLOBALS['Language']->getText('plugin_docman', 'details_history_anonymous'); $content .= '<tr class="' . $odd_even[$i++ % count($odd_even)] . '">'; $content .= '<td align="center"><a href="' . $download . '">' . $versions[$key]->getNumber() . '</a></td>'; $content .= '<td>' . html_time_ago($versions[$key]->getDate()) . '</td>'; $content .= '<td>' . $this->hp->purify($user) . '</td>'; $content .= '<td>' . $this->hp->purify($versions[$key]->getLabel()) . '</td>'; $content .= '<td>' . $this->hp->purify($versions[$key]->getChangelog(), CODENDI_PURIFIER_LIGHT) . '</td>'; $content .= '</tr>'; } $content .= '</table>'; } else { $content .= '<div>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_error') . '</div>'; } return $content; }