///// <summary> ///// ///// </summary> //private void LoadRenderModeList() //{ // var RenderModeList = new List<SelectListItem>(); // RenderModeList.Add(new SelectListItem { Text = Localization.GetString("RICH", LocalResourceFile), Value = "RICH", Selected = (RenderModeSelectedValue.Equals("RICH", StringComparison.InvariantCultureIgnoreCase)) }); // RenderModeList.Add(new SelectListItem { Text = Localization.GetString("BASIC", LocalResourceFile), Value = "BASIC", Selected = (RenderModeSelectedValue.Equals("BASIC", StringComparison.InvariantCultureIgnoreCase)) }); // ViewBag.RenderModeList = RenderModeList; //} ///// <summary> ///// ///// </summary> //private void LoadTextRenderModeRBList() //{ // var TextRenderModeRBList = new Dictionary<string, string>() // { // { "T", Localization.GetString("T",LocalResourceFile) }, // { "H", Localization.GetString("H",LocalResourceFile) }, // { "R", Localization.GetString("R",LocalResourceFile) } // }; // ViewBag.TextRenderModeRBList = TextRenderModeRBList; //} /// <summary> /// /// </summary> /// <param name="_html"></param> private string FormatToHtmlText(string _nText) { var repo = new HtmlModuleSettingsRepository(); var settings = repo.GetSettings(ModuleContext.Configuration); return(HtmlTextController.FormatHtmlText(ModuleContext.ModuleId, _nText, settings, ModuleContext.PortalSettings, (Page)HttpContext.CurrentHandler)); }
/// ----------------------------------------------------------------------------- /// <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> /// UpdateSettings saves the modified settings to the Database /// </summary> public override void UpdateSettings() { try { var htmlTextController = new HtmlTextController(); // update replace token setting ModuleSettings.ReplaceTokens = chkReplaceTokens.Checked; ModuleSettings.UseDecorate = cbDecorate.Checked; ModuleSettings.SearchDescLength = int.Parse(txtSearchDescLength.Text); var repo = new HtmlModuleSettingsRepository(); repo.SaveSettings(this.ModuleConfiguration, ModuleSettings); // disable module caching if token replace is enabled if (chkReplaceTokens.Checked) { ModuleInfo module = ModuleController.Instance.GetModule(ModuleId, TabId, false); if (module.CacheTime > 0) { module.CacheTime = 0; ModuleController.Instance.UpdateModule(module); } } // update workflow/version settings switch (rblApplyTo.SelectedValue) { case "Module": htmlTextController.UpdateWorkflow(ModuleId, rblApplyTo.SelectedValue, Int32.Parse(cboWorkflow.SelectedValue), chkReplace.Checked); break; case "Page": htmlTextController.UpdateWorkflow(TabId, rblApplyTo.SelectedValue, Int32.Parse(cboWorkflow.SelectedValue), chkReplace.Checked); break; case "Site": htmlTextController.UpdateWorkflow(PortalId, rblApplyTo.SelectedValue, Int32.Parse(cboWorkflow.SelectedValue), chkReplace.Checked); break; } //Module failed to load } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// UpdateSettings saves the modified settings to the Database /// </summary> /// ----------------------------------------------------------------------------- public override void UpdateSettings() { try { //update module settings ModuleSettings.ReplaceTokens = chkReplaceTokens.Checked; int searchLength = 0; if (int.TryParse(txtSearchDescLength.Text.Trim(), out searchLength)) { ModuleSettings.SearchDescLength = searchLength; } ModuleSettings.EnableFallback = bool.Parse(rblEnableFallback.SelectedValue); var repo = new HtmlModuleSettingsRepository(); repo.SaveSettings(this.ModuleConfiguration, ModuleSettings); // disable module caching if token replace is enabled if (chkReplaceTokens.Checked) { ModuleInfo module = ModuleController.Instance.GetModule(ModuleId, TabId, false); if (module.CacheTime > 0) { module.CacheTime = 0; ModuleController.Instance.UpdateModule(module); } } // advance global settings if (HasAdminRights()) { var htmlTextController = new HtmlTextController(); htmlTextController.UpdateMaximumVersionHistorySetting(PortalId, Convert.ToInt32(ddlMaxVersion.SelectedValue)); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
public override IList <SearchDocument> GetModifiedSearchDocuments(ModuleInfo modInfo, DateTime beginDateUtc) { var workflowId = this.GetWorkflow(modInfo.ModuleID, modInfo.TabID, modInfo.PortalID).Value; var searchDocuments = new List <SearchDocument>(); var htmlTextInfo = this.GetTopHtmlText(modInfo.ModuleID, true, workflowId); var repo = new HtmlModuleSettingsRepository(); var settings = repo.GetSettings(modInfo); if (htmlTextInfo != null && (htmlTextInfo.LastModifiedOnDate.ToUniversalTime() > beginDateUtc && htmlTextInfo.LastModifiedOnDate.ToUniversalTime() < DateTime.UtcNow)) { var strContent = HtmlUtils.Clean(htmlTextInfo.Content, false); // Get the description string var description = strContent.Length <= settings.SearchDescLength ? strContent : HtmlUtils.Shorten(strContent, settings.SearchDescLength, "..."); var searchDoc = new SearchDocument { UniqueKey = modInfo.ModuleID.ToString(), PortalId = modInfo.PortalID, Title = modInfo.ModuleTitle, Description = description, Body = strContent, ModifiedTimeUtc = htmlTextInfo.LastModifiedOnDate.ToUniversalTime(), }; if (modInfo.Terms != null && modInfo.Terms.Count > 0) { searchDoc.Tags = CollectHierarchicalTags(modInfo.Terms); } searchDocuments.Add(searchDoc); } return(searchDocuments); }