{% extends "_layouts/cp" %} {% set centered = true %} {% includeCssResource "css/entry.css" %} {% includeJsResource "lib/jquery-ui-1.8.23.custom.min.js" %} {% import "_includes/forms" as forms %} {% if blx.hasPackage('PublishPro') %} {% set section = blx.sections.handle(sectionHandle).first %} {% if not section %}{% exit 404 %}{% endif %} {% set permissionSuffix = 'InSection'~section.id %} {% else %} {% set permissionSuffix = '' %} {% endif %} {% requirePermission 'editEntries'~permissionSuffix %} {% if entry is not defined and entryId is defined %} {% if draftId is defined %} {% set entry = blx.entryRevisions.getDraftById(draftId) %} {% elseif versionId is defined %} {% set entry = blx.entryRevisions.getVersionById(versionId) %} {% else %} {% set entry = blx.entries.id(entryId).status('*').first %} {% endif %} {% if not entry %}{% exit 404 %}{% endif %} {% endif %} {% set isNewEntry = (entry is not defined or not entry.id) %} {% if isNewEntry %} {% requirePermission 'createEntries'~permissionSuffix %} {% elseif entry.authorId != user.id %} {% requirePermission 'editPeerEntries'~permissionSuffix %} {% endif %} {% if not isNewEntry and entry.classHandle == 'EntryDraft' %} {% if entry.creatorId != user.id %} {% requirePermission 'editPeerEntryDrafts'~permissionSuffix %} {% endif %} {% set revisionLabel = "Draft {id}"|t({ id: draftId }) %} {% elseif not isNewEntry and entry.classHandle == 'EntryVersion' %} {% set revisionLabel = "Version {id}"|t({ id: versionId }) %} {% else %} {% set revisionLabel = "Current"|t %} {% endif %} {% if blx.hasPackage('PublishPro') %} {% set blocks = blx.entryBlocks.getBlocksBySectionId(section.id) %} {% else %} {% set blocks = blx.entryBlocks.getAllBlocks %} {% endif %} {% if isNewEntry %} {% set title = "Create a new {section} entry"|t({ section: (blx.hasPackage('PublishPro') ? section.name : 'Blog'|t) }) %} {% else %} {% set title = "Editing “{title}”"|t({ title: entry.title|t }) %} {% if entry is defined and entry.classHandle != 'Entry' %} {% set title = title ~ ' ' ~ revisionLabel ~ '' %} {% endif %} {% endif %} {% set hasSettingsErrors = (entry is defined and (entry.getErrors('slug') or entry.getErrors('postDate') or entry.getErrors('expiryDate') or entry.getErrors('tags'))) %} {% set header %}

{{ title|raw }}

{% if not isNewEntry and blx.hasPackage('PublishPro') %} {% endif %} {% endset %} {% set tabs %}
  • {{ "Content"|t }}
  • {{ "Settings"|t }}
  • {% endset %} {% set content %}
    {% if blx.hasPackage('PublishPro') %} {% endif %} {% if not isNewEntry %} {% endif %}
    {{ forms.textField({ label: (blx.hasPackage('PublishPro') ? section.titleLabel : "Title")|t, id: 'title', name: 'title', value: (entry is defined ? entry.title : null), errors: (entry is defined ? entry.getErrors('title') : null), autofocus: true, required: true }) }} {% include "_includes/blockfields" with { blocks: blocks, entity: (entry is defined ? entry : null) } only %}

    {% if not isNewEntry and entry.classHandle == 'EntryDraft' %} {% if user.can('publishEntries'~permissionSuffix) and (entry.creatorId == user.id or user.can('publishPeerEntryDrafts'~permissionSuffix)) %} {% endif %} {% elseif not isNewEntry and entry.classHandle == 'EntryVersion' %} {% else %} {% if isNewEntry or not entry.enabled or user.can('publishEntries'~permissionSuffix) %} {% if blx.hasPackage('PublishPro') %} {% else %} {% endif %} {% if not isNewEntry and blx.hasPackage('PublishPro') %} {% endif %} {% else %} {% if blx.hasPackage('PublishPro') %} {% endif %} {% endif %} {% endif %}
    {% endset %} {% if entry is not defined or not entry.slug %} {% includeJs "new Blocks.ui.SlugGenerator('#title', '#slug');" %} {% endif %}