[EXTENSION] Date picker (jQuery UI based)

http://www.yiiframew…/juidatepicker/

Post your bug reports here :)

A bug was reported on the extension page:

Quote

this extension is really good, but DIRECTORY_SEPARATOR is not working well under windows. i have to change DIRECTORY_SEPARATOR to '/' when i use it under windows

DIRECTORY_SEPARATOR comes from Yii's core, right? is it directly available to extensions or do we need to use it like Yii::DIRECTORY_SEPARATOR or something like that? Is it working on Windows?

DIRECTORY_SEPARATOR is a constant defined by PHP.

Indeed Qiang  ;D (too tired, sorry). Then the reviewer had a broken installation… dunno.

setlanguage() did not work when set 'zh-CN'.(validatelanguagearray has no value of zh-CN,zh-TB…, and the check method is wrong. ). is there any way to change the size of datepicker panel? and there is no way to change the dateformat to such as "mm/dd/yy","m-d-Y".

Quote

setlanguage() did not work when set 'zh-CN'.(validatelanguagearray has no value of zh-CN,zh-TB..., and the check method is wrong. ).

It currently works only with two letters code, a workaround is to rename the zh-CN or zh-TW to zh as needed.

Quote

is there any way to change the size of datepicker panel?

You would need to alter or create a theme. Take a look at this theme found in the jQuery UI demo page.

Quote

and there is no way to change the dateformat to such as "mm/dd/yy","m-d-Y".

Did you try the [tt]dateFormat[/tt] configuration parameter?

Quote

and there is no way to change the dateformat to such as "mm/dd/yy","m-d-Y".

Ok, you found a bug here. It’s fixed in 1.1. Thanks  :)

Please update the widget!

Just added support for zh_CN, zh_TW and pt_BR languages in 1.2

it looks great, but about the DIRECTORY_SEPARATOR, is there any good way to make it work on both win* and *inux?

Please check this: http://us2.php.net/m…r.constants.php

Hmm, I found something:

http://www.talkphp.c…-necessary.html

http://us2.php.net/m…ystem.php#73954

http://marc.info/?l=…76927027525&w=2

It seems that, at least in recent PHPs. there's no need for [tt]DIRECTORY_SEPARATOR[/tt] after all, and using [tt]/[/tt] will work just fine.

hellowayne, could you provide details? which PHP version are you using? which server?

as i know function registerScriptFile($url) and registerCssFile($url) actually accept a url format that is using '/' as separator, however DIRECTORY_SEPARATOR =='' .

so the path will become something like

/assets/edd489d9\ui\i18n\ui.datepicker-en.js . why do not just use '/' ? is there any good reason to use DIRECTORY_SEPARATOR for create url path?

i am using php 5.25 , apache 2.2 ,

Quote

as i know function registerScriptFile($url) and registerCssFile($url) actually accept a url format that is using '/' as separator, however DIRECTORY_SEPARATOR =='\' .

so the path will become something like

/assets/edd489d9\ui\i18n\ui.datepicker-en.js . why do not just use '/' ? is there any good reason to use DIRECTORY_SEPARATOR for create url path?

Ok, I see where the problem is. It has nothing to do with a malfunction in DIRECTORY_SEPARATOR, but with its use in the URL registration. Fixed in 1.3. Thanks.

great ! it works fine now. another issue about theme. as you suggested, create a new theme css may change the size of datepicker panel , but i think it is inconvenience. if there is a parameter (panelsize) for user to initialize the size of datepicker panel, that will be wonderful.

do you think is possible ? i think is can be achieved by registered a piece of javascript code. i did a test when i change the font-size using piece of javacode, the datepicker panel changed.

add one line code in run function as following

  public function run()

  {…

      $cs->registerScript(get_class($this).'_'.$id, $js);

$cs->registerScript(‘theme-panel-size’,‘jQuery("#ui-datepicker-div").css(“font-size”,“0.5em”)’);

      echo $html;

  }

therefore i do believe the datepicker panel size can be customized as well. just like set language, theme ect. what do you think?

Done, thanks for the hint.

fantastic job.  ;)

Added support for [tt]fadeIn[/tt] and [tt]slideDown[/tt] effects.

There are several other effects, but they don’t seem to work when included with the example code code (see the [tt]showAnim[/tt] option)  ??? . I’ll try to ask in the jQuery’s mailing list, but if someone is more experienced with jQuery or this jQuery UI widget, your help is appreciated!  ;)

Ok, now this might be a basic misunderstanding of extensions or there is something wrong with this extension. I've tried using it by doing:

$this->widget(


     'application.extensions.juidatepicker.EDatePicker', 


     array(


          'model' => $form, 


          'attribute' => 'birthdate'


     )


);

Where $form is an instance of CFormModel.

And then I get the following error:

The asset "<snip>\protected\extensions\juidatepicker\jquery" to be pulished does not exist.

I guess I'd be able to fix this by adding a jquery directory and appropriate files, but is that really how I should do it, since I believe that jQuery is part of the core of this framework? Please forgive my n00bness.

Hi Kaerigan,

you need to do a [tt]tar xzvf juidatepicker-1.5.tar.gz[/tt] (or use Winzip, since as I guess you're on Windows) to extract the contents of the tarball inside a directory called [tt]extensions[/tt] in your project's [tt]protected[/tt] directory (this is just a convention). This will create a [tt]jquery[/tt] directory inside the extension directory, and this last one will contain the jquery plugin which renders the calendar, and some CSS and images for the look and feel. Make sure that you're extracting all the files using "original paths". Let me know if this works for you.