Skip to content

页面编辑-Page editing

ARCHIVED

!注意“归档”

This chapter has not been updated for the current version of Orchard, and has been ARCHIVED.

Page creation

页面创建

The page draft is created in the database when the save or preview button is clicked (preview saves the draft implicitly). In order to save, the state of the page form must be valid.

单击保存或预览按钮时,将在数据库中创建页面草稿(预览会隐式保存草稿)。为了保存,页面表单的状态必须是有效的。

Validation rules

验证规则

The slug rules are described here: Slugs.

这里描述了段塞规则:[Slugs](slugs)。

  • The title field cannot be empty. Message: "Please specify a title."

  • 标题字段不能为空。消息:“请指定标题。” *

  • The title field can contain any character except for tabs, newlines/CR and control characters. Message: "No control characters are allowed in the title field."

  • title字段可以包含除制表符,换行符/ CR和控制字符之外的任何字符。消息:“标题字段中不允许使用控制字符。” *

  • If the radio button for later publication is checked, a date must be specified. Message: "Please specify a publication date."

  • 如果选中用于以后发布的单选按钮,则必须指定日期。消息:“请指定发布日期。” *

  • If a publication date is specified, it must be parsable under the current culture. Message: "'{0}' is not recognized as a valid date. An example of a valid date is: '{1}'." Substitute {1} with the current date, formatted with the current culture.

  • 如果指定了发布日期,则必须在当前文化下进行解析。消息:“'{0}'未被识别为有效日期。有效日期的示例为:'{1}'。”用当前日期替换{1},使用当前文化格式化。 *

  • The publication date, if specified, must be in the future. "Please specify a future date."

  • 如果指定,发布日期必须在将来。 “请指明未来的日期。” *

Orphaned contents

孤儿的内容

When the user switches the page to a layout that has less zones than the previous ones, he is potentially creating orphaned contents. We don't throw that contents away or try to merge them. We also don't try to reassign if the zone names are different, even if the number of zones is the same.

当用户将页面切换到区域比以前的区域少的布局时,他可能会创建孤立的内容。我们不会抛弃那些内容或尝试合并它们。如果区域名称不同,我们也不会尝试重新分配,即使区域数量相同。

Instead, we display the following message in the top alert zone: "You have switched to a template that does not have the same content zones as the previous one, resulting in some of your contents not showing up on your site. You can either delete that content or copy it into another zone."

相反,我们会在顶部提醒区域中显示以下消息:“您已切换到与前一个不具有相同内容区域的模板,导致您的某些内容未显示在您的网站上。您可以删除该内容或将其复制到另一个区域。“

In the admin screen for the page, we show the orphaned contents with an alert "This content is assigned to a zone that does not exist in the current template. Please delete it or copy it to another zone."

在页面的管理屏幕中,我们显示孤立内容,并显示警告“此内容已分配给当前模板中不存在的区域。请将其删除或复制到另一个区域”。

When the page is saved, we delete empty orphaned contents. By empty, we mean empty of contents, not necessarily empty string: <p></p> is empty contents. Warning, <img src="foo.gif"/> is not.

保存页面时,我们删除空的孤立内容。空,我们的意思是空的内容,不一定是空字符串:&lt; p&gt;&lt; / p&gt;是空的内容。警告,&lt; img src =“foo.gif”/&gt;不是。

Preview

预习

When the user clicks the "Preview" button, we need to create a draft. We've considered making that draft "temporary" and not a full draft. We also talked about the potential concurrency issues associated with this. Those concurrency issues actually also exist when saving a draft, the difference here is that the operation is implicit.

当用户单击“预览”按钮时,我们需要创建草稿。我们已经考虑过将该草案“暂时”而不是完整的草案。我们还讨论了与此相关的潜在并发问题。保存草稿时实际上也存在这些并发问题,这里的区别在于操作是隐式的。

For the moment, we'll ignore the concurrent editing scenarios and let the latest draft, implicit or explicit, win. There is still always only one draft at any given time.

目前,我们将忽略并发编辑方案,并让最新的草案(隐式或显式)获胜。在任何给定时间仍然只有一个草案。

Clicking preview is exactly equivalent to saving as a draft and then navigating to the url for the draft in a new window. The draft is not automatically deleted.

单击预览完全等同于保存为草稿,然后在新窗口中导航到草稿的URL。草稿不会自动删除。

When the preview button is clicked and JS is disabled, we save a draft then redirect to the preview page. The user can go back to the edit page UI by clicking "edit this page" in the preview or by hitting back.

单击预览按钮并禁用JS时,我们会保存草稿,然后重定向到预览页面。用户可以通过单击预览中的“编辑此页面”或通过回击来返回编辑页面UI。

When JS is enabled, we can override the default behavior of the button and open the preview in a new window.

启用JS后,我们可以覆盖按钮的默认行为并在新窗口中打开预览。

Changing template

更改模板

The behavior when clicking the change template button is to be determined. We could warn about unsaved changes when JS is enabled, or we could implicitly save, or we could persist the data in hidden fields.

单击更改模板按钮时的行为将被确定。我们可以在启用JS时警告未保存的更改,或者我们可以隐式保存,或者我们可以将数据保存在隐藏字段中。

Page Management

页面管理

We are not implementing parent pages. In future iterations, we'll introduce ways to organize pages and other kinds of contents using tags and / or categories.

我们没有实现父页面。在将来的迭代中,我们将介绍使用标签和/或类别组织页面和其他类型内容的方法。

Security

安全

We do not introduce security in the iteration as this would require making a decision on user management / membership, which we are not ready to do at this point. It should be a high priority item for future iterations.

我们不会在迭代中引入安全性,因为这需要对用户管理/成员资格做出决定,我们此时尚未做好准备。它应该是未来迭代的高优先级项目。

Media Management

媒体管理

We do not implement media management this iteration but it should be a high priority item for future iterations.

我们不会在此次迭代中实现媒体管理,但它应该是未来迭代的高优先级项目。

History / Revisions

历史/修订

We do not implement history now but so that we do not have to throw away our implementation of drafts when we do, we implement the draft feature now with history in mind. In particular, the database structure will be the one that we'll eventually use for storing revisions. A draft is a special case of revision.

我们现在没有实现历史,但是当我们这样做时,我们不必丢弃我们的草稿实现,我们现在实现草案功能,记住历史。特别是,数据库结构将是我们最终用于存储修订的结构。草案是一个特殊的修订案例。

Error information bar

错误信息栏

Error messages and warnings in the admin UI are uniformly presented in a colored bar that sits between the title area and the top of the current screen. The bar takes all the width of the page.

管理界面中的错误消息和警告统一显示在位于标题区域和当前屏幕顶部之间的彩色条中。条形图占据页面的所有宽度。

Errors are on a red background, warnings on an orange background, informational / confirmation messages are on a cream background.

错误是在红色背景上,橙色背景上的警告,信息/确认消息是在奶油色的背景上。

When JavaScript is enabled, we can animate the appearance of the message (Jon?) to better attract attention.

启用JavaScript后,我们可以为消息的外观设置动画(Jon?)以更好地吸引注意力。

The messages have an optional icon, a type (error / warning / notification) and a text message. They are informational and may state possible action steps for the user, but they do not contain any UI (confirmation or otherwise) other than the icon and message.

消息具有可选图标,类型(错误/警告/通知)和文本消息。它们是信息性的,可以为用户说明可能的操作步骤,但它们不包含除图标和消息之外的任何UI(确认或其他)。

The bar is temporary and disappears as soon as any user action results in a POST or an Ajax request.

该栏是临时的,只要任何用户操作导致POST或Ajax请求,该栏就会消失。

The bar is able to expand to display more than one message at a time, stacked one above another.

该栏可以扩展为一次显示多条消息,一个堆叠在另一个上面。

The validation summary when it exists goes into the error bar.

验证摘要存在时会进入错误栏。

The admin views will have to provide a hook for the message bar to display.

管理视图必须提供要显示的消息栏的挂钩。

Dialogs

对话框

Some user actions will result in the system prompting him for additional information. One such example is bulk delayed publishing, where we need to prompt for the publication date.

某些用户操作将导致系统提示他输入其他信息。其中一个例子是批量延迟发布,我们需要提示发布日期。

In the non-JavaScript case, this is done by displaying the dialog UI as a separate screen.

在非JavaScript情况下,这是通过将对话框UI显示为单独的屏幕来完成的。

When JavaScript is enabled, the same dialog is shown as a lightbox modal dialog style without navigating away from the current page.

启用JavaScript后,同一对话框将显示为灯箱模式对话框样式,而不会导航离开当前页面。

Dialogs have a cancel button.

对话框有一个取消按钮。