[QUESTION]PerlHandler and PerlLogHandler Phase

2002-02-01 Thread Mod Perl

Hi!
I am been working on modperl for some time this is the
first time I am posting a question on the mailing
list. Please bear with me if I miss something or give
too much information.

I have been working on a project that can be described
as an online library. The modperl portion of it adds a
header,navigation bar and a footer and display the
content file of the book which I shall try to draw
below. 
The URI is used to determine what ModPerl nav. bar to
generate. These URI are always in the format 
/en/book/bookname/ch01p01.html. I have used the
following in my configuration file
Location /en/book
PerlHandler MyApache::StartBook
PerlLogHandler MyApache::ActivityLogger
/Location

Things would have been great if the ch01p01.html was
just one long html file without images,stylesheets and
a number of script src=. calls.  The general
format of these html files are as follows.
script
Javascript Global Variables set,
the content file to open.
chapterNum=01
chapterPage=01
/script
trtd
script scr=js/bookconfig.js
script scr=js/+chapterNum+P+chapterPage+.js
script scr=js/chapnav.js
script scr=js/footer.js
/td/tr

Here is the layout
--
ModPerl Gen Header(Nav. Bar for suhjects in library)
---
ModPerl|  Contents of the course
Gen.   |  which contains html,stylesheets,
Nav Bar|  images,audio files,java class files
for selected   |  in a directory below the html file
book   |  [-JS Nav bar mainly images]
   |  [!-Footer with current page number]
--
ModPerl Footer (Copyrights info.)
-

Here are the problems/Questions that I face:
1. Since in this case each requests for a html file
has multiple files that need to be downloaded by the
client. Am I right to assume that the handler will act
on each and every file requested file below my
/en/course URI?

2.If the answer to the above question is YES? The
Handler will add headers,footers for everything. What
do I need to do to apply the handler logic just to the
requested page and return the remaining files that are
needed to complete the requested page as they are?  

3. When I move these JS files outside the /en/course
URI they seem to work? But now when I put them with
in? It just displays the Javascript code like simple
text on the browser.

4. In the Logging Phase, I need to store the last
requested page as a bookmark. So if the user logs out,
and logs back in it takes him to the same page. Since
the html files are made up of some many requests to
other files, it stores the last file it requested. It
may be path to an image file,style sheet file etc...
Is there any way I can circumvent this problem?

Thank You very much for you help in advance. I
apologize if the email is too detailed.

Mark

__
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com



Re: [QUESTION]PerlHandler and PerlLogHandler Phase

2002-02-01 Thread Thomas Klausner

Hi!

On Fri, Feb 01, 2002 at 10:24:24AM -0800, Mod Perl wrote:
 Here are the problems/Questions that I face:
 1. Since in this case each requests for a html file
 has multiple files that need to be downloaded by the
 client. Am I right to assume that the handler will act
 on each and every file requested file below my
 /en/course URI?
Add something like 
  return DECLINED unless $r-content_type() eq 'text/html';
near the top of your handler.

This way only html-documents get handled by your handler, the rest falls
through to the default apache handler.


-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++



RE: [QUESTION]PerlHandler and PerlLogHandler Phase

2002-02-01 Thread Rob Bloodgood

 2.If the answer to the above question is YES? The
 Handler will add headers,footers for everything. What
 do I need to do to apply the handler logic just to the
 requested page and return the remaining files that are
 needed to complete the requested page as they are?

In the Eagle book (as well as a Perl Journal article) there is an example of
a Apache::Header/Apache::Footer.  CPAN doesn't show them right now.  But you
could implement them as filters using Apache::Filter to mark up each
document on its way out, based on URI.

 3. When I move these JS files outside the /en/course
 URI they seem to work? But now when I put them with
 in? It just displays the Javascript code like simple
 text on the browser.

SCRIPT SRC=/en/course/one.js/SCRIPT
... or you could template them in directly, since you're playing w/ the
content already.

 4. In the Logging Phase, I need to store the last
 requested page as a bookmark. So if the user logs out,
 and logs back in it takes him to the same page. Since
 the html files are made up of some many requests to
 other files, it stores the last file it requested. It
 may be path to an image file,style sheet file etc...
 Is there any way I can circumvent this problem?

You could use a cookie, issued with each document, noting what url they are
on right now??  Logging it (storing it) and then reading it back are bound
to be way too much work.

HTH!

L8r,
Rob




Re: [QUESTION]PerlHandler and PerlLogHandler Phase

2002-02-01 Thread Mod Perl

Thanks Thomas,
Question:
  Here are the problems/Questions that I face:
  1. Since in this case each requests for a html
 file has multiple files that need to be downloaded 
  the client. Am I right to assume that the handler
 will act on each and every file requested file 
 below my /en/course URI?
Answer:
 Add something like
 return DECLINED unless $r-content_type() eq
  'text/html';
 near the top of your handler.
 This way only html-documents get handled by your
 handler, the rest falls
 through to the default apache handler.

This one did work for most of the cases. Which is the
first war among many battles? I also have cases where
the book content has pop up windows to display meaning
of words that do not need the entire header to be
displayed .i.e. the handler should not be act on such
a request. 
Question:
Is there a way I can put them in a directory and when
the uri matches that directory, i disable the handler?
If so how can I do it?

Mark

__
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com



RE: [QUESTION]PerlHandler and PerlLogHandler Phase

2002-02-01 Thread Mod Perl

Thanks Rob for your reply.
--- Rob Bloodgood [EMAIL PROTECTED] wrote:
Question:
  2.If the answer to the above question is YES? The
  Handler will add headers,footers for everything.
 What do I need to do to apply the handler logic 
 justto the requested page and return the remaining 
 files that are needed to complete the requested 
 page as they are?
Answer:
 In the Eagle book (as well as a Perl Journal
 article) there is an example of a 
Apache::Header/Apache::Footer.  CPAN doesn't show
 them right now.  But you could implement them as 
filters using Apache::Filter to mark up each
 document on its way out, based on URI.
Reply:
I shall look into this.  There is some database
entries that have to take place as the web pages are
being servered. 
Question:
  3. When I move these JS files outside the
 /en/course URI they seem to work? But now when I 
 put them with in? It just displays the Javascript 
 code like simple text on the browser.
Answer:
 SCRIPT SRC=/en/course/one.js/SCRIPT
 ... or you could template them in directly, since
 you're playing w/ the content already.
Reply: Most of the books are already existing in that
format. To Change them would be a lot of code
rewriting,testing and deploying. 

Question:
  4. In the Logging Phase, I need to store the last
  requested page as a bookmark. So if the user logs
 out, and logs back in it takes him to the same
page.
 Since the html files are made up of some many 
 requests to other files, it stores the last file it
requested.
  It may be path to an image file,style sheet file
 etc... Is there any way I can circumvent this
problem?
Answer: 
 You could use a cookie, issued with each document,
 noting what url they are on right now??  Logging it
(storing it) and then  reading it back are bound
 to be way too much work.
Reply: I kind of figured this portion out. Though its
is not a clean way to do it. In the ActivityLogger.pm,
I plan to use $r-the_request instead of $r-uri. 

The PerlLogHandler being called on every request will
be overwriting the same data in the database.  Let us
assume that the web page request has 5 more files that
it depends. Would not the PerlLogHandler be called
when each file is being server.
 
 HTH!
 
 L8r,
 Rob
 


__
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com