Files
2026-08-31 16:22:00 +08:00

219 lines
10 KiB
XML

<?xml version="1.0"?>
<root>
<LabelType>其他类</LabelType>
<LabelIntro>
</LabelIntro>
<OutType>sin</OutType>
<LabelDataType>sql_sysquery</LabelDataType>
<EnabelAjax>False</EnabelAjax>
<IsXsltSql>false</IsXsltSql>
<IsXsltCountSql>false</IsXsltCountSql>
<LabelSqlString>SELECT * FROM PE_MoodScheme WHERE MoodID = @moodId</LabelSqlString>
<LabelTemplate>
<![CDATA[<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pe="labelproc" exclude-result-prefixes="pe">
<xsl:output method="html" />
<xsl:template match="/">
<xsl:if test="(/NewDataSet/Table/MoodStatus) = 'true'">
<div id="moodVote">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<xsl:call-template name="GetOptionIcon">
<xsl:with-param name="moodOption" select="NewDataSet/Table/MoodOption"/>
</xsl:call-template>
</tr>
<tr>
<xsl:call-template name="GetOptionName">
<xsl:with-param name="moodOption" select="NewDataSet/Table/MoodOption"/>
</xsl:call-template>
</tr>
<tr>
<xsl:call-template name="GetOptionIndex">
<xsl:with-param name="moodOption" select="NewDataSet/Table/MoodOption"/>
</xsl:call-template>
</tr>
</tbody>
</table>
</div>
<script type="text/javascript">
function MoodVote(value) {
var x = new AjaxRequest('XML', 'status');
x.para = ['position=' + value, 'generalId=@RequestInt_Id', 'moodId=<xsl:value-of select="NewDataSet/Table/MoodID"/>'];
x.paratype = ['nohtml', 'nohtml', 'nohtml']
x.post('MoodVote', '{PE.SiteConfig.ajaxsitepath/}ajax.aspx', function(s) {
var xml = x.createXmlDom(s);
var status = xml.getElementsByTagName("status")[0].firstChild.data;
switch (status) {
case "ok":
DisplayResult();
break;
case "isOnlyMember":
alert("只有会员才能发表投票!");
break;
default:
alert("投票失败!");
break;
}
});
}
function getlabel(labelname, targetid) {
var x = new AjaxRequest('XML', targetid);
x.post(labelname, '{PE.SiteConfig.ajaxsitepath/}ajax.aspx', function(s) {
var xml = x.createXmlDom(s);
$(targetid).innerHTML = xml.getElementsByTagName("body")[0].firstChild.data;
});
}
function DisplayResult() {
var x = new AjaxRequest('XML', 'moodVote');
x.labelname = "显示心情指数";
x.para = ['itemId=@RequestInt_Id'];
x.paratype = ['nohtml', 'nohtml', 'nohtml']
x.post('updatelabel', '{PE.SiteConfig.ajaxsitepath/}ajax.aspx', function(s) {
var xml = x.createXmlDom(s);
document.getElementById('moodVote').innerHTML = xml.getElementsByTagName("body")[0].firstChild.data;
});
}
</script>
</xsl:if>
</xsl:template>
<!--方法模板在不能理解含义的情况下请勿修改
任何修改都有可能导致改模板不能正常工作
By Lewi-->
<!--组合选项名模板-->
<xsl:template name="GetOptionName">
<xsl:param name="moodOption"/>
<xsl:choose>
<xsl:when test="contains($moodOption,'$$$')">
<td align="center" valign="bottom">
<xsl:value-of select="substring-before(substring-before($moodOption,'$$$'),'|')"/>
</td>
<xsl:variable name="after" select="substring-after($moodOption,'$$$')" />
<xsl:choose>
<xsl:when test="contains($after,'$$$')">
<xsl:call-template name="GetOptionName">
<xsl:with-param name="moodOption" select="$after"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<td align="center" valign="bottom">
<xsl:value-of select="substring-before($after,'|')"/>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<td align="center" valign="bottom">
<xsl:value-of select="substring-before($moodOption,'|')"/>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--组合选项图标ICON模板-->
<xsl:template name="GetOptionIcon">
<xsl:param name="moodOption"/>
<xsl:choose>
<xsl:when test="contains($moodOption,'$$$')">
<td align="center" valign="bottom">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:choose>
<xsl:when test="pe:IsStartWithhttp(substring-after(substring-before($moodOption,'$$$'),'|')) = 'true'">
<xsl:value-of select="substring-after(substring-before($moodOption,'$$$'),'|')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="pe:InstallDir()"/>Images/MoodIcon/<xsl:value-of select="substring-after(substring-before($moodOption,'$$$'),'|')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:element>
</td>
<xsl:variable name="after" select="substring-after($moodOption,'$$$')" />
<xsl:choose>
<xsl:when test="contains($after,'$$$')">
<xsl:call-template name="GetOptionIcon">
<xsl:with-param name="moodOption" select="$after"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<td align="center" valign="bottom">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:choose>
<xsl:when test="pe:IsStartWithhttp(substring-after($after,'|')) = 'true'">
<xsl:value-of select="substring-after($after,'|')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="pe:InstallDir()"/>Images/MoodIcon/<xsl:value-of select="substring-after($after,'|')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:element>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<td align="center" valign="bottom">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:choose>
<xsl:when test="pe:IsStartWithhttp(substring-after($moodOption,'|')) = 'true'">
<xsl:value-of select="substring-after($moodOption,'|')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="pe:InstallDir()"/>Images/MoodIcon/<xsl:value-of select="substring-after($moodOption,'|')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:element>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--组合选项索引模板-->
<xsl:template name="GetOptionIndex">
<xsl:param name="moodOption"/>
<xsl:param name="position" select="0" />
<xsl:choose>
<xsl:when test="contains($moodOption,'$$$')">
<td align="center" valign="bottom">
<input onclick="javascript:MoodVote(this.value);" value="{$position}" type="radio" name="moodradio" />
</td>
<xsl:variable name="after" select="substring-after($moodOption,'$$$')" />
<xsl:choose>
<xsl:when test="contains($after,'$$$')">
<xsl:call-template name="GetOptionIndex">
<xsl:with-param name="moodOption" select="$after"/>
<xsl:with-param name="position" select="$position + 1"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<td align="center" valign="bottom">
<input onclick="javascript:MoodVote(this.value);" value="{$position + 1}" type="radio" name="moodradio" />
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<td align="center" valign="bottom">
<input onclick="javascript:MoodVote(this.value);" value="{$position}" type="radio" name="moodradio" />
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>]]>
</LabelTemplate>
<attributes>
<name>moodId</name>
<datatype>supersql</datatype>
<default>1</default>
<intro>心情指数ID</intro>
</attributes>
</root>