This commit is contained in:
chenfei
2020-07-08 16:38:14 +08:00
parent d71428b12d
commit 2eb7efb314
5 changed files with 29 additions and 22 deletions
+2 -2
View File
@@ -97,9 +97,9 @@ function setBeginsAndEnds(i, beginOrEnd)
}
}
function switchDateList(number)
function switchTimeList(number)
{
if($('#switchDate' + number).prop('checked'))
if($('#switchTime' + number).prop('checked'))
{
$('#begins' + number).attr('disabled', 'disabled').trigger('chosen:updated');
$('#ends' + number).attr('disabled', 'disabled').trigger('chosen:updated');
+19 -12
View File
@@ -99,6 +99,8 @@ class todoModel extends model
public function batchCreate()
{
$todos = fixer::input('post')->get();
$validTodos = array();
for($i = 0; $i < $this->config->todo->batchCreate; $i++)
{
if($todos->names[$i] != '' || isset($todos->bugs[$i + 1]) || isset($todos->tasks[$i + 1]))
@@ -126,17 +128,9 @@ class todoModel extends model
if($todo->type == 'task') $todo->idvalue = isset($todos->tasks[$i + 1]) ? $todos->tasks[$i + 1] : 0;
if($todo->type == 'story') $todo->idvalue = isset($todos->storys[$i + 1]) ? $todos->storys[$i + 1] : 0;
if($todo->end <= $todo->begin) die(js::alert(sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin)));
if($todo->end < $todo->begin) die(js::alert(sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin)));
$this->dao->insert(TABLE_TODO)->data($todo)->autoCheck()->exec();
if(dao::isError())
{
echo js::error(dao::getError());
die(js::reload('parent'));
}
$todoID = $this->dao->lastInsertID();
$this->loadModel('score')->create('todo', 'create', $todoID);
$this->loadModel('action')->create('todo', $todoID, 'opened');
$validTodos[] = $todo;
}
else
{
@@ -148,6 +142,19 @@ class todoModel extends model
unset($todos->ends[$i]);
}
}
foreach($validTodos as $todo)
{
$this->dao->insert(TABLE_TODO)->data($todo)->autoCheck()->exec();
if(dao::isError())
{
echo js::error(dao::getError());
die(js::reload('parent'));
}
$todoID = $this->dao->lastInsertID();
$this->loadModel('score')->create('todo', 'create', $todoID);
$this->loadModel('action')->create('todo', $todoID, 'opened');
}
}
/**
@@ -173,7 +180,7 @@ class todoModel extends model
->remove('uid')
->get();
if($todo->end <= $todo->begin)
if($todo->end < $todo->begin)
{
dao::$errors[] = sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin);
return false;
@@ -247,7 +254,7 @@ class todoModel extends model
if($todo->type == 'bug') $todo->idvalue = isset($data->bugs[$todoID]) ? $data->bugs[$todoID] : 0;
if($todo->type == 'story')$todo->idvalue = isset($data->storys[$todoID]) ? $data->storys[$todoID] : 0;
if($todo->end <= $todo->begin) die(js::alert(sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin)));
if($todo->end < $todo->begin) die(js::alert(sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin)));
$todos[$todoID] = $todo;
}
+4 -4
View File
@@ -25,10 +25,10 @@
<h2><?php echo $lang->todo->batchCreate . $lang->todo->common;?></h2>
<div class="input-group pull-left">
<span class="input-group-addon"><?php echo $lang->todo->date;?></span>
<input type="text" name="date" value="<?php echo $date;?>" class="form-control form-date" autocomplete="off" />
<input type="text" name="date" id='date' value="<?php echo $date;?>" class="form-control form-date" autocomplete="off" />
<span class="input-group-addon">
<div class="checkbox-primary">
<input type="checkbox" name="switchDate" id='switchDate' class="control-time-switch" />
<input type='checkbox' name='switchDate' id='switchDate' class='control-time-switch 'onclick='switchDateTodo(this);' />
<label for='switchDate'><?php echo $lang->todo->periods['future'];?></label>
</div>
</span>
@@ -77,8 +77,8 @@
</td>
<td <?php echo zget($visibleFields, 'beginAndEnd', "class='hidden'")?> style='overflow:visible'>
<div class='checkbox-primary'>
<input type='checkbox' name="switchDate[<?php echo $i?>]" id="switchDate<?php echo $i?>" class='control-time-switch' onclick='switchDateList(<?php echo $i?>);' />
<label for="switchDate<?php echo $i?>"> <?php echo $lang->todo->periods['future'];?></label>
<input type='checkbox' name="switchTime[<?php echo $i?>]" id="switchTime<?php echo $i?>" class='control-time-switch' onclick='switchTimeList(<?php echo $i?>);' />
<label for="switchTime<?php echo $i?>"> <?php echo $lang->todo->periods['future'];?></label>
</div>
</td>
</tr>
+2 -2
View File
@@ -87,8 +87,8 @@
?>
<span class="input-group-addon">
<div class='checkbox-primary dateSwitcher'>
<input type='checkbox' name="switchDate[<?php echo $todo->id;?>]" id="switchDate<?php echo $todo->id;?>" data-key="<?php echo $todo->id;?>" onclick='switchDateList(<?php echo $todo->id?>);' <?php if($todo->begin == '2400') echo "checked='checked'";?>>
<label for='switchDate'><?php echo $lang->todo->periods['future'];?></label>
<input type='checkbox' name="switchTime[<?php echo $todo->id;?>]" id="switchTime<?php echo $todo->id;?>" data-key="<?php echo $todo->id;?>" onclick='switchTimeList(<?php echo $todo->id?>);' <?php if($todo->begin == '2400') echo "checked='checked'";?>>
<label for='switchTime'><?php echo $lang->todo->periods['future'];?></label>
</div>
</span>
</div>
+2 -2
View File
@@ -116,8 +116,8 @@
</td>
<td>
<div class='checkbox-primary'>
<input type='checkbox' id='switchDate' onclick='switchDateFeature(this);' />
<label for='switchDate'><?php echo $lang->todo->lblDisableDate;?></label>
<input type='checkbox' name='switchTime' id='switchTime' onclick='switchDateFeature(this);' />
<label for='switchTime'><?php echo $lang->todo->lblDisableDate;?></label>
</div>
</td>
</tr>