/**
  *
  */
 function _getReportTableContent($reportIter, $isAdmin, &$altRowClass)
 {
     $hp = Codendi_HTMLPurifier::instance();
     $html = '';
     $reportIter->rewind();
     while ($reportIter->valid()) {
         $r = $reportIter->current();
         $trclass = html_get_alt_row_color($altRowClass++);
         $html .= '<tr class="' . $trclass . '">';
         // Name
         $rUrl = $this->defaultUrl . '&action=report_settings&report_id=' . $r->getId();
         $rName = '<a href="' . $rUrl . '">' . $hp->purify($r->getName(), CODENDI_PURIFIER_CONVERT_HTML) . '</a>';
         $html .= '<td align="left">' . $rName . '</td>';
         // Scope
         $scopeName = $GLOBALS['Language']->getText('plugin_docman', 'report_scope_' . $r->getScope());
         $html .= '<td align="center">' . $scopeName . '</td>';
         // Delete
         $trashLink = $this->defaultUrl . '&action=report_del&report_id=' . $r->getId();
         $trashWarn = $GLOBALS['Language']->getText('plugin_docman', 'report_settings_delete', $hp->purify(addslashes($r->getName()), CODENDI_PURIFIER_CONVERT_HTML));
         $trashAlt = $GLOBALS['Language']->getText('plugin_docman', 'report_settings_delete_alt', $hp->purify($r->getName(), CODENDI_PURIFIER_CONVERT_HTML));
         $delUrl = $this->defaultUrl . '&action=report_del&report_id=' . $r->getId();
         $delName = html_trash_link($trashLink, $trashWarn, $trashAlt);
         $html .= '<td align="center">' . $delName . '</td>';
         $html .= "</tr>\n";
         $reportIter->next();
     }
     return $html;
 }
 function getTable($params)
 {
     $this->defaultUrl = $params['default_url'];
     $content = '';
     $content .= html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_title'), $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_location'), $GLOBALS['Language']->getText('plugin_docman', 'admin_lock_infos_who'), $GLOBALS['Language']->getText('plugin_docman', 'admin_lock_infos_when')));
     // Get list of all locked documents in the project.
     $dPM = Docman_PermissionsManager::instance($params['group_id']);
     $lockInfos = $dPM->getLockFactory()->getProjectLockInfos($params['group_id']);
     $uH = UserHelper::instance();
     $hp = Codendi_HTMLPurifier::instance();
     require_once dirname(__FILE__) . '/../Docman_ItemFactory.class.php';
     $dIF = new Docman_ItemFactory($params['group_id']);
     $altRowClass = 0;
     foreach ($lockInfos as $row) {
         $trclass = html_get_alt_row_color($altRowClass++);
         $item = $dIF->getItemFromDb($row['item_id']);
         $parent = $dIF->getItemFromDb($item->getParentId());
         $content .= '<tr class="' . $trclass . '">';
         $content .= '<td>' . '<a href="/plugins/docman/?group_id=' . $params['group_id'] . '&action=details&id=' . $item->getId() . '">' . $item->getTitle() . '</a></td>';
         $content .= '<td>';
         if ($dIF->isRoot($parent)) {
             $content .= '</td>';
         } else {
             $content .= '<a href="' . $this->defaultUrl . '&action=show&id=' . $parent->getId() . '">' . $parent->getTitle() . '</a></td>';
         }
         $content .= '<td>' . $hp->purify($uH->getDisplayNameFromUserId($row['user_id'])) . '</td>';
         $content .= '<td>' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $row['lock_date']) . '</td>';
         $content .= '</tr>';
     }
     $content .= '</table>';
     return $content;
 }
 private function fetchMappings()
 {
     $html = '';
     $html .= '<table class="cardwall_admin_ontop_mappings"><thead><tr valign="top">';
     $html .= '<td></td>';
     foreach ($this->config->getDashboardColumns() as $column) {
         $html .= '<th>';
         $html .= '<div class="cardwall-column-header-color" style="background-color: ' . $column->bgcolor . '; color: ' . $column->fgcolor . ';"></div>';
         $html .= $this->fetchColumnHeader($column);
         $html .= '</th>';
     }
     $html .= '<td>';
     $html .= $this->fetchAdditionalColumnHeader();
     $html .= '</td>';
     $html .= '</tr></thead>';
     $html .= '<tbody>';
     $row_number = 0;
     foreach ($this->config->getMappings() as $mapping) {
         $html .= '<tr class="' . html_get_alt_row_color(++$row_number) . '" valign="top">';
         $html .= $mapping->accept($this);
         $html .= '<td>';
         $html .= '</td>';
         $html .= '</tr>';
     }
     $html .= '</tbody></table>';
     return $html;
 }
Example #4
0
function display_docs($style, $group_id)
{
    global $sys_datefmt;
    $query = "select * " . "from doc_data as d1, doc_groups as d2 " . "where d1.stateid = '" . $style . "' " . "and d2.group_id = '" . $group_id . "' " . "and d1.doc_group = d2.doc_group";
    $result = db_query($query);
    if (db_numrows($result) < 1) {
        $query = "select name " . "from doc_states " . "where stateid = " . $style . "";
        $result = db_query($query);
        $row = db_fetch_array($result);
        echo 'No ' . $row['name'] . ' docs available <p>';
    } else {
        $title_arr = array();
        $title_arr[] = 'Document ID';
        $title_arr[] = 'Name';
        $title_arr[] = 'Type';
        $title_arr[] = 'Filename';
        $title_arr[] = 'Create Date';
        $title_arr[] = 'Update Date';
        echo html_build_list_table_top($title_arr);
        $i = 0;
        while ($row = db_fetch_array($result)) {
            print "<tr bgcolor=\"" . html_get_alt_row_color($i) . "\">" . "<td>" . $row['docid'] . "</td>" . "<td><a href=\"index.php?docid=" . $row['docid'] . "&mode=docedit&group_id=" . $group_id . "\">" . $row['title'] . "</a></td>" . "<td>" . $row['type'] . "</td>" . "<td>" . $row['filename'] . "</td>" . "<td>" . date($sys_datefmt, $row['createdate']) . "</td>" . "<td>" . date($sys_datefmt, $row['updatedate']) . "</td>" . "</tr>";
            $i++;
        }
        echo '</table>';
    }
    //end else
}
 function getContent()
 {
     $html = '';
     $dwItemFactory = $this->getDocmanWatermarkItemFactory();
     $watermarkingIsDisabled = $dwItemFactory->isWatermarkingDisabled($this->item->getId());
     // Status
     if ($watermarkingIsDisabled) {
         $status = '<strong>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_disabled') . '</strong>';
     } else {
         $status = $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_enabled');
     }
     $html .= '<p>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_status', array($status)) . '</p>';
     // About section
     $html .= '<h2>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_about_title') . '</h2>';
     $html .= '<p>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_disclamer_pdf') . '</p>';
     // Disable/enable section
     $user = $this->getUserManager()->getCurrentUser();
     $dPm = $this->getDocman_PermissionsManager($this->item->getGroupId());
     if ($dPm->userCanManage($user, $this->item->getId())) {
         $html .= '<h2>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_toggle_title') . '</h2>';
         $html .= '<p>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_desc') . '</p>';
         $html .= '<p>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_clicktoproceed') . '</p>';
         $html .= '<form method="post" action="' . $this->url . '&item_id=' . $this->item->getId() . '&action=docmanwatermark_toggle_item">';
         if ($watermarkingIsDisabled) {
             $html .= '<input type="submit" name="enable_watermarking" value="' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_enableit') . '" />';
         } else {
             $html .= '<input type="submit" name="disable_watermarking" value="' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_disableit') . '" />';
         }
         $html .= '</form>';
     }
     // History
     $html .= '<h2>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_title') . '</h2>';
     $dwLog = $this->getDocmanWatermark_Log();
     $dar = $dwLog->getLog($this->item);
     if ($dar && $dar->rowCount() > 0) {
         $uh = UserHelper::instance();
         $hp = Codendi_HTMLPurifier::instance();
         $titles = array($GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_when'), $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_who'), $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_what'));
         $html .= html_build_list_table_top($titles, false, false, false);
         $altColor = 0;
         foreach ($dar as $logEntry) {
             $html .= '<tr class="' . html_get_alt_row_color($altColor++) . '">';
             $html .= '<td>' . util_timestamp_to_userdateformat($logEntry['time']) . '</td>';
             $html .= '<td>' . $hp->purify($uh->getDisplayNameFromUserId($logEntry['who'])) . '</td>';
             $html .= '<td>' . ($logEntry['watermarked'] == 0 ? $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_desactivate') : $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_activate')) . '</td>';
             $html .= '</tr>';
         }
         $html .= '</table>';
     }
     return $html;
 }
 /**
  * List the available metadata
  */
 function getMetadataTable($mdIter, $groupId, $defaultUrl)
 {
     $content = '';
     $mdFactory = new Docman_MetadataFactory($groupId);
     $content .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_title') . '</h3>' . "\n";
     $content .= $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_instructions') . "\n";
     $content .= html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_name'), $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_descr'), $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_status'), $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_delete')));
     $altRowClass = 0;
     $mdIter->rewind();
     while ($mdIter->valid()) {
         $md =& $mdIter->current();
         $canDelete = false;
         if ($mdFactory->isRealMetadata($md->getLabel())) {
             $canDelete = true;
         }
         $trclass = html_get_alt_row_color($altRowClass++);
         $content .= '<tr class="' . $trclass . '">';
         $nameUrl = $this->buildUrl($defaultUrl, array('action' => 'admin_md_details', 'md' => $md->getLabel()));
         $nameHref = '<a href="' . $nameUrl . '">' . $this->hp->purify($md->getName()) . '</a>';
         $content .= '<td>' . $nameHref . '</td>';
         $content .= '<td>' . $this->hp->purify($md->getDescription()) . '</td>';
         $content .= '<td>';
         if ($md->isRequired()) {
             $content .= "-";
         } else {
             if ($md->isUsed()) {
                 $content .= "Used";
             } else {
                 $content .= "Unused";
             }
         }
         $content .= '</td>';
         $trash = '-';
         if ($canDelete) {
             $link = $this->buildUrl($defaultUrl, array('action' => 'admin_delete_metadata', 'md' => $md->getLabel()));
             $warn = $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_delete_warn', $this->hp->purify($md->getName()));
             $alt = $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_list_delete_alt', $this->hp->purify($md->getName()));
             $trash = html_trash_link($link, $warn, $alt);
         }
         $content .= '<td>' . $trash . '</td>';
         $content .= '</tr>' . "\n";
         $mdIter->next();
     }
     $content .= '</table>' . "\n";
     return $content;
 }
Example #7
0
function ShowResultsGroupSurveys($result)
{
    global $group_id, $Language;
    $survey =& SurveySingleton::instance();
    $rows = db_numrows($result);
    $cols = db_numfields($result);
    $title_arr = array();
    $title_arr[] = $Language->getText('survey_index', 's_id');
    $title_arr[] = $Language->getText('survey_index', 's_tit');
    echo html_build_list_table_top($title_arr);
    for ($j = 0; $j < $rows; $j++) {
        echo "<tr class=\"" . html_get_alt_row_color($j) . "\">\n";
        echo "<TD><A HREF=\"survey.php?group_id={$group_id}&survey_id=" . db_result($result, $j, "survey_id") . "\">" . db_result($result, $j, "survey_id") . "</TD>";
        printf("<TD>%s</TD>\n", $survey->getSurveyTitle(db_result($result, $j, 'survey_title')));
        echo "</tr>";
    }
    echo "</table>";
    //</TD></TR></TABLE>");
}
 function getTable($params)
 {
     $html = '';
     // Get root
     $itemFactory = new Docman_ItemFactory($params['group_id']);
     $rootItem = $itemFactory->getRoot($params['group_id']);
     $nbItemsFound = 0;
     $itemIterator =& $itemFactory->getItemList($rootItem->getId(), $nbItemsFound, array('user' => $params['user'], 'ignore_collapse' => true, 'obsolete_only' => true));
     $table = html_build_list_table_top(array('Title', 'Obsolete date'));
     $altRowClass = 0;
     $itemIterator->rewind();
     while ($itemIterator->valid()) {
         $item =& $itemIterator->current();
         $type = $itemFactory->getItemTypeForItem($item);
         if ($type != PLUGIN_DOCMAN_ITEM_TYPE_FOLDER) {
             $trclass = html_get_alt_row_color($altRowClass++);
             $table .= "<tr class=\"" . $trclass . "\">\n";
             // Name
             $docmanIcons =& $this->_getDocmanIcons($params);
             $icon_src = $docmanIcons->getIconForItem($item, $params);
             $icon = '<img src="' . $icon_src . '" class="docman_item_icon" />';
             $table .= "<td>";
             $table .= '<span style="white-space: nowrap;">';
             $table .= $icon;
             $url = $this->buildActionUrl($params, array('action' => 'details', 'id' => $item->getId()), false, true);
             $table .= '<a href="' . $url . '">';
             $table .= htmlentities($item->getTitle(), ENT_QUOTES, 'UTF-8');
             $table .= '</a>';
             $table .= '</span>';
             $table .= "</td>\n";
             // Obsolete date
             $table .= "<td>";
             $table .= format_date("Y-m-j", $item->getObsolescenceDate());
             $table .= "</td>\n";
             $table .= "</tr>\n";
         }
         $itemIterator->next();
     }
     $table .= "</table>\n";
     $html = $table;
     return $html;
 }
 function ShowResultComments($result)
 {
     global $survey_id;
     $rows = db_numrows($result);
     $cols = db_numfields($result);
     echo "<h3>{$rows} Found</h3>";
     $title_arr = array();
     $title_arr[] = 'User ID';
     $title_arr[] = 'Response';
     echo html_build_list_table_top($title_arr);
     for ($j = 0; $j < $rows; $j++) {
         echo "<tr BGCOLOR=\"" . html_get_alt_row_color($j) . "\">\n";
         for ($i = 0; $i < $cols; $i++) {
             printf("<TD>%s</TD>\n", db_result($result, $j, $i));
         }
         echo "</tr>";
     }
     echo "</table>";
     //</TD></TR></TABLE>";
 }
Example #10
0
 function ShowResultsGroupSurveys($result)
 {
     global $group_id;
     $rows = db_numrows($result);
     $cols = db_numfields($result);
     $title_arr = array();
     $title_arr[] = 'Survey ID';
     $title_arr[] = 'Survey Title';
     echo html_build_list_table_top($title_arr);
     for ($j = 0; $j < $rows; $j++) {
         echo "<tr BGCOLOR=\"" . html_get_alt_row_color($j) . "\">\n";
         echo "<TD><A HREF=\"survey.php?group_id={$group_id}&survey_id=" . db_result($result, $j, "survey_id") . "\">" . sprintf("%06d", db_result($result, $j, "survey_id")) . "</A></TD>";
         for ($i = 1; $i < $cols; $i++) {
             printf("<TD WIDTH=\"99%%\">%s</TD>\n", db_result($result, $j, $i));
         }
         echo "</tr>";
     }
     echo "</table>";
     //</TD></TR></TABLE>");
 }
 function ShowResultsEditQuestion($result)
 {
     global $group_id;
     $rows = db_numrows($result);
     $cols = db_numfields($result);
     echo "<h3>{$rows} Found</h3>";
     $title_arr = array();
     $title_arr[] = 'Question ID';
     $title_arr[] = 'Question';
     $title_arr[] = 'Type';
     echo html_build_list_table_top($title_arr);
     for ($j = 0; $j < $rows; $j++) {
         echo "<tr BGCOLOR=\"" . html_get_alt_row_color($j) . "\">\n";
         echo "<TD><A HREF=\"edit_question.php?group_id={$group_id}&question_id=" . db_result($result, $j, "question_id") . "\">" . sprintf("%06d", db_result($result, $j, "question_id")) . "</A></TD>\n";
         for ($i = 1; $i < $cols; $i++) {
             printf("<TD>%s</TD>\n", db_result($result, $j, $i));
         }
         echo "</tr>";
     }
     echo "</table>";
     //</TD></TR></TABLE>");
 }
Example #12
0
function ShowResultsEditSurvey($result)
{
    global $group_id, $PHP_SELF;
    $rows = db_NumRows($result);
    $cols = db_NumFields($result);
    echo "<h3>{$rows} Found</h3>";
    $title_arr = array();
    $title_arr[] = 'Survey ID';
    $title_arr[] = 'Group ID';
    $title_arr[] = 'Survey Title';
    $title_arr[] = 'Survey Questions';
    $title_arr[] = 'Is Active';
    echo html_build_list_table_top($title_arr);
    for ($j = 0; $j < $rows; $j++) {
        echo "<tr BGCOLOR=\"" . html_get_alt_row_color($j) . "\">\n";
        echo "<TD><A HREF=\"edit_survey.php?group_id={$group_id}&survey_id\n=" . db_result($result, $j, 0) . "\">" . sprintf("%06d", db_result($result, $j, 0)) . "</A></TD>";
        for ($i = 1; $i < $cols; $i++) {
            printf("<TD>%s</TD>\n", db_result($result, $j, $i));
        }
        echo "</tr>";
    }
    echo "</table>";
    //</TD></TR></TABLE>";
}
Example #13
0
 /**
  * Get the HTML output for ugroups bound to the current one
  *
  * @param Array $clones List of ugroups bound to this one
  *
  * @return String
  */
 private function getClonesHTML($clones)
 {
     $clonesHTML = '<table>';
     if (!empty($clones)) {
         $clonesHTML .= html_build_list_table_top(array($GLOBALS['Language']->getText('project_reference', 'ref_scope_P'), $GLOBALS['Language']->getText('project_ugroup_binding', 'ugroup')), false, false, false);
         $count = 0;
         $i = 0;
         foreach ($clones as $clone) {
             $project = $this->project_manager->getProject($clone['group_id']);
             if ($project->userIsAdmin()) {
                 $clonesHTML .= '<tr class="' . html_get_alt_row_color(++$i) . '"><td><a href="/projects/' . $project->getUnixName() . '" >' . $project->getPublicName() . '</a></td><td><a href="/project/admin/ugroup.php?group_id=' . $project->getID() . '" >' . $clone['cloneName'] . '</a></td></tr>';
             } else {
                 $count++;
             }
         }
         if ($count) {
             $clonesHTML .= '<tr class="' . html_get_alt_row_color(++$i) . '" colspan="2" ><td>and ' . $count . ' other ugroups you\'re not allowed to administrate</td></tr>';
         }
     } else {
         $clonesHTML .= '<tr><td>' . $GLOBALS['Language']->getText('project_ugroup_binding', 'not_source') . '</td></tr>';
     }
     $clonesHTML .= '</table>';
     return $clonesHTML;
 }
Example #14
0
 /**
  * Returns HTML code to display the artifact follow-up comments
  *
  * @param PFUser $current_user the current user
  *
  * @return string The HTML code for artifact follow-up comments
  */
 private function fetchFollowUps($submitted_comment = '')
 {
     $html = '';
     $html .= $this->fetchSubmitButton();
     $classname = 'tracker_artifact_followup_comments-display_changes';
     $user_preference = $this->user->getPreference(self::USER_PREFERENCE_DISPLAY_CHANGES);
     if ($user_preference !== false && $user_preference == 0) {
         $classname = '';
     }
     $html .= '<div id="tracker_artifact_followup_comments" class="' . $classname . '">';
     $html .= '<div id="tracker_artifact_followup_comments-content">';
     $html .= '<h1 id="tracker_artifact_followups">' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'follow_ups') . '</h1>';
     $html .= '<ul class="tracker_artifact_followups">';
     $previous_item = null;
     $i = 0;
     foreach ($this->artifact->getFollowupsContent() as $item) {
         if ($previous_item) {
             $classnames = html_get_alt_row_color($i++) . ' tracker_artifact_followup ';
             $classnames .= $item->getFollowUpClassnames();
             $html .= '<li id="followup_' . $item->getId() . '" class="' . $classnames . '">';
             $html .= $item->fetchFollowUp();
             $html .= '</li>';
         }
         $previous_item = $item;
     }
     $html .= '<li>';
     $html .= '<div class="' . html_get_alt_row_color($i++) . '">';
     $hp = Codendi_HTMLPurifier::instance();
     if (count($responses = $this->artifact->getTracker()->getCannedResponseFactory()->getCannedResponses($this->artifact->getTracker()))) {
         $html .= '<p><b>' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'use_canned') . '</b>&nbsp;';
         $html .= '<select id="tracker_artifact_canned_response_sb">';
         $html .= '<option selected="selected" value="">--</option>';
         foreach ($responses as $r) {
             $html .= '<option value="' . $hp->purify($r->body, CODENDI_PURIFIER_CONVERT_HTML) . '">' . $hp->purify($r->title, CODENDI_PURIFIER_CONVERT_HTML) . '</option>';
         }
         $html .= '</select>';
         $html .= '<noscript> javascript must be enabled to use this feature! </noscript>';
         $html .= '</p>';
     }
     if ($this->artifact->userCanUpdate($this->user)) {
         $html .= '<textarea id="tracker_followup_comment_new" class="user-mention" wrap="soft" rows="8" cols="80" name="artifact_followup_comment" id="artifact_followup_comment">' . $hp->purify($submitted_comment, CODENDI_PURIFIER_CONVERT_HTML) . '</textarea>';
         $html .= $this->fetchReplyByMailHelp();
         $html .= '</div>';
     }
     $html .= '</li>';
     $html .= '</ul>';
     $html .= '</div>';
     $html .= '</div>';
     $html .= '</td></tr></table>';
     //see fetchFields
     return $html;
 }
 function getTableHistory()
 {
     $html = '';
     $uh = UserHelper::instance();
     if (is_a($this->table, 'Docman_ApprovalTableVersionned')) {
         $html .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_title') . '</h3>';
         $html .= html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_table_version'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_table_owner'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_table_status'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_table_date')));
         $allTables = $this->atf->getAllApprovalTable();
         $rowColorIdx = 1;
         foreach ($allTables as $table) {
             $html .= '<tr class="' . html_get_alt_row_color($rowColorIdx++) . '">';
             if ($this->table->getVersionNumber() != $table->getVersionNumber()) {
                 $url = Docman_View_View::buildUrl($this->url, array('action' => 'details', 'section' => 'approval', 'id' => $this->item->getId(), 'version' => $table->getVersionNumber()));
                 $href = '<a href="' . $url . '">' . $table->getVersionNumber() . '</a>';
             } else {
                 $href = $table->getVersionNumber();
             }
             $html .= '<td>' . $href . '</td>';
             $html .= '<td>' . $this->hp->purify($uh->getDisplayNameFromUserId($table->getOwner())) . '</td>';
             $html .= '<td>' . $GLOBALS['Language']->getText('plugin_docman', 'approval_review_state_' . $table->getApprovalState()) . '</td>';
             $html .= '<td>' . util_timestamp_to_userdateformat($table->getDate()) . '</td>';
             $html .= '</tr>';
         }
         $html .= '</table>';
     }
     return $html;
 }
Example #16
0
 }
 echo html_build_list_table_top($title_arr);
 echo "\n";
 $art_displayed = 0;
 $rows = 0;
 while ($arr = db_fetch_array($result)) {
     $rows++;
     $curArtifact = new Artifact($ath, $arr['artifact_id']);
     if ($curArtifact->isStatusClosed($curArtifact->getStatusID())) {
         $status = $Language->getText('global', 'closed');
     } else {
         $status = $Language->getText('global', 'open');
     }
     // Only display artifacts that the user is allowed to see
     if ($curArtifact->userCanView(user_getid())) {
         print "\n<TR class=\"" . html_get_alt_row_color($art_displayed) . "\">";
         if ($summary_field->userCanRead($group_id, $atid)) {
             print "<TD><A HREF=\"/tracker/?group_id={$group_id}&func=detail&atid={$atid}&aid=" . $arr['artifact_id'] . "\"><IMG SRC=\"" . util_get_image_theme('msg.png') . "\" BORDER=0 HEIGHT=12 WIDTH=10> " . $arr['summary'] . "</A></TD>";
         }
         if ($submitted_field->userCanRead($group_id, $atid)) {
             print "<TD>" . $arr['user_name'] . "</TD>";
         }
         if ($date_field->userCanRead($group_id, $atid)) {
             print "<TD>" . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $arr['open_date']) . "</TD>";
         }
         if ($status_field->userCanRead($group_id, $atid)) {
             print "<TD>" . $status . "</TD>";
         }
         print "</TR>";
         $art_displayed++;
         if ($art_displayed > 24) {
function show_supporthistory($support_id)
{
    /*
    	show the support_history rows that are relevant to this support_id, excluding details
    */
    global $sys_datefmt;
    $result = support_data_get_history($support_id);
    $rows = db_numrows($result);
    if ($rows > 0) {
        $title_arr = array();
        $title_arr[] = 'Field';
        $title_arr[] = 'Old Value';
        $title_arr[] = 'Date';
        $title_arr[] = 'By';
        echo html_build_list_table_top($title_arr);
        for ($i = 0; $i < $rows; $i++) {
            $field = db_result($result, $i, 'field_name');
            echo '
			<TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD>' . $field . '</TD><TD>';
            if ($field == 'support_status_id') {
                echo support_data_get_status_name(db_result($result, $i, 'old_value'));
            } else {
                if ($field == 'support_category_id') {
                    echo support_data_get_category_name(db_result($result, $i, 'old_value'));
                } else {
                    if ($field == 'assigned_to') {
                        echo user_getname(db_result($result, $i, 'old_value'));
                    } else {
                        if ($field == 'close_date') {
                            echo date($sys_datefmt, db_result($result, $i, 'old_value'));
                        } else {
                            echo db_result($result, $i, 'old_value');
                        }
                    }
                }
            }
            echo '</TD>' . '<TD>' . date($sys_datefmt, db_result($result, $i, 'date')) . '</TD>' . '<TD>' . db_result($result, $i, 'user_name') . '</TD></TR>';
        }
        echo '
		</TABLE>';
    } else {
        echo '
			<H3>No Changes Have Been Made to This Support Request</H3>';
    }
}
Example #18
0
function show_filters($group_id)
{
    /*
    	The goal here is to show any existing bug filters for this user/group combo.
    	In addition, we are going to show an empty row where a new filter can be created
    */
    $sql = "SELECT * FROM bug_filter WHERE user_id='" . user_getid() . "' AND group_id='{$group_id}'";
    $result = db_query($sql);
    echo '<TABLE BORDER="0" CELLSPACING="1" CELLPADDING="2">';
    if ($result && db_numrows($result) > 0) {
        for ($i = 0; $i < db_numrows($result); $i++) {
            /*
            	iterate and show the existing filters
            */
            ?>
			<FORM ACTION="<?php 
            echo $PHP_SELF;
            ?>
" METHOD="POST">
			<INPUT TYPE="HIDDEN" NAME="func" VALUE="postmodfilters">
			<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="<?php 
            echo $group_id;
            ?>
">
			<INPUT TYPE="HIDDEN" NAME="subfunc" VALUE="mod">
			<INPUT TYPE="HIDDEN" NAME="filter_id" VALUE="<?php 
            echo db_result($result, $i, "filter_id");
            ?>
">
			<TR BGCOLOR="<?php 
            echo html_get_alt_row_color($i);
            ?>
">
				<TD>
					<FONT SIZE="-1"><INPUT TYPE="SUBMIT" NAME="delete_filter" VALUE="Delete"><BR>
					<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Modify/Activate">
				</TD>
				<TD NOWRAP><FONT SIZE="-1">SELECT * FROM bug WHERE<BR>bug.group_id='<?php 
            echo $group_id;
            ?>
' AND (</TD>
				<TD NOWRAP><FONT SIZE="-1"><INPUT TYPE="TEXT" SIZE="60" MAXLENGTH="250" NAME="sql_clause" VALUE="<?php 
            echo stripslashes(db_result($result, $i, "sql_clause"));
            ?>
"></TD>
				<TD NOWRAP><FONT SIZE="-1">) LIMIT 0,50</TD>
			</TR></FORM>
			<?php 
        }
    }
    /*
    	empty form for new filter
    */
    ?>
	<FORM ACTION="<?php 
    echo $PHP_SELF;
    ?>
" METHOD="POST">
	<INPUT TYPE="HIDDEN" NAME="func" VALUE="postmodfilters">
	<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="<?php 
    echo $group_id;
    ?>
">
	<INPUT TYPE="HIDDEN" NAME="subfunc" VALUE="add">
	<TR BGCOLOR="<?php 
    echo html_get_alt_row_color($i);
    ?>
">
		<TD><FONT SIZE="-1"><INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Add"></TD>
		<TD NOWRAP><FONT SIZE="-1">SELECT * FROM bug WHERE<BR>bug.group_id='<?php 
    echo $group_id;
    ?>
' AND (</TD>
		<TD NOWRAP><FONT SIZE="-1"><INPUT TYPE="TEXT" SIZE="60" MAXLENGTH="250" NAME="sql_clause" VALUE="bug.status_id IN (1,2,3) OR bug.priority > 0 OR bug.bug_group_id IN (1,2,3,4) OR bug.resolution_id IN (1,2,3) OR bug.assigned_to IN (1,2,3,4,5,6) OR bug.category_id IN (1,2,3)"></TD>
		<TD NOWRAP><FONT SIZE="-1">) LIMIT 0,50</TD>
	</TR></FORM>
	</TABLE>
	<P>
	<FORM ACTION="<?php 
    echo $PHP_SELF;
    ?>
" METHOD="POST">
	<INPUT TYPE="HIDDEN" NAME="func" VALUE="postmodfilters">
	<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="<?php 
    echo $group_id;
    ?>
">
	<INPUT TYPE="HIDDEN" NAME="subfunc" VALUE="turn_off">
	<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Deactivate Filters">
	</FORM>
<?php 
}
Example #19
0
    }
    echo html_build_list_table_top($title_arr);
    for ($i = 0; $i < $rows; $i++) {
        // If user is not project admin, use static fields whenever possible
        if ($is_admin) {
            $name_entry = '<INPUT TYPE="TEXT" NAME="package_name" VALUE="' . db_result($res, $i, 'package_name') . '" SIZE="20" MAXLENGTH="30">';
        } else {
            $name_entry = db_result($res, $i, 'package_name');
        }
        $status_entry = frs_show_status_popup('status_id', db_result($res, $i, 'status_id'));
        echo '
		<FORM ACTION="' . $PHP_SELF . '" METHOD="POST">
		<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $group_id . '">
		<INPUT TYPE="HIDDEN" NAME="func" VALUE="update_package">
		<INPUT TYPE="HIDDEN" NAME="package_id" VALUE="' . db_result($res, $i, 'package_id') . '">
		<TR BGCOLOR="' . html_get_alt_row_color($i) . '">
			<TD NOWRAP ALIGN="center">
				<FONT SIZE="-1">
					<A HREF="newrelease.php?package_id=' . db_result($res, $i, 'package_id') . '&group_id=' . $group_id . '"><B>[Add Release]</B>
					</A>
				</FONT>
				<FONT SIZE="-1">
					<A HREF="editreleases.php?package_id=' . db_result($res, $i, 'package_id') . '&group_id=' . $group_id . '"><B>[Edit Releases]</B>
					</A>
				</FONT>

			</TD>
			<TD><FONT SIZE="-1">' . $name_entry . '</TD>
			<TD><FONT SIZE="-1">' . $status_entry . '</TD>';
        if ($is_admin) {
            echo '<TD><FONT SIZE="-1"><INPUT TYPE="SUBMIT" NAME="submit" VALUE="Update"></TD>';
Example #20
0
    /**
     * LIST OF MAILS TO NOTIFY
     */
    protected function _listOfMails()
    {
        $r = new GitRepository();
        $r->setId($this->repoId);
        $r->load();
        $mails = $r->getNotifiedMails();
        ?>
<h3><?php 
        echo $this->getText('notified_mails_title');
        ?>
</h3>
    <?php 
        if (!empty($mails)) {
            ?>
<form id="add_user_form" action="/plugins/git/" method="POST">
    <input type="hidden" id="action" name="action" value="remove_mail" />
    <input type="hidden" id="group_id" name="group_id" value="<?php 
            echo $this->groupId;
            ?>
" />
    <input type="hidden" id="repo_id" name="repo_id" value="<?php 
            echo $this->repoId;
            ?>
" />
    <table>
        <?php 
            $i = 0;
            foreach ($mails as $mail) {
                echo '<tr class="' . html_get_alt_row_color(++$i) . '">';
                echo '<td>' . $mail . '</td>';
                echo '<td>';
                echo '<input type="checkbox" name="mail[]" value="' . $this->HTMLPurifier->purify($mail) . '" />';
                echo '</a>';
                echo '</td>';
                echo '</tr>';
            }
            ?>
    </table>
    <input type="submit" value="<?php 
            echo $GLOBALS['Language']->getText('global', 'btn_delete');
            ?>
" />
</form>
        <?php 
        } else {
            ?>
<h4><?php 
            echo $this->getText('add_mail_existing');
            ?>
 </h4>
<?php 
        }
    }
	</TD></TR>
	</FORM>
	</TABLE>
	<?php 
    /*
    	Show the snippets in this package
    */
    $result = db_query("SELECT snippet_package_item.snippet_version_id, snippet_version.version, snippet.name " . "FROM snippet,snippet_version,snippet_package_item " . "WHERE snippet.snippet_id=snippet_version.snippet_id " . "AND snippet_version.snippet_version_id=snippet_package_item.snippet_version_id " . "AND snippet_package_item.snippet_package_version_id='{$snippet_package_version_id}'");
    $rows = db_numrows($result);
    if (!$result || $rows < 1) {
        echo db_error();
        echo '
		<P>
		No Snippets Are In This Package Yet';
    } else {
        $HTML->box1_top('Snippets In This Package');
        for ($i = 0; $i < $rows; $i++) {
            echo '
			<TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD ALIGN="MIDDLE">
				<A HREF="/snippet/delete.php?type=frompackage&snippet_version_id=' . db_result($result, $i, 'snippet_version_id') . '&snippet_package_version_id=' . $snippet_package_version_id . '">' . html_image("images/ic/trash.png", "16", "16", array("BORDER" => "0")) . '</A></TD><TD WIDTH="99%">' . db_result($result, $i, 'name') . ' ' . db_result($result, $i, 'version') . "</TD></TR>";
            $last_group = db_result($result, $i, 'group_id');
        }
        $HTML->box1_bottom();
    }
    echo '
	<P>
	<H2><FONT COLOR="RED">' . $feedback . '</FONT></H2>';
    handle_add_exit();
} else {
    exit_not_logged_in();
}
Example #22
0
function file_utils_show_processors($result)
{
    global $group_id, $Language;
    $hp =& Codendi_HTMLPurifier::instance();
    $rows = db_numrows($result);
    $title_arr = array();
    $title_arr[] = $Language->getText('file_file_utils', 'proc_name');
    $title_arr[] = $Language->getText('file_file_utils', 'proc_rank');
    $title_arr[] = $Language->getText('file_file_utils', 'del');
    echo html_build_list_table_top($title_arr);
    for ($j = 0; $j < $rows; $j++) {
        $proc_id = db_result($result, $j, 'processor_id');
        $proc_name = db_result($result, $j, 'name');
        $proc_rank = db_result($result, $j, 'rank');
        $gr_id = db_result($result, $j, 'group_id');
        echo '<tr class="' . html_get_alt_row_color($j) . '">' . "\n";
        if ($gr_id == "100") {
            echo '<td>' . $hp->purify($proc_name) . '</td>';
        } else {
            echo '<td><A HREF="/file/admin/editproc.php?group_id=' . $group_id . '&proc_id=' . $proc_id . '" title="' . $hp->purify($proc_id . ' - ' . $proc_name) . '">' . $hp->purify($proc_name) . '</td>';
        }
        echo '<td>' . $proc_rank . "</td>\n";
        if ($gr_id == "100") {
            #pre-defined processors are not manageable
            echo '<TD align=center>-</TD>';
        } else {
            echo '<TD align=center>' . '<a href="/file/admin/manageprocessors.php?mode=delete&group_id=' . $group_id . '&proc_id=' . $proc_id . '" ' . '" onClick="return confirm(\'' . $Language->getText('file_file_utils', 'del_proc') . '\')">' . '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" BORDER="0" ALT="' . $Language->getText('file_file_utils', 'del') . '"></A></TD>';
        }
        echo "</tr>";
    }
    echo "</table>";
}
 function _getReviewerTable()
 {
     $html = '';
     $uh = UserHelper::instance();
     $html .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_table_title') . '</h3>';
     $html .= '<div id="docman_approval_table_create_table">';
     if (!$this->table->isClosed()) {
         $html .= '<div class="docman_help">' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_table_help') . '</div>';
     }
     $rIter = $this->table->getReviewerIterator();
     if ($rIter !== null) {
         $docmanIcons =& $this->_getDocmanIcons();
         $html .= html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_docman', 'details_approval_select'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_reviewer'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_review'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_rank')), false, false, false);
         $isFirst = true;
         $isLast = false;
         $nbReviewers = $rIter->count();
         $i = 0;
         $rIter->rewind();
         while ($rIter->valid()) {
             $isLast = $i == $nbReviewers - 1;
             $reviewer = $rIter->current();
             // i+1 to start with 'white'
             $html .= '<tr class="' . html_get_alt_row_color($i + 1) . '">';
             // Select
             if (!$this->table->isClosed()) {
                 $checkbox = '<input type="checkbox" name="sel_user[]" value="' . $reviewer->getId() . '" />';
             } else {
                 $checkbox = '&nbsp;';
             }
             $html .= '<td align="center">' . $checkbox . '</td>';
             // Username
             $html .= '<td>' . $this->hp->purify($uh->getDisplayNameFromUserId($reviewer->getId())) . '</td>';
             // Review
             $html .= '<td>' . $this->atf->getReviewStateName($reviewer->getState()) . '</td>';
             // Rank
             if (!$this->table->isClosed()) {
                 $rank = $reviewer->getRank();
                 $baseUrl = '?group_id=' . $this->item->getGroupId() . '&action=approval_upd_user&id=' . $this->item->getId() . '&user_id=' . $reviewer->getId() . '&rank=';
                 $begLink = '';
                 $upLink = '';
                 if (!$isFirst) {
                     $begIcon = '<img src="' . $docmanIcons->getIcon('move-beginning') . '" alt="Beginning" />';
                     $begLink = '<a href="' . $baseUrl . 'beginning">' . $begIcon . '</a>';
                     $upIcon = '<img src="' . $docmanIcons->getIcon('move-up') . '" alt="Up" />';
                     $upLink = '<a href="' . $baseUrl . 'up">' . $upIcon . '</a>';
                 }
                 $endLink = '';
                 $downLink = '';
                 if (!$isLast) {
                     $endIcon = '<img src="' . $docmanIcons->getIcon('move-end') . '" alt="End" />';
                     $endLink = '<a href="' . $baseUrl . 'end">' . $endIcon . '</a>';
                     $downIcon = '<img src="' . $docmanIcons->getIcon('move-down') . '" alt="Down" />';
                     $downLink = '<a href="' . $baseUrl . 'down">' . $downIcon . '</a>';
                 }
                 $rankHtml = $upLink . '&nbsp;' . $downLink . '&nbsp;' . $begLink . '&nbsp;' . $endLink;
             } else {
                 $rankHtml = '&nbsp;';
             }
             $html .= '<td align="center">' . $rankHtml . '</td>';
             $html .= '</tr>';
             $isFirst = false;
             $i++;
             $rIter->next();
         }
         $html .= '</table>';
         // Action with selected reviewers
         if (!$this->table->isClosed()) {
             $html .= '<p>';
             $html .= $GLOBALS['Language']->getText('plugin_docman', 'details_approval_create_table_act');
             $vals = array('del', 'mail');
             $txts = array($GLOBALS['Language']->getText('plugin_docman', 'details_approval_create_table_act_rm'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_create_table_act_mail'));
             $html .= html_build_select_box_from_arrays($vals, $txts, 'sel_user_act', 100, true);
             $html .= '</p>';
         }
     }
     $html .= '</div>';
     return $html;
 }
Example #24
0
 /**
  * Returns HTML code to display the artifact follow-up comments
  *
  * @param User $current_user the current user
  *
  * @return string The HTML code for artifact follow-up comments
  */
 protected function fetchFollowUps($current_user, $submitted_comment = '')
 {
     $html = '';
     $html_submit_button = '<p style="text-align:center;">';
     $html_submit_button .= '<input type="submit" value="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '" />';
     $html_submit_button .= ' ';
     $html_submit_button .= '<input type="submit" name="submit_and_stay" value="' . $GLOBALS['Language']->getText('global', 'btn_submit_and_stay') . '" />';
     $html_submit_button .= '</p>';
     $html .= $html_submit_button;
     $html .= '<fieldset id="tracker_artifact_followup_comments"><legend
                       class="' . Toggler::getClassName('tracker_artifact_followups', true, true) . '"
                       id="tracker_artifact_followups">' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'follow_ups') . '</legend>';
     $html .= '<ul class="tracker_artifact_followups">';
     $previous_changeset = null;
     $i = 0;
     foreach ($this->getChangesets() as $changeset) {
         if ($previous_changeset) {
             $html .= '<li id="followup_' . $changeset->id . '" class="' . html_get_alt_row_color($i++) . ' tracker_artifact_followup">';
             $html .= $changeset->fetchFollowUp($previous_changeset);
             $html .= '</li>';
         }
         $previous_changeset = $changeset;
     }
     $html .= '<li>';
     $html .= '<div class="' . html_get_alt_row_color($i++) . '">';
     $hp = Codendi_HTMLPurifier::instance();
     if (count($responses = $this->getTracker()->getCannedResponseFactory()->getCannedResponses($this->getTracker()))) {
         $html .= '<p><b>' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'use_canned') . '</b>&nbsp;';
         $html .= '<select id="tracker_artifact_canned_response_sb">';
         $html .= '<option selected="selected" value="">--</option>';
         foreach ($responses as $r) {
             $html .= '<option value="' . $hp->purify($r->body, CODENDI_PURIFIER_CONVERT_HTML) . '">' . $hp->purify($r->title, CODENDI_PURIFIER_CONVERT_HTML) . '</option>';
         }
         $html .= '</select>';
         $html .= '<noscript> javascript must be enabled to use this feature! </noscript>';
         $html .= '</p>';
     }
     $html .= '<b>' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'add_comment') . '</b><br />';
     $html .= '<textarea id="tracker_followup_comment_new" wrap="soft" rows="12" cols="80" style="width:99%;" name="artifact_followup_comment" id="artifact_followup_comment">' . $hp->purify($submitted_comment, CODENDI_PURIFIER_CONVERT_HTML) . '</textarea>';
     $html .= '</div>';
     if ($current_user->isAnonymous()) {
         $html .= $this->fetchAnonymousEmailForm();
     }
     $html .= '</li>';
     $html .= '</ul>';
     $html .= '</fieldset>';
     $html .= $html_submit_button;
     $html .= '</td></tr></table>';
     //see fetchFields
     return $html;
 }
Example #25
0
            */
            $sql = "SELECT feature_canned_id,title FROM feature_canned_responses WHERE group_id='{$group_id}'";
            $result = db_query($sql);
            $rows = db_numrows($result);
            echo "<P>";
            if ($result && $rows > 0) {
                //code to show existing responses and link to update page
                echo '
			<H3>Existing Responses:</H3>
			<P>';
                $title_arr = array();
                $title_arr[] = 'ID';
                $title_arr[] = 'Title';
                echo html_build_list_table_top($title_arr);
                for ($i = 0; $i < $rows; $i++) {
                    echo '<TR BGCOLOR="' . html_get_alt_row_color($i) . '">' . '<TD>' . db_result($result, $i, 'feature_canned_id') . '</TD>' . '<TD><A HREF="' . $PHP_SELF . '?update_canned=1&feature_canned_id=' . db_result($result, $i, 'feature_canned_id') . '&group_id=' . $group_id . '">' . db_result($result, $i, 'title') . '</A></TD></TR>';
                }
                echo '</TABLE>';
            } else {
                echo "\n<H1>No responses set up in this group</H1>";
            }
            ?>
		<P>
		Creating useful generic messages can save you a lot of time when 
		handling common feature requests.
		<P>
		<FORM ACTION="<?php 
            echo $PHP_SELF;
            ?>
" METHOD="POST">
		<INPUT TYPE="HIDDEN" NAME="create_canned" VALUE="y">
Example #26
0
 /**
  * Display debug info gathered along the execution
  *
  * @return void
  */
 public static function showDebugInfo()
 {
     global $Language;
     echo '<div id="footer_debug_separator"/>';
     echo '<div id="footer_debug">';
     echo '<div class="alert alert-info">
                <h4> Development useful information! </h4>
                The section above will show you some useful information about Tuleap for development purpose.
           </div>';
     echo '<div id="footer_debug_content">';
     $debug_compute_tile = microtime(true) - $GLOBALS['debug_time_start'];
     if (function_exists('xdebug_time_index')) {
         $xdebug_time_index = xdebug_time_index();
     }
     $query_time = 0;
     foreach ($GLOBALS['DBSTORE'] as $d) {
         foreach ($d['trace'] as $trace) {
             $query_time += $trace[2] - $trace[1];
         }
     }
     $purifier = Codendi_HTMLPurifier::instance();
     echo '<span class="debug">' . $Language->getText('include_layout', 'query_count') . ": ";
     echo $GLOBALS['DEBUG_DAO_QUERY_COUNT'] . "</span>";
     $percent = (int) ($GLOBALS['DEBUG_TIME_IN_PRE'] * 100 / $debug_compute_tile);
     $sql_percent = (int) ($query_time * 100 / $debug_compute_tile);
     echo '<table border=1><thead><tr><th></th><th>Page generated in</th></tr></thead><tbody>';
     echo '<tr><td>pre.php</td><td>' . number_format(1000 * $GLOBALS['DEBUG_TIME_IN_PRE'], 0, '.', "'") . ' ms (' . $percent . '%)</td>';
     echo '<tr><td>remaining</td><td>' . number_format(1000 * ($debug_compute_tile - $GLOBALS['DEBUG_TIME_IN_PRE']), 0, '.', "'") . ' ms</td>';
     echo '<tr><td><b>total</td><td><b>' . number_format(1000 * $debug_compute_tile, 0, '.', "'") . ' ms</td>';
     if (function_exists('xdebug_time_index')) {
         echo '<tr><td>xdebug</td><td>' . number_format(1000 * $xdebug_time_index, 0, '.', "'") . ' ms</tr>';
     }
     echo '<tr><td>sql</td><td>' . number_format(1000 * $query_time, 0, '.', "'") . ' ms (' . $sql_percent . '%)</tr>';
     echo '</tbody></table>';
     if (function_exists('xdebug_get_profiler_filename')) {
         if ($file = xdebug_get_profiler_filename()) {
             echo '<div>Profiler info has been written in: ' . $file . '</div>';
         }
     }
     $hook_params = array();
     EventManager::instance()->processEvent('layout_footer_debug', $hook_params);
     //Display the config
     // Uncomment this only if you know what you are doing. This may lead to sensitive information leakage /!\
     //echo '<fieldset><legend id="footer_debug_config" class="'. Toggler::getClassname('footer_debug_config') .'">Config:</legend>';
     //echo '<pre>';
     //Config::dump();
     //echo '</pre>';
     //echo '</fieldset>';
     // Display all queries used to generate the page
     echo '<fieldset><legend id="footer_debug_allqueries" class="' . Toggler::getClassname('footer_debug_allqueries') . '">All queries:</legend>';
     echo '<pre>';
     $queries = array();
     $queries_by_time_taken = array();
     $i = 0;
     foreach ($GLOBALS['QUERIES'] as $sql) {
         $t = 0;
         foreach ($GLOBALS['DBSTORE'][md5($sql)]['trace'] as $trace) {
             $t += $trace[2] - $trace[1];
         }
         $q = array('sql' => $purifier->purify($sql), 'total time' => number_format(1000 * $t, 0, '.', "'") . ' ms');
         $queries[] = $q;
         $queries_by_time_taken[] = array('n°' => $i++, 't' => $t) + $q;
     }
     print_r($queries);
     echo '</pre>';
     echo '</fieldset>';
     // Display all queries used to generate the page ordered by time taken
     usort($queries_by_time_taken, array(__CLASS__, 'sort_queries_by_time_taken'));
     echo '<fieldset><legend id="footer_debug_allqueries_time_taken" class="' . Toggler::getClassname('footer_debug_allqueries_time_taken') . '">All queries by time taken:</legend>';
     echo '<table border="1" style="border-collapse:collapse" cellpadding="2" cellspacing="0">';
     echo '<thead><tr><th>n°</th><th style="white-space:nowrap;">time taken</th><th>sum</th><th>sql</th></tr></thead>';
     $i = 0;
     $sum = 0;
     foreach ($queries_by_time_taken as $q) {
         echo '<tr valign="top" class="' . html_get_alt_row_color($i++) . '">';
         echo '<td>' . $q['n°'] . '</td>';
         echo '<td style="white-space:nowrap;">' . $q['total time'] . '</td>';
         echo '<td style="white-space:nowrap;">' . number_format(1000 * ($sum += $q['t']), 0, '.', "'") . ' ms' . '</td>';
         echo '<td><pre>' . $q['sql'] . '</pre></td>';
         echo '</tr>';
     }
     echo '</table>';
     echo '</fieldset>';
     echo '<fieldset><legend id="footer_debug_queriespaths" class="' . Toggler::getClassname('footer_dubug_queriespaths') . '">Path of all queries:</legend>';
     $max = 0;
     foreach ($GLOBALS['DBSTORE'] as $d) {
         foreach ($d['trace'] as $trace) {
             $time_taken = 1000 * round($trace[2] - $trace[1], 3);
             if ($max < $time_taken) {
                 $max = $time_taken;
             }
         }
     }
     $paths = array();
     $time = $GLOBALS['debug_time_start'];
     foreach ($GLOBALS['DBSTORE'] as $d) {
         foreach ($d['trace'] as $trace) {
             $time_taken = 1000 * round($trace[2] - $trace[1], 3);
             self::_debug_backtrace_rec($paths, array_reverse($trace[0]), '[' . 1000 * round($trace[1] - $GLOBALS['debug_time_start'], 3) . '/' . $time_taken . '] ' . ($time_taken >= $max ? ' <span style="background:yellow; padding-left:4px; padding-right:4px; color:red;">top!</span> ' : '') . $purifier->purify($d['sql']));
         }
     }
     echo '<table>';
     self::_debug_display_paths($paths, false);
     echo '</table>';
     echo '</fieldset>';
     //Print the backtrace of specific queries
     /*
                 echo '<pre>';
                 $specific_queries = array(48,49);
                 $i = 0;
                 foreach($GLOBALS['DBSTORE'] as $d) {
                     //echo $i ."\t". $d['sql'] ."\n";
                     if (in_array($i++, $specific_queries)) {
                         $traces = $d['trace'][0];
                         foreach($traces as $trace) {
                             echo '<code>'. $trace['file']. ' #'. $trace['line'] .' ('. (isset($trace['class']) ? $trace['class'] .'::' : '') . $trace['function'] ."</code>\n";
                         }
                         echo "\n";
                     }
                 }
                 echo '</pre>';
                 /**/
     // Display queries executed more than once
     $title_displayed = false;
     foreach ($GLOBALS['DBSTORE'] as $key => $value) {
         if ($GLOBALS['DBSTORE'][$key]['nb'] > 1) {
             if (!$title_displayed) {
                 echo '<fieldset><legend>Queries executed more than once :</legend>';
                 $title_displayed = true;
             }
             echo "<fieldset>";
             echo '<legend id="footer_debug_doublequery_' . $key . '" class="' . Toggler::getClassname('footer_debug_doublequery_' . $key) . '">';
             echo '<b>Run ' . $GLOBALS['DBSTORE'][$key]['nb'] . " times: </b>";
             echo $purifier->purify($GLOBALS['DBSTORE'][$key]['sql']) . "\n";
             echo '</legend>';
             self::_debug_backtraces($GLOBALS['DBSTORE'][$key]['trace']);
             echo "</fieldset>";
         }
     }
     if ($title_displayed) {
         echo '</fieldset>';
     }
     echo '<fieldset>';
     echo '<legend id="footer_debug_session" class="' . Toggler::getClassname('footer_debug_session') . '">Session</legend>';
     echo "<div>";
     echo '<a href="#" onclick="new Ajax.Updater(\'footer_debug_session_data\', \'/include/debug_session.php?reload\');return false;">reload</a>';
     echo '  |  ';
     echo '<a href="#" onclick="new Ajax.Updater(\'footer_debug_session_data\', \'/include/debug_session.php?reset\');return false;">reset</a>';
     echo '<pre id="footer_debug_session_data">' . print_r($_SESSION, 1) . '</pre>';
     echo "</div>";
     echo '</fieldset>';
     echo "</pre>\n";
     echo '</div>';
     echo '</div>';
 }
 /**
  * Compute the content of the widget
  *
  * @return String
  */
 public function getContent()
 {
     $dao = new Git_LogDao();
     $um = UserManager::instance();
     $user = $um->getCurrentUser();
     $date = $_SERVER['REQUEST_TIME'] - $this->pastDays * 24 * 60 * 60;
     $result = $dao->getLastPushesRepositories($user->getId(), $date);
     $content = '';
     $project = '';
     $dh = new DateHelper();
     if ($result && !$result->isError()) {
         foreach ($result as $entry) {
             if (!empty($entry['repository_namespace'])) {
                 $namespace = $entry['repository_namespace'] . "/";
             } else {
                 $namespace = '';
             }
             $dar = $dao->getLastPushesByUser($user->getId(), $entry['repository_id'], $this->offset, $date);
             if ($dar && !$dar->isError() && $dar->rowCount() > 0) {
                 if ($project != $entry['group_name']) {
                     if (!empty($project)) {
                         $content .= '</fieldset>';
                     }
                     $project = $entry['group_name'];
                     $content .= '<fieldset>
                                  <legend id="plugin_git_user_pushes_widget_project_' . $project . '" class="' . Toggler::getClassname('plugin_git_user_pushes_widget_project_' . $project) . '">
                                  <span title="' . $GLOBALS['Language']->getText('plugin_git', 'tree_view_project') . '">
                                  <b>' . $project . '</b>
                                  </span>
                                  </legend>
                                  <a href="' . $this->pluginPath . '/index.php?group_id=' . $entry['group_id'] . '">[ ' . $GLOBALS['Language']->getText('plugin_git', 'widget_user_pushes_details') . ' ]</a>';
                 }
                 $content .= '<fieldset>
                              <legend id="plugin_git_user_pushes_widget_repo_' . $project . $namespace . $entry['repository_name'] . '" class="' . Toggler::getClassname('plugin_git_user_pushes_widget_repo_' . $project . $namespace . $entry['repository_name']) . '">
                              <span title="' . $GLOBALS['Language']->getText('plugin_git', 'tree_view_repository') . '">
                              ' . $namespace . $entry['repository_name'] . '
                              </span>
                              </legend>
                              ' . html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_git', 'tree_view_date'), $GLOBALS['Language']->getText('plugin_git', 'tree_view_commits')));
                 $i = 0;
                 $hp = Codendi_HTMLPurifier::instance();
                 foreach ($dar as $row) {
                     $content .= '<tr class="' . html_get_alt_row_color(++$i) . '">
                                      <td><span title="' . $dh->timeAgoInWords($row['push_date'], true) . '">' . $hp->purify(format_date($GLOBALS['Language']->getText('system', 'datefmt'), $row['push_date'])) . '</span></td>
                                      <td>
                                          <a href="' . $this->pluginPath . '/index.php/' . $entry['group_id'] . '/view/' . $entry['repository_id'] . '/">
                                          ' . $hp->purify($row['commits_number']) . '
                                          </a>
                                      </td>
                                  </tr>';
                 }
                 $content .= "</table>\n                                 </fieldset>";
             } else {
                 $content .= $GLOBALS['Language']->getText('plugin_git', 'widget_user_pushes_no_content');
             }
         }
     } else {
         $content = $GLOBALS['Language']->getText('plugin_git', 'widget_user_pushes_no_content');
     }
     return $content;
 }
Example #28
0
//echo html_build_list_table_top($title_arr) . "\n";
function col_heading($title)
{
    global $HTML;
    return '<FONT COLOR="' . $HTML->FONTCOLOR_HTMLBOX_TITLE . '"><B>' . $title . '</B></FONT>';
}
global $HTML;
echo '
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr align="middle" BGCOLOR="' . $HTML->COLOR_HTMLBOX_TITLE . '">' . '<td rowspan="2">' . col_heading('Package') . '</td>' . '<td rowspan="2">' . col_heading('Release<BR>&amp; Notes') . '</td>' . '<td rowspan="2">' . col_heading('Filename') . '</td>' . '<td colspan="4">' . col_heading('Date') . '</td>' . '</tr>
<tr align="middle" BGCOLOR="' . $HTML->COLOR_HTMLBOX_TITLE . '">' . '<td>' . col_heading('Size') . '</td>' . '<td>' . col_heading('D/L') . '</td>' . '<td>' . col_heading('Arch.') . '</td>' . '<td>' . col_heading('Type') . '</td>' . '</tr>
';
$proj_stats['packages'] = $num_packages;
// Iterate and show the packages
for ($p = 0; $p < $num_packages; $p++) {
    $cur_color = html_get_alt_row_color($p);
    print '<TR bgcolor="' . $cur_color . '"><TD colspan="3"><h3>' . db_result($res_package, $p, 'name') . '</h3></TD><TD COLSPAN="4">&nbsp;</TD></TR>' . "\n";
    // get the releases of the package
    $sql = "SELECT * FROM frs_release WHERE package_id='" . db_result($res_package, $p, 'package_id') . "' " . "AND status_id=1 ORDER BY release_date DESC";
    $res_release = db_query($sql);
    $num_releases = db_numrows($res_release);
    $proj_stats['releases'] += $num_releases;
    if (!$res_release || $num_releases < 1) {
        print '<TR bgcolor="' . $cur_color . '"><TD colspan="3">&nbsp;&nbsp;<i>No Releases</i></TD><TD COLSPAN="4">&nbsp;</TD></TR>' . "\n";
    } else {
        // iterate and show the releases of the package
        for ($r = 0; $r < $num_releases; $r++) {
            $package_release = db_fetch_array($res_release);
            // Highlight the release if one was chosen
            if ($release_id && $release_id == $package_release['release_id']) {
                $bgcolor = "pink";
Example #29
0
    echo html_build_list_table_top($title_arr);
    /*
    	List packages if there are any
    */
    if ($rows2 > 0) {
        echo '
			<TR BGCOLOR="EFEFEF"><TD COLSPAN="3"><B>Packages Of Snippets</B></TD>';
    }
    for ($i = 0; $i < $rows2; $i++) {
        echo '
			<TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD ROWSPAN="2" VALIGN="top"><A HREF="/snippet/detail.php?type=package&id=' . db_result($result2, $i, 'snippet_package_id') . '"><B>' . sprintf("%06d", db_result($result2, $i, 'snippet_package_id')) . '</B></A></TD><TD><B>' . db_result($result2, $i, 'name') . '</TD><TD>' . db_result($result2, $i, 'user_name') . '</TD></TR>';
        echo '
			<TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD COLSPAN="2">' . util_make_links(nl2br(db_result($result2, $i, 'description'))) . '</TD></TR>';
    }
    /*
    	List snippets if there are any
    */
    if ($rows > 0) {
        echo '
			<TR BGCOLOR="EFEFEF"><TD COLSPAN="3"><B>Snippets</B></TD>';
    }
    for ($i = 0; $i < $rows; $i++) {
        echo '
			<TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD ROWSPAN="2" VALIGN="top"><A HREF="/snippet/detail.php?type=snippet&id=' . db_result($result, $i, 'snippet_id') . '"><B>' . sprintf("%06d", db_result($result, $i, 'snippet_id')) . '</B></A></TD><TD><B>' . db_result($result, $i, 'name') . '</TD><TD>' . db_result($result, $i, 'user_name') . '</TD></TR>';
        echo '
			<TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD COLSPAN="2">' . util_make_links(nl2br(db_result($result, $i, 'description'))) . '</TD></TR>';
    }
    echo '
		</TABLE>';
}
snippet_footer(array());
Example #30
0
        } else {
            echo '<TR><TD COLSPAN=2><B>Date:</B> ' . date($sys_datefmt, db_result($res, $i, 'date_posted')) . '<BR>
			<B>Subject:</B> ' . db_result($res, $i, 'summary') . '<P>
			<B>Body:</B><BR>
			' . nl2br(db_result($res, $i, 'details')) . '
			</TD></TR>';
        }
    }
    /*
    	List all diary entries
    */
    $sql = "SELECT * FROM user_diary WHERE user_id='{$diary_user}' AND is_public=1 ORDER BY id DESC";
    $result = db_query($sql);
    $rows = db_numrows($result);
    if (!$result || $rows < 1) {
        echo '
			<TR><TD COLSPAN=2><B>This User Has No Diary Entries</B></TD></TR>';
        echo db_error();
    } else {
        for ($i = 0; $i < $rows; $i++) {
            echo '
			<TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD><A HREF="' . $PHP_SELF . '?diary_id=' . db_result($result, $i, 'id') . '&diary_user='******'">' . db_result($result, $i, 'summary') . '</A></TD>' . '<TD>' . date($sys_datefmt, db_result($result, $i, 'date_posted')) . '</TD></TR>';
        }
        echo '
		<TR><TD COLSPAN="2" BGCOLOR="' . $HTML->COLOR_CONTENT_BACK . '">&nbsp;</TD></TR>';
    }
    echo $HTML->box1_bottom();
    echo $HTML->footer(array());
} else {
    exit_error('ERROR', 'No User Selected');
}