Merge branch 'master' of github.com:easysoft/zentaopms
This commit is contained in:
+17
-10
@@ -23,7 +23,6 @@ $config->bug->list->allFields = 'id, module, project, story, task,
|
||||
lastEditedBy,
|
||||
lastEditedDate';
|
||||
|
||||
if($config->global->flow == 'onlyTest') $config->bug->list->allFields = str_replace(array('project, ', 'story, ', 'task,'), '', $config->bug->list->allFields);
|
||||
$config->bug->list->defaultFields = 'id,severity,pri,title,openedBy,assignedTo,resolvedBy,resolution';
|
||||
|
||||
$config->bug->list->exportFields = 'id, product, branch, module, project, story, task,
|
||||
@@ -37,7 +36,6 @@ $config->bug->list->exportFields = 'id, product, branch, module, project, story,
|
||||
case,
|
||||
lastEditedBy,
|
||||
lastEditedDate, files';
|
||||
if($config->global->flow == 'onlyTest') $config->bug->list->exportFields = str_replace(array('project, ', 'story, ', 'task,'), '', $config->bug->list->exportFields);
|
||||
|
||||
$config->bug->list->customCreateFields = 'project,story,task,pri,severity,os,browser,deadline,mailto,keywords';
|
||||
$config->bug->list->customBatchCreateFields = 'module,project,steps,type,pri,severity,os,browser,keywords';
|
||||
@@ -50,9 +48,13 @@ $config->bug->custom->batchEditFields = 'type,severity,pri,branch,assignedTo,d
|
||||
|
||||
if($config->global->flow == 'onlyTest')
|
||||
{
|
||||
$config->bug->list->allFields = str_replace(array('project, ', 'story, ', 'task,'), '', $config->bug->list->allFields);
|
||||
$config->bug->list->exportFields = str_replace(array('project, ', 'story, ', 'task,'), '', $config->bug->list->exportFields);
|
||||
|
||||
$config->bug->list->customCreateFields = str_replace(array('project,', 'story,', 'task,'), '', $config->bug->list->customCreateFields);
|
||||
$config->bug->list->customBatchCreateFields = str_replace('project,', '', $config->bug->list->customBatchCreateFields);
|
||||
$config->bug->custom->batchCreateFields = str_replace('project,', '', $config->bug->custom->batchCreateFields);
|
||||
|
||||
$config->bug->custom->batchCreateFields = str_replace('project,', '', $config->bug->custom->batchCreateFields);
|
||||
}
|
||||
|
||||
$config->bug->editor = new stdclass();
|
||||
@@ -79,9 +81,9 @@ $config->bug->search['fields']['confirmed'] = $lang->bug->confirmed;
|
||||
|
||||
$config->bug->search['fields']['product'] = $lang->bug->product;
|
||||
$config->bug->search['fields']['branch'] = '';
|
||||
$config->bug->search['fields']['plan'] = $lang->bug->productplan;
|
||||
$config->bug->search['fields']['plan'] = $lang->bug->productplan;
|
||||
$config->bug->search['fields']['module'] = $lang->bug->module;
|
||||
if($config->global->flow != 'onlyTest') $config->bug->search['fields']['project'] = $lang->bug->project;
|
||||
$config->bug->search['fields']['project'] = $lang->bug->project;
|
||||
|
||||
$config->bug->search['fields']['severity'] = $lang->bug->severity;
|
||||
$config->bug->search['fields']['pri'] = $lang->bug->pri;
|
||||
@@ -92,11 +94,8 @@ $config->bug->search['fields']['resolution'] = $lang->bug->resolution;
|
||||
|
||||
$config->bug->search['fields']['activatedCount'] = $lang->bug->activatedCount;
|
||||
|
||||
if($config->global->flow != 'onlyTest')
|
||||
{
|
||||
$config->bug->search['fields']['toTask'] = $lang->bug->toTask;
|
||||
$config->bug->search['fields']['toStory'] = $lang->bug->toStory;
|
||||
}
|
||||
$config->bug->search['fields']['toTask'] = $lang->bug->toTask;
|
||||
$config->bug->search['fields']['toStory'] = $lang->bug->toStory;
|
||||
|
||||
$config->bug->search['fields']['openedBy'] = $lang->bug->openedBy;
|
||||
$config->bug->search['fields']['closedBy'] = $lang->bug->closedBy;
|
||||
@@ -114,6 +113,14 @@ $config->bug->search['fields']['closedDate'] = $lang->bug->closedDate;
|
||||
$config->bug->search['fields']['lastEditedDate'] = $lang->bug->lastEditedDateAB;
|
||||
$config->bug->search['fields']['deadline'] = $lang->bug->deadline;
|
||||
|
||||
if($config->global->flow != 'onlyTest')
|
||||
{
|
||||
unset($config->bug->search['fields']['project']);
|
||||
unset($config->bug->search['fields']['plan']);
|
||||
unset($config->bug->search['fields']['toTask']);
|
||||
unset($config->bug->search['fields']['toStory']);
|
||||
}
|
||||
|
||||
$config->bug->search['params']['title'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
|
||||
$config->bug->search['params']['keywords'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
|
||||
$config->bug->search['params']['steps'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
|
||||
|
||||
@@ -366,7 +366,7 @@ class file extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload zip of Images.
|
||||
* Upload Images.
|
||||
*
|
||||
* @param string $module
|
||||
* @param string $params
|
||||
@@ -386,14 +386,14 @@ class file extends control
|
||||
|
||||
if($_FILES)
|
||||
{
|
||||
$file = $this->file->getUploadImageFile('file');
|
||||
$file = $this->file->getUploadFile('file');
|
||||
if(!$file) die(json_encode(array('result' => 'fail', 'message' => $this->lang->error->noData)));
|
||||
if(empty($file['extension']) or !in_array($file['extension'], $this->config->file->imageExtensions))
|
||||
{
|
||||
die(json_encode(array('result' => 'fail', 'message' => $this->lang->file->errorFileFormate)));
|
||||
}
|
||||
|
||||
$imageFile = $this->file->saveUploadImageFile($file, $uid);
|
||||
$imageFile = $this->file->saveUploadFile($file, $uid);
|
||||
if($imageFile === false)
|
||||
{
|
||||
die(json_encode(array('result' => 'fail', 'message' => $this->lang->file->errorFileMove)));
|
||||
|
||||
+28
-81
@@ -172,13 +172,13 @@ class fileModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* get uploaded image file from zui.uploader.
|
||||
* get uploaded file from zui.uploader.
|
||||
*
|
||||
* @param string $htmlTagName
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getUploadImageFile($htmlTagName = 'file')
|
||||
public function getUploadFile($htmlTagName = 'file')
|
||||
{
|
||||
if(!isset($_FILES[$htmlTagName]) || empty($_FILES[$htmlTagName]['name'])) return;
|
||||
|
||||
@@ -208,70 +208,70 @@ class fileModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Save uploaded image file.
|
||||
* Save uploaded file from zui.uploader.
|
||||
*
|
||||
* @param int $file
|
||||
* @param int $uid
|
||||
* @access public
|
||||
* @return array|bool
|
||||
*/
|
||||
public function saveUploadImageFile($file, $uid)
|
||||
public function saveUploadFile($file, $uid)
|
||||
{
|
||||
$imageFile = array();
|
||||
$uploadFile = array();
|
||||
|
||||
$cachePath = $this->app->getCacheRoot() . 'uploadimages/';
|
||||
if(!is_dir($cachePath)) mkdir($cachePath, 0777, true);
|
||||
$tmpFilePath = $this->app->getTmpRoot() . 'uploadfiles/';
|
||||
if(!is_dir($tmpFilePath)) mkdir($tmpFilePath, 0777, true);
|
||||
|
||||
$imageFilePath = $cachePath . $uid . '/';
|
||||
if(!is_dir($imageFilePath)) mkdir($imageFilePath);
|
||||
$tmpFileSavePath = $tmpFilePath . $uid . '/';
|
||||
if(!is_dir($tmpFileSavePath)) mkdir($tmpFileSavePath);
|
||||
|
||||
$fileName = basename($file['pathname']);
|
||||
$file['realpath'] = $imageFilePath . $fileName;
|
||||
$file['realpath'] = $tmpFileSavePath . $fileName;
|
||||
|
||||
if($file['chunks'] > 1)
|
||||
{
|
||||
$fileSavePath = $cachePath . $file['chunkpath'];
|
||||
if(!file_exists($fileSavePath)) mkdir(dirname($fileSavePath));
|
||||
$tmpFileChunkPath = $tmpFilePath . $file['chunkpath'];
|
||||
if(!file_exists($tmpFileChunkPath)) mkdir(dirname($tmpFileChunkPath));
|
||||
|
||||
if($file['chunk'] > 0)
|
||||
{
|
||||
$uploadFile = fopen($fileSavePath, 'a+b');
|
||||
$fileChunk = fopen($tmpFileChunkPath, 'a+b');
|
||||
$tmpChunkFile = fopen($file['tmpname'], 'rb');
|
||||
while($buff = fread($tmpChunkFile, 4069))
|
||||
{
|
||||
fwrite($uploadFile, $buff);
|
||||
fwrite($fileChunk, $buff);
|
||||
}
|
||||
fclose($uploadFile);
|
||||
fclose($fileChunk);
|
||||
fclose($tmpChunkFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!move_uploaded_file($file['tmpname'], $fileSavePath)) return false;
|
||||
if(!move_uploaded_file($file['tmpname'], $tmpFileChunkPath)) return false;
|
||||
}
|
||||
|
||||
if($file['chunk'] == ($file['chunks'] - 1))
|
||||
{
|
||||
rename($fileSavePath, $file['realpath']);
|
||||
rename($tmpFileChunkPath, $file['realpath']);
|
||||
|
||||
$imageFile['extension'] = $file['extension'];
|
||||
$imageFile['pathname'] = $file['pathname'];
|
||||
$imageFile['title'] = $file['title'];
|
||||
$imageFile['realpath'] = $file['realpath'];
|
||||
$imageFile['size'] = $file['size'];
|
||||
$uploadFile['extension'] = $file['extension'];
|
||||
$uploadFile['pathname'] = $file['pathname'];
|
||||
$uploadFile['title'] = $file['title'];
|
||||
$uploadFile['realpath'] = $file['realpath'];
|
||||
$uploadFile['size'] = $file['size'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!move_uploaded_file($file['tmpname'], $file['realpath'])) return false;
|
||||
|
||||
$imageFile['extension'] = $file['extension'];
|
||||
$imageFile['pathname'] = $file['pathname'];
|
||||
$imageFile['title'] = $file['title'];
|
||||
$imageFile['realpath'] = $file['realpath'];
|
||||
$imageFile['size'] = $file['size'];
|
||||
$uploadFile['extension'] = $file['extension'];
|
||||
$uploadFile['pathname'] = $file['pathname'];
|
||||
$uploadFile['title'] = $file['title'];
|
||||
$uploadFile['realpath'] = $file['realpath'];
|
||||
$uploadFile['size'] = $file['size'];
|
||||
}
|
||||
|
||||
return $imageFile;
|
||||
return $uploadFile;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -569,59 +569,6 @@ class fileModel extends model
|
||||
return str_replace('""', '"', $matchs[1]) . str_replace(',', ',', $matchs[2]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract zip.
|
||||
*
|
||||
* @param string $zipFile
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function extractZip($zipFile)
|
||||
{
|
||||
$classFile = $this->app->loadClass('zfile');
|
||||
$parentPath = $this->app->getCacheRoot() . 'uploadimages/';
|
||||
if(!is_dir($parentPath)) mkdir($parentPath, 0777, true);
|
||||
|
||||
$filePath = $parentPath . str_replace('.zip', '', basename($zipFile)) . '/';
|
||||
if(is_dir($filePath)) $classFile->removeDir($filePath);
|
||||
mkdir($filePath);
|
||||
|
||||
$this->app->loadClass('pclzip', true);
|
||||
$zip = new pclzip($zipFile);
|
||||
$files = $zip->listContent();
|
||||
foreach($files as $i => $uploadFile)
|
||||
{
|
||||
if($uploadFile['folder']) continue;
|
||||
$extension = strtolower(substr(strrchr($uploadFile['filename'], '.'), 1));
|
||||
if(empty($extension) or !in_array($extension, $this->config->file->imageExtensions)) return false;
|
||||
}
|
||||
|
||||
$extractedFiles = array();
|
||||
foreach($files as $i => $uploadFile)
|
||||
{
|
||||
if($uploadFile['folder']) continue;
|
||||
$fileName = $uploadFile['filename'];
|
||||
$fileName = helper::convertEncoding($fileName, 'gbk', 'utf-8//TRANSLIT');
|
||||
if(($pos = strrpos($fileName, '/')) !== false) $fileName = substr($fileName, $pos + 1);
|
||||
|
||||
$file = array();
|
||||
$file['extension'] = $this->getExtension($fileName);
|
||||
$file['pathname'] = $this->setPathName($i, $file['extension']);
|
||||
$file['title'] = str_replace(".{$file['extension']}", '', $fileName);
|
||||
$file['size'] = $uploadFile['size'];
|
||||
|
||||
$fileName = basename($file['pathname']);
|
||||
$file['realpath'] = $filePath . $fileName;
|
||||
$list = $zip->extract(PCLZIP_OPT_BY_INDEX, $i, PCLZIP_OPT_EXTRACT_AS_STRING);
|
||||
if($list)
|
||||
{
|
||||
file_put_contents($file['realpath'], $list[0]['content']);
|
||||
$extractedFiles[$fileName] = $file;
|
||||
}
|
||||
}
|
||||
return $extractedFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process editor.
|
||||
*
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<?php
|
||||
js::import($jsRoot . 'uploader/min.js');
|
||||
css::import($jsRoot . 'uploader/min.css');
|
||||
js::set('module', $module);
|
||||
js::set('params', $params);
|
||||
js::set('uid', $uid);
|
||||
?>
|
||||
<style>
|
||||
#uploader{padding: 20px;}
|
||||
@@ -24,17 +27,21 @@ css::import($jsRoot . 'uploader/min.css');
|
||||
<div class='content'></div>
|
||||
<button type='button' class='close'>×</button>
|
||||
</div>
|
||||
<div class='file-list file-list-lg' data-drag-placeholder="<?php echo $lang->file->dragFile;?>"></div>
|
||||
<div class='uploader-files file-list file-list-grid' data-drag-placeholder="<?php echo $lang->file->dragFile;?>"></div>
|
||||
<hr/>
|
||||
<span><?php echo $this->lang->file->uploadImagesExplain?></span>
|
||||
<div class='uploader-footer'>
|
||||
<div class='uploader-status pull-right text-muted'></div>
|
||||
<button type='button' class='btn btn-primary uploader-btn-browse'><i class='icon icon-plus'></i><?php echo $lang->file->addFile;?></button>
|
||||
<button type='button' class='btn btn-success uploader-btn-start'><i class='icon icon-cloud-upload'></i><?php echo $lang->file->beginUpload;?></button>
|
||||
<?php echo html::a(inlink('uploadImages', "module=$module¶ms=$params&uid=$uid&locate=true"), $lang->save, '', "class='btn'");?>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$('#uploader').uploader({
|
||||
onUploadComplete:function()
|
||||
{
|
||||
location.href = createLink('file', 'uploadImages', 'module=' + module + '¶ms=' + params + '&uid=' + uid + '&locate=true');
|
||||
},
|
||||
onBeforeUpload: function(file)
|
||||
{
|
||||
this.plupload.setOption(
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user