[geeklog-cvs] journal functions.inc,1.7,1.8

geeklog-cvs-admin at lists.geeklog.net geeklog-cvs-admin at lists.geeklog.net
Thu Aug 21 15:10:21 EDT 2003


Update of /usr/cvs/geeklog/journal
In directory geeklog_prod:/tmp/cvs-serv31827

Modified Files:
	functions.inc 
Log Message:
Allow for shorter URLs to display the Journal entries.
Some more HTML cleanup.


Index: functions.inc
===================================================================
RCS file: /usr/cvs/geeklog/journal/functions.inc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** functions.inc	6 Aug 2003 20:10:32 -0000	1.7
--- functions.inc	21 Aug 2003 19:10:19 -0000	1.8
***************
*** 623,628 ****
  }
  
! function showjournalentries($jrn_id,$offset,$mode) {
! 	global $_CONF,$_TABLES, $LANG_JOURNAL,$_USER,$JOURNAL_PREFS;
  
  	if (empty($jrn_id)) return;
--- 623,629 ----
  }
  
! function showjournalentries($jrn_id,$offset,$mode)
! {
!     global $_CONF, $_TABLES, $_USER, $LANG_JOURNAL, $JOURNAL_PREFS;
  
  	if (empty($jrn_id)) return;
***************
*** 665,677 ****
  	}
  
! 	$nrows = DB_numRows($result);
! 	$retval .= "<table cellpadding=0 cellspacing=0 width=100%><tr><th width=5%>{$LANG_JOURNAL['mood']}</th><th align=left width=30%>{$LANG_JOURNAL['summary']}</th><th align=left width=15%>{$LANG_JOURNAL['date']}</th><th width=5%>{$LANG_JOURNAL['public']}</th><th width=5%>{$LANG_JOURNAL['hits']}</th></tr>";
  	for ($i = 1; $i <= $nrows; $i++) {
  		$A = DB_fetchArray($result);
! 		$curtime = COM_getUserDateTimeFormat($A["je_date"]);
  		if (($i % 2) > 0) {
  			$retval .= '<tr bgcolor="#DDDDDD">';
  		} else {
! 			$retval .= "<tr>";
  		}
          if (empty ($A['je_mood'])) {
--- 666,678 ----
  	}
  
!     $nrows = DB_numRows($result);
!     $retval .= '<table cellpadding="0" cellspacing="0" width="100%"><tr><th width="5%">' . $LANG_JOURNAL['mood'] . '</th><th align="left" width="30%">' . $LANG_JOURNAL['summary'] . '</th><th align="left" width="15%">' . $LANG_JOURNAL['date'] . '</th><th width="5%">' . $LANG_JOURNAL['public'] . '</th><th width="5%">' . $LANG_JOURNAL['hits'] . '</th></tr>';
  	for ($i = 1; $i <= $nrows; $i++) {
  		$A = DB_fetchArray($result);
! 		$curtime = COM_getUserDateTimeFormat($A['je_date']);
  		if (($i % 2) > 0) {
  			$retval .= '<tr bgcolor="#DDDDDD">';
  		} else {
! 			$retval .= '<tr>';
  		}
          if (empty ($A['je_mood'])) {
***************
*** 686,715 ****
          $retval .= '<td width="5%" align="center"><img src=' . $image
                  . '></td><td width="30%"><a href="' . $_CONF['site_url']
!                 . '/journal/index.php?mode=read&type=entry&je_id='
                  . $A['je_id'] . '">' . stripslashes ($A['je_summary']) . '</a>';
  		if ($isadmin) {
! 			$retval .= "  [<a href={$_CONF["site_url"]}/journal/index.php?mode=edit&type=entry&je_id={$A["je_id"]}>{$LANG_JOURNAL['edit']}</a>]</td>";
  		} else {
! 			$retval .= "</td>";
  		}
! 		$retval .= "<td width=15%>$curtime[0]</td>";
! 		if ($A["je_public"] == 1) {
! 			$A["je_public"] = $LANG_JOURNAL['yes'];
  		} else {
! 			$A["je_public"] = $LANG_JOURNAL['no'];
  		}
! 		$retval .= "<td align=center width=5%>{$A["je_public"]}</td>";
! 		$retval .= "<td align=center width=5%>{$A["je_hits"]}</td></tr>";
  	}
  	if ($nrows == 0) {
! 		$retval .= "<tr><td colspan=4 align=left>{$LANG_JOURNAL["noentriesmsg"]}</td></tr>";
  	}
  
! 	$retval .= "<tr><td align=center colspan=4> <br>";
  
  	# next we need to do the links to other results
      if ($offset > 0) { # bypass PREV link if offset is 0
          $prevoffset = $offset - 20;
!         $retval .= "<a href=\"$PHP_SELF?mode=user&offset=$prevoffset\">{$LANG_JOURNAL['previous']}</a>   \n";
      } else {
          $retval .= $LANG_JOURNAL['previous'] . "   \n";
--- 687,719 ----
          $retval .= '<td width="5%" align="center"><img src=' . $image
                  . '></td><td width="30%"><a href="' . $_CONF['site_url']
!                 . '/journal/index.php?je_id='
                  . $A['je_id'] . '">' . stripslashes ($A['je_summary']) . '</a>';
  		if ($isadmin) {
! 			$retval .= '  [<a href="' . $_CONF['site_url']
!                     . '/journal/index.php?mode=edit&type=entry&je_id='
!                     . $A['je_id'] . '">' . $LANG_JOURNAL['edit'] . '</a>]</td>';
  		} else {
! 			$retval .= '</td>';
  		}
! 		$retval .= '<td width="15%">' . $curtime[0] . '</td>';
! 		if ($A['je_public'] == 1) {
! 			$A['je_public'] = $LANG_JOURNAL['yes'];
  		} else {
! 			$A['je_public'] = $LANG_JOURNAL['no'];
  		}
! 		$retval .= '<td align="center" width="5%">' . $A['je_public'] . '</td>';
! 		$retval .= '<td align="center" width="5%">' . $A['je_hits'] . '</td></tr>';
  	}
  	if ($nrows == 0) {
! 		$retval .= '<tr><td colspan="4" align="left">'
!                 . $LANG_JOURNAL['noentriesmsg'] . '</td></tr>';
  	}
  
! 	$retval .= '<tr><td align="center" colspan="4"> <br>';
  
  	# next we need to do the links to other results
      if ($offset > 0) { # bypass PREV link if offset is 0
          $prevoffset = $offset - 20;
!         $retval .= "<a href=\"$PHP_SELF?mode=user&offset=$prevoffset\">{$LANG_JOURNAL['previous']}</a>   \n";
      } else {
          $retval .= $LANG_JOURNAL['previous'] . "   \n";
***************
*** 717,733 ****
  
  	# calculate number of pages needing links
!     $pages= intval($totalrows / $limit);
  
      # $pages now contains int of pages needed unless there is a remainder from division
!     if ($numrows%$limit) {
          #has remainder so add one page
          $pages++;
      }
  
!     for ($i=1;$i<=$pages;$i++) { // loop thru
!         $newoffset = $limit * ($i-1);
  		# only $retval .= link if we aren't on page $i
! 		if ($i <> ($offset+1)) {
!             $retval .= "<a href=\"$PHP_SELF?mode=user&offset=$newoffset\">$i</a>   \n";
  			$lastpage = false;
  		} else {
--- 721,737 ----
  
  	# calculate number of pages needing links
!     $pages = intval($totalrows / $limit);
  
      # $pages now contains int of pages needed unless there is a remainder from division
!     if ($numrows % $limit) {
          #has remainder so add one page
          $pages++;
      }
  
!     for ($i = 1; $i <= $pages; $i++) { // loop thru
!         $newoffset = $limit * ($i - 1);
  		# only $retval .= link if we aren't on page $i
! 		if ($i <> ($offset + 1)) {
!             $retval .= "<a href=\"$PHP_SELF?mode=user&offset=$newoffset\">$i</a>   \n";
  			$lastpage = false;
  		} else {
***************
*** 741,759 ****
          # not last page so give NEXT link
          $newoffset= $offset + $limit;
!         $retval .= "<a href=\"$PHP_SELF?offset=$newoffset\">{$LANG_JOURNAL['next']}</a><p>\n";
      } else {
!         $retval .= "{$LANG_JOURNAL['next']}<p>\n";
  	}
  
! 	$retval .= "</td></tr></table>";
  
  	$retval .= COM_endBlock();
  
  	return $retval;
! }	
  
  function getprevnextentries($je_id,$jrn_id,$date) {
      global $_TABLES;
!     
      $result = DB_query("SELECT je_id FROM {$_TABLES['journal_entry']} WHERE je_date > '" . $date . "' AND je_jrn_id = $jrn_id ORDER BY je_date");
         
--- 745,763 ----
          # not last page so give NEXT link
          $newoffset= $offset + $limit;
!         $retval .= "<a href=\"$PHP_SELF?offset=$newoffset\">{$LANG_JOURNAL['next']}</a>" . LB;
      } else {
!         $retval .= $LANG_JOURNAL['next'] . LB;
  	}
  
! 	$retval .= '</td></tr></table>';
  
  	$retval .= COM_endBlock();
  
  	return $retval;
! }
  
  function getprevnextentries($je_id,$jrn_id,$date) {
      global $_TABLES;
! 
      $result = DB_query("SELECT je_id FROM {$_TABLES['journal_entry']} WHERE je_date > '" . $date . "' AND je_jrn_id = $jrn_id ORDER BY je_date");
         





More information about the geeklog-cvs mailing list