[geeklog-cvs] geeklog-1.3/system lib-comment.php,1.7,1.8
vinny at iowaoutdoors.org
vinny at iowaoutdoors.org
Sat Feb 5 00:04:20 EST 2005
Update of /var/cvs/geeklog-1.3/system
In directory www:/tmp/cvs-serv9651/system
Modified Files:
lib-comment.php
Log Message:
Checking in dynamic comments
Index: lib-comment.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/system/lib-comment.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** lib-comment.php 28 Jan 2005 13:12:06 -0000 1.7
--- lib-comment.php 5 Feb 2005 05:04:17 -0000 1.8
***************
*** 52,56 ****
*/
function CMT_commentBar( $sid, $title, $type, $order, $mode ) {
! global $_CONF, $_TABLES, $_USER, $LANG01;
$page = array_pop( explode( '/', $_SERVER['PHP_SELF'] ));
--- 52,56 ----
*/
function CMT_commentBar( $sid, $title, $type, $order, $mode ) {
! global $_CONF, $_TABLES, $_USER, $LANG01, $_REQUEST;
$page = array_pop( explode( '/', $_SERVER['PHP_SELF'] ));
***************
*** 156,161 ****
$selector = '<select name="mode">';
}
$selector .= LB
! . COM_optionList( $_TABLES['commentmodes'], 'mode,name', $mode )
. LB . '</select>';
$commentbar->set_var( 'mode_selector', $selector);
--- 156,165 ----
$selector = '<select name="mode">';
}
+ $where = '';
+ if( !$_CONF['dynamic_comments'] ) {
+ $where = 'mode != \'dynamic\'';
+ }
$selector .= LB
! . COM_optionList( $_TABLES['commentmodes'], 'mode,name', $mode, 1, $where )
. LB . '</select>';
$commentbar->set_var( 'mode_selector', $selector);
***************
*** 187,191 ****
$template = new Template( $_CONF['path_layout'] . 'comment' );
$template->set_file( array( 'comment' => 'comment.thtml',
! 'thread' => 'thread.thtml' ));
// generic template variables
--- 191,196 ----
$template = new Template( $_CONF['path_layout'] . 'comment' );
$template->set_file( array( 'comment' => 'comment.thtml',
! 'thread' => 'thread.thtml',
! 'wrap' => 'commentwrap.thtml' ));
// generic template variables
***************
*** 203,213 ****
}
! if( $preview ) {
$A = $comments;
! if( empty( $A['nice_date'] ))
! {
$A['nice_date'] = time();
}
! $mode = 'flat';
} else {
$A = DB_fetchArray($comments);
--- 208,219 ----
}
! if( $preview || $mode == 'dynamic_thread' || $mode == 'dynamic_comment' ) {
$A = $comments;
! if( empty( $A['nice_date'] )) {
$A['nice_date'] = time();
}
! if ( $preview ) {
! $mode = 'flat';
! }
} else {
$A = DB_fetchArray($comments);
***************
*** 220,224 ****
do {
// determines indentation for current comment
! if( $mode == 'threaded' || $mode == 'nested' ) {
$indent = ($A['indent'] - $A['pindent']) * $_CONF['comment_indent'];
}
--- 226,230 ----
do {
// determines indentation for current comment
! if( $mode == 'threaded' || $mode == 'nested' || $mode == 'dynamic' ) {
$indent = ($A['indent'] - $A['pindent']) * $_CONF['comment_indent'];
}
***************
*** 228,231 ****
--- 234,238 ----
$template->set_var( 'author', $A['username'] );
$template->set_var( 'author_id', $A['uid'] );
+ $template->set_var( 'cid', $A['cid'] );
if( $A['uid'] > 1 ) {
***************
*** 279,282 ****
--- 286,296 ----
}
+ // Display ability to expand comments only in dynamic mode
+ if( $mode != 'dynamic' && $mode != 'dynamic_thread' && $mode != 'dynamic_comment' ) {
+ $template->set_var( 'dynamic_hide', 'style="display:none"' );
+ } else {
+ $template->set_var( 'dynamic_hide', '' );
+ }
+
// for threaded mode, add a link to comment parent
if( $mode == 'threaded' && $A['pid'] != 0 && $indent == 0 ) {
***************
*** 356,365 ****
// parse the templates
! if( $mode == 'threaded' && $indent > 0 ) {
$template->set_var( 'pid', $A['pid'] );
$retval .= $template->parse( 'output', 'thread' );
} else {
$template->set_var( 'pid', $A['cid'] );
! $retval .= $template->parse( 'output', 'comment' );
}
} while( $A = DB_fetchArray( $comments ));
--- 370,387 ----
// parse the templates
! if( $mode == 'dynamic_thread' ) {
$template->set_var( 'pid', $A['pid'] );
$retval .= $template->parse( 'output', 'thread' );
+ } else if( $mode == 'dynamic_comment') {
+ $template->set_var( 'pid', $A['cid'] );
+ $retval .= $template->parse( 'output', 'comment' );
+ } else if( (($mode == 'threaded' || $mode == 'dynamic') && $indent > 0 )) {
+ $template->set_var( 'pid', $A['pid'] );
+ $template->set_var( 'comment_content', $template->parse( 'output', 'thread' ) );
+ $retval .= $template->parse( 'output', 'wrap' );
} else {
$template->set_var( 'pid', $A['cid'] );
! $template->set_var( 'comment_content', $template->parse( 'output', 'comment' ) );
! $retval .= $template->parse( 'output', 'wrap' );
}
} while( $A = DB_fetchArray( $comments ));
***************
*** 411,414 ****
--- 433,441 ----
}
+ // if dynamic comment mode is disabled and selected, use threaded instead
+ if ( ($mode == 'dynamic') && (!$_CONF['dynamic_comments']) ) {
+ $mode = 'threaded';
+ }
+
if( empty( $limit )) {
$limit = $_CONF['comment_limit'];
***************
*** 428,432 ****
CMT_commentBar( $sid, $title, $type, $order, $mode));
! if( $mode == 'nested' or $mode == 'threaded' or $mode == 'flat' ) {
// build query
switch( $mode ) {
--- 455,459 ----
CMT_commentBar( $sid, $title, $type, $order, $mode));
! if( $mode == 'nested' || $mode == 'threaded' || $mode == 'flat' || $mode == 'dynamic' ) {
// build query
switch( $mode ) {
***************
*** 452,455 ****
--- 479,483 ----
case 'nested':
case 'threaded':
+ case 'dynamic':
default:
if( $order == 'DESC' ) {
More information about the geeklog-cvs
mailing list