Merge branch '15.0.beta3' of https://gitlab.zcorp.cc/easycorp/zentaopms into 15.0.beta3
This commit is contained in:
@@ -177,11 +177,12 @@ class actionModel extends model
|
||||
}
|
||||
|
||||
/* Only process these object types. */
|
||||
if(strpos(',story,productplan,release,task,build,bug,case,testtask,doc,', ",{$objectType},") !== false)
|
||||
if(strpos(',story,productplan,release,task,build,bug,case,testtask,doc,issue,risk,', ",{$objectType},") !== false)
|
||||
{
|
||||
if(!isset($this->config->objectTables[$objectType])) return $emptyRecord;
|
||||
|
||||
/* Set fields to fetch. */
|
||||
$fields = '*';
|
||||
if(strpos('story, productplan, case', $objectType) !== false) $fields = 'product';
|
||||
if(strpos('build, bug, testtask, doc', $objectType) !== false) $fields = 'product, project, execution';
|
||||
if($objectType == 'release') $fields = 'product, build';
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/kindeditor.html.php';?>
|
||||
<?php js::set('sysurl', common::getSysUrl());?>
|
||||
<?php $browseLink = $app->session->bugList != false ? $app->session->bugList : inlink('browse', "productID=$bug->product");?>
|
||||
<?php $browseLink = $app->session->bugList ? $app->session->bugList : inlink('browse', "productID=$bug->product");?>
|
||||
<div id="mainMenu" class="clearfix">
|
||||
<div class="btn-toolbar pull-left">
|
||||
<?php if(!isonlybody()):?>
|
||||
|
||||
@@ -330,9 +330,9 @@ $lang->devops->menuOrder[25] = 'rules';
|
||||
/* Doc menu.*/
|
||||
$lang->doc->menu = new stdclass();
|
||||
$lang->doc->menu->dashboard = array('link' => "{$lang->dashboard}|doc|index");
|
||||
$lang->doc->menu->recent = array('link' => "{$lang->doc->recent}|doc|browse|libID=0&browseTyp=byediteddate", 'alias' => 'recent');
|
||||
$lang->doc->menu->my = array('link' => "{$lang->doc->my}|doc|browse|libID=0&browseTyp=openedbyme", 'alias' => 'my');
|
||||
$lang->doc->menu->collect = array('link' => "{$lang->doc->favorite}|doc|browse|libID=0&browseTyp=collectedbyme", 'alias' => 'collect');
|
||||
$lang->doc->menu->recent = array('link' => "{$lang->doc->recent}|doc|browse|browseTyp=byediteddate", 'alias' => 'recent');
|
||||
$lang->doc->menu->my = array('link' => "{$lang->doc->my}|doc|browse|browseTyp=openedbyme", 'alias' => 'my');
|
||||
$lang->doc->menu->collect = array('link' => "{$lang->doc->favorite}|doc|browse|browseTyp=collectedbyme", 'alias' => 'collect');
|
||||
$lang->doc->menu->product = array('link' => "{$lang->doc->product}|doc|objectLibs|type=product", 'alias' => 'product');
|
||||
if($config->systemMode == 'new') $lang->doc->menu->project = array('link' => "{$lang->doc->project}|doc|objectLibs|type=project", 'alias' => 'project');
|
||||
if($config->systemMode == 'classic') $lang->doc->menu->execution = array('link' => "{$lang->doc->execution}|doc|objectLibs|type=execution", 'alias' => 'execution');
|
||||
|
||||
+8
-197
@@ -26,10 +26,6 @@ class doc extends control
|
||||
$this->loadModel('product');
|
||||
$this->loadModel('project');
|
||||
$this->loadModel('execution');
|
||||
$this->from = $this->cookie->from ? $this->cookie->from : 'doc';
|
||||
$this->productID = $this->cookie->product ? $this->cookie->product : '0';
|
||||
$this->projectID = isset($_GET['project']) ? $_GET['project'] : 0;
|
||||
if($this->from == 'doc') $this->session->set('project', '');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,9 +36,6 @@ class doc extends control
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->from = 'doc';
|
||||
setcookie('from', 'doc', $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
|
||||
|
||||
$this->session->set('docList', $this->app->getURI(true), 'doc');
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager(0, 5, 1);
|
||||
@@ -53,9 +46,9 @@ class doc extends control
|
||||
$this->view->title = $this->lang->doc->common . $this->lang->colon . $this->lang->doc->index;
|
||||
$this->view->position[] = $this->lang->doc->index;
|
||||
|
||||
$this->view->latestEditedDocs = $this->doc->getDocsByBrowseType(0, 'byediteddate', 0, 0, 'editedDate_desc, id_desc', $pager);
|
||||
$this->view->myDocs = $this->doc->getDocsByBrowseType(0, 'openedbyme', 0, 0, 'addedDate_desc', $pager);
|
||||
$this->view->collectedDocs = $this->doc->getDocsByBrowseType(0, 'collectedbyme', 0, 0, 'addedDate_desc', $pager);
|
||||
$this->view->latestEditedDocs = $this->doc->getDocsByBrowseType('byediteddate', 0, 0, 'editedDate_desc, id_desc', $pager);
|
||||
$this->view->myDocs = $this->doc->getDocsByBrowseType('openedbyme', 0, 0, 'addedDate_desc', $pager);
|
||||
$this->view->collectedDocs = $this->doc->getDocsByBrowseType('collectedbyme', 0, 0, 'addedDate_desc', $pager);
|
||||
$this->view->statisticInfo = $this->doc->getStatisticInfo();
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
|
||||
@@ -69,20 +62,15 @@ class doc extends control
|
||||
* @param string $browseType
|
||||
* @param int $param
|
||||
* @param string $orderBy
|
||||
* @param string $from doc|project|product
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browse($libID = 0, $browseType = 'all', $param = 0, $orderBy = 'id_desc', $from = 'doc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
public function browse($browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
$this->session->set('docList', $this->app->getURI(true), 'doc');
|
||||
|
||||
$this->from = $from;
|
||||
setcookie('from', $from, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
|
||||
|
||||
$this->loadModel('search');
|
||||
|
||||
/* Set browseType.*/
|
||||
@@ -90,38 +78,8 @@ class doc extends control
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
|
||||
|
||||
$type = '';
|
||||
$productID = 0;
|
||||
$executionID = 0;
|
||||
if($libID)
|
||||
{
|
||||
$lib = $this->doc->getLibByID($libID);
|
||||
$type = $lib->type;
|
||||
$productID = $lib->product;
|
||||
$executionID = $lib->execution;
|
||||
|
||||
if($type != 'product' and $type != 'execution') $from = 'doc';
|
||||
}
|
||||
|
||||
$this->libs = $this->doc->getLibs($type, '', $libID);
|
||||
|
||||
/* According the from, set menus. */
|
||||
if($from == 'product')
|
||||
{
|
||||
$this->product->setMenu($productID);
|
||||
}
|
||||
elseif($from == 'project')
|
||||
{
|
||||
$this->project->setMenu($lib->project);
|
||||
}
|
||||
else
|
||||
{
|
||||
$menuType = (!$type && (in_array($browseType, array_keys($this->lang->doc->fastMenuList)) || $browseType == 'bysearch')) ? $browseType : $type;
|
||||
}
|
||||
|
||||
/* Set header and position. */
|
||||
$this->view->title = $this->lang->doc->common . ($libID ? $this->lang->colon . $this->libs[$libID] : '');
|
||||
$this->view->position[] = $libID ? $this->libs[$libID] : '';
|
||||
$this->view->title = $this->lang->doc->common;
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
@@ -130,33 +88,8 @@ class doc extends control
|
||||
/* Append id for secend sort. */
|
||||
$sort = $this->loadModel('common')->appendOrder($orderBy);
|
||||
|
||||
/* Build the search form. */
|
||||
$actionURL = $this->createLink('doc', 'browse', "lib=$libID&browseType=bySearch&queryID=myQueryID&orderBy=$orderBy");
|
||||
$this->doc->buildSearchForm($libID, $this->libs, $queryID, $actionURL, $type);
|
||||
|
||||
$title = '';
|
||||
$module = $moduleID ? $this->tree->getByID($moduleID) : '';
|
||||
if($module) $title = $module->name;
|
||||
if($libID) $title = html::a(helper::createLink('doc', 'browse', "libID=$libID"), $this->libs[$libID], '');
|
||||
if(in_array($browseType, array_keys($this->lang->doc->fastMenuList))) $title = $this->lang->doc->fastMenuList[$browseType];
|
||||
if($browseType == 'bysearch') $title = $this->lang->doc->search;
|
||||
if($param != 0) $title = $this->doc->buildCrumbTitle($libID, $param, $title);
|
||||
if($browseType == 'fastsearch')
|
||||
{
|
||||
if($this->post->searchDoc) $this->session->set('searchDoc', $this->post->searchDoc);
|
||||
$title = '"' . $this->session->searchDoc . '" ' . $this->lang->doc->searchResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set('searchDoc', '');
|
||||
}
|
||||
|
||||
$libs = array();
|
||||
if($browseType == 'collectedbyme')
|
||||
{
|
||||
$libs = $this->doc->getAllLibsByType('collector');
|
||||
$this->view->itemCounts = $this->doc->statLibCounts(array_keys($libs));
|
||||
|
||||
$this->app->rawMethod = 'collect';
|
||||
}
|
||||
elseif($browseType == 'openedbyme')
|
||||
@@ -168,33 +101,13 @@ class doc extends control
|
||||
$this->app->rawMethod = 'recent';
|
||||
}
|
||||
|
||||
$attachLibs = array();
|
||||
if(!empty($lib) and (!empty($lib->product) or !empty($lib->execution)) and $browseType != 'bymodule')
|
||||
{
|
||||
$count = $this->dao->select('count(*) as count')->from(TABLE_DOCLIB)->where('execution')->eq($lib->execution)->andWhere('product')->eq($lib->product)->fetch('count');
|
||||
if($count == 1 and $type and isset($lib->$type))
|
||||
{
|
||||
$objectLibs = $this->doc->getLibsByObject($type, $lib->$type);
|
||||
if(isset($objectLibs['execution'])) $attachLibs['execution'] = $objectLibs['execution'];
|
||||
if(isset($objectLibs['files'])) $attachLibs['files'] = $objectLibs['files'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->breadTitle = $title;
|
||||
$this->view->libID = $libID;
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->modules = $this->doc->getDocMenu($libID, $moduleID, '`order`', $browseType);
|
||||
$this->view->docs = $this->doc->getDocsByBrowseType($libID, $browseType, $queryID, $moduleID, $sort, $pager);
|
||||
$this->view->attachLibs = $attachLibs;
|
||||
$this->view->docs = $this->doc->getDocsByBrowseType($browseType, $queryID, $moduleID, $sort, $pager);
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->param = $param;
|
||||
$this->view->type = $type;
|
||||
$this->view->from = $from;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->libs = $libs;
|
||||
$this->view->currentLib = $libID ? $lib : '';
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -390,20 +303,6 @@ class doc extends control
|
||||
$lib = $this->doc->getLibByID($libID);
|
||||
$type = $lib->type;
|
||||
|
||||
/* According the from, set menus. */
|
||||
if($this->from == 'product')
|
||||
{
|
||||
$this->product->setMenu($lib->product);
|
||||
|
||||
$this->lang->TRActions = common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib'), "<i class='icon icon-plus'></i> " . $this->lang->doc->createlib, '', "class='btn btn-secondary iframe' data-width='70%'") : '';
|
||||
}
|
||||
elseif($this->from == 'project')
|
||||
{
|
||||
$this->project->setMenu($lib->project);
|
||||
|
||||
$this->lang->TRActions = common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib'), "<i class='icon icon-plus'></i> " . $this->lang->doc->createlib, '', "class='btn btn-secondary iframe' data-width='70%'") : '';
|
||||
}
|
||||
|
||||
$this->view->title = $lib->name . $this->lang->colon . $this->lang->doc->create;
|
||||
$this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$libID"), $lib->name);
|
||||
$this->view->position[] = $this->lang->doc->create;
|
||||
@@ -411,7 +310,7 @@ class doc extends control
|
||||
$unclosed = strpos($this->config->doc->custom->showLibs, 'unclosed') !== false ? 'unclosedProject' : '';
|
||||
|
||||
$this->view->libID = $libID;
|
||||
$this->view->libs = $this->doc->getLibs($type = 'all', $extra = "withObject,$unclosed", $libID);
|
||||
$this->view->libs = $this->doc->getLibs($type = 'all', $extra = "withObject,$unclosed", $libID, $objectID);
|
||||
$this->view->libName = $this->dao->findByID($libID)->from(TABLE_DOCLIB)->fetch('name');
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($libID, 'doc', $startModuleID = 0);
|
||||
$this->view->moduleID = $moduleID ? (int)$moduleID : (int)$this->cookie->lastDocModule;
|
||||
@@ -522,7 +421,7 @@ class doc extends control
|
||||
$this->view->doc = $doc;
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($libID, 'doc', $startModuleID = 0);
|
||||
$this->view->type = $type;
|
||||
$this->view->libs = $this->doc->getLibs('all', $extra = 'withObject|noBook', $libID);
|
||||
$this->view->libs = $this->doc->getLibs('all', $extra = 'withObject|noBook', $libID, $objectID);
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->user->getPairs('noletter|noclosed|nodeleted', $doc->users);
|
||||
$this->display();
|
||||
@@ -576,16 +475,6 @@ class doc extends control
|
||||
$lib = $this->doc->getLibByID($doc->lib);
|
||||
$type = $lib->type;
|
||||
|
||||
/* According the from, set menus. */
|
||||
if($this->from == 'product')
|
||||
{
|
||||
$this->product->setMenu($lib->product);
|
||||
}
|
||||
elseif($this->from == 'project')
|
||||
{
|
||||
$this->project->setMenu($lib->project);
|
||||
}
|
||||
|
||||
$this->view->title = "DOC #$doc->id $doc->title - " . $lib->name;
|
||||
$this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$doc->lib"), $lib->name);
|
||||
$this->view->position[] = $this->lang->doc->view;
|
||||
@@ -873,84 +762,6 @@ class doc extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show files for product or execution.
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $objectID
|
||||
* @param string $from product|project|doc
|
||||
* @param string $viewType
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function showFiles($type, $objectID, $from = 'doc', $viewType = '', $orderBy = 't1.id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
$uri = $this->app->getURI(true);
|
||||
$this->app->session->set('taskList', $uri, 'execution');
|
||||
$this->app->session->set('storyList', $uri, 'product');
|
||||
$this->app->session->set('docList', $uri, 'doc');
|
||||
|
||||
if(empty($viewType)) $viewType = !empty($_COOKIE['docFilesViewType']) ? $this->cookie->docFilesViewType : 'card';
|
||||
setcookie('docFilesViewType', $viewType, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
|
||||
|
||||
$table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT;
|
||||
$object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch();
|
||||
|
||||
/* According the from, set menus. */
|
||||
if($this->from == 'product')
|
||||
{
|
||||
$this->product->setMenu($lib->product);
|
||||
}
|
||||
elseif($this->from == 'project')
|
||||
{
|
||||
$this->project->setMenu($objectID);
|
||||
}
|
||||
else
|
||||
{
|
||||
$crumb = html::a(inlink('allLibs', "type=$type"), $type == 'product' ? $this->lang->productCommon : $this->lang->executionCommon) . $this->lang->doc->separator;
|
||||
if($this->productID and $type == 'execution') $crumb = $this->doc->getProductCrumb($this->productID, $objectID);
|
||||
$crumb .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name);
|
||||
$crumb .= $this->lang->doc->separator . ' ' . $this->lang->doclib->files;
|
||||
|
||||
$productID = 0;
|
||||
$executionID = 0;
|
||||
if($type == 'product')
|
||||
{
|
||||
$productID = $objectID;
|
||||
if(!$this->product->checkPriv($objectID)) $this->accessDenied();
|
||||
}
|
||||
|
||||
if($type == 'execution')
|
||||
{
|
||||
$executionID = $objectID;
|
||||
if(!$this->execution->checkPriv($objectID)) $this->accessDenied();
|
||||
}
|
||||
}
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$this->view->title = $object->name;
|
||||
$this->view->position[] = $object->name;
|
||||
|
||||
$this->view->type = $type;
|
||||
$this->view->object = $object;
|
||||
$this->view->files = $this->doc->getLibFiles($type, $objectID, $orderBy, $pager);
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
$this->view->pager = $pager;
|
||||
$this->view->viewType = $viewType;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->canBeChanged = common::canModify($type, $object); // Determines whether an object is editable.
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show accessDenied response.
|
||||
*
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
/* Browse by module. */
|
||||
function browseByModule()
|
||||
{
|
||||
$('.divider').removeClass('hidden');
|
||||
$('#bymoduleTab').addClass('active');
|
||||
$('#allTab').removeClass('active');
|
||||
}
|
||||
|
||||
function browseBySearch()
|
||||
{
|
||||
$('.divider').addClass('hidden');
|
||||
$('#bymoduleTab').removeClass('active');
|
||||
$('#allTab').addClass('active');
|
||||
}
|
||||
|
||||
$(function()
|
||||
{
|
||||
if(browseType == 'bysearch') return;
|
||||
if(browseType == 'byediteddate' || browseType == 'openedbyme' || browseType == 'collectedbyme')
|
||||
{
|
||||
$('#pageActions ul.dropdown-menu').css('left', '0px');
|
||||
}
|
||||
$('#' + browseType + 'Tab').addClass('active');
|
||||
});
|
||||
+12
-114
@@ -31,43 +31,23 @@ class docModel extends model
|
||||
* @param string $type
|
||||
* @param string $extra
|
||||
* @param string $appendLibs
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getLibs($type = '', $extra = '', $appendLibs = '')
|
||||
public function getLibs($type = '', $extra = '', $appendLibs = '', $objectID = 0)
|
||||
{
|
||||
$projectID = $this->session->project;
|
||||
if($type == 'product' or $type == 'project')
|
||||
if($type == 'product' or $type == 'project' or $type == 'execution')
|
||||
{
|
||||
$idList = array();
|
||||
if($type == 'product') $idList = $this->loadModel('product')->getProductIDByProject($projectID, false);
|
||||
if($type == 'execution')
|
||||
{
|
||||
$status = strpos($this->config->doc->custom->showLibs, 'unclosed') !== false ? 'undone' : 'all';
|
||||
$idList = $this->loadModel('execution')->getIdList($projectID, $status);
|
||||
}
|
||||
|
||||
$table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT;
|
||||
$stmt = $this->dao->select('*')->from(TABLE_DOCLIB)
|
||||
->where($type)->in($idList)
|
||||
->where($type)->eq($objectID)
|
||||
->andWhere('deleted')->eq('0')
|
||||
->query();
|
||||
}
|
||||
elseif($type == 'all')
|
||||
{
|
||||
/* If extra have unclosedProject then ignore unclosed project libs. */
|
||||
$status = (strpos($extra, 'unclosedProject') !== false) ? 'undone' : 'all';
|
||||
$executionIdList = $this->loadModel('execution')->getIdList($projectID, $status);
|
||||
$productIdList = $this->loadModel('product')->getProductIDByProject($projectID, false);
|
||||
|
||||
$stmt = $this->dao->select('*')->from(TABLE_DOCLIB)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere()
|
||||
->markLeft(1)
|
||||
->where('`type`')->eq('custom')
|
||||
->orWhere('execution')->in($executionIdList)
|
||||
->orWhere('product')->in($productIdList)
|
||||
->markRight(1)
|
||||
->orderBy('id_desc')
|
||||
->query();
|
||||
}
|
||||
@@ -79,11 +59,9 @@ class docModel extends model
|
||||
->orderBy('`order`, id desc')->query();
|
||||
}
|
||||
|
||||
if(strpos($extra, 'withObject') !== false)
|
||||
{
|
||||
$products = $this->loadModel('product')->getProductPairsByProject($projectID);
|
||||
$executions = $this->loadModel('execution')->getPairs($projectID, 'all', 'noclosed');
|
||||
}
|
||||
$products = $this->loadModel('product')->getPairs();
|
||||
$projects = $this->loadModel('project')->getPairsByProgram();
|
||||
$executions = $this->loadModel('execution')->getPairs();
|
||||
|
||||
$libPairs = array();
|
||||
while($lib = $stmt->fetch())
|
||||
@@ -93,6 +71,7 @@ class docModel extends model
|
||||
if(strpos($extra, 'withObject') !== false)
|
||||
{
|
||||
if($lib->product != 0) $lib->name = zget($products, $lib->product, '') . '/' . $lib->name;
|
||||
if($lib->project != 0) $lib->name = zget($projects, $lib->project, '') . '/' . $lib->name;
|
||||
if($lib->execution != 0) $lib->name = zget($executions, $lib->execution, '') . '/' . $lib->name;
|
||||
}
|
||||
|
||||
@@ -211,7 +190,6 @@ class docModel extends model
|
||||
/**
|
||||
* Get docs by browse type.
|
||||
*
|
||||
* @param string $libID
|
||||
* @param string $browseType
|
||||
* @param int $queryID
|
||||
* @param int $moduleID
|
||||
@@ -220,10 +198,10 @@ class docModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDocsByBrowseType($libID, $browseType, $queryID, $moduleID, $sort, $pager)
|
||||
public function getDocsByBrowseType($browseType, $queryID, $moduleID, $sort, $pager)
|
||||
{
|
||||
$allLibs = array_keys($this->getLibs('all'));
|
||||
$docIdList = $this->getPrivDocs($libID, $moduleID);
|
||||
$docIdList = $this->getPrivDocs(0, $moduleID);
|
||||
|
||||
$files = $this->dao->select('*')->from(TABLE_FILE)
|
||||
->where('objectType')->eq('doc')
|
||||
@@ -232,13 +210,12 @@ class docModel extends model
|
||||
|
||||
if($browseType == "all")
|
||||
{
|
||||
$docs = $this->getDocs($libID, 0, $sort, $pager);
|
||||
$docs = $this->getDocs(0, 0, $sort, $pager);
|
||||
}
|
||||
elseif($browseType == "openedbyme")
|
||||
{
|
||||
$docs = $this->dao->select('*')->from(TABLE_DOC)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($libID)->andWhere('lib')->in($libID)->fi()
|
||||
->andWhere('lib')->in($allLibs)
|
||||
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
|
||||
->andWhere('addedBy')->eq($this->app->user->account)
|
||||
@@ -256,7 +233,6 @@ class docModel extends model
|
||||
$docs = $this->dao->select('*')->from(TABLE_DOC)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('id')->in(array_keys($docIDList))
|
||||
->beginIF($libID)->andWhere('lib')->in($libID)->fi()
|
||||
->andWhere('lib')->in($allLibs)
|
||||
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
|
||||
->orderBy($sort)
|
||||
@@ -278,7 +254,6 @@ class docModel extends model
|
||||
{
|
||||
$docs = $this->dao->select('*')->from(TABLE_DOC)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($libID)->andWhere('lib')->in($libID)->fi()
|
||||
->andWhere('lib')->in($allLibs)
|
||||
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
|
||||
->andWhere('collector')->like("%,{$this->app->user->account},%")
|
||||
@@ -286,83 +261,6 @@ class docModel extends model
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
}
|
||||
elseif($browseType == "bymodule")
|
||||
{
|
||||
$modules = 0;
|
||||
if($moduleID)
|
||||
{
|
||||
$modules = array($moduleID => $moduleID);
|
||||
if(strpos($this->config->doc->custom->showLibs, 'children') !== false) $modules = $this->loadModel('tree')->getAllChildId($moduleID);
|
||||
}
|
||||
$docs = $this->getDocs($libID, $modules, $sort, $pager);
|
||||
}
|
||||
elseif($browseType == "bygrid")
|
||||
{
|
||||
$docs = $this->getDocs($libID, 0, $sort, $pager);
|
||||
}
|
||||
elseif($browseType == "bysearch")
|
||||
{
|
||||
if($queryID)
|
||||
{
|
||||
$query = $this->loadModel('search')->getQuery($queryID);
|
||||
if($query)
|
||||
{
|
||||
$this->session->set('docQuery', $query->sql);
|
||||
$this->session->set('docForm', $query->form);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set('docQuery', ' 1 = 1');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->session->docQuery == false) $this->session->set('docQuery', ' 1 = 1');
|
||||
}
|
||||
|
||||
$libCond = strpos($this->session->docQuery, "`lib` = ") !== false;
|
||||
$allLibCond = strpos($this->session->docQuery, "`lib` = 'all'") !== false;
|
||||
|
||||
$docQuery = str_replace("`product` = 'all'", '1', $this->session->docQuery); // Search all product.
|
||||
$docQuery = str_replace("`execution` = 'all'", '1', $docQuery); // Search all execution.
|
||||
$docQuery = str_replace("`lib` = 'all'", '1', $docQuery); // Search all lib.
|
||||
|
||||
$docs = $this->dao->select('*')->from(TABLE_DOC)->where($docQuery)
|
||||
->beginIF(!$libCond and $libID != 0)->andWhere("lib")->eq($libID)->fi()
|
||||
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchAll('id');
|
||||
foreach($docs as $docID => $doc)
|
||||
{
|
||||
if(!$this->checkPrivDoc($doc)) unset($docs[$docID]);
|
||||
}
|
||||
$docs = $this->dao->select('*')->from(TABLE_DOC)
|
||||
->where('id')->in(array_keys($docs))
|
||||
->andWhere('lib')->in($allLibs)
|
||||
->orderBy($sort)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
}
|
||||
elseif($browseType == 'fastsearch')
|
||||
{
|
||||
if($this->session->searchDoc == false) return array();
|
||||
$docIdList = $this->getPrivDocs($libID, $moduleID);
|
||||
$docs = $this->dao->select('t1.*')->from(TABLE_DOC)->alias('t1')
|
||||
->leftJoin(TABLE_DOCCONTENT)->alias('t2')->on('t2.doc = t1.id')
|
||||
->where('t1.deleted')->eq(0)
|
||||
->beginIF(!empty($docIdList))->andWhere('t1.id')->in($docIdList)->fi()
|
||||
->andWhere('t1.title', true)->like("%{$this->session->searchDoc}%")
|
||||
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
|
||||
->orWhere('t2.content')->like("%{$this->session->searchDoc}%")->markRight(1)
|
||||
->andWhere('t1.lib')->in($allLibs)
|
||||
->orderBy($sort)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
foreach($docs as $doc) $doc->title = str_replace($this->session->searchDoc, "<span style='color:red'>{$this->session->searchDoc}</span>", $doc->title);
|
||||
}
|
||||
|
||||
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'doc', false);
|
||||
if(!$docs) return array();
|
||||
|
||||
$docContents = $this->dao->select('*')->from(TABLE_DOCCONTENT)->where('doc')->in(array_keys($docs))->orderBy('version,doc')->fetchAll('doc');
|
||||
foreach($docs as $index => $doc)
|
||||
@@ -743,7 +641,7 @@ class docModel extends model
|
||||
->orderBy($orderBy)
|
||||
->fetchAll('id');
|
||||
|
||||
$docCounts= $this->dao->select("module, count(id) as docCount")->from(TABLE_DOC)
|
||||
$docCounts = $this->dao->select("module, count(id) as docCount")->from(TABLE_DOC)
|
||||
->where('module')->in(array_keys($modules))
|
||||
->andWhere('deleted')->eq(0)
|
||||
->groupBy('module')
|
||||
|
||||
@@ -15,27 +15,14 @@
|
||||
<?php include '../../common/view/datepicker.html.php';?>
|
||||
<?php js::set('browseType', $browseType);?>
|
||||
<?php js::set('confirmDelete', $lang->doc->confirmDelete)?>
|
||||
<?php js::set('libID', $libID);?>
|
||||
<?php if($this->from != 'doc') js::set('type', 'doc');?>
|
||||
|
||||
<?php $spliter = (empty($this->app->user->feedback) && !$this->cookie->feedbackView && $this->from == 'doc') ? true : false;?>
|
||||
<div class="main-row fade <?php if($spliter) echo 'split-row';?>" id="mainRow">
|
||||
<div class="main-row fade" id="mainRow">
|
||||
<div id="mainContent">
|
||||
<div class="cell<?php if($browseType == 'bysearch') echo ' show';?>" id="queryBox" data-module='doc'></div>
|
||||
<div class="panel block-files block-sm no-margin">
|
||||
<?php if(empty($docs) and $browseType == 'bysearch'):?>
|
||||
<div class="table-empty-tip">
|
||||
<p><span class="text-muted"><?php echo $lang->doc->noSearchedDoc;?></span></p>
|
||||
</div>
|
||||
<?php elseif(empty($docs) and empty($modules) and empty($libs) and empty($attachLibs)):?>
|
||||
<?php if(empty($docs)):?>
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<?php if($libID):?>
|
||||
<span class="text-muted"><?php echo $lang->doc->noDoc;?></span>
|
||||
<?php if(common::hasPriv('doc', 'create') and common::canBeChanged('doc', $currentLib)):?>
|
||||
<?php echo html::a($this->createLink('doc', 'create', "libID={$libID}&moduleID=$moduleID&type=&from={$lang->navGroup->doc}"), "<i class='icon icon-plus'></i> " . $lang->doc->create, '', "class='btn btn-info'");?>
|
||||
<?php endif;?>
|
||||
<?php elseif($browseType == 'byediteddate'):?>
|
||||
<?php if($browseType == 'byediteddate'):?>
|
||||
<span class="text-muted"><?php echo $lang->doc->noEditedDoc;?></span>
|
||||
<?php elseif($browseType == 'openedbyme'):?>
|
||||
<span class="text-muted"><?php echo $lang->doc->noOpenedDoc;?></span>
|
||||
@@ -58,60 +45,6 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if(!empty($libs) and $browseType != 'bysearch'):?>
|
||||
<?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>
|
||||
<?php if(common::hasPriv('doc', 'collect')):?>
|
||||
<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 endif;?>
|
||||
<?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&viewType=doc¤tModuleID=0&branch=0&from=$from", "<i class='icon icon-cog'></i>", '', "title='{$lang->tree->manage}' class='btn btn-link'")?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php if(!empty($attachLibs) and $browseType != 'bysearch'):?>
|
||||
<?php foreach($attachLibs as $libType => $attachLib):?>
|
||||
<tr>
|
||||
<?php if($libType == 'execution'):?>
|
||||
<td class="c-name"><?php echo html::a(inlink('allLibs', "type=execution&product={$currentLib->product}"), "<i class='icon icon-folder text-yellow'></i> " . $attachLib->name);?></td>
|
||||
<?php elseif($libType == 'files'):?>
|
||||
<td class="c-name"><?php echo html::a(inlink('showFiles', "type=$type&objectID={$currentLib->$type}&from=$from"), "<i class='icon icon-folder text-yellow'></i> " . $attachLib->name);?></td>
|
||||
<?php endif;?>
|
||||
<td class="c-num"></td>
|
||||
<td class="c-user"></td>
|
||||
<td class="c-datetime"></td>
|
||||
<td class="c-datetime"></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php if(isset($modules) and $browseType != 'bysearch'):?>
|
||||
<?php foreach($modules as $module):?>
|
||||
<?php $star = strpos($module->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
|
||||
<?php $collectTitle = strpos($module->collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
|
||||
<tr>
|
||||
<td class="c-name"><?php echo html::a(inlink('browse', "libID=$libID&browseType=bymodule¶m=$module->id&orderBy=$orderBy&from=$from"), "<i class='icon icon-folder text-yellow'></i> " . $module->name);?></td>
|
||||
<td class="c-num"></td>
|
||||
<td class="c-user"></td>
|
||||
<td class="c-datetime"></td>
|
||||
<td class="c-datetime"></td>
|
||||
<td class="c-actions">
|
||||
<?php if(common::hasPriv('doc', 'collect')):?>
|
||||
<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 endif;?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php foreach($docs as $doc):?>
|
||||
<?php $star = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
|
||||
<?php $collectTitle = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
|
||||
@@ -126,8 +59,8 @@
|
||||
<?php if(common::hasPriv('doc', 'collect')):?>
|
||||
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
|
||||
<?php endif;?>
|
||||
<?php common::printLink('doc', 'edit', "docID=$doc->id&comment=false&from={$lang->navGroup->doc}", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link iframe'", true, true)?>
|
||||
<?php common::printLink('doc', 'delete', "docID=$doc->id&confirm=no&from={$lang->navGroup->doc}", "<i class='icon icon-trash'></i>", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
|
||||
<?php common::printLink('doc', 'edit', "docID=$doc->id&comment=false&from=$app->openApp", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link iframe'", true, true)?>
|
||||
<?php common::printLink('doc', 'delete', "docID=$doc->id&confirm=no&from=$app->openApp", "<i class='icon icon-trash'></i>", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -38,8 +38,10 @@ $sessionString .= session_name() . '=' . session_id();
|
||||
echo html::a("javascript:ajaxDeleteDoc(\"$deleteURL\", \"docList\", confirmDelete)", '<i class="icon-trash"></i>', '', "title='{$lang->doc->delete}' class='btn btn-link'");
|
||||
}
|
||||
?>
|
||||
<?php if(common::hasPriv('doc', 'collect')):?>
|
||||
<?php $star = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
|
||||
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $lang->doc->collect;?>" class='ajaxCollect btn btn-link'><i class='icon <?php echo $star;?>'></i></a>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-content article-content">
|
||||
|
||||
@@ -1,209 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The showFiles view file of doc module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Yidong Wang <yidong@cnezsoft.com>
|
||||
* @package doc
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php $pageCSS .= $this->doc->appendNavCSS();?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div class="main-row fade <?php if($this->from == 'doc') echo 'split-row';?>" id="mainRow">
|
||||
<?php if($this->from == 'doc'):?>
|
||||
<?php include './side.html.php';?>
|
||||
<div class="col-spliter"></div>
|
||||
<?php endif;?>
|
||||
<div class="main-col" data-min-width="400">
|
||||
<div class="panel block-files block-sm no-margin">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-title font-normal"><i class="icon icon-folder-open-o text-muted"></i> <?php echo $lang->doclib->files;?></div>
|
||||
<nav class="panel-actions btn-toolbar">
|
||||
<div class="btn-group">
|
||||
<form class='input-control has-icon-right table-col' method='get'>
|
||||
<?php
|
||||
if($config->requestType == 'GET')
|
||||
{
|
||||
echo html::hidden('m', 'doc');
|
||||
echo html::hidden('f', 'showFiles');
|
||||
echo html::hidden('type', $type);
|
||||
echo html::hidden('objectID', $object->id);
|
||||
echo html::hidden('viewType', ($viewType == 'list' ? 'list' : 'card'));
|
||||
echo html::hidden('recTotal', isset($this->get->recTotal) ? $this->get->recTotal : 0);
|
||||
echo html::hidden('recPerPage', isset($this->get->recPerPage) ? $this->get->recPerPage : 0);
|
||||
echo html::hidden('pageID', isset($this->get->pageID) ? $this->get->pageID : 0);
|
||||
}
|
||||
?>
|
||||
<?php echo html::hidden('onlybody', isonlybody() ? 'yes' : 'no');?>
|
||||
<?php echo html::input('title', $this->get->title, "class='form-control' placeholder='{$lang->doc->fileTitle}'");?>
|
||||
<?php echo html::submitButton("<i class='icon icon-search'></i>", '', "btn btn-icon btn-link input-control-icon-right");?>
|
||||
</form>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<?php $from = $lang->navGroup->doc;?>
|
||||
<?php echo html::a(inlink('showFiles', "type=$type&objectID=$objectID&from=$from&viewType=card"), "<i class='icon icon-cards-view'></i>", '', "title={$lang->doc->browseTypeList['grid']} class='btn btn-icon" . ($viewType != 'list' ? ' text-primary' : '') . "'");?>
|
||||
<?php echo html::a(inlink('showFiles', "type=$type&objectID=$objectID&from=$from&viewType=list"), "<i class='icon icon-bars'></i>" , '', "title={$lang->doc->browseTypeList['list']} class='btn btn-icon" . ($viewType == 'list' ? ' text-primary' : '') . "'");?>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<?php if($viewType == 'list'):?>
|
||||
<div class="panel-body">
|
||||
<table class="table table-borderless table-hover table-files table-fixed no-margin">
|
||||
<thead>
|
||||
<tr class="text-center">
|
||||
<th class="w-80px"><?php echo $lang->doc->id;?></th>
|
||||
<th class='text-left'><?php echo $lang->doc->fileTitle;?></th>
|
||||
<th class='text-left'><?php echo $lang->doc->filePath;?></th>
|
||||
<th class="w-80px"><?php echo $lang->doc->extension;?></th>
|
||||
<th class="w-60px"><?php echo $lang->doc->size;?></th>
|
||||
<th class="w-100px"><?php echo $lang->doc->addedBy;?></th>
|
||||
<th class="w-160px"><?php echo $lang->doc->addedDate;?></th>
|
||||
<th class="w-80px"><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($files as $file):?>
|
||||
<?php if(empty($file->pathname)) continue;?>
|
||||
<tr>
|
||||
<td class="text-center"><?php echo sprintf('%03d', $file->id);?></td>
|
||||
<td class="c-url">
|
||||
<?php
|
||||
if($type == 'execution' && in_array($file->objectType, array('task', 'build')))
|
||||
{
|
||||
$objectLink = $this->createLink($file->objectType, 'view', "objectID=$file->objectID", '', '', $file->project);
|
||||
}
|
||||
if($type == 'product' && in_array($file->objectType, array('bug', 'release', 'testcase', 'testreport')))
|
||||
{
|
||||
$objectLink = $this->createLink($file->objectType, 'view', "objectID=$file->objectID", '', '', $file->project);
|
||||
}
|
||||
else
|
||||
{
|
||||
$objectLink = $this->createLink($file->objectType, 'view', "objectID=$file->objectID");
|
||||
}
|
||||
?>
|
||||
<a href='<?php echo $objectLink;?>'><?php echo $file->title . ' [' . strtoupper($file->objectType) . ' #' . $file->objectID . ']';?></a>
|
||||
</td>
|
||||
<td> <?php echo $file->pathname;?> </td>
|
||||
<td class="text-center"><?php echo $file->extension;?></td>
|
||||
<td><?php echo number_format($file->size / 1024 , 1) . 'K';?></td>
|
||||
<td class="text-center"><?php echo isset($file->addedBy) ? zget($users, $file->addedBy) : '';?></td>
|
||||
<td class="text-center"><?php echo isset($file->addedDate) ? substr($file->addedDate, 0, 10) : '';?></td>
|
||||
<td class="c-actions">
|
||||
<?php
|
||||
common::printLink('file', 'download', "fileID=$file->id", '<i class="icon-import"></i>', "data-toggle='modal'", "class='btn' title={$lang->doc->download}", true, false, $file);
|
||||
if($canBeChanged) common::printLink('file', 'delete', "fileID=$file->id", '<i class="icon-trash"></i>', 'hiddenwin', "class='btn' title={$lang->delete}", true, false, $file);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
|
||||
</div>
|
||||
<?php else:?>
|
||||
<div class="panel-body">
|
||||
<div class="row row-grid files-grid" data-size="300">
|
||||
<?php foreach($files as $file):?>
|
||||
<?php if(empty($file->pathname)) continue;?>
|
||||
<div class='col'>
|
||||
<div class='lib-file'>
|
||||
<?php
|
||||
$imageWidth = 0;
|
||||
if(stripos('jpg|jpeg|gif|png|bmp', $file->extension) !== false and file_exists($file->realPath))
|
||||
{
|
||||
$imageSize = getimagesize($file->realPath);
|
||||
$imageWidth = $imageSize ? $imageSize[0] : 0;
|
||||
}
|
||||
|
||||
$sessionString = $config->requestType == 'PATH_INFO' ? '?' : '&';
|
||||
$sessionString .= session_name() . '=' . session_id();
|
||||
$fileID = $file->id;
|
||||
$url = helper::createLink('file', 'download', 'fileID=' . $fileID) . $sessionString ;
|
||||
?>
|
||||
<div class='file'>
|
||||
<a href='<?php echo $url;?>' title='<?php echo $file->title;?>' target='_blank' onclick="return downloadFile(<?php echo $file->id?>, '<?php echo $file->extension?>', <?php echo $imageWidth?>)">
|
||||
<?php
|
||||
$downloadLink = $this->createLink('file', 'download', "fileID=$file->id&mouse=left");
|
||||
if(in_array($file->extension, $config->file->imageExtensions))
|
||||
{
|
||||
echo "<div class='img-holder' style='background-image: url($file->webPath)'><img src='$file->webPath'/></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$iconClass = 'icon-file';
|
||||
if(strpos('zip,tar,gz,bz2,rar', $file->extension) !== false) $iconClass = 'icon-file-archive';
|
||||
else if(strpos('csv,xls,xlsx', $file->extension) !== false) $iconClass = 'icon-file-excel';
|
||||
else if(strpos('doc,docx', $file->extension) !== false) $iconClass = 'icon-file-word';
|
||||
else if(strpos('ppt,pptx', $file->extension) !== false) $iconClass = 'icon-file-powerpoint';
|
||||
else if(strpos('pdf', $file->extension) !== false) $iconClass = 'icon-file-pdf';
|
||||
else if(strpos('mp3,ogg,wav', $file->extension) !== false) $iconClass = 'icon-file-audio';
|
||||
else if(strpos('avi,mp4,mov', $file->extension) !== false) $iconClass = 'icon-file-video';
|
||||
else if(strpos('txt,md', $file->extension) !== false) $iconClass = 'icon-file-text';
|
||||
else if(strpos('html,htm', $file->extension) !== false) $iconClass = 'icon-globe';
|
||||
echo "<i class='file-icon icon $iconClass'></i>";
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
<?php
|
||||
if($type == 'execution' && in_array($file->objectType, array('task', 'build')))
|
||||
{
|
||||
$objectLink = $this->createLink($file->objectType, 'view', "objectID=$file->objectID", '', '', $file->project);
|
||||
}
|
||||
else
|
||||
{
|
||||
$objectLink = $this->createLink($file->objectType, 'view', "objectID=$file->objectID");
|
||||
}
|
||||
?>
|
||||
<div class='file-name'><a href='<?php echo $objectLink;?>' title='<?php echo substr($file->addedDate, 0, 10)?>'><?php echo $file->title . ' [' . strtoupper($file->objectType) . ' #' . $file->objectID . ']';?></a></div>
|
||||
</div>
|
||||
<div class='actions'>
|
||||
<?php if(common::hasPriv('file', 'delete') and $canBeChanged): ?>
|
||||
<a href='<?php echo $this->createLink('file', 'delete', "fileID=$file->id"); ?>' target='hiddenwin' title='<?php echo $lang->delete?>' class='delete btn btn-link'><i class='icon icon-trash'></i></a>
|
||||
<?php endif?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
<?php if(!empty($files)):?>
|
||||
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
|
||||
<?php else:?>
|
||||
<div class='table-empty-tip text-muted'><?php echo $lang->pager->noRecord;?></div>
|
||||
<?php endif?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php js::set('type', 'doc');?>
|
||||
<script>
|
||||
<?php
|
||||
$sessionString = $config->requestType == 'PATH_INFO' ? '?' : '&';
|
||||
$sessionString .= session_name() . '=' . session_id();
|
||||
?>
|
||||
function downloadFile(fileID, extension, imageWidth)
|
||||
{
|
||||
if(!fileID) return;
|
||||
var fileTypes = 'txt,jpg,jpeg,gif,png,bmp';
|
||||
var sessionString = '<?php echo $sessionString;?>';
|
||||
var windowWidth = $(window).width();
|
||||
var url = createLink('file', 'download', 'fileID=' + fileID + '&mouse=left') + sessionString;
|
||||
width = (windowWidth > imageWidth) ? ((imageWidth < windowWidth*0.5) ? windowWidth*0.5 : imageWidth) : windowWidth;
|
||||
if(fileTypes.indexOf(extension) >= 0)
|
||||
{
|
||||
$('<a>').modalTrigger({url: url, type: 'iframe', width: width}).trigger('click');
|
||||
}
|
||||
else
|
||||
{
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -1016,13 +1016,10 @@ $lang->resource->doc->create = 'create';
|
||||
$lang->resource->doc->view = 'view';
|
||||
$lang->resource->doc->edit = 'edit';
|
||||
$lang->resource->doc->delete = 'delete';
|
||||
//$lang->resource->doc->deleteFile = 'deleteFile';
|
||||
$lang->resource->doc->deleteFile = 'deleteFile';
|
||||
$lang->resource->doc->allLibs = 'allLibs';
|
||||
//$lang->resource->doc->showFiles = 'showFiles';
|
||||
$lang->resource->doc->objectLibs = 'objectLibs';
|
||||
//$lang->resource->doc->sort = 'sort';
|
||||
$lang->resource->doc->collect = 'collectAction';
|
||||
//$lang->resource->doc->diff = 'diff';
|
||||
|
||||
$lang->doc->methodOrder[0] = 'index';
|
||||
$lang->doc->methodOrder[5] = 'browse';
|
||||
@@ -1033,13 +1030,10 @@ $lang->doc->methodOrder[25] = 'create';
|
||||
$lang->doc->methodOrder[30] = 'view';
|
||||
$lang->doc->methodOrder[35] = 'edit';
|
||||
$lang->doc->methodOrder[40] = 'delete';
|
||||
//$lang->doc->methodOrder[45] = 'deleteFile';
|
||||
$lang->doc->methodOrder[45] = 'deleteFile';
|
||||
$lang->doc->methodOrder[50] = 'allLibs';
|
||||
//$lang->doc->methodOrder[55] = 'showFiles';
|
||||
$lang->doc->methodOrder[60] = 'objectLibs';
|
||||
//$lang->doc->methodOrder[65] = 'sort';
|
||||
$lang->doc->methodOrder[70] = 'collect';
|
||||
//$lang->doc->methodOrder[55] = 'diff';
|
||||
$lang->doc->methodOrder[55] = 'objectLibs';
|
||||
$lang->doc->methodOrder[60] = 'collect';
|
||||
|
||||
/* Mail. */
|
||||
$lang->resource->mail = new stdclass();
|
||||
|
||||
@@ -286,7 +286,7 @@ class project extends control
|
||||
if($model == 'waterfall')
|
||||
{
|
||||
$productID = $this->loadModel('product')->getProductIDByProject($projectID, true);
|
||||
$this->session->set('programPlanList', $this->createLink('programplan', 'browse', "projectID=$projectID&productID=$productID&type=lists", '', '', $projectID), 'project');
|
||||
$this->session->set('projectPlanList', $this->createLink('programplan', 'browse', "projectID=$projectID&productID=$productID&type=lists", '', '', $projectID), 'project');
|
||||
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('programplan', 'create', "projectID=$projectID", '', '', $projectID)));
|
||||
}
|
||||
|
||||
@@ -606,14 +606,18 @@ class project extends control
|
||||
$this->session->set('productPlanList', $uri, 'product');
|
||||
$this->session->set('releaseList', $uri, 'product');
|
||||
$this->session->set('storyList', $uri, 'product');
|
||||
$this->session->set('projectList', $uri, 'project');
|
||||
$this->session->set('executionList', $uri, 'execution');
|
||||
$this->session->set('taskList', $uri, 'execution');
|
||||
$this->session->set('buildList', $uri, 'execution');
|
||||
$this->session->set('bugList', $uri, 'qa');
|
||||
$this->session->set('caseList', $uri, 'qa');
|
||||
$this->session->set('testtaskList', $uri, 'qa');
|
||||
|
||||
if($this->config->maxVersion)
|
||||
{
|
||||
$this->session->set('riskList', $uri, 'project');
|
||||
$this->session->set('issueList', $uri, 'project');
|
||||
}
|
||||
|
||||
/* Append id for secend sort. */
|
||||
$orderBy = $direction == 'next' ? 'date_desc' : 'date_asc';
|
||||
$sort = $this->loadModel('common')->appendOrder($orderBy);
|
||||
@@ -712,7 +716,7 @@ class project extends control
|
||||
$this->loadModel('product');
|
||||
|
||||
/* Save session. */
|
||||
$this->session->set('bugList', $this->app->getURI(true), 'qa');
|
||||
$this->session->set('bugList', $this->app->getURI(true), 'project');
|
||||
$this->project->setMenu($projectID);
|
||||
|
||||
$project = $this->project->getByID($projectID);
|
||||
|
||||
@@ -820,7 +820,7 @@ class projectModel extends model
|
||||
$lib->name = $this->lang->doclib->main['product'];
|
||||
$lib->type = 'product';
|
||||
$lib->main = '1';
|
||||
$lib->acl = $product->acl;
|
||||
$lib->acl = 'default';
|
||||
$this->dao->insert(TABLE_DOCLIB)->data($lib)->exec();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
.thWidth {width: 80px !important;}
|
||||
.thWidth {width: 93px !important;}
|
||||
.lifeThWidth {width: 80px !important;}
|
||||
|
||||
Reference in New Issue
Block a user