Re: [fw-general] On checkbox checked event

2007-08-13 Thread Dillon Woods
On 8/13/07, Rohit83 <[EMAIL PROTECTED]> wrote:
>
>
> Hi All,
>  I have one query,suppose i am supposed to display a page on which
> their is one checkbox.If i checked the checkbox the textbox below it will
> be
> vanished.


This is really more of a javascript question than a Zend Framework
question.  I recommend checking out the Prototype Javascript Framework (
http://prototypejs.org/) for handling client side events like checking a
checkbox.   The one part of the Zend Framework you might want to use is
Zend_Json, but that would only be applicable if you wanted to send responses
from the server back to the client on every mouse click.

Dillon


Re: [fw-general] Zend_Db_Table Relationships Delete/Update

2007-07-24 Thread Dillon Woods

On 7/24/07, Jack Sleight <[EMAIL PROTECTED]> wrote:


Hi,
I'm using the database to manage delete and update actions in related
tables, so do I need to tell Zend_Db_Table not to try to emulate these
for me? And if so, how?



Do you mean that you have cascading UPDATE and DELETE rules set up on the
dependent tables in your database?  If your RDBMS supports it, it is
considered a best practice to do what you are doing.  Unless you
specifically declare onUpdate and onDelete variables in your $_referenceMap,
then Zend_Db_Table will not emulate them.  For more information see
http://framework.zend.com/manual/en/zend.db.table.relationships.html#zend.db.table.relationships.cascadingin
the framework documentation.

Dillon


Re: [fw-general] Installing ZF on already existing site

2007-07-24 Thread Dillon Woods

On 7/24/07, Lekan <[EMAIL PROTECTED]> wrote:


Can anyone tell me how to go about installing ZF on
an already existing site?



To start using ZF in an existing application you need to first copy ZF into
a directory, probably '/library', then add the library directory to your
include path if it isn't already, see
http://us2.php.net/set_include_pathfor more info.  After that, you
will probably want to include the
Zend_Loader by doing something like this, but it isn't necessary:
require "Zend/Loader.php";

At that point, ZF is "installed" and you can start loading the ZF classes
and using them wherever you want, for instance:
Zend_Loader::loadClass( 'Zend_Session' );
Zend_Session:start();

Dillon


Re: [fw-general] print a value from another table (Zend_Db)

2007-07-19 Thread Dillon Woods

On 7/19/07, José de Menezes Soares Neto <[EMAIL PROTECTED]> wrote:


i have two tables:

tb_employees (id, emp_name, fk_sector)
tb_sectors (id, sec_name)

I need to make a sql query in the tb_employees, and then, print emp_name
and sec_name...
But I don't know how to retrieve this using Zend_DB



What you are looking to do is outlined in the framework documentation at
http://framework.zend.com/manual/en/zend.db.table.relationships.html.
Basically, you need to declare tb_sectors a dependent table of
tb_employees.  After that, you just need to find the tb_employees record
normally:

$employee = $table->find( 1 );

Then, you will be able to get the tb_sectors record associated with the
employee like so:

$sector = $employee->findDependentRowset( 'Tb_sectors' );
echo $employee->emp_name;
echo $sector->sec_name;

Dillon


Re: [fw-general] Apply ajax in Zend Framework

2007-07-19 Thread Dillon Woods

On 7/18/07, minglee <[EMAIL PROTECTED]> wrote:


However, when printing xmlHttp.responseText, it displayed content of my
another application's xmlHttp.responseText.
I think there must be something wrong with cache, but how should I do with
the zend framework's cache  in this case?



Are you using Zend_Cache inside your registerAction?  If not, then I suspect
the problem is with your javascript and not with the Zend Framework.  Do you
have an online example of the problem we could look at?  I recommend using
the Prototype javascript library (http://prototypejs.org/) for making your
Ajax requests, it will take care of a lot of common javascript issues for
you.  You might also want to get the Firebug extension for Firefox (
http://www.getfirebug.com/), it will show you exactly what is being returned
to the browser from the server so you will easily be able to determine where
the problem is.

Dillon
www.dewoods.com


Re: [fw-general] Apply ajax in Zend Framework

2007-07-18 Thread Dillon Woods

On 7/17/07, minglee <[EMAIL PROTECTED]> wrote:


1. Because ZF is using rewrite, how should I call the server-side action,
for example:
If I want to call registerAction in
/topath/application/controllers/visitor.php, can I call like
"/visitor/register"-- my .js file is in /topath/public/script/?



Yes, that will work fine.  Your javascript function can send the
XMLHttpRequest to any valid URL that you can access with a web browser.

2. After handle the HttpRequest in visitor.php, how shall I output HTTP

response, shall I use something $view->render() or just "echo $response;"
?



I have a small writeup at http://dewoods.com/blog/view/id/3 showing how I
use Zend_Json to return a response to an AJAX request.  If you just want the
output of a view to be returned, then you don't have to do anything because
the new viewRenderer helper will automatically do the equivalent of calling
$view->render() for you.

Dillon


[fw-general] Zend_Mail mime encoding

2007-02-13 Thread Dillon Woods

In Zend_Mail the setBodyText() and setBodyHtml() functions both create a
protected Zend_Mime_Part object and automatically set the encoding to
Zend_Mime::ENCODING_QUOTEDPRINTABLE.  I have a situation where I would like
to send an email with the encoding Zend_Mime::ENCODING_7BIT, but there is
not an exposed way to edit that property.

Would the group in charge of Zend_Mail consider changing the function so
that the encoding could be passed in a third parameter, or is there a better
way to do it?

public function setBodyText($txt, $charset=null, $encoding=null)
{
  if ($charset === null) {
 $charset = $this->_charset;
  }
  if ($encoding === null) {
 $encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE;
  }
  $mp = new Zend_Mime_Part($txt);
  $mp->encoding = $encoding;
  $mp->type = Zend_Mime::TYPE_TEXT;
  $mp->disposition = Zend_Mime::DISPOSITION_INLINE;
  $mp->charset = $charset;

   $this->_bodyText = $mp;
   return $mp;
}

Dillon


[fw-general] Zend_Measure bug

2007-01-24 Thread Dillon Woods

In Zend_Measure the following code which begins on line 130 does not work as
intended:

if (strpos($type, '::') !== false) {
   $type = substr($type, 0, strpos($type, '::'));
   $sublib  = substr($type, strpos($type, '::') + 2);
}

If your type is something like 'BINARY::KILOBYTE' for example, the expected
output would be:
$type = 'BINARY'
$sublib = 'KILOBYTE'

However, the current code gives you
$type = 'BINARY'
$sublib = 'NARY'

because '::KILOBYTE' is removed from $type when it is assigned to the output
from the initial substr() function call.

Dillon


Re: [fw-general] Zend Framework on DreamHost

2007-01-17 Thread Dillon Woods

On 1/10/07, Elisamuel Resto <[EMAIL PROTECTED]> wrote:


   Anybody has actually gotten the Framework working on a DreamHost
account? I'm hitting the ground hard with mod_rewrite looping with every
ruleset I've tried, even ones I had that had worked before, and ones that
were on the manuals and tutorials.



I've got it working on my DreamHost account without a problem.  My .htaccess
file simply has:
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php

In the DreamHost Control Panel, you can choose which version of PHP you want
to use, is yours set to a version less than 5 perhaps?

Dillon


Re: [fw-general] xmlRpc Server authentication

2007-01-17 Thread Dillon Woods

On 1/17/07, andrey <[EMAIL PROTECTED]> wrote:


I wonder how to implement xmlRpc Server authentication for a client?

Does the framework comes with something easy?
Or should I use a token returned from a login() method in every other
session resquest?



One way to do it is to use HTTP Basic Authentication on the server and then
set the credentials in the Zend_Http_Client used to make the XmlRpc
requests:

$http = new Zend_Http_Client();

$http->setAuth( 'username', 'password' );
$client = new Zend_XmlRpc_Client( $url, $http );
$client->setHttpClient( $http );



Is that what you were looking for?

Dillon


[fw-general] Zend_Db_Table lastInsertId question

2006-12-11 Thread Dillon Woods

The Zend_Db_Table insert function attempts to return the value from the PDO
driver's lastInsertId function which is called in the following way:


return $this->_connection->lastInsertId($tableName .'_'. $primaryKey
.'_seq');



It is very handy to have the id of the inserted row automatically returned,
but if a sequence with that specific name does not exist, than the insert()
call will fail.  The names of my existing sequences take the from
'table_seq' instead of 'table_id_seq', so new rows are inserted into the
table correctly, but the insert() call never returns because lastInsertId()
fails.  Has there been any thought given to adding a protected $_sequence
variable to the Zend_Db_Table class that could default to 'table_id_seq',
but could be overridden by a class extending Zend_Db_Table similar to the
way $_name can?  Is there any other way I can make this work without
changing the name of my sequences?

Thank you,
Dillon