Click here to Skip to main content
15,867,568 members
Articles / Web Development / ASP.NET
Article

Microsoft Content Management Server Decline Reason Extension (C#)

Rate me:
Please Sign up or sign in to vote.
4.33/5 (3 votes)
17 May 2006CPOL1 min read 73.5K   19   9
A Web Author extension that prompts authors to enter a reason when declining postings.

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:
      ASP.NET
      <%@ 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:
      HTML
      .....
      
      <%=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:
    ASP.NET
    <%@ 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)


Written By
Software Developer (Senior)
Canada Canada
A Microsoft Certified Professional Developer and Technology Specialist.

Experience and expertise in SharePoint 2016 / 2013 / 2010 / 2007.

Role ranges from a developer in a multi-person team to a solution consultant with expert-level skills, leading a project to completion status.

Proven experience working effectively in a team environment and a self-managed environment.

Comments and Discussions

 
GeneralCould not find a part of the Pin
johnhaigh18-Nov-04 11:13
johnhaigh18-Nov-04 11:13 
GeneralRe: Could not find a part of the Pin
johnhaigh18-Nov-04 13:31
johnhaigh18-Nov-04 13:31 
GeneralRe: Could not find a part of the Pin
Stephen Huen18-Nov-04 13:38
Stephen Huen18-Nov-04 13:38 
GeneralRe: Could not find a part of the Pin
johnhaigh18-Nov-04 14:40
johnhaigh18-Nov-04 14:40 
GeneralRe: Could not find a part of the Pin
Stephen Huen18-Nov-04 15:27
Stephen Huen18-Nov-04 15:27 
GeneralRe: Could not find a part of the Pin
johnhaigh18-Nov-04 15:39
johnhaigh18-Nov-04 15:39 
GeneralUnterminated string constant Pin
ksasdf7-Oct-04 23:01
ksasdf7-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 constant Pin
ksasdf8-Oct-04 5:54
ksasdf8-Oct-04 5:54 
GeneralV1.1 requires MCMS SP1a Pin
Stephen Huen9-Jul-04 5:41
Stephen Huen9-Jul-04 5:41 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.