Skip to content

Commit

Permalink
編集フォームに現在時刻を挿入するボタンの追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Piyoyo committed Mar 22, 2015
1 parent e8edb93 commit 9d6e6cd
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 7 deletions.
24 changes: 24 additions & 0 deletions nucleus/javascript/edit_date.js
@@ -0,0 +1,24 @@

function edit_form_change_date_ByValue( list )
{
var id_lists = new Array("inputyear", "inputmonth", "inputday",
"inputhour", "inputminutes");
var i,e,v;
for(i =0; i<=id_lists.length-1; i++)
{
e = document.getElementById( id_lists[i] );
if ((e != null) && (e != undefined))
{
v = (i > list.length-1) ? "" : list[i];
e.value = (v != null) ? v : "";
}
}
}

function edit_form_change_date_now()
{
var e_now = new Date;
edit_form_change_date_ByValue( new Array( e_now.getFullYear(),
e_now.getMonth()+1, e_now.getDate(),
e_now.getHours(), e_now.getMinutes() ) );
}
17 changes: 10 additions & 7 deletions nucleus/language/japanese-utf8.php 100755 → 100644
Expand Up @@ -16,13 +16,16 @@

// Note for Japanese users
// このファイルは Nucleus の UTF-8 版日本語ランゲージファイルです。

/********************************************
* Start New for 3.64 *
********************************************/
define('_ERROR_USER_TOO_LONG', '名前を40文字以内で入力してください。');
define('_ERROR_EMAIL_TOO_LONG', 'eメールを40文字以内で入力してください。');
define('_ERROR_URL_TOO_LONG', 'ウェブサイトを40文字以内で入力してください。');

define('_ADD_DATEINPUTNOW', '現在時刻');
define('_ADD_DATEINPUTRESET', 'リセット');

/********************************************
* Start New for 3.64 *
********************************************/
define('_ERROR_USER_TOO_LONG', '名前を40文字以内で入力してください。');
define('_ERROR_EMAIL_TOO_LONG', 'eメールを40文字以内で入力してください。');
define('_ERROR_URL_TOO_LONG', 'ウェブサイトを40文字以内で入力してください。');

/********************************************
* Start New for 3.62 *
Expand Down
14 changes: 14 additions & 0 deletions nucleus/libs/include/admin-add.template 100755 → 100644
Expand Up @@ -2,6 +2,7 @@

<%init%>
<script type="text/javascript" src="javascript/numbercheck.js"></script>
<script type="text/javascript" src="javascript/edit_date.js"></script>
<%ifautosave()%><script type="text/javascript" src="javascript/xmlhttprequest.js"></script><%endif%>

<form id="addform" method="post" action="index.php" >
Expand Down Expand Up @@ -71,6 +72,9 @@
<input id="inputminutes" name="minutes" tabindex="67" size="2" value="<%currenttime(minutes)%>" onchange="document.forms[0].act_future.checked=true;" /><%text(_ITEM_ADDEDITTEMPLATE_MINUTE)%>
<br /><%text(_ITEM_ADDEDITTEMPLATE_FORMAT)%>(yyyy)<%text(_ITEM_ADDEDITTEMPLATE_YEAR)%>(mm)<%text(_ITEM_ADDEDITTEMPLATE_MONTH)%>(dd)<%text(_ITEM_ADDEDITTEMPLATE_DAY)%> (hh)<%text(_ITEM_ADDEDITTEMPLATE_HOUR)%>(mm)<%text(_ITEM_ADDEDITTEMPLATE_MINUTE)%>

<input tabindex="68" type="button" value="<%text(_ADD_DATEINPUTNOW)%>" onclick = 'document.forms[0].act_future.checked=true; return edit_form_change_date_now();' />
<input tabindex="69" type="button" value="<%text(_ADD_DATEINPUTRESET)%>" onclick = 'return date_currenttime_reset();' />

<%ifblogsetting(ballowpast,0)%>
<br />
<%text(_ADD_NOPASTDATES)%>
Expand Down Expand Up @@ -143,3 +147,13 @@
var formtype = 'add'; // Add or edit form
</script>
<%endif%>

<script type="text/javascript">
// datetime reset functions
function date_currenttime_reset( )
{
edit_form_change_date_ByValue( new Array(
"<%currenttime(year)%>", "<%currenttime(mon)%>", "<%currenttime(mday)%>",
"<%currenttime(hours)%>", "<%currenttime(minutes)%>" ) );
}
</script>
21 changes: 21 additions & 0 deletions nucleus/libs/include/admin-edit.template 100755 → 100644
Expand Up @@ -2,6 +2,7 @@

<%init%>
<script type="text/javascript" src="javascript/numbercheck.js"></script>
<script type="text/javascript" src="javascript/edit_date.js"></script>
<%ifautosave()%><script type="text/javascript" src="javascript/xmlhttprequest.js"></script><%endif%>

<form id="editform" method="post" action="index.php">
Expand Down Expand Up @@ -71,6 +72,8 @@
<input id="inputhour" name="hour" tabindex="74" size="2" value="<%currenttime(hours)%>" onchange="document.forms[0].act_future.checked=true;" /><%text(_ITEM_ADDEDITTEMPLATE_HOUR)%>
<input id="inputminutes" name="minutes" tabindex="75" size="2" value="<%currenttime(minutes)%>" onchange="document.forms[0].act_future.checked=true;" /><%text(_ITEM_ADDEDITTEMPLATE_MINUTE)%>
<br /><%text(_ITEM_ADDEDITTEMPLATE_FORMAT)%>(yyyy)<%text(_ITEM_ADDEDITTEMPLATE_YEAR)%>(mm)<%text(_ITEM_ADDEDITTEMPLATE_MONTH)%>(dd)<%text(_ITEM_ADDEDITTEMPLATE_DAY)%> (hh)<%text(_ITEM_ADDEDITTEMPLATE_HOUR)%>(mm)<%text(_ITEM_ADDEDITTEMPLATE_MINUTE)%>
<input tabindex="76" type="button" value="<%text(_ADD_DATEINPUTNOW)%>" onclick = 'document.forms[0].act_future.checked=true; return edit_form_change_date_now();' />
<input tabindex="77" type="button" value="<%text(_ADD_DATEINPUTRESET)%>" onclick = 'return date_currenttime_reset();' />
<%ifblogsetting(ballowpast,0)%>
<br />
<%text(_ADD_NOPASTDATES)%>
Expand All @@ -95,6 +98,8 @@
<input id="inputhour" name="hour" tabindex="74" size="2" value="<%itemtime(hours)%>" onchange="document.forms[0].act_changedate.checked=true;" /><%text(_ITEM_ADDEDITTEMPLATE_HOUR)%>
<input id="inputminutes" name="minutes" tabindex="75" size="2" value="<%itemtime(minutes)%>" onchange="document.forms[0].act_changedate.checked=true;" /><%text(_ITEM_ADDEDITTEMPLATE_MINUTE)%>
<br /><%text(_ITEM_ADDEDITTEMPLATE_FORMAT)%>(yyyy)<%text(_ITEM_ADDEDITTEMPLATE_YEAR)%>(mm)<%text(_ITEM_ADDEDITTEMPLATE_MONTH)%>(dd)<%text(_ITEM_ADDEDITTEMPLATE_DAY)%> (hh)<%text(_ITEM_ADDEDITTEMPLATE_HOUR)%>(mm)<%text(_ITEM_ADDEDITTEMPLATE_MINUTE)%>
<input tabindex="76" type="button" value="<%text(_ADD_DATEINPUTNOW)%>" onclick = 'document.forms[0].act_changedate.checked=true; return edit_form_change_date_now();' />
<input tabindex="77" type="button" value="<%text(_ADD_DATEINPUTRESET)%>" onclick = 'return date_itemtime_reset();' />
</div>
<%endif%>
<input name="actiontype" value="backtodrafts" type="radio" id="act_backtodrafts" tabindex="71" /><label for="act_backtodrafts"><%text(_BMLET_BACKTODRAFTS)%></label> <%helplink(draft)%>
Expand Down Expand Up @@ -167,3 +172,19 @@
var lastsavedtext = '<%text(_AUTOSAVEDRAFT_LASTSAVED)%>'; // The language variable for 'Last saved'
var formtype = 'edit'; // Add or edit form
</script><%endif%>

<script type="text/javascript">
// datetime reset functions
function date_currenttime_reset( )
{
edit_form_change_date_ByValue( new Array(
"<%currenttime(year)%>", "<%currenttime(mon)%>", "<%currenttime(mday)%>",
"<%currenttime(hours)%>", "<%currenttime(minutes)%>" ) );
}
function date_itemtime_reset( )
{
edit_form_change_date_ByValue( new Array(
"<%itemtime(year)%>", "<%itemtime(mon)%>", "<%itemtime(mday)%>",
"<%itemtime(hours)%>", "<%itemtime(minutes)%>" ) );
}
</script>
13 changes: 13 additions & 0 deletions nucleus/libs/include/bookmarklet-add.template 100755 → 100644
Expand Up @@ -20,6 +20,7 @@
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script type="text/javascript" src="javascript/bookmarklet.js"></script>
<script type="text/javascript" src="javascript/edit.js"></script>
<script type="text/javascript" src="javascript/edit_date.js"></script>
<script type="text/javascript" src="javascript/numbercheck.js"></script>
<%ifautosave()%><script type="text/javascript" src="javascript/xmlhttprequest.js"></script><%endif%>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
Expand Down Expand Up @@ -125,6 +126,8 @@
<input class="addFuture" id="inputhour" name="hour" size="2" value="<%currenttime(hours)%>" tabindex="100" /><%text(_ITEM_ADDEDITTEMPLATE_HOUR)%>
<input class="addFuture" id="inputminutes" name="minutes" size="2" value="<%currenttime(minutes)%>" tabindex="110" /><%text(_ITEM_ADDEDITTEMPLATE_MINUTE)%>
<br /><%text(_ITEM_ADDEDITTEMPLATE_FORMAT)%>(yyyy)<%text(_ITEM_ADDEDITTEMPLATE_YEAR)%>(mm)<%text(_ITEM_ADDEDITTEMPLATE_MONTH)%>(dd)<%text(_ITEM_ADDEDITTEMPLATE_DAY)%> (hh)<%text(_ITEM_ADDEDITTEMPLATE_HOUR)%>(mm)<%text(_ITEM_ADDEDITTEMPLATE_MINUTE)%>
<input tabindex="120" type="button" value="<%text(_ADD_DATEINPUTNOW)%>" onclick = 'document.forms[0].act_future.checked=true; return edit_form_change_date_now();' />
<input tabindex="121" type="button" value="<%text(_ADD_DATEINPUTRESET)%>" onclick = 'return date_currenttime_reset();' />
<%ifblogsetting(ballowpast,0)%><br /><%text(_ADD_NOPASTDATES)%><%endif%>
</div>
</li>
Expand Down Expand Up @@ -170,5 +173,15 @@
var lastsavedtext = '<%text(_AUTOSAVEDRAFT_LASTSAVED)%>'; // The language variable for 'Last saved'
var formtype = 'add'; // Add or edit form
</script><%endif%>

<script type="text/javascript">
// datetime reset functions
function date_currenttime_reset( )
{
edit_form_change_date_ByValue( new Array(
"<%currenttime(year)%>", "<%currenttime(mon)%>", "<%currenttime(mday)%>",
"<%currenttime(hours)%>", "<%currenttime(minutes)%>" ) );
}
</script>
</body>
</html>
13 changes: 13 additions & 0 deletions nucleus/libs/include/bookmarklet-edit.template 100755 → 100644
Expand Up @@ -20,6 +20,7 @@
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script type="text/javascript" src="javascript/bookmarklet.js"></script>
<script type="text/javascript" src="javascript/edit.js"></script>
<script type="text/javascript" src="javascript/edit_date.js"></script>
<script type="text/javascript" src="javascript/numbercheck.js"></script>
<%ifautosave()%><script type="text/javascript" src="javascript/xmlhttprequest.js"></script><%endif%>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
Expand Down Expand Up @@ -126,6 +127,8 @@
<input class="chgDate" id="inputhour" name="hour" size="2" value="<%itemtime(hours)%>" tabindex="100" /><%text(_ITEM_ADDEDITTEMPLATE_HOUR)%>
<input class="chgDate" id="inputminutes" name="minutes" size="2" value="<%itemtime(minutes)%>" tabindex="110" /><%text(_ITEM_ADDEDITTEMPLATE_MINUTE)%>
<br /><%text(_ITEM_ADDEDITTEMPLATE_FORMAT)%>(yyyy)<%text(_ITEM_ADDEDITTEMPLATE_YEAR)%>(mm)<%text(_ITEM_ADDEDITTEMPLATE_MONTH)%>(dd)<%text(_ITEM_ADDEDITTEMPLATE_DAY)%> (hh)<%text(_ITEM_ADDEDITTEMPLATE_HOUR)%>(mm)<%text(_ITEM_ADDEDITTEMPLATE_MINUTE)%>
<input tabindex="120" type="button" value="<%text(_ADD_DATEINPUTNOW)%>" onclick = 'document.forms[0].act_changedate.checked=true; return edit_form_change_date_now();' />
<input tabindex="121" type="button" value="<%text(_ADD_DATEINPUTRESET)%>" onclick = 'return date_itemtime_reset();' />
</div>
</li><%endif%>
<li>
Expand Down Expand Up @@ -170,5 +173,15 @@
var lastsavedtext = '<%text(_AUTOSAVEDRAFT_LASTSAVED)%>'; // The language variable for 'Last saved'
var formtype = 'edit'; // Add or edit form
</script><%endif%>

<script type="text/javascript">
// datetime reset functions
function date_itemtime_reset( )
{
edit_form_change_date_ByValue( new Array(
"<%itemtime(year)%>", "<%itemtime(mon)%>", "<%itemtime(mday)%>",
"<%itemtime(hours)%>", "<%itemtime(minutes)%>" ) );
}
</script>
</body>
</html>

0 comments on commit 9d6e6cd

Please sign in to comment.