* Fix doc create.

This commit is contained in:
zhujinyong
2021-04-02 07:33:26 +08:00
parent 0a33e2e6ed
commit 1a45ed22ac
6 changed files with 45 additions and 10 deletions
+25 -8
View File
@@ -214,7 +214,7 @@ class doc extends control
if(!dao::isError())
{
$this->action->create('docLib', $libID, 'Created');
die(js::locate($this->createLink($this->moduleName, 'browse', "libID=$libID"), 'parent.parent'));
die(js::locate($this->createLink('doc', 'objectLibs', "type=$type&objectID=$objectID&libID=$libID"), 'parent.parent'));
}
else
{
@@ -222,9 +222,9 @@ class doc extends control
}
}
$projectID = $this->session->project;
$products = $this->product->getProductPairsByProject($projectID, 'noclosed');
$executions = $this->execution->getByProject($projectID, 'all', 0, true);
$products = $this->product->getPairs();
$projects = $this->project->getPairsByProgram();
$executions = $this->execution->getPairs();
$libTypeList = $this->lang->doc->libTypeList;
if(empty($products)) unset($libTypeList['product']);
@@ -233,6 +233,7 @@ class doc extends control
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->users = $this->user->getPairs('nocode');
$this->view->products = $products;
$this->view->projects = $projects;
$this->view->executions = $executions;
$this->view->type = $type;
$this->view->libTypeList = $libTypeList;
@@ -306,7 +307,7 @@ class doc extends control
* @access public
* @return void
*/
public function create($libID, $moduleID = 0, $docType = '')
public function create($type, $objectID, $libID, $moduleID = 0, $docType = '')
{
if(!empty($_POST))
{
@@ -332,6 +333,22 @@ class doc extends control
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
}
if($this->app->openApp == 'product')
{
$this->product->setMenu($objectID);
unset($this->lang->product->menu->doc['subMenu']);
}
else if($this->app->openApp == 'project')
{
$this->project->setMenu($objectID);
unset($this->lang->project->menu->doc['subMenu']);
}
else if($this->app->openApp == 'execution')
{
$this->execution->setMenu($objectID);
unset($this->lang->exectuion->menu->doc['subMenu']);
}
$lib = $this->doc->getLibByID($libID);
$type = $lib->type;
@@ -883,9 +900,6 @@ class doc extends control
$this->app->rawMethod = '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->lang->TRActions .= common::hasPriv('doc', 'create') ? $this->doc->buildCreateButton4Doc() : '';
$object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch();
if(empty($object)) $this->locate($this->createLink($type, 'create', '', '', '', $this->session->project));
@@ -898,6 +912,9 @@ class doc extends control
$actionURL = $this->createLink('doc', 'browse', "lib=0&browseType=bySearch&queryID=myQueryID");
$this->doc->buildSearchForm(0, array(), 0, $actionURL, 'objectLibs');
$this->lang->TRActions = common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib', "type=$type&objectID=$objectID"), "<i class='icon icon-plus'></i> " . $this->lang->doc->createlib, '', "class='btn btn-secondary iframe' data-width='70%'") : '';
$this->lang->TRActions .= common::hasPriv('doc', 'create') ? $this->doc->buildCreateButton4Doc($type, $objectID) : '';
$this->view->customObjectLibs = $customObjectLibs;
$this->view->showLibs = $this->config->doc->custom->objectLibs;
+10
View File
@@ -14,18 +14,28 @@ function changeByLibType(libType)
if(libType == 'product')
{
$('table tr.product').removeClass('hidden');
$('table tr.project').addClass('hidden');
$('table tr.execution').addClass('hidden');
changeDoclibAcl(libType);
}
else if(libType == 'project')
{
$('table tr.product').addClass('hidden');
$('table tr.project').removeClass('hidden');
$('table tr.execution').addClass('hidden');
changeDoclibAcl(libType);
}
else if(libType == 'execution')
{
$('table tr.product').addClass('hidden');
$('table tr.project').addClass('hidden');
$('table tr.execution').removeClass('hidden');
changeDoclibAcl(libType);
}
else
{
$('table tr.product').addClass('hidden');
$('table tr.project').addClass('hidden');
$('table tr.execution').addClass('hidden');
changeDoclibAcl(libType);
}
+1
View File
@@ -104,6 +104,7 @@ $lang->doc->allProduct = 'All' . $lang->productCommon . 's';
$lang->doc->allExecutions = 'All' . $lang->executionCommon . 's';
$lang->doc->libTypeList['product'] = $lang->productCommon . ' Library';
$lang->doc->libTypeList['project'] = 'Project Library';
$lang->doc->libTypeList['execution'] = $lang->executionCommon . ' Library';
$lang->doc->libTypeList['custom'] = 'Custom Library';
+1
View File
@@ -104,6 +104,7 @@ $lang->doc->allProduct = '所有' . $lang->productCommon;
$lang->doc->allExecutions = '所有' . $lang->executionCommon;
$lang->doc->libTypeList['product'] = $lang->productCommon . '文档库';
$lang->doc->libTypeList['project'] = '项目文档库';
$lang->doc->libTypeList['execution'] = $lang->executionCommon . '文档库';
$lang->doc->libTypeList['custom'] = '自定义文档库';
+4 -2
View File
@@ -1596,10 +1596,12 @@ class docModel extends model
/**
* Build document module index page create document button.
*
* @param string $type
* @param int $objectID
* @access public
* @return string
*/
public function buildCreateButton4Doc()
public function buildCreateButton4Doc($type, $objectID)
{
$libs = $this->getLibs('all', strpos($this->config->doc->custom->showLibs, 'unclosed') !== false ? 'unclosedProject' : '');
$html = "";
@@ -1613,7 +1615,7 @@ class docModel extends model
{
$class = strpos($this->config->doc->officeTypes, $typeKey) !== false ? 'iframe' : '';
$html .= "<li>";
$html .= html::a(helper::createLink('doc', 'create', "libID=$libID&moduleID=0&type=$typeKey"), $typeName, '', "class='$class'");
$html .= html::a(helper::createLink('doc', 'create', "type=$type&objectID=$objectID&libID=$libID&moduleID=0&type=$typeKey"), $typeName, '', "class='$class' data-app='{$this->app->openApp}'");
$html .= "</li>";
}
$html .="</ul></div>";
+4
View File
@@ -29,6 +29,10 @@
<th><?php echo $lang->doc->product?></th>
<td><?php echo html::select('product', $products, $type == 'product' ? $objectID : '', "class='form-control chosen' data-drop_direction='down'")?></td>
</tr>
<tr class='project hidden'>
<th><?php echo $lang->doc->project?></th>
<td><?php echo html::select('project', $projects, $type == 'project' ? $objectID : '', "class='form-control chosen' data-drop_direction='down'")?></td>
</tr>
<tr class='execution hidden'>
<th><?php echo $lang->doc->execution?></th>
<td><?php echo html::select('execution', $executions, $type == 'execution' ? $objectID : '', "class='form-control chosen' data-drop_direction='down'")?></td>