Dojo Cake Help

15 views
Skip to first unread message

blessan

unread,
Jan 19, 2010, 4:53:34 AM1/19/10
to DojoCake
I am currently using the Dojo Cake helpers. Iam trying to extend the
dojo_form.php to support all dijit widgets. Now it only supports
'textbox' and 'button' widget. I was able to include the 'textarea'
widget.
Now i am tryin to implement the 'datetextbox' widget. But a error
occurs when i use

$dojo->req('dijit.form.DateTextBox')

Error is shown in firebig while the files are loaded. So when i
searched, i found that the error occurs at the dojo/date/locale.js
file.

This is the line that causes the error

dojo.requireLocalization("dojo.cldr", "gregorian");

Any idea on how to fix this? i tried a lot of methods i know. Is it a
issue with dojo or cakePHP? Any ideas let me know.

Message has been deleted

LordZardeck

unread,
Jan 19, 2010, 10:05:26 AM1/19/10
to DojoCake
What is the file structure of your dojo path from web root? DojoCake
assumes that you use this path:
/webroot/js/dojo, /webroot/js/dijit, /webroot/js/dojox
If that is not your structure, you can change it in the core Dojo
helper in lines 8-12:
define('DIJIT_PATH', JS_URL . 'path/to/dijit/');
It is VERY important that you leave off the forward slash in front of
the path. The JS_URL tacks one on its end.

LordZardeck

unread,
Jan 19, 2010, 10:47:01 AM1/19/10
to DojoCake
By the way, the text area is now included in revision 10. Since there
was really no other significant change, it will not be placed in a
download. However, you can still get it from our repository.

blessan

unread,
Jan 19, 2010, 11:28:24 PM1/19/10
to DojoCake
This is my folder structure in dojo.php


if(!defined('DOJO_PATH')){
define('DOJO_PATH', JS_URL . 'lib/dojo/dojo/');
}
if(!defined('DIJIT_PATH')){
define('DIJIT_PATH', JS_URL . 'lib/dojo/dijit/');
}
if(!defined('DOJOX_PATH')){
define('DOJOX_PATH', JS_URL . 'lib/dojo/dojox/');
}

Anyway i need to test with your new revisions. I'll let you know what
happens. I was able to get the 'DateTextBox' widget to work. But had
to move some files in the dijit folder. I know thats not the correct
method. But for the time being, thats what i got.

blessan

unread,
Jan 20, 2010, 12:46:36 AM1/20/10
to DojoCake
After playing around the code a while, i noticed, that I was able to
get the Soria theme when i used small letters.


$dojo->theme("soria");

<body class="soria">

Now the theme function is working fine when i changed the case. I used
capital 'Soria' earlier as was shown in the tutorial.

blessan

unread,
Jan 20, 2010, 1:00:42 AM1/20/10
to DojoCake
When we set the 'debug' of cakephp to 1. We get a error

'Notice (8): Undefined variable: reqs [APP/views/helpers/dojo.php,
line 195]'

I was able to resolve it by adding the line

$reqs = '';

Another error is

Notice (8): Undefined index: content [APP/views/helpers/dojo.php,
line 287]
This happens when use the 'textBox' widget. We should add a default
array like in 'textArea' so that content is set to 'null'

blessan

unread,
Jan 20, 2010, 1:13:54 AM1/20/10
to DojoCake
I was able to implement the 'DateTextBox' widget without modifying any
of the code. The $dojo->req worked perfectly well. I changed my folder
structure to the one u gave. Thanks for te help.

LordZardeck

unread,
Jan 25, 2010, 8:27:46 AM1/25/10
to DojoCake
I will work on adding default values. Since it never gave errors, I
never worried about it. Bad programming practice on my behalf. :P I
will also look into the theme issue. I don't know why it had problems
with capitols. Also, would you be interested in being a contributor,
and helping out with this project?

LordZardeck

unread,
Jan 25, 2010, 11:21:16 AM1/25/10
to DojoCake
Ok, all that should be fixed in the latest release. I also added a
nice little feature: The theme class will automatically be added to
the body. You don't have to apply the class attribute anymore. This is
introduced in version 0.0.11

blessan

unread,
Jan 27, 2010, 12:25:28 AM1/27/10
to DojoCake
Thanks for the revisions in the code. Trying to work on them now. Been
working with the digit.form.select widget. I'm having some problems
with the css. I mean the select box gets display but the options
don't. I tried to find the error. It appeared to me as the color of
the text in the options is causing the problem.
I changed it and made it to red in firebug and the options were
displayed. I tried to 2 method,

1. Putting html directly to the view files as

<select dojoType="dijit.form.Select" style="width: 150px;" >
<option value="TN">Tennessee</option>
<option value="VA" selected="selected">Virginia</option>
<option value="WA">Washington</option>
<option value="FL">Florida</option>
<option value="CA">California</option>
</select>

2. By using the dojo_form helper

function select($parms = array()){
$defaults = array
("dojoType"=>"dijit.form.Select","style"=>"width:150px");
$labels = array();
$values = array();
$labels = array_keys($parms);
$values = array_values($parms);

$select = "<select dojoType='".$defaults['dojoType']."'
style=".$defaults['style'].">";
if(($labels !=NULL) && ($values !=NULL)) {
for($counter = 0; $counter < count($labels); $counter++) {
$select .= "<option value='".$values[$counter]."'>".$labels
[$counter]."</option>";
}
}
$select .= "</select>";
return $select;
}

I don't know if this is a error is just for me. I'm relatively new to
cakePHP.
And for your question, I would like to be a contributor to the
dojocake project.

LordZardeck

unread,
Jan 27, 2010, 8:09:24 AM1/27/10
to DojoCake
Actualy, for the sake of redundancy, it might be best to not add this
to the helper form. Or at least not the whole code. Infact, I was
thinking of a rewrite of some form widgets. The built-in CakePHP form
helper has already a select function, and by passing
"dijit.form.Select" as a dojoType attribute, and by requiring
"dijit.form.Select", we would have to write less code than we do now.
Plus, and here's the big bonus, we'll have Cake's ability to
automatically fill in the data based on the models.
Reply all
Reply to author
Forward
0 new messages