private void SetupFeature(ContentFeature feature) { WritePageContent( string.Format(SetupResource.ConfigureFeatureMessage, ResourceHelper.GetResourceString( feature.ResourceFile, feature.FeatureNameReasourceKey)) , true); ModuleDefinition moduleDefinition = new ModuleDefinition(feature.FeatureGuid); moduleDefinition.ControlSrc = feature.ControlSource; moduleDefinition.DefaultCacheTime = feature.DefaultCacheTime; moduleDefinition.FeatureName = feature.FeatureNameReasourceKey; moduleDefinition.Icon = feature.Icon; moduleDefinition.IsAdmin = feature.ExcludeFromFeatureList; moduleDefinition.SortOrder = feature.SortOrder; moduleDefinition.ResourceFile = feature.ResourceFile; moduleDefinition.IsCacheable = feature.IsCacheable; moduleDefinition.IsSearchable = feature.IsSearchable; moduleDefinition.SearchListName = feature.SearchListNameResourceKey; moduleDefinition.SupportsPageReuse = feature.SupportsPageReuse; moduleDefinition.DeleteProvider = feature.DeleteProvider; moduleDefinition.PartialView = feature.PartialView; moduleDefinition.Save(); foreach (ContentFeatureSetting featureSetting in feature.Settings) { ModuleDefinition.UpdateModuleDefinitionSetting( moduleDefinition.FeatureGuid, moduleDefinition.ModuleDefId, featureSetting.ResourceFile, featureSetting.GroupNameKey, featureSetting.ResourceKey, featureSetting.DefaultValue, featureSetting.ControlType, featureSetting.RegexValidationExpression, featureSetting.ControlSrc, featureSetting.HelpKey, featureSetting.SortOrder); } }
private void UpdateBtn_Click(Object sender, EventArgs e) { if (Page.IsValid) { ModuleDefinition moduleDefinition = new ModuleDefinition(this.moduleDefinitionId); if (txtFeatureGuid.Text.Length == 36) { moduleDefinition.FeatureGuid = new Guid(txtFeatureGuid.Text); } moduleDefinition.SiteId = siteSettings.SiteId; moduleDefinition.FeatureName = this.txtFeatureName.Text; moduleDefinition.ResourceFile = txtResourceFile.Text; moduleDefinition.ControlSrc = this.txtControlSource.Text; moduleDefinition.SortOrder = int.Parse(this.txtSortOrder.Text, CultureInfo.InvariantCulture); moduleDefinition.DefaultCacheTime = int.Parse(this.txtDefaultCacheDuration.Text, CultureInfo.InvariantCulture); moduleDefinition.IsAdmin = this.chkIsAdmin.Checked; moduleDefinition.Icon = this.ddIcons.SelectedValue; moduleDefinition.IsCacheable = chkIsCacheable.Checked; moduleDefinition.IsSearchable = chkIsSearchable.Checked; moduleDefinition.SearchListName = txtSearchListName.Text; moduleDefinition.Save(); string redirectUrl = SiteRoot + "/Admin/ModuleDefinitions.aspx?defid=" + moduleDefinition.ModuleDefId.ToString(CultureInfo.InvariantCulture); WebUtils.SetupRedirect(this, redirectUrl); } }