{% 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 %}