Beispiel #1
0
def installParcel(parcel, oldVersion=None):

    rv = parcel.itsView

    SharingPreferences.update(parcel, "prefs")

    # Even though we're not using this at the moment, I'm leaving it here
    # because people's personal parcels refer to this and we'll probably
    # resurrect this someday:
    Reference.update(parcel, "currentSharingAccount")

    SyncPeriodicTask.update(
        parcel,
        "sharingTask",
        invoke="osaf.sharing.BackgroundSyncHandler",
        run_at_startup=False,
        active=True,
        interval=datetime.timedelta(minutes=15),
    )

    # Make a collection of all Notes with an icalUID, so that
    # we can index it.
    filterAttribute = pim.Note.icalUID.name
    iCalendarItems = FilteredCollection.update(
        parcel,
        "iCalendarItems",
        source=schema.ns("osaf.pim", rv).noteCollection,
        filterExpression="view.hasTrueValues(uuid, '%s')" % (filterAttribute,),
        filterAttributes=[filterAttribute],
    )
    iCalendarItems.addIndex("icalUID", "value", attribute=filterAttribute)

    # Make a collection used to let the main ui view know what new shared
    # inbound occurrences have come in so that OnIdle can check for duplicate
    # recurrenceIDs (via the processSharingQueue function below):
    pim.ListCollection.update(parcel, "newItems")

    if not Globals.options.reload:
        prepareAccounts(rv)
Beispiel #2
0
def installParcel(parcel, oldVersion=None):

    rv = parcel.itsView

    SharingPreferences.update(parcel, "prefs")

    # Even though we're not using this at the moment, I'm leaving it here
    # because people's personal parcels refer to this and we'll probably
    # resurrect this someday:
    Reference.update(parcel, 'currentSharingAccount')

    SyncPeriodicTask.update(parcel,
                            "sharingTask",
                            invoke="osaf.sharing.BackgroundSyncHandler",
                            run_at_startup=False,
                            active=True,
                            interval=datetime.timedelta(minutes=15))

    # Make a collection of all Notes with an icalUID, so that
    # we can index it.
    filterAttribute = pim.Note.icalUID.name
    iCalendarItems = FilteredCollection.update(
        parcel,
        'iCalendarItems',
        source=schema.ns('osaf.pim', rv).noteCollection,
        filterExpression="view.hasTrueValues(uuid, '%s')" %
        (filterAttribute, ),
        filterAttributes=[filterAttribute])
    iCalendarItems.addIndex('icalUID', 'value', attribute=filterAttribute)

    # Make a collection used to let the main ui view know what new shared
    # inbound occurrences have come in so that OnIdle can check for duplicate
    # recurrenceIDs (via the processSharingQueue function below):
    pim.ListCollection.update(parcel, 'newItems')

    if not Globals.options.reload:
        prepareAccounts(rv)
Beispiel #3
0
def installParcel(parcel, oldVersion=None):
    view = parcel.itsView

    # Create our one collection of indexDefinition mappings; when each gets
    # created, its __init__ will add it to this collection automagically.
    AllIndexDefinitions.update(parcel, "allIndexDefinitions")
    Reference.update(parcel, "currentContact")

    MailPreferences.update(parcel, "MailPrefs")
    Reference.update(parcel, "currentMeEmailAddress")

    cur = Reference.update(parcel, "currentIncomingAccount")
    cur1 = Reference.update(parcel, "currentOutgoingAccount")

    if cur.item is None:
        cur.item = IMAPAccount(
            itsView=view,
            displayName=_(u"Incoming Mail"),
            replyToAddress=EmailAddress(itsView=view),
            password=password.Password(itsView=view),
        )

    if cur1.item is None:
        cur1.item = SMTPAccount(itsView=view, displayName=_(u"Outgoing Mail"), password=password.Password(itsView=view))

    trashCollection = ListCollection.update(parcel, "trashCollection", displayName=_(u"Trash"))

    notes = KindCollection.update(parcel, "noteCollection", kind=Note.getKind(view), recursive=True)

    mine = UnionCollection.update(parcel, "mine")

    # it would be nice to get rid of these intermediate fully-fledged
    # item collections, and replace them with lower level Set objects
    mineNotes = IntersectionCollection.update(parcel, "mineNotes", sources=[mine, notes])

    nonOccurrenceFilter = NonOccurrenceFilter(None, parcel)

    nonRecurringNotes = FilteredCollection.update(
        parcel,
        "nonRecurringNotes",
        source=mineNotes,
        filterMethod=(nonOccurrenceFilter, "isNonOccurrence"),
        filterAttributes=[EventStamp.occurrenceFor.name, EventStamp.modificationFor.name, EventStamp.occurrences.name],
    )
    nonRecurringNotes.addIndex("__adhoc__", "numeric")

    allContentItems = KindCollection.update(parcel, "allContentItems", kind=ContentItem.getKind(view), recursive=True)

    contentItems = FilteredCollection.update(
        parcel,
        "contentItems",
        source=allContentItems,
        filterMethod=(nonOccurrenceFilter, "isNotPureOccurrence"),
        filterAttributes=[EventStamp.occurrenceFor.name, EventStamp.modificationFor.name],
    )

    allReminders = KindCollection.update(parcel, "allReminders", kind=Reminder.getKind(view), recursive=True)

    allFutureReminders = FilteredCollection.update(
        parcel,
        "allFutureReminders",
        source=allReminders,
        filterMethod=(UnexpiredFilter(None, parcel), "notExpired"),
        filterAttributes=[UnexpiredFilter.findValuePair[0]],
    )

    allFutureReminders.addIndex(
        "reminderPoll",
        "method",
        method=(UnexpiredFilter(None, parcel), "compare"),
        monitor=[UnexpiredFilter.findValuePair[0]],
    )

    # the "All" / "My" collection
    allCollection = SmartCollection.update(
        parcel,
        "allCollection",
        displayName=_(u"Dashboard"),
        source=nonRecurringNotes,
        exclusions=trashCollection,
        trash=None,
    )
    # kludge to improve on bug 4144 (not a good long term fix but fine for 0.6)
    allCollection.addIndex("__adhoc__", "numeric")

    events = EventStamp.getCollection(view)
    eventComparator = EventComparator.update(parcel, "eventComparator")

    EventStamp.addIndex(
        events,
        "effectiveStart",
        "method",
        method=(eventComparator, "cmpStartTime"),
        monitor=(EventStamp.startTime, EventStamp.allDay, EventStamp.anyTime),
        kind=ContentItem.getKind(view),
    )
    EventStamp.addIndex(
        events,
        "effectiveEnd",
        "method",
        method=(eventComparator, "cmpEndTime"),
        monitor=(EventStamp.startTime, EventStamp.allDay, EventStamp.anyTime, EventStamp.duration),
        kind=ContentItem.getKind(view),
    )

    # floatingEvents need to be reindexed in effectiveStart and effectiveEnd
    # when the floating timezone changes
    filterAttributes = [entry[0] for entry in _FILTER_ATTRIBUTES]
    floatingEvents = FilteredCollection.update(
        parcel,
        "floatingEvents",
        source=events,
        filterMethod=(FloatingEventFilter(None, parcel), "isFloatingEvent"),
        filterAttributes=filterAttributes,
    )
    floatingEvents.addIndex("__adhoc__", "numeric")

    # UTCEvents need to be reindexed in effectiveStartNoTZ and effectiveEndNoTZ
    # when the floating timezone changes, because UTC events are treated
    # specially
    UTCEvents = FilteredCollection.update(
        parcel,
        "UTCEvents",
        source=events,
        filterMethod=(UTCEventFilter(None, parcel), "isUTCEvent"),
        filterAttributes=filterAttributes,
    )
    UTCEvents.addIndex("__adhoc__", "numeric")

    longEvents = FilteredCollection.update(
        parcel,
        "longEvents",
        source=events,
        filterMethod=(LongEventFilter(None, parcel), "isLongEvent"),
        filterAttributes=[EventStamp.duration.name],
    )
    longEvents.addIndex("effectiveStart", "subindex", superindex=(events, events.__collection__, "effectiveStart"))
    longEvents.addIndex("effectiveEnd", "subindex", superindex=(events, events.__collection__, "effectiveEnd"))

    filterAttributes = (EventStamp.rruleset.name, EventStamp.occurrences.name)
    masterFilter = "view.hasTrueValues(uuid, '%s', '%s')" % filterAttributes
    nonMasterFilter = "not " + masterFilter

    masterEvents = FilteredCollection.update(
        parcel, "masterEvents", source=events, filterExpression=masterFilter, filterAttributes=list(filterAttributes)
    )

    nonMasterEvents = FilteredCollection.update(
        parcel,
        "nonMasterEvents",
        source=events,
        filterExpression=nonMasterFilter,
        filterAttributes=list(filterAttributes),
    )

    MasterEventWatcher.update(parcel, "masterEventWatcher", targetCollection=masterEvents)

    EventStamp.addIndex(
        masterEvents,
        "recurrenceEnd",
        "method",
        method=(eventComparator, "cmpRecurEnd"),
        monitor=(EventStamp.recurrenceEnd,),
    )

    EventStamp.addIndex(
        masterEvents, "effectiveStart", "subindex", superindex=(events, events.__collection__, "effectiveStart")
    )

    locations = KindCollection.update(parcel, "locations", kind=Location.getKind(view), recursive=True)

    locations.addIndex("locationName", "value", attribute="displayName", nodefer=True)

    mailCollection = mail.MailStamp.getCollection(view)

    kind = mail.EmailAddress.getKind(view)
    emailAddressCollection = KindCollection.update(parcel, "emailAddressCollection", kind=kind, recursive=True)
    emailComparator = EmailComparator.update(parcel, "emailComparator")
    emailAddressCollection.addIndex(
        "emailAddress", "method", method=(emailComparator, "cmpAddress"), monitor="emailAddress", nodefer=True
    )
    emailAddressCollection.addIndex(
        "fullName", "method", method=(emailComparator, "cmpFullName"), monitor="fullName", nodefer=True
    )
    emailAddressCollection.addIndex(
        "both",
        "method",
        method=(emailComparator, "cmpBoth"),
        monitor=("emailAddress", "fullName"),
        nodefer=True,
        kind=kind,
    )

    # Contains all current me addresses (that is, referenced by an account)
    currentMeEmailAddresses = ListCollection.update(parcel, "currentMeEmailAddresses")

    currentMeEmailAddresses.addIndex(
        "emailAddress", "method", method=(emailComparator, "cmpAddress"), monitor="emailAddress"
    )

    # Contains all current and former me addresses
    meEmailAddressCollection = ListCollection.update(parcel, "meEmailAddressCollection")

    meEmailAddressCollection.addIndex(
        "emailAddress", "method", method=(emailComparator, "cmpAddress"), monitor="emailAddress"
    )

    inSource = ToMeFilter.makeCollection(parcel, "inSource", mailCollection)
    # this index must be added to shield from the duplicate
    # source (mailCollection) that is going to be in mine
    inSource.addIndex("__adhoc__", "numeric")

    # The "In" collection
    inCollection = SmartCollection.update(
        parcel, "inCollection", displayName=_(u"In"), source=inSource, trash=trashCollection, visible=True
    )
    mine.addSource(inCollection)

    outSource = FromMeFilter.makeCollection(parcel, "outSource", mailCollection)
    # this index must be added to shield from the duplicate
    # source (mailCollection) that is going to be in mine
    outSource.addIndex("__adhoc__", "numeric")

    # The "Out" collection
    outCollection = SmartCollection.update(
        parcel, "outCollection", displayName=_(u"Out"), visible=True, source=outSource, trash=trashCollection
    )
    mine.addSource(outCollection)

    allEventsCollection = IntersectionCollection.update(parcel, "allEventsCollection", sources=[allCollection, events])

    searchResultsUnfiltered = SmartCollection.update(parcel, "searchResultsUnfiltered", displayName=messages.UNTITLED)

    searchResults = DifferenceCollection.update(
        parcel, "searchResults", sources=[searchResultsUnfiltered, masterEvents], displayName=messages.UNTITLED
    )

    TriageStatusReminder.update(parcel, "triageStatusReminder")
    startup.Startup.update(parcel, "installWatchers", invoke=__name__ + ".installWatchers")

    tzInstallParcel(parcel)
Beispiel #4
0
def installParcel(parcel, oldVersion=None):

    curDav = Reference.update(parcel, 'currentWebDAVAccount')
    curMail = Reference.update(parcel, 'currentMailAccount')
    curSmtp = Reference.update(parcel, 'currentSMTPAccount')
    curCon = Reference.update(parcel, 'currentContact')

    sharing = schema.ns("osaf.sharing", parcel)
    model = schema.ns("osaf.pim", parcel)
    mail = schema.ns("osaf.pim.mail", parcel)
    photos = schema.ns("osaf.pim.photos", parcel)
    contacts = schema.ns("osaf.pim.contacts", parcel)

    # Items created in osaf.app (this parcel):

    sharing.WebDAVAccount.update(parcel,
                                 'OSAFWebDAVAccount',
                                 displayName=u'OSAF sharing',
                                 host=u'pilikia.osafoundation.org',
                                 path=u'/dev1',
                                 username=u'dev1',
                                 password=u'd4vShare',
                                 useSSL=False,
                                 port=80,
                                 references=[curDav])

    sharing.WebDAVAccount.update(
        parcel,
        'XythosWebDAVAccount',
        displayName=u'Xythos sharing',
        host=u'www.sharemation.com',
        path=u'/OSAFdot5',
        username=u'OSAFdot5',
        password=u'osafdemo',
        useSSL=False,
        port=80,
    )

    sharing.WebDAVAccount.update(
        parcel,
        'VenueWebDAVAccount',
        displayName=u'Venue sharing',
        host=u'webdav.venuecom.com',
        path=u'/calendar/OSAFdot5/calendars',
        username=u'OSAFdot5',
        password=u'demo',
        useSSL=False,
        port=80,
    )

    preReply = mail.EmailAddress.update(parcel, 'PredefinedReplyAddress')

    preSmtp = mail.SMTPAccount.update(parcel,
                                      'PredefinedSMTPAccount',
                                      displayName=u'Outgoing SMTP mail',
                                      references=[curSmtp])

    mail.IMAPAccount.update(parcel,
                            'PredefinedIMAPAccount',
                            displayName=u'Incoming IMAP mail',
                            replyToAddress=preReply,
                            defaultSMTPAccount=preSmtp,
                            references=[curMail])

    mail.POPAccount.update(parcel,
                           'PredefinedPOPAccount',
                           displayName=u'Incoming POP mail',
                           replyToAddress=preReply,
                           defaultSMTPAccount=preSmtp)

    testReply = mail.EmailAddress.update(parcel, 'TestReplyAddress')

    testSmtp = mail.SMTPAccount.update(parcel,
                                       'TestSMTPAccount',
                                       displayName=u'Test SMTP Account',
                                       isActive=False)

    mail.IMAPAccount.update(parcel,
                            'TestIMAPAccount',
                            displayName=u'Test IMAP mail',
                            replyToAddress=testReply,
                            defaultSMTPAccount=testSmtp,
                            isActive=False)

    mail.POPAccount.update(parcel,
                           'TestPOPAccount',
                           displayName=u'Test POP mail',
                           replyToAddress=testReply,
                           defaultSMTPAccount=testSmtp,
                           isActive=False)

    model.ItemCollection.update(parcel,
                                'trash',
                                displayName=_('Trash'),
                                renameable=False)

    welcome = photos.Photo.update(parcel,
                                  'WelcomePhoto',
                                  displayName=u'Welcome to Chandler 0.5',
                                  dateTaken=datetime.datetime.now(),
                                  creator=contacts.Contact.update(
                                      parcel,
                                      'OSAFContact',
                                      emailAddress=u'*****@*****.**',
                                      contactName=contacts.ContactName.update(
                                          parcel,
                                          'OSAFContactName',
                                          firstName=u'OSAF',
                                          lastName=u'Development')))

    welcome.importFromFile(
        os.path.join(os.path.dirname(__file__), "TeamOSAF.jpg"))

    body = u"""Welcome to the Chandler 0.5 Release!

Chandler 0.5 contains support for early adopter developers who want to start building parcels. For example, developers now can create form-based parcels extending the kinds of information that Chandler manages. This release also brings significant improvements to infrastructure areas such as sharing, and to overall performance and reliability.

In addition to the maturing developer infrastructure, Chandler 0.5 begins to focus on fleshing out calendar features and functionality, supporting basic individual and collaborative calendaring tasks.

As you get started, be sure to set up your email and WebDAV account information under the File > Accounts menu.

For a self-guided demo with accompanying screenshots, point your browser to:
   http://www.osafoundation.org/0.5/GuidedTour.htm

For more details on this release, please visit:
    http://wiki.osafoundation.org/bin/view/Chandler/ChandlerZeroPointFiveReadme

Please note, this release is still intended to be experimental, do not trust your real data with this version. An experimental file import/export feature is available to backup your calendar data.

Thank you for trying Chandler. Your feedback is welcome on our mail lists:
    http://wiki.osafoundation.org/bin/view/Chandler/OsafMailingLists

The Chandler Team"""

    welcome.body = welcome.getAttributeAspect('body', 'type').makeValue(body)

    # Set up the main web server
    startup = schema.ns("osaf.startup", parcel)
    webserver = schema.ns("osaf.webserver", parcel)

    startup.Startup.update(parcel,
                           "startServers",
                           invoke="osaf.webserver.start_servers")

    webserver.Server.update(
        parcel,
        "mainServer",
        # Port to listen on.  1888 was the year Raymond Chandler was born.
        port=1888,

        # This path specifies the "doc root" of this web server, and is
        # relative to webserver/servers, but you may also put in an
        # absolute path if you wish.
        #
        path="webhome",
        resources=[
            webserver.Resource.update(
                parcel,
                "lobsterResource",
                displayName="Lob Server",
                location="lobs",
                resourceClass=schema.importString(
                    "osaf.servlets.lobviewer.LobViewerResource"),
            ),
            webserver.Resource.update(
                parcel,
                "photoResource",
                displayName="Photo Viewer",
                location="photos",
                resourceClass=schema.importString(
                    "osaf.servlets.photos.PhotosResource"),
            ),
            webserver.Resource.update(
                parcel,
                "repoResource",
                displayName="Repository Viewer",
                location="repo",
                resourceClass=schema.importString(
                    "osaf.servlets.repo.RepoResource"),
            )
        ])
def installParcel(parcel, oldVersion=None):
    view = parcel.itsView

    # Create our one collection of indexDefinition mappings; when each gets
    # created, its __init__ will add it to this collection automagically.
    AllIndexDefinitions.update(parcel, "allIndexDefinitions")
    Reference.update(parcel, 'currentContact')

    MailPreferences.update(parcel, 'MailPrefs')
    Reference.update(parcel, 'currentMeEmailAddress')

    cur = Reference.update(parcel, 'currentIncomingAccount')
    cur1 = Reference.update(parcel, 'currentOutgoingAccount')

    if cur.item is None:
        cur.item = IMAPAccount(itsView=view,
                               displayName=_(u'Incoming Mail'),
                               replyToAddress=EmailAddress(itsView=view),
                               password=password.Password(itsView=view))

    if cur1.item is None:
        cur1.item = SMTPAccount(
            itsView=view,
            displayName=_(u'Outgoing Mail'),
            password=password.Password(itsView=view),
        )

    trashCollection = ListCollection.update(parcel,
                                            'trashCollection',
                                            displayName=_(u"Trash"))

    notes = KindCollection.update(parcel,
                                  'noteCollection',
                                  kind=Note.getKind(view),
                                  recursive=True)

    mine = UnionCollection.update(parcel, 'mine')

    # it would be nice to get rid of these intermediate fully-fledged
    # item collections, and replace them with lower level Set objects
    mineNotes = IntersectionCollection.update(parcel,
                                              'mineNotes',
                                              sources=[mine, notes])

    nonOccurrenceFilter = NonOccurrenceFilter(None, parcel)

    nonRecurringNotes = FilteredCollection.update(
        parcel,
        'nonRecurringNotes',
        source=mineNotes,
        filterMethod=(nonOccurrenceFilter, 'isNonOccurrence'),
        filterAttributes=[
            EventStamp.occurrenceFor.name, EventStamp.modificationFor.name,
            EventStamp.occurrences.name
        ])
    nonRecurringNotes.addIndex('__adhoc__', 'numeric')

    allContentItems = KindCollection.update(parcel,
                                            'allContentItems',
                                            kind=ContentItem.getKind(view),
                                            recursive=True)

    contentItems = FilteredCollection.update(
        parcel,
        'contentItems',
        source=allContentItems,
        filterMethod=(nonOccurrenceFilter, 'isNotPureOccurrence'),
        filterAttributes=[
            EventStamp.occurrenceFor.name, EventStamp.modificationFor.name
        ])

    allReminders = KindCollection.update(parcel,
                                         'allReminders',
                                         kind=Reminder.getKind(view),
                                         recursive=True)

    allFutureReminders = FilteredCollection.update(
        parcel,
        'allFutureReminders',
        source=allReminders,
        filterMethod=(UnexpiredFilter(None, parcel), 'notExpired'),
        filterAttributes=[UnexpiredFilter.findValuePair[0]],
    )

    allFutureReminders.addIndex('reminderPoll',
                                'method',
                                method=(UnexpiredFilter(None,
                                                        parcel), 'compare'),
                                monitor=[UnexpiredFilter.findValuePair[0]])

    # the "All" / "My" collection
    allCollection = SmartCollection.update(
        parcel,
        'allCollection',
        displayName=_(u"Dashboard"),
        source=nonRecurringNotes,
        exclusions=trashCollection,
        trash=None,
    )
    # kludge to improve on bug 4144 (not a good long term fix but fine for 0.6)
    allCollection.addIndex('__adhoc__', 'numeric')

    events = EventStamp.getCollection(view)
    eventComparator = EventComparator.update(parcel, 'eventComparator')

    EventStamp.addIndex(events,
                        'effectiveStart',
                        'method',
                        method=(eventComparator, 'cmpStartTime'),
                        monitor=(EventStamp.startTime, EventStamp.allDay,
                                 EventStamp.anyTime),
                        kind=ContentItem.getKind(view))
    EventStamp.addIndex(events,
                        'effectiveEnd',
                        'method',
                        method=(eventComparator, 'cmpEndTime'),
                        monitor=(EventStamp.startTime, EventStamp.allDay,
                                 EventStamp.anyTime, EventStamp.duration),
                        kind=ContentItem.getKind(view))

    # floatingEvents need to be reindexed in effectiveStart and effectiveEnd
    # when the floating timezone changes
    filterAttributes = [entry[0] for entry in _FILTER_ATTRIBUTES]
    floatingEvents = FilteredCollection.update(
        parcel,
        'floatingEvents',
        source=events,
        filterMethod=(FloatingEventFilter(None, parcel), 'isFloatingEvent'),
        filterAttributes=filterAttributes)
    floatingEvents.addIndex('__adhoc__', 'numeric')

    # UTCEvents need to be reindexed in effectiveStartNoTZ and effectiveEndNoTZ
    # when the floating timezone changes, because UTC events are treated
    # specially
    UTCEvents = FilteredCollection.update(parcel,
                                          'UTCEvents',
                                          source=events,
                                          filterMethod=(UTCEventFilter(
                                              None, parcel), 'isUTCEvent'),
                                          filterAttributes=filterAttributes)
    UTCEvents.addIndex('__adhoc__', 'numeric')

    longEvents = FilteredCollection.update(
        parcel,
        'longEvents',
        source=events,
        filterMethod=(LongEventFilter(None, parcel), 'isLongEvent'),
        filterAttributes=[EventStamp.duration.name])
    longEvents.addIndex('effectiveStart',
                        'subindex',
                        superindex=(events, events.__collection__,
                                    'effectiveStart'))
    longEvents.addIndex('effectiveEnd',
                        'subindex',
                        superindex=(events, events.__collection__,
                                    'effectiveEnd'))

    filterAttributes = (EventStamp.rruleset.name, EventStamp.occurrences.name)
    masterFilter = "view.hasTrueValues(uuid, '%s', '%s')" % filterAttributes
    nonMasterFilter = "not " + masterFilter

    masterEvents = FilteredCollection.update(
        parcel,
        'masterEvents',
        source=events,
        filterExpression=masterFilter,
        filterAttributes=list(filterAttributes))

    nonMasterEvents = FilteredCollection.update(
        parcel,
        'nonMasterEvents',
        source=events,
        filterExpression=nonMasterFilter,
        filterAttributes=list(filterAttributes))

    MasterEventWatcher.update(parcel,
                              'masterEventWatcher',
                              targetCollection=masterEvents)

    EventStamp.addIndex(masterEvents,
                        "recurrenceEnd",
                        'method',
                        method=(eventComparator, 'cmpRecurEnd'),
                        monitor=(EventStamp.recurrenceEnd, ))

    EventStamp.addIndex(masterEvents,
                        'effectiveStart',
                        'subindex',
                        superindex=(events, events.__collection__,
                                    'effectiveStart'))

    locations = KindCollection.update(parcel,
                                      'locations',
                                      kind=Location.getKind(view),
                                      recursive=True)

    locations.addIndex('locationName',
                       'value',
                       attribute='displayName',
                       nodefer=True)

    mailCollection = mail.MailStamp.getCollection(view)

    kind = mail.EmailAddress.getKind(view)
    emailAddressCollection = \
        KindCollection.update(parcel, 'emailAddressCollection',
                              kind=kind,
                              recursive=True)
    emailComparator = EmailComparator.update(parcel, 'emailComparator')
    emailAddressCollection.addIndex('emailAddress',
                                    'method',
                                    method=(emailComparator, 'cmpAddress'),
                                    monitor='emailAddress',
                                    nodefer=True)
    emailAddressCollection.addIndex('fullName',
                                    'method',
                                    method=(emailComparator, 'cmpFullName'),
                                    monitor='fullName',
                                    nodefer=True)
    emailAddressCollection.addIndex('both',
                                    'method',
                                    method=(emailComparator, 'cmpBoth'),
                                    monitor=('emailAddress', 'fullName'),
                                    nodefer=True,
                                    kind=kind)

    # Contains all current me addresses (that is, referenced by an account)
    currentMeEmailAddresses = ListCollection.update(parcel,
                                                    'currentMeEmailAddresses')

    currentMeEmailAddresses.addIndex('emailAddress',
                                     'method',
                                     method=(emailComparator, 'cmpAddress'),
                                     monitor='emailAddress')

    # Contains all current and former me addresses
    meEmailAddressCollection = ListCollection.update(
        parcel, 'meEmailAddressCollection')

    meEmailAddressCollection.addIndex('emailAddress',
                                      'method',
                                      method=(emailComparator, 'cmpAddress'),
                                      monitor='emailAddress')

    inSource = ToMeFilter.makeCollection(parcel, 'inSource', mailCollection)
    # this index must be added to shield from the duplicate
    # source (mailCollection) that is going to be in mine
    inSource.addIndex('__adhoc__', 'numeric')

    # The "In" collection
    inCollection = SmartCollection.update(parcel,
                                          'inCollection',
                                          displayName=_(u"In"),
                                          source=inSource,
                                          trash=trashCollection,
                                          visible=True)
    mine.addSource(inCollection)

    outSource = FromMeFilter.makeCollection(parcel, 'outSource',
                                            mailCollection)
    # this index must be added to shield from the duplicate
    # source (mailCollection) that is going to be in mine
    outSource.addIndex('__adhoc__', 'numeric')

    # The "Out" collection
    outCollection = SmartCollection.update(
        parcel,
        'outCollection',
        displayName=_(u"Out"),
        visible=True,
        source=outSource,
        trash=trashCollection,
    )
    mine.addSource(outCollection)

    allEventsCollection = IntersectionCollection.update(
        parcel, 'allEventsCollection', sources=[allCollection, events])

    searchResultsUnfiltered = SmartCollection.update(
        parcel, 'searchResultsUnfiltered', displayName=messages.UNTITLED)

    searchResults = DifferenceCollection.update(
        parcel,
        'searchResults',
        sources=[searchResultsUnfiltered, masterEvents],
        displayName=messages.UNTITLED)

    TriageStatusReminder.update(parcel, 'triageStatusReminder')
    startup.Startup.update(parcel,
                           "installWatchers",
                           invoke=__name__ + ".installWatchers")

    tzInstallParcel(parcel)
Beispiel #6
0
def installParcel(parcel, oldVersion=None):

    curDav = Reference.update(parcel, 'currentWebDAVAccount')
    curMail = Reference.update(parcel, 'currentMailAccount')
    curSmtp = Reference.update(parcel, 'currentSMTPAccount')
    curCon = Reference.update(parcel, 'currentContact')

    sharing = schema.ns("osaf.sharing", parcel)
    model = schema.ns("osaf.pim", parcel)
    mail = schema.ns("osaf.pim.mail", parcel)
    photos = schema.ns("osaf.pim.photos", parcel)
    contacts = schema.ns("osaf.pim.contacts", parcel)

    # Items created in osaf.app (this parcel):

    sharing.WebDAVAccount.update(parcel, 'OSAFWebDAVAccount',
        displayName=u'OSAF sharing',
        host=u'pilikia.osafoundation.org',
        path=u'/dev1',
        username=u'dev1',
        password=u'd4vShare',
        useSSL=False,
        port=80,
        references=[curDav]
    )

    sharing.WebDAVAccount.update(parcel, 'XythosWebDAVAccount',
        displayName=u'Xythos sharing',
        host=u'www.sharemation.com',
        path=u'/OSAFdot5',
        username=u'OSAFdot5',
        password=u'osafdemo',
        useSSL=False,
        port=80,
    )

    sharing.WebDAVAccount.update(parcel, 'VenueWebDAVAccount',
        displayName=u'Venue sharing',
        host=u'webdav.venuecom.com',
        path=u'/calendar/OSAFdot5/calendars',
        username=u'OSAFdot5',
        password=u'demo',
        useSSL=False,
        port=80,
    )

    preReply = mail.EmailAddress.update(parcel, 'PredefinedReplyAddress')

    preSmtp = mail.SMTPAccount.update(parcel, 'PredefinedSMTPAccount',
        displayName=u'Outgoing SMTP mail',
        references=[curSmtp]
    )

    mail.IMAPAccount.update(parcel, 'PredefinedIMAPAccount',
        displayName=u'Incoming IMAP mail',
        replyToAddress=preReply,
        defaultSMTPAccount=preSmtp,
        references=[curMail]
    )

    mail.POPAccount.update(parcel, 'PredefinedPOPAccount',
        displayName=u'Incoming POP mail',
        replyToAddress=preReply,
        defaultSMTPAccount=preSmtp
    )


    testReply = mail.EmailAddress.update(parcel, 'TestReplyAddress')

    testSmtp = mail.SMTPAccount.update(parcel, 'TestSMTPAccount',
        displayName=u'Test SMTP Account',
        isActive=False
    )

    mail.IMAPAccount.update(parcel, 'TestIMAPAccount',
        displayName=u'Test IMAP mail',
        replyToAddress=testReply,
        defaultSMTPAccount=testSmtp,
        isActive=False
    )

    mail.POPAccount.update(parcel, 'TestPOPAccount',
        displayName=u'Test POP mail',
        replyToAddress=testReply,
        defaultSMTPAccount=testSmtp,
        isActive=False
    )


    model.ItemCollection.update(parcel, 'trash',
        displayName=_('Trash'),
        renameable=False
    )

    welcome = photos.Photo.update(parcel, 'WelcomePhoto',
        displayName=u'Welcome to Chandler 0.5',
        dateTaken=datetime.datetime.now(),
        creator=contacts.Contact.update(parcel, 'OSAFContact',
             emailAddress=u'*****@*****.**',
             contactName=contacts.ContactName.update(parcel, 'OSAFContactName',
                firstName=u'OSAF',
                lastName=u'Development'
             )
        )
    )

    welcome.importFromFile(os.path.join(os.path.dirname(__file__),
        "TeamOSAF.jpg"))

    body = u"""Welcome to the Chandler 0.5 Release!

Chandler 0.5 contains support for early adopter developers who want to start building parcels. For example, developers now can create form-based parcels extending the kinds of information that Chandler manages. This release also brings significant improvements to infrastructure areas such as sharing, and to overall performance and reliability.

In addition to the maturing developer infrastructure, Chandler 0.5 begins to focus on fleshing out calendar features and functionality, supporting basic individual and collaborative calendaring tasks.

As you get started, be sure to set up your email and WebDAV account information under the File > Accounts menu.

For a self-guided demo with accompanying screenshots, point your browser to:
   http://www.osafoundation.org/0.5/GuidedTour.htm

For more details on this release, please visit:
    http://wiki.osafoundation.org/bin/view/Chandler/ChandlerZeroPointFiveReadme

Please note, this release is still intended to be experimental, do not trust your real data with this version. An experimental file import/export feature is available to backup your calendar data.

Thank you for trying Chandler. Your feedback is welcome on our mail lists:
    http://wiki.osafoundation.org/bin/view/Chandler/OsafMailingLists

The Chandler Team"""

    welcome.body = welcome.getAttributeAspect('body', 'type').makeValue(body)


    # Set up the main web server
    startup = schema.ns("osaf.startup", parcel)
    webserver = schema.ns("osaf.webserver", parcel)

    startup.Startup.update(parcel, "startServers",
        invoke = "osaf.webserver.start_servers"
    )

    webserver.Server.update(parcel, "mainServer",
        # Port to listen on.  1888 was the year Raymond Chandler was born.
        port=1888,

        # This path specifies the "doc root" of this web server, and is
        # relative to webserver/servers, but you may also put in an
        # absolute path if you wish.
        #
        path="webhome",

        resources = [
            webserver.Resource.update(parcel, "lobsterResource",
                displayName="Lob Server",
                location="lobs",
                resourceClass=schema.importString(
                    "osaf.servlets.lobviewer.LobViewerResource"
                ),
            ),
            webserver.Resource.update(parcel, "photoResource",
                displayName="Photo Viewer",
                location="photos",
                resourceClass=schema.importString(
                    "osaf.servlets.photos.PhotosResource"
                ),
            ),
            webserver.Resource.update(parcel, "repoResource",
                displayName="Repository Viewer",
                location="repo",
                resourceClass=schema.importString(
                    "osaf.servlets.repo.RepoResource"
                ),
            )
        ]
    )