* code for task #90784.

This commit is contained in:
wangyidong
2023-04-11 11:19:22 +08:00
parent 3ce431f253
commit 73ed3946e2
7 changed files with 51 additions and 38 deletions
+6 -1
View File
@@ -1185,7 +1185,12 @@ if($config->edition == 'biz' or $config->edition == 'max')
$lang->tree->methodOrder[35] = 'editHost';
$lang->host->methodOrder[40] = 'groupMaintenance';
$lang->resource->doc->diff = 'diffAction';
$lang->resource->doc->diff = 'diffAction';
$lang->resource->doc->mine2export = 'mine2export';
$lang->resource->doc->product2export = 'product2export';
$lang->resource->doc->project2export = 'project2export';
$lang->resource->doc->custom2export = 'custom2export';
$lang->resource->doc->execution2export = 'execution2export';
$lang->resource->my->review = 'review';
+33 -28
View File
@@ -64,6 +64,7 @@ class doc extends control
$this->session->set('executionList', $uri, 'execution');
$this->session->set('projectList', $uri, 'project');
$this->session->set('objectName', '', 'doc');
$this->session->set('spaceType', 'mine', 'doc');
$this->loadModel('search');
list($libs, $libID, $object, $objectID, $objectDropdown) = $this->doc->setMenuByType('mine', 0, $libID);
@@ -1122,7 +1123,7 @@ class doc extends control
$objectType = isset($lib->type) ? $lib->type : 'custom';
$type = $objectType == 'execution' && $this->app->tab != 'execution' ? 'project' : $objectType;
$objectID = isset($doc->{$type}) ? $doc->{$type} : 0;
$objectID = zget($doc, $type, 0);
list($libs, $libID, $object, $objectID, $objectDropdown) = $this->doc->setMenuByType($type, $objectID, $doc->lib, $appendLib);
$moduleTree = $this->doc->getTreeMenu($type, $objectID, $libID, 0, $docID);
@@ -1205,50 +1206,54 @@ class doc extends control
}
}
$doc = $docID ? $doc : '';
$spaceType = $objectType . 'Space';
$doc = $docID ? $doc : '';
/* Crumbs links array. */
$methodName = in_array($type, array('product', 'project')) ? $objectType . 'Space' : 'tableContents';
$linkObject = zget($lib, $type, 0);
if($this->app->tab == 'execution' and $objectType == 'execution') $linkObject = zget($lib, 'execution', 0);
$linkParams = "objectID=$linkObject&libID=$lib->id";
$linkParams = "objectID={$objectID}&libID={$lib->id}";
if($this->app->tab == 'execution' or $objectType == 'custom')
{
$linkParams = "objectType=$objectType&$linkParams";
$methodName = 'tableContents';
}
if($type == 'mine')
{
$linkParams = "type=mine&libID={$lib->id}";
$methodName = 'mySpace';
}
$crumbs[] = html::a(inLink($methodName, $linkParams), html::image("static/svg/wiki-file-lib.svg") . $lib->name);
$moduleList = $this->loadModel('tree')->getParents($doc->module);
foreach($moduleList as $module)
{
$linkParams .= "&moduleID=$module->id";
$crumbs[] = html::a(inLink($methodName, $linkParams), $module->name);
$withModuleParams = $linkParams . "&moduleID=$module->id";
$crumbs[] = html::a(inLink($methodName, $withModuleParams), $module->name);
}
$this->view->title = isset($this->lang->doc->{$spaceType}) ? $this->lang->doc->{$spaceType} : $this->lang->doc->common;
$this->view->docID = $docID;
$this->view->doc = $doc;
$this->view->version = $version;
$this->view->object = $object;
$this->view->objectID = $objectID;
$this->view->objectType = $objectType;
$this->view->type = $type;
$this->view->libID = $libID;
$this->view->crumbs = $crumbs;
$this->view->lib = isset($libs[$libID]) ? $libs[$libID] : new stdclass();
$this->view->libs = $this->doc->getLibsByObject($type, $objectID);
$this->view->canBeChanged = common::canModify($type, $object); // Determines whether an object is editable.
$this->view->actions = $docID ? $this->action->getList('doc', $docID) : array();
$this->view->users = $this->user->getPairs('noclosed,noletter');
$this->view->autoloadPage = $this->doc->checkAutoloadPage($doc);
$this->view->libTree = $this->doc->getLibTree($libID, $libs, $type, $doc->module, $objectID);
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('doc', $docID);
$this->view->moduleID = $doc->module;
$spaceType = $objectType . 'Space';
$this->view->title = isset($this->lang->doc->{$spaceType}) ? $this->lang->doc->{$spaceType} : $this->lang->doc->common;
$this->view->docID = $docID;
$this->view->doc = $doc;
$this->view->version = $version;
$this->view->object = $object;
$this->view->objectID = $objectID;
$this->view->objectType = $objectType;
$this->view->type = $type;
$this->view->libID = $libID;
$this->view->crumbs = $crumbs;
$this->view->lib = isset($libs[$libID]) ? $libs[$libID] : new stdclass();
$this->view->libs = $this->doc->getLibsByObject($type, $objectID);
$this->view->canBeChanged = common::canModify($type, $object); // Determines whether an object is editable.
$this->view->actions = $docID ? $this->action->getList('doc', $docID) : array();
$this->view->users = $this->user->getPairs('noclosed,noletter');
$this->view->autoloadPage = $this->doc->checkAutoloadPage($doc);
$this->view->libTree = $this->doc->getLibTree($libID, $libs, $type, $doc->module, $objectID);
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('doc', $docID);
$this->view->moduleID = $doc->module;
$this->view->objectDropdown = $objectDropdown;
$this->view->canExport = ($this->config->edition != 'open' && common::hasPriv('doc', $type . '2export'));
$this->view->exportMethod = $type . '2export';
$this->display();
}
+1
View File
@@ -187,6 +187,7 @@ $(function()
simplemde.value(String($('#markdownContent').val()));
simplemde.togglePreview();
}
$('#docExport').attr('href', createLink('doc', exportMethod, 'libID=' + libID + '&docID=' + docID + '&version=' + $('#content .doc-title .version').data('version')));
});
})
+1 -1
View File
@@ -984,7 +984,7 @@ class docModel extends model
if($files) $docContent->files .= ',' . join(',', array_keys($files));
$docContent->files = trim($docContent->files, ',');
if(isset($doc->digest)) $docContent->digest = $doc->digest;
if($doc->status == 'draft')
if($oldDoc->status == 'draft')
{
$this->dao->update(TABLE_DOCCONTENT)->data($docContent)->where('id')->eq($oldDocContent->id)->exec();
}
+2 -2
View File
@@ -22,8 +22,8 @@
<?php if(!empty($libTree)):?>
<?php foreach($lang->doc->featureBar['tableContents'] as $barType => $barName):?>
<?php $active = $barType == $browseType ? 'btn-active-text' : '';?>
<?php $linkParams = $app->rawMethod == 'tablecontents' ? "type=$type&objectID=$objectID&libID=$libID&moduleID=$moduleID&browseType=$barType": "objectID=$objectID&libID=$libID&moduleID=$moduleID&browseType=$barType";?>
<?php echo html::a($this->createLink('doc', $app->rawMethod, $linkParams), $barName . ($active ? "<span class='label label-light label-badge'>{$pager->recTotal}</span>" : ''), '', "class='btn btn-link $active' id='{$barType}Tab'");?>
<?php $linkParams = "type=$type&libID=$libID&moduleID=$moduleID&browseType=$barType";?>
<?php echo html::a($this->createLink('doc', $app->rawMethod, $linkParams), "<span class='text'>{$barName}</span>" . ($active ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>" : ''), '', "class='btn btn-link $active' id='{$barType}Tab'");?>
<?php endforeach;?>
<a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->doc->searchDoc;?></a>
<?php endif;?>
+1 -1
View File
@@ -23,7 +23,7 @@
<?php foreach($lang->doc->featureBar['tableContents'] as $barType => $barName):?>
<?php $active = $barType == $browseType ? 'btn-active-text' : '';?>
<?php $linkParams = $app->rawMethod == 'tablecontents' ? "type=$type&objectID=$objectID&libID=$libID&moduleID=$moduleID&browseType=$barType": "objectID=$objectID&libID=$libID&moduleID=$moduleID&browseType=$barType";?>
<?php echo html::a($this->createLink('doc', $app->rawMethod, $linkParams), $barName . ($active ? "<span class='label label-light label-badge'>{$pager->recTotal}</span>" : ''), '', "class='btn btn-link $active' id='{$barType}Tab'");?>
<?php echo html::a($this->createLink('doc', $app->rawMethod, $linkParams), "<span class='text'>{$barName}</span>" . ($active ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>" : ''), '', "class='btn btn-link $active' id='{$barType}Tab'");?>
<?php endforeach;?>
<?php endif;?>
<a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->doc->searchDoc;?></a>
+7 -5
View File
@@ -16,6 +16,8 @@
<?php js::set('docID', $docID);?>
<?php js::set('linkParams', "objectID=$objectID&%s");?>
<?php js::set('docLang', $lang->doc);?>
<?php js::set('exportMethod', $exportMethod);?>
<?php js::set('libID', $libID);?>
<?php if($app->tab == 'execution'):;?>
<style>.panel-body{min-height: 180px}</style>
<?php endif;?>
@@ -25,11 +27,11 @@
<?php echo html::backButton("<i class='icon icon-back icon-sm'></i> " . $lang->goback, "id='backBtn'", 'btn btn-link')?>
</div>
<div class="btn-toolbar pull-right">
<?php
common::printLink('project', 'export', "", "<i class='icon-export muted'> </i>" . $lang->export, '', "class='btn btn-link export'");
if(common::hasPriv('api', 'create')) echo html::a($this->createLink('api', 'create', "libID=$libID&moduleID=$moduleID", '', true), '<i class="icon icon-plus"></i> ' . $lang->api->createApi, '', 'class="btn btn-primary iframe" data-width="95%"');
if(common::hasPriv('doc', 'create')) echo $this->doc->printCreateBtn($lib, $type, $objectID, $moduleID);
?>
<?php
if($canExport) echo html::a($this->createLink('doc', $exportMethod, "libID=$libID&docID=$docID"), "<i class='icon-export muted'> </i>" . $lang->export, 'hiddenwin', "class='btn btn-link' id='docExport'");
if(common::hasPriv('api', 'create')) echo html::a($this->createLink('api', 'create', "libID=$libID&moduleID=$moduleID", '', true), '<i class="icon icon-plus"></i> ' . $lang->api->createApi, '', 'class="btn btn-primary iframe" data-width="95%"');
if(common::hasPriv('doc', 'create')) echo $this->doc->printCreateBtn($lib, $type, $objectID, $moduleID);
?>
</div>
</div>
<div id='mainContent'class="fade flex">