public static void FullText( this Comments self, Context context, Column column, StringBuilder fullText) { if (self != null) { switch (column?.FullTextType) { case Column.FullTextTypes.DisplayName: case Column.FullTextTypes.Value: case Column.FullTextTypes.ValueAndDisplayName: self.ForEach(o => fullText .Append(" ") .Append(SiteInfo.UserName( context: context, userId: o.Creator)) .Append(" ") .Append(o.Body)); break; } } }
private static string Label( Context context, Column groupBy, string selectedValue, Dictionary <string, string> linkedLabelHash) { if (groupBy.UserColumn) { return(SiteInfo.UserName( context: context, userId: selectedValue.ToInt())); } else if (groupBy.HasChoices()) { var label = linkedLabelHash != null ? linkedLabelHash?.Get(selectedValue) : groupBy.Choice(selectedValue).TextMini; return(label.IsNullOrEmpty() ? NumericZero(groupBy, selectedValue) ? Displays.NotSet(context: context) : StringEmpty(groupBy, selectedValue) ? Displays.NotSet(context: context) : "? " + selectedValue : label); } else { return(selectedValue); } }
private static string Text( Context context, SiteSettings ss, NavigationMenu menu) { switch (menu.Name) { case null: case "": return(null); case "{UserName}": return(SiteInfo.UserName( context: context, userId: context.UserId)); case "{SiteSettingsDisplayName}": return(SiteSettingsDisplayName( context: context, ss: ss)); default: return(Displays.Get( context: context, id: menu.Name)); } }
private string GetDisplayValue( SiteSettings ss, Column column, DataRow dataRow, string path) { switch (column.TypeName.CsTypeSummary()) { case Types.CsNumeric: return(column.HasChoices() ? column.UserColumn ? SiteInfo.UserName(dataRow.Int(path)) : column.Choice(dataRow.Long(path).ToString()).Text : column.Display(dataRow.Decimal(path), unit: true)); case Types.CsDateTime: switch (path) { case "CompletionTime": return(column.DisplayControl(new CompletionTime( ss, dataRow, new ColumnNameInfo(path)).DisplayValue)); default: return(column.DisplayControl( dataRow.DateTime(path).ToLocal())); } case Types.CsString: return(column.HasChoices() ? column.Choice(dataRow.String(path)).Text : dataRow.String(path)); default: return(dataRow.String(path)); } }
public string ToExport(Column column) { return(this.Select(o => new Time(o.CreatedTime).ToViewText() + " " + SiteInfo.UserName(o.Creator) + "\n" + o.Body).Join("\n\n")); }
public void ReplaceRelatedUsers(Context context, List <int> users) { Address = Address.Replace( "[RelatedUsers]", Repository.ExecuteTable( context: context, statements: Rds.SelectMailAddresses( column: Rds.MailAddressesColumn() .OwnerId() .MailAddress(), where : Rds.MailAddressesWhere() .OwnerId_In(users .Distinct() .Where(userId => SiteInfo.User( context: context, userId: userId).Id != SiteInfo.AnonymousId) .Select(userId => userId.ToLong())) .OwnerType("Users"))) .AsEnumerable() .GroupBy(o => o["OwnerId"]) .Select(o => MailAddressUtilities.Get( SiteInfo.UserName( context: context, userId: o.First().Int("OwnerId")), o.First()["MailAddress"].ToString())) .Join(";")); }
private string GetDisplayValue(Column column, Dictionary <string, string> data) { switch (column.TypeName.CsTypeSummary()) { case Types.CsNumeric: return(column.HasChoices() ? column.UserColumn ? SiteInfo.UserName(data.Get(column.ColumnName).ToInt()) : column.Choice(data.Get(column.ColumnName)).Text : column.Display(data.Get(column.ColumnName).ToDecimal(), unit: true)); case Types.CsDateTime: switch (column.ColumnName) { case "CompletionTime": return(column.DisplayControl( data.Get(column.ColumnName).ToDateTime().ToLocal().AddDays(-1))); default: return(column.DisplayControl( data.Get(column.ColumnName).ToDateTime().ToLocal())); } case Types.CsString: return(column.HasChoices() ? column.Choice(data.Get(column.ColumnName)).Text : data.Get(column.ColumnName)); default: return(data.Get(column.ColumnName)); } }
public string ToExport(Column column, ExportColumn exportColumn = null) { return(this.Select(o => o.CreatedTime.ToLocal().ToViewText() + " " + SiteInfo.UserName(o.Creator) + "\n" + o.Body).Join("\n\n")); }
private static HtmlBuilder DropDown( this HtmlBuilder hb, Context context, SiteSettings ss, Column column, View view, Dictionary <string, ControlData> optionCollection, string idPrefix = "ViewFilters__", string action = null, bool controlOnly = false) { var selectedValue = view.ColumnFilter(column.ColumnName); if (column.UseSearch == true) { selectedValue?.Deserialize <List <string> >()?.ForEach(value => { if (column.UserColumn) { var userId = value.ToInt(); if (userId > 0 && userId != User.UserTypes.Anonymous.ToInt()) { optionCollection.AddIfNotConainsKey( value, new ControlData(SiteInfo.UserName( context: context, userId: userId))); } } else { HtmlFields.EditChoices( context: context, ss: ss, column: column, value: value) .ForEach(data => optionCollection.AddIfNotConainsKey(data.Key, data.Value)); } }); } return(hb.FieldDropDown( context: context, controlId: idPrefix + column.ColumnName, fieldCss: "field-auto-thin", controlCss: " auto-postback" + (column.UseSearch == true ? " search" : string.Empty), labelText: Displays.Get( context: context, id: column.GridLabelText), labelTitle: ss.LabelTitle(column), controlOnly: controlOnly, action: action, optionCollection: optionCollection, selectedValue: selectedValue, multiple: true, addSelectedValue: false, method: "post", column: column)); }
public static HtmlBuilder Td( this HtmlBuilder hb, Context context, Column column, string value) { return(column.HasChoices() ? hb.Td(action: () => { if (column.UserColumn && column.UseSearch == true && !value.IsNullOrEmpty()) { column.ChoiceHash.AddIfNotConainsKey( value, new Choice(SiteInfo.UserName( context: context, userId: value.ToInt()))); } var choice = column.Choice( value, nullCase: value.IsNullOrEmpty() ? null : "? " + value); hb.P( attributes: new HtmlAttributes() .Class(choice.CssClass) .Style(choice.Style), action: () => hb .Text(choice.TextMini)); }) : column.ControlType == "MarkDown" ? hb.Td(action: () => hb .Div(css: "grid-title-body", action: () => hb .P(css: "body markup", action: () => hb .Text(text: value)))) : hb.Td(action: () => hb .Text(text: value))); }
private static Dictionary <string, ControlData> OptionCollection( Dictionary <string, ControlData> optionCollection = null, string selectedValue = null, bool multiple = false, bool addSelectedValue = true, bool insertBlank = false, Column column = null) { if (insertBlank) { optionCollection = InsertBlank(optionCollection); } if (selectedValue == null || selectedValue == string.Empty || optionCollection?.ContainsKey(selectedValue) == true || selectedValue == "0" || multiple || !addSelectedValue) { return(optionCollection); } else { var userId = selectedValue.ToInt(); optionCollection?.Add( selectedValue, column != null && column.UserColumn ? new ControlData(SiteInfo.UserName(userId)) : new ControlData("? " + selectedValue)); return(optionCollection); } }
public GanttElement( string groupBy, object sortBy, long id, string title, decimal workValue, DateTime startTime, DateTime completionTime, decimal progressRate, int status, int owner, int updatorId, DateTime createdTime, DateTime updatedTime, Column statusColumn, Column completionTimeColumn, Column workValueColumn, Column progressRateColumn, bool showProgressRate, bool?summary = null) { GroupBy = groupBy; SortBy = sortBy; Id = id; var userNameText = SiteInfo.UserName(owner, notSet: false); var statusText = statusColumn.Choice(status.ToString()).Text; Title = showProgressRate ? "{0} ({1}{2} * {3}{4}){5}{6}".Params( title, workValueColumn.Display(workValue), workValueColumn.Unit, progressRateColumn.Display(progressRate), progressRateColumn.Unit, !userNameText.IsNullOrEmpty() ? " " + SiteInfo.UserName(owner, notSet: false) : string.Empty, !statusText.IsNullOrEmpty() ? " : " + statusColumn.Choice(status.ToString()).Text : string.Empty) : "{0}{1}{2}".Params( title, !userNameText.IsNullOrEmpty() ? " (" + SiteInfo.UserName(owner, notSet: false) + ")" : string.Empty, !statusText.IsNullOrEmpty() ? " : " + statusColumn.Choice(status.ToString()).Text : string.Empty); StartTime = startTime.InRange() ? startTime.ToLocal(Displays.YmdFormat()) : createdTime.ToLocal(Displays.YmdFormat()); CompletionTime = completionTime.ToLocal(Displays.YmdFormat()); DisplayCompletionTime = completionTime .AddDifferenceOfDates(completionTimeColumn.EditorFormat, minus: true) .ToLocal(Displays.YmdFormat()); ProgressRate = progressRate; Completed = status >= Parameters.General.CompletionCode; GroupSummary = summary; }
public static HtmlBuilder HtmlUser( this HtmlBuilder hb, Context context, int id) { return(hb.P(css: "user", action: () => hb .Icon(iconCss: "ui-icon-person", text: SiteInfo.UserName( context: context, userId: id)))); }
public static void SearchIndexes( this Comments self, Dictionary <string, int> searchIndexHash, int searchPriority) { SearchIndexes( searchIndexHash, self.Select(o => SiteInfo.UserName(o.Creator) + " " + o.Body).Join(" "), searchPriority); }
public string GridText(Context context, Column column) { return(Id != UserTypes.Anonymous.ToInt() ? SiteInfo.UserName( context: context, userId: Id) : string.Empty); }
public string GridText(Context context, Column column) { return(!Anonymous() ? SiteInfo.UserName( context: context, userId: Id) : string.Empty); }
public string ToResponse(Context context, SiteSettings ss, Column column) { return(column.EditorReadOnly != true ? Id.ToString() : SiteInfo.UserName( context: context, userId: Id)); }
private static HtmlBuilder NavigationMenu( this HtmlBuilder hb, SiteSettings ss, long siteId, string referenceType, bool useNavigationMenu) { return(hb.Ul( id: "NavigationMenu", action: () => hb .Li( action: () => hb .Div(action: () => hb .A( href: NewHref(ss), attributes: SiteIndex(ss) ? new HtmlAttributes() .OnClick("$p.openTemplateDialog($(this));") .DataAction("OpenTemplateDialog") .DataMethod("post") : null, action: () => hb .Span(css: "ui-icon ui-icon-plus") .Text(text: Displays.New()))), _using: ss.ReferenceType == "Sites" && Routes.Action() == "index" ? ss.CanManageSite() : ss.CanCreate() && ss.ReferenceType != "Wikis") .Li( css: "sub-menu", action: () => hb .Div( attributes: new HtmlAttributes().DataId("ViewModeMenu"), action: () => hb .Span(css: "ui-icon ui-icon-triangle-1-e") .Text(text: Displays.View())) .ViewModeMenu(ss: ss), _using: Def.ViewModeDefinitionCollection .Any(o => o.ReferenceType == referenceType)) .Li( css: "sub-menu", action: () => hb .Div( attributes: new HtmlAttributes().DataId("SettingsMenu"), action: () => hb .Span(css: "ui-icon ui-icon-gear") .Text(text: Displays.Setting())) .SettingsMenu(siteId: siteId, ss: ss)) .Li( css: "sub-menu", action: () => hb .Div( attributes: new HtmlAttributes().DataId("AccountMenu"), action: () => hb .Span(css: "ui-icon ui-icon-person") .Text(text: SiteInfo.UserName(( Sessions.UserId())))) .AccountMenu()))); }
public static void FullText(this Comments self, List <string> fullText) { if (self != null) { fullText.Add(self.Select(o => SiteInfo.UserName(o.Creator) + " " + o.Body) .Join(" ")); } }
public string GridText(Column column) { return(this?.Take(DisplayCount()).Select(comment => "{0} {1} \n{2}".Params( comment.CreatedTimeDisplayValue(), SiteInfo.UserName(comment.Creator), comment.Body)) .Join("\n\n")); }
public string ToExport(IContext context, Column column, ExportColumn exportColumn = null) { return(this.Select(o => o.CreatedTime.ToLocal(context: context).ToViewText(context: context) + " " + SiteInfo.UserName( context: context, userId: o.Creator) + "\n" + o.Body).Join("\n\n")); }
public HtmlBuilder Td(HtmlBuilder hb, Context context, Column column) { return(Id != UserTypes.Anonymous.ToInt() ? hb.Td(action: () => hb .HtmlUser( context: context, text: column.ChoiceHash.Get(Id.ToString())?.Text ?? SiteInfo.UserName( context: context, userId: Id))) : hb.Td(action: () => { })); }
public static void SearchIndexes( this Comments self, IContext context, Dictionary <string, int> searchIndexHash, int searchPriority) { SearchIndexes( context: context, searchIndexHash: searchIndexHash, text: self.Select(o => SiteInfo.UserName( context: context, userId: o.Creator) + " " + o.Body).Join(" "), searchPriority: searchPriority); }
public HtmlBuilder Td(HtmlBuilder hb, Context context, Column column) { return(Id != UserTypes.Anonymous.ToInt() ? hb.Td( css: column.TextAlign == SiteSettings.TextAlignTypes.Right ? " right-align " : string.Empty, action: () => hb .HtmlUser( context: context, text: column.ChoiceHash.Get(Id.ToString())?.Text ?? SiteInfo.UserName( context: context, userId: Id))) : hb.Td(action: () => { })); }
public void ReplaceRelatedUsers(IEnumerable <long> users) { Address = Address.Replace( "[RelatedUsers]", Rds.ExecuteTable(statements: Rds.SelectMailAddresses( column: Rds.MailAddressesColumn() .OwnerId() .MailAddress(), where : Rds.MailAddressesWhere() .OwnerId_In(users.Distinct()))) .AsEnumerable() .GroupBy(o => o["OwnerId"]) .Select(o => MailAddressUtilities.Get( SiteInfo.UserName(o.First()["OwnerId"].ToInt()), o.First()["MailAddress"].ToString())) .Join(";")); }
public HtmlBuilder Td( HtmlBuilder hb, Context context, Column column, int?tabIndex, ServerScriptModelColumn serverScriptModelColumn) { return(!Anonymous() ? hb.Td( css: column.CellCss(serverScriptModelColumn?.ExtendedCellCss), action: () => hb .HtmlUser( context: context, text: column.ChoiceHash.Get(Id.ToString())?.Text ?? SiteInfo.UserName( context: context, userId: Id))) : hb.Td(action: () => { })); }
private static string Label(Column groupBy, string selectedValue) { if (groupBy.UserColumn) { return(SiteInfo.UserName(selectedValue.ToInt())); } else if (groupBy.HasChoices()) { var label = groupBy.Choice(selectedValue).TextMini; return(label.IsNullOrEmpty() ? NumericZero(groupBy, selectedValue) ? Displays.NotSet() : StringEmpty(groupBy, selectedValue) ? Displays.NotSet() : "? " + selectedValue : label); } else { return(selectedValue); } }
private static string Label(Column groupBy, string selectedValue) { if (groupBy.UserColumn) { return(SiteInfo.UserName(selectedValue.ToInt())); } else if (groupBy.HasChoices()) { var label = groupBy.Choice(selectedValue).TextMini; if (groupBy.TypeName.CsTypeSummary() == Types.CsNumeric && label == "0") { return(Displays.NotSet()); } return(label != string.Empty ? label : Displays.NotSet()); } else { return(selectedValue); } }
public GanttElement( string groupBy, long id, string title, decimal workValue, DateTime startTime, DateTime completionTime, decimal progressRate, int status, int owner, int updatorId, DateTime createdTime, DateTime updatedTime, Column statusColumn, Column workValueColumn, Column progressRateColumn, bool?summary = null) { GroupBy = groupBy; Id = id; Title = "{0} ({1}{2} * {3}{4}) {5} : {6}".Params( title, workValueColumn.Display(workValue), workValueColumn.Unit, progressRateColumn.Display(progressRate), progressRateColumn.Unit, SiteInfo.UserName(owner, notSet: false), statusColumn.Choice(status.ToString()).Text); StartTime = startTime.InRange() ? startTime.ToLocal(Displays.YmdFormat()) : createdTime.ToLocal(Displays.YmdFormat()); CompletionTime = completionTime.ToLocal(Displays.YmdFormat()); DisplayCompletionTime = completionTime.AddDays(-1).ToLocal(Displays.YmdFormat()); ProgressRate = progressRate; Completed = status >= Parameters.General.CompletionCode; GroupSummary = summary; }
/// <summary> /// Fixed: /// </summary> private static void AddMember(this Dictionary <string, ControlData> data, DataRow dataRow) { var deptId = dataRow["DeptId"].ToInt(); var userId = dataRow["UserId"].ToInt(); var admin = dataRow.Table.Columns.Contains("Admin") ? dataRow["Admin"].ToBool() : false; var manager = admin ? "(" + Displays.Manager() + ")" : string.Empty; if (deptId > 0) { data.Add( "Dept," + deptId.ToString() + "," + admin, new ControlData(SiteInfo.Dept(deptId)?.Name + manager)); } else if (userId > 0) { data.Add( "User," + userId.ToString() + "," + admin, new ControlData(SiteInfo.UserName(userId) + manager)); } }