#
# This program 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 or later of the GPL.
######################################################################
require "include/prepend.php3";
page_open(array("sess" => "SourceAgency_Session"));
if (isset($auth) && !empty($auth->auth["perm"])) {
    page_close();
    page_open(array("sess" => "SourceAgency_Session", "auth" => "SourceAgency_Auth", "perm" => "SourceAgency_Perm"));
}
require "include/header.inc";
require "include/newslib.inc";
$bx = new box("80%", $th_box_frame_color, $th_box_frame_width, $th_box_title_bgcolor, $th_box_title_font_color, $th_box_title_align, $th_box_body_bgcolor, $th_box_body_font_color, $th_box_body_align);
start_content();
$page = "news_edit";
if (check_permission($proid, $page)) {
    top_bar($proid, $page);
    print $t->translate('News can be posted by the project owner(s)') . ".\n<br><p>\n";
    if (!isset($submit) || empty($submit)) {
        if (isset($preview) && !empty($preview)) {
            news_preview($proid);
        }
        newsform($proid);
    } else {
        news_insert($proid, $auth->auth["uname"], $subject, $text);
    }
}
end_content();
require "include/footer.inc";
@page_close();
 function testNews_preview()
 {
     global $subject, $text, $auth, $sess, $bx, $t;
     $text = "this is the text";
     $subject = "this is the subject";
     $auth->set_uname("username");
     $proid = 'fubar';
     $bx = $this->_create_default_box();
     capture_reset_and_start();
     news_preview($proid);
     $this->set_text(capture_stop_and_get());
     $this->_checkFor_a_box('PREVIEW', '<center><b>%s</b></center>');
     $this->_checkFor_a_box('News', '%s: ' . $subject);
     $this->_testFor_lib_nick($auth->auth['uname']);
     $this->_testFor_string_length(947 + strlen(timestr(time())));
 }