* [story-60813, doing] add doc edit view for text doc.
This commit is contained in:
@@ -1,18 +1,2 @@
|
||||
#docEditForm #title {border: unset; font-size: 18px; font-weight: bold; color: #3c4353; padding-left: 16px; --tw-ring-shadow: none}
|
||||
#docEditForm #title:focus {box-shadow: none; outline: unset}
|
||||
.titleBox{padding: 7px; background: #fff}
|
||||
#modalBasicInfo .form-group {margin-top: 0.5rem}
|
||||
#modalBasicInfo .modal-header {padding-bottom: 0.5rem;}
|
||||
.form-horz>:not([hidden])~:not([hidden]){margin-top: 0;}
|
||||
#whitelistBox .form-group-wrapper+.form-group-wrapper {margin-top: 10px;}
|
||||
#titleBox:before {position: absolute; --tw-translate-y: .125rem; --tw-scale-x: 1.25; --tw-scale-y: 1.25; --tw-text-opacity: 1; color: rgba(var(--color-danger-500-rgb),var(--tw-text-opacity)); content: "*"; display: inline-block; margin-left: 0.25rem; transform: translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); }
|
||||
#titleBox {margin-left: 5px}
|
||||
#saveBtn {margin-right: 0.75em}
|
||||
|
||||
.m-doc-edit #header,
|
||||
.m-doc-edit #mainNavbar {display: none!important;}
|
||||
.m-doc-edit #mainContent {padding-top: 0;}
|
||||
.m-doc-edit #main {min-height: 0;}
|
||||
.m-doc-edit #main > .container {max-width: initial!important; padding: 0!important}
|
||||
|
||||
.m-doc-edit #mainContent > .form {height: calc(100vh - 48px)}
|
||||
.m-doc-edit .doc-menu-header.is-fixed {position: relative; top: auto; width: calc(100% - 10px); margin-bottom: 12px;}
|
||||
.m-doc-edit .doc-menu {max-height: calc(100vh - 115px);}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
window.clickSubmit = function(e)
|
||||
{
|
||||
if($(e.submitter).hasClass('save-btn')) $('input[name=status]').val('normal');
|
||||
if($(e.submitter).hasClass('save-draft')) $('input[name=status]').val('draft');
|
||||
}
|
||||
|
||||
+2
-286
@@ -12,290 +12,6 @@ namespace zin;
|
||||
|
||||
include($this->app->getModuleRoot() . 'ai/ui/inputinject.html.php');
|
||||
|
||||
jsVar('titleNotEmpty', sprintf($lang->error->notempty, $lang->doc->title));
|
||||
jsVar('requiredFields', ',' . $config->doc->create->requiredFields . ',');
|
||||
jsVar('libNotEmpty', sprintf($lang->error->notempty, $lang->doc->lib));
|
||||
jsVar('keywordsNotEmpty', sprintf($lang->error->notempty, $lang->doc->keywords));
|
||||
jsVar('contentNotEmpty', sprintf($lang->error->notempty, $lang->doc->content));
|
||||
$isTextDoc = $doc->type == 'text';
|
||||
|
||||
$doc->type == 'text' ? form
|
||||
(
|
||||
set::actions(''),
|
||||
set::ajax(array('beforeSubmit' => jsRaw("clickSubmit"))),
|
||||
setID('docEditForm'),
|
||||
div
|
||||
(
|
||||
setClass('flex titleBox'),
|
||||
backBtn(setClass('btn secondary'), set::icon('back'), $lang->goback),
|
||||
formGroup
|
||||
(
|
||||
set::id('titleBox'),
|
||||
input
|
||||
(
|
||||
set::name('title'),
|
||||
set::value($doc->title),
|
||||
set::maxlength(100),
|
||||
set::placeholder($lang->doc->titlePlaceholder)
|
||||
)
|
||||
),
|
||||
$doc->status == 'draft' ? btn
|
||||
(
|
||||
set
|
||||
(
|
||||
array
|
||||
(
|
||||
'class' => 'btn secondary mr-2 save-draft',
|
||||
'text' => $lang->doc->saveDraft,
|
||||
'btnType' => 'submit'
|
||||
)
|
||||
)
|
||||
) : null,
|
||||
btn
|
||||
(
|
||||
set
|
||||
(
|
||||
array
|
||||
(
|
||||
'class' => 'btn primary save-btn',
|
||||
'text' => $lang->doc->release,
|
||||
'btnType' => 'submit'
|
||||
)
|
||||
)
|
||||
),
|
||||
btn
|
||||
(
|
||||
set
|
||||
(
|
||||
array
|
||||
(
|
||||
'class' => 'btn ghost',
|
||||
'icon' => 'cog-outline',
|
||||
'text' => $lang->settings,
|
||||
'data-toggle' => 'modal',
|
||||
'id' => 'basicInfoLink',
|
||||
'url' => '#modalBasicInfo'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
editor
|
||||
(
|
||||
set::name('content'),
|
||||
set::size('full'),
|
||||
set::resizable(false),
|
||||
$doc->contentType == 'markdown' ? set::markdown(true) : null,
|
||||
html($doc->content)
|
||||
),
|
||||
formHidden('status', $doc->status),
|
||||
formHidden('contentType', $doc->contentType),
|
||||
formHidden('type', 'text'),
|
||||
modalTrigger
|
||||
(
|
||||
modal
|
||||
(
|
||||
modalHeader(set::title($lang->doc->basicInfo), set::entityText(''), set::entityID(0)),
|
||||
set::id('modalBasicInfo'),
|
||||
on::change('#product', "loadObjectModules"),
|
||||
on::change('#project', "loadObjectModules"),
|
||||
on::change('#execution', "loadObjectModules"),
|
||||
$type == 'execution' ? formHidden('project', $doc->project) : null,
|
||||
(strpos('product|project|execution', $type) !== false) ? formGroup
|
||||
(
|
||||
set::width('1/2'),
|
||||
set::required(true),
|
||||
set::label($lang->doc->{$type}),
|
||||
picker
|
||||
(
|
||||
set::name($type),
|
||||
set::id($type),
|
||||
set::items($objects),
|
||||
set::value($objectID),
|
||||
set::required(true)
|
||||
)
|
||||
) : null,
|
||||
formGroup
|
||||
(
|
||||
set::width('1/2'),
|
||||
set::required(true),
|
||||
set::label($lang->doc->libAndModule),
|
||||
picker
|
||||
(
|
||||
set::name('module'),
|
||||
set::items($moduleOptionMenu),
|
||||
set::value($doc->lib . '_' . $doc->module),
|
||||
set::required(true)
|
||||
)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
(strpos($config->doc->officeTypes, $doc->type) === false && $doc->type != 'text') ? setClass('hidden') : null,
|
||||
set::label($lang->doc->keywords),
|
||||
set::control('input'),
|
||||
set::name('keywords'),
|
||||
set::value($doc->keywords)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->doc->files),
|
||||
fileSelector()
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->doc->mailto),
|
||||
mailto(set::items($users), set::value($doc->mailto))
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->doclib->control),
|
||||
radioList
|
||||
(
|
||||
set::name('acl'),
|
||||
set::items($lang->doc->aclList),
|
||||
set::value($doc->acl),
|
||||
on::change('toggleWhiteList')
|
||||
)
|
||||
),
|
||||
$lib->type != 'mine' ? formGroup
|
||||
(
|
||||
$doc->acl == 'open' ? setClass('hidden') : null,
|
||||
set::label($lang->doc->whiteList),
|
||||
set::id('whitelistBox'),
|
||||
div
|
||||
(
|
||||
setClass('w-full check-list'),
|
||||
inputGroup
|
||||
(
|
||||
setClass('w-full'),
|
||||
$lang->doc->groups,
|
||||
picker
|
||||
(
|
||||
set::name('groups[]'),
|
||||
set::items($groups),
|
||||
set::multiple(true),
|
||||
set::value($doc->groups)
|
||||
)
|
||||
),
|
||||
div
|
||||
(
|
||||
setClass('w-full'),
|
||||
userPicker(set::label($lang->doc->users), set::items($users), set::value($doc->users))
|
||||
)
|
||||
)
|
||||
) : null,
|
||||
formRow
|
||||
(
|
||||
div
|
||||
(
|
||||
setClass('form-actions form-group no-label'),
|
||||
btn
|
||||
(
|
||||
setClass('btn primary'),
|
||||
set::btnType('button'),
|
||||
setData('dismiss', 'modal'),
|
||||
$lang->save
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
) : form
|
||||
(
|
||||
modalHeader(),
|
||||
on::change('#product', "loadObjectModules"),
|
||||
on::change('#project', "loadObjectModules"),
|
||||
on::change('#execution', "loadObjectModules"),
|
||||
(strpos('product|project|execution', $type) !== false) ? formGroup
|
||||
(
|
||||
set::width('1/2'),
|
||||
set::required(true),
|
||||
set::label($lang->doc->{$type}),
|
||||
picker
|
||||
(
|
||||
set::name($type),
|
||||
set::id($type),
|
||||
set::items($objects),
|
||||
set::value($objectID),
|
||||
set::required(true)
|
||||
)
|
||||
) : null,
|
||||
formGroup
|
||||
(
|
||||
set::width('1/2'),
|
||||
set::required(true),
|
||||
set::label($lang->doc->libAndModule),
|
||||
picker
|
||||
(
|
||||
set::name('module'),
|
||||
set::items($moduleOptionMenu),
|
||||
set::value($doc->lib . '_' . $doc->module),
|
||||
set::required(true)
|
||||
)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->doc->title),
|
||||
set::name('title'),
|
||||
set::value($doc->title),
|
||||
set::required(true)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
strpos($config->doc->officeTypes, $doc->type) === false ? setClass('hidden') : null,
|
||||
set::label($lang->doc->keywords),
|
||||
set::control('input'),
|
||||
set::name('keywords'),
|
||||
set::value($doc->keywords)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->doc->files),
|
||||
fileSelector()
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->doc->mailto),
|
||||
mailto(set::items($users), set::value($doc->mailto))
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->doclib->control),
|
||||
radioList
|
||||
(
|
||||
set::name('acl'),
|
||||
set::items($lang->doc->aclList),
|
||||
set::value($doc->acl),
|
||||
on::change('toggleWhiteList')
|
||||
)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
$doc->acl == 'open' ? setClass('hidden') : null,
|
||||
set::label($lang->doc->whiteList),
|
||||
set::id('whitelistBox'),
|
||||
div
|
||||
(
|
||||
setClass('w-full check-list'),
|
||||
inputGroup
|
||||
(
|
||||
setClass('w-full'),
|
||||
$lang->doc->groups,
|
||||
picker
|
||||
(
|
||||
set::name('groups[]'),
|
||||
set::items($groups),
|
||||
set::multiple(true),
|
||||
set::value($doc->groups)
|
||||
)
|
||||
),
|
||||
div
|
||||
(
|
||||
setClass('w-full'),
|
||||
userPicker(set::label($lang->doc->users), set::items($users), set::value($doc->users))
|
||||
)
|
||||
)
|
||||
),
|
||||
formHidden('contentType', $doc->contentType),
|
||||
formHidden('type', $doc->type),
|
||||
formHidden('status', $doc->status),
|
||||
formHidden('parent', $doc->parent)
|
||||
);
|
||||
if($isTextDoc) include 'edit.text.html.php';
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The edit view file of doc module of ZenTaoPMS.
|
||||
* @copyright Copyright 2024 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Sun Hao<sunhao@easycorp.ltd>
|
||||
* @package doc
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
namespace zin;
|
||||
|
||||
include 'lefttree.html.php';
|
||||
|
||||
$headingActions = array('class' => 'gap-3 pr-1', 'items' => array());
|
||||
if($doc->status == 'draft') $headingActions['items'][] = array('type' => 'secondary', 'class' => 'save-draft', 'text' => $lang->doc->saveDraft, 'btnType' => 'submit');
|
||||
$headingActions['items'][] = array('type' => 'primary', 'class' => 'btn-wide', 'text' => $lang->doc->release, 'btnType' => 'submit');
|
||||
$headingActions['items'][] = array('type' => 'ghost', 'icon' => 'cog-outline', 'text' => $lang->settings, 'url' => '#modalBasicInfo', 'data-toggle' => 'modal');
|
||||
|
||||
$basicInfoModal = modal
|
||||
(
|
||||
set::id('modalBasicInfo'),
|
||||
set::bodyClass('form form-horz'),
|
||||
set::title($lang->doc->release . $lang->doc->common),
|
||||
bind::change('#product,#project,#execution', 'loadObjectModules'),
|
||||
$type == 'execution' ? formHidden('project', $doc->project) : null,
|
||||
(strpos('product|project|execution', $type) !== false) ? formGroup
|
||||
(
|
||||
set::width('1/2'),
|
||||
set::required(true),
|
||||
set::label($lang->doc->{$type}),
|
||||
picker
|
||||
(
|
||||
set::name($type),
|
||||
set::id($type),
|
||||
set::items($objects),
|
||||
set::value($objectID),
|
||||
set::required(true)
|
||||
)
|
||||
) : null,
|
||||
formGroup
|
||||
(
|
||||
set::width('1/2'),
|
||||
set::required(true),
|
||||
set::label($lang->doc->libAndModule),
|
||||
picker
|
||||
(
|
||||
set::name('module'),
|
||||
set::items($moduleOptionMenu),
|
||||
set::value($doc->lib . '_' . $doc->module),
|
||||
set::required(true)
|
||||
)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
(strpos($config->doc->officeTypes, $doc->type) === false && $doc->type != 'text') ? setClass('hidden') : null,
|
||||
set::label($lang->doc->keywords),
|
||||
set::control('input'),
|
||||
set::name('keywords'),
|
||||
set::value($doc->keywords)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->doc->mailto),
|
||||
mailto(set::items($users), set::value($doc->mailto))
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->doclib->control),
|
||||
radioList
|
||||
(
|
||||
set::name('acl'),
|
||||
set::items($lang->doc->aclList),
|
||||
set::value($doc->acl),
|
||||
on::change('toggleWhiteList')
|
||||
)
|
||||
),
|
||||
$lib->type != 'mine' ? formGroup
|
||||
(
|
||||
$doc->acl == 'open' ? setClass('hidden') : null,
|
||||
set::label($lang->doc->whiteList),
|
||||
set::id('whitelistBox'),
|
||||
div
|
||||
(
|
||||
setClass('w-full check-list'),
|
||||
inputGroup
|
||||
(
|
||||
setClass('w-full'),
|
||||
$lang->doc->groups,
|
||||
picker
|
||||
(
|
||||
set::name('groups[]'),
|
||||
set::items($groups),
|
||||
set::multiple(true),
|
||||
set::value($doc->groups)
|
||||
)
|
||||
),
|
||||
div
|
||||
(
|
||||
setClass('w-full'),
|
||||
userPicker(set::label($lang->doc->users), set::items($users), set::value($doc->users))
|
||||
)
|
||||
)
|
||||
) : null,
|
||||
formRow
|
||||
(
|
||||
div
|
||||
(
|
||||
setClass('form-actions form-group no-label'),
|
||||
btn
|
||||
(
|
||||
set::type('primary'),
|
||||
set::btnType('button'),
|
||||
setData('dismiss', 'modal'),
|
||||
$lang->save
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$handleSubmitForm = <<<'JS'
|
||||
function(e)
|
||||
{
|
||||
const isDraft = $(e.submitter).hasClass('save-draft');
|
||||
const $title = $('#title');
|
||||
if(isDraft && !$title.val().length)
|
||||
{
|
||||
zui.Modal.alert($title.data('titleHint')).then(() => $title[0].focus());
|
||||
return false;
|
||||
}
|
||||
$(e.target).find('input[name=status]').val(isDraft ? 'draft' : 'normal');
|
||||
}
|
||||
JS;
|
||||
|
||||
formBase
|
||||
(
|
||||
set::actions(false),
|
||||
set::ajax(array('beforeSubmit' => jsRaw($handleSubmitForm))),
|
||||
panel
|
||||
(
|
||||
setClass('doc-form'),
|
||||
to::heading
|
||||
(
|
||||
input
|
||||
(
|
||||
setClass('ring-0 text-xl font-bold px-0'),
|
||||
set::name('title'),
|
||||
set::value($doc->title),
|
||||
set::maxlength(100),
|
||||
set::placeholder($lang->doc->titlePlaceholder),
|
||||
setData('title-hint', sprintf($lang->error->notempty, $lang->doc->title))
|
||||
)
|
||||
),
|
||||
set::headingActions($headingActions),
|
||||
set::headingClass('py-3'),
|
||||
set::bodyClass('p-0 border-t'),
|
||||
editor
|
||||
(
|
||||
set::name('content'),
|
||||
set::size('full'),
|
||||
set::resizable(false),
|
||||
set::markdown($doc->contentType == 'markdown'),
|
||||
html($doc->content)
|
||||
)
|
||||
),
|
||||
formHidden('status', $doc->status),
|
||||
formHidden('contentType', $doc->contentType),
|
||||
formHidden('type', 'text'),
|
||||
$basicInfoModal
|
||||
);
|
||||
Reference in New Issue
Block a user