0

您能否告诉我在不使用撰写按钮的 cocrete5 cms 版本 5.8.1.0 中单击编辑按钮(左上菜单)模式后如何发布页面?我无法发布任何页面点击左上角的编辑按钮,编辑它并再次点击编辑按钮。Publish Changes 按钮被禁用,并且有消息:“该字段 Page Thumbnail 是必需的。” 但我可以使用撰写菜单发布(在左上角编辑旁边)。这个问题的原因是什么?它是具体的错误吗?

如果我注释掉检查 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;
    }
4

2 回答 2

0

我可以解决覆盖文件的问题:

<?php
namespace Application\Attribute\ImageFile;

use Loader;
use Core;

class Controller extends \Concrete\Attribute\ImageFile\Controller
{
    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;
    }
}
于 2017-06-16T06:13:18.657 回答
0

错误说明了一切?“页面缩略图字段是必需的。” 你真的添加了缩略图吗?基本上你不能在不填写所有必填字段的情况下提交表格。

还是您仍然遇到错误?

于 2017-06-12T11:39:06.057 回答