现在的位置: 首页 > 综合 > 正文

Basic Orchard Concept Definitions—Orchard基础概念定义

2012年12月27日 ⁄ 综合 ⁄ 共 8238字 ⁄ 字号 评论关闭
文章目录

Orchard是一个网页CMS系统,可以帮助我们通过已有的模块来构建网站。如果我们想要使用Orchard CMS系统更高效地创建网站应用的话,我们需要先熟悉Orchard的一些基本概念以及一些术语。 这篇将解释Orchard系统所用到的一些概念以及它们的作用。

 

General CMS definitions--- CMS的一般定义

CMS中的‘C'的意思是 “content” 也就是内容的意思, 可以这么去理解,所有通过CMS系统管理的东西都可以称之为内容。更准确的来讲,内容就是网站中的所有信息。 举例来说,一篇博客文章,一个评论,一个产品展示信息,或者是导航菜单,亦或者是公司的标识图片,这些都是可以被分辨的、独立的内容。 如果这会儿你在想,内容是网站里的一切,那么就对啦。 如果你还是认为这个概念很模糊的话,那也没什么不对的, 幸运的是,我们将在下面的章节中会更详细具体地阐述不同的内容概念。

Admin panel, Dashboard or back-end 网站的后台管理界面

网站的后台管理界面是我们可以管理网站以及网站内容的地方。 只有被授予了“可以访问后台管理界面”的用户才能访问和管理网站及网站中的内容。 这就是CMS中’M’ 的意思。

image

 

CMS中的S

'S' 在 CMS的意思是系统,这个概念应该不会听起来那么模糊。CMS是通过一种系统的方式来管理内容的:所有的内容都可以以同样的方式被管理。
举例来说,你可以通过同样的工具来管理博客文章、页面内容以及产品展示信息,这些内容也都可以通过使用常用的模块来添加评论、评分及标签。这样以来,在使用系统时才会有一致的体验,也能使得创建新类型的内容更为简便。

Front-end --前台

前台是网站中所有用户能够访问到的界面。换句话说,前台就是除了后台管理界面之外所有能被公众访问到的部分。

image

 

Setup -- 安装配置

安装配置是将网站从初始状态配置成为可工作状态的一个必须的过程(而且,除此之外,你还有很多要做的,比如说,创建网站的内容)。

image

 

Orchard concepts – Orchard概念

Content Item--内容条目

内容条目是一个单独的一块内容,通常可以用一个单独的网址就可以访问到。例如,页面、博客文章或产品展示。

Content type--内容类型

内容条目是内容类型的实例。换种方式说,内容条目是属于内容类型的类别的。在前一节中,我们讲到了内容条目的例子,页面、博客文章、产品展示,这三个例子也是三个不同的内容类型。

Content Part --内容单元

在Orchard系统里内容类型是由一些小的内容单元组成。 内容单元是内容的最小单位,是可以被其他内容类型重用的。

image

 

 

例如,评论(comments)、标签(tags)或者评分(ratings)都是内容单元,因为它们有着特定的功能,而且可以被任何内容类型所重用。 评论作为内容单元并没有只限定于一个特定的内容类型,比如博客文章。评论在博客文章内容类型中的作用和在其他内容类型中的作用是一样的,没有任何差别。在一个内容类型中只能有一个而且仅有一个同样的内容单元。

Content Field--内容字段

内容字段是可以添加到一个内容类型中的。内容字段有一个名字和一个数据类型,而且是限定于这个内容类型的,就是说,不能像内容单元一样在其他内容类型中重用。 一个 内容类型中可以有很多个有着同样数据类型的内容字段。

例如,一个产品内容类型有一个文本内容字段来代表这个产品的唯一标识,一个数字内容字段表示价格,另一个数字内容字段表示重量。这其中的每个内容字段或许只有对这个产品来说是有意义的,用在其他的内容类型中就不会这样。

注意: 也可以创建一个名为产品的内容单元,这个内容单元包含上面所说的三个内容字段。 这样的话就可以将任何内容类型转化为产品了。 这两种方法在Orchard系统中都是可行的。

Module--模块

Orchard的许多扩展应用都是被创建成模块的。一个模块是Orchard的一组功能扩展,这些扩展被整合在Orchard网站中的Modules目录下的同一个子目录中。
你也可以早Orchard Gallery中找到许多可用的模块。

 

image

 

Feature—功能特性

一个模块可以有一个或多个功能特性,它在逻辑上将这些功能组织了起来,而每个功能却可以单独启用或是禁用。例如,一个自定义的验证模块可以有: OpenID验证功能、Facebook验证功能、LiveID验证功能以及其他的验证功能,这些功能都可以单独地被启用或是禁用。
功能特性可以相互依赖,不管它们是不是在同一个模块中。

image

 

Manifest--清单文件

清单文件是模块或主题中的一个描述这个模块或主题的文本文件。
下面就是清单文件的示例:

Name: Comments
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 0.9.0
OrchardVersion: 0.9.0
Description: The comments system implemented by this module can be applied to arbitrary Orchard content types, such as blogs and pages. It includes comment validation and spam protection through the Akismet service.
Features:
    Orchard.Comments:
        Name: Comments
        Description: Standard content item comments.
        Dependencies: Settings
        Category: Social

UI composition --界面合成

Orchard中所管理的内容是由不同单元组成的。这就需要一种机制可以统一内容显示,同时也顾及到内容的整体性。这就是为什么我们在讲界面的合成, 很多小块的内容需要和谐地整合在一起以统一的整体来展示。界面合成包含下面所要讲述几个概念。

Theme--主题

在创建一个网站时, 我们都有可能需要能够修改网站的每一处的视觉显示效果。Orchard将内容管理与内容显示很清晰地分离开了。一个主题就是用Orchard所创建的网站的所有界面展示。它包括css样式、图片、布局文件、模板文件甚至是自定义的代码文件。我们也可以创建一个主题继承于来自另一主题的属性,如果你只是想在已有主题基础上做一些小的改动时这将会很有用的。

image

Layout--布局

布局文件是主题中定义页面中的大概组织构成的一个文件。布局文件中定义了一组区块以及这些区块的排列顺序及位置,区块中可以插入内容以及小部件(widgets)。

image

 

Template--模板

每一个内容单元,每个内容字段以及每个小部件都需要在前台有自己的展示以便将它们所表示的数据以用户可以阅读的方式展现出来。 一个模板就是将数据转化为浏览器可以显示的HTML源代码的一个文件。你可以将模板理解为有着预先定义的位置的普通的HTML, 这些预先定义好的位置处就是数据可以插入的地方。
下面就是一个模板的一个简单示例:

<h1>@Model.Title</h1>

Shape --形状

Before displaying something using a template, that something gets transformed into a shape, which is a very malleable object that contains all the information required in order to display it. Before getting rendered by templates, everything gets mapped into a tree of shapes that is a sort of abstract representation of the contents of the final page. The advantage of such trees of shapes is that any module can modify existing shapes or create new ones.
The layout, zones, widgets and content parts all get represented as shapes as part of the rendering process.
One could imagine for example a Gravatar module that would add avatar icon shapes to the comment shapes that were created by the comment module. In the same way, the layers from the widget module are adding widget shapes to the zone shapes of the layout shape.

Placement

When rendering the collections of parts and fields -or any other shapes- that compose a page or content item, Orchard needs to know in what order to do so. Placement.info files are XML files that describe rules that can be used to determine what shapes go into what zones and in what order. This enables not only the rendering of each shape to be customized, but also the order in which they get rendered.
Here is an example of a placement file:

<Placement>
    <Place Parts_Map="Content:10"/>
    <Place Parts_Map_Edit="Content:7.5"/>
</Placement>

Zone

Zones are specific parts of a layout that can be customized by inserting widgets. In some themes, zones are collapsible, which means that they disappear if they contain no active widget.

Widget

A widget is a small fragment of UI that can be added to some or all pages of the site. Examples of widgets are tag clouds, maps, archives, a search form, or recent blog posts.

image

Layer

A layer is a group of widgets (with their specific configuration, which includes their positioning -zone name and ordering-) that is activated by a specific rule.
For example, the TheHomePage layer is activated by a rule that specifically selects the home page. The Default layer is always active no matter what page is displayed. The Authenticated layer is only active when users have identified themselves.
When more than one layer is active on any given page, all the widgets from all those layers get displayed at the same time. Orchard orders them based on their position string.

Security

Users and roles

In Orchard, users can be attributed roles, which can be seen as stereotypes of users. Permissions can then be attributed to roles in order to define who can do what on the site (more on this in the next section). Any user can have one or several roles.
Site owners can create their own roles but Orchard comes with built-in roles that should cover most sites' requirements:

  • Administrator: have full control over the site's settings and contents.
  • Editor: does not create content but edit and publish content created by authors.
  • Moderator: validates user-created contents such as comments.
  • Author: writes and publishes his own content.
  • Contributor: writes content but does not necessarily have the rights to publish it.
  • Anonymous: an unknown user, someone who hasn't logged in.
  • Authenticated: any user who has logged in.

Neither Anonymous nor Authenticated can be assigned to a user manually. Rather, they are determined dynamically at runtime.

Privileges and Permissions

All users don't have the same rights and privileges in Orchard: the site owner can choose who can create content, who can write or validate comments, etc. Rights and privileges are represented as permissions. In Orchard, permissions are granted to roles but are not explicitly denied. In other words if a user belongs to any role that has a given permission, he has that permission. To revoke a permission, you need to either remove a user with the role the permission has been granted to or you need to remove that permission for the whole role.
Some permissions are "effectively granted". This means that they have not been explicitly granted, but that they have been implied by another permission. For example, if you grant the site owner permission, you are implicitly granting all the other permissions.

image

Permissions, as well as their default settings for the built-in roles, are defined by modules. This means that if you build your own module, you can define specific permissions to accompany it.

Site owner

The site owner, sometimes also called "super user" is a special user that is defined at setup time and that has all the rights on the site. It can be changed from the settings admin screen if you have the permission to do so.
There is a permission called "Site Owners Permission" that grants the same right and that is granted by default to only members of the Administrator role. We advise never to grant that permission to any other role.

Development

In this section we will describe concepts that are only required for module developers.

ASP.NET MVC

ASP.NET MVC is the Web framework that Orchard is built on.

Handler

A handler is similar to an MVC filter in that it contains code that will execute for specific events of the request life-cycle. They are typically used to set-up data repositories or to do additional operations when something gets loaded.

Driver

Drivers are similar to MVC controllers, but they act at the level of a content part instead of at the level of the full request. They typically prepare shapes for rendering and handle post-backs from admin editors.

Record

A record is a class that models the database representation of a content part. They are POCOs where each property must be virtual.

Model

What plays the part of the model for a content part is the part class itself. Some parts also define view models, in the form of strongly-typed classes or of more flexible dynamic shapes.

Migration

A migration is a description of the operations to execute when first installing a feature or when upgrading it from a version to the next. This enables smooth upgrades of individual features without data loss. Orchard includes a data migration framework.

Injection

Inversion of Control, or injection, is widely used in Orchard. When any piece of code requires a dependency, it will typically demand the injection of one or several instances of a specific interface. The framework will take care of selecting, instantiating and injecting the right implementations at runtime.

抱歉!评论已关闭.