FindListPeople page complete

This commit is contained in:
Rick Falkvinge
2014-10-02 16:18:19 +02:00
parent 57c477d9ec
commit 9b6f621863
8 changed files with 59 additions and 23 deletions
+2 -1
View File
@@ -37,7 +37,8 @@ namespace Swarmops.Logic.Security
{
Unknown = 0,
Bookkeeping,
Financials
Financials,
PersonData
}
public enum AccessType
+3 -3
View File
@@ -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];
+20
View File
@@ -475,4 +475,24 @@
<value>Geography</value>
<comment>As in "location" - on any scale and anywhere from "World" to a named city</comment>
</data>
<data name="Global_Action" xml:space="preserve">
<value>Action</value>
<comment>Header over a column of possible actions (signified by icons) in a datagrid.</comment>
</data>
<data name="Global_Mail" xml:space="preserve">
<value>Mail</value>
<comment>Somebody's email address.</comment>
</data>
<data name="Global_Name" xml:space="preserve">
<value>Name</value>
<comment>A plain person's first and last name</comment>
</data>
<data name="Global_Notes" xml:space="preserve">
<value>Notes</value>
<comment>Small notes in a grid, maybe in icon form</comment>
</data>
<data name="Global_Phone" xml:space="preserve">
<value>Phone</value>
<comment>Somebody's telephone number. Mobile assumed.</comment>
</data>
</root>
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

+1 -1
View File
@@ -16,7 +16,7 @@
<ResourceKey>People_ListFind</ResourceKey>
<UserLevel>2</UserLevel>
<Permissions />
<ImageUrl />
<ImageUrl>iconshock-group-search</ImageUrl>
<NavigateUrl>/Pages/v5/Swarm/ListFindPeople.aspx</NavigateUrl>
<Type>Link</Type>
<Children />
@@ -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);
}
+15 -8
View File
@@ -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">
<thead>
<tr>
<th data-options="field:'name',width:70"><asp:Label ID="LabelGridHeaderDue" runat="server" Text="XYZ Due"/></th>
<th data-options="field:'geographyName',width:150,sortable:true"><asp:Label ID="LabelGridHeaderRecipient" runat="server" Text="XYZ Beneficiary" /></th>
<th data-options="field:'bank',width:70"><asp:Label ID="LabelGridHeaderBank" runat="server" Text="XYZ Bank" /></th>
<th data-options="field:'account',width:120,sortable:true"><asp:Label ID="LabelGridHeaderAccount" runat="server" Text="XYZ Account" /></th>
<th data-options="field:'reference',width:140,sortable:true,order:'asc'"><asp:Label ID="LabelGridHeaderReference" runat="server" Text="XYZ Reference" /></th>
<th data-options="field:'amount',width:80,align:'right'"><asp:Label ID="LabelGridHeaderAmount" runat="server" Text="XYZ Amount" /></th>
<th data-options="field:'action',width:43,align:'center'"><asp:Label ID="LabelGridHeaderPaid" runat="server" Text="XYZPaid" /></th>
<th data-options="field:'name',width:210"><asp:Label ID="LabelGridHeaderName" runat="server" Text="XYZ Name"/></th>
<th data-options="field:'geographyName',width:150,sortable:true"><asp:Label ID="LabelGridHeaderGeography" runat="server" Text="XYZ Geography" /></th>
<th data-options="field:'mail',width:105,sortable:true"><asp:Label ID="LabelGridHeaderMail" runat="server" Text="XYZ Mail" /></th>
<th data-options="field:'phone',width:100,sortable:true"><asp:Label ID="LabelGridHeaderPhone" runat="server" Text="XYZ Phone" /></th>
<th data-options="field:'notes',width:50"><asp:Label ID="LabelGridHeaderNotes" runat="server" Text="XYZ Notes" /></th>
<th data-options="field:'actions',width:43,align:'center'"><asp:Label ID="LabelGridHeaderAction" runat="server" Text="XYZ Actions" /></th>
</tr>
</thead>
</table>
+7 -8
View File
@@ -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;
}