'Who is online' implemented

main
Inga 🏳‍🌈 15 years ago
parent deea138acf
commit 264e809af9
  1. 2
      Builder/IISMainHandler/build.txt
  2. 2
      Builder/IISUploadHandler/build.txt
  3. 2
      Common/dataobjects/Account.cs
  4. 2
      IISMainHandler/HandlersFactory.cs
  5. 1
      IISMainHandler/IISMainHandler.csproj
  6. 45
      IISMainHandler/handlers/response/WhoIsOnlineHandler.cs
  7. 5
      templates/Full/elems/Header.xslt

@ -177,7 +177,7 @@ namespace FLocal.Common.dataobjects {
public static Account tryAuthorize(string name, string password) { public static Account tryAuthorize(string name, string password) {
Account account = LoadByName(name); Account account = LoadByName(name);
if(account.passwordHash != account.hashPassword(password)) throw new FLocalException("Wrong password"); if(account.passwordHash != account.hashPassword(password)) throw new FLocalException("Wrong password (" + account.hashPassword(password) + ")");
return account; return account;
} }

@ -77,6 +77,8 @@ namespace FLocal.IISHandler {
switch(context.requestParts[1].ToLower()) { switch(context.requestParts[1].ToLower()) {
case "active": case "active":
return new handlers.response.ActiveAccountListHandler(); return new handlers.response.ActiveAccountListHandler();
case "online":
return new handlers.response.WhoIsOnlineHandler();
default: default:
return new handlers.response.UserListHandler(); return new handlers.response.UserListHandler();
} }

@ -93,6 +93,7 @@
<Compile Include="handlers\response\UploadNewHandler.cs" /> <Compile Include="handlers\response\UploadNewHandler.cs" />
<Compile Include="handlers\response\UserInfoHandler.cs" /> <Compile Include="handlers\response\UserInfoHandler.cs" />
<Compile Include="handlers\response\UserPostsHandler.cs" /> <Compile Include="handlers\response\UserPostsHandler.cs" />
<Compile Include="handlers\response\WhoIsOnlineHandler.cs" />
<Compile Include="handlers\RootHandler.cs" /> <Compile Include="handlers\RootHandler.cs" />
<Compile Include="handlers\StaticHandler.cs" /> <Compile Include="handlers\StaticHandler.cs" />
<Compile Include="handlers\ThreadHandler.cs" /> <Compile Include="handlers\ThreadHandler.cs" />

@ -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;
using FLocal.Core.DB;
using FLocal.Core.DB.conditions;
namespace FLocal.IISHandler.handlers.response {
class WhoIsOnlineHandler : AbstractGetHandler {
override protected string templateName {
get {
return "UserList.xslt";
}
}
override protected XElement[] getSpecificData(WebContext context) {
PageOuter pageOuter = PageOuter.createUnlimited(context.userSettings.usersPerPage);
IEnumerable<Session> sessions =
from stringId in Config.instance.mainConnection.LoadIdsByConditions(
Session.TableSpec.instance,
new Core.DB.conditions.ComparisonCondition(
Session.TableSpec.instance.getColumnSpec(Session.TableSpec.FIELD_LASTACTIVITY),
Core.DB.conditions.ComparisonType.GREATEROREQUAL,
DateTime.Now.Subtract(Config.instance.ActivityThreshold).ToUTCString()
),
pageOuter
) select Session.LoadById(Session.SessionKey.Parse(stringId));
return new XElement[] {
new XElement("users",
from session in sessions select session.account.user.exportToXmlForViewing(context),
pageOuter.exportToXml(2, 5, 2)
)
};
}
}
}

@ -73,7 +73,10 @@
<xsl:text>Âőîä</xsl:text> <xsl:text>Âőîä</xsl:text>
</a> </a>
<xsl:text> | </xsl:text> <xsl:text> | </xsl:text>
<a target="_top">Êòî â îíëàéíå</a> <a target="_top">
<xsl:attribute name="href">/Users/Online/</xsl:attribute>
<xsl:text>Êòî â îíëàéíå</xsl:text>
</a>
<xsl:text> | </xsl:text> <xsl:text> | </xsl:text>
<a target="_top"> <a target="_top">
<xsl:attribute name="href">/q/faq</xsl:attribute> <xsl:attribute name="href">/q/faq</xsl:attribute>

Loading…
Cancel
Save