Grokbase
Topics Posts Groups | in
x
[ help ]

jshirley

Profile | Recent Topics | Posts (94) | Saved Groups (3) Posts (4) | Tagged system:unfiled » all posts
1) [Catalyst] C::P::UploadProgress Patch
saved to system:unfiled | saved by 1 person
Adam Herzog [Catalyst] C::P::UploadProgress Patch
| +2 votes
Hi, all. I'm using Catalyst::Plugin::UploadProgress on a project of mine, and it works great. At...
Catalyst Framework
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Hi, all.

I'm using Catalyst::Plugin::UploadProgress on a project of mine, and  
it works great. At least, until I tried to deploy the application.  
The plugin and accompanying javascript only works correctly if the  
app is deployed at the root (ie, it always checks /progress).

I've attached a patch (svn diff) which allows the plugin to be used  
when an app is deployed at a non-root location, like http://
domain.tld/myapp/.

I would have liked to add some tests for my changes, but, to be  
honest, I don't really know how to test deployment issues like this.  
If somebody has some pointers, I'd be happy to add the appropriate  
tests.

If there aren't any problems with it, can somebody apply the patch  
and push a new release, please?

Thanks,
-A


Index: lib/Catalyst/Plugin/UploadProgress.pm
===================================================================
--- lib/Catalyst/Plugin/UploadProgress.pm       (revision 6455)
+++ lib/Catalyst/Plugin/UploadProgress.pm       (working copy)
@@ -41,8 +41,9 @@
      # if the URI is /progress?progress_id=<id> intercept the request
      # and display the progress JSON.

-    my $query = $c->req->uri->path_query;
-    if ( $query =~ /^\/progress\?progress_id=[a-f0-9]{32}$/ ) {
+    my $base  = $c->request->base;
+    my $query = $c->req->uri;
+    if ( $query =~ /^${base}progress\?progress_id=[a-f0-9]{32}$/ ) {
          return $c->upload_progress_output( $c->req->params-> 
{progress_id} );
      }

@@ -199,6 +200,21 @@
C::E::Apache2::MP20 1.07 with Apache 2.0.58, mod_perl 2.0.2 (OSX)
C::E::FastCGI with Apache 2.0.55, mod_fastcgi 2.4.2 (Ubuntu)
+=head2 NON-ROOT DEPLOYMENT
+
+By default, the javascript uses the URL /progress in order to check  
on the
+status of the upload. If you are deploying your application in a non-
root
+location, like http://domain.com/myapp, you will also need to add an
+additional piece of javascript to your pages. This will let the  
progress
+checking javascript know the correct base path to use in the URL.
+
+If you are using Template Toolkit for your view, you can add the  
following to
+the <head> section of your pages.
+
+    <script type="text/javascript">
+        request_base = '[% Catalyst.request.base %]';
+    </script>
+
=head1 INTERNAL METHODS
You don't need to know about these methods, but they are documented
Index: lib/Catalyst/Plugin/UploadProgress/Static.pm
===================================================================
--- lib/Catalyst/Plugin/UploadProgress/Static.pm        (revision 6455)
+++ lib/Catalyst/Plugin/UploadProgress/Static.pm        (working copy)
@@ -122,6 +122,7 @@
__upload_progress_js__
var progress;
+var request_base = '/';
function startPopupProgressBar(form, options) {
      var id = generateProgressID();
@@ -203,7 +204,7 @@
function reportUploadProgress() {

-    url = '/progress?progress_id=' + progress.id;
+    url = request_base + 'progress?progress_id=' + progress.id;
      var req = new XMLHttpRequest();
      req.open('GET', url, Boolean(handleUploadProgressResults));
Index: Changes
===================================================================
--- Changes     (revision 6455)
+++ Changes     (working copy)
@@ -1,5 +1,7 @@
Revision history for Perl extension Catalyst::Plugin::UploadProgress
+        - Now works under non-root deployment.
+
0.03    2006-10-18 22:15:00
          - Handle race condition where progress handler is
            called before any upload data is received.
Index: example/Upload/root/static/js/progress.js
===================================================================
--- example/Upload/root/static/js/progress.js   (revision 6455)
+++ example/Upload/root/static/js/progress.js   (working copy)
@@ -1,5 +1,6 @@
var progress;
+var request_base = '/';
function startPopupProgressBar(form, options) {
      var id = generateProgressID();
@@ -81,7 +82,7 @@
function reportUploadProgress() {

-    url = '/progress?progress_id=' + progress.id;
+    url = request_base + 'progress?progress_id=' + progress.id;
      var req = new XMLHttpRequest();
      req.open('GET', url, Boolean(handleUploadProgressResults));

_______________________________________________
List: [email protected: Cat...@lists.rawmode.org]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/
2) [Catalyst] New Catalyst powered site
saved to system:unfiled | saved by 1 person
Matthew Pitts [Catalyst] New Catalyst powered site
| +1 vote
I would like to announce the release of a new Catalyst powered site, www.tangeroutlet.com. The...
Catalyst Framework
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
I would like to announce the release of a new Catalyst powered site,
www.tangeroutlet.com.

The project was a complete rewrite of an existing CGI/mod_perl/etc.
mess. It is running fastcgi under Apache+mod_fcgid on a dual Opteron
system with SLES 10 installed and handles about 33k requests a day. It
is a pretty standard Catalyst app, except for the templating - we chose
HTML::Template.

I would like to extend my thanks to all of those who have helped develop
Catalyst and it's many plugins. It has been a fun system to learn and
deploy and I hope that I have some code worth contributing at some
point.

v/r

--
Matthew Pitts <mpitts@a3its.com>
A3 IT Solutions, LLC

_______________________________________________
List: [email protected: Cat...@lists.rawmode.org]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/
3) [Catalyst] Trapping exit/respawning FastCgiExternalServer
saved to system:unfiled | saved by 1 person
Andrew Peebles [Catalyst] Trapping exit/respawning FastCgiExternalServer
| +1 vote
Running a "production" Catalyst app as a FastCgiExternalServer. Occasionally it crashes. I'd like...
Catalyst Framework
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Running a "production" Catalyst app as a FastCgiExternalServer.  
Occasionally it crashes.  I'd like to trap that event, use StackTrace 
and send the web admin email (with the trace) to alert them to the
crash.  Ideally I would even like to have the app respawned.  Haven't 
figured out how ...



_______________________________________________
List: [email protected: Cat...@lists.rawmode.org]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/
4) [Dbix-class] Several InflateColumn modules to release
saved to system:unfiled | saved by 1 person
Mike Friedman [Dbix-class] Several InflateColumn modules to release
| +1 vote
Greetings, I'm putting the finishing touches on a group of InflateColumn modules which I thought...
DBIx::Class
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Greetings,

I'm putting the finishing touches on a group of InflateColumn modules
which I thought might be useful CPAN releases; they're all pretty
trivial, though, so it seems a bit obnoxious to make an entire
distribution for each one. Should I bundle them all together in a
single distribution or upload them separately? Here are the ones I
have which don't overlap with stuff already on CPAN:

InflateColumn::URI  -- turns URI/URL fields into URI objects
InflateColumn::Twig -- turns XML chunks into XML::Twig objects
InflateColumn::GD -- turns a binary field with an image into a GD object
InflateColumn::YAML -- turns a YAML chunk into Perl data structure
InflateColumn::JSON -- same thing but for JSON data


Mike
spacer
Profile | Recent Topics | Posts (94) | Saved Groups (3) Posts (4) | Tagged system:unfiled » all posts
Home > People > jshirley > Saved Posts > system:unfiled