Click here to Skip to main content
Click here to Skip to main content

Microsoft Content Management Server Decline Reason Extension (C#)

By , 17 May 2006
 

Sample Image - sample.gif

Introduction

For use in Microsoft Content Management Server, this Decline Reason Web Author extension prompts authors to enter a reason when declining postings. It works in both single posting declines in the Web Author menu and multiple posting declines in the Approval Assistant dialog. The reason entered can be collected using Request.Form["NC_DeclineReason"] within the events CmsPosting_Declining and CmsPosting_Declined in global.asax, and be used for email notifications (code sample not included).

A VB.NET version of this extension is available here.

Installation Procedures

  1. Copy all the files in directory WebControlLibray to the web control library project of your MCMS solution.
  2. Copy the directory WebAuthor into the root of your web site. The file /WebAuthor/Client/Console.js contains the scripts for the custom console actions. If Console.js exists already, copy the new scripts into your existing Console.js.
  3. Copy the MCMS Web Author file \Program Files\Microsoft Content Management Server\Server\IIS_CMS\WebAuthor\Dialogs\TasksAssistant\ApprovalAssistant\ ApprovalAssistant.aspx into /WebAuthor/Dialogs/TasksAssistant/ApprovalAssistant/. In VS.NET 2003, when the file is included and you are asked to automatically generate the code-behind file for it, say No. Edit the file as follows:
    1. Change the source of the DialogTitle register:
      <%@ Register tagprefix="WebAuthor" Tagname="DialogTitle" 
          Src="/ProjectName/CMS/WebAuthor/Controls/DialogTitle.ascx" %>
    2. Add a JavaScript include, an onsubmit attribute in the form element, and a hidden element:
      .....
      
      <%=EmbedHeadSection()%>
      <script language="JavaScript" src="ApprovalAssistant.js"
              type="text/javascript"></script>
      </head>
      
          ..... 
      
        <form id="WBC_frmApprovalAssistant" method="post" 
            runat="server" onsubmit="return CMS_onMultipleDecline();">
        <input type="hidden" name="NC_DeclineReason" value="">
      
      .....
  4. Change the console actions to use the new custom classes. For example, if you are using DefaultConsole.ascx:
    <%@ Register TagPrefix="CustomAction" 
      Namespace="McmsCustom.WebAuthor" 
      Assembly="WebControl Library Assembly Name" %>
    
    ......
    
    <CmsConsole:Console runat="server" id="Console1">
    
    <script language="javascript" type="text/javascript"
            src="../WebAuthor/Client/Console.js"></script>
    
    ......
    
    <cms:PresentationModeContainer mode="Unpublished" runat="server"
           id="PresentationUnpublishedModeContainer1">
    
    ......
    
    <CustomAction:ApprovalAssistantCustomAction 
         id="ApprovalAssistantAction1" runat="server">
    <A id="ApprovalAssistantAnchor" href="#"
     onclick="<%# Container.ActionJavascript %>;return false" 
     target=_self>
    <%# Container.Text %>
    </A>
    <BR>
    </CustomAction:ApprovalAssistantCustomAction>
    
    ......
    
    <CustomAction:DeclineReasonAction 
        id="DeclineAction1" runat="server">
    <A id="DeclineAnchor" href="#"
     onclick="<%# Container.ActionJavascript %>;return false" 
     target=_self>
    <%# Container.Text %>
    </A>
    <BR>
    </CustomAction:DeclineReasonAction> 
    
    ......
    
    </cms:PresentationModeContainer>
      
    ......
    
    </CmsConsole:Console>
  5. Rebuild your site solution in VS.NET.

History

  • V1.0 - 2004.04.10 - Base.
  • V1.1 - 2004.07.08
    • Fixed the missing buttons in the dialog.
    • Split CustomAction.cs into DeclineReasonAction.cs and ApprovalAssistantCustomAction.cs.
  • V1.2 - 2006.05.14 - Added a ASP.NET 2.0 version.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Stephen Huen
Web Developer Questech Systems
Canada Canada
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralCould not find a part of thememberjohnhaigh18 Nov '04 - 11:13 

Hi,
 
I have implemented step by step and I get the following error.
 
Parser Error: Could not find a part of the path "C:\cmspub\HRPAO.CMS\WebAuthor\Controls\DialogTitle.ascx".
 
Here is the full error:
 
System.IO.DirectoryNotFoundException: Could not find a part of the path "C:\cmspub\HRPAO.CMS\WebAuthor\Controls\DialogTitle.ascx".
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.Web.UI.Util.ReaderFromFile(String filename, HttpContext context, String configPath)
at System.Web.UI.TemplateParser.ParseFile(String filename, String virtualPath)
at System.Web.UI.TemplateParser.Parse()
at System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation()
at System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean fCreateIfNotFound)
at System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath()
at System.Web.UI.TemplateControlParser.GetReferencedType(TemplateControlParser parser, String virtualPath)
at System.Web.UI.TemplateControlParser.GetUserControlType(String virtualPath)
at System.Web.UI.TemplateControlParser.ProcessDirective(String directiveName, IDictionary directive)
at System.Web.UI.TemplateParser.ParseStringInternal(String text)
at System.Web.UI.TemplateParser.ParseString(String text, String virtualPath, String basePhysicalDir)
 
Thanks for any help.
 


 
John Haigh
GeneralRe: Could not find a part of thememberjohnhaigh18 Nov '04 - 13:31 
I forgot to mention this happens when I goto the Approval Assistant Dialog.
GeneralRe: Could not find a part of thememberStephen Huen18 Nov '04 - 13:38 
What is your DialogTitle register source value (installation 3a above) ?
GeneralRe: Could not find a part of thememberjohnhaigh18 Nov '04 - 14:40 

It is:
/HRPAO.CMS/WebAuthor/Controls/DialogTitle.ascx
GeneralRe: Could not find a part of thememberStephen Huen18 Nov '04 - 15:27 
There is a built-in CMS virtual directory. If your application name is HRPAO.CMS, try changing the value to /HRPAO.CMS/CMS/WebAuthor/Controls/DialogTitle.ascx.
GeneralRe: Could not find a part of thememberjohnhaigh18 Nov '04 - 15:39 
thanks, that fixed the problem. Guess I didn't follow the instructions.
 
Thanks,
 
John
GeneralUnterminated string constantsusskamil sykora7 Oct '04 - 23:01 
Hi,
I put the declinereason code to my CMS project (C#). There is a small problem with declining using Approval Assistant. If I select some postings in the Approval Assistant and then click on Decline button, I get an error message
 
Line: 12
char: 51
Error: Unterminated string constant
Code: 0
URL: href="http://myserver/CmsProject/WebAuthor/Dialogs/DeclineReason/DeclineReasonDlg.aspx?wbc_purpose=Basic&NRMODE=Update&WBCMODE=PresentationUnpublished
 
If I close the error window It seems to work, the postings are declined. So it is no a critical error, but would be very nice to fix it.
Any ideas will be appreciated
 
Regards
Kamil

GeneralRe: Unterminated string constantsusskamil sykora8 Oct '04 - 5:54 
It seems the problem was that I added the DeclineReasonDlg.js to my C# solution which has set code page 1250. When I checked-in the solution to the SourceSave the code page 1250 was probably set also for the DeclineReasonDlg.js. I also localized text from the DeclineReasonDlg.js to Czech. Since then it didn't work.
So, I set the codepage UTF-8 for the DeclineReasonDlg.js and it seems to work now again.
The purpose of the problem is still not very clear to me, but it works.
 
Regards
Kamil
GeneralV1.1 requires MCMS SP1amemberStephen Huen9 Jul '04 - 5:41 
The problem of missing buttons in dialog is due to MCMS SP1a. If you are using MCMS SP1, do not upgrade to V1.1.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 17 May 2006
Article Copyright 2004 by Stephen Huen
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid