コード例 #1
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
}
コード例 #2
0
ファイル: index.php プロジェクト: nterray/tuleap
 function all(&$request)
 {
     $html = '';
     $servers = $this->server_factory->getAllServers();
     if (count($servers)) {
         $title_arr = array($GLOBALS['Language']->getText('admin_servers', 'all_name'), $GLOBALS['Language']->getText('admin_servers', 'all_description'), 'HTTP', 'HTTPS', $GLOBALS['Language']->getText('admin_servers', 'all_is_master'), '');
         $html .= html_build_list_table_top($title_arr);
         $row_num = 0;
         foreach ($servers as $key => $nop) {
             $html .= '<tr class="' . util_get_alt_row_color($row_num++) . '">';
             $html .= '<td><a title="' . $GLOBALS['Language']->getText('admin_servers', 'all_edit', array(htmlentities($servers[$key]->getName(), ENT_QUOTES, 'UTF-8'))) . '" href="/admin/servers/edit/' . $servers[$key]->getId() . '">' . $servers[$key]->getId() . '. ' . $servers[$key]->getName() . '</a></td>';
             $html .= '<td>' . $servers[$key]->getDescription() . '</td>';
             $html .= '<td>' . $servers[$key]->getHttp() . '</td>';
             $html .= '<td>' . $servers[$key]->getHttps() . '</td>';
             $html .= '<td style="text-align:center">' . ($servers[$key]->isMaster() ? $GLOBALS['Language']->getText('admin_servers', 'all_master') : '-') . '</td>';
             $html .= '<td>';
             if (!$servers[$key]->isMaster()) {
                 $html .= '<a title="' . $GLOBALS['Language']->getText('admin_servers', 'all_delete', array(htmlentities($servers[$key]->getName(), ENT_QUOTES, 'UTF-8'))) . '" href="/admin/servers/delete/' . $servers[$key]->getId() . '">' . $GLOBALS['Response']->getImage('ic/trash.png', array('alt' => 'Delete server')) . '</a>';
             } else {
                 $html .= '-';
             }
             $html .= '</td>';
             $html .= '</tr>';
         }
         $html .= '</table>';
     } else {
         $html .= '<p>No servers</p>';
     }
     $html .= '<p><a href="/admin/servers/add">' . $GLOBALS['Language']->getText('admin_servers', 'all_add') . '</a> ';
     if (count($servers)) {
         $html .= '| <a href="/admin/servers/master">' . $GLOBALS['Language']->getText('admin_servers', 'all_choose') . '</a>';
     }
     $html .= '</p>';
     return $html;
 }
コード例 #3
0
 /**
  * create the html output to visualize what has been parsed
  * @param $users: array containing all the users (User Object) that are in the import file
  */
 function showParseResults($parsed_users)
 {
     global $Language;
     echo $Language->getText('project_admin_userimport', 'ready') . "<br><br>\n";
     //Display table containing the list of users to be imported
     $title_arr = array($Language->getText('project_admin_userimport', 'username'), $Language->getText('project_admin_userimport', 'mail_addr'));
     echo html_build_list_table_top($title_arr);
     $i = 0;
     foreach ($parsed_users as $current_user) {
         echo '<TR class="' . util_get_alt_row_color($i++) . '">' . "\n";
         echo '<TD>' . $current_user->getName() . '</TD>' . "\n";
         echo '<TD>' . $current_user->getEmail() . '</TD></TR>' . "\n";
     }
     echo "</TABLE>\n";
     // Add 'import'  button to confirm import
     echo '<FORM NAME="acceptimportdata" action="?" method="POST" enctype="multipart/form-data">
         <p align="left"><INPUT TYPE="SUBMIT" NAME="submit" VALUE="' . $Language->getText('project_admin_userimport', 'import') . '"></p>
         <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $this->group_id . '">
         <INPUT TYPE="HIDDEN" NAME="func" VALUE="import">
         <INPUT TYPE="HIDDEN" NAME="mode" VALUE="import">';
     foreach ($parsed_users as $current_user) {
         echo '<INPUT TYPE="HIDDEN" NAME="parsed_users[]" VALUE="' . $current_user->getId() . '">';
     }
     echo '</FORM><A href="/project/admin/userimport.php?group_id=' . $this->group_id . '"> [' . $Language->getText('global', 'back') . ']</A>';
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 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;
 }
 private function getTableHeader()
 {
     $title = array();
     $title[] = $GLOBALS['Language']->getText('plugin_statistics', 'project_name');
     $title[] = $GLOBALS['Language']->getText('plugin_statistics', 'current_size');
     $title[] = $GLOBALS['Language']->getText('plugin_statistics', 'quota');
     $title[] = $GLOBALS['Language']->getText('plugin_statistics', 'exceeding_size');
     $title[] = $GLOBALS['Language']->getText('plugin_statistics', 'warn_administrators');
     $table_header = html_build_list_table_top($title);
     return $table_header;
 }
 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;
 }
コード例 #8
0
ファイル: snippet_utils.php プロジェクト: pombredanne/tuleap
function snippet_show_package_snippets($version)
{
    global $Language;
    $version = (int) $version;
    //show the latest version
    $sql = "SELECT snippet.snippet_id, snippet_package_item.snippet_version_id, snippet_version.version,snippet.name,user.user_name, snippet_version.filesize " . "FROM snippet,snippet_version,snippet_package_item,user " . "WHERE snippet.snippet_id=snippet_version.snippet_id " . "AND user.user_id=snippet_version.submitted_by " . "AND snippet_version.snippet_version_id=snippet_package_item.snippet_version_id " . "AND snippet_package_item.snippet_package_version_id='" . db_ei($version) . "'";
    $result = db_query($sql);
    $rows = db_numrows($result);
    echo '
	<P>
	<H3>' . $Language->getText('snippet_add_snippet_to_package', 's_in_p') . '</H3>
	<P>';
    $title_arr = array();
    $title_arr[] = $Language->getText('snippet_utils', 'version_id');
    $title_arr[] = $Language->getText('snippet_details', 's_version');
    $title_arr[] = $Language->getText('snippet_browse', 'title');
    $title_arr[] = $Language->getText('snippet_details', 'author');
    echo html_build_list_table_top($title_arr, $links_arr);
    if (!$result || $rows < 1) {
        echo db_error();
        echo '
			<TR><TD COLSPAN="4"><H3>' . $Language->getText('snippet_add_snippet_to_package', 'no_s_in_p') . '</H3></TD></TR>';
    } else {
        //get the newest version, so we can display it's code
        $newest_version = db_result($result, 0, 'snippet_version_id');
        for ($i = 0; $i < $rows; $i++) {
            echo '
			<TR class="' . util_get_alt_row_color($i) . '">
                            <TD><A HREF="/snippet/detail.php?type=snippet&id=' . db_result($result, $i, 'snippet_id') . '"><b><center>' . db_result($result, $i, 'snippet_version_id') . '</center></b></A></TD>
                            <TD>';
            echo '<A HREF="/snippet/download.php?type=snippet&id=' . db_result($result, $i, 'snippet_version_id') . '"><b><center>' . db_result($result, $i, 'version') . '</b></A>';
            // For uploaded files, the user can choose between view or display the code snippet
            if (db_result($result, $i, 'filesize') != 0) {
                // View link : the file is forced to be displayed as a text
                echo '&nbsp;<a href="/snippet/download.php?mode=view&type=snippet&id=' . db_result($result, $i, 'snippet_version_id') . '">';
                echo '<img src="' . util_get_image_theme("ic/view.png") . '" border="0" alt="' . $Language->getText('snippet_details', 'view') . '" title="' . $Language->getText('snippet_details', 'view') . '"></a>';
                // Download link : the file is forced to be downloaded
                echo '&nbsp;<a href="/snippet/download.php?mode=download&type=snippet&id=' . db_result($result, $i, 'snippet_version_id') . '">';
                echo '<img src="' . util_get_image_theme("ic/download.png") . '" border="0" alt="' . $Language->getText('snippet_details', 'download') . '" title="' . $Language->getText('snippet_details', 'download') . '"></a>';
            }
            $user = UserManager::instance()->getUserByUserName(db_result($result, $i, 'user_name'));
            echo '</center></TD>
                             <TD>' . db_result($result, $i, 'name') . '</TD><TD>' . UserHelper::instance()->getLinkOnUser($user) . '</TD></TR>';
        }
    }
    echo '</TABLE>';
}
コード例 #9
0
 /**
  * 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;
 }
コード例 #10
0
ファイル: index.php プロジェクト: nterray/tuleap
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>");
}
コード例 #11
0
ファイル: showdetails.php プロジェクト: nterray/tuleap
function getReferencesTable($groupId)
{
    $html = '';
    $html .= '<h3>' . $GLOBALS['Language']->getText('project_showdetails', 'references') . '</h3>';
    $title_arr[] = $GLOBALS['Language']->getText('project_reference', 'r_keyword');
    $title_arr[] = $GLOBALS['Language']->getText('project_reference', 'r_desc');
    $title_arr[] = $GLOBALS['Language']->getText('project_reference', 'r_link');
    $html .= html_build_list_table_top($title_arr, false, false, true);
    $referenceManager =& ReferenceManager::instance();
    $references =& $referenceManager->getReferencesByGroupId($groupId);
    // References are sorted by scope first
    $row_num = 0;
    foreach ($references as $ref) {
        $html .= getReferenceRow($ref, $row_num);
        $row_num++;
    }
    $html .= '</table>';
    return $html;
}
コード例 #12
0
 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;
 }
コード例 #13
0
 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>";
 }
コード例 #14
0
ファイル: index.php プロジェクト: BackupTheBerlios/berlios
 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>");
 }
コード例 #15
0
 function showAvailableReports()
 {
     $hp = Codendi_HTMLPurifier::instance();
     $g = $GLOBALS['ath']->getGroup();
     $group_id = $g->getID();
     $atid = $GLOBALS['ath']->getID();
     $reports = $this->grf->getReports_ids();
     echo '<H2>' . $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'tracker') . ' \'<a href="/tracker/admin/?group_id=' . $group_id . '&atid=' . $atid . '">' . $hp->purify($GLOBALS['ath']->getName()) . '</a>\'' . $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'report_admin') . '</H2>';
     if ($reports) {
         // Loop through the list of all graphic reports
         $title_arr = array();
         $title_arr[] = $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'report_name');
         $title_arr[] = $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'desc');
         $title_arr[] = $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'scope');
         $title_arr[] = $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'delete');
         echo '<p>' . $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'mod');
         echo html_build_list_table_top($title_arr);
         for ($i = 0; $i < count($reports); $i++) {
             $r = new GraphOnTrackers_Report($reports[$i]);
             echo '<TR class="' . util_get_alt_row_color($i) . '"><TD>';
             if ($r->getScope() == 'S' || !$GLOBALS['ath']->userIsAdmin() && $r->getScope() == 'P') {
                 echo $hp->purify($r->getName());
             } else {
                 echo '<A HREF="/tracker/admin/?func=reportgraphic&group_id=' . $group_id . '&report_graphic_id=' . $r->getId() . '&atid=' . $GLOBALS['ath']->getID() . '">' . $hp->purify($r->getName()) . '</A>';
             }
             echo "</td>" . "\n<td>" . $hp->purify($r->getDescription(), CODENDI_PURIFIER_BASIC) . '</td>' . "\n<td align=\"center\">" . $hp->purify($r->getScopeLabel($r->getScope())) . '</td>' . "\n<td align=\"center\">";
             if ($r->getScope() == 'S' || !$GLOBALS['ath']->userIsAdmin() && $r->getScope() == 'P') {
                 echo '-';
             } else {
                 $delete_report_text = $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'delete_report', $r->getName());
                 $delete_report_text_js = $hp->purify($delete_report_text, CODENDI_PURIFIER_JS_QUOTE);
                 echo '<A HREF="/tracker/admin/?func=reportgraphic' . '&report_graphic_id=' . $r->getId() . '&group_id=' . $group_id . '&atid=' . $atid . '&delete_report_graphic=1"' . '" onClick="return confirm(\'' . $delete_report_text_js . '\')">' . '<img src="' . util_get_image_theme("ic/trash.png") . '" border="0"></A>';
             }
             echo '</td></tr>';
         }
         echo '</TABLE>';
     } else {
         echo '<p><h3>' . $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'no_rep_def') . '</h3>';
     }
     echo '<P> ' . $GLOBALS['Language']->getText('plugin_graphontrackers_include_report', 'create_report', array('/tracker/admin/?func=reportgraphic&group_id=' . $group_id . '&atid=' . $atid . '&new_report_graphic=1'));
 }
コード例 #16
0
 function fetch($id, $params)
 {
     $html = '';
     if ($params['user_can_manage']) {
         $titles = array();
         $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_permissions_ugroups');
         $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_permissions_perms');
         $html .= html_build_list_table_top($titles, false, false, false);
         $odd_even = array('boxitem', 'boxitemalt');
         $i = 0;
         $ugroups = permission_get_ugroups_permissions($params['group_id'], $id, array('PLUGIN_DOCMAN_READ', 'PLUGIN_DOCMAN_WRITE', 'PLUGIN_DOCMAN_MANAGE'), false);
         ksort($ugroups);
         foreach ($ugroups as $ugroup) {
             $html .= '<tr class="' . $odd_even[$i++ % count($odd_even)] . '">';
             $html .= '<td>' . $ugroup['ugroup']['name'] . '</td>';
             $html .= '<td style="text-align:center;"><select name="permissions[' . $ugroup['ugroup']['id'] . ']">';
             $html .= '<option value="100">-</option>';
             $perms = array('PLUGIN_DOCMAN_READ', 'PLUGIN_DOCMAN_WRITE', 'PLUGIN_DOCMAN_MANAGE');
             $i = 1;
             foreach ($perms as $perm) {
                 if (isset($params['force_permissions'][$ugroup['ugroup']['id']])) {
                     $selected = $params['force_permissions'][$ugroup['ugroup']['id']] == $i ? 'selected="selected"' : '';
                 } else {
                     $selected = isset($ugroup['permissions'][$perm]) ? 'selected="selected"' : '';
                 }
                 $html .= '<option value="' . $i++ . '" ' . $selected . '>' . permission_get_name($perm) . '</option>';
             }
             $html .= '</select></td>';
             $html .= '</tr>';
         }
         $html .= '</table>';
     } else {
         $html .= $GLOBALS['Language']->getText('plugin_docman', 'new_same_perms_as_parent');
         // Will be created with the same permissions than its parent.
         $html .= $GLOBALS['Language']->getText('plugin_docman', 'new_need_to_be_manager');
         // <br />You need Manage permission to define permissions.
     }
     return $html;
 }
 /**
  * Show list of people monitoring the document directly or indirectly by monitoring one of the parents and its subitems
  *
  * @param Integer $itemId Id of the document
  *
  * @return String
  */
 function displayListeningUsers($itemId)
 {
     $dpm = Docman_PermissionsManager::instance($this->item->getGroupId());
     $userHelper = new UserHelper();
     $um = UserManager::instance();
     $content = '';
     if ($dpm->userCanManage($um->getCurrentUser(), $itemId)) {
         $listeners = $this->notificationsManager->getListeningUsers($this->item);
         if (!empty($listeners)) {
             $content .= '<fieldset><legend>' . $GLOBALS['Language']->getText('plugin_docman', 'details_listeners') . '</legend>';
             $content .= '<form name="remove_monitoring" method="POST" action="">';
             $content .= '<input type="hidden" name="action" value="remove_monitoring" />';
             $content .= '<table><tr><td>';
             $content .= html_build_list_table_top(array($GLOBALS['Language']->getText('people_viewprofile', 'user_name'), $GLOBALS['Language']->getText('plugin_docman', 'details_notifications_monitored_doc'), $GLOBALS['Language']->getText('docman_doc_utils', 'delete_ask')), false, false, false);
             $rowBgColor = 0;
             $hp = Codendi_HTMLPurifier::instance();
             foreach ($listeners as $userId => $item) {
                 $content .= '<tr class="' . html_get_alt_row_color(++$rowBgColor) . '">';
                 $user = $um->getUserById($userId);
                 $content .= '<td>' . $userHelper->getDisplayName($user->getName(), $user->getRealName()) . '</td>';
                 $content .= '<td>' . $item->getTitle() . '</td><td>';
                 if ($this->item == $item) {
                     $content .= '<input type="checkbox" value="' . $userId . '" name="listeners_to_delete[]">';
                 } else {
                     $content .= '<input type="checkbox" value="' . $userId . '" name="listeners_to_delete[]" disabled="disabled">';
                 }
                 $content .= '</td></tr>';
             }
             // TODO : ask user if he wants or not to notify the users he remove
             // TODO : We may ask him also if his name will appear as the guilty one or not
             $content .= '<td colspan="2"><input type="submit" value="' . $GLOBALS['Language']->getText('plugin_docman', 'action_delete') . '"></td></tr>';
             $content .= '</tbody></table></form>';
             $content .= '</td><td><div class="docman_help">' . $GLOBALS['Language']->getText('plugin_docman', 'details_notifications_help') . '</div></td></tr>';
         }
         $content .= $this->addListeningUser($itemId);
         $content .= '</table></fieldset>';
     }
     return $content;
 }
コード例 #18
0
 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>");
 }
コード例 #19
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>";
}
コード例 #20
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;
 }
コード例 #21
0
ファイル: browse.php プロジェクト: BackupTheBerlios/berlios
    } else {
        exit_error('Error', 'Error - bad url?');
    }
}
$result = db_query($sql);
$rows = db_numrows($result);
$result2 = db_query($sql2);
$rows2 = db_numrows($result2);
if ((!$result || $rows < 1) && (!$result2 || $rows2 < 1)) {
    echo '<H2>No snippets found</H2>';
} else {
    $title_arr = array();
    $title_arr[] = 'Snippet ID';
    $title_arr[] = 'Title';
    $title_arr[] = 'Creator';
    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
コード例 #22
0
 /**
  *  Display the field sets list
  *
  *  @return void
  */
 function displayFieldSetList()
 {
     global $ath, $art_fieldset_fact, $Language;
     $hp = Codendi_HTMLPurifier::instance();
     echo '<h3>' . $Language->getText('tracker_include_type', 'list_all_fieldsets') . '</h3>';
     echo '<p>' . $Language->getText('tracker_include_report', 'mod');
     // Show all the fields currently available in the system
     $i = 0;
     $title_arr = array();
     $title_arr[] = $Language->getText('tracker_include_type', 'fieldset_name');
     $title_arr[] = $Language->getText('tracker_include_artifact', 'desc');
     $title_arr[] = $Language->getText('tracker_include_type', 'fields_inside');
     $title_arr[] = $Language->getText('tracker_include_type', 'rank_screen');
     $title_arr[] = $Language->getText('tracker_include_canned', 'delete');
     echo html_build_list_table_top($title_arr);
     // Build HTML ouput for  Used fields
     $iu = 0;
     $fieldsets = $art_fieldset_fact->getAllFieldSets();
     $html = "";
     foreach ($fieldsets as $fieldset) {
         $rank = $fieldset->getRank() ? $fieldset->getRank() : "-";
         $html .= '<tr class="' . util_get_alt_row_color($iu) . '">';
         $html .= '<td><a href="?group_id=' . (int) $this->Group->getID() . "&atid=" . (int) $this->getID() . '&func=display_fieldset_update&fieldset_id=' . (int) $fieldset->getID() . '">' . $hp->purify(SimpleSanitizer::unsanitize($fieldset->getLabel()), CODENDI_PURIFIER_CONVERT_HTML) . '</A></td>';
         $html .= '<td>' . $hp->purify(SimpleSanitizer::unsanitize($fieldset->getDescriptionText()), CODENDI_PURIFIER_BASIC, $this->getGroupId()) . '</td>';
         $html .= '<td>';
         $fields_contained = $fieldset->getArtifactFields();
         if (count($fields_contained) > 0) {
             $html .= '<ul>';
             foreach ($fields_contained as $field_contained) {
                 $link_field_usage = '/tracker/admin/?func=display_field_update&group_id=' . (int) $this->Group->getID() . '&atid=' . (int) $this->getID() . '&field_id=' . (int) $field_contained->getID();
                 $html .= '<li>';
                 if ($field_contained->getUseIt()) {
                     $html .= '<strong><a href="' . $link_field_usage . '">' . $hp->purify(SimpleSanitizer::unsanitize($field_contained->getLabel()), CODENDI_PURIFIER_CONVERT_HTML) . '</a></strong>';
                 } else {
                     $html .= '<em><a href="' . $link_field_usage . '">' . $hp->purify(SimpleSanitizer::unsanitize($field_contained->getLabel()), CODENDI_PURIFIER_CONVERT_HTML) . '</a></em>';
                 }
                 $html .= '</li>';
             }
             $html .= '</ul>';
         } else {
             $html .= '- - -';
             // $Language-> getText('tracker_include_type','empty_fieldset');
         }
         $html .= '</td>';
         $html .= '<td align="center">' . $hp->purify($rank, CODENDI_PURIFIER_CONVERT_HTML) . '</td>';
         $html .= '<td align="center">';
         // Only possible to delete empty field sets (containing no fields inside)
         if (count($fields_contained) <= 0) {
             $html .= '<a href="/tracker/admin/?func=fieldset_delete&group_id=' . (int) $this->Group->getID() . '&atid=' . (int) $this->getID() . '&fieldset_id=' . (int) $fieldset->getID() . '"><img src="' . util_get_image_theme("ic/trash.png") . '" border="0" onClick="return confirm(\'' . $Language->getText('tracker_include_type', 'warning_delete_fieldset') . '\')"></a>';
         }
         $html .= '</td>';
         $html .= '</tr>';
         $iu++;
     }
     echo $html;
     echo '</table>';
     echo '<hr>';
 }
コード例 #23
0
 /**
  * Display the artifact inverse dependencies list
  *
  * @param group_id: the group id
  * @param group_artifact_id: the artifact type ID
  * @param ascii: ascii mode
  *
  * @return void
  */
 function showInverseDependencies($group_id, $group_artifact_id, $ascii = false)
 {
     $hp = Codendi_HTMLPurifier::instance();
     global $sys_lf, $Language;
     //
     //      format the dependencies list for this artifact
     //
     $result = $this->getInverseDependencies();
     $rows = db_numrows($result);
     $out = '';
     // Nobody in the dependencies list -> return now
     if ($rows <= 0) {
         if ($ascii) {
             $out = $Language->getText('tracker_include_artifact', 'no_depend') . "{$sys_lf}";
         } else {
             $out = '<H4>' . $Language->getText('tracker_include_artifact', 'no_depend') . '</H4>';
         }
         return $out;
     }
     // Header first an determine what the print out format is
     // based on output type (Ascii, HTML)
     if ($ascii) {
         $out .= $Language->getText('tracker_include_artifact', 'dep_list') . $sys_lf . str_repeat("*", strlen($Language->getText('tracker_include_artifact', 'dep_list'))) . "{$sys_lf}{$sys_lf}";
         $fmt = "%-15s | %s (%s){$sys_lf}";
         $out .= sprintf($fmt, $Language->getText('tracker_include_artifact', 'artifact'), $Language->getText('tracker_include_artifact', 'summary'), $Language->getText('global', 'status'));
         $out .= "------------------------------------------------------------------{$sys_lf}";
     } else {
         $title_arr = array();
         $title_arr[] = $Language->getText('tracker_include_artifact', 'artifact');
         $title_arr[] = $Language->getText('tracker_include_artifact', 'summary');
         $title_arr[] = $Language->getText('global', 'status');
         $title_arr[] = $Language->getText('tracker_import_admin', 'tracker');
         $title_arr[] = $Language->getText('tracker_include_artifact', 'group');
         $out .= html_build_list_table_top($title_arr);
         $fmt = "\n" . '<TR class="%s"><td>%s</td><td>%s</td><td align="center">%s</td>' . '<td align="center">%s</td><td align="center">%s</td></tr>';
     }
     // Loop through the denpendencies and format them
     for ($i = 0; $i < $rows; $i++) {
         $dependent_on_artifact_id = db_result($result, $i, 'artifact_id');
         $summary = db_result($result, $i, 'summary');
         $status = db_result($result, $i, 'status');
         $tracker_label = db_result($result, $i, 'name');
         $group_label = db_result($result, $i, 'group_name');
         if ($ascii) {
             $out .= sprintf($fmt, $dependent_on_artifact_id, $summary, $status);
         } else {
             $out .= sprintf($fmt, util_get_alt_row_color($i), '<a href="/tracker/?func=gotoid&group_id=' . (int) $group_id . '&aid=' . (int) $dependent_on_artifact_id . '">' . (int) $dependent_on_artifact_id . '</a>', $hp->purify(util_unconvert_htmlspecialchars($summary), CODENDI_PURIFIER_CONVERT_HTML), $hp->purify($status, CODENDI_PURIFIER_CONVERT_HTML), $hp->purify(SimpleSanitizer::unsanitize($tracker_label), CODENDI_PURIFIER_CONVERT_HTML), $hp->purify(util_unconvert_htmlspecialchars($group_label), CODENDI_PURIFIER_CONVERT_HTML));
         }
         // for
     }
     // final touch...
     $out .= $ascii ? "{$sys_lf}" : "</TABLE>";
     return $out;
 }
コード例 #24
0
 /**
  * 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;
 }
コード例 #25
0
ファイル: Artifact.class.php プロジェクト: nterray/tuleap
 /**
  * Display the list of attached files
  *
  * @param group_id: the group id
  * @param group_artifact_id: the artifact type ID
  * @param ascii: ascii mode
  *
  * @return void
  */
 function showAttachedFiles($group_id, $group_artifact_id, $ascii = false, $pv = 0)
 {
     global $Language;
     $hp = $this->getHtmlPurifier();
     //
     //  show the files attached to this artifact
     //
     $result = $this->getAttachedFiles();
     $rows = db_numrows($result);
     // No file attached -> return now
     if ($rows <= 0) {
         if ($ascii) {
             $out = $Language->getText('tracker_include_artifact', 'no_file_attached') . $GLOBALS['sys_lf'];
         } else {
             $out = '<H4>' . $Language->getText('tracker_include_artifact', 'no_file_attached') . '</H4>';
         }
         return $out;
     }
     // Header first
     if ($ascii) {
         $out = $Language->getText('tracker_include_artifact', 'file_attachment') . $GLOBALS['sys_lf'] . str_repeat("*", strlen($Language->getText('tracker_include_artifact', 'file_attachment')));
     } else {
         $title_arr = array();
         $title_arr[] = $Language->getText('tracker_include_artifact', 'name');
         $title_arr[] = $Language->getText('tracker_include_artifact', 'desc');
         $title_arr[] = $Language->getText('tracker_include_artifact', 'size_kb');
         $title_arr[] = $Language->getText('global', 'by');
         $title_arr[] = $Language->getText('tracker_include_artifact', 'posted_on');
         if ($pv == 0) {
             $title_arr[] = $Language->getText('tracker_include_canned', 'delete');
         }
         $out = html_build_list_table_top($title_arr);
     }
     // Determine what the print out format is based on output type (Ascii, HTML)
     if ($ascii) {
         $fmt = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . "------------------------------------------------------------------" . $GLOBALS['sys_lf'] . $Language->getText('tracker_import_utils', 'date') . ": %s  " . $Language->getText('tracker_include_artifact', 'name') . ": %s  " . $Language->getText('tracker_include_artifact', 'size') . ": %dKB   " . $Language->getText('global', 'by') . ": %s" . $GLOBALS['sys_lf'] . "%s" . $GLOBALS['sys_lf'] . "%s";
     } else {
         $fmt = "" . $GLOBALS['sys_lf'] . '<TR class="%s"><td>%s</td><td>%s</td><td align="center">%s</td><td align="center">%s</td><td align="center">%s</td>';
         if ($pv == 0) {
             $fmt .= '<td align="center">%s</td>';
         }
         $fmt .= '</tr>';
     }
     // Determine which protocl to use for embedded URL in ASCII format
     $server = get_server_url();
     // Loop throuh the attached files and format them
     for ($i = 0; $i < $rows; $i++) {
         $artifact_file_id = db_result($result, $i, 'id');
         $href = "/tracker/download.php?artifact_id=" . (int) $this->getID() . "&id=" . (int) $artifact_file_id;
         if ($ascii) {
             $out .= sprintf($fmt, format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 'adddate')), db_result($result, $i, 'filename'), intval(db_result($result, $i, 'filesize') / 1024), db_result($result, $i, 'user_name'), SimpleSanitizer::unsanitize(db_result($result, $i, 'description')), $server . $href);
         } else {
             // show CC delete icon if one of the condition is met:
             // (a) current user is group member
             // (b) the current user is the person who added a gieven name in CC list
             if (user_ismember($this->ArtifactType->getGroupID()) || user_getname(user_getid()) == db_result($result, $i, 'user_name')) {
                 $html_delete = '<a href="?func=delete_file&group_id=' . (int) $group_id . "&atid=" . (int) $group_artifact_id . "&aid=" . (int) $this->getID() . "&id=" . (int) db_result($result, $i, 'id') . '" ' . ' onClick="return confirm(\'' . $Language->getText('tracker_include_artifact', 'delete_attachment') . '\')">' . '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" BORDER="0" ALT="' . $Language->getText('global', 'btn_delete') . '"></A>';
             } else {
                 $html_delete = '-';
             }
             $out .= sprintf($fmt, util_get_alt_row_color($i), '<a href="' . $href . '">' . $hp->purify(db_result($result, $i, 'filename'), CODENDI_PURIFIER_CONVERT_HTML) . '</a>', $hp->purify(SimpleSanitizer::unsanitize(db_result($result, $i, 'description')), CODENDI_PURIFIER_BASIC, $group_id), intval(db_result($result, $i, 'filesize') / 1024), util_user_link(db_result($result, $i, 'user_name')), format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 'adddate')), $html_delete);
         }
     }
     // for
     // final touch...
     $out .= $ascii ? "" . $GLOBALS['sys_lf'] . "" : "</TABLE>";
     return $out;
 }
 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;
 }
コード例 #27
0
ファイル: commit_utils.php プロジェクト: pombredanne/tuleap
function show_commit_details($result)
{
    global $group_id, $commit_id, $Language;
    /*
    	Accepts a result set from the commits table. Should include all columns from
    	the table, and it should be joined to USER to get the user_name.
    */
    $rows = db_numrows($result);
    $url = "/cvs/?func=detailcommit&commit_id={$commit_id}&group_id={$group_id}&order=";
    $list_log = '<pre>' . util_make_links(util_line_wrap(db_result($result, 0, 'description')), $group_id) . '</pre>';
    if ($commit_id) {
        $hdr = '[' . $Language->getText('cvs_commit_utils', 'commit') . $commit_id . '] - ';
    } else {
        $hdr = $Language->getText('cvs_commit_utils', 'checkin') . ' ';
    }
    echo '<h2>' . $hdr . uniformat_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, 0, 'c_when')) . '</h2></h2>';
    echo '<table WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2"><tr class="' . util_get_alt_row_color(0) . '"><td>' . $list_log . '</td></tr></table>';
    $crossref_fact = new CrossReferenceFactory($commit_id, ReferenceManager::REFERENCE_NATURE_CVSCOMMIT, $group_id);
    $crossref_fact->fetchDatas();
    if ($crossref_fact->getNbReferences() > 0) {
        echo '<h3> ' . $Language->getText('cross_ref_fact_include', 'references') . '</h3>';
        $crossref_fact->DisplayCrossRefs();
    }
    echo '<h3>' . $Language->getText('cvs_commit_utils', 'impacted_file') . '</h3>';
    $title_arr = array();
    $title_arr[] = $Language->getText('cvs_commit_utils', 'file');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'rev');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'branch');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'type');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'added_line');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'removed_line');
    $links_arr = array();
    $links_arr[] = $url . 'filename';
    $links_arr[] = $url . 'revision';
    $links_arr[] = $url . 'branch';
    $links_arr[] = $url . 'type';
    $links_arr[] = $url . 'addedlines';
    $links_arr[] = $url . 'removedlines';
    echo html_build_list_table_top($title_arr, $links_arr);
    for ($i = 0; $i < $rows; $i++) {
        $commit_id = db_result($result, $i, 'id');
        $type = db_result($result, $i, 'type');
        $added = db_result($result, $i, 'addedlines');
        $removed = db_result($result, $i, 'removedlines');
        $revision = db_result($result, $i, 'revision');
        $filename = db_result($result, $i, 'dir') . '/' . db_result($result, $i, 'file');
        $type_text = $Language->getText('cvs_commit_utils', strtolower($type));
        if ($type == "Change" && $added == 999 && $removed == 999) {
            // the default values
            // back to rcs to complete
            $repo = db_result($result, $i, 'repository');
            $command = "rlog -r" . $revision . " " . $repo . "/" . $filename;
            $output = array();
            exec($command, $output, $ret);
            $added = 0;
            $removed = 0;
            $l = 0;
            while ($l < count($output)) {
                // parse the rlog result till getting "state: Exp;  lines:"
                $line = $output[$l];
                $l++;
                if (ereg('state: +Exp; +lines: +\\+([0-9]*) +\\-([0-9]*)$', $line, $na)) {
                    $added = $na[1];
                    $removed = $na[2];
                    $sql_up = "UPDATE cvs_checkins SET addedlines=" . $added . ", removedlines=" . $removed . " WHERE repositoryid=" . db_result($result, $i, 'repositoryid') . " AND dirid=" . db_result($result, $i, 'dirid') . " AND fileid=" . db_result($result, $i, 'fileid') . " AND revision=" . $revision;
                    $res = db_query($sql_up);
                    break;
                }
            }
        }
        if (!$filename) {
            $filename = '';
        } else {
            if ($type == 'Remove') {
                $filename = makeCvsDirLink($group_id, db_result($result, $i, 'file'), $filename, db_result($result, $i, 'dir'));
                $rev_text = '';
            } else {
                // Clean file path to remove duplicate separators
                $filename = preg_replace('/\\/\\//', '/', $filename);
                $filename = preg_replace('/\\.\\//', '', $filename);
                if ($type == 'Change') {
                    // horrible hack to 'guess previous revision' to diff with
                    $prev = explode(".", $revision);
                    $lastIndex = sizeof($prev);
                    $lastIndex = $lastIndex - 1;
                    if ($prev[$lastIndex] != '1') {
                        $prev[$lastIndex] = $prev[$lastIndex] - 1;
                        $previous = join(".", $prev);
                    } else {
                        $index = 0;
                        $new_prev = array();
                        while ($index <= $lastIndex - 2) {
                            $new_prev[$index] = $prev[$index];
                            $index++;
                        }
                        $previous = join('.', $new_prev);
                    }
                    $type = makeCvsLink($group_id, $filename, $type_text, '', '&r1=' . $previous . '&r2=' . $revision);
                }
                $rev_text = makeCvsLink($group_id, $filename, $revision, $revision, '&view=markup');
                $filename = makeCvsLink($group_id, $filename, $filename, '', '&view=log');
            }
        }
        ##$commits_url = '<A HREF="/commits/download.php/Commits'.$commit_id.'.txt?commit_id='.$id.'">'.$filename.'</a>';
        echo '
			<TR class="' . util_get_alt_row_color($i) . '">' . '<TD class="small"><b>' . $filename . '</b></TD>' . '<TD class="small">' . $rev_text . '</TD>' . '<TD class="small">' . db_result($result, $i, 'branch') . '</TD>' . '<TD class="small">' . $type . '</TD>' . '<TD class="small">' . $added . '</TD>' . '<TD class="small">' . $removed . '</TD></TR>';
    }
    /*
    	Show extra rows for <-- Prev / Next -->
    */
    echo '
		<TR><TD COLSPAN="2" class="small">';
    if ($offset > 0) {
        echo '<A HREF="?func=browse&group_id=' . $group_id . '&set=' . $set . '&offset=' . ($offset - 50) . '"><B>&lt; ' . $Language->getText('global', 'prev') . '</B></A>';
    } else {
        echo '&nbsp;';
    }
    echo '</TD><TD>&nbsp;</TD><TD COLSPAN="2" class="small">';
    if ($rows == 50) {
        echo '<A HREF="?func=browse&group_id=' . $group_id . '&set=' . $set . '&offset=' . ($offset + 50) . '"><B>' . $Language->getText('global', 'prev') . ' 50 &gt;</B></A>';
    } else {
        echo '&nbsp;';
    }
    echo '</TD></TR></TABLE>';
}
コード例 #28
0
ファイル: file_utils.php プロジェクト: rinodung/tuleap
function frs_display_release_form($is_update, &$release, $group_id, $title, $url)
{
    global $frspf, $frsrf, $frsff;
    $hp =& Codendi_HTMLPurifier::instance();
    if (is_array($release)) {
        if (isset($release['date'])) {
            $release_date = $release['date'];
        }
        $release = new FRSRelease($release);
    }
    if ($is_update) {
        $files = $release->getFiles();
        if (count($files) > 0) {
            for ($i = 0; $i < count($files); $i++) {
                if (!$frsff->compareMd5Checksums($files[$i]->getComputedMd5(), $files[$i]->getReferenceMd5())) {
                    $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('file_admin_editreleases', 'md5_fail', array(basename($files[$i]->getFileName()), $files[$i]->getComputedMd5())));
                }
            }
        }
    }
    file_utils_admin_header(array('title' => $GLOBALS['Language']->getText('file_admin_editreleases', 'release_new_file_version'), 'help' => 'frs.html#delivery-manager-administration'));
    echo '<H3>' . $hp->purify($title, CODENDI_PURIFIER_CONVERT_HTML) . '</H3>';
    $sql = "SELECT * FROM frs_processor WHERE (group_id = 100 OR group_id = " . db_ei($group_id) . ") ORDER BY rank";
    $result = db_query($sql);
    $processor_id = util_result_column_to_array($result, 0);
    $processor_name = util_result_column_to_array($result, 1);
    foreach ($processor_name as $key => $value) {
        $processor_name[$key] = $hp->purify($value, CODENDI_PURIFIER_JS_QUOTE);
    }
    $sql = "SELECT * FROM frs_filetype ORDER BY type_id";
    $result1 = db_query($sql);
    $type_id = util_result_column_to_array($result1, 0);
    $type_name = util_result_column_to_array($result1, 1);
    $url_news = get_server_url() . "/file/showfiles.php?group_id=" . $group_id;
    echo '<script type="text/javascript">';
    echo "var processor_id = ['" . implode("', '", $processor_id) . "'];";
    echo "var processor_name = ['" . implode("', '", $processor_name) . "'];";
    echo "var type_id = ['" . implode("', '", $type_id) . "'];";
    echo "var type_name = ['" . implode("', '", $type_name) . "'];";
    echo "var group_id = " . $group_id . ";";
    echo "var relname = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'relname') . "';";
    echo "var choose = '" . $GLOBALS['Language']->getText('file_file_utils', 'must_choose_one') . "';";
    echo "var browse = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'browse') . "';";
    echo "var local_file = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'local_file') . "';";
    echo "var scp_ftp_files = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'scp_ftp_files') . "';";
    echo "var upload_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'upload') . "';";
    echo "var add_file_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'add_file') . "';";
    echo "var add_change_log_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'add_change_log') . "';";
    echo "var view_change_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'view_change') . "';";
    echo "var refresh_files_list = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'refresh_file_list') . "';";
    echo "var release_mode = '" . ($is_update ? 'edition' : 'creation') . "';";
    if ($is_update) {
        $pm = PermissionsManager::instance();
        $dar = $pm->getAuthorizedUgroups($release->getReleaseID(), FRSRelease::PERM_READ);
        $ugroups_name = array();
        foreach ($dar as $row) {
            $ugroups_name[] = util_translate_name_ugroup($row['name']);
        }
        echo "var ugroups_name = '" . implode(", ", $ugroups_name) . "';";
        echo "var default_permissions_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'release_perm') . "';";
    } else {
        echo "var default_permissions_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'default_permissions') . "';";
    }
    echo '</script>';
    //set variables for news template
    $relname = $GLOBALS['Language']->getText('file_admin_editreleases', 'relname');
    if (!$is_update) {
        echo '<p>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'contain_multiple_files') . '</p>';
    }
    ?>
    
    <FORM id="frs_form" NAME="frsRelease" ENCTYPE="multipart/form-data" METHOD="POST" ACTION="<?php 
    echo $url;
    ?>
" CLASS="form-inline">
        <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="<? echo $GLOBALS['sys_max_size_upload']; ?>">
        <input type="hidden" name="postReceived" value="" />
        <?php 
    if ($release->getReleaseId()) {
        echo '<input type="hidden" id="release_id" name="release[release_id]" value="' . $release->getReleaseId() . '" />';
    }
    ?>
        <TABLE BORDER="0" width="100%">
        <TR><TD><FIELDSET><LEGEND><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_properties');
    ?>
</LEGEND>
        <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">
            <TR>
                <TD>
                    <B><?php 
    echo $GLOBALS['Language']->getText('file_admin_editpackages', 'p_name');
    ?>
:</B>
                </TD>
                <TD>
    <?php 
    $res =& $frspf->getFRSPackagesFromDb($group_id);
    $rows = count($res);
    if (!$res || $rows < 1) {
        echo '<p class="highlight">' . $GLOBALS['Language']->getText('file_admin_qrs', 'no_p_available') . '</p>';
    } else {
        echo '<SELECT NAME="release[package_id]" id="package_id">';
        for ($i = 0; $i < $rows; $i++) {
            echo '<OPTION VALUE="' . $res[$i]->getPackageID() . '"';
            if ($res[$i]->getPackageID() == $release->getPackageId()) {
                echo ' selected';
            }
            echo '>' . $hp->purify(util_unconvert_htmlspecialchars($res[$i]->getName()), CODENDI_PURIFIER_CONVERT_HTML) . '</OPTION>';
        }
        echo '</SELECT>';
    }
    ?>
                </TD><td></td>
                <TD>
                    <B><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'release_name');
    ?>
: <span class="highlight"><strong>*</strong></span></B>
                </TD>
                <TD>
                    <INPUT TYPE="TEXT" id="release_name" name="release[name]" onBlur="update_news()" value="<?php 
    echo $hp->purify($release->getName());
    ?>
">
                </TD>
            </TR>
            <TR>
                <TD>
                    <B><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'release_date');
    ?>
:</B>
                </TD>
                <TD>
                <?php 
    echo $GLOBALS['HTML']->getDatePicker('release_date', 'release[date]', isset($release_date) ? $hp->purify($release_date) : format_date('Y-m-d', $release->getReleaseDate()));
    ?>
                </TD>
                <td></td>
                <TD>
                    <B><?php 
    echo $GLOBALS['Language']->getText('global', 'status');
    ?>
:</B>
                </TD>
                <TD>
                    <?php 
    print frs_show_status_popup($name = 'release[status_id]', $release->getStatusID()) . "<br>";
    ?>
                </TD>
            </TR></TABLE></FIELDSET>
        </TD></TR>
        <TR><TD><FIELDSET><LEGEND><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_uploaded_files');
    ?>
</LEGEND>
    <?php 
    $titles = array();
    $titles[] = $is_update ? $GLOBALS['Language']->getText('file_admin_editreleases', 'delete_col') : '';
    $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'filename');
    $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'processor');
    $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'file_type');
    $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'md5sum');
    $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'comment');
    $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'user');
    if ($is_update) {
        $titles[] = $GLOBALS['Language']->getText('file_admin_editreleasepermissions', 'release');
        $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'release_date');
    }
    echo html_build_list_table_top($titles, false, false, false, 'files');
    ?>
            <tbody id="files_body">
    
    <?php 
    $files =& $release->getFiles();
    for ($i = 0; $i < count($files); $i++) {
        $fname = $files[$i]->getFileName();
        $list = split('/', $fname);
        $fname = $list[sizeof($list) - 1];
        $user_id = $files[$i]->getUserID();
        $userName = isset($user_id) ? UserManager::instance()->getUserById($files[$i]->getUserID())->getRealName() : "";
        echo '<TR>';
        echo '<TD><INPUT TYPE="CHECKBOX" NAME="release_files_to_delete[]" VALUE="' . $files[$i]->getFileID() . '"</TD>';
        echo '<TD>' . $hp->purify($fname, CODENDI_PURIFIER_CONVERT_HTML) . '<INPUT TYPE="HIDDEN" NAME="release_files[]" VALUE="' . $files[$i]->getFileID() . '"></TD>';
        echo '<TD>' . frs_show_processor_popup($group_id, $name = 'release_file_processor[]', $files[$i]->getProcessorID()) . '</TD>';
        echo '<TD>' . frs_show_filetype_popup($name = 'release_file_type[]', $files[$i]->getTypeID()) . '</TD>';
        //In case of difference between the inserted md5 and the computed one
        //we dispaly an editable text field to let the user insert the right value
        //to avoid the error message next time
        $value = 'value = "' . $files[$i]->getReferenceMd5() . '"';
        if ($frsff->compareMd5Checksums($files[$i]->getComputedMd5(), $files[$i]->getReferenceMd5())) {
            $value = 'value = "' . $files[$i]->getComputedMd5() . '" readonly="true"';
        }
        echo '<TD><INPUT TYPE="TEXT" NAME="release_reference_md5[]" ' . $value . ' SIZE="36" ></TD>';
        $comment = $files[$i]->getComment();
        echo '<TD><textarea NAME="release_comment[]" cols="20", rows="1" >' . $comment . '</textarea></TD>';
        echo '<TD><INPUT TYPE="TEXT" NAME="user" value = "' . $userName . '" readonly="true"></TD>';
        echo '<TD>' . frs_show_release_popup2($group_id, $name = 'new_release_id[]', $files[$i]->getReleaseID()) . '</TD>';
        echo '<TD><INPUT TYPE="TEXT" NAME="release_time[]" VALUE="' . format_date('Y-m-d', $files[$i]->getReleaseTime()) . '" SIZE="10" MAXLENGTH="10"></TD></TR>';
    }
    echo '<INPUT TYPE="HIDDEN" id="nb_files" NAME="nb_files" VALUE="' . count($files) . '">';
    ?>
                        
                        <tr id="row_0">
                            <td></td>
                            <td>
                                <input type="hidden" name="js" value="no_js"/>
                                <select name="ftp_file[]" id="ftp_file_0">
                                    <option value="-1"><?php 
    echo $GLOBALS['Language']->getText('file_file_utils', 'must_choose_one');
    ?>
</option>
    <?php 
    //iterate and show the files in the upload directory
    $file_list = $frsff->getUploadedFileNames($release->getProject());
    foreach ($file_list as $file) {
        echo '<option value="' . $file . '">' . $hp->purify($file, CODENDI_PURIFIER_CONVERT_HTML) . '</option>';
    }
    echo '<script type="text/javascript">';
    echo "var available_ftp_files = ['" . implode("', '", $file_list) . "'];";
    echo '</script>';
    ?>
                                </select>
    
                                <span id="or">or</span>
                                <input type="file" name="file[]" id="file_0" />
                            </td>
                            <td>
                                <?php 
    print frs_show_processor_popup($group_id, $name = 'file_processor');
    ?>
                            </td>
                            <td>
                                <?php 
    print frs_show_filetype_popup($name = 'file_type');
    ?>
                            </td>
                            <td>
                                <input name="reference_md5" value="" size="36" type="TEXT">
                            </td>
                        </tr>
                    </tbody>
                </table>
                <?php 
    echo '<span class="small" style="color:#666"><i>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'upload_file_msg', formatByteToMb($GLOBALS['sys_max_size_upload'])) . '</i> </span>';
    echo '<div id=\'files_help\'><span class="smaller">';
    include $GLOBALS['Language']->getContent('file/qrs_attach_file');
    echo '</span></div>';
    ?>
            </FIELDSET>
            </TD></TR>
            <TR><TD><FIELDSET><LEGEND><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_notes');
    ?>
</LEGEND>
            <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2" WIDTH="100%">
            <TR id="notes_title">
                <TD VALIGN="TOP" width="10%">
                    <span id="release_notes"><B><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'release_notes');
    ?>
:  </B></span>
                </TD>
            </TR>
            <TR id="upload_notes">
                <TD>
                    <input id="uploaded_notes" type="file" name="uploaded_release_notes"  size="30">
                </TD>
            </TR>
            <TR id="release_notes_area">
                <TD width="100%">
                    <TEXTAREA NAME="release[release_notes]" rows="7" cols="70"><?php 
    echo $hp->purify($release->getNotes(), CODENDI_PURIFIER_CONVERT_HTML);
    ?>
</TEXTAREA>
                </TD>
            </TR>
            <TR id="change_log_title">
                <TD VALIGN="TOP" width="10%">
                    <span id="change_log"><B><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'change_log');
    ?>
:  </B></span>
                </TD>
            </TR>
            <TR id="upload_change_log">
                <TD>
                    <input type="file" id="uploaded_change_log" name="uploaded_change_log"  size="30">
                </TD>
            </TR>
            <TR id="change_log_area">
                <TD width="40%">
                    <TEXTAREA ID="text_area_change_log" NAME="release[change_log]" ROWS="7" COLS="70"><?php 
    echo $hp->purify($release->getChanges(), CODENDI_PURIFIER_CONVERT_HTML);
    ?>
</TEXTAREA>
                </TD>
            </TR>
            </TABLE></FIELDSET>
            </TD></TR>
            <TR>
                <TD>
                    <FIELDSET><LEGEND><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_permissions');
    ?>
</LEGEND>
                        <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">
    
                            <TR id="permissions">
                                <TD>
                                    <DIV id="permissions_list">
                                        <?php 
    if ($is_update) {
        permission_display_selection_frs("RELEASE_READ", $release->getReleaseID(), $group_id);
    } else {
        permission_display_selection_frs("PACKAGE_READ", $release->getPackageID(), $group_id);
    }
    ?>
                                    </DIV>
                                </TD>
                            </TR>
                        </TABLE>
                    </FIELDSET>
                </TD>
            </TR> 
            <?php 
    if (user_ismember($group_id, 'A') || user_ismember($group_id, 'N2') || user_ismember($group_id, 'N1')) {
        echo '
            <TR><TD><FIELDSET><LEGEND>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_news') . '</LEGEND>
                <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">
                    <TR>
                        <TD VALIGN="TOP">
                            <B> ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'submit_news') . ' :</B>
                        </TD>
                        <TD>
                            <INPUT ID="submit_news" TYPE="CHECKBOX" NAME="release_submit_news" VALUE="1">
                            
                        </TD>	
                    </TR>
                    <TR id="tr_subject">
                        <TD VALIGN="TOP" ALIGN="RIGHT">
                            <B> ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'subject') . ' :</B>
                        </TD>
                        <TD>
                            <INPUT TYPE="TEXT" ID="release_news_subject" NAME="release_news_subject" VALUE=" ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'file_news_subject', $relname) . '" SIZE="40" MAXLENGTH="60">
                        </TD>
                    </TR>	
                    <TR id="tr_details">
                        <TD VALIGN="TOP" ALIGN="RIGHT">
                            <B> ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'details') . ' :</B>
                        </TD>
                        <TD>
                            <TEXTAREA ID="release_news_details" NAME="release_news_details" ROWS="7" COLS="50">' . $GLOBALS['Language']->getText('file_admin_editreleases', 'file_news_details', array($relname, $url_news)) . ' </TEXTAREA>
                        </TD>
                    </TR>
                    <TR id="tr_public">
                        <TD ROWSPAN=2 VALIGN="TOP" ALIGN="RIGHT">
                            <B> ' . $GLOBALS['Language']->getText('news_submit', 'news_privacy') . ' :</B>
                        </TD>
                        <TD>
                            <INPUT TYPE="RADIO" ID="publicnews" NAME="private_news" VALUE="0" CHECKED>' . $GLOBALS['Language']->getText('news_submit', 'public_news') . '
                        </TD>
                    </TR > 
                    <TR id="tr_private">
                        <TD>
                            <INPUT TYPE="RADIO" ID="privatenews" NAME="private_news" VALUE="1">' . $GLOBALS['Language']->getText('news_submit', 'private_news') . '
                        </TD>
                    </TR></DIV>
                </TABLE></FIELDSET>
            </TD></TR>';
    }
    $fmmf = new FileModuleMonitorFactory();
    $count = count($fmmf->getFilesModuleMonitorFromDb($release->getPackageId()));
    if ($count > 0) {
        echo '<TR><TD><FIELDSET><LEGEND>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_notification') . '</LEGEND>';
        echo '<TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">';
        echo '<TR><TD>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'users_monitor', $count) . '</TD></TR>';
        echo '<TR><TD><B>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'mail_file_rel_notice') . '</B><INPUT TYPE="CHECKBOX" NAME="notification" VALUE="1" CHECKED>';
        echo '</TD></TR>';
        echo '</TABLE></FIELDSET></TD></TR>';
    }
    ?>
            
            <TR>
                <TD ALIGN="CENTER">
                    
                    <INPUT TYPE="HIDDEN" NAME="create" VALUE="bla">
                    <INPUT TYPE="SUBMIT" ID="create_release"  VALUE="<?php 
    echo $is_update ? $GLOBALS['Language']->getText('file_admin_editreleases', 'edit_release') : $GLOBALS['Language']->getText('file_admin_qrs', 'release_file');
    ?>
">
                    <input type="submit" ID="cancel_release" name="cancel" value="<?php 
    echo $GLOBALS['Language']->getText('global', 'btn_cancel');
    ?>
" />
                </TD>
            </TR>
        </TABLE>
    </FORM>
    
    <?php 
    file_utils_footer(array());
}
コード例 #29
0
function display_exported_fields($col_list, $lbl_list, $dsc_list, $sample_val, $mand_list = false)
{
    global $Language;
    $title_arr = array();
    $title_arr[] = $Language->getText('project_export_utils', 'label');
    $title_arr[] = $Language->getText('project_export_utils', 'sample_val');
    $title_arr[] = $Language->getText('project_admin_editugroup', 'desc');
    echo html_build_list_table_top($title_arr);
    reset($col_list);
    $cnt = 0;
    while (list(, $col) = each($col_list)) {
        $star = $mand_list && isset($mand_list[$col]) && $mand_list[$col] ? ' <span class="highlight"><big>*</big></b></span>' : '';
        echo '<tr class="' . util_get_alt_row_color($cnt++) . '">' . '<td><b>' . $lbl_list[$col] . '</b>' . $star . '</td><td>' . nl2br($sample_val[$col]) . '</td><td>' . $dsc_list[$col] . '</td></tr>';
    }
    echo '</table>';
}
コード例 #30
0
ファイル: svn_utils.php プロジェクト: pombredanne/tuleap
function svn_utils_show_revision_detail($result, $group_id, $group_name, $commit_id)
{
    global $Language;
    /*
      Accepts a result set from the svn_checkins table. Should include all columns from
      the table, and it should be joined to USER to get the user_name.
    */
    $rows = db_numrows($result);
    $url = "/svn/?func=detailrevision&commit_id={$commit_id}&group_id={$group_id}&order=";
    $list_log = '<pre>' . util_make_links(util_line_wrap(db_result($result, 0, 'description')), $group_id) . '</pre>';
    $revision = db_result($result, 0, 'revision');
    $hdr = '[' . $Language->getText('svn_browse_revision', 'rev') . ' #' . $revision . '] - ';
    echo '<h2>' . $hdr . format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, 0, 'date')) . '</h2></h2>';
    echo '<table WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2"><tr class="' . util_get_alt_row_color(0) . '"><td>' . $list_log . '</td></tr></table>';
    $crossref_fact = new CrossReferenceFactory($revision, ReferenceManager::REFERENCE_NATURE_SVNREVISION, $group_id);
    $crossref_fact->fetchDatas();
    if ($crossref_fact->getNbReferences() > 0) {
        echo '<h3> ' . $Language->getText('cross_ref_fact_include', 'references') . '</h3>';
        $crossref_fact->DisplayCrossRefs();
    }
    echo '<h3> ' . $Language->getText('svn_utils', 'impacted_files') . '</h3>';
    $title_arr = array();
    $title_arr[] = $Language->getText('svn_utils', 'file');
    $title_arr[] = $Language->getText('svn_browse_revision', 'rev');
    $title_arr[] = $Language->getText('svn_utils', 'type');
    //$title_arr[]='AddedLines'; To be implemented
    //$title_arr[]='RemovedLines'; To be implemented
    $links_arr = array();
    $links_arr[] = $url . 'filename';
    $links_arr[] = $url . '';
    $links_arr[] = $url . 'type';
    $pm = ProjectManager::instance();
    $project = $pm->getProject($group_id);
    $root = $project->getUnixName();
    echo html_build_list_table_top($title_arr, $links_arr);
    for ($i = 0; $i < $rows; $i++) {
        $type = db_result($result, $i, 'type');
        $dirname = db_result($result, $i, 'dir');
        $filename = db_result($result, $i, 'file');
        $fullpath = $dirname . $filename;
        if ($filename) {
            // It' a file
            $viewfile_url = svn_utils_make_viewlink($group_name, $fullpath, $fullpath, "&pathrev={$revision}&view=log");
            $viewrev_url = svn_utils_make_viewlink($group_name, $fullpath, $revision, "&revision={$revision}&pathrev={$revision}&view=markup");
        } else {
            // It' a directory
            $viewfile_url = svn_utils_make_viewlink($group_name, $fullpath, $fullpath, "&pathrev={$revision}");
            $viewrev_url = svn_utils_make_viewlink($group_name, $fullpath, $revision, "&pathrev={$revision}&view=log");
        }
        if ($type == 'Change') {
            $viewtype_url = svn_utils_make_viewlink($group_name, $fullpath, $Language->getText('svn_utils', 'change'), "&r1=" . ($revision - 1) . "&r2={$revision}&diff_format=h&pathrev={$revision}");
        } else {
            if ($type == 'Add') {
                $viewtype_url = $Language->getText('svn_utils', 'add');
            } else {
                if ($type == 'Delete') {
                    $viewtype_url = $Language->getText('svn_utils', 'del');
                }
            }
        }
        echo '
	       <TR class="' . util_get_alt_row_color($i) . '">' . '<TD class="small"><b>' . $viewfile_url . '</b></TD>' . '<TD class="small" width="10%" align="center">' . $viewrev_url . '</TD>' . '<TD class="small" width="10%" align="center">' . $viewtype_url . '</TD>';
        //'<TD class="small">'.$added.'</TD>'. // To be done
        //'<TD class="small">'.$removed.'</TD></TR>'; // To be done
    }
    echo '</TD></TR></TABLE>';
}