Commit 96c944b3 authored by Frank Bergmann's avatar Frank Bergmann

Initial Import

parents
Pipeline #704 failed with stages
<?xml version="1.0"?>
<!-- Generated by the OpenACS Package Manager -->
<package key="cronjob" url="http://openacs.org/repository/apm/packages/cronjob" type="apm_application">
<package-name>Cronjob</package-name>
<pretty-plural>Cronjobs</pretty-plural>
<initial-install-p>f</initial-install-p>
<singleton-p>t</singleton-p>
<version name="0.2" url="http://rmadilo.com/files/cronjob/cronjob-0.2.apm">
<owner url="mailto:tom@junom.com">Tom Jackson</owner>
<summary>Runs sql and tcl code on schedule similar to unix cron.</summary>
<release-date>2007-02-12</release-date>
<description format="text/plain">Runs sql and tcl code on schedule similar to unix cron.</description>
<provides url="cronjob" version="0.2"/>
<callbacks>
</callbacks>
<parameters>
<!-- No version parameters -->
</parameters>
</version>
</package>
--
-- Cronjob in sql
-- @author tom jackson <tom@zmbh.com>
-- @creation-date 22 Sept 2001
-- @cvs-id $Id$
--
create table cronjobs (
cronjob_id integer not null
constraint cj_cronjob_id_fk references acs_objects(object_id)
constraint cj_cronjob_id_pk primary key,
user_id integer not null
constraint cj_user_id_fk references users,
description varchar2(100) not null,
approved_p char(1) default 'f' not null
constraint cj_approved_p_ck check (approved_p in ('f','t')),
disabled_p char(1) default 'f' not null
constraint cj_disabled_p_ck check (disabled_p in ('f','t')),
minute char(2) default '0' not null,
hr char(2) default '0' not null,
mon char(2) default '0' not null,
day char(2) default '0' not null,
dayofweek char(2) default '0' not null,
run_sql varchar2(4000),
run_tcl varchar2(4000),
email varchar2(255)
);
begin
acs_object_type.create_type (
supertype => 'acs_object',
object_type => 'cronjob',
pretty_name => 'CronJob',
pretty_plural => 'CronJobs',
table_name => 'cronjobs',
id_column => 'cronjob_id'
);
end;
/
show errors;
create or replace package cronjob
as
function cronjob_p (
cronjob_id in cronjobs.cronjob_id%TYPE
) return char;
function new (
cronjob_id in cronjobs.cronjob_id%TYPE default null,
user_id in cronjobs.user_id%TYPE,
description in cronjobs.description%TYPE,
approved_p in cronjobs.approved_p%TYPE default 'f',
disabled_p in cronjobs.disabled_p%TYPE,
minute in cronjobs.minute%TYPE default '0',
hr in cronjobs.hr%TYPE default '0',
mon in cronjobs.mon%TYPE default '0',
day in cronjobs.day%TYPE default '0',
dayofweek in cronjobs.dayofweek%TYPE default '0',
run_sql in cronjobs.run_sql%TYPE default null,
run_tcl in cronjobs.run_tcl%TYPE default null,
email in cronjobs.email%TYPE default null,
object_type in acs_objects.object_type%TYPE default 'cronjob',
creation_date in acs_objects.creation_date%TYPE default sysdate,
creation_user in acs_objects.creation_user%TYPE default null,
creation_ip in acs_objects.creation_ip%TYPE default null,
context_id in acs_objects.context_id%TYPE default null
) return cronjobs.cronjob_id%TYPE;
procedure del (
cronjob_id in cronjobs.cronjob_id%TYPE
);
procedure set_attrs (
cronjob_id in cronjobs.cronjob_id%TYPE,
user_id in cronjobs.user_id%TYPE default null,
description in cronjobs.description%TYPE default null,
approved_p in cronjobs.approved_p%TYPE default null,
disabled_p in cronjobs.disabled_p%TYPE default null,
minute in cronjobs.minute%TYPE default null,
hr in cronjobs.hr%TYPE default null,
mon in cronjobs.mon%TYPE default null,
day in cronjobs.day%TYPE default null,
dayofweek in cronjobs.dayofweek%TYPE default null,
run_sql in cronjobs.run_sql%TYPE default null,
run_tcl in cronjobs.run_tcl%TYPE default null,
email in cronjobs.email%TYPE default null
);
procedure reset_attr (
cronjob_id in cronjobs.cronjob_id%TYPE,
column_name in varchar
);
end cronjob;
/
show errors;
create or replace package body cronjob
as
function cronjob_p (
cronjob_id in cronjobs.cronjob_id%TYPE
) return char
is
-- declare vars here
v_check_cronjob_id integer;
begin
select count(cronjob_id) into v_check_cronjob_id
from cronjobs
where cronjob_id = cronjob_p.cronjob_id;
if v_check_cronjob_id = 1 then
return 't';
else
return 'f';
end if;
end cronjob_p;
-- Context ID May need adjustment to reflect security/access model.
function new (
cronjob_id in cronjobs.cronjob_id%TYPE default null,
user_id in cronjobs.user_id%TYPE,
description in cronjobs.description%TYPE,
approved_p in cronjobs.approved_p%TYPE default 'f',
disabled_p in cronjobs.disabled_p%TYPE,
minute in cronjobs.minute%TYPE default '0',
hr in cronjobs.hr%TYPE default '0',
mon in cronjobs.mon%TYPE default '0',
day in cronjobs.day%TYPE default '0',
dayofweek in cronjobs.dayofweek%TYPE default '0',
run_sql in cronjobs.run_sql%TYPE default null,
run_tcl in cronjobs.run_tcl%TYPE default null,
email in cronjobs.email%TYPE default null,
object_type in acs_objects.object_type%TYPE default 'cronjob',
creation_date in acs_objects.creation_date%TYPE default sysdate,
creation_user in acs_objects.creation_user%TYPE default null,
creation_ip in acs_objects.creation_ip%TYPE default null,
context_id in acs_objects.context_id%TYPE default null
) return cronjobs.cronjob_id%TYPE
is
v_cronjob_id integer;
begin
v_cronjob_id := acs_object.new (
object_id => cronjob_id,
object_type => object_type,
creation_date => creation_date,
creation_user => creation_user,
creation_ip => creation_ip,
context_id => context_id
);
insert into cronjobs
( cronjob_id, user_id, description, approved_p, disabled_p, minute, hr, mon, day, dayofweek, run_sql, run_tcl, email )
values
( v_cronjob_id, user_id, description, approved_p, disabled_p, minute, hr, mon, day, dayofweek, run_sql, run_tcl, email );
return v_cronjob_id;
end new;
procedure del (
cronjob_id in cronjobs.cronjob_id%TYPE
)
is
begin
if cronjob_p(cronjob.del.cronjob_id) = 'f' then
return;
end if;
delete from cronjobs
where cronjob_id = cronjob.del.cronjob_id;
acs_object.del(cronjob_id);
end del;
procedure set_attrs (
cronjob_id in cronjobs.cronjob_id%TYPE,
user_id in cronjobs.user_id%TYPE default null,
description in cronjobs.description%TYPE default null,
approved_p in cronjobs.approved_p%TYPE default null,
disabled_p in cronjobs.disabled_p%TYPE default null,
minute in cronjobs.minute%TYPE default null,
hr in cronjobs.hr%TYPE default null,
mon in cronjobs.mon%TYPE default null,
day in cronjobs.day%TYPE default null,
dayofweek in cronjobs.dayofweek%TYPE default null,
run_sql in cronjobs.run_sql%TYPE default null,
run_tcl in cronjobs.run_tcl%TYPE default null,
email in cronjobs.email%TYPE default null
)
is
-- declared vars here
begin
if cronjob_p(cronjob.set_attrs.cronjob_id) = 'f' then
return;
end if;
-- modify parts that are not null
if user_id is not null then
update cronjobs set user_id = set_attrs.user_id
where cronjob_id = set_attrs.cronjob_id;
end if;
if description is not null then
update cronjobs set description = set_attrs.description
where cronjob_id = set_attrs.cronjob_id;
end if;
if approved_p is not null then
update cronjobs set approved_p = set_attrs.approved_p
where cronjob_id = set_attrs.cronjob_id;
end if;
if disabled_p is not null then
update cronjobs set disabled_p = set_attrs.disabled_p
where cronjob_id = set_attrs.cronjob_id;
end if;
if minute is not null then
update cronjobs set minute = set_attrs.minute
where cronjob_id = set_attrs.cronjob_id;
end if;
if hr is not null then
update cronjobs set hr = set_attrs.hr
where cronjob_id = set_attrs.cronjob_id;
end if;
if mon is not null then
update cronjobs set mon = set_attrs.mon
where cronjob_id = set_attrs.cronjob_id;
end if;
if day is not null then
update cronjobs set day = set_attrs.day
where cronjob_id = set_attrs.cronjob_id;
end if;
if dayofweek is not null then
update cronjobs set dayofweek = set_attrs.dayofweek
where cronjob_id = set_attrs.cronjob_id;
end if;
if run_sql is not null then
update cronjobs set run_sql = set_attrs.run_sql
where cronjob_id = set_attrs.cronjob_id;
end if;
if run_tcl is not null then
update cronjobs set run_tcl = set_attrs.run_tcl
where cronjob_id = set_attrs.cronjob_id;
end if;
if email is not null then
update cronjobs set email = set_attrs.email
where cronjob_id = set_attrs.cronjob_id;
end if;
end set_attrs;
procedure reset_attr (
cronjob_id in cronjobs.cronjob_id%TYPE,
column_name in varchar
)
is
-- declared vars here
begin
if cronjob_p(cronjob.reset_attr.cronjob_id) = 'f' then
return;
end if;
if column_name = 'approved_p' then
update cronjobs set approved_p = 'f'
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'minute' then
update cronjobs set minute = '0'
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'hr' then
update cronjobs set hr = '0'
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'mon' then
update cronjobs set mon = '0'
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'day' then
update cronjobs set day = '0'
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'dayofweek' then
update cronjobs set dayofweek = '0'
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'run_sql' then
update cronjobs set run_sql = NULL
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'run_tcl' then
update cronjobs set run_tcl = NULL
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'email' then
update cronjobs set email = NULL
where cronjob_id = reset_attr.cronjob_id;
end if;
end reset_attr;
end cronjob;
/
show errors;
--
-- Cronjob in sql
-- @author tom jackson <tom@zmbh.com>
-- @creation-date 22 Sept 2001
-- @cvs-id $Id$
--
acs_object_type.drop_type('cronjob');
drop table cronjobs;
drop package cronjob;
--
-- Cronjob in sql
-- @author tom jackson <tom@zmbh.com>
-- @creation-date 22 Sept 2001
-- @cvs-id $Id$
--
create or replace package cronjob
as
function cronjob_p (
cronjob_id in cronjobs.cronjob_id%TYPE
) return char;
function new (
cronjob_id in cronjobs.cronjob_id%TYPE default null,
user_id in cronjobs.user_id%TYPE,
description in cronjobs.description%TYPE,
approved_p in cronjobs.approved_p%TYPE default 'f',
disabled_p in cronjobs.disabled_p%TYPE,
minute in cronjobs.minute%TYPE default '0',
hr in cronjobs.hr%TYPE default '0',
mon in cronjobs.mon%TYPE default '0',
day in cronjobs.day%TYPE default '0',
dayofweek in cronjobs.dayofweek%TYPE default '0',
run_sql in cronjobs.run_sql%TYPE default null,
run_tcl in cronjobs.run_tcl%TYPE default null,
email in cronjobs.email%TYPE default null,
object_type in acs_objects.object_type%TYPE default 'cronjob',
creation_date in acs_objects.creation_date%TYPE default sysdate,
creation_user in acs_objects.creation_user%TYPE default null,
creation_ip in acs_objects.creation_ip%TYPE default null,
context_id in acs_objects.context_id%TYPE default null
) return cronjobs.cronjob_id%TYPE;
procedure del (
cronjob_id in cronjobs.cronjob_id%TYPE
);
procedure set_attrs (
cronjob_id in cronjobs.cronjob_id%TYPE,
user_id in cronjobs.user_id%TYPE default null,
description in cronjobs.description%TYPE default null,
approved_p in cronjobs.approved_p%TYPE default null,
disabled_p in cronjobs.disabled_p%TYPE default null,
minute in cronjobs.minute%TYPE default null,
hr in cronjobs.hr%TYPE default null,
mon in cronjobs.mon%TYPE default null,
day in cronjobs.day%TYPE default null,
dayofweek in cronjobs.dayofweek%TYPE default null,
run_sql in cronjobs.run_sql%TYPE default null,
run_tcl in cronjobs.run_tcl%TYPE default null,
email in cronjobs.email%TYPE default null
);
procedure reset_attr (
cronjob_id in cronjobs.cronjob_id%TYPE,
column_name in varchar
);
end cronjob;
/
show errors;
create or replace package body cronjob
as
function cronjob_p (
cronjob_id in cronjobs.cronjob_id%TYPE
) return char
is
-- declare vars here
v_check_cronjob_id integer;
begin
select count(cronjob_id) into v_check_cronjob_id
from cronjobs
where cronjob_id = cronjob_p.cronjob_id;
if v_check_cronjob_id = 1 then
return 't';
else
return 'f';
end if;
end cronjob_p;
-- Context ID May need adjustment to reflect security/access model.
function new (
cronjob_id in cronjobs.cronjob_id%TYPE default null,
user_id in cronjobs.user_id%TYPE,
description in cronjobs.description%TYPE,
approved_p in cronjobs.approved_p%TYPE default 'f',
disabled_p in cronjobs.disabled_p%TYPE,
minute in cronjobs.minute%TYPE default '0',
hr in cronjobs.hr%TYPE default '0',
mon in cronjobs.mon%TYPE default '0',
day in cronjobs.day%TYPE default '0',
dayofweek in cronjobs.dayofweek%TYPE default '0',
run_sql in cronjobs.run_sql%TYPE default null,
run_tcl in cronjobs.run_tcl%TYPE default null,
email in cronjobs.email%TYPE default null,
object_type in acs_objects.object_type%TYPE default 'cronjob',
creation_date in acs_objects.creation_date%TYPE default sysdate,
creation_user in acs_objects.creation_user%TYPE default null,
creation_ip in acs_objects.creation_ip%TYPE default null,
context_id in acs_objects.context_id%TYPE default null
) return cronjobs.cronjob_id%TYPE
is
v_cronjob_id integer;
begin
v_cronjob_id := acs_object.new (
object_id => cronjob_id,
object_type => object_type,
creation_date => creation_date,
creation_user => creation_user,
creation_ip => creation_ip,
context_id => context_id
);
insert into cronjobs
( cronjob_id, user_id, description, approved_p, disabled_p, minute, hr, mon, day, dayofweek, run_sql, run_tcl, email )
values
( v_cronjob_id, user_id, description, approved_p, disabled_p, minute, hr, mon, day, dayofweek, run_sql, run_tcl, email );
return v_cronjob_id;
end new;
procedure del (
cronjob_id in cronjobs.cronjob_id%TYPE
)
is
begin
if cronjob_p(cronjob.del.cronjob_id) = 'f' then
return;
end if;
delete from cronjobs
where cronjob_id = cronjob.del.cronjob_id;
acs_object.del(cronjob_id);
end del;
procedure set_attrs (
cronjob_id in cronjobs.cronjob_id%TYPE,
user_id in cronjobs.user_id%TYPE default null,
description in cronjobs.description%TYPE default null,
approved_p in cronjobs.approved_p%TYPE default null,
disabled_p in cronjobs.disabled_p%TYPE default null,
minute in cronjobs.minute%TYPE default null,
hr in cronjobs.hr%TYPE default null,
mon in cronjobs.mon%TYPE default null,
day in cronjobs.day%TYPE default null,
dayofweek in cronjobs.dayofweek%TYPE default null,
run_sql in cronjobs.run_sql%TYPE default null,
run_tcl in cronjobs.run_tcl%TYPE default null,
email in cronjobs.email%TYPE default null
)
is
-- declared vars here
begin
if cronjob_p(cronjob.set_attrs.cronjob_id) = 'f' then
return;
end if;
-- modify parts that are not null
if user_id is not null then
update cronjobs set user_id = set_attrs.user_id
where cronjob_id = set_attrs.cronjob_id;
end if;
if description is not null then
update cronjobs set description = set_attrs.description
where cronjob_id = set_attrs.cronjob_id;
end if;
if approved_p is not null then
update cronjobs set approved_p = set_attrs.approved_p
where cronjob_id = set_attrs.cronjob_id;
end if;
if disabled_p is not null then
update cronjobs set disabled_p = set_attrs.disabled_p
where cronjob_id = set_attrs.cronjob_id;
end if;
if minute is not null then
update cronjobs set minute = set_attrs.minute
where cronjob_id = set_attrs.cronjob_id;
end if;
if hr is not null then
update cronjobs set hr = set_attrs.hr
where cronjob_id = set_attrs.cronjob_id;
end if;
if mon is not null then
update cronjobs set mon = set_attrs.mon
where cronjob_id = set_attrs.cronjob_id;
end if;
if day is not null then
update cronjobs set day = set_attrs.day
where cronjob_id = set_attrs.cronjob_id;
end if;
if dayofweek is not null then
update cronjobs set dayofweek = set_attrs.dayofweek
where cronjob_id = set_attrs.cronjob_id;
end if;
if run_sql is not null then
update cronjobs set run_sql = set_attrs.run_sql
where cronjob_id = set_attrs.cronjob_id;
end if;
if run_tcl is not null then
update cronjobs set run_tcl = set_attrs.run_tcl
where cronjob_id = set_attrs.cronjob_id;
end if;
if email is not null then
update cronjobs set email = set_attrs.email
where cronjob_id = set_attrs.cronjob_id;
end if;
end set_attrs;
procedure reset_attr (
cronjob_id in cronjobs.cronjob_id%TYPE,
column_name in varchar
)
is
-- declared vars here
begin
if cronjob_p(cronjob.reset_attr.cronjob_id) = 'f' then
return;
end if;
if column_name = 'approved_p' then
update cronjobs set approved_p = 'f'
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'minute' then
update cronjobs set minute = '0'
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'hr' then
update cronjobs set hr = '0'
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'mon' then
update cronjobs set mon = '0'
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'day' then
update cronjobs set day = '0'
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'dayofweek' then
update cronjobs set dayofweek = '0'
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'run_sql' then
update cronjobs set run_sql = NULL
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'run_tcl' then
update cronjobs set run_tcl = NULL
where cronjob_id = reset_attr.cronjob_id;
end if;
if column_name = 'email' then
update cronjobs set email = NULL
where cronjob_id = reset_attr.cronjob_id;
end if;
end reset_attr;
end cronjob;
/
show errors;
--
-- Cronjob in sql
-- @author tom jackson <tom@zmbh.com>
-- @creation-date 22 Sept 2001
-- @cvs-id $Id$
--
create table cronjobs (
cronjob_id integer not null
constraint cj_cronjob_id_fk references acs_objects(object_id)
constraint cj_cronjob_id_pk primary key,
user_id integer
not null
constraint cj_user_id_fk references users,
description text not null,
approved_p char(1) default 'f'
not null
constraint cj_approved_p_ck check (approved_p in ('f','t')),
disabled_p char(1) default 'f'
not null
constraint cj_disabled_p_ck check (disabled_p in ('f','t')),
minute char(2) default '0'
not null,
hr char(2) default '0'
not null,
mon char(2) default '0'
not null,
day char(2) default '0'
not null,
dayofweek char(2) default '0'
not null,
run_sql text,
run_tcl text,
email text
);
-- DRB: since I had to remove the various "drop" commands that caused install-stopping
-- errors in the APM, I got rid of the inline function that used to surround this call
-- as well. The inline func approach is great when you need to initialize a bunch
-- of things in a single transaction (in order to get a clean rollback on failure) but
-- IMO it just sorta obfuscates the source code if you're just doing a single
-- command. All those ugly double apostrophes that are required, etc...
select acs_object_type__create_type (
'cronjob', -- object_type
'CronJob', -- pretty_name
'CronJobs', -- pretty_plural
'acs_object', -- supertype
'cronjobs', -- table_name
'cronjob_id', -- id_column
null, -- package_name
'f', -- abstract_p
null, -- type_extension_table
null -- name_method
);
create function cronjob__cronjob_p (integer)
returns boolean as $body$
declare
p_cronjob_id alias for $1;
v_check_cronjob_id integer;
begin
select count(cronjob_id) into v_check_cronjob_id
from cronjobs where cronjob_id = p_cronjob_id;
if v_check_cronjob_id = 1 then return true; else return false; end if;
end;$body$ language 'plpgsql';
create function cronjob__new (integer, integer, varchar, char, char, char(2), char(2), char(2), char(2), char(2), text, text, varchar, integer, varchar, integer)
returns integer as $body$
declare
p_cronjob_id alias for $1; p_user_id alias for $2;
p_description alias for $3; p_approved_p alias for $4;
p_disabled_p alias for $5; p_minute alias for $6;
p_hr alias for $7; p_mon alias for $8;
p_day alias for $9; p_dayofweek alias for $10;
p_run_sql alias for $11; p_run_tcl alias for $12;
p_email alias for $13; p_creation_user alias for $14;
p_creation_ip alias for $15; p_context_id alias for $16;
v_cronjob_id cronjobs.cronjob_id%TYPE;
v_object_type acs_objects.object_type%TYPE; -- default 'cronjob'
v_creation_date acs_objects.creation_date%TYPE; -- default now()
begin
v_cronjob_id := acs_object__new (
p_cronjob_id,
'cronjob',
now(),
p_creation_user,
p_creation_ip,
p_context_id
);
insert into cronjobs (
cronjob_id, user_id, description, approved_p,
disabled_p, minute, hr, mon, day, dayofweek, run_sql, run_tcl, email
) values (
v_cronjob_id, p_user_id, p_description, p_approved_p,
p_disabled_p, p_minute, p_hr, p_mon, p_day, p_dayofweek, p_run_sql, p_run_tcl, p_email
);
return v_cronjob_id;
end;$body$ language 'plpgsql';
create function cronjob__delete (integer)
returns integer as $body$
declare
p_cronjob_id alias for $1;
v_return integer := 0;
begin
if not cronjob__cronjob_p(p_cronjob_id) then return v_return; end if;
delete from acs_permissions where object_id = p_cronjob_id;
delete from cronjobs where cronjob_id = p_cronjob_id;
raise NOTICE 'Deleting cronjob...';
return v_return;
end;$body$ language 'plpgsql';
create function cronjob__set_attrs (integer, integer, varchar, char, char, char(2), char(2), char(2), char(2), char(2), text, text, varchar)
returns integer as $body$
declare
p_cronjob_id alias for $1; p_user_id alias for $2;
p_description alias for $3; p_approved_p alias for $4;
p_disabled_p alias for $5; p_minute alias for $6;
p_hr alias for $7; p_mon alias for $8;
p_day alias for $9; p_dayofweek alias for $10;
p_run_sql alias for $11; p_run_tcl alias for $12;
p_email alias for $13;
v_return integer := 0;
begin
if p_user_id is not null then update cronjobs set user_id = p_user_id where cronjob_id = p_cronjob_id; end if;
if p_description is not null then update cronjobs set description = p_description where cronjob_id = p_cronjob_id; end if;
if p_approved_p is not null then update cronjobs set approved_p = p_approved_p where cronjob_id = p_cronjob_id; end if;
if p_disabled_p is not null then update cronjobs set disabled_p = p_disabled_p where cronjob_id = p_cronjob_id; end if;
if p_minute is not null then update cronjobs set minute = p_minute where cronjob_id = p_cronjob_id; end if;
if p_hr is not null then update cronjobs set hr = p_hr where cronjob_id = p_cronjob_id; end if;
if p_mon is not null then update cronjobs set mon = p_mon where cronjob_id = p_cronjob_id; end if;
if p_day is not null then update cronjobs set day = p_day where cronjob_id = p_cronjob_id; end if;
if p_dayofweek is not null then update cronjobs set dayofweek = p_dayofweek where cronjob_id = p_cronjob_id; end if;
if p_run_sql is not null then update cronjobs set run_sql = p_run_sql where cronjob_id = p_cronjob_id; end if;
if p_run_tcl is not null then update cronjobs set run_tcl = p_run_tcl where cronjob_id = p_cronjob_id; end if;
if p_email is not null then update cronjobs set email = p_email where cronjob_id = p_cronjob_id; end if;
return v_return;
end;$body$ language 'plpgsql';
create function cronjob__reset_attr (integer,varchar)
returns integer as $body$
declare
p_cronjob_id alias for $1;
p_column_name alias for $2;
v_return integer := 0;
begin
if p_column_name = 'approved_p' then update cronjobs set approved_p = 'f' where cronjob_id = p_cronjob_id; end if;
if p_column_name = 'disabled_p' then update cronjobs set disabled_p = 'f' where cronjob_id = p_cronjob_id; end if;
if p_column_name = 'minute' then update cronjobs set minute = '0' where cronjob_id = p_cronjob_id; end if;
if p_column_name = 'hr' then update cronjobs set hr = '0' where cronjob_id = p_cronjob_id; end if;
if p_column_name = 'mon' then update cronjobs set mon = '0' where cronjob_id = p_cronjob_id; end if;
if p_column_name = 'day' then update cronjobs set day = '0' where cronjob_id = p_cronjob_id; end if;
if p_column_name = 'dayofweek' then update cronjobs set dayofweek = '0' where cronjob_id = p_cronjob_id; end if;
return v_return;
end;$body$ language 'plpgsql';
select acs_object_type__drop_type('cronjob', 'f');
drop table cronjobs;
drop function cronjob__cronjob_p (integer);
drop function cronjob__new (integer, integer, varchar, char, char, char(2), char(2), char(2), char(2), char(2), text, text, varchar, integer, varchar, integer);
drop function cronjob__delete (integer);
drop function cronjob__set_attrs (integer, integer, varchar, char, char, char(2), char(2), char(2), char(2), char(2), text, text, varchar);
drop function cronjob__reset_attr (integer,varchar);
ad_library {
Initializes cronjob package
@creation-date 22 Sept 2001
@author Tom Jackson <tom@zmbh.com>
@cvs-id $Id$
}
ad_schedule_proc -thread t 60 cronjob_check
if {![info exists qd_write_query_select]} {
ad_proc qd_write_query_select {package attrs} {
<p>Returns Postgresql function with:
<ul>
<li>correctly ordered attributes
<li>defaults filled in for un-supplied attributes.
</ul>
} {
ns_log Debug "Running qd_write_query_select with $package $attrs"
set query [list]
set in_args [list]
set args [concat $attrs]
foreach {attr sign value} $args {
lappend in_args $attr
set attr_array($attr) $value
}
set attrs_and_defaults [eval qd_choose_function $package $in_args]
foreach {attr default_value} $attrs_and_defaults {
# see if attr was passed in with value
if {![info exists attr_array($attr)]} {
if {[string match "" $default_value]} {
ns_log Debug "Attempt to call $package with no value for $attr"
return -code error
}
lappend query $default_value
} else {
lappend query "$attr_array($attr)"
}
}
ns_log Debug "${package}([join $query ",\n"]);"
return "${package}([join $query ",\n"]);"
}
ad_proc qd_add_package {package args} {
<p>Adds a package with all the attributes for every function of the same name.
<p>For example, if you have two functions that could be called
<code>foo(a,b,c)</code> and <code>foo(a,c,d)</code>,
the package would be registered using:
<blockquote>
<pre>
qd_add_package foo a b c d
</pre>
</blockquote>
} {
nsv_set qd_pg_packages $package $args
set n 1
foreach attr $args {
nsv_set $package $attr $n
set n [expr $n * 2]
}
}
ad_proc qd_total_attributes {package attributes} {
<p>Totals the attribute values.
} {
upvar $package package_array
upvar $attributes attrs
set total 0
foreach attribute $attrs {
incr total $package_array($attribute)
ns_log Debug "Adding $package_array($attribute) $total"
}
return $total
}
ad_proc qd_add_function {package args} {
<p>Adds a single function, including defaults to a package.
<p>If one foo function has three attributes: a, b and c, where
a is required and b can be null and c default to 't',
the function would be
registered using:
<blockquote>
<pre>
qd_add_function foo a "" b "null" c "'t'"
</pre>
</blockquote>
} {
# total up the function value.
array set temp_package [nsv_array get $package]
set i 1
foreach {attr default} $args {
lappend attr_list $attr
}
set total [qd_total_attributes temp_package attr_list]
nsv_set ${package}_functions $total $args
}
ad_proc qd_choose_function {package args} {
<p>Used to choose a function based on passed in attributes.
} {
array set temp_package [nsv_array get $package]
set total [qd_total_attributes temp_package args]
if {[nsv_exists ${package}_functions $total]} {
ns_log Debug "Found matching sig: '$total'"
return [nsv_get ${package}_functions $total]
}
set functions [nsv_array names ${package}_functions]
foreach sig $functions {
ns_log Debug "checking sig '$total' against '$sig'"
if {$total == [expr $sig & $total]} {
ns_log Debug "Found match '$total' in '$sig'"
return [nsv_get ${package}_functions $sig]
}
}
return "!NO MATCH: $total not in $functions"
}
proc qd_write_query {package args} {
set query [list]
set attrs_and_defaults [eval qd_choose_function $package $args]
foreach {attr default_value} $attrs_and_defaults {
if {[lsearch $args $attr] < 0 } {
if {[string match "" $default_value]} {
ns_log Debug "Attempt to call $package with no value for $attr"
return -code error
}
lappend query $default_value
} else {
lappend query ":${attr}"
}
}
return [join $query ",\n"]
}
proc qd_write_query_upvar {package listvar} {
set query [list]
upvar $listvar args
set attrs_and_defaults [eval qd_choose_function $package $args]
if {[string match "!NO MATCH:*" $attrs_and_defaults ]} {
ns_log Debug "$attrs_and_defaults"
return -code error
}
foreach {attr default_value} $attrs_and_defaults {
if {[lsearch $args $attr] < 0 } {
if {[string match "" $default_value]} {
ns_log Debug "Attempt to call $package with no value for $attr"
return -code error
}
lappend query $default_value
} else {
lappend query ":${attr}"
}
}
return [join $query ",\n"]
}
}
qd_add_package cronjob__new cronjob_id user_id description approved_p disabled_p minute hr mon day dayofweek run_sql run_tcl email creation_user creation_ip context_id
qd_add_function cronjob__new "cronjob_id" "null" "user_id" "" "description" "" "approved_p" "'f'" "disabled_p" "'f'" "minute" "'0'" "hr" "'0'" "mon" "'0'" "day" "'0'" "dayofweek" "'0'" "run_sql" "" "run_tcl" "" "email" "" "creation_user" "null" "creation_ip" "null" "context_id" "null"
qd_add_package cronjob__set_attrs "cronjob_id" "user_id" "description" "approved_p" "disabled_p" "minute" "hr" "mon" "day" "dayofweek" "run_sql" "run_tcl" "email"
qd_add_function cronjob__set_attrs "cronjob_id" "" "user_id" "null" "description" "null" "approved_p" "null" "disabled_p" "'f'" "minute" "null" "hr" "null" "mon" "null" "day" "null" "dayofweek" "null" "run_sql" "null" "run_tcl" "null" "email" "null"
qd_add_package cronjob__delete cronjob_id
qd_add_function cronjob__delete cronjob_id ""
ad_library {
Cronjob support procs
@author Tom Jackson <tom@junom.com>
@creation-date 22 Sept 2001
@cvs-id $Id$
}
ad_proc cronjob_check { } {
Checks the database for cronjobs that need to run
} {
# setup the vars
set time [ns_time]
set minute [ns_fmttime $time %M]
set hr [ns_fmttime $time %H]
set mon [ns_fmttime $time %m]
set day [ns_fmttime $time %d]
set dayofweek [ns_fmttime $time %w]
db_foreach cronjob_sched_foreach "" {
ad_schedule_proc -once t -thread t 1 cronjob_run $cronjob_id
}
}
ad_proc cronjob_run { cronjob_id } {
Proc to run cronjobs
} {
# To avoid errors
set rownum 0
set table "No SQL"
ns_log Debug "Cronjob_id is $cronjob_id $rownum"
db_1row cronjob_query {}
db_release_unused_handles
if {![string match "" $run_sql]} {
set rownum 0
set table "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">"
db_foreach cronjob_run_sql $run_sql -column_set row {
set size [ns_set size $row]
if {$rownum == 0} {
for {set i 0 } {$i < $size} {incr i} {
append table "\n<th>[ns_set key $row $i]</th>"
}
}
append table "<tr>"
for {set i 0 } {$i < $size} {incr i} {
append table "\n<td>[ns_set value $row $i]</td>"
}
append table "</tr>"
incr rownum
}
}
append table "</table>"
if {$rownum == 0} {
set table "No Rows Returned"
}
# evaluate the run_tcl code
eval $run_tcl
if {![string match "" $email]} {
ns_log Debug "sending cronjob email to $email"
acs_mail_lite::send -to_addr $email -from_addr [ad_host_administrator] \
-subject "Cronjob $cronjob_id" \
-body "Description: <br>$description<br> $table" \
-extraheaders [list [list "Content-Type" "text/html"]]
}
return
}
<?xml version="1.0"?>
<queryset>
<fullquery name="cronjob_check.cronjob_sched_foreach">
<querytext>
select cronjob_id
from cronjobs
where disabled_p = 'f'
and approved_p = 't'
and ((minute = :minute) or (minute = '*'))
and ((hr = :hr ) or (hr = '*'))
and ((mon = :mon ) or (mon = '*'))
and ((day = :day ) or (day = '*'))
and ((dayofweek = :dayofweek ) or (dayofweek = '*'))
</querytext>
</fullquery>
<fullquery name="cronjob_run.cronjob_query">
<querytext>
select description, run_sql, run_tcl, email
from cronjobs
where cronjob_id = :cronjob_id
</querytext>
</fullquery>
</queryset>
<?xml version="1.0"?>
<queryset>
<rdbms><type>oracle</type><version>8.1.6</version></rdbms>
<fullquery name="add_cronjob">
<querytext>
declare v_cronjob_id integer;
begin
v_cronjob_id := cronjob.new(
user_id => :user_id,
description => :description,
approved_p => :approved_p,
disabled_p => :disabled_p,
minute => :minute,
hr => :hr,
mon => :mon,
day => :day,
dayofweek => :dayofweek,
run_sql => :run_sql,
run_tcl => :run_tcl,
email => :email);
end;
</querytext>
</fullquery>
</queryset>
<?xml version="1.0"?>
<queryset>
<rdbms><type>postgresql</type><version>7.1</version></rdbms>
<fullquery name="add_cronjob">
<querytext>
select [qd_write_query_select cronjob__new {
user_id => :user_id
description => :description
approved_p => :approved_p
disabled_p => :disabled_p
minute => :minute
hr => :hr
mon => :mon
day => :day
dayofweek => :dayofweek
run_sql => :run_sql
run_tcl => :run_tcl
email => :email } ]
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Cronjobs Add Page 2
@author tom@junom.com
@creation-date 22 Sept 2001
@cvs-id $Id$
} {
description:trim,notnull,html
minute:notnull,trim
hr:notnull,trim
mon:notnull,trim
day:notnull,trim
dayofweek:notnull,trim
run_sql:trim,allhtml
run_tcl:trim,html
email:trim
}
set user_id [ad_maybe_redirect_for_registration]
set approved_p "f"
set disabled_p "t"
db_exec_plsql add_cronjob {}
ad_returnredirect cronjobs
<?xml version="1.0"?>
<queryset>
<rdbms><type>oracle</type><version>8.1.6</version></rdbms>
<fullquery name="edit_cronjob">
<querytext>
begin
cronjob.del(cronjob_id => :cronjob_id);
end;
</querytext>
</fullquery>
</queryset>
<?xml version="1.0"?>
<queryset>
<rdbms><type>postgresql</type><version>7.1</version></rdbms>
<fullquery name="edit_cronjob">
<querytext>
select [qd_write_query_select cronjob__delete {
cronjob_id => :cronjob_id } ]
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Cronjob Delete
@author tom@junom.com
@creation-date 22 Sept 2001
@cvs-id $Id$
} {
cronjob_id:integer,trim,notnull
}
db_exec_plsql edit_cronjob {}
ad_returnredirect cronjobs
<?xml version="1.0"?>
<queryset>
<rdbms><type>oracle</type><version>8.1.6</version></rdbms>
<fullquery name="edit_cronjob">
<querytext>
begin
cronjob.set_attrs(
cronjob_id => :cronjob_id,
description => :description,
approved_p => :approved_p,
disabled_p => :disabled_p,
minute => :minute,
hr => :hr,
mon => :mon,
day => :day,
dayofweek => :dayofweek,
run_sql => :run_sql,
run_tcl => :run_tcl,
email => :email);
end;
</querytext>
</fullquery>
</queryset>
<?xml version="1.0"?>
<queryset>
<rdbms><type>postgresql</type><version>7.1</version></rdbms>
<fullquery name="edit_cronjob">
<querytext>
select [qd_write_query_select cronjob__set_attrs {
cronjob_id => :cronjob_id
description => :description
approved_p => :approved_p
disabled_p => :disabled_p
minute => :minute
hr => :hr
mon => :mon
day => :day
dayofweek => :dayofweek
run_sql => :run_sql
run_tcl => :run_tcl
email => :email } ]
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Cronjobs Edit Page 2
@author tom@junom.com
@creation-date 22 Sept 2001
@cvs-id $Id$
} {
cronjob_id:integer,trim,notnull
{description:trim,html ""}
{minute:trim ""}
{hr:trim ""}
{mon:trim ""}
{day:trim ""}
{dayofweek:trim ""}
{run_sql:trim,allhtml ""}
{run_tcl:trim ""}
{email:trim ""}
{approved_p:trim ""}
{disabled_p:trim ""}
}
db_exec_plsql edit_cronjob {}
ad_returnredirect cronjobs
ad_page_contract {
Run Cronjob
@author tom@zmbh.com
@creation-date 22 Sept 2001
@cvs-id $Id$
} {
cronjob_id:integer,trim,notnull
}
ad_schedule_proc -once t -thread t 1 cronjob_run $cronjob_id
ad_returnredirect cronjobs
<master>
<property name="title">@page_title@</property>
<property name="context">@context@</property>
<h3>@page_title@</h3>
<a href="cronjob-delete?cronjob_id=@cronjob_id@">Delete this cronjob</a>
<form action="cronjob-edit" method="post">
<input type="hidden" name="cronjob_id" value="@cronjob_id@">
<table cellspacing="0" cellpadding="2" border="1">
<tr>
<th align="left">Description</th>
<td>
<textarea cols="60" rows="4" name="description" wrap="absolute">@description@</textarea>
<td>
</tr>
<tr><th align="left">Enabled</th>
<td><select name="disabled_p">
<option value="f" <if @disabled_p@ eq f>selected</if>>Enabled</option>
<option value="t" <if @disabled_p@ eq t>selected</if>>Disabled</option>
</select></td>
</tr>
<tr><th align="left">Approved</th>
<td><select name="approved_p">
<option value="t" <if @approved_p@ eq t>selected</if>>Approved</option>
<option value="f" <if @approved_p@ eq f>selected</if>>Not Approved</option>
</select></td>
</tr>
<tr>
<th align="left">Minute (0-59)</th>
<td>
<select name="minute">
@minute_option;noquote@
</select><td></tr>
<tr>
<th align="left">Hour (0-23)</th><td>
<select name="hr">
@hour_option;noquote@
</select><td></tr>
<tr>
<th align="left">Month (1-12)</th><td>
<select name="mon">
@month_option;noquote@
</select><td></tr>
<tr>
<th align="left">Day (1-31)</th><td>
<select name="day">
@day_option;noquote@
</select><td></tr>
<tr>
<th align="left">Day of Week</th><td>
<select name="dayofweek">
@dayofweek_option;noquote@
</select><td></tr>
<tr>
<th align="left">SQL to Run</th>
<td>
<textarea cols="80" rows="10" name="run_sql" wrap="absolute">@run_sql@</textarea>
<td></tr>
<tr>
<th align="left">Tcl Code to Run</th>
<td>
<textarea cols="60" rows="4" name="run_tcl" wrap="absolute">@run_tcl@</textarea>
<td></tr>
<tr>
<th align="left">Email Address</th>
<td><input type="text" name="email" value="@email@" size="60">
<td></tr>
<tr>
<th colspan="2"><input type="submit" value="Update Cronjob"></th>
</tr>
</table>
</form>
<a href="cronjob-run-now?cronjob_id=@cronjob_id@">Run This CronJob Now</a>
ad_page_contract {
Cronjobs List and Add Page
@author tom@junom.com
@creation-date 22 Sept 2001
@cvs-id $Id$
} {
cronjob_id:integer,notnull
} -properties {
page_title:onevalue
context:onevalue
hour_option:onevalue
minute_option:onevalue
month_option:onevalue
day_option:onevalue
dayofweek_option:onevalue
}
set page_title "One Cronjob"
set context [list [list "cronjobs" Cronjobs ] "One Cronjob"]
set hour_option ""
set minute_option ""
set month_option ""
set day_option ""
set dayofweek_option ""
db_1row cronjob_query ""
set dayofweek [string trim $dayofweek]
foreach {value name} [list "\*" "Every Month" 01 January 02 February 03 March 04 April 05 May 06 June 07 July 08 August 09 September 10 October 11 November 12 December] {
if {[string match $mon $value]} {
append month_option "
<option value=\"$value\" selected >$name</option>"
} else {
append month_option "
<option value=\"$value\">$name</option>"
}
}
foreach {value name} [list "\*" "Every Day of Week" 0 Sunday 1 Monday 2 Tuesday 3 Wednesday 4 Thursday 5 Friday 6 Saturday] {
if {"$dayofweek" eq "$value"} {
append dayofweek_option "
<option value=\"$value\" selected >$name</option>"
} else {
append dayofweek_option "
<option value=\"$value\">$name</option>"
}
}
foreach {value name} [list "\*" "Every Day" 01 1 02 2 03 3 04 4 05 5 06 6 07 7 08 8 09 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31] {
if {[string match $day $value]} {
append day_option "
<option value=\"$value\" selected >$name</option>"
} else {
append day_option "
<option value=\"$value\">$name</option>"
}
}
foreach {value name} [list "\*" "Every Hour" 00 0 01 1 02 2 03 3 04 4 05 5 06 6 07 7 08 8 09 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23] {
if {[string match $hr $value]} {
append hour_option "
<option value=\"$value\" selected >$name</option>"
} else {
append hour_option "
<option value=\"$value\">$name</option>"
}
}
foreach {value name} [list "\*" "Every Minute" \
00 0 01 1 02 2 03 3 04 4 05 5 06 6 07 7 08 8 09 9 10 10\
11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20\
21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30\
31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40\
41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50\
51 51 52 52 53 53 54 54 55 55 56 56 57 57 58 58 59 59 ] {
if {[string match $minute $value]} {
append minute_option "
<option value=\"$value\" selected >$name</option>"
} else {
append minute_option "
<option value=\"$value\">$name</option>"
}
}
ad_return_template
<?xml version="1.0"?>
<queryset>
<fullquery name="cronjob_query">
<querytext>
select *
from cronjobs
where cronjob_id = :cronjob_id
</querytext>
</fullquery>
</queryset>
<master>
<property name="title">@page_title@</property>
<property name="context">@context@</property>
<h3>@page_title@</h3>
<if @cronjobs:rowcount@ eq 0>
No jobs present.
</if>
<else>
<table cellspacing="0" cellpadding="2" border="1">
<tr>
<th>Cronjob</th>
<th>Schedule</th>
<th>Approved</th>
<th>Enabled</th>
<th width="300">Description</th>
</tr>
<multiple name="cronjobs">
<tr>
<td><a href="cronjob?cronjob_id=@cronjobs.cronjob_id@">
@cronjobs.cronjob_id@ :: @cronjobs.user_id@ </a></td>
<td>@cronjobs.minute@
@cronjobs.hr@
@cronjobs.mon@
@cronjobs.day@
@cronjobs.dayofweek@ </td>
<td><if @cronjobs.approved_p@ eq t>Approved</if><else>Not Approved</else></td>
<td><if @cronjobs.disabled_p@ eq t>Disabled</if><else>Enabled</else></td>
<td>@cronjobs.description@</td></tr>
</multiple>
</table>
</else>
<h3>Add New Cronjob</h3>
<form action="cronjob-add" method="post">
<table cellspacing="0" cellpadding="2" border="1">
<tr>
<th align="left">Description</th>
<td>
<textarea cols="60" rows="4" name="description" wrap="absolute"></textarea>
<td></tr>
<tr>
<th align="left">Minute (0-59)</th>
<td>
<select name="minute">
<option value="*">Every Minute</option>@minute_option;noquote@
</select><td></tr>
<tr>
<th align="left">Hour (0-23)</th><td>
<select name="hr">
<option value="*">Every Hour</option>@hour_option;noquote@
</select><td></tr>
<tr>
<th align="left">Month (1-12)</th><td>
<select name="mon">
<option value="*">Every Month</option>@month_option;noquote@
</select><td></tr>
<tr>
<th align="left">Day (1-31)</th><td>
<select name="day">
<option value="*">Every Day</option>@day_option;noquote@
</select><td></tr>
<tr>
<th align="left">Day of Week</th><td>
<select name="dayofweek">
<option value="*">Every Day of Week</option>@dayofweek_option;noquote@
</select><td></tr>
<tr>
<th align="left">SQL to Run</th>
<td>
<textarea cols="60" rows="4" name="run_sql" wrap="absolute"></textarea>
<td></tr>
<tr>
<th align="left">Tcl Code to Run</th>
<td>
<textarea cols="60" rows="4" name="run_tcl" wrap="absolute"></textarea>
<td></tr>
<tr>
<th align="left">Email Address</th>
<td><input type="text" name="email" value="" size="60">
<td></tr>
<tr>
<th colspan="2"><input type="submit" value="Enter Cronjob"></th>
</tr>
</table>
</form>
ad_page_contract {
Cronjobs List and Add Page
@author tom@zmbh.com
@creation-date 22 Sept 2001
@cvs-id $Id$
} -properties {
page_title:onevalue
context:onevalue
hour_option:onevalue
minute_option:onevalue
month_option:onevalue
day_option:onevalue
dayofweek_option:onevalue
}
set page_title "Cronjobs List and Add Page"
set context [list "Cronjobs"]
set hour_option ""
set minute_option ""
set month_option ""
set day_option ""
set dayofweek_option ""
foreach {value name} [list 01 January 02 February 03 March 04 April 05 May 06 June 07 July 08 August 09 September 10 October 11 November 12 December] {
append month_option "
<option value=\"$value\">$name</option>"
}
foreach {value name} [list 0 Sunday 1 Monday 2 Tuesday 3 Wednesday 4 Thursday 5 Friday 6 Saturday] {
append dayofweek_option "
<option value=\"$value\">$name</option>"
}
for {set i 1} {$i < 32} {incr i} {
append day_option "
<option value=\"[format %-2.2d $i]\">$i</option>"
}
for {set i 0} {$i < 24} {incr i} {
append hour_option "
<option value=\"[format %-2.2d $i]\">$i</option>"
}
append minute_option $hour_option
for {} {$i < 60} {incr i} {
append minute_option "
<option value=\"[format %-2.2d $i]\">$i</option>"
}
db_multirow cronjobs cronjobs_query ""
ad_return_template
<?xml version="1.0"?>
<queryset>
<fullquery name="cronjobs_query">
<querytext>
select *
from cronjobs
order by user_id, cronjob_id
</querytext>
</fullquery>
</queryset>
# $Id$
ad_returnredirect "cronjobs"
<master>
<property name="title">@title@</property>
<property name="context">@context@</property>
<p>This package has no user pages.</p>
<if @admin_p@ eq 1>
[ <a href="admin/">Administer</a> ]
</if>
\ No newline at end of file
ad_page_contract {
A place holder for access to the admin pages.
@author Bart Teeuwisse <bart.teeuwisse@7-sisters.com>
@cvs-id $Id$
@creation-date Oct 2002
} {
} -properties {
title:onevalue
context:onevalue
}
# Authenticate the user
set user_id [ad_maybe_redirect_for_registration]
# Check for admin privileges
set package_id [ad_conn package_id]
set admin_p [ad_permission_p $package_id admin]
# Get the name of the package
if {[db_0or1row get_package_name ""]} {
set title "$instance_name"
} else {
set title "Cronjob"
}
# Set the context bar.
set context [list]
<?xml version="1.0"?>
<queryset>
<fullquery name="get_package_name">
<querytext>
select p.instance_name
from apm_packages p, apm_package_versions v
where p.package_id = :package_id
and p.package_key = v.package_key
and v.enabled_p = 't'
</querytext>
</fullquery>
</queryset>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment