Forum OpenACS Development: Re: Calendar Create

Collapse
4: Re: Calendar Create (response to 3)
Posted by Iuri Sampaio on
Hi Gustaf,
Indeed, the best way would be to pass the creator of the content item. However, I hit the problem, because of a constraint in calendar pkg: The owner must be one, and only one, personal calendar.

Thus, I have to option:
1. Create a fictitious party and party_type;
2. Remove calendar constraint;

So far, I opted for solution 1. However, I'm going to study more the scenario, then I can have better and more enlightening ideas.

p.s. Attachment is not a solution because, by definition, the content item will never have an attachment.

Collapse
5: Re: Calendar Create (response to 4)
Posted by Iuri Sampaio on
Database operation "0or1row" failed (exception NSINT, "Query returned more than one row.")

SQL:
select calendar_id
from calendars
where owner_id = '698'
and private_p = 't'

while executing
"ns_pg_bind 0or1row nsdb0 {
select calendar_id

Collapse
6: Re: Calendar Create (response to 5)
Posted by Gustaf Neumann on
Don't define the calendar as private. The definition of "private calendars" in the calendar package is not great. The baseline assumption there is that the owner has just one private calendar.

There is no definition in OpenACS that states that "the content item will never have an attachment". The basic attachment API is designed for attaching/detaching arbitrary objects to other arbitrary objects (see table definition below), while some other parts of the API and the web-interface assume content from the content repository/file storage. You should be able to use at least attach/unattach.

-gn

          Table "public.attachments"
   Column   |  Type   |       Modifiers       
------------+---------+-----------------------
 object_id  | integer | not null
 item_id    | integer | not null
 approved_p | boolean | not null default true
Indexes:
    "attachments_pk" PRIMARY KEY, btree (object_id, item_id)
    "attachments_item_id_idx" btree (item_id)
Foreign-key constraints:
    "attachments_item_id_fk" FOREIGN KEY (item_id) REFERENCES acs_objects(object_id) ON DELETE CASCADE
    "attachments_object_id_fk" FOREIGN KEY (object_id) REFERENCES acs_objects(object_id) ON DELETE CASCADE