private void SaveHangout() { var ctlHangout = new DNNHangoutController(); var sec = new PortalSecurity(); HangoutInfo hangout = null; // get an instance of the hangout (if necessary) if (Hangout == null) { hangout = new HangoutInfo(); } else { hangout = Hangout; } // populate the hangout with the user field values hangout.Description = sec.InputFilter(txtDescription.Text.Trim(), PortalSecurity.FilterFlag.NoScripting); hangout.Duration = int.Parse(sec.InputFilter(txtDuration.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup), NumberStyles.Integer); hangout.HangoutAddress = sec.InputFilter(txtHangoutAddress.Text.Trim(), PortalSecurity.FilterFlag.NoScripting); hangout.StartDate = txtStartDate.SelectedDate != null ? txtStartDate.SelectedDate.Value : DateTime.Now; hangout.Title = sec.InputFilter(txtTitle.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup); // determine the units to use if (ddlDurationUnits.SelectedIndex == 0) { hangout.DurationUnits = DurationType.Minutes; } else { hangout.DurationUnits = DurationType.Hours; } var contentItemId = Null.NullInteger; // update or create the hangout if (HangoutId > Null.NullInteger) { // update hangout contentItemId = ctlHangout.UpdateContentItem(TabId, ModuleId, hangout.ContentItemId, hangout); } else { // new hangout contentItemId = ctlHangout.CreateContentItem(TabId, ModuleId, hangout); } if (contentItemId > Null.NullInteger) { // update the module settings to set the default Google Hangout to show on the first page load var ctlModule = new ModuleController(); ctlModule.UpdateTabModuleSetting(TabModuleId, DNNHangoutController.SETTINGS_HANGOUT_ID,contentItemId.ToString()); ModuleController.SynchronizeModule(ModuleId); } }
private string GetTemplate() { var template = string.Empty; if (Settings.ContainsKey(DNNHangoutController.SETTINGS_TEMPLATE)) { // use a saved template from settings template = Settings[DNNHangoutController.SETTINGS_TEMPLATE].ToString(); } else { // use a default template from RESX template = Localization.GetString("DefaultTemplate.Text", LocalResourceFile.Replace("View", "Settings")); } // replace tokens var ctlHangout = new DNNHangoutController(); template = ctlHangout.ReplaceTokens(template, Hangout, PortalSettings, ModuleId, LocalResourceFile); return template; }
private void DeleteHangout() { if (HangoutId > Null.NullInteger) { // delete the related content item var ctlHangout = new DNNHangoutController(); ctlHangout.DeleteContentItem(HangoutId); // delete the module setting var ctlModule = new ModuleController(); if (Settings.ContainsKey(DNNHangoutController.SETTINGS_HANGOUT_ID)) { ctlModule.DeleteTabModuleSetting(TabModuleId, DNNHangoutController.SETTINGS_HANGOUT_ID); } ModuleController.SynchronizeModule(ModuleId); } }