Merge branch 'master' of https://github.com/easysoft/zentaopms
This commit is contained in:
+3
-12
@@ -16,11 +16,12 @@ class file extends control
|
||||
*
|
||||
* @param int $fileCount
|
||||
* @param float $percent
|
||||
* @param array $htmlTagName
|
||||
* @param string $filesName
|
||||
* @param string $labelsName
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function buildForm($fileCount = 1, $percent = 0.9, $htmlTagName = array())
|
||||
public function buildForm($fileCount = 1, $percent = 0.9, $filesName = 'files', $labelsName = 'labels')
|
||||
{
|
||||
if(!file_exists($this->file->savePath))
|
||||
{
|
||||
@@ -33,16 +34,6 @@ class file extends control
|
||||
return false;
|
||||
}
|
||||
|
||||
if(empty($htmlTagName))
|
||||
{
|
||||
$filesName = 'files';
|
||||
$labelsName = 'labels';
|
||||
}
|
||||
else
|
||||
{
|
||||
list($filesName, $labelsName) = $htmlTagName;
|
||||
}
|
||||
|
||||
$this->view->fileCount = $fileCount;
|
||||
$this->view->percent = $percent;
|
||||
$this->view->filesName = $filesName;
|
||||
|
||||
+9
-15
@@ -70,24 +70,16 @@ class fileModel extends model
|
||||
* @param string $objectType
|
||||
* @param string $objectID
|
||||
* @param string $extra
|
||||
* @param array $htmlTagName
|
||||
* @param string $filesName
|
||||
* @param string $labelsName
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function saveUpload($objectType = '', $objectID = '', $extra = '', $htmlTagName = array())
|
||||
public function saveUpload($objectType = '', $objectID = '', $extra = '', $filesName = 'files', $labelsName = 'labels')
|
||||
{
|
||||
if(empty($htmlTagName))
|
||||
{
|
||||
$files = $this->getUpload();
|
||||
}
|
||||
else
|
||||
{
|
||||
list($filesName, $labelsName) = $htmlTagName;
|
||||
$files = $this->getUpload($filesName, $labelsName);
|
||||
}
|
||||
|
||||
$fileTitles = array();
|
||||
$now = helper::today();
|
||||
$files = $this->getUpload($filesName, $labelsName);
|
||||
|
||||
foreach($files as $id => $file)
|
||||
{
|
||||
@@ -144,13 +136,14 @@ class fileModel extends model
|
||||
{
|
||||
if(empty($filename)) continue;
|
||||
if(!validater::checkFileName($filename)) continue;
|
||||
$title = $_POST[$labelsName][$id];
|
||||
$file['extension'] = $this->getExtension($filename);
|
||||
$file['pathname'] = $this->setPathName($id, $file['extension']);
|
||||
$file['title'] = !empty($_POST[$labelsName][$id]) ? htmlspecialchars($_POST[$labelsName][$id]) : str_replace('.' . $file['extension'], '', $filename);
|
||||
$file['title'] = !empty($title) ? htmlspecialchars($title) : str_replace('.' . $file['extension'], '', $filename);
|
||||
$file['title'] = $purifier->purify($file['title']);
|
||||
$file['size'] = $size[$id];
|
||||
$file['tmpname'] = $tmp_name[$id];
|
||||
$files[] = $file;
|
||||
$files[] = $file;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -158,9 +151,10 @@ class fileModel extends model
|
||||
if(empty($_FILES[$htmlTagName]['name'])) return $files;
|
||||
extract($_FILES[$htmlTagName]);
|
||||
if(!validater::checkFileName($name)) return array();;
|
||||
$title = $_POST[$labelsName][0];
|
||||
$file['extension'] = $this->getExtension($name);
|
||||
$file['pathname'] = $this->setPathName(0, $file['extension']);
|
||||
$file['title'] = !empty($_POST[$labelsName][0]) ? htmlspecialchars($_POST[$labelsName][0]) : substr($name, 0, strpos($name, $file['extension']) - 1);
|
||||
$file['title'] = !empty($title) ? htmlspecialchars($title) : substr($name, 0, strpos($name, $file['extension']) - 1);
|
||||
$file['title'] = $purifier->purify($file['title']);
|
||||
$file['size'] = $size;
|
||||
$file['tmpname'] = $tmp_name;
|
||||
|
||||
@@ -446,7 +446,7 @@ class testtaskModel extends model
|
||||
$resultID = $this->dao->lastInsertID();
|
||||
if(!empty($stepResults))
|
||||
{
|
||||
foreach($stepResults as $stepID => $stepResult) $this->loadModel('file')->saveUpload('stepResult', $resultID, $stepID, array("files{$stepID}", "labels{$stepID}"));
|
||||
foreach($stepResults as $stepID => $stepResult) $this->loadModel('file')->saveUpload('stepResult', $resultID, $stepID, "files{$stepID}", "labels{$stepID}");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -96,7 +96,6 @@
|
||||
</div>
|
||||
<?php else:?>
|
||||
<?php foreach($run->case->steps as $key => $step):?>
|
||||
<?php $htmlTagName = array("files{$step->id}", "labels{$step->id}");?>
|
||||
<div class="modal fade" id="fileModal<?php echo $step->id;?>">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
@@ -107,7 +106,7 @@
|
||||
<div class="modal-body">
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<td><?php echo $this->fetch('file', 'buildform', array('fileCount' => 1, 'percent' => 0.9, 'htmlTagName' => $htmlTagName));?></td>
|
||||
<td><?php echo $this->fetch('file', 'buildform', array('fileCount' => 1, 'percent' => 0.9, 'filesName' => "files{$step->id}", 'labelsName' => "labels{$step->id}"));?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user