Welcome, Guest. Please login or register.
Did you miss your activation email?
Oct. 11, 2008, 03:52:20 PM
47672 Posts in 10455 Topics by 5339 Members
Latest Member: phamlehoaian
News: Share your PRADO experience with other PRADOers by commenting on the QuickStart Tutorial.
 
The PRADO Community » Prado v3.x » General Discussion » 3.0.1 - Demo BLOG, Authentification, Send file, TDatePicker « previous next »
Pages: [1] 2 Print
Author Topic: 3.0.1 - Demo BLOG, Authentification, Send file, TDatePicker  (Read 2127 times)
zecat
Junior Member
**

Karma: 0
Offline Offline

Posts: 5


View Profile
« on: Jul. 06, 2006, 08:05:44 PM »

Hi,
I have installed prado prado-3.0.1, and discover BLOG demo which is very impressive.

Just four little question about it :
- How change prado settings to prolongate session : After a successful authentification process, if the user open an other browser, he had to reauthenticate himself. It means that there is no cookie, or cookie lifetime is negative. Or as I didn't see any cookie in the browser, is there no cookie based seesion ?. How change this fact ?

- On an edit post, user can put a file (eg. image...) in the content but it must be previously downloader on the server. Has I see an attachement table in the db, is there any settings I miss too ? Or should I develop any portlet or page to do this job ?

- I modified post page by included a TDatepicker component : I had some trouble with the mode 'DropDownlist' as setTimestamp method did not work. Get is ok, and set ok too when mode is 'textbox'.

- In the same TDatePicker class, it seems that in prado 2, there was time option to include time selection (h:m) Is it right ? Is there any plan too add this option in v3 ?


Thanks again for your job, really great and wellcoded.

Thierry
Logged
Qiang
PRADO Team Leader
Administrator
Diamond Member
*****

Karma: 97
Offline Offline

Posts: 3167



View Profile
« Reply #1 on: Jul. 06, 2006, 08:21:40 PM »

Thanks.

The current implementation doesn't have the "remember password" feature and attachment feature that you asked, although they were planned to. It may be added in future releases.

Wei will have better answers for you regarding to the TDatePicker component.
Logged
wei
PRADO v3.x Developer
Diamond Member
*****

Karma: 65
Offline Offline

Posts: 2872



View Profile
« Reply #2 on: Jul. 06, 2006, 11:59:44 PM »

The TDatePicker is for picking dates, for a time picker you can try to create your own custom component  using  simply some drop down list. Do you have an example where setting the timestamp doesn't work? Timestamp must be unix timestamp, which are integers. setDate takes a string which must be in the same format as specified by the DateFormat property.

Thanks.
Logged
zecat
Junior Member
**

Karma: 0
Offline Offline

Posts: 5


View Profile
« Reply #3 on: Jul. 07, 2006, 12:36:26 AM »

Thanks Qiang and Wei for your quicker answers.

I will try to add the remember password feature by myself. It is a good practice to go deeper in your framework to understand the global process, and the TAuthManager as well. Adding download feature seem to me more easy with TFileUpload.

About the TDatePicker, in the edit template page I added something as
Code:
<com:TDatePicker ID="MyDate"¦nbsp; DateFormat="dd/MM/yyyy"¦nbsp; Mode="ImageButton" InputMode="DropDownList"/>

and in the script page
Code:
public function onLoad($param)
{
parent::onLoad($param);
if(!$this->IsPostBack)
{
...
$this->MyDate->TimeStamp=1152918600; //timestamp comes from outside;
...
}
}

public function saveButtonClicked($sender,$param)
{
if($this->IsValid)
{
...
$postRecord->MyDate=$this->MyDate->TimeStamp;
...
}
}


The set TimeStamp in 'Onload Part' didn't have effect of the dropdownlist showed :
 the three dropdownlist 'month,day,year' stay on 1 jan 2001

The get Timestamp in 'save part' work like a charm.

When InputMode is 'textBox' , set timestamp works, and textBox is filled with the correct date coming from DB.

Other trouble in this the 'TextBox' Inputmode, if user write something wrong like : '12/05/2006zzz' I got :
TInvalidDataValueException
Description
Pattern 'dd/MM/yyyy' mismatch
Fichier Source
/usr/local/www/prado-3.0.1/framework/Util/TSimpleDateFormatter.php (296)


With a validator too.

Last things : 'MMMM' DateFormat produce a double month, and not a localized month in 'textbox' but works in 'dropdownlist' Smiley

And about 'hour picker' I added two listbox which did succesfully the job.

Thierry
« Last Edit: Jul. 07, 2006, 12:46:52 AM by zecat » Logged
wei
PRADO v3.x Developer
Diamond Member
*****

Karma: 65
Offline Offline

Posts: 2872



View Profile
« Reply #4 on: Jul. 07, 2006, 01:30:47 AM »

I was unable to reproduce your problem, here is the test code
Code:
<com:TDatePicker ID="MyDate"
DateFormat="dd/MM/yyyy"
Mode="ImageButton" />
<com:TRequiredFieldValidator
ControlToValidate="MyDate"
ErrorMessage="date required (dd/MM/yyyy)" />

<com:TDataTypeValidator
DataType="Date"
DateFormat="dd/MM/yyyy"
ControlToValidate="MyDate"
ErrorMessage="date must be of the form dd/MM/yyyy" />

<com:TButton Text="Submit!" OnClick="button1_clicked"/>

<com:TLabel ID="label1" />

Code:
public function onLoad($param)
{
if(!$this->IsPostBack)
$this->MyDate->TimeStamp=1152918600; //timestamp comes from outside;
}

function button1_clicked()
{
$this->label1->Text = $this->MyDate->TimeStamp;
}
Logged
zecat
Junior Member
**

Karma: 0
Offline Offline

Posts: 5


View Profile
« Reply #5 on: Jul. 07, 2006, 09:00:25 AM »

Hi, with your example if the user put '05/07/2006ttt' in the Tdatepicker textbox, I get following error :

TInvalidDataValueException
Description
Pattern 'dd/MM/yyyy' mismatch

../..

Trace de la pile d'ex閏ution:
#0 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\WebControls\TDatePicker.php(520): TSimpleDateFormatter->parse('05/07/2006ttt')
#1 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\WebControls\TDatePicker.php(250): TDatePicker->getTimeStampFromText()
#2 C:\INTRANET\www\prado-3.0.2.r1226\framework\TComponent.php(102): TDatePicker->getTimeStamp()
#3 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\TControl.php(196): TComponent->__get('TimeStamp')
#4 C:\INTRANET\www\prado-3.0.2.r1226\feeds\protected\Pages\Posts\EditPost.php(89): TControl->__get('TimeStamp')
#5 C:\INTRANET\www\prado-3.0.2.r1226\framework\TComponent.php(364): EditPost->saveButtonClicked(Object(TLinkButton), NULL)
#6 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\WebControls\TLinkButton.php(232): TComponent->raiseEvent('OnClick', Object(TLinkButton), NULL)
#7 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\WebControls\TLinkButton.php(219): TLinkButton->onClick(NULL)
#8 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\TPage.php(712): TLinkButton->raisePostBackEvent('undefined')
#9 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\TPage.php(235): TPage->raisePostBackEvent()
#10 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\TPage.php(170): TPage->processPostBackRequest(Object(THtmlWriter))
#11 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\Services\TPageService.php(458): TPage->run(Object(THtmlWriter))
#12 C:\INTRANET\www\prado-3.0.2.r1226\framework\TApplication.php(988): TPageService->run()
#13 C:\INTRANET\www\prado-3.0.2.r1226\framework\TApplication.php(346): TApplication->runService()
#14 C:\INTRANET\www\prado-3.0.2.r1226\feeds\index.php(23): TApplication->run()
#15 {main}

And about SetTimeStamp with InputMode="DropDownList", meaculpa, I probably did a 'very' bad things as it works now. Sorry.

Thanks you  Smiley

Thierry
Logged
wei
PRADO v3.x Developer
Diamond Member
*****

Karma: 65
Offline Offline

Posts: 2872



View Profile
« Reply #6 on: Jul. 07, 2006, 10:25:35 PM »

OK, please submit a ticket at http://trac.pradosoft.com

the client-side javascript validator should have already picked the problem.
Logged
zecat
Junior Member
**

Karma: 0
Offline Offline

Posts: 5


View Profile
« Reply #7 on: Jul. 08, 2006, 12:04:57 AM »

Ok, I did it, ticket 274.
Thank you.

Thierry
Logged
hops
Junior Member
**

Karma: 1
Offline Offline

Posts: 25


View Profile
« Reply #8 on: Aug. 22, 2006, 11:16:21 AM »

Hi,

I have a similar problem with prado 3.0.3.

TDataTypeValidator does not work with TDatePicker (no validation is performed) and TRequiredFieldValidator is invoked when user prompts invalid data. So if there is no TRequiredFieldValidator and the date is invalid, I get a TInvalidDataExecption.

When I use prado 3.0.1, it works perfectly.
Logged
wei
PRADO v3.x Developer
Diamond Member
*****

Karma: 65
Offline Offline

Posts: 2872



View Profile
« Reply #9 on: Aug. 23, 2006, 12:31:14 AM »

please show me an example, did you specify the DateFormat property?
Logged
hops
Junior Member
**

Karma: 1
Offline Offline

Posts: 25


View Profile
« Reply #10 on: Aug. 24, 2006, 11:56:49 AM »

Code:
<com:TDatePicker  ID="Date1"
                      Columns="25" DateFormat="dd/MM/yyyy"
                      Mode="ImageButton"
                      Culture="fr" CssClass="textfield"   
/>

<com:TRequiredFieldValidator
                ID="Date1Obligatoire"
ValidationGroup="Validation"
ControlToValidate="Date1"
ErrorMessage="Le champ est obligatoire."
Enabled="False"
/>     

<com:TDataTypeValidator
ValidationGroup="Validation"
ControlToValidate="Date1"
DataType="Date" DateFormat="d/M/yyyy"
ErrorMessage="<br/>Le format de la date doit être (dd/MM/aaaa)."
/>

In this code, the DataTypeValidator is never performed. And if I enable the TRequiredFieldValidator from the PHP Code, the required validator is performed and returns false if the format is not valid.

Thank you
Logged
wei
PRADO v3.x Developer
Diamond Member
*****

Karma: 65
Offline Offline

Posts: 2872



View Profile
« Reply #11 on: Aug. 24, 2006, 11:58:44 PM »

The following should work I think

http://trac.pradosoft.com/browser/trunk/tests/FunctionalTests/tickets/protected/pages/Ticket274.page

could you try it with your browser please?
Logged
hops
Junior Member
**

Karma: 1
Offline Offline

Posts: 25


View Profile
« Reply #12 on: Aug. 28, 2006, 12:04:10 PM »

I am sorry not to understand exactly what you ask me to test.

Anyway, I added EnableClienScript=false to my template, and that makes no difference ?
Logged
wei
PRADO v3.x Developer
Diamond Member
*****

Karma: 65
Offline Offline

Posts: 2872



View Profile
« Reply #13 on: Aug. 28, 2006, 11:59:01 PM »

can you try

Code:
<com:TDatePicker ID="MyDate"
DateFormat="dd/MM/yyyy"
Mode="ImageButton" />
<com:TRequiredFieldValidator
ID="validator1"
ControlToValidate="MyDate"
ErrorMessage="date required (dd/MM/yyyy)" />


<com:TButton ID="button1" Text="Submit!" />
?
Logged
hops
Junior Member
**

Karma: 1
Offline Offline

Posts: 25


View Profile
« Reply #14 on: Aug. 29, 2006, 12:33:46 PM »

Same behaviour. If the date is empty or in wrong format, the message "date required (dd/MM/yyyy)" appear.

The need is to make the date not required, but when given, its format must be checked
Logged
Pages: [1] 2 Print 
« previous next »
Jump to: