示例#1
0
 internal void PersistContentGroupAndBlankTemplateToModule(int moduleId, bool wasCreated, Guid guid)
 {
     // Remove the previewTemplateId (because it's not needed as soon Content is inserted)
     DeletePreviewTemplateId(moduleId);
     // Update contentGroup Guid for this module
     if (wasCreated)
     {
         DnnStuffToRefactor.UpdateModuleSettingForAllLanguages(moduleId, Settings.ContentGroupGuidString,
                                                               guid.ToString());
     }
 }
示例#2
0
        /// <summary>
        /// Saves a temporary templateId to the module's settings
        /// This templateId will be used until a contentgroup exists
        /// </summary>
        /// <param name="moduleId"></param>
        /// <param name="previewTemplateGuid"></param>
        public void SetModulePreviewTemplateId(int moduleId, Guid previewTemplateGuid)
        {
            // todo: 2rm - I believe you are accidentally using uncached module settings access - pls check and probably change
            // todo: note: this is done ca. 3x in this class
            var moduleController = new ModuleController();
            var settings         = moduleController.GetModuleSettings(moduleId);

            // Do not allow saving the temporary template id if a contentgroup exists for this module
            if (settings[Settings.ContentGroupGuidString] != null)
            {
                throw new Exception("Preview template id cannot be set for a module that already has content.");
            }

            //var dataSource = DataSource.GetInitialDataSource(_zoneId, _appId);
            //var previewTemplateGuid = dataSource.List[previewTemplateId].EntityGuid;

            //moduleController.UpdateModuleSetting(moduleId, PreviewTemplateIdString, previewTemplateGuid.ToString());
            DnnStuffToRefactor.UpdateModuleSettingForAllLanguages(moduleId, Settings.PreviewTemplateIdString, previewTemplateGuid.ToString());
        }
示例#3
0
 public static void DeletePreviewTemplateId(int moduleId)
 {
     DnnStuffToRefactor.UpdateModuleSettingForAllLanguages(moduleId, Settings.PreviewTemplateIdString, null);
 }
 internal override void SetTemplateChooserState(bool state)
 => DnnStuffToRefactor.UpdateModuleSettingForAllLanguages(ModuleId, Settings.SettingsShowTemplateChooser, state.ToString());