Home
The Toolkit for Online Communities
16701 Community Members, 3 members online, 2528 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Development : Notification intervals -- adding more like openacs.org?

Forum OpenACS Development: Notification intervals -- adding more like openacs.org?

Icon of envelope Request notifications

On the openacs.org site, Forum notifications can be set at one of 5 intervals: instant, hourly, daily, every other day, weekly. However, in the notifications package installation code, only the first three intervals are created. See oacs-5-2 branch which is essentially the same as the openacs-org branch. Forums appears hard-wired for these three intervals, too: all branches. File-storage. is also hard-wired to instant, hourly, daily.

This is the only discussion I see on notification intervals.

So several questions: how did the extra intervals get added to the openacs.org site? Was this done manually to the DB? Should the notifications package be fixed to include all intervals during package installation? Should client packages like forums and file-storage add notification intervals they want but aren't already installed? Should user-configurable notification intervals be offered?

Collapse
Posted by Stan Kaufman on
Actually, it's trivial to add an upgrade script to do this if you want a site to have more notification intervals, so there's no need to modify the existing notification, file-storage, or forum packages (though it would make some sense to have this install out of the box):

-- notification-intervals-update.sql

-- add missing notification intervals

select notification_interval__new (
    null,
    'weekly',
    3600 * 24 * 7,
    now(),
    null,
    null,
    null
);

select notification_interval__new (
    null,
    'every other day',
    3600 * 24 * 2,
    now(),
    null,
    null,
    null
);

-- add in missing intervals to any client package types

create function inline_0() returns integer as '
declare
        v_type_id integer;
begin
        insert into notification_types_intervals
        (type_id, interval_id)
        select t.type_id, i.interval_id 
        from notification_types t, notification_intervals i where i.name in (''weekly'',''qod'');

	return (0);
end;
' language 'plpgsql';

select inline_0();
drop function inline_0();