From 8ab196ce6c2d5de323bdd8ebcc11a73814c0cdca Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 26 Apr 2006 21:18:01 +0000 Subject: Merge from 3.0 branch till 971. --- .../quickstart/protected/pages/Advanced/I18N.page | 124 ++++++++++++++++++++- .../protected/pages/Controls/DatePicker.page | 75 ++++++++++++- .../protected/pages/Controls/Literal.page | 6 +- .../pages/Controls/Samples/TDatePicker/Home.page | 61 ++++++++++ .../protected/pages/Controls/Standard.page | 4 +- .../protected/pages/Controls/Validation.page | 28 ++++- .../protected/pages/GettingStarted/AboutPrado.page | 8 +- 7 files changed, 293 insertions(+), 13 deletions(-) create mode 100644 demos/quickstart/protected/pages/Controls/Samples/TDatePicker/Home.page (limited to 'demos') diff --git a/demos/quickstart/protected/pages/Advanced/I18N.page b/demos/quickstart/protected/pages/Advanced/I18N.page index f37e5cf6..4a220c4c 100644 --- a/demos/quickstart/protected/pages/Advanced/I18N.page +++ b/demos/quickstart/protected/pages/Advanced/I18N.page @@ -170,23 +170,145 @@ The time is {time}. <com:TDateFormat Value="12/01/2005" /> -

There are of 4 localized date patterns and 4 localized time patterns. They can be used in any combination. If using a combined pattern, the first must be the date, followed by a space, and lastly the time pattern. For example, full date pattern with short time pattern.

+

The Pattern property accepts 4 predefined localized date patterns and 4 predefined localized time patterns. +

+The predefined can be used in any combination. If using a combined predefined pattern, +the first pattern must be the date, followed by a space, and lastly the time pattern. +For example, full date pattern with short time pattern. The actual ordering of the +date-time and the actual pattern will be determine automatically from locale data specified +by the Culture property.

<com:TDateFormat Pattern="fulldate shorttime" /> +

You can also specify a custom pattern using the following sub-patterns. +The date/time format is specified by means of a string time pattern. In this pattern, all ASCII letters are reserved as pattern letters, which are defined as the following: + + Symbol Meaning Presentation Example + ------ ------- ------------ ------- + G era designator (Text) AD + y year (Number) 1996 + M month in year (Text & Number) July & 07 + d day in month (Number) 10 + h hour in am/pm (1~12) (Number) 12 + H hour in day (0~23) (Number) 0 + m minute in hour (Number) 30 + s second in minute (Number) 55 + E day of week (Text) Tuesday + D day in year (Number) 189 + F day of week in month (Number) 2 (2nd Wed in July) + w week in year (Number) 27 + W week in month (Number) 2 + a am/pm marker (Text) PM + k hour in day (1~24) (Number) 24 + K hour in am/pm (0~11) (Number) 0 + z time zone (Time) Pacific Standard Time + ' escape for text (Delimiter) 'Date=' + '' single quote (Literal) 'o''clock' + +

+ +

The count of pattern letters determine the format.

+ +

(Text): 4 letters uses full form, less than 4, use short or abbreviated form +if it exists. (e.g., "EEEE" produces "Monday", "EEE" produces "Mon")

+ +

(Number): the minimum number of digits. Shorter numbers are zero-padded + to this amount (e.g. if "m" produces "6", "mm" produces "06"). Year is + handled specially; that is, if the count of 'y' is 2, the Year will be + truncated to 2 digits. (e.g., if "yyyy" produces "1997", "yy" produces "97".) + Unlike other fields, fractional seconds are padded on the right with zero.

+ +

(Text and Number): 3 or over, use text, otherwise use number. (e.g., +"M" produces "1", "MM" produces "01", "MMM" produces "Jan", and "MMMM" +produces "January".)

+ +

Any characters in the pattern that are not in the ranges of ['a'..'z'] +and ['A'..'Z'] will be treated as quoted text. For instance, characters +like ':', '.', ' ', and '@' will appear in the resulting time text +even they are not embraced within single quotes.

+ +

Examples using the US locale: + + +Format Pattern Result +-------------- ------- +"yyyy.MM.dd G 'at' HH:mm:ss" ->> 1996.07.10 AD at 15:08:56 +"EEE, MMM d, ''yy" ->> Wed, Jul 10, '96 +"h:mm a" ->> 12:08 PM +"hh 'o''clock' a, z" ->> 12 o'clock PM, Pacific Daylight Time +"K:mm a" ->> 0:00 PM +"yyyy.MMMM.dd G hh:mm a" ->> 1996.July.10 AD 12:08 PM + +

+

If the Value property is not specified, the current date and time is used.

TNumberFormat

PRADO's Internationalization framework provide localized currency formatting and number formatting. Please note that the TNumberFormat component provides formatting only, it does not perform current conversion or exchange.

+

Numbers can be formatted as currency, percentage, decimal or scientific +numbers by specifying the Type attribute. The valid types are: +

+

+ <com:TNumberFormat Type="currency" Value="100" />

Culture and Currency properties may be specified to format locale specific numbers.

+

If someone from US want to see sales figures from a store in +Germany (say using the EURO currency), formatted using the german + currency, you would need to use the attribute Culture="de_DE" to get +the currency right, e.g. 100,00$. The decimal and grouping separator is +then also from the de_DE locale. This may lead to some confusion because +people from US uses the "," (comma) as thousand separator. Therefore a Currency +attribute is available, so that the output from the following example results in $100.00 + +<com:TNumberFormat Type="currency" + Culture="en_US" Currency="EUR" Value="100" /> + +

+ +

The Pattern property determines the number of digits, thousand grouping +positions, the number of decimal points and the decimal position. The actual characters that +are used to represent the decimal points and thousand points are culture specific +and will change automatically according to the Culture property. The valid +Pattern characters are: +

+For example, consider the Value="1234567.12345" and +with Culture="en_US" (which uses "," for thousand point separator and "." for decimal separators). + +Pattern Output +------- ------ +##,###.00 ->> 1,234,567.12 +##,###.## ->> 1,234,567.12345 +##,##.0000 ->> 1,23,45,67.1235 +##,###,##.0 ->> 12,345,67.1 +000,000,000.0 ->> 001,234,567.1 + +

TTranslateParameter

Compound messages, i.e., string substitution, can be accomplished with TTranslateParameter. diff --git a/demos/quickstart/protected/pages/Controls/DatePicker.page b/demos/quickstart/protected/pages/Controls/DatePicker.page index 5425f2ab..17d28382 100644 --- a/demos/quickstart/protected/pages/Controls/DatePicker.page +++ b/demos/quickstart/protected/pages/Controls/DatePicker.page @@ -3,8 +3,81 @@

TDatePicker

+

TDatePicker displays a text box for date input purpose. +When the text box receives focus, a calendar will pop up and users can +pick up from it a date that will be automatically entered into the text box. +The format of the date string displayed in the text box is determined by +the DateFormat property. Valid formats are the combination of the +following tokens: + + +Character Format Pattern (en-US) +--------------------------------------------------------------------- + d day digit + dd padded day digit e.g. 01, 02 + M month digit + MM padded month digit + MMM localized abbreviated month names, e.g. Mar, Apr + MMMM localized month name, e.g. March, April + yy 2 digit year + yyyy 4 digit year +--------------------------------------------------------------------- + + +

+The date of the date picker can be set using the Date or Timestamp +properties. The Date property value must be in the same format as the pattern +specified in the DateFormat property. The Timestamp property +only accepts integers such as the Unix timestamp. +

+

-TBD +TDatePicker has three Mode to show the date picker popup. +

+

The CssClass property can be used to override the css class name +for the date picker panel. The CalendarStyle property changes the overall calendar style. +The following CalendarStyle values are available: +

+

+ +

The InputMode property can be set to "TextBox" or "DropDownList" with +default as "TextBox". In DropDownList mode, in addition to the popup date picker, three +drop down list (day, month and year) are presented to select the date . +When InputMode equals "DropDownList", the order and appearance of the date, month, and year +will depend on the pattern specified in DateFormat property. +

+ +

The popup date picker can be hidden by specifying ShowCalendar as false. Much of the +text of the popup date picker can be changed to a different language using the Culture property. +

+ +

The calendar picker year limit can be set using the FromYear and UpToYear properties +where FromYear is the starting year and UpToYear is the last year selectable. +The starting day of the week can be changed by the FirstDayOfWeek property, with 0 as Sunday, 1 as Monday, etc. +

+ +

Note 1: If the InputMode is "TextBox", the DateFormat should +only NOT contain MMM or MMMM patterns. The +server side date parser will not be able to determine the correct date if MMM or +MMMM are used. When InputMode equals "DropDownList", all patterns can be used.

+ +

Note 2: When the TDatePicker is used together +with a validator, the DateFormat property of the validator must be equal to +the DateFormat of the TDatePicker AND must set DataType="Date" +on the validator to ensure correct validation. See +TCompareValidator, +TDataTypeValidator and +TRangeValidator +for details.

+ + + \ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Literal.page b/demos/quickstart/protected/pages/Controls/Literal.page index d7b44aff..30a84880 100644 --- a/demos/quickstart/protected/pages/Controls/Literal.page +++ b/demos/quickstart/protected/pages/Controls/Literal.page @@ -5,13 +5,17 @@

TLiteral displays a static text on a Web page. TLiteral is similar to the TLabel control, except that the TLiteral - * control does not allow child controls and has no style properties, such as BackColor, Font, etc. + * control has no style properties, such as BackColor, Font, etc.

The text displayed by TLiteral can be programmatically controlled by setting the Text property. The text displayed may be HTML-encoded if the Encode is true (the default value is false).

+

+TLiteral will render the contents enclosed within its component tag if Text is empty. +

+

Be aware, if Encode is false, make sure Text does not contain unwanted characters that may bring security vulnerabilities.

diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDatePicker/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TDatePicker/Home.page new file mode 100644 index 00000000..e563145d --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TDatePicker/Home.page @@ -0,0 +1,61 @@ + + +

TDatePicker Samples

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Default TDatePicker + +
Button Mode,
pre-selected date 20-10-2005
+ +
InputMode="DropDownList",
custom DateFormat="yyyy/MMM"
+ +
InputMode="DropDownList",
custom DateFormat="MMM/yyyy",
Culture="fr"
+ +
Custom DateFormat="日期:yyyy年M月d日",
culture="zh_CN",
ImageButton mode,
pre-selected using Timestamp=<%= @strtotime("-1 year") %>
+ /> +
Custom DateFormat="yyyy/MMMM/dd",
DropDownList,
pre-selected Date="2005/05/15"
+ +
DropDownList,
pre-selected date Timestamp=<%= @strtotime("-1 month") %>
+ /> +
+ +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Standard.page b/demos/quickstart/protected/pages/Controls/Standard.page index 9580a0d7..dfaee35b 100644 --- a/demos/quickstart/protected/pages/Controls/Standard.page +++ b/demos/quickstart/protected/pages/Controls/Standard.page @@ -15,7 +15,7 @@ TColorPicker represents an input field taking color values via a color dialog. -
  • * +
  • TDatePicker represents an input field taking date values via a calendar dialog.
  • @@ -27,7 +27,7 @@ TFileUpload represents a file upload field. It allows users to upload a file to server. -
  • +
  • * THead represents the <head> element on an HTML Web page. It is required by a PRADO page should it use themes.
  • diff --git a/demos/quickstart/protected/pages/Controls/Validation.page b/demos/quickstart/protected/pages/Controls/Validation.page index 6fe87fd0..6d83af3d 100644 --- a/demos/quickstart/protected/pages/Controls/Validation.page +++ b/demos/quickstart/protected/pages/Controls/Validation.page @@ -26,14 +26,19 @@ Validators share a common set of properties, which are defined in the base class
  • Dynamic - the space for displaying the error message is NOT reserved. Therefore, showing up the error message will shift the layout of your page around (usually down).
  • +
  • ControlCssClass - the Css class that is applied to the control being validated in case the validation fails.
  • +
  • FocusOnError - set focus at the validating place if the validation fails. Defaults to false.
  • +
  • FocusElementID - the ID of the HTML element that will receive focus if validation fails and FocusOnError is true.
  • +

    TRequiredFieldValidator

    TRequiredFieldValidator ensures that the user enters some data in the specified input field. By default, TRequiredFieldValidator will check if the user input is empty or not. The validation fails if the input is empty. By setting InitialValue, the validator can check if the user input is different from InitialValue. If not, the validation fails.

    +

    TRegularExpressionValidator

    TRegularExpressionValidator verifies the user input against a regular pattern. The validation fails if the input does not match the pattern. The regular expression can be specified by the RegularExpression property. Some commonly used regular expressions include: @@ -58,7 +63,7 @@ Note, TRegularExpressionValidator only checks for nonempty user input. Use a TRe

    -

    TEmailAddressValidator

    +

    TEmailAddressValidator

    TEmailAddressValidator verifies that the user input is a valid email address. The validator uses a regular expression to check if the input is in a valid email address format. If CheckMXRecord is true, the validator will also check whether the MX record indicated by the email address is valid, provided checkdnsrr() is available in the installed PHP.

    @@ -66,7 +71,8 @@ TEmailAddressValidator verifies that the user input is a valid email address. Th Note, if the input being validated is empty, TEmailAddressValidator will not do validation. Use a TRequiredFieldValidator to ensure the value is not empty.

    - + +

    TCompareValidator

    TCompareValidator compares the user input with a constant value specified by ValueToCompare, or another user input specified by ControlToCompare. The Operator property specifies how to compare the values, which includes Equal, NotEqual, GreaterThan, GreaterThanEqual, LessThan and LessThanEqual. Before comparison, the values being compared will be converted to the type specified by DataType listed as follows, @@ -75,26 +81,40 @@ TCompareValidator compares the user input with a constant value specified by String - A string data type.

  • Integer - A 32-bit signed integer data type.
  • Float - A double-precision floating point number data type.
  • -
  • Currency - A decimal data type that can contain currency symbols.
  • Date - A date data type. The date format can be specified by setting DateFormat property, which must be recognizable by TSimpleDateFormatter. If the property is not set, the GNU date syntax is assumed.
  • Note, if the input being validated is empty, TEmailAddressValidator will not do validation. Use a TRequiredFieldValidator to ensure the value is not empty.

    +

    +N.B. If validating against a TDatePicker the DataType must be equal to "Date" and the DateFormat property of the validator must be equal to the DateFormat of the TDatePicker. +

    +

    TDataTypeValidator

    TDataTypeValidator verifies if the input data is of specific type indicated by DataType. The data types that can be checked against are the same as those in TCompareValidator.

    +

    +N.B. If validating against a TDatePicker the DataType must be equal to "Date" and the DateFormat property of the validator must be equal to the DateFormat of the TDatePicker. +

    + + +

    TRangeValidator

    TRangeValidator verifies whether an input value is within a specified range. TRangeValidator uses three key properties to perform its validation. The MinValue and MaxValue properties specify the minimum and maximum values of the valid range. The DataType property specifies the data type of the value being validated. The value will be first converted into the specified type and then compare with the valid range. The data types that can be checked against are the same as those in TCompareValidator.

    +

    +N.B. If validating against a TDatePicker the DataType must be equal to "Date" and the DateFormat property of the validator must be equal to the DateFormat of the TDatePicker. +

    + +

    TCustomValidator

    TCustomValidator performs user-defined validation (either server-side or client-side or both) on an input control. @@ -118,7 +138,7 @@ function ValidationFunctionName(sender, parameter) - +

    TValidationSummary

    TValidationSummary displays a summary of validation errors inline on a Web page, in a message box, or both. diff --git a/demos/quickstart/protected/pages/GettingStarted/AboutPrado.page b/demos/quickstart/protected/pages/GettingStarted/AboutPrado.page index 5ea7a1cf..6ac58b73 100644 --- a/demos/quickstart/protected/pages/GettingStarted/AboutPrado.page +++ b/demos/quickstart/protected/pages/GettingStarted/AboutPrado.page @@ -48,21 +48,21 @@ Without caching techniques, PRADO may not be suitable for developing extremely h PRADO is described as a unique framework. Its uniqueness mainly lies in the component-based and event-driven programming paradigm that it tries to promote. Although this programming paradigm is not new in desktop application programming and not new in a few Web programming languages, PRADO is perhaps the first PHP framework enabling it.

    -Most PHP frameworks are trying to establish a loose standard of organizing PHP programming, most preferably the MVC (model-view-controller) model. It is difficult to compare PRADO with these frameworks because they have different focuses. What we can say is, PRADO is more like a high-level language built upon PHP while those MVC frameworks stand for the best programming practices. Both aim to help developers to rapidly complete Web application development. The advantage of PRADO is its rich set of prebuilt powerful components and extreme reusability of the PRADO code, while the advantage of the MVC frameworks is the complete separation of model, view and controller, which greatly facilitates team integration. +Most PHP frameworks are trying to establish a loose standard of organizing PHP programming, most preferably the MVC (model-view-controller) model. It is difficult to compare PRADO with these frameworks because they have different focuses. What we can say is, PRADO is more like a high-level language built upon PHP, while the MVC frameworks stand for the best programming practices. Both aim to help developers to rapidly complete Web application development. The advantage of PRADO is its rich set of prebuilt powerful components and extreme reusability of the PRADO code, while the advantage of the MVC frameworks is the complete separation of model, view and controller, which greatly facilitates team integration.

    History of PRADO

    -The very original inspiration of PRADO came from Apache Tapestry. During the design and implementation, I borrowed many ideas from Borland Delphi and Microsoft ASP.NET. The first version of PRADO came out in June 2004 and was written in PHP 4. Driven by the Zend PHP 5 coding contest, I rewrote PRADO in PHP 5, which proved to be a wise move, thanks to the new object model provided by PHP 5. PRADO won the grand prize in the Zend contest, earning high votes both from the public and from the judges' panel. +The very original inspiration of PRADO came from Apache Tapestry. During the design and implementation, I borrowed many ideas from Borland Delphi and Microsoft ASP.NET. The first version of PRADO came out in June 2004 and was written in PHP 4. Driven by the Zend PHP 5 coding contest, I rewrote PRADO in PHP 5, which proved to be a wise move, thanks to the new object model provided by PHP 5. PRADO won the grand prize in the Zend contest, earning the highest votes from both the public and the judges' panel.

    -In August 2004, PRADO was hosted on SourceForge as an open source project. Soon after, the project site xisc.com was announced to public. With the fantastic support of PRADO developer team and PRADO users, PRADO evolved to version 2.0 in mid 2005. In this version, Wei Zhuo contributed to PRADO with the excellent I18 and L10N support. +In August 2004, PRADO started to be hosted on SourceForge as an open source project. Soon after, the project site xisc.com was announced to public. With the fantastic support of PRADO developer team and PRADO users, PRADO evolved to version 2.0 in mid 2005. In this version, Wei Zhuo contributed to PRADO with the excellent I18N and L10N support.

    In May 2005, we decided to completely rewrite the PRADO framework to resolve a few fundamental issues found in version 2.0 and to catch up with some cool features available in Microsoft ASP.NET 2.0. After nearly a year's hard work with over 50,000 lines of new code, version 3.0 was finally made available in April 2006.

    -Starting from version 3.0, significant efforts are allocated to ensure the quality and stability of PRADO. If we say PRADO v2.x and v1.x are proof-of-concept work, we can say PRADO 3.x grows up to a serious project that is suitable for business application development. +Starting from version 3.0, significant efforts are allocated to ensure the quality and stability of PRADO. If we say PRADO v2.x and v1.x are proof-of-concept work, we can say PRADO 3.x has grown up to a project that is suitable for serious business application development.

    \ No newline at end of file -- cgit v1.2.3