* [misc] add docVersion property to docApp.

This commit is contained in:
sunhao
2024-11-01 14:30:59 +08:00
committed by 谢杞钰
parent 75f92d65f8
commit 144a4aea6e
2 changed files with 18 additions and 10 deletions
+16 -10
View File
@@ -139,15 +139,9 @@ zui.AjaxForm.DEFAULT.onResult = function(res)
*/
function handleSwitchView(mode, location, info)
{
const rawModule = config.rawModule.toLowerCase();
const rawMethod = config.rawMethod.toLowerCase();
const formatUrl = this.props.viewModeUrl;
if(!formatUrl || (rawModule === 'doc' && rawMethod === 'view' && mode === 'view' && !lastAppUrl))
{
top.document.title = info.title ? (info.title + documentTitleSuffix) : originalDocumentTitle;
return;
}
const rawModule = config.rawModule.toLowerCase();
const rawMethod = config.rawMethod.toLowerCase();
const formatUrl = this.props.viewModeUrl;
const formatOptions = $.extend({recTotal: 0, recPerPage: 20, page: 1}, location, location.pager,
{
mode : mode,
@@ -157,7 +151,19 @@ function handleSwitchView(mode, location, info)
noSpace : location.noSpace || 0,
filterType: encodeURIComponent(location.filterType || '')
});
const url = (typeof formatUrl === 'function' ? formatUrl.call(this, formatOptions) : zui.formatString(formatUrl, formatOptions).replace('&libID=0&moduleID=0&docID=0&mode=home&orderBy=id_desc&recTotal=0&recPerPage=0&pageID=1&filterType=&search=&noSpace=false', '').replace('&libID=0&moduleID=0&browseType=all&param=&orderBy=&recTotal=0&recPerPage=20&pageID=1&mode=home&docID=0&search=', ''));
let url;
if(typeof formatUrl === 'function')
{
url = formatUrl.call(this, formatOptions);
}
else if(mode === 'view')
{
url = $.createLink('doc', 'view', `docID=${location.docID}` + (info.data && location.docVersion && location.docVersion !== info.data.version ? `&version=${location.docVersion}` : ''));
}
else
{
url = zui.formatString(formatUrl, formatOptions).replace('&libID=0&moduleID=0&docID=0&mode=home&orderBy=id_desc&recTotal=0&recPerPage=0&pageID=1&filterType=&search=&noSpace=false', '').replace('&libID=0&moduleID=0&browseType=all&param=&orderBy=&recTotal=0&recPerPage=20&pageID=1&mode=home&docID=0&search=', '');
}
if(url === lastAppUrl) return;
if(lastAppUrl && !$.apps.getAppUrl().endsWith(url)) $.apps.updateAppUrl(url, info.title ? (info.title + documentTitleSuffix) : originalDocumentTitle);
lastAppUrl = url;
+2
View File
@@ -29,6 +29,7 @@ class docApp extends wg
'libID' => '?number', // 库 ID。
'moduleID' => '?number', // 模块 ID。
'docID' => '?number', // 文档 ID。
'docVersion' => '?number', // 文档版本。
'mode' => '?string', // 应用默认界面模式,包括 home、list、edit、create、files。
'spaceIcon' => '?string', // 空间图标。
'libIcon' => '?string', // 库图标。
@@ -181,6 +182,7 @@ class docApp extends wg
set::libID(data('libID')),
set::moduleID(data('moduleID')),
set::docID(data('docID')),
set::docVersion(data('docVersion')),
set::mode('list'),
set::filterType(data('filterType')),
set::search(data('search')),