/// ----------------------------------------------------------------------------- /// <summary> /// GetWorkFlow retrieves the currently active Workflow for the Portal /// </summary> /// <remarks> /// </remarks> /// <param name = "ModuleId">The ID of the Module</param> /// <param name="TabId">The Tab ID</param> /// <param name = "PortalId">The ID of the Portal</param> public KeyValuePair <string, int> GetWorkflow(int ModuleId, int TabId, int PortalId) { int workFlowId = Null.NullInteger; string workFlowType = Null.NullString; // get module settings HtmlModuleSettings settings; if (ModuleId > -1) { var module = ModuleController.Instance.GetModule(ModuleId, TabId, false); var repo = new HtmlModuleSettingsRepository(); settings = repo.GetSettings(module); } else { settings = new HtmlModuleSettings(); } if (settings.WorkFlowID != Null.NullInteger) { workFlowId = settings.WorkFlowID; workFlowType = "Module"; } if (workFlowId == Null.NullInteger) { // if undefined at module level, get from tab settings var tabSettings = TabController.Instance.GetTabSettings(TabId); if (tabSettings["WorkflowID"] != null) { workFlowId = Convert.ToInt32(tabSettings["WorkflowID"]); workFlowType = "Page"; } } if (workFlowId == Null.NullInteger) { // if undefined at tab level, get from portal settings workFlowId = int.Parse(PortalController.GetPortalSetting("WorkflowID", PortalId, "-1")); workFlowType = "Site"; } // if undefined at portal level, set portal default if (workFlowId == Null.NullInteger) { var objWorkflow = new WorkflowStateController(); ArrayList arrWorkflows = objWorkflow.GetWorkflows(PortalId); foreach (WorkflowStateInfo objState in arrWorkflows) { // use direct publish as default if (Null.IsNull(objState.PortalID) && objState.WorkflowName == "Direct Publish") { workFlowId = objState.WorkflowID; workFlowType = "Module"; } } } return(new KeyValuePair <string, int>(workFlowType, workFlowId)); }
/// ----------------------------------------------------------------------------- /// <summary> /// FormatHtmlText formats HtmlText content for display in the browser /// </summary> /// <remarks> /// </remarks> /// <param name="moduleId">The ModuleID</param> /// <param name = "content">The HtmlText Content</param> /// <param name = "settings">Module Settings</param> /// <param name="portalSettings">The Portal Settings.</param> /// <param name="page">The Page Instance.</param> public static string FormatHtmlText(int moduleId, string content, HtmlModuleSettings settings, PortalSettings portalSettings, Page page) { // token replace if (settings.ReplaceTokens) { var tr = new HtmlTokenReplace(page) { AccessingUser = UserController.Instance.GetCurrentUserInfo(), DebugMessages = portalSettings.UserMode != PortalSettings.Mode.View, ModuleId = moduleId, PortalSettings = portalSettings }; content = tr.ReplaceEnvironmentTokens(content); } // Html decode content content = HttpUtility.HtmlDecode(content); // manage relative paths content = ManageRelativePaths(content, portalSettings.HomeDirectory, "src", portalSettings.PortalId); content = ManageRelativePaths(content, portalSettings.HomeDirectory, "background", portalSettings.PortalId); return(content); }