function getTitle($view, $viewParams)
 {
     $sort = $this->getSort();
     if ($sort == 1) {
         $toggleValue = '0';
         $toogleIcon = '<img src="' . util_get_image_theme("up_arrow.png") . '" border="0" >';
     } else {
         $toggleValue = '1';
         $toogleIcon = '<img src="' . util_get_image_theme("dn_arrow.png") . '" border="0" >';
     }
     //
     // URL
     //
     $toggleParam = array();
     $sortParam = $this->getSortParameter();
     if ($sortParam !== null) {
         $toggleParam[$sortParam] = $toggleValue;
     }
     $url = $view->_buildSearchUrl($viewParams, array($sortParam => $toggleValue));
     $title = $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_toggletitle');
     $purifier = Codendi_HTMLPurifier::instance();
     $link = $purifier->purify($this->md->getName());
     if ($sort !== null) {
         $link .= '&nbsp;' . $toogleIcon;
     }
     $href = '<a href="' . $url . '" title="' . $title . '">' . $link . '</a>';
     return $href;
 }
/**
 * Generate url to Expend/Collapse a part of a page
 * @see my_hide_url
 */
function hide_url($svc, $db_item_id, $defaultHide = false, $hide = null)
{
    $pref_name = 'hide_' . $svc . $db_item_id;
    if (empty($hide)) {
        $hide = $_REQUEST['hide_' . $svc];
    }
    $noPref = false;
    $old_hide = user_get_preference($pref_name);
    // Make sure they are both 0 if never set before
    if ($old_hide == false) {
        $noPref = true;
        $old_hide = 0;
    }
    // If no given value for hide, keep the old one
    if (!isset($hide)) {
        $hide = $old_hide;
    }
    // Update pref value if needed
    if ($old_hide != $hide) {
        user_set_preference($pref_name, $hide);
    }
    if ($hide == 2 || $noPref && $defaultHide) {
        $hide_url = 'hide_' . $svc . '=1&hide_item_id=' . $db_item_id;
        $hide_img = '<img src="' . util_get_image_theme("pointer_right.png") . '" align="middle" border="0" alt="Expand">';
        $hide_now = true;
    } else {
        $hide_url = 'hide_' . $svc . '=2&hide_item_id=' . $db_item_id;
        $hide_img = '<img src="' . util_get_image_theme("pointer_down.png") . '" align="middle" border="0" alt="Collapse">';
        $hide_now = false;
    }
    return array($hide_now, $hide_url, $hide_img);
}
 function getContent()
 {
     $html_my_bookmarks = '';
     $result = db_query("SELECT bookmark_url, bookmark_title, bookmark_id from user_bookmarks where " . "user_id='" . user_getid() . "' ORDER BY bookmark_title");
     $rows = db_numrows($result);
     if (!$result || $rows < 1) {
         $html_my_bookmarks .= $GLOBALS['Language']->getText('my_index', 'no_bookmark');
         $html_my_bookmarks .= db_error();
     } else {
         $purifier = Codendi_HTMLPurifier::instance();
         $html_my_bookmarks .= '<table style="width:100%">';
         for ($i = 0; $i < $rows; $i++) {
             $bookmark_url = $purifier->purify(db_result($result, $i, 'bookmark_url'), CODENDI_PURIFIER_CONVERT_HTML);
             if (my_has_URL_invalid_content($bookmark_url)) {
                 $bookmark_url = '';
             }
             $bookmark_title = $purifier->purify(db_result($result, $i, 'bookmark_title'), CODENDI_PURIFIER_CONVERT_HTML);
             $html_my_bookmarks .= '<TR class="' . util_get_alt_row_color($i) . '"><TD>';
             $html_my_bookmarks .= '<A HREF="' . $bookmark_url . '">' . $bookmark_title . '</A> ';
             $html_my_bookmarks .= '<small><A HREF="/my/bookmark_edit.php?bookmark_id=' . db_result($result, $i, 'bookmark_id') . '">[' . $GLOBALS['Language']->getText('my_index', 'edit_link') . ']</A></SMALL></TD>';
             $html_my_bookmarks .= '<td style="text-align:right"><A HREF="/my/bookmark_delete.php?bookmark_id=' . db_result($result, $i, 'bookmark_id') . '">';
             $html_my_bookmarks .= '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" BORDER="0" ALT="DELETE"></A></td></tr>';
         }
         $html_my_bookmarks .= '</table>';
     }
     $html_my_bookmarks .= '<div style="text-align:center; font-size:0.8em;"><a href="/my/bookmark_add.php">[' . $GLOBALS['Language']->getText('my_index', 'add_bookmark') . ']</a></div>';
     return $html_my_bookmarks;
 }
 function getContent()
 {
     $frsrf = new FRSReleaseFactory();
     $html_my_monitored_fp = '';
     $sql = "SELECT groups.group_name,groups.group_id " . "FROM groups,filemodule_monitor,frs_package " . "WHERE groups.group_id=frs_package.group_id " . "AND frs_package.status_id !=" . $frsrf->STATUS_DELETED . " " . "AND frs_package.package_id=filemodule_monitor.filemodule_id " . "AND filemodule_monitor.user_id='" . user_getid() . "' ";
     $um =& UserManager::instance();
     $current_user =& $um->getCurrentUser();
     if ($current_user->isRestricted()) {
         $projects = $current_user->getProjects();
         $sql .= "AND groups.group_id IN (" . implode(',', $projects) . ") ";
     }
     $sql .= "GROUP BY group_id ORDER BY group_id ASC LIMIT 100";
     $result = db_query($sql);
     $rows = db_numrows($result);
     if (!$result || $rows < 1) {
         $html_my_monitored_fp .= $GLOBALS['Language']->getText('my_index', 'my_files_msg');
     } else {
         $html_my_monitored_fp .= '<table style="width:100%">';
         $request =& HTTPRequest::instance();
         for ($j = 0; $j < $rows; $j++) {
             $group_id = db_result($result, $j, 'group_id');
             $sql2 = "SELECT frs_package.name,filemodule_monitor.filemodule_id " . "FROM groups,filemodule_monitor,frs_package " . "WHERE groups.group_id=frs_package.group_id " . "AND groups.group_id={$group_id} " . "AND frs_package.status_id !=" . $frsrf->STATUS_DELETED . " " . "AND frs_package.package_id=filemodule_monitor.filemodule_id " . "AND filemodule_monitor.user_id='" . user_getid() . "'  LIMIT 100";
             $result2 = db_query($sql2);
             $rows2 = db_numrows($result2);
             $vItemId = new Valid_UInt('hide_item_id');
             $vItemId->required();
             if ($request->valid($vItemId)) {
                 $hide_item_id = $request->get('hide_item_id');
             } else {
                 $hide_item_id = null;
             }
             $vFrs = new Valid_WhiteList('hide_frs', array(0, 1));
             $vFrs->required();
             if ($request->valid($vFrs)) {
                 $hide_frs = $request->get('hide_frs');
             } else {
                 $hide_frs = null;
             }
             list($hide_now, $count_diff, $hide_url) = my_hide_url('frs', $group_id, $hide_item_id, $rows2, $hide_frs);
             $html_hdr = ($j ? '<tr class="boxitem"><td colspan="2">' : '') . $hide_url . '<A HREF="/project/?group_id=' . $group_id . '">' . db_result($result, $j, 'group_name') . '</A>&nbsp;&nbsp;&nbsp;&nbsp;';
             $html = '';
             $count_new = max(0, $count_diff);
             for ($i = 0; $i < $rows2; $i++) {
                 if (!$hide_now) {
                     $html .= '
                     <TR class="' . util_get_alt_row_color($i) . '">' . '<TD WIDTH="99%">&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<A HREF="/file/showfiles.php?group_id=' . $group_id . '">' . db_result($result2, $i, 'name') . '</A></TD>' . '<TD><A HREF="/file/filemodule_monitor.php?filemodule_id=' . db_result($result2, $i, 'filemodule_id') . '&group_id=' . $group_id . '" onClick="return confirm(\'' . $GLOBALS['Language']->getText('my_index', 'stop_file') . '\')">' . '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" ' . 'BORDER=0" ALT="' . $GLOBALS['Language']->getText('my_index', 'stop_monitor') . '"></A></TD></TR>';
                 }
             }
             $html_hdr .= my_item_count($rows2, $count_new) . '</td></tr>';
             $html_my_monitored_fp .= $html_hdr . $html;
         }
         $html_my_monitored_fp .= '</table>';
     }
     return $html_my_monitored_fp;
 }
 function getContent()
 {
     $html_my_monitored_forums = '';
     $sql = "SELECT groups.group_id, groups.group_name " . "FROM groups,forum_group_list,forum_monitored_forums " . "WHERE groups.group_id=forum_group_list.group_id " . "AND groups.status = 'A' " . "AND forum_group_list.is_public <> 9 " . "AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id " . "AND forum_monitored_forums.user_id='" . user_getid() . "' ";
     $um =& UserManager::instance();
     $current_user =& $um->getCurrentUser();
     if ($current_user->isRestricted()) {
         $projects = $current_user->getProjects();
         $sql .= "AND groups.group_id IN (" . implode(',', $projects) . ") ";
     }
     $sql .= "GROUP BY group_id ORDER BY group_id ASC LIMIT 100";
     $result = db_query($sql);
     $rows = db_numrows($result);
     if (!$result || $rows < 1) {
         $html_my_monitored_forums .= $GLOBALS['Language']->getText('my_index', 'my_forums_msg');
     } else {
         $request =& HTTPRequest::instance();
         $html_my_monitored_forums .= '<table style="width:100%">';
         for ($j = 0; $j < $rows; $j++) {
             $group_id = db_result($result, $j, 'group_id');
             $sql2 = "SELECT forum_group_list.group_forum_id,forum_group_list.forum_name " . "FROM groups,forum_group_list,forum_monitored_forums " . "WHERE groups.group_id=forum_group_list.group_id " . "AND groups.group_id={$group_id} " . "AND forum_group_list.is_public <> 9 " . "AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id " . "AND forum_monitored_forums.user_id='" . user_getid() . "' LIMIT 100";
             $result2 = db_query($sql2);
             $rows2 = db_numrows($result2);
             $vItemId = new Valid_UInt('hide_item_id');
             $vItemId->required();
             if ($request->valid($vItemId)) {
                 $hide_item_id = $request->get('hide_item_id');
             } else {
                 $hide_item_id = null;
             }
             $vForum = new Valid_WhiteList('hide_forum', array(0, 1));
             $vForum->required();
             if ($request->valid($vForum)) {
                 $hide_forum = $request->get('hide_forum');
             } else {
                 $hide_forum = null;
             }
             list($hide_now, $count_diff, $hide_url) = my_hide_url('forum', $group_id, $hide_item_id, $rows2, $hide_forum);
             $html_hdr = ($j ? '<tr class="boxitem"><td colspan="2">' : '') . $hide_url . '<A HREF="/forum/?group_id=' . $group_id . '">' . db_result($result, $j, 'group_name') . '</A>&nbsp;&nbsp;&nbsp;&nbsp;';
             $html = '';
             $count_new = max(0, $count_diff);
             for ($i = 0; $i < $rows2; $i++) {
                 if (!$hide_now) {
                     $group_forum_id = db_result($result2, $i, 'group_forum_id');
                     $html .= '
                 <TR class="' . util_get_alt_row_color($i) . '"><TD WIDTH="99%">' . '&nbsp;&nbsp;&nbsp;-&nbsp;<A HREF="/forum/forum.php?forum_id=' . $group_forum_id . '">' . stripslashes(db_result($result2, $i, 'forum_name')) . '</A></TD>' . '<TD ALIGN="center"><A HREF="/my/stop_monitor.php?forum_id=' . $group_forum_id . '" onClick="return confirm(\'' . $GLOBALS['Language']->getText('my_index', 'stop_forum') . '\')">' . '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" ' . 'BORDER=0 ALT="' . $GLOBALS['Language']->getText('my_index', 'stop_monitor') . '"></A></TD></TR>';
                 }
             }
             $html_hdr .= my_item_count($rows2, $count_new) . '</td></tr>';
             $html_my_monitored_forums .= $html_hdr . $html;
         }
         $html_my_monitored_forums .= '</table>';
     }
     return $html_my_monitored_forums;
 }
 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;
 }
Exemple #7
0
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>';
}
Exemple #8
0
function my_hide_url($svc, $db_item_id, $item_id, $count, $hide)
{
    global $Language;
    $pref_name = 'my_hide_' . $svc . $db_item_id;
    $old_hide = $old_count = $old_pref_value = user_get_preference($pref_name);
    if ($old_pref_value) {
        list($old_hide, $old_count) = explode('|', $old_pref_value);
    }
    // Make sure they are both 0 if never set before
    if ($old_count == false) {
        $old_count = 0;
    }
    if ($old_hide == false) {
        $old_hide = 0;
    }
    if ($item_id == $db_item_id) {
        if (isset($hide)) {
            $pref_value = "{$hide}|{$count}";
        } else {
            $pref_value = "{$old_hide}|{$count}";
            $hide = $old_hide;
        }
    } else {
        if ($old_hide) {
            // if items are hidden keep the old count and keep pref as is
            $pref_value = $old_pref_value;
        } else {
            // only update the item count if the items are visible
            // if they are hidden keep reporting the old count
            $pref_value = "{$old_hide}|{$count}";
        }
        $hide = $old_hide;
    }
    // Update pref value if needed
    if ($old_pref_value != $pref_value) {
        user_set_preference($pref_name, $pref_value);
    }
    if ($hide) {
        $hide_url = '<a href="?hide_' . $svc . '=0&hide_item_id=' . $db_item_id . '"><img src="' . util_get_image_theme("pointer_right.png") . '" align="middle" border="0" title="' . $Language->getText('my_utils', 'expand') . '" alt="' . $Language->getText('my_utils', 'expand') . '"></a>&nbsp;';
        $hide_now = true;
    } else {
        $hide_url = '<a href="?hide_' . $svc . '=1&hide_item_id=' . $db_item_id . '"><img src="' . util_get_image_theme("pointer_down.png") . '" align="middle" border="0" title="' . $Language->getText('my_utils', 'collapse') . '" alt="' . $Language->getText('my_utils', 'collapse') . '"></a>&nbsp;';
        $hide_now = false;
    }
    return array($hide_now, $count - $old_count, $hide_url);
}
Exemple #9
0
function forum_show_a_nested_message($result, $row = 0)
{
    /*
    	accepts a database result handle to display a single message
    		in the format appropriate for the nested messages
    	second param is which row in that result set to use
    */
    global $Language;
    $g_id = db_result($result, $row, 'group_id');
    if ($g_id == $GLOBALS['sys_news_group']) {
        $f_id = db_result($result, $row, 'group_forum_id');
        $gr = db_query("SELECT group_id FROM news_bytes WHERE forum_id=" . db_ei($f_id));
        $g_id = db_result($gr, 0, 'group_id');
    }
    $poster = UserManager::instance()->getUserByUserName(db_result($result, $i, 'user_name'));
    $ret_val = '
		<TABLE BORDER="0" WIDTH="100%">
			<TR>                  
              <TD class="thread" NOWRAP>' . $Language->getText('forum_forum', 'by') . ': ' . UserHelper::instance()->getLinkOnUser($poster) . '<BR><A HREF="/forum/message.php?msg_id=' . db_result($result, $row, 'msg_id') . '">' . '<IMG SRC="' . util_get_image_theme("msg.png") . '" BORDER=0 HEIGHT=12 WIDTH=10> ' . db_result($result, $row, 'subject') . ' [ ' . $Language->getText('forum_forum', 'reply') . ' ]</A> &nbsp; ' . '<BR>' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $row, 'date')) . '
                </TD>      
                               
			</TR>
			<TR>
				<TD>
					' . util_make_links(nl2br(db_result($result, $row, 'body')), $g_id) . '
				</TD>
			</TR>';
    $crossref_fact = new CrossReferenceFactory(db_result($result, $row, 'msg_id'), ReferenceManager::REFERENCE_NATURE_FORUMMESSAGE, $g_id);
    $crossref_fact->fetchDatas();
    if ($crossref_fact->getNbReferences() > 0) {
        $ret_val .= '<tr>';
        $ret_val .= ' <td class="forum_reference_separator">';
        $ret_val .= '  <b> ' . $Language->getText('cross_ref_fact_include', 'references') . '</b>';
        $ret_val .= $crossref_fact->getHTMLDisplayCrossRefs();
        $ret_val .= ' </td>';
        $ret_val .= '</tr>';
    }
    $ret_val .= '
			<tr>
			 <td>
			 </td>
			</tr>
		</TABLE>';
    return $ret_val;
}
Exemple #10
0
function display_ml_details($group_id, $list_server, $result, $i)
{
    echo '<IMG SRC="' . util_get_image_theme("ic/cfolder15.png") . '" HEIGHT="13" WIDTH="15" BORDER="0">&nbsp;<b>' . db_result($result, $i, 'list_name') . '</b> [';
    $list_is_public = db_result($result, $i, 'is_public');
    $html_a = '';
    $em =& EventManager::instance();
    $em->processEvent('browse_archives', array('html' => &$html_a, 'group_list_id' => db_result($result, $i, 'group_list_id')));
    if ($html_a) {
        echo $html_a;
    } else {
        if ($list_is_public) {
            echo ' <A HREF="?group_id=' . $group_id . '&amp;action=pipermail&amp;id=' . db_result($result, $i, 'group_list_id') . '">' . $GLOBALS['Language']->getText('mail_index', 'archive') . '</A>';
        } else {
            echo ' ' . $GLOBALS['Language']->getText('mail_index', 'archive') . ': <A HREF="?group_id=' . $group_id . '&amp;action=pipermail&amp;id=' . db_result($result, $i, 'group_list_id') . '">' . $GLOBALS['Language']->getText('mail_index', 'public') . '</A>/<A HREF="?group_id=' . $group_id . '&amp;action=private&amp;id=' . db_result($result, $i, 'group_list_id') . '">' . $GLOBALS['Language']->getText('mail_index', 'private') . '</A>';
        }
    }
    echo ' | <A HREF="?group_id=' . $group_id . '&amp;action=listinfo&amp;id=' . db_result($result, $i, 'group_list_id') . '">' . $GLOBALS['Language']->getText('mail_index', 'unsubscribe') . '</A>)';
    echo ' | <A HREF="?group_id=' . $group_id . '&amp;action=admin&amp;id=' . db_result($result, $i, 'group_list_id') . '">' . $GLOBALS['Language']->getText('mail_index', 'ml_admin') . '</A>';
    echo ' ]<br>&nbsp;' . db_result($result, $i, 'description') . '<p>';
}
 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'));
 }
Exemple #12
0
 /**
  * Fetch the html code to display the icon of a repository (depends on type of project)
  *
  * @param $access
  * @param $backend_type
  */
 public function fetchAccessType($access, $backendIsGitolite)
 {
     $accessType = '<span class="plugin_git_repo_privacy" title=';
     if ($backendIsGitolite) {
         //$accessType .= '"'.$this->getText('view_repo_access_custom').'">';
         $accessType .= '"custom">';
         $accessType .= '<img src="' . $this->getController()->getPlugin()->getThemePath() . '/images/perms.png" />';
     } else {
         switch ($access) {
             case GitRepository::PRIVATE_ACCESS:
                 $accessType .= '"' . $this->getText('view_repo_access_private') . '">';
                 $accessType .= '<img src="' . util_get_image_theme('ic/lock.png') . '" />';
                 break;
             case GitRepository::PUBLIC_ACCESS:
                 $accessType .= '"' . $this->getText('view_repo_access_public') . '">';
                 $accessType .= '<img src="' . util_get_image_theme('ic/lock-unlock.png') . '" />';
                 break;
         }
     }
     $accessType .= '</span>';
     return $accessType;
 }
Exemple #13
0
function getImage($url)
{
    return util_get_image_theme($url);
}
Exemple #14
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>";
}
   /**
    * displayMenu - public
    */
   function displayMenu()
   {
       print '
   <table class="ServiceMenu">
     <tr>
       <td>';
       switch (DEFAULT_LANGUAGE) {
           case 'fr_FR':
               $attatch_page = "DéposerUnFichier";
               $preferences_page = "PréférencesUtilisateurs";
               break;
           case 'en_US':
           default:
               $attatch_page = 'UpLoad';
               $preferences_page = 'UserPreferences';
               break;
       }
       $attatch_menu = $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'menuattch');
       $preferences_menu = $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'menuprefs');
       $help_menu = $GLOBALS['Language']->getText('global', 'help');
       print '
   <ul class="ServiceMenu">
     <li><a href="' . $this->wikiLink . '&view=browsePages">' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'menupages') . '</a>&nbsp;|&nbsp;</li>';
       if (UserManager::instance()->getCurrentUser()->isLoggedIn()) {
           print '<li><a href="javascript:help_window(\'' . $this->wikiLink . '&pagename=' . $attatch_page . '&pv=1\')">' . $attatch_menu . '</a>&nbsp;|&nbsp;</li>';
           print '<li><a href="' . $this->wikiLink . '&pagename=' . $preferences_page . '">' . $preferences_menu . '</a>&nbsp;|&nbsp;</li>';
       }
       if (user_ismember($this->gid, 'W2')) {
           print '<li><a href="' . $this->wikiAdminLink . '">' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'menuadmin') . '</a>&nbsp;|&nbsp;</li>';
       }
       print '<li>' . help_button('WikiService.html', false, $help_menu) . '</li>
  </ul>';
       print '
 </td>
 <td align="right" valign="top">';
       if (user_ismember($this->gid, 'W2')) {
           $wiki = new Wiki($this->gid);
           $permInfo = "";
           if ('wiki' == $this->view) {
               // User is browsing a wiki page
               $wp = new WikiPage($this->gid, $_REQUEST['pagename']);
               $permLink = $this->wikiAdminLink . '&view=pagePerms&id=' . $wp->getId();
               if ($wp->permissionExist()) {
                   $permInfo = '<a href="' . $permLink . '"> ' . '<img src="' . util_get_image_theme("ic/lock.png") . '" border="0" alt="' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'lock_alt') . '" title="' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'lock_title_spec') . '"/></a>';
               }
           }
           if ($wiki->permissionExist()) {
               $permInfo .= '<a href="/wiki/admin/index.php?group_id=' . $this->gid . '&view=wikiPerms"> ' . '<img src="' . util_get_image_theme("ic/lock.png") . '" border="0" alt="' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'lock_alt') . '" title="' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'lock_title_set') . '"/>' . '</a>';
           }
           if ($permInfo) {
               print $permInfo;
           }
       }
       //Display printer_version link only in wiki pages
       if (isset($_REQUEST['pagename'])) {
           print '
         (<a href="' . $_SERVER['REQUEST_URI'] . '&pv=1" title="' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'lighter_display') . '">
         <img src="' . util_get_image_theme("msg.png") . '" border="0">&nbsp;' . $GLOBALS['Language']->getText('global', 'printer_version') . '</A> ) 
         </li>';
       }
       print '
    </td>
   </tr>
 </table>';
   }
 /**
  * Display date reminders
  *
  * @param HTTPRequest $request HTTP request
  *
  * @return Void
  */
 public function displayDateReminders(HTTPRequest $request)
 {
     $output = '<h2>' . $GLOBALS['Language']->getText('project_admin_utils', 'tracker_date_reminder_title') . '</h2>';
     $output .= '<fieldset>';
     if ($request->get('action') == 'delete_reminder') {
         $output .= $this->displayConfirmDelete($request->get('reminder_id'));
     }
     $output .= $this->displayAllReminders();
     $output .= '<div id="tracker_reminder" style="display:none;"><p><label for="New Reminder">' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'tracker_date_reminder_add_title') . '<input type="image" src="' . util_get_image_theme('ic/add.png') . '" id="add_reminder" value="' . (int) $this->tracker->id . '"></label></div>';
     $output .= '<noscript>
     <p><a href="?func=admin-notifications&amp;tracker=' . (int) $this->tracker->id . '&amp;action=add_reminder" id="add_reminder">' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'tracker_date_reminder_add_title') . '</a>
     </noscript>';
     if ($request->get('action') == 'add_reminder') {
         $output .= $this->getNewDateReminderForm();
     } elseif ($request->get('action') == 'update_reminder') {
         $output .= '<div id="update_reminder"></div>';
         $output .= $this->editDateReminder($request->get('reminder_id'));
     }
     $output .= '</fieldset>';
     echo $output;
 }
 /**
  * Hook to list archived repositories for restore in site admin page
  *
  * @param array $params
  */
 public function showArchivedRepositories($params)
 {
     $group_id = $params['group_id'];
     $archived_repositories = $this->getRepositoryManager()->getRepositoriesForRestoreByProjectId($group_id);
     $tab_content = '<div class="contenu_onglet" id="contenu_onglet_git_repository">';
     if (count($archived_repositories) == 0) {
         $tab_content .= '<center>' . $GLOBALS['Language']->getText('plugin_git', 'restore_no_repo_found') . '</center>';
     } else {
         $tab_content .= '<table>';
         foreach ($archived_repositories as $archived_repository) {
             $tab_content .= '<tr class="boxitemgrey">';
             $tab_content .= '<td>' . $archived_repository->getName() . '</td>';
             $tab_content .= '<td>' . $archived_repository->getCreationDate() . '</td>';
             $tab_content .= '<td>' . $archived_repository->getCreator()->getName() . '</td>';
             $tab_content .= '<td>' . $archived_repository->getDeletionDate() . '</td>';
             $tab_content .= '<td><a href="/plugins/git/?action=restore&group_id=' . $group_id . '&repo_id=' . $archived_repository->getId() . '"><img src="' . util_get_image_theme("ic/convert.png") . '" onClick="return confirm(\'' . $GLOBALS['Language']->getText('plugin_git', 'restore_confirmation') . '\')" border="0" height="16" width="16"></a></td>';
             $tab_content .= '</tr>';
         }
         $tab_content .= '</table>';
     }
     $tab_content .= '</div>';
     $params['id'][] = 'git_repository';
     $params['nom'][] = $GLOBALS['Language']->getText('plugin_git', 'archived_repositories');
     $params['html'][] = $tab_content;
 }
 function getDocumentPath($id, $group_id, $referrer_id = null)
 {
     $parents = array();
     $html = HTML();
     $hp =& Codendi_HTMLPurifier::instance();
     $item_factory =& $this->_getItemFactory($group_id);
     $item =& $item_factory->getItemFromDb($id);
     $reference =& $item;
     if ($reference && $referrer_id != $id) {
         while ($item && $item->getParentId() != 0) {
             $item =& $item_factory->getItemFromDb($item->getParentId());
             $parents[] = array('id' => $item->getId(), 'title' => $item->getTitle());
         }
         $parents = array_reverse($parents);
         $item_url = '/plugins/docman/?group_id=' . $group_id . '&sort_update_date=0&action=show&id=';
         foreach ($parents as $parent) {
             $html->pushContent(HTML::a(array('href' => $item_url . $parent['id'], 'target' => '_blank'), HTML::strong($parent['title'])));
             $html->pushContent(' / ');
         }
         $md_uri = '/plugins/docman/?group_id=' . $group_id . '&action=details&id=' . $id;
         //Add a pen icon linked to document properties.
         $pen_icon = HTML::a(array('href' => $md_uri), HTML::img(array('src' => util_get_image_theme("ic/edit.png"))));
         $html->pushContent(HTML::a(array('href' => $item_url . $reference->getId()), HTML::strong($reference->getTitle())));
         $html->pushContent($pen_icon);
         $html->pushContent(HTML::br());
     }
     return $html;
 }
Exemple #19
0
                echo '
				<H4>' . $Language->getText('news_admin_index', 'need_approve') . '</H4>
				<P><ul><li><strong>' . $Language->getText('news_admin_index', 'approve_legend', $GLOBALS['sys_name']) . '
				</strong></ul><P>';
                for ($i = 0; $i < $rows; $i++) {
                    //if the news is private, not display it in the list of news to be approved
                    $forum_id = db_result($result, $i, 'forum_id');
                    $res = news_read_permissions($forum_id);
                    // check on db_result($res,0,'ugroup_id') == $UGROUP_ANONYMOUS only to be consistent
                    // with ST DB state
                    if (db_numrows($res) < 1 || db_result($res, 0, 'ugroup_id') == $UGROUP_ANONYMOUS) {
                        $is_approved = db_result($result, $i, 'is_approved');
                        if ($is_approved == '3') {
                            //the submitter of this news asked to promote it ==>  display an icon
                            echo '
				            <IMG SRC="' . util_get_image_theme("ic/p_news.png") . '" alt="' . $Language->getText('news_admin_index', 'approve_alt', $GLOBALS['sys_name']) . '" title="' . $Language->getText('news_admin_index', 'approve_alt', $GLOBALS['sys_name']) . '" /> <A HREF="/news/admin/?approve=1&id=' . db_result($result, $i, 'id') . '">' . db_result($result, $i, 'summary') . '</A><BR>';
                        } else {
                            echo '
				            <A HREF="/news/admin/?approve=1&id=' . db_result($result, $i, 'id') . '">' . db_result($result, $i, 'summary') . '</A><BR>';
                        }
                    }
                }
            }
            //Display [Approve All] hyper-link when there are news asked for promotion
            $sql = "SELECT * FROM news_bytes WHERE is_approved=3";
            $res = db_query($sql);
            if (db_numrows($res) > 0) {
                echo '<P>
			 <A HREF="/news/admin/?approve_all=1">' . $Language->getText('news_admin_index', 'approve_all') . '</A>';
            } else {
                echo '<P>' . $Language->getText('news_admin_index', 'approved');
Exemple #20
0
 function menu_entry($link, $title)
 {
     print "\t" . '<A class="menus" href="' . $link . '">' . $title . '</A> &nbsp;<img src="' . util_get_image_theme("point1.png") . '" alt=" " width="7" height="7"><br>';
 }
Exemple #21
0
 /**
  * Fetch the html code to display the icon of a repository (depends on type of project)
  *
  * @param $access
  * @param $backend_type
  */
 private function getAccessType($access, $backendIsGitolite)
 {
     if ($backendIsGitolite) {
         return '';
     }
     $html = '<span class="plugin_git_repo_privacy" title=';
     switch ($access) {
         case GitRepository::PRIVATE_ACCESS:
             $html .= '"' . $GLOBALS['Language']->getText('plugin_git', 'view_repo_access_private') . '">';
             $html .= '<img src="' . util_get_image_theme('ic/lock.png') . '" />';
             break;
         case GitRepository::PUBLIC_ACCESS:
             $html .= '"' . $GLOBALS['Language']->getText('plugin_git', 'view_repo_access_public') . '">';
             $html .= '<img src="' . util_get_image_theme('ic/lock-unlock.png') . '" />';
             break;
     }
     $html .= '</span>';
     return $html;
 }
 function _icon($icon, $params = NULL)
 {
     // returns the HTML to display the named icon
     global $Language;
     switch ($icon) {
         case 'main':
             $src = $this->getThemePath() . "/images/project_link.png";
             $height = 21;
             $width = 77;
             $alt = $Language->getText('plugin_plinks', 'project_links');
             break;
         case 'add':
             $src = $this->getThemePath() . "/images/add.png";
             $height = 10;
             $width = 10;
             $alt = $Language->getText('plugin_plinks', 'add');
             break;
         case 'template':
             $src = $this->getThemePath() . "/images/template.png";
             $height = 15;
             $width = 10;
             $alt = $Language->getText('plugin_plinks', 'template_marker');
             break;
         case 'new':
             $src = $this->getThemePath() . "/images/new.png";
             $height = 10;
             $width = 10;
             $alt = $Language->getText('plugin_plinks', 'newly_added', util_timestamp_to_userdateformat($params['date']));
             break;
         case 'arrow-right':
             $src = $this->getThemePath() . "/images/arrow-right.png";
             $height = 10;
             $width = 10;
             $alt = "";
             break;
         case 'trash':
             $src = util_get_image_theme('ic/trash.png');
             $height = 16;
             $width = 16;
             $alt = $Language->getText('plugin_plinks', 'delete');
             break;
         case 'matched':
             $src = util_get_image_theme('ic/check.png');
             $height = 15;
             $width = 16;
             $alt = $Language->getText('plugin_plinks', 'matched');
             break;
     }
     return "<IMG SRC='{$src}' HEIGHT='{$height}' WIDTH='{$width}' BORDER='0'\n            ALT='{$alt}' TITLE='{$alt}'>";
 }
Exemple #23
0
 /**
  * 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;
 }
Exemple #24
0
    } else {
        echo "&nbsp;";
    }
    echo "</TD>\n\t<TD ALIGN=\"right\">";
    if ($rows_returned > $rows) {
        echo "<span class=\"normal\"><B>";
        echo "<A HREF=\"/search/?type_of_search={$type_of_search}&words=" . urlencode($words) . "&offset=" . ($offset + $rows);
        if ($type_of_search == 'bugs') {
            echo "&group_id={$group_id}&is_bug_page=1";
        }
        if ($type_of_search == 'forums') {
            echo "&forum_id={$forum_id}&is_forum_page=1";
        }
        if ($exact) {
            echo "&exact=1";
        }
        if ($type_of_search == 'tracker') {
            echo "&group_id={$group_id}&atid={$atid}";
        }
        echo "\"><B>" . $Language->getText('search_index', 'next_res') . " <IMG SRC=\"" . util_get_image_theme('t.png') . "\" HEIGHT=15 WIDTH=15 BORDER=0 ALIGN=MIDDLE></A></B></span>";
    } else {
        echo "&nbsp;";
    }
    echo "</TD>\n</TR>\n";
    echo "</TABLE>\n";
}
if ($type_of_search !== "tracker" && $type_of_search !== "all_trackers" || !isset($ath)) {
    $HTML->footer(array());
} else {
    $ath->footer(array());
}
Exemple #25
0
 function getThemeIcon($icon)
 {
     return util_get_image_theme('ic/' . $icon);
 }
Exemple #26
0
 /**
  * Display the submit form
  */
 public function displaySearch(Tracker_IDisplayTrackerLayout $layout, $request, $current_user)
 {
     $hp = Codendi_HTMLPurifier::instance();
     $pm = ProjectManager::instance();
     $group_id = $request->get('group_id');
     $group = $pm->getProject($group_id);
     if (!$group || !is_object($group) || $group->isError()) {
         exit_no_group();
     }
     $breadcrumbs = array(array('title' => $GLOBALS['Language']->getText('plugin_tracker_browse', 'search_result'), 'url' => TRACKER_BASE_URL . '/?tracker=' . $this->getId()));
     $this->displayHeader($layout, $this->name, $breadcrumbs);
     $html = '';
     $words = $request->get('words');
     $criteria = 'OR';
     if ($request->exist('exact') && $request->get('exact') == '1') {
         $criteria = 'AND';
     }
     $offset = 0;
     if ($request->exist('offset')) {
         $offset = $request->get('offset');
     }
     $limit = 25;
     $tracker_artifact_dao = new Tracker_ArtifactDao();
     $dar = $tracker_artifact_dao->searchByKeywords($this->getId(), $words, $criteria, $offset, $limit);
     $rows_returned = $tracker_artifact_dao->foundRows();
     $no_rows = false;
     if ($dar->rowCount() < 1 || $rows_returned < 1) {
         $no_rows = true;
         $html .= '<h2>' . $GLOBALS['Language']->getText('search_index', 'no_match_found', $hp->purify($words, CODENDI_PURIFIER_CONVERT_HTML)) . '</h2>';
     } else {
         $html .= '<h3>' . $GLOBALS['Language']->getText('search_index', 'search_res', array($hp->purify($words, CODENDI_PURIFIER_CONVERT_HTML), $rows_returned)) . '</h3>';
         $title_arr = array();
         $art_field_fact = Tracker_FormElementFactory::instance();
         $artifact_factory = Tracker_ArtifactFactory::instance();
         $user_helper = UserHelper::instance();
         $summary_field = $this->getTitleField();
         if ($summary_field && $summary_field->userCanRead()) {
             $title_arr[] = $GLOBALS['Language']->getText('plugin_tracker_search_index', 'artifact_title');
         }
         $submitted_field = $art_field_fact->getFormElementByName($this->getId(), 'submitted_by');
         if ($submitted_field && $submitted_field->userCanRead()) {
             $title_arr[] = $GLOBALS['Language']->getText('search_index', 'submitted_by');
         }
         $date_field = $art_field_fact->getFormElementByName($this->getId(), 'open_date');
         if ($date_field && $date_field->userCanRead()) {
             $title_arr[] = $GLOBALS['Language']->getText('search_index', 'date');
         }
         $status_field = $this->getStatusField();
         if ($status_field && $status_field->userCanRead()) {
             $title_arr[] = $GLOBALS['Language']->getText('global', 'status');
         }
         $html .= html_build_list_table_top($title_arr);
         $nb_artifacts = 0;
         while ($row = $dar->getRow()) {
             $nb_artifacts++;
             $artifact_id = $row['artifact_id'];
             $artifact = $artifact_factory->getArtifactById($artifact_id);
             if ($artifact->userCanView()) {
                 $html .= '<tr class="' . html_get_alt_row_color($nb_artifacts) . '">';
                 if ($summary_field->userCanRead()) {
                     $html .= '<td><a href="' . TRACKER_BASE_URL . '/?aid=' . $artifact_id . '"><img src="' . util_get_image_theme('msg.png') . '" border="0" height="12" width="10"> ' . $artifact->getTitle() . '</a></td>';
                 }
                 if ($submitted_field->userCanRead()) {
                     $html .= '<td>' . $hp->purify($user_helper->getDisplayNameFromUserId($artifact->getSubmittedBy())) . '</td>';
                 }
                 if ($date_field->userCanRead()) {
                     $html .= '<td>' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $artifact->getSubmittedOn()) . '</td>';
                 }
                 if ($status_field->userCanRead()) {
                     $html .= '<td>' . $artifact->getStatus() . '</td>';
                 }
                 $html .= '</tr>';
             }
         }
         $html .= '</table>';
     }
     // Search result pagination
     if (!$no_rows && ($rows_returned > $nb_artifacts || $offset != 0)) {
         $html .= '<br />';
         $url_params = array('exact' => $request->get('exact') === '1' ? 1 : 0, 'group_id' => $this->getGroupId(), 'tracker' => $this->getId(), 'type_of_search' => 'tracker', 'words' => urlencode($words), 'offset' => $offset - $limit);
         $html .= '<table class="boxitem" width="100%" cellpadding="5" cellspacing="0">';
         $html .= '<tr>';
         $html .= '<td align="left">';
         if ($offset != 0) {
             $html .= '<span class="normal"><b>';
             $html .= '<a href="/search/?' . http_build_query($url_params);
             $html .= '">' . "<b><img src=\"" . util_get_image_theme('t2.png') . "\" height=15 width=15 border=0 align=middle> " . $GLOBALS['Language']->getText('search_index', 'prev_res') . " </a></b></span>";
         } else {
             $html .= '&nbsp;';
         }
         $html .= '</td><td align="right">';
         if ($rows_returned > $nb_artifacts && $rows_returned > $offset + $limit) {
             $url_params['offset'] = $offset + $limit;
             $html .= '<span class="normal"><b>';
             $html .= '<a href="/search/?' . http_build_query($url_params);
             $html .= '"><b>' . $GLOBALS['Language']->getText('search_index', 'next_res') . ' <img src="' . util_get_image_theme('t.png') . '" height="15" width="15" border="0" align="middle"></a></b></span>';
         } else {
             $html .= '&nbsp;';
         }
         $html .= '</td></tr>';
         $html .= '</table>';
     }
     echo $html;
     $this->displayFooter($layout);
 }
 /**
  * Display the artifact
  *
  * @param ro: read only parameter - Display mode or update mode
  * @param pv: printer version
  *
  * @return void
  */
 function display($ro, $pv, $user_id)
 {
     global $art_field_fact, $art_fieldset_fact, $sys_max_size_attachment, $Language;
     $hp = Codendi_HTMLPurifier::instance();
     $fields_per_line = 2;
     // the column number is the number of field per line * 2 (label + value)
     // + the number of field per line -1 (a blank column between each pair "label-value" to give more space)
     $columns_number = $fields_per_line * 2 + ($fields_per_line - 1);
     $max_size = 40;
     $group = $this->ArtifactType->getGroup();
     $group_artifact_id = $this->ArtifactType->getID();
     $group_id = $group->getGroupId();
     $result_fields = $art_field_fact->getAllUsedFields();
     $result_fieldsets = $art_fieldset_fact->getAllFieldSetsContainingUsedFields();
     $summary = $this->getValue('summary');
     echo '<div id="tracker_toolbar_specific">';
     if ($this->ArtifactType->allowsCopy()) {
         echo "<A HREF='?func=copy&aid=" . (int) $this->getID() . "&group_id=" . (int) $group_id . "&atid=" . (int) $group_artifact_id . "'><img src=\"" . util_get_image_theme("ic/copy.png") . "\" />&nbsp;" . $Language->getText('tracker_include_artifact', 'copy_art') . "</A>";
     }
     echo "&nbsp;&nbsp;<A HREF='?func=detail&aid=" . (int) $this->getID() . "&group_id=" . (int) $group_id . "&atid=" . (int) $group_artifact_id . "&pv=1' target='_blank'><img src='" . util_get_image_theme("ic/printer.png") . "' border='0'>&nbsp;" . $Language->getText('global', 'printer_version') . "</A>";
     echo '</div>' . PHP_EOL;
     echo '<div id="tracker_toolbar_clear"></div>' . PHP_EOL;
     $artTitle = '[ ' . $hp->purify($this->ArtifactType->getItemName(), CODENDI_PURIFIER_CONVERT_HTML);
     $field_artifact_id = $result_fields['artifact_id'];
     if ($field_artifact_id->userCanRead($group_id, $group_artifact_id, $user_id)) {
         $artTitle .= " #" . $hp->purify($this->getID(), CODENDI_PURIFIER_CONVERT_HTML);
     }
     $artTitle .= ' ] ' . $hp->purify(util_unconvert_htmlspecialchars($summary), CODENDI_PURIFIER_CONVERT_HTML);
     // First display some  internal fields
     echo '
         <FORM ACTION="" METHOD="POST" enctype="multipart/form-data" NAME="artifact_form">
         <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="' . $sys_max_size_attachment . '">';
     if ($ro) {
         echo '<INPUT TYPE="HIDDEN" NAME="func" VALUE="postaddcomment">';
     } else {
         echo '<INPUT TYPE="HIDDEN" NAME="func" VALUE="postmod">';
     }
     echo '
         <INPUT TYPE="HIDDEN" NAME="artifact_timestamp" VALUE="' . time() . '">
         <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . (int) $group_id . '">
         <INPUT TYPE="HIDDEN" NAME="group_artifact_id" VALUE="' . (int) $group_artifact_id . '">
         <INPUT TYPE="HIDDEN" NAME="atid" VALUE="' . (int) $group_artifact_id . '">
         <INPUT TYPE="HIDDEN" NAME="artifact_id" VALUE="' . (int) $this->getID() . '">
         <INPUT TYPE="HIDDEN" NAME="aid" VALUE="' . (int) $this->getID() . '">';
     echo '<TABLE><TR><TD class="artifact">';
     $html = '';
     $html .= '<TABLE width="100%"><TR>';
     $pm = ProjectManager::instance();
     // Now display the variable part of the field list (depend on the project)
     foreach ($result_fieldsets as $fieldset_id => $result_fieldset) {
         // this variable will tell us if we have to display the fieldset or not (if there is at least one field to display or not)
         $display_fieldset = false;
         $fieldset_html = '';
         $i = 0;
         $fields_in_fieldset = $result_fieldset->getAllUsedFields();
         while (list($key, $field) = each($fields_in_fieldset)) {
             if ($field->getName() != 'comment_type_id' && $field->getName() != 'artifact_id') {
                 $field_html = $this->_getFieldLabelAndValueForUser($group_id, $group_artifact_id, $field, $user_id, $pv);
                 if ($field_html) {
                     // if the user can read at least one field, we can display the fieldset this field is within
                     $display_fieldset = true;
                     list($sz, ) = explode("/", $field->getDisplaySize());
                     // Details field must be on one row
                     if ($sz > $max_size || $field->getName() == 'details') {
                         $fieldset_html .= "\n<TR>" . '<TD align="left" valign="top" width="10%" nowrap="nowrap">' . $field_html['label'] . '</td>' . '<TD valign="top" width="90%" colspan="' . ($columns_number - 1) . '">' . $field_html['value'] . '</TD>' . "\n</TR>";
                         $i = 0;
                     } else {
                         $fieldset_html .= $i % $fields_per_line ? '' : "\n<TR>";
                         $fieldset_html .= '<TD align="left" valign="top" width="10%" nowrap="nowrap">' . $field_html['label'] . '</td>' . '<TD width="38%" valign="top">' . $field_html['value'] . '</TD>';
                         $i++;
                         // if the line is not full, we add a additional column to give more space
                         $fieldset_html .= $i % $fields_per_line ? '<td class="artifact_spacer" width="4%">&nbsp;</td>' : "\n</TR>";
                     }
                 }
             }
         }
         // while
         // We display the fieldset only if there is at least one field inside that we can display
         if ($display_fieldset) {
             //$html .= '<TR><TD COLSPAN="'.(int)$columns_number.'">&nbsp</TD></TR>';
             $html .= '<TR class="boxtitle artifact_fieldset"><TD class="left" COLSPAN="' . (int) $columns_number . '">&nbsp;<span title="' . $hp->purify(SimpleSanitizer::unsanitize($result_fieldset->getDescriptionText()), CODENDI_PURIFIER_CONVERT_HTML) . '">' . $hp->purify(SimpleSanitizer::unsanitize($result_fieldset->getLabel()), CODENDI_PURIFIER_CONVERT_HTML) . '</span></TD></TR>';
             $html .= $fieldset_html;
         }
     }
     $html .= '<tr><td><font color="red">*</font>: ' . $Language->getText('tracker_include_type', 'fields_requ') . '</td></tr></TABLE>';
     echo $this->_getSection('artifact_section_details', $artTitle, $html, true);
     if (!$ro) {
         echo '<div style="text-align:center"><INPUT CLASS="btn btn-primary" TYPE="SUBMIT" NAME="SUBMIT" VALUE="' . $Language->getText('tracker_include_artifact', 'submit') . '"></div>';
     }
     //
     // Followups comments
     //
     $html = '';
     $html .= '<script type="text/javascript">';
     $html .= "var tracker_comment_togglers = {};\n            function tracker_reorder_followups() {\n                var element = \$('artifact_section_followups');\n                if (element) {\n                    element.cleanWhitespace();\n                    var elements = [];\n                    var len = element.childNodes.length;\n                    for(var i = len - 1 ; i >= 0 ; --i) {\n                        elements.push(Element.remove(element.childNodes[i]));\n                    }\n                    for(var i = 0 ; i < len ; ++i) {\n                        element.appendChild(elements[i]);\n                    }\n                }\n            }";
     $html .= '</script>';
     $html .= '<div>';
     if (!$ro) {
         if (db_numrows($this->ArtifactType->getCannedResponses())) {
             $html .= '<p><b>' . $Language->getText('tracker_include_artifact', 'use_canned') . '</b>&nbsp;';
             $html .= $this->ArtifactType->cannedResponseBox();
             $html .= '</p>';
         }
         $field = $art_field_fact->getFieldFromName('comment_type_id');
         if ($field && $field->isUsed() && db_numrows($field->getFieldPredefinedValues($group_artifact_id)) > 1) {
             $field_html = new ArtifactFieldHtml($field);
             $html .= '<P><B>' . $Language->getText('tracker_include_artifact', 'comment_type') . '</B>' . $field_html->fieldBox('', $group_artifact_id, $field->getDefaultValue(), true, $Language->getText('global', 'none')) . '<BR>';
         }
         $html .= '<b>' . $Language->getText('tracker_include_artifact', 'add_comment') . '</b>';
         $html .= '<DIV ID="tracker_artifact_comment_label"></DIV>';
         $html .= '<TEXTAREA NAME="comment" id="tracker_artifact_comment" ROWS="10" style="width:700px;" WRAP="SOFT"></TEXTAREA>';
     } else {
         if ($pv == 0) {
             $html .= '<b>' . $Language->getText('tracker_include_artifact', 'add_comment') . '</b>';
             // Non authenticated user can submit only in text format
             //$html .= '<DIV ID="tracker_artifact_comment_label"></DIV>';
             $html .= '<TEXTAREA NAME="comment" id="tracker_artifact_comment" ROWS="10" style="width:700px" WRAP="SOFT"></TEXTAREA>';
         }
     }
     if (!user_isloggedin() && $pv == 0) {
         $html .= $Language->getText('tracker_include_artifact', 'not_logged_in', '/account/login.php?return_to=' . urlencode($_SERVER['REQUEST_URI']));
         $html .= '<br><input type="text" name="email" maxsize="100" size="50"/><p>';
     }
     $html .= '</div>';
     $html .= $this->showFollowUpComments($group_id, $pv);
     $title = $Language->getText('tracker_include_artifact', 'follow_ups') . ' ';
     $title .= '<script type="text/javascript">';
     $title .= 'document.write(\'<a href="#reorder" onclick="tracker_reorder_followups();new Ajax.Request(\\\'invert_comments_order.php\\\'); return false;" title="Invert order of the follow-ups">[&darr;&uarr;]</a>\');';
     $title .= '</script>';
     $title .= ' <a href="/tracker/?func=rss&aid=' . (int) $this->getId() . '&atid=' . (int) $this->ArtifactType->getID() . '&group_id=' . (int) $this->ArtifactType->getGroupId() . '" ';
     $hp =& Codendi_HTMLPurifier::instance();
     $title .= ' title="' . $hp->purify(util_unconvert_htmlspecialchars($group->getPublicName()) . ' ' . SimpleSanitizer::unsanitize($this->ArtifactType->getName()) . ' #' . $this->getId() . ' - ' . util_unconvert_htmlspecialchars($this->getValue('summary')), CODENDI_PURIFIER_CONVERT_HTML) . ' - ' . $Language->getText('tracker_include_artifact', 'follow_ups') . '">';
     $title .= '[xml]</a> ';
     if ($pv == 0) {
         $title .= help_button('tracker-v3.html#comments') . ' ';
     }
     echo $this->_getSection('artifact_section_followups', $title, $html, true);
     if (user_get_preference('tracker_comment_invertorder')) {
         echo '<script type="text/javascript">tracker_reorder_followups();</script>';
     }
     //
     // CC List
     //
     $html = '';
     if ($pv == 0) {
         $html .= $Language->getText('tracker_include_artifact', 'fill_cc_list_msg');
         $html .= $Language->getText('tracker_include_artifact', 'fill_cc_list_lbl');
         $html .= '<textarea type="text" name="add_cc" id="tracker_cc" rows="2" cols="60" wrap="soft"></textarea>';
         $html .= '<B>&nbsp;&nbsp;&nbsp;' . $Language->getText('tracker_include_artifact', 'fill_cc_list_cmt') . ":&nbsp</b>";
         $html .= '<input type="text" name="cc_comment" size="40" maxlength="255">';
     }
     $html .= $this->showCCList($group_id, $group_artifact_id, false, $pv);
     echo $this->_getSection('artifact_section_cc', $Language->getText('tracker_include_artifact', 'cc_list') . ' ' . ($pv == 0 ? help_button('tracker-v3.html#cc-list') : ''), $html, db_numrows($this->getCCList()), db_numrows($this->getCCList()) ? '' : '<div>' . $GLOBALS['Language']->getText('tracker_include_artifact', 'cc_empty') . '</div>');
     //
     // File attachments
     //
     $html = '';
     if ($pv == 0) {
         $html .= '<input type="file" name="input_file" size="40">';
         $html .= $Language->getText('tracker_include_artifact', 'upload_file_msg', formatByteToMb($sys_max_size_attachment));
         $html .= $Language->getText('tracker_include_artifact', 'upload_file_desc');
         $html .= '<input type="text" name="file_description" size="60" maxlength="255">';
     }
     $html .= $this->showAttachedFiles($group_id, $group_artifact_id, false, $pv);
     echo $this->_getSection('artifact_section_attachments', $Language->getText('tracker_include_artifact', 'attachment') . ' ' . ($pv == 0 ? help_button('tracker-v3.html#artifact-attachments') : ''), $html, db_numrows($this->getAttachedFiles()), db_numrows($this->getAttachedFiles()) ? '' : '<div>' . $GLOBALS['Language']->getText('tracker_include_artifact', 'no_file_attached') . '</div>');
     //
     // Artifact dependencies
     //
     $html = '<B>' . $Language->getText('tracker_include_artifact', 'depend_on') . '</B><BR><P>';
     if (!$ro) {
         $html .= '
                 <B>' . $Language->getText('tracker_include_artifact', 'aids') . '</B>&nbsp;
                 <input type="text" name="artifact_id_dependent" size="20" maxlength="255">
                 &nbsp;<span style="color:#666">' . $Language->getText('tracker_include_artifact', 'fill') . '</span><p>';
     }
     $html .= $this->showDependencies($group_id, $group_artifact_id, false, $pv);
     $html .= '
         <P><B>' . $Language->getText('tracker_include_artifact', 'dependent_on') . '</B><BR>
         <P>';
     $html .= $this->showInverseDependencies($group_id, $group_artifact_id);
     echo $this->_getSection('artifact_section_dependencies', $Language->getText('tracker_include_artifact', 'dependencies') . ' ' . ($pv == 0 ? help_button('tracker-v3.html#artifact-dependencies') : ''), $html, db_numrows($this->getDependencies()) || db_numrows($this->getInverseDependencies()), db_numrows($this->getDependencies()) || db_numrows($this->getInverseDependencies()) ? '' : '<div>' . $Language->getText('tracker_include_artifact', 'dep_list_empty') . '</div>');
     //
     // Artifact Cross References
     //
     $html = '';
     $crossref_fact = new CrossReferenceFactory($this->getID(), ReferenceManager::REFERENCE_NATURE_ARTIFACT, $group_id);
     $crossref_fact->fetchDatas();
     $html .= $crossref_fact->getHTMLDisplayCrossRefs();
     echo $this->_getSection('artifact_section_references', $Language->getText('cross_ref_fact_include', 'references') . ' ' . ($pv == 0 ? help_button('tracker-v3.html#artifact-cross-referencing') : ''), $html, $crossref_fact->getNbReferences(), $crossref_fact->getNbReferences() ? '' : '<div>' . $Language->getText('tracker_include_artifact', 'ref_list_empty') . '</div>');
     //
     // Artifact permissions
     //
     if ($this->ArtifactType->userIsAdmin()) {
         $checked = '';
         if ($this->useArtifactPermissions()) {
             $checked = 'checked="checked"';
         }
         $html = '';
         $html .= '<p>';
         $html .= '<label class="checkbox" for="use_artifact_permissions"><input type="hidden" name="use_artifact_permissions_name" value="0" />';
         $html .= '<input type="checkbox" name="use_artifact_permissions_name" id="use_artifact_permissions" value="1" ' . $checked . ' />';
         $html .= $GLOBALS['Language']->getText('tracker_include_artifact', 'permissions_label') . '</label>';
         $html .= '</p>';
         $html .= permission_fetch_selection_field('TRACKER_ARTIFACT_ACCESS', $this->getId(), $group_id);
         $html .= '<script type="text/javascript">';
         $html .= "\n                document.observe('dom:loaded', function() {\n                    if ( ! \$('use_artifact_permissions').checked) {\n                        \$('ugroups').disable();\n                    }\n                    \$('use_artifact_permissions').observe('click', function(evt) {\n                        if (this.checked) {\n                            \$('ugroups').enable();\n                        } else {\n                            \$('ugroups').disable();\n                        }\n                    });\n                });\n                </script>";
         echo $this->_getSection('artifact_section_permissions', $Language->getText('tracker_include_artifact', 'permissions') . ' ' . ($pv == 0 ? help_button('tracker-v3.html#permissions-on-artifacts') : ''), $html, $checked, $checked ? '' : $GLOBALS['Language']->getText('tracker_include_artifact', 'permissions_not_restricted'));
     }
     //
     // History
     //
     $is_there_history = db_numrows($this->getHistory());
     echo $this->_getSection('artifact_section_history', $Language->getText('tracker_include_artifact', 'change_history') . ' ' . ($pv == 0 ? help_button('tracker-v3.html#artifact-history') : ''), $this->showHistory($group_id, $group_artifact_id), !$is_there_history);
     //
     // Final submit button
     //
     if ($pv == 0) {
         echo '<div style="text-align:center"><INPUT CLASS="btn btn-primary" TYPE="SUBMIT" NAME="SUBMIT" VALUE="' . $Language->getText('tracker_include_artifact', 'submit') . '"></div>';
     }
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     user_set_preference('tracker_' . $this->ArtifactType->getId() . '_artifact_' . $this->getId() . '_last_visit', time());
 }
Exemple #28
0
$hp =& Codendi_HTMLPurifier::instance();
if ($num_packages < 1) {
    echo '<h3>' . $Language->getText('file_showfiles', 'no_file_p') . '</h3><p>' . $Language->getText('file_showfiles', 'no_p_available');
    if ($frspf->userCanAdmin($user, $group_id)) {
        echo '<p><a href="admin/package.php?func=add&amp;group_id=' . $group_id . '">[' . $GLOBALS['Language']->getText('file_admin_editpackages', 'create_new_p') . ']</a></p>';
    }
    file_utils_footer($params);
    exit;
}
if ($pv) {
    echo '<h3>' . $Language->getText('file_showfiles', 'p_releases') . ':</h3>';
} else {
    echo "<TABLE width='100%'><TR><TD>";
    echo '<h3>' . $Language->getText('file_showfiles', 'p_releases') . ' ' . help_button('FileReleaseJargon.html') . '</h3>';
    echo "</TD>";
    echo "<TD align='left'> ( <A HREF='showfiles.php?group_id={$group_id}&pv=1'><img src='" . util_get_image_theme("msg.png") . "' border='0'>&nbsp;" . $Language->getText('global', 'printer_version') . "</A> ) </TD>";
    echo "</TR></TABLE>";
    echo '<p>' . $Language->getText('file_showfiles', 'select_release') . '</p>';
    ?>
<SCRIPT language="JavaScript">
<!--
function showConfirmDownload(group_id,file_id,filename) {
    url = "/file/confirm_download.php?popup=1&group_id=" + group_id + "&file_id=" + file_id + "&filename=" + filename;
    wConfirm = window.open(url,"confirm","width=520,height=450,resizable=1,scrollbars=1");
    wConfirm.focus();
}

function download(group_id,file_id,filename) {
    url = "/file/download.php/" + group_id + "/" + file_id +"/"+filename;
    wConfirm.close();
    self.location = url;
 /**
  *  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>';
 }
Exemple #30
0
if ($rows < 1) {
    echo '<H2>' . $Language->getText('news_index', 'no_news_found');
    if ($group_id) {
        echo ' ' . $Language->getText('news_index', 'for', $pm->getProject($group_id)->getPublicName());
    }
    echo '</H2>';
    echo '
		<P>' . $Language->getText('news_index', 'no_items_found');
    echo db_error();
} else {
    echo '<table WIDTH="100%" border=0>
		<TR><TD VALIGN="TOP">';
    for ($j = 0; $j < $rows; $j++) {
        $forum_id = db_result($result, $j, 'forum_id');
        if (news_check_permission($forum_id, $group_id)) {
            if ($group_id) {
                echo '
		<A HREF="/forum/forum.php?forum_id=' . db_result($result, $j, 'forum_id') . '&group_id=' . $group_id . '"><IMG SRC="' . util_get_image_theme("ic/cfolder15.png") . '" HEIGHT=13 WIDTH=15 BORDER=0> &nbsp;' . stripslashes(db_result($result, $j, 'summary')) . '</A> ';
            } else {
                echo '
		  <A HREF="/forum/forum.php?forum_id=' . db_result($result, $j, 'forum_id') . '"><IMG SRC="' . util_get_image_theme("ic/cfolder15.png") . '" HEIGHT=13 WIDTH=15 BORDER=0> &nbsp;' . stripslashes(db_result($result, $j, 'summary')) . '</A> ';
            }
            echo '
		<BR>';
        }
    }
    echo '
	</TD></TR></TABLE>';
}
// Display footer page
news_footer($params);