Change the input method in plone event forms? - plone

I am trying do one of the following in the "Create Event" form in Plone 4, when creating events which happened in the past:
i. Set the default start/end dates in the "Start Date" and "End Date" drop-downs to a larger range of values (I cannot create events before 2001 or after 2016).
OR
ii. Allow users to input start/end dates for events as text (rather than select from a drop-down).
I can't seem to find what is controlling this form anywhere... after hours of googling!

The start and end fields are standard Archetypes DateTimeField fields, using the default CalendarWidget widgets.
The CalendarWidget reuses some fairly old and crufty calendar macros from Plone, and these read the range of selectable years from the site properties. You can change these in the ZMI, find the portal_properties tool, then the site_properties property sheet within that. The two properties to look for are:
calendar_starting_year
The starting year to show in the calendar widget. Default is 2001.
calendar_future_years_available
The number of future years, after the current year, to show in the calendar widget. Default is empty, and the widget then falls back to 5 years.
Also see the site properties documentation; you can also use a GenericSetup profile to set these.
These values apply to all usage of the calendar macros. You can also set this for just the event type, by setting the starting_year, ending_year and/or future_years properties on the CalendarWidget for the startDate and endDate fields. If you set an ending_year the future_years property is ignored.
Monkey-patch style altering of the event schema:
from Products.Archetypes.content import event
ATEventSchema['startDate'].widget.starting_year = 1999
ATEventSchema['startDate'].widget.ending_year = 2020
ATEventSchema['endDate'].widget.starting_year = 1999
ATEventSchema['endDate'].widget.ending_year = 2020

If the starting_year and ending_year are not defined on the definition level of the calendarwidget (inside the definition of the ATEvent schema implementation) then some assumptions about the year range is made inside
Products/CMFPlone/skins/plone_scripts/date_components_support.py
Modify the related code inside the date_components_support.py script.

Related

AngularJS datepicker change day item CSS

I'd like to use the http://angular-ui.github.io/bootstrap/#/datepicker.
Also, I have e.g. a the Events list for, let's say - 12th January
Is it possible to change e.g. the color of that day in the datepicker that I can see that for that day some events exist ?
the reason is, I'd like to give the opportunity for users to be aware whose days contains any Events
I've found that plugin https://github.com/eternicode/bootstrap-datepicker (in the demo, set the 'multidate' textbox value to true).
Moreover, that plugin offers the method to select many dates.
That's exactly I was looking for

How to select a date in Flex datechooser using TestComplete

We are testing a Flex application using TestComplete Tool. The tool is able to recognize all the fields inside the Flex application. As part of this, we need to select dates (DateChooser object) for few of the fields in a Form.
Issue: We are selecting the date in the datechooser object by setting the "selectedDate" property.
fromDate.FlexObject.selectedDate = aqDateTime.Today
The selected date appears in the UI for the fromDate field.On submitting the form, we are getting error message as "fromDate field is empty".
Do we need to set any additional fields to register the selected date?
We are using VBScript as scripting language in the Test Complete Tool.
The problem is that a required event is not fired when the value is set programmatically (e.g. OnKeyPress or something like that). You need to make your test type the date to the field in order to make this event work:
fromDate.FlexObject.selectedDate.Keys "6/2/2014"

adding field to the combo box in assest depreciation profile form

i am new to ax2012. I have a doubt in asset depreciation profile form.There is combo box called period frequency in that, i need to add a field called monthly. Can any one help me out ?
I have tried out by creating base enum for monthly filed but i didn't get the output required.
This field is an Enum of type AssetAccrualFiscal, therefore you need to add a monthly element to this AssetAccrualFiscal in the AOT.
Beware however, the field is controlled by an edit method, and changing the field triggers some business logic.
This can be found in the table method accrualFiscal() on the table AssetDepreciationProfile. You may need to decide which part of the existing logic needs to consider your new enum element when it is selected.
See my comment, but basically you need to find out which base enum the combo box uses (supposing it is an enum combo box) and add a new element "monthly" to that enum.
If it is a standard enum, please leave a gap between the last enum element index and the index of your new element. This leaves room for new elements from Microsoft and enables easier upgrades.
Did some digging, in AX 2012 R2 there already is an element "monthly" for the period frequency combo box. Please take a look at enum "AssetAccrualCalendar" and method "accrualCalendar" on table AssetDepreciationProfile.

Copy/duplicate field values on add/edit (plone/dexterity)

I have a dexterity content type (container) where I have two custom fields for a contract start date and end date.
When creating the type I’d like the end date to be used also for the Plone “expiration date”.
How do I copy the Date over to the Expiration Date field?
I think you have 2 approaches to solve this: the first is to use the standard expires field directly instead of your custom end date field; you could have an issue if you want to override the label/description of it, as you will have no way (AFAIK) to change them only for your domain.
the second one could be to override the standard expires field and make its getter method return the value of your custom end date field.
check the following documentation:
Plone and Dexterity: Working with computed fields
Plone Developer Documentation: Behaviors
Medatada definitions inside plone.app.dexterity

Month navigation sidebar in blog section?

I have a blog section in a drupal website, built with Views. I want to add a sidebar with month navigation (as in each mont is listed with the number of posts, etc). How can I do this, preferably with Views?
Drupal views can create views which allow you to select and list or summarise lists of nodes by various fields including the date related fields. You can do this by adding an argument, and then setting how the view behaves when no argument is supplied.
Are you looking for something along the following lines?
March 2010 (3)
February 2010 (12)
January 2010 (7)
... etc.
Create a view called Monthly Summary, and add an "argument" 'Node: Created year + month'.
Then use the options on the argument to select the 'action to take if argument is not present'. Select 'Summary, sorted descending' to create list with most recent month at top.
Watch out for sorting issues - this choice of how you sort the monthly summary in the argument settings will override the usual views sort order. This caught me out for a while.
Have you tried the Date/Calendar modules? Some more details about the Calendar module (from its project page):
This module will display any Views date field in calendar formats, including CCK date fields, node created or updated dates, etc. Switch between year, month, and day views. Back and next navigation is provided for all views. Lots of the Calendar functionality comes from the Date module, so any time you update the Calendar module you should be sure you also update to the latest version of the Date module at the same time.
See also Date iCal, a project that contains code and features needed to either import or export dates using iCal feeds. The functionality that used to be in the Calendar iCal module has been moved into that module.

Resources