/**
  * Constructor of the class
  *
  * @retun Void
  */
 function Widget_ProjectLatestNews()
 {
     $this->Widget('projectlatestnews');
     $request = $this->getHTTPRequest();
     $pm = $this->getProjectManager();
     $project = $pm->getProject($request->get('group_id'));
     if ($project && $this->canBeUsedByProject($project)) {
         require_once 'www/news/news_utils.php';
         $this->content = news_show_latest($request->get('group_id'), 10, false);
     }
 }
Ejemplo n.º 2
0
 public function displayStandardHomepage($display_homepage_news)
 {
     $dao = new Admin_Homepage_Dao();
     $current_user = UserManager::instance()->getCurrentUser();
     $project_dao = new UserDao();
     $nb_users = $project_dao->countActiveAndRestrictedUsers();
     $project_dao = new ProjectDao();
     $nb_projects = $project_dao->countActiveProjects();
     $most_secure_url = '';
     if (ForgeConfig::get('sys_https_host')) {
         $most_secure_url = 'https://' . ForgeConfig::get('sys_https_host');
     }
     $login_presenter_builder = new User_LoginPresenterBuilder();
     $login_presenter = $login_presenter_builder->buildForHomepage();
     $headline = $dao->getHeadlineByLanguage($current_user->getLocale());
     $news_bytes_dao = new NewsBytesDao();
     $news = false;
     if ($display_homepage_news && $news_bytes_dao->isThereNewsToDisplayInHomepage()) {
         $news = news_show_latest($GLOBALS['sys_news_group'], 2, true, false, true, 0);
     }
     $awesomeness = file_get_contents($GLOBALS['Language']->getContent('homepage/awesomeness', null, null, '.html'));
     $templates_dir = ForgeConfig::get('codendi_dir') . '/src/templates/homepage/';
     $renderer = TemplateRendererFactory::build()->getRenderer($templates_dir);
     $presenter = new FlamingParrot_HomepagePresenter($headline, $nb_projects, $nb_users, $most_secure_url, $login_presenter, $display_homepage_news, $news, $current_user, $awesomeness);
     $renderer->renderToPage('homepage', $presenter);
 }
Ejemplo n.º 3
0
<?php

//
// SourceForge: Breaking Down the Barriers to Open Source Development
// Copyright 1999-2000 (c) The SourceForge Crew
// http://sourceforge.net
//
require 'pre.php';
require $DOCUMENT_ROOT . '/news/news_utils.php';
if ($limit > 20) {
    $limit = 20;
}
$news = news_show_latest($group_id, $limit, $show_summaries, false, $flat);
print $news;
Ejemplo n.º 4
0
<?php

/**
 * Copyright (c) Enalean 2011. All rights reserved
 *
 * Tuleap is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Tuleap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
 */
if ($display_homepage_news) {
    ?>
    <div class="span4">
        <h2><?php 
    echo $Language->getText('homepage', 'news_title');
    ?>
</h2>
        <?php 
    echo news_show_latest($GLOBALS['sys_news_group'], 3, true, false, true, 3);
    ?>
    </div>
<?php 
}
Ejemplo n.º 5
0
print _('New online_help plugin.');
?>
</li>
<li><?php 
print _('New phpwebcalendar plugin.');
?>
</li>
<li><?php 
print _('New project hierarchy plugin.');
?>
</li>
</ul>
</p>
<?php 
echo $HTML->boxTop(_('Latest News'));
echo news_show_latest($sys_news_group, 5, true, false, false, 5);
echo $HTML->boxBottom();
?>

</td>

<td width="35%" valign="top">
<?php 
echo $HTML->boxTop('Getting FusionForge');
?>
<p />
<strong><?php 
print _('Download');
?>
</strong><br />
<?php 
Ejemplo n.º 6
0
    echo ' ( <B>' . project_get_screenshots_count($group_id) . '</B> screenshots )';
}
// 2003-01-31 helix
// ######################## Wiki
if ($project->usesWiki()) {
    print '<HR SIZE="1" NoShade><A href="/wiki/?group_id=' . $group_id . '">';
    print html_image("images/ic/manual16b.png", '20', '20', array('alt' => $Language->GROUP_LONG_WIKI));
    print " " . $Language->GROUP_LONG_WIKI . "</A>";
}
$HTML->box1_bottom();
if ($project->usesNews()) {
    // COLUMN BREAK
    ?>

	</TD>
	<TD WIDTH="15">&nbsp;</TD>
	<TD VALIGN="top">

	<?php 
    // ############################# Latest News
    echo $HTML->box1_top($Language->GROUP_LONG_NEWS);
    echo news_show_latest($group_id, 10, false);
    echo $HTML->box1_bottom();
}
?>
</TD>

</TR></TABLE>

<?php 
site_project_footer(array());
Ejemplo n.º 7
0
    $HTML->header($header_params);
    $HTML->displayStandardHomepage($display_homepage_news);
} else {
    $HTML->header($header_params);
    echo '<div id="homepage" class="container">';
    // go fetch le content that may have its own logic to decide if the boxes should be displayed or not
    ob_start();
    include $Language->getContent('homepage/homepage', null, null, '.php');
    $homepage_content = ob_get_contents();
    ob_end_clean();
    echo '<div id="homepage_speech" ' . ($display_homepage_boxes ? '' : 'style="width:100%;"') . '>';
    echo $homepage_content;
    echo '</div>';
    if ($display_homepage_boxes) {
        echo '<div id="homepage_boxes">';
        show_features_boxes();
        echo '</div>';
    }
    // HTML is sad, we need to keep this div to clear the "float:right/left" that might exists before
    // Yet another dead kitten somewhere :'(
    echo '<div id="homepage_news">';
    if ($display_homepage_news) {
        $w = new Widget_Static($Language->getText('homepage', 'news_title'));
        $w->setContent(news_show_latest($GLOBALS['sys_news_group'], 5, true, false, true, 5));
        $w->setRssUrl('/export/rss_sfnews.php');
        $w->display();
    }
    echo '</div>';
    echo '</div>';
}
$HTML->footer(array());
Ejemplo n.º 8
0
function forum_header($params)
{
    global $HTML, $group_id, $forum_name, $thread_id, $msg_id, $forum_id, $et, $et_cookie, $Language;
    $hp = Codendi_HTMLPurifier::instance();
    $uh = new UserHelper();
    $params['group'] = $group_id;
    $params['toptab'] = 'forum';
    $params['help'] = 'WebForums.html';
    /*
    	bastardization for news
    	Show icon bar unless it's a news forum
    */
    if ($group_id == $GLOBALS['sys_news_group']) {
        //this is a news item, not a regular forum
        if ($forum_id) {
            /*
            	Show this news item at the top of the page
            */
            $sql = "SELECT * FROM news_bytes WHERE forum_id=" . db_ei($forum_id);
            $result = db_query($sql);
            //backwards shim for all "generic news" that used to be submitted
            //as of may, "generic news" is not permitted - only project-specific news
            if (db_result($result, 0, 'group_id') != $GLOBALS['sys_news_group']) {
                $params['group'] = db_result($result, 0, 'group_id');
                $params['toptab'] = 'news';
                $group_id = db_result($result, 0, 'group_id');
                site_project_header($params);
            } else {
                $HTML->header($params);
                echo '
					<H2>' . $GLOBALS['sys_name'] . ' <A HREF="/news/">' . $Language->getText('forum_forum_utils', 'news') . '</A></H2><P>';
            }
            echo '<TABLE><TR><TD VALIGN="TOP">';
            if (!$result || db_numrows($result) < 1) {
                echo '
					<h3>' . $Language->getText('forum_forum_utils', 'news_not_found') . '</h3>';
            } else {
                echo '
				<B>' . $Language->getText('forum_forum_utils', 'posted_by') . ':</B> ' . $hp->purify($uh->getDisplayNameFromUserId(db_result($result, 0, 'submitted_by')), CODENDI_PURIFIER_CONVERT_HTML) . '<BR>
				<B>' . $Language->getText('forum_forum', 'date') . ':</B> ' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, 0, 'date')) . '<BR>
				<B>' . $Language->getText('forum_forum_utils', 'summary') . ':</B><A HREF="/forum/forum.php?forum_id=' . db_result($result, 0, 'forum_id') . '">' . db_result($result, 0, 'summary') . '</A>
				<P>
				' . util_make_links(nl2br(db_result($result, 0, 'details')), $group_id);
                echo '<P>';
                $crossref_fact = new CrossReferenceFactory($forum_id, ReferenceManager::REFERENCE_NATURE_NEWS, $group_id);
                $crossref_fact->fetchDatas();
                if ($crossref_fact->getNbReferences() > 0) {
                    echo '<b> ' . $Language->getText('cross_ref_fact_include', 'references') . '</b>';
                    $crossref_fact->DisplayCrossRefs();
                }
            }
            echo '</TD><TD VALIGN="TOP" WIDTH="35%">';
            echo $HTML->box1_top($Language->getText('forum_forum_utils', 'proj_latest_news'), 0);
            echo news_show_latest(db_result($result, 0, 'group_id'), 5, false);
            echo $HTML->box1_bottom();
            echo '</TD></TR></TABLE>';
        }
    } else {
        //this is just a regular forum, not a news item
        site_project_header($params);
    }
    /*
    	Show horizontal forum links
    */
    if ($forum_id && $forum_name) {
        echo '<P><H3>' . $Language->getText('forum_forum_utils', 'discuss_forum') . ': <A HREF="/forum/forum.php?forum_id=' . $forum_id . '">' . $forum_name . '</A></H3>';
    }
    if (!isset($params['pv']) || isset($params['pv']) && !$params['pv']) {
        echo '<P><B>';
        $request =& HTTPRequest::instance();
        if ($forum_id && user_isloggedin() && !$request->exist('delete')) {
            if (user_monitor_forum($forum_id, user_getid())) {
                $msg = $Language->getText('forum_forum_utils', 'stop_monitor');
            } else {
                $msg = $Language->getText('forum_forum_utils', 'monitor');
            }
            echo '<A HREF="/forum/monitor.php?forum_id=' . $forum_id . '">';
            echo html_image("ic/monitor_forum.png", array()) . ' ' . $msg . '</A> | ';
            echo '<A HREF="/forum/monitor_thread.php?forum_id=' . $forum_id . '"> ' . html_image("ic/monitor_thread.png", array()) . $Language->getText('forum_forum_utils', 'monitor_thread') . '</A> | ';
            echo '<A HREF="/forum/save.php?forum_id=' . $forum_id . '">';
            echo html_image("ic/save.png", array()) . ' ' . $Language->getText('forum_forum_utils', 'save_place') . '</A> | ';
            print ' <a href="forum.php?forum_id=' . $forum_id . '#start_new_thread">';
            echo html_image("ic/thread.png", array()) . ' ' . $Language->getText('forum_forum_utils', 'start_thread') . '</A> | ';
            if (isset($msg_id) && $msg_id) {
                echo "<A HREF='" . $_SERVER['PHP_SELF'] . "?msg_id={$msg_id}&pv=1'><img src='" . util_get_image_theme("msg.png") . "' border='0'>&nbsp;" . $Language->getText('global', 'printer_version') . "</A> | ";
            } else {
                echo "<A HREF='" . $_SERVER['PHP_SELF'] . "?forum_id={$forum_id}&pv=1'><img src='" . util_get_image_theme("msg.png") . "' border='0'>&nbsp;" . $Language->getText('global', 'printer_version') . "</A> | ";
            }
        }
        // The forum admin link is only displayed for the forum moderators
        if (user_ismember($group_id, 'F2')) {
            echo '  <A HREF="/forum/admin/?group_id=' . $group_id . '">' . $Language->getText('forum_forum_utils', 'admin') . '</A></B>';
            if (isset($params['help']) && $params['help']) {
                echo ' | ';
            }
        }
        if (isset($params['help']) && $params['help']) {
            echo help_button($params['help'], false, $Language->getText('global', 'help'));
        }
        echo '</B><P>';
    }
}
Ejemplo n.º 9
0
function forum_header($params)
{
    global $DOCUMENT_ROOT, $HTML, $group_id, $forum_name, $thread_id, $msg_id, $forum_id, $REQUEST_URI, $sys_datefmt, $et, $et_cookie, $sys_news_group;
    $params['group'] = $group_id;
    $params['toptab'] = 'forums';
    /*
    	bastardization for news
    	Show icon bar unless it's a news forum
    */
    if ($group_id == $sys_news_group) {
        //this is a news item, not a regular forum
        if ($forum_id) {
            /*
            	Show this news item at the top of the page
            */
            $sql = "SELECT * FROM news_bytes WHERE forum_id='{$forum_id}'";
            $result = db_query($sql);
            //backwards shim for all "generic news" that used to be submitted
            //as of may, "generic news" is not permitted - only project-specific news
            if (db_result($result, 0, 'group_id') != $sys_news_group) {
                $params['group'] = db_result($result, 0, 'group_id');
                $params['toptab'] = 'news';
                site_project_header($params);
            } else {
                $HTML->header($params);
                echo '
					<H2>' . $GLOBALS['sys_default_name'] . ' <A HREF="/news/">News</A></H2><P>';
            }
            echo '<TABLE WIDTH="100%"><TR><TD VALIGN="TOP">';
            if (!$result || db_numrows($result) < 1) {
                echo '
					<h3>Error - this news item was not found</h3>';
            } else {
                echo '
				<B>Posted By:</B> ' . user_getname(db_result($result, 0, 'submitted_by')) . '<BR>
				<B>Date:</B> ' . date($sys_datefmt, db_result($result, 0, 'date')) . '<BR>
				<B>Summary:</B> <A HREF="/forum/forum.php?forum_id=' . db_result($result, 0, 'forum_id') . '">' . db_result($result, 0, 'summary') . '</A>
				<P>
				' . nl2br(util_make_links(db_result($result, 0, 'details')));
                echo '<P>';
            }
            echo '</TD><TD VALIGN="top" WIDTH="35%">';
            echo $HTML->box1_top('Latest News', 0, $GLOBALS['COLOR_LTBACK2']);
            echo news_show_latest($sys_news_group, 5, false);
            echo $HTML->box1_bottom();
            echo '</TD></TR></TABLE>';
        }
    } else {
        //this is just a regular forum, not a news item
        site_project_header($params);
    }
    /*
    	Show horizontal forum links
    */
    if ($forum_id && $forum_name) {
        echo '<P><H2>Discussion Forums: <A HREF="/forum/forum.php?forum_id=' . $forum_id . '">' . $forum_name . '</A></H2>';
    }
    echo '<P><B>';
    if ($forum_id && user_isloggedin()) {
        // 2003-02-04 helix: change to relative images url
        echo '<A HREF="/forum/monitor.php?forum_id=' . $forum_id . '">' . html_image('images/ic/check.png', '16', '15', array()) . ' Monitor Forum</A> | ' . '<A HREF="/forum/save.php?forum_id=' . $forum_id . '">';
        // 2003-02-04 helix: change to relative images url
        echo html_image('images/ic/save.png', '24', '24', array()) . ' Save Place</A> | ';
    }
    echo '  <A HREF="/forum/admin/?group_id=' . $group_id . '">Admin</A></B>';
    echo '<P>';
}
Ejemplo n.º 10
0
function forum_header($params)
{
    global $HTML, $group_id, $forum_name, $forum_id, $sys_news_group, $f, $sys_use_forum, $group_forum_id;
    if ($group_forum_id) {
        $forum_id = $group_forum_id;
    }
    if (!$sys_use_forum) {
        exit_disabled();
    }
    $params['group'] = $group_id;
    $params['toptab'] = 'forums';
    /*
    bastardization for news
    Show icon bar unless it's a news forum
    */
    if ($group_id == $sys_news_group) {
        //this is a news item, not a regular forum
        if ($forum_id) {
            // Show this news item at the top of the page
            $sql = "SELECT submitted_by, post_date, group_id, forum_id, summary, details FROM news_bytes WHERE forum_id='{$forum_id}'";
            $result = db_query($sql);
            // checks which group the news item belongs to
            $params['group'] = db_result($result, 0, 'group_id');
            $params['toptab'] = 'news';
            $HTML->header($params);
            echo '<table><tr><td valign="top">';
            if (!$result || db_numrows($result) < 1) {
                echo '<h3>' . _('Error - this news item was not found') . '</h3>';
            } else {
                $user = user_get_object(db_result($result, 0, 'submitted_by'));
                $group =& group_get_object($params['group']);
                if (!$group || !is_object($group) || $group->isError()) {
                    exit_no_group();
                }
                echo '
				<strong>' . _('Posted by') . ':</strong> ' . $user->getRealName() . '<br />
				<strong>' . _('Date') . ':</strong> ' . date(_('Y-m-d H:i'), db_result($result, 0, 'post_date')) . '<br />
				<strong>' . _('Summary') . ':</strong>' . util_make_link('/forum/forum.php?forum_id=' . db_result($result, 0, 'forum_id') . '&group_id=' . $group_id, db_result($result, 0, 'summary')) . '<br/>
				<strong>' . _('Project') . ':</strong>' . util_make_link_g($group->getUnixName(), db_result($result, 0, 'group_id'), $group->getPublicName()) . '<br />
				<p>
				' . util_make_links(nl2br(db_result($result, 0, 'details')));
                echo '</p>';
            }
            echo '</td><td valign="top" width="35%">';
            echo $HTML->boxTop(_('Latest News'));
            echo news_show_latest($params['group'], 5, false);
            echo $HTML->boxBottom();
            echo '</td></tr></table>';
        } else {
            site_project_header($params);
        }
    } else {
        site_project_header($params);
    }
    $menu_text = array();
    $menu_links = array();
    if ($f) {
        if ($f->userIsAdmin()) {
            $menu_text[] = _('Admin');
            $menu_links[] = '/forum/admin/?group_id=' . $group_id;
        }
        if ($forum_id) {
            $menu_text[] = _('Discussion Forums:') . ' ' . $f->getName();
            $menu_links[] = '/forum/forum.php?forum_id=' . $forum_id;
        }
    } else {
        $gg =& group_get_object($group_id);
        $perm =& $gg->getPermission(session_get_user());
        if ($perm->isForumAdmin()) {
            $menu_text[] = _('Admin');
            $menu_links[] = '/forum/admin/?group_id=' . $group_id;
        }
    }
    if (count($menu_text) > 0) {
        echo $HTML->subMenu($menu_text, $menu_links);
    }
    if (session_loggedin()) {
        if ($f) {
            if ($f->isMonitoring()) {
                echo util_make_link('/forum/monitor.php?forum_id=' . $forum_id . '&amp;group_id=' . $group_id . '&amp;stop=1', html_image('ic/xmail16w.png', '20', '20', array()) . ' ' . _('Stop Monitoring')) . ' | ';
            } else {
                echo util_make_link('/forum/monitor.php?forum_id=' . $forum_id . '&amp;group_id=' . $group_id . '&amp;start=1', html_image('ic/mail16w.png', '20', '20', array()) . ' ' . _('Monitor Forum')) . ' | ';
            }
            echo util_make_link('/forum/save.php?forum_id=' . $forum_id . '&amp;group_id=' . $group_id, html_image('ic/save.png', '24', '24', array()) . ' ' . _('Save Place')) . ' | ';
        }
    }
    if ($f && $forum_id) {
        echo util_make_link('/forum/new.php?forum_id=' . $forum_id . '&amp;group_id=' . $group_id, html_image('ic/write16w.png', '20', '20', array('alt' => _('Start New Thread'))) . ' ' . _('Start New Thread'));
    }
}