【问题标题】:can not publish any page in edit mode无法在编辑模式下发布任何页面
【发布时间】:2017-06-09 13:55:32
【问题描述】:

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

如果我注释掉检查 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 concrete5 concrete5-8.x


    【解决方案1】:

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

    或者您是否仍然遇到错误?

    【讨论】:

    • 据我判断有缩略图。我无法在编辑模式下发布任何页面,但我可以在作曲家页面上发布。
    【解决方案2】:

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

    <?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;
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-28
      • 2010-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-18
      • 2012-10-13
      相关资源
      最近更新 更多