protected void sourcerepeater_databound(object sender, RepeaterItemEventArgs e) { CalendarDataSource cds = (e.Item.DataItem as CalendarDataSource); if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { Control itemID = e.Item.FindControl("itemID"); if(itemID != null){ string sourcetype = Enum.GetName(typeof(SourceType), cds.sourceType).Replace("Calendar", ""); (itemID as Literal).Text = sourcetype + "-" + cds.defaultId; } Control itemName = e.Item.FindControl("itemName"); if (itemName != null) { string name = ""; switch (cds.sourceType) { case SourceType.GroupCalendar: Ektron.Cms.API.Community.CommunityGroup cg = new Ektron.Cms.API.Community.CommunityGroup(); CommunityGroupData cgd = cg.GetCommunityGroupByID(cds.defaultId); name = cgd.GroupName; break; case SourceType.SystemCalendar: FolderData fd = this.folder.GetItem(cds.defaultId); name = fd.Name; break; case SourceType.UserCalendar: Ektron.Cms.Framework.User.UserManager user = new Ektron.Cms.Framework.User.UserManager(Ektron.Cms.Framework.ApiAccessMode.Admin); UserData ud = user.GetItem(cds.defaultId); name = ud.DisplayName; break; default: break; } (itemName as Literal).Text = name; } } }
protected void Page_Load(object sender, EventArgs e) { Packages.jQuery.jQueryUI.ThemeRoller.Register(this); Packages.jQuery.jQueryUI.Tabs.Register(this); Packages.jQuery.jQueryUI.Datepicker.Register(this); ICmsContextService cmsContextService = ServiceFactory.CreateCmsContextService(); JS.RegisterJSInclude(this, cmsContextService.UIPath + "/js/jQuery/Plugins/globinfo/ektron.glob." + ClientCulture.Name + ".js", "EktronGlobalCulture_" + ClientCulture.Name + "_JS"); JS.RegisterJSInclude(this, JS.ManagedScript.EktronBlockUiJS); JS.RegisterJSInclude(this, ContentApi.AppPath + "WebCalendar/DefaultTemplate/timeselector/jquery.ptTimeSelect.js", "WebCalendarAdvancedFormTimePickerJS"); JS.RegisterJSInclude(this, ContentApi.AppPath + "WebCalendar/defaulttemplate/advancedform.js", "WebCalendarAdvancedFormJS"); labelfortitle.Text = ContentApi.EkMsgRef.GetMessage("generic title label"); labelforlocation.Text = ContentApi.EkMsgRef.GetMessage("generic location") + ":"; UpdateButton.ValidationGroup = Owner.ValidationGroup; UpdateButton.CommandName = Mode == AdvancedFormMode.Edit ? "Update" : "Insert"; UpdateButton.Command += new CommandEventHandler(CommandHandler); CancelButton.Command += new CommandEventHandler(CancelButton_Command); AdvancedEditCloseButton.Command += new CommandEventHandler(CancelButton_Command); AdvCalendarSelect.Visible = (Provider.DataSources.Count > 1); long lastselectedfolder = Folder; sourceSelector.Items.Clear(); foreach (EventRadScheduleProvider.CalendarData cd in Provider.DataSources) { if (cd.PermissionData.CanAdd) { FolderData fd = ContentApi.GetFolderById(cd.FolderID, false, false); IsEventSearchable = fd.IscontentSearchable; Ektron.Cms.API.User.User uapi = new Ektron.Cms.API.User.User(); Ektron.Cms.API.Community.CommunityGroup cgapi = new Ektron.Cms.API.Community.CommunityGroup(); if (fd != null) { string name = ""; switch (cd.sourceType) { case Ektron.Cms.Controls.SourceType.SystemCalendar: name = "System Calendar: " + fd.Name + " (ID: " + cd.FolderID + ")"; break; case Ektron.Cms.Controls.SourceType.GroupCalendar: CommunityGroupData cgd = cgapi.GetCommunityGroupByID(cd.defaultId); name = "Group Calendar: " + cgd.GroupName + " (Group ID: " + cd.defaultId + ")"; break; case Ektron.Cms.Controls.SourceType.UserCalendar: UserData thisUser = uapi.GetUser(cd.defaultId, false, true); if (cd.defaultId == 0 || cd.defaultId == ContentApi.UserId) { name = "My Calendar (" + thisUser.DisplayUserName + ")"; } else { name = "User Calendar: " + thisUser.DisplayUserName + " (User ID: " + cd.defaultId + ")"; } break; } sourceSelector.Items.Add(new ListItem(name, cd.FolderID.ToString() + "|" + cd.SelectedTaxID.ToString())); } } } if (Provider.DataSources.Count == 1) { SelectedTaxID = Provider.DataSources[0].SelectedTaxID; Folder = Provider.DataSources[0].FolderID; } if (sourceSelector.SelectedValue == string.Empty && sourceSelector.Items.Count > 0) { sourceSelector.Items[0].Selected = true; } if (lastselectedfolder != 0) { Folder = lastselectedfolder; } if (EventData != null) { Folder = EventData.FolderId; sourceSelector.Enabled = false; } if (Folder > 0) { TaxonomySelector.FolderID = Folder; MetadataSelector.FolderID = Folder; if (Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(ContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.UrlAliasing, false)) { Ektron.Cms.UrlAliasing.UrlAliasSettingsApi _aliasSettings = new Ektron.Cms.UrlAliasing.UrlAliasSettingsApi(); FolderData fd = ContentApi.GetFolderById(Folder, false, false); if (_aliasSettings.IsManualAliasEnabled) { if (ContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias)) { phAliases.Visible = phAliasTab.Visible = pnlManualAlias.Visible = true; aliasRequired.InnerText = fd.AliasRequired.ToString().ToLower(); } } if (_aliasSettings.IsAutoAliasEnabled) { System.Collections.Generic.List<UrlAliasAutoData> autoAliasList = new System.Collections.Generic.List<UrlAliasAutoData>(); Ektron.Cms.UrlAliasing.UrlAliasAutoApi autoAliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi(); phAliases.Visible = phAliasTab.Visible = pnlAutoAlias.Visible = true; if (EventData != null) { autoAliasList = autoAliasApi.GetListForContent(EventData.Id); rpAutoAlias.DataSource = autoAliasList; } } //-------------------DisplayTabs Based on selected options from Folder properties---------------------------------- if (((fd.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.AllTabs) == (int)EkEnumeration.FolderTabDisplaySettings.AllTabs) && fd.DisplaySettings != 0) { if ((fd.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.MetaData) == (int)EkEnumeration.FolderTabDisplaySettings.MetaData) { phMetadata.Visible= MetadataSelector.Visible = true; } else { if (!MetadataSelector.MetadataRequired) phMetadata.Visible = MetadataSelector.Visible = false; } if ((_aliasSettings.IsManualAliasEnabled || _aliasSettings.IsAutoAliasEnabled) && _contentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias)) //And Not (m_bIsBlog) { if ((fd.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Aliasing) == (int)EkEnumeration.FolderTabDisplaySettings.Aliasing) { phAliases.Visible = phAliasTab.Visible = pnlManualAlias.Visible = pnlAutoAlias.Visible = true; } else { if (!fd.AliasRequired) phAliases.Visible = phAliasTab.Visible = pnlManualAlias.Visible = pnlAutoAlias.Visible = false; } } if ((fd.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Taxonomy) == (int)EkEnumeration.FolderTabDisplaySettings.Taxonomy) { phTaxonomyTab.Visible = phTaxonomy.Visible = true; } else { if (!fd.IsCategoryRequired) phTaxonomyTab.Visible = phTaxonomy.Visible = false; } } //-------------------DisplayTabs Based on selected options from Folder properties End----------------------------- } } if (!FormInitialized) { initHiddenData(); InitializeManualAliases(); PrefillEventControls(); PrefillRecurrenceControls(); UpdateResetExceptionsVisibility(); bool failed = false; string initform = String.Format("Ektron.WebCalendar.AdvancedForm.init(\"{0}\", \"{1}\", {2});", Owner.ClientID, ContentApi.AppPath, ContentApi.RequestInformationRef.WorkAreaOperationMode.ToString().ToLower()); try { JavaScript.RegisterJavaScriptBlock(this, initform); } catch { failed = true; } if (failed || Controls.IsReadOnly) { //we're apparently in a full postback which doesn't care for registerjsblock extrascript.Text = "<script type=\"text/javascript\" defer=\"defer\"> window.setTimeout(function(){" + initform + "}, 750); </script>"; extrascript.Visible = true; } } else { extrascript.Visible = false; } btnHelp.Text = "<li class=\"actionbarDivider\"> </li>" + m_refStyle.GetHelpButton("editevent", ""); }