{% extends "_layouts/cp" %} {% includeCssResource "css/entry.css" %} {% includeJsResource 'lib/jquery-ui-1.10.0.custom'~(blx.config.useCompressedJs ? '.min' : '')~'.js' %} {% import "_includes/forms" as forms %} {% set crumbs = [ { label: "Content"|t, url: url('content') }, { label: "Entries"|t, url: url('content') } ] %} {% set section = blx.sections.getSectionByHandle(sectionHandle) %} {% if not section %}{% exit 404 %}{% endif %} {% if blx.hasPackage('PublishPro') %} {% set crumbs = crumbs|merge([ { label: section.name|t, url: url('content/'~section.handle) } ]) %} {% endif %} {% set permissionSuffix = 'InSection'~section.id %} {% requirePermission 'editEntries'~permissionSuffix %} {% if blx.hasPackage('Language') %} {% set sectionLocaleIds = section.getLocales()|keys %} {% if not sectionLocaleIds %} {% exit 404 %} {% endif %} {% if localeId is not defined %} {% set localeId = blx.locale %} {% if localeId not in sectionLocaleIds %} {% set localeId = sectionLocaleIds[0] %} {% endif %} {% elseif localeId not in sectionLocaleIds %} {% exit 404 %} {% endif %} {% endif %} {% 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 params = { id: entryId, status: '*' } %} {% if blx.hasPackage('Language') %} {% set params = params|merge({ locale: localeId }) %} {% endif %} {% set entry = blx.entries.first(params) %} {% 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 isNewEntry %} {% set title = "Create a new entry"|t %} {% else %} {% set title = entry.title %} {% if entry is defined and entry.classHandle != 'Entry' %} {% set title = title ~ ' (' ~ revisionLabel ~ ')' %} {% endif %} {% endif %} {% set extraPageHeaderHtml %} {% if blx.hasPackage('Language') %}