[geeklog-cvs] geeklog-1.3/public_html lib-common.php,1.216,1.217

geeklog-cvs-admin at lists.geeklog.net geeklog-cvs-admin at lists.geeklog.net
Mon Apr 21 12:49:35 EDT 2003


Update of /usr/cvs/geeklog/geeklog-1.3/public_html
In directory internal.geeklog.net:/tmp/cvs-serv3726

Modified Files:
	lib-common.php 
Log Message:
Moved hard-coded HTML for the poll results to template files.


Index: lib-common.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.216
retrieving revision 1.217
diff -C2 -d -r1.216 -r1.217
*** lib-common.php	21 Apr 2003 09:56:56 -0000	1.216
--- lib-common.php	21 Apr 2003 16:49:33 -0000	1.217
***************
*** 1658,1664 ****
                              DB_count( $_TABLES['comments'], 'sid', $qid ));
                      $poll->set_var( 'lang_comments', $LANG01[3] );
-                     $poll->parse( 'poll_comments', 'comments', true );
                      $poll->set_var( 'poll_comments_url', $_CONF['site_url'] .
                          '/pollbooth.php?qid=' . $qid . '&aid=-1#comments');
                  }
                  else
--- 1658,1664 ----
                              DB_count( $_TABLES['comments'], 'sid', $qid ));
                      $poll->set_var( 'lang_comments', $LANG01[3] );
                      $poll->set_var( 'poll_comments_url', $_CONF['site_url'] .
                          '/pollbooth.php?qid=' . $qid . '&aid=-1#comments');
+                     $poll->parse( 'poll_comments', 'comments', true );
                  }
                  else
***************
*** 1807,1812 ****
                  $retval .= COM_startBlock( $title );
              }
!             $retval .= '<h2>' . $Q['question'] . '</h2>'
!                 .'<table border="0" cellpadding="3" cellspacing="0" align="center">' . LB;
  
              for( $i = 1; $i <= $nanswers; $i++ )
--- 1807,1824 ----
                  $retval .= COM_startBlock( $title );
              }
! 
!             $poll = new Template( $_CONF['path_layout'] . '/pollbooth' );
!             $poll->set_file( array( 'result' => 'pollresult.thtml',
!                                     'comments' => 'pollcomments.thtml',
!                                     'votes_bar' => 'pollvotes_bar.thtml',
!                                     'votes_num' => 'pollvotes_num.thtml' ));
!             $poll->set_var( 'site_url', $_CONF['site_url'] );
!             $poll->set_var( 'layout_url', $_CONF['layout_url'] );
! 
!             $poll->set_var( 'poll_question', $Q['question'] );
!             $poll->set_var( 'poll_id', $qid );
!             $poll->set_var( 'num_votes', $Q['voters'] );
! 
!             $poll->set_var( 'lang_votes', $LANG01[8] );
  
              for( $i = 1; $i <= $nanswers; $i++ )
***************
*** 1823,1856 ****
                  }
  
!                 $retval .= '<tr>' . LB
!                     . '<td align="right"><b>' . $A['answer'] . '</b></td>' . LB
!                     . '<td>';
! 
                  if( $scale < 120 )
                  {
!                     $retval .= sprintf( "%.2f", $percent * 100 ) . '% </td>' . LB;
                  }
                  else
                  {
                      $width = $percent * $scale;
!                     $retval .= '<img src="' . $_CONF['layout_url']
!                         . '/images/bar.gif" width="' . $width
!                         . '" height="10" align="bottom" alt=""> '
!                         . $A['votes'] . ' ' . sprintf( "(%.2f)", $percent * 100 ) . '%' . '</td>' . LB;
                  }
- 
-                 $retval .= '</tr>' . LB;
              }
  
-             $retval .= '</table>' . LB . '<div class="storybyline" align="right">'
-                 . $Q['voters'] . ' ' . $LANG01[8] . LB;
- 
              if( $Q['commentcode'] >= 0 )
              {
!                 $retval .= ' | <a href="' .$_CONF['site_url'] . '/pollbooth.php?qid=' . $qid.'&aid=-1#comments">'
!                     . DB_count( $_TABLES['comments'], 'sid', $qid ) . ' ' . $LANG01[3] . '</a>';
              }
  
!             $retval .= '</div>'. LB;
              if( $scale < 120)
              {
--- 1835,1873 ----
                  }
  
!                 $poll->set_var( 'answer_text', $A['answer'] );
!                 $poll->set_var( 'answer_counter', $i );
!                 $poll->set_var( 'answer_odd', (( $i - 1 ) % 2 ));
!                 $poll->set_var( 'answer_num', $A['votes'] );
!                 $poll->set_var( 'answer_percent',
!                                 sprintf( '%.2f', $percent * 100 ));
                  if( $scale < 120 )
                  {
!                     $poll->parse( 'poll_votes', 'votes_num', true );
                  }
                  else
                  {
                      $width = $percent * $scale;
!                     $poll->set_var( 'bar_width', $width );
!                     $poll->parse( 'poll_votes', 'votes_bar', true );
                  }
              }
  
              if( $Q['commentcode'] >= 0 )
              {
!                 $poll->set_var( 'num_comments',
!                         DB_count( $_TABLES['comments'], 'sid', $qid ));
!                 $poll->set_var( 'lang_comments', $LANG01[3] );
!                 $poll->set_var( 'poll_comments_url', $_CONF['site_url'] .
!                         '/pollbooth.php?qid=' . $qid . '&aid=-1#comments');
!                 $poll->parse( 'poll_comments', 'comments', true );
!             }
!             else
!             {
!                 $poll->set_var( 'poll_comments_url', '' );
!                 $poll->set_var( 'poll_comments', '' );
              }
  
!             $retval .= $poll->finish( $poll->parse( 'output', 'result' ));
! 
              if( $scale < 120)
              {





More information about the geeklog-cvs mailing list