[fw-general] Firefox Ajax problem

2009-10-13 Thread moesian

Hi I'm having a problem in Firefox detecting if the request is xmlHttpRequest
in my php code, my code seems to work fine when using IE and Chrome. I'm
using Magento which is based on the Zend Framework and using the Zend
isXmlHttpRequest() function to test whether or not the request is an xhr one
or not. In Firefox this seems to return false even when I make an ajax call
using Prototype.

Here's the prototype code, perhaps I'm doing something wrong here:

var shop = {
cart: {
init: function(){
var product_forms  = $$('.ajax-add-to-cart');
if (!product_forms[0]) return;
product_forms.invoke('observe', 'submit', 
shop.cart.add);
},
add: function(e){
var ele = e.element();
ele.request({
onFailure: function() {},
onSuccess: function(t) 
{$('header-cart').replace(t.responseText);}
});
Event.stop(e); // stop the form from submitting

},
remove: function(productId){

}
}
}

And here's the php code that tests if its an xhr request:

if($this-getRequest()-isXmlHttpRequest())
{
$this-loadLayout();

$this-getResponse()-setBody($this-_getSideCartHtml());
}
else
{
Varien_Profiler::start(__METHOD__ . 'cart_display');
$this-loadLayout();
$this-_initLayoutMessages('checkout/session');
$this-_initLayoutMessages('catalog/session');

$this-getLayout()-getBlock('head')-setTitle($this-__('Shopping
Cart Ajax 2'));
$this-renderLayout();
Varien_Profiler::stop(__METHOD__ . 'cart_display');
}

Thanks in advance for any help, this one has me really scratching my head.
-- 
View this message in context: 
http://www.nabble.com/Firefox-Ajax-problem-tp25868337p25868337.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught?

2009-10-13 Thread bytte

Thanks man. Appreciate your answer so long after the thread was started.



Ryan Lange wrote:
 
 This is an old thread, but I noticed that no one actually hit upon the
 *real* problem.
 
 On Mon, Feb 16, 2009 at 7:28 AM, bytte thomas.bytteb...@gmail.com wrote:
 

 Bug in my code or bug in Zend Framework?

 
 Neither. It's an unfortunate short-coming of PHP itself.
 
 http://us3.php.net/manual/en/ini.core.php#ini.post-max-size : If the size
 of post data is greater than post_max_size, the $_POST and $_FILES
 superglobals are empty.
 
 Files are uploaded as post data. If the file being uploaded pushes the
 post
 data beyond the size allowed in php.ini, you get empty $_POST and $_FILES
 superglobals, which is why ZF complains about not being able to find your
 file field.
 
 

-- 
View this message in context: 
http://www.nabble.com/User-uploads-file-bigger-than-what%27s-allowed-in-php.ini%2C-can-it-be-caught--tp21936346p25869083.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Firefox Ajax problem

2009-10-13 Thread Thorsten Suckow-Homberg
Hey there,
 
Hi I'm having a problem in Firefox detecting if the request is xmlHttpRequest
in my php code, my code seems to work fine when using IE and Chrome. I'm
using Magento which is based on the Zend Framework and using the Zend
isXmlHttpRequest() function to test whether or not the request is an xhr one
or not. In Firefox this seems to return false even when I make an ajax call
using Prototype.
this is not a direct answer to your question, but you might want to check out 
the ContextSwitch-ActionHelper, which automates a lot for you regarding 
deciding whether to treat the incoming calls as AJAX requests. 
See 
http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.contextswitch
 - it saved me a lot of time in my AJAX powered apps.

Regards

Thorsten

-- 
Thorsten Suckow-Homberg
Jakobstrasse 214-216
52064 Aachen
http://www.siteartwork.de

Tel.:  0151 -10927135
Email: t...@siteartwork.de

You should follow me on Twitter: http://twitter.com/ThorstenSuckow

Sent with conjoon. Visit http://www.conjoon.org


Re: [fw-general] Zend pdf and vertical text

2009-10-13 Thread scs
Hi,
The following link might be an answer to my question below:
http://zendpdftable.sourceforge.net/

scs

On Sun, Oct 11, 2009 at 9:45 AM, scs sasc...@gmail.com wrote:
 and one more question from me:
 is there an practical way of printing tabular data in a pdf file
 generated by zend_pdf?

 scs

 On Sun, Oct 11, 2009 at 9:22 AM, Sergio Rinaudo
 kaiohken1...@hotmail.com wrote:
 Great,
 thanks!

 I just need to 'rotate' the page

 $page-rotate(0, 0, M_PI/12);
 $page-drawText('Hello world!', 150, 100);





 Date: Sun, 11 Oct 2009 01:02:34 -0500
 From: ralph.schind...@zend.com
 To: kaiohken1...@hotmail.com
 CC: fw-general@lists.zend.com
 Subject: Re: [fw-general] Zend pdf and vertical text

 Have a look here:
 http://devzone.zend.com/article/2525

 There are some hints in there.

 Hope it helps,
 -ralph

 Sergio Rinaudo wrote:
  Hello,
  is it possible using Zend_Pdf to draw a text vertically?
  I did not find anything in the documentation.
  Thanks
 
  
  Un' immagine personale per Messenger? Crea il tuo Avatar!
  http://avatarstudio.it.msn.com/

 
 Il tormentone dell'estate? Riascoltalo sulla Messenger Radio



[fw-general] Problems with getting Zend_Test correctly working

2009-10-13 Thread Koen
Hi All,

I forced myself to start writing unit tests (which I thought was the hardest
part), but trying to getting it work properly seems a bit harder :)

I'm trying to get it working for an existing ZF 1.9.2 project. For that
project I'm using Zend_Application to bootstrap everything in a
Bootstrap.php file and some things in an ini file, like:
resources.layout.layout = main
resources.layout.layoutPath = APPLICATION_PATH /layouts
resources.frontController.controllerDirectory.default = APPLICATION_PATH
/default/controllers
resources.frontController.controllerDirectory.cms = APPLICATION_PATH
/cms/controllers

In my tests folder I have a TestHelper.php which sets some constants and
includes paths and initializes Zend_Loader_Autoloader.
I have a separate bootstrap.php file containing:
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/config/config.ini'
);

$bootstrap = $application-bootstrap()-getBootstrap();
$bootstrap-bootstrap();

In the test file 'controllers/IndexControllerTest.php' I require
TestHelper.php and the public property $bootstrap contains: 'bootstrap.php'.

When running 'phpunit --verbose controllers\IndexControllerTest.php' it just
seems to die. When commenting the 2 layout entries out in the ini file
(resources.layout.layout, see above) it continues correctly, but a plugin
fails, because the layout cannot be requested from the bootstrap...

Why can't the layout be set in the bootstrap (via .ini) for testing
controllers? Does someone have a solution for this?

Thanks in advance.

- Koen


Re: [fw-general] HeadMeta

2009-10-13 Thread David Mintz
On Mon, Oct 12, 2009 at 11:55 PM, Hector Virgen djvir...@gmail.com wrote:

 Another way around this would be to set your default description early
 (like in a bootstrap init method) and let your view scripts override it
 when necessary.


Let your view scripts override it when necessary -- that's exactly what I am
not figuring out how to do.

My scenario is slightly different, but typical. I want my layout to detect
if there's a logged in user; if so, display Welcome User Foo , otherwise
display a link to the login page. No problem.

If, however, the current page itself is the login page, I want to suppress
the welcome/log in message entirely. Thus, in my layout,

$this-placeholder('loginBox')-captureStart();?
div id=loginDiv
?php if ($this-user) :?Welcome ?=$this-user-firstname?
?php else:?
a href=/users/login/ /a[log in]/a
?php endif;?
/div
?php $this-placeholder('loginBox')-captureEnd();

and later in the layout script,

?= $this-placeholder('loginBox')?

Once I get into login.phtml, I can't seem to reset the content of the
placeholder to empty string, or unset it, or otherwise prevent it from being
displayed, having tried exchangeArray() and various other tricks. It seems
it's already been output to the browser and that's that. What am I missing?

Thanks a million,

-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


[fw-general] Module Boostraps and parent resources

2009-10-13 Thread Philip G
I'm going to do my best to explain this.

So, we have the ability to create independent bootstraps for each module, as
well as having a parent bootstrap within the application directory.

I'm having an issue accessing resources from the parent within the module
based bootstraps.

For example, I have a resource 'db' defined within the parent. However, none
of the module bootstraps can see it. The DB connections are the same: I
don't want to have to repeat the db connections several times (that's the
point of inheritance, no?).

In my application.xml I have the following lines:

resources !-- Base? Parent? --

db adapter=pdo_mysql

params host=unknown.prodserver username=prod
password=prod

dbname=prod port= /

/db
modulesplaceholder //modules
.

/resources

admin !-- Inherits from base? right? --

resources



/resources
/admin

Within my Admin_Bootstrap, I have the following two lines:
$this-bootstrap( 'db' );
$db = $this-getResource('db');

The error I'm getting is:  'Resource matching db not found'
What I expected was to get the base global resource, 'db' from the parent.

Is there a way to allow Admin_Bootstrap to see the parent db resource,
without having to repeat the db connection several times?

---
Philip
g...@gpcentre.net
http://www.gpcentre.net/


Re: [fw-general] Firefox Ajax problem

2009-10-13 Thread Matthew Weier O'Phinney
-- moesian rolandlamb...@googlemail.com wrote
(on Tuesday, 13 October 2009, 12:28 AM -0700):
 
 Hi I'm having a problem in Firefox detecting if the request is xmlHttpRequest
 in my php code, my code seems to work fine when using IE and Chrome. I'm
 using Magento which is based on the Zend Framework and using the Zend
 isXmlHttpRequest() function to test whether or not the request is an xhr one
 or not. In Firefox this seems to return false even when I make an ajax call
 using Prototype.

If you're using FireBug (and if you're not, you should be), check to see
what request headers are sent during your XHR call. 

What ZF does is look for the header:

X-Requested-With: XMLHttpRequest

If that header isn't present, then isXmlHttpRequest() evaluates to
false.

There are two ways to get around that situation:

 * Most JS toolkits allow you to pass custom headers when making an XHR;
   good JS toolkits allow you to extend the functionality of the XHR
   functionality to add the headers in so that *all* calls will add
   them.

 * Alternately, send a special query parameter that you can check for in
   your code. If you use the parameter format, you can then also start
   doing some fun stuff with the ContextSwitch action helper in ZF. :)

 Here's the prototype code, perhaps I'm doing something wrong here:
 
 var shop = {
 cart: {
   init: function(){
   var product_forms  = $$('.ajax-add-to-cart');
   if (!product_forms[0]) return;
   product_forms.invoke('observe', 'submit', 
 shop.cart.add);
   },
   add: function(e){
   var ele = e.element();
   ele.request({
   onFailure: function() {},
   onSuccess: function(t) 
 {$('header-cart').replace(t.responseText);}
   });
   Event.stop(e); // stop the form from submitting
   
   },
   remove: function(productId){
   
   }
   }
 }
 
 And here's the php code that tests if its an xhr request:
 
   if($this-getRequest()-isXmlHttpRequest())
   {
   $this-loadLayout();
   
 $this-getResponse()-setBody($this-_getSideCartHtml());
   }
   else
   {
   Varien_Profiler::start(__METHOD__ . 'cart_display');
   $this-loadLayout();
   $this-_initLayoutMessages('checkout/session');
   $this-_initLayoutMessages('catalog/session');
   
 $this-getLayout()-getBlock('head')-setTitle($this-__('Shopping
 Cart Ajax 2'));
   $this-renderLayout();
   Varien_Profiler::stop(__METHOD__ . 'cart_display');
   }
 
 Thanks in advance for any help, this one has me really scratching my head.
 -- 
 View this message in context: 
 http://www.nabble.com/Firefox-Ajax-problem-tp25868337p25868337.html
 Sent from the Zend Framework mailing list archive at Nabble.com.
 

-- 
Matthew Weier O'Phinney
Project Lead| matt...@zend.com
Zend Framework  | http://framework.zend.com/


[fw-general] Custom validator not run when a Zend_Form field is empty?

2009-10-13 Thread ramonhimera

The problem i had was that my custom validator was not being called when the
value of the input (select) was empty. I couldnt use setRequired() because
in some cases (dependent upon another form value) i want to process empty
values.
The solution was to do the following:

$organiser_member = new Zend_Form_Element_Text(’organiser_member’);
$organiser_member-setLabel(’* Organiser:’);

// Force empty values through the custom validator!
$organiser_member-setRequired(false);
$organiser_member-setAllowEmpty(false);

// Add the custom validator
$organiser_member-addPrefixPath(’BC_Validate’, ‘BC/Validate’, ‘validate’);
$organiser_member-addValidator(’EventOrganiser’, false);
$form-addElement($organiser_member);

Now the custom validator is always called, whether the input
‘organiser_member’ is set or not.

-- 
View this message in context: 
http://www.nabble.com/Custom-validator-not-run-when-a-Zend_Form-field-is-empty--tp23666798p25874140.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend Framework 1.9.4 Released

2009-10-13 Thread Matthew Weier O'Phinney
The Zend Framework team is pleased to announce the immediate
availability of the 1.9.4 release. This release is the fourth
maintenance release in the 1.9 series.
 
You may download it from: 
 
http://framework.zend.com/download/latest

For a full list of closed issues, you can visit:

http://framework.zend.com/changelog/1.9.4

Many thanks to all the contributors who helped with this release: issue
reporters, documentation translators, and code contributors alike; the
project gets better each release as the direct result of your efforts!

--- 
Bug Hunt this week!

Also, a reminder: our monthly bug hunt days are this week, Thursday and
Friday, 15 and 16 October 2009! Join us on IRC on Freenode/#zftalk.dev
and help close out the issue backlog!

-- 
Matthew Weier O'Phinney
Project Lead| matt...@zend.com
Zend Framework  | http://framework.zend.com/