plone.app.event - a calendar framework for Plone¶
Overview
plone.app.event is a new calendar framework for Plone.
Features:
- Dexterity behaviors and Archetypes type,
- Timezone support,
- Recurring Events,
- Whole day events,
- Open end events (End on the same day),
- Icalendar export,
- Icalendar import,
- Better calendar and events portlets,
- An event listing and event detail view.
It was developed with these goals in mind:
- Encapsulation and independence: All event related code should reside in a single package. Relevant, re-usable functionality is split to seperate packages. Plone’s dependencies on calendar related code should be reduced to a minimum. plone.app.event should be able to be deinstalled from Plone.
- Dexterity and Archetypes support: plone.app.event should provide Dexterity behaviors, which can be used in Dexterity types and an ATEvent content type (factored out from ATContentTypes). For a Dexterity event type, use plone.app.contenttypes 1.1 or newer.
- Standards compliancy: We support the icalendar standard (RFC5545) including recurrence.
- Recurring events based on the RFC5545 standard.
Documentation¶
Installation¶
Compatibility¶
plone.app.event is tested with latest Plone 4.3 and the upcoming Plone 5.0.
Removed 4.2 compatibility¶
Since plone.app.event 1.1b1 we depend on changes from plone.app.contenttypes 1.1b1, which depends on plone.dexterity>=2.2.1 which itself (since 2.2) depends on a AccessControl version not provided by the Plone 4.2 version fixes.
You can still experiment with Plone 4.2 compatibility if you need to, but officially it’s support in plone.app.event is removed. There are a number of other compatibility issues to be solved and the tests will fail anyways. If you really need to, use this as a starting point:
plone.app.dexterity = 2.0.10
plone.dexterity = 2.1.3
plone.app.contenttypes = 1.1a1
z3c.form = 3.0.5
plone.app.z3cform = 0.7.5
Buildout files¶
- buildout.cfg: plone.app.event base installation.
- dev.cfg: plone.app.event development configuration, including tests.
- tests.cfg: plone.app.event tests only.
- sources.cfg: plone.app.event mr.developer source definitions.
- versions.cfg: plone.app.event version requirements.
Installation¶
Depend on one (or both) of these setuptools dependencies:
'plone.app.event [dexterity]'
or:
'plone.app.event [archetypes]'
The zcml dependency is be loaded automatically by z3c.autoinclude.
Then install plone.app.event via the controlpanel or by depending on the following GenericSetup profile in metadata.xml:
plone.app.event:default
For Archetypes, use this one:
plone.app.event.at:default
Don’t use the plone.app.event.dx:default profile, which will be removed in future versions of plone.app.event. Please create your own type based on plone.app.event’s Dexterity behaviors (Through the web or via a GenericSetup profile), or install plone.app.contenttypes for ready-to-use Dexterity types.
Plone 4.3 installation¶
plone.app.event depends on plone.app.portlets>=2.5a1. This version has the calendar and event portlet removed, which are now in plone.app.event itself. Also, it allows the calendar portlet to do AJAX calls without KSS via standard jQuery. For Plone < 5.0 you have to fix the plone.app.portlets version in your buildout like so:
[buildout]
versions = versions
[versions]
plone.app.portlets = 2.5a1
Upgrading from plone.app.event 1.0¶
The “ploneintegration” setuptools extra, subpackage and GenericSetup profile have been gone. You just need to remove these dependencies from your setup and use the “plone.app.event.at:default” profile instead, if you plan to use the Archetypes based ATEvent type.
Use the provided upgrade steps to upgrade Dexterity behaviors: Attribute storage (Migrate fields from annotation storage to attribute storage) and New IRichText behavior (Enable the new IRichText instead of the IEventSummary behavior).
Upgrading from Products.ATContentType to plone.app.event¶
Warning
Please backup before upgrading and check the upgraded contents for validity!
If you want to upgrade Products.ATContentTypes based ATEvents to plone.app.event ones, there is an upgrade step for that: “Upgrades old AT events to plone.app.events” (Metadata version 1 to 2). In order to use it, go to Plone Control Center -> ZMI -> portal_setup -> Upgrades. Select “plone.app.event.at:default” profile and click “Show old upgrades”. Select the upgrade step and run it.
You might also need to “clear and rebuild” the catalog after upgrading. You can do so at Plone Control Center -> ZMI -> portal_catalog -> Advanced (this may take a while)
Upgrading to Dexterity¶
Upgrade steps to migrate Products.ATContentTypes based ATEvents, plone.app.event based ATEvents or plone.app.event Dexterity example types (plone.app.event.dx.event) to plone.app.contenttypes Dexterity Events can be found within plone.app.contenttypes. This package utilizes plone.app.event’s Dexterity behaviors for it’s Event type.
Configuration¶
Note
Don’t forget to set the portal timezone!
After installation, please set your timezone in the @@event-settings controlpanel. Otherwise time calculations are based on UTC and likely wrong for your timezone. Also set the first weekday setting for correct display of the first weekday in calendar views.
Architectural Overview¶
Design goals¶
The development of plone.app.event was done with following design goals in mind:
[a] Encapsulation and independence: All event related code should reside in a seperate package (splitted into other packages, where appropriate). Plone should be least dependend on plone.app.event. Best would be that one can deinstall this feature completly.
[b] Dexterity and Archetypes support: plone.app.event should provide Dexterity behaviors, which can be used in Dexterity types and an ATEvent content type (factored out from ATContentTypes) as a replacement for the Products.ATContentType ATEvent.
[c] Standards compliancy: the iCalendar / RFC5545 standard is wonderful flexible, so plone.app.event should provide support for it by allowing ical exports. This is also available for the current ATContentType based implementation, but plone.app.event aims to improve it. A future goal is to support CalDAV also.
[d] Recurring events support based on the RFC5545 standard.
[e] A modern dateinput widget.
[f] Features like whole-day-events.
[g] Timezone support.
Encapsulation and independence: plone.app.event provides the Archetypes based type and the Dexterity behaviors via two other subpackages in that package: at and dx. Based on installed features (Products.ATContentTypes or plone.dexterity, respectively), eather of those subpackages are included via the zcml:condition statement. The calendar and event portlets were moved from plone.app.portlets into plone.app.event, where they belong semantically - thus improving encapsulation and independence and reducing interwoven dependencies. The calendar portlet was completly refactored. The functionality of the CalendarTool (portal_calendar) was reimplenented. Important settings from the calendar-controlpanel are now available in the event configlet. Since the calendar portlet was the only consumer of the CalendarTool, the CalendarTool, the calendar controlpanel and the dependency to Products.CMFCalendar can be dropped. The new plone.formwidget.datetime implements archetypes and z3cform based widgets, so the old datetime widget can be dropped. Python-dateutil provides recurrence calculations based on the RFC5545 standard - plone.formwidget.recurrence provides a awidget for recurrence and Products.DateRecurringIndex an appropriate index as a drop-in replacement for Zope’s DateIndex. The iCalendar package was improved and is now used for plone.app.event to provide icalendar serialization. The timezone support is based on the pytz package. Plone now haves a portal timezone, User timezones and every event can define another timezone, if wished. User timezones are planned. Whole day events get their starttime set to 0:00 and endtime set to 23:59:59 - thats should be feasable in most cases
(excluding any scientific events...).
Packages¶
plone.app.event¶
Github: https://github.com/plone/plone.app.event
The “at” submodule provides the Archetypes based ATEvent content type as a drop-in replacement of the ATContentType based ATEvent. Ical, recurrence and generic event accessor adapters and some event subscribers related to the ATEvent.
The “dx” submodule provides Dexterity behaviors (some granular ones). Like in the “at” submodule, ical, recurrence and generic event accessor adapters as well as some event subscribers are provided.
Both subpackages are only loaded, if the neccassary features are installed.
plone.app.event does not depend on CMFCalendar and the portal_calendar tool any more. Plone core’s only consumer of this package was the calendar portlet anyways, which was completly rewritten.
base.py provides some basic event related functionality. Many of them need a context in order to get the correct timezone.
The “browser” submodule provides the new “event” controlpanel (the “calendar” controlpanel can be dropped, since we do not need CMFCalendar any more). The settings are stored in plone.registry. The event view is generic to ATEvent and DX based event types.
The ical submodule provides adapters and views for export and import to and from icalendar resources.
The locales directory which holds locale files.
In the portlets subpackage there are portlet_calendar (a complete rewrite) and portlet_events, both from plone.app.portlets, where only BBB imports exist, so that existing installations do not break.
The tests are all ported to plone.app.testing.
plone.event¶
Github: https://github.com/plone/plone.event
Date/time related utilities, recurrence calculations based on python-dateutil.
plone.formwidget.datetime¶
Github: https://github.com/plone/plone.formwidget.datetime
Derived from collective.z3cform.datetimewidget and archetypes.datetimewidget (which itself was derived from the former). It is splitted into “at” and “z3cform” subpackages, like plone.app.event.
plone.formwidget.recurrence¶
Github: https://github.com/plone/plone.formwidget.recurrence
Recurrence widget based on jquery.recurrenceinput.js. Supports complex recurrence rules with exclusion and inclusion dates, automatically updated occurrences display within the widget and a nicely formatted string which explains the recurrence rule. The recurrence rule is stored as a RFC5545/icalendar compatible recurrence string.
Products.DateRecurringIndex¶
Github: https://github.com/collective/Products.DateRecurringIndex
A drop-in replacement for Zope’s DateIndex with support for recurring events. Each recurrence get’s an index entry.
Other, external packages¶
plone.app.eventindex¶
Github: https://github.com/regebro/plone.app.eventindex
A possible alternative to Products.DateRecurringindex, which supports late indexing and which does not have problems with unlimited occurrences. This eventindex is currently not used by plone.app.event.
Python-dateutil¶
Documentation: http://labix.org/python-dateutil Repository: https://launchpad.net/dateutil
Useful extensions to the standard Python datetime features. plone.app.event uses it mainly for recurrence calculations.
Pytz¶
Documentation: http://pytz.sourceforge.net/ Pypi page: https://pypi.python.org/pypi/pytz/
World timezone definitions, modern and historical. Based on the Olson database.
Developer documentation¶
The IEvent interface¶
All event types should implement the IEvent interface from plone.event.interfaces, in order that some functionality of plone.app.event can be used. For example, catalog searches for event objects ask for the IEvent interface in the object_provides index:
from plone.event.interfaces import IEvent
assert(IEvent.providedBy(obj)==True)
Custom event content types¶
Using Dexterity behaviors to build new content types with IEvent support¶
For Dexterity use the plone.app.event.dx.behaviors.IEventBasic and optionally any other event related behavior from there.
You can just enable the behaviors you want to use for your custom content type in the FTI via GenericSetup or through the web. This types/Event.xml GenericSetup FTI configuration snippet from plone.app.contenttypes shows an example. The only behavior, which is definitely needed is the IEventBasic behavior. All other are optional:
<property name="behaviors">
<element value="plone.app.event.dx.behaviors.IEventBasic"/>
<element value="plone.app.event.dx.behaviors.IEventRecurrence"/>
<element value="plone.app.event.dx.behaviors.IEventLocation"/>
<element value="plone.app.event.dx.behaviors.IEventAttendees"/>
<element value="plone.app.event.dx.behaviors.IEventContact"/>
<element value="plone.app.contenttypes.behaviors.richtext.IRichText"/>
<element value="plone.app.dexterity.behaviors.metadata.IDublinCore"/>
<element value="plone.app.content.interfaces.INameFromTitle"/>
<element value="plone.app.dexterity.behaviors.discussion.IAllowDiscussion"/>
<element value="plone.app.dexterity.behaviors.exclfromnav.IExcludeFromNavigation"/>
<element value="plone.app.relationfield.behavior.IRelatedItems"/>
<element value="plone.app.versioningbehavior.behaviors.IVersionable" />
</property>
Of course, it’s also possible to create a new behavior which derives from plone.app.event’s one, like so:
from plone.app.event.dx.behaviors import IEventBasic
from plone.app.event.dx.behaviors import IEventLocation
from plone.app.event.dx.behaviors import IEventRecurrence
from plone.app.event.dx.behaviors import first_weekday_sun0
from plone.app.event.dx.interfaces import IDXEvent
from plone.app.event.dx.interfaces import IDXEventLocation
from plone.app.event.dx.interfaces import IDXEventRecurrence
from plone.autoform import directives as form
from plone.autoform.interfaces import IFormFieldProvider
from zope.interface import alsoProvides
class IEvent(IEventBasic, IEventRecurrence, IEventLocation,
IDXEvent, IDXEventLocation, IDXEventRecurrence):
"""Custom Event behavior."""
form.widget('start', first_day=first_weekday_sun0)
form.widget('end', first_day=first_weekday_sun0)
form.widget('recurrence',
start_field='IEvent.start',
first_day=first_weekday_sun0)
alsoProvides(IEvent, IFormFieldProvider)
Note
If you don’t register the behavior with a factory and a marker interface like it’s done in plone.app.event, the behavior is the marker interface itself (see plone.app.dexterity’s documentation on behavior marker interfaces). In this case, the behavior should also derive from the marker interfaces defined in plone.app.event.dx.interfaces in order to let it use all of plone.app.event’s functionality (indexers, adapters and the like).
Note
You have to reconfigure the start, end and recurrence fields’ widgets again. The widgets for the start and end fields have to be configured with the first_day parameter while the recurrence field widget has to be configured with the first_day and start_field parameters. Even if the start field is derived from another behavior, in this case the dotted-path includes the new behavior: IEvent.start.
Then register the behavior in ZCML:
<plone:behavior
title="Event"
description="A Event"
provides=".behaviors.IEvent"
for="plone.dexterity.interfaces.IDexterityContent"
/>
And register it in your FTI via GenericSetup as usual.
Extending the Archetypes based plone.app.event.at.content.ATEvent class¶
For Archetypes, derive from plone.app.event.at.content.ATEvent.
Here is an example from collective.folderishtypes:
from Products.Archetypes import atapi
from plone.app.event.at import content as event
type_schema = event.ATEventSchema.copy() # Add your custom fields here
# Move location back to main schemata
type_schema.changeSchemataForField('location', 'default')
type_schema.moveField('location', before='attendees')
class CustomEvent(event.ATEvent):
portal_type = 'Custom Event'
_at_rename_after_creation = True
schema = type_schema
atapi.registerType(CustomEvent, PROJECTNAME)
Register this type in the FTI via Generic Setup as usual.
None of the above¶
If you cannot use the above two methods, you can still implement the plone.event.interfaces.IEvent interface.
In any case you might need to provide an IEventAccessor adapter. For more information, see below.
Getting and setting properties¶
For Dexterity based types: Accessing properties behavior interface adaption¶
To use the functionality provided by the behaviors, get the behavior adapter first. For example, for setting or getting attributes of an event object, do:
from plone.app.event.dx.behaviors import IEventBasic
event = IEventBasic(obj)
event.start = datetime(2011,11,11,11,00)
event.end = datetime(2011,11,11,12,00)
event.timezone = 'CET'
import transaction
transaction.commit()
Alternatively, use the more convenient IEventAccessor pattern described below.
Accessing event objects via an unified accessor object¶
To make it easier to support Archetypes and Dexterity based objects, an adapter for content objects is provided, which allows unified interaction with event objects.
The interface definition can be found in plone.event.interfaces.IEventAccessor. Default accessors:
- For IEvent (plone.event.interfaces.IEvent) implementing objects: plone.event.adapters.EventAccessor.
- For IATEvent (plone.app.event.at.interfaces.IATEvent): plone.app.event.at.content.EventAccessor.
- For IDXEvent (plone.app.event.dx.interfaces.IDXEvent): plone.app.event.dx.behaviors.EventAccessor.
- For IOccurrence (plone.event.interfaces.IOccurrence): plone.app.event.recurrence.EventAccessor.
Event objects implement the IEvent interface from plone.event.interfaces.
The objects can be accessed like so:
from plone.event.interfaces import IEventAccessor
acc = IEventAccessor(obj)
assert(isinstance(acc.start, datetime)==True)
assert(isinstance(acc.timezone, string)==True)
assert(isinstance(acc.recurrence, string)==True)
Set properties of the object via the accessor. Don’t forget to throw ObjectModifiedEvent after setting properties to call an event subscriber which does some timezone related post calculations:
from zope.event import notify
from zope.lifecycleevent import ObjectModifiedEvent
tz = pytz.timezone('Europe/Vienna')
acc.start = datetime(2012, 12, 12, 10, 10, tzinfo=tz)
acc.timezone = 'Europe/London'
notify(ObjectModifiedEvent(obj))
You can also use the accessor edit method, which also throws the ObjectModifiedEvent event for you:
acc.edit(end=datetime(2012, 12, 12, 20, 0, tzinfo=tz))
For creating events, you can use the accessor’s create method, which again returns an accessor. E.g. if you want to create the Dexterity based event type:
from plone.app.event.dx.behaviors import EventAccessor
acc = EventAccessor.create(
container=app.plone,
content_id=u'new_event'
title=u'New Event'
start=datetime(2013, 7, 1, 10, 0, tzinfo=tz),
end=datetime(2013, 7, 1, 12, 0, tzinfo=tz),
timezone='Europe/Vienna'
)
acc.location = u"Graz, Austria"
Access the content object from an accessor like so:
obj = acc.context
from plone.event.interfaces import IEvent
assert(not IEvent.providedBy(acc))
assert(IEvent.providedBy(obj))
Getting occurrences from IEventRecurrence implementing objects¶
Events with recurrence support should implement the IEventRecurrence (plone.event.interfaces.IEventRecurrence) interface.
An IRecurrenceSupport implementing adapter allows the calculation of all occurrences:
from plone.event.interfaces import IRecurrenceSupport
rec_support = IRecurrenceSupport(obj)
# All occurrences of the object
rec_support.occurrences()
# All occurrences within a time range
start = datetime(2012,1,1)
end = datetime(2012,1,3)
rec_support.occurrences(range_start=start, range_end=end)
If you want to get all occurrences from any event within a timeframe, use the get_events function like so:
from plone.app.event.base import get_events, localized_now
occ = get_events(context, start=localized_now(), ret_mode=2, expand=True)
Reusing the @@event_summary view to list basic event information¶
The @@event_summary listing lists basic event information including microdata on the right hand side of the default event view. You can reuse this listing in custom views by calling the event_summary view on an IEvent providing context in page templates like so:
<tal:eventsummary replace="structure context/@@event_summary"/>
or in Python code like so:
context.restrictedTraverse('@@event_ticket_summary')()
There are cases where you might exclude some of this information. You can do that by overriding the excludes list of the view. Possible values are:
title
subjects
date
occurrences
location
contact
event_url
ical
Running tests¶
After running buildout with the dev.cfg or tests.cfg config files, you can run all tests (including robot tests with --all switch) like so:
./bin/test -s plone.app.event --all
The -t switch allows you to run a specific test file or method. The –list-tests lists all available tests.
To run the robot tests do:
./bin/test --all -s plone.app.event -t robot
For development, it might be more convenient to start a test server and run robot tests individually, like so:
./bin/robot-server plone.app.event.testing.PAEventDX_ROBOT_TESTING
./bin/robot plone/app/event/tests/robot/test_event_roundtrip.robot
In the robot test you can place the debug statement to access a robot shell to try things out.
For more information on this topic visit: http://developer.plone.org/reference_manuals/external/plone.app.robotframework/happy.html
Development design choices¶
- Timezone support. Every event has a timezone.
- Usage of pytz. The timezone library used it pytz. Other timezone identifiers than defined in pytz (Olson database) are not supported.
- Dropped support for ambiguous timezones. Three letter timezones like CET, MET, PST, etc. are not supported.
- Start/end datetime inputs are treated as localized values. If a timezone on an event is changed afterwards, the datetime values are not converted to the target timezone.
- Whole day events last from 0:00 until 23:59:59 on the same day.
- Open end events end on the same day at 23:59:59.
- For recurring events, we do not support unlimited occurrences. The number of possible recurrences of an event is limited to 1000 occurrences. This way, indexing and other operations doesn’t take too long. The maximum number of occurrences is set via the MAXCOUNT constant in plone.event.recurrence.
Contributing¶
Contributions¶
Please report any bugs, issues or feature requests here: https://github.com/plone/plone.app.event/issues.
And better yet, help out with documentation and pull-requests!
Note
To accept your pull requests, we need you need to have Plone contributors agreement signed and sent-in. For more information, see: ` Contributor’s Agreement for Plone Explained <http://plone.org/foundation/contributors-agreement/contributors-agreement-explained>`_.
Contributors¶
Contributors, please add you name here! By doing this, you also state, that you have signed the Contributor’s Agreement for Plone Explained. Download it from plone.org. Thanks!
- Johannes Raggam, thet (Main author and PLIP implementation)
- Andreas Jung, zopyx
- David Glick, davisagli
- Érico Andrei, ericof
- Franklin Kingma, kingel
- Gauthier Bastien, gbastien
- Georg Bernhard, gogo
- Giacomo Spettoli, giacomos
- Guido Stevens, gyst
- JeanMichel FRANCOIS, toutpt
- Jens Klein, jensens
- Lennart Regebro, regebro
- Nathan Van Gheem, vangheem
- Philip Bauer, pbauer
- Robert Niederreiter, rnixx
- Rok Garbas, garbas
- Róman Joost, romanofski
- Sean Upton, seanupton
- Simone Orsi, simahawk
- Thomas Desvenain, tdesvenain
- Timo Stollenwerk, timo
- Tom Gross, tomgross
- Vincent Fretin, vincentfretin
- Vitaliy Podoba, piv, vipod
- Wolfgang Thomas, pysailor
Find out who contributed:
$ git shortlog -s -e
API documentation¶
plone.app.event API¶
plone.app.event.base¶
plone.app.event.interfaces¶
plone.app.event.recurrence¶
plone.app.event.setuphandlers¶
plone.app.event.vocabularies¶
plone.app.event.at.content¶
plone.app.event.at.interfaces¶
plone.app.event.at.traverser¶
plone.app.event.at.upgrades.event¶
plone.app.event.browser.controlpanel¶
plone.app.event.browser.event_listing¶
plone.app.event.browser.event_view¶
- plone.app.event.browser.event_view.get_location(accessor)[source]¶
Return the location. This method can be overwritten by external packages, for example to provide a reference to a Location object as done by collective.venue.
Parameters: accessor (IEvent, IOccurrence or IEventAccessor) – Event, Occurrence or IEventAccessor object. Returns: A location string. Possibly a HTML structure to link to another object, representing the location. Return type: string
plone.app.event.browser.formatted_date¶
plone.app.event.dx.behaviors¶
plone.app.event.dx.interfaces¶
plone.app.event.dx.traverser¶
plone.app.event.ical.exporter¶
plone.app.event.ical.importer¶
plone.app.event.portlets.portlet_calendar¶
plone.app.event.portlets.portlet_events¶
Legal¶
Copyright notice¶
plone.app.event is copyright Plone Foundation
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
GPL - Gnu General Public License¶
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
PreambleThe licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software–to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation’s software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
Also, for each author’s protection and ours, we want to make certain
that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors’ reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone’s free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSETERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
- This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The “Program”, below, refers to any such program or work, and a “work based on the Program” means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term “modification”.) Each licensee is addressed as “you”.
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
- You may copy and distribute verbatim copies of the Program’s
source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
- You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
- You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
- You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
- You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
- Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients’ exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
- If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
- If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
- The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and “any later version”, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
- If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
NO WARRANTY
- BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONSHow to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
<one line to give the program’s name and a brief idea of what it does.> Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
The hypothetical commands `show w’ and `show c’ should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w’ and `show c’; they could even be mouse-clicks or menu items–whatever suits your program.
You should also get your employer (if you work as a programmer) or your school, if any, to sign a “copyright disclaimer” for the program, if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision’ (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice
This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.