source: branches/version-2_12-multilang/data/Smarty/templates/admin/contents/index.tpl @ 22456

Revision 22456, 13.5 KB checked in by m_uehara, 8 years ago (diff)

#1987 日付取得処理修正

  • 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/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23*}-->
24
25<script type="text/javascript">
26<!--
27
28function func_regist(url) {
29    res = confirm('<!--{if $edit_mode eq "on"}--><!--{t string="tpl_Do you want to edit with these contents?_01"}--><!--{else}--><!--{t string="tpl_Register and continue?_01"}--><!--{/if}-->');
30    if(res == true) {
31        document.form1.mode.value = 'regist';
32        document.form1.submit();
33        return false;
34    }
35    return false;
36}
37
38function func_edit(news_id) {
39    document.form1.mode.value = "search";
40    document.form1.news_id.value = news_id;
41    document.form1.submit();
42}
43
44function func_del(news_id) {
45    res = confirm('<!--{t string="tpl_Do you want to delete this new information?_01"}-->');
46    if(res == true) {
47        document.form1.mode.value = "delete";
48        document.form1.news_id.value = news_id;
49        document.form1.submit();
50    }
51    return false;
52}
53
54function func_rankMove(term,news_id) {
55    document.form1.mode.value = "move";
56    document.form1.news_id.value = news_id;
57    document.form1.term.value = term;
58    document.form1.submit();
59}
60
61function moving(news_id,rank, max_rank) {
62
63    var val;
64    var ml;
65    var len;
66
67    ml = document.move;
68    len = document.move.elements.length;
69    j = 0;
70    for( var i = 0 ; i < len ; i++) {
71            if ( ml.elements[i].name == 'position' && ml.elements[i].value != "" ) {
72            val = ml.elements[i].value;
73            j ++;
74            }
75    }
76
77    if ( j > 1) {
78        alert( '<!--{t string="tpl_Enter a single move ranking._01"}-->' );
79        return false;
80    } else if( ! val ) {
81        alert( '<!--{t string="tpl_Enter a move ranking._01"}-->' );
82        return false;
83    } else if( val.length > 4){
84        alert( '<!--{t string="tpl_Enter a move ranking that is 4 digits or less._01"}-->' );
85        return false;
86    } else if( val.match(/[0-9]+/g) != val){
87        alert( '<!--{t string="tpl_Enter a number for the move ranking._01"}-->' );
88        return false;
89    } else if( val == rank ){
90        alert( '<!--{t string="The number to be moved is a duplicate._01"}-->' );
91        return false;
92    } else if( val == 0 ){
93        alert( '<!--{t string="tpl_Enter 0 or greater for the move ranking_01"}-->' );
94        return false;
95    } else if( val > max_rank ){
96        alert( '<!--{t string="tpl_The order that was entered exceeds the maximum valued for the number registered._01"}-->' );
97        return false;
98    } else {
99        ml.moveposition.value = val;
100        ml.rank.value = rank;
101        ml.news_id.value = news_id;
102        ml.submit();
103        return false;
104    }
105}
106
107    $(function(){
108        var dateFormat = $.datepicker.regional['<!--{$smarty.const.LANG_CODE}-->'].dateFormat;
109
110        <!--{if $arrForm.year != '' && $arrForm.month != '' && $arrForm.day != ''}-->
111        var year  = '<!--{$arrForm.year|h}-->';
112        var month = '<!--{$arrForm.month|h}-->';
113        var day   = '<!--{$arrForm.day|h}-->';
114        var ymd = $.datepicker.formatDate(dateFormat, new Date(year, month - 1, day));
115        $("#datepicker").val(ymd);
116        // console.log(ymd);
117        <!--{/if}-->
118
119        $( "#datepicker" ).datepicker({
120        beforeShowDay: function(date) {
121            if(date.getDay() == 0) {
122                return [true,"date-sunday"];
123            } else if(date.getDay() == 6){
124                return [true,"date-saturday"];
125            } else {
126                return [true];
127            }
128        },changeMonth: 'true'
129        ,changeYear: 'true'
130        ,onSelect: function(dateText, inst){
131            var year  = inst.selectedYear;
132            var month = inst.selectedMonth + 1;
133            var day   = inst.selectedDay;
134            setDate(year + '/' + month + '/' + day);
135        },
136        showButtonPanel: true,
137        beforeShow: showAdditionalButton,       
138        onChangeMonthYear: showAdditionalButton
139        });
140       
141        $("#datepicker").change( function() {
142            var dateText   = $(this).val();
143            var dateFormat = $.datepicker.regional['<!--{$smarty.const.LANG_CODE}-->'].dateFormat;
144            // console.log(dateText);
145            // console.log(dateFormat);
146            var date;
147            var year  = '';
148            var month = '';
149            var day   = '';
150            try {
151                date = $.datepicker.parseDate(dateFormat, dateText);
152                year  = date.getFullYear();
153                month = date.getMonth() + 1;
154                day   = date.getDate();
155            } catch (e) {
156                // console.log(e);
157                // clear date text
158                $(this).val('');
159            }
160            setDate(year + '/' + month + '/' + day);
161        });
162       
163    });
164   
165    var btn = $('<button class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" type="button">Clear</button>');
166   
167    var showAdditionalButton = function (input) {
168        setTimeout(function () {
169            var buttonPane = $(input)
170                     .datepicker("widget")
171                     .find(".ui-datepicker-buttonpane");
172            btn
173                    .unbind("click")
174                    .bind("click", function () {
175                        $.datepicker._clearDate(input);
176                        $("*[name=year]").val("");
177                        $("*[name=month]").val("");
178                        $("*[name=day]").val("");
179                    });
180            btn.appendTo(buttonPane);
181        }, 1);
182    };
183   
184    function setDate(dateText){
185    var dates = dateText.split('/');
186    $("*[name=year]").val(dates[0]);
187    $("*[name=month]").val(dates[1]);
188    $("*[name=day]").val(dates[2]);
189    }
190
191//-->
192</script>
193
194
195<div id="admin-contents" class="contents-main">
196<form name="form1" id="form1" method="post" action="?">
197<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
198<input type="hidden" name="mode" value="" />
199<input type="hidden" name="news_id" value="<!--{$arrForm.news_id|h}-->" />
200<input type="hidden" name="term" value="" />
201    <!--{* ▼登録テーブルここから *}-->
202    <table>
203        <tr>
204            <th><!--{t string="tpl_Date<span class='attention'> *</span>_01" escape="none"}--></th>
205            <td>
206                <!--{if $arrErr.year || $arrErr.month || $arrErr.day}--><span class="attention"><!--{$arrErr.year}--><!--{$arrErr.month}--><!--{$arrErr.day}--></span><!--{/if}-->
207                <input id="datepicker"
208                       type="text"
209                       value="" <!--{if $arrErr.year != ""}--><!--{sfSetErrorStyle}--><!--{/if}--> />
210                <input type="hidden" name="year" value="<!--{$arrForm.year|h}-->" />
211                <input type="hidden" name="month" value="<!--{$arrForm.month|h}-->" />
212                <input type="hidden" name="day" value="<!--{$arrForm.day|h}-->" />
213            </td>
214        </tr>
215        <tr>
216            <th><!--{t string="tpl_Title<span class='attention'> *</span>_01" escape="none"}--></th>
217            <td>
218                <!--{if $arrErr.news_title}--><span class="attention"><!--{$arrErr.news_title}--></span><!--{/if}-->
219                <textarea name="news_title" cols="60" rows="8" class="area60" maxlength="<!--{$smarty.const.MTEXT_LEN}-->" <!--{if $arrErr.news_title}-->style="background-color:<!--{$smarty.const.ERR_COLOR|h}-->"<!--{/if}-->><!--{"\n"}--><!--{$arrForm.news_title|h}--></textarea><br />
220                <span class="attention"> <!--{t string="tpl_(T_ARG1 characters max)_01" T_ARG1=$smarty.const.MTEXT_LEN}--></span>
221            </td>
222        </tr>
223        <tr>
224            <th><!--{t string="tpl_URL_01"}--></th>
225            <td>
226                <span class="attention"><!--{$arrErr.news_url}--></span>
227                <input type="text" name="news_url" size="60" class="box60"    value="<!--{$arrForm.news_url|h}-->" <!--{if $arrErr.news_url}-->style="background-color:<!--{$smarty.const.ERR_COLOR|h}-->"<!--{/if}--> maxlength="<!--{$smarty.const.URL_LEN}-->" />
228                <span class="attention"> <!--{t string="tpl_(T_ARG1 characters max)_01" T_ARG1=$smarty.const.URL_LEN}--></span>
229            </td>
230        </tr>
231        <tr>
232            <th><!--{t string="tpl_Link_01"}--></th>
233            <td><label><input type="checkbox" name="link_method" value="2" <!--{if $arrForm.link_method eq 2}--> checked <!--{/if}--> /> <!--{t string="tpl_Open in separate window_01"}--></label></td>
234        </tr>
235        <tr>
236            <th><!--{t string="tpl_Create text_01"}--></th>
237            <td>
238                <!--{if $arrErr.news_comment}--><span class="attention"><!--{$arrErr.news_comment}--></span><!--{/if}-->
239                <textarea name="news_comment" cols="60" rows="8" wrap="soft" class="area60" maxlength="<!--{$smarty.const.LTEXT_LEN}-->" style="background-color:<!--{if $arrErr.news_comment}--><!--{$smarty.const.ERR_COLOR|h}--><!--{/if}-->"><!--{"\n"}--><!--{$arrForm.news_comment|h}--></textarea><br />
240                <span class="attention"> <!--{t string="tpl_(3000 characters max)_01"}--></span>
241            </td>
242        </tr>
243    </table>
244    <!--{* ▲登録テーブルここまで *}-->
245
246    <div class="btn-area">
247        <ul>
248            <li><a class="btn-action" href="javascript:;" onclick="return func_regist();"><span class="btn-next"><!--{t string="tpl_Save and continue_01"}--></span></a></li>
249        </ul>
250    </div>
251</form>
252
253    <h2><!--{t string="tpl_List of new information_01"}--></h2>
254    <!--{if $arrErr.moveposition}-->
255    <p><span class="attention"><!--{$arrErr.moveposition}--></span></p>
256    <!--{/if}-->
257    <!--{* ▼一覧表示エリアここから *}-->
258    <form name="move" id="move" method="post" action="?">
259    <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
260    <input type="hidden" name="mode" value="moveRankSet" />
261    <input type="hidden" name="term" value="setposition" />
262    <input type="hidden" name="news_id" value="" />
263    <input type="hidden" name="moveposition" value="" />
264    <input type="hidden" name="rank" value="" />
265    <table class="list">
266        <col width="5%" />
267        <col width="15%" />
268        <col width="45%" />
269        <col width="5%" />
270        <col width="5%" />
271        <col width="25%" />
272        <tr>
273            <th><!--{t string="tpl_Ranking_01"}--></th>
274            <th><!--{t string="tpl_Date_01"}--></th>
275            <th><!--{t string="tpl_Title_01"}--></th>
276            <th class="edit"><!--{t string="tpl_Edit_01"}--></th>
277            <th class="delete"><!--{t string="tpl_Remove_01"}--></th>
278            <th><!--{t string="tpl_Move_01"}--></th>
279        </tr>
280        <!--{section name=data loop=$arrNews}-->
281        <tr style="background:<!--{if $arrNews[data].news_id != $tpl_news_id}-->#ffffff<!--{else}--><!--{$smarty.const.SELECT_RGB}--><!--{/if}-->;" class="center">
282            <!--{assign var=db_rank value="`$arrNews[data].rank`"}-->
283            <td><!--{math equation="$line_max - $db_rank + 1"}--></td>
284            <td><!--{$arrNews[data].cast_news_date|date_format:"%Y/%m/%d"}--></td>
285            <td class="left">
286                <!--{if $arrNews[data].link_method eq 1 && $arrNews[data].news_url != ""}--><a href="<!--{$arrNews[data].news_url|h}-->" ><!--{$arrNews[data].news_title|h|nl2br}--></a>
287                <!--{elseif $arrNews[data].link_method eq 1 && $arrNews[data].news_url == ""}--><!--{$arrNews[data].news_title|h|nl2br}-->
288                <!--{elseif $arrNews[data].link_method eq 2 && $arrNews[data].news_url != ""}--><a href="<!--{$arrNews[data].news_url|h}-->" target="_blank" ><!--{$arrNews[data].news_title|h|nl2br}--></a>
289                <!--{else}--><!--{$arrNews[data].news_title|h|nl2br}-->
290                <!--{/if}-->
291            </td>
292            <td>
293                <!--{if $arrNews[data].news_id != $tpl_news_id}-->
294                <a href="#" onclick="return func_edit('<!--{$arrNews[data].news_id|h}-->');"><!--{t string="tpl_Edit_01"}--></a>
295                <!--{else}-->
296                <!--{t string="tpl_being edited_01"}-->
297                <!--{/if}-->
298            </td>
299            <td><a href="#" onclick="return func_del('<!--{$arrNews[data].news_id|h}-->');"><!--{t string="tpl_Remove_01"}--></a></td>
300            <td>
301            <!--{if count($arrNews) != 1}-->
302            <input type="text" name="pos-<!--{$arrNews[data].news_id|h}-->" size="3" class="box3" /><!--{t string="tpl_The first_01"}--> <a href="?" onclick="fnFormModeSubmit('move', 'moveRankSet','news_id', '<!--{$arrNews[data].news_id|h}-->'); return false;"><!--{t string="tpl_Move_01"}--></a><br />
303            <!--{/if}-->
304            <!--{if $arrNews[data].rank ne $max_rank}--><a href="#" onclick="return func_rankMove('up', '<!--{$arrNews[data].news_id|h}-->', '<!--{$max_rank|h}-->');"><!--{t string="tpl_To top_01"}--></a><!--{/if}-->&nbsp;<!--{if $arrNews[data].rank ne 1}--><a href="#" onclick="return func_rankMove('down', '<!--{$arrNews[data].news_id|h}-->', '<!--{$max_rank|h}-->');"><!--{t string="tpl_To bottom_01"}--></a><!--{/if}-->
305            </td>
306        </tr>
307        <!--{sectionelse}-->
308        <tr class="center">
309            <td colspan="6"><!--{t string="tpl_Currently, there is no data._01"}--></td>
310        </tr>
311        <!--{/section}-->
312    </table>
313    </form>
314    <!--{* ▲一覧表示エリアここまで *}-->
315
316</div>
Note: See TracBrowser for help on using the repository browser.