[fw-general] Can't get Zend_Paginator to work with Zend_DB_Select

2008-08-27 Thread Peter Wansch

Hi,
I am using ZendFramework-1.6.0RC2 and have the following table:

DROP TABLE IF EXISTS transaction;
CREATE TABLE transaction (
  transaction_id int NOT NULL auto_increment,
  transaction_name varchar(64) NOT NULL default '',
  transaction_type int(1) DEFAULT '1', 
  PRIMARY KEY (transaction_id),
  KEY idx_transaction_name (transaction_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO transaction (transaction_name, transaction_type) VALUES ('Tent
#1', 1);
:
:
INSERT INTO transaction (transaction_name, transaction_type) VALUES ('Tent
#40', 1);

I created a model class Transaction to which I added the following method to
return a paginator:

public function getPaginator($currentPageNumber = 1, $name = '', $where 
=
'transaction_name LIKE ?', $order = 'transaction_name', $itemCountPerPage =
10, $pageRange = 10)
{
// Construct select statement
$pattern = %$name%; // Put into double-quotes so that the 
variable gets
parsed
$select = $this-select()
-from('transaction')
-where($where, $pattern)
-order($order);

// Create paginator
$paginator = Zend_Paginator::factory($select);
$paginator-setItemCountPerPage($itemCountPerPage);
$paginator-setPageRange($pageRange);
$paginator-setCurrentPageNumber($currentPageNumber);
return $paginator;
}

In my controller TransactionController I do the following for my list
action:


// Get the paginator with all the details from the model
$this-view-paginator = $this-transaction-getPaginator();
$this-render();

where transaction is an instance variable initialized with new
Transaction().

In my view, I do the following:

?php if (count($this-paginator)): ?
table
?php foreach ($this-paginator as $item): ?
tr
  td?= $item; ?/td
/tr  
?php endforeach; ?
/table
?php endif; ?
?= $this-paginationControl($this-paginator, 'Sliding',
'partials/transaction/item_pagination_control.phtml'); ?
/div

The end result is:

Array
Array
Array
Array
Array
Array
Array
Array
Array
Array
1 - 10 of 40 First |  Previous | Next  | Last

I expected item to be a row so that I can access a model column with
$item-transaction_name; but then I get a

Notice: Trying to get property of non-object in
/Library/WebServer/Documents/application/views/scripts/partials/transaction/list_content.phtml
on line 14

The paginator has the right counts and I also tried a fetch all to make sure
my select works. How can I print the columns in my view?

Thanks and best wishes,
Peter
-- 
View this message in context: 
http://www.nabble.com/Can%27t-get-Zend_Paginator-to-work-with-Zend_DB_Select-tp19175496p19175496.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Fwd: Problem with Zend_Form_Element_File::isValid()

2008-08-27 Thread Ralf Eggert
Hi,

I want to send this message again since I got no answer yet and I am no
sure if this problem is a bug or a feature.

I just started to use Zend_Form_Element_File with ZF 1.6.0RC2 release.
Adding a file form element and displaying it was no problem at all.
Unfortunately, I have problems with the validation when the file element
is not optional, i.e. not set as required.

Here is an extract of my form definition (array format):

array(
'form' = array(
'action'   = '/employer/edit',
'method'   = 'post',
'name' = 'employer_edit',
'enctype'  = 'multipart/form-data',
[]
'elements' = array(
'employer_id' = array(
'type'= 'hidden',
'options' = array(
'required' = true,
),
),
[...]
'employer_logo' = array(
'type'= 'file',
'options' = array(
'label'   = 'label_employer_logo',
'description' = 'message_employer_logo',
'destination' = '/tmp/upload',
),
),
'submit_employer_edit' = array(
'type'= 'submit',
'options' = array(
'label' = 'action_save',
),
),
),
),
);

When I send this form then the file is not transfered to '/tmp/upload'.
When I set employer_logo to be a required field then the file is
transfered. But I do not want this field to be mandatory.

I had a closer look at Zend_Form_Element_File::isValid() and saw that
$value parameter is always NULL. So when the file element is not
required this if-control is always true and thus ending validation:

   if (!$this-isRequired()  empty($value))

Is this a bug or a feature? Did I miss anything to get Zend_Form working
for non-required file elements?

Thanks and best regards,

Ralf



Re: [fw-general] How to add select=selected in Zend_Form_Element_Multiselect

2008-08-27 Thread Martin Martinov
2008/8/26 vladimirn [EMAIL PROTECTED]:

 Huh, i think you dont understand me :))
 I dont know how to put onClick event in select tag :) I know how to make
 this without zend form, but cant figure it out how to put onClick in
 $listOptions array:)
 I will use CAPS just to point on some lines :) sorry about that :)
 This array build my select tag if i understud well:

  $listOptions = array(
  'first'='first choice',
  'second' ='second choice',
  'third' = 'third choice'
 )
 and then i am building multiselect as:

 $lists = new Zend_Form_SubForm();
$lists-addElements(array(
new Zend_Form_Element_Multiselect('nameOfMultiselect',array(
'label' = 'Select all you can apply',
'required'  =true,
'filters'   =array('StringTrim'),
'multiOptions'  = $listOptions,
'value'   = array('second'), // this one sometimes works and
 sometimes not, i cant figure it out why
'onClick'   ='some javascrpt code here',// THIS IS 
 APPLIED ON SELECT
 TAG INSTEAD ON OPTION TAG :))
'validators'= array(
array('InArray', false, array(array_keys($listOptions)))
)
)),
 And later this will be displayed as bellow

 select name=lists[nameOfMultiselect][] id=lists-nameOfMultiselect
 multiple=multiple onClick=some javascript code here// there is unwanted
 onClick event lol, i want this onClick inside of option tag
option value=first label=first choicefirst choice/option
option value=second label=second choicesecond
 choice/option//THIS ONE SHOULD BE SELECTED, RIGHT? But somehow it is not
 :) Well, sometimes it is selected, but not this time :)
option value=third label=third choicethird choice/option// here
 i need onClick event :)







 Matthew Weier O'Phinney-3 wrote:

 -- vladimirn [EMAIL PROTECTED] wrote
 (on Tuesday, 26 August 2008, 12:23 PM -0700):

 Thanks for the link and for guide lines.
 I thought that something like that should be solution, but i need to
 rephrase my question-
 how to add on click in my array? is there somethin like:
  new Zend_Form_Element_Multiselect('nameOfMultiselect',array(
 'label'  = 'Select all you can apply',
 'required'   =true,
 'filters'=array('StringTrim'),
 'multiOptions'   = $listOptions,
 'value'   = array('eml'),
 'onClick'   = 'DoSomething'// ---

 Yep -- any configuration key that does not correspond to an accessor is
 then set as an object property, and passed as an attribute to the view
 helper.

 and more, how to add this on specific array key/value which i am building
 in
 $listOptions = array(
 'first'='first choice',
 'second' ='second choice',
 'third' = 'third choice',
 'clickOne' = 'I want this one to opena hidden text area :)'
 );

 Again, go to your favorite JS toolkit mailing list or IRC channel. :)


 Matthew Weier O'Phinney-3 wrote:
 
  -- vladimirn [EMAIL PROTECTED] wrote
  (on Tuesday, 26 August 2008, 11:15 AM -0700):
  Well, is there a room to ask another question? or should i open a new
  topic?
  I need to add hidden text area bellow multiselect, and if you select
  third
  choice, this hidden box should appear visible.
  How to set up something like this?
 
  Use javascript to do this. When the page renders, do two things:
 
* hide the element (set the visibility attribute to 'collapse')
 
* connect an event handler to the multiselect option that looks for
  the number of selected options and re-displays the hidden element.
 
  For techniques on this, visit your favorite JS toolkit mailing list or
  IRC channel.
 
  p.s. [off topic] about zend dojo webinar- can u post a link to my mail
 or
  here pls?
 
  Sure:
 
 
 
 http://www.zend.com/en/company/news/event/webinar-zend-framework-and-dojo-integration
 
  --
  Matthew Weier O'Phinney
  Software Architect   | [EMAIL PROTECTED]
  Zend Framework   | http://framework.zend.com/
 
 

 --
 View this message in context:
 http://www.nabble.com/How-to-add-select%3Dselected-in-Zend_Form_Element_Multiselect-and-one-more-question-%3A%29-tp19166233p19168608.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/



 --
 View this message in context: 
 http://www.nabble.com/How-to-add-select%3Dselected-in-Zend_Form_Element_Multiselect-and-one-more-question-%3A%29-tp19166233p19169726.html
 Sent from the Zend Framework mailing list archive at Nabble.com.



 Again, go to your favorite JS toolkit mailing list or IRC channel. :)

Use the onchenge event of your select tag.

-- 
Regards,
Martin Martinov
http://mmartinov.com/


Re: [fw-general] How to add select=selected in Zend_Form_Element_Multiselect

2008-08-27 Thread vladimirn



Martin Martinov-2 wrote:
 
 Use the onchenge event of your select tag.
 
 -- 
 Regards,
 Martin Martinov
 http://mmartinov.com/
 
 
Thanks Martin, but if i use onChange event in select tag, this will show
hidden text area on any change inside multiselect, right? I need to make
text area visible only if user choose third option.
-- 
View this message in context: 
http://www.nabble.com/How-to-add-select%3Dselected-in-Zend_Form_Element_Multiselect-and-one-more-question-%3A%29-tp19166233p19176062.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend Framework 1.6 Release Candidate 3 now available!

2008-08-27 Thread Alexander Veremyev
We couldn't be happier to announce that Zend Framework 1.6 Release
Candidate 3 is now available from the Zend Framework download site!

http://framework.zend.com/download

An overview of new features:

* Dojo Integration
- JSON-RPC Server
- dojo.data Envelopes
- Dojo View Helper
- Dijit integration with Zend_Form  Zend_View
- Dojo Library Distribution
* SOAP
- SOAP Server
- SOAP Client
- Autodiscovery
- WSDL access
- WSDL Generation
* Preview of Tooling Project in Laboratory (see /laboratory folder)
- Command Line Interface
- Project Asset Management
* Unit Testing Harness for Controllers
* Lucene 2.3 Index File Format Support
* Zend_Session save handler for Database Tables
* Paginator Component
* Text/Figlet Support
* ReCaptcha Service
* Captcha Form Element
* Zend_Config_Xml Attribute Support 
* Zend_File_Transfer Component
* File Upload Form Element
* Zend_Wildfire Component with FireBug Log Writer
* Media View Helpers (Flash, Quicktime, Object, and Page)
* Support in Zend_Translate for INI File Format


This obviously marks a very important step towards a high-quality,
highly tested 1.6 GA release. Thanks to everyone who has contributed to
this release in any way: with patches/check ins,
documentation/translations, and bug reports.
But our work is not yet over! Let's do our best to bring this release to
the breaking point to find areas we can improve the release for General
Availability. Based on your feedback we will determine in the next few
weeks whether we require additional release candidates, so please
provide feedback on our issue tracker (http://framework.zend.com/issues)
as soon as you can and ask any questions/post your experiences on the
appropriate mailing list.

Again, the Zend Framework community does NOT recommend this release for
production use. We do, however, recommend evaluating new features in
this release with existing and new applications.

Enjoy 1.6RC3, and see you on the issue tracker, wiki, and mailing lists!

,Alexander



Re: [fw-general] How to add select=selected in Zend_Form_Element_Multiselect

2008-08-27 Thread Martin Martinov
2008/8/27 vladimirn [EMAIL PROTECTED]:



 Martin Martinov-2 wrote:

 Use the onchenge event of your select tag.

 --
 Regards,
 Martin Martinov
 http://mmartinov.com/


 Thanks Martin, but if i use onChange event in select tag, this will show
 hidden text area on any change inside multiselect, right? I need to make
 text area visible only if user choose third option.
 --
 View this message in context: 
 http://www.nabble.com/How-to-add-select%3Dselected-in-Zend_Form_Element_Multiselect-and-one-more-question-%3A%29-tp19166233p19176062.html
 Sent from the Zend Framework mailing list archive at Nabble.com.



Well, you'll just have to count how many options are selected in the
onchange event handler, and show/hide your textarea as appropriate.
This list is really not the place to discuss this thing :-)

-- 
Regards,
Martin Martinov
http://mmartinov.com/


Re: [fw-general] How to add select=selected in Zend_Form_Element_Multiselect

2008-08-27 Thread vladimirn

Well,  ok.
Thanks for your reply.
I still dont understand how to put onClick or some other event inside
option tag which is created by Zend_Form_Element_Multiselect.
I was not asking how to use js. 




Martin Martinov-2 wrote:
 
 2008/8/27 vladimirn [EMAIL PROTECTED]:



 Martin Martinov-2 wrote:

 Use the onchenge event of your select tag.

 --
 Regards,
 Martin Martinov
 http://mmartinov.com/


 Thanks Martin, but if i use onChange event in select tag, this will show
 hidden text area on any change inside multiselect, right? I need to make
 text area visible only if user choose third option.
 --
 View this message in context:
 http://www.nabble.com/How-to-add-select%3Dselected-in-Zend_Form_Element_Multiselect-and-one-more-question-%3A%29-tp19166233p19176062.html
 Sent from the Zend Framework mailing list archive at Nabble.com.


 
 Well, you'll just have to count how many options are selected in the
 onchange event handler, and show/hide your textarea as appropriate.
 This list is really not the place to discuss this thing :-)
 
 -- 
 Regards,
 Martin Martinov
 http://mmartinov.com/
 
 

-- 
View this message in context: 
http://www.nabble.com/How-to-add-select%3Dselected-in-Zend_Form_Element_Multiselect-and-one-more-question-%3A%29-tp19166233p19176713.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] [Zend Form] Conditional SubForms

2008-08-27 Thread Tobias Schifftner

Hello there,

when you look at the picture you see a simple example form. On the first
sight this doesn't look really complicated but when it comes to dynamic
creation I just cannot find a solution.

http://www.nabble.com/file/p19177733/example_form.png 

Ok, I guess the best solution for the date select boxes and the input field
are two subforms. But how can I split a multioption radio button just like
shown on the picture? To complicate matters further, all form configuration
is saved as xml in the database. This means that you cannot define a view
script for displaying the form ($this-formRadio(...)).

Hope someone has an idea or solution...

Thanks in advance.
Tobias


-- 
View this message in context: 
http://www.nabble.com/-Zend-Form--Conditional-SubForms-tp19177733p19177733.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend Layout and _forward

2008-08-27 Thread pvechi

Hi there again,

I am creating the HTML in my application using Zend Layout using a similar
method shown in the Zend documentation.  Here is an extract from the
documentation:

As an example, let's say your code first hits FooController::indexAction(),
which renders some content to the default response segment, and then
forwards to NavController::menuAction(), which renders content to the 'nav'
response segment. Finally, you forward to CommentController::fetchAction()
and fetch some comments, but render those to the default response segment as
well (which appends content to that segment). Your view script could then
render each separately:

from this page:
http://framework.zend.com/manual/en/zend.layout.quickstart.html

I have this view script layout.phtml:

?php echo $this-partial('header.phtml'); ?

?php echo $this-escape($this-title); ?
?php echo $this-layout()-content; ?


?php echo $this-layout()-nav; ?

?php echo $this-partial('footer.phtml'); ?



In my CustomerController I have the following actions:


function indexAction()
{
$this-view-title = Customers;
$customers = new Customers();
$this-view-customers = $customers-fetchAll();
$this-render(null, 'content');
}

This supposedly sends everything to the variable 'content' in my layout
script (above).

I then have this postDispatch in the CustomerController that forwards to the
action to create the navigation menu:

function postDispatch()
{
$this-_forward('menu','navigation');
}

I have created a  NavigationController with a menuAction:

?php
class NavigationController extends Zend_Controller_Action
{
function init()
{
$this-initView();
$this-view-baseUrl = $this-_request-getBaseUrl();
}

function preDispatch()
{
$this-_helper-viewRenderer-setResponseSegment('nav');
}

function menuAction()
{
$this-view-menuTitle = 'Menu title goes here';
}


}

The problem that I am having is that the navigation menu is the only part
that appears on my screen.  The body 'content' which is suppose to show
customer information does not show.

Am I missusing _forward()?  I also looked into the actionstack method but I
have no idea how to implement this within the action controllers.  I looked
for examples too and I still don't get it.

Can anyone provide some direction?

++Tx
P


-- 
View this message in context: 
http://www.nabble.com/Zend-Layout-and-_forward-tp19178382p19178382.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Zend Layout and _forward

2008-08-27 Thread Tobias Schifftner

Normally you should not always forward to an other action. Only if you really
need to do so. Not all the time...

Well, as I can see you use already ?= $this-layout()-content; ?, so all
other $this-view variables will be within that. In your view script
view/scripts/action.phtml you can just use

?= $this-title ?

But this only works when you not forward all the time. Just stay in you
indexAction() function and you can easily use your variables in
view/scripts/index.phtml
-- 
View this message in context: 
http://www.nabble.com/Zend-Layout-and-_forward-tp19178382p19180230.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend Framework 1.6 Release Candidate 3 now available!

2008-08-27 Thread SWilk

Hi,

Alexander Veremyev wrote:

We couldn't be happier to announce that Zend Framework 1.6 Release
Candidate 3 is now available from the Zend Framework download site!

http://framework.zend.com/download


[...]


I think that someone forgot (or did not have enough time) to change 
the info at http://framework.zend.com/ main page.


There is still link to RC1 version in Get Started section:
Zend Framework 1.6 Release Candidate 1 now available!


P.S. Thank you ZF Developers! Great Work!

--
Regards,
Szymon Wilkołazki


Re: [fw-general] [Zend Form] Conditional SubForms

2008-08-27 Thread Bart McLeod
Have you considered using CSS to fake the split? Or you can use separate 
single radio buttons and use javascript to toggle them (yek).
Or have the radios inline and toglle the elements beneath them, 
depending on the users' choice...
In fact, there are so many ways to solve this problem, just by designing 
your UI differently.


Regards,

Bart McLeod

Tobias Schifftner schreef:

Hello there,

when you look at the picture you see a simple example form. On the first
sight this doesn't look really complicated but when it comes to dynamic
creation I just cannot find a solution.

http://www.nabble.com/file/p19177733/example_form.png 


Ok, I guess the best solution for the date select boxes and the input field
are two subforms. But how can I split a multioption radio button just like
shown on the picture? To complicate matters further, all form configuration
is saved as xml in the database. This means that you cannot define a view
script for displaying the form ($this-formRadio(...)).

Hope someone has an idea or solution...

Thanks in advance.
Tobias


  


[fw-general] subforms question

2008-08-27 Thread Bart McLeod

Hi all,

I have been on a long vacation. So after six weeks I have updated my ZF 
library from svn, and guess what: subforms processing in my application 
is broken now. Anyone knows of any changed functionality: naming of 
elements for example? Because the number of subforms is dynamic, I have 
to check for their names in $_POST to see if there are any to process.


There are no errors whatsoever, they just don't get processed.

Regards,

Bart McLeod


Re: [fw-general] subforms question

2008-08-27 Thread Bart McLeod

To be more specific:
   if($subform-isValid($_POST[$formname])){
   if($this-validateSubform($subform, $code, 
'processTranslation')){

   $changed = true;
   }
   }else{
   //this part should not be needed
   echo subform is invalid.. print_r($_POST, true);
   }
The subform does not validate. The version that is in production does. 
With a version of ZF standard/trunk that is about six weeks older than 
my current version.


Anyone?

Bart McLeod schreef:

Hi all,

I have been on a long vacation. So after six weeks I have updated my 
ZF library from svn, and guess what: subforms processing in my 
application is broken now. Anyone knows of any changed functionality: 
naming of elements for example? Because the number of subforms is 
dynamic, I have to check for their names in $_POST to see if there are 
any to process.


There are no errors whatsoever, they just don't get processed.

Regards,

Bart McLeod



Re: [fw-general] subforms question

2008-08-27 Thread Bart McLeod
The subform only contains two elements that require no validation 
whatsoever, they are not even required. Even if completely empty, the 
form should validate...



Bart McLeod schreef:

To be more specific:
   if($subform-isValid($_POST[$formname])){
   if($this-validateSubform($subform, $code, 
'processTranslation')){

   $changed = true;
   }
   }else{
   //this part should not be needed
   echo subform is invalid.. print_r($_POST, true);
   }
The subform does not validate. The version that is in production does. 
With a version of ZF standard/trunk that is about six weeks older than 
my current version.


Anyone?

Bart McLeod schreef:

Hi all,

I have been on a long vacation. So after six weeks I have updated my 
ZF library from svn, and guess what: subforms processing in my 
application is broken now. Anyone knows of any changed functionality: 
naming of elements for example? Because the number of subforms is 
dynamic, I have to check for their names in $_POST to see if there 
are any to process.


There are no errors whatsoever, they just don't get processed.

Regards,

Bart McLeod





[fw-general] Acl and User Group/content restriction

2008-08-27 Thread rgesse

Hello,

I'm a ZF newb and I've been architecting a new project for my company with
the Zend Framework in mind. I've got Zend_Auth and Zend_Acl under control
and working appropriately.

However, the next issue that I have is that I want to limit a user not just
by role (Zend_Acl), but also by a particular group(s) that a user has been
assigned. e.g. product, region, customer type, business unit, etc.

I'll give an example: 

 - Say we have a role of Content Admin.
 
 - User A and User B are both assigned the Content Admin role, so can see
exactly the same modules, resources, and have the same permissions.
 
 - However, I want to limit individual pieces of content that User A and
User B can administer, based on the fact that they are assigned to different
groups (products and business units).
 
 - For example, User A can only administer content for Product C assigned to
Business Unit E, and User B can only administer Product D assigned to
Business Unit E.
 
 - Another example: User A can administer content for Business Unit A and B,
while User B can only administer content in Business Unit C.

Hopefully that makes sense...

I was assuming that there would be some sort of philosophical Zend approach
to do this type of content/group filtering/restriction. So I did a lot of
poking around the ZF site, forums and personal blogs, but I wasn't able to
find anything concrete(as far as I understood) that details a ZF method of
doing this. I feel confident I can create something from scratch over time,
but would like to avoid re-inventing the wheel. 

As an aside, I think that I'm going to try digging into the Zend_Acl
advanced assertions section to see what I come up with. I may be able to get
something working from that.

Any ideas/help would be greatly appreciated.

Thanks
-- 
View this message in context: 
http://www.nabble.com/Acl-and-User-Group-content-restriction-tp19181300p19181300.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Rest_Server and Zend_Rest_Client error

2008-08-27 Thread Marco
HI Matthew

We have just come across the same issue.. it appears only when using a Rest
call with a single parameter. For example

/**
 * Say Hello
 *
 * @param string $who
 * @return string
 */
function sayHello($who)
{
return Hello $who, Good Day;
}

doesn't work whilst

/**
 * Say Hello
 *
 * @param string $who
 * @param string $day
  * @return string
 */
function sayHello2($who, $day)
{
return Hello $who, Good $day;
}

does work.

I've done some tracing and have narrowed it down to the client class.
Applying the following change

Index: Rest/Client.php
===
--- Rest/Client.php(revision 11081)
+++ Rest/Client.php(working copy)
@@ -237,7 +237,7 @@
 } else {
 // More than one arg means it's definitely a Zend_Rest_Server
 if (sizeof($args) == 1) {
-$this-_data[$method] = $args[0];
+$this-_data['method'] = $method;
 $this-_data['arg1']  = $args[0];
 } else {
 $this-_data['method'] = $method;


Seems to get it working again but i'm unsure if this will break anything
else. If you could confirm I will raise a bug in the issue tracker and will
submit a patch

Regards

Marco


Re: [fw-general] Zend Framework 1.6 Release Candidate 3 now available!

2008-08-27 Thread Matthew Weier O'Phinney
-- SWilk [EMAIL PROTECTED] wrote
(on Wednesday, 27 August 2008, 03:10 PM +0200):
 Alexander Veremyev wrote:
 We couldn't be happier to announce that Zend Framework 1.6 Release
 Candidate 3 is now available from the Zend Framework download site!

 http://framework.zend.com/download

 [...]


 I think that someone forgot (or did not have enough time) to change the 
 info at http://framework.zend.com/ main page.

 There is still link to RC1 version in Get Started section:
 Zend Framework 1.6 Release Candidate 1 now available!

Cal released an article on devzone for the RC1 release, but we have not
posted one for the additional RCs -- that's why it's not showing the RC2
and RC3 releases.

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


Re: [fw-general] subforms question

2008-08-27 Thread Matthew Weier O'Phinney
-- Bart McLeod [EMAIL PROTECTED] wrote
(on Wednesday, 27 August 2008, 03:36 PM +0200):
 To be more specific:
if($subform-isValid($_POST[$formname])){
if($this-validateSubform($subform, $code,  
 'processTranslation')){
$changed = true;
}
}else{
//this part should not be needed
echo subform is invalid.. print_r($_POST, true);
}
 The subform does not validate. The version that is in production does.  
 With a version of ZF standard/trunk that is about six weeks older than  
 my current version.

 Anyone?

Can you send me the form and some sample data to try and validate? Hard
to know what changed, and I'd like to find out.

There were two primary changes to forms for 1.5.3 and 1.6.0:

 * Implemented lazy-loading of plugins. This shouldn't affect what
   you're observing, however.
 * Fixes to how array notation with subforms works. This _may_ affect
   what you're observing; if so, it's likely you were working around the
   issues, and I may be able to present a fix.


 Bart McLeod schreef:
 Hi all,

 I have been on a long vacation. So after six weeks I have updated my  
 ZF library from svn, and guess what: subforms processing in my  
 application is broken now. Anyone knows of any changed functionality:  
 naming of elements for example? Because the number of subforms is  
 dynamic, I have to check for their names in $_POST to see if there are  
 any to process.

 There are no errors whatsoever, they just don't get processed.

 Regards,

 Bart McLeod



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


Re: [fw-general] Can't get Zend_Paginator to work with Zend_DB_Select

2008-08-27 Thread Peter Wansch

Problem solved:

  td?= $item['transaction_name']; ?/td

properly prints the transaction names as wanted.
-- 
View this message in context: 
http://www.nabble.com/Can%27t-get-Zend_Paginator-to-work-with-Zend_DB_Select-tp19175496p19182068.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Acl and User Group/content restriction

2008-08-27 Thread Matthew Weier O'Phinney
-- rgesse [EMAIL PROTECTED] wrote
(on Wednesday, 27 August 2008, 06:46 AM -0700):
 I'm a ZF newb and I've been architecting a new project for my company with
 the Zend Framework in mind. I've got Zend_Auth and Zend_Acl under control
 and working appropriately.
 
 However, the next issue that I have is that I want to limit a user not just
 by role (Zend_Acl), but also by a particular group(s) that a user has been
 assigned. e.g. product, region, customer type, business unit, etc.

A group *is* a role. 

 
 I'll give an example: 
 
  - Say we have a role of Content Admin.
  
  - User A and User B are both assigned the Content Admin role, so can see
 exactly the same modules, resources, and have the same permissions.
  
  - However, I want to limit individual pieces of content that User A and
 User B can administer, based on the fact that they are assigned to different
 groups (products and business units).
  
  - For example, User A can only administer content for Product C assigned to
 Business Unit E, and User B can only administer Product D assigned to
 Business Unit E.
  
  - Another example: User A can administer content for Business Unit A and B,
 while User B can only administer content in Business Unit C.

I'd create roles for the products and business units, and assign these
roles to the users.


 Hopefully that makes sense...
 
 I was assuming that there would be some sort of philosophical Zend approach
 to do this type of content/group filtering/restriction. So I did a lot of
 poking around the ZF site, forums and personal blogs, but I wasn't able to
 find anything concrete(as far as I understood) that details a ZF method of
 doing this. I feel confident I can create something from scratch over time,
 but would like to avoid re-inventing the wheel. 
 
 As an aside, I think that I'm going to try digging into the Zend_Acl
 advanced assertions section to see what I come up with. I may be able to get
 something working from that.
 
 Any ideas/help would be greatly appreciated.

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


Re: [fw-general] Zend_Rest_Server and Zend_Rest_Client error

2008-08-27 Thread Matthew Weier O'Phinney
-- Marco [EMAIL PROTECTED] wrote
(on Wednesday, 27 August 2008, 04:03 PM +0200):
 We have just come across the same issue.. it appears only when using a Rest
 call with a single parameter. For example
 
 /**
  * Say Hello
  *
  * @param string $who
  * @return string
  */
 function sayHello($who)
 {
 return Hello $who, Good Day;
 }
 
 doesn't work whilst
 
 /**
  * Say Hello
  *
  * @param string $who
  * @param string $day
   * @return string
  */
 function sayHello2($who, $day)
 {
 return Hello $who, Good $day;
 }
 
 does work.
 
 I've done some tracing and have narrowed it down to the client class. Applying
 the following change
 
 Index: Rest/Client.php
 ===
 --- Rest/Client.php(revision 11081)
 +++ Rest/Client.php(working copy)
 @@ -237,7 +237,7 @@
  } else {
  // More than one arg means it's definitely a Zend_Rest_Server
  if (sizeof($args) == 1) {
 -$this-_data[$method] = $args[0];
 +$this-_data['method'] = $method;
  $this-_data['arg1']  = $args[0];
  } else {
  $this-_data['method'] = $method;
 
 
 Seems to get it working again but i'm unsure if this will break anything else.
 If you could confirm I will raise a bug in the issue tracker and will submit a
 patch

Yes -- please create the issue and post the patch.

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


Re: [fw-general] [Zend Form] Conditional SubForms

2008-08-27 Thread Tobias Schifftner

Hello Bart,

thanks for your answer. CSS would be an option if it would be just one form.
But there are many different ones and not yet known forms (that was just an
example case). JS is not an option. Means, that if someone has disabled JS
the form must still work. 

May be you've got a PHP idea? :-)

Thx,
Tobias
-- 
View this message in context: 
http://www.nabble.com/-Zend-Form--Conditional-SubForms-tp19177733p19182106.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] subforms question

2008-08-27 Thread Bart McLeod

* Fixes to how array notation with subforms works. This _may_ affect
  what you're observing; if so, it's likely you were working around the
  issues, and I may be able to present a fix.

This is likely to be the cause of the problem! So far I found the form 
validates with $_POST as is, BUT it does not get populated with the 
correct values.


This is the form:
class SubFormTranslation extends CmsSubForm {

   public function init(){
   parent::init();
   //translation field
   $translation = new Zend_Form_Element_Text('translation');
   $translation-setLabel('translation')-setAttrib('class', 
'_450');

   $this-addElement($translation);

   //language_id field
   $language_id = new Zend_Form_Element_Select('language_id');
   $language_id-setLabel('language');
   /*I do not set required here becuase it complicates reducing 
the options
   * upon reload the validator will mourn if a language_id is 
absent

   * while it is nothing to worry about
   * */
   $this-addElement($language_id);
   parent::postInit();
   }
  


   public function render(Zend_View_Interface $view =  null){
   if($lang = $this-language_id-getValue()){
   $decorator = new ReadOnlyDecorator();
   
$decorator-setDisplayValue(Globals::getDago()-getLanguageName($lang));

   $this-language_id-addDecorator(array('div' = $decorator));
   }
   $this-setRemovalScript(__CLASS__);
   return parent::render($view);
   }

}
The elements that get added in init are the only two elements, except 
for a removal button that is added in the ancestor CmsSubForm.
Nothing is required, yet it does not validate if given an array. Should 
the array have the indexes in the format: formname-fieldname? I am 
currently feeding them as fielname.


Sample data:
language_id: de
translation: something

Sample post data:
array('subform_translation1' = array('language_id' = 'de', 
'translation' = 'something'));


Expected outcome:
true === $subform-isValid($sample_post_data['subform_translation1']);
Real life outcome:
false === $subform-isValid($sample_post_data['subform_translation1']);

Hope this helps you in finding the answer that I am overlooking!

Regards,

Bart McLeod

Matthew Weier O'Phinney schreef:

-- Bart McLeod [EMAIL PROTECTED] wrote
(on Wednesday, 27 August 2008, 03:36 PM +0200):
  

To be more specific:
   if($subform-isValid($_POST[$formname])){
   if($this-validateSubform($subform, $code,  
'processTranslation')){

   $changed = true;
   }
   }else{
   //this part should not be needed
   echo subform is invalid.. print_r($_POST, true);
   }
The subform does not validate. The version that is in production does.  
With a version of ZF standard/trunk that is about six weeks older than  
my current version.


Anyone?



Can you send me the form and some sample data to try and validate? Hard
to know what changed, and I'd like to find out.

There were two primary changes to forms for 1.5.3 and 1.6.0:

 * Implemented lazy-loading of plugins. This shouldn't affect what
   you're observing, however.
 * Fixes to how array notation with subforms works. This _may_ affect
   what you're observing; if so, it's likely you were working around the
   issues, and I may be able to present a fix.


  

Bart McLeod schreef:


Hi all,

I have been on a long vacation. So after six weeks I have updated my  
ZF library from svn, and guess what: subforms processing in my  
application is broken now. Anyone knows of any changed functionality:  
naming of elements for example? Because the number of subforms is  
dynamic, I have to check for their names in $_POST to see if there are  
any to process.


There are no errors whatsoever, they just don't get processed.

Regards,

Bart McLeod

  


  


Re: [fw-general] subforms question

2008-08-27 Thread Bart McLeod
I printed the results of validation to the screen and I get this 
remarkable outcome:

save : opslaan - valid
delete : - valid
code : bedrijfsinfo - valid
sequence_number : 10 - valid
in_mainmenu : 1 - valid
begin : 27-08-2008 - valid
end : 31-12- - valid
number_of_childbranches : 1 - valid
number_of_parentbranches : 1 - valid
number_of_translations : 1 - valid
translation : bedrijfsinfooo - valid
language_id : DEU - valid
remove : - valid
branch_id : - valid
subcode : - valid
sub_sequence_number : 1 - valid
remove : - valid
branch_id : - valid
maincode : - valid
sub_sequence_number : 1 - valid
remove : - valid
translation : bedrijfsinfooo - valid
language_id : DEU - INVALID
remove : - INVALID

The last time a subform is checked, it is invalid, while with the same 
values, it is valid if checked in the form as a whole. Something very 
strange is happening.

I will try removing the validation check for now.

Bart

Bart McLeod schreef:

 * Fixes to how array notation with subforms works. This _may_ affect
   what you're observing; if so, it's likely you were working around the
   issues, and I may be able to present a fix.
This is likely to be the cause of the problem! So far I found the form 
validates with $_POST as is, BUT it does not get populated with the 
correct values.


This is the form:
class SubFormTranslation extends CmsSubForm {

public function init(){
parent::init();
//translation field
$translation = new Zend_Form_Element_Text('translation');
$translation-setLabel('translation')-setAttrib('class', 
'_450');

$this-addElement($translation);

//language_id field
$language_id = new Zend_Form_Element_Select('language_id');
$language_id-setLabel('language');
/*I do not set required here becuase it complicates 
reducing the options
* upon reload the validator will mourn if a language_id is 
absent

* while it is nothing to worry about
* */
$this-addElement($language_id);
parent::postInit();
}
   


public function render(Zend_View_Interface $view =  null){
if($lang = $this-language_id-getValue()){
$decorator = new ReadOnlyDecorator();

$decorator-setDisplayValue(Globals::getDago()-getLanguageName($lang));

$this-language_id-addDecorator(array('div' = $decorator));
}
$this-setRemovalScript(__CLASS__);
return parent::render($view);
}

}
The elements that get added in init are the only two elements, except 
for a removal button that is added in the ancestor CmsSubForm.
Nothing is required, yet it does not validate if given an array. 
Should the array have the indexes in the format: formname-fieldname? I 
am currently feeding them as fielname.


Sample data:
language_id: de
translation: something

Sample post data:
array('subform_translation1' = array('language_id' = 'de', 
'translation' = 'something'));


Expected outcome:
true === $subform-isValid($sample_post_data['subform_translation1']);
Real life outcome:
false === $subform-isValid($sample_post_data['subform_translation1']);

Hope this helps you in finding the answer that I am overlooking!

Regards,

Bart McLeod

Matthew Weier O'Phinney schreef:

-- Bart McLeod [EMAIL PROTECTED] wrote
(on Wednesday, 27 August 2008, 03:36 PM +0200):
  

To be more specific:
   if($subform-isValid($_POST[$formname])){
   if($this-validateSubform($subform, $code,  
'processTranslation')){

   $changed = true;
   }
   }else{
   //this part should not be needed
   echo subform is invalid.. print_r($_POST, true);
   }
The subform does not validate. The version that is in production does.  
With a version of ZF standard/trunk that is about six weeks older than  
my current version.


Anyone?



Can you send me the form and some sample data to try and validate? Hard
to know what changed, and I'd like to find out.

There were two primary changes to forms for 1.5.3 and 1.6.0:

 * Implemented lazy-loading of plugins. This shouldn't affect what
   you're observing, however.
 * Fixes to how array notation with subforms works. This _may_ affect
   what you're observing; if so, it's likely you were working around the
   issues, and I may be able to present a fix.


  

Bart McLeod schreef:


Hi all,

I have been on a long vacation. So after six weeks I have updated my  
ZF library from svn, and guess what: subforms processing in my  
application is broken now. Anyone knows of any changed functionality:  
naming of elements for example? Because the number of subforms is  
dynamic, I have to check for their names in $_POST to see if there are  
any to process.


There are no errors whatsoever, they just don't get processed.

Regards,

Bart McLeod

  


  


Re: [fw-general] Zend_Rest_Server and Zend_Rest_Client error

2008-08-27 Thread Marco
Hi Matthew


 Yes -- please create the issue and post the patch.


Bug and patch can be found at
http://framework.zend.com/issues/browse/ZF-4089

Regards

Marco


Re: [fw-general] subforms question

2008-08-27 Thread Bart McLeod
I think I found a clue. The select elements seem to have gotten an 
in_array validator! it does never validate, since the options aren't 
added until very late, because lesser options are added as more of them 
are already in use.
So this validator, however nice, has killed my subform processing. I can 
probably remove the validator or do not check and just populate the 
subform, since I am not checking it anyway. Or add all of the options, 
just for validations sake, which will be the best option I guess.


So, problem solved, beware!

Regards,

Bart McLeod

Bart McLeod schreef:
I printed the results of validation to the screen and I get this 
remarkable outcome:

save : opslaan - valid
delete : - valid
code : bedrijfsinfo - valid
sequence_number : 10 - valid
in_mainmenu : 1 - valid
begin : 27-08-2008 - valid
end : 31-12- - valid
number_of_childbranches : 1 - valid
number_of_parentbranches : 1 - valid
number_of_translations : 1 - valid
translation : bedrijfsinfooo - valid
language_id : DEU - valid
remove : - valid
branch_id : - valid
subcode : - valid
sub_sequence_number : 1 - valid
remove : - valid
branch_id : - valid
maincode : - valid
sub_sequence_number : 1 - valid
remove : - valid
translation : bedrijfsinfooo - valid
language_id : DEU - INVALID
remove : - INVALID

The last time a subform is checked, it is invalid, while with the same 
values, it is valid if checked in the form as a whole. Something very 
strange is happening.

I will try removing the validation check for now.

Bart

Bart McLeod schreef:

 * Fixes to how array notation with subforms works. This _may_ affect
   what you're observing; if so, it's likely you were working around the
   issues, and I may be able to present a fix.
This is likely to be the cause of the problem! So far I found the 
form validates with $_POST as is, BUT it does not get populated with 
the correct values.


This is the form:
class SubFormTranslation extends CmsSubForm {

public function init(){
parent::init();
//translation field
$translation = new Zend_Form_Element_Text('translation');
$translation-setLabel('translation')-setAttrib('class', 
'_450');

$this-addElement($translation);

//language_id field
$language_id = new Zend_Form_Element_Select('language_id');
$language_id-setLabel('language');
/*I do not set required here becuase it complicates 
reducing the options
* upon reload the validator will mourn if a language_id 
is absent

* while it is nothing to worry about
* */
$this-addElement($language_id);
parent::postInit();
}
   


public function render(Zend_View_Interface $view =  null){
if($lang = $this-language_id-getValue()){
$decorator = new ReadOnlyDecorator();

$decorator-setDisplayValue(Globals::getDago()-getLanguageName($lang));

$this-language_id-addDecorator(array('div' = $decorator));
}
$this-setRemovalScript(__CLASS__);
return parent::render($view);
}

}
The elements that get added in init are the only two elements, except 
for a removal button that is added in the ancestor CmsSubForm.
Nothing is required, yet it does not validate if given an array. 
Should the array have the indexes in the format: formname-fieldname? 
I am currently feeding them as fielname.


Sample data:
language_id: de
translation: something

Sample post data:
array('subform_translation1' = array('language_id' = 'de', 
'translation' = 'something'));


Expected outcome:
true === $subform-isValid($sample_post_data['subform_translation1']);
Real life outcome:
false === $subform-isValid($sample_post_data['subform_translation1']);

Hope this helps you in finding the answer that I am overlooking!

Regards,

Bart McLeod

Matthew Weier O'Phinney schreef:

-- Bart McLeod [EMAIL PROTECTED] wrote
(on Wednesday, 27 August 2008, 03:36 PM +0200):
  

To be more specific:
   if($subform-isValid($_POST[$formname])){
   if($this-validateSubform($subform, $code,  
'processTranslation')){

   $changed = true;
   }
   }else{
   //this part should not be needed
   echo subform is invalid.. print_r($_POST, true);
   }
The subform does not validate. The version that is in production does.  
With a version of ZF standard/trunk that is about six weeks older than  
my current version.


Anyone?



Can you send me the form and some sample data to try and validate? Hard
to know what changed, and I'd like to find out.

There were two primary changes to forms for 1.5.3 and 1.6.0:

 * Implemented lazy-loading of plugins. This shouldn't affect what
   you're observing, however.
 * Fixes to how array notation with subforms works. This _may_ affect
   what you're observing; if so, it's likely you were working around the
   issues, 

[fw-general] Zend AMF + Cache

2008-08-27 Thread Josh Team
One of the challenges I have had in the past is using remoting (AMF) and
still utilizing the caching layer. I could put the caching in the handled
service, but would like to somehow cache the binary response. Has anyone
used AMF, plan on using Zend AMF + caching?
Thanks!


Re: [fw-general] subforms question

2008-08-27 Thread Matthew Weier O'Phinney
-- Bart McLeod [EMAIL PROTECTED] wrote
(on Wednesday, 27 August 2008, 05:32 PM +0200):
 I think I found a clue. The select elements seem to have gotten an in_array
 validator! it does never validate, since the options aren't added until very
 late, because lesser options are added as more of them are already in use.
 So this validator, however nice, has killed my subform processing. I can
 probably remove the validator or do not check and just populate the subform,
 since I am not checking it anyway. Or add all of the options, just for
 validations sake, which will be the best option I guess.
 
 So, problem solved, beware!

You can also disable loading this validator:

   $element-setRegisterInArrayValidator(false);
   // Or, pass a boolean false value to the 'registerInArrayValidator'
   // option when instantiating.

BTW, this validator is added by default for all elements deriving from the
Multi base class -- which includes Select, Multiselect, MultiCheckbox,
and Radio. The idea was to make it simpler to register these --
typically you'll use the inArray validator with the exact same options
you pass in.

 Bart McLeod schreef:
 
 I printed the results of validation to the screen and I get this 
 remarkable
 outcome:
 save : opslaan - valid
 delete : - valid
 code : bedrijfsinfo - valid
 sequence_number : 10 - valid
 in_mainmenu : 1 - valid
 begin : 27-08-2008 - valid
 end : 31-12- - valid
 number_of_childbranches : 1 - valid
 number_of_parentbranches : 1 - valid
 number_of_translations : 1 - valid
 translation : bedrijfsinfooo - valid
 language_id : DEU - valid
 remove : - valid
 branch_id : - valid
 subcode : - valid
 sub_sequence_number : 1 - valid
 remove : - valid
 branch_id : - valid
 maincode : - valid
 sub_sequence_number : 1 - valid
 remove : - valid
 translation : bedrijfsinfooo - valid
 language_id : DEU - INVALID
 remove : - INVALID
 
 The last time a subform is checked, it is invalid, while with the same
 values, it is valid if checked in the form as a whole. Something very
 strange is happening.
 I will try removing the validation check for now.
 
 Bart
 
 Bart McLeod schreef:
 
  * Fixes to how array notation with subforms works. This _may_ affect
what you're observing; if so, it's likely you were working around 
 the
issues, and I may be able to present a fix.
 
 This is likely to be the cause of the problem! So far I found the form
 validates with $_POST as is, BUT it does not get populated with the
 correct values.
 
 This is the form:
 class SubFormTranslation extends CmsSubForm {
 
 public function init(){
 parent::init();
 //translation field
 $translation = new Zend_Form_Element_Text('translation');
 $translation-setLabel('translation')-setAttrib('class',
 '_450');
 $this-addElement($translation);
 
 //language_id field
 $language_id = new 
 Zend_Form_Element_Select('language_id');
 $language_id-setLabel('language');
 /*I do not set required here becuase it complicates
 reducing the options
 * upon reload the validator will mourn if a language_id is
 absent
 * while it is nothing to worry about
 * */
 $this-addElement($language_id);
 parent::postInit();
 }

 
 public function render(Zend_View_Interface $view =  null){
 if($lang = $this-language_id-getValue()){
 $decorator = new ReadOnlyDecorator();
 $decorator-setDisplayValue(Globals::getDago()-
 getLanguageName($lang));
 $this-language_id-addDecorator(array('div' =
 $decorator));
 }
 $this-setRemovalScript(__CLASS__);
 return parent::render($view);
 }
 
 }
 The elements that get added in init are the only two elements, except
 for a removal button that is added in the ancestor CmsSubForm.
 Nothing is required, yet it does not validate if given an array. 
 Should
 the array have the indexes in the format: formname-fieldname? I am
 currently feeding them as fielname.
 
 Sample data:
 language_id: de
 translation: something
 
 Sample post data:
 array('subform_translation1' = array('language_id' = 'de',
 'translation' = 'something'));
 
 Expected outcome:
 true === $subform-isValid($sample_post_data['subform_translation1']);
 Real life outcome:
 false === 
 

RE: [fw-general] Zend Framework 1.6 Release Candidate 3 now available!

2008-08-27 Thread Wil Sinclair
Thanks for reminding me. Those links are actually pulled from Dev Zone 
(http://devzone.zend.com/public/view), and I haven't posted an announcement 
there yet.
So now you all know how to get on the homepage of framework.zend.com: write a 
great Dev Zone article about ZF!

,Wil

 -Original Message-
 From: SWilk [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 27, 2008 6:11 AM
 To: fw-general@lists.zend.com
 Subject: Re: [fw-general] Zend Framework 1.6 Release Candidate 3 now
 available!
 
 Hi,
 
 Alexander Veremyev wrote:
  We couldn't be happier to announce that Zend Framework 1.6 Release
  Candidate 3 is now available from the Zend Framework download site!
 
  http://framework.zend.com/download
 
 [...]
 
 
 I think that someone forgot (or did not have enough time) to change
 the info at http://framework.zend.com/ main page.
 
 There is still link to RC1 version in Get Started section:
 Zend Framework 1.6 Release Candidate 1 now available!
 
 
 P.S. Thank you ZF Developers! Great Work!
 
 --
 Regards,
 Szymon Wilkołazki


[fw-general] $this-getRequest()-isPost() vs. ($_SERVER['REQUEST_METHOD'] == 'POST')

2008-08-27 Thread HMunroe

I just read this 
http://weierophinney.net/matthew/archives/184-Speaking-at-ZendCon-2008.html
blog post  from Matthew, and saw the link to the QuickStart:

*  http://framework.zend.com/wiki/display/ZFDEV/Official+ZF+QuickStart
http://framework.zend.com/wiki/display/ZFDEV/Official+ZF+QuickStart 

I found something that I find disturbing. In the form handler, I saw this:

if ($this-getRequest()-isPost()) {...

(this is in the 
http://framework.zend.com/wiki/display/ZFDEV/Official+ZF+QuickStart#OfficialZFQuickStart-BuildaForm
Build a Form  section)

Isn't this a little too overcomplicated ? I also like the well-arranged and
tidy OOP syntax, but this seems too much for me. I don't mean to criticize,
but I want to figure out what's the logic behind a line of code like that.
What would justify the extra cycles for stacking the function calls, and
passing the request object, against plain old equals check , like:

if ($_SERVER['REQUEST_METHOD'] == 'POST') { ...

I understand that there are a lot of ways to do a job, but in this case this
doesn't seem like a best practice to me.

What do you think ?
-- 
View this message in context: 
http://www.nabble.com/%24this-%3EgetRequest%28%29-%3EisPost%28%29-vs.-%28%24_SERVER-%27REQUEST_METHOD%27--%3D%3D-%27POST%27%29-tp19185079p19185079.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] $this-getRequest()-isPost() vs. ($_SERVER['REQUEST_METHOD'] == 'POST')

2008-08-27 Thread Matthew Weier O'Phinney
-- HMunroe [EMAIL PROTECTED] wrote
(on Wednesday, 27 August 2008, 09:53 AM -0700):
 I just read this 
 http://weierophinney.net/matthew/archives/184-Speaking-at-ZendCon-2008.html
 blog post  from Matthew, and saw the link to the QuickStart:
 
 *  http://framework.zend.com/wiki/display/ZFDEV/Official+ZF+QuickStart
 http://framework.zend.com/wiki/display/ZFDEV/Official+ZF+QuickStart 
 
 I found something that I find disturbing. In the form handler, I saw this:
 
 if ($this-getRequest()-isPost()) {...
 
 (this is in the 
 http://framework.zend.com/wiki/display/ZFDEV/Official+ZF+QuickStart#OfficialZFQuickStart-BuildaForm
 Build a Form  section)
 
 Isn't this a little too overcomplicated ? I also like the well-arranged and
 tidy OOP syntax, but this seems too much for me. I don't mean to criticize,
 but I want to figure out what's the logic behind a line of code like that.
 What would justify the extra cycles for stacking the function calls, and
 passing the request object, against plain old equals check , like:
 
 if ($_SERVER['REQUEST_METHOD'] == 'POST') { ...
 
 I understand that there are a lot of ways to do a job, but in this case this
 doesn't seem like a best practice to me.
 
 What do you think ?

A couple of things.

First, despite it's verbosity, the ZF line is shorter than the one you
suggest. :)

Now, snarkiness aside, there are some good reasons behind this.

Sometimes the obvious and simple solutions simply are not portable, or
would circumvent custom logic the developer may need to utilize.

So, let's look at the examples above.

First, you _can_ use the $_request property directly. However, if you
ever modify getRequest() in your class or in a custom base controller
class, then you may be accessing the wrong property or overriding
necessary business logic. For this reason, we recommend using
getRequest() to grab the request object. (This is good OOP practice,
btw.)

Next, using isPost() is more portable than using
$_SERVER['REQUEST_METHOD']. The reasons are that your web server may or
may not populate this environment variable, and for testing. With
testing, we allow you to specifically set the request method -- $_SERVER
is never modified in this case. This gives you the ability to test your
applications without needing a web server involved.

Hope this answers your questions.

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


Re: [fw-general] subforms question

2008-08-27 Thread Bart McLeod



Matthew Weier O'Phinney schreef:

-- Bart McLeod [EMAIL PROTECTED] wrote
(on Wednesday, 27 August 2008, 05:32 PM +0200):
  

I think I found a clue. The select elements seem to have gotten an in_array
validator! it does never validate, since the options aren't added until very
late, because lesser options are added as more of them are already in use.
So this validator, however nice, has killed my subform processing. I can
probably remove the validator or do not check and just populate the subform,
since I am not checking it anyway. Or add all of the options, just for
validations sake, which will be the best option I guess.

So, problem solved, beware!



You can also disable loading this validator:

   $element-setRegisterInArrayValidator(false);
   // Or, pass a boolean false value to the 'registerInArrayValidator'
   // option when instantiating.

BTW, this validator is added by default for all elements deriving from the
Multi base class -- which includes Select, Multiselect, MultiCheckbox,
and Radio. The idea was to make it simpler to register these --
typically you'll use the inArray validator with the exact same options
you pass in.

  
I like the idea. It is actually quite good. I just hoped to save on 
performance by not adding all the options for all of the subforms from 
the start, since most of them won't be used anyway, but I think the 
benefit of automatic validation outweighs the benefit of a little extra 
performance. I will be in need of an opcode cache anyway. I could also 
inverse the approach and use a hidden element a the start and only 
replace it with a select if one is really being used. For now, I hapily 
take the benefit of the automatic white list validation.


Regards,

Bart McLeod

Bart McLeod schreef:

I printed the results of validation to the screen and I get this remarkable
outcome:
save : opslaan - valid
delete : - valid
code : bedrijfsinfo - valid
sequence_number : 10 - valid
in_mainmenu : 1 - valid
begin : 27-08-2008 - valid
end : 31-12- - valid
number_of_childbranches : 1 - valid
number_of_parentbranches : 1 - valid
number_of_translations : 1 - valid
translation : bedrijfsinfooo - valid
language_id : DEU - valid
remove : - valid
branch_id : - valid
subcode : - valid
sub_sequence_number : 1 - valid
remove : - valid
branch_id : - valid
maincode : - valid
sub_sequence_number : 1 - valid
remove : - valid
translation : bedrijfsinfooo - valid
language_id : DEU - INVALID
remove : - INVALID

The last time a subform is checked, it is invalid, while with the same
values, it is valid if checked in the form as a whole. Something very
strange is happening.
I will try removing the validation check for now.

Bart

Bart McLeod schreef:

 * Fixes to how array notation with subforms works. This _may_ affect
   what you're observing; if so, it's likely you were working around the
   issues, and I may be able to present a fix.

This is likely to be the cause of the problem! So far I found the form
validates with $_POST as is, BUT it does not get populated with the
correct values.

This is the form:
class SubFormTranslation extends CmsSubForm {

public function init(){
parent::init();
//translation field
$translation = new Zend_Form_Element_Text('translation');
$translation-setLabel('translation')-setAttrib('class',
'_450');
$this-addElement($translation);

//language_id field
$language_id = new Zend_Form_Element_Select('language_id');
$language_id-setLabel('language');
/*I do not set required here becuase it complicates
reducing the options
* upon reload the validator will mourn if a language_id is
absent
* while it is nothing to worry about
* */
$this-addElement($language_id);
parent::postInit();
}
   


public function render(Zend_View_Interface $view =  null){
if($lang = $this-language_id-getValue()){
$decorator = new ReadOnlyDecorator();
$decorator-setDisplayValue(Globals::getDago()-
getLanguageName($lang));
$this-language_id-addDecorator(array('div' =
$decorator));
}
$this-setRemovalScript(__CLASS__);
return parent::render($view);
}

}
The elements that get added in init are the only two elements, except
for a removal button that is added in the ancestor CmsSubForm.
Nothing is required, yet it does not validate if given an array. 

[fw-general] 1.6 Release Coming Soon!

2008-08-27 Thread Wil Sinclair
Hi all, if you've noticed that we Zenders have been hunkering down a bit
lately, there's a good reason: we've been getting ready for the
production release of 1.6. A lot of work is currently being done on the
site. With this release, we would like to bolster the framework.zend.com
site as a definitive source of information about ZF; in short, we are
making sure you can find what you want on the site easily and know that
it's current and accurate when you do.
You can help us with this effort! There is a lot of useful content on
the wiki whose value has been undermined somewhat by out-of-date
content. There are also sections in the wiki that need to be finished or
refactored. We would greatly appreciate any help in updating this
content. If you have some time this week, please take a moment to go
through the wiki and update/add what you can.
Please contact me directly if you have any questions about current wiki
content and what should be done with it.

Thanks, and I hope all of you are looking forward to 1.6GA as much as we
are!
,Wil


Re: [fw-general] Acl and User Group/content restriction

2008-08-27 Thread rgesse

What you are suggesting kinda makes sense to me, but I think that I'm missing
something.

Maybe I can try and explain my train of thought: (As an aside, all of the
roles, resources, access rules, users, user groups etc. are all stored in a
SQL database.)

 - Now, say for example I have 4 roles: unknown, member, content admin,
super admin.
 - I have 2 product lines that are assigned both to content AND to user: P1
and P2.
 - I also have 2 business units that are also assigned both to content AND
to user: BU1 and BU2.

Both business units sell both products. However, I don't want
user1(contentadmin for BU1) and user2(contentadmin for BU2) editing each
others content. 

Furthermore, I don't want members to be able to view content for Products
and Business Units for which they don't have appropriate permission.

Detailed Scenario:

Bill - view anything under BU1
Fred - view only BU1 and P1
John - edit BU2, view any BU2
Sam - edit P1 under BU2, view any BU2

Correct me if I'm wrong, but based on what you are suggesting, and what I
require above, this is how the acl roles would look:

//Add Roles
$this-addRole(new Zend_Acl_Role('unknown'));
$this-addRole(new Zend_Acl_Role('member'), 'guest');
$this-addRole(new Zend_Acl_Role('contentadmin'), 'member');
$this-addRole(new Zend_Acl_Role('superadmin'));

$this-addRole(new Zend_Acl_Role('P1-view'), 'member');
$this-addRole(new Zend_Acl_Role('P1-create'), 'member');
$this-addRole(new Zend_Acl_Role('P1-edit'), 'member');

$this-addRole(new Zend_Acl_Role('P2-view'), 'member');
$this-addRole(new Zend_Acl_Role('P2-create'), 'member');
$this-addRole(new Zend_Acl_Role('P2-edit'), 'member');

$this-addRole(new Zend_Acl_Role('BU1-view'), 'member');
$this-addRole(new Zend_Acl_Role('BU1-create'), 'member');
$this-addRole(new Zend_Acl_Role('BU1-edit'), 'member');

$this-addRole(new Zend_Acl_Role('BU2-view'), 'member');
$this-addRole(new Zend_Acl_Role('BU2-create'), 'member');
$this-addRole(new Zend_Acl_Role('BU2-edit'), 'member');

$this-addRole(new Zend_Acl_Role('P1-B1-view'), 'member');
$this-addRole(new Zend_Acl_Role('P1-B1-create'), 'member');
$this-addRole(new Zend_Acl_Role('P1-B1-edit'), 'member');

$this-addRole(new Zend_Acl_Role('P1-B2-view'), 'member');
$this-addRole(new Zend_Acl_Role('P1-B2-create'), 'member');
$this-addRole(new Zend_Acl_Role('P1-B2-edit'), 'member');

$this-addRole(new Zend_Acl_Role('P2-B1-view'), 'member');
$this-addRole(new Zend_Acl_Role('P2-B1-create'), 'member');
$this-addRole(new Zend_Acl_Role('P2-B1-edit'), 'member');

$this-addRole(new Zend_Acl_Role('P2-B2-view'), 'member');
$this-addRole(new Zend_Acl_Role('P2-B2-create'), 'member');
$this-addRole(new Zend_Acl_Role('P2-B2-edit'), 'member');

If so, it seems like it has the potential of becoming very un-maintainable
as soon as you add more products, BU and other categories like region,
customer type, language, etc.

Is there some other way of merging these roles to accomplish the same
thing without creating an un-maintainable list covering all permutations of
all roles and assigning these roles to every user?


Matthew Weier O'Phinney-3 wrote:
 
 -- rgesse [EMAIL PROTECTED] wrote
 (on Wednesday, 27 August 2008, 06:46 AM -0700):
 I'm a ZF newb and I've been architecting a new project for my company
 with
 the Zend Framework in mind. I've got Zend_Auth and Zend_Acl under control
 and working appropriately.
 
 However, the next issue that I have is that I want to limit a user not
 just
 by role (Zend_Acl), but also by a particular group(s) that a user has
 been
 assigned. e.g. product, region, customer type, business unit, etc.
 
 A group *is* a role. 
 
 
 I'll give an example: 
 
  - Say we have a role of Content Admin.
  
  - User A and User B are both assigned the Content Admin role, so can see
 exactly the same modules, resources, and have the same permissions.
  
  - However, I want to limit individual pieces of content that User A and
 User B can administer, based on the fact that they are assigned to
 different
 groups (products and business units).
  
  - For example, User A can only administer content for Product C assigned
 to
 Business Unit E, and User B can only administer Product D assigned to
 Business Unit E.
  
  - Another example: User A can administer content for Business Unit A and
 B,
 while User B can only administer content in Business Unit C.
 
 I'd create roles for the products and business units, and assign these
 roles to the users.
 
 
 Hopefully that makes sense...
 
 I was assuming that there would be some sort of philosophical Zend
 approach
 to do this type of content/group filtering/restriction. So I did a lot of
 poking around the ZF site, forums and personal blogs, but I wasn't able
 to
 find anything concrete(as far as I understood) that details a ZF method
 of
 doing this. I feel confident I can create something from scratch over
 time,
 but would like to avoid re-inventing the wheel. 
 
 As an aside, I think that I'm going to try digging into the Zend_Acl
 

Re: [fw-general] Zend_Tool working in 1.6 RC3?

2008-08-27 Thread Ralph Schindler
Hey Ken,

I have a fix for that issue and it will be available within the next 12
hours.

If you are interested in the development of Zend_Tool, check out the yahoo
page for it.

http://tech.groups.yahoo.com/group/zf-tool/

Ill ping back when its resolved to have you test it.

-ralph


On 8/27/08 4:43 PM, Ken Petri [EMAIL PROTECTED] wrote:

 
 When I try to run Zend_Tool (following the Zend Tool Quickstart on the Zend
 Framework Community wiki), I get the following errors:
 
 Fatal error: Uncaught exception 'Zend_Exception' with message 'Security
 check: Illegal character in filename' in C:\wamp
 \phpinc\ZendFramework-1.6.0RC3\library\Zend\Loader.php:232
 Stack trace:
 #0 C:\wamp\phpinc\ZendFramework-1.6.0RC3\library\Zend\Loader.php(117):
 Zend_Loader::_securityCheck('C:\wamp\phpinc\...')
 
 #1
 C:\wamp\phpinc\ZendFramework-1.6.0RC3\laboratory\Zend_Tool\library\ZendL\Tool\
 Rpc\Loader\Abstract.php(18):
 Zend_Loade
 r::loadFile('C:\wamp\phpinc\...')
 #2
 C:\wamp\phpinc\ZendFramework-1.6.0RC3\laboratory\Zend_Tool\library\ZendL\Tool\
 Rpc\Endpoint\Abstract.php(60):
 ZendL_To
 ol_Rpc_Loader_Abstract-load()
 #3
 C:\wamp\phpinc\ZendFramework-1.6.0RC3\laboratory\Zend_Tool\library\ZendL\Tool\
 Rpc\Endpoint\Cli.php(8):
 ZendL_Tool_Rpc
 _Endpoint_Abstract-__construct()
 #4
 C:\wamp\phpinc\ZendFramework-1.6.0RC3\laboratory\Zend_Tool\bin\zf.php(55):
 ZendL_Tool_Rpc_Endpoint_Cli::main()
 #5 {main}
   thrown in C:\wamp\phpinc\ZendFramework-1.6.0RC3\library\Zend\Loader.php on
 line 232
 
 Any ideas, anyone?
 
 Thanks,
 ken

-- 
Ralph Schindler
Software Engineer | [EMAIL PROTECTED]
Zend Framework| http://framework.zend.com/




Re: [fw-general] 1.6 Release Coming Soon!

2008-08-27 Thread Ralf Eggert
Hi Wil,

quick question regarding the wiki. Are there any plans for a
multi-lingual wiki, for example have spaces in other languages?

Thanks and best regards,

Ralf


[fw-general] Multiple versions of VIEWS

2008-08-27 Thread gsharma

Hi,

Given the Zend Framework MVC structure, how would I implement this -

Depending on the request source, the page gets displayed in either HTML,
XHTML Mobile, WAP or any other format?

Code examples would be nice.

Thanks
Gaurav