XSL笔记

列表页:

list.xml

list.xml
 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
 6 <link rel="stylesheet" type="text/css" href="/Css/jqueryui/jquery-ui-1.9.2.custom.css"/>
 7 <link href="/Css/admin/v1.3.css" rel="stylesheet" type="text/css" media="all"/>
 8 <script type="text/javascript" src="/js/jquery/jquery-1.8.3.min.js"></script>
 9 <script type="text/javascript" src="/js/jquery/jquery-ui-1.9.2.min.js"></script>
10 <script type="text/javascript" src="/js/jquery/jquery.bgiframe-2.1.2.js"></script>
11 <script type="text/javascript" src="/js/admin/v3.2.js"></script>
12 <script type="text/javascript">
13 $(function(){
14     
15     $('#btnSearch').click(function(e) {
16             $('#frmSearch').submit()
17       });
18     
19     $('.btndel').click(function(){
20     var id = $(this).attr('data');
21     var q= 'id='+id;
22      $.doCmd('delete',{method:'post',query:q,confirm:true,title:'删除',success:function(code,info){
23         alert(info);             
24         location.reload();            
25         }})    
26     })
27     
28     $('.editactstatus').click(function(){
29     var id = $(this).attr('data');
30     var rel = $(this).attr('rel');
31     var edit = $(this).attr('edit');
32     var q= 'id='+id+'&actstatus='+rel+'&edit='+edit;
33      $.doCmd('editactstatus',{method:'post',query:q,success:function(code,info){
34      alert(info);             
35     location.reload();            
36         }})    
37     })
38 
39     $('.editrecommend').click(function(){
40     var id = $(this).attr('data');
41     var rel = $(this).attr('rel');
42     var edit = $(this).attr('edit');
43     var q= 'id='+id+'&recommend='+rel+'&edit='+edit;
44      $.doCmd('editrecommend',{method:'post',query:q,success:function(code,info){
45      alert(info);             
46     location.reload();            
47         }})    
48     })
49 
50 
51     
52 
53    
54 
55           $('.addurl').click(function(){
56          var id=$(this).attr("data");    
57           //编辑房源信息
58           btns = {
59               '确认':function(){
60               var q ='id='+id +'&'+$('#myform').serialize();
61               $.doCmd('editurl',{method:'post',query:q,success:function(code,info){             
62                 $('#dlgEdit').dialog('close');
63                 alert(info);
64                 location.reload();            
65               }})
66               return false;    
67               },
68               '取消':function(){
69               $('#dlgEdit').dialog('close');
70               }
71              }  
72              $('#dlgEdit').loadContent('addurl',{query:'id='+id}).dialog({
73               modal:true,
74               width:600,
75               buttons :btns
76               })
77       })
78     
79 });
80 </script>
81 <title>楼市观察</title>
82 </head>
83 
84 <body class="mainContent" style="margin:0">
85 <city_list>manage</city_list>
86 <div id="dlgEdit" title="编辑"></div>
87 </body>
88 </html>

 


s_manager.xml

s_manager.xml
  1 <?xml version="1.0" encoding="utf-8"?>
  2 <!DOCTYPE xsl:stylesheet  [
  3     <!ENTITY nbsp   "&#160;">
  4     <!ENTITY copy   "&#169;">
  5     <!ENTITY reg    "&#174;">
  6     <!ENTITY trade  "&#8482;">
  7     <!ENTITY mdash  "&#8212;">
  8     <!ENTITY ldquo  "&#8220;">
  9     <!ENTITY rdquo  "&#8221;">
 10     <!ENTITY pound  "&#163;">
 11     <!ENTITY yen    "&#165;">
 12     <!ENTITY euro   "&#8364;">
 13 ]>
 14 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="CityFly" xmlns:page="urn:page">
 15     <xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
 16     <xsl:param name="rowcount"/>
 17     <!--数据库总记录数-->
 18     <xsl:param name="maxrow"/>
 19     <!--每页记录数-->
 20     <xsl:param name="curpage"/>
 21     <!--当前页码-->
 22     <xsl:param name="param"/>
 23     <!--引入 param 参数-->
 24     <xsl:param name="templatename"/>
 25     <!--Label.xml 模块名称-->
 26     <xsl:param name="orderby"/>
 27     <!--Label.xml orderby 参数-->
 28     <xsl:param name="where"/>
 29     <!--Label.xml where 参数-->
 30     <xsl:param name="runtime"/>
 31     <!--运行时长-->
 32     <msxsl:script language="javascript" implements-prefix="user">
 33         var n=5;
 34         <![CDATA[function PageList(cP,rC,qStr,mR){
 35       var pC=(rC%mR==0)?rC/mR:int(rC/mR)+1;
 36       var pStr="";
 37       cP=int(cP);
 38       if (pC>cP+n){var eP=cP+n;}else{var eP=pC;}
 39       if (cP-n<=0){var sP=1;}else{var sP=cP-n;}
 40       if(cP>1){pStr=pStr+'<a class="prve" href="?page='+(cP-1)+qStr+'" rel="'+(cP-1)+'">上一页</a>';}
 41       if (cP>n+1){pStr=pStr+'<a href="?page=1'+qStr+'" rel="1">1</a> <span>...</span>';}
 42       for (var i=sP;i<=eP;i++){
 43       if (i==cP){
 44       pStr=pStr+' <a rel="'+i+'" class="current">'+i+'</a> ';
 45       }else{
 46       pStr=pStr+' <a rel="'+i+'" href="?page='+i+qStr+'">'+i+'</a> ';
 47       }
 48       }
 49       if(pC>cP+n){pStr=pStr+'<span>...</span> <a rel="pC" href="?page='+pC+qStr+'">'+pC+'</a>';}
 50       if(cP<pC){pStr=pStr+' <a class="next" rel="'+(cP+1)+'" href="?page='+(cP+1)+qStr+'">下一页</a> ';}
 51       return pStr;
 52       }]]>
 53     </msxsl:script>
 54     <xsl:template match="/">
 55 
 56         <div class="search">
 57             <form id="frmSearch" method="get" >
 58                 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_content">
 59                     <tr>
 60                         <td width="60">
 61                             <strong>时间:</strong>
 62                         </td>
 63                         <td>
 64                             <input name="startdate" type="text" title="起始时间" class="my-datepicker input_100" id="startdate" value="{page:xRequest('startdate')}" />
 65                             &nbsp;<b>至</b>&nbsp;
 66                             <input name="overdate" type="text" title="终止时间" class="my-datepicker input_100" id="overdate" value="{page:xRequest('overdate')}" />
 67                         </td>
 68                     </tr>
 69                     <tr>
 70                         <td  width="60">
 71                             <strong>标题:</strong>
 72                         </td>
 73                         <td>
 74                             <input type="text" class="input_300" name="keywords" value=""  />
 75                             <input name="btnSearch" type="button"  class="button"  id="btnSearch" value="查询"/>
 76                             <input type="button" value="重置所有"  class="button" id="btnReset"/>
 77                             <a href="/zhuanti/loushiguancha/loushiguancha.html" target="_blank">[新增]</a>
 78 
 79                             <!--<xsl:variable name="domain" select="page:xExec('sp_admin_siteselect1',concat('siteid=',page:xCookie('siteid')))" />
 80                   
 81                     <li class="fr"><a href="http://c.{$domain/rows/row/f_domain}/zhuanti/guide.html" target="_blank">[查看前台列表页面]</a>-->
 82                         </td>
 83                     </tr>
 84                 </table>
 85             </form>
 86         </div>
 87         <div>
 88             <form id="frmArticleList" method="get">
 89                 <table width="100%" border="0" cellspacing="1" cellpadding="0" class="table">
 90                     <thead  class="tableBody">
 91                         <tr class="head">
 92                             <td align="center">ID</td>
 93                             <td align="center">标题</td>
 94                             <td align="center">浏览量</td>
 95                             <td align="center">发布时间</td>
 96                             <td align="center">最后修改时间</td>
 97                             <td align="center">操作人</td>
 98                             <td align="center">操作</td>
 99                         </tr>
100                     </thead>
101                     <xsl:if test="count(rows/row)!=0">
102                         <tbody class="tableBody">
103                             <xsl:for-each select="rows/row">
104                                 <tr class="{page:xIIF(position() mod 2 =1,'','odd')}" >
105                                     <td align="center">
106                                         <xsl:value-of select="id"/>
107                                     </td>
108                                     <td align="center">
109                                         <xsl:value-of select="f_title"/>
110                                     </td>
111                                     <td align="center">
112                                         <a href="/actmgmt/date/default.html?t=2&amp;id={id}&amp;type={f_source_id}" target="iWindow" title="统计分析">
113                                             <xsl:value-of select="page:xIIF(count(f_pvcount)=0 or f_pvcount='',0,f_pvcount)"/>
114                                         </a>
115                                     </td>
116                                     <td align="center">
117                                         <xsl:value-of select="substring(f_addtime,1,10)"/>
118                                         <br />
119                                         <xsl:value-of select="substring(f_addtime,12,8)"/>
120                                     </td>
121                                     <td align="center">
122                                         <xsl:value-of select="substring(f_updatetime,1,10)"/>
123                                         <br />
124                                         <xsl:value-of select="substring(f_updatetime,12,8)"/>
125                                     </td>
126                                     <td align="center">
127                                         <xsl:value-of select="f_master_name" />
128                                     </td>
129                                     <td align="center">
130                                         <a href="/zhuanti/loushiguancha/loushiguancha.html?id={id}" target="_blank">编辑</a>&nbsp;&nbsp;<a href="###" class="addurl" data="{id}" >qq链接</a> &nbsp;&nbsp;<a href="{f_urlprev}/zhuanti/zhuanti/loushiguancha/default.html?id={id}" target="_blank">预览</a>
131                                         &nbsp;&nbsp;<a href="/actmgmt/date/default.html?t=1&amp;id={id}&amp;type={f_source_id}" target="iWindow" title="统计分析">统计</a>&nbsp;&nbsp;
132                                         <xsl:if test="f_actstatus = 1">
133                                             <a href="###" data="{id}" rel="2" edit="1" class="editactstatus" >下线</a>
134                                             <span style="color:#000">/上线</span>
135                                         </xsl:if>
136                                         <xsl:if test="f_actstatus = 2">
137                                             下线/<a href="###" data="{id}" rel="1" edit="1" class="editactstatus" >上线</a>
138                                         </xsl:if>
139                                         &nbsp;&nbsp; <a href="#" class="btndel" edit="2" data="{id}"> 删除</a> &nbsp;&nbsp;
140 
141                                         <a href="{f_urlprev}/code.html?url={f_urlprev}/zhuanti/zhuanti/loushiguancha/default.html?id={id}"  target="_blank" >查看源码</a>
142                                     </td>
143                                 </tr>
144                             </xsl:for-each>
145                         </tbody>
146                     </xsl:if>
147                 </table>
148             </form>
149         </div>
150         <div class="list">
151             <xsl:variable name="query" select="concat(
152                         '&amp;sourceid=',page:xRequest('sourceid'),
153                         '&amp;service=',page:xRequest('service'),
154                         '&amp;serviceid=',page:xRequest('serviceid'),
155                         '&amp;regioncode=',page:xRequest('regioncode'),
156                         '&amp;newhouseid=',page:xRequest('newhouseid'),
157                         '&amp;time=',page:xRequest('time'),                   
158                         '&amp;addstartdate=',page:xRequest('addstartdate'),
159                         '&amp;addoverdate=',page:xRequest('addoverdate'),                        
160                         '&amp;clientid=',page:xRequest('clientid'),
161                         '&amp;opstatus=',page:xRequest('opstatus'),
162                         '&amp;keywords=',page:xRequest('keywords'),                        
163                         '&amp;editstartdate=',page:xRequest('editstartdate'),
164                         '&amp;editoverdate=',page:xRequest('editoverdate'),
165                         '&amp;servicetype=',page:xRequest('servicetype'),
166                         '&amp;typestatus=',page:xRequest('typestatus'),
167                         '&amp;type=',page:xRequest('type'),
168                         '&amp;isvalid=',page:xRequest('isvalid'),
169                         '&amp;tel400=',page:xRequest('tel400'),                      
170                         '&amp;tel400ext=',page:xRequest('tel400ext'),
171                         '&amp;id=',page:xRequest('id') ,
172                         '&amp;orderby=',page:xRequest('orderby')    
173                                                             
174          )"/>
175             <div class="fl">
176                 共有<span class="red">
177                     <xsl:value-of select="$rowcount"/>
178                 </span>179                 ,每页显示
180                 <select onchange="location.href='?mR='+this.value+'{$query}'">
181                     <option  value="50">
182                         <xsl:if test="page:xRequest('mR')=50">
183                             <xsl:attribute name="selected"></xsl:attribute>
184                         </xsl:if>
185                         50
186                     </option>
187                     <option  value="75">
188                         <xsl:if test="page:xRequest('mR')=75">
189                             <xsl:attribute name="selected"></xsl:attribute>
190                         </xsl:if>
191                         75
192                     </option>
193                     <option  value="100">
194                         <xsl:if test="page:xRequest('mR')=100">
195                             <xsl:attribute name="selected"></xsl:attribute>
196                         </xsl:if>
197                         100
198                     </option>
199                 </select>
200 201             </div>
202             <div class="fr" >
203                 <xsl:value-of select="user:PageList($curpage,$rowcount,concat($query,'&amp;mR=',page:xRequest('mR')),$maxrow)" disable-output-escaping="yes"/>
204                 <span style="float:left">
205                     跳转到<input id="page" size="2"  /><button class="sortBtn btn" data="{concat($query,'&amp;mR=',page:xRequest('mR'))}"  style="height:20px; width:30px; line-height:12px; font-size:12px;">确认</button>
206                 </span>
207             </div>
208         </div>
209 
210     </xsl:template>
211 </xsl:stylesheet>

 

s_edit.xml

s_edit
 1 <?xml version="1.0" encoding="utf-8"?>
 2 <!DOCTYPE xsl:stylesheet  [
 3     <!ENTITY nbsp   "&#160;">
 4     <!ENTITY copy   "&#169;">
 5     <!ENTITY reg    "&#174;">
 6     <!ENTITY trade  "&#8482;">
 7     <!ENTITY mdash  "&#8212;">
 8     <!ENTITY ldquo  "&#8220;">
 9     <!ENTITY rdquo  "&#8221;">
10     <!ENTITY pound  "&#163;">
11     <!ENTITY yen    "&#165;">
12     <!ENTITY euro   "&#8364;">
13 ]>
14 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:page="urn:page">
15     <xsl:output method="html" encoding="utf-8"/>
16     <xsl:param name="rowcount"/>
17     <!--数据库总记录数-->
18     <xsl:param name="maxrow"/>
19     <!--每页记录数-->
20     <xsl:param name="curpage"/>
21     <!--当前页码-->
22     <xsl:param name="param"/>
23     <!--引入 param 参数-->
24     <xsl:param name="templatename"/>
25     <!--Label.xml 模块名称-->
26     <xsl:param name="orderby"/>
27     <!--Label.xml orderby 参数-->
28     <xsl:param name="where"/>
29     <!--Label.xml where 参数-->
30     <xsl:param name="runtime"/>
31     <!--运行时长-->
32     <xsl:template match="/">
33         <xsl:choose>
34             <xsl:when test="$templatename='addurl'">
35                 <form id="myform" >
36                     <table width="100%" border="0" cellpadding="2" cellspacing="0" style="padding-top:8px;">
37                         <tr>
38                             <td width="15%" >QQ链接:</td>
39                             <td align="left">
40                                 <input type="text"  name="listlink"  value="{page:xIIF(count(rows/row/f_listlink) =0 or rows/row/f_listlink ='','http://',rows/row/f_listlink)}" size="50"/>
41                             </td>
42                         </tr>
43                         <tr>
44                             <td>列表图片:</td>
45                             <td >
46                                 <input type="text"  name="listpic"  value="{rows/row/f_listpic}" size="50"/>205*260
47                             </td>
48                         </tr>
49                     </table>
50                 </form>
51             </xsl:when>
52 
53         </xsl:choose>
54     </xsl:template>
55 </xsl:stylesheet>

 

label.config


 

label.config
 1 <?xml version="1.0" encoding="utf-8"?>
 2 <Labels>
 3     <ACL>3</ACL>
 4     <List>
 5         <ID>1022</ID>
 6         <Name>manage</Name>
 7         <Table>
 8             <Name>v_admin_zhuanti</Name>
 9             <MaxOnPage>{request:mR:50}</MaxOnPage>
10             <Query>*</Query>
11             <OrderBy>f_addtime desc</OrderBy>
12             <Where field="f_siteid"><![CDATA[{cookie:siteid:3501}]]></Where>
13             <!--<Where field="f_type">1</Where>    -->
14             <Where field="f_source_id">18</Where>
15             <Where field="cast(f_addtime as date)" mode="&gt;=">{request:startdate}</Where>
16             <Where field="cast(f_addtime as date)" andor="and" mode="&lt;=">{request:overdate}</Where>
17             <Where field="f_title" mode="like"  pattern="%'+Rtrim('{0}')+'%">{request:keywords}</Where>
18             <Where field="f_status"  mode="&lt;&gt;">99</Where>
19         </Table>
20         <XsltStyle>s_manage.xsl</XsltStyle>
21     </List>
22 
23 
24     <List>
25         <ID>1022</ID>
26         <Name>delete</Name>
27         <Table type="proc">
28             <Name>sp_admin_zhuantideleteupdate</Name>
29             <Param field="id">{form:id:-1}</Param>
30             <Param field="edit">{form:edit:2}</Param>
31             <Param field="siteid"><![CDATA[{cookie:siteid:3501}]]></Param>
32             <Param field="masterid"><![CDATA[{admin:id}]]></Param>
33             <Param field="mastername"><![CDATA[{admin:description}]]></Param>
34         </Table>
35         <XsltStyle>/templates/xsl/sqlreturn.xsl</XsltStyle>
36     </List>
37 
38 
39     <List>
40         <ID>1022</ID>
41         <Name>editactstatus</Name>
42         <Table type="proc">
43             <Name>sp_admin_zhuantideleteupdate</Name>
44             <Param field="id">{form:id:-1}</Param>
45             <Param field="edit">{form:edit:1}</Param>
46             <Param field="actstatus">{form:actstatus:1}</Param>
47             <Param field="siteid"><![CDATA[{cookie:siteid:3501}]]></Param>
48             <Param field="masterid"><![CDATA[{admin:id}]]></Param>
49             <Param field="mastername"><![CDATA[{admin:description}]]></Param>
50         </Table>
51         <XsltStyle>/templates/xsl/sqlreturn.xsl</XsltStyle>
52     </List>
53 
54     <List>
55         <ID>1022</ID>
56         <Name>addurl</Name>
57         <Table>
58             <Name>v_admin_zhuanti</Name>
59             <MaxOnPage>{request:mR:50}</MaxOnPage>
60             <Query>*</Query>
61             <OrderBy>f_addtime desc</OrderBy>
62             <Where field="id">{request:id}</Where>
63         </Table>
64         <XsltStyle>s_edit.xsl</XsltStyle>
65     </List>
66 
67     <List>
68         <ID>1022</ID>
69         <Name>editurl</Name>
70         <Table type="proc">
71             <Name>sp_admin_zhuantideleteupdate</Name>
72             <Param field="id">{form:id:-1}</Param>
73             <Param field="edit">4</Param>
74             <Param field="listpic">{form:listpic}</Param>
75             <Param field="listlink">{form:listlink}</Param>
76             <Param field="siteid"><![CDATA[{cookie:siteid:3501}]]></Param>
77             <Param field="masterid"><![CDATA[{admin:id}]]></Param>
78             <Param field="mastername"><![CDATA[{admin:description}]]></Param>
79         </Table>
80         <XsltStyle>/templates/xsl/sqlreturn.xsl</XsltStyle>
81     </List>
82 
83 
84 
85 </Labels>

 

list.html

list.html
 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
 6 <link rel="stylesheet" type="text/css" href="/Css/jqueryui/jquery-ui-1.9.2.custom.css"/>
 7 <link href="/Css/admin/v1.3.css" rel="stylesheet" type="text/css" media="all"/>
 8 <script type="text/javascript" src="/js/jquery/jquery-1.8.3.min.js"></script>
 9 <script type="text/javascript" src="/js/jquery/jquery-ui-1.9.2.min.js"></script>
10 <script type="text/javascript" src="/js/jquery/jquery.bgiframe-2.1.2.js"></script>
11 <script type="text/javascript" src="/js/admin/v3.2.js"></script>
12 <script type="text/javascript">
13 $(function(){
14     
15     $('#btnSearch').click(function(e) {
16             $('#frmSearch').submit()
17       });
18     
19     $('.btndel').click(function(){
20     var id = $(this).attr('data');
21     var q= 'id='+id;
22      $.doCmd('delete',{method:'post',query:q,confirm:true,title:'删除',success:function(code,info){
23         alert(info);             
24         location.reload();            
25         }})    
26     })
27     
28     $('.editactstatus').click(function(){
29     var id = $(this).attr('data');
30     var rel = $(this).attr('rel');
31     var edit = $(this).attr('edit');
32     var q= 'id='+id+'&actstatus='+rel+'&edit='+edit;
33      $.doCmd('editactstatus',{method:'post',query:q,success:function(code,info){
34      alert(info);             
35     location.reload();            
36         }})    
37     })
38 
39     $('.editrecommend').click(function(){
40     var id = $(this).attr('data');
41     var rel = $(this).attr('rel');
42     var edit = $(this).attr('edit');
43     var q= 'id='+id+'&recommend='+rel+'&edit='+edit;
44      $.doCmd('editrecommend',{method:'post',query:q,success:function(code,info){
45      alert(info);             
46     location.reload();            
47         }})    
48     })
49 
50 
51     
52 
53    
54 
55           $('.addurl').click(function(){
56          var id=$(this).attr("data");    
57           //编辑房源信息
58           btns = {
59               '确认':function(){
60               var q ='id='+id +'&'+$('#myform').serialize();
61               $.doCmd('editurl',{method:'post',query:q,success:function(code,info){             
62                 $('#dlgEdit').dialog('close');
63                 alert(info);
64                 location.reload();            
65               }})
66               return false;    
67               },
68               '取消':function(){
69               $('#dlgEdit').dialog('close');
70               }
71              }  
72              $('#dlgEdit').loadContent('addurl',{query:'id='+id}).dialog({
73               modal:true,
74               width:600,
75               buttons :btns
76               })
77       })
78     
79 });
80 </script>
81 <title>样板间</title>
82 </head>
83 
84 <body class="mainContent" style="margin:0">
85 <city_list>manage</city_list>
86 <div id="dlgEdit" title="编辑"></div>
87 </body>
88 </html>

 

posted @ 2013-04-11 14:16  张涵哲琪  阅读(398)  评论(0编辑  收藏  举报