Re: [fw-general] Zend_Payment proposal ready for review

2010-09-14 Thread Cameron
How long until it's ready to roll? I'm looking at implementing ANZ eGate in
the next few weeks, sounds like I'm going to have to do a hack job for now
and roll on the proper code base once it's done.

On Tue, Sep 14, 2010 at 9:58 AM, Dmitriy Soroka
dmitriy.sor...@magento.comwrote:

  Hi everyone



 Zend_Payment proposal (
 http://framework.zend.com/wiki/display/ZFPROP/Zend_Payment+-+Dmitriy+Soroka) 
 is ready for review.



 Main goal of current proposal is provide common way of integration with
 different gateways.

 It will supersede Vadim Gabriel’s because few reasons:

 - base data containers level definition

 - more flexible api for payment gateway

 - strict requirements for payment transaction request



 I would like to ask all of you to check out the proposal and to provide
 comments



 Thank you,

 Dmitriy



[fw-general] Payment Gateway solutions

2010-08-26 Thread Cameron
Hi guys,

Anyone know if there's any components out there for implementing payment
gateways in our ZF apps? I'm half considering pulling the components out of
Magento, or trying to get the Zend_Payment proposal up and going, but
obviously it'd be easier if there were some relatively simple drop-in
components that did a fairly good job, and could be extended to support
whatever gateway we need. I looked at ezcomponents, nothing there either...

Regards,

Cameron


Re: [fw-general] Re: Zend_Rest_Route doesn't work when not in the web root.

2010-05-11 Thread Cameron
For the sake of completion, I should point out that that isn't a problem,
and Zend_Rest_Route works just fine in sub directories.

It ended up being the codepath i thought was happening wasn't, it went
around that through a ridiculous chain of redirections through three or four
controllers that actually ended up coming back to the right controller in
some situations but failing in others. Sorry to have bothered the list over
my own bugs!

On Mon, May 10, 2010 at 5:57 PM, Cameron themsel...@gmail.com wrote:


 A bit of further examination on this one hasn't gotten me too much further,
 except that: Zend_Rest_Route is definitely catching the URL correctly, it's
 just for some reason it is stripping off the format=json before passing it
 on to the Index controller action. Can't seem to work out why, I don't
 actually know what code is calling all this to pull it apart and see.

 I've managed to work around it for now by defaulting the index action
 controller to return JSON, but it's not an ideal solution. So, anyone know
 where to start hunting down the reason why a Zend_Rest_Route is stripping
 off params when matching a sub directory but leaves them in place for a
 request off the root directory?
 --
 View this message in context:
 http://zend-framework-community.634137.n4.nabble.com/Zend-Rest-Route-doesn-t-work-when-not-in-the-web-root-tp2133790p2165177.html
 Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Re: Zend_Rest_Route doesn't work when not in the web root.

2010-05-10 Thread Cameron

A bit of further examination on this one hasn't gotten me too much further,
except that: Zend_Rest_Route is definitely catching the URL correctly, it's
just for some reason it is stripping off the format=json before passing it
on to the Index controller action. Can't seem to work out why, I don't
actually know what code is calling all this to pull it apart and see. 

I've managed to work around it for now by defaulting the index action
controller to return JSON, but it's not an ideal solution. So, anyone know
where to start hunting down the reason why a Zend_Rest_Route is stripping
off params when matching a sub directory but leaves them in place for a
request off the root directory? 
-- 
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Rest-Route-doesn-t-work-when-not-in-the-web-root-tp2133790p2165177.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] Zend_Rest_Route doesn't work when not in the web root.

2010-05-07 Thread Cameron
Hi guys, not really sure whether this is an issue with REST as a protocol
definition or it's a Zend thing...

In my bootstrap I have support for both regular routes and RESTful routes.
It is achieved like this:

protected function _initRestRoute() {
$this-bootstrap('Request');
$front = $this-getResource('FrontController');
$restRoute = new Zend_Rest_Route($front);
$defaultRoute = new Zend_Controller_Router_Route(
':controller/:action/*', array('module' = 'default'),
array('action' = '^[a-z][a-z0-9.-]+')
);
$front-getRouter()-addRoute('rest', $restRoute);
$front-getRouter()-addRoute('default', $defaultRoute);
}

When I go like : http://www.example.com/controller/?format=json the RESTful
route catches it and returns the list view just fine, which is exactly what
it should do. The problem comes with sub directories - if I have the
application sitting in a sub directory, then the REST router no longer
catches the route.
http://www.example.com/sub/directory/controller/?format=json simply doesn't
work.

Is this by design? Is it not meant to work? Or am I doing something wrong?


Re: [fw-general] model attached to a view helper

2010-03-30 Thread Cameron
I frequently pass full model instances through to my views and retrieve
information from them, but I don't write code in the models that is
specifically used for display purposes - as an example, if there's a method
calculateOutstandingBalance(), it's just going to return a float, it's the
exact same method and return value that I'd use if I called it from
somewhere else in the model. I would wrap the dollar sign around it and pad
it to two decimal places in the view though, because that's display logic.

I suppose the other option is to write controllers that simply list every
variable you're going to want to display and call the appropriate method to
fill their values, but that seems really dumb to me.

On Wed, Mar 31, 2010 at 6:58 AM, My Lists l...@eduardocury.net wrote:

 Hello people, check out this example found at :

 http://framework.zend.com/manual/en/performance.view.html


 class My_View_Helper_BugList extends Zend_View_Helper_Abstract
 {
 public function bugList()
 {
 $model = new Bug();
 $html  = ul\n;
 foreach ($model-fetchActive() as $bug) {
 $html .= sprintf(
 lib%s/b: %s/li\n,
 $this-view-escape($bug-id),
 $this-view-escape($bug-summary)
 );
 }
 $html .= /ul\n;
 return $html;
 }
 }


 I like the approach to attach the Model inside view helper for
 specific stuff and reusability. Im right now needing a helper exactly
 like this but i dont know if i'm violating any pattern rule.

 One guy as commented out about above example that this is a bad
 practive since the view shouldn't know the model. What do you think
 about this ? Should i go ahead in the same way?

 I have read in many places that this is pretty acceptable in the MVC,
 just wanted to confirm this.

 Thanks,



[fw-general] Tying Dojo and Zend form validation together - I'm dreaming, right?

2010-03-22 Thread Cameron
Hi guys, I've got a pie in the sky idea, and I'm just wondering if it's even
remotely possible, or if I should give up and try something else.

I've got a bunch of Zend_Dojo_Form forms with a bunch of custom validators
on the Zend side - they work fine, the form errors out when values are
incorrect, it's all working exactly as you'd expect, however, what I'd also
like is for the same validators to work on the Dojo client side of the form
- but without having to completely re-implement them, validator by
validator.

I understand that at its simplest level, the Dojo isValid method doesn't
know or care about the application behind it, and indeed for it to even be
able to get access to the errors in the application it'd have to attempt a
submit, which isn't what it's meant to do, but has anyone tried a system of
something like:

1. override form onSubmit to add our code
2. test Dojo isValid()
3. if the Dojo side is happy, AJAX submit the form
4. if successful, which would be returned i don't know how, then forward on
to the appropriate page
5. if not successful, then (and this is where it gets tricky I guess) pass
back enough data to know what field errored out, what the error was, and
then call enough of the Dojo isValid internal guts to make the form look
like it didn't validate?

Sorry to just be airing ideas like this, I just figured it might be really
useful if we could come up with a way to sort of globally add custom
validators to our forms that work both client and server side, without
having to implement them uniquely on both sides.


Re: [fw-general] Zend_Auth::getInstance()-clearIdentity() doesn't seem to log me out?

2010-03-08 Thread Cameron
On Tue, Mar 9, 2010 at 10:49 AM, Jake McGraw jmcgr...@gmail.com wrote:



 On Mon, Mar 8, 2010 at 8:51 PM, Cameron themsel...@gmail.com wrote:

 Ok, I just tried removing everything except for

 $data = $authAdapter-getResultRowObject(null, 'password');
 $auth-getStorage()-write($data);

 all, the $authNamespace stuff is gone, and it makes no difference - still
 can't log out. Does clearIdentity() not work when there's something in the
 Zend_Auth instance's storage? Because I use the storage all around my
 application... It forms the basis of my ACL class...

 Oh. Ok. Is it possible that Zend_Auth's storage is completely separate
 to the authenticated session? that clearIdentity() doesn't touch it?


 Typically, I don't mess with the identity created by the Auth Adapter.
 However, there are instances where you need to store more than the $identity
 (which may only be an email or userId), for that I use Session_Namespace,
 check out my example:

 http://gist.github.com/326089

 - jake



So I'm doing this wrong? Because I've been pulling my identity out of
Zend_Auth like this: Zend_Auth::getInstance()-getStorage()-read()-id... I
don't recall why I was doing it like that, but it seemed to work at the
time.


Re: [fw-general] Zend_Auth::getInstance()-clearIdentity() doesn't seem to log me out?

2010-03-08 Thread Cameron
On Tue, Mar 9, 2010 at 1:28 PM, Jake McGraw jmcgr...@gmail.com wrote:

 On Tue, Mar 9, 2010 at 12:05 AM, Cameron themsel...@gmail.com wrote:
 
 
  On Tue, Mar 9, 2010 at 10:49 AM, Jake McGraw jmcgr...@gmail.com wrote:
 
 
  On Mon, Mar 8, 2010 at 8:51 PM, Cameron themsel...@gmail.com wrote:
 
  Ok, I just tried removing everything except for
 
  $data = $authAdapter-getResultRowObject(null, 'password');
  $auth-getStorage()-write($data);
 
  all, the $authNamespace stuff is gone, and it makes no difference -
 still
  can't log out. Does clearIdentity() not work when there's something in
 the
  Zend_Auth instance's storage? Because I use the storage all around my
  application... It forms the basis of my ACL class...
 
  Oh. Ok. Is it possible that Zend_Auth's storage is completely
  separate to the authenticated session? that clearIdentity() doesn't
 touch
  it?
 
  Typically, I don't mess with the identity created by the Auth Adapter.
  However, there are instances where you need to store more than the
 $identity
  (which may only be an email or userId), for that I use
 Session_Namespace,
  check out my example:
  http://gist.github.com/326089
  - jake
 
  So I'm doing this wrong? Because I've been pulling my identity out of
  Zend_Auth like this:
 Zend_Auth::getInstance()-getStorage()-read()-id... I
  don't recall why I was doing it like that, but it seemed to work at the
  time.
 

 You aren't ever required to directly interface with the Zend_Auth
 Storage instance, though there is nothing technically wrong with it, I
 prefer Zend_Auth::getInstance()-getIdentity() if the identity is
 available.

 I think the disconnect here is that you're trying to store more than
 the user identity (email, userId, username, etc) inside the the
 instance of Zend_Auth storage, which isn't technically wrong, it's
 just not what the built in default storage system was written for. I
 work around this by using another persistent storage method, in my
 case Zend_Session_Namespace.

 - jake


Ok, well, I can remove all that extra stuff and rip it back down to just
using Zend_Auth::getInstance()-getIdentity(), I'm guessing that's going to
fix the clearIdentity() problem? It sounds to me like clearIdentity() does
exactly what it says, and that would need to log myself out by using some
sort of clearStorage() method as well...


Re: [fw-general] Zend_Auth::getInstance()-clearIdentity() doesn't seem to log me out?

2010-03-07 Thread Cameron
Sorry I haven't replied for a couple of days, I went on a fishing trip over
the weekend, it was pretty exciting, a mate of mine saw a crab swimming in
the water, he leapt in after it and caught it with bare hands!

Anyway, back to more technical matters - here's my login method. This might
be the issue. I copied and worked on this from some this is how you do user
auth tutorial about 40 versions of ZF ago...

public function logUserIn($email, $password) {
$config = Zend_Registry::get('config');
$salt = $config['password']['salt'];

   //setup Zend_Auth adapter for a database table
$db = DbTable_Base::getDefaultAdapter();
$authAdapter = new Zend_Auth_Adapter_DbTable(
   $db,
   'user',
   'email',
   'password', MD5(CONCAT('$salt',?)) AND
deleted=0);
$authAdapter-setIdentity($email)-setCredential($password);
//do the authentication
$auth = Zend_Auth::getInstance();
$result = $auth-authenticate($authAdapter);
if ($result-isValid()) {
//success: store database row to auth's storage system. (Not the
password though!)
$data = $authAdapter-getResultRowObject(null, 'password');
$auth = Zend_Auth::getInstance();
$auth-getStorage()-write($data);
$authNamespace = new Zend_Session_Namespace('Zend_Auth');
$authNamespace-id = $data-id;
$authNamespace-email = $data-email;
$authNamespace-role = $data-role;
$authNamespace-setExpirationSeconds(36000);
return true;
}
return false;
}

Is it possible the $authNamespace = new Zend_Session_Namespace('Zend_Auth');
stuff is incorrect? I mean it *works*, but is it correct?

On Fri, Mar 5, 2010 at 9:45 PM, Bart McLeod mcl...@spaceweb.nl wrote:

  My guess is that it will only help if you allow the request to complete
 within your application logic. That is why I suggest a _forward instead of a
 _redirect, but even that was a guess. I didn't yet try if a _redirect would
 break my application to.
 But now I have verified it, and it works equally well with a redirect as
 with a _forward. Even if I redirect to a complete different website.

 *Anyway, clearIdentity should be enough* within normal application flow.

 It may go wrong if you login someone automatically based on session data
 outside the reach of Zend_Auth. If you logout and then get logged in
 automatically based on derived session data, not encapsulated within
 Zend_Auth, then you are doing something wrong.

 clearIdentity() does the job. If it doesn't, something got out of control
 somewhere.

 I think you should be looking at how identity checking is done. Is it
 actually being performed for each access to your application?

 Regards,

 Bart McLeod

 Op 5-3-2010 14:21, Gina-Marie Rollock schreef:

  I have the following in my logout action:



 Zend_Session::destroy(true);



 after I clear my identity. Will that help?



 *From:* Bart McLeod [mailto:mcl...@spaceweb.nl mcl...@spaceweb.nl]
 *Sent:* Friday, March 05, 2010 4:06 AM
 *To:* Cameron
 *Cc:* Jake McGraw; Hector Virgen; Zend Framework - General
 *Subject:* Re: [fw-general] Zend_Auth::getInstance()-clearIdentity()
 doesn't seem to log me out?



 Hi  Cameron,

 Just some ideas. I assume you are using latest from trunk.

 If I try in my system to logout, I can logout. So nothing is wrong with the
 framework  I think. So we are looking at a problem in your logic somewhere.

 The first thing I thought was there could be something with redirecting the
 way you do. May you should be forwarding to your default action instead, so
 that the clearance of the identity can take effect before you redirect.

 I do this in my logout action:
 public function logoutAction()
 {
 Globals::logout();
 $this-_forward('index');
 }

 You can see that I do not redirect, but I forward. In this case to the
 default action of the login controller.

 Globals does the following:
 public static function logout()
 {
 $auth = Zend_Auth::getInstance();
 Zend_Registry::get('log')-info('Trying to clear identity');
 $auth-clearIdentity();
 }

 Since there is not much of a difference with your code, I think it must be
 the redirect.

 If that is not the issue, then I start to think of caching. Do you return
 cached content before you check the identity? In that case, logging out
 won't help once pages are cached. Just a thought.

 Regards,

 Bart McLeod




 Cameron schreef:

 I'm logged in because I can still access the entire application, something
 I can't do until I'm authorized. As for cookies, I dunno... there's nothing
 in the application that manually writes anything to a cookie, so it could
 only be Zend or general PHP session related...

 On Fri, Mar 5, 2010 at 12:54 PM, Jake McGraw jmcgr

[fw-general] Zend_Auth::getInstance()-clearIdentity() doesn't seem to log me out?

2010-03-04 Thread Cameron
Hi guys, I'm really not sure where I'm going with this one, it seems like I
must be doing something completely wrong, but I'm not really sure where to
even start looking.

Here's my logout action:

public function logoutAction() {
Zend_Auth::getInstance()-clearIdentity();
$this-_helper-redirector('/');
}

Pretty simple, right? The redirect certainly works, but for some reason, I'm
still logged in! I've even tried $_SESSION = ''; to brute force the session
to be deleted, but there i am, still logged in. Anyone got any ideas on this
one?


Re: [fw-general] Zend_Auth::getInstance()-clearIdentity() doesn't seem to log me out?

2010-03-04 Thread Cameron
I'm logged in because I can still access the entire application, something I
can't do until I'm authorized. As for cookies, I dunno... there's nothing in
the application that manually writes anything to a cookie, so it could only
be Zend or general PHP session related...

On Fri, Mar 5, 2010 at 12:54 PM, Jake McGraw jmcgr...@gmail.com wrote:

 On Thu, Mar 4, 2010 at 11:39 PM, Hector Virgen djvir...@gmail.com wrote:
  Anything in your cookies causing you to stay logged in?
 
  --
  Hector
 
 
  On Thu, Mar 4, 2010 at 7:30 PM, Cameron themsel...@gmail.com wrote:
 
  Hi guys, I'm really not sure where I'm going with this one, it seems
 like
  I must be doing something completely wrong, but I'm not really sure
 where to
  even start looking.
 
  Here's my logout action:
 
  public function logoutAction() {
  Zend_Auth::getInstance()-clearIdentity();
  $this-_helper-redirector('/');
  }
 
  Pretty simple, right? The redirect certainly works, but for some reason,
  I'm still logged in! I've even tried $_SESSION = ''; to brute force the
  session to be deleted, but there i am, still logged in. Anyone got any
 ideas
  on this one?

 How are you confirming that you're still logged in? Perhaps that's the
 issue?

 - jake

 
 



[fw-general] Zend_Rest_Route in a sub directory doesn't work?

2010-03-02 Thread Cameron
Hi guys,

I'm not sure this is 100% the issue, but I've moved an application that
works perfectly fine from a root directory to a sub directory, and now the
REST routes seem to not work any longer. Does REST by definition have to be
calls to the root path? Or is the module just not set up to support
baseUrls?

Regards,

Cameron


[fw-general] Zend Navigation ignoring Action section of config

2010-02-21 Thread Cameron
Hi everyone, I've got an unusual issue with Zend_Navigation that seems like
it should work correctly, but isn't.

Here's a basic example of the config...


nav
home
labelHome/label
controllerindex/controller
actionindex/action
/home
admin
labelAdmin/label
controlleradmin/controller
actionindex/action
/admin
booking
labelBookings/label
controllerbooking/controller
actionlist/action

pages
list-booking
labelList bookings/label
controllerbooking/controller
actionlist/action
/list-booking
calendar
labelBooking calendar/label
controllerbooking/controller
actioncalendar/action
/calendar
add-booking
labelAdd booking/label
controllerbooking/controller
actionnew/action
/add-booking
/pages
/booking
/nav

The problem exists when you're not on a URL that includes both controller
and action parts. If I go to http://example.com/base/url/admin, it defaults
to the index action, which is fine, but in the menu above none of the
actions display, so all of the Booking menus all say just
http://example.com/base/url/booking. Once you're actually in the menu and
using links generated by the menu, it all seems to work fine. Has anyone got
any idea why it is behaving this way?


Re: [fw-general] Zend Navigation ignoring Action section of config

2010-02-21 Thread Cameron
Ahh ok, thanks, that works. But if there's no route in either the request or
the config it defaults to... breaking the URLs?

On Mon, Feb 22, 2010 at 2:24 PM, Hector Virgen djvir...@gmail.com wrote:

 It helps to specify the route because Zend_Navigation uses the current
 route to create the url instead of the default route. So your navigation
 should look more like this:

 home
 labelHome/label
 controllerindex/controller
 actionindex/action
 *routedefault/route*
 /home

 --
 Hector



 On Sun, Feb 21, 2010 at 10:14 PM, Cameron themsel...@gmail.com wrote:

 Hi everyone, I've got an unusual issue with Zend_Navigation that seems
 like it should work correctly, but isn't.

 Here's a basic example of the config...


 nav
 home
 labelHome/label
 controllerindex/controller
 actionindex/action
 /home
 admin
 labelAdmin/label
 controlleradmin/controller
 actionindex/action
 /admin
 booking
 labelBookings/label
 controllerbooking/controller
 actionlist/action

 pages
 list-booking
 labelList bookings/label
 controllerbooking/controller
 actionlist/action
 /list-booking
 calendar
 labelBooking calendar/label
 controllerbooking/controller
 actioncalendar/action
 /calendar
 add-booking
 labelAdd booking/label
 controllerbooking/controller
 actionnew/action
 /add-booking
 /pages
 /booking
 /nav

 The problem exists when you're not on a URL that includes both controller
 and action parts. If I go to http://example.com/base/url/admin, it
 defaults to the index action, which is fine, but in the menu above none of
 the actions display, so all of the Booking menus all say just
 http://example.com/base/url/booking. Once you're actually in the menu
 and using links generated by the menu, it all seems to work fine. Has anyone
 got any idea why it is behaving this way?





Re: [fw-general] Zend Navigation ignoring Action section of config

2010-02-21 Thread Cameron
I have two routes, the default and a RESTful router. So because it didn't
really know what route to be on, it.. oh, ok, so it probably WAS doing
the right thing, and returning the correct route (a RESTful one) when the
URL matched that router - it's just a pity that it wasn't adding the http
headers too, eh!

On Mon, Feb 22, 2010 at 2:35 PM, Hector Virgen djvir...@gmail.com wrote:

 No, it defaults the the route that matched the current request. It works
 similarly to the url view helper.

 Do you have any custom routes set up? It seems to me that you may have one
 that looks something like like this:

 /:controller

 It seems like that's the case because normally with only the default
 built-in route your navigation should have worked since all of your pages
 would have used the default route when requested.

 --
 Hector



 On Sun, Feb 21, 2010 at 10:31 PM, Cameron themsel...@gmail.com wrote:

 Ahh ok, thanks, that works. But if there's no route in either the request
 or the config it defaults to... breaking the URLs?

 On Mon, Feb 22, 2010 at 2:24 PM, Hector Virgen djvir...@gmail.comwrote:

 It helps to specify the route because Zend_Navigation uses the current
 route to create the url instead of the default route. So your navigation
 should look more like this:

 home
 labelHome/label
 controllerindex/controller
 actionindex/action
 *routedefault/route*
 /home

 --
 Hector



 On Sun, Feb 21, 2010 at 10:14 PM, Cameron themsel...@gmail.com wrote:

 Hi everyone, I've got an unusual issue with Zend_Navigation that seems
 like it should work correctly, but isn't.

 Here's a basic example of the config...


 nav
 home
 labelHome/label
 controllerindex/controller
 actionindex/action
 /home
 admin
 labelAdmin/label
 controlleradmin/controller
 actionindex/action
 /admin
 booking
 labelBookings/label
 controllerbooking/controller
 actionlist/action

 pages
 list-booking
 labelList bookings/label
 controllerbooking/controller
 actionlist/action
 /list-booking
 calendar
 labelBooking calendar/label
 controllerbooking/controller
 actioncalendar/action
 /calendar
 add-booking
 labelAdd booking/label
 controllerbooking/controller
 actionnew/action
 /add-booking
 /pages
 /booking
 /nav

 The problem exists when you're not on a URL that includes both
 controller and action parts. If I go to
 http://example.com/base/url/admin, it defaults to the index action,
 which is fine, but in the menu above none of the actions display, so all of
 the Booking menus all say just http://example.com/base/url/booking.
 Once you're actually in the menu and using links generated by the menu, 
 it
 all seems to work fine. Has anyone got any idea why it is behaving this 
 way?








Re: [fw-general] File Element problem - getValue() returns null, but getFileName() returns full path and file?

2010-02-11 Thread Cameron
I hadn't ever turned on ValueDisabled, but even so I just set it to false,
$element-setValueDisabled(false). And the code comes directly after an
isValid. In its original context...

if (!$this-getForm()-isValid ( $data )) {
  throw new Exception ( 'Form data invalid!' );
}

$values = $this-getForm()-getValues();
var_dump($this-getForm()-image-getValue());
var_dump($this-getForm()-image-getFileName());

$data is just post data.

On Thu, Feb 11, 2010 at 4:08 PM, Thomas Weidner thomas.weid...@gmx.atwrote:

 Look if the value is disabled (isValueDisabled()).
 Per default is could be disabled for security reasons.

 And getValue() returns null when there is any error at validation or
 filtering on that file element. Therefor use always isValid().


 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Zend Framework - General fw-general@lists.zend.com
 Sent: Thursday, February 11, 2010 4:48 AM
 Subject: [fw-general] File Element problem - getValue() returns null, but
 getFileName() returns full path and file?



  The subject says it all - I'm not really sure what I'm doing wrong, but
 this
 is really odd. This is on ZF 1.9.5 on the Beta Zend Server 5.0.3 btw...

 I have a basic file field in my form, and it all works perfectly well -
 calling getValues() on the form moves the file in to the correct location,
 the whole thing is bulletproof - except that the return of getValues() for
 the file field is null. Example.

 $values = $this-getForm()-getValues();
 var_dump($this-getForm()-image-getValue());
 var_dump($this-getForm()-image-getFileName());

 Returns...

 NULL
 string(91) C:\Program

 Files\Zend\Apache2\htdocs\HACT\application/../public/images/upload\testimage.jpg


 Can anyone help shed some light on this? It's quite peculiar. Obviously
 I'd
 like to just automatically pass the $values array through to my add/update
 method and store the filename in the DB, as I'm sure this whole thing was
 designed to be used, but I can't seem to get it to work!





Re: [fw-general] File Element problem - getValue() returns null, but getFileName() returns full path and file?

2010-02-11 Thread Cameron
I'm trying to get the filename. If you var_dump on $values below, it is
null. I'm only using the second call to getValue() to show how it isn't
working. I believe the standard mode of operation is to go like this:

if (! $this-getForm()-isValid ( $data )) {
 return false;
}

$values = $this-getForm()-getValues();

return $this-getTable()-insert ( $values );

Which is exactly what I've got. But it isn't working.

On Thu, Feb 11, 2010 at 5:07 PM, Thomas Weidner thomas.weid...@gmx.atwrote:

 Question:

 You have already received the file by calling getValues() on the form.
 Why do you want to receive the file once again?

 A received file can not be received once again (not with 1.9.5).


 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Zend Framework - General fw-general@lists.zend.com
 Sent: Thursday, February 11, 2010 9:40 AM
 Subject: Re: [fw-general] File Element problem - getValue() returns null,
 but getFileName() returns full path and file?



  I hadn't ever turned on ValueDisabled, but even so I just set it to false,
 $element-setValueDisabled(false). And the code comes directly after an
 isValid. In its original context...

 if (!$this-getForm()-isValid ( $data )) {
 throw new Exception ( 'Form data invalid!' );
 }

 $values = $this-getForm()-getValues();
 var_dump($this-getForm()-image-getValue());
 var_dump($this-getForm()-image-getFileName());

 $data is just post data.

 On Thu, Feb 11, 2010 at 4:08 PM, Thomas Weidner thomas.weid...@gmx.at
 wrote:

  Look if the value is disabled (isValueDisabled()).
 Per default is could be disabled for security reasons.

 And getValue() returns null when there is any error at validation or
 filtering on that file element. Therefor use always isValid().


 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Zend Framework - General fw-general@lists.zend.com
 Sent: Thursday, February 11, 2010 4:48 AM
 Subject: [fw-general] File Element problem - getValue() returns null, but
 getFileName() returns full path and file?



  The subject says it all - I'm not really sure what I'm doing wrong, but

 this
 is really odd. This is on ZF 1.9.5 on the Beta Zend Server 5.0.3 btw...

 I have a basic file field in my form, and it all works perfectly well -
 calling getValues() on the form moves the file in to the correct
 location,
 the whole thing is bulletproof - except that the return of getValues()
 for
 the file field is null. Example.

 $values = $this-getForm()-getValues();
 var_dump($this-getForm()-image-getValue());
 var_dump($this-getForm()-image-getFileName());

 Returns...

 NULL
 string(91) C:\Program


 Files\Zend\Apache2\htdocs\HACT\application/../public/images/upload\testimage.jpg


 Can anyone help shed some light on this? It's quite peculiar. Obviously
 I'd
 like to just automatically pass the $values array through to my
 add/update
 method and store the filename in the DB, as I'm sure this whole thing
 was
 designed to be used, but I can't seem to get it to work!








Re: [fw-general] File Element problem - getValue() returns null, but getFileName() returns full path and file?

2010-02-11 Thread Cameron
oops - to clarify, if you var_dump on $values, $values['image'] is null, the
rest of the array is fine, and what you would expect.

On Thu, Feb 11, 2010 at 5:19 PM, Cameron themsel...@gmail.com wrote:

 I'm trying to get the filename. If you var_dump on $values below, it is
 null. I'm only using the second call to getValue() to show how it isn't
 working. I believe the standard mode of operation is to go like this:

 if (! $this-getForm()-isValid ( $data )) {
  return false;
 }

 $values = $this-getForm()-getValues();

 return $this-getTable()-insert ( $values );

 Which is exactly what I've got. But it isn't working.

 On Thu, Feb 11, 2010 at 5:07 PM, Thomas Weidner thomas.weid...@gmx.atwrote:

 Question:

 You have already received the file by calling getValues() on the form.
 Why do you want to receive the file once again?

 A received file can not be received once again (not with 1.9.5).


 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Zend Framework - General fw-general@lists.zend.com
 Sent: Thursday, February 11, 2010 9:40 AM
 Subject: Re: [fw-general] File Element problem - getValue() returns null,
 but getFileName() returns full path and file?



  I hadn't ever turned on ValueDisabled, but even so I just set it to
 false,
 $element-setValueDisabled(false). And the code comes directly after an
 isValid. In its original context...

 if (!$this-getForm()-isValid ( $data )) {
 throw new Exception ( 'Form data invalid!' );
 }

 $values = $this-getForm()-getValues();
 var_dump($this-getForm()-image-getValue());
 var_dump($this-getForm()-image-getFileName());

 $data is just post data.

 On Thu, Feb 11, 2010 at 4:08 PM, Thomas Weidner thomas.weid...@gmx.at
 wrote:

  Look if the value is disabled (isValueDisabled()).
 Per default is could be disabled for security reasons.

 And getValue() returns null when there is any error at validation or
 filtering on that file element. Therefor use always isValid().


 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Zend Framework - General fw-general@lists.zend.com
 Sent: Thursday, February 11, 2010 4:48 AM
 Subject: [fw-general] File Element problem - getValue() returns null,
 but
 getFileName() returns full path and file?



  The subject says it all - I'm not really sure what I'm doing wrong, but

 this
 is really odd. This is on ZF 1.9.5 on the Beta Zend Server 5.0.3 btw...

 I have a basic file field in my form, and it all works perfectly well -
 calling getValues() on the form moves the file in to the correct
 location,
 the whole thing is bulletproof - except that the return of getValues()
 for
 the file field is null. Example.

 $values = $this-getForm()-getValues();
 var_dump($this-getForm()-image-getValue());
 var_dump($this-getForm()-image-getFileName());

 Returns...

 NULL
 string(91) C:\Program


 Files\Zend\Apache2\htdocs\HACT\application/../public/images/upload\testimage.jpg


 Can anyone help shed some light on this? It's quite peculiar. Obviously
 I'd
 like to just automatically pass the $values array through to my
 add/update
 method and store the filename in the DB, as I'm sure this whole thing
 was
 designed to be used, but I can't seem to get it to work!









Re: [fw-general] File Element problem - getValue() returns null, but getFileName() returns full path and file?

2010-02-11 Thread Cameron
var_dump($this-getForm()-image-receive())) returns bool(false) - however,
the file is uploaded just fine, it appears in the destination directory
without any issues. also, calling $this-getForm()-image-isReceived()
after calling receive() returns true!

so in reference to your suggestion below, are there any methods for
retrieving the actual error that caused receive() to return false? all i can
seem to get out of it is a boolean.

On Thu, Feb 11, 2010 at 5:40 PM, Thomas Weidner thomas.weid...@gmx.atwrote:

 getValue() returns null when there is any error.
 So the question is which error is returned.

 When you say that isValid() returns not false, then the question is why
 receive() returns false. Look at it's error message to see details.


 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Zend Framework - General fw-general@lists.zend.com
 Sent: Thursday, February 11, 2010 10:22 AM

 Subject: Re: [fw-general] File Element problem - getValue() returns null,
 but getFileName() returns full path and file?


  oops - to clarify, if you var_dump on $values, $values['image'] is null,
 the
 rest of the array is fine, and what you would expect.

 On Thu, Feb 11, 2010 at 5:19 PM, Cameron themsel...@gmail.com wrote:

  I'm trying to get the filename. If you var_dump on $values below, it is
 null. I'm only using the second call to getValue() to show how it isn't
 working. I believe the standard mode of operation is to go like this:

 if (! $this-getForm()-isValid ( $data )) {
 return false;
 }

 $values = $this-getForm()-getValues();

 return $this-getTable()-insert ( $values );

 Which is exactly what I've got. But it isn't working.

 On Thu, Feb 11, 2010 at 5:07 PM, Thomas Weidner thomas.weid...@gmx.at
 wrote:

  Question:

 You have already received the file by calling getValues() on the form.
 Why do you want to receive the file once again?

 A received file can not be received once again (not with 1.9.5).


 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Zend Framework - General fw-general@lists.zend.com
 Sent: Thursday, February 11, 2010 9:40 AM
 Subject: Re: [fw-general] File Element problem - getValue() returns
 null,
 but getFileName() returns full path and file?



  I hadn't ever turned on ValueDisabled, but even so I just set it to

 false,
 $element-setValueDisabled(false). And the code comes directly after an
 isValid. In its original context...

 if (!$this-getForm()-isValid ( $data )) {
throw new Exception ( 'Form data invalid!' );
 }

 $values = $this-getForm()-getValues();
 var_dump($this-getForm()-image-getValue());
 var_dump($this-getForm()-image-getFileName());

 $data is just post data.

 On Thu, Feb 11, 2010 at 4:08 PM, Thomas Weidner thomas.weid...@gmx.at
 wrote:

  Look if the value is disabled (isValueDisabled()).

 Per default is could be disabled for security reasons.

 And getValue() returns null when there is any error at validation or
 filtering on that file element. Therefor use always isValid().


 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Zend Framework - General fw-general@lists.zend.com
 Sent: Thursday, February 11, 2010 4:48 AM
 Subject: [fw-general] File Element problem - getValue() returns null,
 but
 getFileName() returns full path and file?



  The subject says it all - I'm not really sure what I'm doing wrong,
 but

  this
 is really odd. This is on ZF 1.9.5 on the Beta Zend Server 5.0.3
 btw...

 I have a basic file field in my form, and it all works perfectly well
 -
 calling getValues() on the form moves the file in to the correct
 location,
 the whole thing is bulletproof - except that the return of
 getValues()
 for
 the file field is null. Example.

 $values = $this-getForm()-getValues();
 var_dump($this-getForm()-image-getValue());
 var_dump($this-getForm()-image-getFileName());

 Returns...

 NULL
 string(91) C:\Program



 Files\Zend\Apache2\htdocs\HACT\application/../public/images/upload\testimage.jpg


 Can anyone help shed some light on this? It's quite peculiar.
 Obviously
 I'd
 like to just automatically pass the $values array through to my
 add/update
 method and store the filename in the DB, as I'm sure this whole thing
 was
 designed to be used, but I can't seem to get it to work!












[fw-general] File Element problem - getValue() returns null, but getFileName() returns full path and file?

2010-02-10 Thread Cameron
The subject says it all - I'm not really sure what I'm doing wrong, but this
is really odd. This is on ZF 1.9.5 on the Beta Zend Server 5.0.3 btw...

I have a basic file field in my form, and it all works perfectly well -
calling getValues() on the form moves the file in to the correct location,
the whole thing is bulletproof - except that the return of getValues() for
the file field is null. Example.

$values = $this-getForm()-getValues();
var_dump($this-getForm()-image-getValue());
var_dump($this-getForm()-image-getFileName());

Returns...

NULL
string(91) C:\Program
Files\Zend\Apache2\htdocs\HACT\application/../public/images/upload\testimage.jpg


Can anyone help shed some light on this? It's quite peculiar. Obviously I'd
like to just automatically pass the $values array through to my add/update
method and store the filename in the DB, as I'm sure this whole thing was
designed to be used, but I can't seem to get it to work!


Re: [fw-general] Zend_Dojo_Form_Element_Editor returning Array using some browsers

2010-01-04 Thread Cameron
I had the same problem with Chrome... ended up just replacing it with
ckeditor.

On Tue, Jan 5, 2010 at 12:31 AM, Guillaume ORIOL gor...@technema.fr wrote:

 Hi,

 When I use a Zend_Dojo_Form_Element_Editor in a form, the returned value is
 an array with some browsers.

 For instance, $form-getValues() will return the following when I use
 Safari (4.0.4 Mac):
 array (
'last_name' = 'Doe',
'content' =
array (
  'Editor' = 'some text',
),
...
 )

 But with Firefox 3.5.6, the following is returned:
 array (
'last_name' = 'Doe,
'content' = 'some textbr _moz_editor_bogus_node=TRUE /',
...
 ),

 Searching on Nabble, I've found a few posts related to this question - but
 none of them were answered.
 Could someone help me find a solution?

 Best regards
 --

 Guillaume ORIOL




[fw-general] Zend_Navigation rendering incorrect paths at the root level

2010-01-03 Thread Cameron
Hi guys, not sure if I'm doing something really stupid here, but I can't
seem to work this out - essentially what is happening is that if I am at the
root of my application then the action part of the config doesn't get
added to the URL, but if I work my way down in to any of the controllers,
then all of the actions display fine.

The example config is here: http://pastie.org/765545. I'm using
controllers/actions instead of just straight urls because the application
resides in a sub directory and the paths won't work correctly otherwise.
It's really weird. It's like you have to be viewing a controller, and if
not, controllers are the only thing it'll render.


Re: [fw-general] Re: Base Controller Classes

2009-12-22 Thread Cameron
What's the deal with haters hatin' on our old friend the base class? Maybe
you can implement base class functions like getAction using a dispatch level
plugin, but how is that better than a simple abstract class to base your
controllers around? My actual controllers are 80% method free, it's all done
in the base class, I only ever have to override on occasion - it seems like
a solid solution to me, why is it considered less than ideal?


On Tue, Dec 22, 2009 at 5:21 PM, Colin Guthrie gm...@colin.guthr.ie wrote:

 'Twas brillig, and Taha Bayrak at 22/12/09 06:23 did gyre and gimble:
  What is the best practice for placing the base controller classes?

 Ideally, don't use them at all. You can use action helpers to group up
 common tasks into one handy call...

 You can also have plugins work at the dispatch loop level which can be
 handy.

 Sometimes it just feels nicer to have a base class tho'.

  a. Placing them in the same directory as the other controllers - the
  ones that extends from the base class -? If so, is there a easy way to
  prevent the base class getting into  the dispatch loop?

 Just prefix the class with the word abstract... i.e. abstract class
 MyBase_Controller {  }

 That way the class cannot be instantiated on it's own. It may be a nasty
 crash tho'.

 Personally I'd put it in a subdirectory of the Controller folder to make
 sure.

 Col.

 --

 Colin Guthrie
 gmane(at)colin.guthr.ie
 http://colin.guthr.ie/

 Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
 Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]




Re: [fw-general] Adding a # to a URL using gotoRoute

2009-12-10 Thread Cameron
isn't the use of named anchors deprecated?

On Fri, Dec 11, 2009 at 7:23 AM, Daniel Latter dan.lat...@gmail.com wrote:


 +1


 On 10 Dec 2009, at 22:54, takeshin admi...@gmail.com wrote:




 Jason Austin wrote:



 Hope this helps.  I smell a feature request for adding hashes to
 routes  url helpers :)



 +1

 --
 takeshin

 --
 View this message in context:
 http://n4.nabble.com/Adding-a-to-a-URL-using-gotoRoute-tp957210p960642.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] observe controller action

2009-12-02 Thread Cameron
I've done a similar thing by using an Events and Subscribe system, my
controller abstract has a number of event broadcasts throughout, and it's
very simple to build a subscriber that latches on to whatever it needs to in
order to satisfy the business rules. I based mine upon some code I found
through the googles, I've just now quickly tried to find it again with no
success, I suppose though I could be convinced to package up what I've done
and post it somewhere.

On Wed, Dec 2, 2009 at 8:41 PM, Diego Potapczuk potapc...@gmail.com wrote:

 Exactly.


 ::: Diego Potapczuk

 »» Analista de sistemas
 »» Tel: (71) 3287-8343 / (71) 9144-3062
 »» http://www.diegoliveira.com.br



 On Wed, Dec 2, 2009 at 9:22 AM, Vincent de Lau vinc...@delau.nl wrote:

 Consume basically means 'one object using another object'.

 Basically what it boils down to, is that you should move the code from the
 controller to an object in the Model layer (a Service is suggested). Both
 controllers can than consume/use this service to get their work done.

 Controllers should be thin and use Models to do the work. I can suggest
 reading http://www.survivethedeepend.com/ for more information on the
 subject.

 Vincent de Lau
  vinc...@delau.nl

  -Original Message-
  From: tonystamp [mailto:tonyst...@hotmail.co.uk]
  Sent: Wednesday, December 02, 2009 12:34 PM
  To: fw-general@lists.zend.com
  Subject: Re: [fw-general] observe controller action
 
 
  Thanks for the reply, but could you elaborate a bit more- what do you
  mean by consume?





Re: [fw-general] module repository poll

2009-11-30 Thread Cameron
This sort of thing would be tremendously useful. I'd absolutely love to see
a drop in component for handling, say, User authentication - handling
signups, forgot your password functionality, the whole check your email and
verify your account stuff, a very basic admin page, all done in the right
way according to ZF practices.

On Mon, Nov 30, 2009 at 9:48 PM, Matthew Weier O'Phinney
matt...@zend.comwrote:

 Greetings!

 Ivo Jansch, of ibuildings.nl, has recently opened a poll for framework
 users of any flavor (ZF, symfony, etc.), asking the question, Would you
 be interested in a repository of off-the-shelf modules/app components
 for popular frameworks?

 If interested, place your vote here:

http://twtpoll.com/d6kfvh

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



[fw-general] Applying Zend_Acl to Zend_Form_Element

2009-11-29 Thread Cameron
Hi guys, this is pretty pie in the sky, but I was wondering if anyone had
seen it done / had a good trick for it.

What I'd like to do is come up with a really clean way of controlling which
users can see which form fields. Example being a role field in the user
form - admins can set the user's role, but regular users cannot. I know that
I can wrap the odd if ($acl-isAllowed($params)) call around the element in
my form init, but it seems to me that it'd be really nice to be able to mark
form elements as being a certain resource name and then apply the
permissions tools in exactly the same way as an action plugin does, without
explicitly defining the code, just setting up the ACL lists. It's like we
need a form helper or something... It seems to me that the fewer inline ACL
checks we have to perform, the easier and safer our overall permission
structure is going to be. Anyone managed to do something like this?


Re: [fw-general] Zend_Db_Profiler should be working but isn't...

2009-10-06 Thread Cameron
I reverted to 1.4.0 and it started working for me again after a restart or
two. It was all a bit weird to be honest.

On Sat, Sep 26, 2009 at 5:49 AM, Eugene Morgan eugenemorganrea...@gmail.com
 wrote:

 Actually I was just using the .ini method before, but I can get it to
 work now using the Bootstrap method in both Firebug 1.4.1 and 1.4.2
 (using FirePHP 0.3.1)

 On Fri, Sep 25, 2009 at 3:39 PM, Christoph Dorn
 christ...@christophdorn.com wrote:
 
  What version of Firebug are you using?
 
  See:
 
 http://n2.nabble.com/Console-output-disappearing-with-Firebug-1-4-2-tp3394160ef842658.html
 
  Christoph
 
 
 
  Eugene Morgan wrote:
 
  I've had the same problem since ZF 1.8 -- has anyone else gotten it to
 work?
 
  On Tue, Sep 22, 2009 at 10:46 PM, Cameron themsel...@gmail.com wrote:
 
 
  How can I test this one further? It *used* to work just fine, but since I
  reworked to Zend_Application formats, it seems to have stopped, and the
  regular methods of turning it on don't seem to result in any output.
 
  I've tried turning it on both in application.ini and in the Bootstrap. In
  application.ini it looks like...
 
  resources.db.isdefaulttableadapter = true
  resources.db.params.profiler.enabled = true
  resources.db.params.profiler.class = Zend_Db_Profiler_Firebug
 
  and in Bootstrap.php...
 
  protected function _initDbProfiler() {
  $this-bootstrap(db);
  $db = $this-getResource(db);
  $db-setProfiler(new Zend_Db_Profiler_Firebug());
  $db-getProfiler()-setEnabled(true);
  }
 
  If I go like this:
 
  $db = DbTable_Base::getDefaultAdapter();
  var_dump($db-getProfiler()-getEnabled());
 
  in a controller, it most certainly returns True, so according to the
  framework guts, it's most certainly turned on, but there's nothing
 appearing
  in my Firebug. FirePHP just says No FirePHP data found in response
  headers. Anyone know where to start looking with this? it's really quite
  confusing, it all used to work perfectly!
 
 
 
 
 



Re: [fw-general] DataGrid

2009-09-25 Thread Cameron
On Fri, Sep 25, 2009 at 2:28 AM, Kyle Spraggs the...@spiffyjr.me wrote:


 Matthew Weier O'Phinney-3 wrote:
 
  -- Cameron themsel...@gmail.com wrote
  (on Wednesday, 23 September 2009, 09:42 AM +0800):
  Dojo grids. I've actually just moved a lot of my functionality over to
  Dojo
  JsonRestStore so I can do in-grid editing, it's not completed yet, but
 so
  far
  it is coming together really smoothly.
 
  I'm planning on doing a blog post on this combination (Zend_Rest_Route +
  dojox.data.JsonRestStore + dojox.grid.DataGrid) -- the three work
  together incredibly well, and make CRUD interfaces a breeze.
 
  On Tue, Sep 22, 2009 at 9:10 PM, Kyle Spraggs the...@spiffyjr.me
 wrote:
 
  I was curious what everyone is using for DataGrids. I am aware of
  http://
  petala-azul.com/blog/ as well as http://code.google.com/p/
  zend-framework-datagrid/ and there is also the possibility of Dojo
  Grids.
  Any input would be appreciated.
 
  --
  Matthew Weier O'Phinney
  Project Lead| matt...@zend.com
  Zend Framework  | http://framework.zend.com/
 
 

 I don't mean to steal your thunder but that's exactly what I'm using and am
 in the middle of writing a blog post. :)


I've got the whole lot working pretty nicely at the moment, just trying to
work out how best to do inline Selects - trying to get a
dojox.data.KeyValueStore to attach. It'd be nice to have a KVS and just grab
the options autocomplete style from a json-providing url!


Re: [fw-general] DataGrid

2009-09-24 Thread Cameron
On Thu, Sep 24, 2009 at 8:38 AM, Cameron themsel...@gmail.com wrote:



 On Wed, Sep 23, 2009 at 6:49 PM, Matthew Weier O'Phinney matt...@zend.com
  wrote:

 -- Cameron themsel...@gmail.com wrote
 (on Wednesday, 23 September 2009, 09:42 AM +0800):
  Dojo grids. I've actually just moved a lot of my functionality over to
 Dojo
  JsonRestStore so I can do in-grid editing, it's not completed yet, but
 so far
  it is coming together really smoothly.

 I'm planning on doing a blog post on this combination (Zend_Rest_Route +
 dojox.data.JsonRestStore + dojox.grid.DataGrid) -- the three work
 together incredibly well, and make CRUD interfaces a breeze.


 So far I'm finding the same, it's a match made in heaven, except for some
 reason the grid doesn't seem to be triggering on edits. I can't see any ajax
 hits in firebug. Anyway, I'm sure it's my fault, I'll work it out!


Ok, so I'm dumb, you need to manually call store.save().

Matthew, one thing that your post should cover over is the handling of error
conditions - I'm struggling to find any examples of neatly dealing with what
happens if your controller decides it's not happy with the data and has to
let the store know so it can deal with the situation appropriately.






  On Tue, Sep 22, 2009 at 9:10 PM, Kyle Spraggs the...@spiffyjr.me
 wrote:
 
  I was curious what everyone is using for DataGrids. I am aware of
 http://
  petala-azul.com/blog/ as well as http://code.google.com/p/
  zend-framework-datagrid/ and there is also the possibility of Dojo
 Grids.
  Any input would be appreciated.

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





Re: [fw-general] Is there anybody from Zend team ?

2009-09-23 Thread Cameron
On Wed, Sep 23, 2009 at 5:03 PM, Alan Wagstaff awagst...@gmail.com wrote:

 Hi,

 2009/9/23 aoohralex aoohra...@gmail.com


 My critical subject about Zend Framework was deleted. Somebody from Zend
 deleted my post. My criticism PHP authors and Zend Framework in compare to
 other frameworks wasn't comfortable for Zend company. You can don't agree
 with me but delete my subject ? So again:


 I'd just like to point out that this is a mailing list, not a forum.  That
 means that a copy of every email gets sent to everyone subscribed to the
 list.  No-one 'deleted' your email as that is not possible.

 Kind regards,
 Alan


Heh, I sure deleted the hell out of it


Re: [fw-general] DataGrid

2009-09-23 Thread Cameron
On Wed, Sep 23, 2009 at 6:49 PM, Matthew Weier O'Phinney
matt...@zend.comwrote:

 -- Cameron themsel...@gmail.com wrote
 (on Wednesday, 23 September 2009, 09:42 AM +0800):
  Dojo grids. I've actually just moved a lot of my functionality over to
 Dojo
  JsonRestStore so I can do in-grid editing, it's not completed yet, but so
 far
  it is coming together really smoothly.

 I'm planning on doing a blog post on this combination (Zend_Rest_Route +
 dojox.data.JsonRestStore + dojox.grid.DataGrid) -- the three work
 together incredibly well, and make CRUD interfaces a breeze.


So far I'm finding the same, it's a match made in heaven, except for some
reason the grid doesn't seem to be triggering on edits. I can't see any ajax
hits in firebug. Anyway, I'm sure it's my fault, I'll work it out!



  On Tue, Sep 22, 2009 at 9:10 PM, Kyle Spraggs the...@spiffyjr.me
 wrote:
 
  I was curious what everyone is using for DataGrids. I am aware of
 http://
  petala-azul.com/blog/ as well as http://code.google.com/p/
  zend-framework-datagrid/ and there is also the possibility of Dojo
 Grids.
  Any input would be appreciated.

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



Re: [fw-general] grade zend framework and compared to Symfony and ASP.NET MVC

2009-09-22 Thread Cameron
You seem to be overlooking the entire concept behind Zend. Many frameworks
are designed for people who want their hands held through the application
building process, Zend is designed for professional developers who know what
they are doing and all they want are a few reliable and standardized tools
to help them along with their development.


On Wed, Sep 23, 2009 at 2:30 AM, aoohralex aoohra...@gmail.com wrote:


 Sry for my English – it isn't my national language.

 I have started learn ZF because I wanted to learn something new.
 If we have range 0 – 10. My knowledge ZF is 1 – I can make basic things in
 ZF – connect to database, queries insert/update/delete, basic zend forms,
 authorization, use jquery and layout in zend, controllers, views.
 My knowledge Symfony Framework is 5. My knowledge ASP.NET MVC (not ASP.NET
 )
 is 4.

 Now I can say that ZF is very bad framework or maybe rather it isn't a
 framework. Everybody knows that authors of PHP are always late and behind –
 for example PHP is really OO from version v5 (eariel it was only some OO
 elements in PHP). The same is in Zend Framework – this framework is behind
 others frameworks.

 First - Zend_Db is nothing compared to Doctrine ORM. Using Zend_Db I have
 to
 create myself models:
 http://framework.zend.com/docs/quickstart/create-a-model-and-database-table
 ! In Symfony Framework with Doctrine ORM and in ASP.NET MVC with Linq
 to
 SQL I don't need because it is wasting of time – there it is automatic – in
 Symfony using console and in ASP.NET MVC using Visual Studio. Of course
 Doctrine and Linq to SQL have got more better things.

 In Zend Framework almost nothing you can do using console (of course almost
 nothing compared to Symfony) – in Symfony using console you can generate
 much more (I don't use in Symfony console to generate modules, controllers
 or forms but for begginners it is very comfortable). In ASP.NET MVC I
 don't
 need use console but Visual Studio but ASP.NET MVC is very young so
 generated controllers/views etc. don't have so good code as in Symfony. In
 ASPNET MVC and Symfony Framework I don't need to enable layout like in
 Zend
 Framework. The most horrible thing in Zend it was for me Zend_Acl – using
 that I can't still make that only logged users can have access to action
 'add' controller 'books' – in Symfony I can make that using 2 lines of code
 in module 'books':

 add:
  is_secure: on

 and in ASP.NET one line of code in controller:

 [Authorize]

 What is more in Symfony and ASP.NET MVC we have tables in database and
 everything else related with users, authorization etc. created in these
 frameworks – in Zend I must myself do that.
 There is of course more good things in these frameworks – better than in
 Zend.

 Documentation – hahah – in Zend documentation is chaotic, is HORRIBLE !!
 Have you ever seen documentation of Symfony or ASP.NET MVC ? I have never
 seen worse documentation than in Zend.

 For me Zend isn't a framework but rather components that we can use in
 other
 frameworks – for example Zend Lucene in Symfony:
 http://www.symfony-project.org/jobeet/1_2/Doctrine/en/17

 As I thought – authors of PHP are always late and they are always behind so
 Zend is always late and behind. For now Symfony and ASP.NET MVC are from
 XXI
 age, Zend is from XX age.

 This was my compare these frameworks.

 --
 View this message in context:
 http://www.nabble.com/grade-zend-framework-and-compared-to-Symfony-and-ASP.NET-MVC-tp25530860p25530860.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] DataGrid

2009-09-22 Thread Cameron
Dojo grids. I've actually just moved a lot of my functionality over to Dojo
JsonRestStore so I can do in-grid editing, it's not completed yet, but so
far it is coming together really smoothly.

On Tue, Sep 22, 2009 at 9:10 PM, Kyle Spraggs the...@spiffyjr.me wrote:

 I was curious what everyone is using for DataGrids. I am aware of
 http://petala-azul.com/blog/ as well as
 http://code.google.com/p/zend-framework-datagrid/ and there is also the
 possibility of Dojo Grids. Any input would be appreciated.

 --
 Kyle Spraggs (SpiffyJr)
 http://www.spiffyjr.me




[fw-general] Zend_Db_Profiler should be working but isn't...

2009-09-22 Thread Cameron
How can I test this one further? It *used* to work just fine, but since I
reworked to Zend_Application formats, it seems to have stopped, and the
regular methods of turning it on don't seem to result in any output.

I've tried turning it on both in application.ini and in the Bootstrap. In
application.ini it looks like...

resources.db.isdefaulttableadapter = true
resources.db.params.profiler.enabled = true
resources.db.params.profiler.class = Zend_Db_Profiler_Firebug

and in Bootstrap.php...

protected function _initDbProfiler() {
$this-bootstrap(db);
$db = $this-getResource(db);
$db-setProfiler(new Zend_Db_Profiler_Firebug());
$db-getProfiler()-setEnabled(true);
}

If I go like this:

$db = DbTable_Base::getDefaultAdapter();
var_dump($db-getProfiler()-getEnabled());

in a controller, it most certainly returns True, so according to the
framework guts, it's most certainly turned on, but there's nothing appearing
in my Firebug. FirePHP just says No FirePHP data found in response
headers. Anyone know where to start looking with this? it's really quite
confusing, it all used to work perfectly!


[fw-general] Stylistic question - controller actions vs. context switches?

2009-09-21 Thread Cameron
Hi everyone, I just wanted to see if anyone else had had a good long think
about this sort of thing before I decided one way or the other.

Basically I have been playing with the context switch action helper, and it
has opened a whole new world of possibilities in terms of application
structure, but i'm not certain if i'm about to head down a path of
over-engineering or not.

As an example, my controllers have an autocomplete action. It essentially
switches off the layout and returns the appropriate data in JSON format -
all of which is fine and dandy, and there's a bit of processing in the whole
thing so it's not unreasonable that it's its own action, HOWEVER... stopping
and thinking for a bit, retrieving a list of autocomplete options IS just a
list, and hence shouldn't it be a function of the /list action? with the
format simply decided by the context switcher? it seems to make sense to me,
but then i start to think about how many other actions this might mean
reworking - where do you draw the line? i guess you could make your entire
application a context switch of /, which is obviously taking it too far, but
you see the point...

I'm just thinking out loud, I'm guessing the answer is that there's no
perfect structure, and it's better to just write the code and get it
working rather than philosophize endlessly over the best possible solution,
i just thought this one might be an interesting debate for the mailing list.


Re: [fw-general] Controllers that respond to both normal requests and RESTful requests

2009-09-20 Thread Cameron
On Wed, Sep 9, 2009 at 11:36 PM, Matthew Weier O'Phinney
matt...@zend.comwrote:

 -- Cameron themsel...@gmail.com wrote
 (on Wednesday, 09 September 2009, 05:35 PM +0800):
  Hi, this is very likely to be a dumb question, but I'd really like to
 have my
  controllers respond to normal requests (as in
 http://domain.com/product/
  display/id/1) and also the full range of RESTful requests (GET http://
  domain.com/product/1 and so on). Turning on Zend_Rest_Route across all
 my
  controllers breaks regular requests, but does make them respond correctly
 to
  REST, but yeah... I know this is unlikely to work, I was just wondering
 if
  there's a way of somehow ordering the routes so that if regular ones
 don't
  match then use the RESTful ones or something. Failing that, I suppose I'm
 just
  going to have to come up with a nice clean way to link the separate REST
  controllers back to the normal code.

 You can do it in a variety of ways. First, you can always use the
 default route in conjunction with the Rest route, though you run the
 risk of the actions being interpreted as IDs.

 Another option is to create an additional Zend_Controller_Router_Route
 instance that matches your controller:

$route = new Zend_Controller_Router_Route(
'product/:action/*',
array(
'controller' = 'product',
),
array(
'action' = '^[a-z][a-z0-9.-]+',
)
);

 Assuming your IDs are numeric, the above will not match unless the
 action starts with an alphabetic character -- which should be safe for
 your purposes. (You can also use static and regexp routes in this
 fashion.)

 If you use such a route, make sure you register it *after* the REST
 route to ensure it's executed *before* it.


Thanks Matthew, this works perfectly. For the record, here is the complete
Bootstrap method for setting up the routes in complete Zend Application
style. If you drop this in your application it should just work. Now to work
out how to get REST routes to respond with JSON and regular routes with
regular view scripts!

protected function _initRestRoute() {
$this-bootstrap('Request');
$front = $this-getResource('FrontController');
$restRoute = new Zend_Rest_Route($front);
$defaultRoute = new Zend_Controller_Router_Route(
':controller/:action/*', array('module' = 'default'),
array('action' = '^[a-z][a-z0-9.-]+')
);
$front-getRouter()-addRoute('rest', $restRoute);
$front-getRouter()-addRoute('default', $defaultRoute);
}


[fw-general] Controllers that respond to both normal requests and RESTful requests

2009-09-09 Thread Cameron
Hi, this is very likely to be a dumb question, but I'd really like to have
my controllers respond to normal requests (as in
http://domain.com/product/display/id/1) and also the full range of RESTful
requests (GET http://domain.com/product/1 and so on). Turning on
Zend_Rest_Route across all my controllers breaks regular requests, but does
make them respond correctly to REST, but yeah... I know this is unlikely to
work, I was just wondering if there's a way of somehow ordering the routes
so that if regular ones don't match then use the RESTful ones or something.
Failing that, I suppose I'm just going to have to come up with a nice clean
way to link the separate REST controllers back to the normal code.


[fw-general] Including regular Zend Form elements with a Zend Dojo form.

2009-08-31 Thread Cameron
Hi guys, just a quick one.

I want to be able to add a regular textarea to a Zend_Dojo form - the Dojo
editor is a tiny bit crappy, and i'd really rather use something else. The
problem is that the text area that Zend_Dojo outputs isn't an actual
textarea, and thus 3rd party editors tend to have difficulty attaching
themselves to it. Is it even possible to include normal Zend Form textareas
with Zend Dojo forms?


Re: [fw-general] Best practices, environment setup

2009-08-30 Thread Cameron
I've been looking for something like this too. It's all well and fine to
install all the Zend products with the intention of integrating them in to a
homogenous whole, but the reality is that there's very little in the way of
documentation looking at the problem from a broader development perspective.
I'm trying to nut my way through and develop my own series of best practices
with regards to all this, but my particular sticking point is still the Zend
Server to Zend Studio integration, which seems to be focused around using
your local machine as the development server - a situation which obviously
doesn't scale terribly well. I've tried finding some good examples of using
external Zend Server instances via a local Zend Studio, but so far,
nothing...

On Fri, Aug 28, 2009 at 5:28 AM, Robert Gormley rgorm...@mgcare.com wrote:

  Has anyone got a good pointer to a resource, or able to offer some
 advice, on a ‘best practices’ set-up for ZF, Server, for use with Studio...
 Something that’s nicely organized and elegant. Things like


- nice ways to address development and test environments on the same
server (use of Apache ENV for example, or hostname)
- awareness of multiple sites on the same server
- other common best practices, like ‘root of the project’ being outside
the web root, etc


 I realize these are all fairly common/well-known things, but I’m trying to
 find a nice document/blog, what have you, that does a good job of
 encapsulating a lot of these ‘best practices’.

 Robert



Re: [fw-general] Handling MySQL replication with Zend_Db_Adapter and Zend_Db_Table

2009-08-13 Thread Cameron
Also, this sounds like a great idea for ZF 2.0, people are lining up a huge
list of sweeping, BC-breaking changes for the 2.0 release, why not add this
to the pile?

On Fri, Aug 14, 2009 at 9:48 AM, johncongdon j...@johncongdon.com wrote:


 Are you able to make your solution public?  I am looking for this very
 thing
 and would prefer to stand on the shoulders of giants rather than trying to
 eat a ton of calories to become one myself  :)




 william0275 wrote:
 
  We are switching to a replicated database environment and I've been
  studying the class hierarchy in the Zend Framework to find the best way
 to
  handle this. Since it seems ZF makes poor use of interfaces, classes like
  Zend_Db_Table checks for an instance of Zend_Db_Adapter instead of a
  similar interface.
 
  I've seen solutions on the web having to do with extending Zend_Db_Table.
 
  I think I found a better solution and would like to suggest it here for
  people who might have the same dillema in the future.
 
  I think extending Zend_Db_Table is the wrong idea, because it means
 you're
  limited to Zend_Db_Table to handle your master/slave architecture. If you
  extend Zend_Db_Adapter instead, you will have master/slave functionality
  at the core, not only in Zend_Db_Table.
 
  I did extend Zend_Db_Adapter with the concept that the instance of this
  Zend_Db_Adapter is for the master connection, and internally I create a
  second adapter which will be used for the slave. Methods like insert,
  update and delete are not overriden because they always work directly
 with
  the master. I overrode all fetch methods (fetchAll, fetchAssoc, etc) so
  that it uses the slave adapter instead, remapping the calls.
 
  I added a forceAdapter() method to force the use of the master
  connection throughout a series of queries, so that in some circumstances
  you can select data from the master to make sure you get the newly
 updated
  data right away.
 
  Now, my MyCompany_Db_Adapter_Pdo_Mysql will automatically handle reads
 and
  writes to the right server. When I create the instance I pass it a series
  of parameters, like before, with a new parameter called 'slave' which
  contains it's own series of connection parameters. If the 'slave' array
  isnt present, the adapter works the traditionnal way.
 
  Anyhow, unless there are other better alternatives, I suggest you do it
  this way, you'll then be able to use this class with most Zend_Db classes
  like Zend_Db_Table. It's a shame the Zend Framework team didnt use
  interfaces in an extensive way, I might have chosen other alternatives if
  classes like Zend_Db_Table validated the adapter against a
  DbAdapterInterface (for example) instead of Zend_Db_Adapter.
 

 --
 View this message in context:
 http://www.nabble.com/Handling-MySQL-replication-with-Zend_Db_Adapter-and-Zend_Db_Table-tp21812347p24964652.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] Zend Studio 7.0 Zend Framework webinar tomorrow!

2009-08-12 Thread Cameron
On Tue, Jul 28, 2009 at 7:35 PM, Matthew Weier O'Phinney
matt...@zend.comwrote:

 -- Joseph Crawford i...@josephcrawford.com wrote
 (on Tuesday, 28 July 2009, 07:25 AM -0400):
  I agree I would also love to be able to download these Webinars and go
  through them on my own time..
 
  Anyone know when and if they will be released online?

 Typically they're released around a week after the webinar -- unless
 there were issues with the recording (which has also happened before).


So, it's a couple of weeks later, where can we get this?


Re: [fw-general] Zend Studio 7.0 Zend Framework webinar tomorrow!

2009-07-27 Thread Cameron
Yeah this is what I wanted to say, an actual webinar is pretty much useless
to those of us with jobs and lives and (especially) don't live in a timezone
amenable to spending 1 1/2 hours watching a video on programming stuff at
3am. When will these webinars be available for download?

On Tue, Jul 28, 2009 at 4:03 AM, mbneto mbn...@gmail.com wrote:

 Hi,

 Since you will be writing them please add that the time that it takes from
 a webinar to take place and when it becomes available for download is really
 long.

 I am still waiting for the last one




 On Mon, Jul 27, 2009 at 11:22 AM, Matthew Weier O'Phinney 
 matt...@zend.com wrote:

 -- Philip G guice...@gmail.com wrote
 (on Monday, 27 July 2009, 10:12 AM -0500):
  Oops, I'm dumb. I take that back. I thought it was at 9am, not 9pm PDT.
 Doh!

 It *is* for 9am PDT, and should last for an hour. I'll forward the bad
 schedule details to the webinar organizers.


  On Mon, Jul 27, 2009 at 10:05 AM, Philip G guice...@gmail.com wrote:
 
  There's a slight bug with the meeting invite that's sent out with
  registration:
  When: Tuesday, July 28, 2009 11:00 PM to Wednesday, July 29, 2009
 12:30 AM.
  (this is shown in CDT time)
 
  This is by far the longest web seminar I've ever attended. Wow. Must
 be a
  lot of material to take 13.5 hours! :)
 
  ---
  Philip
  g...@gpcentre.net
  http://www.gpcentre.net/
 
 
 
  On Mon, Jul 27, 2009 at 9:00 AM, Matthew Weier O'Phinney 
 matt...@zend.com
  wrote:
 
  For those of you who use Zend Studio or who are looking for an
 IDE with
  Zend Framework integration, Zend Studio is shipping version 7.0
 this
  week, and one feature is Zend_Tool integration, via a virtual
 console.
 
  The project lead for Zend Studio, Roy Ganor, will be presenting
 a
  webinar on the new features tomorrow:
 
 http://short.ie/a5szts
 
  If you find the above intriguing, register today so you can find
 out
  about these new features!
 
  --
  Matthew Weier O'Phinney
  Project Lead| matt...@zend.com
  Zend Framework  | http://framework.zend.com/
 
 
 
 

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





Re: [fw-general] Of 3 methods to centralize code used in all/many controllers which do you use when?

2009-06-16 Thread Cameron
why can't it be all three?

seriously though, i'm doing mostly 1, then 3 and 2.

On Tue, Jun 16, 2009 at 1:35 PM, joedevon joede...@gmail.com wrote:


 The following question on Stack Overflow prompted this post:


 http://stackoverflow.com/questions/866367/how-do-i-centralize-code-from-my-init-functions-in-all-controllers/866517

 How do I centralize code from my init functions in all controllers?

 Three answers all work I believe:

 1. Extend Zend_Controller_Action and have your controllers extend from
 THERE

 2. Write a plugin by extending Zend_Controller_Plugin_Abstract

 3. Create an Action Helper

 I assume there are situations where each one of those is the best solution.
 I've been doing answer 1 mostly, but thinking about switching to answer 3
 for future projects.

 But I'd like to know what the recommended situations are for each solution.

 Thanks.
 --
 View this message in context:
 http://www.nabble.com/Of-3-methods-to-centralize-code-used-in-all-many-controllers-which-do-you-use-when--tp24047991p24047991.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




[fw-general] reusing view scripts across controllers.

2009-06-10 Thread Cameron
Hi guys,

I have a number of view scripts that are cut and paste across almost all of
my view directories, basically templates that hold code to load a structural
html / tabs / etc. These files are almost all  identical, so there is a very
obvious case for removing these duplications, along with providing an
override system if and when that particular action requires custom code.
I've seen this page here:
http://joshribakoff.com/2009/02/overridable-view-scripts-in-zend-framework/-
and it does exactly what I want, but it also seems a little bit
curious
having to duplicate code across all of my actions / controllers in order to
remove some duplicate code. Is there a better way of doing this?


Re: [fw-general] Re: re[fw-general] using view scripts across controllers.

2009-06-10 Thread Cameron
On Wed, Jun 10, 2009 at 3:23 PM, staar2 est.ri...@gmail.com wrote:




 Themselves wrote:
 
  Hi guys,
 
  I have a number of view scripts that are cut and paste across almost all
  of
  my view directories, basically templates that hold code to load a
  structural
  html / tabs / etc. These files are almost all  identical, so there is a
  very
  obvious case for removing these duplications, along with providing an
  override system if and when that particular action requires custom
 code.
  I've seen this page here:
 
 http://joshribakoff.com/2009/02/overridable-view-scripts-in-zend-framework/-
  and it does exactly what I want, but it also seems a little bit
  curious
  having to duplicate code across all of my actions / controllers in order
  to
  remove some duplicate code. Is there a better way of doing this?
 
 
 I would use here custom made view
 helpers(
 http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.custom
 )
 and for more pure html code can be done with
 partials(
 http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.partial
 )


View partials still need a view script there to call them - which is what I
was trying to avoid. And I know you can do it with custom view helpers,
except won't it ALWAYS use that view instead of having a default +
override type functionality? Or should I work out a way to put that logic in
the custom helper itself? I guess that seems clean enough...


Re: [fw-general] New to zend world, need some guidance..

2009-05-08 Thread Cameron
1. Is this a question?
2. Zend is a loosely coupled framework, meaning most of the components can
be used independently of each other with very few dependencies. You don't
have to use the MVC components if you don't want to. Personally I really
like this approach, I can just pick and choose the bits I want to use and
ignore the rest.
3. It works pretty well on Windows, but you might need to re-implement any
Apache specific parts like the MVC router (which you're not using anyway),
and if you're using SQL Server you might need to do a bit of extra work.

On Fri, May 8, 2009 at 4:05 PM, naveed83 nav...@eteamid.com wrote:

 Hello there, We are developing a large scale PHP product and have already
 done a good part of the development. We are now thinking to use Zend
 framework for this product, but we have no experience of Zend framework. So,
 we some question regarding Zend framework, 1. As we have already done a lot
 of development for the project, we just want to actually keep the Zend
 adaptation process as quick as possible and don’t want to change the current
 file structure or project architecture (i.e. don’t want to use Zend’s MVC).
 2. We are thinking to actually just use the Zend components (like for
 database access, session handling, cookie management, AJAX etc), means that
 we for example, we will change the current database code to actually use the
 Zend’s database component. Is this a good approach to start with Zend? 3. We
 will be using a shared hosting initially with Windows + IIS, can we setup
 Zend there? Thanks.
 --
 View this message in context: New to zend world, need some 
 guidance..http://www.nabble.com/New-to-zend-world%2C-need-some-guidance..-tp23441826p23441826.html
 Sent from the Zend Framework mailing list 
 archivehttp://www.nabble.com/Zend-Framework-f15440.htmlat Nabble.com.



Re: [fw-general] IE issues and i have no idea

2009-05-06 Thread Cameron
This is caused by Javascript trying to manipulate the page content before
the page has completely loaded, other browsers handle it fine, IE doesn't.
It's a well known problem. If you google the error message you'll find heaps
of info, but the basic gist of it is that you need to delay the execution of
any JS that is going to manipulate the page.

On Thu, May 7, 2009 at 5:40 AM, dele454 d...@killerinstinct.co.za wrote:


 Hi Mark,

 Long time. How are you doing?

 Thanks for the reply. Well i am using ver 7.0.5730.11. You made a valid
 point there so i checked my source file and discovered the custom dojo
 build
 was loading after my js scripts. So i changed it to
 headScript()-prependFile() instead. - so that was sorted.

 I cleared cache but the problem still persists :( I wish i could ignore IE
 but i cant. Alot of our clients use this silly browser. In fact a client
 mailed this bug to me :( They cant view their company's details page using
 this God forsaken browser.

 Now i am so stuck with this error i cant even pin it on something

 ARRR!!



 Mark Wright-3 wrote:
 
  Which versions of IE are you testing?
 
  Anyways, this wouldn't be a ZF problem. It might be javascript. We
  have seen rare instances where loading javascripts in the wrong order
  can cause IE to show a similar error (might be the same error - I
  don't remember what it said). I think the best solution is to ignore
  IE entirely and let people who use it fend for themselves.
  Unfortunately the boss man disagrees.
 
 
  Mark
 
  On Wed, May 6, 2009 at 1:14 PM, dele454 d...@killerinstinct.co.za
 wrote:
 
  Hi,
 
  Whenever i browse the site i am working on at the moment using IE, i get
  the
  error below. I have tried to pin it on something but i dont know when it
  is
  giving such a message in IE. I have checked everything in my bootstrap
  but i
  cant find anything out of the ordinary there. Please i need help with
  this
  bug.
 
  It works perfectly on FF, Chrome and Opera. And  I am not experiencing
  this
  problem locally - ONLY LIVE.
 
  Thanks in advance.
 
  http://www.nabble.com/file/p23412418/bug.gif
 
  -
  dee
  --
  View this message in context:
 
 http://www.nabble.com/IE-issues-and-i-have-no-idea-tp23412418p23412418.html
  Sent from the Zend Framework mailing list archive at Nabble.com.
 
 
 
 
 
  --
  Have fun or die trying - but try not to actually die.
 
 


 -
 dee
 --
 View this message in context:
 http://www.nabble.com/IE-issues-and-i-have-no-idea-tp23412418p23416089.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] Zend_Forms with Zend_Db_Tables

2009-04-29 Thread Cameron
The $form-populate() method accepts an array of key-value pairs that it
will populate the form with before passing on to your view.

On Wed, Apr 29, 2009 at 4:05 PM, iceangel89 comet2...@gmail.com wrote:


 i think this is common. i want to create a form that optionally maps to a
 table row. eg. i have a departments table thus a department Zend_Db_Table

 i also created a form class that extends from Zend_Form to add/edit rows

 so for add its simple all fields empty. for edit i want to populate the
 fields with a table row. how can i do this?
 --
 View this message in context:
 http://www.nabble.com/Zend_Forms-with-Zend_Db_Tables-tp23292523p23292523.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




[fw-general] Serializing select objects supposed to be working but isn't.

2009-04-24 Thread Cameron
Hi guys, I've come up with a situation in my application where serializing a
select object to store it in a session variable would be remarkably useful,
but it isn't working. It's just throwing the usual can't serialize a PDO
object error. This was apparently fixed in
http://framework.zend.com/issues/browse/ZF-4600. Here's my basic code.

class DbTable_Candidates extends Zend_Db_Table_Abstract
{
/**
 * @var string Table name
 */
public $_name = 'candidates';

/**
 * @var string Primary key
 */
public $_primary = 'id';
}

...then, later on...

function fetchList($criteria) {
   $table = new DbTable_Candidates();
   $adapter = $table-getAdapter();
   $select  = $adapter-select();

... a bunch of stuff gets added to the $select object

   $serialize = serialize($select);
}

and the error: You cannot serialize or unserialize PDO instances

This is on 1.7.8 of the framework, by the way.


[fw-general] passing multiple fetchProperties through to FilteringSelect

2009-04-19 Thread Cameron
Hi guys, I'm just having trouble working out the syntax on this one, was
wondering if anyone could give me a quick hand - or even show me a better
way of doing it :P

What I'm trying to do is get a spinner to pop up when a FilteringSelect is
retrieving its JSON from the server. As best as I can tell, what you have to
do is attach your call on to the onBegin and onComplete of the fetch method
of the FilteringSelect. This is apparently done by way of passing in
fetchProperties, which are then mixed in before the fetch is called by the
FilteringSelect. So what I'm doing is this:

$this-addElement('FilteringSelect', 'jobs', array(
'label'= 'Job:',
'storeId' = 'jobStore',
'storeType'= 'dojo.data.ItemFileReadStore',
'storeParams' = array( 'url' =
'/jobs/autocomplete/format/ajax?autocomplete=1str=*',),
'fetchProperties' = array( 'onBegin' =
'snowwhite._toggleAjaxSpinner()', 'onComplete' =
'snowwhite._toggleAjaxSpinner()' ),
'autoComplete'   = 'false',
'hasDownArrow'   = 'true',
'id' = 'fk_jobs_id',
));

It's the fetchProperties format that is getting me. If I just include ONE
value, like this:

'fetchProperties' = array( 'onBegin' = 'snowwhite._toggleAjaxSpinner()' ),

It works fine - it actually triggers off the spinner, so I'm pretty sure I'm
on the right track here. The problem is trying to add in the onComplete, I
just can't seem to work out the syntax for passing through a second
property. I've tried various combinations of arrays inside arrays and all
sorts of tricks, all to no avail. Anyone know what I'm missing here? Or have
a better way of performing this trick?


Re: [fw-general] MVC - Model in View

2009-04-06 Thread Cameron
You should be populating the values of the form in your model before passing
it as a completed whole through to the view, then if you have to do any
autocomplete stuff, do it in javascript.

On Mon, Apr 6, 2009 at 4:43 PM, Marko Korhonen 
marko.korho...@datafisher.com wrote:


 Hi,

 I have made my model system as:
 Model, Model_DbTable, Model_DbTable_Row etc...

 I have always declared by models in controller, but MVC seems
 to allow View to command models also?
 I also try to live by the Fat models, thin controllers rule...

 So I made following:

 select name=faculty id=faculty

option value=-- Filter by Faculty --/option
?php $model = new Material_Model_Faculty(); foreach
 ($model-getAll() as
 $faculty): ?
option value=?= $this-url(array(faculty = $faculty-id),
 materials) ??= $faculty-name ?/option
?php endforeach; ?

 /select



 This is kinda religious question, I know... =)
 But this approach gives me very flexible developing...

 br, Marko
 --
 View this message in context:
 http://www.nabble.com/MVC---Model-in-View-tp22904523p22904523.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




[fw-general] Reporting in Zend Framework MVC applications

2009-03-25 Thread Cameron
Hi guys, this is probably more of a general OO question than specific to ZF,
but I thought I'd throw it out there to see if there's some really good
solutions out there.

I've written a pretty extensive application in ZF, it's all MVC driven, uses
Dojo and AJAX, it's pretty cool, and generic and flexible enough to easily
adapt against different databases with different object relationships. I'm
pretty proud of how it's coming out so far, despite a few obvious
shortcomings, but I've gotten to the point where one of the clients using
this wants a whole lot of reports generated, and that raises issues of
architectural requirements.

I've been looking at a Builder design pattern, but the more I think about
it, the more it doesn't really seem to solve many problems - MVC separates
the View already, and it ain't no thang to have a different view script per
report page. I guess what I'm trying to work out is how best to model the in
between bits - the classes between the View and the DB access in the Model.

My current Models really only have the usual get / insert / list / count /
delete methods, with a bunch of private methods for filtering, sorting and
ordering the data, and so any complex report queries would need to be either
built using these tools in a separate layer, or implemented as extra methods
in the current Model classes.

Another thing to consider is user input in these reports, like sorting by
columns, pagination, date ranges, etc.

I guess the question is one of style and elegance. Has anyone got any
examples of a good layer between the Controller and Model(s) for reporting?
I was basically considering something like this:


   - A Reports Controller with a whole lot of named Actions that map to the
   various reports we'll build.
   - Each Action handles gentle processing of user input and passes it on to
   the Reports Model.
   - The Reports model holds all the ugly business logic, calling queries
   and / or other Models directly, processing data to a point fit to return
   back to the Controller. Try and add private methods for standardizing
   functionality where I can.
   - The regular Models mapping against the business objects remain
   untouched.


My concern with this layout is one of cleanliness, I guess. It seems like a
lot of ugly code to put in the one Model. Has anyone seen this problem set
solved really nicely? Something like a handful of good generic reporting
methods that one can implement that map against a significant number of
typical reporting needs? A particular OO design pattern that suits this
really well? Something I haven't thought of?


Re: [fw-general] Models and input validation best practices

2009-03-25 Thread Cameron
On Wed, Mar 25, 2009 at 5:06 PM, Simon Corless si...@sico.co.uk wrote:




 fab2008 wrote:
 
  Hi all,
 
  I want to ask a simple question about validating user input especially
 the
  input from the url taken with $this-_getParam(). An example:
 
  Currently I write my models assuming that the parameters are correct,
 this
  mainly because the data are taken using a Zend_Form subclass and the
  validators make the hard job, but I have a doubt because on the other
 side
  the model classes are not safe used alone and they often needs controls
 on
  params correctness otherwise they may go into an inconsistent state, or
  even worse they could have some security vulnerability if used without
  those checks.
 
  What do you suggests?
 

 I believe the consensus around here is the fat model skinny controller
 concept, try searching the news group on Nabble for it, basically your
 model
 should handle all it's ins and outs from any data and your controller does
 very little other than call various models as required.

 You may also want to look in to Zend_Form and it's use as a validator which
 you can then call in your model to validate and filter the data.

 In short it's probably 'best' to change to your second method!

 Simon


I, too, use Zend_Form's validators, then all you need to do is in your
add/edit method, call:

if (!$form-isValid($data)) {
   return false;
}

If anyone has a really good regexp or 2 for cleaning up various inputs by
the way, I'd *LOVE* to see them.


Re: [fw-general] Reporting in Zend Framework MVC applications

2009-03-25 Thread Cameron
A decorator hey...

And so each ReportMetric would return... Hrm. Part of the issue is trying to
generate say, a report that lists all the staff members, and their stats for
the week along side them all. Ordinarily for something like that, I would
just write a big query that selects all the staff members, then joins on to
the various tables to fetch the various statistics. I'm considering breaking
down those joins in to generic methods that can be called from any base
query, as in if you wanted to find out how many comments were entered
alongside recordtype1, and also have a different report with comments
entered alongside recordtype2, then there is an obvious case for code reuse,
however... That sounds like it could very quickly get out of control, and
I'd end up putting all sorts of conditional stuff in those so-called
generic methods.

I guess using a chain of objects and a decorator, it would be easy to
generate reports with 2 or 3 different separate tables of data displayed on
it, ready for them to print out or use however they want. Compiling
different lists of reports becomes very easy.

Blergh! Maybe I'm over-thinking this. Perhaps my first implementation is
pretty much good enough for 90% of reporting needs, and I should just get it
written and move on to the next job.

On Wed, Mar 25, 2009 at 6:46 PM, keith Pope mute.p...@googlemail.comwrote:

 Maybe a decorator? You could then start with a base report and build it up.

 $report = new ReportMetricOne(new ReportMetricTwo(new Report()));

 $report could then be processed by a generic reporting class/model:

 $reportModel-generate($report);

 downside = complexity, decorators can be confusing to people ala
 Zend_Form :) Though once you get them they are easy



 2009/3/25 Cameron themsel...@gmail.com:
  Hi guys, this is probably more of a general OO question than specific to
 ZF,
  but I thought I'd throw it out there to see if there's some really good
  solutions out there.
 
  I've written a pretty extensive application in ZF, it's all MVC driven,
 uses
  Dojo and AJAX, it's pretty cool, and generic and flexible enough to
 easily
  adapt against different databases with different object relationships.
 I'm
  pretty proud of how it's coming out so far, despite a few obvious
  shortcomings, but I've gotten to the point where one of the clients using
  this wants a whole lot of reports generated, and that raises issues of
  architectural requirements.
 
  I've been looking at a Builder design pattern, but the more I think about
  it, the more it doesn't really seem to solve many problems - MVC
 separates
  the View already, and it ain't no thang to have a different view script
 per
  report page. I guess what I'm trying to work out is how best to model the
 in
  between bits - the classes between the View and the DB access in the
 Model.
 
  My current Models really only have the usual get / insert / list / count
 /
  delete methods, with a bunch of private methods for filtering, sorting
 and
  ordering the data, and so any complex report queries would need to be
 either
  built using these tools in a separate layer, or implemented as extra
 methods
  in the current Model classes.
 
  Another thing to consider is user input in these reports, like sorting by
  columns, pagination, date ranges, etc.
 
  I guess the question is one of style and elegance. Has anyone got any
  examples of a good layer between the Controller and Model(s) for
 reporting?
  I was basically considering something like this:
 
  A Reports Controller with a whole lot of named Actions that map to the
  various reports we'll build.
  Each Action handles gentle processing of user input and passes it on to
 the
  Reports Model.
  The Reports model holds all the ugly business logic, calling queries and
 /
  or other Models directly, processing data to a point fit to return back
 to
  the Controller. Try and add private methods for standardizing
 functionality
  where I can.
  The regular Models mapping against the business objects remain untouched.
 
  My concern with this layout is one of cleanliness, I guess. It seems like
 a
  lot of ugly code to put in the one Model. Has anyone seen this problem
 set
  solved really nicely? Something like a handful of good generic reporting
  methods that one can implement that map against a significant number of
  typical reporting needs? A particular OO design pattern that suits this
  really well? Something I haven't thought of?
 



 --
 --
 [MuTe]
 --



Re: [fw-general] Tabbed Dojo Interface

2009-02-05 Thread Cameron
On Wed, Feb 4, 2009 at 11:54 PM, Matthew Weier O'Phinney
matt...@zend.comwrote:

 -- HenryG henry.god...@tanist.co.uk wrote
 (on Wednesday, 04 February 2009, 04:05 AM -0800):
  I'm just starting out with Zend and Dojo and I have a quick question
 which I
  hope you can answer.
 
  I have built a tabbed dojo interface and some of the tabs contain dojo
  forms. I have a view helper which validates the dojo form onsubmit. The
  helper adds some javascript to head which connects up the submit button.
 
  The tabs are linked to an actions which use Context Switching to return
 an
  ajax response (I guess you'd call it lazy loading). Here's my problem, if
  I'm trying to lazy load a tab which contains a form then then the
 javascript
  for the head is not put in place. I cannot for the life of me figure out
 how
  this should be done. I've searched high and low before posting, so I
 really
  hope someone out there can help.

 This is where digging into the Dojo documentation can help.

 With dijit.layout.ContentPane, you can't return javascript; it simply
 won't get executed. However, you *can* embed special script tags within
 the content that the dojo parser will then parse and execute. As an
 example, the following is something I've done:

script type=dojo/method event=onLoad
dojo.connect(dijit.byId(submit), onclick, function(e){
/* actions go here... */
});
/script

 Note the dojo/method script type -- the parser recognizes various
 dojo/* types and creates callbacks or binds events accordingly.

 This can be added to your form via a custom decorator that renders
 inside the ContentPane.

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


Or even better, do what I do, and use the ContentPane's onLoad. This feature
doesn't seem to be documented anywhere I could find, I stumbed across it by
complete fluke, and yet, it is easily the best way to attach JS to tabbed
items in your Dojo + Zend app. Example:

code
   ?= $this-contentPane('files', '',
array('title' = 'Files',
'class' = 'tab',
'href' = $this-url(
array('controller' =
'files',
'action' = 'list',
'format' = 'ajax'
),
'default',
true),
 'parseOnLoad' = true,
 'onLoad' = app.attachJavascript('list',
'files')
)); ?
/code

attachJavascript in this case is a simple loader, and I pass it through a
couple of variables to let it know the actual JS I want it to load. Then, I
create a function named in a fashion the loader tries to find. If it exists,
it loads it, and there you have it - all the JS you could ever want to
include on a page, all in the right context, and it just works. None of
these special script tags, none of the nonsense with stuff not being able to
attach because the objects don't exist, none of that - it only loads what it
needs to when it needs to, and you can drop in whatever the hell JS you
want. dojo.connect, dojo.query, dojo,subscribe... all works perfectly :D

If the code tags don't work, I apologise, I'm just guessing here. I can
repost if the formatting is too munched.

code
dojo.mixin(app, {

attachJavascript: function (action, controller, params) {
var functionName = app. + action + ucfirst(controller) +
Attach;
if (eval(typeof  + functionName +  == 'function')) {
eval(functionName)(params);
}
},

listFilesAttach: function () {
dojo.connect(dijit.byId('files_id'), 'onChange', function () {
dijit.byId('contacts_id').store = new
dojo.data.ItemFileReadStore({ url:
/contacts/autocomplete/format/ajax?autocomplete=1files_id= +
dijit.byId(files_id).value });
});
},

}
/code


Re: [fw-general] Question about underscores in controller and action names

2009-02-02 Thread Cameron
yeah i've been wondering about this one too, given the standard thing to
do with table names is to put underscores in them, and controller names
don't seem to work with them, and controllers often map well to database
tables...

On Tue, Feb 3, 2009 at 7:45 AM, Terre Porter
tpor...@webpage-builders.comwrote:


 Hey all,

 I'm working on an upgrade to a existing site that has several url paths
 with
 underscores.

 I've been trying to figure out what would be the best way to handle these,
 as I can not easily change the urls all over the site.

 I read about this option in the list archives.

 $dispatcher = $frontController-getDispatcher();
 $dispatcher-setWordDelimiter('-', '.', '_');

 I can't seem to get this to work.

 For example, If I had a controller named : controller_name  - What would
 be the controller file and class name ?

 I've tried Controllername, controllerName, controller_name, nothing seems
 to
 be working.

 Would it be better to create a route?

 As an example url, I'm trying to figure out url's like this one :
 /special_section/discovering_pinellas/

 Thanks, Terre




[fw-general] Implementing generic views that apply to all your controllers. Action Helpers?

2009-01-18 Thread Cameron
Hi guys,

I have an application that is growing piece by piece, table by table, and as
it grows, as do the number of view scripts the application needs. In order
to ease maintenance on these, I've managed to make the vast majority of the
views indentical across controllers, by just passing the relevant variables
in to the view. Of course, this means I still have to cut and paste the
views each time I make a change to one of them, which is clearly
inefficient. So, what's the standard way around this? I saw Action Helpers,
and they seem like they would do the trick, but I'm not sure if that's
considered best practice. Any ideas?


Re: [fw-general] Implementing generic views that apply to all your controllers. Action Helpers?

2009-01-18 Thread Cameron
wouldn't view partials still require the view script to exist? I was trying
to avoid having the actual files there too. Infact, the perfect solution
would be to override if the file does exist.

On Mon, Jan 19, 2009 at 3:32 PM, Chris Weldon ch...@chrisweldon.net wrote:

 Action Helpers are really dependent upon what you are trying to do.
 Something that's static I would render out using partials. However, if
 you're doing a bit of output processing (nothing static), I would
 recommend using an Action Helper. :-)
 --
 Chris Weldon

 On Sun, Jan 18, 2009 at 11:17 PM, Cameron themsel...@gmail.com wrote:
  Hi guys,
 
  I have an application that is growing piece by piece, table by table, and
 as
  it grows, as do the number of view scripts the application needs. In
 order
  to ease maintenance on these, I've managed to make the vast majority of
 the
  views indentical across controllers, by just passing the relevant
 variables
  in to the view. Of course, this means I still have to cut and paste the
  views each time I make a change to one of them, which is clearly
  inefficient. So, what's the standard way around this? I saw Action
 Helpers,
  and they seem like they would do the trick, but I'm not sure if that's
  considered best practice. Any ideas?
 



 --
 Christopher Weldon
 http://chrisweldon.net
 ch...@chrisweldon.net



Re: [fw-general] Implementing generic views that apply to all your controllers. Action Helpers?

2009-01-18 Thread Cameron
Oh, well that sounds like what I'm looking for. I'll have a look at view
partials too.

And Zend_Layout isn't going to work out, each view per action is quite
different. Ergh. I mean... maybe I could, but there'd be so much if-then
logic to accomodate the differences it'd rapidly turn in to a nightmare.

On Mon, Jan 19, 2009 at 4:31 PM, Chris Weldon ch...@chrisweldon.net wrote:

 Not necessarily. You can put one partial in a single location. I have
 the following structure for my applications:

 application/
  layouts/
  views/
scripts/
  modules/
agency/
  views/
scripts/

 I have scripts located in both the layouts/, views/scripts, and
 modules/*/views/scripts/ folders, and I render some partials located
 in just application/views/scripts from the module/controller view
 script. You don't have to have a copy in each of your respective
 controller directories.

 BTW, is what you're doing not suitable for Zend_Layout ?
 --
 Chris Weldon

 On Mon, Jan 19, 2009 at 12:36 AM, Cameron themsel...@gmail.com wrote:
  wouldn't view partials still require the view script to exist? I was
 trying
  to avoid having the actual files there too. Infact, the perfect solution
  would be to override if the file does exist.
 
  On Mon, Jan 19, 2009 at 3:32 PM, Chris Weldon ch...@chrisweldon.net
 wrote:
 
  Action Helpers are really dependent upon what you are trying to do.
  Something that's static I would render out using partials. However, if
  you're doing a bit of output processing (nothing static), I would
  recommend using an Action Helper. :-)
  --
  Chris Weldon
 
  On Sun, Jan 18, 2009 at 11:17 PM, Cameron themsel...@gmail.com wrote:
   Hi guys,
  
   I have an application that is growing piece by piece, table by table,
   and as
   it grows, as do the number of view scripts the application needs. In
   order
   to ease maintenance on these, I've managed to make the vast majority
 of
   the
   views indentical across controllers, by just passing the relevant
   variables
   in to the view. Of course, this means I still have to cut and paste
 the
   views each time I make a change to one of them, which is clearly
   inefficient. So, what's the standard way around this? I saw Action
   Helpers,
   and they seem like they would do the trick, but I'm not sure if that's
   considered best practice. Any ideas?
  
 
 
 
  --
  Christopher Weldon
  http://chrisweldon.net
  ch...@chrisweldon.net
 
 



 --
 Christopher Weldon
 http://chrisweldon.net
 ch...@chrisweldon.net



Re: [fw-general] What do you use to manage your ZF projects?

2008-12-21 Thread Cameron
I'm using Project Locker - http://www.projectlocker.com - it's a hosted SVN
+ Trac system, supports unlimited projects, works really well, it's not
terribly pretty, but it's basically everything you need all in one package.
Now if only they could integrate some sort of billing system so I can have
contractors log in, get their tickets, log their hours and have PL bill the
client, well, then I'd hardly even have to do anything ever again :P


Re: [fw-general] Default value of a Zend_Dojo_Form_Element_DateTextBox in a Zend_Form

2008-12-21 Thread Cameron
is the output of $zdate-getIso() correct?

On Sat, Dec 20, 2008 at 7:36 AM, Barrett Conrad barrettcon...@gmail.comwrote:

 I know this post if aging, but I'm still having some difficulty with it.

 I attempted using Zend_Date's getIso, with basically no change.

 class My_Zend_Form extends Zend_Form {

 public function init() {

 // ... GET $obj ROW FROM DATABASE

 $date = new Zend_Dojo_Form_Element_DateTextBox('date');
  $zdate = new Zend_Date();

 // $obj-date is from MySQL and formatted as 'Y-m-d'
 $zdate-set($obj-date, Zend_Date::ISO_8601);

 // METHOD 1
 $date-setValue($zdate-getIso());

 // METHOD 2
 $this-populate(array('date' = $obj-date));

 $this-addElements(array($date));

 // I ATTEMPTED METHOD 2 HERE AFTER ADDING THE ELEMENTS JUST TO BE SURE
 }

 The form still pops on the screen with the right date and then it
 disappears from the form element once the JavaScript kicks in.

 Thanks again for the help.

 On Dec 14, 2008, at 9:01 PM, Cameron wrote:

 You need to pass the element an ISO date. Try something like this:

 $date = new Zend_Date();
 $date-set($row['date'], Zend_Date::ISO_8601);
 $retarr['auction_date'] = $date-getIso();


 Interestingly enough, the Time picker accepts the full ISO date too, if
 you're using them. Unfortunately you need to do this for every date/time
 dojo field and datetime you pull out of a mysql DB, because mysql misses the
 T in the middle - although it happily accepts an ISO date as an input, it
 stores it without. Quite annoying, really.


 On Mon, Dec 15, 2008 at 4:53 AM, Barrett Conrad 
 barrettcon...@gmail.comwrote:

 Hello all.  I am attempting to use a Zend_Dojo_Form_Element_DateTextBox in
 a Zend_Form and I am unable to set the default value for the date picker.
  The element works fine if the form/element validates, but the element does
 not retain its value when the validation fails or it has no value at all if
 I am populating it with existing data.  I am currently trying to use
 -setValue on the element within the Zend_Form, and that works up to the
 initial page load; once Dojo kicks in and turns the element into a date
 picker it appears to strip the value of the input.  A simple example of what
 I am trying is:

 class My_Zend_Form extends Zend_Form {

public function init() {

$date = new Zend_Dojo_Form_Element_DateTextBox('date');

$date-setLabel('Date')
-setValue(date('m/d/Y'));

$this-addElements(array($date));
}

 }

 Just to be clear, all other elements of the form work just fine;  only the
 Dojo date picker has problems.

 Thanks for the assistance,
 Barrett M. Conrad






Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.

2008-12-17 Thread Cameron
Yep, $tmpdir is empty. That must mean none of the entire _getTmpDir method
works in my environment, at least in the context of $adapter-getFileName().
Looking over the _getTmpDir method it, I find that...

   if (empty($this-_tmpDir)) {
// Attemp to detect by creating a temporary file
$tempFile = tempnam(md5(uniqid(rand(), TRUE)), '');
if ($tempFile) {
$tmpdir = realpath(dirname($tempFile));
unlink($tempFile);
} else
{

require_once 'Zend/File/Transfer/Exception.php';
throw new Zend_File_Transfer_Exception('Could not
determine temp directory');
}
}

it enters this conditional statement, yet seems to escape it without
throwing that exception. so the tempfile check isn't working. not 100% sure
what you guys are trying to do with this check, but whatever it is, it's not
working on my server :)

On Wed, Dec 17, 2008 at 4:53 PM, Thomas Weidner thomas.weid...@gmx.atwrote:

 Cameron,

 to go further with debugging you can see that your exception is called in
 the file Abstract on line 948.
 Now simply output the destination directory on line 947 so you can see
 which directory you set.

 Then check if the directory which is set there
 * does exist
 * has write access

 Do this checks within your application as your user can have other rights
 than the webserver.

 I am sure you will see where the problem is.

 To note:
 This is default debugging strategy... there is no magic ZF action or
 knowledge necessary. :-)

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Thomas Weidner thomas.weid...@gmx.at
 Cc: Zend Framework - General fw-general@lists.zend.com
 Sent: Wednesday, December 17, 2008 1:59 AM

 Subject: Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.


  here's the full $e.

 http://pastebin.com/m5d442e15

 the line in my code, line 83, that is definitely where it is calling
 $adapter-getFileName().

 On Tue, Dec 16, 2008 at 7:01 PM, Thomas Weidner thomas.weid...@gmx.at
 wrote:

  Cameron,

 when you have unexpected exceptions somewhere in your code it's always
 usefull to get the whole exception and not only the rethrown content.

 This would be really helpfull, not only for ZF but for every generic
 problem where exceptions are thrown.

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Thomas Weidner thomas.weid...@gmx.at
 Cc: Zend Framework - General fw-general@lists.zend.com
 Sent: Tuesday, December 16, 2008 10:47 AM
 Subject: Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.



  Yeah ok, so that's all a bit messy/broken, but I've cleaned it up and
 it's

 still doing the same thing:

 here's the cleaned up code in a pastebin:

 http://pastebin.com/m5bab1a44

 the output is:

 Array ( [0] = bbbThe given destination is no directory or does not
 exist
 )

 To test and make sure, i reverted to 1.7.0, still works fine.


 On Tue, Dec 16, 2008 at 5:31 PM, Thomas Weidner thomas.weid...@gmx.at
 wrote:

  Hy Cameron,


 Why should the first catch, catch anything when there is a failure ?
 According to manual, receive() returns a false on failure, not an
 exception.

 Also you are calling getFileName in any case, regardless if the form is
 valid or not.

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Zend Framework - General fw-general@lists.zend.com
 Sent: Tuesday, December 16, 2008 7:25 AM
 Subject: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.



  if ($form-isValid($formData)) {

  //the form is valid, finish moving the file about

 $adapter = new Zend_File_Transfer_Adapter_Http();
 if ($adapter-isValid() === false) {
 print_r($adapter-getMessages());
 }

 try {
 $adapter-setDestination($path .
 /$src_class/$foreign_id)
 -receive();
 } catch (Exception $e) {
 $errors[] = $e-getMessage();
 }
 }

 if (!$errors) {
 //if there are no errors with things so far, add a db
 record.
 try {
 $this-_model-add(array('foreign_id' = $foreign_id,
 'filename' = $adapter-getFileName(), 'src_class' = $src_class,
 'type'
 =
 $formData['newform']['type']));
 }
 catch (Exception $e) {
 $errors[] = $e-getMessage();
 }
 }


 This works perfectly with 1.7.0, fails in 1.7.1 with a really odd
 problem
 -
 it doesn't fail until the SECOND catch Exception, and the error it
 returns
 is The given

Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.

2008-12-16 Thread Cameron
Yeah ok, so that's all a bit messy/broken, but I've cleaned it up and it's
still doing the same thing:

here's the cleaned up code in a pastebin:

http://pastebin.com/m5bab1a44

the output is:

Array ( [0] = bbbThe given destination is no directory or does not exist )

To test and make sure, i reverted to 1.7.0, still works fine.


On Tue, Dec 16, 2008 at 5:31 PM, Thomas Weidner thomas.weid...@gmx.atwrote:

 Hy Cameron,

 Why should the first catch, catch anything when there is a failure ?
 According to manual, receive() returns a false on failure, not an
 exception.

 Also you are calling getFileName in any case, regardless if the form is
 valid or not.

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Zend Framework - General fw-general@lists.zend.com
 Sent: Tuesday, December 16, 2008 7:25 AM
 Subject: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.



if ($form-isValid($formData)) {
   //the form is valid, finish moving the file about

   $adapter = new Zend_File_Transfer_Adapter_Http();
   if ($adapter-isValid() === false) {
   print_r($adapter-getMessages());
   }

   try {
   $adapter-setDestination($path .
 /$src_class/$foreign_id)
   -receive();
   } catch (Exception $e) {
   $errors[] = $e-getMessage();
   }
   }

   if (!$errors) {
   //if there are no errors with things so far, add a db
 record.
   try {
   $this-_model-add(array('foreign_id' = $foreign_id,
 'filename' = $adapter-getFileName(), 'src_class' = $src_class, 'type'
 =
 $formData['newform']['type']));
   }
   catch (Exception $e) {
   $errors[] = $e-getMessage();
   }
   }


 This works perfectly with 1.7.0, fails in 1.7.1 with a really odd problem
 -
 it doesn't fail until the SECOND catch Exception, and the error it returns
 is The given destination is no directory or does not exist, which it
 most
 certainly does because the file is being uploaded and moved in to place
 just
 fine, nor can I see how the setDestinaton method is being called by the
 getFileName method?
 This is all a bit too weird for me, I'm not really sure what's going on.
 printing out variables as the setDestination method is being called shows
 a
 perfectly fine path, and the file is being written... there's just this
 exception being thrown at some point. If one of you Zend guys has a good
 place for me to start debugging this one from I'm more than happy to help.





Re: [fw-general] How to set name= on form

2008-12-16 Thread Cameron
$form-addAttribs(array('name' = 'formname')); ?

On Wed, Dec 17, 2008 at 9:24 AM, maxarbos maxar...@yahoo.com wrote:


 Have you gotten any answers on this?
 I am having the same issue and cannot get the name attribute to be set.

 I am using 1.5 of the framework.


 notmessenger wrote:
 
  I know I've seen this answer somewhere before on this list, but I cannot
  find it anywhere (archives or my own copies of the emails).
  I have this code:
 

 --
 View this message in context:
 http://www.nabble.com/How-to-set-name%3D%22%22-on-form-tp19422464p21044857.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.

2008-12-16 Thread Cameron
here's the full $e.

http://pastebin.com/m5d442e15

the line in my code, line 83, that is definitely where it is calling
$adapter-getFileName().

On Tue, Dec 16, 2008 at 7:01 PM, Thomas Weidner thomas.weid...@gmx.atwrote:

 Cameron,

 when you have unexpected exceptions somewhere in your code it's always
 usefull to get the whole exception and not only the rethrown content.

 This would be really helpfull, not only for ZF but for every generic
 problem where exceptions are thrown.

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Thomas Weidner thomas.weid...@gmx.at
 Cc: Zend Framework - General fw-general@lists.zend.com
 Sent: Tuesday, December 16, 2008 10:47 AM
 Subject: Re: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.



  Yeah ok, so that's all a bit messy/broken, but I've cleaned it up and it's
 still doing the same thing:

 here's the cleaned up code in a pastebin:

 http://pastebin.com/m5bab1a44

 the output is:

 Array ( [0] = bbbThe given destination is no directory or does not exist
 )

 To test and make sure, i reverted to 1.7.0, still works fine.


 On Tue, Dec 16, 2008 at 5:31 PM, Thomas Weidner thomas.weid...@gmx.at
 wrote:

  Hy Cameron,

 Why should the first catch, catch anything when there is a failure ?
 According to manual, receive() returns a false on failure, not an
 exception.

 Also you are calling getFileName in any case, regardless if the form is
 valid or not.

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Cameron themsel...@gmail.com
 To: Zend Framework - General fw-general@lists.zend.com
 Sent: Tuesday, December 16, 2008 7:25 AM
 Subject: [fw-general] Unusual bug introduced with 1.7.1 in Zend_File.



   if ($form-isValid($formData)) {

  //the form is valid, finish moving the file about

  $adapter = new Zend_File_Transfer_Adapter_Http();
  if ($adapter-isValid() === false) {
  print_r($adapter-getMessages());
  }

  try {
  $adapter-setDestination($path .
 /$src_class/$foreign_id)
  -receive();
  } catch (Exception $e) {
  $errors[] = $e-getMessage();
  }
  }

  if (!$errors) {
  //if there are no errors with things so far, add a db
 record.
  try {
  $this-_model-add(array('foreign_id' = $foreign_id,
 'filename' = $adapter-getFileName(), 'src_class' = $src_class, 'type'
 =
 $formData['newform']['type']));
  }
  catch (Exception $e) {
  $errors[] = $e-getMessage();
  }
  }


 This works perfectly with 1.7.0, fails in 1.7.1 with a really odd
 problem
 -
 it doesn't fail until the SECOND catch Exception, and the error it
 returns
 is The given destination is no directory or does not exist, which it
 most
 certainly does because the file is being uploaded and moved in to place
 just
 fine, nor can I see how the setDestinaton method is being called by the
 getFileName method?
 This is all a bit too weird for me, I'm not really sure what's going on.
 printing out variables as the setDestination method is being called
 shows
 a
 perfectly fine path, and the file is being written... there's just this
 exception being thrown at some point. If one of you Zend guys has a good
 place for me to start debugging this one from I'm more than happy to
 help.








[fw-general] Unusual bug introduced with 1.7.1 in Zend_File.

2008-12-15 Thread Cameron
if ($form-isValid($formData)) {
//the form is valid, finish moving the file about

$adapter = new Zend_File_Transfer_Adapter_Http();
if ($adapter-isValid() === false) {
print_r($adapter-getMessages());
}

try {
$adapter-setDestination($path .
/$src_class/$foreign_id)
-receive();
} catch (Exception $e) {
$errors[] = $e-getMessage();
}
}

if (!$errors) {
//if there are no errors with things so far, add a db
record.
try {
$this-_model-add(array('foreign_id' = $foreign_id,
'filename' = $adapter-getFileName(), 'src_class' = $src_class, 'type' =
$formData['newform']['type']));
}
catch (Exception $e) {
$errors[] = $e-getMessage();
}
}


This works perfectly with 1.7.0, fails in 1.7.1 with a really odd problem -
it doesn't fail until the SECOND catch Exception, and the error it returns
is The given destination is no directory or does not exist, which it most
certainly does because the file is being uploaded and moved in to place just
fine, nor can I see how the setDestinaton method is being called by the
getFileName method?
This is all a bit too weird for me, I'm not really sure what's going on.
printing out variables as the setDestination method is being called shows a
perfectly fine path, and the file is being written... there's just this
exception being thrown at some point. If one of you Zend guys has a good
place for me to start debugging this one from I'm more than happy to help.


Re: [fw-general] How to set up dependant dropdowns in form

2008-12-14 Thread Cameron
try calling it statically, Zend_Json::encode($data);

On Sun, Dec 14, 2008 at 11:39 PM, Ace Paul sa...@acewebdesign.com.auwrote:


 thanks for your help on this.
 I'm trying to get this going, but not having any luck at all, especially
 seeing as I haven't used json with zend yet.

 I'm getting this error in my controller file.

 Method encodeJson does not exist and was not trapped in __call()
   public function _prepareautocompletion($data) {
$items = array();
foreach ($data as $key = $value) {
$items[] = array('label' = $value, 'name' = $value, 'key' =
 $key);
}
$final = array(
'identifier' = 'key',
'items' = $items,
);
return $this-encodeJson($final);
}

 this is my autocompleteAction in CategoryController.php

  function autocompleteAction ()
{
$this-getHelper('viewRenderer')-setNoRender();
$request = $this-getRequest();
$category_id =
 (int)$this-_request-getParam('category_id');
$race = new Race();
$races = $race-getCategoryRaces($category_id); // function
 to output all
 races
 $this-view-races = $this-_prepareautocompletion($races);
}


 Ok, now theres a couple things here i'm unsure of.
 Firstly because this is setup with the first select box not populated
 because it is expecting data from a data store, how am I to pass this info
 into the json request. I'm sure I'm way off track with this one.
 And Second, why am I getting the json error. Do I need to set something up
 before hand for this to work.

 thanks
 Paul


 Themselves wrote:
 
  I have spent WAY too much time getting this exact scenario working using
  Zend Dojo forms and an MVC environment, and I plan on building an
  extensive
  article explaining it all soon, but for now, here's the really quick and
  dirty version. I haven't gotten my version perfect yet, I'm still not
  happy
  with the URLs I'm calling to retrieve the data, but that's not a huge
  deal.
  Anyway, on with the show.
 
  First of all, here's your two form elements.
 
  $this-addElement('FilteringSelect', 'fk_client_id', array(
  'label'= 'Client:',
  'storeId' = 'clientStore',
  'storeType'= 'dojo.data.ItemFileReadStore',
  'storeParams' = array( 'url' =
  '/clients/autocomplete/format/ajax?autocomplete=1str=*',),
  'autoComplete'   = 'false',
  'hasDownArrow'   = 'true',
  'id' = 'fk_client_id',
  ));
 
  $this-addElement('FilteringSelect', 'fk_client_contact_id',
  array(
  'label'= 'Client contact:',
  'storeId' = 'clientContactStore',
  'storeType'= 'dojo.data.ItemFileReadStore',
  'autoComplete'   = 'false',
  'hasDownArrow'   = 'true',
  'id' = 'fk_client_contact_id',
  ));
 
  Now for the javascript, this has to appear somewhere on the page that
  contains the form.
 
  dojo.connect(dijit.byId('fk_client_id'), 'onChange', function () {
  dijit.byId('fk_client_contact_id').store = new
  dojo.data.ItemFileReadStore({ url:
  /clientcontacts/autocomplete/format/ajax?autocomplete=1fk_client_id= +
  dijit.byId(fk_client_id).value });
  });
 
 
  As for the URLs for the Datastores, they are kind of an exercise for the
  reader, other than to say they obviously should filter correctly on the
  passed parameters, and they have to return JSON. This part was pretty
  annoying, but I eventually found that a function like this returns the
  correct JSON format:
 
  public function prepareAutoCompletion($data) {
  $items = array();
  foreach ($data as $key = $value) {
  $items[] = array('label' = $value, 'name' = $value, 'key'
 =
  $key);
  }
  $final = array(
  'identifier' = 'key',
  'items' = $items,
  );
  return $this-encodeJson($final);
  }
 
 
  You pass in to the function an array of id = value pairs, and it will
  output the correct JSON for the FilteringSelects. If you use the built in
  AutoCompleteDojo helper, it won't use the id from your table as the value
  that the form submits, which is pretty much useless.
 
  Oh, and one more trick, for the Edit action, you are going to need to
  include something like this:
 
  $form-populate($row);
  $form-getElement('fk_client_contact_id')-setStoreParams(array( 'url' =
  '/clientcontacts/autocomplete/format/ajax?autocomplete=1fk_client_id='
 .
  $form-getElement('fk_client_id')-getValue() ));
 
  So that it prepopulates the form correctly.
 
  I promise I'll write up a really impressive document that spells this
  whole
  thing out in painstaking detail, I'm just absolutely flat out until
  christmas, I haven't had any time!
 
 
  On Tue, Dec 9, 2008 at 10:58 AM, Ace Paul sa...@acewebdesign.com.au
  wrote:
 
 
  I have a form, which I 

Re: [fw-general] Default value of a Zend_Dojo_Form_Element_DateTextBox in a Zend_Form

2008-12-14 Thread Cameron
You need to pass the element an ISO date. Try something like this:

$date = new Zend_Date();
$date-set($row['date'], Zend_Date::ISO_8601);
$retarr['auction_date'] = $date-getIso();


Interestingly enough, the Time picker accepts the full ISO date too, if
you're using them. Unfortunately you need to do this for every date/time
dojo field and datetime you pull out of a mysql DB, because mysql misses the
T in the middle - although it happily accepts an ISO date as an input, it
stores it without. Quite annoying, really.


On Mon, Dec 15, 2008 at 4:53 AM, Barrett Conrad barrettcon...@gmail.comwrote:

 Hello all.  I am attempting to use a Zend_Dojo_Form_Element_DateTextBox in
 a Zend_Form and I am unable to set the default value for the date picker.
  The element works fine if the form/element validates, but the element does
 not retain its value when the validation fails or it has no value at all if
 I am populating it with existing data.  I am currently trying to use
 -setValue on the element within the Zend_Form, and that works up to the
 initial page load; once Dojo kicks in and turns the element into a date
 picker it appears to strip the value of the input.  A simple example of what
 I am trying is:

 class My_Zend_Form extends Zend_Form {

public function init() {

$date = new Zend_Dojo_Form_Element_DateTextBox('date');

$date-setLabel('Date')
-setValue(date('m/d/Y'));

$this-addElements(array($date));
}

 }

 Just to be clear, all other elements of the form work just fine;  only the
 Dojo date picker has problems.

 Thanks for the assistance,
 Barrett M. Conrad



[fw-general] Zend_Date and Timezones - how do I turn them off?

2008-12-14 Thread Cameron
Hi guys,

I'm just doing a bit of work with the Dojo date and time pickers, and it's
all going wonderfully, and I decided to use the Zend_Date::ISO_8601 method
for formatting the output from MySQL, which works perfectly well, all except
for the fact it's appending a timezone, which then goes and screws with the
time that gets displayed in the time picker - i wouldn't have noticed this
if it wasn't for DST!

Anyway, all I want is to basically turn off the whole timezone thing - I
don't need it for this project, and it's much more obvious for the time
stored in the DB to be the time of the event, not a GMT representation of
it. I tried $date-setTimezone(NULL); and $date-setTimezone(''); but I got
nothing. Of course I can chop the last 6 chars off the string and everything
will be fine, but i'd rather not have to resort to such clunkiness if at all
possible.


Re: [fw-general] Dynamically create dojo form elements

2008-12-12 Thread Cameron
Dynamically adding form elements is painful, because of form validation
issues. What I usually do is add all the possible form elements to the form
up front, and then use JS / Controller logic to dictate what elements I
should or shouldn't display. I guess you could store the form object in
session and add/remove records from there. That would probably work too.

On Thu, Dec 11, 2008 at 2:58 AM, Daniel Latter dan.lat...@gmail.com wrote:

 First of appologies to everyone  for the blank message.

 I would like to get thoughts on the below scenario:

 I wish to dynamically add elements to a Zend_Dojo_Form. I was wondering if
 any one has managed to do this, and if it can be done.

 My initial thoughts are to send an Ajax request that will append set
 elements to the current form, but I'm not sure if that can be done, could
 anyone please give me some pointers where to start, it will help alot,

 Thanks



Re: [fw-general] How to set up dependant dropdowns in form

2008-12-08 Thread Cameron
I have spent WAY too much time getting this exact scenario working using
Zend Dojo forms and an MVC environment, and I plan on building an extensive
article explaining it all soon, but for now, here's the really quick and
dirty version. I haven't gotten my version perfect yet, I'm still not happy
with the URLs I'm calling to retrieve the data, but that's not a huge deal.
Anyway, on with the show.

First of all, here's your two form elements.

$this-addElement('FilteringSelect', 'fk_client_id', array(
'label'= 'Client:',
'storeId' = 'clientStore',
'storeType'= 'dojo.data.ItemFileReadStore',
'storeParams' = array( 'url' =
'/clients/autocomplete/format/ajax?autocomplete=1str=*',),
'autoComplete'   = 'false',
'hasDownArrow'   = 'true',
'id' = 'fk_client_id',
));

$this-addElement('FilteringSelect', 'fk_client_contact_id', array(
'label'= 'Client contact:',
'storeId' = 'clientContactStore',
'storeType'= 'dojo.data.ItemFileReadStore',
'autoComplete'   = 'false',
'hasDownArrow'   = 'true',
'id' = 'fk_client_contact_id',
));

Now for the javascript, this has to appear somewhere on the page that
contains the form.

dojo.connect(dijit.byId('fk_client_id'), 'onChange', function () {
dijit.byId('fk_client_contact_id').store = new
dojo.data.ItemFileReadStore({ url:
/clientcontacts/autocomplete/format/ajax?autocomplete=1fk_client_id= +
dijit.byId(fk_client_id).value });
});


As for the URLs for the Datastores, they are kind of an exercise for the
reader, other than to say they obviously should filter correctly on the
passed parameters, and they have to return JSON. This part was pretty
annoying, but I eventually found that a function like this returns the
correct JSON format:

public function prepareAutoCompletion($data) {
$items = array();
foreach ($data as $key = $value) {
$items[] = array('label' = $value, 'name' = $value, 'key' =
$key);
}
$final = array(
'identifier' = 'key',
'items' = $items,
);
return $this-encodeJson($final);
}


You pass in to the function an array of id = value pairs, and it will
output the correct JSON for the FilteringSelects. If you use the built in
AutoCompleteDojo helper, it won't use the id from your table as the value
that the form submits, which is pretty much useless.

Oh, and one more trick, for the Edit action, you are going to need to
include something like this:

$form-populate($row);
$form-getElement('fk_client_contact_id')-setStoreParams(array( 'url' =
'/clientcontacts/autocomplete/format/ajax?autocomplete=1fk_client_id=' .
$form-getElement('fk_client_id')-getValue() ));

So that it prepopulates the form correctly.

I promise I'll write up a really impressive document that spells this whole
thing out in painstaking detail, I'm just absolutely flat out until
christmas, I haven't had any time!


On Tue, Dec 9, 2008 at 10:58 AM, Ace Paul [EMAIL PROTECTED] wrote:


 I have a form, which I would like to use dependent drop downs in. I can't
 seem to find anything about it hear, after looking all morning trying to
 work it out.
 I have one field race_country
 when an option is selected I would like to show the cities in that country.
 The following is what I have currently in the form, which will show all
 countries and all cities.
 Any help would be great. thanks

 $table = new Country();
 foreach ($table-fetchAll() as $c) {
$country-addMultiOption($c-country_id, $c-country_name);
 }
  $this-addElement( $country);

  $city = new Zend_Form_Element_Select('race_city');
 $city-setLabel('City')
 -setRequired(true);

 $table = new City();
 foreach ($table-fetchAll() as $c) {
$city-addMultiOption($c-city_id, $c-city_name);
 }
  $this-addElement( $city);
 --
 View this message in context:
 http://www.nabble.com/How-to-set-up-dependant-dropdowns-in-form-tp20907379p20907379.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] [Dumb Question] How do I use the URL view helper in my controllers?

2008-12-02 Thread Cameron
well i thought about that, and that's a very simple solution (because the
code in the url helper is very simple), but that internal interface might
change in later revisions of the framework, so i thought i'd see about doing
it the right way :P

On Tue, Dec 2, 2008 at 5:21 PM, keith Pope [EMAIL PROTECTED] wrote:

 I would have a look inside the view url helper and maybe create an
 action helper that does the same?

 2008/12/2 Cameron [EMAIL PROTECTED]:
  Hi guys,
 
  The subject line sums it all up. I do some URL generation in the
 controller
  / model (form submission URLs and so on), and I'd love to be able to use
 the
  same url View Helper that has proven so wonderful in my Views. What's the
  trick? I'm sure it's something simple that I'm not smart enough to have
  guessed.
 



 --
 --
 [MuTe]
 --



Re: [fw-general] Question on organising controllers

2008-12-01 Thread Cameron
I'm pretty terrible at the whole MVC thing but I've done ok with a separate
controller for each table (except for obvious exclusions like intersection
tables or tiny tables for normalization purposes), and then extra
controllers for stuff in your app, like users, and action helpers /
bootstrap code for stuff that you'll use across all the controllers like
logging or ACLs.

One thing I will say is that you'll probably end up implementing a Base
controller that all your other controllers inherit from. Apparently you are
meant to use action helpers for stuff like that though, but eh... it works
for me and it is pretty simple and easy to follow.

On Mon, Dec 1, 2008 at 7:13 PM, Julian102 [EMAIL PROTECTED] wrote:


 Hello,

 I am new to using the MVC (or any other design pattern) as well as zend
 framework.

 I can find lots and lots of documentation on what a controller is and how
 it
 works however I am still struggling to find out how to decide how to
 organise controllers in my applicaiton.

 Say I had a community site where people go to discuss their faviroute music
 albums and it was made up of the following

 a bar at the top where people can login, register, logout, access their
 personal account

 home page (where you can pick your preferred genre)
 page which shows each album in that genre
 page which allows people to discuss the album they have picked
 login page
 signup page
 logout page

 How would you decide what the controllers are.

 If you could help me, or point me to somewhere that can I would be very
 greatful

 Thanks in advance
 --
 View this message in context:
 http://www.nabble.com/Question-on-organising-controllers-tp20768820p20768820.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




[fw-general] [Dumb Question] How do I use the URL view helper in my controllers?

2008-12-01 Thread Cameron
Hi guys,

The subject line sums it all up. I do some URL generation in the controller
/ model (form submission URLs and so on), and I'd love to be able to use the
same url View Helper that has proven so wonderful in my Views. What's the
trick? I'm sure it's something simple that I'm not smart enough to have
guessed.


Re: [fw-general] ZF 1.7 - Zend Dojo SubmitButton Bug?

2008-11-25 Thread Cameron
it's a known bug, try this:

http://www.framework.zend.com/issues/browse/ZF-4977;jsessionid=C628D5128C025969ADFBC9D052740C19?page=com.atlassian.jira.ext.fisheye:fisheye-issuepanel



On Tue, Nov 25, 2008 at 10:14 PM, drj201 [EMAIL PROTECTED] wrote:


 Hi all,

 I have created a form class that extends Zend_Dojo_Form. I have various
 elements (i.e. ComboBox, DateTextBox etc) in the form including a
 SubmitButton and they all display perfectly in ZF1.6.1.

 My problem has arrisen since upgarading to ZF 1.7. Since the upgrade the
 SubmitButton is not displaying correctly (Everything else works fine).

 Below is the code involved:

 $this-addElement('SubmitButton', 'submit', array(
'label' = 'Submit!!',
'decorators' = $this-_buttonElementDecorator // returns array
 ('DijitElement')
 ));


 $this-addDisplayGroup(
array('submit'), 'datasubmit',
array(
'disableLoadDefaultDecorators' = true,
'decorators' = $this-_buttonGroupDecorator, // returns array
 ('FormElements', 'Fieldset')
'class' = 'submit'
)
 );

 This results in the following HTML being generated:

 input content=Submit!! id=submit name=submit value=
 type=submit //fieldset/form


 Note the 'label' value from the addElement is placed within a 'content'
 attribute in the HTML but the 'value' remains empty...?!

 Am I doing something wrong? Apologies if so... This works perfectly fine in
 ZF 1.6.1. I notice the Dojo CDN has changed to Google in the latest
 release
 but Im unsure of the cause... Both Zend_Dojo_View_Helper_SubmitButton and
 Zend_Dojo_View_Helper_Button appear to be exactly the same in both
 versions...

 Thanks,

 David
 --
 View this message in context:
 http://www.nabble.com/ZF-1.7---Zend-Dojo-SubmitButton-Bug--tp20680984p20680984.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] New To PHP Zend

2008-11-24 Thread Cameron
I would also recommend a basic guide to OO programming, as much of Zend
takes advantage of PHP5's OO features, and unless you spend the time to
formally learn OO it can be somewhat confusing. There are a number of
fantastic tutorials out there on the Googles, but I personally read the
first 2 chapters of Packt Publishing - Object-Oriented Programming with
PHP5, which all made so much sense that I didn't need the rest of the book
:P

There's a lot more to OO than what you'll learn through an understanding the
mechanics of it, it takes a number of years to really get to *think* in
objects. Bruce Eckel's Thinking in Java is apparently a fantastic book for
helping you down the road of truly understanding OO, but I've not read past
the first few pages yet. Always so busy :/

On Tue, Nov 25, 2008 at 1:55 AM, Django Woolf [EMAIL PROTECTED] wrote:


 Hi All

 Am new to php/mysql and am looking to use Zend Framework as the backbone of
 my introduction into such application design, for the purposes of building
 dynamic web sites.

 I have made myself sufficiently familair with HTML as the first part of my
 learning and now wish to step up to building data driven web applications.

 Have fore-armed myself with several books for reference, but feel that at
 my
 advanced years and lack of technical nous...the best method for accelerated
 learning is to use the above, in a by rote manner.almost like building
 a
 jigsaw, which I can examine by seeing completed and working code.

 Could someone kindly offer a start point?

 thanks
 Mike


 --
 View this message in context:
 http://www.nabble.com/New-To-PHP---Zend-tp20664844p20664844.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] fetching arrays from js in php/zf for checkboxes

2008-11-20 Thread Cameron
At the risk of replying to your email with a one word answer, what you need
is JSON.


On Fri, Nov 21, 2008 at 6:37 AM, cali_dotocm [EMAIL PROTECTED] wrote:


 hi,
 i'm trying to figure out how to pass arrays back and forth from php to
 javascript and back in the zend framework. i need to do this for check
 boxes
 for a project and i canno use zend_form. i came up with a way to do this
 but
 the problem i have is that php cannot read the array string tha i pass to
 it. the javascript i used looks like this:
 [code]var cur=;
var ajaxfields=;
alert(field count:+fields.length);

if (fields.length  0) {

for (var t=0;tfields.length;t++){



 ajaxfields=ajaxfields+escape(fields[t])+=+escape(document.getElementById(fields[t]).checked)+;

}

alert(ajaxfields:+ajaxfields);

var url=/articles/delete-field
var param=c=delete+ajaxfields+sid=+Math.random();
//alert(param);
vpMakePostRequest(url, param, deletedone)
}
 }[/code]

 when i alert the ajaxfields, this is how the string looks like:

 ajaxfields:47=false48=false49=false50=true51=false52=false53=false.

 in th php script, i get the c paramemter using(zend):

 [code]  $this-c = $_POST['c'];
echo $this-c;[/code]
 i echo for debugging purposes and i get delete.
 now the problem is fetching the array string so i gp-could go ahead with
 the
 script.
 NOTE: i couldn't fetch it the same way.

 can anyone help me out


 --
 View this message in context:
 http://www.nabble.com/fetching-arrays-from-js-in-php-zf-for-checkboxes-tp20610507p20610507.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] Passing an array from PHP to Javascript

2008-11-20 Thread Cameron
that's what JSON is for. It's a serialized javascript array, so you simply
serialize the array in javascript, pass it through to your PHP app, and
there are JSON tools in PHP to instantly decode / encode the arrays.
http://www.php.net/json for more info!

On Fri, Nov 21, 2008 at 5:16 AM, cali_dotocm [EMAIL PROTECTED] wrote:


 thanks for the solution, it was quiet helpful. i had the exact same
 problem.
 i just have a little problem though. how qould i the fetch the array of
 values back in php(zend). that has proven to be a problem?
 --
 View this message in context:
 http://www.nabble.com/Passing-an-array-from-PHP-to-Javascript-tp19511848p20609153.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] Passing an array from PHP to Javascript

2008-11-20 Thread Cameron
heh, suck up :P

On Fri, Nov 21, 2008 at 8:35 AM, Ben Scholzen 'DASPRiD' [EMAIL 
PROTECTED]wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Uhm, sorry, the correct answer is Zend_Json ;)
 ...
 :  ___   _   ___ ___ ___ _ ___:
 : |   \ /_\ / __| _ \ _ (_)   \   :
 : | |) / _ \\__ \  _/   / | |) |  :
 : |___/_/:\_\___/_| |_|_\_|___/   :
 :::
 : Web: http://www.dasprids.de :
 : E-mail : [EMAIL PROTECTED]   :
 : Jabber : [EMAIL PROTECTED] :
 : ICQ: 105677955  :
 :::


 Cameron schrieb:
  that's what JSON is for. It's a serialized javascript array, so you
  simply serialize the array in javascript, pass it through to your PHP
  app, and there are JSON tools in PHP to instantly decode / encode the
  arrays. http://www.php.net/json for more info!
 
  On Fri, Nov 21, 2008 at 5:16 AM, cali_dotocm [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
 
  thanks for the solution, it was quiet helpful. i had the exact same
  problem.
  i just have a little problem though. how qould i the fetch the array
 of
  values back in php(zend). that has proven to be a problem?
  --
  View this message in context:
 
 http://www.nabble.com/Passing-an-array-from-PHP-to-Javascript-tp19511848p20609153.html
  Sent from the Zend Framework mailing list archive at Nabble.com.
 
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iEYEARECAAYFAkkl9D4ACgkQ0HfT5Ws789BkLwCgkZnWUtvLmg0JfXr/4AxZLinH
 G2MAoK4JyeLjx3SpspMRBSfY4i9aATwV
 =pIWk
 -END PGP SIGNATURE-



Re: [fw-general] $form-populate and FilteringSelect using Dojo datastore doesn't work, issue tracker won't let me submit bug, nowhere else to turn

2008-11-13 Thread Cameron
I've had a look at the version in the trunk, and it's not going to work for
anyone - maybe I'm crazy, but I've always thought selects were best used as
an id = value pair, so the id matches the id value in your database, so you
don't have to rely on clunky string matching. In the refactored version (and
it's the same in the old version too), we have this:

$items = array();
foreach ($data as $key = $value) {
$items[] = array('label' = $value, 'name' = $value);
}
$data = new Zend_Dojo_Data('name', $items);


Which submits a value = value pair to the drop down. Is it just me, or is
this a bit useless? I'm beginning to think this is the source of all the
problems I'm having with these things, that I'm trying to do this based on
ids rather than strings, but I'd have thought my use case was far more
common!


On Wed, Nov 12, 2008 at 7:30 PM, Matthew Weier O'Phinney
[EMAIL PROTECTED]wrote:

 -- Cameron [EMAIL PROTECTED] wrote
 (on Wednesday, 12 November 2008, 06:51 PM +0900):
  So you don't have to recreate it, the Autocomplete Helper is as follows.
 It's a
  cut and paste of the work some other wonderful gentleman did, and I
 turned off
  the validator because i was lazy.

 BTW, the Zend_Controller_Action_Helper_AutoCompleteDojo was refactored
 in trunk last week to use Zend_Dojo_Data internally, as well as to
 accept Zend_Dojo_Data objects. These changes will be released with
 1.7.0.


  class Zend_Controller_Action_Helper_AutoCompleteDojoNew extends
  Zend_Controller_Action_Helper_AutoComplete_Abstract
  {
  public function validateData($data)
  {
  return true;
  }
 
  public function prepareAutoCompletion($data, $keepLayouts = false) {
  $items = array();
  foreach ($data as $key = $value) {
  $items[] = array('label' = $value, 'name' = $value, 'key'
 =
  $key);
  }
  $final = array(
  'identifier' = 'key',
  'items' = $items,
  );
  return $this-encodeJson($final, $keepLayouts);
  }
  }
 
  On Tue, Nov 11, 2008 at 5:50 PM, Bart McLeod [EMAIL PROTECTED] wrote:
 
  Hi Cameron,
 
  I tried to set up a testsite yesterday evening, but I ran out of time
  (mostly because I did not do much Dojo so far). I will keep looking
 into
  this and file a bug if I can confirm it.
 
  Will use your examples if possible to set it up and confirm the bug.
 
  While you are at it, could you evaluate a patch I provided for the
 dojo
  checkbox? It is Issue ZF-4274, you can download patches there.
 
  Regards,
 
  Bart McLeod
 
  Cameron schreef:
 
  I'm really stumped with this one, it flat out doesn't work in
 anything
  like the way you'd expect / want it to, and I can't find a single
 piece
  of documentation on this anywhere. I'm not even talking about
 dependent
  dropdowns here, all I am trying to do is get $form-populate to
  correctly work in my Edit action when I'm using a FilteringSelect
 that
  uses a store instead of setMultiOptions. Note, this exact same
 form
  works just fine (and submits the ID value correctly) from the New
  action, the ONLY thing that fails is the populate method,
 everything
  else works perfectly.
 
  Let's get in to the code. I've trimmed the unimportant parts.
 
  EDIT ACTION IN THE CONTROLLER:
 
  public function editAction() {
  $form = $this-getForm();
  $id = (int)$this-_request-getParam('id', 0);
  $form-setAction(/$this-_class/edit/id/$id)
   -setMethod('post')
   -setName('editform')
   -setElementsBelongTo('editform');
 
  if ($this-_request-isPost()) {
  //SAVE RECORD
  $formData = $this-_request-getPost();
  $formData['id'] = (int) $id;
  $model = $this-getModel();
  if (true === $model-update($formData)) {
  //SAVE SUCCESS
 
 $this-_redirect(/$this-_class/display/id/$id);
  } else {
  //SAVE FAILURE, RETURN AND EDIT AGAIN
  $form-populate($formData);
  }
  } else {
   //INITIAL LOAD, GET VALUES AND POPULATE
   $model = $this-getModel();
   $job = $model-get($id);
   $form-populate($job);
  }
  $this-view-form = $form;
 
  }
 
  ADDELEMENT METHOD FROM THE FORM CLASS
 
  $this-addElement('FilteringSelect', 'fk_client_id',
 array(
  'label'= 'Client:',
  'store'  = 'clientStore',
  'autoComplete

Re: [fw-general] $form-populate and FilteringSelect using Dojo datastore doesn't work, issue tracker won't let me submit bug, nowhere else to turn

2008-11-12 Thread Cameron
So you don't have to recreate it, the Autocomplete Helper is as follows.
It's a cut and paste of the work some other wonderful gentleman did, and I
turned off the validator because i was lazy.


class Zend_Controller_Action_Helper_AutoCompleteDojoNew extends
Zend_Controller_Action_Helper_AutoComplete_Abstract
{
public function validateData($data)
{
return true;
}

public function prepareAutoCompletion($data, $keepLayouts = false) {
$items = array();
foreach ($data as $key = $value) {
$items[] = array('label' = $value, 'name' = $value, 'key' =
$key);
}
$final = array(
'identifier' = 'key',
'items' = $items,
);
return $this-encodeJson($final, $keepLayouts);
}
}

On Tue, Nov 11, 2008 at 5:50 PM, Bart McLeod [EMAIL PROTECTED] wrote:

  Hi Cameron,

 I tried to set up a testsite yesterday evening, but I ran out of time
 (mostly because I did not do much Dojo so far). I will keep looking into
 this and file a bug if I can confirm it.

 Will use your examples if possible to set it up and confirm the bug.

 While you are at it, could you evaluate a patch I provided for the dojo
 checkbox? It is Issue ZF-4274, you can download patches there.

 Regards,

 Bart McLeod

 Cameron schreef:

 I'm really stumped with this one, it flat out doesn't work in anything like
 the way you'd expect / want it to, and I can't find a single piece of
 documentation on this anywhere. I'm not even talking about dependent
 dropdowns here, all I am trying to do is get $form-populate to correctly
 work in my Edit action when I'm using a FilteringSelect that uses a store
 instead of setMultiOptions. Note, this exact same form works just fine (and
 submits the ID value correctly) from the New action, the ONLY thing that
 fails is the populate method, everything else works perfectly.

 Let's get in to the code. I've trimmed the unimportant parts.

 EDIT ACTION IN THE CONTROLLER:

 public function editAction() {
 $form = $this-getForm();
 $id = (int)$this-_request-getParam('id', 0);
 $form-setAction(/$this-_class/edit/id/$id)
  -setMethod('post')
  -setName('editform')
  -setElementsBelongTo('editform');

 if ($this-_request-isPost()) {
 //SAVE RECORD
 $formData = $this-_request-getPost();
 $formData['id'] = (int) $id;
 $model = $this-getModel();
 if (true === $model-update($formData)) {
 //SAVE SUCCESS
 $this-_redirect(/$this-_class/display/id/$id);
 } else {
 //SAVE FAILURE, RETURN AND EDIT AGAIN
 $form-populate($formData);
 }
 } else {
  //INITIAL LOAD, GET VALUES AND POPULATE
  $model = $this-getModel();
  $job = $model-get($id);
  $form-populate($job);
 }
 $this-view-form = $form;

 }

 ADDELEMENT METHOD FROM THE FORM CLASS

 $this-addElement('FilteringSelect', 'fk_client_id', array(
 'label'= 'Client:',
 'store'  = 'clientStore',
 'autoComplete'   = 'false',
 'hasDownArrow'   = 'true',
 'id' = 'fk_client_id',
 ));

 JAVASCRIPT THAT CREATES THE STORE

 dojo.declare(ClientReadStore, dojox.data.QueryReadStore, {
 fetch:function (request) {
 request.serverQuery = { autocomplete:1, str:request.query.name };
 return this.inherited(fetch, arguments);
 }
 });

 JSON FORMAT THE STORE RETURNS
 (this is a long story, I had to rewrite
 Zend_Controller_Action_Helper_AutoCompleteDojo because it doesn't work, as
 has been noted by others, but the end result is that it now outputs this
 JSON, and it works)

 ({identifier:key,items:[

 {label:,name:,key:1},
 {label:bbb,name:bbb,key:2},
 {label:v,name:v,key:3},
 {label:,name:,key:4},
 {label:ddd,name:ddd,key:5}
 {label:s,name:s,key:7},
 {label:rr,name:rr,key:8},
 {label:,name:,key:9}

 ]})

 EDIT ACTION VIEW SCRIPT

 ? Zend_Dojo_View_Helper_Dojo::setUseDeclarative();?

 div dojoType=ClientReadStore jsId=clientStore
 url=/clients/autocomplete/format/ajax?autocomplete=1str=*
 requestMethod=get/div

 ? echo $this-form; ?


 As you can see, this is all pretty basic stuff, and follows (as far as I
 can piece together) the best practices for doing this sort of thing. Now.
 Here's the debugging information I've managed to coax out so far.

 If you call print_r($this-form-getValues()) in the View script, it returns
 this:

 Array ( [editform] = Array ( [fk_client_id] = 484 [fk_client_contact_id]
 = 459 [position] = CIVIL ENGINEER [quantity] = 1 [start] = ASAP?
 [duration] = 3 - 4 MTHS INIT [rate] = NEG [charge] = [experience] = MPD
 JV. DESIGN EARTHWORKS, DRAINAGE, ROADS

Re: [fw-general] Trouble with on Change in Zend_Form_Element_Select

2008-11-10 Thread Cameron
Simple, really - dropdown lists that change their options depending on other
dropdown lists, but all done through Zend Dojo and using a nice clean MVC
interface. The classic example is Country / State - when you select the
Country from a dropdown, it refreshes the options available in the State
list to match the Country. This sort of functionality is pretty fundamental
stuff, and is really quite simple when you're just knocking it together in
regular ol' PHP/JS.

So far, I have a framework in place that builds these things really quite
cleanly, you can add a new pair of fields (or really as many as you want in
cascade, it should work fine) with 2 dojo divs and a tiny chunk of
Javascript, it just doesn't work when you're editing the row - the populate
method is passing the id value on to the view just fine, but I either need
to find a way to somehow trigger the options list to refresh on page load
(no idea if that will work, and I can't find any Dojo docs describing how to
do it), or, come up with a syntax that lets you pre-populate the dropdowns
while you're still assembling them in the Model. So far it seems that if you
addMultiOptions while there's a Store defined, the MultiOptions are ignored.
So I'm a bit stuck at the moment :/

I'd like to put a good tutorial together for this once it's done too,
because i'm sure a lot of other developers will need this in future, so it
will make fantastic SEO for my development company's blog :P

On Mon, Nov 10, 2008 at 5:18 PM, Bart McLeod [EMAIL PROTECTED] wrote:

  Your problem looks interesting, and I would like to help you, but I am not
 sure if I fully understand what you are trying to achieve.

 Could you provide a full and exact functional description of what you are
 trying to accomplish?

 Bart

 Cameron schreef:

 You are going to have to do this with Javascript. I'm trying to build the
 ultimate example of how you do dependent dropdowns using Zend + Dojo, and
 I've got it so far to the point where it works when adding a new record, but
 when you try to edit data, the $form-populate method fails to build a
 dropdown appropriately when using a Dojo datastore (which is the recommended
 way of doing dependent dropdown menus). So far I've been unable to work it
 out, and a few posts to this mailing list haven't turned anything up yet,
 but if/when I eventually work it out, I'll be building a detailed
 demonstration of how to do it.

 On Sat, Nov 8, 2008 at 12:56 AM, Mantz [EMAIL PROTECTED][EMAIL 
 PROTECTED]wrote:


 Hey everyone

 I am working with ZF 1.6.2 and I'm trying to select something from one
 select element and then enable a second select element.

 I tried it as follows, but there are two problems. First of all go() does
 not know $fach2 and if I try to simply echo a random number it shows this
 one already when loading the page and does not change it when changing the
 select value. Can anyone help me with this? I would rather not try it with
 JavaScript, but if there is no other solution, please post this one, too.
 Thanx!

 function go()
 {
$fach2-disable = true; //does not know $fach2

//echo random number
//srand();
//echo rand();
 }

 public function __construct($options = null)
 {
parent::__construct($options);
$this-setAttrib('enctype', 'multipart/form-data');

$this-setName('upload_form');

$fach = new Zend_Form_Element_Select('fach');
$fach-setLabel(Fach:)
 -setName('fach')
 -setAttrib('id', 'fach')
 -setAttrib('onChange', $this-go());

$fach2 = new Zend_Form_Element_Select('fach2');
$fach2-disable = true;
$fach2-setLabel(Fach2:)
  -setName('fach2')
  -setAttrib('id', 'fach2');

$this-addElements(array($fach, $fach2));
 }

 Would be great if someone could help me. Thanx

 Mantz

 --
 View this message in context:
 http://www.nabble.com/Trouble-with-on-Change-in-Zend_Form_Element_Select-tp20383280p20383280.html
 Sent from the Zend Framework mailing list archive at Nabble.com.



 --
   Bart McLeod
 *Space Web Internet Team*
 Middenlaan 47
 6865 VN Heveadorp
 The Netherlands
 *t* +31(0)26 3392952
 *m* 06 51 51 89 71
 [EMAIL PROTECTED] [EMAIL PROTECTED]
 www.spaceweb.nl  [image: zce logo] [image: zce PHP 5 logo]

 *Bart McLeod is a Zend Certified Engineer.*

 Click to verify! http://www.zend.com/zce.php?c=ZEND004591r=218204904



Re: [fw-general] Trouble with on Change in Zend_Form_Element_Select

2008-11-09 Thread Cameron
You are going to have to do this with Javascript. I'm trying to build the
ultimate example of how you do dependent dropdowns using Zend + Dojo, and
I've got it so far to the point where it works when adding a new record, but
when you try to edit data, the $form-populate method fails to build a
dropdown appropriately when using a Dojo datastore (which is the recommended
way of doing dependent dropdown menus). So far I've been unable to work it
out, and a few posts to this mailing list haven't turned anything up yet,
but if/when I eventually work it out, I'll be building a detailed
demonstration of how to do it.

On Sat, Nov 8, 2008 at 12:56 AM, Mantz [EMAIL PROTECTED] wrote:


 Hey everyone

 I am working with ZF 1.6.2 and I'm trying to select something from one
 select element and then enable a second select element.

 I tried it as follows, but there are two problems. First of all go() does
 not know $fach2 and if I try to simply echo a random number it shows this
 one already when loading the page and does not change it when changing the
 select value. Can anyone help me with this? I would rather not try it with
 JavaScript, but if there is no other solution, please post this one, too.
 Thanx!

 function go()
 {
$fach2-disable = true; //does not know $fach2

//echo random number
//srand();
//echo rand();
 }

 public function __construct($options = null)
 {
parent::__construct($options);
$this-setAttrib('enctype', 'multipart/form-data');

$this-setName('upload_form');

$fach = new Zend_Form_Element_Select('fach');
$fach-setLabel(Fach:)
 -setName('fach')
 -setAttrib('id', 'fach')
 -setAttrib('onChange', $this-go());

$fach2 = new Zend_Form_Element_Select('fach2');
$fach2-disable = true;
$fach2-setLabel(Fach2:)
  -setName('fach2')
  -setAttrib('id', 'fach2');

$this-addElements(array($fach, $fach2));
 }

 Would be great if someone could help me. Thanx

 Mantz

 --
 View this message in context:
 http://www.nabble.com/Trouble-with-on-Change-in-Zend_Form_Element_Select-tp20383280p20383280.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




[fw-general] Zend Form populate method doesn't support FilteringSelect / ComboBoxes using a Dojo datastore.

2008-11-06 Thread Cameron
Hi guys,

I've got some form elements built using Dojo data stores, basically like
this:

$this-addElement('FilteringSelect', 'client_id', array(
'label'= 'Client:',
'store'  = 'clientStore',
'autoComplete'   = 'false',
'hasDownArrow'   = 'true',
'id' = 'client_id',
));

with

div dojoType=ClientReadStore jsId=clientStore
url=/clients/autocomplete/format/ajax
requestMethod=get/div

on the form page. But when I call $form-populate in the edit controller, it
is populating the value correctly (as confirmed by
print_r($this-form-getValues()) in the edit view), but the select isn't
displaying anything.

I'm assuming this is happening because the options aren't being generated
until after the first attempt to type something in to the select or click on
the down arrow, so I've tried adding an extra default option to fill out the
drop down while it's waiting for someone to click on something by going:

$form-getElement('client_id')-addMultiOption($id, $value);

in the controller, but it's no go. Doesn't work. The only other idea I've
got is somehow triggering the form to fill the dropdown list with JS when it
first loads, but I haven't found any documentation on such features, so I'm
basically shooting in the dark with it. So has anyone else solved this
issue? Or am I doing something wrong / missing the obvious?


Re: [fw-general] Zend_Db_Table_Rowset seek() question

2008-11-06 Thread Cameron
I built something like this as a paginator for when you're on your item
view. What I did was build a simple class that implements the SPL Iterator
and Countable classes, just like the internal Zend_Paginator, but just uses
an array as its internal guts. Then I simply grabbed all the id fields from
my table and passed it as an array through to my paginator class'
constructor, and then called the setCurrentItem method to correctly position
the pointer in array. I have no idea if something like this helps you at
all, but it seemed a pretty clean way of solving my particular problem,
which was getting a next and previous button on my record display.
Here's the class anyway, if it helps.

class ItemPaginator implements Countable, Iterator
{
protected $collection;
protected $count;
protected $pointer_position;

public function __construct( $collection ) {
  $this-collection = $collection;
  $this-count = sizeof($this-collection);
}

public function count() {
return $this-count;
}

public function key() {
  return $this-pointer_position;
}

public function current() {
  return $this-collection[$this-pointer_position];
}

public function next() {
  $this-pointer_position++;
}

public function rewind() {
  $this-pointer_position = 0;
}

public function valid() {
  return strlen( $this-collection )  $this-pointer_position;
}

public function getNextItem() {
if ($this-pointer_position  $this-count) {
return $this-collection[$this-pointer_position + 1];
}
return false;
}

public function getPrevItem() {
if ($this-pointer_position  0 ) {
return $this-collection[$this-pointer_position - 1];
}
return false;
}

public function getFirstItem() {
if ($this-pointer_position  0 ) {
return $this-collection[0];
}
return false;
}

public function getLastItem() {
if ($this-pointer_position  $this-count ) {
return $this-collection[$this-count - 1]; // -1 for the array
offset
}
return false;
}

public function setCurrentItem($item) {
$key = array_search($item, $this-collection);
if (FALSE !== $key) {
$this-pointer_position = $key;
return true;
}
return false;
}
}


Sorry if this is really terrible code that I should be implementing
completely differently, the SPL is all a bit new to me :)



On Fri, Nov 7, 2008 at 1:17 AM, Jason Austin [EMAIL PROTECTED] wrote:

 I have a need to paginate some simple results, which I need the count of
 the entire rowset, and then rows from a particular offset.  I don't really
 want to execute 2 queries, so I was thinking of using the seek() method of
 my result set to put the pointer to the required offset, however when I loop
 through the results it starts over at the beginning of the result set:

 ?php

 $rows = $model-fetchAll($where, $order);

 $rows-seek($page * $resultsPerPage);

 echo $rows-current()-id  // echoes correct seek() offset ID

 foreach ($rows as $r) {  // starts over at the beginning of the rowset
   // add to result set
 }

 ?

 Is this the expected behavior or am I missing something totally obvious?
  This is with version 1.6.1.  Should I just do 2 queries (a query to get
 the required rows, then a count query without qualifier)?

 Thanks!
 Jason

 --
 Jason Austin
 Senior Solutions Implementation Engineer
 NC State University - Office of Information Technology
 http://webapps.ncsu.edu
 919.513-4372




Re: [fw-general] JSON format for ComboBox / FilteringSelect

2008-11-04 Thread Cameron
Thanks for that, I've managed to get it working now with the rewritten
autoCompleteDojo at
http://www.makina-corpus.org/2008/10/26/autocomplete-ajax-search-with-dojo-and-zend-framework/,
and I've got dropdown dependencies working with a bit of javascript, but now
I have one last little problem!

It works perfectly on the New form, but when you try to $form-populate in
your Edit controller, the autocomplete fields aren't filled in on the form
for editing. How has everyone else solved this one?

On Mon, Nov 3, 2008 at 9:15 PM, lupusBE [EMAIL PROTECTED] wrote:


 http://framework.zend.com/issues/browse/ZF-4494


 Themselves wrote:
 
  Hi guys,
 
  I'm trying to build some autocomplete dropdowns using Zend + Dojo, but I
  can't seem to work out how to get the select to submit the id and display
  the name. As per the documentation, a ComboBox submits the value of the
  label, so I've tried passing through JSON like this:
 
  {identifier:label,items:[
  {label:1,name:aaa},
  {label:435,name:bb},
  {label:209,name:ccc},
  {label:3,name:d},
  {label:2,name:e}
  ]}
 
  Which displays the correct name in the drop down, but when you submit the
  form, it submits the name, not the contents of the label field. What is
  the
  correct JSON format for my autoComplete action helper to return to get
  this
  to work correctly? And once I have got this working correctly, I'm going
  to
  need to access the label value through javascript - Can I assume I'll be
  able to get it via comboBox.label in much the same way as I can get
  comboBox.value now?
 
 

 --
 View this message in context:
 http://www.nabble.com/JSON-format-for-ComboBox---FilteringSelect-tp20295920p20301734.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




[fw-general] Item paginators + Dojo Grids

2008-11-03 Thread Cameron
Hi again,

I'm trying to put together simple item paginators (ala the
http://framework.zend.com/manual/en/zend.paginator.usage.html example), and
I'm just wondering what the best practice for something like this is when
used with the Dojo grid. The Dojo grid takes care of the search pagination,
so all we really need after that is item pagination, but it seems to be a
pretty manual job to get that working in this context.

Basically, the best way I've come up with so far to do this is as follows:

1. user browses the grid / conducts a search on the grid, which triggers the
controller's list action
2. list action instances the model, the model hits the db, and retrieves the
rows for the grid.
3. the model instances the paginator and stores it in a session
4. the user eventually selects a row from the grid, which triggers the
display action
5. display action checks the session, and passes the last stored session
paginator on to the view for displaying

There's a couple of obvious problems, the main one being searches will get
clobbered if the user conducts more than one at once, which can be avoided
by a token in the URL or something, but even if you solve that, there's
still some PHP-type problems, and I haven't really got a clean way around
them yet.

Basically, it seems cleanest to just instance the paginator in the model,
because the $select is right there, you've applied all your criteria to it,
it's perfect to pass on to the paginator factory right there and then,
except... it doesn't work. You can't serialize a PDO object, so you can't
keep the thing around long enough to get it in to a view. Well, using
sessions at least.

So far I've worked on using Zend_Paginator_Adaptor_Null and controlling it
all manually with URL variables, which is possible, but it sounds pretty
clunky, and really doesn't sound like what I'd call a best practice for
this. DbSelect is out and Array probably won't help things much. So has
anyone done this / got any good ideas? What would be beautiful if we could
simplify item paginators down to as simple as they are with search
paginators, something like $this-view-paginator =
Zend_Paginator::factory($select);.


[fw-general] JSON format for ComboBox / FilteringSelect

2008-11-02 Thread Cameron
Hi guys,

I'm trying to build some autocomplete dropdowns using Zend + Dojo, but I
can't seem to work out how to get the select to submit the id and display
the name. As per the documentation, a ComboBox submits the value of the
label, so I've tried passing through JSON like this:

{identifier:label,items:[
{label:1,name:aaa},
{label:435,name:bb},
{label:209,name:ccc},
{label:3,name:d},
{label:2,name:e}
]}

Which displays the correct name in the drop down, but when you submit the
form, it submits the name, not the contents of the label field. What is the
correct JSON format for my autoComplete action helper to return to get this
to work correctly? And once I have got this working correctly, I'm going to
need to access the label value through javascript - Can I assume I'll be
able to get it via comboBox.label in much the same way as I can get
comboBox.value now?


Re: [fw-general] Developing for Zend Framework in Zend Studio for Eclipse

2008-11-02 Thread Cameron
This is a very common issue with Eclipse, it dies in the arse with large
projects. The building workspace thing has cost me a handful of days in
lost productivity. I don't know any solutions, other than try to keep the
projects on your local machine (trying to work on a large project via ftp
mount or whatever is a guaranteed failure). Sorry I'm not much help here,
other than to let you know you're not alone. Actually, something that might
help (if it's even possible) is turning off the way it parses the entire
project during that build process to find warnings - that seems to take
forever.

On Mon, Nov 3, 2008 at 9:49 AM, Bradley Holt [EMAIL PROTECTED]wrote:

 Has anyone successfully used Zend Studio for Eclipse to develop for Zend
 Framework (I'm talking about developing Zend Framework itself, not web
 applications based on ZF)? I'm trying to use it to write some sample code
 for a proposed Zend Framework component and it is very slow and now has
 stopped for 30+ minutes (and still counting) to build my workspace blocking
 me from working. I'm wondering if I'm the only one experience these
 problems. If so, I'll pursue this in the appropriate support channels. I
 know Zend Framework is a big project, but I would think Zend Studio for
 Eclipse could handle it. I'm on a Windows XP Pro box with a 2.00 GHz
 processor and 2 GB of RAM. Do most Zend Framework developers use a different
 tool when writing their Zend Framework code? I know of at least one ZF
 developer who is a vi user ;-)

 Thanks,
 Bradley

 --
 Bradley Holt
 [EMAIL PROTECTED]




[fw-general] AJAX enabling of Zend + Dojo forms, and populating Select dependencies in an MVC environment, e.g. Country / State selects

2008-10-28 Thread Cameron
Phew. Big title.

I'm currently building a large scale application in Zend + Dojo, and with it
being so new, I'm assuming I'm one of the first to attempt such undertaking.
I have built it using Matthew Weier O'Phinney's Pastebox
apphttp://weierophinney.net/matthew/archives/189-Pastebin-app-and-conference-updates.htmlas
an example of the underlying MVC, and extended it to support accordian
navigation, a heavily tabbed interface, JS onLoad for lazy-loaded content
(it's all about WHERE you load it), XHR posts, extensive use of dojox grids
(with AJAX search), it is a pretty full scale application so far, and it's
all built in a very clean MVC fashion which I'm quite proud of. Now though,
I'm up to one of the final stumbling blocks, and that is trying to AJAX up
drop down selects built using Zend_Dojo_Form where there are dependencies,
i.e., a select needs to be filled appropriately depending on the value of a
parent select - a classic example being a Country select that changes the
State select options.

It is very simple indeed to add AJAX options to a single select, simply by
giving the ComboBox / FilteringSelect a dojox data store and a searchAttr
(although I can't see how to have an id = value pair, the form only submits
values so far...), however, I can't find any examples on the Internet of
people building dependent select boxes in Zend + Dojo.

There's also a possible issue with the $form-populate method, meaning when
we call the edit action in our controller, if too much of the logic that
controls the multiple select boxes is client side, the populate method is
going to act pretty weirdly.

Has anyone managed to build something like this yet? I know the Zend + Dojo
combination is very new, and therefore not many examples of code are out
there yet, but this sort of functionality is pretty fundamental for modern
applications. What I'd like to do is solve this problem in a really clean,
standard Zend MVC way once and for all, and post the results on the
Interwebs for everyone to use.

As a starting point, I guess I should outline a list of ideal qualities in
such a solution:


   - Uses basic Zend MVC layout, i.e. actions in a controller, separate form
   in the model
   - Form is built primarily in Zend_Dojo_Form and can use Dijit controls
   - The options in the select submit the id of the record, not the display
   value.
   - in the edit action of your controller, the $form-populate method
   functions correctly.
   - Ideally the data sources for the selects is a dojox.data.QueryReadStore
   that reads from a URL in the MVC structure that returns JSON (i.e. 'url' =
   '/clients/list-data/format/ajax'), this actually works by default in
   
Pasteboxhttp://weierophinney.net/matthew/archives/189-Pastebin-app-and-conference-updates.html
   - The Javascript for controlling the form's onChange is able to be
   included in a single script type=dojo/connect event=onLoad


That last part is important, as the advanced interfaces it's possible to
build with Dijit layout tools are capable of XHR loading page content as
they're going, meaning we have to be able to load the JS up front and not
embed it on the form we're pulling in.

If anyone is working on similar functionality or wants to contact me
off-list to help build a demonstration version to, my email address is
themselves at gmail dot com. Sorry for such a long post!


Re: [fw-general] ZF and Autoloading

2007-01-09 Thread Cameron Brunner

These are tests that were done for Propel, note that propel has now
gone to requiring spl_autoload because of these results.

this is using eaccel as apc was crashing for him, php 5.0.4, october 4th

(02:38:26)  let's see if it crashes my apache like APC does
(02:38:35)  nope!
(02:38:41)  shit
(02:38:44)  it's like 3x faster
(02:39:09)  even w/o doing a huge list of require's
(02:39:11)  lemme test
(02:41:03)  ok
(02:41:06)  so with eacc
(02:41:26)  .25 req/sec with no accelerator (with or w/o require list)
(02:41:30)  with eacc
(02:41:39)  .55 req/sec w/autoload
(02:41:45)  .49 w/ list of requires

the list of requires was literally just a list of
require('filea');
require('fileb');
etc at the top of the script. Yes, require, not require_once. No i
dont have how many files it was including here in my logs however
propel includes a lot of files so it should be a reasonable
comparison.

Can we please finally come to a conclusion on this subject? Test for
yourself or use these as a reference but PLEASE stop this FUD
surrounding autoload!


Cameron


Re: [fw-general] ZF and Autoloading

2007-01-09 Thread Cameron Brunner

I disagree with it not making sense, if there are less objects in
memory when you are trying to initialize the next required object the
engine will be able to find it quicker. Seems to be the case at least.
These results were ran multiple times and got the same numbers. The
only files required were those that were going to be needed for it to
run the script.


Cameron

On 1/10/07, Richard Thomas [EMAIL PROTECTED] wrote:

That doesn't even make common sense, autoload will never be faster
then straight require if the exact same number of files are called
each time, there is less overhead.

The only way for them to get the below results would of been to
include every file in propel straight out even if it wasn't used which
is just stupid.

File per file autoload is slower, If you know a file is going to be
needed without question you will get better performance if you require
it.

The best solution is to find a middle ground, what files get called
50%+ of the time in your application and preload those, let the rest
be autoloaded.

This would give you the best of both worlds, performance and flexability.

On 1/9/07, Cameron Brunner [EMAIL PROTECTED] wrote:
 These are tests that were done for Propel, note that propel has now
 gone to requiring spl_autoload because of these results.

 this is using eaccel as apc was crashing for him, php 5.0.4, october 4th

 (02:38:26)  let's see if it crashes my apache like APC does
 (02:38:35)  nope!
 (02:38:41)  shit
 (02:38:44)  it's like 3x faster
 (02:39:09)  even w/o doing a huge list of require's
 (02:39:11)  lemme test
 (02:41:03)  ok
 (02:41:06)  so with eacc
 (02:41:26)  .25 req/sec with no accelerator (with or w/o require list)
 (02:41:30)  with eacc
 (02:41:39)  .55 req/sec w/autoload
 (02:41:45)  .49 w/ list of requires

 the list of requires was literally just a list of
 require('filea');
 require('fileb');
 etc at the top of the script. Yes, require, not require_once. No i
 dont have how many files it was including here in my logs however
 propel includes a lot of files so it should be a reasonable
 comparison.

 Can we please finally come to a conclusion on this subject? Test for
 yourself or use these as a reference but PLEASE stop this FUD
 surrounding autoload!


 Cameron