* complete task #299:use default file name when download.
+ complete task #297:add file delete function to all files.
This commit is contained in:
@@ -529,6 +529,13 @@ class bug extends control
|
||||
}
|
||||
}
|
||||
|
||||
/* 删除一个文件。*/
|
||||
public function deleteFile($fileID)
|
||||
{
|
||||
$this->dao->delete()->from(TABLE_FILE)->where('id')->eq($fileID)->exec();
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
|
||||
/* 保存模板。*/
|
||||
public function saveTemplate()
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../file/view/download.html.php';?>
|
||||
|
||||
<div class='yui-d0'>
|
||||
<div id='titlebar'>
|
||||
@@ -56,7 +57,15 @@
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->bug->legendAttatch;?></legend>
|
||||
<div><?php foreach($bug->files as $file) echo html::a($this->createLink('file', 'download', "fileID=$file->id"), $file->title, '_blank');?></div>
|
||||
<div>
|
||||
<?php
|
||||
foreach($bug->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)");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php include '../../common/view/action.html.php';?>
|
||||
<div class='a-center' style='font-size:16px; font-weight:bold'>
|
||||
|
||||
@@ -23,14 +23,8 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<script language='Javascript'>
|
||||
/* 删除文件。*/
|
||||
function deleteFile(fileID)
|
||||
{
|
||||
if(!fileID) return;
|
||||
hiddenwin.location.href =createLink('doc', 'deleteFile', 'fileID=' + fileID);
|
||||
}
|
||||
</script>
|
||||
<?php include '../../file/view/download.html.php';?>
|
||||
</style>
|
||||
<div class='yui-d0'>
|
||||
<table class='table-1'>
|
||||
<caption><?php echo $doc->title . $lang->colon . $lang->doc->view;?></caption>
|
||||
@@ -57,13 +51,13 @@ function deleteFile(fileID)
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->files;?></th>
|
||||
<td>
|
||||
<?php
|
||||
foreach($doc->files as $file)
|
||||
{
|
||||
echo html::a($this->createLink('file', 'download', "fileID=$file->id"), $file->title, '_blank');
|
||||
echo html::commonButton('x', "onclick=deleteFile($file->id)");
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
foreach($doc->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)");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
+27
-3
@@ -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格式的文件。*/
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<style>
|
||||
.button-c {padding:1px}
|
||||
</style>
|
||||
<script language='Javascript'>
|
||||
/* 删除文件。*/
|
||||
function deleteFile(fileID)
|
||||
{
|
||||
if(!fileID) return;
|
||||
hiddenwin.location.href =createLink('doc', 'deleteFile', 'fileID=' + fileID);
|
||||
}
|
||||
/* 下载文件。*/
|
||||
function downloadFile(fileID){
|
||||
if(!fileID) return;
|
||||
var URL = createLink('file', 'download', 'fileID=' + fileID + '&mouse=left');
|
||||
window.open(URL, '_blank');
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../file/view/download.html.php';?>
|
||||
|
||||
<div class='yui-d0'>
|
||||
<div id='titlebar'>
|
||||
@@ -54,7 +55,15 @@
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->story->legendAttatch;?></legend>
|
||||
<div><?php foreach($story->files as $file) echo html::a($this->createLink('file', 'download', "fileID=$file->id"), $file->title, '_blank');?></div>
|
||||
<div>
|
||||
<?php
|
||||
foreach($story->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)");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php include '../../common/view/action.html.php';?>
|
||||
<div class='a-center' style='font-size:16px; font-weight:bold'>
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../file/view/download.html.php';?>
|
||||
|
||||
<div class='yui-d0'>
|
||||
<div id='titlebar'>
|
||||
@@ -57,7 +58,15 @@
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->files;?></legend>
|
||||
<div><?php foreach($task->files as $file) echo html::a($this->createLink('file', 'download', "fileID=$file->id"), $file->title, '_blank');?></div>
|
||||
<div>
|
||||
<?php
|
||||
foreach($task->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)");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php include '../../common/view/action.html.php';?>
|
||||
<div class='a-center f-16px strong'>
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/colorize.html.php';?>
|
||||
<?php include '../../file/view/download.html.php';?>
|
||||
<div class='yui-d0'>
|
||||
<div id='titlebar' <?php if($case->deleted) echo "class='deleted'";?>>
|
||||
CASE #<?php echo $case->id . $lang->colon . $case->title;?>
|
||||
@@ -66,7 +67,15 @@
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->testcase->legendAttatch;?></legend>
|
||||
<div><?php foreach($case->files as $file) echo html::a($this->createLink('file', 'download', "fileID=$file->id"), $file->title, '_blank');?></div>
|
||||
<div>
|
||||
<?php
|
||||
foreach($case->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)");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<?php include '../../common/view/action.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user