Basic Orchard Concept Definitions—Orchard基礎概念定義

來源:互聯網
上載者:User
文章目錄
  • General CMS definitions--- CMS的一般定義
  • Orchard concepts – Orchard概念
  • UI composition --介面合成

Orchard是一個網頁CMS系統,可以協助我們通過已有的模組來構建網站。如果我們想要使用Orchard CMS系統更高效地建立網站應用程式的話,我們需要先熟悉Orchard的一些基本概念以及一些術語。 這篇將解釋Orchard系統所用到的一些概念以及它們的作用。

 

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

CMS中的‘C'的意思是 “content” 也就是內容的意思, 可以這麼去理解,所有通過CMS系統管理的東西都可以稱之為內容。更準確的來講,內容就是網站中的所有資訊。 舉例來說,一篇部落格文章,一個評論,一個產品展示資訊,或者是導覽功能表,亦或者是公司的標識圖片,這些都是可以被分辨的、獨立的內容。 如果這會兒你在想,內容是網站裡的一切,那麼就對啦。 如果你還是認為這個概念很模糊的話,那也沒什麼不對的, 幸運的是,我們將在下面的章節中會更詳細具體地闡述不同的內容概念。

Admin panel, Dashboard or back-end 網站的後台管理介面

網站的後台管理介面是我們可以管理網站以及網站內容的地方。 只有被授予了“可以訪問後台管理介面”的使用者才能訪問和管理網站及網站中的內容。 這就是CMS中’M’ 的意思。

 

CMS中的S

'S' 在 CMS的意思是系統,這個概念應該不會聽起來那麼模糊。CMS是通過一種系統的方式來管理內容的:所有的內容都可以以同樣的方式被管理。
舉例來說,你可以通過同樣的工具來管理部落格文章、頁面內容以及產品展示資訊,這些內容也都可以通過使用常用的模組來添加評論、評分及標籤。這樣以來,在使用系統時才會有一致的體驗,也能使得建立新類型的內容更為簡便。
Front-end --前台

前台是網站中所有使用者能夠訪問到的介面。換句話說,前台就是除了後台管理介面之外所有能被公眾訪問到的部分。

 

Setup -- 安裝配置

安裝配置是將網站從初始狀態配置成為可工作狀態的一個必須的過程(而且,除此之外,你還有很多要做的,比如說,建立網站的內容)。

 

Orchard concepts – Orchard概念Content Item--內容條目

內容條目是一個單獨的一塊內容,通常可以用一個單獨的網址就可以訪問到。例如,頁面、部落格文章或產品展示。
Content type--內容類型

內容條目是內容類型的執行個體。換種方式說,內容條目是屬於內容類型的類別的。在前一節中,我們講到了內容條目的例子,頁面、部落格文章、產品展示,這三個例子也是三個不同的內容類型。
Content Part --內容單元

在Orchard系統裡內容類型是由一些小的內容單元組成。 內容單元是內容的最小單位,是可以被其他內容類型重用的。

 

 

例如,評論(comments)、標籤(tags)或者評分(ratings)都是內容單元,因為它們有著特定的功能,而且可以被任何內容類型所重用。 評論作為內容單元並沒有只限定於一個特定的內容類型,比如部落格文章。評論在部落格文章內容類型中的作用和在其他內容類型中的作用是一樣的,沒有任何差別。在一個內容類型中只能有一個而且僅有一個同樣的內容單元。

Content Field--內容欄位

內容欄位是可以添加到一個內容類型中的。內容欄位有一個名字和一個資料類型,而且是限定於這個內容類型的,就是說,不能像內容單元一樣在其他內容類型中重用。 一個 內容類型中可以有很多個有著同樣資料類型的內容欄位。

例如,一個產品內容類型有一個常值內容欄位來代表這個產品的唯一標識,一個數字內容欄位表示價格,另一個數字內容欄位表示重量。這其中的每個內容欄位或許只有對這個產品來說是有意義的,用在其他的內容類型中就不會這樣。

注意: 也可以建立一個名為產品的內容單元,這個內容單元包含上面所說的三個內容欄位。 這樣的話就可以將任何內容類型轉化為產品了。 這兩種方法在Orchard系統中都是可行的。

Module--模組

Orchard的許多擴充應用都是被建立成模組的。一個模組是Orchard的一組功能擴充,這些擴充被整合在Orchard網站中的Modules目錄下的同一個子目錄中。
你也可以早Orchard Gallery中找到許多可用的模組。

 

 

Feature—功能特性

一個模組可以有一個或多個功能特性,它在邏輯上將這些功能組織了起來,而每個功能卻可以單獨啟用或是禁用。例如,一個自訂的驗證模組可以有: OpenID驗證功能、Facebook驗證功能、LiveID驗證功能以及其他的驗證功能,這些功能都可以單獨地被啟用或是禁用。
功能特性可以相互依賴,不管它們是不是在同一個模組中。

 

Manifest--資訊清單檔

資訊清單檔是模組或主題中的一個描述這個模組或主題的文字檔。
下面就是資訊清單檔的樣本:

Name: CommentsAntiForgery: enabledAuthor: The Orchard TeamWebsite: http://orchardproject.netVersion: 0.9.0OrchardVersion: 0.9.0Description: 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樣式、圖片、布局檔案、模板檔案甚至是自訂的代碼檔案。我們也可以建立一個主題繼承於來自另一主題的屬性,如果你只是想在已有主題基礎上做一些小的改動時這將會很有用的。

Layout--布局

布局檔案是主題中定義頁面中的大概組織構成的一個檔案。布局檔案中定義了一組區塊以及這些區塊的排列順序及位置,區塊中可以插入內容以及小組件(widgets)。

 

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.

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.

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.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.