From 9b6f6218635a79960035f57ea504fcd75086a499 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Thu, 2 Oct 2014 16:18:19 +0200 Subject: [PATCH] FindListPeople page complete --- Logic/Security/Accesses.cs | 3 ++- Site5/App_Code/PageV5Base.cs | 6 ++--- Site5/App_GlobalResources/Global.resx | 20 +++++++++++++++ .../PageIcons/iconshock-group-search-40px.png | Bin 0 -> 4143 bytes Site5/MainMenu-v5.xml | 2 +- .../v5/Swarm/Json-ListFindPeople.aspx.cs | 13 ++++++++-- Site5/Pages/v5/Swarm/ListFindPeople.aspx | 23 ++++++++++++------ Site5/Pages/v5/Swarm/ListFindPeople.aspx.cs | 15 ++++++------ 8 files changed, 59 insertions(+), 23 deletions(-) create mode 100644 Site5/Images/PageIcons/iconshock-group-search-40px.png diff --git a/Logic/Security/Accesses.cs b/Logic/Security/Accesses.cs index 1b7870bf..a33cf7d3 100644 --- a/Logic/Security/Accesses.cs +++ b/Logic/Security/Accesses.cs @@ -37,7 +37,8 @@ namespace Swarmops.Logic.Security { Unknown = 0, Bookkeeping, - Financials + Financials, + PersonData } public enum AccessType diff --git a/Site5/App_Code/PageV5Base.cs b/Site5/App_Code/PageV5Base.cs index ae43c1f7..86692e00 100644 --- a/Site5/App_Code/PageV5Base.cs +++ b/Site5/App_Code/PageV5Base.cs @@ -67,9 +67,9 @@ public class PageV5Base : System.Web.UI.Page { // Localization - // Set default culture (English, United States, but that doesn't work so fake it to GB) + // Set default culture (English, United States) - string preferredCulture = "en-GB"; + string preferredCulture = "en-US"; // ----------- SET CULTURE ------------ @@ -83,7 +83,7 @@ public class PageV5Base : System.Web.UI.Page else { // No, determine from browser - string browserPreference = "en-GB"; + string browserPreference = "en-US"; if (Request.UserLanguages != null && Request.UserLanguages.Length > 0) { browserPreference = Request.UserLanguages[0]; diff --git a/Site5/App_GlobalResources/Global.resx b/Site5/App_GlobalResources/Global.resx index ab33ae20..43e31c85 100644 --- a/Site5/App_GlobalResources/Global.resx +++ b/Site5/App_GlobalResources/Global.resx @@ -475,4 +475,24 @@ Geography As in "location" - on any scale and anywhere from "World" to a named city + + Action + Header over a column of possible actions (signified by icons) in a datagrid. + + + Mail + Somebody's email address. + + + Name + A plain person's first and last name + + + Notes + Small notes in a grid, maybe in icon form + + + Phone + Somebody's telephone number. Mobile assumed. + \ No newline at end of file diff --git a/Site5/Images/PageIcons/iconshock-group-search-40px.png b/Site5/Images/PageIcons/iconshock-group-search-40px.png new file mode 100644 index 0000000000000000000000000000000000000000..03ca7f496e03e1a9adceefd52e6fa5ff1527d0b6 GIT binary patch literal 4143 zcmV+~5YX?5P)=3Aq3O54=f4 zK~z}7rI>k;T~(dOKX-fk>-S#o-RXYa37xHz4uMWW3=jw?i>b(>IF1t)HHuEvSPt%5 z<2X|_E~DcNIv^s9f>UlFq6iW(BuElE3EB6Mbb4Q3zx}><-(Aj`KVAnDOrlkDs(y9O zy>;rG&-wm-XVq?OjG#6&lgZ`)XoyAv%a$)oG$j&^AwzGd*pB9SUKyaXrIBpWv$=o87u^-@dQT%w)@4Ch0qO?WSj8*V@}Q-1)z@ zd-ZEd0DIRPMTTK?D~duspC^;akj-WZ z1p@asG}J#|ah%UzF>l_znyQkXNujwG*Y(T;P3L6FLD3C{hlfd}Qn;>jWMX{mM%R-w zmjrB#N14hN*!ExdKfL_5JMW7%HA1unP$<9l9JhVuAspAGv9Xa*I7}{^WqNv=>FH_G z=`_V+k&ccIdU|>=O_NinPQLWvcU-@stLuuIfd!>oK{yg68jCZreLGD}O{`nDjzXb;St=0>hHq@{oUi=d2RB051fhZLf}WsvQ3u^E zQTD!8!Zb}np-?Ck3*2GUv?}EDd0f|}vAKmqhmX^-b{Tkpri1XnvAB6jl5(xaABGYXUO4!&Q!>YQ z?78&Xs^0P3ApoZO`!{11!L5L8fn(tn^7vy7;98Iw1-k-f7R)r1bKtockvP3=QEbGG|%QU z8?IsNKW$|Fm2;WNWLdEwc_EA+9;E0$A2%1w?<;@26??7XV0&kAKQ5 zm0B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O!C-+-@&rV zbaX95dN#@SBrDcj&#|*ZjJ&dg8?U=Aas3T9v~7E7%OUk*fKGjFw*)-P0#!u{0a8@m zCIpIOgYfWF4aKQ|=T=qrJd(1^KN!)ynbXpm1~l~|fV#4O_Y=nCl&$CnpiouwLbWb5Sv@>xJ`Ba>nQc2+ zy5tH(%N&+3?;(+hb2idMU!;w`L>Hq?3mSm&`o_ks_ip+qo45UuFa7J+um$v=K1KJU zMc8KkLBP@e>=LCYzL|qtCTc3`YyMDeuU%hPs~A3zmx8PQS3H4(${b;G;Mt$Edc*Cs zT+vR>$~83_zxwvq z!7LI9$N2Bz5>9Os)YO4yu*C29zWlEB?}{bj(W&Vf4jep0|JeZshX!eAsFzct!;hUg z{rXN|;$ncZx}o3!r1$@RM`ZWz-vwfgwxVdd>Uv?t6Mhs0fihcJf|LlLjLMlmzw_|^UEjU=eV3Z}J9a)kJ~sL~ke+?RmKv8&@=YDsvu4dgpKmtc%;uHZ zI_8`0^vM(Bw{Ezje*DbQ)#*Zx_O2x1a1ei?kbd;x?|r>gb!~dKU;Yx{`Jk7AJs+|> z3ueuh%NH4dn@Oi%TYhzKIUrJX8M)JHI}f tuIoSo=w7*c%{v3Z&@I4Hpzh70{U7L{v2w%#Aiw|s002ovPDHLkV1o6x8LPeople_ListFind 2 - + iconshock-group-search /Pages/v5/Swarm/ListFindPeople.aspx Link diff --git a/Site5/Pages/v5/Swarm/Json-ListFindPeople.aspx.cs b/Site5/Pages/v5/Swarm/Json-ListFindPeople.aspx.cs index 0867e9e8..7d1a5284 100644 --- a/Site5/Pages/v5/Swarm/Json-ListFindPeople.aspx.cs +++ b/Site5/Pages/v5/Swarm/Json-ListFindPeople.aspx.cs @@ -24,6 +24,13 @@ namespace Swarmops.Frontend.Pages.Swarm int geographyId = int.Parse(geographyString); Geography geography = Geography.FromIdentity(geographyId); + if ( + !this.CurrentUser.HasAccess(new Access(this.CurrentOrganization, geography, AccessAspect.PersonData, + AccessType.Read))) + { + throw new UnauthorizedAccessException("nope"); + } + People matches = People.FromOrganizationAndGeographyWithPattern(this.CurrentOrganization, geography, pattern); // matches = Authorization.FilterPeopleToMatchAuthority(matches, CurrentUser.GetAuthority()); @@ -42,11 +49,13 @@ namespace Swarmops.Frontend.Pages.Swarm foreach (Person person in matches) { - string onePerson = '{' + String.Format("\"id\":\"{0}\",\"name\":\"{1}\",\"avatar16Url\":\"{2}\",\"geographyName\":\"{3}\"", + string onePerson = '{' + String.Format("\"id\":\"{0}\",\"name\":\"{1}\",\"avatar16Url\":\"{2}\",\"geographyName\":\"{3}\",\"mail\":\"{4}\",\"phone\":\"{5}\"", person.Identity, JsonSanitize(person.Canonical), person.GetSecureAvatarLink(16), - JsonSanitize(person.Geography.Name)) + '}'; + JsonSanitize(person.Geography.Name), + JsonSanitize(person.Mail), + JsonSanitize(person.Phone)) + '}'; jsonPeople.Add(onePerson); } diff --git a/Site5/Pages/v5/Swarm/ListFindPeople.aspx b/Site5/Pages/v5/Swarm/ListFindPeople.aspx index cdc8c8da..9471730c 100644 --- a/Site5/Pages/v5/Swarm/ListFindPeople.aspx +++ b/Site5/Pages/v5/Swarm/ListFindPeople.aspx @@ -31,6 +31,10 @@ if (newNamePattern != lastNamePattern && newNamePattern.length >= 3) { lastNamePattern = newNamePattern; $('#TableSearchResults').datagrid({ url: 'Json-ListFindPeople.aspx?Pattern=' + escape(newNamePattern) + '&GeographyId=' + selectedGeographyId }); + } else if (newNamePattern.length < 3 && newNamePattern != lastNamePattern && selectedGeographyId != 1) { + $('#TableSearchResults').datagrid({ url: 'Json-ListFindPeople.aspx?Pattern=&GeographyId=' + selectedGeographyId }); + } else { // empty pattern and "world" + $('#TableSearchResults').datagrid({ url: '' }); } }); @@ -141,7 +145,11 @@ function onGeographyChange(newGeographyId) { if (newGeographyId != selectedGeographyId) { selectedGeographyId = newGeographyId; - $('#TableSearchResults').datagrid({ url: 'Json-ListFindPeople.aspx?Pattern=' + escape(lastNamePattern) + '&GeographyId=' + selectedGeographyId }); + if (selectedGeographyId != 1 || lastNamePattern.length > 2) { // do not allow carte-blance listing for "world" + $('#TableSearchResults').datagrid({ url: 'Json-ListFindPeople.aspx?Pattern=' + escape(lastNamePattern) + '&GeographyId=' + selectedGeographyId }); + } else { + $('#TableSearchResults').datagrid({ url: '' }); + } } } @@ -171,13 +179,12 @@ idField="itemId"> - - - - - - - + + + + + + diff --git a/Site5/Pages/v5/Swarm/ListFindPeople.aspx.cs b/Site5/Pages/v5/Swarm/ListFindPeople.aspx.cs index 073bca86..67c7844e 100644 --- a/Site5/Pages/v5/Swarm/ListFindPeople.aspx.cs +++ b/Site5/Pages/v5/Swarm/ListFindPeople.aspx.cs @@ -17,7 +17,7 @@ namespace Swarmops.Frontend.Pages.Swarm { protected void Page_Load(object sender, EventArgs e) { - this.PageIcon = "iconshock-money-envelope"; + this.PageIcon = "iconshock-group-search"; if (!Page.IsPostBack) { @@ -36,13 +36,12 @@ namespace Swarmops.Frontend.Pages.Swarm this.LabelMatchingPeopleInX.Text = String.Format(Resources.Pages.People.ListFindPeople_MatchingPeopleInX, this.CurrentOrganization.Name); - this.LabelGridHeaderAccount.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_BankAccount; - this.LabelGridHeaderAmount.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_Amount; - this.LabelGridHeaderBank.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_BankName; - this.LabelGridHeaderDue.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_DueDate; - this.LabelGridHeaderPaid.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_PaidOut; - this.LabelGridHeaderRecipient.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_Recipient; - this.LabelGridHeaderReference.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_Reference; + this.LabelGridHeaderAction.Text = Resources.Global.Global_Action; + this.LabelGridHeaderGeography.Text = Resources.Global.Global_Geography; + this.LabelGridHeaderMail.Text = Resources.Global.Global_Mail; + this.LabelGridHeaderName.Text = Resources.Global.Global_Name; + this.LabelGridHeaderPhone.Text = Resources.Global.Global_Phone; + this.LabelGridHeaderNotes.Text = Resources.Global.Global_Notes; }