Log In View a printable version of the current page. Get help from the Confluence website.
Last changed on mar 14, 2006 by Rahul Singh

Add support for workflow in your module

Workflow at the moment work’s only for modules which persist there content in the rainbow database.

The table in which the content is persisted must be linked through a foreign key to the modules table.

If this table contains child tables itself then the the workflow will fail. I can support this too, but then I have to make the publish stored proc recursive.
Do the following steps
Database modifications
  1. Create an identical table and name it as rb_Tablename_st in the database to the table in which you store the modules content.
  2. Modify your stored procedure so updates the staging table instead of the “production” table (add and update).
  3. Add a trigger to the staging table (‘rb_Tablename_st’).
    For example see to the trigger on the rb_HtmlText_st table.:
CREATE TRIGGER [rb_Tablename_stModified]
ON [rb_Tablename_st]
FOR DELETE, INSERT, UPDATE
AS
BEGIN
   DECLARE ChangedModules CURSOR FOR
   SELECT ModuleID
   FROM inserted
   UNION
   SELECT ModuleID
   FROM deleted
 
   DECLARE @ModID     int
   OPEN ChangedModules    
   FETCH NEXT FROM ChangedModules
   INTO @ModID
   WHILE @@FETCH_STATUS = 0
   BEGIN
     EXEC rb_ModuleEdited @ModID
     FETCH NEXT FROM ChangedModules
     INTO @ModID
   END
   CLOSE ChangedModules
   DEALLOCATE ChangedModules
END

  1. Add a parameter to the stored procedure you use for retrieving the content to indicate if you want the staging data or the production data.
    For example see rb_GetHtmlText :

CREATE   PROCEDURE rb_GetHtmlText
(
@ModuleID int,
@WorkflowVersion int
)
AS
IF ( @WorkflowVersion = 1 )
SELECT *
FROM
rb_HtmlText
WHERE
ModuleID = @ModuleID
ELSE
SELECT *
FROM
rb_HtmlText_st
WHERE
ModuleID = @ModuleID
GO

C# source code modifications

  1. Add a parameter to indicate the version you want to retrieve to the retrieve function in your DB component corresponding to your module.
    public SqlDataReader GetHtmlText(int moduleId, WorkFlowVersion version)
  2. In the constructor of your module set the “SupportsWorkflow” property = true;
    public HtmlModule()
         {
            //...
            SupportsWorkflow = true;
         }
  1. In the databinding procedure of your module use the “Version” property of the PortalModuleControl with the retrieving procedure of your DB component corresponding to your module.
    // Obtain the selected item from the HtmlText table
    HtmlTextDB text = new HtmlTextDB();
    SqlDataReader dr = text.GetHtmlText(ModuleId, Version);
  2. In the databinding of the edit page of your module always use WorkflowVersion.Staging, because you always have to bind your editing env to the staging environment.
    // Obtain a single row of text information
    HtmlTextDB text = new HtmlTextDB();
    SqlDataReader dr = text.GetHtmlText(ModuleId, WorkFlowVersion.Staging);

0 comments
 
This site is running on Atlassian Confluence with a free Open Source Project / Non-profit License (license details).
Confluence is professional wiki, blog and knowledge management tool. Evaluate Confluence for your organisation.
Powered by Atlassian Confluence (Version: 1.3.5 Build:#122 mar 01, 2005) - Bug/feature request - Contact Administrators