Recurring Schedules: ab-common-recurring-pattern-edit.js
Recurring Schedules: ab-common-recurring-pattern-edit.js
This file contains the javascript code corresponding to the view file above. The following are the ‘public’ methods in the view controller (
abRecurringPatternCtrl
) that are available for external use. These are used when embedding the recurrence panel into the layout of your view in an existing or new region.
Method | Description |
---|---|
abRecurringPatternCtrl.getRecurringPattern() | Generates and returns the XML string representation of the current recurrence schedule pattern displayed in the User Interface (UI). Store this string in any text field (minimum size of 96 characters) in any table that you wish. Do not parse or modify this string, as the format is internal to the Recurrence Schedules toolkit and subject to change. |
abRecurringPatternCtrl.setRecurringPattern(xmlPattern, isDisable) |
Displays the recurrence schedule pattern contained in the string parameter
The
|
abRecurringPatternCtrl.getRecurringPatternType() | Returns a string representation of the recurring schedule type currently selected in the UI: ‘none’, ‘once’, ‘day’, ‘week’, ‘month’, ‘year’. |
abRecurringPatternCtrl.setRecurringPatternType (rtype) | Sets the recurring schedule type currently selected in the UI: ‘none’, ‘once’, ‘day’, ‘week’, ‘month’, ‘year’. |
abRecurringPatternCtrl.clearRecurringPattern( ) | Sets all controls in the UI to a default initial state. This includes unchecking all radio buttons and checkboxes, clearing all edit boxes, and setting the “Every:” edit box to 1. The pattern type radio button for None is checked. |
abRecurringPatternCtrl.enableRecurringPattern (isEnabled) |
Enables or disables all controls in the UI. The parameter
isEnabled
is optional. If omitted, the controls are enabled. Use this parameter when you need to display the UI in read-only mode.
|
abRecurringPatternCtrl.showRecurringPatternPanel (isShow) |
Shows (true) or hides (false) the entire Recurring Schedules panel. The
isShow
parameter is optional. If omitted, the panel is shown.
|
abRecurringPatternCtrl.getVal_EndAfterOccurrences() | Returns the current numeric value in the “End After:” edit box in the UI. If the box is empty, this method returns the value 0. You might need to access this value in the UI in some cases, for example if you need to enforce a minimum and/or maximum value entered for the number of occurrences. |
abRecurringPatternCtrl.showDateStart(isShow) |
Shows (true) or hides (false) a Date Start field. By default, the Date Start field is hidden. The value in this field is not stored in the XML pattern. It is up to the application code to get the value selected by the user (using the
getDateStart
method below) and use it to generate dates and/or store it in the database.
|
abRecurringPatternCtrl.showDateEnd(isShow) |
Shows (true) or hides (false) a Date End field. By default, the Date End field is hidden. The value in this field is not stored in the XML pattern. It is up to the application code to get the value selected by the user (using the
getDateEnd
method below) and use it to generate dates and/or store it in the database.
|
abRecurringPatternCtrl.enableDateStart(isEnabled) |
Enables (true) or disables (false) the Date Start field. By default, the Date Start field is enabled (when shown). This method is useful when you want to display a fixed Date Start value that the user cannot change, in which case you would invoke
showDateStart()
,
setDateStart(value)
, and then
enableDateStart(false)
.
|
abRecurringPatternCtrl.enableDateEnd(isEnabled) |
Enables (true) or disables (false) the Date End field. By default, the Date End field is enabled (when shown). This method is useful when you want to display a fixed Date End value that the user cannot change, in which case you would invoke
showDateEnd()
,
setDateEnd(value)
, and then
enableDateEnd(false)
.
|
abRecurringPatternCtrl.getDateStart() | Returns the value of the Date Start field in the form. |
abRecurringPatternCtrl.getDateEnd() | Returns the value of the Date End field in the form. |
abRecurringPatternCtrl.setDateStart(dateVal) |
Sets the value of the Date End field in the form to
dateVal
.
|
abRecurringPatternCtrl.getRecurringType() |
Returns a string representation of the stored recurring schedule type that was set in the UI when the
getRecurringPattern()
function was last called: ‘none’, ‘once’, ‘day’, ‘week’, ‘month’, ‘year’.
|
abRecurringPatternCtrl.getInterval() |
Returns the stored recurring interval that was set in the UI when the
getRecurringPattern()
function was last called. The return value is an integer, specifying the number of days, weeks, months, or years of the recurring pattern, i.e. Every x days/weeks/months/years.
|
abRecurringPatternCtrl.getTotal() |
Returns the stored maximum number of occurrences that was set in the UI when the
getRecurringPattern()
function was last called. The return value is an integer, and defaults to 0 if no value was set in the UI.
|
abRecurringPatternCtrl.getDaysOfWeek() |
Returns the stored day(s) of the week that was set in the UI when the
|
abRecurringPatternCtrl.getDayOfMonth() |
Returns the stored day of the month that was set in the UI when the
getRecurringPattern()
function was last called. The return value is an integer from 0-31. A value of 0 means that no value was set in the UI.
|
abRecurringPatternCtrl.getWeekOfMonth() |
Returns the stored week of the month that was set in the UI when the
getRecurringPattern()
function was last called. The return value is an integer from 0-5 to indicate the 1st, 2nd, 3rd, 4th, or last week of the month. A value of 0 means that no value was set in the UI.
|
abRecurringPatternCtrl.getMonthOfYear() |
Returns the stored month of the year that was set in the UI when the
getRecurringPattern()
function was last called. The return value is an integer from 0-12. A value of 0 means that no value was set in the UI.
|
abRecurringPatternCtrl.setSchedulingLimits(dayVal, weekVal, monthVal, yearVal) |
Sets the future scheduling limit in years for each recurring type. The limits set with this function are only used for the string displayed in the UI: “Note: Scheduling limit for your selection is {0} years in the future.” The toolkit substitutes the {0} parameter with the scheduling limits set with this function for the currently selected recurring type. If you do not set any limits, the default limits in the application parameter AbCommonResources-RecurringSchedulingLimits are used. If the activity parameter does not exist, then the default limits of 5, 5, 5, 10 years are used. A value of (-1) indicates no limit. However, the date generation code still enforces a limit of 999 maximum occurrences for all recurring types. |
Displaying the Recurrence Panel in a Dialog
The above methods are used when embedding the recurrence panel into the layout of your view in an existing or new region. If you wish to display the recurrence panel in a pop-up dialog box, the following approach and features are available:
View.openDialog('ab-common-recurring-pattern-edit.axvw', null, false, {
width: 520, height: 300,
closeButton: false,
xmlPatternRecurrence: null, // required
enableRecurringPattern: false, // optional, set to false to disable all controls in the UI
recurringPatternType: 'day', // optional, default=’none’
dateStart: '2013-08-08', // optional, set to ‘’ for blank initial value
dateEnd: '2013-09-09', // optional, set to ‘’ for blank initial value
enableDateStart: true, // optional, set to false to show the field disabled (if dateStart specified)
enableDateEnd: true, // optional, set to false to show the field disabled (if dateEnd specified)
schedulingLimits: ‘day;5;week;5;month;5;year;10’, // optional, set future schedule limits for
each recurrence type
callback: function(xmlPatternNew, parameters) {
formPanel.setFieldValue("table.recurrence_pattern", xmlPatternNew);
}
});
-
Include
enableRecurringPattern: false
to display the recurring pattern in read-only mode with all controls and fields disabled. -
Include
recurringPatternType
to set the initial recurrence type for new patterns (valid string values are none,once,day,week,month,year). -
Include
dateStart
to display a Date Start field and optionally set its initial value. To simply display the field with a blank initial value, use''
. -
Include
dateEnd
to display a Date End field and optionally set its initial value. To simply display the field with a blank initial value, use''
. -
Include
enableDateStart:false
to disable the Date Start field when displayed. This has no effect unlessdateStart
is also included to actually display the field. This is useful to display a preset value that the user cannot change. -
Include
enableDateEnd:false
to disable the Date End field when displayed. This has no effect unlessdateEnd
is also included to actually display the field. This is useful to display a preset value that the user cannot change.
Callback Function
The callback function is invoked when the user clicks the Save button in the pop-up dialog window. The xmlPatternNew argument contains the recurrence pattern XML string set in the UI. The parameters argument contains the following values from the interface:
xmlPatternRecurrence | The xml pattern, same value as the xmlPatternNew argument. |
description | localized readable description of XML pattern in xmlPatternRecurrence. |
dateStart | Value in the Date Start field. |
dateEnd | Value in the Date End field. |
recurringPatternType | recurring pattern type string (none, once, day, week, month, year) |
totalOccurrences | Integer in the End After Occurrences box. |
interval | value obtained from getInterval() |
daysOfWeek | value obtained from getDaysOfWeek() |
dayOfMonth | value obtained from getDayOfMonth() |
weekOfMonth | value obtained from getWeekOfMonth() |
monthOfYear | value obtained from getMonthOfYear() |
The following utility function is available in the javascript module as a general function, outside the view controller:
getRecurringRuleDescription (xmlRecurringRule) | Returns a localized readable description of the XML-encoded recurring pattern in the xmlRecurringRule string |