* Fix design details.

This commit is contained in:
Yagami
2020-08-20 17:28:02 +08:00
parent 80e5e35540
commit 0f91511fe4
9 changed files with 116 additions and 131 deletions
+34 -45
View File
@@ -29,28 +29,27 @@ class design extends control
$this->design->setProductMenu($productID);
$product = $this->loadModel('product')->getById($productID);
$project = $this->loadModel('project')->getById($product->program);
$program = $this->loadModel('project')->getById($product->program);
$this->app->session->set('designList', $this->app->getURI(true));
$this->app->loadClass('pager', $static = true);
if($this->app->getViewType() == 'mhtml') $recPerPager = 10;
$pager = pager::init($recTotal, $recPerPage, $pageID);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$designs = $this->design->getList($productID, $type, $orderBy, $pager);
$this->view->title = $this->lang->design->browse;
$this->view->position[] = $this->lang->design->browse;
$this->view->title = $this->lang->design->browse;
$this->view->position[] = $this->lang->design->browse;
$this->view->designs = $designs;
$this->view->type = $type;
$this->view->recTotal = $recTotal;
$this->view->recPerPage = $recPerPage;
$this->view->pageID = $pageID;
$this->view->orderBy = $orderBy;
$this->view->productID = $productID;
$this->view->program = $project;
$this->view->pager = $pager;
$this->view->designs = $designs;
$this->view->type = $type;
$this->view->recTotal = $recTotal;
$this->view->recPerPage = $recPerPage;
$this->view->pageID = $pageID;
$this->view->orderBy = $orderBy;
$this->view->productID = $productID;
$this->view->pager = $pager;
$this->display();
}
@@ -67,14 +66,12 @@ class design extends control
public function create($productID = 0, $prevModule = '', $prevID = 0)
{
$productID = $this->loadModel('product')->saveState($productID, $this->product->getPairs('nocode'));
$this->design->setProductMenu($productID);
if($_POST)
{
$productID = $this->post->product;
$designID = $this->design->create();
$designID = $this->design->create();
if(dao::isError())
{
$response['result'] = 'fail';
@@ -93,11 +90,11 @@ class design extends control
$this->view->title = $this->lang->design->create;
$this->view->position[] = $this->lang->design->create;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->view->stories = $this->loadModel('story')->getProductStoryPairs($productID);
$this->view->products = $this->loadModel('product')->getPairs($this->session->program);
$this->view->productID = $productID;
$this->view->program = $this->loadModel('project')->getByID($this->session->program);
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->view->stories = $this->loadModel('story')->getProductStoryPairs($productID);
$this->view->products = $this->loadModel('product')->getPairs($this->session->program);
$this->view->productID = $productID;
$this->view->program = $this->loadModel('project')->getByID($this->session->program);
$this->display();
}
@@ -111,34 +108,16 @@ class design extends control
*/
public function view($designID = 0)
{
$design = $this->design->getById($designID);
$design->productName = $this->dao->findByID($design->product)->from(TABLE_PRODUCT)->fetch('name');
$design->files = $this->loadModel('file')->getByObject('design', $designID);
$relations = $this->loadModel('common')->getRelations('design', $design->id, 'commit');
$storyTitle = $this->dao->findByID($design->story)->from(TABLE_STORY)->fetch('title');
$design->commit = '';
if(!empty($_GET['onlybody']))
{
foreach($relations as $relation) $design->commit .= " #$relation->BID";
$design->story = $storyTitle;
}
else
{
foreach($relations as $relation) $design->commit .= html::a(helper::createLink('design', 'revision', "repoID=$relation->BID", '', true), "#$relation->BID", '', "class='iframe' data-width='80%' data-height='550'");
$design->story = $storyTitle ? html::a($this->createLink('story', 'view', "id=$design->story"), $storyTitle) : '';
}
$actions = $this->loadModel('action')->getList('design', $design->id);
$design = $this->design->getById($designID);
$this->design->setProductMenu($design->product);
$this->view->title = $this->lang->design->designView;
$this->view->position[] = $this->lang->design->designView;
$this->view->productID = $design->product;
$this->view->design = $design;
$this->view->relations = $relations;
$this->view->stories = $this->loadModel('story')->getProductStoryPairs($design->product);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->actions = $actions;
$this->view->actions = $this->loadModel('action')->getList('design', $design->id);
$this->display();
}
@@ -166,8 +145,11 @@ class design extends control
$this->send($response);
}
$actionID = $this->loadModel('action')->create('design', $designID, 'changed');
$this->action->logHistory($actionID, $changes);
if(!empty($changes))
{
$actionID = $this->loadModel('action')->create('design', $designID, 'changed');
$this->action->logHistory($actionID, $changes);
}
$response['result'] = 'success';
$response['message'] = $this->lang->saveSuccess;
@@ -241,6 +223,13 @@ class design extends control
$this->display();
}
public function revision($repoID)
{
$repo = $this->dao->select('*')->from(TABLE_REPOHISTORY)->where('id')->eq($repoID)->fetch();
$repoURL = $this->createLink('repo', 'revision', "repoID=$repo->repo&revistion=$repo->revision");
header("location:" . $repoURL);
}
/**
* Delete a design.
*
-6
View File
@@ -1,6 +0,0 @@
$('.main-actions').width($('.main-col').outerWidth());
if(showAction == 'hidden')
{
$('.main-actions').remove();
$('.pull-left').children('a').remove();
};
+3 -1
View File
@@ -28,9 +28,9 @@ $lang->design->designView = '查看详情';
$lang->design->reviewObject = '评审对象';
$lang->design->createdBy = '由谁创建';
$lang->design->createdDate = '创建时间';
$lang->design->basicInfo = '基本信息';
$lang->design->typeList = array();
$lang->design->typeList['all'] = '所有';
$lang->design->typeList['HLDS'] = '概要设计';
$lang->design->typeList['DDS'] = '详细设计';
$lang->design->typeList['DBDS'] = '数据库设计';
@@ -44,3 +44,5 @@ $lang->design->rangeList = array();
$lang->design->rangeList['all'] = '全部记录';
$lang->design->rangeList['assign'] = '选中记录';
$lang->design->featureBar['all'] = '所有';
$lang->design->featureBar += $lang->design->typeList;
+24 -8
View File
@@ -27,7 +27,7 @@ class designModel extends model
->add('createdDate', helper::now())
->add('program', $this->session->program)
->add('version', 1)
->remove('file,files,labels,children, toList')
->remove('file,files,labels,children,toList')
->get();
$design = $this->loadModel('file')->processImgURL($design, 'desc', $this->post->uid);
@@ -67,7 +67,7 @@ class designModel extends model
->add('editedBy', $this->app->user->account)
->add('editedDate', helper::now())
->stripTags($this->config->design->editor->edit['id'], $this->config->allowedTags)
->remove('file,files,labels,children, toList')
->remove('file,files,labels,children,toList')
->get();
$design = $this->loadModel('file')->processImgURL($design, 'desc', $this->post->uid);
@@ -147,11 +147,12 @@ class designModel extends model
public function setProductMenu($productID = 0)
{
$programID = $this->session->program;
$program = $this->loadModel('project')->getByID($programID);
$products = $this->loadModel('product')->getPairs($programID);
$productID = in_array($productID, array_keys($products)) ? $productID : key($products);
$productID = $this->loadModel('product')->saveState($productID, $products);
$this->loadModel('product')->setMenu($products, $productID);
if($program->category == 'multiple') $this->loadModel('product')->setMenu($products, $productID);
}
/**
@@ -164,7 +165,14 @@ class designModel extends model
public function getByID($designID)
{
$design = $this->dao->select('*')->from(TABLE_DESIGN)->where('id')->eq($designID)->fetch();
return $this->loadModel('file')->replaceImgURL($design, 'desc');
$design->files = $this->loadModel('file')->getByObject('design', $designID);
$design->productName = $this->dao->findByID($design->product)->from(TABLE_PRODUCT)->fetch('name');
$design->commit = '';
$relations = $this->loadModel('common')->getRelations('design', $designID, 'commit');
foreach($relations as $relation) $design->commit .= html::a(helper::createLink('design', 'revision', "repoID=$relation->BID"), "#$relation->BID", '_blank');
return $this->loadModel('file')->replaceImgURL($design, 'desc');
}
/**
@@ -216,16 +224,24 @@ class designModel extends model
* @access public
* @return array
*/
public function getList($productID, $type, $orderBy, $pager)
public function getList($productID, $type = 'all', $orderBy = 'id_desc', $pager = null)
{
return $this->dao->select('*')->from(TABLE_DESIGN)
$designs = $this->dao->select('*')->from(TABLE_DESIGN)
->where('deleted')->eq(0)
->beginIF($this->session->program)->andWhere('program')->eq($this->session->program)->fi()
->beginIF(!$this->app->user->admin)->andWhere('product')->in($this->app->user->view->products)->fi()
->beginIF($type !='all')->andWhere('type')->in($type)->fi()
->beginIF($type != 'all')->andWhere('type')->in($type)->fi()
->andWhere('product')->eq($productID)
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
foreach($designs as $id => $design)
{
$design->commit = '';
$relations = $this->loadModel('common')->getRelations('design', $id, 'commit');
foreach($relations as $relation) $design->commit .= html::a(helper::createLink('design', 'revision', "repoID=$relation->BID", '', true), "#$relation->BID", '_blank');
}
return $designs;
}
}
+17 -24
View File
@@ -12,20 +12,15 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/sortable.html.php';?>
<?php js::set('productID', $productID);?>
<?php
$showSubHeader = $program->category == 'single' ? 'hidden' : 'show';
js::set('showSubHeader', $showSubHeader);
?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<?php
$recTotalLabel = " <span class='label label-light label-badge'>{$pager->recTotal}</span>";
echo html::a(inlink('browse', "productID={$productID}&type=all"), "<span class='text'>{$lang->design->typeList['all']}</span>" . ($type == 'all' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'all' ? ' btn-active-text' : '') . "'");
echo html::a(inlink('browse', "productID={$productID}&type=HLDS"), "<span class='text'>{$lang->design->typeList['HLDS']}</span>" . ($type == 'HLDS' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'HLDS' ? ' btn-active-text' : '') . "'");
echo html::a(inlink('browse', "productID={$productID}&type=DDS"), "<span class='text'>{$lang->design->typeList['DDS']}</span>" . ($type == 'DDS' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'DDS' ? ' btn-active-text' : '') . "'");
echo html::a(inlink('browse', "productID={$productID}&type=DBDS"), "<span class='text'>{$lang->design->typeList['DBDS']}</span>" . ($type == 'DBDS' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'DBDS' ? ' btn-active-text' : '') . "'");
echo html::a(inlink('browse', "productID={$productID}&type=ADS"), "<span class='text'>{$lang->design->typeList['ADS']}</span>" . ($type == 'ADS' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'ADS' ? ' btn-active-text' : '') . "'");
foreach($lang->design->featureBar as $key => $label)
{
$active = $key == $type ? 'btn-active-text' : '';
$recTotalLabel = $key == $type ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>" : '';
echo html::a(inlink('browse', "productID={$productID}&type=$key"), "<span class='text'>$label</span>" . $recTotalLabel, '', "class='btn btn-link $active'");
}
?>
</div>
<div class='btn-toolbar pull-right'>
@@ -40,14 +35,13 @@ js::set('showSubHeader', $showSubHeader);
<?php else:?>
<form id='designFrom' method='post' class="main-table">
<table class='table has-sort-head table-fixrd' id="designTable">
<?php $vars = "productID=$productID&orderBy=%s&recTotal=$pager->recTotal&recPerPage=$pager->recPerPage&pageID=$pager->pageID";?>
<?php $vars = "productID=$productID&type=$type&orderBy=%s&recTotal=$pager->recTotal&recPerPage=$pager->recPerPage&pageID=$pager->pageID";?>
<thead>
<tr>
<th class="text-left w-120px"> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class="text-left w-120px"> <?php common::printOrderLink('type', $orderBy, $vars, $lang->design->type);?></th>
<th class="text-left w-60px"> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class="text-left w-100px"> <?php common::printOrderLink('type', $orderBy, $vars, $lang->design->type);?></th>
<th class="text-left"> <?php common::printOrderLink('name', $orderBy, $vars, $lang->design->name);?></th>
<th class="text-left w-130px"> <?php common::printOrderLink('commit', $orderBy, $vars, $lang->design->submission);?></th>
<th class="text-left w-70px"> <?php common::printOrderLink('version', $orderBy, $vars, $lang->design->version);?></th>
<th class="text-left w-150px"> <?php common::printOrderLink('commit', $orderBy, $vars, $lang->design->submission);?></th>
<th class="text-left w-120px"> <?php common::printOrderLink('createdBy', $orderBy, $vars, $lang->design->createdBy);?></th>
<th class="text-left w-150px"> <?php common::printOrderLink('createdDate', $orderBy, $vars, $lang->design->createdDate);?></th>
<th class="text-left w-120px"> <?php common::printOrderLink('assignedTo', $orderBy, $vars, $lang->design->assignedTo);?></th>
@@ -57,14 +51,13 @@ js::set('showSubHeader', $showSubHeader);
<tbody>
<?php foreach($designs as $design):?>
<tr>
<td class='text-left'><?php printf('%03d', $design->id);?></td>
<td class='text-left'><?php echo zget($lang->design->typeList, $design->type);?></td>
<td class='text-left' title="<?php echo $design->name;?>"><?php echo html::a($this->createLink('design', 'view', "id={$design->id}"), $design->name);?></td>
<td class='text-left'><?php echo zget($lang->design->submission, $design->commit);?></td>
<td class='text-left'><?php echo zget($lang->design->version, $design->version);?></td>
<td class='text-left'><?php echo $design->createdBy;?></td>
<td class='text-left'><?php echo $design->createdDate;?></td>
<td class='text-left'><?php echo $design->assignedTo;?></td>
<td><?php printf('%03d', $design->id);?></td>
<td><?php echo zget($lang->design->typeList, $design->type);?></td>
<td title="<?php echo $design->name;?>"><?php echo html::a($this->createLink('design', 'view', "id={$design->id}"), $design->name);?></td>
<td><?php echo $design->commit;?></td>
<td><?php echo $design->createdBy;?></td>
<td><?php echo substr($design->createdDate, 0, 11);?></td>
<td><?php echo $design->assignedTo;?></td>
<td class='c-actions text-center'>
<?php
$vars = "design={$design->id}";
-7
View File
@@ -12,10 +12,6 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php
$showSubHeader = $program->category == 'single' ? 'hidden' : 'show';
js::set('showSubHeader', $showSubHeader);
?>
<div id="mainContent" class="main-content fade">
<div class="center-block">
<div class="main-header">
@@ -63,7 +59,4 @@ js::set('showSubHeader', $showSubHeader);
</form>
</div>
</div>
<script>
if(showSubHeader == 'hidden') $("#subHeader").remove();
</script>
<?php include '../../common/view/footer.html.php';?>
-7
View File
@@ -12,10 +12,6 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php
$showSubHeader = $program->category == 'single' ? 'hidden' : 'show';
js::set('showSubHeader', $showSubHeader);
?>
<div id="mainContent" class="main-content fade">
<div class="center-block">
<div class="main-header">
@@ -100,7 +96,4 @@ js::set('showSubHeader', $showSubHeader);
</form>
</div>
</div>
<script>
if(showSubHeader == 'hidden') $("#subHeader").remove();
</script>
<?php include '../../common/view/footer.html.php';?>
+33 -30
View File
@@ -13,7 +13,7 @@
<?php include '../../common/view/header.html.php';?>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left">
<?php echo html::a($this->createLink('design', 'browse', "productID=$productID"), '<i class="icon icon-back icon-sm"></i> ' . $lang->goback, '', "class='btn btn-secondary'");?>
<?php echo html::a($this->createLink('design', 'browse', "productID=$design->product"), '<i class="icon icon-back icon-sm"></i> ' . $lang->goback, '', "class='btn btn-secondary'");?>
<div class="divider"></div>
<div class="page-title">
<span class="label label-id"><?php echo $design->id?></span>
@@ -28,9 +28,9 @@
<div class="detail-title"><?php echo $lang->design->desc;?></div>
<div class="detail-content article-content">
<?php echo $design->desc;?>
<?php echo $this->fetch('file', 'printFiles', array('files' => $design->files, 'fieldset' => 'true'));?>
</div>
</div>
<?php echo $this->fetch('file', 'printFiles', array('files' => $design->files, 'fieldset' => 'true'));?>
</div>
<div class='cell'><?php include '../../common/view/action.html.php';?></div>
<div class='main-actions'>
@@ -40,42 +40,45 @@
<?php if(!$design->deleted):?>
<?php
common::printIcon('design', 'commit', "designID=$design->id", $design, 'button', 'link', '', 'iframe showinonlybody', true);
common::printIcon('design', 'edit', "designID=$design->id", $design, 'button', '', '', '', true);
common::printIcon('design', 'edit', "designID=$design->id", $design, 'button', 'fork', '', '', true);
common::printIcon('design', 'delete', "designID=$design->id", $design, 'button', 'trash', 'hiddenwin');
?>
<?php endif;?>
</div>
</div>
</div>
<div class='side-col col4'>
<div class='side-col col-4'>
<div class='cell'>
<div class="detail">
<table class='table table-data'>
<tr>
<th><?php echo $lang->design->type;?></th>
<td><?php echo zget($lang->design->typeList, $design->type);?></td>
</tr>
<tr>
<th><?php echo $lang->design->product;?></th>
<td><?php echo $design->productName;?></td>
</tr>
<tr>
<th><?php echo $lang->design->story;?></th>
<td><?php echo $design->story;?></td>
</tr>
<tr>
<th><?php echo $lang->design->commit;?></th>
<td><?php echo $design->commit;?></td>
</tr>
<tr>
<th><?php echo $lang->design->createdBy;?></th>
<td><?php echo zget($users, $design->createdBy);?></td>
</tr>
<tr>
<th><?php echo $lang->design->createdDate;?></th>
<td><?php echo $design->createdDate;?></td>
</tr>
</table>
<div class='detail-title'><?php echo $lang->design->basicInfo;?></div>
<div class='detail-content'>
<table class='table table-data'>
<tr>
<th><?php echo $lang->design->type;?></th>
<td><?php echo zget($lang->design->typeList, $design->type);?></td>
</tr>
<tr>
<th><?php echo $lang->design->product;?></th>
<td><?php echo $design->productName;?></td>
</tr>
<tr>
<th><?php echo $lang->design->story;?></th>
<td><?php echo $design->story ? html::a($this->createLink('story', 'view', "id=$design->story"), zget($stories, $design->story)) : '';?></td>
</tr>
<tr>
<th><?php echo $lang->design->commit;?></th>
<td><?php echo $design->commit;?></td>
</tr>
<tr>
<th><?php echo $lang->design->createdBy;?></th>
<td><?php echo zget($users, $design->createdBy);?></td>
</tr>
<tr>
<th><?php echo $lang->design->createdDate;?></th>
<td><?php echo substr($design->createdDate, 0, 11);?></td>
</tr>
</table>
</div>
</div>
</div>
</div>
+5 -3
View File
@@ -16,13 +16,13 @@ $lang->moduleOrder[5] = 'my';
$lang->moduleOrder[10] = 'todo';
$lang->moduleOrder[11] = 'program';
$lang->moduleOrder[12] = 'design';
$lang->moduleOrder[15] = 'product';
$lang->moduleOrder[20] = 'story';
$lang->moduleOrder[25] = 'productplan';
$lang->moduleOrder[30] = 'release';
$lang->moduleOrder[35] = 'project';
$lang->moduleOrder[36] = 'design';
$lang->moduleOrder[40] = 'task';
$lang->moduleOrder[45] = 'build';
@@ -440,6 +440,7 @@ $lang->resource->design->browse = 'browse';
$lang->resource->design->create = 'create';
$lang->resource->design->edit = 'edit';
$lang->resource->design->commit = 'commit';
$lang->resource->design->revision = 'revision';
$lang->resource->design->delete = 'delete';
$lang->resource->design->view = 'view';
@@ -447,8 +448,9 @@ $lang->design->methodOrder[5] = 'browse';
$lang->design->methodOrder[10] = 'create';
$lang->design->methodOrder[15] = 'edit';
$lang->design->methodOrder[20] = 'commit';
$lang->design->methodOrder[25] = 'delete';
$lang->design->methodOrder[30] = 'view';
$lang->design->methodOrder[25] = 'revision';
$lang->design->methodOrder[30] = 'delete';
$lang->design->methodOrder[35] = 'view';
/* Task. */
$lang->resource->task = new stdclass();