<!--#include file="../lib/base.asp"-->
<!--#include file="../theme.asp"-->
<%
''' EYCMS 评价
''' ==================================================================
	eycms.stophack
	dim root
	sub loadtop()
		dim id:id=eycms.getint(eycms.fget("id",0),0)
		if id=0 then
			exit sub
		end if
		dim score:score=0
		dim percent:percent=0
		dim data:data=eycms.db.dbloadone("avg(score)","ey_order_score","cid="&id&" and islock=1")
		if eycms.strlen(data)>0 then score=data
		if score>0 then
			score=formatnumber(score,1,true,false,true)
		end if
		if score>0 then
			percent=(score/5)*100
		end if

		dim total:total=eycms.db.dbcount("ey_order_score","cid="&id&" and islock=1")

		dim html:html=""
		html=html&"<div class=""review"">"
		html=html&"	<div class=""score"">"
		html=html&"		<strong>"&score&"</strong>"
		html=html&"		<div>"
		html=html&"			<div class=""score"&clng(score*2)&"""></div>"
		html=html&"			<div>总人数："&total&"</div>"
		html=html&"		</div>"
		html=html&"	</div>"
		html=html&"	<div class=""graph"">"
		html=html&"		<span style=""width:"&percent&"%"">"
		html=html&"			<em>"&score&"</em>"
		html=html&"		</span>"
		html=html&"		<div>&nbsp;</div>"
		html=html&"		<ul>"
		html=html&"			<li>非常不满</li>"
		html=html&"			<li>不满意</li>"
		html=html&"			<li>一般</li>"
		html=html&"			<li>满意</li>"
		html=html&"			<li>非常满意</li>"
		html=html&"		</ul>"
		html=html&"	</div>"
		html=html&"</div>"
		if total>0 then
			if page=1 then eycms.echo html
		else
			eycms.echo "暂无评价":exit sub
		end if

		dim i,str,temp,show,rs
		temp=""
		temp=temp&"<div class=""comment"">"
		temp=temp&"        <div class=""face""><img src="""&webroot&"site/"&site_root&"/upfile/avatar/{avatar}/normal.jpg"" />{username}</div>"
		temp=temp&"        <div class=""text"">"
		temp=temp&"            <div class=""div"">"
		temp=temp&"                <div class=""icon""></div>"
		temp=temp&"                <div class=""base""><span>{createdate}</span><div class=""score{star}""></div></div>"
		temp=temp&"                <div class=""content"">{content}</div>"
		temp=temp&"                {reply}"
		temp=temp&"            </div>"
		temp=temp&"        </div>"
		temp=temp&"    </div>"
		
		eycms.page.field="avatar,score,createdate,content,reply,(select top 1 username from ey_user where ey_user.id=userid) as username"
		eycms.page.table="ey_order_score"
		eycms.page.join=""
		eycms.page.where="cid="&id&" and islock=1"
		eycms.page.order="id desc"
		eycms.page.pagesize=10
		eycms.page.page=page
		eycms.page.htmlurl=""
		eycms.page.pagenumber=5
		eycms.page.isadminurl=1
		set rs=eycms.page.getrs
		for i=1 to rs.pagesize
		if rs.eof or rs.bof then exit for
			show=temp
			show=replace(show,"{avatar}",rs(0))
			show=replace(show,"{username}",eycms.cutstr(rs(5),5,1))
			show=replace(show,"{star}",rs(1)*2)
			show=replace(show,"{createdate}",rs(2))
			show=replace(show,"{content}",rs(3))
			if eycms.strlen(rs(4))>0 then
				show=replace(show,"{reply}","<div class=""reply""><strong>回复：</strong>"&rs(4)&"</div>")
			else
				show=replace(show,"{reply}","")
			end if
			str=str&show
		rs.movenext
		next
		set rs=nothing
		
		eycms.echo str
			
		if page<eycms.page.totalurl and page=1 then
			eycms.echo "<div class=""loadmore""><a href=""javascript:;"">查看更多>></a></div>"
		end if
	end sub
	
	dim act:act=eycms.fget("act",0)
	select case act
		case "load":loadtop
	end select
	eycms.db.dbclose
%>
