+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Does Wiki Module support workflow?

Does Wiki Module support workflow?

13 posts, 0 answered
  1. Kirby
    Kirby avatar
    2 posts
    Registered:
    13 Jan 2009
    19 Jan 2010
    Link to this post
    Hi,

        I would like to ask if the wiki module support workflow?
        I've downloaded the Sitefinity_3_7_2057_standard_trial_ExternalTemplates and copied the file to the project. I've follow the guild in KnowledgeBase. I successfully enable workflow with News & Blogs module. But it failed for Wiki. Please kindly give advise, thanks!

    Joe
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Jan 2010
    Link to this post
    Hi Kirby,

    The Wiki module does not support Workflow. we will consider to implement it for one of the next SP of 3.7 versions.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Kirby
    Kirby avatar
    2 posts
    Registered:
    13 Jan 2009
    19 Jan 2010
    Link to this post
    Hi,

        Thanks for you reply.

        I would like to ask if i want to implement a function like the workflow (for approving the submission), which direction should i go? Can i extend the wiki module and implement the approval function?

        Thanks~

        P.S. If workflow is not possible solution, is there anyway to implement/extend the wiki to save a draft version of the page when submitting, but not replacing the old version with the new version??
  4. Olivier
    Olivier avatar
    11 posts
    Registered:
    13 May 2008
    09 Feb 2010
    Link to this post
    Hi,
    i'm also interested in implementing a workflow for the wiki module, can you give informations about around when this feature may be included in Sitefinity?
    do you have any recommendation about the way to implement a workflow in the wiki module ?

    thanks, 

    Olivier
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Feb 2010
    Link to this post
    Hello Olivier,

    Wiki module will support workflow from 4.0. In 3.x version you could implement the workflow for the backend by replacing the default WikiPreviewView.cs with a custom one. In your custom view template- say WikiPreviewViewCustom you have to add workflow menu control

    <telerik:WorkflowMenu ID="workflowMenu" runat="server" />

    In the view you need to create a contorol reference to this view

    protected virtual WorkflowMenu WorkflowMenuControl
            {
                get
                {
                    return base.Container.GetControl<WorkflowMenu>("workflowMenu", true);
                }
            }

    Then implement a method for setting the workflow

    sample

    public ApprovalStatus SetWorkflow(IContent cnt)
           {
               if (cnt != null && this.Host.Manager.Provider.AllowWorkflow)
               {
                   WorkflowMenu workflowMenu = this.WorkflowMenuControl;
     
                   IContent currentState = cnt;
                   StagedContent staged = cnt as StagedContent;
                   if (staged == null)
                   {
                       staged = this.Manager.GetCurrentState(cnt.ID);
                       if (staged != null)
                           currentState = staged;
                   }
     
                   if (staged != null)
                   {
                       if (staged.Locked)
                       {
                           workflowMenu.Visible = false;
                           return ApprovalStatus.None;
                       }
                       workflowMenu.DataSource = new Guid[] { staged.WorkflowInstanceId };
                   }
     
                   workflowMenu.Visible = true;
                   workflowMenu.Command += new CommandEventHandler(workflowMenu_Command);
                        
                   workflowMenu.DataBind();
     
                   WorkflowInstance instance = workflowMenu.GetWorkflow();
                   if (instance != null)
                   {
                     // get the workflow and approval status create a switch loop
                     // depending on the satus 
                        
                       return workflow.ApprovalStatus;
                   }
               }
               else
               {
                   this.WorkflowMenuControl.Visible = false;
               }
               return ApprovalStatus.None;
           }

    handle the command event of the workflow control

    private void workflowMenu_Command(object sender, CommandEventArgs e)
          {
              IContent currState = this.Host.Manager.GetCurrentState(this.DataItemId, true);
              this.SetWorkflow(currState);
          }

    Implement a method that sets the content edit form where you call SetWorkflow or call the method in InitializeControls where you need to pass the content item as parameter.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  6. Olivier
    Olivier avatar
    11 posts
    Registered:
    13 May 2008
    09 Feb 2010
    Link to this post
    Hi Ivan,

    thanks a lot for the quick and detailled answer

    Olivier
  7. kp
    kp avatar
    4 posts
    Registered:
    19 Feb 2010
    19 Feb 2010
    Link to this post
    Hi Ivan,
    I am not quite understand the procedures, I done the following steps:
    1. download and install Sitefinity_3_7_2057_standard_trial_ExternalTemplates.zip
    2. create ~/Sitefinity/Admin/ControlTemplates/Wiki/WikiPreviewView.ascx.cs with 
    "protected virtual WorkflowMenu WorkflowMenuControl .... "
    3. edit  ~/Sitefinity/Admin/ControlTemplates/Wiki/WikiPreviewView.ascx to add src="WikiPreviewView.ascx.cs" in the directive. and add <telerik:WorkflowMenu ID="workflowMenu" runat="server" />

    but it still doesn't work. I'm sure I missed something. Would you please give us more hints?
    Thanks a lot.



  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Feb 2010
    Link to this post
    Hello kp,

    You cannot use the code behind of the template to implement the logic. You need to create a custom view or replace the default one. Please take a look at Views hierarchy: Overview  and Replacing a child view with another one

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  9. kp
    kp avatar
    4 posts
    Registered:
    19 Feb 2010
    22 Feb 2010
    Link to this post
    Hi Ivan,

    Thanks for your reply.
    I followed the tutorial to replace the view, but I go this exception:

    A required control was not found in the template for "". The control must be assignable form type "Telerik.Workflow.WebControls.WorkflowMenu" and must have ID "workflowMenu".

    I put the cs file inside App_Code and edited the ControlConfig.

    Cheers,
    KP
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    22 Feb 2010
    Link to this post
    Hi kp,

    The view cannot find one of its require controls - workflowMenu. Make sure that control of type WorkflowMenu
    exists in your template and has ID="workflowMenu".

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  11. kp
    kp avatar
    4 posts
    Registered:
    19 Feb 2010
    22 Feb 2010
    Link to this post
    Thanks Ivan,
    Actually, I created WikiPreviewViewCustom and already has workflowMenu control inside.
    I have done the following steps:
    1. Create WikiPreviewViewCustom.cs inherited from ViewModeControl<WikiPreviewView> place inside App_Code folder.
       it contains the source suggested above: protected virtual WorkflowMenu WorkflowMenuControl, public ApprovalStatus SetWorkflow(IContent cnt), private void workflowMenu_Command(object sender, CommandEventArgs e)
    2. Edit WikiPreviewView.ascx add WorkflowMenu control inside.
    3. Edit ControlsConfig to update the viewSettings section.

    But when it called SetWorkflow inside InitializeControls from WikiPreviewViewCustom.cs, it throwed the above exception.

    Btw you mentioned that the wiki workflow will be implemented in next SP release, would you please let us know the approximate release time?

    Thanks a lot

    Rgds,
    kp 
  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    22 Feb 2010
    Link to this post
    Hello kp,

    WikiPreviewView inherits from ViewModeControl<WikiItemsView> which means that you need to add reference to Workflow menu. You have set the Workflow control as requred, but it is not found from your custom view.

    Below is a sample code where the workflow is found without problems

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="WikiPreviewView.ascx.cs" Inherits="Sitefinity_Admin_ControlTemplates_Wiki_WikiPreviewView" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Workflow.WebControls" Assembly="Telerik.Workflow" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Cms.Engine.WebControls" Assembly="Telerik.Cms.Engine" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Localization.WebControls" Assembly="Telerik.Localization" %>
    <div class="ToolsAll">
        <div class="backWrapp">
            <asp:HyperLink ID="BackButton1" CssClass="actions back" runat="server">
                <asp:Literal ID="Literal2" Text="BackToAllWikis" runat="server" />
            </asp:HyperLink>
        </div>
        <telerik:RadTabStrip
                        id="tabStrip"
                        Align="Right"
                        runat="server"
                        selectedindex="0"
                        causesvalidation="false"
                        EnableEmbeddedSkins="false"
                        Skin="SitefinityPages">
                            <Tabs>
                                <telerik:RadTab Text="View" ></telerik:RadTab>
                                <telerik:RadTab Text="Edit" ></telerik:RadTab>
                                <telerik:RadTab Text="Permissions"></telerik:RadTab>
                            </Tabs>
                        </telerik:RadTabStrip>
        <div class="clear"><!-- --></div>
    </div>
    <div id="divWorkArea" runat="server" class="workArea">
        <telerik:MessageControl runat="server" ID="message1">
            <ItemTemplate>
                <asp:Label runat="server" ID="messageText"></asp:Label>
            </ItemTemplate>
        </telerik:MessageControl>
        <div class="view">
            <p class="button_area">
            <telerik:WorkflowMenu ID="workflowMenu" runat="server" />
                <asp:HyperLink ID="editCommand1" runat="server" CssClass="CmsButLeft editdark">
                    <asp:Literal ID="editLiteral" runat="server" Text="EditThisWiki"></asp:Literal>
                </asp:HyperLink>   
            </p>
            <div class="setW clearfix">
                <div class="setInW clearfix">                      
                    <div class="viewIn">
                        <h1 class="viewHead">
                            <asp:Literal ID="wikiName" runat="server" />
                        </h1>
                        <asp:Literal ID="wikiDescription" runat="server"></asp:Literal>                
                    </div>
                    <div class="details">
                        <h3>
                            <asp:Literal ID="Literal3" Text="Details" runat="server" />
                        </h3>
                        <dl>
                            <dt>
                                <asp:Literal ID="Literal1" runat="server" Text="Owner" />
                            </dt>
                            <dd>
                                <asp:Literal ID="wikiOwner" runat="server" />
                            </dd>
                            <dt>
                                <asp:Literal ID="Literal22" runat="server" Text="Created" />
                            </dt>
                            <dd>
                                <asp:Literal ID="wikiCreated" runat="server" />
                            </dd>
                            <dt>
                                <asp:Literal ID="Literal32" runat="server" Text="ContentsCount" />
                            </dt>
                            <dd>
                                <asp:Literal ID="wikiContentsCount" runat="server" />
                            </dd>
                        </dl>
                    </div>
                </div>
            </div>
            <div class="bottomW"><div><!-- --></div></div>
        </div>
        <div class="info">
            <div class="infoBottom">
                <div id="divViewFaq" runat="server">
                    <h3>
                        <asp:Literal ID="Literal55" Text="WikisFAQ" runat="server" />
                    </h3>
                    <asp:Literal ID="Literal66" Text="WikisFAQText" runat="server" />
                  <%--  <p class="hideAllFAQs">
                        <a href="javascript:void(0)" onclick="javascript:Personalization.hideFaqSection('<%= divViewFaq.ClientID %>')"><%= GetLocalResourceObject("HideFAQEverywhere")%></a>
                    </p>--%>
                </div>
            </div>
        </div>             
        <div class="clear"><!-- --></div>
    </div>


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Wiki.WebControls.Admin;
    using Telerik.Workflow.WebControls;
     
    /// <summary>
    /// Summary description for WikiPreviewCustom
    /// </summary>
    public class WikiPreviewCustom : WikiPreviewView
    {
        public WikiPreviewCustom()
        {
        }
     
        public override string LayoutTemplatePath
        {
            get
            {
                return "~/Sitefinity/Admin/ControlTemplates/Wiki/WikiPreviewView.ascx";
            }
     
        }
        public override System.Type LocalizationAssemblyInfo
        {
            get
            {
                return typeof(WikiPreviewView);
            }
            set
            {
                base.LocalizationAssemblyInfo = value;
            }
        }
     
        public override System.Type AssemblyInfo
        {
            get
            {
                return typeof(WikiPreviewView);
            }
            set
            {
                base.AssemblyInfo = value;
            }
        }
         
     
        protected override void InitializeControls(System.Web.UI.Control viewContainer)
        {
            base.InitializeControls(viewContainer);
            this.WorkflowMenuControl.Visible = true;
        }
     
        protected virtual WorkflowMenu WorkflowMenuControl
        {
            get
            {
                return base.Container.GetControl<WorkflowMenu>("workflowMenu", true);
            }
        }
     
    }



    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  13. kp
    kp avatar
    4 posts
    Registered:
    19 Feb 2010
    23 Feb 2010
    Link to this post
    Hi Ivan,

    It doesn't work.
    I used the code you provided, but it return this error:
    ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).

    Thanks again,
    KP

Register for webinar
13 posts, 0 answered