RE: Search Text

2006-08-17 Thread albartell

i would prefer to do it through tapestry. and if not is there a JS library
i can use.
Here is how I do it on my pages. Note that c:out/ is a JSF component but
it could be just as easily done in Tapestry.

Hope that helps,
Aaron Bartell


...
body onload=highlightSearchTerms('c:out
value=${DocumentCtl.searchValue}/');
...
/*
 * This is the function that actually highlights a text string by
 * adding HTML tags before and after all occurrences of the search
 * term. You can pass your own tags if you'd like, or if the
 * highlightStartTag or highlightEndTag parameters are omitted or
 * are empty strings then the default font tags will be used.
 */
function doHighlight(bodyText, searchTerm, highlightStartTag,
highlightEndTag) 
{
  // the highlightStartTag and highlightEndTag parameters are optional
  if ((!highlightStartTag) || (!highlightEndTag)) {
highlightStartTag = b;
highlightEndTag = /b;
  }
  
  // find all occurences of the search term in the given text,
  // and add some highlight tags to them (we're not using a
  // regular expression search, because we want to filter out
  // matches that occur within HTML tags and script blocks, so
  // we have to do a little extra validation)
  var newText = ;
  var i = -1;
  var lcSearchTerm = searchTerm.toLowerCase();
  var lcBodyText = bodyText.toLowerCase();

  while (bodyText.length  0) {
i = lcBodyText.indexOf(lcSearchTerm, i+1);
if (i  0) {
  newText += bodyText;
  bodyText = ;
} else {
  // skip anything inside an HTML tag
  if (bodyText.lastIndexOf(, i) = bodyText.lastIndexOf(, i)) {
// skip anything inside a script block
if (lcBodyText.lastIndexOf(/script, i) =
lcBodyText.lastIndexOf(script, i)) {
  newText += bodyText.substring(0, i) + highlightStartTag +
bodyText.substr(i, searchTerm.length) + highlightEndTag;
  bodyText = bodyText.substr(i + searchTerm.length);
  lcBodyText = bodyText.toLowerCase();
  i = -1;
}
  }
}
  }
  
  return newText;
}


/*
 * This is sort of a wrapper function to the doHighlight function.
 * It takes the searchText that you pass, optionally splits it into
 * separate words, and transforms the text on the current web page.
 * Only the searchText parameter is required; all other parameters
 * are optional and can be omitted.
 */
function highlightSearchTerms(searchText, treatAsPhrase, warnOnFailure,
highlightStartTag, highlightEndTag)
{

  if(searchText.length == 0){
return false;
  }
  
  

  treatAsPhrase = true;
  
  // if the treatAsPhrase parameter is true, then we should search for 
  // the entire phrase that was entered; otherwise, we will split the
  // search string so that each word is searched for and highlighted
  // individually
  if (treatAsPhrase) {
searchArray = [searchText];
  } else {
searchArray = searchText.split( );
  }
  
  if (!document.body || typeof(document.body.innerHTML) == undefined) {
if (warnOnFailure) {
  alert(Sorry, for some reason the text of this page is unavailable.
Searching will not work.);
}
return false;
  }
  
  var bodyText = document.body.innerHTML;
  for (var i = 0; i  searchArray.length; i++) {
bodyText = doHighlight(bodyText, searchArray[i], highlightStartTag,
highlightEndTag);
  }
  
  document.body.innerHTML = bodyText;
  return true;
}


/*
 * This displays a dialog box that allows a user to enter their own
 * search terms to highlight on the page, and then passes the search
 * text or phrase to the highlightSearchTerms function. All parameters
 * are optional.
 */
function searchPrompt(defaultText, treatAsPhrase, textColor, bgColor)
{
  // This function prompts the user for any words that should
  // be highlighted on this web page
  if (!defaultText) {
defaultText = ;
  }
  
  // we can optionally use our own highlight tag values
  if ((!textColor) || (!bgColor)) {
highlightStartTag = ;
highlightEndTag = ;
  } else {
highlightStartTag = font style='color: + textColor + ;
background-color: + bgColor + ;';
highlightEndTag = /font;
  }
  
  if (treatAsPhrase) {
promptText = Please enter the phrase you'd like to search for:;
  } else {
promptText = Please enter the words you'd like to search for, separated
by spaces:;
  }
  
  searchText = prompt(promptText, defaultText);

  if (!searchText)  {
alert(No search terms were entered. Exiting function.);
return false;
  }
  
  return highlightSearchTerms(searchText, treatAsPhrase, true,
highlightStartTag, highlightEndTag);
}


/*
 * This function takes a referer/referrer string and parses it
 * to determine if it contains any search terms. If it does, the
 * search terms are passed to the highlightSearchTerms function
 * so they can be highlighted on the current page.
 */
function highlightGoogleSearchTerms(referrer)
{
  // This function has only been very lightly tested against
  // typical Google search URLs. If you wanted the Google search
  // terms to be 

RE: RoR

2006-08-03 Thread albartell
As much as I agree that Wim V was flaming, I also see the complete meaning
of the email.  I originally came from a CGI environment where I used RPG on
an iSeries (say AS/400) to do web pages using simple text templates that had
sections and variable pieces of data to be replaced at runtime (similar to
http://smarty.php.net/).  Some portions of this were more laborious than I
would have liked so I moved to the JSF world when I saw the event driven
paradigm working with web controls - I loved it!  I then came across some
things in JSF that just didn't work for my programming environment (i.e.
graphic developers had to know JSF UI tags to develop my pages and that just
didn't cut it - I know things have changed since then, but this was two
years ago).  I then moved to Tapestry specifically because it allowed my ui
person to develop like they had before just with some additional attributes
in their HTML - works great for that, and I also loved the statement of
purpose behind Tapestry.

I don't know if my problem is with Tapestry or more with the Java community,
but you nearly have to be specialized Java programmer in many areas
(Hivemind, Tapestry v3 to v4 differences, bad documentation, making
Hibernate work - Tapernate lacks documentation, etc, etc) to be able to
easily build web applications in Tapestry.  Want an example?  Last week when
I had 2 hours to do some catchup Tapestry programming I had a need to build
and place a cookie on the clients machine for affiliate referral reasons. I
searched for over an hour and didn't make any progress other than to find
out of date examples or examples that were incredibly incomplete that would
require a lot more questions to this users list.  Part of the reason it took
so long is because the new Tapestry site is very confusing to navigate - I
will save those comments for another thread. 

Here is what I know...

---Where you _cant_ find how to do cookies in Tapestry---
1. http://tapestry.apache.org/tapestry4/UsersGuide/state.html
2. http://tapestry.apache.org/tapestry4/tapestry-annotations/index.html
3. http://wiki.apache.org/tapestry/HowTos
4.
http://wiki.apache.org/tapestry/FindPage?action=fullsearchtitlesearch=0val
ue=cookiecontext=160
5. http://tapestry.apache.org/tapestry4/UsersGuide/index.html (no where in
the user guide, I checked each page manually because you can't search it)


Some possibilities, but they are either incomplete (i.e. only hivemind and
zero Java) or they are old (i.e. Tapestry 3)...
http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-user/200603.mbox/%
[EMAIL PROTECTED]
http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-user/200510.mbox/%
[EMAIL PROTECTED]

Traffic on the Tapestry list would be cut IN HALF if the documentation was
up to par and organized well.  I WANT to help with that, but I get so
confused once into the yuck of it all that I feel my limited view would give
flawed documentation, so I rule myself out as a documenter and instead can
just provide topical areas that are in desperate need of documentation.

In closing, RoR or going back to JSF is looking ever more appealing because
I didn't have this much complication in JSF and I have yet to hear show
stopping things about RoR.  Tapestry's lack of documentation IS A
SHOWSTOPPER!

Thanks for listening,
Aaron Bartell



-Original Message-
From: Wim V [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 03, 2006 12:31 AM
To: users@tapestry.apache.org
Subject: RoR

Im tired of getting mails after I unsubscribed from this mailing list, so
I'm simply gonna abuse it.

Tired of using hibernate?
Tired of having to config all the time?
Tired of deploying?
Need something that comes as a whole package?
Tired of Java and Tapestry verboseness?
Tired of this damn mailing list?

Try Ruby On Rails, an MVC framework based on the language Ruby! Write web
applications faster than you ever did!
a href=http://www.rubyonrails.org;http://www.rubyonrails.org/a

_
Open your shared folders wherever you are thanks to the new Messenger
version! 
http://imagine-msn.com/minisites/messenger/default.aspx?locale=nl-be


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to search Tapestry mailing list was-RE: Why I hate mailing lists

2006-07-08 Thread albartell
Try using google by entering the following in the search box:

site:http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-user/ KEYWORD


Thanks to Rodnei Couto for this tip he gave me a month ago on this list.

Aaron Bartell
http://mowyourlawn.com

-Original Message-
From: Epstein, Ezra [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 07, 2006 2:20 PM
To: Tapestry users
Subject: Why I hate mailing lists

So I wanted to read up about putting multiple portlets/pages in a single
Tapestry portlet .war and went happily to the online mailing list archives
and what do I find:

The archives are segmented:
+ first by month (oh and only 3 months are online) then by a page of 
+ n postings in a month.
+ there's no search feature.

This is why I deplore mailing lists.  They are so 1983.  Why don't all teams
follow Hibernate's (and others) lead and choose a simple Forum (phpBB in the
case of Hibernate).  It (like google/yahoo groups) is free, keeps all the
old posts, is automatically topically threaded, is entirely searchable, if
you're addicted to email you can get posts as emails or, if you prefer,
receive daily digests.  Why would anyone continue to use an outdated
technology like an email list?

Thanks, 

Ezra Epstein 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tapernate HOWTO -RE: Tapestry+Spring+Hibernate

2006-06-09 Thread albartell
Looks very promising James!

I am trying to implement it and have been all over the place trying to find
an example.  I got to this from the page you specified:
http://www.carmanconsulting.com/mvn/com/carmanconsulting/tapernate-example/0
.1/ but the tapernate-example-1.0.jar file only has *.class files.

I then went and installed Subclipse so I could get the source from SVN
hoping for an example or readme.txt, but nothing.

I have my hivemind contribution setup complete (I believe, see below), but I
don't see where I can get a Hibernate Session from? 


Hivemodule.xml
...
contribution configuration-id=hivemind.hibernate3.Configuration
  configuration-filehibernate.cfg.xml/configuration-file
  mapping-filecom/rxs/dao/Lead.hbm.xml/mapping-file
  mapping-filecom/rxs/dao/Affiliate.hbm.xml/mapping-file
  mapping-filecom/rxs/dao/Reqext.hbm.xml/mapping-file
  mapping-filecom/rxs/dao/Leadtag.hbm.xml/mapping-file
  mapping-filecom/rxs/dao/Translog.hbm.xml/mapping-file
  mapping-filecom/rxs/dao/Leadtagtype.hbm.xml/mapping-file
  mapping-filecom/rxs/dao/Sysctl.hbm.xml/mapping-file
  property name=hibernate.dialect
value=org.hibernate.dialect.MySQLDialect/
  classcom.rxs.dao.Affiliate/class
  classcom.rxs.dao.Lead/class
  classcom.rxs.dao.Leadtag/class
  classcom.rxs.dao.Leadtagtype/class
  classcom.rxs.dao.Reqext/class
  classcom.rxs.dao.Translog/class
  classcom.rxs.dao.Sysctl/class 
/contribution

Thanks,
Aaron Bartell
http://mowyourlawn.com/blog

-Original Message-
From: James Carman [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 08, 2006 11:44 AM
To: 'Tapestry users'
Subject: RE: Tapestry+Spring+Hibernate was -RE: @For within a
@contrib:Table

Or, use Tapernate!  Other folks are using it and they seem to like it a lot.
It does roughly the same thing as the Spring OpenSessionInViewFilter, but it
also does a whole lot more.  Check out the documentation at:

www.carmanconsulting.com/tapernate

James


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: @For within a @contrib:Table

2006-06-08 Thread albartell
Thanks Eric, that makes sense as to why it is occurring.  I am going to
shoot for option 2 below as right now I am doing my Hibernate open/close of
the session through a servlet filter.

Thanks again,
Aaron Bartell 

-Original Message-
From: Eric Fesler [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 08, 2006 8:26 AM
To: Tapestry users
Subject: Re: @For within a @contrib:Table

Hi,

I already had this issue in the past. It was due to the fact that the
leadtagtype (or equivalent) method was called on the leadtag bean after the
hibernate session was closed.

There are two ways to solve the issue.
1°) Do not use lazy loading for the leadtagtype association
2°) Use the OpenSessionInViewFilter of the Spring framework. This filter
opens the session only once per request and close it at the end of the
request.

--ERic

On Wednesday 07 June 2006 19:43, albartell wrote:
 I am having an odd issue. When the below executes it obtains 
 ognl:dataItems just fine, but when it gets to the internal @For loop an
error is thrown:

 ognl.OgnlException... source is null for getProperty(null, 
 leadtagtype)

 The problem seems to be that the contrib:Table isn't waiting for the 
 leadtagtype method to be called/loaded (which is lazy loaded by 
 Hibernate), because when I run it through debug leadtagtype DOES get 
 called, but not until after the page has rendered. Anybody else ever have
this problem?

table jwcid=[EMAIL PROTECTED]:Table source=ognl:dataItems

 
columns=leadtag,leaduid,firstname,lastname,cmpyname,expirehigh,saleper
cent
, procgroup,serialnbr,model,action
   rowsClass=ognl:beans.evenOdd.next
   pageSize=12

  span jwcid=[EMAIL PROTECTED]
   table cellpadding=0 cellspacing=0
 tr jwcid=[EMAIL PROTECTED]
 source=ognl:components.table.tableRow.leadtags value=ognl:leadtag
 element=tr
   td
   span jwcid=[EMAIL PROTECTED]
 value=ognl:leadtag.leadtagtype.name/
   /td
 /tr
   /table
  /span
 /table

 Thanks in advance,
 Aaron Bartell
 http://mowyourlawn.com/blog

--
Eric Fesler
Technical Director
---
 Audaxis S.A.
 Tel: +32 (0)2 361.83.01
 Fax: +32 (0)2 361.83.11
 Mob: +32 (0)478 22.90.78
 http://www.audaxis.com
 
 PGP Fingerprint : FECF 2841 48B7 47D8 C426 55A4 0A60 FB52 833B 1EF1  Public
PGP key  : available at server subkeys.pgp.net
---

In the plot, people came to the land; the land loved them; they worked and
struggled and had lots of children.  There was a Frenchman who talked funny
and a greenhorn from England who was a fancy-pants but when it came to the
crunch he was all courage.  Those novels would make you retch.
-- Canadian novelist Robertson Davies, on the generic
Canadian
   novel.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



@For within a @contrib:Table

2006-06-07 Thread albartell
I am having an odd issue. When the below executes it obtains ognl:dataItems
just fine, but when it gets to the internal @For loop an error is thrown:
 
ognl.OgnlException... source is null for getProperty(null, leadtagtype)
 
The problem seems to be that the contrib:Table isn't waiting for the
leadtagtype method to be called/loaded (which is lazy loaded by Hibernate),
because when I run it through debug leadtagtype DOES get called, but not
until after the page has rendered. Anybody else ever have this problem?  
 
   table jwcid=[EMAIL PROTECTED]:Table source=ognl:dataItems 
 
columns=leadtag,leaduid,firstname,lastname,cmpyname,expirehigh,salepercent,
procgroup,serialnbr,model,action 
  rowsClass=ognl:beans.evenOdd.next
  pageSize=12
   
 span jwcid=[EMAIL PROTECTED] 
  table cellpadding=0 cellspacing=0
tr jwcid=[EMAIL PROTECTED]
source=ognl:components.table.tableRow.leadtags value=ognl:leadtag
element=tr  
  td
  span jwcid=[EMAIL PROTECTED]
value=ognl:leadtag.leadtagtype.name/ 
  /td
/tr
  /table
 /span
/table
 
Thanks in advance,
Aaron Bartell
http://mowyourlawn.com/blog