diff --git a/module/doc/view/view.html.php b/module/doc/view/view.html.php
index 1879540ccc..97ea146ffa 100644
--- a/module/doc/view/view.html.php
+++ b/module/doc/view/view.html.php
@@ -23,14 +23,8 @@
*/
?>
-
+
+
title . $lang->colon . $lang->doc->view;?>
@@ -57,13 +51,13 @@ function deleteFile(fileID)
| files;?> |
- files as $file)
- {
- echo html::a($this->createLink('file', 'download', "fileID=$file->id"), $file->title, '_blank');
- echo html::commonButton('x', "onclick=deleteFile($file->id)");
- }
- ?>
+ files as $file)
+ {
+ echo html::a($this->createLink('file', 'download', "fileID=$file->id"), $file->title, '_blank', "onclick='return downloadFile($file->id)'");
+ echo html::commonButton('x', "onclick=deleteFile($file->id)");
+ }
+ ?>
|
diff --git a/module/file/control.php b/module/file/control.php
index c00e8437a9..26961c8853 100644
--- a/module/file/control.php
+++ b/module/file/control.php
@@ -32,11 +32,35 @@ class file extends control
}
/* 下载一个文件。*/
- public function download($fileID)
+ public function download($fileID, $mouse = '')
{
$file = $this->file->getById($fileID);
- if(file_exists($file->realPath))$this->locate($file->webPath);
- $this->app->error("The file you visit $fileID not found.", __FILE__, __LINE__, true);
+ $fileTypes = array('txt', 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'xml', 'html');
+ foreach($fileTypes as $fileType)
+ {
+ if($file->extension == $fileType)
+ {
+ $download = 'false';
+ break;
+ }
+ }
+ if(isset($download) && $mouse == 'left')
+ {
+ if(file_exists($file->realPath))$this->locate($file->webPath);
+ $this->app->error("The file you visit $fileID not found.", __FILE__, __LINE__, true);
+ }
+ else
+ {
+ if(file_exists($file->realPath))
+ {
+ $fileName = $file->title . '.' . $file->extension;
+ header('Content-type: application/octet-stream');
+ header("Content-Disposition: attachment; filename=$fileName");
+ $fileData = file_get_contents($file->realPath);
+ echo $fileData;
+ }
+ $this->app->error("The file you visit $fileID not found.", __FILE__, __LINE__, true);
+ }
}
/* 导出csv格式的文件。*/
diff --git a/module/file/view/download.html.php b/module/file/view/download.html.php
new file mode 100644
index 0000000000..af7841f56c
--- /dev/null
+++ b/module/file/view/download.html.php
@@ -0,0 +1,19 @@
+
+
+
diff --git a/module/story/control.php b/module/story/control.php
index 44267e6159..8450a75fe9 100644
--- a/module/story/control.php
+++ b/module/story/control.php
@@ -223,6 +223,13 @@ class story extends control
}
}
+ /* 删除一个文件。*/
+ public function deleteFile($fileID)
+ {
+ $this->dao->delete()->from(TABLE_FILE)->where('id')->eq($fileID)->exec();
+ die(js::reload('parent'));
+ }
+
/* 评审一条需求。*/
public function review($storyID)
{
diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php
index d26eb1cca8..f379775ee1 100644
--- a/module/story/view/view.html.php
+++ b/module/story/view/view.html.php
@@ -23,6 +23,7 @@
*/
?>
+
@@ -54,7 +55,15 @@
diff --git a/module/task/control.php b/module/task/control.php
index 2cf964117b..13a224b8e3 100644
--- a/module/task/control.php
+++ b/module/task/control.php
@@ -303,6 +303,13 @@ class task extends control
}
}
+ /* 删除一个文件。*/
+ public function deleteFile($fileID)
+ {
+ $this->dao->delete()->from(TABLE_FILE)->where('id')->eq($fileID)->exec();
+ die(js::reload('parent'));
+ }
+
/* 发送邮件。*/
private function sendmail($taskID, $actionID)
{
diff --git a/module/task/view/view.html.php b/module/task/view/view.html.php
index efa2e307a8..c7d1cf3f6f 100644
--- a/module/task/view/view.html.php
+++ b/module/task/view/view.html.php
@@ -23,6 +23,7 @@
*/
?>
+
@@ -57,7 +58,15 @@
diff --git a/module/testcase/control.php b/module/testcase/control.php
index 03018a7bba..7ed0514d00 100644
--- a/module/testcase/control.php
+++ b/module/testcase/control.php
@@ -255,6 +255,13 @@ class testcase extends control
}
}
+ /* 删除一个文件。*/
+ public function deleteFile($fileID)
+ {
+ $this->dao->delete()->from(TABLE_FILE)->where('id')->eq($fileID)->exec();
+ die(js::reload('parent'));
+ }
+
/* 确认需求变动。*/
public function confirmStoryChange($caseID)
{
diff --git a/module/testcase/view/view.html.php b/module/testcase/view/view.html.php
index 20b7d3a3ec..dd6e1dfddf 100644
--- a/module/testcase/view/view.html.php
+++ b/module/testcase/view/view.html.php
@@ -24,6 +24,7 @@
?>
+
deleted) echo "class='deleted'";?>>
CASE #id . $lang->colon . $case->title;?>
@@ -66,7 +67,15 @@