1.22.3 Console unexpected behaviour/bug?

Support and queries relating to all previous versions of ZoneMinder
Locked
domf
Posts: 7
Joined: Tue Jun 12, 2007 12:14 pm

1.22.3 Console unexpected behaviour/bug?

Post by domf »

Hi,

I am successfully running zm 1.22.3 on Ununtu 7.04 (Feisty Fawn). I have a number of monitors setup, some as Record, some as Mocord and some as Modect. I have split these into three "groups" and under normal usage only have the "modect" group displayed in the console.

This displays (for example) two cameras with a total of five events in the last day. If I click on the total entry (5) under day I would expect to see the five events for these monitors displayed - this does not happen. Instead I see events for ALL monitors in the last day including those not in the current group.

If instead I click on the individual daily totals for the monitors I get the correct result - it is only the total that is "broken" when I have some monitors hidden by using groups.

There seem to be two alternatives:

1) Change the total line to display the total events for all monitors
2) Change the behaviour to display the five (in my example) events I would expect to see as this is the number reported by the total.

IMO Option two is the better answer.


Hope this is clear.


Dom
wilso027
Posts: 90
Joined: Wed Feb 21, 2007 10:38 pm

Post by wilso027 »

Remember we can all help on this project. Try to look at the code and see what needs to be changed to fix it for everyone. I'll try to setup groups and look and see if I can catch what you are talking about.

Allan
domf
Posts: 7
Joined: Tue Jun 12, 2007 12:14 pm

Post by domf »

Hi,
sorry if my original post came across as if I wasn't trying to help - certainly wasn't intended. I've spent some time trying to understand what's going on here but it's not helped by my lack of php knowledge!

If I have a group setup (and only the monitors in that group displayed on the main console) with two monitors (13 & 14) if I click on the hourly events the urls are as follows:

For monitor 13:
javascript: scrollWindow( '/zm/index.php?view=events&page=1&filter=1&trms=3&attr1=MonitorId&op1=%3d&val1=13&cnj2=and&attr2=Archived&op2=%3d&val2=0&cnj3=and&attr3=DateTime&op3=%3e%3d&val3=-1+hour', 'zmEvents', 720, 480 );

For monitor 14:
javascript: scrollWindow( '/zm/index.php?view=events&page=1&filter=1&trms=3&attr1=MonitorId&op1=%3d&val1=14&cnj2=and&attr2=Archived&op2=%3d&val2=0&cnj3=and&attr3=DateTime&op3=%3e%3d&val3=-1+hour', 'zmEvents', 720, 480 );

From this the MonitorId is passed as attr1 with values of 13 & 14 respectively.

The URL for the total hourly events (which correctly shows the total for monitors 13 & 14 for the last hour) is:

javascript: scrollWindow( '/zm/index.php?view=events&page=1&filter=1&trms=2&attr1=Archived&op1=%3d&val1=0&cnj2=and&attr2=DateTime&op2=%3e%3d&val2=-1+hour', 'zmEvents', 720, 480 );


Here MonitorId is not passed so the events for all monitors for the last hour are displayed instead of just those for the selected monitors (i.e. those in the current group, 13 & 14 in this example).

My lack of php knowledge makes it difficult for me to work out whether the current code allows multiple arguments to be passed as the MonitorId (and hence just the call needs changing) or whether more is required.


Hope this helps and shows I'm willing to do as much as I can to help!

Dom
wilso027
Posts: 90
Joined: Wed Feb 21, 2007 10:38 pm

Post by wilso027 »

I see what you are talking about on my system also and the code is pretty hard to follow. I'll try to look at it more this evening and see if I can see anything else.

Allan
domf
Posts: 7
Joined: Tue Jun 12, 2007 12:14 pm

Post by domf »

Thanks.

Dom
User avatar
AmmarossDanan
Posts: 19
Joined: Tue Jul 03, 2007 10:05 pm
Location: Salt Lake, UT, US

Solved

Post by AmmarossDanan »

I saw your plight on this apparent bug, and I managed to hack up a solution. I just hope you're still monitoring this thread. ZM, I hope you review this for a possible addition to the next release.

On line 45 of zm_html_view_events.php, paste this:

Code: Select all

if ( isset($cgroup) && $cgroup != 0 )
{
        $sql = "select * from Groups where Id = '$cgroup'";
        $result = mysql_query( $sql );
        if ( !$result )
                echo mysql_error();
        $group = mysql_fetch_assoc( $result );
        mysql_free_result( $result );

        $count_sql .= " AND M.Id in (".join( ",", preg_split( '/["\'\s]*,["\'\s]*/', $group['MonitorIds'] ) ).")";
        $events_sql .= " AND M.Id in (".join( ",", preg_split( '/["\'\s]*,["\'\s]*/', $group['MonitorIds'] ) ).")";
}
Here's a bit of the surroundings:

Code: Select all

}
else
{
        $count_sql .= " 1";
        $events_sql .= " 1";
}

/*
 * clip goes here
 */

parseSort();
parseFilter();
That's all there is to it. Hope this fixes your problem. :)
Oh, and btw, this will also solve a potential problem of users viewing recordings for cameras they shouldn't have access to...
Ammaross Danan
domf
Posts: 7
Joined: Tue Jun 12, 2007 12:14 pm

Post by domf »

Thanks - I'll give it a go and report back.


Dom
domf
Posts: 7
Joined: Tue Jun 12, 2007 12:14 pm

Post by domf »

I am happy to report that this works successfully. Thankyou for your time.



Dom
Locked