[fw-general] ZF based Bulletin Board software?

2008-09-26 Thread Drew Bertola
Anyone know of a good bulletin board built on ZF (best if it could be a 
single module).


Thanks,

--
Drew Bertola

-
*   PHP/LAMP Consultant, ZCE-1000   *
*   *
*   Tel: 408-966-6671   *
*   *
*   current resume: *
*   http://drewb.com/blog/about/resume/ *
-



Re: [fw-general] Zend_Acl_Assert_Interface Usage

2008-09-26 Thread Martijn Korse

Hi valugi


Let's review your code first


You're using Zend_Registy in your example, but i'm not sure why. I think
you're confusing it with the Role-Registry? Zend_Registry is a different
thing and not part of Zend_Acl.

Also, you forget to instantiate proper roles and resources (through
Zend_Acl_Role and Zend_Acl_Resource).


I've rewritten your example:



class My_Acl_Assert_Test implements Zend_Acl_Assert_Interface
{
public function __construct($test)
{
$this-test= $test;
}
   
public function assert(Zend_Acl $acl,
   Zend_Acl_Role_Interface $role = null,
   Zend_Acl_Resource_Interface $resource = null,
   $privilege = null)
{
return $this-_test();
}

protected function _test()
{
  return $this-test;
}
}

//controller code
$acl = new Zend_Acl();
$acl-addRole(new Zend_Acl_Role('client'));
$acl-add(new Zend_Acl_Resource('resource'));
$bool = $acl-isAllowed('client', 'resource');
var_dump($bool);
$assertRule = new My_Acl_Assert_Test( false );

// new rules
$acl-allow('client', 'resource', null , $assertRule );
$bool = $acl-isAllowed('client', 'resource' );
var_dump($bool);


This outputs the boolean 'false' twice, as expected.


In case you're still unsure how assertions work: you should see them as a
dependency on the rule. If the assertion returns false it means acl should
ignore the rule. It will then then look if it can find another rule through
inheritance and if no such rule can be found it will return the default
'false'

i hope that clears things up for you


-
http://devshed.excudo.net http://devshed.excudo.net 
-- 
View this message in context: 
http://www.nabble.com/Zend_Acl_Assert_Interface-Usage-tp19668142p19683552.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Zend_Acl_Assert_Interface Usage

2008-09-26 Thread valugi

Hi and thanks for replying
It's not an error that I've used the registry. I have an already constructed
ACL object there. 

Your example is identical with mine only that you construct the ACL in place
and I get it from a class. But in my case the second return is true which
is very wrong.

Also my object is more complex in terms of resources and roles both with
inheritace levels.
I read something about assertions breaking when inheritance is used and I
think this could be the real problem. Because otherwise I did understand the
mechanisms of Assertions.
http://framework.zend.com/issues/browse/ZF-1722
http://framework.zend.com/issues/browse/ZF-1722 





Martijn Korse wrote:
 
 Hi valugibr
 br
 Let's review your code firstbr
 br
 You're using Zend_Registy in your example, but i'm not sure why. I think
 you're confusing it with the Role-Registry? Zend_Registry is a different
 thing and not part of Zend_Acl.br
 Also, you forget to instantiate proper roles and resources (through
 Zend_Acl_Role and Zend_Acl_Resource).br
 br
 I've rewritten your example:br
 br
 pre
 class My_Acl_Assert_Test implements Zend_Acl_Assert_Interface
 {
 public function __construct($test)
 {
 $this-test= $test;
 }

 public function assert(Zend_Acl $acl,
Zend_Acl_Role_Interface $role = null,
Zend_Acl_Resource_Interface $resource = null,
$privilege = null)
 {
 return $this-_test();
 }
 
 protected function _test()
 {
   return $this-test;
 }
 }
 
 //controller code
 $acl = new Zend_Acl();
 $acl-addRole(new Zend_Acl_Role('client'));
 $acl-add(new Zend_Acl_Resource('resource'));
 $bool = $acl-isAllowed('client', 'resource');
 var_dump($bool);
 $assertRule = new My_Acl_Assert_Test( false );
 
 // new rules
 $acl-allow('client', 'resource', null , $assertRule );
 $bool = $acl-isAllowed('client', 'resource' );
 var_dump($bool);
 /pre
 br
 This outputs the boolean 'false' twice, as expected.br
 br
 In case you're still unsure how assertions work: you should see them as a
 dependency on the rule. If the assertion returns false it means acl should
 ignore the rule. It will then then look if it can find another rule
 through inheritance and if no such rule can be found it will return the
 default 'false'
 br
 i hope that clears things up for you

-- 
View this message in context: 
http://www.nabble.com/Zend_Acl_Assert_Interface-Usage-tp19668142p19684326.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Re: Using ACL asserts to validate access to specific instances of a generic resource

2008-09-26 Thread Colin Guthrie

Martijn Korse wrote:

I'm not sure what you mean with part the the validation... you mean that
every article is tied to to a certain group of users?

In that case i think the way to go would be to assign roles to these users
and then loop through this data, setting an allow rule for each combination
or role and resource. You don't even need assertions for that.


To explain a bit better

Say you have a simple news system with a million articles written by a 
million different users. You want the authors to be able to edit their 
own article.


To do this via individual roles is definitely not scalable and the 
assertions seem like an ideal way of achieving this (and indeed such a 
use case is given as an example use of assertions in the webinars/docs).


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/]



[fw-general] Re: Using ACL asserts to validate access to specific instances of a generic resource

2008-09-26 Thread Colin Guthrie

Hi,

Aldemar Bernal wrote:
http://devzone.zend.com/article/3509-Zend_Acl-and-MVC-Integration-Part-I-Basic-Use 
http://devzone.zend.com/article/3510-Zend_Acl-and-MVC-Integration-Part-II-Advanced-Use 


Yeah these articles were useful when I read them earlier.

The most useful bit is at the end of the second link where you do the 
kind of check I'm interested in, but it is done very much in the 
controller rather than the acl itself.


I appreciate that I'm being quite pedantic here, but I'd rather have the 
controller set some sort of data on the resource object itself and have 
this checked in an assertion in the ACL (the semantics are very similar, 
just a slight architectural difference). In my previous example I 
suggested a static method but really you'd probably want to piggy back a 
resource implementation onto some other object (see below for my example).


Why do I want to do it this way?

Well I want to be able to define roles dynamically. In my app I have a 
way to list all the resources available and for each resource, what 
privileges and assertions apply to them.


This way a role can be defined very specifically and tailored to 
individual needs. By putting the test itself in the controller I cannot 
have this degree of control. If the controller sets a value on the 
resource and it is up to the assert() method to do the test, the 
flexibility is maintained (e.g. if the current user's ACL has or does 
not have the assert applied to it).




To elaborate: In your example you have:

public function editAction()
{
/** Load article by id */
$article = new Article($this-_request-id);

/** Validate if the user is the owner or an Admin */
if (($article-author != $this-_application-loggedUser)  
($this-_application-currentRole != 'admin')) {

$this-_acl-denyAccess();
}

...
}


Here the action itself has special knowledge of how your ACL operates 
and imeplements ACL features manually (the allowing of admins to access 
all articles). But I would propose something a little bit different but 
which leveraged the power of the ACL system and use and assert.


The assert would be something like:


class My_Article_Access
  implements Zend_Acl_Assert_Interface
{
  public function assert(
Zend_Acl $acl,
Zend_Acl_Role_Interface $role = null,
Zend_Acl_Resource $resource = null,
$privilege = null)
  {
/** This assert requires that $resource is and Article object.
  * We cannot do this in the argument definition as it would no
  * longer match the interface.
  * Obviously article implements Zend_Acl_Resource_Interface */
if (!($resource instanceof Article))
  return false; // or throw

$app = new Zend_Session_Namespace('myApplication');

return ($app-loggedUser == $resource-author);
  }
}



and the editAction becomes something like:
(NB, I've assumed the Zend_Acl object is available via 
$this-_application-acl)



public function editAction()
{
/** Load article by id */
$article = new Article($this-_request-id);

/** NB Article also implements Zend_Acl_Resource
  * and obviously knows it's own id  */

/** Inject the article ID into the resource */
if (!$this-_application-acl-isAllowed(
  $this-_application-currentRole,
  $article,
  'edit'))
{
  $this-_acl-denyAccess();
}

...
}



I think this is a better approach than in your example as it means that 
the knowledge of the role and what it means is kept out of your 
controller and action logic. It's kept inside the ACL system which is 
where IMO it belongs.



What do you think?

Col (who hopes he's explained it well enough!)



--

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] Re: Using ACL asserts to validate access to specific instances of a generic resource

2008-09-26 Thread Colin Guthrie

Jaka Jančar wrote:
For that news system, I would just store the author of the article with 
the article (which you normally already do) and then create two nested 
resources:


- articles
   `- own_articles

And then allow edit privilege to either articles, own_articles or neither.


While I agree this would work, I can't help but feel it's a little 
contrived in that the structure of resources has been moulded to fit in 
with your access restriction and not really designed in.


How about a more complex structure as follows:

Articles also have categories assigned to them. There exists a role of 
article category manager who is allowed to edit all articles in their 
category regardless of author. In this scenrio this approach would break 
down.


I think I am actually very happy with my original suggestion albeit it 
was a little contrived to keep the Resources as individual objects in 
their own right and used static values to get round a problem. In actual 
fact Resources should not just be individual objects, but they should 
really be the objects in their own right that also implement 
Zend_Acl_Resource_Interface.


My Article object should implement Zend_Acl_Resource_Interface and using 
an assert to handle the restrictions is very much the right 
architectural approach here.


I'm happy :)

Thanks for the help. Hopefully my thinking out loud and discussions has 
helped other people think about this a little too :)


See my reply to Aldemar Bernal for more examples.

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/]



[fw-general] Re: Using ACL asserts to validate access to specific instances of a generic resource

2008-09-26 Thread Colin Guthrie

Colin Guthrie wrote:

class My_Article_Access
  implements Zend_Acl_Assert_Interface
{
  public function assert(
Zend_Acl $acl,
Zend_Acl_Role_Interface $role = null,
Zend_Acl_Resource $resource = null,
$privilege = null)
  {


Sorry, typo'ed. That should be:

  Zend_Acl_Resource_Interface $resource = null
   ^^
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] Using ACL asserts to validate access to specific instances of a generic resource

2008-09-26 Thread Martijn Korse

I think your articles should implement the Resource_Interface and your users
should implement the Role_Interface. The article/resource will have
knowlnedge about who its creator is and since both objects are passed to the
assertion you could then simple do something like:

if ($article-ownerId == $role-userId) { echo this is allowed; }

It's more or less what you proposed earlier, but without the need for static
variables.
And if a resource/article has also knowledge about the category it's in you
could also decide that it requests the owner-id of the category and use
that.

-
http://devshed.excudo.net http://devshed.excudo.net 
-- 
View this message in context: 
http://www.nabble.com/Using-ACL-asserts-to-validate-access-to-specific-instances-of-a-generic-resource-tp19678452p19686252.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Acl_Assert_Interface Usage

2008-09-26 Thread Martijn Korse


valugi wrote:
 
 Your example is identical with mine only that you construct the ACL in
 place and I get it from a class. But in my case the second return is
 true which is very wrong.
 
 Also my object is more complex in terms of resources and roles both with
 inheritace levels.
 I read something about assertions breaking when inheritance is used and I
 think this could be the real problem. Because otherwise I did understand
 the mechanisms of Assertions.
  http://framework.zend.com/issues/browse/ZF-1722
 http://framework.zend.com/issues/browse/ZF-1722 
 
 

Given the fact that ACL will return false by default, the fact that you get
an unexpected True means that some form of inheritance ís working. Your
assertion works, it ignores the rule, but then - by means of inheritance (of
either the role or the resource) - it bumps into another rule that says:
'allow'

But, for me it is impossible to disect it for you with only a small example
that doesn't show all the influences.

You should try to find out (by outputting some variables) which allow-rule
is causing the 'true'

-
http://devshed.excudo.net http://devshed.excudo.net 
-- 
View this message in context: 
http://www.nabble.com/Zend_Acl_Assert_Interface-Usage-tp19668142p19686501.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] How to use sections with Zend_Config and PHP Arrays

2008-09-26 Thread Rob Allen


On 23 Sep 2008, at 18:56, Ralf Eggert wrote:


Hi,

has anyone any idea about this (see forwarded message)? Thanks for
clarification.

Best regards,

Ralf

Ralf Eggert schrieb am 19.09.2008 23:01:

Hi,

I know that both Zend_Config_Ini and Zend_Config_Xml support sections
and extending sections for config data definitions. In the manual I  
read

that Zend_Config also supports sections when used with PHP arrays. If
this is right, how can this be achieved?

If not, I think this passage of the manual is a little unclear:


The Zend_Config family of classes enables configuration data to be
organized into sections. Zend_Config adapter objects may be loaded
with a single specified section, multiple specified sections, or
all sections (if none are specified).


http://framework.zend.com/manual/en/zend.config.theory_of_operation.html



The Zend_Config adapter classes for INI and XML files support the  
loading of a specified section. For Zend_Config itself (which loads  
arrays), you just load the array you want to use. We'll have to see if  
we can make this clearer in the manual.


Regards,

Rob...



[fw-general] Re: Using ACL asserts to validate access to specific instances of a generic resource

2008-09-26 Thread Colin Guthrie

Martijn Korse wrote:

It's more or less what you proposed earlier, but without the need for static
variables.


Yup, I'd more or less come to the same conclusion (see my earlier reply 
which says:


I think I am actually very happy with my original suggestion albeit it 
was a little contrived to keep the Resources as individual objects in 
their own right and used static values to get round a problem. In actual 
fact Resources should not just be individual objects, but they should 
really be the objects in their own right that also implement 
Zend_Acl_Resource_Interface.


My Article object should implement Zend_Acl_Resource_Interface

So yes I concur :)


And if a resource/article has also knowledge about the category it's in you
could also decide that it requests the owner-id of the category and use
that.


Exactly. Different asserts can check for different logical conditions 
like this in a very configurable way without cluttering up controller or 
action logic.


Thanks for the help.

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/]



[fw-general] is there a Validator to check if at least one of a group of fields is valid?

2008-09-26 Thread Ian R


...For example, say I wanted to get contact information: either a  
phone number, an email address, or both, but NOT neither.


I'm about to create a custom validator but I'm wondering if such a  
thing already exists.  I can't seem to find anything through my  
various searches but I'm not entirely sure what to call that.


I'm just now picking up speed with ZF, it's just starting to click.   
It's very exciting!


Ian

Re: [fw-general] is there a Validator to check if at least one of a group of fields is valid?

2008-09-26 Thread David Mintz
On Fri, Sep 26, 2008 at 8:52 AM, Ian R [EMAIL PROTECTED] wrote:


 ...For example, say I wanted to get contact information: either a phone
 number, an email address, or both, but NOT neither.

 I'm about to create a custom validator but I'm wondering if such a thing
 already exists.  I can't seem to find anything through my various searches
 but I'm not entirely sure what to call that.

 I'm just now picking up speed with ZF, it's just starting to click.  It's
 very exciting!

 Ian


Maybe someone else will correct me, but I think one way to do this is indeed
to write your own validator. When you add the validator you might say
something like

'multi_fields'=array(
new My_Validator_OneOrMoreFields(),
'fields'=array('phone','email'),
'messages'=array(Please provide either a phone number or an email
address')
),

And in your validator's logic you check that either one or the other is
nonempty. Meanwhile you can also add the validators e.,g., on the email,
that ship with ZF, with the allowEmpty flag set to true.

I did this for one form, and found I could use it again for another, giving
me a pleasing sense of DRY satisfaction.

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

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


[fw-general] FCKEditor and Zend_Form integration

2008-09-26 Thread drj201

Hi all,

I want to integrate FCKEditor (WYSIWYG) into a Zend_Form thus bringing all
the benefits that allows...

Note: Im not talking of simply getting FCKEditor to work in the view etc
(ala here:
http://blog.ekini.net/2007/11/28/using-fckeditor-with-zend-framework-file-browser-enabled/#comments)
but actually integrating it into Zend_Form.

Has anyone done this before? What would be your recommended approach? Is it
even possible without  investing 100's of man hours and hacking the
framework to death? :-(

I first thought of simply dumping the HTML required by FCKEditor into a
decorator but this is not the answer.

I then thought of creating a new Zend_Form_Element and overwriting the
render method to simply return the HTML like so:

public function render(Zend_View_Interface $view = null)
{

$oFCKeditor = new FCKeditor_FCKeditor('FCKeditor1');
$oFCKeditor-BasePath = '/js/FCKeditor/';
$oFCKeditor-Value = $this-getValue();

return $oFCKeditor-CreateHtml();

} 

Neither of the above provide any real integration with Zend_Form however!
Using the above method for example it is not possible to wrap the element in
Decorators or add a Label. It also doesnt provide integration when using
$form-getValues(). The FCKEditor form field only shows in $_POST.

Maybe a ViewScript Decorator is the answer? Wait for the Editor Dijit (even
though it is nowhere as comprehensive)?

What would you guys suggest?

Regards,

David
-- 
View this message in context: 
http://www.nabble.com/FCKEditor-and-Zend_Form-integration-tp19688738p19688738.html
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] FCKEditor and Zend_Form integration

2008-09-26 Thread Guillaume BABIK
Hi,

 

In my projects using FCKEditor, I created a View's Helper that renders FCK
Editor.

 

I just applied or not this helper on a Zend_Form_Element_Textarea to use
FKCeditor.

 

My View's Helper is : 

/**

  * Constructor

  *

  * @access public

  * @param string $xhtml balise textarea

  * @param string $id ID de la balise textarea

  * @return string 

  */

 public function TextareaFCK($xhtml, $id)

 {

return $xhtml . 'script type=text/javascript $(function(){
$(\'textarea#'.$id.'\').fck({path: \'/fckeditor/\',
toolbar:\'Toolbar_Name\', width:\'520px\', height:\'300px\'}); });
/script';

 }

 

In a view :

?php echo $this-TextareaFCK($this-form-getElement('nameField'), '
nameField '); ?

 

I.E. : I use JQuery's FCKEditor version.

 

Hope it's help.

 

Regards,

 

Guillaume BABIK

INTERNIM

45, rue Aristide Briand

92300 LEVALLOIS

 BLOCKED::http://www.internim.com/ http://www.internim.com

 

-Message d'origine-
De : drj201 [mailto:[EMAIL PROTECTED] 
Envoyé : vendredi 26 septembre 2008 15:42
À : fw-general@lists.zend.com
Objet : [fw-general] FCKEditor and Zend_Form integration

 

 

Hi all,

 

I want to integrate FCKEditor (WYSIWYG) into a Zend_Form thus bringing all

the benefits that allows...

 

Note: Im not talking of simply getting FCKEditor to work in the view etc

(ala here:

http://blog.ekini.net/2007/11/28/using-fckeditor-with-zend-framework-file-br
owser-enabled/#comments)

but actually integrating it into Zend_Form.

 

Has anyone done this before? What would be your recommended approach? Is it

even possible without  investing 100's of man hours and hacking the

framework to death? :-(

 

I first thought of simply dumping the HTML required by FCKEditor into a

decorator but this is not the answer.

 

I then thought of creating a new Zend_Form_Element and overwriting the

render method to simply return the HTML like so:

 

  public function render(Zend_View_Interface $view = null)

  {



$oFCKeditor = new FCKeditor_FCKeditor('FCKeditor1');

$oFCKeditor-BasePath = '/js/FCKeditor/';

$oFCKeditor-Value = $this-getValue();

  

return $oFCKeditor-CreateHtml();



  } 

 

Neither of the above provide any real integration with Zend_Form however!

Using the above method for example it is not possible to wrap the element in

Decorators or add a Label. It also doesnt provide integration when using

$form-getValues(). The FCKEditor form field only shows in $_POST.

 

Maybe a ViewScript Decorator is the answer? Wait for the Editor Dijit (even

though it is nowhere as comprehensive)?

 

What would you guys suggest?

 

Regards,

 

David

-- 

View this message in context:
http://www.nabble.com/FCKEditor-and-Zend_Form-integration-tp19688738p1968873
8.html

Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] View Helpers Repository

2008-09-26 Thread Edward Haber
This is why I called the helper s instead of pluralize. If you'd  
like to contribute a better pluralization helper, email it to me or  
leave comments on the website.


Maybe I wasn't clear. The point is not that I'm bringing to the Zend  
community my awesome personal view helpers, but rather I am trying to  
create a repository so that all ZF developers can share View Helpers  
as a resource.


I'm just about to take the site down though seeing as this idea isn't  
of interest to anyone.


Thanks!
Eddie


On Sep 25, 2008, at 2:31 PM, Matthew Ratzloff wrote:


Regarding your plural (s) helper...

person = people

-Matt

On Thu, Sep 25, 2008 at 10:53 AM, Edward Haber [EMAIL PROTECTED]  
wrote:
I'm just in the first steps of putting together a ViewHelpers  
repository because there is such a serious need for a resources  
repository for ZF. I would welcome any thoughts on this  
implementation -- any intelligence on the idea itself (does it  
already exist in a better form somewhere else?) -- if this is  
planned by Zend in the future I would be happy not to waste my time.


This is basically a code-repository Wiki: http://zfhelpers.com. If  
you want to email me your view helpers I'll add them to the site.  
LMK if you have any thoughts on better/easier administration.


SO far I put up my view helpers I've used. Is this idea worthwhile?  
i'm curious if people want to trade view helpers and other resources.


Thx!
Eddie




On Sep 25, 2008, at 1:47 PM, Jason Austin wrote:

Count me in as a vote for doing this.  It would be great to provide  
that type of resource to users.


- Jason

Matthew Weier O'Phinney wrote:
-- mezoni [EMAIL PROTECTED] wrote
(on Thursday, 25 September 2008, 09:13 AM -0700):

Is ZF Teem planned official user plugin repository?


Not currently; we've been kicking the idea around for a while, though.



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







RE: [fw-general] FCKEditor and Zend_Form integration

2008-09-26 Thread gammamatrix

I created a view helper as well with the option of including extra options:

class Site_View_Helper_FckEditor {

/**
 * Creates a form element with FCKEditor.
 *
 * @param   string  $name   The form 
element name
 * @param   string  $value  The form element value
 * @param   array   $optionsOptions
*/
public function fckEditor($name = '', $value = '', $options = array())
{
include_once(ROOT_PUBLIC . 
/resources/fckeditor/fckeditor.php);

$oFCKeditor = new FCKeditor($name);

$oFCKeditor-Config['EnterMode'] = 
((isset($options['EnterMode'])) ?
$options['EnterMode'] : 'br');

$oFCKeditor-ToolbarSet = ((isset($options['ToolbarSet'])) ?
$options['ToolbarSet'] : 'User');

$oFCKeditor-BasePath = '/resources/fckeditor/';

if(isset($options['Height']))   $oFCKeditor-Height = 
$options['Height'];
if(isset($options['Width']))
$oFCKeditor-Width  = $options['Width'];

$oFCKeditor-Value = $value;

return $oFCKeditor-CreateHtml();
}
}

This is a rough helper. I am sure there are other default options that may
need to be handled.


Guillaume BABIK wrote:
 
 Hi,
 
  
 
 In my projects using FCKEditor, I created a View's Helper that renders FCK
 Editor.
 
  
 
 I just applied or not this helper on a Zend_Form_Element_Textarea to use
 FKCeditor.
 
  
 
 My View's Helper is : 
 
 /**
 
   * Constructor
 
   *
 
   * @access public
 
   * @param string $xhtml balise textarea
 
   * @param string $id ID de la balise textarea
 
   * @return string 
 
   */
 
  public function TextareaFCK($xhtml, $id)
 
  {
 
 return $xhtml . 'script type=text/javascript $(function(){
 $(\'textarea#'.$id.'\').fck({path: \'/fckeditor/\',
 toolbar:\'Toolbar_Name\', width:\'520px\', height:\'300px\'}); });
 /script';
 
  }
 
  
 
 In a view :
 
 ?php echo $this-TextareaFCK($this-form-getElement('nameField'), '
 nameField '); ?
 
  
 
 I.E. : I use JQuery's FCKEditor version.
 
  
 
 Hope it's help.
 
  
 
 Regards,
 
  
 
 Guillaume BABIK
 
 INTERNIM
 
 45, rue Aristide Briand
 
 92300 LEVALLOIS
 
  BLOCKED::http://www.internim.com/ http://www.internim.com
 
  
 
 -Message d'origine-
 De : drj201 [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 26 septembre 2008 15:42
 À : fw-general@lists.zend.com
 Objet : [fw-general] FCKEditor and Zend_Form integration
 
  
 
  
 
 Hi all,
 
  
 
 I want to integrate FCKEditor (WYSIWYG) into a Zend_Form thus bringing all
 
 the benefits that allows...
 
  
 
 Note: Im not talking of simply getting FCKEditor to work in the view etc
 
 (ala here:
 
 http://blog.ekini.net/2007/11/28/using-fckeditor-with-zend-framework-file-br
 owser-enabled/#comments)
 
 but actually integrating it into Zend_Form.
 
  
 
 Has anyone done this before? What would be your recommended approach? Is
 it
 
 even possible without  investing 100's of man hours and hacking the
 
 framework to death? :-(
 
  
 
 I first thought of simply dumping the HTML required by FCKEditor into a
 
 decorator but this is not the answer.
 
  
 
 I then thought of creating a new Zend_Form_Element and overwriting the
 
 render method to simply return the HTML like so:
 
  
 
   public function render(Zend_View_Interface $view = null)
 
   {
 
 
 
 $oFCKeditor = new FCKeditor_FCKeditor('FCKeditor1');
 
 $oFCKeditor-BasePath = '/js/FCKeditor/';
 
 $oFCKeditor-Value = $this-getValue();
 
   
 
 return $oFCKeditor-CreateHtml();
 
 
 
   } 
 
  
 
 Neither of the above provide any real integration with Zend_Form however!
 
 Using the above method for example it is not possible to wrap the element
 in
 
 Decorators or add a Label. It also doesnt provide integration when using
 
 $form-getValues(). The FCKEditor form field only shows in $_POST.
 
  
 
 Maybe a ViewScript Decorator is the answer? Wait for the Editor Dijit
 (even
 
 though it is nowhere as comprehensive)?
 
  
 
 What would you guys suggest?
 
  
 
 Regards,
 
  
 
 David
 
 -- 
 
 View this message in context:
 http://www.nabble.com/FCKEditor-and-Zend_Form-integration-tp19688738p1968873
 8.html
 
 Sent from the Zend Framework mailing list archive at Nabble.com.
 
 
 

-- 
View this message in context: 
http://www.nabble.com/FCKEditor-and-Zend_Form-integration-tp19688738p19689614.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] No conditional comment support for headScript?

2008-09-26 Thread Isaak Malik
Thank you for your answer, unfortunately that is not what I meant. I'm
looking for conditional comments support with headScripts().

I'd like this to be implemented just for a matter of readability.

On Thu, Sep 25, 2008 at 9:39 PM, Jeremy Brown [EMAIL PROTECTED] wrote:

  This is an excerpt from an email on the fw-mvc list sent on 21 Aug 2008:



 $url = $this-_view-baseUrl() . '/css/blueprint/ie.css';
 $this-_view-headLink()-appendStylesheet($url, 'screen,projection', 'IE
 7');

 This outputs:

 !--[if IE 7].!-- [endif] --



 

 Jeremy Brown
 Senior Web Developer

 Spear One
 972.661.6038
 www.spearone.com



 *From:* Isaak Malik [mailto:[EMAIL PROTECTED]
 *Sent:* Thursday, September 25, 2008 2:23 PM
 *To:* fw-general@lists.zend.com
 *Subject:* [fw-general] No conditional comment support for headScript?



 How come conditional comments are not supported for headscripts? Next to
 CSS this method is also commonly used with JavaScript code/files, a common
 example is the PNG background fix.

 Are there any plans for this or will I have to force my lazy fingers to
 keep typing the extra characters?

 Thank you
 --
 Isaak Malik
 Web Developer




-- 
Isaak Malik
Web Developer


Re: [fw-general] Dojo BorderContainer Help

2008-09-26 Thread Panman



Matthew Weier O'Phinney-3 wrote:
 
 Yep -- I use it in my pastebin demo:
 
 http://weierophinney.net/matthew/uploads/pastebin-1.0.0.tar.gz
 
 One thing to note: BorderContainer and doctypes don't play well together
 in most cases -- I generally need to omit the DocType declaration when
 using it. 
 
Do you apply a theme? I've found that when I apply the Tundra theme the
entire layout dissapears after the page loads.
-- 
View this message in context: 
http://www.nabble.com/Dojo-BorderContainer-Help-tp19657350p19690187.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] How to validate Zend_Dojo_Form_Element_Textarea?

2008-09-26 Thread Ian R


Hi there!  I'm trying to make a textarea, dojo-enabled, with a maximum  
of 500 characters.  Here's what I have:


// creating validator
$validator = new Zend_Validate_StringLength();
$validator-setMin(2)
-setMax(5)
-setMessage('Text is too  
long!',Zend_Validate_StringLength::TOO_LONG);


// create textarea and add validator
$el = new Zend_Dojo_Form_Element_Textarea(ef_Description);
$el-setLabel(Describe the Event)
-addValidator($validator);

$this-addElement($el);

Everything else validates, dojo-style, but every other form element is  
derives from ValidationTextBox.  Some debugging shows that the isValid  
function, defined in Zend/Validate/StringLength.php, is never being  
called.


How do I call it?  Is it just a matter of adding onkeydown and onblur  
events?


Thanks again for everyone's help.  I promise I use the list as a last  
resort, and I'm stumped!


Ian



[fw-general] PDO and setFetchMode weirdness

2008-09-26 Thread Colin Guthrie

Using 1.6.1

If I call $db-setFetchMode(Zend_Db::FETCH_COLUMN) with a PDO adapter, I 
get an invalid fetch mode exception.


If I add an additional case into the Db/Pdo/Abstract it worked fine in 
my tests (mysqli) (ignore rev numbers - this is my repo)


--- Db/Adapter/Pdo/Abstract.php (revision 30213)
+++ Db/Adapter/Pdo/Abstract.php (working copy)
@@ -286,6 +286,7 @@
 case PDO::FETCH_BOTH:
 case PDO::FETCH_NAMED:
 case PDO::FETCH_OBJ:
+case PDO::FETCH_COLUMN:
 $this-_fetchMode = $mode;
 break;
 default:


Why isn't this supported? Is it just an oversight or is there a more 
interesting reason?



As another note, why is the mode compared to the PDO:: namespace and not 
the Zend_Db:: one for the constants? Even if there is a 1::1 mapping, 
this seems wrong and it would make more sense (to me) to do the 
following despite the fact it's more verbose:



--- Db/Adapter/Pdo/Abstract.php (revision 30213)
+++ Db/Adapter/Pdo/Abstract.php (working copy)
@@ -280,14 +280,27 @@
 public function setFetchMode($mode)
 {
 switch ($mode) {
-case PDO::FETCH_LAZY:
-case PDO::FETCH_ASSOC:
-case PDO::FETCH_NUM:
-case PDO::FETCH_BOTH:
-case PDO::FETCH_NAMED:
-case PDO::FETCH_OBJ:
-$this-_fetchMode = $mode;
+case Zend_Db::FETCH_LAZY:
+$this-_fetchMode = PDO::FETCH_LAZY;
 break;
+case Zend_Db::FETCH_ASSOC:
+$this-_fetchMode = PDO::FETCH_ASSOC;
+break;
+case Zend_Db::FETCH_NUM:
+$this-_fetchMode = PDO::FETCH_NUM;
+break;
+case Zend_Db::FETCH_BOTH:
+$this-_fetchMode = PDO::FETCH_BOTH;
+break;
+case Zend_Db::FETCH_NAMED:
+$this-_fetchMode = PDO::FETCH_NAMED;
+break;
+case Zend_Db::FETCH_OBJ:
+$this-_fetchMode = PDO::FETCH_OBJ;
+break;
+case Zend_Db::FETCH_COLUMN:
+$this-_fetchMode = PDO::FETCH_COLUMN;
+break;
 default:
 /**
  * @see Zend_Db_Adapter_Exception



--

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] Dojo BorderContainer Help

2008-09-26 Thread Matthew Weier O'Phinney
-- Panman [EMAIL PROTECTED] wrote
(on Friday, 26 September 2008, 08:02 AM -0700):
 Matthew Weier O'Phinney-3 wrote:
  
  Yep -- I use it in my pastebin demo:
  
  http://weierophinney.net/matthew/uploads/pastebin-1.0.0.tar.gz
  
  One thing to note: BorderContainer and doctypes don't play well together
  in most cases -- I generally need to omit the DocType declaration when
  using it. 
  
 Do you apply a theme? I've found that when I apply the Tundra theme the
 entire layout dissapears after the page loads.

Please look at how the pastebin does it; everything works correctly in
that application.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] How to validate Zend_Dojo_Form_Element_Textarea?

2008-09-26 Thread Matthew Weier O'Phinney
-- Ian R [EMAIL PROTECTED] wrote
(on Friday, 26 September 2008, 11:06 AM -0400):
 Hi there!  I'm trying to make a textarea, dojo-enabled, with a maximum  
 of 500 characters.  Here's what I have:

 // creating validator
 $validator = new Zend_Validate_StringLength();
 $validator-setMin(2)
 -setMax(5)

Just a note -- this will set a maximum of 5 characters, not 500, as you
state you'd like to have.

 -setMessage('Text is too  
 long!',Zend_Validate_StringLength::TOO_LONG);

 // create textarea and add validator
 $el = new Zend_Dojo_Form_Element_Textarea(ef_Description);
 $el-setLabel(Describe the Event)
 -addValidator($validator);

 $this-addElement($el);

 Everything else validates, dojo-style, but every other form element is  
 derives from ValidationTextBox.  Some debugging shows that the isValid  
 function, defined in Zend/Validate/StringLength.php, is never being  
 called.

 How do I call it?  Is it just a matter of adding onkeydown and onblur  
 events?

No -- Zend_Form validators are only called when the form is submitted;
they do not affect client-side operations.

Everything above looks correct; can you indicate what data passed to the
form does not validate? That will potentially give me a reproduce case.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] How to validate Zend_Dojo_Form_Element_Textarea?

2008-09-26 Thread Jason

FYI, the textarea in the link is not accessable at all on an iPhone ;)



Jason


Sent from my iPhone

On Sep 26, 2008, at 1:53 PM, Ian Rickert [EMAIL PROTECTED] wrote:




Matthew Weier O'Phinney-3 wrote:



Just a note -- this will set a maximum of 5 characters, not 500, as  
you

state you'd like to have.




Ah, yes.  Of course.  I had changed it to make testing easier, but  
forgot to

change it back for this post.



Matthew Weier O'Phinney-3 wrote:



Zend_Form validators are only called when the form is submitted;
they do not affect client-side operations.




Ah... so is there a way to do it the way that ValidationTextBox does  
it,
with the alert symbol, turning yellow, displaying an error message?   
So that

when the user exceeds 500 characters, it displays an error message?


Matthew Weier O'Phinney-3 wrote:



Everything above looks correct; can you indicate what data passed  
to the
form does not validate? That will potentially give me a reproduce  
case.





I'm a little unsure what you mean by this; I have basically been  
loading up
the page and then slapping a few random characters (fdsagfdsa)  
into the
textarea, nothing fails validation (I believe because it doesn't  
actually

check)...


If it is related to the submit button, here's my code for that...  
perhaps

the problem is in there?

$el = new Zend_Dojo_Form_Element_SubmitButton(sb_SendForm2);
$el-setLabel(Submit??)
   -setRequired();
$this-addElement($el);


Well, I've put what I have up on the web.  The textarea in question is
labeled Describe the Event.  Also included are Zend_Debug dumps of  
the

Textarea and SubmitButton.

http://fairmountfair.com/CalendarSubmissions/public/

Thanks so much!  I really appreciate your work.

Ian



--
View this message in context: 
http://www.nabble.com/How-to-validate-Zend_Dojo_Form_Element_Textarea--tp19690291p19693452.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] How to validate Zend_Dojo_Form_Element_Textarea?

2008-09-26 Thread Matthew Weier O'Phinney
-- Jason [EMAIL PROTECTED] wrote
(on Friday, 26 September 2008, 03:11 PM -0400):
 FYI, the textarea in the link is not accessable at all on an iPhone ;)

That doesn't entirely surprise me -- and would be something to take up
on the Dojo mailing lists and/or IRC channel.


 Sent from my iPhone

 On Sep 26, 2008, at 1:53 PM, Ian Rickert [EMAIL PROTECTED] wrote:



 Matthew Weier O'Phinney-3 wrote:


 Just a note -- this will set a maximum of 5 characters, not 500, as  
 you
 state you'd like to have.



 Ah, yes.  Of course.  I had changed it to make testing easier, but  
 forgot to
 change it back for this post.



 Matthew Weier O'Phinney-3 wrote:


 Zend_Form validators are only called when the form is submitted;
 they do not affect client-side operations.



 Ah... so is there a way to do it the way that ValidationTextBox does  
 it,
 with the alert symbol, turning yellow, displaying an error message?   
 So that
 when the user exceeds 500 characters, it displays an error message?


 Matthew Weier O'Phinney-3 wrote:


 Everything above looks correct; can you indicate what data passed to 
 the
 form does not validate? That will potentially give me a reproduce  
 case.



 I'm a little unsure what you mean by this; I have basically been  
 loading up
 the page and then slapping a few random characters (fdsagfdsa) into 
 the
 textarea, nothing fails validation (I believe because it doesn't  
 actually
 check)...


 If it is related to the submit button, here's my code for that...  
 perhaps
 the problem is in there?

 $el = new Zend_Dojo_Form_Element_SubmitButton(sb_SendForm2);
 $el-setLabel(Submit??)
-setRequired();
 $this-addElement($el);


 Well, I've put what I have up on the web.  The textarea in question is
 labeled Describe the Event.  Also included are Zend_Debug dumps of  
 the
 Textarea and SubmitButton.

 http://fairmountfair.com/CalendarSubmissions/public/

 Thanks so much!  I really appreciate your work.

 Ian



 -- 
 View this message in context: 
 http://www.nabble.com/How-to-validate-Zend_Dojo_Form_Element_Textarea--tp19690291p19693452.html
 Sent from the Zend Framework mailing list archive at Nabble.com.



-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] View Helpers Repository

2008-09-26 Thread Matthew Ratzloff
It's a nice idea but a bit too narrow in scope.  There needs to be a
dedicated community site that has all manner of library components (which
would naturally include view helpers).  There also has to be a way to own
your contribution (as with Firefox add-ons), own your namespace, set up
teams, and (as you have) enable users to comment.  To keep it relatively
simple, users should manage the distribution themselves (like Firefox,
unlike Sourceforge).
I suppose there could be a market with purchasing options and varying
licenses, but I would suggest instead requiring all components to be made
freely available under a New BSD license.  This would encourage users to
contribute components with broad appeal to the framework instead of charging
for them.  It would also keep licensing considerations reasonable (all one
license instead of several different ones).  A contributor licensing
agreement should only be required if the community expresses interest in
bringing a component into the main framework, at which point it should go
through the standard proposal process.
-Matt

On Fri, Sep 26, 2008 at 7:22 AM, Edward Haber [EMAIL PROTECTED] wrote:

 This is why I called the helper s instead of pluralize. If you'd like
 to contribute a better pluralization helper, email it to me or leave
 comments on the website.

 Maybe I wasn't clear. The point is not that I'm bringing to the Zend
 community my awesome personal view helpers, but rather I am trying to create
 a repository so that all ZF developers can share View Helpers as a resource.

 I'm just about to take the site down though seeing as this idea isn't of
 interest to anyone.

 Thanks!
 Eddie



 On Sep 25, 2008, at 2:31 PM, Matthew Ratzloff wrote:

  Regarding your plural (s) helper...

 person = people

 -Matt

 On Thu, Sep 25, 2008 at 10:53 AM, Edward Haber [EMAIL PROTECTED] wrote:
 I'm just in the first steps of putting together a ViewHelpers repository
 because there is such a serious need for a resources repository for ZF. I
 would welcome any thoughts on this implementation -- any intelligence on the
 idea itself (does it already exist in a better form somewhere else?) -- if
 this is planned by Zend in the future I would be happy not to waste my time.

 This is basically a code-repository Wiki: http://zfhelpers.com. If you
 want to email me your view helpers I'll add them to the site. LMK if you
 have any thoughts on better/easier administration.

 SO far I put up my view helpers I've used. Is this idea worthwhile? i'm
 curious if people want to trade view helpers and other resources.

 Thx!
 Eddie




 On Sep 25, 2008, at 1:47 PM, Jason Austin wrote:

 Count me in as a vote for doing this.  It would be great to provide that
 type of resource to users.

 - Jason

 Matthew Weier O'Phinney wrote:
 -- mezoni [EMAIL PROTECTED] wrote
 (on Thursday, 25 September 2008, 09:13 AM -0700):

 Is ZF Teem planned official user plugin repository?


 Not currently; we've been kicking the idea around for a while, though.



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







Re: [fw-general] How to validate Zend_Dojo_Form_Element_Textarea?

2008-09-26 Thread Ian Rickert



Bruno Friedmann-2 wrote:
 
 
 If you want to interact with the content of the textarea during the
 client phase you must interact with the browser and this
 is done by a javascript you could attach on the textarea.
 
 Google is your friend
 something like this
 http://www.tutorialstream.com/tutorials/javascript/check-textarea-length/
 
 


You'll have to excuse me, but it seems to me that the
Zend_Dojo_Form_Elements are javascript-based Dijits, intended to validate on
the client-side.  I can easily (without Google, even) check a textarea's
length, but I was expecting the functionality of most of the other
Zend_Dojo_Form_Elements.  From Matthew's response, I'm not sure I'm mistaken
about that, but am I?

I've been scouring the ZF code and the Dojo API looking for clues as to why
this would or wouldn't work with a textarea, and I'll spare you the code
snippets, but it just seems like a (very strange) limitation of Dojo Dijits. 
There's no validate() function for dijit.form.Textarea the way there is for,
say, dijit.form.ValidationTextBox or dijit.form.ComboBox.  It is to weep. 
Kinda doesn't make sense to me, so if it actually does make sense, I'd love
to know why.

That having been said, I guess the way to go is to just put some custom
javascript in the oninit, onblue and onkeypress events of the textarea, like
Dojo has built in for those other Dijits.  Yes?

Ian



-- 
View this message in context: 
http://www.nabble.com/How-to-validate-Zend_Dojo_Form_Element_Textarea--tp19690291p19695957.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Form ViewScript Elements don't show

2008-09-26 Thread devxtech

After looking through the mailing list archives and trying a lot of different
things I can't seem to find out why the form elements won't display from my
viewscript. They display fine when i don't use a viewscript and use the
default decorators.

My viewscript (/application/views/scripts/contactForm.phtml) looks like
this:

h4Please Fill Me Out/h4
form action=? $this-escape($this-element-getAction()); ? method=?
$this-escape($this-element-getMethod());?
fieldset
legendContact Information/legend
pPlease provide us with the following information so we may contact
you./p
? $this-element-firstName; ?
? $this-element-lastName; ? 
? $this-element-email; ?
? $this-element-telephoneNum; ?
/fieldset
fieldset
legendContact Reason  Message/legend
pNow please provide us with your reason for contacting us and a brief
message./p
? $this-element-contactReason; ?
? $this-element-message; ?
/fieldset
? $this-element-submit; ?
/form

My class in (/application/forms/ContactForm.php) is as follows:

class forms_ContactForm extends Zend_Form {
public function __construct($options = null)
{
parent::__construct($options);
$this-setAction('');
$this-setMethod('post');
$this-setName('contact_us');

$firstName = new Zend_Form_Element_Text('firstName');
$firstName-setLabel('First Name')
  -setRequired(true)
  -addValidator('NotEmpty', true)
  -addValidator('Alpha', true);

$lastName = new Zend_Form_Element_Text('lastName');
$lastName-setLabel('Last Name')
 -setRequired(true)
 -addValidator('NotEmpty')
 -addValidator('Alpha', true);
 
$telephoneNum = new Zend_Form_Element_Text('telephoneNum');
$telephoneNum-setLabel('Telephone Number')
 //-setDescription('example 
(555)555-')
 -setRequired(false)
 -addValidator('NonEmpty');
 
$email = new Zend_Form_Element_Text('email');
$email-setLabel('Email Address')
  -addFilter('StripTags')
  -addFilter('StringTrim')
  -addFilter('StringToLower')
  -setRequired(true)
  -addValidator('NotEmpty', true)
  -addValidator('EmailAddress');
  
$contactReason = new Zend_Form_Element_Select('contactReason');
$contactReason-setLabel('Reason for Contact')
  -setRequired(true)
  -addMultiOption('none','Please 
Select One')
  
-addMultiOption('personal','Personal')
  
-addMultiOption('business','Business')
  -addValidator('NotEmpty');

$message = new Zend_Form_Element_Textarea('message');
$message-setLabel('Comments')
-setAttrib('rows','15')
-setAttrib('cols','70')
-setRequired(true)
-addValidator('NotEmpty');

$submit = new Zend_Form_Element_Submit('submit');
$submit-setLabel('Submit Form');

$this-setDecorators(array(
array('ViewScript',array('viewScript' = 
'forms/contactForm.phtml'))
));

$this-addElements(array($firstName, $lastName, $email, 
$telephoneNum,
$contactReason, $message, $submit));
}
}
?


When the script runs it outputs the fieldsets and the legends with the
descriptions but nothing else is outputted. Any ideas on what could be
causing this. Been trying to figure this out for a few days now and could
really use some help as I'm still learning OOP and the Zend Framework.
-- 
View this message in context: 
http://www.nabble.com/Zend_Form-ViewScript-Elements-don%27t-show-tp19696062p19696062.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Form ViewScript Elements don't show

2008-09-26 Thread Matthew Weier O'Phinney
-- devxtech [EMAIL PROTECTED] wrote
(on Friday, 26 September 2008, 01:43 PM -0700):
 
 After looking through the mailing list archives and trying a lot of different
 things I can't seem to find out why the form elements won't display from my
 viewscript. They display fine when i don't use a viewscript and use the
 default decorators.

Make sure that you call setView() on the elements. Easiest would be to
do the following at the top of your view script:

foreach ($this-element as $item) {
$item-setView($this);
}


 My viewscript (/application/views/scripts/contactForm.phtml) looks like
 this:
 
 h4Please Fill Me Out/h4
 form action=? $this-escape($this-element-getAction()); ? method=?
 $this-escape($this-element-getMethod());?
 fieldset
 legendContact Information/legend
 pPlease provide us with the following information so we may contact
 you./p
 ? $this-element-firstName; ?
 ? $this-element-lastName; ?   
 ? $this-element-email; ?
 ? $this-element-telephoneNum; ?
 /fieldset
 fieldset
 legendContact Reason  Message/legend
 pNow please provide us with your reason for contacting us and a brief
 message./p
 ? $this-element-contactReason; ?
 ? $this-element-message; ?
 /fieldset
 ? $this-element-submit; ?
 /form
 
 My class in (/application/forms/ContactForm.php) is as follows:
 
 class forms_ContactForm extends Zend_Form {
   public function __construct($options = null)
   {
   parent::__construct($options);
   $this-setAction('');
   $this-setMethod('post');
   $this-setName('contact_us');
   
   $firstName = new Zend_Form_Element_Text('firstName');
   $firstName-setLabel('First Name')
 -setRequired(true)
 -addValidator('NotEmpty', true)
 -addValidator('Alpha', true);
   
   $lastName = new Zend_Form_Element_Text('lastName');
   $lastName-setLabel('Last Name')
-setRequired(true)
-addValidator('NotEmpty')
-addValidator('Alpha', true);

   $telephoneNum = new Zend_Form_Element_Text('telephoneNum');
   $telephoneNum-setLabel('Telephone Number')
//-setDescription('example 
 (555)555-')
-setRequired(false)
-addValidator('NonEmpty');

   $email = new Zend_Form_Element_Text('email');
   $email-setLabel('Email Address')
 -addFilter('StripTags')
 -addFilter('StringTrim')
 -addFilter('StringToLower')
 -setRequired(true)
 -addValidator('NotEmpty', true)
 -addValidator('EmailAddress');
 
   $contactReason = new Zend_Form_Element_Select('contactReason');
   $contactReason-setLabel('Reason for Contact')
 -setRequired(true)
 -addMultiOption('none','Please 
 Select One')
 
 -addMultiOption('personal','Personal')
 
 -addMultiOption('business','Business')
 -addValidator('NotEmpty');
   
   $message = new Zend_Form_Element_Textarea('message');
   $message-setLabel('Comments')
   -setAttrib('rows','15')
   -setAttrib('cols','70')
   -setRequired(true)
   -addValidator('NotEmpty');
   
   $submit = new Zend_Form_Element_Submit('submit');
   $submit-setLabel('Submit Form');
   
   $this-setDecorators(array(
   array('ViewScript',array('viewScript' = 
 'forms/contactForm.phtml'))
   ));
   
   $this-addElements(array($firstName, $lastName, $email, 
 $telephoneNum,
 $contactReason, $message, $submit));
   }
 }
 ?
 
 
 When the script runs it outputs the fieldsets and the legends with the
 descriptions but nothing else is outputted. Any ideas on what could be
 causing this. Been trying to figure this out for a few days now and could
 really use some help as I'm still learning OOP and the Zend Framework.
 -- 
 View this message in context: 
 http://www.nabble.com/Zend_Form-ViewScript-Elements-don%27t-show-tp19696062p19696062.html
 Sent from the Zend Framework mailing list archive at Nabble.com.
 

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | 

Re: [fw-general] How to validate Zend_Dojo_Form_Element_Textarea?

2008-09-26 Thread Matthew Weier O'Phinney
-- Ian Rickert [EMAIL PROTECTED] wrote
(on Friday, 26 September 2008, 01:37 PM -0700):
 Bruno Friedmann-2 wrote:
  If you want to interact with the content of the textarea during the
  client phase you must interact with the browser and this
  is done by a javascript you could attach on the textarea.
  
  Google is your friend
  something like this
  http://www.tutorialstream.com/tutorials/javascript/check-textarea-length/
  
  
 
 
 You'll have to excuse me, but it seems to me that the
 Zend_Dojo_Form_Elements are javascript-based Dijits, intended to validate on
 the client-side.  I can easily (without Google, even) check a textarea's
 length, but I was expecting the functionality of most of the other
 Zend_Dojo_Form_Elements.  From Matthew's response, I'm not sure I'm mistaken
 about that, but am I?

Yes, you are. Not all Dijits have validation available -- that's why,
for instance, there's both TextBox and ValidationTextBox. Textarea has
no validation by default.

Additionally, you'll need to tell the form to validate at the onsubmit
event so that it does client-side validations prior to submitting. This
has been discussed in a previous thread.

 I've been scouring the ZF code and the Dojo API looking for clues as to why
 this would or wouldn't work with a textarea, and I'll spare you the code
 snippets, but it just seems like a (very strange) limitation of Dojo Dijits. 
 There's no validate() function for dijit.form.Textarea the way there is for,
 say, dijit.form.ValidationTextBox or dijit.form.ComboBox.  It is to weep. 
 Kinda doesn't make sense to me, so if it actually does make sense, I'd love
 to know why.

Because Textareas allow for freeform input. Most validation constraints
are meaningless for textareas as a result -- they're too restrictive.

That said, it's simple to attach lambdas to events with Dojo, so you can
certainly do so.

 That having been said, I guess the way to go is to just put some custom
 javascript in the oninit, onblue and onkeypress events of the textarea, like
 Dojo has built in for those other Dijits.  Yes?

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Zend_Form ViewScript Elements don't show

2008-09-26 Thread devxtech

Here is what Matthew found out to be the problem. Just posting the solution
for anyone else who has my same issue.



Matthew Weier O'Phinney-3 wrote:
 
 I forgot to include that at the top of my viewscript before was the
 following code:

 foreach ($this-element as $element):
  $element-setView($this);
 endforeach;

 I changed it to what you suggested and still no elements are being
 displayed.

 At the top of my viewscript now is:

 foreach ($this-element as $element) {
  $element-setView($this);
  }

 Also the getAction() and getMethod() don't output any data.
 
 Figured it out. You're using:
 
? $this-element-firstName ?
 
 instead of :
 
?= $this-element-firstName ?
 
 The first doesn't echo anything. ;)
 
-- 
View this message in context: 
http://www.nabble.com/Zend_Form-ViewScript-Elements-don%27t-show-tp19696062p19696735.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Log_Writer_Syslog proposal

2008-09-26 Thread Thomas Gelf

Hi list,

I finally found some time to finalize Zend_Log_Writer_Syslog and also
added the possibility to use multiple syslog-writer instances in the
very same application. See

http://framework.zend.com/wiki/display/ZFPROP/Zend_Log_Writer_Syslog+-+Thomas+Gelf

for latest source code. As I would really like to move the proposal to
Ready for Recommendation soon I would greatly appreciate all kinds of
feedback.

Best regards,
Thomas Gelf