This commit is contained in:
Catouse
2018-05-28 10:13:13 +08:00
3 changed files with 45 additions and 45 deletions
+41 -41
View File
@@ -66,7 +66,7 @@ class docModel extends model
if($type == 'custom') $currentLib = $libID;
if($type == 'product') $currentLib = $productID;
if($type == 'project') $currentLib = $projectID;
if($currentLib)
if($currentLib)
{
$allLibGroups = $this->getAllLibGroups();
$currentGroups = $allLibGroups[$type];
@@ -283,7 +283,13 @@ class docModel extends model
*/
public function getDocsByBrowseType($libID, $browseType, $queryID, $moduleID, $sort, $pager)
{
$allLibs = array_keys($this->getLibs('all'));
$allLibs = array_keys($this->getLibs('all'));
$docIdList = $this->getPrivDocs($libID, $moduleID);
$files = $this->dao->select('*')->from(TABLE_FILE)
->where('objectType')->eq('doc')
->andWhere('objectID')->in($docIdList)
->fetchGroup('objectID');
if($browseType == "all")
{
$docs = $this->getDocs($libID, 0, $sort, $pager);
@@ -301,12 +307,6 @@ class docModel extends model
}
elseif($browseType == 'byediteddate')
{
$docIdList = $this->getPrivDocs($libID, $moduleID);
$files = $this->dao->select('*')->from(TABLE_FILE)
->where('objectType')->eq('doc')
->andWhere('objectID')->in($docIdList)
->fetchGroup('objectID');
$docs = $this->dao->select('*')->from(TABLE_DOC)
->where('deleted')->eq(0)
->andWhere('id')->in($docIdList)
@@ -314,34 +314,6 @@ class docModel extends model
->orderBy('editedDate_desc')
->page($pager)
->fetchAll('id');
foreach($docs as $doc)
{
$docs[$doc->id]->fileSize = 0;
if(isset($files[$doc->id]))
{
$fileSize = 0;
foreach($files[$doc->id] as $file) $fileSize += $file->size;
if($fileSize < 1024)
{
$fileSize .= 'B';
}
elseif($fileSize < 1024 * 1024)
{
$fileSize = round($fileSize / 1024, 2) . 'KB';
}
elseif($fileSize < 1024 * 1024 * 1024)
{
$fileSize = round($fileSize / 1024 / 1024, 2) . 'MB';
}
else
{
$fileSize = round($fileSize / 1024 / 1024 /1024, 2) . 'G';
}
$docs[$doc->id]->fileSize = $fileSize;
}
}
}
elseif($browseType == "collectedbyme")
{
@@ -420,9 +392,37 @@ class docModel extends model
}
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'doc');
if($docs) return $docs;
if(!$docs) return array();
return array();
foreach($docs as $index => $doc)
{
$docs[$index]->fileSize = 0;
if(isset($files[$index]))
{
$fileSize = 0;
foreach($files[$index] as $file) $fileSize += $file->size;
if($fileSize < 1024)
{
$fileSize .= 'B';
}
elseif($fileSize < 1024 * 1024)
{
$fileSize = round($fileSize / 1024, 2) . 'KB';
}
elseif($fileSize < 1024 * 1024 * 1024)
{
$fileSize = round($fileSize / 1024 / 1024, 2) . 'MB';
}
else
{
$fileSize = round($fileSize / 1024 / 1024 /1024, 2) . 'G';
}
$docs[$index]->fileSize = $fileSize;
}
}
return $docs;
}
/**
@@ -1110,8 +1110,8 @@ class docModel extends model
/**
* Stat module and document counts of lib.
*
* @param array $idList
*
* @param array $idList
* @access public
* @return array
*/
@@ -1398,7 +1398,7 @@ class docModel extends model
/**
* Get statistic information.
*
*
* @access public
* @return object
*/
+1 -1
View File
@@ -85,7 +85,7 @@ var browseType = '<?php echo $browseType;?>';
<?php $collectTitle = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
<tr>
<td class="c-name"><?php echo html::a(inlink('view', "docID=$doc->id"), "<i class='icon icon-file-text text-muted'></i> &nbsp;" . $doc->title);?></td>
<td class="c-num"></td>
<td class="c-num"><?php echo $doc->fileSize ? $doc->fileSize : '-';?></td>
<td class="c-user"><?php echo zget($users, $doc->addedBy);?></td>
<td class="c-datetime"><?php echo formatTime($doc->addedDate, 'm-d h:i');?></td>
<td class="c-datetime"><?php echo formatTime($doc->editedDate, 'm-d h:i');?></td>
+3 -3
View File
@@ -41,7 +41,7 @@ js::set('flow', $this->config->global->flow);
<span class='caret'></span>
</button>
<ul class='dropdown-menu pull-right'>
<?php
<?php
$misc = common::hasPriv('testsuite', 'batchCreateCase') ? '' : "class=disabled";
$link = common::hasPriv('testsuite', 'batchCreateCase') ? $this->createLink('testsuite', 'batchCreateCase', "libID=$libID&moduleID=" . (isset($moduleID) ? $moduleID : 0)) : '#';
echo "<li>" . html::a($link, $lang->testcase->batchCreate, '', $misc) . "</li>";
@@ -150,7 +150,7 @@ js::set('flow', $this->config->global->flow);
<th class='c-type'> <?php common::printOrderLink('type', $orderBy, $vars, $lang->typeAB);?></th>
<th class='c-user'> <?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->openedByAB);?></th>
<th class='c-status'><?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<th class='c-actions-2 text-center'><?php echo $lang->actions;?></th>
<th class='c-actions text-center'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
@@ -250,7 +250,7 @@ js::set('flow', $this->config->global->flow);
</div>
</div>
<script>
$('#module' + moduleID).addClass('active');
$('#module' + moduleID).addClass('active');
$('#<?php echo $this->session->libBrowseType?>Tab').addClass('btn-active-text').append("<span class='label label-light label-badge'><?php echo $pager->recTotal;?></span>");
if(flow == 'onlyTest')
{