Re: email component - smtp auth (SOLVED?)

2007-11-30 Thread Gorka

Changed $this-_newLine from \n to \r\n and mail started to work.
The CRLF thing applies to the whole email, and not just the ending
CRLF.CRLF... I should have slept a bit more before reading the
dmtplf doc!

Anyway, if it is mandatory to end lines with CRLF and not just CR,
shouldn't _newLine have a default value of CRLF?

On 30 nov, 12:11, Gorka [EMAIL PROTECTED] wrote:
 My fault... I was starting an SMTP connection on localhost, which is
 of course whitelisted. Solved.

 Still mail wasn't delivered, so I updated the email component to the
 latest nightly build and now I'm getting a 451 
 Seehttp://pobox.com/~djb/docs/smtplf.html; SMTP error. Before the update
 the log file for qmail was showing the same error, but now Cake knows
 it was rejected. Far as I can tell, though, the SMTP send code in
 email component looks ok to me, ending the connection with a LF.LF:

 if (!$this-__sendData($this-__header . \r\n . $this-__message .
 \r\n\r\n\r\n.\r\n)) {

 On 28 nov, 18:34, atomic [EMAIL PROTECTED] wrote:



  Just a quick guess:
  You are sending from a whitelistened ip and don't need to auth on your
  test system / on your testsystem SMTP Auth is disabled ?

  On Nov 28, 12:47 pm, Gorka [EMAIL PROTECTED] wrote:

   In fact, on the test server I get a 503 You are already
   authenticated error message.

   On 27 nov, 16:17, atomic [EMAIL PROTECTED] wrote:

Afaik this fix is already comitted in the latest nightly builds.
What do you mean with they still don't seem to arrive.

Is mail delivered correctly to your MTA but does not reach recipient ?
Do you have access to MTA logs ?

On Nov 26, 7:04 pm, Gorka [EMAIL PROTECTED] wrote:

 I had this same issue, the server was responding 235 GO AHEAD ans
 not OKauthenticated. This fixed the error on send, though emails
 still don't seem to arrive.

 On 29 oct, 21:35, atomic [EMAIL PROTECTED] wrote:

  I had some problems sending mail using smtp auth.
  MTA (postfix) always told me lost connection after auth

  Theemailcomponent is testing for OKAuthenticated
  which seems not RFC compliant to me, so i changend testing
  for return value into 235.

 email.php line 744:
  if (stristr($response, '235') === false)

  This should match most common used MTA.

  Regards,
  Andreas- Ocultar texto de la cita -

- Mostrar texto de la cita -- Ocultar texto de la cita -

  - Mostrar texto de la cita -- Ocultar texto de la cita -

 - Mostrar texto de la cita -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: email component - smtp auth (SOLVED?)

2007-11-30 Thread Gorka

My fault... I was starting an SMTP connection on localhost, which is
of course whitelisted. Solved.

Still mail wasn't delivered, so I updated the email component to the
latest nightly build and now I'm getting a 451 See
http://pobox.com/~djb/docs/smtplf.html; SMTP error. Before the update
the log file for qmail was showing the same error, but now Cake knows
it was rejected. Far as I can tell, though, the SMTP send code in
email component looks ok to me, ending the connection with a LF.LF:

if (!$this-__sendData($this-__header . \r\n . $this-__message .
\r\n\r\n\r\n.\r\n)) {

On 28 nov, 18:34, atomic [EMAIL PROTECTED] wrote:
 Just a quick guess:
 You are sending from a whitelistened ip and don't need to auth on your
 test system / on your testsystem SMTP Auth is disabled ?

 On Nov 28, 12:47 pm, Gorka [EMAIL PROTECTED] wrote:



  In fact, on the test server I get a 503 You are already
  authenticated error message.

  On 27 nov, 16:17, atomic [EMAIL PROTECTED] wrote:

   Afaik this fix is already comitted in the latest nightly builds.
   What do you mean with they still don't seem to arrive.

   Is mail delivered correctly to your MTA but does not reach recipient ?
   Do you have access to MTA logs ?

   On Nov 26, 7:04 pm, Gorka [EMAIL PROTECTED] wrote:

I had this same issue, the server was responding 235 GO AHEAD ans
not OKauthenticated. This fixed the error on send, though emails
still don't seem to arrive.

On 29 oct, 21:35, atomic [EMAIL PROTECTED] wrote:

 I had some problems sending mail using smtp auth.
 MTA (postfix) always told me lost connection after auth

 Theemailcomponent is testing for OKAuthenticated
 which seems not RFC compliant to me, so i changend testing
 for return value into 235.

email.php line 744:
 if (stristr($response, '235') === false)

 This should match most common used MTA.

 Regards,
 Andreas- Ocultar texto de la cita -

   - Mostrar texto de la cita -- Ocultar texto de la cita -

 - Mostrar texto de la cita -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: email component - smtp auth (SOLVED?)

2007-11-28 Thread Gorka

In fact, on the test server I get a 503 You are already
authenticated error message.

On 27 nov, 16:17, atomic [EMAIL PROTECTED] wrote:
 Afaik this fix is already comitted in the latest nightly builds.
 What do you mean with they still don't seem to arrive.

 Is mail delivered correctly to your MTA but does not reach recipient ?
 Do you have access to MTA logs ?

 On Nov 26, 7:04 pm, Gorka [EMAIL PROTECTED] wrote:



  I had this same issue, the server was responding 235 GO AHEAD ans
  not OKauthenticated. This fixed the error on send, though emails
  still don't seem to arrive.

  On 29 oct, 21:35, atomic [EMAIL PROTECTED] wrote:

   I had some problems sending mail using smtp auth.
   MTA (postfix) always told me lost connection after auth

   Theemailcomponent is testing for OKAuthenticated
   which seems not RFC compliant to me, so i changend testing
   for return value into 235.

  email.php line 744:
   if (stristr($response, '235') === false)

   This should match most common used MTA.

   Regards,
   Andreas- Ocultar texto de la cita -

 - Mostrar texto de la cita -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: email component - smtp auth (SOLVED?)

2007-11-26 Thread Gorka

I had this same issue, the server was responding 235 GO AHEAD ans
not OK authenticated. This fixed the error on send, though emails
still don't seem to arrive.

On 29 oct, 21:35, atomic [EMAIL PROTECTED] wrote:
 I had some problems sending mail using smtp auth.
 MTA (postfix) always told me lost connection after auth

 The email component is testing for OK Authenticated
 which seems not RFC compliant to me, so i changend testing
 for return value into 235.

 email.php line 744:
 if (stristr($response, '235') === false)

 This should match most common used MTA.

 Regards,
 Andreas
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Multiselect dropdown controls

2007-11-23 Thread Gorka

Anybody knows of a multiselect dropdown form control? It might be of
great help when designing administration forms for things like
assigning a user to multiple groups or products to multiple
categories.

The pure HTML multiple select control is absolutely horrible from a
usability and graphical design point of view, and it would be great to
replace it with a dropdown select with checkboxes as items. I've been
looking for this for months, but only found a similar control for
asp.net and an experimental control from ARC90 (http://lab.arc90.com/
2007/07/multiselect.php) that still needs improvements.

I've also developed a control that improves some aspects of ARC90's
control, but it is getting more and more ugly to position... and I'm
starting to get quite desperate.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



beforeSave SQL manipulation

2007-08-28 Thread Gorka

I'm developing an application using Google Maps for geolocation. In
order to use DB geometry functions, I'm using a field of type
GEOMETRY, and some MySQL functions to manipulate it. The GoogleMaps
helper I'm using sets two hidden fields, 'latitude' and 'longitude',
that are needed to form a WKT string like POINT(0 0) that will be
later passed to the geolocation field in the DB table.

For this to work, SQL queries must use Geometry functions to translate
(latitude, longitude) into geometry values.

The question is: is there a way to tell Cake that a field value is a
SQL expression and not a value itself?

function beforeSave() {

$this-data['Model']['field'] = array('sql' =
GeometryFromText(POINT({$this-data['Model']['latitude']} {$this-
data['Model']['longitude']});


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



SQL expressions as field values

2007-08-28 Thread Gorka

I'm developing an application using geolocation data. The GoogleMaps
helper I'm using sets 'latitude' and 'longitude' fields according to
user selection on the map. In order to use geometry functions of
MySQL, I need to use a DB field of type GEOMETRY, which requires some
SQL manipulation on the given data.

In short: Is there a way to tell Cake that a field value is not a
string but a SQL expression? Something like:

function beforeSave() {
/* ... */
$this-data['Model']['geolocation'] = array('sql' =
GeometryFromText(POINT({$this-data['Model']['lat']} {$this-
data['Model']['lng']})));
/* ... */
}

Or is using a complete SQL insert/update sentence the only way around
this?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how can i use 10n in cake 1.2

2007-07-29 Thread Gorka

Please see the frequent dicussion page
http://groups.google.co.uk/group/cake-php/web/frequent-discussions and
search the group before making a question, you will get your answers
faster and will not create duplicated threads.

On 29 jul, 11:04, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 So I foundhttp://api.cakephp.org/1.2/l10n_8php-source.htmlis it
 completed class ? which function i must use in view and how look file
 witch translation.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Easy problem, not all that easy to figure out (set function)

2007-07-29 Thread Gorka

If I understood you right, you are overwritting the value of 'gallery'
with the second call to $this-set(), when you wanted to merge both
values. Try preparing your data first, then setting 'gallery' for the
view.

$galery = $this-Gallery-findAll();
$gallery['numRows'] = $this-Gallery-getNumRows();
$this-set('gallery', $gallery);

On 29 jul, 17:30, DrLaban [EMAIL PROTECTED] wrote:
 Hey all!

 Short and simple;
 I'm trying to add more data to a Controller object with the help of
 set().

 So what I'm doing in practice:
 $this-set('gallery', $this-Gallery-findAll());

 Everything works out fine here. I get access to all the info I need in
 the view I'm working with.
 Now, I'd like to add something simple like numRows to the gallery
 variable.

 What I've tried is:
 $this-set('gallery', array('numRows' = $this-Gallery-

 getNumRows());

 But, as it would seem, the gallery object now only contains the last
 set function call's info. How do I add info to the gallery object
 without losing info from the first set call? I'd just like to add a
 field called numRows that contains the int value of rows returned,
 into the gallery object.

 Thanks in advance!

 Regards
  DrLaban


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth component + Cake 1.2

2007-07-27 Thread Gorka

After digging quite a bit in the AuthComponent source, I think I've
found the problem. There are still some things I don't understand, so
please feel free to correct me where I might be wrong. For example,
identify() gets called twice in a login, but I can't figure where does
the second call come from and why the passed data is different in each
call: first the POST data, then username/password fields as part of a
User array. This second call is the one logging the user even if no
username/password information was given on the login form, see code
bellow. On a side note for my previous code, it is not necessary to
call $this-Auth-login() passing it $this-data. It will use $_POST
data if nothing is specified.

The identify() function of AuthComponent (auth.php 5437 2007-07-10
16:25:23Z gwoo) will use an empty array as a condition for a model-
find() call if any of the login fields are empty, thus finding the
first result in the database: in my case, user with id=1: the
administrator. The problematic code commented:

/* Initialize the array we are going to use as a find condition as
empty */
$find = array();
/* If *both* username and password are provided as a user object */
if (isset($user[$this-fields['username']])  !empty($user[$this-
fields['username']])   !empty($user[$this-fields['password']])) {

if (trim($user[$this-fields['username']]) == '=' || trim($user[$this-
fields['password']]) == '=') {
return false;
}
/* Set find conditions */
$find = array(
$this-fields['username'] = $user[$this-fields['username']],
$this-fields['password'] = $user[$this-fields['password']]
);
/* Else, if username is provided in POST */
} elseif (isset($user[$this-userModel . '.' . $this-
fields['username']])  !empty($user[$this-userModel . '.' . $this-
fields['username']])) {
/* If both are empty (why '='?) this should return a
login failure, but the misterious (for me!) second call will ruin the
login failure */
if (trim($user[$this-userModel . '.' . $this-fields['username']])
== '=' || trim($user[$this-userModel . '.' . $this-
fields['password']]) == '=') {
return false;
}
/* Set find conditions */
$find = array(
$this-fields['username'] = $user[$this-userModel . '.' . 
$this-
fields['username']],
$this-fields['password'] = $user[$this-userModel . '.' . 
$this-
fields['password']]
);
}
/* At this point, if we were working with the user array and *any* but
not both of the fields were empty, find = array( ) */
$model = $this-getModel();
/*
$model-find(am(array(), $this-userScope), null, null, -1) will
seek:
If $this-userScope == array() the first user record,
unconditionally.
Else, the first user record that matches filtering conditions, but
ommiting the identifying information: username/password
*/
$data = $model-find(am($find, $this-userScope), null, null, -1);

/*
If there are any users on the DB, $data won't be empty, thus login
is authorized
and user is acknowledged to be the first matching the prior
conditions. In my case, user with id=1: administrator.
*/
if (empty($data) || empty($data[$this-userModel])) {
return null;
}

Now the questions are:

Q1. What is this second call to identify and where does it come
from?
Q2. Is this a bug and should be reported to trac or am I doing
something deadly wrong?

On 27 jul, 12:10, Gorka [EMAIL PROTECTED] wrote:
 I thought AuthComponent handled user login and logout on its own,
 validating username/password pairs and thus I saw no reason to use a
 validLogin function on the model as you did.

 But: AuthComponent won't log me in with an invalid password for a
 given username, but what is freaking me out is that it logs me in with
 any username/password combination (even both blanks) that are not in
 the database... incidentally, it logs me in with a user id of '1',
 which means I turn into admin without even specifying a name or
 password.

 So, I'm damn sure I'm missing some very crucial information on how
 AuthComponent is supposed to be used. Could anyone tell what am I
 doing wrong?

 My users controller:

 ?php

 class UsuariosController extends AppController {

 var $name = 'Usuarios';

 function login() {

 $user_id = $this-Auth-user('id');
 if (!empty($user_id)  $this-Session-valid()) {
 $this-Session-setFlash(__('Already logged in',
 true), 'message', array('class' = 'error'));
 $this-redirect('/');
 exit();
 }

 if (!empty($this-data)) {
 if (!$this-Auth-login($this-data)) {
 $this-Session-setFlash(__('Login failed', true),
 'message', array('class' = 'error'));
 } else {
  $this-flashRedirect(__('Welcome', true

Re: Auth component + Cake 1.2

2007-07-27 Thread Gorka

I thought AuthComponent handled user login and logout on its own,
validating username/password pairs and thus I saw no reason to use a
validLogin function on the model as you did.

But: AuthComponent won't log me in with an invalid password for a
given username, but what is freaking me out is that it logs me in with
any username/password combination (even both blanks) that are not in
the database... incidentally, it logs me in with a user id of '1',
which means I turn into admin without even specifying a name or
password.

So, I'm damn sure I'm missing some very crucial information on how
AuthComponent is supposed to be used. Could anyone tell what am I
doing wrong?

My users controller:

?php

class UsuariosController extends AppController {

var $name = 'Usuarios';

function login() {

$user_id = $this-Auth-user('id');
if (!empty($user_id)  $this-Session-valid()) {
$this-Session-setFlash(__('Already logged in',
true), 'message', array('class' = 'error'));
$this-redirect('/');
exit();
}

if (!empty($this-data)) {
if (!$this-Auth-login($this-data)) {
$this-Session-setFlash(__('Login failed', true),
'message', array('class' = 'error'));
} else {
 $this-flashRedirect(__('Welcome', true), '/');
}
}
}

function logout() {
$this-Auth-logout();
$this-flashRedirect(__('Logged out', true), '/');
}

}

And App Controller:

?php

class AppController extends Controller {

var $components = array('Session', 'Acl', 'Auth');
var $helpers = array('html', 'javascript', 'form', 'head');

function beforeFilter() {
if (isset($this-Auth)) {
$this-Auth-fields = array('username' = 'email',
'password' = 'password');
$this-Auth-userModel = 'Usuario';
$this-Auth-loginAction = array('controller'='usuarios',
'action'='login');
$this-Auth-loginRedirect =
array('controller'='usuarios', 'action'='index');
}
parent::beforeFilter();
}

function flashRedirect($message, $url = array(), $class = 'info')
{
$this-Session-setFlash($message, 'message', array('class' =
$class));
$this-redirect($url);
exit();
}

}

The user login view:

?=$form-create('Usuario', array('action'='login'))?
?=$form-input('Usuario.email')?
?=$form-input('Usuario.password', array('type'='password',
'value'=''))?
?=$form-submit('Entrar')?
?=$form-end()?

On 21 jun, 10:24, danfreak [EMAIL PROTECTED] wrote:
 Dunno why but I can't post in the original thread.

 original thread=  new auth component in cake 1.2   
 http://groups.google.com/group/cake-php/browse_frm/thread/f2d0143c2e5...

 My 2 cents about the new Auth component (Cake 1.2.0.5146alpha)

 It stores encrypted passwords in the DB when you add/edit a new user.

 Let's start with the users controller:

 --
 users_controller.php
 --
 ?php
 class UsersController extends AppController {

 var $name = 'Users';
 var $helpers = array('Html', 'Form', 'Session');
 var $components = array('Auth', 'Session');

 function beforeFilter()
 {
 //actions we allow without authentication, you can also put
 them in the app_controller.php
$this-Auth-allow('index', 'register', 'login', 'logout');
 }

 function login()
 {
 //user already logged in?
 //checking if session has been written
 $user_id = $this-Auth-user('id');
 if (!empty($user_id)  $this-Session-valid())
 {
 $this-Session-setFlash('You are already logged in');
 $this-redirect(array('action'=''), null, true);
 }
 else
 {
 if(!empty($this-data))
 {
 //calling login validation validLogin() in model
 if($this-User-validLogin($this-data))
 {
 if($this-Auth-login($this-User-user))
 {
 $this-Session-setFlash('You have
 successfully logged in');
 $this-redirect(array('action'=''), null,
 true);
 }
 else
 {
 $this-set('password', null);
 $this-set('auth_msg', 'Please try again');
 }

 }
 }
 else
 {
 $this-set('auth_msg', 'Please enter your username and
 password');
 }
 }

 }

 function logout()
 {
 $this-Session-destroy('user');
 

Re: i18n translation in db tables - how to do this like Symfony?

2007-07-25 Thread Gorka

I tried a similar approach and most likely will end up using it due to
time constraints for the project. Still, i18n support is a great step
in Cake's maturity road, and I'd love to make it work even if it was
in a not-so-elegant way. In fact, maybe Cake Foundation may study
donation-promoted development. I'd be more than happy to donate to see
this functionallity working!

On 25 jul, 01:56, oleonav [EMAIL PROTECTED] wrote:
 On Jul 24, 12:09 am, Gorka [EMAIL PROTECTED] wrote:

  Actually, $form-input('TransName.eng.content') renders something like
  this for me:

  input name=data[TransName][content] type=text value=
  id=TransNameContent /

  This is obviously not very useful when editing multiple languages at
  the same time (mostly in the admin area for defining name,
  description, etc... of an item). Has anyone found a method for editing
  multiple languages at the sameview?

 Yes, I did find this out to. Not very useful.

  Oleonav, did you manage to get any closer to a satisfying solution?

 No, I did not. Not in the cake 1.2 way for that matter. Maybe some of
 the core developers would be so nice to contribute on this subject.

 Anyway, I'm working on a different approach to i18n. It does not use a
 'global' i18n  i18n_content table. It stores translations in the same
 table as the main, default language.

 For example a article table:
 id
 article_id
 locale
 ...
 title
 content

 For the main article, in the default language, the field id  article
 id have the same value. Locale is set to the default locale string.
 Translations have their own id. The  article_id is the same as the id
 of the main default record. Each translation has it's own locale
 string. The combination of article_id  locale is defined as unique in
 the database.

 Model assoc's:
 var $belongsTo = array(
'MotherArticle' = array('className' = 'Article',
 'foreignKey' = 'article_id',
 );

 var $hasMany = array(
'ChildArticle' = array('className' = 'Article',
 'foreignKey' = 'article_id'
 );

 I have added a function to the main AppModel to fetch the article in
 the preferred translation if available.

 function readTranslated($fields=null,$id,$lang=null){
$res = $this-read($fields,$id);
$childs = 'Child' . $this-name;
if($res  $lang  is_array($res[$childs])){
   foreach($res[$childs] as $trans){
 if($trans['locale'] == $lang){
$resTrans = $trans;
$resTrans['translated'] = 'yes';
 }
  }
}
if(isset($resTrans)){
  $res[$this-name] = $resTrans;
}
elseif($res != null){
  $res[$this-name]['translated'] = 'no';
}

return $res;

 }

 In the view action of the article controller I use the following
 function $this-Article-readTranslated(null,$id,'eng') for example to
 fetch the article in the prefered language, if available.

 I'm now busy coding the add  edit actions. Having some trouble with
 validation

 This is work in progress. I will share my thoughts / solution when I'm
 satisfied


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: i18n translation in db tables - how to do this like Symfony?

2007-07-25 Thread Gorka

Damn copypaste... the last lines of the function are missing:

@ignore_user_abort((bool) $this-runtime[$model-name]
['ignoreUserAbort']);
unset($this-runtime[$model-name]['ignoreUserAbort']);
}

On 25 jul, 18:34, Gorka [EMAIL PROTECTED] wrote:
 In case it helps anyone, this is the solution I've come up with.
 Please keep in mind that this is my own personal solution and may
 conflict with active development by the core team.

 On your edit/add views you must use plain html instead of the form
 helper, because it won't generate data[Model][Field][locale] names no
 matter what you try. IMHO, this is something to look into, because it
 also adds difficulties dealing with file input arrays and the like.
 Anyhow, the input fields should look like:

 input type=text name=data[Model][Field][locale]
 id=ModelFieldLocale /

 I've rewritten the afterSave() function of TranslateBehaviour like
 follows to allow working with the new field arrays. This should
 probably better be pasted somewhere else, feel free to do so if you
 feel like it.

 function afterSave($model, $created) {
 $locale = $this-_getLocale($model);

 if (empty($locale) || is_array($locale) || 
 empty($this-runtime[$model-name]['beforeSave'])) {

 return true;
 }
 $tempData = $this-runtime[$model-name]['beforeSave'];
 unset($this-runtime[$model-name]['beforeSave']);

 $conditions = array('model' = $model-name,
 'row_id' = 
 $model-id);

 if ($created) {
 foreach ($tempData as $field = $value) {
 if (!is_array($value)) {
 $value = array($locale=$value);
 }

 foreach ($value as $lang=$content) {
  $this-_model-Content-create();
  
 $this-_model-Content-save(array('I18nContent' =
 array('content'=$content)));

  $this-_model-create();
  $this-_model-save(array('I18nModel' = 
 am($conditions,
 array(
   
'locale'
 = $lang,

 'i18n_content_id' = $this-_model-Content-getInsertID(),
   
'field' =
 $field;
 }
 }
 } else {
 $this-_model-recursive = -1;
 $translations = $this-_model-findAll($conditions, 
 array('field',
 'i18n_content_id', 'locale'));
 $values = Set::extract($translations, 
 '{n}.I18nModel');

 foreach ($values as $translation) {
 $field = $translation['field'];
 if (array_key_exists($field, $tempData)) {
 if (!is_array($tempData[$field])) {
 $tempData[$field] = 
 array($locale=$tempData[$field]);
 }
 if (array_key_exists($translation['locale'],
 $tempData[$field])) {
 $this-_model-Content-create();
 
 $this-_model-Content-save(array('I18nContent' =
 array(
  
 'id'=
 $translation['i18n_content_id'],
  
 'content'=
 $tempData[$field][$translation['locale']])));
 }
 }
 }

 }

 There is sure plenty of room for improvement, but it works for me.

 I'm still trying to figure out how to define a default locale and
 dealing with the different locales set by IE7  Firefox (spa/es-es).
 This last issue is really annoying, as it hides one's records from the
 other when using locale autodetection.

 Comments, improvements and suggestions are more than welcome :)

 On 25 jul, 14:33, Gorka [EMAIL PROTECTED] wrote:



  I tried a similar approach and most likely will end up using it due to
  time constraints for the project. Still, i18n support is a great step
  in Cake's maturity road, and I'd love to make it work even if it was
  in a not-so-elegant way. In fact, maybe Cake Foundation may study
  donation-promoted development. I'd be more than happy to donate to see
  this functionallity working!

  On 25 jul, 01:56, oleonav [EMAIL PROTECTED] wrote:

   On Jul 24, 12:09 am, Gorka [EMAIL PROTECTED] wrote:

Actually, $form-input('TransName.eng.content') renders something like
this for me:

input name=data[TransName][content

Re: i18N issue

2007-07-24 Thread Gorka

I'm also trying to figure this out. There are a couple of threads on
the subject anyway, though I believe nobody has yet managed to do
this. Not in a clean way.

There's also another issue I've found working with i18n, apart from
the known fact that find operations won't return anything if there are
i18n definitions missing for the model (instead of returning an empty
field which would be the expected result). In my machine at least,
Firefox and IE use differente locale settings: es_es for Firefox and
spa for IE. This means that any record inserted from IE will be
invisible for Firefox and viceversa if you rely on TranslateBehaviour
locale autodetection. Maybe it's just me, because it looks like a
really big issue to be the first reporting it.

Please, let me know if you manage to work this out.

On 24 jul, 12:58, adevaratu [EMAIL PROTECTED] wrote:
 For the site I`m currently working on I am using cake 1.2`s i18N
 functionality. I was wondering how can be done saving different
 translations at same time.
 For example : admin can add a category, wich title is defined:
 var $actsAs = array('Translate' = array('title'));
 When admin is adding new category, I want to save at same time
 translated content for different languages (coming from diferent input
 fields).

 Can this be done in some way using model-save or I have to enter
 manualy each fields?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: i18n translation in db tables - how to do this like Symfony?

2007-07-23 Thread Gorka

Actually, $form-input('TransName.eng.content') renders something like
this for me:

input name=data[TransName][content] type=text value=
id=TransNameContent /

This is obviously not very useful when editing multiple languages at
the same time (mostly in the admin area for defining name,
description, etc... of an item). Has anyone found a method for editing
multiple languages at the same view?

Oleonav, did you manage to get any closer to a satisfying solution?

On 20 jul, 18:19, oleonav [EMAIL PROTECTED] wrote:
 Sorry, my post was not about labels or div's.

 The input tag transforms Model.Fieldname to a forminput named
 Model.Fieldname with the value of the fieldname applied to it, for
 example $Article['title']

 $form-input('Article.title') will become input type=text
 name=Model.Fieldname value=TheValue ...

 Would be nice to know how to do this with translated content

 For example $TranslatedTitle.0.fra.content - how do we use this in a
 form input without looping trough the array in some sort of way. This
 would also be nice to know regarding validation stuff.

 Your second question, in general, is explained very well in the bakery
 -http://bakery.cakephp.org/articles/view/multiple-rules-of-validation-...

 On Jul 20, 4:33 pm, zwobot [EMAIL PROTECTED] wrote:



  I have found a way here in the google group (don't memorize the exact
  source though):

  ?php echo $form-input('player.vorname', array('div' = false,
  'label' = false));?

  The options in the secon parameter prevent the input function to
  automatically wrap a div tag and the column name as label around the
  input tag itsself.
  So you can for example use:

  ?php __('any_label_you_like', true);?
  ?php echo $form-input('player.vorname', array('div' = false,
  'label' = false));?

  --

  Another issue:
  Do you know how to change the error message on a failed validation in
  a view?
  If I have for example VALID_NOT_EMPTY defined for my title column in
  the Post model, and I leave the input field for title empty in the add
  view a standard message is echoed.
  How can I alter the error message in cake 1.2? With cake 1.1 you could
  use the HtmlHelper and its tagErrorMsg function for that, but how to
  do this in cake 1.2?
  I have tried error function from FormHelper but it did not work.

  On Jul 20, 12:46 pm, oleonav [EMAIL PROTECTED] wrote:

   If we could use something like $form-input('TransTitle.fra.content')
   that would be nice. Using this produces a form input but the value is
   lost.

   We can write some logic (like I have shown in my recent posts about
   this topic) to loop through the TransTitle  TransContent array, but
   this seems not to be the most elegant solution. Not very 'Cake' like.
   Also in the controller function we have to parse things back again.

   On Jul 19, 9:37 am, zwobot [EMAIL PROTECTED] wrote:

Good question oleonav. I wondered how this works too.
In general I want to use any label for an input field, seems like
there is missing a parameter for an input label and you cannot use the
second 'options' parameter to define a label as it seems.

On Jul 17, 4:29 am, oleonav [EMAIL PROTECTED] wrote:

 Presenting a formtag for [Article][active] is simple: 
 $form-input('Article.active'). How to output a tag for the French 
 title is

 a mystery to me.
 $form-input('TransTitle.??? ') ??- Ocultar texto de la cita -

 - Mostrar texto de la cita -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using formHelper-file() to generate a file array

2007-07-16 Thread Gorka

Thanks both for your answers, but I'm afraid I didn't make myself
clear. The form enctype was fine, the problem is how to properly set
the file field to be an array instead of a single field, so when the
form is submitted I can manage the multiple files contained in the
field. That way file fields can be added or removed dynamically with
javascript as they are not fixed table fields for the model, but a
relationship with another model that gets managed with a behavior.

* This view:
?=$form-create('Alojamiento', array('type'='file',
'action'='add'))?
?=$form-input('Alojamiento.nombre', 'Nombre')?
?=$form-file('Alojamiento.images')?
?=$form-file('Alojamiento.images')?
?=$form-submit()?
?=$form-end()?

* Renders this HTML:
form id=AlojamientoAddForm enctype=multipart/form-data
method=post action=/admin/alojamientos/add/
div class=inputlabel for=AlojamientoNombreNombre/
labelinput name=data[Alojamiento][nombre] type=text 0=0
value= id=AlojamientoNombre //div
input type=file name=data[Alojamiento][images] value=
id=AlojamientoImages /
input type=file name=data[Alojamiento][images] value=
id=AlojamientoImages /
div class=submitinput type=submit value=Submit //div
/form

* When I'd like it to render something like:
form id=AlojamientoAddForm enctype=multipart/form-data
method=post action=/admin/alojamientos/add/
div class=inputlabel for=AlojamientoNombreNombre/
labelinput name=data[Alojamiento][nombre] type=text 0=0
value= id=AlojamientoNombre //div
input type=file name=data[Alojamiento][images][] value=
id=AlojamientoImages1 /
input type=file name=data[Alojamiento][images][] value=
id=AlojamientoImages2 /
div class=submitinput type=submit value=Submit //div
/form

I see no way of forcing $form-file() to specify an array of files and
not a single file. Or maybe I'm doing something terribly wrong?

BTW: What is that 0=0 thing that gets shown in the text input field?


On 16 jul, 13:49, Dr. Tarique Sani [EMAIL PROTECTED] wrote:
 On 7/16/07, ctimoteo [EMAIL PROTECTED] wrote:



  In my view form i use:

  $form-create('Geo_objectos',array('enctype'= 'multipart/form-
  data','action'='save'))

 @ ctimoteo  try   $form-create('Geo_objectos', array('type' = 'file'));
 instead of the above line

 HTH

 T

 --
 =
 Cheesecake-Photoblog:http://cheesecake-photoblog.org
 PHP for E-Biz:http://sanisoft.com
 =


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: symfony

2007-07-16 Thread Gorka

In fact I don't think he's trying to convince anyone to use Symfony,
but trying to decide which one to use -Cake or Symfony- and asking for
the reasons that made us choose Cake. That would be fine if it weren't
for the fact that by now it seems that the user base is his only
argument, so he still has plenty of homework to do ;)

Anyhow, I'm on a good mood so I'll tell you one BIG reason for me:
Cake works with PHP4. Symfony doesn't. Most of the hosters out there
still use PHP4. 1 + 1 = 2. Easy as cake ;)

On 16 jul, 13:53, Dr. Tarique Sani [EMAIL PROTECTED] wrote:
 On 7/16/07, Thierry [EMAIL PROTECTED] wrote:



  why aren't you using symfony

 Why don't you tell us why should we use symfony

 T

 --
 =
 Cheesecake-Photoblog:http://cheesecake-photoblog.org
 PHP for E-Biz:http://sanisoft.com
 =


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Upload behavior

2007-07-16 Thread Gorka

I'm still working on this and have come to the point where files are
uploaded and their data is inserted as an association with the
'behaviored' model. Kind of a mix between translate  upload behaviors
in fact.
I'm currently trying to find a way to render the file field arrays on
the model's form (see 
http://groups.google.co.uk/group/cake-php/t/f4821d946c5be6b1)
and manage already uploaded files (edit operations on the model,
saving changes on the related uploads and deleting... well, deleted
ones :)

@AD7six, are you also working on this? Maybe we can share some ideas



On 13 jul, 14:52, AD7six [EMAIL PROTECTED] wrote:
 On Jul 13, 2:47 pm, AD7six [EMAIL PROTECTED] wrote:

  beforeDelete($model) {
   if (!parent::beforeSave()) {

 Holy crossposting typos!

 beforeSave in both cases for the example.

 AD


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: PHP 4 = Dead

2007-07-14 Thread Gorka

IMHO if PHP5 was full backwards compatible there would be less
problems for its adoption. Hosters just won't update to see a hundred
clientes blaming them when their applications start failing. It is not
PHP developers fault if people did things wrong in the past (or is
it?), but it is how things are. Learn and move forward.

I really don't think PHP4 is going to die anytime soon, not until all
legacy PHP apps have passed and every developer has adopted PHP5. And
that, for sure, is going to take a while. Damn, I'm still fighting
with some MySQL 3.xx databases! :P

On 14 jul, 02:16, CraZyLeGs [EMAIL PROTECTED] wrote:
 Yep.

 On 13 juil, 22:07, Felix Geisendörfer [EMAIL PROTECTED] wrote:



PHP 4 = Dead

  We'll talk in 2 years again when PHP4 is still holding the major market
  share.

  -- Felix
  --
  My Blog:http://www.thinkingphp.org
  My Business:http://www.fg-webdesign.de

  Mech7 wrote:
   Well allmost in december it is no longer supported.

  http://php.net/

   Today it is exactly three years ago since PHP 5 has been released. In
   those three years it has seen many improvements over PHP 4. PHP 5 is
   fast, stable  production-ready and as PHP 6 is on the way, PHP 4 will
   be discontinued.

   The PHP development team hereby announces that support for PHP 4 will
   continue until the end of this year only. After 2007-12-31 there will
   be no more releases of PHP 4.4. We will continue to make critical
   security fixes available on a case-by-case basis until 2008-08-08.
   Please use the rest of this year to make your application suitable to
   run on PHP 5.- Ocultar texto de la cita -

 - Mostrar texto de la cita -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Using formHelper-file() to generate a file array

2007-07-14 Thread Gorka

I've checked the API for Cake 1.2 and I see no way of doing this
within the formHelper. Of course I could just directly write the HTML
on the view, but I'm curious to see if there is a better way of doing
this.

When using form-file('Article.image') you get the following HTML:

inpur type=file name=data[Article][image] value=
id=ArticleImage /

It is just fine if each file is mapped to a model attribute and a
single field on the data base. But what if you want to retrieve a file
array like the following?

input type=file name=data[Article][images][] value=
id=ArticleImages /
input type=file name=data[Article][images][] value=
id=ArticleImages /

This would generate an array to be parsed by the model or a behavior
as $model-data['Article']['images'], which is much more comfortable
to use than multiple fields on the model. Of course the HTML attribute
'id' should be fixed to validate, but that is another story and could
be as simple as specifying the id in the form-file() call.

Specifying the name atribute on the form-file() call doesn't work,
BTW. It generartes data[Article][images[]] as a name.

Is there a simple way of doing this apart from directly writing the
HTML without using the helper? Should form-file() set the name as it
does when it is specified or is this something that could be reported
to be fixed?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Upload behavior

2007-07-13 Thread Gorka

 Or maybe even 'MiUploadBehavior extends UploadBehavior', and a call to
 beforeSave{mime}{Type} is made if the method exists etc..

Though this might enforce convention over configuration approach, I
see two possible issues with it. First, some file types have several
mime types -or better, mime names- they can fit ('image/jpg', 'image/
jpeg' for example). On the other hand, you might want different
treatments applied for files of the same type, say extract and record
on DB the text from this PDF, but just zip and store the other one.

When defining validation rules, we can define custom functions or use
the ones implemented in Cake by setting the validation config array.
Maybe we could use something similar to that?

On 13 jul, 12:37, AD7six [EMAIL PROTECTED] wrote:
 On Jul 13, 11:23 am, Gorka [EMAIL PROTECTED] wrote:

  I agree that file uploading should be made as generic as possible, and
  enabling some callbacks for file processing should be a great bonus.

 Hmm,

 I'm currently pondering ImageUploadBehavior extends UploadBehavior

 where upload behavior has empty _postSave __postDelete (referring to
 after saving the original file to the disk, and after deleting the
 original file from the disk) methods and the image version has
 functionality to create/delete thumbs, and DocUploadBehavior has
 whatever else you might want to use etc.

 At least then the 'essential' functionality can be separated from
 image (or whatever) specific calls/functionality.

 Or maybe even 'MiUploadBehavior extends UploadBehavior', and a call to
 beforeSave{mime}{Type} is made if the method exists etc..

 More pondering required.

 AD


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Upload behavior

2007-07-13 Thread Gorka

I agree that file uploading should be made as generic as possible, and
enabling some callbacks for file processing should be a great bonus.

I used uploadBehaviour as published in the Bakery for a recent project
and -though it really simplified my work- I had to make some
adjustments for it to work properly. Still I wasn't happy with it
being so image oriented and also I would prefer not to hardcode the
file fields in the DB model (id, name, photo1, photo2, photo3, pdf...)
which, for example, limits the number of images a post might have.
IMHO, this should be addressed in a similar fashion to
translateBehaviour, where an extra table is added to the DB and
associations are made on the fly to the corresponding model. That way
we could have Post hasMany Files, defining file type as 'image',
'video', 'pdf', or whatever and allowing setting up a callback to
handle any extra file manipulations.

The architecture for such a solution doesn't seem trivial, but it
certainly can and should be done as it would be of great value for the
framework itself and for all the bakers out there.

I'm really short on time these days, but will give it a try. Anyone
else? :)

On 13 jul, 09:12, AD7six [EMAIL PROTECTED] wrote:
 On Jul 12, 1:53 pm, Tijs Teulings [EMAIL PROTECTED] wrote:

 Hi Tarique,

 The behavior in cheesecake is almost stripped to the bone, and has
 some assumptions built in (where the files will go meaning the use of
 WWW_ROOT, each file is a foto, the format for the name of the thumb
 file etc.). For a photo driven site I guess it's what's needed.

 Hi Tijs,

 The paste was not for a finished version but I did a bit more than
 change the way the default setup works. I added/did the following:
  * style changed to be more inline with other behaviors (use of
 extract so you don't need $this-params to refer to all your variables
 for example)
  * changed to work with almost no parameters
  * made separate methods for some operations such as determining file,
 thumb and path names
  * the folder to save can be configured/changed on the fly 'dir' =
 '{APP}uploads{DS}{$class}{DS}{$foreign_id}' - those get replaced when
 used
  * the thumb/versions to save can be configured/changed on the fly
 ''name' = '{$file}.small.{$ext}' - can be what you like
  * added a name cleanup routine (only applicable if you are not using
 random filenames) so that áccëñtèd characters in file names are
 converted
  * fixed the beforeDelete method and wrote it to ensure that the pics/
 thumbs/versions of abcd.jpg are not deleted when you delete the pic
 bcd.jpg

 I changed it to use relative file paths when saving to the database,
 although that's currently hard coded. Not sure if it is still a bit
 too db-centric as a model may not be a table in the db of course.

 The thing that mildly bugged me before was that a file (upload) is a
 file, not a jpeg/png. The behavior was and still is (because I decided
 to stop thinking and just write something) a bit foto centric imo. I
 need to be able to upload images and pdfs, but the same upload
 behaviour could be used for any file type, so if it includes image
 resizing, shouldn't it include any of doc to text, text to pdf, mp3 to
 first x seconds, movie to first x seconds, unzip zip etc. ?

 I like the way cheesecake keeps things separate by outsourcing image
 manipulation to a vendor. Maybe configuring a callback is a
 possibility, maybe image resizing should be done in the model or maybe
 I'm thinking too much.

 Anyway, thoughts?

 AD


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Upload behavior

2007-07-13 Thread Gorka

This kind of inheritance would certainly allow the code to be better
structured and organized, but still we would need the flexibility to
select the kind of processing that should be applied to the files
uploaded through the config array, bakers would need to extend
imageUpload (or whatever) if they need any extra functionality not
covered by the class, and I think we could end up with a bunch of
imageUpload, videoUpload, docUpload, spreadsheetUpload, ... classes.
Thoughts?

On 13 jul, 13:11, Tijs Teulings [EMAIL PROTECTED] wrote:
 On 13-jul-2007, at 12:47, Gorka wrote:







  Or maybe even 'MiUploadBehavior extends UploadBehavior', and a  
  call to
  beforeSave{mime}{Type} is made if the method exists etc..

  Though this might enforce convention over configuration approach, I
  see two possible issues with it. First, some file types have several
  mime types -or better, mime names- they can fit ('image/jpg', 'image/
  jpeg' for example). On the other hand, you might want different
  treatments applied for files of the same type, say extract and record
  on DB the text from this PDF, but just zip and store the other one.

  When defining validation rules, we can define custom functions or use
  the ones implemented in Cake by setting the validation config array.
  Maybe we could use something similar to that?

 Mimetype based super classes would indeed be a bit troublesome i  
 think. I like the ImageUploadBehavior extends UploadBehavior idea a  
 lot! You could still configure what constitutes an image or a  
 document in the UploadBehaviour based on mimetypes and maybe even set  
 some default methods to call. Then if you could override a default  
 method of, for instance, extractText with convertToPdf in the  
 controller you would have a very powerful set of functionality.

 Tijs- Ocultar texto de la cita -

 - Mostrar texto de la cita -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Upload behavior

2007-07-13 Thread Gorka

That was my point :)

Whatever the nature of the uploaded file is, we might want to act on
it differently based on the functionality required by that precise
upload operation. That functionality is probably already out there, be
it creating a thumbnail, zipping a file or whatever. It is just that I
don't really like the idea of extending the class just for a simple
function call to operate on the file. But, anyhow, it is the most
flexible and sensitive approach given that there is more functionality
to cover than just applying a function to the file when it is
uploaded. Go for it! ;)

Now, for an extreme example, lets take a music publisher that wants to
put their records online using the best framework out there ;) An
album has multiple photos, a cover, videos, lyrics, audio tracks...
some of them would probably better be models themselves, but just for
the porpouse of the example the $actsAs array could look something
like this:

var $actsAs = array (
'imageUpload' = array (
'photos' = array (
'dir' = 'files/images',
'max_size' = 20,
'thumbs' = array (
'small' = array('width' = 320, 'height' = 200),
'medium' = array('width' = 640, 'height' = 400)
)
),
'cover' = array (
'dir' = 'files/images/covers',
'max_size' = 20,
'filters' = array (
'tint' = array('color' = '#FF9900'),
'resize' = array('width' = 400, 'height' = 400)
)
)
),
'videoUpload' = array (
'videos' = array (
'dir' = 'files/video',
'max_size' = 300,
'preview' = array('width' = 100, 'height' = 100),
'encode' = array('format' = 'flv', 'sound' = 'mono',
'fps' = 25)
)
),
'docIndexerUpload' = array (
'lyrics' = array (
'dir' = 'files/docs/lyrics',
'max_size' = 20
),
'intro' = array (
'dir' = 'files/docs/intros'
)
),
'audioUpload' = array(
...
),
...
);

Different behaviors (hint!) for different fields of the model, but
still the could all be referenced by the same DB table, name it
'files', associated to the model through the behavior. Thus, an album
might look like:

[Album] = Array (
[id] = 5,
[title] = 'Innuendo',
[group] = 'Queen',
[genre] = Array ([0] = 'pop', [1] = 'rock'),
...
[videos] = Array (
[0] = Array (
[dir] = 'files/videos',
[name] = 'delilah.flv',
...),
[1] = Array (
[dir] = 'files/videos',
[name] = 'all_gods_people.flv',
...),
...),
[photos] = Array (...),
[cover] = Array ([dir] = 'files/images/covers', [name] =
'innuendo.jpg', ...)

)

Sorry for the lengthy post, you get the idea :)

On 13 jul, 13:38, Dr. Tarique Sani [EMAIL PROTECTED] wrote:
 On 7/13/07, Gorka [EMAIL PROTECTED] wrote:



  imageUpload, videoUpload, docUpload, spreadsheetUpload, ... classes.
  Thoughts?

 IME most often the functions which act on the file at the time of upload are
 also needed in, to coin a phrase, non upload situations. To give an example
 you create thumbnails while uploading but you could also want to re-create
 different sized thumbnails some other time - if your resize code was
 contained in a behavior it will not be much help.

 So after making a generic upload class it can be left to users to extend it
 to suit their needs using - vendor classes, stand-alone code, components or
 chicken entrails - Of course everyone loves examples though :)

 Tarique

 --
 =
 Cheesecake-Photoblog:http://cheesecake-photoblog.org
 PHP for E-Biz:http://sanisoft.com
 =


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Strange url's

2007-07-08 Thread Gorka

Looks like the session id going along as a GET parameter, maybe you
could start checking if you have disabled cookies.

On 8 jul, 14:55, cakedude [EMAIL PROTECTED] wrote:
 Hi there,

 I was hoping someone can help me with this.

 I've developed a nice cake-based website which works just fine
 locally. However when i publish put the website online i get some
 really strange url's:

 www.mywebsite.com/chapters/view/1?CAKEPHP=

 For most of the site this is no problem (other then that it doesn't
 look that nice!) but the forms on my website just don't work as they
 should.

 My host:www.startlogic.com

 I really hope someone can help me out on this.

 Thanx!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ajax evalScripts not working for IE?

2007-01-15 Thread Gorka


Still stuck with this... :P

I've changed the $ajax-sortable( ) call to simplify it a bit. I had to
change a line in ajaxhelper to make it pass the Sortable.serialize() in
'postBody' and not in 'parameters' or it wouldn't work.

The call now looks like:

?=$ajax-sortable('nsortable',array('url'=sort,'update'='noticias','loading'=new
Effect.Appear('feedback');,'loaded'=new
Effect.Fade('feedback');))?

And the full updated block:
---
div id=noticias
?php if (count($news)==0) { ?
pNo hay noticias publicadas/p
? } else { ?
ul id=nsortable
?php foreach ($news as $n): ?
li class=noticia?=$n['News']['hidden']?' borrador':''?
id=noticia_?=$n['News']['id']?
div 
class=noticia_headerh1?=$n['News']['title']?/h1/div
div class=noticia_body
id=body_?=$n['News']['id']?p?=$n['News']['body']?/p/div
div class=noticia_footer/div
/li
?php endforeach; ?
/ul
? } ?
?=$ajax-sortable('nsortable',array('url'=sort,'update'='noticias','loading'=new
Effect.Appear('feedback');,'loaded'=new
Effect.Fade('feedback');))?
/div
---

Still, after the first update it keeps working for FF but not for IE,
what makes me think it is somehow related to evalScripts. It can't be
bad javascript for IE because the JS code is exactly the same both
times.

Honestly, I'm absolutely confused about this.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Ajax evalScripts not working for IE?

2007-01-14 Thread Gorka


The following is included in the content for an ajax updated DIV, wich
is a sortable list. The intention is to re-generate the sortables on
each update so the user can continue sorting elements. It works fine
for Firefox, but evalScripts does not seem to work on IE. Any clues
why? I've digged the previous posts on similar subjects, scriptaculous
docs and CakePHP API without luck. BTW, I'm using CakePHP 1.2

?=$ajax-sortable('nsortable',array('onUpdate'=function(element){
 new Effect.Appear('feedback');
 new
Ajax.Updater('noticias','/admin/news/sort',
{

postBody:Sortable.serialize('nsortable'),
onComplete:function(obj){ new
Effect.Fade('feedback'); },
asynchronous:true,
evalScripts:true,
requestHeaders:['X-Update',
'noticias']
}
 )
   }))
?

This, and scriptaculous IE bug with slides, are making what should be a
simple work into a nightmare :P


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Creating a helper: Undefined property error

2006-12-06 Thread Gorka

Thanks for your feedback Francky. However, including
$helpers(...'Util'...,'Head') both in the controller and CalendarHelper
did not work. Any more ideas?


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
Cake PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Creating a helper: Undefined property error

2006-12-06 Thread Gorka

After spending some time looking into it, I would say that the problem
is related to the mode in which helpers are loaded. I haven't checked
this too thouroughly, but it seems that helpers are loaded secuentally
and their __contruct() methods executed. That means that you can't
actually use other helpers -not in a reliable way- in your helper's
contructor.

Hope this helps someone, it took me a while to figure this out.


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
Cake PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Creating a helper: Undefined property error

2006-12-06 Thread Gorka

I don't know...I first thought it might be PHP4/5 related, but I'm
achieving the same results with PHP5 so this is out of the whiteboard.
It certainly could be related to helper dependencies and the order in
which they get actually loaded, but I find it hard to believe that I'm
the first one biting this, so I must be missing something.

I'm too close to the deadline of the project to look into this, but I'm
intrigued.


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
Cake PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---