温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:SpaceBuilder v1.0正式版源码
当前文件:
SpaceBuiderV10Source/BlogControls/Views/BlogRatePost.cs,打开代码结构图
SpaceBuiderV10Source/BlogControls/Views/BlogRatePost.cs,打开代码结构图1////------------------------------------------------------------------------------ 2
// <copyright company="Tunynet"> 3
// Copyright (c) Tunynet Network Technology Co., Ltd. All rights reserved. 4
// </copyright> 5
//------------------------------------------------------------------------------ 6
7
//using System; 8
//using System.Text; 9
//using System.Web.UI.WebControls; 10
//using SpaceBuilder.Blogs.Components; 11
//using SpaceBuilder.Components; 12
//using SpaceBuilder.Controls; 13
//using SpaceBuilder.Utils; 14
//using SpaceBuilder.Posts.Components; 15
16
//namespace SpaceBuilder.Blogs.Controls 17
//{ 18
// /// <summary> 19
// /// Summary description for BlogRatePost. 20
// /// </summary> 21
// public class BlogRatePost : WeblogThemedControl 22
// { 23
// public event EventHandler RatingsChanged; 24
25
// private BlogThread _p; 26
// public BlogThread Post 27
// { 28
// get 29
// { 30
// if (_p == null) 31
// { 32
// SBContext cntx = SBContext.Current; 33
// Weblog wl = Weblogs.GetWeblog(cntx.ApplicationKey); 34
// _p = BlogPosts.GetThread(cntx.PostID, true); 35
// } 36
// return _p; 37
// } 38
// set { _p = value; } 39
// } 40
41
// protected override void AttachChildControls() 42
// { 43
// LinkButton l; 44
// l = (LinkButton)FindControl("RateZero"); 45
// l.CommandArgument = "0"; 46
// l.Text = ResourceManager.GetString("PostRating_Zero"); 47
// l.Click += new EventHandler(RateTopic_Click); 48
49
// l = (LinkButton)FindControl("RateOne"); 50
// l.CommandArgument = "1"; 51
// l.Text = ResourceManager.GetString("PostRating_One"); 52
// l.Click += new EventHandler(RateTopic_Click); 53
54
// l = (LinkButton)FindControl("RateTwo"); 55
// l.CommandArgument = "2"; 56
// l.Text = ResourceManager.GetString("PostRating_Two"); 57
// l.Click += new EventHandler(RateTopic_Click); 58
59
// l = (LinkButton)FindControl("RateThree"); 60
// l.CommandArgument = "3"; 61
// l.Text = ResourceManager.GetString("PostRating_Three"); 62
// l.Click += new EventHandler(RateTopic_Click); 63
64
// l = (LinkButton)FindControl("RateFour"); 65
// l.CommandArgument = "4"; 66
// l.Text = ResourceManager.GetString("PostRating_Four"); 67
// l.Click += new EventHandler(RateTopic_Click); 68
69
// l = (LinkButton)FindControl("RateFive"); 70
// l.CommandArgument = "5"; 71
// l.Text = ResourceManager.GetString("PostRating_Five"); 72
// l.Click += new EventHandler(RateTopic_Click); 73
74
// HyperLink RateLink = FindControl("RateLink") as HyperLink; 75
76
// /** 77
// string imagePath = Globals.GetSkinPath() + "/images/ratetopic.gif"; 78
// string imagePathDown = Globals.GetSkinPath() + "/images/ratetopic.gif"; 79
// string imagePathOver = Globals.GetSkinPath() + "/images/ratetopic_Over.gif"; 80
81
// RateLink.Attributes.Add("onMouseOver", "src='" + imagePathOver + "'"); 82
// RateLink.Attributes.Add("onMouseOut", "src='" + imagePath + "'"); 83
// RateLink.Attributes.Add("onMouseDown", "src='" + imagePathDown + "'"); 84
// **/ 85
86
// RateLink.Text = ResourceManager.GetString("Weblogs_Rate"); 87
// RateLink.NavigateUrl = "javascript:ToggleRateMenu()"; 88
89
// //RateLink.Attributes.Add("onMouseDown", "ToggleRateMenu()"); 90
// } 91
92
// void RateTopic_Click(object sender, EventArgs e) 93
// { 94
// LinkButton l = (LinkButton)sender; 95
// int rate = int.Parse(l.CommandArgument); 96
97
// if (SelectedValue != rate) 98
// { 99
// Rating rating = new Rating(); 100
// rating.ApplicationType = ApplicationType.Blog; 101
// rating.UserID = SBContext.Current.User.UserID; 102
// rating.Author = SBContext.Current.User.DisplayName; 103
// rating.ThreadID = this.Post.ThreadID; 104
// rating.Rate = rate; 105
106
// Ratings.Rate(rating); 107
// SelectedValue = rate; 108
// OnRatingsChange(e); 109
// } 110
// } 111
112
// protected int SelectedValue 113
// { 114
// get 115
// { 116
// object obj = ViewState["SelectedValue"]; 117
// if (obj == null) 118
// return -1; 119
// else 120
// return (int)obj; 121
// } 122
// set { ViewState["SelectedValue"] = value; } 123
// } 124
125
// protected void OnRatingsChange(EventArgs e) 126
// { 127
// if (RatingsChanged != null) 128
// RatingsChanged(this, e); 129
// } 130
131
// protected override void OnPreRender(EventArgs e) 132
// { 133
// base.OnPreRender(e); 134
// StringBuilder sb = new StringBuilder(); 135
// sb.Append("<script language =\"javascript\">"); 136
// sb.Append(" function ToggleRateMenu() {"); 137
// sb.Append(" rateMenu = document.getElementById('RateMenu');"); 138
// sb.Append(" rateButton = document.getElementById('RateButton');"); 139
// sb.Append(""); 140
// sb.Append(" rateMenu.style.left = getposOffset(rateButton, \"left\");"); 141
// sb.Append(" rateMenu.style.top = getposOffset(rateButton, \"top\") + rateButton.offsetHeight;"); 142
// sb.Append(""); 143
// sb.Append(" if (rateMenu.style.visibility == \"hidden\") {"); 144
// sb.Append(" rateMenu.style.visibility = \"visible\";"); 145
// sb.Append(" rateMenu.style.display = 'block';"); 146
// sb.Append(" } else {"); 147
// sb.Append(" rateMenu.style.visibility = \"hidden\";"); 148
// sb.Append(" rateMenu.style.display = 'none';"); 149
// sb.Append(" }"); 150
// sb.Append(" }"); 151
// sb.Append(" "); 152
// sb.Append(" function getposOffset(what, offsettype){"); 153
// sb.Append(" var totaloffset=(offsettype==\"left\")? what.offsetLeft : what.offsetTop;"); 154
// sb.Append(" var parentEl=what.offsetParent;"); 155
// sb.Append(" while (parentEl!=null){"); 156
// sb.Append(" totaloffset=(offsettype==\"left\")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;"); 157
// sb.Append(" parentEl=parentEl.offsetParent;"); 158
// sb.Append(" }"); 159
// sb.Append(" return totaloffset;"); 160
// sb.Append("}"); 161
// sb.Append("</script>"); 162
// Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "RatePost", sb.ToString()); 163
// } 164
// } 165
//} 166



