留言置标IBOX:LEAVE,IBOX产品里第一个自己写的插件,使用说明如下:
程序集assembly:IBOX.Plugins.InterActive(属于互动插件),控件命名控件namespace:FortuneAge.IBOX_UC.Plugins,控件前缀IBOX。
语法:
<IBOX:Leave ShowResult="0或1" ShowSubmit="0或1" TopCount="提取前记录条数" PageSize="显示条数" ></IBOX:Leave>
置标属性说明:
属性 |
描述 |
类型 |
取值 |
值说明 |
SiteID |
站点ID |
数字 |
未指定 |
当前站点 |
0 |
所有站点留言 |
|||
大于0的整数 |
必须跟内容管理系统的站点ID一致 |
|||
TypeID |
留言类型编号 |
数字 |
0 |
将列出当前站点下所有类型选择 |
大于0的整数 |
必须跟留言类型列表里编号对应一致 |
|||
PageSize |
列表每页显示数 |
数字 |
大于0的整数 |
默认20条 |
TopCount |
提取每页记录前条数 |
数字 |
大于0的整数 |
默认0,显示每页显示PageSize条 |
ShowResult |
是否显示留言列表结果 |
数字 |
0或1 |
0不显示,1显示(默认) |
ShowSubmit |
是否显示提交留言 |
数字 |
0或1 |
0不显示,1显示(默认) |
应用举例:
<h4>留言</h4>
<div class="leave">
<!--显示留言列表-->
<IBOX:Leave ShowSubmit="0" TopCount="6" PageSize="5" ></IBOX:Leave>
</div>
<h4>提交留言</h4>
<div class="submitleave">
<!--显示提交留言-->
<IBOX:Leave ShowResult="0" ShowSubmit="1" ></IBOX:Leave>
</div>
生成静态页面后HTML结构如下:
<h4>留言</h4>
<div class="leave">
<!--显示留言列表-->
<div id="panResult" class="result">
<div class="item">
<div class="divtitle">
<span class="title">gfh</span>
</div>
<div class="content">
呵呵,你好。
</div>
<div class="reply" style="display: ">
回复:谢谢,^_^!!!
</div>
<div>
fgf
<span class="time">2009-09-01 14:20</span>
</div>
</div>
<div class="item">
<div class="divtitle">
<span class="title">3</span>
</div>
<div class="content">
fdf
</div>
<div class="reply" style="display: none">
回复:
</div>
<div>
3
<span class="time">2009-08-31 17:29</span>
</div>
</div>
<div class="item">
<div class="divtitle">
<span class="title">调查建议主题22222</span>
</div>
<div class="content">
ddddddddddd
</div>
<div class="reply" style="display: none">
回复:
</div>
<div>
Jonllen
<span class="time">2009-08-31 17:27</span>
</div>
</div>
<div class="item">
<div class="divtitle">
<span class="title">调查建议主题</span>
</div>
<div class="content">
ttttttttt
</div>
<div class="reply" style="display: none">
回复:
</div>
<div>
jonllen
<span class="time">2009-08-31 17:21</span>
</div>
</div>
<div class="item">
<div class="divtitle">
<span class="title">Re:留言</span>
</div>
<div class="content">
test内容!
</div>
<div class="reply" style="display: none">
回复:
</div>
<div>
Jonllen
<span class="time">2009-08-31 14:40</span>
</div>
</div>
<div class="item">
<div class="divtitle">
<span class="title">测试5</span>
</div>
<div class="content">
哈哈,踩踩55555
</div>
<div class="reply" style="display: ">
回复:gfhgfh
</div>
<div>
Jonllen Peng
<span class="time">2009-08-27 11:07</span>
</div>
</div>
<div class="pager">
<div id="pager1"><span class='summary'>共20条记录,当前显示第1页,共2页</span><span class='pages'><a disabled>首页</a><a disabled>前一页</a><font color='red'><strong>1</strong></font><a href='?r=1&s=0&t=6&site=19&type=0&size=5.com.cn&pid=2' title='转到第2页'>2</a><a href='?r=1&s=0&t=6&site=19&type=0&size=5.com.cn&pid=2' title='转到第2页'>后一页</a><a href='?r=1&s=0&t=6&site=19&type=0&size=5.com.cn&pid=2' title='转到第2页'>末页</a><span><input type='text' value='1' style='width:25px'><input type='button' value='Go' onclick='javascript:GoToPage("?r=1&s=0&t=6&site=19&type=0&size=5.com.cn&pid=_pid", this.parentElement.children[0].value);'></span></span></div><script language='javascript'>function GoToPage(url,pid){document.location = url.replace('_pid', pid).replace('_1.','.');}</script>
</div>
</div>
</div>
<h4>提交留言</h4>
<div class="submitleave">
<!--显示提交留言-->
<div id="panSubmit" class="submit">
<div class="retype">
类别:
<label><input type="radio" name="leavetype" value="1" />网站留言(Jonllen)</label>
<label><input type="radio" name="leavetype" value="2" />调查建议</label>
<span class="remark">*</span>
<span id="lblTypeName" class="retypename"></span>
</div>
<div class="retitle">
主题:<input type="text" id="txtTitle" /><span class="remark">*</span>
</div>
<div class="reuname">
姓名:<input type="text" id="txtUserName" /><span class="remark">*</span>
</div>
<div class="remail">
邮箱:<input type="text" id="txtEmail" />
</div>
<div class="rephone">
联系电话:<input type="text" id="txtPhone" />
</div>
<div class="recontent">
内容:<textarea id="txtContent"></textarea><span class="remark">*</span>
</div>
<div class="rebtn">
<input type="button" value="提交" onclick="leaveadd()" />
<input type="button" value="清空" onclick="rewrite()" />
</div>
<script type="text/jscript">
function rewrite() {
$("#txtTitle").val("");
$("#txtUserName").val("");
$("#txtEmail").val("");
$("#txtPhone").val("");
$("#txtContent").val("");
}
function leaveadd() {
var typeId = '0';
var title = $("#txtTitle").val();
var uname = $("#txtUserName").val();
var email = $("#txtEmail").val();
var phone = $("#txtPhone").val();
var content = $("#txtContent").val();
var errmsg = '';
if( typeId=='0' )
{
typeId = $("input[@name=leavetype][@checked]").val();
if(!typeId)
{
errmsg +="请选择留言类型!\n";
}
}
if(title==""){
errmsg += "请输入主题!\n";
}
if(uname==""){
errmsg += "请输入姓名!\n";
}
if(content==""){
errmsg += "请输入内容!\n";
}
if( email!='' && ! /^\w+([-+.]\w+)*@\w+([-.]\\w+)*\.\w+([-.]\w+)*$/.test(email) )
{
errmsg += "邮箱地址格式不正确!\n";
}
if( phone!='' && ! /\d{7}/.test(phone) )
{
errmsg += "联系电话输入不正确!\n";
}
if( errmsg != '')
{
alert(errmsg);
return;
}
var apiurl = 'http://localhost:8080/Plugin/Leave/Web/LeaveAdd.aspx';
$.post(apiurl, { title: escape(title), uname: escape(uname), type :typeId, email:escape(email), phone:escape(phone), content:escape(content) },
function(data){
if(data=="true"){
alert("留言成功");
window.location = window.location;
}
else{
alert(data);
}
}
);
}
</script>
</div>
</div>
完。