From e2fe23c5814baa624a42c353e97e1234af264823 Mon Sep 17 00:00:00 2001 From: "chencongzhi520@gmail.com" Date: Fri, 8 Jun 2012 02:47:49 +0000 Subject: [PATCH] * remove todo-batchedit as plugin. --- module/group/lang/resource.php | 2 - module/my/view/todo.html.php | 15 +++--- module/todo/control.php | 83 ----------------------------- module/todo/lang/en.php | 1 - module/todo/lang/zh-cn.php | 1 - module/todo/model.php | 59 -------------------- module/todo/view/batchedit.html.php | 62 --------------------- 7 files changed, 7 insertions(+), 216 deletions(-) delete mode 100755 module/todo/view/batchedit.html.php diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index f0daff64dd..29e236148f 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -30,7 +30,6 @@ $lang->resource->my->changePassword = 'changePassword'; /* Todo. */ $lang->resource->todo->create = 'create'; $lang->resource->todo->batchCreate = 'batchCreate'; -$lang->resource->todo->batchEdit = 'batchEdit'; $lang->resource->todo->edit = 'edit'; $lang->resource->todo->view = 'view'; $lang->resource->todo->delete = 'delete'; @@ -376,7 +375,6 @@ $lang->changelog['3.0.beta2'][] = 'project-order'; $lang->changelog['3.1'][] = 'todo-batchCreate'; $lang->changelog['3.2'][] = 'my-changePassword'; -$lang->changelog['3.2'][] = 'todo-batchEdit'; $lang->changelog['3.2'][] = 'story-batchEdit'; $lang->changelog['3.2'][] = 'story-batchClose'; $lang->changelog['3.2'][] = 'task-batchEdit'; diff --git a/module/my/view/todo.html.php b/module/my/view/todo.html.php index c5301cb059..acf723b89b 100644 --- a/module/my/view/todo.html.php +++ b/module/my/view/todo.html.php @@ -57,7 +57,12 @@ - id; ?> + + + + + id; ?> + date == '2030-01-01' ? $lang->todo->dayInFuture : $todo->date;?> todo->typeList->{$todo->type};?> pri;?> @@ -82,15 +87,9 @@
createLink('todo', 'batchEdit', "from=myTodo&type=$type&account=$account&status=$status"); - echo html::commonButton($lang->todo->batchEdit, "onclick=\"changeAction('todoform', 'batchEdit', '$actionLink')\""); - - } if(common::hasPriv('todo', 'import2Today') and $importFuture) { + echo html::selectAll() . html::selectReverse(); $actionLink = $this->createLink('todo', 'import2Today'); echo html::commonButton($lang->todo->import2Today, "onclick=\"changeAction('todoform', 'import2Today', '$actionLink')\""); } diff --git a/module/todo/control.php b/module/todo/control.php index 8f967cc1a6..a2f8ebc8e6 100644 --- a/module/todo/control.php +++ b/module/todo/control.php @@ -123,89 +123,6 @@ class todo extends control $this->display(); } - /** - * Batch edit todo. - * - * @param string $from example:myTodo, todoBatchEdit. - * @param string $type - * @param string $account - * @param string $status - * @access public - * @return void - */ - public function batchEdit($from = '', $type = 'today', $account = '', $status = 'all') - { - /* Get form data for my-todo. */ - if($from == 'myTodo') - { - /* Initialize vars. */ - $editedTodos = array(); - $todoIDList = array(); - $columns = 7; - $showSuhosinInfo = false; - - if($account == '') $account = $this->app->user->account; - $bugs = $this->bug->getUserBugPairs($account); - $tasks = $this->task->getUserTaskPairs($account, $status); - $allTodos = $this->todo->getList($type, $account, $status); - if($this->post->todoIDList) $todoIDList = $this->post->todoIDList; - - /* Initialize todos whose need to edited. */ - foreach($allTodos as $todo) - { - if(in_array($todo->id, $todoIDList)) - { - $editedTodos[$todo->id] = $todo; - } - } - foreach($editedTodos as $todo) - { - if($todo->type == 'task') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name'); - if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title'); - $todo->date = str_replace('-', '', $todo->date); - $todo->begin = str_replace(':', '', $todo->begin); - $todo->end = str_replace(':', '', $todo->end); - } - - /* Judge whether the edited todos is too large. */ - $showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($editedTodos), $columns); - - /* Set the sessions. */ - $this->app->session->set('showSuhosinInfo', $showSuhosinInfo); - - /* Assign. */ - $header['title'] = $this->lang->my->common . $this->lang->colon . $this->lang->todo->batchEdit; - $position[] = $this->lang->todo->common; - $position[] = $this->lang->todo->batchEdit; - - if($showSuhosinInfo) $this->view->suhosinInfo = $this->lang->suhosinInfo; - $this->view->bugs = $bugs; - $this->view->tasks = $tasks; - $this->view->editedTodos = $editedTodos; - $this->view->times = $this->todo->buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); - $this->view->time = $this->todo->now(); - $this->view->header = $header; - $this->view->position = $position; - - $this->display(); - } - /* Get form data from todo-batchEdit. */ - elseif($from == 'todoBatchEdit') - { - $allChanges = $this->todo->batchUpdate(); - foreach($allChanges as $todoID => $changes) - { - if(!empty($changes)) - { - $actionID = $this->loadModel('action')->create('todo', $todoID, 'edited'); - $this->action->logHistory($actionID, $changes); - } - } - - die(js::locate($this->session->todoList, 'parent')); - } - } - /** * View a todo. * diff --git a/module/todo/lang/en.php b/module/todo/lang/en.php index 369dc5bbfe..34591c0474 100644 --- a/module/todo/lang/en.php +++ b/module/todo/lang/en.php @@ -13,7 +13,6 @@ $lang->todo->common = 'TODO'; $lang->todo->index = "Index"; $lang->todo->create = "Create"; $lang->todo->batchCreate = "Batch create"; -$lang->todo->batchEdit = "Batch edit"; $lang->todo->edit = "Edit"; $lang->todo->view = "Info"; $lang->todo->viewAB = "Info"; diff --git a/module/todo/lang/zh-cn.php b/module/todo/lang/zh-cn.php index 5bfc659b19..732e03744f 100644 --- a/module/todo/lang/zh-cn.php +++ b/module/todo/lang/zh-cn.php @@ -13,7 +13,6 @@ $lang->todo->common = 'TODO'; $lang->todo->index = "todo一览"; $lang->todo->create = "新增TODO"; $lang->todo->batchCreate = "批量添加"; -$lang->todo->batchEdit = "批量编辑"; $lang->todo->edit = "更新TODO"; $lang->todo->view = "TODO详情"; $lang->todo->viewAB = "详情"; diff --git a/module/todo/model.php b/module/todo/model.php index ce35100cef..23dd59f57a 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -120,65 +120,6 @@ class todoModel extends model if(!dao::isError()) return common::createChanges($oldTodo, $todo); } - /** - * Batch update todo. - * - * @access public - * @return void - */ - public function batchUpdate() - { - $todos = array(); - $allChanges = array(); - $todoIDList = $this->post->todoIDList ? $this->post->todoIDList : array(); - - /* Adjust whether the post data is complete, if not, remove the last element of $todoIDList. */ - if($this->session->showSuhosinInfo) array_pop($taskIDList); - - if(!empty($todoIDList)) - { - /* Initialize todos from the post data. */ - foreach($todoIDList as $todoID) - { - $todo->date = $this->post->dates[$todoID]; - $todo->type = $this->post->types[$todoID]; - $todo->pri = $this->post->pris[$todoID]; - $todo->name = $todo->type == 'custom' ? htmlspecialchars($this->post->names[$todoID]) : ''; - $todo->begin = $this->post->begins[$todoID]; - $todo->end = $this->post->ends[$todoID]; - if($todo->type == 'task') $todo->idvalue = isset($this->post->tasks[$todoID]) ? $this->post->tasks[$todoID] : 0; - if($todo->type == 'bug') $todo->idvalue = isset($this->post->bugs[$todoID]) ? $this->post->bugs[$todoID] : 0; - - $todos[$todoID] = $todo; - unset($todo); - } - - foreach($todos as $todoID => $todo) - { - $oldTodo = $this->getById($todoID); - if($oldTodo->type != 'custom') $oldTodo->name = ''; - $this->dao->update(TABLE_TODO)->data($todo) - ->autoCheck() - ->checkIF($todo->type == 'custom', $this->config->todo->edit->requiredFields, 'notempty') - ->checkIF($todo->type == 'bug', 'idvalue', 'notempty') - ->checkIF($todo->type == 'task', 'idvalue', 'notempty') - ->where('id')->eq($todoID) - ->exec(); - - if(!dao::isError()) - { - $allChanges[$todoID] = common::createChanges($oldTodo, $todo); - } - else - { - die(js::error('todo#' . $todoID . dao::getError(true))); - } - } - } - - return $allChanges; - } - /** * Change the status of a todo. * diff --git a/module/todo/view/batchedit.html.php b/module/todo/view/batchedit.html.php deleted file mode 100755 index 89fdf481be..0000000000 --- a/module/todo/view/batchedit.html.php +++ /dev/null @@ -1,62 +0,0 @@ - - * @package todo - * @version $Id: create.html.php 2741 2012-04-07 07:24:21Z areyou123456 $ - * @link http://www.zentao.net - */ -?> - - -
'> - - - - - - - - - - - - - - - - - - - - - - - - -
todo->batchEdit . $lang->colon;?>
idAB;?>todo->date;?>todo->type;?>todo->pri;?>todo->name;?>todo->beginAndEnd;?>
id . html::hidden("todoIDList[$todo->id]", $todo->id);?>id]", $todo->date, "class='text-1 date'");?>id]", $lang->todo->typeList, $todo->type, "onchange=loadList(this.value,$todo->id) class='select-1'");?>id]", $lang->todo->priList, $todo->pri, 'class=select-1');?> - -
- type == 'custom') - { - echo html::input("names[$todo->id]", $todo->name, "class='f-left text-1'"); echo "*"; - } - elseif($todo->type == 'task') - { - echo html::select("tasks[$todo->id]", $tasks, $todo->idvalue, 'class="select-1 f-left"'); - } - elseif($todo->type == 'bug') - { - echo html::select("bugs[$todo->id]", $bugs, $todo->idvalue, 'class="select-1 f-left"'); - } - ?> -
-
id]", $times, $todo->begin) . html::select("ends[$todo->id]", $times, $todo->end);?> -
-
- -