source: branches/version-2_11-dev/data/Smarty/templates/sphone/frontparts/bloc/news.tpl @ 21132

Revision 21132, 6.7 KB checked in by nanasess, 13 years ago (diff)

#1413 HTML5 構文修正

  • カート, 複数お届け先指定, 購入確認画面での画像リンクは見づらいので廃止
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-smarty-template; charset=UTF-8
Line 
1<!--{*
2 * This file is part of EC-CUBE
3 *
4 * Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
5 *
6 * http://www.lockon.co.jp/
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 *}-->
22<!-- ▼新着情報 -->
23
24<section id="news_area">
25<h2 class="title_block">新着情報</h2>
26<ul class="newslist">
27  <!--{section name=data loop=$arrNews max=3}-->
28  <li>
29    <a id="windowcolumn<!--{$smarty.section.data.index}-->" href="javascript:getNewsDetail(<!--{$arrNews[data].news_id}-->);">
30    <span class="news_title"><!--{$arrNews[data].news_title|h}--></span></a><br />
31    <span class="news_date"><!--{$arrNews[data].news_date_disp|date_format:"%Y年 %m月 %d日"}--></span>
32  </li>
33  <!--{/section}-->
34</ul>
35
36<!--{if $newsCount > 3}-->
37<div class="btn_area">
38<p><a href="javascript:;" class="btn_more" id="btn_more_news" onclick="getNews(3); return false;">もっとみる(+3件)</a></p>
39</div>
40<!--{/if}-->
41</section>
42<!-- ▲新着情報 -->
43
44
45<script>
46var newsPageNo = 2;
47
48function getNews(limit) {
49    $.mobile.pageLoading();
50    var i = limit;
51
52    $.ajax({
53               url: "<!--{$smarty.const.HTTP_URL}-->frontparts/bloc/news.php",
54               type: "POST",
55               data: "mode=getList&pageno="+newsPageNo+"&disp_number="+i,
56               cache: false,
57               dataType: "json",
58               error: function(XMLHttpRequest, textStatus, errorThrown){
59                   alert(textStatus);
60                   $.mobile.pageLoading(true);
61               },
62               success: function(result){
63                   if (result.error) {
64                       alert(result.error);
65                   } else {
66                       for (var j = 0; j < i; j++) {
67                           if (result[j] != null) {
68                               var news = result[j];
69                               var maxCnt = $("#news_area ul.newslist li").length - 1;
70                               var newsEl = $("#news_area ul.newslist li").get(maxCnt);
71                               newsEl = $(newsEl).clone(true).insertAfter(newsEl);
72                               maxCnt++;
73
74                               //件名をセット
75                               $($("#news_area ul.newslist li a span.news_title").get(maxCnt)).text(news.news_title);
76
77                               //リンクをセット
78                               $($("#news_area ul.newslist li a").get(maxCnt)).attr("href", "javascript:getNewsDetail(" + news.news_id + ");");
79
80                               //年月をセット
81                               var newsDateDispArray = news.news_date_disp.split("-"); //ハイフンで年月日を分解
82                               var newsDateDisp = newsDateDispArray[0] + "年 " + newsDateDispArray[1] + "月 " + newsDateDispArray[2] + "日";
83                               $($("#news_area ul.newslist li span.news_date").get(maxCnt)).text(newsDateDisp);
84                           }
85                       }
86
87                       //すべての新着情報を表示したか判定
88                       var newsPageCount = result.news_page_count;
89                       if (parseInt(newsPageCount) <= newsPageNo) {
90                           $("#btn_more_news").hide();
91                       }
92
93                       newsPageNo++;
94                   }
95                   $.mobile.pageLoading(true);
96               }
97           });
98}
99
100var loadingState = 0;
101function getNewsDetail(newsId) {
102    if (loadingState == 0) {
103        $.mobile.pageLoading();
104        loadingState = 1;
105        $.ajax({
106                   url: "<!--{$smarty.const.HTTP_URL}-->frontparts/bloc/news.php",
107                   type: "GET",
108                   data: "mode=getDetail&news_id="+newsId,
109                   cache: false,
110                   async: false,
111                   dataType: "json",
112                   error: function(XMLHttpRequest, textStatus, errorThrown){
113                       alert(textStatus);
114                       $.mobile.pageLoading(true);
115                       loadingState = 0;
116                   },
117                   success: function(result){
118                       if (result.error) {
119                           alert(result.error);
120                           $.mobile.pageLoading(true);
121                           loadingState = 0;
122                       }
123                       else if (result[0] != null) {
124                           var news = result[0];
125                           var maxCnt = 0;
126
127                           //件名をセット
128                           $($("#windowcolumn dl.view_detail dt a").get(maxCnt)).text(news.news_title);
129                           if (news.news_url != null) {
130                               $($("#windowcolumn dl.view_detail dt a").get(maxCnt)).attr("href", news.news_url);
131                           } else {
132                               $($("#windowcolumn dl.view_detail dt a").get(maxCnt)).attr("href", "javascript:;");
133                           }
134
135                           //年月をセット
136                           //var newsDateDispArray = news.news_date_disp.split("-"); //ハイフンで年月日を分解
137                           //var newsDateDisp = newsDateDispArray[0] + "年 " + newsDateDispArray[1] + "月 " + newsDateDispArray[2] + "日";
138                           //$($("#windowcolumn dl.view_detail dt").get(maxCnt)).text(newsDateDisp);
139
140                           //コメントをセット(iphone4の場合、innerHTMLの再描画が行われない為、タイマーで無理やり再描画させる)
141                           setTimeout( function() {
142                               $("#newsComment").html(news.news_comment.replace(/\n/g,"<br />"));
143                           }, 10);
144
145                           $.mobile.changePage('#windowcolumn', 'slideup');
146                           //ダイアログが開き終わるまで待機
147                           setTimeout( function() {
148                                           loadingState = 0;
149                                           $.mobile.pageLoading(true);
150                                       }, 1000);
151                       }
152                   }
153               });
154    }
155}
156</script>
Note: See TracBrowser for help on using the repository browser.