Forum OpenACS Q&A: Personal/Corporate Calendar in ACS

Collapse
Posted by Leif Jensen on
Hi,

    I have successfully installed the OpenACS without too
    much trouble 😊.

    I am investigating the possibility for using ACS for
    personal and corporate use. In this respect a very
    important feature is the use of a personal/corporate
    calendar for booking meeting rooms, making sure
    everybody can attend, the secretary must easily be able
    to book meetings for others, check where they are, etc. I
    haven't been able to figure out (yet) if this is part of the
    intranet part of ACS. Could someone please explain to
    me how if it is, or does anyone have a module doing
    this?

    Greetings
Collapse
Posted by Don Baccus on
Ben and I were at arsDigita two-three weeks ago, and Adam Farkas
kindly booked us a room using the aD web-based booking
module/corporate calendaring module.

Which is NOT part of the ACS at this point.

We were kinda going like "hey, why hasn't this been released, people
would love this" and the response was that no one had had time to do so.

You might ask your question over at web/db, though since several aD
folk (including Adam) monitor this forum we might get a response here.

If aD were to make the code available, but not neatly packaged up etc,
perhaps a volunteer could be found to port it and integrate it with
the existing OpenACS release?

(hint hint to all concerned)

Collapse
Posted by Adam Farkas on
I'll see what I can do 😊
Collapse
Posted by Adam Farkas on
ok, by popular demand the room reservation system has been made available at:

http://www.arsdigita.com/acs-repository/one-version?version_id=886

it's designed for ACS 3.4, and is in APM format.

To use it, just gunzip the APM & take a look at the code that lies beneath.

good luck!

Collapse
Posted by Leif Jensen on
Thanks, I'll have a look and see what I can find out. Sounds great. Does this also include several peoples commen/individual personal calendars?
Collapse
Posted by Leif Jensen on
Sorry, I should have taken a look at the room-reservation before asking the last question. I guess the calendar package is just what I was looking for too 😉.
Collapse
Posted by Don Baccus on
There is already a calendar module in OpenACS.  You can set up group,
public and user calendar categories in the datamodel.  The admin UI
doesn't fully support the datamodel, however (wasn't quite there in
ACS Classic 3.2, I guess).  However, it doesn't take much work to set
up a simple UI to set up the various kinds of calendar events.

There's also an easy-to-use calendar drawing widget that takes an
ns_set of julian date keys and HTML values, parameters for background
and foreground colors, day headers, etc etc etc.

With a little work you can set up a simple calendar which displays
shared and private calendar dates tailored to the individual user.

I assume that the room reservation system uses the calendar module to
store reservation dates, but haven't looked at the code so could be
wrong.  The calendar module itself does no scheduling or similar work,
it is truly just a simple calendar tool.

If you look into the room reservation system, be warned that OpenACS
doesn't support the 3.4 APM tools.  You'll have to unpackge it to port
it.  This shouldn't be hard.

Of course, our 4.1 version will fully support the APM system.

Collapse
Posted by Leif Jensen on
I'm a little confused. First I thought that you guys were refering to the standard calendar thing in OpenACS, but as far as I can tell this is an 'upcomming calendar' !? (Is this right Don?) Then from Adams writing I got hold of the .apm calendar module and had a look. This seems to be what I wanted (plus the room-reservation package). So I had a look on trying to convert it. I am not an oracle expert, but the first part went OK, but then I stumbled over the 'create procedure'. This made me get hold of the description of converting oracle-to-pg. Unfortunately, there is no mentioning of 'create procedure'. Does this have to be converted into some .tcl script? in which case I am in bad shape, since I am not very good at Tcl/Tk.
Collapse
Posted by Dan Wickstrom on
Procedures and functions are basically the same thing.  In oracle, procedures don't return a value, whereas functions do.  Ususally we just port oracle procedures to postgresql functions and return a dummy value which is ignored.
Collapse
Posted by Leif Jensen on
Hi again,

  I feel I am on deep water here. I have been trying to convert the ACS (personal) calendar .apm package to OpenACS-3.2.4. I think I got the .sql right and I am now trying to get the tcl's running. After some tweeking, I got the initial .tcl's to load into the server at start-up, but I constantly run into 'command not found' when trying to load the calendar's index.tcl. Is there anywhere documented the differencies (HowToPort...) between ACS and OpenACS-3.2.4 ? Or am I just doing something plain stupid ? 😟.
Collapse
Posted by Vinod Kurup on
Does it tell you which commands are not found?

When the tcl file is sourced at startup, does it load gracefully or are there any errors reported?

Collapse
Posted by Leif Jensen on
Well, first I had the problem of 'ad_library' not found when starting the server. I found this from the standard ACS distribution and included this in some of the start-up files for OpenACS, but I had to modify it sligthly (something about 'too many parameters'). Then I got the server to load withuot errors. Next, when I accessed the .../calendar/index.tcl, I got 'ad_package.....' not found. In desparation I found the places where it was called, which I commented out. The one I have right now is 'db_1row' not found. I suspect that I have made some wrong descission during this fight, hence the question about a HowTo...
Collapse
Posted by Don Baccus on
The problem is that you've picked up either an ACS 3.4 or ACS 4.0
calendar package.  Probably a 3.4, and absolutely a 3.4 if I
understand correctly just what you downloaded.

OpenACS 3.2 predates the arsDigita Package Manager (apm), so doesn't
have any of the package stuff in it.  You have a couple of options,
rip out the package stuff, or wait until we get the ACS 4 core ported
and rewrite the package as an ACS 4 package.

I realize this isn't a very satisfactory answer, you've caught us at a
point where our initial port is obsolete and our future port only just
about to start (hey, it's Feb 3, and we said we'd start Feb 1, we
gotta get going here).

Collapse
Posted by Vinod Kurup on
I suspect that I have made some wrong descission during this fight, hence the question about a HowTo...

I just downloaded the .apm file and took a look. The major issue is that it's an ACS 3.4.x package and OpenACS is based on 3.2.x. Between those versions, ACS added the package management stuff as well as some new database-access stuff.

So, I don't think you've done anything wrong - you're on the right track. Basically you need to look at each command that is not found and decide if it's needed. If so, you need to figure out how to port it to 3.2.4. As far as I know, there isn't a HOWTO on this, but I'm happy to help here, where I can.

1) ad_library - it looks like this is a documentation routine. Since it's not present in any of the other files in the /web/$openacs-server/tcl directory, I would just delete this call.

2) ad_page_contract - this function specifies the form variables that the page should expect and sets them. It does some documentation stuff as well. You should be able to delete this call and replace it by the simple set_the_usual_form_variables 0. Be aware that this call may do some error-checking as well, so you may need to validate the input yourself. Also, it's a good idea to document what variables you expect in the form.

3) db_1row - This is from the new database access api. Look at this document for some background info. You'll need to convert all the calls starting with db_ to the ns_db equivalent. Plus, you'll need to do your own handle management. So, I would do ...

set db [ns_db gethandle] # now you got a handle. send this to all your db calls in this file ... ns_db 1row $db $sql_query ... # done with db stuff - release your handle ns_db releasehandle $db

Hopefully, this will get you started. Good luck!

Collapse
Posted by Leif Jensen on
Thanks to Don and Vinod for your comments and suggestions. Don, I am really looking forward to the 4.x port, but I doubt that it is an option for me, since I have to do a demo of the calendar stuff within not too long. What kind of timeframe do you anticipate for the 4.x port? Vinod, I continued following your suggestions and got some more running, but with some trouble since I don't know the ACS philosophy up front and I am not too keen on tcl. But I got all the db_1row calls converted including gethandle/releasehandle. Now I got into trouble with the (oracle) to_date function. What would be the PostgreSQL equivalent?
Collapse
Posted by Leif Jensen on
I am still fighting this conversion issue. I have quite a lot working now, thanks to Don and Vinod. I have, however, run into a new problem (I guess this is again because of 3.2.x <-> 3.4.x). In some of the calendar functions (defined as ad_proc) there is a -public or -private, which is not part of the 3.2.x ad_proc definition. Where do I find documentation on exactly what it means and how I can implement/convert such functions?
Collapse
Posted by Leif Jensen on
I almost forgot one more question:

        set item_id [db_exec_plsql cal_ins_item_on_id_table "
        BEGIN
        :1 := cal_ins_item_on_id_table(:on_which_table, :on_what_id,
        $start_date_sql, $end_date_sql,
        :title, :user_id, :group_id, :description, :html_p,
        :related_link_url, :related_link_text, :redirect_to_related_link_p,
        :creator_id, :editable_p);
        END;
        "]

Will this work in 3.2.x or do I have to implement some plsql function?

Collapse
Posted by Dan Wickstrom on
I haven't compared the difference between the ad_proc used in openacs 3.2.x and later versions of acs classic, but I think the -public and -private switches can be removed when porting. It sounds like they are just used to declare whether the function should be used internally in the tcl library or whether it is part of the public api which can be used by other modules. They might have some code in ad_proc that adds error checking code so that if a -private function is called from another module it will throw an error.

As far as the db_exec_plsql call, you are correct. You need to port "cal_ins_item_on_id_table" and then you can call it like this:

set item_id [database_to_tcl_string "select cal_ins_item_on_id_table(....)"]

You will also need to port the bind variables so that you use regular tcl variables instead.

Collapse
Posted by Don Baccus on
For the 4x timeline see the other (4.0 design) forum, a proposed schedule is posted there.

Regarding ad_proc, I've not taken a close look at 3.4 so don't know what the private/public function flags do.  I suggest you study the code - it may be taking advantage of namespaces (Tcl 8x) or the like to avoid name collisions.  But I don't know.  Does anyone else, offhand?

(I'm busy with a bunch of stuff at the moment, otherwise I'd be willing to dig into the details myself).

The "begin 1:=func_name(); end;" constructs refer to a PL/SQL function.  You have to rewrite func_name() in PL/pgSQL.  You might see  Roberto's beta "PL/pgSQL for PL/SQL porters" manual, also referenced in the "4.0 design" forum.

After re-writing the function, you simply call it like this:

ns_db 1row $db "select func_name()"

Postgres doesn't require the "from" clause in such cases, i.e. no need  to do a "from dual".  Since you're not interested in the result of the function in this case, you don't need to call set_variables_after_query.

Collapse
Posted by Leif Jensen on
Where do I find the 3.4.x code for comparison?
Collapse
Posted by Dan Wickstrom on
You can go to the download link at aD and get a copy.
Collapse
Posted by Leif Jensen on
I am amased that I didn't run into the following problem any sooner:

[20/Feb/2001:02:49:50][27955.10245][-conn3-] Error: dbinit: db handle limit exceeded: thread already
owns 1 handle from pool 'main'
[20/Feb/2001:02:49:50][27955.10245][-conn3-] Error: could not allocate 1 handle from pool "main"

It occurs because I have inserted [ns_db gethandle] ... ns_db release handle, in several places in the tcl functions. Of course these functions are nested, but in 3.4.x the db handles are controlled by the db_xxxx functions, whereas in 3.2.x they handled by the programmer, right? If I am right, to solve this problem you need quite a good idea of the structure the system (and the calendar package in particular). To get such an overview I would like some kind of tool to analyse tcl scripts. Does any of you have/know of such a tool or do you have any other idea of what to do in this situation. Has this occured in any of the other work of converting ACS -> OpenACS?

Collapse
Posted by Leif Jensen on
I am still fighting this conversion of the calendar package from 3.4.x to 3.2.x. I ran into to a problem converting some PL/SQL functions to Pl/PgSql (I am not a PgSql 'eagle' 😊, but thanks to the description by Roberto Mello, I think I got it right. However, the next step was recognising that I am missing (at least) one function: portals_get_url_root. I scanned the original ACS 3.4.x source, but didn't find it. Can anybody please point me to where to locate this function and maybe other that I will be missing?

  Greetings,
Collapse
Posted by Caroline Meeks on
Hi,

Did you ever succeed in porting the 3.4 calendar package to OpenACS 3x?  If so (or even if you never quite got it working) can I get a copy of what you've done so far?

Thanks

Collapse
Posted by Leif Jensen on
No, sorry. After looking into the matter I decided that it would be too involved (just like a web 😉 before even starting to make changes. At the same time, the implementation of such a system within my company was postponed for other reasons. In the mean time, Open ACS 4.x has evolved quite nicely, but I haven't been able to get time to get the calendar working yet, though it is converted and tested. This is just a matter of time (or rather lack of time 😉. Also we have (temporarily) taken on Netscape Calendar, which seems to solve our problem/wishes. The main problem with this is that it's running on NT Server and it is not being developed any further.

  Greetings,
Collapse
Posted by Johannes Hühnler on
There is also a urgent need for us for the above mentioned calendar functionality in the package. If somebody could tell me what would be the best starting point I would be prepare to volunteer and overtake the port to OpenACS V4.x I am new with OpenACS, but do have experience with ACS classic.
Collapse
Posted by Don Baccus on
Johannes ... the bare calendar package and acs-events package it is based on work great in OpenACS 4 at the moment, both Postgres and Oracle.

One of my upcoming tasks, for a client, will be to generalize the calendar package so it can track *any* object derived from acs_events, rather than just the calendar object type (the acs_event type has all the time and date information needed to display calendar events).

I also have a copy of the 3.4-based room reservation package mentioned above.

The cool thing to do would be to rewrite the room reservation package to use the standard acs_events data type and massage it in whatever other way is needed to make it work well within the OpenACS 4 framework (expose it to the search package, for instance).  By basing it on the standard OpenACS 4 acs_events data type the reservation could then be easily added to the right calendar (AFTER I make the changes to the calendar package mentioned above, which will happen in the next two weeks).

A lot of people would love to have this.  I've not looked at the code for the room reservation system so don't know how closely tied it is to the old intranet package.  It should be generalized in any case if it is.

If you're interested in working on this, e-mail me privately and we'll  talk things out...

Collapse
Posted by Johannes Hühnler on
Sounds interesting, but we would have to talk on this more in depth. During the christmas season I would have also time to undertake such a project. May you give me a link to the reservation package and I will have a look on it. For understanding, what shall be the requirement for merging acs-event, acs-calendar and the room reservation system.... anything in writting would be fine. I am eager to contribute to the OpenACS project
Collapse
Posted by Jade Rubick on
By the way, I'm improved the room reservation system a bit. If you'd like some diffs or just the code, I can send it to you. I've seen the room reservation code on the aD website, so I'm pretty sure that the modifications could be distributed.

Changes: I improved the interface so that the first screen you see is the table showing you which rooms are free and busy. You click on the time slot you want instead of filling out the form, and it gives you the form with the spot you wanted already filled in.

Collapse
Posted by Michael Feldstein on
In general, when people make changes to the 3.2 codebase,
(e.g., Jade changing the UI on room reservations), it would be a
Really Good Idea for the 4.x module owners to look at those
improvements from a pageflow perspective. Much of 4.x is
actually a step backward in terms of usability.
Collapse
Posted by Jade Rubick on
Michael, I should be starting an OpenACS 4 project in the next month or so. My background is in HCI and UI design, so I'll be spending a lot of time cleaning up the interface :)
Collapse
Posted by Don Baccus on
I've e-mailed Johannes the room reservation code - Jade, if you've got some time, why don't you e-mail him so you can arrange to share your UI improvements?  They sound good.
Collapse
Posted by Jade Rubick on
I've written to Johannes about the UI improvements to the room-reservation system code.