Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

mantisbt/core news_api.php,1.20,1.21 print_api.php,1.117,1.118: msg#00037

bug-tracking.mantis.cvs

Subject: mantisbt/core news_api.php,1.20,1.21 print_api.php,1.117,1.118

Update of /cvsroot/mantisbt/mantisbt/core
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22654/core

Modified Files:
news_api.php print_api.php
Log Message:
- Moved news printing code to print_api.php (rather than news_inc.php).
- Added field names to missing field error message on updating.
- Update the preview done after news adding to use the same news printing api.
- Removed news_inc.php and all references to it.

Index: news_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/news_api.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- news_api.php 21 Mar 2005 11:57:55 -0000 1.20
+++ news_api.php 21 Mar 2005 12:09:30 -0000 1.21
@@ -48,7 +48,7 @@
db_query( $query );

# db_query() errors on failure so:
- return true;
+ return db_insert_id();
}
# --------------------
# Delete the news entry
@@ -90,7 +90,13 @@
$c_headline = db_prepare_string( $p_headline );
$c_body = db_prepare_string( $p_body );

- if ( is_blank( $c_headline ) || is_blank( $c_body ) ) {
+ if ( is_blank( $c_headline ) ) {
+ error_parameters( lang_get( 'headline' ) );
+ trigger_error( ERROR_EMPTY_FIELD, ERROR );
+ }
+
+ if ( is_blank( $c_body ) ) {
+ error_parameters( lang_get( 'body' ) );
trigger_error( ERROR_EMPTY_FIELD, ERROR );
}


Index: print_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/print_api.php,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- print_api.php 26 Feb 2005 15:16:46 -0000 1.117
+++ print_api.php 21 Mar 2005 12:09:31 -0000 1.118
@@ -267,6 +267,72 @@
PRINT "<option
value=\"$v_id\">$v_headline$t_note_string</option>";
}
}
+ #---------------
+ # Constructs the string for one news entry given the row retrieved from
the news table.
+ function print_news_entry( $p_headline, $p_body, $p_poster_id,
$p_view_state, $p_announcement, $p_date_posted ) {
+ $t_headline = string_display_links( $p_headline );
+ $t_body = string_display_links( $p_body );
+ $t_date_posted = date( config_get( 'normal_date_format' ),
$p_date_posted );
+
+ if ( VS_PRIVATE == $p_view_state ) {
+ $t_news_css = 'news-heading-private';
+ } else {
+ $t_news_css = 'news-heading-public';
+ }
+
+ $output = '<div align="center">';
+ $output .= '<table class="width75" cellspacing="0">';
+ $output .= '<tr>';
+ $output .= "<td class=\"$t_news_css\">";
+ $output .= "<span class=\"bold\">$t_headline</span> - ";
+ $output .= "<span class=\"italic-small\">$t_date_posted</span>
- ";
+ echo $output;
+
+ # @@@ eventually we should replace print's with methods to
construct the
+ # strings.
+ print_user( $p_poster_id );
+ $output = '';
+
+ $output .= ' <span class="small">';
+ if ( 1 == $p_announcement ) {
+ $output .= '[' . lang_get( 'announcement' ) . ']';
+ }
+ if ( VS_PRIVATE == $p_view_state ) {
+ $output .= '[' . lang_get( 'private' ) . ']';
+ }
+
+ $output .= '</span>';
+ $output .= '</td>';
+ $output .= '</tr>';
+ $output .= '<tr>';
+ $output .= "<td class=\"news-body\">$t_body</td>";
+ $output .= '</tr>';
+ $output .= '</table>';
+ $output .= '</div>';
+
+ echo $output;
+ }
+
+ # --------------------
+ # print a news item given a row in the news table.
+ function print_news_entry_from_row( $p_news_row ) {
+ extract( $p_news_row, EXTR_PREFIX_ALL, 'v' );
+ print_news_entry( $v_headline, $v_body, $v_poster_id,
$v_view_state, $v_announcement, $v_date_posted );
+ }
+
+ # --------------------
+ # print a news item
+ function print_news_string_by_news_id( $p_news_id ) {
+ $row = news_get_row( $p_news_id );
+
+ # only show VS_PRIVATE posts to configured threshold and above
+ if ( ( VS_PRIVATE == $row['view_state'] ) &&
+ !access_has_project_level( config_get(
'private_news_threshold' ) ) ) {
+ continue;
+ }
+
+ print_news_entry_from_row( $row );
+ }
# --------------------
# Used for update pages
function print_field_option_list( $p_list, $p_item='' ) {



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
video.h264.deve...    technology.erps...    drivers.hostap/...    user-groups.lin...    games.railroad-...    handhelds.linux...    lang.harbour.de...    recreation.radi...    culture.publica...    xfree86.devel/2...    music.john-cage...    otrs.cvs/2003-0...    network.e-smith...    asplinux.suppor...    qnx.openqnx.dev...    ietf.nfsv4/2005...    editors.vim/200...    kde.devel.kopet...    web.zope.zwiki....    freebsd.devel.m...    java.xdoclet.de...    php.simpletest....    bacula.user/200...    security.virus....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation