Forum OpenACS Q&A: Questions about static pages

Collapse
Posted by Reuven Lerner on
I'm trying to set up the "static pages" application on a site under my control, and have a number of questions regarding its installation and use.  I'm running OpenACS 4.5 (with almost no updates) and PostgreSQL 7.1.2.

(1) The "static pages" APM is installed and enabled.  Nevertheless, I cannot seem to mount the application or create a new instance of it from the site map.  How do I set it up?  I've tried to do this both within the subsites and the main site hierarchy, to no avail.

(2) My OpenACS installation contains two subsites with no overlapping content, except for the list of users and the site-wide administration.  Each has its own directory under /web/openacs/www, in which ADPs are located.  Since static-pages is a singleton (and thus site-wide) application, how can I separate the pages on these two sites from each other?

(3) Is there any conflict between static pages and OpenACS templates?  All of the files that I want to handle with static-pages are actually .tcl/.adp pairs.

(4) The only real reason I'm going through all of this is to allow people to add comments to individual ADP pages that a designer is loading into the filesystem.  Is there an easier or more obvious way to accomplish this?

Thanks for any and all help!

Collapse
Posted by Jarkko Laine on
Hi Reuven,

I'll try to give some answers to the first question and leave others for more experienced folks here.

1. You install Static pages and General Comments packages using the Package Manager. Remember to restart the server after that.

2. Using the site map create a new subfolder and name it.

3. Click new application, give the new instance a name and submit the form. Again, restart the server.

4. After these steps I had a working instance of Static Pages. I don't see there's a reason to mount more than one instance of static pages, because it's just a way to make static pages commentable and its UI is just for administrative purposes like finding new static pages or to change the commentability of particular pages or folders.

OK, just a bit to the second question:
"Since static-pages is a singleton (and thus site-wide) application, how can I separate the pages on these two sites from each other?"

Static pages is aware of the folders, so if you have your subsites in folders a and b, you can set the commentability prefs differently for the both folders AND for the individual pages inside them.

Collapse
Posted by Reuven Lerner on
Hi Jarkko,

Thanks for the advice.  Unfortunately, it doesn't help me much.  The problem is that when I go to the site map and click on "new application," the "static pages" application doesn't appear in the list.

According to the apm application, "static pages" is both installed and enabled, so it should be visible when I'm trying to create a new application instance.  Or am I missing something here?

Collapse
Posted by Dave Bauer on
Not sure why static-pages isn't an option on the site-map. Very strange.

Your requirements are a little different than the static-pages design. #1 it is meant to be mounted once and indexes all files under /www with the extensions you specify in the package parameter. It would be nice to mount different static pages on different directories and allow it to be managed seperately.

Static pages sends out the HTML itself, so it will not parse an adp file and add the comments links for you. It was designed to take text or html files and allow commenting. T

Collapse
Posted by Reuven Lerner on
Well, I'll go check my installation to see why static-pages isn't an option.  Maybe I installed it without restarting the server, but I don't believe that this is the case.

However, Dave's answer tells me that static-pages isn't what I'm looking for anyway.  I would like to find a way to add comments to ADP pages in the /www directory.  Is there any easy way to do this?  If not, then I can probably use the news module for this purpose, which I know supports  commenting.  (I didn't use news from the beginning because I figured that it would be easier to add comments to static pages.  Foolish me!)

Collapse
Posted by Dan Wickstrom on
I think somebody said it was a singleton package, so it won't show up in the "applications" list.  If you tell the apm to show all packages, you should be able to mount it using "mount" instead of "new application".
Collapse
Posted by Rafael Calvo on
Reuven

I was able to mount it without trouble. Th problem I am getting is that when I scan the filesystem for static pages (I copied a couple in the www directory) they are not being loaded....
Any ideas of what could it be, DaveB?
There is no parameter for this, do I need to set something up in the code?

Reuven, what you need seems to be to enable general comments in those adp pages.
BTW, congratulations on your latest article

Collapse
Posted by Rafael Calvo on
I should mentionthat I am using PG7.2, AOLserver/3.3.1+ad13
Collapse
Posted by Reuven Lerner on
Rafael,

I think that my installation must be broken somehow, because I definitely mounted general-comments under the /general-comments URL, and yet I still cannot mount the static-pages application.  I'll haev to

However, I'm curious to know how I can activate comments on ADP pages, which would indeed solve my problem for good.  I don't remember seeing that configuration option anywhere; I just looked through the parameters for the kernel, templating, and workflow, and can't figure out how to turn this on.  Do I need to add something to the default master?

Collapse
Posted by Rafael Calvo on
Reuven

I haven't used it myself, but I believe is 1 line of code you need to add to the adp page. I am not sure if youcan doit in the master template.
The documentation doesn't give examples, but might help:
http://www.weg.ee.usyd.edu.au/doc/general-comments/

Collapse
Posted by Reuven Lerner on
Well, the API is surprisingly straightforward.  The problem is that plain ol' ADP pages don't have an object ID, because they're not in the database.

So while I would love to simply say

    set comment_link [general_comments_create_link]

in my .tcl file, the above code throws an exception, saying (more or less) that it cannot infer the object ID, and that I have to give it an explicit value.

If I were only interested in doing this for a single ADP page, I would be happy to lie about the object ID, "borrowing" one from soemwhere else within the same subsite that won't ever have any comments associated with it.  But not only is that ugly and potentially dangerous, but I imagine that it's unnecessary, and that I can somehow create (and then retrieve and reuse) an object ID that's associated with the page.

Any ideas?

Collapse
Posted by Jeff Davis on
I think the easiest way to do it is to extend static pages to also index .adp pages. Doing so will have two benefits:
  • It will create and object_id for each file.
  • The adp files will then be searchable
It would be a nice way to extend it (oh and whoever does it should fix it to index the PACKAGE/www/doc directories as well :) )
Collapse
Posted by Ola Hansson on
There is a way to make it work, even though Jeff's proposal is less of a work-around 😊:

1) Rename your .adp files in question to .ADP ... (I don't believe they are allowed to have an accompanying .tcl file, though. If I'm right, try to move the logic into the .ADP page)

2) Add to the default params for static-pages, "html htm", to look like "html htm adp" (the params are case insensitive).

3) Go to static-pages admin and scan the filesystem for static pages.

4) Restart the server.

5) .ADP pages ought to be commentable at this point.

PS. I've noticed strange behaviour when indexing large amounts of pages (html pages mostly) where the "add comment" link would not show directly. However, waiting till the next day always solved that problem... Perhaps it has something to do with scheduling of the indexing - I don't remember/know exactly.

Disclaimer: I've only tried this on an 4.5 Beta2 install.

Collapse
Posted by Jeff Davis on
Ola, why do you upcase the extension?
Collapse
Posted by Ola Hansson on
Reuven, Jeff: Forget about my idea!

I just found out that my suggested solution doesn't parse the tcl/adp code (as Dave mentioned previously!).

Sorry. I will go stand in the corner for ten minutes.