From 6e0513ad624f10fdf7728b29e1f43c7b11f86400 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 18 Jan 2013 07:01:06 +0000 Subject: [PATCH] * refactory the logic: hasPriv then html::a instead common::printLink. --- module/bug/view/browse.custom.html.php | 4 +- module/extension/view/header.html.php | 2 +- module/file/view/printfiles.html.php | 2 +- module/my/view/todo.html.php | 18 +-- module/project/view/browse.html.php | 154 ------------------------- module/project/view/grouptask.html.php | 6 +- module/project/view/task.html.php | 10 +- module/project/view/team.html.php | 2 +- module/task/view/import.html.php | 58 ---------- 9 files changed, 21 insertions(+), 235 deletions(-) delete mode 100644 module/project/view/browse.html.php delete mode 100644 module/task/view/import.html.php diff --git a/module/bug/view/browse.custom.html.php b/module/bug/view/browse.custom.html.php index 8fd016ee96..cc3b573c2c 100644 --- a/module/bug/view/browse.custom.html.php +++ b/module/bug/view/browse.custom.html.php @@ -5,9 +5,7 @@
-
- createLink('tree', 'browse', "productID=$productID&view=bug"), $lang->tree->manage);?> -
+
tree->manage);?>
diff --git a/module/extension/view/header.html.php b/module/extension/view/header.html.php index 7221a5ad8b..ba93b6448a 100644 --- a/module/extension/view/header.html.php +++ b/module/extension/view/header.html.php @@ -7,7 +7,7 @@ echo ''. html::a(inlink('browse', "type=deactivated"), $lang->extension->deactivated) . ''; echo '' . html::a(inlink('browse', "type=available"), $lang->extension->available ) . ''; echo ' ' . html::a(inlink('obtain'), $lang->extension->obtain) . ''; - if(common::hasPriv('extension', 'upload')) echo '' . html::a(inlink('upload'), $lang->extension->upload, '', "class='iframe'") . ''; + common::printLink('extension', 'upload', '', $lang->extension->upload, '', "class='iframe'"); ?> diff --git a/module/file/view/printfiles.html.php b/module/file/view/printfiles.html.php index 488dc341d1..5fc27a1c3c 100644 --- a/module/file/view/printfiles.html.php +++ b/module/file/view/printfiles.html.php @@ -33,7 +33,7 @@ function downloadFile(fileID) foreach($files as $file) { if(common::hasPriv('file', 'download')) echo html::a($this->createLink('file', 'download', "fileID=$file->id") . $sessionString, $file->title .'.' . $file->extension, '_blank', "onclick='return downloadFile($file->id)'"); - if(common::hasPriv('file', 'edit')) echo html::a($this->createLink('file', 'edit', "fileID=$file->id"), $lang->edit, '', "class='edit'"); + common::printLink('file', 'edit', "fileID=$file->id", $lang->edit, '', "class='edit'"); if(common::hasPriv('file', 'delete')) echo html::commonButton(' x ', "onclick='deleteFile($file->id)'"); } ?> diff --git a/module/my/view/todo.html.php b/module/my/view/todo.html.php index da41f89abd..6744ef30e2 100644 --- a/module/my/view/todo.html.php +++ b/module/my/view/todo.html.php @@ -17,18 +17,18 @@
' . html::a(inlink('todo', "date=today"), $lang->todo->todayTodos) . ''; - echo ''. html::a(inlink('todo', "date=yesterday"), $lang->todo->yesterdayTodos). ''; - echo '' . html::a(inlink('todo', "date=thisweek"), $lang->todo->thisWeekTodos) . ''; - echo '' . html::a(inlink('todo', "date=lastweek"), $lang->todo->lastWeekTodos) . ''; - echo ''. html::a(inlink('todo', "date=thismonth"), $lang->todo->thismonthTodos). ''; + echo '' . html::a(inlink('todo', "date=today"), $lang->todo->todayTodos) . ''; + echo '' . html::a(inlink('todo', "date=yesterday"), $lang->todo->yesterdayTodos). ''; + echo '' . html::a(inlink('todo', "date=thisweek"), $lang->todo->thisWeekTodos) . ''; + echo '' . html::a(inlink('todo', "date=lastweek"), $lang->todo->lastWeekTodos) . ''; + echo '' . html::a(inlink('todo', "date=thismonth"), $lang->todo->thismonthTodos). ''; echo '' . html::a(inlink('todo', "date=lastmonth"), $lang->todo->lastmonthTodos). ''; echo ''. html::a(inlink('todo', "date=thisseason"),$lang->todo->thisseasonTodos).''; echo '' . html::a(inlink('todo', "date=thisyear"), $lang->todo->thisyearTodos) . ''; - echo '' . html::a(inlink('todo', "date=future"), $lang->todo->futureTodos) . ''; - echo '' . html::a(inlink('todo', "date=all"), $lang->todo->allDaysTodos) . ''; - echo '' . html::a(inlink('todo', "date=before&account={$app->user->account}&status=undone"), $lang->todo->allUndone) . ''; - echo "" . html::input('date', $date,"class='w-date date' onchange='changeDate(this.value)'") . ''; + echo '' . html::a(inlink('todo', "date=future"), $lang->todo->futureTodos) . ''; + echo '' . html::a(inlink('todo', "date=all"), $lang->todo->allDaysTodos) . ''; + echo '' . html::a(inlink('todo', "date=before&account={$app->user->account}&status=undone"), $lang->todo->allUndone) . ''; + echo "" . html::input('date', $date,"class='w-date date' onchange='changeDate(this.value)'") . ''; if($type == 'bydate') { diff --git a/module/project/view/browse.html.php b/module/project/view/browse.html.php deleted file mode 100644 index 8091e522aa..0000000000 --- a/module/project/view/browse.html.php +++ /dev/null @@ -1,154 +0,0 @@ - - * @package project - * @version $Id$ - * @link http://www.zentao.net - */ -?> - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - -
- project->selectProject;?> - id, 'onchange="selectProject(this.value);" style="width:200px"');?> -
project->name;?>name;?>
project->code;?>code;?>
project->begin;?>begin;?>
project->end;?>end;?>
- createLink('project', 'edit', "projectID=$project->id"), $lang->project->edit); - if(common::hasPriv('project', 'delete')) echo html::a($this->createLink('project', 'delete', "projectID=$project->id"), $lang->project->delete, 'hiddenwin'); - //echo html::a($this->createLink('tree', 'browse', "productID=$productID&view=product"), $lang->tree->manage); - ?> -
- - - - - -
- project->products;?> -
- $productName) echo html::a($this->createLink('product', 'browse', "productID=$productID"), $productName) . '
';?> -
- createLink('project', 'manageproducts', "projectID=$project->id"), $lang->project->manageProducts); - if(common::hasPriv('project', 'linkstory')) echo html::a($this->createLink('project', 'linkstory', "projectID=$project->id"), $lang->project->linkStory); - ?> -
-
- - - - - - - - - - $lang->actions";?> - - - - - - - - - - " . html::a($this->createLink('project', 'unlinkmember', "projectID=$project->id&account=$member->account"), $lang->project->unlinkMember, 'hiddenwin') . '';?> - - - -
- project->team . $lang->colon . $project->team; ?> -
team->account;?>team->role;?>team->joinDate;?>team->workingHour;?>
- createLink('user', 'view', "account=$member->account"), $member->realname); - else echo $member->realname; - ?> - role;?>joinDate, 2);?>workingHour;?>
-
- createLink('project', 'managemembers', "projectID=$project->id"), $lang->project->manageMembers) . '
';?> -
- -
-
-
-
-
    - $project->name"; - echo "
  • " . html::a($this->createLink('project', 'browse', "projectID=$project->id&tabID=task"), $lang->project->tasks) . "
  • "; - echo "
  • " . html::a($this->createLink('project', 'browse', "projectID=$project->id&tabID=story"), $lang->project->stories) . "
  • "; - //echo "
  • " . html::a($this->createLink('project', 'browse', "projectID=$project->id&tabID=bug"), $lang->project->bugs) . "
  • "; - //echo "
  • " . html::a($this->createLink('project', 'browse', "projectID=$project->id&tabID=burn"), $lang->project->burndown) . "
  • "; - echo << -$("#{$tabID}tab").addClass('active'); - -EOT; - ?> -
- -
createLink('task', 'create', "project=$project->id"), $lang->task->create);?>
- -
createLink('project', 'linkstory', "project=$project->id"), $lang->project->linkStory);?>
- -
- -
-
-
- diff --git a/module/project/view/grouptask.html.php b/module/project/view/grouptask.html.php index 4218b5a71f..b3d0e65225 100644 --- a/module/project/view/grouptask.html.php +++ b/module/project/view/grouptask.html.php @@ -90,7 +90,7 @@ ?> -  id . $lang->colon; if(common::hasPriv('task', 'view')) echo html::a($this->createLink('task', 'view', "task=$task->id"), $task->name); else echo $task->name;?> +  id . $lang->colon; if(!common::printLink('task', 'view', "task=$task->id", $task->name)) echo $task->name;?> pri?>'>pri;?> >assignedToRealName;?> finishedBy];?> @@ -101,8 +101,8 @@ delay)) echo 'delayed';?>>deadline, 0, 4) > 0) echo $task->deadline;?> status;?> >task->statusList[$task->status];?> - createLink('task', 'edit', "taskid=$task->id"), $lang->edit);?> - createLink('task', 'delete', "projectID=$task->project&taskid=$task->id"), $lang->delete, 'hiddenwin');?> + id", '', 'list');?> + project&taskid=$task->id", '', 'list', '', 'hiddenwin');?> diff --git a/module/project/view/task.html.php b/module/project/view/task.html.php index 3de0984ddf..f453062c5e 100644 --- a/module/project/view/task.html.php +++ b/module/project/view/task.html.php @@ -111,11 +111,11 @@ var browseType = ''; consumed;?> left;?> - storyID and common::hasPriv('story', 'view')) $story = html::a($this->createLink('story', 'view', "storyid=$task->storyID"), $task->storyTitle); - if($task->storyID and !common::hasPriv('story', 'view')) $story = $task->storyTitle; - echo $story; + storyID) + { + if(!common::printLink('story', 'view', "storyid=$task->storyID", $task->storyTitle)) print $task->storyTitle; + } ?> diff --git a/module/project/view/team.html.php b/module/project/view/team.html.php index cea71b3655..0b6cafe68e 100644 --- a/module/project/view/team.html.php +++ b/module/project/view/team.html.php @@ -30,7 +30,7 @@ createLink('user', 'view', "account=$member->account"), $member->realname)) : print($member->realname); + if(!common::printLink('user', 'view', "account=$member->account", $member->realname)) print $member->realname; $memberHours = $member->days * $member->hours; $totalHours += $memberHours; ?> diff --git a/module/task/view/import.html.php b/module/task/view/import.html.php deleted file mode 100644 index 19b0fb735a..0000000000 --- a/module/task/view/import.html.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @package task - * @version $Id$ - * @link http://www.zentao.net - */ -?> - - - - - - - - - - - - - - - - - - - - assignedTo == $app->user->account ? 'style=color:red' : '';?> - - - - - - - - - - - - - - - -
task->id;?>task->pri;?>task->name;?>task->assignedTo;?>task->estimate;?>task->consumed;?>task->left;?>task->type;?>task->status;?>task->story;?>actions;?>
createLink('task', 'view', "task=$task->id"), sprintf('%03d', $task->id)); else printf('%03d', $task->id);?>pri;?>name;?>>assignedToRealName;?>estimate;?>consumed;?>left;?>task->typeList[$task->type];?>status;?> >task->statusList->{$task->status};?> - storyID) - { - if(common::hasPriv('story', 'view')) echo html::a($this->createLink('story', 'view', "storyid=$task->storyID"), $task->storyTitle); - else echo $task->storyTitle; - } - ?> - -
-