Click here to register.
      
PBWG Banner


     Re: Update of UsersOnline macro > Re: Update of UsersOnline macro

Update of UsersOnline macro

User bernd
Date 5/20/2008 3:38 am
Views 1031
Rating 0    Rate [
|
]
Previous · Next
User Message
bernd

I am in the process of updating the UsersOnline macro which has been submitted for WebGUI 6. I am almost there. However, there remains an issue with time stamps.

Active users are found by the following SQL query:

SELECT COUNT(DISTINCT userId) FROM userSession where (lastPageView >= $epoch) and (userId != 1)

The original code relied on WebGUI::DateTime functions for creating the timestamp in $epoch:

$epoch = WebGUI::DateTime::time();
$epoch = WebGUI::DateTime::addToTime($epoch, 0, -$minutes, 0);

Unfortunately, these functions have disappeared in WebGUI 7. I tried to replace them by

$epoch = time() - $minutes*60;

However, I get unreasonable results. So how do I create correct timestamps in WebGUI 7 such that there compatible with the ones used in the database backend?

--
Trying to build a non-profit community portal for free-climbers around Magdeburg/Germany. Check out http://kletterfreunde-md.kashyyyk.de (under construction).



Back to Top
Rate [
|
]
 
 
JT
Have a look at webgui::session::datetime, aka $session->datetime

JT
On May 20, 2008, at 3:38 AM, <spunky@kashyyyk.de> wrote:

bernd wrote:

I am in the process of updating the UsersOnline macro which has been submitted for WebGUI 6. I am almost there. However, there remains an issue with time stamps.

Active users are found by the following SQL query:

SELECT COUNT(DISTINCT userId) FROM userSession where (lastPageView >= $epoch) and (userId != 1)

The original code relied on WebGUI::DateTime functions for creating the timestamp in $epoch:

$epoch = WebGUI::DateTime::time();
$epoch = WebGUI::DateTime::addToTime($epoch, 0, -$minutes, 0);

Unfortunately, these functions have disappeared in WebGUI 7. I tried to replace them by

$epoch = time() - $minutes*60;

However, I get unreasonable results. So how do I create correct timestamps in WebGUI 7 such that there compatible with the ones used in the database backend?

--
Trying to build a non-profit community portal for free-climbers around Magdeburg/Germany. Check out http://kletterfreunde-md.kashyyyk.de (under construction).



http://www.plainblack.com/webgui/dev/discuss/update-of-usersonline-macro


--

Plain Black&#44; makers of WebGUI
http://plainblack.com


Back to Top
Rate [
|
]
 
 
bernd

Have a look at webgui::session::datetime, aka $session->datetime

JT

I found it. Thanks! The macro seems to work again. I am going to submit it after I have added some documentation. Is there a chance it can make it into the core? Let us assume for a moment that it supports templates, internationalization, uses the API exclusively and is documented well?
Bernd

 



Back to Top
Rate [
|
]
 
 
JT
> I found it. Thanks! The macro seems to work again. I am going to  
> submit it after I have added some documentation. Is there a chance  
> it can make it into the core? Let us assume for a moment that it  
> supports templates, internationalization, uses the API exclusively  
> and is documented well?

I'm not even sure what it is that you're working on, I just offered  
help based upon what you asked. But yeah, there's a chance that  
anything can make it into the core provided it follows all the  
guidelines for submitting stuff to the core.



JT Smith
ph: 703-286-2525 x810
fx: 312-264-5382

Create like a god. Command like a king. Work like a slave.



Back to Top
Rate [
|
]
 
 
bernd


I'm not even sure what it is that you're working on, I just offered  help based upon what you asked. But yeah, there's a chance that  anything can make it into the core provided it follows all the guidelines for submitting stuff to the core.

The macro is meant to display users (members and visitors) that are currently active on a site. Optionally, a list of members with links to their profiles can be displayed.

I think this is a very nice extension for community portals. At the moment, however, the macro is still very unflexible. In addition, it uses direct queries for finding active users. I was wondering if there are any appropriate API functions for replacing these?

--
Trying to build a non-profit community portal for free-climbers around Magdeburg/Germany. Check out http://kletterfreunde-md.kashyyyk.de (under construction).



Back to Top
Rate [
|
]
 
 
JT
That seems like a nice idea. There's one thing I need you to agree to however. Something new we're trying to avoid the dump and run syndrome of the past. I need you to agree to support your code (bug fix wise) for at least one year after it gets added to the core. Can you agree to that?



On May 21, 2008, at 12:59 AM, <spunky@kashyyyk.de> <spunky@kashyyyk.de> wrote:
bernd wrote:



I'm not even sure what it is that you're working on, I just offered  help based upon what you asked. But yeah, there's a chance that  anything can make it into the core provided it follows all the guidelines for submitting stuff to the core.


The macro is meant to display users (members and visitors) that are currently active on a site. Optionally, a list of members with links to their profiles can be displayed.

I think this is a very nice extension for community portals. At the moment, however, the macro is still very unflexible. In addition, it uses direct queries for finding active users. I was wondering if there are any appropriate API functions for replacing these?

--
Trying to build a non-profit community portal for free-climbers around Magdeburg/Germany. Check out http://kletterfreunde-md.kashyyyk.de (under construction).



http://www.plainblack.com/webgui/dev/discuss/update-of-usersonline-macro/4

--

Plain Black&#44; makers of WebGUI
http://plainblack.com


JT Smithph: 703-286-2525 x810fx: 312-264-5382
Create like a god. Command like a king. Work like a slave.


Back to Top
Rate [
|
]
 
 
bernd


That seems like a nice idea. There's one thing I need you to agree to however. Something new we're trying to avoid the dump and run syndrome of the past. I need you to agree to support your code (bug fix wise) for at least one year after it gets added to the core. Can you agree to that?


Not sure. I am only a perl newbie and have little time for coding. I am not even sure whether I will be able to implement everything I want. So let me finish the macro first. Then we can talk again. In any case there is the possibilty to submit to the add-ons section.
Bernd

BTW, where can I find guidelines for submitting "stuff" to the core?

--
Trying to build a non-profit community portal for free-climbers around Magdeburg/Germany. Check out http://www.klettern-md.de (under construction).



Back to Top
Rate [
|
]
 
 
JT
> BTW, where can I find guidelines for submitting "stuff" to the core?

http://www.webgui.org/community-wiki/how-to-add-a-feature-to-webgui-core



JT Smith
ph: 703-286-2525 x810
fx: 312-264-5382

Create like a god. Command like a king. Work like a slave.



Back to Top
Rate [
|
]
 
 

Smoketest For nightly_2008-08-30 by Visitor - Sat @ 01:45am

Re: Config File Changes by pwrightson - Fri @ 04:07pm

Re: IRC Logs by koen - Fri @ 02:08pm

Re: IRC Logs by patspam - Fri @ 02:01pm

Re: IRC Logs by koen - Fri @ 01:42pm

Re: How do I find al my submitted RFE's? by bartjol - Fri @ 01:39pm

Re: IRC Logs by kristi - Fri @ 01:27pm

Re: LastModified question by perlDreamer - Fri @ 12:57pm

Re: How do I find al my submitted RFE's? by bartjol - Fri @ 12:11pm

How do I find al my submitted RFE's? by koen - Fri @ 11:23am

Re: IRC Logs by koen - Fri @ 11:20am

IRC Logs by martink - Fri @ 10:51am

Re: cleaning out the wiki by koen - Fri @ 10:44am

Re: shop in 7.5.21 by kristi - Fri @ 09:03am