Forum OpenACS Development: Adding comments to ADP pages in the www directory?

I have read several threads on this issue but don't think that I have a concrete solution.  I would like to be able to add comments to adp pages that are in the www directory and thus do not have an object_id to pass to the general-comments package.  I have looked at the static-pages package and understand it should be a good solution but have not managed to make it work properly yet. I have edited the sp_sync_cr_with_filesystem call in the fs-scan-progress.tcl file to include the regex \.html?$|\.adp$ so it can index these files I believe I will also need to modify the handler for adp pages but I am not really sure where to head from here or how to modify that handeler.  And if modified will that cause other problems?  I still am not sure this is the best answer to the problem. The other solutions that I have thought about are:
a) creating my own object that takes only the url as a parameter and passing that object_id to the general comments package
b)Dumping all of the files from the www package and dumping them in a new package foo so they would have object_id (this is less desireable but could be done)

Thanks in advance for any comments or sugestions.

Collapse
Posted by Trenton Cameron on
After talking with Roberto I decided that it would be a good idea to create a ADP package to handle creating an object ID so that I could pass it to the general-comments package part of the reason for this logic is that I am using tcl/adp pairs.
I have called the package SDL-ADP (I work for SDL) any how when I try to create an object of this type I get the error

ora8.c:3568:ora_tcl_command: error in `OCIStmtExecute ()': ORA-06550: line 4, column 13:
PLS-00905: object TRENTORACLE.SDL is invalid
ORA-06550: line 4, column 7:
PL/SQL: Statement ignored

the create statement that I am using is

begin
  acs_object_type.create_type (
    supertype    => 'acs_object',
    object_type  => 'adppage',
    pretty_name  => 'AdpPage',
    pretty_plural => 'AdpPages',
    table_name    => 'ADPPAGE',
    id_column    => 'PAGE_ID'
  );
end;
/
show errors;

declare
attr_id acs_attributes.attribute_id%TYPE;
begin
  attr_id := acs_attribute.create_attribute (
    object_type    => 'adppage',
    attribute_name => 'URL',
    pretty_name    => 'URL',
    pretty_plural  => 'URLs',
    datatype      => 'string'
  );
end;
/
show errors;

create table adppage (
    page_id    integer references acs_objects(object_id) primary key,
    owner_id  integer references users(user_id),
    url        varchar(255) not null
)

create or replace package sdl-adp
as
  function new (
    page_id            in adppage.page_id%TYPE default null,
    owner_id            in adppage.owner_id%TYPE default null,
    url                in adppage.url%TYPE,
    object_type        in acs_object_types.object_type%TYPE default 'adppage',
    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 adppage.page_id%TYPE;

  procedure delete (
    page_id      in adppage.page_id%TYPE
  );
end sdl-adp;
/
show errors

create or replace package body sdl-adp
as

  function new (
    page_id            in adppage.page_id%TYPE default null,
    owner_id            in adppage.owner_id%TYPE default null,
    url                in adppage.url%TYPE,
    object_type        in acs_object_types.object_type%TYPE default 'adppage',
    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 adppage.page_id%TYPE
  is
    v_page_id integer;
  begin
    v_page_id := acs_object.new (
      object_id    => page_id,
      object_type  => object_type,
      creation_date => creation_date,
      creation_user => creation_user,
      creation_ip  => creation_ip,
      context_id    => context_id
    );

    insert into adppage
    (page_id, owner_id, url)
    values
    (v_page_id, owner_id, url);

    return v_page_id;
  end new;

  procedure delete (
    page_id      in adppage.page_id%TYPE
  )
  is
  begin
    delete from adppage
    where page_id = adppage.delete.page_id;

    acs_object.delete(page_id);
  end delete;

end sdl-adp;
/
show errors;

and the tcl code that is calling it is

set url_list [list url www.here.com]
set new_id [package_instantiate_object  -package_name sdl-adp -var_list $url_list adppage]

Any help would be greatly appreciated this is the first object that I have created and I am sure I am making some small fundimental mistake.  The basis for my code was the notes example.  Thanks again

  -Trent

Collapse
Posted by Roberto Mello on
I don't know what the error means exactly. I glanced through your code and it seems to be correct.

Try separating the statements into separate files and loading them individually to see if you can spot the problem more easily.

Also, don't forget that http://tahiti.oracle.com/ is your friend (you can search for those erros codes).

On a separate note, the convention in ACS is to use underscores to separate names, not the UpperLowerDrivesYouNuts convention. But it's up to you of course.

-Roberto