* Finish task #40004.

This commit is contained in:
holan20180123
2021-07-12 10:36:44 +08:00
parent 3034d24f2c
commit 195e6492d2
7 changed files with 58 additions and 22 deletions
+1 -6
View File
@@ -6,7 +6,7 @@ $config->product->customBatchEditFields = 'PO,QD,RD,status,type,desc,acl';
$config->product->browse = new stdclass();
$config->product->custom = new stdclass();
$config->product->custom->batchEditFields = 'PO,QD,RD,status,type,acl';
$config->product->custom->batchEditFields = 'program,PO,QD,RD,status,type,acl';
$config->product->list = new stdclass();
$config->product->list->exportFields = 'id,name,line,activeStories,changedStories,draftStories,closedStories,plans,releases,bugs,unResolvedBugs,assignToNullBugs';
@@ -85,11 +85,6 @@ $config->product->create = new stdclass();
$config->product->edit = new stdclass();
$config->product->create->requiredFields = 'name';
$config->product->edit->requiredFields = 'name';
if($config->systemMode == 'new')
{
$config->product->create->requiredFields .= ',program';
$config->product->edit->requiredFields .= ',program';
}
$config->product->editor = new stdclass();
$config->product->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
+3 -2
View File
@@ -536,7 +536,7 @@ class product extends control
* @access public
* @return void
*/
public function batchEdit($programID)
public function batchEdit($programID = 0)
{
$this->lang->product->switcherMenu = '';
if($this->post->names)
@@ -553,7 +553,7 @@ class product extends control
}
}
$locate = $this->createLink('program', 'product', "programID=$programID");
$locate = $this->app->openApp == 'product' ? $this->createLink('product', 'all') : $this->createLink('program', 'product', "programID=$programID");
die(js::locate($locate, 'parent'));
}
@@ -594,6 +594,7 @@ class product extends control
$this->view->poUsers = $poUsers;
$this->view->qdUsers = $qdUsers;
$this->view->rdUsers = $rdUsers;
$this->view->programs = array('') + $this->program->getTopPairs();
unset($this->lang->product->typeList['']);
$this->display();
+3 -1
View File
@@ -35,13 +35,15 @@
#sidebar>.cell {width: 100%;}
.main-table thead>tr:first-of-type>th {border-left: 1px solid #ddd;}
th.table-nest-title .table-nest-toggle {margin-top: 5px; margin-left: 6px;}
th.table-nest-title .table-nest-toggle {margin-top: 8px; margin-left: 35px;}
th.table-nest-title .header {margin-left: 5px;}
th.table-nest-title .sort-up {padding-left: 5px;}
th.table-nest-title .sort-down {padding-left: 5px;}
th .check-all {left: -16px;}
#productTableList .icon-product:before {content: '\e98f'; width: 22px; height: 22px; background: none; color: #16a8f8; top: 0; line-height: 22px; margin-right: 2px; font-size: 14px;}
.table.has-sort-head thead>tr>th>a:after, .table.has-sort-head thead>tr>th>a:before {top: -3px;}
.main-table thead>tr>th {padding: 0px 8px; line-height: 24px;}
.icon-move {color: #16a8f8;}
+15
View File
@@ -34,4 +34,19 @@ $(function()
$('#productListForm').table('initNestedList');
}
});
$(".check-all, [id^='productIDList']").click(function()
{
setTimeout(function()
{
var checkedProduct = true;
$("[id^='productIDList']").each(function()
{
if(!$(this).prop('checked')) checkedProduct = false;
})
console.log(checkedProduct);
if(checkedProduct) $('.check-all').addClass('checked');
if(!checkedProduct) $('.check-all').removeClass('checked');
}, 100)
})
});
+12 -9
View File
@@ -657,15 +657,16 @@ class productModel extends model
$productID = (int)$productID;
$products[$productID] = new stdClass();
$products[$productID]->name = $productName;
$products[$productID]->PO = $data->POs[$productID];
$products[$productID]->QD = $data->QDs[$productID];
$products[$productID]->RD = $data->RDs[$productID];
$products[$productID]->type = $data->types[$productID];
$products[$productID]->status = $data->statuses[$productID];
$products[$productID]->desc = strip_tags($this->post->descs[$productID], $this->config->allowedTags);
$products[$productID]->acl = $data->acls[$productID];
$products[$productID]->order = $data->orders[$productID];
$products[$productID]->program = $data->programs[$productID];
$products[$productID]->name = $productName;
$products[$productID]->PO = $data->POs[$productID];
$products[$productID]->QD = $data->QDs[$productID];
$products[$productID]->RD = $data->RDs[$productID];
$products[$productID]->type = $data->types[$productID];
$products[$productID]->status = $data->statuses[$productID];
$products[$productID]->desc = strip_tags($this->post->descs[$productID], $this->config->allowedTags);
$products[$productID]->acl = $data->acls[$productID];
$products[$productID]->order = $data->orders[$productID];
/* Check unique name for edited products. */
if(isset($nameList[$productName])) dao::$errors['name'][] = 'product#' . $productID . sprintf($this->lang->error->unique, $this->lang->product->name, $productName);
@@ -676,6 +677,8 @@ class productModel extends model
foreach($products as $productID => $product)
{
$oldProduct = $oldProducts[$productID];
if($oldProduct->program != $product->program) $product->line = 0;
$this->dao->update(TABLE_PRODUCT)
->data($product)
->autoCheck()
+22 -4
View File
@@ -31,12 +31,16 @@
<?php else:?>
<div class="main-col">
<form class="main-table table-product" data-ride="table" data-nested='true' id="productListForm" method="post" action='<?php echo inLink('batchEdit', '');?>' data-preserve-nested='false' data-expand-nest-child='true'>
<?php $canOrder = common::hasPriv('product', 'updateOrder');?>
<table id="productList" class="table has-sort-head table-fixed table-nested">
<?php
$canOrder = common::hasPriv('product', 'updateOrder');
$canBatchEdit = common::hasPriv('product', 'batchEdit');
?>
<table id="productList" class="table has-sort-head table-fixed table-nested table-form">
<?php $vars = "browseType=$browseType&orderBy=%s";?>
<thead>
<tr class="text-center">
<th class='table-nest-title text-left' rowspan="2">
<?php if($canBatchEdit) echo "<div class='checkbox-primary check-all' title='{$this->lang->selectAll}'><label></label></div>";?>
<a class='table-nest-toggle table-nest-toggle-global' data-expand-text='<?php echo $lang->expand; ?>' data-collapse-text='<?php echo $lang->collapse; ?>'></a>
<?php common::printOrderLink('name', $orderBy, $vars, $lang->product->name);?>
</th>
@@ -135,8 +139,11 @@
?>
<tr class="text-center" <?php echo $trAttrs;?>>
<td class="c-name text-left" title='<?php echo $product->name?>'>
<span class='table-nest-icon icon icon-product'></span>
<?php echo html::a($this->createLink('product', 'browse', 'product=' . $product->id), $product->name);?>
<?php
$productLink = html::a($this->createLink('product', 'browse', 'product=' . $product->id), $product->name);
$productName = "<span class='table-nest-icon icon icon-product'></span>" . $productLink;
echo $canBatchEdit ? html::checkbox('productIDList', array($product->id => '')) . $productName : $productName;
?>
</td>
<?php if($this->config->URAndSR):?>
<td><?php echo $product->requirements['active'];?></td>
@@ -164,6 +171,17 @@
<?php endforeach;?>
</tbody>
</table>
<?php if(!empty($product) and $canBatchEdit):?>
<div class='table-footer'>
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<div class="table-actions btn-toolbar">
<?php
$actionLink = $this->createLink('product', 'batchEdit');
echo html::commonButton($lang->edit, "data-form-action='$actionLink'");
?>
</div>
</div>
<?php endif;?>
</form>
</div>
<?php endif;?>
+2
View File
@@ -51,6 +51,7 @@
$full = '';
}
?>
<th class='w-150px<?php echo zget($visibleFields, 'program', ' hidden') . zget($requiredFields, 'program', '', ' required');?>'><?php echo $lang->product->program;?></th>
<th class='required <?php echo $width;?>' style="<?php echo $full;?>"><?php echo $lang->product->name;?></th>
<th class='w-150px<?php echo zget($visibleFields, 'PO', ' hidden') . zget($requiredFields, 'PO', '', ' required');?>'><?php echo $lang->product->PO;?></th>
<th class='w-150px<?php echo zget($visibleFields, 'QD', ' hidden') . zget($requiredFields, 'QD', '', ' required');?>'><?php echo $lang->product->QD;?></th>
@@ -71,6 +72,7 @@
?>
<tr>
<td><?php echo sprintf('%03d', $productID) . html::hidden("productIDList[$productID]", $productID);?></td>
<td class='text-left<?php echo zget($visibleFields, 'program', ' hidden')?>' style='overflow:visible'><?php echo html::select("programs[$productID]", $programs, $products[$productID]->program, "class='form-control chosen'");?></td>
<td title='<?php echo $products[$productID]->name?>'><?php echo html::input("names[$productID]", $products[$productID]->name, "class='form-control'");?></td>
<td class='text-left<?php echo zget($visibleFields, 'PO', ' hidden')?>' style='overflow:visible'><?php echo html::select("POs[$productID]", $poUsers, $products[$productID]->PO, "class='form-control chosen'");?></td>
<td class='text-left<?php echo zget($visibleFields, 'QD', ' hidden')?>' style='overflow:visible'><?php echo html::select("QDs[$productID]", $qdUsers, $products[$productID]->QD, "class='form-control chosen'");?></td>