Re: [gantry] Gantry/Bigtop newb needs help

9 views
Skip to first unread message

wfdudley

unread,
Jun 17, 2011, 1:36:17 PM6/17/11
to John Weigel, gan...@googlegroups.com
The controllers are AutoCRUD. Is that good or bad? I see that the
"Users" controller in the samples.bigtop is AutoCRUD.

Javascript console says:
(2) Uncaught TypeError: object is not a function

(2) is a 2 in a red dot, which error also appears in the "resources" listing,
excerpted here:

<input type="text" name="livesearch" id="livesearch" value="" />
<input type="button" name="search" value="search"
onclick="javascript: livesearch();">

I have no idea what "object is not a function" means or refers to here.

Interestingly, when I run a search of Users in samples (demo) app, I get this
error message in the javascript console:

Refused to set unsafe header "Connection"

But the search still works. The code around the livesearch button
looks the same
as the quote above.

Thanks,
Bill Dudley


On 6/17/11, John Weigel <John....@knology.com> wrote:
> Best way to debug it is use the Chrome web browser. View -> Developer ->
> Javascript Console. If there are any javascript errors occurring you
> should be able to see them. If there are no js errors then the problem may
> be with the controller. Are you using CRUD or AutoCRUD for the controller?
>
> -John
>
> On 6/16/11 5:49 PM, "wfdudley" <wfdu...@gmail.com> wrote:
>
>>John,
>>
>>Thanks for the clarification and the svn command.
>>
>>I downloaded from svn, did the Build per the README, and re-generated
>>my application from the bigtop file. Then I restored my old genwrapper.tt
>>
>>The good news is that the "ajaxrequest" from demo works in my application.
>>The problem I was having was that a cut and paste from the email you sent
>>me must have gotten some non-ASCII characters, so the <script ... /script>
>>didn't work. Once I copied that bit from the working genwrapper.tt in the
>>samples/html/templates directory, the ajaxrequest is working fine.
>>
>>But search is still a no-op.
>>
>>Is there any way to debug this? To figure out what is happening when I
>>click
>>on the "search" button?
>>
>>I'm still willing to work on updating the docs should I ever get this
>>working.
>>
>>Thanks,
>>Bill
>>
>>
>>On 6/16/11, John Weigel <John....@knology.com> wrote:
>>> You can get the bigtop svn code here: svn checkout
>>> http://bigtop.googlecode.com/svn/trunk/ bigtop-read-only
>>> Sorry I wasn't clear. Replace
>>>
>>> template_wrapper `genwrapper.tt` => no_accessor;
>>>
>>> in the bigtop file with
>>>
>>> template_wrapper `mywrapper.tt` => no_accessor;
>>>
>>> That will make it so the app uses mywrapper.tt as the wrapper instead of
>>> genwrapper.tt. You can copy genwrapper.tt to mywrapper.tt so you can
>>>then
>>> make changes to it w/o having to worry about bigtop overwriting your
>>> changes.
>>>
>>> -John
>>>
>>> On 6/16/11 4:29 PM, "wfdudley" <wfdu...@gmail.com> wrote:
>>>
>>>>John,
>>>>
>>>>I misspoke again. I am using bigtop to regenerate everything:
>>>>
>>>>bigtop docs/our_app.bigtop all
>>>>
>>>>So it's bigtop that's overwriting genwrapper.tt
>>>>
>>>>This line is already in my bigtop file:
>>>>
>>>>template_wrapper `genwrapper.tt` => no_accessor;
>>>>
>>>>I don't understand what the effect of adding this line is supposed to
>>>>be:
>>>>template_wrapper `mywrapper.tt` => no_accessor;
>>>>
>>>>Is that supposed to get bigtop to ignore mywrapper.tt? Copy it for me
>>>>(unlikely)?
>>>>
>>>>I'm using the cpan version of bigtop.
>>>>
>>>>I have no idea how to get the svn version. The link from usegantry.org
>>>>only
>>>>talks about getting gantry.
>>>>
>>>>Thanks,
>>>>Bill
>>>>
>>>>On 6/16/11, John Weigel <John....@knology.com> wrote:
>>>>> Do you have svn version of bigtop? It, like gantry doesn't get regular
>>>>> pushes to cpan. As far as tentmaker goes - its possible you've come
>>>>>across
>>>>> a problem with it. I've never used tentmaker to build a gantry app. I
>>>>> always just create the bigtop file by hand and then use the bigtop
>>>>>command
>>>>> line tool to gen/regen. As far as your problem goes with the code
>>>>>being
>>>>> removed from the genwrapper template - yeah that’s going to happen any
>>>>> time you regenerate the app. The best thing to do is copy the template
>>>>>to
>>>>> another name and then update the template wrapper config item in the
>>>>> bigtop file and regen.
>>>>>
>>>>> template_wrapper `mywrapper.tt` => no_accessor;
>>>>>
>>>>> That way regenerating the app won't overwrite your changes to the
>>>>>wrapper.
>>>>>
>>>>> -John
>>>>>
>>>>>
>>>>>
>>>>> On 6/16/11 3:35 PM, "wfdudley" <wfdu...@gmail.com> wrote:
>>>>>
>>>>>>John,
>>>>>>
>>>>>>Again, thanks for your help. This would be hopeless without you.
>>>>>>
>>>>>>I had already copied js/gantry.js, and I had already added the snippet
>>>>>>to
>>>>>>templates/genwrapper.tt. I spent a LOT of time with find | xargs grep
>>>>>>trying
>>>>>>to figure out where the hooks are hidden.
>>>>>>
>>>>>>I had no idea about plugins `AuthCookie Static`; Since this modifies
>>>>>>the
>>>>>>bigtop file, I re-ran tentmaker. That erased the <script
>>>>>>...gantry.jg.../script>
>>>>>>business from genwrapper.tt.
>>>>>>
>>>>>>So, I replaced the bit in genwrapper.tt, now with the AuthCookie
>>>>>>Static
>>>>>>plugins
>>>>>>cited in the bigtop file.
>>>>>>
>>>>>>Still, search is a no-op.
>>>>>>
>>>>>>And, amusingly, the "ajaxrequest" thingy died. I had bolted this into
>>>>>>my
>>>>>>app
>>>>>>by copying bits from the sample app, thinking it would test if any
>>>>>>java stuff worked
>>>>>>at all. I had it working, until I ran tentmaker. Now it's just as
>>>>>>dead as the search
>>>>>>box. I've been doing "find | xargs grep" and "ls -lR" etc to try to
>>>>>>figure out what
>>>>>>broke when I ran tentmaker, but no success there.
>>>>>>
>>>>>>As far as the larger, philosiphical discussion about docs, here's my
>>>>>>two
>>>>>>cents:
>>>>>>
>>>>>>if you want more users, so that the project gains some kind of
>>>>>>following, you have
>>>>>>to have better docs.
>>>>>>
>>>>>>If you want to not have to keep answering the same stupid questions
>>>>>>over
>>>>>>again
>>>>>>to newbs on the mailing list, you have to have better docs. There is
>>>>>>NO
>>>>>>WAY in
>>>>>>hell anybody is going to guess the secret "plugins" that goes in the
>>>>>>bigtop file,
>>>>>>nor that running tentmaker will kill the java script include in
>>>>>>genwrapper.tt.
>>>>>>
>>>>>>I've been using unix from the command line for many years now,
>>>>>>programming
>>>>>>Perl for a decade or more, and believe me when I say that this is
>>>>>>impenetrably
>>>>>>hard.
>>>>>>
>>>>>>That said, I'm willing to mark up changes to the docs to fix some of
>>>>>>these problems
>>>>>>if I ever get it working.
>>>>>>
>>>>>>Thanks for all your help,
>>>>>>Bill Dudley
>>>>>>
>>>>>>
>>>>>>
>>>>>>On 6/16/11, John Weigel <John....@knology.com> wrote:
>>>>>>> Copy the gantry.js file from gantry into your project under
>>>>>>> html/js/gantry.js. Then add the following to your wrapper template
>>>>>>>head
>>>>>>> element:
>>>>>>>
>>>>>>> <script type="text/javascript" src="[% self.doc_rootp
>>>>>>>%]/js/gantry.js">
>>>>>>> </script>
>>>>>>>
>>>>>>> You can look at the genwrapper.tt in the
>>>>>>> samples/html/templates/genwrapper.tt file for an example.
>>>>>>>
>>>>>>> If you're using the appserver (as opposed to running it under
>>>>>>>apache)
>>>>>>>you
>>>>>>> need to make sure you have the Static plugin enabled to serve out
>>>>>>>the
>>>>>>> static files. That¹s enabled in the bigtop file with plugins
>>>>>>>`AuthCookie
>>>>>>> Static`; (you can look at the samples bigtop file under samples/docs
>>>>>>>for
>>>>>>> an example).
>>>>>>>
>>>>>>> I agree the documentation could be better and it could be easier to
>>>>>>>get
>>>>>>> working out of the box but unfortunately there are only a couple
>>>>>>>people
>>>>>>> who contribute to the project and its not the focus of work for any
>>>>>>>of
>>>>>>> them including myself. Given the little time I have to work on
>>>>>>>gantry
>>>>>>>its
>>>>>>> mostly all bug fixes I happen to encounter while working on gantry
>>>>>>>web
>>>>>>> applications.
>>>>>>>
>>>>>>>
>>>>>>> -John
>>>>>>>
>>>>>>> On 6/16/11 1:40 PM, "wfdudley" <wfdu...@gmail.com> wrote:
>>>>>>>
>>>>>>>>First: John, thanks for spending your time on this.
>>>>>>>>
>>>>>>>>Second: I need to correct what I said in my last emails. When I
>>>>>>>>said:
>>>>>>>>
>>>>>>>>"No javascript gets included in my page that has the non-functional
>>>>>>>>Search box."
>>>>>>>>
>>>>>>>>I don't really know that. Firefox "View Source" doesn't show
>>>>>>>>javascript apparently,
>>>>>>>>since it doesn't show it for the working sample app.server version,
>>>>>>>>either.
>>>>>>>>
>>>>>>>>So we are left with:
>>>>>>>>
>>>>>>>>livesearch doesn't work in an application built according to the
>>>>>>>>"manual", such
>>>>>>>>as it is (I even wasted $20 on the Gantry book, silly me). I
>>>>>>>>haven't
>>>>>>>>the slightest
>>>>>>>>idea why, and there is no debug output that I can find.
>>>>>>>>
>>>>>>>>Is there *any* documentation on "livesearch" ? I mean, aside from
>>>>>>>>the "keywords" docs that say that there are "livesearch" and
>>>>>>>>"searchable"
>>>>>>>>keywords, but are silent on any other points.
>>>>>>>>
>>>>>>>>Thanks,
>>>>>>>>Bill Dudley
>>>>>>>>
>>>>>>>>
>>>>>>>>On 6/16/11, wfdudley <wfdu...@gmail.com> wrote:
>>>>>>>>> Ah-hah. Figured out it wanted "install Authen::Htpasswd, which
>>>>>>>>>once
>>>>>>>>> installed,
>>>>>>>>> app.server now runs.
>>>>>>>>>
>>>>>>>>> So yes, I now admit that it is theoretically possible to get
>>>>>>>>>livesearch
>>>>>>>>>to
>>>>>>>>> work.
>>>>>>>>>
>>>>>>>>> BUT there are NO DOCS for how to get it to work. Which of the
>>>>>>>>>12,000
>>>>>>>>> files in this
>>>>>>>>> thing is the ONE that makes livesearch work?
>>>>>>>>>
>>>>>>>>> I see that the sample html directory has a "js" subdir with
>>>>>>>>> "gantry.js" and some other stuff in it. Totally undocumented, but
>>>>>>>>>OK,
>>>>>>>>> what the hell. I replicated that in MY application; still no go.
>>>>>>>>>No
>>>>>>>>> javascript gets included in my page that has the non-functional
>>>>>>>>>Search
>>>>>>>>> box.
>>>>>>>>>
>>>>>>>>> Obviously, there's another (or 6 or 7) more secret places where I
>>>>>>>>>have
>>>>>>>>> missing files to get this to work.
>>>>>>>>>
>>>>>>>>> I'm sorry to be sounding so testy, but when a beginner runs the
>>>>>>>>> *tutorial*, it should work. Especially on a package that is at
>>>>>>>>> version 3.x.
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> Bill Dudley
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 6/16/11, wfdudley <wfdu...@gmail.com> wrote:
>>>>>>>>>> This is what I get when I run app.server from the sample dir:
>>>>>>>>>>
>>>>>>>>>> ./app.server
>>>>>>>>>> Could not load plugin "Gantry::Plugins::AuthCookie", "Can't
>>>>>>>>>>locate
>>>>>>>>>> Authen/Htpasswd.pm in @INC (@INC contains: lib ../lib
>>>>>>>>>> /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
>>>>>>>>>> /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl
>>>>>>>>>> /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi
>>>>>>>>>> /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl
>>>>>>>>>> /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8
>>>>>>>>>>.)
>>>>>>>>>> at ../lib/Gantry/Plugins/AuthCookie.pm line 10.
>>>>>>>>>> BEGIN failed--compilation aborted at
>>>>>>>>>> ../lib/Gantry/Plugins/AuthCookie.pm line 10.
>>>>>>>>>> Compilation failed in require at (eval 84) line 3.
>>>>>>>>>> " at ../lib/Gantry.pm line 386.
>>>>>>>>>> BEGIN failed--compilation aborted at ./app.server line 14.
>>>>>>>>>>
>>>>>>>>>> so I try to install the "missing" perl module:
>>>>>>>>>>
>>>>>>>>>> sudo perl -MCPAN -e shell
>>>>>>>>>> cpan[1]> install Gantry::Plugins::AuthCookie
>>>>>>>>>> Going to read '/home/dud/.cpan/Metadata'
>>>>>>>>>> Database was generated on Tue, 07 Jun 2011 15:30:25 GMT
>>>>>>>>>> Going to read '/home/dud/.cpan/sources/authors/01mailrc.txt.gz'
>>>>>>>>>>
>>>>>>>>>>..................................................................
>>>>>>>>>>..
>>>>>>>>>>..
>>>>>>>>>>..
>>>>>>>>>>....DONE
>>>>>>>>>> Going to read
>>>>>>>>>>'/home/dud/.cpan/sources/modules/02packages.details.txt.gz'
>>>>>>>>>> Database was generated on Thu, 16 Jun 2011 17:28:57 GMT
>>>>>>>>>>
>>>>>>>>>>..................................................................
>>>>>>>>>>..
>>>>>>>>>>..
>>>>>>>>>>..
>>>>>>>>>>....DONE
>>>>>>>>>> Fetching with LWP:
>>>>>>>>>> http://www.perl.com/CPAN/modules/03modlist.data.gz
>>>>>>>>>> Going to read '/home/dud/.cpan/sources/modules/03modlist.data.gz'
>>>>>>>>>>
>>>>>>>>>>..................................................................
>>>>>>>>>>..
>>>>>>>>>>..
>>>>>>>>>>..
>>>>>>>>>>....DONE
>>>>>>>>>> Going to write /home/dud/.cpan/Metadata
>>>>>>>>>> Gantry::Plugins::AuthCookie is up to date (undef).
>>>>>>>>>>
>>>>>>>>>> Now what?
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> Bill Dudley
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 6/16/11, John Weigel <John....@knology.com> wrote:
>>>>>>>>>>> There is a sample included with gantry of how livesearch works.
>>>>>>>>>>>It
>>>>>>>>>>>was
>>>>>>>>>>> broken until about a minute ago when I committed a change to fix
>>>>>>>>>>>it.
>>>>>>>>>>> So...
>>>>>>>>>>>
>>>>>>>>>>> Get the latest code from subversion.
>>>>>>>>>>> Go to the samples directory and do ./app.server.
>>>>>>>>>>> Point your browser at http://localhost:8080/user.
>>>>>>>>>>> You should have a working example of how livesearch works.
>>>>>>>>>>>
>>>>>>>>>>> -John
>>>>>>>>>>>
>>>>>>>>>>> On 6/15/11 4:15 PM, "wfdudley" <wfdu...@gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>>John,
>>>>>>>>>>>>
>>>>>>>>>>>>Thanks!
>>>>>>>>>>>>
>>>>>>>>>>>>I installed from svn and now have version 3.79, up from 3.64.
>>>>>>>>>>>>
>>>>>>>>>>>>What do you mean by: "include the gantry.js file on your page" ?
>>>>>>>>>>>>I see the gantry.js file in the gantry/js directory but have no
>>>>>>>>>>>>idea
>>>>>>>>>>>> what
>>>>>>>>>>>>to do with it. I know it's java, that's about it.
>>>>>>>>>>>>
>>>>>>>>>>>>The search button (which I had figured out how to make appear
>>>>>>>>>>>>before)
>>>>>>>>>>>>does nothing right now.
>>>>>>>>>>>>
>>>>>>>>>>>>Can one have more than one field in a table "searchable" ?
>>>>>>>>>>>>
>>>>>>>>>>>>Is there an example I can look at that has REAL search
>>>>>>>>>>>>capability?
>>>>>>>>>>>>Not
>>>>>>>>>>>>just
>>>>>>>>>>>>hand waving about how easy it is to add search, a real example?
>>>>>>>>>>>>
>>>>>>>>>>>>Thanks again,
>>>>>>>>>>>>Bill
>>>>>>>>>>>>
>>>>>>>>>>>>On 6/15/11, John Weigel <John....@knology.com> wrote:
>>>>>>>>>>>>> Hi Bill,
>>>>>>>>>>>>>
>>>>>>>>>>>>> Gantry is still alive - more or less. You'll want to use the
>>>>>>>>>>>>>version
>>>>>>>>>>>>> in
>>>>>>>>>>>>> subversion as the version in cpan is somewhat out of date.
>>>>>>>>>>>>>There
>>>>>>>>>>>>>is
>>>>>>>>>>>>> some
>>>>>>>>>>>>> built-in search functionality. You can set livesearch to 1
>>>>>>>>>>>>>inside
>>>>>>>>>>>>>your
>>>>>>>>>>>>> do_main method and you'll get a search box on the results
>>>>>>>>>>>>>page.
>>>>>>>>>>>>> Setting
>>>>>>>>>>>>> searchable to 1 inside of your table field block will make it
>>>>>>>>>>>>>so
>>>>>>>>>>>>>that
>>>>>>>>>>>>> column is searched. Here's a simple example:
>>>>>>>>>>>>>
>>>>>>>>>>>>> controller Customer is CRUD {
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> method do_main is main_listing {
>>>>>>>>>>>>> controls_table customer;
>>>>>>>>>>>>> livesearch 1;
>>>>>>>>>>>>> }
>>>>>>>>>>>>>
>>>>>>>>>>>>> }
>>>>>>>>>>>>>
>>>>>>>>>>>>> table bp_ach_errors {
>>>>>>>>>>>>> field id {
>>>>>>>>>>>>> is int4, primary_key, auto;
>>>>>>>>>>>>> }
>>>>>>>>>>>>> field name {
>>>>>>>>>>>>> is varchar;
>>>>>>>>>>>>> label Name;
>>>>>>>>>>>>> html_form_type text;
>>>>>>>>>>>>> searchable 1;
>>>>>>>>>>>>>
>>>>>>>>>>>>> }
>>>>>>>>>>>>> }
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> You'll also need to include the gantry.js file on your page.
>>>>>>>>>>>>>The
>>>>>>>>>>>>>searching
>>>>>>>>>>>>> uses the livesearch method in there.
>>>>>>>>>>>>>
>>>>>>>>>>>>> -John
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 6/13/11 3:19 PM, "William Dudley" <wfdu...@gmail.com>
>>>>>>>>>>>>>wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>>Hi,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>I hope that Gantry is still a live project -- activity seems
>>>>>>>>>>>>>>to
>>>>>>>>>>>>>>have
>>>>>>>>>>>>>>dried up 3 years ago, including bug fixes.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>I've been working on using Bigtop/Gantry to build a simple
>>>>>>>>>>>>>>CRUD
>>>>>>>>>>>>>>interface for my company. Just customers
>>>>>>>>>>>>>>and invoices and such, nothing terribly tricky. And I've been
>>>>>>>>>>>>>>programming in Perl for quite a while, but am
>>>>>>>>>>>>>>NOT more than passing familiar with MVC, having used Rails
>>>>>>>>>>>>>>for a
>>>>>>>>>>>>>>bit
>>>>>>>>>>>>>>at the last job.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>So -- there is no "search" function in Bigtop/Gantry? None at
>>>>>>>>>>>>>>all?
>>>>>>>>>>>>>>There's not even much mention of
>>>>>>>>>>>>>>it in any of the docs, including Phil's book.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Can somebody point me to a *simple* example of adding search
>>>>>>>>>>>>>>to
>>>>>>>>>>>>>>a
>>>>>>>>>>>>>>*simple* application, like any of the
>>>>>>>>>>>>>>tutorial examples? I just have no idea where the various
>>>>>>>>>>>>>>pieces
>>>>>>>>>>>>>>go,
>>>>>>>>>>>>>>and am frankly overwhelmed by the
>>>>>>>>>>>>>>sheer number of Perl modules needed to do anything.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Thanks,
>>>>>>>>>>>>>>Bill Dudley
>>>>>>>>>>>>>>avalon telecom
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>(Oh yeah - fresh install of Bigtop/Gantry from CPAN, Linux
>>>>>>>>>>>>>>box,
>>>>>>>>>>>>>>mysql
>>>>>>>>>>>>>>db, and I doubt any of this matters.)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>--
>>>>>>>>>>>>>>You received this message because you are subscribed to the
>>>>>>>>>>>>>>Google
>>>>>>>>>>>>>>Groups
>>>>>>>>>>>>>>"Gantry" group.
>>>>>>>>>>>>>>To post to this group, send email to gan...@googlegroups.com.
>>>>>>>>>>>>>>To unsubscribe from this group, send email to
>>>>>>>>>>>>>>gantry+un...@googlegroups.com.
>>>>>>>>>>>>>>For more options, visit this group at
>>>>>>>>>>>>>>http://groups.google.com/group/gantry?hl=en.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>

John Weigel

unread,
Jun 17, 2011, 1:47:07 PM6/17/11
to wfdudley, gan...@googlegroups.com
I just realized you also need jquery for the liveupdate function to work.
Do you have jquery.js in your js directory? If not either download it and
put it there or you can copy the version out of gantry to your project.
Check to make sure your app is successfully serving out both the
javascript files by accessing the following in your browser:

http://localhost:8080/static/js/jquery.js

http://localhost:8080/static/js/gantry.js


Also do a view source on the webpage and check that the script elements in
the wrapper are pointing to the correct javascript source files.

-John
Reply all
Reply to author
Forward
0 new messages