Implemented active users page

main
Inga 🏳‍🌈 15 years ago
parent 1d281be54b
commit 8e5ac2966a
  1. 2
      Builder/IISMainHandler/build.txt
  2. 2
      Builder/IISUploadHandler/build.txt
  3. 2
      Common/dataobjects/User.cs
  4. 11
      IISMainHandler/HandlersFactory.cs
  5. 1
      IISMainHandler/IISMainHandler.csproj
  6. 4
      IISMainHandler/PageOuter.cs
  7. 45
      IISMainHandler/handlers/response/ActiveAccountListHandler.cs
  8. 2
      IISMainHandler/handlers/response/UserListHandler.cs
  9. 13
      templates/Full/UserList.xslt

@ -180,7 +180,7 @@ namespace FLocal.Common.dataobjects {
return result; return result;
} }
public static IEnumerable<User> getUsers(Diapasone diapasone, UserContext context) { public static IEnumerable<User> getUsers(Diapasone diapasone) {
return User.LoadByIds( return User.LoadByIds(
from stringId in Config.instance.mainConnection.LoadIdsByConditions( from stringId in Config.instance.mainConnection.LoadIdsByConditions(
User.TableSpec.instance, User.TableSpec.instance,

@ -69,7 +69,16 @@ namespace FLocal.IISHandler {
case "migrateaccount": case "migrateaccount":
return new handlers.response.MigrateAccountHandler(); return new handlers.response.MigrateAccountHandler();
case "users": case "users":
return new handlers.response.UserListHandler(); if(context.requestParts.Length < 2) {
return new handlers.response.UserListHandler();
} else {
switch(context.requestParts[1].ToLower()) {
case "active":
return new handlers.response.ActiveAccountListHandler();
default:
return new handlers.response.UserListHandler();
}
}
case "user": case "user":
if(context.requestParts.Length < 2) { if(context.requestParts.Length < 2) {
return new handlers.WrongUrlHandler(); return new handlers.WrongUrlHandler();

@ -70,6 +70,7 @@
<Compile Include="handlers\request\SendPMHandler.cs" /> <Compile Include="handlers\request\SendPMHandler.cs" />
<Compile Include="handlers\request\SettingsHandler.cs" /> <Compile Include="handlers\request\SettingsHandler.cs" />
<Compile Include="handlers\request\UploadHandler.cs" /> <Compile Include="handlers\request\UploadHandler.cs" />
<Compile Include="handlers\response\ActiveAccountListHandler.cs" />
<Compile Include="handlers\response\BoardAsThread.cs" /> <Compile Include="handlers\response\BoardAsThread.cs" />
<Compile Include="handlers\response\ConversationHandler.cs" /> <Compile Include="handlers\response\ConversationHandler.cs" />
<Compile Include="handlers\response\ConversationsHandler.cs" /> <Compile Include="handlers\response\ConversationsHandler.cs" />

@ -21,6 +21,10 @@ namespace FLocal.IISHandler {
this.perPage = perPage; this.perPage = perPage;
} }
public static PageOuter createUnlimited(long perPage) {
return new PageOuter(perPage);
}
public static PageOuter create(long perPage, long total) { public static PageOuter create(long perPage, long total) {
PageOuter result = new PageOuter(0, perPage, perPage); PageOuter result = new PageOuter(0, perPage, perPage);
result.total = total; result.total = total;

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Xml.Linq;
using FLocal.Common;
using FLocal.Common.dataobjects;
using FLocal.Core.DB;
namespace FLocal.IISHandler.handlers.response {
class ActiveAccountListHandler : AbstractGetHandler {
override protected string templateName {
get {
return "UserList.xslt";
}
}
override protected XElement[] getSpecificData(WebContext context) {
//PageOuter pageOuter = PageOuter.createFromGet(context.requestParts, context.userSettings.usersPerPage, 1);
PageOuter pageOuter = PageOuter.createUnlimited(context.userSettings.usersPerPage);
IEnumerable<Account> accounts = Account.LoadByIds(
from stringId in Config.instance.mainConnection.LoadIdsByConditions(
Account.TableSpec.instance,
new Core.DB.conditions.ComparisonCondition(
Account.TableSpec.instance.getColumnSpec(Account.TableSpec.FIELD_NEEDSMIGRATION),
Core.DB.conditions.ComparisonType.EQUAL,
"0"
),
pageOuter
) select int.Parse(stringId)
);
return new XElement[] {
new XElement("users",
from account in accounts select account.user.exportToXmlForViewing(context),
pageOuter.exportToXml(2, 5, 2)
)
};
}
}
}

@ -20,7 +20,7 @@ namespace FLocal.IISHandler.handlers.response {
override protected XElement[] getSpecificData(WebContext context) { override protected XElement[] getSpecificData(WebContext context) {
PageOuter pageOuter = PageOuter.createFromGet(context.requestParts, context.userSettings.usersPerPage, 1); PageOuter pageOuter = PageOuter.createFromGet(context.requestParts, context.userSettings.usersPerPage, 1);
IEnumerable<User> users = User.getUsers(pageOuter, context); IEnumerable<User> users = User.getUsers(pageOuter);
return new XElement[] { return new XElement[] {
new XElement("users", new XElement("users",
from user in users select user.exportToXmlForViewing(context), from user in users select user.exportToXmlForViewing(context),

@ -58,6 +58,19 @@
</table> </table>
</td> </td>
</tr> </tr>
<tr class="tdheader">
<td colspan="7">
<table width="100%" cellspacing="1" cellpadding="3" border="0">
<tr>
<td>
<a href="/Users/Active/">
<xsl:text>Àêòèâíûå (ñìèãðèðîâàííûå)</xsl:text>
</a>
</td>
</tr>
</table>
</td>
</tr>
</table> </table>
</td> </td>
</tr> </tr>

Loading…
Cancel
Save