* fix bug #4243.
This commit is contained in:
@@ -152,10 +152,17 @@ class doc extends control
|
||||
$this->session->set('searchDoc', '');
|
||||
}
|
||||
|
||||
$libs = array();
|
||||
if($browseType == 'collectedbyme')
|
||||
{
|
||||
$libs = $this->doc->getAllLibsByType('collector');
|
||||
$this->view->itemCounts = $this->doc->statLibCounts(array_keys($libs));
|
||||
}
|
||||
|
||||
$this->view->title = $title;
|
||||
$this->view->libID = $libID;
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->modules = $this->doc->getDocMenu($libID, $moduleID, $orderBy == 'title_asc' ? 'name_asc' : 'id_desc');
|
||||
$this->view->modules = $this->doc->getDocMenu($libID, $moduleID, $orderBy == 'title_asc' ? 'name_asc' : 'id_desc', $browseType);
|
||||
$this->view->docs = $this->doc->getDocsByBrowseType($libID, $browseType, $queryID, $moduleID, $sort, $pager);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->orderBy = $orderBy;
|
||||
@@ -164,6 +171,7 @@ class doc extends control
|
||||
$this->view->type = $type;
|
||||
$this->view->from = $from;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->libs = $libs;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
+12
-3
@@ -789,9 +789,14 @@ class docModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDocMenu($libID, $parent, $orderBy = 'name_asc')
|
||||
public function getDocMenu($libID, $parent, $orderBy = 'name_asc', $browseType = '')
|
||||
{
|
||||
$modules = $this->dao->select('*')->from(TABLE_MODULE)->where('root')->eq($libID)
|
||||
if($libID == 0 and $browseType != 'collectedbyme') return array();
|
||||
|
||||
$modules = $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where(1)
|
||||
->beginIF($browseType != "collectedbyme")->andWhere('root')->eq($libID)->fi()
|
||||
->beginIF($browseType == "collectedbyme")->andWhere('collector')->like("%,{$this->app->user->account},%")->fi()
|
||||
->andWhere('type')->eq('doc')
|
||||
->andWhere('parent')->eq($parent)
|
||||
->andWhere('deleted')->eq(0)
|
||||
@@ -948,13 +953,17 @@ class docModel extends model
|
||||
{
|
||||
if($product and $type == 'project') $projects = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('product')->eq($product)->fetchPairs('project', 'project');
|
||||
|
||||
$libs = $this->getLibs($type);
|
||||
$libs = $this->getLibs($type == 'collector' ? 'all' : $type);
|
||||
$key = ($type == 'product' or $type == 'project') ? $type : 'id';
|
||||
$stmt = $this->dao->select("DISTINCT $key")->from(TABLE_DOCLIB)->where('deleted')->eq(0);
|
||||
if($type == 'product' or $type == 'project')
|
||||
{
|
||||
$stmt = $stmt->andWhere($type)->ne(0);
|
||||
}
|
||||
elseif($type == 'collector')
|
||||
{
|
||||
$stmt = $stmt->andWhere('collector')->like("%,{$this->app->user->account},%");
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt = $stmt->andWhere('project')->eq(0)->andWhere('product')->eq(0);
|
||||
|
||||
@@ -45,7 +45,7 @@ var browseType = '<?php echo $browseType;?>';
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<?php if(empty($docs) and empty($modules)):?>
|
||||
<?php if(empty($docs) and empty($modules) and empty($libs)):?>
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<?php if($libID):?>
|
||||
@@ -75,10 +75,28 @@ var browseType = '<?php echo $browseType;?>';
|
||||
<th class="c-user"><?php echo $lang->doc->addedBy;?></th>
|
||||
<th class="c-datetime"><?php echo $lang->doc->addedDate;?></th>
|
||||
<th class="c-datetime"><?php echo $lang->doc->editedDate;?></th>
|
||||
<th class="c-actions-3"><?php echo $lang->actions;?></th>
|
||||
<th class="c-actions-4"><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if(!empty($libs)):?>
|
||||
<?php foreach($libs as $lib):?>
|
||||
<?php $star = strpos($lib->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
|
||||
<?php $collectTitle = strpos($lib->collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
|
||||
<tr>
|
||||
<td class="c-name"><?php echo html::a(inlink('browse', "libID={$lib->id}&browseType=all¶m=0&orderBy=$orderBy&from=$from"), "<i class='icon icon-folder text-yellow'></i> " . $lib->name);?></td>
|
||||
<td class="c-num"></td>
|
||||
<td class="c-user"></td>
|
||||
<td class="c-datetime"></td>
|
||||
<td class="c-datetime"></td>
|
||||
<td>
|
||||
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$lib->id&objectType=doclib");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
|
||||
<?php common::printLink('doc', 'editLib', "libID=$lib->id", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link iframe'")?>
|
||||
<?php common::printLink('tree', 'browse', "rootID=$lib->id&type=doc", "<i class='icon icon-cog'></i>", '', "title='{$lang->tree->manage}' class='btn btn-link'")?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php if(isset($modules)):?>
|
||||
<?php foreach($modules as $module):?>
|
||||
<?php $star = strpos($module->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
|
||||
@@ -90,7 +108,7 @@ var browseType = '<?php echo $browseType;?>';
|
||||
<td class="c-datetime"></td>
|
||||
<td class="c-datetime"></td>
|
||||
<td>
|
||||
<?php common::printLink('doc', 'collect', "objectID=$module->id&objectType=module", "<i class='icon {$star}'></i>", 'hiddenwin', "title='{$collectTitle}' class='btn btn-link'")?>
|
||||
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$module->id&objectType=module");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
|
||||
<?php common::printLink('tree', 'browse', "rootID=$libID&type=doc", "<i class='icon icon-cog'></i>", '', "title='{$lang->tree->manage}' class='btn btn-link'")?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -9,13 +9,28 @@
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<?php if(empty($docs) and empty($modules)):?>
|
||||
<?php if(empty($docs) and empty($modules) and empty($libs)):?>
|
||||
<div class="table-empty-tip">
|
||||
<p><span class="text-muted"><?php echo $lang->doc->noDoc;?></span> <?php common::printLink('doc', 'create', "libID={$libID}", "<i class='icon icon-plus'></i> " . $lang->doc->create, '', "class='btn btn-info'");?></p>
|
||||
</div>
|
||||
<?php else:?>
|
||||
<div class="panel-body">
|
||||
<div class="row row-grid files-grid" data-size="300">
|
||||
<?php foreach($libs as $lib):?>
|
||||
<?php $star = strpos($lib->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
|
||||
<div class="col">
|
||||
<a class="file" href="<?php echo inlink('browse', "libID=$lib->id&browseType=all¶m=0&orderBy=$orderBy&from=$from");?>">
|
||||
<i class="file-icon icon icon-folder text-yellow"></i>
|
||||
<div class="file-name"><?php echo (strpos($lib->collector, $this->app->user->account) !== false ? "<i class='icon icon-star text-yellow'></i> " : '') . $lib->name;?></div>
|
||||
<div class="text-primary file-info"><?php echo zget($itemCounts, $lib->id, 0) . $lang->doc->item;?></div>
|
||||
</a>
|
||||
<div class="actions">
|
||||
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$lib->id&objectType=doclib");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
|
||||
<?php common::printLink('doc', 'editLib', "libID=$lib->id", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link iframe'")?>
|
||||
<?php common::printLink('tree', 'browse', "rootID=$lib->id&type=doc", "<i class='icon icon-cog'></i>", '', "title='{$lang->tree->manage}' class='btn btn-link'")?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
<?php foreach($modules as $module):?>
|
||||
<?php $star = strpos($module->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
|
||||
<div class="col">
|
||||
|
||||
Reference in New Issue
Block a user