Update of /cvsroot/webnotes/webnotes/themes/phpnet
In directory usw-pr-cvs1:/tmp/cvs-serv15660/themes/phpnet
Modified Files:
theme_api.php
Log Message:
- Enhancing the preview to include the start / end parts - not just the note.
- Handled the case of the preview by not display the # 0 and not adding a hyperlink for + images.
- Fixing a couple of warnings with the preview page.
- Enabled E_ALL in phpapi to show warnings in dependent of the server settings.
Index: theme_api.php
===================================================================
RCS file: /cvsroot/webnotes/webnotes/themes/phpnet/theme_api.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- theme_api.php 11 Sep 2002 09:49:55 -0000 1.8
+++ theme_api.php 12 Sep 2002 12:50:23 -0000 1.9
@@ -30,15 +30,9 @@
}
# This function is called before printing any notes to the page.
- function theme_notes_start( $p_page, $p_url ) {
+ function theme_notes_start( $p_page, $p_url, $p_preview = false ) {
global $g_note_add_page, $s_add_note_link, $s_manage, $s_admin, $g_web_directory, $g_theme;
- if ( isset( $p_page ) ) {
- $t_page = basename( $p_page );
- } else {
- $t_page = "Test Page";
- }
-
$c_url = urlencode( $p_url );
$t_page_id = page_get_id( $p_page );
@@ -48,12 +42,21 @@
$url = $g_web_directory . '/themes/' . $g_theme . '/images/';
$add_picture = $url . 'notes_add.gif';
+ if ( !$p_preview ) {
+ $t_link_start = "<a href=\"$g_note_add_page?f_page_id=$t_page_id&f_url=$c_url\">";
+ $t_link_end = '</a>';
+ } else {
+ $t_link_start = $t_link_end = '';
+ }
+
echo <<<EOT
<table border="0" cellpadding="4" cellspacing="0" width="100%">
<tr bgcolor="#d0d0d0" valign="top">
<td>User Contributed Notes<br /><b>$p_page</b></td>
- <td align="right"><a href="$g_note_add_page?f_page_id=$t_page_id&f_url=$c_url">
- <img src="$add_picture" border="0" width="13" height="13" ALT="add a note"/></a>
+ <td align="right">
+ $t_link_start
+ <img src="$add_picture" border="0" width="13" height="13" ALT="add a note"/>
+ $t_link_end
</td>
</tr>
EOT;
@@ -63,10 +66,10 @@
# are all included in the associative array that is passed to the
# function. The theme should check that a field is defined in
# the array before using it.
- function theme_notes_echo( $p_page, $p_url, $p_note_info_array ) {
+ function theme_notes_echo( $p_page, $p_url, $p_note_info_array, $p_preview = false ) {
- if ( isset( $p_note_info_array['id'] ) ) {
- $t_id = (integer)$p_note_info_array['id'];
+ if ( isset( $p_note_info_array['id'] ) && ( $p_note_info_array['id'] != 0 ) ) {
+ $t_id = '#' . (integer)$p_note_info_array['id'];
} else {
$t_id = '';
}
@@ -92,12 +95,12 @@
echo <<<EOT
<tr valign="top">
<td bgcolor="#e0e0e0" colspan="2">
- <a name="#$t_id"></a>
+ <a name="$t_id"></a>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr align="top" bgcolor="#e0e0e0">
<td><b>$t_email</b><br/>$t_date</td>
- <td align="right">#$t_id</td>
+ <td align="right">$t_id</td>
</tr>
<tr bgcolor="#f0f0f0">
<td colspan="2"><pre>$t_note</pre></td>
@@ -109,26 +112,27 @@
}
# This function is called after all notes are echo'ed.
- function theme_notes_end( $p_page, $p_url ) {
+ function theme_notes_end( $p_page, $p_url, $p_preview = false ) {
global $g_note_add_page, $g_web_directory, $g_theme;
- if ( isset( $p_page ) ) {
- $t_page = basename( $p_page );
- } else {
- $t_page = "Test Page";
- }
-
$c_url = urlencode( $p_url );
$t_page_id = page_get_id( $p_page );
$url = $g_web_directory . '/themes/' . $g_theme . '/images/';
$add_picture = $url . 'notes_add.gif';
+ if ( !$p_preview ) {
+ $t_link_start = "<a href=\"$g_note_add_page?f_page_id=$t_page_id&f_url=$c_url\">";
+ $t_link_end = '</a>';
+ } else {
+ $t_link_start = $t_link_end = '';
+ }
+
echo <<<EOT
<tr bgcolor="#d0d0d0" valign="top">
- <td colspan="2" align="right"><a href="$g_note_add_page?f_page_id=$t_page_id&f_url=$c_url">
- <img src="$add_picture" border="0" width="13" height="13" ALT="add a note"/>
- </a></td>
+ <td colspan="2" align="right">$t_link_start
+ <img src="$add_picture" border="0" width="13" height="13" ALT="add a note" />
+ $t_link_end</td>
</tr>
</table>
EOT;
@@ -139,8 +143,7 @@
# APIs are not called.
function theme_notes_none( $p_page, $p_url ) {
theme_notes_start( $p_page, $p_url );
- #theme_notes_end( $p_page, $p_url );
-
+
echo <<<EOT
<tr valign="top">
<td bgcolor="#e0e0e0" colspan="2">There are no user contributed notes for this page.
@@ -149,6 +152,7 @@
</table>
EOT;
}
+
# This function is called if the current page was not indexed
function theme_not_indexed( $p_page ) {
}
|