<%@ page contentType="text/html; charset=EUC-JP" %> <%-- index.html に include された場合は、リンク先を静的ページにする。 --%> <%@ page import=" java.io.*, java.net.*, java.util.*, java.text.*" %> <%@ include file="common.jsp" %> <%@ include file="/modules/TaxCalculation.jsp" %> <%! // XXX: 安直だ... String[] getPrevNext(String date_key) { Date prev = null, next = null; String prev_s = null, next_s = null; if ( !diaries.containsKey(date_key) ) date_key = last_updated; Date key = ((OneDiary)diaries.get(date_key)).date; Enumeration e = diaries.keys(); // XXX: sort してあれば簡単 while ( e.hasMoreElements() ) { String date = (String)e.nextElement(); Date D = ((OneDiary)diaries.get(date)).date; int cmp = D.compareTo(key); if ( cmp > 0 ) { // D > key if ( next == null || D.compareTo(next) < 0 ) { // D < next next = D; next_s = date; } } else if ( cmp < 0 ) { // D < key if ( prev == null || D.compareTo(prev) > 0 ) { // D > prev prev = D; prev_s = date; } } } return ( new String[] {prev_s, next_s} ); } %> <% Args args = new Args(request); // should be thread-local String myname = request.getRequestURI(); boolean isIncluded = (myname.endsWith("/") || myname.endsWith(".html")); // when included by index.html or YYYYMMDD.html boolean staticLink = ( isIncluded /* So, !previewMode */ && myname.regionMatches(0, "/" + staticLinkShop + "/", 0, 2+staticLinkShop.length()) ); // // when included by '...../YYYYMMDD.html' and no p= is given: // if ( staticLink && args.page.equals("1") ) { // "1" means 'not given' int slashPos; Date d; if ( myname.endsWith(".html") && (slashPos = myname.length() - (1+8+1+4)) >= 0 && myname.charAt(slashPos) == '/' ) { try { d = dateFormatter422.parse(myname.substring(slashPos+1, slashPos+9)); args.page = dateFormatter.format(d); } catch (ParseException e) {} } } String date = args.page; if ( !diaries.containsKey(date) ) // date = last_updated; // XXX: なかったら最新のを表示。 response.sendRedirect("index.html"); // index.html静的化 String[] prev_next = getPrevNext(date); String prev_link = null; String next_link = null; String prev422 = null; String next422 = null; try { if ( prev_next[0] != null ) prev422 = dateFormatter422.format( dateFormatter.parse(prev_next[0]) ); if ( prev_next[1] != null ) next422 = dateFormatter422.format( dateFormatter.parse(prev_next[1]) ); } catch (ParseException e) {} if ( prev_next[0] != null ) prev_link = ( staticLink ? prev422 + ".html" : URL_oneDay + "?p=" + prev_next[0] ); if ( prev_next[1] != null ) next_link = ( staticLink ? next422 + ".html" : URL_oneDay + "?p=" + prev_next[1] ); OneDiary d = (OneDiary)diaries.get(date); String text = getText(date); String uri; boolean noGoodsNo; try { Integer.parseInt(d.goodsNo); uri = "../NS/CSfLastGenGoodsPage_001.jsp?GOODS_NO=" + d.goodsNo; noGoodsNo = false; } catch (NumberFormatException e) { uri = ( !d.goodsNo.equals("") ? d.goodsNo : null ); noGoodsNo = true; } String titleWithLink = d.titleLong; String imageURL = d.image; //String link_to_latest = (date.equals(last_updated) ? null : // staticLink ? URL_latest_html : // URL_latest); String link_to_latest = URL_latest_html; String link_to_calendar = (previewMode ? URL_calendar_month : staticLink ? URL_calendar_all_html : URL_calendar_all); if ( previewMode ) { // on admin-server if ( uri != null && uri.regionMatches(0, "../", 0, 3) ) uri = "http://books.rakuten.co.jp/RBOOKS" + uri.substring(2); titleWithLink = replace(titleWithLink, "\"../NS/", "\"http://books.rakuten.co.jp/RBOOKS/NS/"); imageURL = "../../site" + imageURL; } String previewMark = (!previewMode ? "" : ""); %> 【楽天ブックス 読書日記】 <% if ( previewMode ) { %> <% } else { %> <% } %> <% if ( shopDirName.equals("RBOOKS") ) { %> <% } else { %> <% } %>
<% if ( previewMode ) { %> <% } else if ( shopDirName.equals("RBOOKS") ) { %> <% } else { %> <% } %>
<%= previewMark %> <% if ( previewMode ) { %> <% } else { %> <% } %>
読書日記

<% if ( !date.equals(last_updated) ) { %> <% } %>
 <%= linked_text("読書日記トップ", link_to_latest) %>  <%= date %>の読書日記  バックナンバー一覧  カレンダー   
">
<<<%= linked_text("前日の日記へ", prev_link) %><%= date.equals(last_updated) ? "" : " | " + linked_text("翌日の日記へ", next_link) + ">>" %>
<%= date %>
<%= linked_text("", uri) %> <%= titleWithLink %>

<% if ( !d.author.equals("") ) { %>著 者:<%= d.author %>
<% } %> 出版社:<%= d.publisher %>
<% if ( !d.pubdate.equals("") ) { %>発行日:<%= d.pubdate %>
<% } %> <% if ( !d.price.equals("") ) { %><%= getFormatTaxYen(d.price) %><% } %> <% if ( !noGoodsNo ) { %> <% } %>
<%= text %>
<%= d.writer %>




このページのトップへ

<% if ( previewMode ) { %> <% } else { %> <% } %>