summaryrefslogtreecommitdiff
path: root/demos/blog/protected/Pages/Posts/ViewPost.page
blob: 7d9c208d9c81f70c6b6b60d4a4bffe947b3f578b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<com:TContent ID="Main">

<div class="post">
<div class="post-title">
<%= htmlentities($this->CurrentPost->Title,ENT_QUOTES,'UTF-8') %>
</div>
<div class="post-time">
<com:TLabel
	ID="Status"
	ForeColor="red"
	Text=<%= $this->CurrentPost->Status===PostRecord::STATUS_DRAFT?'[Draft]':'[Pending approval]'%> />
<%= date('l, F j, Y \a\t h:i:s a',$this->CurrentPost->CreateTime) %>
by
<%= '<a href="' . $this->Service->constructUrl('Users.ViewUser',array('id'=>$this->CurrentPost->AuthorID)) . '">' . $this->CurrentPost->AuthorName . '</a>' %>
<%= $this->CanEditPost ? '| <a href="' . $this->Service->constructUrl('Posts.EditPost',array('id'=>$this->CurrentPost->ID)) . '">Edit</a> | ' : '';
%>
<com:TLinkButton
	Text="Delete"
	OnClick="deleteButtonClicked"
	Visible=<%= $this->CanEditPost %>
	Attributes.onclick="if(!confirm('Are you sure to delete this post? This will also delete all related comments.')) return false;"
	/>
</div>
<div class="post-content">
<%= $this->CurrentPost->Content %>
</div>
<div class="post-footer">
<com:TRepeater ID="CategoryList" EnableViewState="false">
	<prop:ItemTemplate>
	[
	<a href="<%# $this->Service->constructUrl('Posts.ListPost',array('cat'=>$this->DataItem->ID)) %>"><%# $this->DataItem->Name %></a>
	]
	</prop:ItemTemplate>
</com:TRepeater>
</div>
</div>

<div class="comments">
<a name="comments"></a>
<h3>Comments</h3>

<com:TRepeater ID="CommentList" OnItemCommand="repeaterItemCommand">
	<prop:ItemTemplate>
<div class="comment">
<div class="comment-header">
<a name="c<%# $this->DataItem->ID %>"></a>
<com:TLinkButton
	Text="Delete"
	Attributes.onclick="if(!confirm('Are you sure to delete this comment?')) return false;"
	CommandParameter=<%# $this->DataItem->ID %>
	Visible=<%= $this->Page->CanEditPost %> Style="float:right"/>
<%# date('F j, Y \a\t h:i:s a',$this->DataItem->CreateTime) %>
by
<%# $this->DataItem->AuthorWebsite==='' ?
		htmlentities($this->DataItem->AuthorName,ENT_QUOTES,'UTF-8') :
		'<a href="' . htmlentities($this->DataItem->AuthorWebsite) . '">' . htmlentities($this->DataItem->AuthorName,ENT_QUOTES,'UTF-8') . '</a>' %>
</div>
<div class="comment-content">
<%# nl2br(htmlentities($this->DataItem->Content,ENT_QUOTES,'UTF-8')) %>
</div>
</div>
	</prop:ItemTemplate>
</com:TRepeater>

<h4>Leave your comment</h4>

<span class="input-label">Name</span>
<com:TRequiredFieldValidator
	ControlToValidate="CommentAuthor"
	ValidationGroup="comment""
	Display="Dynamic"
	Text="...is required"
	ControlCssClass="input-error1" />
<br/>
<com:TTextBox ID="CommentAuthor" />
<br/>

<span class="input-label">Email address</span>
<com:TRequiredFieldValidator
	ControlToValidate="CommentEmail"
	ValidationGroup="comment""
	Display="Dynamic"
	Text="...is required"
	ControlCssClass="input-error1" />
<com:TEmailAddressValidator
	ControlToValidate="CommentEmail"
	ValidationGroup="comment"
	Display="Dynamic"
	Text="*"
	ErrorMessage="You entered an invalid email address."
	ControlCssClass="input-error2" />
<br/>
<com:TTextBox ID="CommentEmail" />
<br/>

<span class="input-label">Personal website</span>
<br/>
<com:TTextBox ID="CommentWebsite" Columns="70"/>
<br/>

<span class="input-label">Comment</span>
<com:TRequiredFieldValidator
	ControlToValidate="CommentContent"
	ValidationGroup="comment"
	Display="Dynamic"
	Text="...is required"
	ControlCssClass="input-error1" />
<br/>
<com:TTextBox ID="CommentContent" TextMode="MultiLine" Columns="55" Rows="10"/>
<br/>
<br/>

<com:TLinkButton
	Text="Submit"
	ValidationGroup="comment"
	CssClass="link-button"
	OnClick="submitCommentButtonClicked" />

</div>
</com:TContent>