Quick Installation of Lu-Guestbook 1.1:
1. Put the "database" folder under the folder where the aspx file using Lu-Guestbook is executed. For example, if your aspx file is in web root, put the database folder in the web root too.
2. Put the Guestbook.dll under the "bin" folder.
3. In Visual Studio, choose Project -> Add references, and browse the guestbook.dll to add a .NET control.
4. Drag the guestbook from your Toolbox (General) and the Guestbook is ready to use.
Configrations:
Lu-Guestbook has the following properties:
Cancel, SendReply, ShowReply, Submit: Specify the cpations of those action buttons/links.
AllowReply: Specify if the user can reply in the Guestbook.
EmailDisplayType: The way to display an email. An email can be displayed as text, image or a hyperlink on the user's name.
EmailImagePath: If you choose Email to display as a hyperlink on image, use the property to specify the image you want to use.
HourAdjustment: Let the Message time become several hours from now. Set it as non-zero when the server and audiences are in different time zones.
DateFormat: The parameter to format the date shown on the guestbook. This property will be the second parameter in the Visual Basic function "Format". For example, by setting DateFormat as "M/d/yyyy" the date will show like 6/1/2005. More information about the parameter.
DBSource: The path to the database which stores all posted information.
StyleSheetSource: The path to the style sheet whcih specifies the format for all textboxs and action button/links.
TemplateSource: The path to the txt file to specify the entire layout and format for the guestbook.
ShowLoginInterface: Determine if the interface for admin login will show. If set false, the developer need to create his own interface for login if he want to manage the guestbook.
AdminPassword: The password used to authenticate the guestbook administrator. Only valid when the ShowLoginInterface is set as true.
RequireEmailAlert, RequireMessageAlert, RequireNameAlert, RequireTopicAlert: Specify the alert message which will show if a user doesn't input the four fields. Leave them blank if no validation is required.
How to create your own template and style:
Template
You can adjust the guestbook to fit your own website by changing the file "GuestbookTemplate.txt" (You can also specify another file). Bascially the txt file is the html template for guestbook, just like the "ItemTemplate" element for Datagrid control. It includes the design for the following seven blocks in the area of guestbook.
Area #1: Header
Area #2: Post Area (Repeat in the guestbook)
Area #3: ShowReply Area (Repeat under each post)
Area #4: SendReply Area (Appear when click "Reply")
Area #5: Post-Seperation Area (Appear between each entire post block)
Area #6: Footer
Area #7: Sumit post Area (Appear after the pager)
In the template file, the seven blocks are seperated by the phrase "[--Delimiter--]". For example, the part of the first and second block in the above sample will be like:
[--Delimiter--]
<TABLE width="600" cellpadding="3" cellspacing="0" style="border: gray 2px
solid;border-bottom-style:none">
<TR height="20">
<TD width="502"
bgcolor="#003300">
<B><font color= "#FFFFFF" size="3" face= "Arial,Helvetica,
sans-serif">[MessageTopic]</font></B>< BR>
</TD>
<TD width="84"
bgcolor="#003300"><font
color="#FFFFFF">[ShowReply]</font></TD>
</TR>
<TR bgcolor="#DDFFDD">
<TD
colspan=2><font size="2" face="Verdana, Arial, Helvetica,
sans-serif">[Message]</font></td>
</TR>
<TR bgcolor="#DDFFDD">
<TD
colspan=2>
<div
align="right"><font face="Arial, Helvetica, sans-serif" size=2>
by <strong>[Name] </strong> [MessageTime]</font></div><
BR>
</TD>
</TR>
< /TABLE>
[--Delimiter--]
You can see there is no codes before the first [--Delimiter--] because my first part is empty. In the second part, it's like the regular html codes but the meesage retrieved from DB are replaced by [Message],[MessageTopic],[Name] and [MessageTime]. Watch here I didn't use the keyword [Email] because I made it become a hyperlink on the user's name by setting the property "EmailDisplayType" as "WithName". [ShowReply] is another keyword. It represents the button link which will show the textbox-for-reply (#4) area in the guestbook when clicked by a user. The caption of link can be changed by the property "ShowReply". All this kinds of keyword include:
[Name]
[Email]
[MessageTopic]
[MessageTime]
[Message]
[ShowReply]
[SendReply]
[Cancel]
[Submit]
The five keywords [Name], [Email], [MessageTopic], [MessageTime], [Message] are repeatedly used in multiple blocks.
Styles
Some keywords are just transformed as plain texts. You can easily format them in the template file. But some others are transformed to text boxs, buttons or links, such as [Submit], the only way you can change the style of those items is through the style sheet file. The default file is "GuestbookStyle.css", but you can also link to another file by specifying the property "StlyeSheetSource". In the file you can control the deisgn by creating the following CSS classes:
For the textbox/textarea:
.ReplyName : The text box for name input in the area # 4
.ReplyEmail
.ReplyMessage
.NewName
.NewMessageTopic
.NewEmail
.NewMessage
For the action buttons/links:
.Submit
.ShowReply
.SendReply
.Cancel
To see the changes, remember to clear all caches of your browser every time you modify the style sheet.
About Administration setting
Lu-Guestbook1.1 provides the function which allows a user to manage the guestbook (e.g.:delete posts) by loging in as a administrator. There are two ways to achieve this:
Use the default interface and machanism provided by Lu-Guestbook
Follow the steps:
1. Set the property "ShowLoginInterface" as true.
2. Set the property "AdminPassword" as the password for administration login. (Never leave the property blank if you set ShowLoginInterface as true, or everyone can delete the posts!!!)
3. Then you will see the login box appearing on the top of the guestbook. After login you can delete the posts or replies. The user will log out if he closes the browser or click "logout".
Integrate with your own administration functions
Lu-Guestbook 1.1 allows you to create your own interface or integrate the security login with the rest of your website. There is an attribute called "AllowAdmin" (not shown in the property window). By setting its value as true in the codes, you can make the user have the permission to delete the posts and replies. The attribute "AllowAdmin" will not remember its value after each postback, so one of the common ways is to set its value every time when the page loads (And set "ShowLoginInterface as false). The following is an example:
------------------------------------------------------------------------------------------------------------------------------------------------------
(Assume you already have a central login system and it uses cookies to identify a user)
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Page.Request.Cookies("Admin")=True then
'whatever cookies you use to identify users in your website
Me.Guestbook1.AllowAdmin = True
Else
Me.Guestbook1.AllowAdmin=False
End if
(the rest of your codes)
End Sub
--------------------------------------------------------------------------------------------------------------------------------------------------------
Contact
If any questions or comments, please email to hslu@syr.edu.