diff --git a/module/user/control.php b/module/user/control.php index 8308db97b5..2d9a2e1466 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -39,15 +39,18 @@ class user extends control } /* 用户的todo列表。*/ - public function todo($account, $date = 'today', $status = 'all') + public function todo($account, $type = 'today', $status = 'all') { /* 加载todo model。*/ $this->loadModel('todo'); $this->lang->set('menugroup.user', 'company'); $user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch(); - $todos = $this->todo->getList($date, $account, $status); - if((int)$date == 0) $date = $this->todo->today(); + /* 设置菜单。*/ + $this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account); + + $todos = $this->todo->getList($type, $account, $status); + $date = (int)$type == 0 ? $this->todo->today() : $type; /* 设定header和position信息。*/ $header['title'] = $this->lang->company->orgView . $this->lang->colon . $this->lang->user->todo; @@ -61,6 +64,8 @@ class user extends control $this->assign('date', $date); $this->assign('todos', $todos); $this->assign('user', $user); + $this->assign('account', $account); + $this->assign('type', $type); $this->display(); } @@ -72,6 +77,9 @@ class user extends control $this->loadModel('task'); $this->lang->set('menugroup.user', 'company'); $user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch(); + + /* 设置菜单。*/ + $this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account); /* 设定header和position信息。*/ $header['title'] = $this->lang->user->common . $this->lang->colon . $this->lang->user->task; @@ -95,6 +103,9 @@ class user extends control $this->lang->set('menugroup.user', 'company'); $user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch(); + /* 设置菜单。*/ + $this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account); + /* 设定header和position信息。*/ $header['title'] = $this->lang->user->common . $this->lang->colon . $this->lang->user->bug; $position[] = $this->lang->user->bug; @@ -117,6 +128,9 @@ class user extends control $this->lang->set('menugroup.user', 'company'); $user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch(); + /* 设置菜单。*/ + $this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account); + /* 设定header和position信息。*/ $header['title'] = $this->lang->user->common . $this->lang->colon . $this->lang->user->project; $position[] = $this->lang->user->project; @@ -131,6 +145,21 @@ class user extends control $this->display(); } + /* 查看个人档案。*/ + public function profile($account) + { + $header['title'] = $this->lang->user->common . $this->lang->colon . $this->lang->user->profile; + $position[] = $this->lang->user->profile; + + /* 设置菜单。*/ + $this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account); + + $this->assign('header', $header); + $this->assign('position', $position); + $this->assign('user', $this->user->getById($account)); + + $this->display(); + } /* 设置referer信息。*/ private function setReferer($referer = 0) @@ -146,7 +175,7 @@ class user extends control } /* 创建一个用户。*/ - public function create($companyID = 0, $from = 'admin') + public function create($companyID = 0, $deptID = 0, $from = 'admin') { if($companyID == 0) $companyID = $this->app->company->id; $this->lang->set('menugroup.user', $from); @@ -171,6 +200,7 @@ class user extends control $this->assign('header', $header); $this->assign('position', $position); $this->assign('depts', $this->dept->getOptionMenu()); + $this->assign('deptID', $deptID); $this->display(); } @@ -179,6 +209,7 @@ class user extends control public function edit($userID, $from = 'admin') { $this->lang->set('menugroup.user', $from); + $this->lang->user->menu = $this->lang->company->menu; if(!empty($_POST)) { $this->user->update($userID); diff --git a/module/user/lang/zh-cn.php b/module/user/lang/zh-cn.php index 3152d3e89a..2179cd3f70 100644 --- a/module/user/lang/zh-cn.php +++ b/module/user/lang/zh-cn.php @@ -39,6 +39,7 @@ $lang->user->confirmDelete = "鎮ㄧ‘璁ゅ垹闄よ鐢ㄦ埛鍚楋紵"; $lang->user->relogin = "閲嶆柊鐧婚檰"; $lang->user->asGuest = "娓稿璁块棶"; $lang->user->goback = "杩斿洖鍓嶄竴椤�"; +$lang->user->allUsers = '鍏ㄩ儴鐢ㄦ埛'; $lang->user->profile = '鐢ㄦ埛妗f'; $lang->user->project = '鐢ㄦ埛椤圭洰'; diff --git a/module/user/model.php b/module/user/model.php index 081c4bbf65..ef746ddbbb 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -25,6 +25,18 @@ lang->user->menu, 'account', $selectHtml); + common::setMenuVars($this->lang->user->menu, 'todo', $account); + common::setMenuVars($this->lang->user->menu, 'task', $account); + common::setMenuVars($this->lang->user->menu, 'bug', $account); + common::setMenuVars($this->lang->user->menu, 'project', $account); + common::setMenuVars($this->lang->user->menu, 'profile', $account); + } + /* 获得某一个公司的用户列表。*/ public function getList($companyID) { @@ -69,16 +81,23 @@ class userModel extends model /* 新增一个用户。*/ function create($companyID) { + /* 先检查密码是否符合规则。*/ + if(!$this->checkPassword()) return; + $user = fixer::input('post') ->add('company', (int)$companyID) ->setDefault('join', '0000-00-00') - ->setForce('password', md5($this->post->password)) + ->setIF($this->post->password1 != false, 'password', md5($this->post->password1)) + ->setIF($this->post->password1 == false, 'password', '') + ->remove('password1, password2') ->get(); + $this->dao->insert(TABLE_USER)->data($user) ->autoCheck() ->batchCheck('account, realname, password', 'notempty') ->check('account', 'unique') ->check('account', 'account') + ->checkIF($this->post->email != false, 'email', 'email') ->exec(); } @@ -92,15 +111,16 @@ class userModel extends model $userID = (int)$userID; $user = fixer::input('post') ->setDefault('join', '0000-00-00') - ->setIF($this->post->password1 != '', 'password', md5($this->post->password1)) + ->setIF($this->post->password1 != false, 'password', md5($this->post->password1)) ->remove('password1, password2') ->get(); $this->dao->update(TABLE_USER)->data($user) ->autoCheck() - ->batchCheck('account, realname, password', 'notempty') + ->batchCheck('account, realname', 'notempty') ->check('account', 'unique', "id != '$userID'") ->check('account', 'account') + ->checkIF($this->post->email != false, 'email', 'email') ->where('id')->eq((int)$userID) ->exec(); } @@ -110,8 +130,8 @@ class userModel extends model { if($this->post->password1 != false) { - if($this->post->password1 != $this->post->password2) dao::$errors['password'] = $this->lang->error->passwordsame; - if(!validater::checkReg($this->post->password1, '|(.){6,}|')) dao::$errors['password'] = $this->lang->error->passwordrule; + if($this->post->password1 != $this->post->password2) dao::$errors['password'][] = $this->lang->error->passwordsame; + if(!validater::checkReg($this->post->password1, '|(.){6,}|')) dao::$errors['password'][] = $this->lang->error->passwordrule; } return !dao::isError(); } diff --git a/module/user/view/bug.html.php b/module/user/view/bug.html.php index b6a9a271bc..d98321d92d 100644 --- a/module/user/view/bug.html.php +++ b/module/user/view/bug.html.php @@ -22,31 +22,34 @@ * @link http://www.zentao.cn */ ?> - - - - - - - - - - - - - - - - - - - - - - - - - - -
bug->id;?>bug->severity;?>bug->title;?>bug->openedBy;?>bug->assignedTo;?>bug->resolvedBy;?>bug->resolution;?>
createLink('bug', 'view', "bugID=$bug->id"), $bug->id, '_blank');?>severity?>title;?>openedBy;?>assignedTo;?>resolvedBy;?>resolution;?>
- + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bug->id;?>bug->severity;?>bug->title;?>bug->openedBy;?>bug->assignedTo;?>bug->resolvedBy;?>bug->resolution;?>
createLink('bug', 'view', "bugID=$bug->id"), $bug->id, '_blank');?>severity?>title;?>openedBy;?>assignedTo;?>resolvedBy;?>resolution;?>
+
+ diff --git a/module/user/view/create.html.php b/module/user/view/create.html.php index 8db57ee8c9..5b7e7339d9 100644 --- a/module/user/view/create.html.php +++ b/module/user/view/create.html.php @@ -23,15 +23,14 @@ */ ?> -
+
- +
- - @@ -54,12 +53,14 @@ - + - + + + + +
user->create;?>
user->dept;?> +
user->account;?>
user->password;?>
- - user->password2;?>
diff --git a/module/user/view/edit.html.php b/module/user/view/edit.html.php index 565ff78f65..8183e5c568 100644 --- a/module/user/view/edit.html.php +++ b/module/user/view/edit.html.php @@ -23,15 +23,14 @@ */ ?> -
+
- + - @@ -54,8 +53,13 @@ - + + + + + +
user->create;?>user->edit;?>
user->dept;?> dept);?>
user->account;?>
user->password;?>
user->password2;?>
diff --git a/module/user/view/footer.html.php b/module/user/view/footer.html.php deleted file mode 100644 index 8616716727..0000000000 --- a/module/user/view/footer.html.php +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/module/user/view/header.html.php b/module/user/view/header.html.php deleted file mode 100644 index a86d558935..0000000000 --- a/module/user/view/header.html.php +++ /dev/null @@ -1,103 +0,0 @@ -. - * - * @copyright Copyright: 2009 Chunsheng Wang - * @author Chunsheng Wang - * @package dashboard - * @version $Id$ - * @link http://www.zentao.cn - */ -?> - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
user->profile;?>
user->account;?>account;?>
user->realname;?>realname;?>
user->nickname;?>nickname;?>
user->join;?>join;?>
user->visits;?>visits;?>
user->ip;?>ip;?>
user->last;?>last);?>
-
- createLink('user', 'edit', "userID=$user->id&from=company"), $lang->user->editProfile); - ?> -
-
-
-
-
-
    - {$user->realname}"; - echo "
  • " . html::a($this->createLink('user', 'todo', "account=$user->account"), $lang->user->todo) . "
  • "; - echo "
  • " . html::a($this->createLink('user', 'task', "account=$user->account"), $lang->user->task) . "
  • "; - echo "
  • ". html::a($this->createLink('user', 'project', "account=$user->account"), $lang->user->project) . "
  • "; - echo "
  • " . html::a($this->createLink('user', 'bug', "account=$user->account"), $lang->user->bug) . "
  • "; - echo << -$("#{$tabID}tab").addClass('active'); - -EOT; - ?> -
-
- -
- createLink('user', 'todo', "account=$user->account&date=today"), $lang->todo->todayTodos); - echo html::a($this->createLink('user', 'todo', "account=$user->account&date=thisweek"), $lang->todo->thisWeekTodos); - echo html::a($this->createLink('user', 'todo', "account=$user->account&date=lastweek"), $lang->todo->lastWeekTodos); - echo html::a($this->createLink('user', 'todo', "account=$user->account&date=all"), $lang->todo->allDaysTodos); - echo html::a($this->createLink('user', 'todo', "account=$user->account&date=before&account={$user->account}&status=wait,doing"), $lang->todo->allUndone); - echo html::select('date', $dates, $date, 'onchange=changeDate(this.value)'); - ?> -
- diff --git a/module/user/view/profile.html.php b/module/user/view/profile.html.php new file mode 100644 index 0000000000..6db22ec6b2 --- /dev/null +++ b/module/user/view/profile.html.php @@ -0,0 +1,64 @@ +. + * + * @copyright Copyright: 2009 Chunsheng Wang + * @author Chunsheng Wang + * @package user + * @version $Id$ + * @link http://www.zentao.cn + */ +?> + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
user->profile;?>
user->account;?>account;?>
user->realname;?>realname;?>
user->nickname;?>nickname;?>
user->email;?>email;?>
user->join;?>join;?>
user->visits;?>visits;?>
user->ip;?>ip;?>
user->last;?>last;?>
+
+ diff --git a/module/user/view/project.html.php b/module/user/view/project.html.php index c39af4779f..ca1ea7e79e 100644 --- a/module/user/view/project.html.php +++ b/module/user/view/project.html.php @@ -22,33 +22,36 @@ * @link http://www.zentao.cn */ ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
project->name;?>project->code;?>project->begin;?>project->end;?>project->status;?>team->role;?>team->joinDate;?>team->workingHour;?>
createLink('project', 'browse', "projectID=$project->id"), $project->name);?>code;?>begin;?>end;?>status;?>role;?>joinDate;?>workingHour;?>
- + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
project->name;?>project->code;?>project->begin;?>project->end;?>project->status;?>team->role;?>team->joinDate;?>team->workingHour;?>
createLink('project', 'browse', "projectID=$project->id"), $project->name);?>code;?>begin;?>end;?>status;?>role;?>joinDate;?>workingHour;?>
+
+ diff --git a/module/user/view/task.html.php b/module/user/view/task.html.php index 4e9f1ea18f..6dfd7dda08 100644 --- a/module/user/view/task.html.php +++ b/module/user/view/task.html.php @@ -22,33 +22,38 @@ * @link http://www.zentao.cn */ ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - -
task->name;?>task->project;?>task->story;?>task->pri;?>task->estimate;?>task->consumed;?>task->status;?>action;?>
createLink('task', 'edit', "taskID=$task->id"), $task->name);?>createLink('project', 'browse', "projectid=$task->projectID"), $task->projectName);?> - storyTitle;?>pri;?>estimate;?>consumed;?>task->statusList->{$task->status};?>createLink('task', 'edit', "taskID=$task->id"), $lang->task->edit, '_blank');?>
- + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
task->id;?>task->name;?>task->project;?>task->pri;?>task->estimate;?>task->consumed;?>task->story;?>task->status;?>action;?>
createLink('task', 'view', "taskID=$task->id"), sprintf('%03d', $task->id));?>name;?>createLink('project', 'browse', "projectid=$task->projectID"), $task->projectName);?> + pri;?>estimate;?>consumed;?>storyID) echo html::a($this->createLink('story', 'view', "storyID=$task->storyID"), $task->storyTitle);?>task->statusList->{$task->status};?>createLink('task', 'edit', "taskID=$task->id"), $lang->task->edit, '_blank');?>
+
+ diff --git a/module/user/view/todo.html.php b/module/user/view/todo.html.php index d4bd2b2523..69a84ff475 100644 --- a/module/user/view/todo.html.php +++ b/module/user/view/todo.html.php @@ -22,42 +22,60 @@ * @link http://www.zentao.cn */ ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
todo->id;?>todo->date;?>todo->type;?>todo->pri;?>todo->name;?>todo->begin;?>todo->end;?>todo->status;?>
id;?>date;?>todo->typeList->{$todo->type};?>pri;?> - type == 'bug' and common::hasPriv('bug', 'view')) $link = $this->createLink('bug', 'view', "id={$todo->idvalue}"); - if($todo->type == 'task' and common::hasPriv('task', 'edit')) $link = $this->createLink('task', 'edit', "id={$todo->idvalue}"); - $link != '' ? print(html::a($link, $todo->name, '_blank')) : print($todo->name); - ?> - begin;?>end;?>todo->statusList->{$todo->status};?>
- + + + +
+' id='todoform'> +
+
+ ' . html::a($this->createLink('user', 'todo', "account=$account&date=today"), $lang->todo->todayTodos) . ''; + echo '' . html::a($this->createLink('user', 'todo', "account=$account&date=thisweek"), $lang->todo->thisWeekTodos) . ''; + echo '' . html::a($this->createLink('user', 'todo', "account=$account&date=lastweek"), $lang->todo->lastWeekTodos) . ''; + echo '' . html::a($this->createLink('user', 'todo', "account=$account&date=all"), $lang->todo->allDaysTodos) . ''; + echo '' . html::a($this->createLink('user', 'todo', "account=$account&date=before&account={$app->user->account}&status=wait,doing"), $lang->todo->allUndone) . ''; + echo "" . html::select('date', $dates, $date, 'onchange=changeDate(this.value)') . ''; + ?> + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
todo->id;?>todo->date;?>todo->type;?>todo->pri;?>todo->name;?>todo->begin;?>todo->end;?>todo->status;?>
id;?>date;?>todo->typeList->{$todo->type};?>pri;?>name;?>begin;?>end;?>todo->statusList->{$todo->status};?>
+ +
+