顯示具有 MCMS 標籤的文章。 顯示所有文章
顯示具有 MCMS 標籤的文章。 顯示所有文章

2008年8月24日 星期日

Get a repeating path in CMS resources gallery

After installing CMS on XP platform, I got a image broken situation when enter any CMS default pages.

There is a repeating image path on HTML source, which like "/IntranetCmsApp/cms/WebAuthor/CMS/WebAuthor/…". To solve this problem, you need to change some application folder to pure virtual folder under your website through the IIS manager. Please read the original article below:

Topic: Template Gallery resources reference "/CMS/CMS/…"

When I select "create new page" in the Web Author console, I see the Template Gallery Window pop up but no images are being pulled down. The stylesheet is not being loaded and the Javascript files are not being pulled down. I viewed the source of this page and saw that there was an extra folder in the path to the resource files. The links looked like this: /CMS/CMS/WebAuthor/Client/WBC.css. I had the same type of problem when I went into the resource gallery. What could be wrong?

Answer

The solution to this problem is that the virtual directory "CMS" in the template application is an application and not a virtual directory. You can tell the difference between the two by their appearance in the MMC. A virtual directory has a little world on top of a folder while an application has a grey box with a page in it and a green arrow. To fix this:

  • Open the IIS_Admin MMC
  • Right click on the "CMS" Virtual Directory/Application item under the web root
  • Click properties on the virtual Directory tab and select "remove"
  • Click "OK"

Reference link, Similar situation

[re-post this article due to database crash.]

Get broken images in MCMS authoring mode

This situation happened in my development machine. I think the problem exited since I have set up the CMS on it.

First, I switched to edit mode and everything looks fine including the web author console area. Then, I clicked the add new posting to enter the edit page and it looks fine too. However, when I finished the editing process and clicked the "Save" command, a pop up window which contains broken images showed up.

According to my experience, it is a similar issue to my previous post, [Get a repeating path in CMS resources gallery on XP platform]. To solve the problem, simply follow the procedure below:

  1. Open the IIS manager.
  2. Find out the web instance to which your CMS app installed.
  3. Switch to your CMS application if you installed it as a sub app under your web instance.
  4. Find out a folder called "cms" and enter it.
  5. Find out a virtual folder called "Web Author". (BINGO! If "Web Author" is not a virtual folder then it is the problem. Simply right click on it then adjust the setting to virtual folder by removing the application pool.)
  6. Done.
[re-post this article due to database crash.]

Using MCMS Performance Counters

It seems MCMS has it’s own performance counters which could be installed on MCMS server itself and browsed by performance tool under control panel.

These MCMS performance counters should be installed when we installed the MCMS spa1. So, They already existed and you just don’t know.

However, there are some issues that you may not see these performance counters after the installation process. You can fallow the steps below to solve this issue:

  1. Open the command window and switch to the directory path below:
    [MCMS install path] \ Server \ bin
  2. Type the command below and press enter button:
    regsvr32 /i cmsperfcounters.dll
  3. reboot server.
  4. If you have installed Microsoft Visual Studio .NET 2003 before then you can execute the “Exctrlst.Exe” tool to verify if the MCMS performance counters have installed successfully.
    The Exctrlst.Exe tool locate at the [Visual Studio Install path] \ Common7 \ Tools \ Bin \ winnt .
    Just execute the program and verify if there has a “CMS Performance Counters” in the middle text box. if you can see that then it means the installation process is successful.
  5. Open [Control Panel] > [ Administrative Tools] > [Performance] and click the “Add” button on the window, then select “CMS Performace Counters“ at the “Performace Object” drop down menu. Now, you should see all the CMS related counters display in the list box. Enjoy!

About the meaning of every CMS Performance Counter, the MCMS help CHM file has detailed information. you can download it from Microsoft MSDN website.
Here is the link.

[re-post this article due to database crash.]

Switching Reports and ReportServer folders under the CMS Website

The description of how to install reporting services in the computer which has MCMS setup.

The Reporting Services virtual folders (Reports and ReportServer) are installed in Default Web Site in IIS.

If we have installed a CMS web site on the same machine, then we should stop it and start the oringinal default web site before we install the Reporting Services.

After that, right click on virtual folders and execute the "Save Configuration to a file" options from "All task" inside the POP Windows, then we can use these files to import virtual folders under the CMS web site.

[re-post this article due to database crash.]

2008年8月22日 星期五

MCMS 系統 Save 及 Publish Posting 程式開發指引

在 MCMS 系統中,如果要以程式的方式來建立或修改 Posting,必須透過一定的流程。然而,因為相關的資訊及文件十分缺乏,導致我自行摸索了許久,以下便將心得與大家分享。

在程式進行 MCMS 的 Posting 更新時,首先必須切換至 MCMS 的編輯模式,此時便需要進行身份驗證的動作。在開發 ASP.NET 程式時,我們通常會以目前 access 頁面的使用者帳戶直接進行驗證,以確定該名使用者具有足夠的權限進行後續操作,要達到上述的目的,請參考以下的程式碼片段:

WindowsIdetity wi = HttpContext.Current.User.Identity as WindowsIdentity;
CmsApplicationContext cac = new CmsApplicationContext();
cac.AuthenticateUsingUserHandle( wi.Token, PublishingMode.Update );


進行身份驗證並切換至編輯模式後,接下來,便是取得欲更新的 Posting 標的,在 MCMS 系統當中,針對每一 Posting 均會維護數種版本,包括歷次發佈的歷史版本等。因為我們是要針對某篇 Posting 做更新動作,所以應當取出該篇 Posting 的最新版本來更新,若先前切換成編輯模式成功,則取出某篇 Posting 的最新版本便輕而易舉,直接呼叫 CmsApplicationContext 物件的 Searches 類別方法即可:

Posting p = cac.Searches.GetByPath( "Posting Path" ) as Posting;

有些時候,你可能會想在同一個操作頁面秀出目前的發佈版本及目前編輯的最新版本,以作為交互比對之用,此時便需要取出上一次發佈的 Posting 版本,該怎麼做呢?請參考以下程式碼:

Posting p = cac.Searches.GetByPath( "Posting Path" ) as Posting;
PostingCollection pc = p.Revisions( true );
p = pc[pc.Count - 1];


一開始,同樣是呼叫 CmsApplicationContext 物件的 Searches 類別方法取出 Posting 物件,就跟取出最新版本的例子一樣,但是接下來,則呼叫 Posting 的 Revisoins 方法取出 PostingCollection 陣列物件。我們在此是傳入 true 當參數,用以取得該 Posting 以前所有發佈過的版本。最後,從回傳的 Posting 陣列中取出最後一個 Posting 物件,即是最近一次的發佈版本了!

再來,便是設定更新值的處理。在 MCMS 的 Posting 中,真正儲存資料的地方是 Placeholder(一篇 Posting 通常會包含數個 Placeholder 以存放資料,端看產生此篇 Posting 的 Template 如何設計而定),以下便以 XmlPlaceholder 為例,示範如何撰寫更新動作的程式碼:

XmlPlaceholder xp = p.Placeholder["Placeholder name"] as XmlPlaceholder;
xp.XmlAsString = "Your new xml content";


在更新動作完成後,有兩種選擇,一是將更新儲存但保持未發佈狀態,二是直接將更新後的 Posting 發佈。前者只會建立一新版本的 Posting 並保存更新狀態,真正供一般使用者瀏覽的 Posting 版本仍是上次發佈的版本。先示範儲存的寫法:

cac.CommitAll();

非常簡單,僅需呼叫 CmsApplicationContext 物件的 CommitAll 方法。再來示範直接發佈的寫法:

if( p.CanSubmit ) { p.Submit(); }
if( p.CanApprove ) { p.Approve(); }
cac.CommitAll();


欲直接發佈 Posting 時,要先呼叫該 Posting 物件的 Submit 方法,再呼叫 Approve 方法,最後跟儲存時的寫法一樣,呼叫 CmsApplicationContext 物件的 CommitAll 方法作為結束。上述的程式碼片段,使用了 CanSubmit 和 CanApprove 兩個 Posting 屬性做確認動作,可防止因登入使用者權限不足而導致的例外錯誤擲出。

以上,便是在撰寫 MCMS Posting 更新程式時的主要關鍵步驟,供大家參考。

[re-post this article due to database crash.]