* Adjust style for no doc page.

This commit is contained in:
wangyidong
2023-10-18 16:40:55 +08:00
parent 40bd0c2bbe
commit ab8f4f1ab0
6 changed files with 185 additions and 229 deletions
+11 -8
View File
@@ -177,15 +177,18 @@ class dtable extends wg
{
global $lang;
$emptyTip = $this->prop('emptyTip', $lang->noData);
$createLink = !empty($this->prop('createLink')) ? $this->getLink($this->prop('createLink')) : '';
if(!empty($createLink))
$createLink = !empty($this->prop('createLink')) ? $this->prop('createLink') : '';
if(is_string($emptyTip))
{
$createTip = $this->prop('createTip', $lang->create);
$emptyTip = array('html' => "<div class='text-gray'>$emptyTip</div><a class='btn primary-pale border-primary' href='$createLink'><i class='icon icon-plus'></i> $createTip</a>", 'className' => 'row gap-4 items-center');
}
else
{
$emptyTip = array('html' => "$emptyTip", 'className' => 'text-gray');
if(!empty($createLink))
{
$createTip = $this->prop('createTip', $lang->create);
$emptyTip = array('html' => "<div class='text-gray'>$emptyTip</div><a class='btn primary-pale border-primary' href='$createLink'><i class='icon icon-plus'></i> $createTip</a>", 'className' => 'row gap-4 items-center');
}
else
{
$emptyTip = array('html' => "$emptyTip", 'className' => 'text-gray');
}
}
$this->setProp('emptyTip', $emptyTip);
}
+16 -17
View File
@@ -33,24 +33,23 @@ foreach($lang->doc->createList as $typeKey => $typeName)
$buildCreateBtn = function($type, $objectID, $lib, $moduleID, $templateParam, $buttonItems) use($app, $lang)
{
return btngroup
return btngroup(
btn
(
btn
(
setClass('btn primary ml-2'),
set::icon('plus'),
set::url(createLink('doc', 'create', "objectType={$type}&objectID={$objectID}&libID={$lib->id}&moduleID={$moduleID}&type=html{$templateParam}")),
set('data-app', $app->tab),
$lang->doc->create
),
dropdown
(
btn(setClass('btn primary dropdown-toggle'),
setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
set::placement('bottom-end'),
set::items($buttonItems),
)
);
setClass('btn primary ml-2'),
set::icon('plus'),
set::url(createLink('doc', 'create', "objectType={$type}&objectID={$objectID}&libID={$lib->id}&moduleID={$moduleID}&type=html{$templateParam}")),
set('data-app', $app->tab),
$lang->doc->create
),
dropdown
(
btn(setClass('btn primary dropdown-toggle'),
setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
set::placement('bottom-end'),
set::items($buttonItems),
)
);
};
$createButton = $buildCreateBtn($type, $objectID, $lib, $moduleID, $templateParam, $buttonItems);
+30 -44
View File
@@ -10,50 +10,36 @@ declare(strict_types=1);
*/
namespace zin;
$docContent = null;
if(empty($docs))
jsVar('iconList', $config->doc->iconList);
jsVar('draftText', $lang->doc->draft);
jsVar('canViewDoc', common::hasPriv('doc', 'view'));
jsVar('canCollect', common::hasPriv('doc', 'collect') && $libType && $libType != 'api');
jsVar('currentAccount', $app->user->account);
$cols = array();
foreach($config->doc->dtable->fieldList as $colName => $col)
{
$emptyCreateBtn = $buildCreateBtn($type, $objectID, $lib, $moduleID, $templateParam, $buttonItems);
$docContent = div
(
setClass('table-empty-tip flex justify-center items-center'),
span
(
setClass('text-gray'),
$lang->doc->noDoc
),
$browseType != 'bySearch' && $libID && (common::hasPriv('doc', 'create') || (common::hasPriv('api', 'create') && !$apiLibID)) ? $emptyCreateBtn : null
);
if($canExport && $colName == 'id') $col['type'] = 'checkID';
if(!in_array($colName, array('id', 'title', 'addedBy', 'addedDate', 'editedBy', 'editedDate', 'actions'))) continue;
$cols[$colName] = $col;
}
else
{
jsVar('iconList', $config->doc->iconList);
jsVar('draftText', $lang->doc->draft);
jsVar('canViewDoc', common::hasPriv('doc', 'view'));
jsVar('canCollect', common::hasPriv('doc', 'collect') && $libType && $libType != 'api');
jsVar('currentAccount', $app->user->account);
$cols = array();
foreach($config->doc->dtable->fieldList as $colName => $col)
{
if($canExport && $colName == 'id') $col['type'] = 'checkID';
if(!in_array($colName, array('id', 'title', 'addedBy', 'addedDate', 'editedBy', 'editedDate', 'actions'))) continue;
$cols[$colName] = $col;
}
$params = "objectID={$objectID}&libID={$libID}&moduleID={$moduleID}&browseType={$browseType}&orderBy={$orderBy}&param={$param}&recTotal={recTotal}&recPerPage={recPerPage}&pageID={page}";
$tableData = initTableData($docs, $cols);
$docContent = dtable
(
set::module($this->app->moduleName),
set::userMap($users),
set::cols($cols),
set::data($tableData),
set::checkable($canExport),
set::onRenderCell(jsRaw('window.rendDocCell')),
set::orderBy($orderBy),
set::sortLink(createLink($app->rawModule, $app->rawMethod, "objectID={$objectID}&libID={$libID}&moduleID={$moduleID}&browseType={$browseType}&orderBy={name}_{sortType}&param={$param}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
set::footPager(usePager(array('linkCreator' => helper::createLink($app->rawModule, $app->rawMethod, $params)))),
);
}
$params = "objectID={$objectID}&libID={$libID}&moduleID={$moduleID}&browseType={$browseType}&orderBy={$orderBy}&param={$param}&recTotal={recTotal}&recPerPage={recPerPage}&pageID={page}";
$tableData = empty($docs) ? array() : initTableData($docs, $cols);
$createDocLink = '';
if($browseType != 'bysearch' && $libID && common::hasPriv('doc', 'create')) $createDocLink = createLink('doc', 'create', "objectType={$type}&objectID={$objectID}&libID={$lib->id}&moduleID={$moduleID}&type=html{$templateParam}");
$docContent = dtable(
set::module($this->app->moduleName),
set::userMap($users),
set::cols($cols),
set::data($tableData),
set::checkable($canExport),
set::onRenderCell(jsRaw('window.rendDocCell')),
set::emptyTip($lang->doc->noDoc),
set::createLink($createDocLink),
set::createTip($lang->doc->create),
set::orderBy($orderBy),
set::sortLink(createLink($app->rawModule, $app->rawMethod, "objectID={$objectID}&libID={$libID}&moduleID={$moduleID}&browseType={$browseType}&orderBy={name}_{sortType}&param={$param}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
set::footPager(usePager(array('linkCreator' => helper::createLink('doc', $app->rawMethod, $params)))),
);
+36 -54
View File
@@ -10,61 +10,43 @@ declare(strict_types=1);
*/
namespace zin;
$docContent = null;
if(empty($docs))
jsVar('iconList', $config->doc->iconList);
jsVar('draftText', $lang->doc->draft);
jsVar('canViewDoc', common::hasPriv('doc', 'view'));
jsVar('canCollect', common::hasPriv('doc', 'collect') && $libType && $libType != 'api');
jsVar('currentAccount', $app->user->account);
jsVar('spaceMethodList', $config->doc->spaceMethod);
jsVar('myspacePriv', common::hasPriv('doc', 'myspace'));
jsVar('productspacePriv', common::hasPriv('doc', 'productspace'));
jsVar('projectspacePriv', common::hasPriv('doc', 'projectspace'));
jsVar('teamspacePriv', common::hasPriv('doc', 'teamspace'));
jsVar('currentTab', $app->tab);
$cols = array();
foreach($config->doc->dtable->fieldList as $colName => $col)
{
$emptyCreateBtn = isset($buildCreateBtn) && is_callable($buildCreateBtn) ? $buildCreateBtn($type, $objectID, $lib, $moduleID, $templateParam, $buttonItems) : null;
$docContent = div
(
setClass('table-empty-tip flex justify-center items-center'),
span
(
setClass('text-gray'),
$lang->doc->noDoc
),
$browseType != 'bysearch' && $libID && common::hasPriv('doc', 'create') ? $emptyCreateBtn : null
);
if($type == 'mine' && in_array($colName, array('objectName', 'module', 'editedBy'))) continue;
if($colName == 'addedBy' && in_array($type, array('mine', 'createdby'))) continue;
if($canExport && $colName == 'id') $col['type'] = 'checkID';
$cols[$colName] = $col;
}
else
{
jsVar('iconList', $config->doc->iconList);
jsVar('draftText', $lang->doc->draft);
jsVar('canViewDoc', common::hasPriv('doc', 'view'));
jsVar('canCollect', common::hasPriv('doc', 'collect') && $libType && $libType != 'api');
jsVar('currentAccount', $app->user->account);
jsVar('spaceMethodList', $config->doc->spaceMethod);
jsVar('myspacePriv', common::hasPriv('doc', 'myspace'));
jsVar('productspacePriv', common::hasPriv('doc', 'productspace'));
jsVar('projectspacePriv', common::hasPriv('doc', 'projectspace'));
jsVar('teamspacePriv', common::hasPriv('doc', 'teamspace'));
jsVar('currentTab', $app->tab);
$cols = array();
foreach($config->doc->dtable->fieldList as $colName => $col)
{
if($type == 'mine' && in_array($colName, array('objectName', 'module', 'editedBy'))) continue;
if($colName == 'addedBy' && in_array($type, array('mine', 'createdby'))) continue;
if($canExport && $colName == 'id') $col['type'] = 'checkID';
$cols[$colName] = $col;
}
$tableData = initTableData($docs, $cols);
$params = "libID={$libID}&moduleID={$moduleID}&browseType={$browseType}&param={$param}&orderBy={$orderBy}&recTotal={recTotal}&recPerPage={recPerPage}&pageID={page}";
if($app->rawMethod == 'myspace') $params = "type={$type}&" . $params;
$docContent = dtable
(
set::userMap($users),
set::cols($cols),
set::data($tableData),
set::checkable($canExport),
set::onRenderCell(jsRaw('window.rendDocCell')),
set::footPager(
usePager
(
array('linkCreator' => helper::createLink('doc', $app->rawMethod, $params)),
),
),
);
}
$params = "libID={$libID}&moduleID={$moduleID}&browseType={$browseType}&param={$param}&orderBy={$orderBy}&recTotal={recTotal}&recPerPage={recPerPage}&pageID={page}";
$tableData = empty($docs) ? array() : initTableData($docs, $cols);
$createDocLink = '';
if($browseType != 'bysearch' && $libID && common::hasPriv('doc', 'create')) $createDocLink = createLink('doc', 'create', "objectType={$type}&objectID={$objectID}&libID={$lib->id}&moduleID={$moduleID}&type=html{$templateParam}");
if($app->rawMethod == 'myspace') $params = "type={$type}&" . $params;
$docContent = dtable
(
set::userMap($users),
set::cols($cols),
set::data($tableData),
set::checkable($canExport),
set::onRenderCell(jsRaw('window.rendDocCell')),
set::emptyTip($lang->doc->noDoc),
set::createLink($createDocLink),
set::createTip($lang->doc->create),
set::footPager(usePager(array('linkCreator' => helper::createLink('doc', $app->rawMethod, $params)))),
);
+28 -35
View File
@@ -11,7 +11,6 @@ declare(strict_types=1);
namespace zin;
include 'lefttree.html.php';
if($libID && common::hasPriv('doc', 'create')) include 'createbutton.html.php';
include 'mydoclist.html.php';
jsVar('browseType', $browseType);
jsVar('docLang', $lang->doc);
@@ -19,39 +18,33 @@ jsVar('confirmDelete', $lang->doc->confirmDelete);
jsVar('appTab', $app->tab);
jsVar('treeData', $libTree);
div
/* zin: Define the set::module('doc') feature bar on main menu. */
featureBar
(
setClass('flex flex-wrap content-start'),
/* zin: Define the set::module('doc') feature bar on main menu. */
featureBar
(
set::current($browseType),
set::linkParams("type={$type}&libID={$libID}&moduleID={$moduleID}&browseType={key}"),
li(searchToggle(set::module($type . $libType . 'Doc')))
),
toolbar
(
$canExport ? item(set(array
(
'icon' => 'export',
'class' => 'ghost export',
'text' => $lang->export,
'url' => createLink('doc', 'mine2export', "libID={$libID}&moduleID={$moduleID}"),
'data-toggle' => 'modal'
))) : null,
common::hasPriv('doc', 'createLib') ? item(set(array
(
'icon' => 'plus',
'class' => 'btn secondary',
'text' => $lang->doc->createLib,
'url' => createLink('doc', 'createLib', 'type=mine'),
'data-toggle' => 'modal'
))) : null,
$libID && common::hasPriv('doc', 'create') ? $createButton : null
),
div
(
setClass('doc-content mt-2 flex-initial w-full'),
$docContent
)
set::current($browseType),
set::linkParams("type={$type}&libID={$libID}&moduleID={$moduleID}&browseType={key}"),
li(searchToggle(set::module($type . $libType . 'Doc')))
);
toolbar
(
$canExport ? item(set(array
(
'icon' => 'export',
'class' => 'ghost export',
'text' => $lang->export,
'url' => createLink('doc', 'mine2export', "libID={$libID}&moduleID={$moduleID}"),
'data-toggle' => 'modal'
))) : null,
common::hasPriv('doc', 'createLib') ? item(set(array
(
'icon' => 'plus',
'class' => 'btn secondary',
'text' => $lang->doc->createLib,
'url' => createLink('doc', 'createLib', 'type=mine'),
'data-toggle' => 'modal'
))) : null,
$libID && common::hasPriv('doc', 'create') ? $createButton : null
);
include 'mydoclist.html.php';
$docContent;
+64 -71
View File
@@ -19,6 +19,69 @@ if($canExport)
if($libType == 'api') $exportLink = $this->createLink('api', $exportMethod, "libID={$libID}&version=0&release={$release}&moduleID={$moduleID}");
}
/* zin: Define the set::module('doc') feature bar on main menu. */
featureBar
(
set::current($browseType),
set::method('tableContents'),
set::linkParams("objectID={$objectID}&libID={$libID}&moduleID={$moduleID}&browseType={key}"),
li(searchToggle(set::module($type . $libType . 'Doc')))
);
toolbar
(
$libType == 'api' && common::hasPriv('api', 'struct') ? item(set(array
(
'icon' => 'treemap',
'class' => 'ghost',
'text' => $lang->api->struct,
'url' => createLink('api', 'struct', "libID={$libID}"),
))) : null,
$libType == 'api' && common::hasPriv('api', 'releases') ? item(set(array
(
'icon' => 'version',
'class' => 'ghost',
'text' => $lang->api->releases,
'url' => createLink('api', 'releases', "libID={$libID}"),
'data-toggle' => 'modal'
))) : null,
$libType == 'api' && common::hasPriv('api', 'createRelease') ? item(set(array
(
'icon' => 'publish',
'class' => 'ghost',
'text' => $lang->api->createRelease,
'url' => createLink('api', 'createRelease', "libID={$libID}"),
'data-toggle' => 'modal'
))) : null,
$canExport ? item(set(array
(
'id' => $exportMethod,
'icon' => 'export',
'class' => 'ghost export',
'text' => $lang->export,
'url' => $exportLink,
'data-toggle' => 'modal'
))) : null,
common::hasPriv('doc', 'createLib') ? item(set(array
(
'icon' => 'plus',
'class' => 'btn secondary',
'text' => $lang->doc->createLib,
'url' => createLink('doc', 'createLib', "type={$type}&objectID={$objectID}"),
'data-toggle' => 'modal'
))) : null,
$libType == 'api' && common::hasPriv('api', 'create') ? item(set(array
(
'icon' => 'plus',
'class' => 'btn primary ml-2',
'text' => $lang->api->createApi,
'url' => createLink('api', 'create', "libID={$libID}&moduleID={$moduleID}"),
'data-size' => 'lg',
'data-toggle' => 'modal'
))) : null,
$libType != 'api' && $libID && common::hasPriv('doc', 'create') ? $createButton : null
);
if($browseType == 'annex')
{
include 'showfiles.html.php';
@@ -33,74 +96,4 @@ else
include 'doclist.html.php';
}
/* zin: Define the set::module('doc') feature bar on main menu. */
div
(
setClass('flex flex-wrap content-start'),
featureBar
(
set::current($browseType),
set::method('tableContents'),
set::linkParams("objectID={$objectID}&libID={$libID}&moduleID={$moduleID}&browseType={key}"),
li(searchToggle(set::module($type . $libType . 'Doc')))
),
toolbar
(
$libType == 'api' && common::hasPriv('api', 'struct') ? item(set(array
(
'icon' => 'treemap',
'class' => 'ghost',
'text' => $lang->api->struct,
'url' => createLink('api', 'struct', "libID={$libID}"),
))) : null,
$libType == 'api' && common::hasPriv('api', 'releases') ? item(set(array
(
'icon' => 'version',
'class' => 'ghost',
'text' => $lang->api->releases,
'url' => createLink('api', 'releases', "libID={$libID}"),
'data-toggle' => 'modal'
))) : null,
$libType == 'api' && common::hasPriv('api', 'createRelease') ? item(set(array
(
'icon' => 'publish',
'class' => 'ghost',
'text' => $lang->api->createRelease,
'url' => createLink('api', 'createRelease', "libID={$libID}"),
'data-toggle' => 'modal'
))) : null,
$canExport ? item(set(array
(
'id' => $exportMethod,
'icon' => 'export',
'class' => 'ghost export',
'text' => $lang->export,
'url' => $exportLink,
'data-toggle' => 'modal'
))) : null,
common::hasPriv('doc', 'createLib') ? item(set(array
(
'icon' => 'plus',
'class' => 'btn secondary',
'text' => $lang->doc->createLib,
'url' => createLink('doc', 'createLib', "type={$type}&objectID={$objectID}"),
'data-toggle' => 'modal'
))) : null,
$libType == 'api' && common::hasPriv('api', 'create') ? item(set(array
(
'icon' => 'plus',
'class' => 'btn primary ml-2',
'text' => $lang->api->createApi,
'url' => createLink('api', 'create', "libID={$libID}&moduleID={$moduleID}"),
'data-size' => 'lg',
'data-toggle' => 'modal'
))) : null,
$libType != 'api' && $libID && common::hasPriv('doc', 'create') ? $createButton : null
),
div
(
setClass('doc-content mt-2 flex-initial w-full'),
$docContent
)
);
$docContent;