protected void Page_Load(object sender, EventArgs e) { CurrentUserInfo cu = CMSContext.CurrentUser; // Check permissions if ((cu == null) || !cu.IsAuthorizedPerResource("CMS.Ecommerce", "EcommerceRead")) { CMSMyDeskPage.RedirectToCMSDeskAccessDenied("CMS.Ecommerce", "EcommerceRead"); } // Check UIProfile if (!cu.IsAuthorizedPerUIElement("CMS.Desk", "Ecommerce")) { CMSMyDeskPage.RedirectToCMSDeskUIElementAccessDenied("CMS.Desk", "Ecommerce"); } if (!cu.IsAuthorizedPerUIElement("CMS.Ecommerce", "DashboardGroup")) { CMSMyDeskPage.RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "DashboardGroup"); } if (!cu.IsAuthorizedPerUIElement("CMS.Ecommerce", "EcommerceDashboard")) { CMSMyDeskPage.RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "EcommerceDashboard"); } }
protected void Page_Load(object sender, EventArgs e) { // Check UIProfile if ((CMSContext.CurrentUser == null) || (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.MyDesk", "MyDeskDashBoard"))) { CMSMyDeskPage.RedirectToCMSDeskUIElementAccessDenied("CMS.MyDesk", "MyDeskDashBoard"); } if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.MyDesk", "MyDeskDashBoardItem")) { CMSMyDeskPage.RedirectToCMSDeskUIElementAccessDenied("CMS.MyDesk", "MyDeskDashBoardItem"); } }
protected void Page_Load(object sender, EventArgs e) { // Keep current user CurrentUserInfo cu = CMSContext.CurrentUser; // Check permissions if ((CMSContext.CurrentUser == null) || !cu.IsAuthorizedPerResource("CMS.WebAnalytics", "Read")) { CMSMyDeskPage.RedirectToCMSDeskAccessDenied("CMS.WebAnalytics", "Read"); } // Check ui elements if (!cu.IsAuthorizedPerUIElement("CMS.WebAnalytics", "Dashboard")) { CMSMyDeskPage.RedirectToCMSDeskUIElementAccessDenied("CMS.WebAnalytics", "Dashboard"); } }
protected void Page_Load(object sender, EventArgs e) { CurrentUserInfo cu = CMSContext.CurrentUser; // Check permissions if ((cu == null) || !cu.IsAuthorizedPerResource("CMS.OnlineMarketing", "Read")) { CMSMyDeskPage.RedirectToCMSDeskAccessDenied("CMS.OnlineMarketing", "Read"); } // Check UIProfile if (!cu.IsAuthorizedPerUIElement("CMS.OnlineMarketing", "OMDashBoardGroup")) { CMSMyDeskPage.RedirectToCMSDeskUIElementAccessDenied("CMS.OnlineMarketing", "OMDashBoardGroup"); } if (!cu.IsAuthorizedPerUIElement("CMS.OnlineMarketing", "OMDashBoard")) { CMSMyDeskPage.RedirectToCMSDeskUIElementAccessDenied("CMS.OnlineMarketing", "OMDashBoard"); } // Register script for unimenu button selection CMSDeskPage.AddMenuButtonSelectScript(this, "OMDashBoard", null, "menu"); }
/// <summary> /// External data binding handler. /// </summary> protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter) { // Prepare variables int nodeId = 0; string culture = string.Empty; DataRowView data = null; sourceName = sourceName.ToLowerCSafe(); SiteInfo site = null; switch (sourceName) { // Edit button case EXTERNALSOURCE_EDIT: if (sender is ImageButton) { ImageButton editButton = (ImageButton)sender; data = UniGridFunctions.GetDataRowView(editButton.Parent as DataControlFieldCell); site = GetSiteFromRow(data); nodeId = ValidationHelper.GetInteger(data[SOURCE_NODEID], 0); culture = ValidationHelper.GetString(data[SOURCE_DOCUMENTCULTURE], string.Empty); string type = ValidationHelper.GetString(DataHelper.GetDataRowViewValue(data, SOURCE_TYPE), string.Empty); // Check permissions if ((site.Status != SiteStatusEnum.Running) || (!CMSMyDeskPage.IsUserAuthorizedPerContent(site.SiteName) || ((ListingType == ListingTypeEnum.All) && (type == LISTINGTYPE_RECYCLEBIN)))) { editButton.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/Editdisabled.png"); editButton.OnClientClick = "return false"; editButton.Style.Add(HtmlTextWriterStyle.Cursor, "default"); } else { editButton.OnClientClick = "return SelectItem(" + nodeId + ", '" + culture + "','" + ResolveSiteUrl(site) + "');"; } return(editButton); } return(sender); // Preview button case EXTERNALSOURCE_PREVIEW: if (sender is ImageButton) { ImageButton previewButton = (ImageButton)sender; data = UniGridFunctions.GetDataRowView(previewButton.Parent as DataControlFieldCell); site = GetSiteFromRow(data); string type = ValidationHelper.GetString(DataHelper.GetDataRowViewValue(data, SOURCE_TYPE), string.Empty); if ((site.Status != SiteStatusEnum.Running) || ((ListingType == ListingTypeEnum.All) && (type == LISTINGTYPE_RECYCLEBIN))) { previewButton.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/Viewdisabled.png"); previewButton.OnClientClick = "return false"; previewButton.Style.Add(HtmlTextWriterStyle.Cursor, "default"); } else { nodeId = ValidationHelper.GetInteger(data[SOURCE_NODEID], 0); culture = ValidationHelper.GetString(data[SOURCE_DOCUMENTCULTURE], string.Empty); string nodeAliasPath = ValidationHelper.GetString(data[SOURCE_NODEALIASPATH], string.Empty); // Generate preview URL string url = CMSContext.GetUrl(nodeAliasPath, null, site.SiteName); url = URLHelper.AddParameterToUrl(url, "viewmode", "2"); url = URLHelper.AddParameterToUrl(url, URLHelper.LanguageParameterName, culture); previewButton.OnClientClick = "window.open('" + URLHelper.ResolveUrl(url) + "','LiveSite');return false;"; } return(previewButton); } return(sender); // Document name column case EXTERNALSOURCE_DOCUMENTNAME: data = (DataRowView)parameter; string name = ValidationHelper.GetString(data[SOURCE_DOCUMENTNAME], string.Empty); nodeId = ValidationHelper.GetInteger(data[SOURCE_NODEID], 0); culture = ValidationHelper.GetString(data[SOURCE_DOCUMENTCULTURE], string.Empty); string className = ValidationHelper.GetString(data[SOURCE_CLASSNAME], string.Empty); site = GetSiteFromRow(data); if (name == string.Empty) { name = GetString("general.notspecified"); } // Add document type icon string result = string.Empty; switch (ListingType) { case ListingTypeEnum.DocTypeDocuments: break; default: result = "<img src=\"" + UIHelper.GetDocumentTypeIconUrl(Parent.Page, className, String.Empty, true) + "\" class=\"UnigridActionButton\" />"; break; } result += "<span style=\"vertical-align: bottom;\">" + HTMLHelper.HTMLEncode(TextHelper.LimitLength(name, 50)) + "</span>"; if (ListingType != ListingTypeEnum.All) { bool isLink = (data.Row.Table.Columns.Contains(SOURCE_NODELINKEDNODEID) && (data[SOURCE_NODELINKEDNODEID] != DBNull.Value)); if (isLink) { // Add link icon result += UIHelper.GetDocumentMarkImage(Parent.Page, DocumentMarkEnum.Link); } } return(result); // Class name column case EXTERNALSOURCE_CLASSDISPLAYNAME: string displayName = ValidationHelper.GetString(parameter, string.Empty); if (sourceName.ToLowerCSafe() == EXTERNALSOURCE_CLASSDISPLAYNAMETOOLTIP) { displayName = TextHelper.LimitLength(displayName, 50); } if (displayName == string.Empty) { displayName = "-"; } return(HTMLHelper.HTMLEncode(ResHelper.LocalizeString(displayName))); case EXTERNALSOURCE_DOCUMENTNAMETOOLTIP: data = (DataRowView)parameter; return(UniGridFunctions.DocumentNameTooltip(data)); case EXTERNALSOURCE_STEPDISPLAYNAME: // Step display name string stepName = ValidationHelper.GetString(parameter, string.Empty); if (stepName == string.Empty) { stepName = "-"; } return(HTMLHelper.HTMLEncode(ResHelper.LocalizeString(stepName))); case EXTERNALSOURCE_STEPNAME: // Step display name from ID int stepId = ValidationHelper.GetInteger(parameter, 0); if (stepId > 0) { WorkflowStepInfo wsi = WorkflowStepInfoProvider.GetWorkflowStepInfo(stepId); if (wsi != null) { return(HTMLHelper.HTMLEncode(ResHelper.LocalizeString(wsi.StepDisplayName))); } } return("-"); case EXTERNALSOURCE_CULTURE: data = (DataRowView)parameter; culture = ValidationHelper.GetString(data[SOURCE_DOCUMENTCULTURE], string.Empty); // Add icon if (culture != String.Empty) { return(UniGridFunctions.DocumentCultureFlag(data, Page)); } return("-"); // Version column case EXTERNALSOURCE_VERSION: if (parameter == DBNull.Value) { parameter = "-"; } parameter = HTMLHelper.HTMLEncode(parameter.ToString()); return(parameter); // Site name column case EXTERNALSOURCE_SITENAME: string siteName = ValidationHelper.GetString(parameter, string.Empty); siteInfo = SiteInfoProvider.GetSiteInfo(siteName); return(HTMLHelper.HTMLEncode(siteInfo.DisplayName)); case EXTERNALSOURCE_SITEID: int siteId = ValidationHelper.GetInteger(parameter, 0); siteInfo = SiteInfoProvider.GetSiteInfo(siteId); return(HTMLHelper.HTMLEncode(siteInfo.DisplayName)); // Document timestamp column case EXTERNALSOURCE_MODIFIEDWHEN: case EXTERNALSOURCE_MODIFIEDWHENTOOLTIP: if (string.IsNullOrEmpty(parameter.ToString())) { return(string.Empty); } else { if (currentSiteInfo == null) { currentSiteInfo = CMSContext.CurrentSite; } bool displayGMT = (sourceName == EXTERNALSOURCE_MODIFIEDWHENTOOLTIP); DateTime time = ValidationHelper.GetDateTime(parameter, DateTimeHelper.ZERO_TIME); return(TimeZoneHelper.ConvertToUserTimeZone(time, displayGMT, currentUserInfo, currentSiteInfo)); } } return(parameter); }