您能否告诉我如何在不使用撰写按钮的情况下在 cocrete5 CMS 版本 5.8.1.0 中单击编辑按钮(左顶部菜单(模式后发布页面?我无法发布任何页面,单击左上角的编辑按钮,对其进行编辑并再次单击编辑按钮。"发布更改"按钮已禁用,并且显示消息: "页面缩略图字段是必需的。"但是我可以使用撰写菜单(在左上角的编辑旁边(发布。此问题的原因是什么?是具体的5错误吗?
如果我注释掉检查 publishinh 方法的行,它看起来允许发布。但我仍然无法理解问题的原因以及如何解决它。
class CheckIn extends BackendInterfacePageController
{
protected $viewPath = '/panels/page/check_in';
// we need this extra because this controller gets called by another page
// and that page needs to know how to submit it.
protected $controllerActionPath = '/ccm/system/panels/page/check_in';
public function canAccess()
{
return $this->permissions->canApprovePageVersions() || $this->permissions->canEditPageContents();
}
public function on_start()
{
parent::on_start();
if ($this->page) {
$v = CollectionVersion::get($this->page, "RECENT");
$this->set('publishDate', $v->getPublishDate());
$this->set('publishErrors', $this->checkForPublishing());
}
}
protected function checkForPublishing()
{
$c = $this->page;
// verify this page type has all the items necessary to be approved.
$e = Loader::helper('validation/error');
if ($c->isPageDraft()) {
if (!$c->getPageDraftTargetParentPageID()) {
$e->add(t('You haven't chosen where to publish this page.'));
}
}
$pagetype = $c->getPageTypeObject();
// if (is_object($pagetype)) {
// $validator = $pagetype->getPageTypeValidatorObject();
// $e->add($validator->validatePublishDraftRequest($c));
// }
if ($c->isPageDraft() && !$e->has()) {
$targetParentID = $c->getPageDraftTargetParentPageID();
if ($targetParentID) {
$tp = Page::getByID($targetParentID, 'ACTIVE');
$pp = new Permissions($tp);
if (!is_object($tp) || $tp->isError()) {
$e->add(t('Invalid target page.'));
} else {
if (!$pp->canAddSubCollection($pagetype)) {
$e->add(
t(
'You do not have permissions to add a page of this type in the selected location.'
)
);
}
}
}
}
return $e;
}
错误说明了一切?"页面缩略图字段是必需的。"您实际上添加了缩略图吗?基本上,如果不填写所有必填字段,您将无法提交表单。
还是您仍然收到错误?
我可以解决覆盖文件的问题:
<?php
namespace ApplicationAttributeImageFile;
use Loader;
use Core;
class Controller extends ConcreteAttributeImageFileController
{
public function validateValue()
{
$f = $this->getAttributeValue()->getValue();
if (is_object($f)) {
return true;
}
$e = Core::make('helper/validation/error');
$e->add(t('You must specify a valid file for %s', $this->attributeKey->getAttributeKeyDisplayName()));
return $e;
}
}