public override object GetValue(TemplateParameters p) { var entity = (Lite <Entity>)p.Rows.DistinctSingle(p.Columns[EntityToken]); var fallback = (string)p.Rows.DistinctSingle(p.Columns[ParsedToken.QueryToken]); return(entity == null ? null : TranslatedInstanceLogic.TranslatedField(entity, Route, fallback)); }
public static void RegisterTranslatableRoutes() { TranslatedInstanceLogic.AddRoute((ToolbarEntity tb) => tb.Name); TranslatedInstanceLogic.AddRoute((ToolbarEntity tb) => tb.Elements[0].Label); TranslatedInstanceLogic.AddRoute((ToolbarMenuEntity tm) => tm.Name); TranslatedInstanceLogic.AddRoute((ToolbarMenuEntity tb) => tb.Elements[0].Label); }
public ActionResult Index() { var cultures = TranslationLogic.CurrentCultureInfos(TranslatedInstanceLogic.DefaultCulture); var list = TranslatedInstanceLogic.TranslationInstancesStatus(); return(base.View(TranslationClient.ViewPrefix.FormatWith("IndexInstance"), list.AgGroupToDictionary(a => a.Type, gr => gr.ToDictionary(a => a.CultureInfo)))); }
private static IEnumerable <ToolbarResponse>?ToResponse(TranslatableElement <ToolbarElementEmbedded> transElement) { var element = transElement.Value; IContentConfig?config = null; if (element.Content != null) { config = ContentCondigDictionary.GetOrThrow(element.Content.EntityType); if (!config.IsAuhorized(element.Content)) { return(null); } var customResponse = config.CustomResponses(element.Content); if (customResponse != null) { return(customResponse); } } var result = new ToolbarResponse { type = element.Type, content = element.Content, url = element.Url, label = transElement.TranslatedElement(a => a.Label !).DefaultText(null) ?? config?.DefaultLabel(element.Content !), iconName = element.IconName, iconColor = element.IconColor, autoRefreshPeriod = element.AutoRefreshPeriod, openInPopup = element.OpenInPopup, }; if (element.Content is Lite <ToolbarMenuEntity> ) { var tme = ToolbarMenus.Value.GetOrThrow((Lite <ToolbarMenuEntity>)element.Content); result.elements = ToResponseList(TranslatedInstanceLogic.TranslatedMList(tme, t => t.Elements).ToList()); if (result.elements.Count == 0) { return(null); } } if (element.Content is Lite <ToolbarEntity> ) { var tme = Toolbars.Value.GetOrThrow((Lite <ToolbarEntity>)element.Content); var res = ToResponseList(TranslatedInstanceLogic.TranslatedMList(tme, t => t.Elements).ToList()); if (res.Count == 0) { return(null); } return(res); } return(new[] { result }); }
public static void ImportSpanishInstanceTranslations() { TranslatedInstanceLogic.ImportExcelFile("../../../InstanceTranslations/Category.es.View.xlsx"); TranslatedInstanceLogic.ImportExcelFile("../../../InstanceTranslations/Dashboard.es.View.xlsx"); TranslatedInstanceLogic.ImportExcelFile("../../../InstanceTranslations/Toolbar.es.View.xlsx"); TranslatedInstanceLogic.ImportExcelFile("../../../InstanceTranslations/ToolbarMenu.es.View.xlsx"); TranslatedInstanceLogic.ImportExcelFile("../../../InstanceTranslations/UserChart.es.View.xlsx"); TranslatedInstanceLogic.ImportExcelFile("../../../InstanceTranslations/UserQuery.es.View.xlsx"); }
public FileContentResult ViewFile(string type, string culture) { Type t = TypeLogic.GetType(type); var c = CultureInfo.GetCultureInfo(culture); var file = TranslatedInstanceLogic.ExportExcelFile(t, c); return(File(file.Content, MimeMapping.GetMimeMapping(file.FileName), file.FileName)); }
public static List <Lite <DashboardEntity> > Autocomplete(string subString, int limit) { var isAllowed = Schema.Current.GetInMemoryFilter <DashboardEntity>(userInterface: false); return(Dashboards.Value.Values .Where(d => d.EntityType == null && isAllowed(d)) .Select(d => d.ToLite(TranslatedInstanceLogic.TranslatedField(d, d => d.DisplayName))) .Autocomplete(subString, limit).ToList()); }
public static List <Lite <UserChartEntity> > GetUserCharts(object queryName) { var isAllowed = Schema.Current.GetInMemoryFilter <UserChartEntity>(userInterface: false); return(UserChartsByQuery.Value.TryGetC(queryName).EmptyIfNull() .Select(lite => UserCharts.Value.GetOrThrow(lite)) .Where(uc => isAllowed(uc)) .Select(uc => uc.ToLite(TranslatedInstanceLogic.TranslatedField(uc, d => d.DisplayName))) .ToList()); }
public void Save([Required, FromBody] List <TranslationRecordTS> body, string type, string?culture) { Type t = TypeLogic.GetType(type); CultureInfo?c = culture == null ? null : CultureInfo.GetCultureInfo(culture); var records = GetTranslationRecords(body, t); TranslatedInstanceLogic.SaveRecords(records, t, c); }
public static List <Lite <UserQueryEntity> > GetUserQueriesEntity(Type entityType) { var isAllowed = Schema.Current.GetInMemoryFilter <UserQueryEntity>(userInterface: false); return(UserQueriesByTypeForQuickLinks.Value.TryGetC(entityType).EmptyIfNull() .Select(lite => UserQueries.Value.GetOrThrow(lite)) .Where(uq => isAllowed(uq)) .Select(uq => uq.ToLite(TranslatedInstanceLogic.TranslatedField(uq, d => d.DisplayName))) .ToList()); }
public static List <Lite <UserQueryEntity> > GetUserQueries(object queryName, bool appendFilterOnly = false) { var isAllowed = Schema.Current.GetInMemoryFilter <UserQueryEntity>(userInterface: false); return(UserQueriesByQuery.Value.TryGetC(queryName).EmptyIfNull() .Select(lite => UserQueries.Value.GetOrThrow(lite)) .Where(uq => isAllowed(uq) && (!appendFilterOnly || uq.AppendFilters)) .Select(d => d.ToLite(TranslatedInstanceLogic.TranslatedField(d, d => d.DisplayName))) .ToList()); }
public List <CategoryWithProducts> Catalog() { return(ProductLogic.ActiveProducts.Value.Select(a => new CategoryWithProducts { Category = a.Key.ToLite(), Picture = a.Key.Picture?.BinaryFile, LocCategoryName = TranslatedInstanceLogic.TranslatedField(a.Key.ToLite(), prCategoryName, null, a.Key.CategoryName), LocDescription = TranslatedInstanceLogic.TranslatedField(a.Key.ToLite(), prDescription, null, a.Key.Description), Products = a.Value }).ToList()); }
public ActionResult UploadFile() { HttpPostedFileBase hpf = Request.Files[Request.Files.Cast <string>().Single()]; var type = TypeLogic.GetType(hpf.FileName.Before('.')); var culture = CultureInfo.GetCultureInfo(hpf.FileName.After('.').Before('.')); var pair = TranslatedInstanceLogic.ImportExcelFile(hpf.InputStream, hpf.FileName); return(RedirectToAction("View", new { type = TypeLogic.GetCleanName(pair.Type), culture = pair.Culture, searchPressed = false })); }
public static List <Lite <DashboardEntity> > GetDashboardsEntity(Type entityType) { var isAllowed = Schema.Current.GetInMemoryFilter <DashboardEntity>(userInterface: false); return(DashboardsByType.Value.TryGetC(entityType) .EmptyIfNull() .Select(lite => Dashboards.Value.GetOrThrow(lite)) .Where(d => isAllowed(d)) .Select(d => d.ToLite(TranslatedInstanceLogic.TranslatedField(d, d => d.DisplayName))) .ToList()); }
public ActionResult SaveView(string type, string culture, string filter) { Type t = TypeLogic.GetType(type); var records = GetTranslationRecords(t); var c = culture == null ? null : CultureInfo.GetCultureInfo(culture); TranslatedInstanceLogic.SaveRecords(records, t, c); return(RedirectToAction("View", new { type = type, culture = culture, filter = filter, searchPressed = true })); }
public ActionResult SaveSync(string type, string culture) { Type t = TypeLogic.GetType(type); var c = CultureInfo.GetCultureInfo(culture); List <TranslationRecord> records = GetTranslationRecords(t); TranslatedInstanceLogic.SaveRecords(records, t, c); return(RedirectToAction("Index")); }
public static void ImportInstanceTranslations() { foreach (var lang in new[] { "de", "es" }) { TranslatedInstanceLogic.ImportExcelFile($"../../../InstanceTranslations/Category.{lang}.View.xlsx"); TranslatedInstanceLogic.ImportExcelFile($"../../../InstanceTranslations/Dashboard.{lang}.View.xlsx"); TranslatedInstanceLogic.ImportExcelFile($"../../../InstanceTranslations/Toolbar.{lang}.View.xlsx"); TranslatedInstanceLogic.ImportExcelFile($"../../../InstanceTranslations/ToolbarMenu.{lang}.View.xlsx"); TranslatedInstanceLogic.ImportExcelFile($"../../../InstanceTranslations/UserChart.{lang}.View.xlsx"); TranslatedInstanceLogic.ImportExcelFile($"../../../InstanceTranslations/UserQuery.{lang}.View.xlsx"); } }//ImportInstanceTranslations
public TranslatedInstanceViewTypeTS View(string type, string?culture, string filter) { Type t = TypeLogic.GetType(type); var c = culture == null ? null : CultureInfo.GetCultureInfo(culture); var master = TranslatedInstanceLogic.FromEntities(t); var support = TranslatedInstanceLogic.TranslationsForType(t, culture: c); var all = string.IsNullOrEmpty(filter); var cultures = TranslationLogic.CurrentCultureInfos(TranslatedInstanceLogic.DefaultCulture); Func <LocalizedInstanceKey, bool> filtered = li => all || li.RowId.ToString() == filter || li.Instance.Id.ToString() == filter || li.Route.PropertyString().Contains(filter, StringComparison.InvariantCultureIgnoreCase) || master.GetOrThrow(li).Contains(filter, StringComparison.InvariantCultureIgnoreCase) || cultures.Any(ci => (support.TryGetC(ci)?.TryGetC(li)?.TranslatedText ?? "").Contains(filter, StringComparison.InvariantCultureIgnoreCase)); var sd = new StringDistance(); var supportByInstance = (from kvpCult in support from kvpLocIns in kvpCult.Value where filtered(kvpLocIns.Key) let newText = master.GetOrThrow(kvpLocIns.Key) group(lockIns: kvpLocIns.Key, translatedInstance: kvpLocIns.Value, culture: kvpCult.Key, newText: newText) by kvpLocIns.Key.Instance into gInstance select KeyValuePair.Create(gInstance.Key, gInstance.AgGroupToDictionary(a => a.lockIns.RouteAndRowId(), gr => gr.ToDictionary(a => a.culture.Name, a => new TranslatedPairViewTS { OriginalText = a.translatedInstance.OriginalText, Diff = a.translatedInstance.OriginalText.Equals(a.newText) ? null : sd.DiffText(a.translatedInstance.OriginalText, a.newText), TranslatedText = a.translatedInstance.TranslatedText }) ))).ToDictionary(); return(new TranslatedInstanceViewTypeTS { TypeName = type, Routes = TranslatedInstanceLogic.TranslateableRoutes.GetOrThrow(t).ToDictionary(a => a.Key.PropertyString(), a => a.Value), MasterCulture = TranslatedInstanceLogic.DefaultCulture.Name, Instances = master.Where(kvp => filtered(kvp.Key)).GroupBy(a => a.Key.Instance).Select(gr => new TranslatedInstanceViewTS { Lite = gr.Key, Master = gr.ToDictionary( a => a.Key.RouteAndRowId(), a => a.Value ), Translations = supportByInstance.TryGetC(gr.Key) ?? new Dictionary <string, Dictionary <string, TranslatedPairViewTS> >() }).ToList() }); }
public static TypeInstancesChanges GetTypeInstanceChangesTranslated(ITranslator[] translators, Type type, CultureInfo targetCulture, out int totalInstances) { var cultures = TranslationLogic.CurrentCultureInfos(TranslatedInstanceLogic.DefaultCulture); cultures.Remove(targetCulture); var instances = TranslatedInstanceLogic.GetInstanceChanges(type, targetCulture, cultures); totalInstances = instances.Count; if (instances.Sum(a => a.TotalOriginalLength()) > MaxTotalSyncCharacters) { instances = instances.Chunk(a => a.TotalOriginalLength(), MaxTotalSyncCharacters).First().ToList(); } return(TranslateInstances(translators, type, targetCulture, instances)); }
public static bool IsTranslateInstanceCanditate(QueryToken token) { if (token.Type != typeof(string)) { return(false); } var pr = token.GetPropertyRoute(); if (pr == null) { return(false); } if (TranslatedInstanceLogic.RouteType(pr) == null) { return(false); } return(true); }
public static ToolbarResponse?GetCurrentToolbarResponse(ToolbarLocation location) { var curr = GetCurrent(location); if (curr == null) { return(null); } var responses = ToResponseList(TranslatedInstanceLogic.TranslatedMList(curr, c => c.Elements).ToList()); if (responses.Count == 0) { return(null); } return(new ToolbarResponse { type = ToolbarElementType.Header, content = curr.ToLite(), label = TranslatedInstanceLogic.TranslatedField(curr, a => a.Name), elements = responses, }); }
public ActionResult View(string type, string culture, bool searchPressed, string filter) { Type t = TypeLogic.GetType(type); ViewBag.Type = t; var c = culture == null ? null : CultureInfo.GetCultureInfo(culture); ViewBag.Culture = c; ViewBag.Filter = filter; if (!searchPressed) { return(base.View(TranslationClient.ViewPrefix.FormatWith("ViewInstance"))); } Dictionary <LocalizedInstanceKey, string> master = TranslatedInstanceLogic.FromEntities(t); ViewBag.Master = master; Dictionary <CultureInfo, Dictionary <LocalizedInstanceKey, TranslatedInstanceEntity> > support = TranslatedInstanceLogic.TranslationsForType(t, culture: c); return(base.View(TranslationClient.ViewPrefix.FormatWith("ViewInstance"), support)); }
public static void Start(SchemaBuilder sb) { if (sb.NotDefined(MethodInfo.GetCurrentMethod())) { sb.Include <ToolbarEntity>() .WithSave(ToolbarOperation.Save) .WithDelete(ToolbarOperation.Delete) .WithQuery(() => e => new { Entity = e, e.Id, e.Name, e.Owner, e.Priority }); sb.Include <ToolbarMenuEntity>() .WithSave(ToolbarMenuOperation.Save) .WithDelete(ToolbarMenuOperation.Delete) .WithQuery(() => e => new { Entity = e, e.Id, e.Name }); UserAssetsImporter.Register <ToolbarEntity>("Toolbar", ToolbarOperation.Save); UserAssetsImporter.Register <ToolbarMenuEntity>("ToolbarMenu", ToolbarMenuOperation.Save); RegisterDelete <UserQueryEntity>(sb); RegisterDelete <UserChartEntity>(sb); RegisterDelete <QueryEntity>(sb); RegisterDelete <DashboardEntity>(sb); RegisterDelete <ToolbarMenuEntity>(sb); RegisterDelete <WorkflowEntity>(sb); RegisterContentConfig <ToolbarMenuEntity>( lite => true, lite => TranslatedInstanceLogic.TranslatedField(ToolbarMenus.Value.GetOrCreate(lite), a => a.Name)); RegisterContentConfig <UserQueryEntity>( lite => { var uq = UserQueryLogic.UserQueries.Value.GetOrCreate(lite); return(InMemoryFilter(uq) && QueryLogic.Queries.QueryAllowed(uq.Query.ToQueryName(), true)); }, lite => TranslatedInstanceLogic.TranslatedField(UserQueryLogic.UserQueries.Value.GetOrCreate(lite), a => a.DisplayName)); RegisterContentConfig <UserChartEntity>( lite => { var uc = UserChartLogic.UserCharts.Value.GetOrCreate(lite); return(InMemoryFilter(uc) && QueryLogic.Queries.QueryAllowed(uc.Query.ToQueryName(), true)); }, lite => TranslatedInstanceLogic.TranslatedField(UserChartLogic.UserCharts.Value.GetOrCreate(lite), a => a.DisplayName)); RegisterContentConfig <QueryEntity>( lite => IsQueryAllowed(lite), lite => QueryUtils.GetNiceName(QueryLogic.QueryNames.GetOrThrow(lite.ToString() !))); RegisterContentConfig <DashboardEntity>( lite => InMemoryFilter(DashboardLogic.Dashboards.Value.GetOrCreate(lite)), lite => TranslatedInstanceLogic.TranslatedField(DashboardLogic.Dashboards.Value.GetOrCreate(lite), a => a.DisplayName)); RegisterContentConfig <PermissionSymbol>( lite => PermissionAuthLogic.IsAuthorized(SymbolLogic <PermissionSymbol> .ToSymbol(lite.ToString() !)), lite => SymbolLogic <PermissionSymbol> .ToSymbol(lite.ToString() !).NiceToString()); RegisterContentConfig <WorkflowEntity>( lite => { var wf = WorkflowLogic.WorkflowGraphLazy.Value.GetOrCreate(lite); return(InMemoryFilter(wf.Workflow) && wf.IsStartCurrentUser()); }, lite => TranslatedInstanceLogic.TranslatedField(WorkflowLogic.WorkflowGraphLazy.Value.GetOrCreate(lite).Workflow, a => a.Name)); // { typeof(QueryEntity), a => IsQueryAllowed((Lite<QueryEntity>)a) }, //{ typeof(PermissionSymbol), a => PermissionAuthLogic.IsAuthorized((PermissionSymbol)a.RetrieveAndRemember()) }, //{ typeof(UserQueryEntity), a => , //{ typeof(UserChartEntity), a => { var uc = UserChartLogic.UserCharts.Value.GetOrCreate((Lite<UserChartEntity>)a); return InMemoryFilter(uc) && QueryLogic.Queries.QueryAllowed(uc.Query.ToQueryName(), true); } }, //{ typeof(DashboardEntity), a => InMemoryFilter(DashboardLogic.Dashboards.Value.GetOrCreate((Lite<DashboardEntity>)a)) }, //{ typeof(WorkflowEntity), a => { var wf = WorkflowLogic.WorkflowGraphLazy.Value.GetOrCreate((Lite<WorkflowEntity>)a); return InMemoryFilter(wf.Workflow) && wf.IsStartCurrentUser(); } }, Toolbars = sb.GlobalLazy(() => Database.Query <ToolbarEntity>().ToDictionary(a => a.ToLite()), new InvalidateWith(typeof(ToolbarEntity))); ToolbarMenus = sb.GlobalLazy(() => Database.Query <ToolbarMenuEntity>().ToDictionary(a => a.ToLite()), new InvalidateWith(typeof(ToolbarMenuEntity))); } }
public override void Execute() { #line 8 "..\..\Translation\Views\ViewInstance.cshtml" CultureInfo culture = ViewBag.Culture; Type type = ViewBag.Type; ViewBag.Title = TranslationMessage.View0In1.NiceToString().FormatWith(type.NiceName(), culture == null ? TranslationMessage.AllLanguages.NiceToString() : culture.DisplayName); Dictionary <LocalizedInstanceKey, string> master = ViewBag.Master; var cultures = TranslationLogic.CurrentCultureInfos(TranslatedInstanceLogic.DefaultCulture); Func <CultureInfo, bool> editCulture = c => culture == null || culture.Name == c.Name; var filter = (string)ViewBag.Filter; var all = string.IsNullOrEmpty(filter); Func <LocalizedInstanceKey, bool> filtered = li => all || li.RowId.ToString() == filter || li.Instance.Id.ToString() == filter || li.Route.PropertyString().Contains(filter, StringComparison.InvariantCultureIgnoreCase) || master.GetOrThrow(li).Contains(filter, StringComparison.InvariantCultureIgnoreCase) || cultures.Any(ci => (Model.TryGetC(ci)?.TryGetC(li)?.TranslatedText ?? "").Contains(filter, StringComparison.InvariantCultureIgnoreCase)); #line default #line hidden WriteLiteral("\r\n"); #line 31 "..\..\Translation\Views\ViewInstance.cshtml" Write(Html.ScriptCss("~/Translation/Content/Translation.css")); #line default #line hidden WriteLiteral("\r\n\r\n\r\n\r\n<h2>"); #line 35 "..\..\Translation\Views\ViewInstance.cshtml" Write(ViewBag.Title); #line default #line hidden WriteLiteral("</h2>\r\n\r\n<div>\r\n"); #line 38 "..\..\Translation\Views\ViewInstance.cshtml" #line default #line hidden #line 38 "..\..\Translation\Views\ViewInstance.cshtml" using (Html.BeginForm("View", "TranslatedInstance", FormMethod.Get)) { #line default #line hidden #line 40 "..\..\Translation\Views\ViewInstance.cshtml" Write(Html.Hidden("type")); #line default #line hidden #line 40 "..\..\Translation\Views\ViewInstance.cshtml" #line default #line hidden #line 41 "..\..\Translation\Views\ViewInstance.cshtml" Write(Html.Hidden("culture")); #line default #line hidden #line 41 "..\..\Translation\Views\ViewInstance.cshtml" #line default #line hidden #line 42 "..\..\Translation\Views\ViewInstance.cshtml" Write(Html.TextBox("filter", filter)); #line default #line hidden #line 42 "..\..\Translation\Views\ViewInstance.cshtml" ; #line default #line hidden WriteLiteral(" <input"); WriteLiteral(" type=\"hidden\""); WriteLiteral(" name=\"searchPressed\""); WriteLiteral(" value=\"true\""); WriteLiteral(" />\r\n"); WriteLiteral(" <input"); WriteLiteral(" type=\"submit\""); WriteAttribute("value", Tuple.Create(" value=\"", 1786), Tuple.Create("\"", 1835) #line 45 "..\..\Translation\Views\ViewInstance.cshtml" , Tuple.Create(Tuple.Create("", 1794), Tuple.Create <System.Object, System.Int32>(TranslationMessage.Search.NiceToString() #line default #line hidden , 1794), false) ); WriteLiteral(" />\r\n"); #line 46 "..\..\Translation\Views\ViewInstance.cshtml" } #line default #line hidden WriteLiteral("</div>\r\n\r\n"); #line 49 "..\..\Translation\Views\ViewInstance.cshtml" if (Model == null) { #line default #line hidden WriteLiteral(" <em>"); #line 51 "..\..\Translation\Views\ViewInstance.cshtml" Write(TranslationMessage.PressSearchForResults.NiceToString()); #line default #line hidden WriteLiteral("</em>\r\n"); #line 52 "..\..\Translation\Views\ViewInstance.cshtml" } else if (Model.IsEmpty()) { #line default #line hidden WriteLiteral(" <strong>"); #line 55 "..\..\Translation\Views\ViewInstance.cshtml" Write(TranslationMessage.NoResultsFound.NiceToString()); #line default #line hidden WriteLiteral("</strong>\r\n"); #line 56 "..\..\Translation\Views\ViewInstance.cshtml" } else { using (Html.BeginForm((TranslatedInstanceController c) => c.SaveView(Signum.Engine.Basics.TypeLogic.GetCleanName(type), culture == null ? null : culture.Name, filter))) { #line default #line hidden WriteLiteral(" <table"); WriteLiteral(" id=\"results\""); WriteLiteral(" style=\"width: 100%; margin: 0px\""); WriteLiteral(" class=\"st\""); WriteLiteral(">\r\n"); #line 62 "..\..\Translation\Views\ViewInstance.cshtml" #line default #line hidden #line 62 "..\..\Translation\Views\ViewInstance.cshtml" foreach (var instance in master.Keys.Where(li => master.GetOrThrow(li).HasText()).Where(filtered).GroupBy(a => a.Instance).OrderBy(a => a.Key.Id)) { #line default #line hidden WriteLiteral(" <thead>\r\n <tr>\r\n <th"); WriteLiteral(" class=\"leftCell\""); WriteLiteral(">"); #line 66 "..\..\Translation\Views\ViewInstance.cshtml" Write(TranslationMessage.Instance.NiceToString()); #line default #line hidden WriteLiteral("</th>\r\n <th"); WriteLiteral(" class=\"titleCell\""); WriteLiteral(">"); #line 67 "..\..\Translation\Views\ViewInstance.cshtml" Write(Html.Href(Navigator.NavigateRoute(instance.Key), instance.Key.ToString())); #line default #line hidden WriteLiteral("</th>\r\n </tr>\r\n </thead>\r\n"); #line 70 "..\..\Translation\Views\ViewInstance.cshtml" foreach (LocalizedInstanceKey key in instance.OrderBy(a => a.Route.ToString())) { var propertyString = key.Route.PropertyString().Replace("/", "[" + key.RowId + "]."); #line default #line hidden WriteLiteral(" <tr>\r\n <th"); WriteLiteral(" class=\"leftCell\""); WriteLiteral(">\r\n"); WriteLiteral(" "); #line 76 "..\..\Translation\Views\ViewInstance.cshtml" Write(TranslationMessage.Property.NiceToString()); #line default #line hidden WriteLiteral("\r\n </th>\r\n <th>"); #line 78 "..\..\Translation\Views\ViewInstance.cshtml" Write(propertyString); #line default #line hidden WriteLiteral("</th>\r\n </tr>\r\n"); #line 80 "..\..\Translation\Views\ViewInstance.cshtml" foreach (var ci in cultures) { var formName = ci.Name + "#" + key.Instance.Key() + "#" + propertyString; if (ci.Name == TranslatedInstanceLogic.DefaultCulture.Name) { #line default #line hidden WriteLiteral(" <tr>\r\n <td"); WriteLiteral(" class=\"leftCell\""); WriteLiteral("><em>"); #line 88 "..\..\Translation\Views\ViewInstance.cshtml" Write(TranslatedInstanceLogic.DefaultCulture); #line default #line hidden WriteLiteral("</em></td>\r\n <td"); WriteLiteral(" class=\"monospaceCell\""); WriteLiteral(">\r\n"); #line 90 "..\..\Translation\Views\ViewInstance.cshtml" #line default #line hidden #line 90 "..\..\Translation\Views\ViewInstance.cshtml" if (TranslatedInstanceLogic.RouteType(key.Route).Value == TranslateableRouteType.Html) { #line default #line hidden WriteLiteral(" <pre>"); #line 92 "..\..\Translation\Views\ViewInstance.cshtml" Write(master[key]); #line default #line hidden WriteLiteral("</pre>\r\n"); #line 93 "..\..\Translation\Views\ViewInstance.cshtml" } else { #line default #line hidden #line 96 "..\..\Translation\Views\ViewInstance.cshtml" Write(master[key]); #line default #line hidden #line 96 "..\..\Translation\Views\ViewInstance.cshtml" } #line default #line hidden WriteLiteral(" "); #line 98 "..\..\Translation\Views\ViewInstance.cshtml" Write(Html.TextArea(formName, master[key], new { style = "display:none" })); #line default #line hidden WriteLiteral("\r\n </td>\r\n </tr>\r\n"); #line 101 "..\..\Translation\Views\ViewInstance.cshtml" } else { TranslatedInstanceEntity trans = Model.TryGetC(ci)?.TryGetC(key); if (trans != null && editCulture(ci)) { #line default #line hidden WriteLiteral(" <tr>\r\n <td"); WriteLiteral(" class=\"leftCell\""); WriteLiteral(">"); #line 109 "..\..\Translation\Views\ViewInstance.cshtml" Write(ci.Name); #line default #line hidden WriteLiteral(" Diff</td>\r\n <td"); WriteLiteral(" class=\"monospaceCell\""); WriteLiteral(">\r\n <pre>"); #line 111 "..\..\Translation\Views\ViewInstance.cshtml" Write(Signum.Web.Translation.TranslationClient.Diff(trans.OriginalText, trans.TranslatedText)); #line default #line hidden WriteLiteral("</pre>\r\n </td>\r\n " + " </tr>\r\n"); #line 114 "..\..\Translation\Views\ViewInstance.cshtml" } if (trans != null || editCulture(ci)) { #line default #line hidden WriteLiteral(" <tr>\r\n <td"); WriteLiteral(" class=\"leftCell\""); WriteLiteral(">"); #line 121 "..\..\Translation\Views\ViewInstance.cshtml" Write(ci.Name); #line default #line hidden WriteLiteral("</td>\r\n <td"); WriteLiteral(" class=\"monospaceCell\""); WriteLiteral(">\r\n"); #line 123 "..\..\Translation\Views\ViewInstance.cshtml" #line default #line hidden #line 123 "..\..\Translation\Views\ViewInstance.cshtml" if (editCulture(ci)) { #line default #line hidden #line 125 "..\..\Translation\Views\ViewInstance.cshtml" Write(Html.TextArea(formName, trans?.TranslatedText, new { style = "width:90%;" })); #line default #line hidden #line 125 "..\..\Translation\Views\ViewInstance.cshtml" } else if (TranslatedInstanceLogic.RouteType(key.Route).Value == TranslateableRouteType.Html) { #line default #line hidden WriteLiteral(" <pre>"); #line 129 "..\..\Translation\Views\ViewInstance.cshtml" Write(trans.TranslatedText); #line default #line hidden WriteLiteral("</pre>\r\n"); #line 130 "..\..\Translation\Views\ViewInstance.cshtml" } else { #line default #line hidden #line 133 "..\..\Translation\Views\ViewInstance.cshtml" Write(trans.TranslatedText); #line default #line hidden #line 133 "..\..\Translation\Views\ViewInstance.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n </tr>\r" + "\n"); #line 137 "..\..\Translation\Views\ViewInstance.cshtml" } } } } } #line default #line hidden WriteLiteral(" </table>\r\n"); WriteLiteral(" <input"); WriteLiteral(" type=\"submit\""); WriteAttribute("value", Tuple.Create(" value=\"", 6410), Tuple.Create("\"", 6457) #line 144 "..\..\Translation\Views\ViewInstance.cshtml" , Tuple.Create(Tuple.Create("", 6418), Tuple.Create <System.Object, System.Int32>(TranslationMessage.Save.NiceToString() #line default #line hidden , 6418), false) ); WriteLiteral(" />\r\n"); #line 145 "..\..\Translation\Views\ViewInstance.cshtml" } } #line default #line hidden WriteLiteral("\r\n\r\n<script>\r\n $(function () {\r\n"); WriteLiteral(" "); #line 151 "..\..\Translation\Views\ViewInstance.cshtml" Write(Signum.Web.Translation.TranslationClient.Module["fixTextAreas"]()); #line default #line hidden WriteLiteral("\r\n });\r\n</script>\r\n"); }
public static void Start(string connectionString) { string logDatabase = Connector.TryExtractDatabaseNameWithPostfix(ref connectionString, "_Log"); SchemaBuilder sb = new SchemaBuilder(); sb.Schema.Version = typeof(Starter).Assembly.GetName().Version; sb.Schema.ForceCultureInfo = CultureInfo.GetCultureInfo("en-US"); MixinDeclarations.Register <OperationLogEntity, DiffLogMixin>(); MixinDeclarations.Register <UserEntity, UserEmployeeMixin>(); OverrideAttributes(sb); SetupDisconnectedStrategies(sb); DynamicQueryManager dqm = new DynamicQueryManager(); Connector.Default = new SqlConnector(connectionString, sb.Schema, dqm, SqlServerVersion.SqlServer2012); CacheLogic.Start(sb); TypeLogic.Start(sb, dqm); OperationLogic.Start(sb, dqm); MigrationLogic.Start(sb, dqm); CultureInfoLogic.Start(sb, dqm); EmbeddedFilePathLogic.Start(sb, dqm); SmtpConfigurationLogic.Start(sb, dqm); EmailLogic.Start(sb, dqm, () => Configuration.Value.Email, et => Configuration.Value.SmtpConfiguration); AuthLogic.Start(sb, dqm, "System", null); AuthLogic.StartAllModules(sb, dqm); ResetPasswordRequestLogic.Start(sb, dqm); UserTicketLogic.Start(sb, dqm); SessionLogLogic.Start(sb, dqm); ProcessLogic.Start(sb, dqm); PackageLogic.Start(sb, dqm, packages: true, packageOperations: true); MapLogic.Start(sb, dqm); SchedulerLogic.Start(sb, dqm); QueryLogic.Start(sb); UserQueryLogic.Start(sb, dqm); UserQueryLogic.RegisterUserTypeCondition(sb, SouthwindGroup.UserEntities); UserQueryLogic.RegisterRoleTypeCondition(sb, SouthwindGroup.RoleEntities); ChartLogic.Start(sb, dqm); UserChartLogic.RegisterUserTypeCondition(sb, SouthwindGroup.UserEntities); UserChartLogic.RegisterRoleTypeCondition(sb, SouthwindGroup.RoleEntities); DashboardLogic.Start(sb, dqm); DashboardLogic.RegisterUserTypeCondition(sb, SouthwindGroup.UserEntities); DashboardLogic.RegisterRoleTypeCondition(sb, SouthwindGroup.RoleEntities); ViewLogLogic.Start(sb, dqm, new HashSet <Type> { typeof(UserQueryEntity), typeof(UserChartEntity), typeof(DashboardEntity) }); DiffLogLogic.Start(sb, dqm); ExceptionLogic.Start(sb, dqm); SMSLogic.Start(sb, dqm, null, () => Configuration.Value.Sms); SMSLogic.RegisterPhoneNumberProvider <PersonEntity>(p => p.Phone, p => null); SMSLogic.RegisterDataObjectProvider((PersonEntity p) => new { p.FirstName, p.LastName, p.Title, p.DateOfBirth }); SMSLogic.RegisterPhoneNumberProvider <CompanyEntity>(p => p.Phone, p => null); NoteLogic.Start(sb, dqm, typeof(UserEntity), /*Note*/ typeof(OrderEntity)); AlertLogic.Start(sb, dqm, typeof(UserEntity), /*Alert*/ typeof(OrderEntity)); FileLogic.Start(sb, dqm); TranslationLogic.Start(sb, dqm); TranslatedInstanceLogic.Start(sb, dqm, () => CultureInfo.GetCultureInfo("en")); HelpLogic.Start(sb, dqm); WordTemplateLogic.Start(sb, dqm); EmployeeLogic.Start(sb, dqm); ProductLogic.Start(sb, dqm); CustomerLogic.Start(sb, dqm); OrderLogic.Start(sb, dqm); ShipperLogic.Start(sb, dqm); StartSouthwindConfiguration(sb, dqm); TypeConditionLogic.Register <OrderEntity>(SouthwindGroup.UserEntities, o => o.Employee.RefersTo(EmployeeEntity.Current)); TypeConditionLogic.Register <EmployeeEntity>(SouthwindGroup.UserEntities, e => e == EmployeeEntity.Current); TypeConditionLogic.Register <OrderEntity>(SouthwindGroup.CurrentCustomer, o => o.Customer == CustomerEntity.Current); TypeConditionLogic.Register <PersonEntity>(SouthwindGroup.CurrentCustomer, o => o == CustomerEntity.Current); TypeConditionLogic.Register <CompanyEntity>(SouthwindGroup.CurrentCustomer, o => o == CustomerEntity.Current); DisconnectedLogic.Start(sb, dqm); DisconnectedLogic.BackupFolder = @"D:\SouthwindTemp\Backups"; DisconnectedLogic.BackupNetworkFolder = @"D:\SouthwindTemp\Backups"; DisconnectedLogic.DatabaseFolder = @"D:\SouthwindTemp\Database"; ProfilerLogic.Start(sb, dqm, timeTracker: true, heavyProfiler: true, overrideSessionTimeout: true); SetupCache(sb); SetSchemaNames(Schema.Current); if (logDatabase.HasText()) { SetLogDatabase(sb.Schema, new DatabaseName(null, logDatabase)); } Schema.Current.OnSchemaCompleted(); }
public static void ImportSpanishInstanceTranslations() { TranslatedInstanceLogic.ImportExcelFile("Category.es.View.xlsx"); }
public List <TranslatedTypeSummaryTS> Status() { return(TranslatedInstanceLogic.TranslationInstancesStatus().Select(a => new TranslatedTypeSummaryTS(a)).ToList()); }
public static void Start(string connectionString) { using (HeavyProfiler.Log("Start")) using (var initial = HeavyProfiler.Log("Initial")) { StartParameters.IgnoredDatabaseMismatches = new List <Exception>(); StartParameters.IgnoredCodeErrors = new List <Exception>(); string?logDatabase = Connector.TryExtractDatabaseNameWithPostfix(ref connectionString, "_Log"); SchemaBuilder sb = new CustomSchemaBuilder { LogDatabaseName = logDatabase, Tracer = initial }; sb.Schema.Version = typeof(Starter).Assembly.GetName().Version; sb.Schema.ForceCultureInfo = CultureInfo.GetCultureInfo("en-US"); MixinDeclarations.Register <OperationLogEntity, DiffLogMixin>(); MixinDeclarations.Register <UserEntity, UserEmployeeMixin>(); OverrideAttributes(sb); var detector = SqlServerVersionDetector.Detect(connectionString); Connector.Default = new SqlConnector(connectionString, sb.Schema, detector !.Value); CacheLogic.Start(sb); DynamicLogicStarter.Start(sb); DynamicLogic.CompileDynamicCode(); DynamicLogic.RegisterMixins(); DynamicLogic.BeforeSchema(sb); TypeLogic.Start(sb); OperationLogic.Start(sb); ExceptionLogic.Start(sb); MigrationLogic.Start(sb); CultureInfoLogic.Start(sb); FilePathEmbeddedLogic.Start(sb); SmtpConfigurationLogic.Start(sb); EmailLogic.Start(sb, () => Configuration.Value.Email, (et, target) => Configuration.Value.SmtpConfiguration); AuthLogic.Start(sb, "System", null); AuthLogic.StartAllModules(sb); ResetPasswordRequestLogic.Start(sb); UserTicketLogic.Start(sb); SessionLogLogic.Start(sb); ProcessLogic.Start(sb); PackageLogic.Start(sb, packages: true, packageOperations: true); SchedulerLogic.Start(sb); QueryLogic.Start(sb); UserQueryLogic.Start(sb); UserQueryLogic.RegisterUserTypeCondition(sb, SouthwindGroup.UserEntities); UserQueryLogic.RegisterRoleTypeCondition(sb, SouthwindGroup.RoleEntities); ChartLogic.Start(sb); UserChartLogic.RegisterUserTypeCondition(sb, SouthwindGroup.UserEntities); UserChartLogic.RegisterRoleTypeCondition(sb, SouthwindGroup.RoleEntities); DashboardLogic.Start(sb); DashboardLogic.RegisterUserTypeCondition(sb, SouthwindGroup.UserEntities); DashboardLogic.RegisterRoleTypeCondition(sb, SouthwindGroup.RoleEntities); ViewLogLogic.Start(sb, new HashSet <Type> { typeof(UserQueryEntity), typeof(UserChartEntity), typeof(DashboardEntity) }); DiffLogLogic.Start(sb, registerAll: true); ExcelLogic.Start(sb, excelReport: true); ToolbarLogic.Start(sb); SMSLogic.Start(sb, null, () => Configuration.Value.Sms); SMSLogic.RegisterPhoneNumberProvider <PersonEntity>(p => p.Phone, p => null); SMSLogic.RegisterDataObjectProvider((PersonEntity p) => new { p.FirstName, p.LastName, p.Title, p.DateOfBirth }); SMSLogic.RegisterPhoneNumberProvider <CompanyEntity>(p => p.Phone, p => null); NoteLogic.Start(sb, typeof(UserEntity), /*Note*/ typeof(OrderEntity)); AlertLogic.Start(sb, typeof(UserEntity), /*Alert*/ typeof(OrderEntity)); FileLogic.Start(sb); TranslationLogic.Start(sb, countLocalizationHits: false); TranslatedInstanceLogic.Start(sb, () => CultureInfo.GetCultureInfo("en")); HelpLogic.Start(sb); WordTemplateLogic.Start(sb); MapLogic.Start(sb); PredictorLogic.Start(sb, () => new FileTypeAlgorithm(f => new PrefixPair(Starter.Configuration.Value.Folders.PredictorModelFolder))); PredictorLogic.RegisterAlgorithm(CNTKPredictorAlgorithm.NeuralNetwork, new CNTKNeuralNetworkPredictorAlgorithm()); PredictorLogic.RegisterPublication(ProductPredictorPublication.MonthlySales, new PublicationSettings(typeof(OrderEntity))); RestLogLogic.Start(sb); RestApiKeyLogic.Start(sb); WorkflowLogicStarter.Start(sb, () => Starter.Configuration.Value.Workflow); EmployeeLogic.Start(sb); ProductLogic.Start(sb); CustomerLogic.Start(sb); OrderLogic.Start(sb); ShipperLogic.Start(sb); StartSouthwindConfiguration(sb); TypeConditionLogic.Register <OrderEntity>(SouthwindGroup.UserEntities, o => o.Employee == EmployeeEntity.Current); TypeConditionLogic.Register <EmployeeEntity>(SouthwindGroup.UserEntities, e => EmployeeEntity.Current.Is(e)); TypeConditionLogic.Register <OrderEntity>(SouthwindGroup.CurrentCustomer, o => o.Customer == CustomerEntity.Current); TypeConditionLogic.Register <PersonEntity>(SouthwindGroup.CurrentCustomer, o => o == CustomerEntity.Current); TypeConditionLogic.Register <CompanyEntity>(SouthwindGroup.CurrentCustomer, o => o == CustomerEntity.Current); ProfilerLogic.Start(sb, timeTracker: true, heavyProfiler: true, overrideSessionTimeout: true); DynamicLogic.StartDynamicModules(sb); DynamicLogic.RegisterExceptionIfAny(); SetupCache(sb); Schema.Current.OnSchemaCompleted(); } }
public static void Start(string connectionString, bool isPostgres, bool includeDynamic = true, bool detectSqlVersion = true) { using (HeavyProfiler.Log("Start")) using (var initial = HeavyProfiler.Log("Initial")) { StartParameters.IgnoredDatabaseMismatches = new List <Exception>(); StartParameters.IgnoredCodeErrors = new List <Exception>(); string?logDatabase = Connector.TryExtractDatabaseNameWithPostfix(ref connectionString, "_Log"); SchemaBuilder sb = new CustomSchemaBuilder { LogDatabaseName = logDatabase, Tracer = initial }; sb.Schema.Version = typeof(Starter).Assembly.GetName().Version !; sb.Schema.ForceCultureInfo = CultureInfo.GetCultureInfo("en-US"); MixinDeclarations.Register <OperationLogEntity, DiffLogMixin>(); MixinDeclarations.Register <UserEntity, UserEmployeeMixin>(); MixinDeclarations.Register <OrderDetailEmbedded, OrderDetailMixin>(); MixinDeclarations.Register <BigStringEmbedded, BigStringMixin>(); ConfigureBigString(sb); OverrideAttributes(sb); if (!isPostgres) { var sqlVersion = detectSqlVersion ? SqlServerVersionDetector.Detect(connectionString) : SqlServerVersion.AzureSQL; Connector.Default = new SqlServerConnector(connectionString, sb.Schema, sqlVersion !.Value); } else { var postgreeVersion = detectSqlVersion ? PostgresVersionDetector.Detect(connectionString) : null; Connector.Default = new PostgreSqlConnector(connectionString, sb.Schema, postgreeVersion); } CacheLogic.Start(sb, cacheInvalidator: sb.Settings.IsPostgres ? new PostgresCacheInvalidation() : null); DynamicLogicStarter.Start(sb); if (includeDynamic)//Dynamic { DynamicLogic.CompileDynamicCode(); DynamicLogic.RegisterMixins(); DynamicLogic.BeforeSchema(sb); }//Dynamic // Framework modules TypeLogic.Start(sb); OperationLogic.Start(sb); ExceptionLogic.Start(sb); QueryLogic.Start(sb); // Extensions modules MigrationLogic.Start(sb); CultureInfoLogic.Start(sb); FilePathEmbeddedLogic.Start(sb); BigStringLogic.Start(sb); EmailLogic.Start(sb, () => Configuration.Value.Email, (template, target, message) => Configuration.Value.EmailSender); AuthLogic.Start(sb, "System", "Anonymous"); /* null); anonymous*/ AuthLogic.StartAllModules(sb); ResetPasswordRequestLogic.Start(sb); UserTicketLogic.Start(sb); SessionLogLogic.Start(sb); WebAuthnLogic.Start(sb, () => Configuration.Value.WebAuthn); ProcessLogic.Start(sb); PackageLogic.Start(sb, packages: true, packageOperations: true); SchedulerLogic.Start(sb); OmniboxLogic.Start(sb); UserQueryLogic.Start(sb); UserQueryLogic.RegisterUserTypeCondition(sb, RG2Group.UserEntities); UserQueryLogic.RegisterRoleTypeCondition(sb, RG2Group.RoleEntities); UserQueryLogic.RegisterTranslatableRoutes(); ChartLogic.Start(sb, googleMapsChartScripts: false /*requires Google Maps API key in ChartClient */); UserChartLogic.RegisterUserTypeCondition(sb, RG2Group.UserEntities); UserChartLogic.RegisterRoleTypeCondition(sb, RG2Group.RoleEntities); UserChartLogic.RegisterTranslatableRoutes(); DashboardLogic.Start(sb); DashboardLogic.RegisterUserTypeCondition(sb, RG2Group.UserEntities); DashboardLogic.RegisterRoleTypeCondition(sb, RG2Group.RoleEntities); DashboardLogic.RegisterTranslatableRoutes(); ViewLogLogic.Start(sb, new HashSet <Type> { typeof(UserQueryEntity), typeof(UserChartEntity), typeof(DashboardEntity) }); DiffLogLogic.Start(sb, registerAll: true); ExcelLogic.Start(sb, excelReport: true); ToolbarLogic.Start(sb); ToolbarLogic.RegisterTranslatableRoutes(); FileLogic.Start(sb); TranslationLogic.Start(sb, countLocalizationHits: false); TranslatedInstanceLogic.Start(sb, () => CultureInfo.GetCultureInfo("en")); HelpLogic.Start(sb); WordTemplateLogic.Start(sb); MapLogic.Start(sb); RestLogLogic.Start(sb); RestApiKeyLogic.Start(sb); WorkflowLogicStarter.Start(sb, () => Starter.Configuration.Value.Workflow); ProfilerLogic.Start(sb, timeTracker: true, heavyProfiler: true, overrideSessionTimeout: true); // RG2 modules EmployeeLogic.Start(sb); ProductLogic.Start(sb); CustomerLogic.Start(sb); OrderLogic.Start(sb); ShipperLogic.Start(sb); ItemLogic.Start(sb); ItemCategoryLogic.Start(sb); StartRG2Configuration(sb); TypeConditionLogic.Register <OrderEntity>(RG2Group.UserEntities, o => o.Employee == EmployeeEntity.Current); TypeConditionLogic.Register <EmployeeEntity>(RG2Group.UserEntities, e => EmployeeEntity.Current.Is(e)); TypeConditionLogic.Register <OrderEntity>(RG2Group.CurrentCustomer, o => o.Customer == CustomerEntity.Current); TypeConditionLogic.Register <PersonEntity>(RG2Group.CurrentCustomer, o => o == CustomerEntity.Current); TypeConditionLogic.Register <CompanyEntity>(RG2Group.CurrentCustomer, o => o == CustomerEntity.Current); if (includeDynamic)//2 { DynamicLogic.StartDynamicModules(sb); }//2 SetupCache(sb); Schema.Current.OnSchemaCompleted(); if (includeDynamic)//3 { DynamicLogic.RegisterExceptionIfAny(); }//3 } }
public static void RegisterTranslatableRoutes() { TranslatedInstanceLogic.AddRoute((UserQueryEntity uq) => uq.DisplayName); TranslatedInstanceLogic.AddRoute((UserQueryEntity uq) => uq.Columns[0].DisplayName); TranslatedInstanceLogic.AddRoute((UserQueryEntity uq) => uq.Filters[0].Pinned !.Label); }