* code for task#1055.
This commit is contained in:
31
module/productplan/js/create.js
Normal file
31
module/productplan/js/create.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Convert a date string like 2011-11-11 to date object in js.
|
||||
*
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return date
|
||||
*/
|
||||
function convertStringToDate(dateString)
|
||||
{
|
||||
dateString = dateString.split('-');
|
||||
dateString = dateString[1] + '/' + dateString[2] + '/' + dateString[0];
|
||||
|
||||
return Date.parse(dateString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the end date for productplan.
|
||||
*
|
||||
* @param int $delta
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function computeEndDate(delta)
|
||||
{
|
||||
beginDate = $('#begin').val();
|
||||
if(!beginDate) return;
|
||||
|
||||
endDate = convertStringToDate(beginDate).addDays(parseInt(delta));
|
||||
endDate = endDate.toString('yyyy-M-dd');
|
||||
$('#end').val(endDate);
|
||||
}
|
||||
@@ -32,3 +32,10 @@ $lang->productplan->title = 'Title';
|
||||
$lang->productplan->desc = 'Desc';
|
||||
$lang->productplan->begin = 'Begin';
|
||||
$lang->productplan->end = 'End';
|
||||
|
||||
$lang->productplan->endList[14] = 'Two Weeks';
|
||||
$lang->productplan->endList[31] = 'One Month';
|
||||
$lang->productplan->endList[62] = 'Two Months';
|
||||
$lang->productplan->endList[93] = 'Three Months';
|
||||
$lang->productplan->endList[186] = 'Half Of Year';
|
||||
$lang->productplan->endList[365] = 'One Year';
|
||||
|
||||
@@ -32,3 +32,10 @@ $lang->productplan->title = '名称';
|
||||
$lang->productplan->desc = '描述';
|
||||
$lang->productplan->begin = '开始日期';
|
||||
$lang->productplan->end = '结束日期';
|
||||
|
||||
$lang->productplan->endList[14] = '两星期';
|
||||
$lang->productplan->endList[31] = '一个月';
|
||||
$lang->productplan->endList[62] = '两个月';
|
||||
$lang->productplan->endList[93] = '三个月';
|
||||
$lang->productplan->endList[186] = '半年';
|
||||
$lang->productplan->endList[365] = '一年';
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/datepicker.html.php';?>
|
||||
<?php include '../../common/view/kindeditor.html.php';?>
|
||||
<?php js::import($jsRoot . 'misc/date.js');?>
|
||||
<form method='post' target='hiddenwin' id='dataform'>
|
||||
<table class='table-1'>
|
||||
<caption><?php echo $lang->productplan->create;?></caption>
|
||||
@@ -30,7 +31,10 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->productplan->end;?></th>
|
||||
<td><?php echo html::input('end', '', "class='text-3 date'");?></td>
|
||||
<td>
|
||||
<?php echo html::input('end', '', "class='text-3 date'");?>
|
||||
<span><?php echo html::radio('delta', $lang->productplan->endList , '', "onclick='computeEndDate(this.value)'");?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->productplan->desc;?></th>
|
||||
|
||||
Reference in New Issue
Block a user