static ToolBarButton[] ButtonBarQueryHelper_GetButtonBarForQueryName(QueryButtonContext ctx) { if (ctx.Prefix.HasText()) { return(null); } return(new[] { ChartQueryButton(ctx) }); }
private static ToolBarButton PlainExcel(QueryButtonContext ctx) { return(new ToolBarButton(ctx.Prefix, "sfToExcelPlain") { Title = ExcelMessage.ExcelReport.NiceToString(), Text = ExcelMessage.ExcelReport.NiceToString(), OnClick = Module["toPlainExcel"](ctx.Prefix, ctx.Url.Action("ToExcelPlain", "Excel")) }); }
static ToolBarButton[] ButtonBarQueryHelper_RegisterGlobalButtons(QueryButtonContext ctx) { HeloToolBarButton btn = new HeloToolBarButton(ctx.Prefix, "helpButton") { QueryName = ctx.QueryName, Order = 1000, }; return(new ToolBarButton[] { btn }); }
public static ToolBarButton ChartQueryButton(QueryButtonContext ctx) { if (!ChartPermission.ViewCharting.IsAuthorized()) { return(null); } string chartNewText = ChartMessage.Chart.NiceToString(); return(new ToolBarButton(ctx.Prefix, "qbChartNew") { Title = chartNewText, Text = chartNewText, OnClick = Module["openChart"](ctx.Prefix, ctx.Url.Action("Index", "Chart")) }); }
static ToolBarButton[] ButtonBarQueryHelper_GetButtonBarForQueryName(QueryButtonContext ctx) { if (ctx.Prefix.HasText()) return null; if (ExcelReport) { var items = new List<IMenuItem>(); if (ToExcelPlain) items.Add(PlainExcel(ctx).ToMenuItem()); List<Lite<ExcelReportEntity>> reports = ExcelLogic.GetExcelReports(ctx.QueryName); if (reports.Count > 0) { if (items.Count > 0) items.Add(new MenuItemSeparator()); foreach (Lite<ExcelReportEntity> report in reports) { items.Add(new MenuItem(ctx.Prefix, "sfExcelReport" + report.Id) { Title = report.ToString(), Text = report.ToString(), OnClick = Module["toExcelReport"](ctx.Prefix, ctx.Url.Action("ExcelReport", "Report"), report.Key()), }); } } items.Add(new MenuItemSeparator()); var current = QueryLogic.GetQueryEntity(ctx.QueryName).ToLite().Key(); items.Add(new MenuItem(ctx.Prefix, "qbReportAdminister") { Title = ExcelMessage.Administer.NiceToString(), Text = ExcelMessage.Administer.NiceToString(), OnClick = Module["administerExcelReports"](ctx.Prefix, Finder.ResolveWebQueryName(typeof(ExcelReportEntity)),current), }); items.Add(new MenuItem(ctx.Prefix, "qbReportCreate") { Title = ExcelMessage.CreateNew.NiceToString(), Text = ExcelMessage.CreateNew.NiceToString(), OnClick = Module["createExcelReports"](ctx.Prefix, ctx.Url.Action("Create", "Report"),current), }); return new ToolBarButton[] { new ToolBarDropDown(ctx.Prefix, "tmExcel") { Title = "Excel", Text = "Excel", Items = items } }; } else { if (ToExcelPlain) return new ToolBarButton[] { PlainExcel(ctx) }; } return null; }
private static ToolBarButton PlainExcel(QueryButtonContext ctx) { return new ToolBarButton(ctx.Prefix, "sfToExcelPlain") { Title = ExcelMessage.ExcelReport.NiceToString(), Text = ExcelMessage.ExcelReport.NiceToString(), OnClick = Module["toPlainExcel"](ctx.Prefix, ctx.Url.Action("ToExcelPlain", "Report")) }; }
static ToolBarButton[] ButtonBarQueryHelper_GetButtonBarForQueryName(QueryButtonContext ctx) { if (ctx.Prefix.HasText()) { return(null); } if (!Navigator.IsNavigable(typeof(UserQueryEntity), null, isSearch: true)) { return(null); } var items = new List <IMenuItem>(); Lite <UserQueryEntity> currentUserQuery = null; string url = (ctx.ControllerContext.RouteData.Route as Route)?.Url; if (url.HasText() && url.Contains("UQ")) { currentUserQuery = Lite.Create <UserQueryEntity>(PrimaryKey.Parse(ctx.ControllerContext.RouteData.Values["lite"].ToString(), typeof(UserQueryEntity))); } foreach (var uq in UserQueryLogic.GetUserQueries(ctx.QueryName).OrderBy(a => a.ToString())) { items.Add(new MenuItem(ctx.Prefix, "sfUserQuery" + uq.Id) { Text = uq.ToString(), Title = uq.ToString(), Href = RouteHelper.New().Action <UserQueriesController>(uqc => uqc.View(uq, null, null)), CssClass = "sf-userquery" + (currentUserQuery.Is(uq) ? " sf-userquery-selected" : "") }); } if (items.Count > 0) { items.Add(new MenuItemSeparator()); } if (Navigator.IsCreable(typeof(UserQueryEntity), isSearch: null)) { items.Add(new MenuItem(ctx.Prefix, "qbUserQueryNew") { Title = UserQueryMessage.UserQueries_CreateNew.NiceToString(), Text = UserQueryMessage.UserQueries_CreateNew.NiceToString(), OnClick = Module["createUserQuery"](ctx.Prefix, ctx.Url.Action("Create", "UserQueries")) }); } if (currentUserQuery != null && currentUserQuery.IsAllowedFor(TypeAllowedBasic.Modify, inUserInterface: true)) { items.Add(new MenuItem(ctx.Prefix, "qbUserQueryEdit") { Title = UserQueryMessage.UserQueries_Edit.NiceToString(), Text = UserQueryMessage.UserQueries_Edit.NiceToString(), Href = Navigator.NavigateRoute(currentUserQuery) }); } string uqUserQueriesText = UserQueryMessage.UserQueries_UserQueries.NiceToString(); return(new ToolBarButton[] { new ToolBarDropDown(ctx.Prefix, "tmUserQueries") { Title = uqUserQueriesText, Text = uqUserQueriesText, Items = items } }); }
static ToolBarButton[] ButtonBarQueryHelper_GetButtonBarForQueryName(QueryButtonContext ctx) { if (ctx.Prefix.HasText()) return null; if (!Navigator.IsNavigable(typeof(UserQueryEntity), null, isSearch: true)) return null; var items = new List<IMenuItem>(); Lite<UserQueryEntity> currentUserQuery = null; string url = (ctx.ControllerContext.RouteData.Route as Route)?.Url; if (url.HasText() && url.Contains("UQ")) currentUserQuery = Lite.Create<UserQueryEntity>(PrimaryKey.Parse(ctx.ControllerContext.RouteData.Values["lite"].ToString(), typeof(UserQueryEntity))); foreach (var uq in UserQueryLogic.GetUserQueries(ctx.QueryName).OrderBy(a => a.ToString())) { items.Add(new MenuItem(ctx.Prefix, "sfUserQuery"+uq.Id) { Text = uq.ToString(), Title = uq.ToString(), Href = RouteHelper.New().Action<UserQueriesController>(uqc => uqc.View(uq, null, null)), CssClass = "sf-userquery" + (currentUserQuery.Is(uq) ? " sf-userquery-selected" : "") }); } if (items.Count > 0) items.Add(new MenuItemSeparator()); if (Navigator.IsCreable(typeof(UserQueryEntity), isSearch: null)) { items.Add(new MenuItem(ctx.Prefix, "qbUserQueryNew") { Title = UserQueryMessage.UserQueries_CreateNew.NiceToString(), Text = UserQueryMessage.UserQueries_CreateNew.NiceToString(), OnClick = Module["createUserQuery"](ctx.Prefix, ctx.Url.Action("Create", "UserQueries")) }); } if (currentUserQuery != null && currentUserQuery.IsAllowedFor(TypeAllowedBasic.Modify, inUserInterface: true)) { items.Add(new MenuItem(ctx.Prefix, "qbUserQueryEdit") { Title = UserQueryMessage.UserQueries_Edit.NiceToString(), Text = UserQueryMessage.UserQueries_Edit.NiceToString(), Href = Navigator.NavigateRoute(currentUserQuery) }); } string uqUserQueriesText = UserQueryMessage.UserQueries_UserQueries.NiceToString(); return new ToolBarButton[] { new ToolBarDropDown(ctx.Prefix, "tmUserQueries") { Title = uqUserQueriesText, Text = uqUserQueriesText, Items = items } }; }
static ToolBarButton[] ButtonBarQueryHelper_GetButtonBarForQueryName(QueryButtonContext ctx) { if (ctx.Prefix.HasText()) { return(null); } if (ExcelReport && DynamicQueryManager.Current.QueryAllowed(typeof(ExcelReportEntity), false)) { var items = new List <IMenuItem>(); if (ToExcelPlain) { items.Add(PlainExcel(ctx).ToMenuItem()); } List <Lite <ExcelReportEntity> > reports = ExcelLogic.GetExcelReports(ctx.QueryName); if (reports.Count > 0) { if (items.Count > 0) { items.Add(new MenuItemSeparator()); } foreach (Lite <ExcelReportEntity> report in reports) { items.Add(new MenuItem(ctx.Prefix, "sfExcelReport" + report.Id) { Title = report.ToString(), Text = report.ToString(), OnClick = Module["toExcelReport"](ctx.Prefix, ctx.Url.Action("ExcelReport", "Excel"), report.Key()), }); } } items.Add(new MenuItemSeparator()); var current = QueryLogic.GetQueryEntity(ctx.QueryName).ToLite().Key(); items.Add(new MenuItem(ctx.Prefix, "qbReportAdminister") { Title = ExcelMessage.Administer.NiceToString(), Text = ExcelMessage.Administer.NiceToString(), OnClick = Module["administerExcelReports"](ctx.Prefix, Finder.ResolveWebQueryName(typeof(ExcelReportEntity)), current), }); items.Add(new MenuItem(ctx.Prefix, "qbReportCreate") { Title = ExcelMessage.CreateNew.NiceToString(), Text = ExcelMessage.CreateNew.NiceToString(), OnClick = Module["createExcelReports"](ctx.Prefix, ctx.Url.Action("Create", "Excel"), current), }); return(new ToolBarButton[] { new ToolBarDropDown(ctx.Prefix, "tmExcel") { Title = "Excel", Text = "Excel", Items = items } }); } else { if (ToExcelPlain) { return new ToolBarButton[] { PlainExcel(ctx) } } ; } return(null); }