- Revision
- 11341
- Author
- morgen
- Date
- 2006-08-07 12:42:46 -0700 (Mon, 07 Aug 2006)
Log Message
Adding support for (optional) sharing of triage status
Modified Paths
- trunk/chandler/application/Utility.py
- trunk/chandler/application/dialogs/PublishCollection.py
- trunk/chandler/application/dialogs/PublishCollection.wdr
- trunk/chandler/application/dialogs/PublishCollection_wdr.xrc
- trunk/chandler/parcels/osaf/pim/items.py
- trunk/chandler/parcels/osaf/servlets/repo.py
- trunk/chandler/parcels/osaf/sharing/Sharing.py
- trunk/chandler/parcels/osaf/sharing/__init__.py
Diff
Modified: trunk/chandler/application/Utility.py (11340 => 11341)
--- trunk/chandler/application/Utility.py 2006-08-07 19:29:54 UTC (rev 11340) +++ trunk/chandler/application/Utility.py 2006-08-07 19:42:46 UTC (rev 11341) @@ -33,7 +33,7 @@ # with your name (and some helpful text). The comment's really there just to # cause Subversion to warn you of a conflict when you update, in case someone # else changes it at the same time you do (that's why it's on the same line). -SCHEMA_VERSION = "230" # stearns: dashboard sectioning on by default +SCHEMA_VERSION = "231" # morgen: added triageStatus to sharing cloud logger = None # initialized in initLogging()
Modified: trunk/chandler/application/dialogs/PublishCollection.py (11340 => 11341)
--- trunk/chandler/application/dialogs/PublishCollection.py 2006-08-07 19:29:54 UTC (rev 11340) +++ trunk/chandler/application/dialogs/PublishCollection.py 2006-08-07 19:42:46 UTC (rev 11341) @@ -125,6 +125,8 @@ self.CheckboxShareAlarms.SetValue(False) self.CheckboxShareStatus = wx.xrc.XRCCTRL(self, "CHECKBOX_STATUS") self.CheckboxShareStatus.SetValue(False) + self.CheckboxShareTriage = wx.xrc.XRCCTRL(self, "CHECKBOX_TRIAGE") + self.CheckboxShareTriage.SetValue(False) self.SetDefaultItem(wx.xrc.XRCCTRL(self, "wxID_OK")) @@ -182,11 +184,14 @@ self.OnFilterClicked) self.CheckboxShareAlarms = wx.xrc.XRCCTRL(self, "CHECKBOX_ALARMS") - self.CheckboxShareAlarms.Enable(False) + self.CheckboxShareAlarms.Enable(True) self.CheckboxShareStatus = wx.xrc.XRCCTRL(self, "CHECKBOX_STATUS") - self.CheckboxShareStatus.Enable(False) + self.CheckboxShareStatus.Enable(True) + self.CheckboxShareTriage = wx.xrc.XRCCTRL(self, "CHECKBOX_TRIAGE") + self.CheckboxShareTriage.Enable(True) - self.originalFilterClasses = self.filterClasses = share.filterClasses + self.originalFilterClasses = self.filterClasses = list(share.filterClasses) + self.originalFilterAttributes = list(share.filterAttributes) self._loadClassFilterState() self._loadAttributeFilterState(share) @@ -205,21 +210,19 @@ def OnManageDone(self, evt): self._saveClassFilterState() - # Commenting this out for now since they can't be changed in the - # manage dialog anyway (the checkboxes are disabled), and it causes - # CalDAV CloudXML shares to lose attribute filters that they need to - # keep: - # for share in self.collection.shares: - # self._saveAttributeFilterState(share) + for share in self.collection.shares: + self._saveAttributeFilterState(share) if self.modal: self.EndModal(False) self.Destroy() - share = iter(self.collection.shares).next() - if share.filterClasses != self.originalFilterClasses: - SyncProgress.Show(wx.GetApp().mainFrame, rv=self.view, - collection=share.contents) + share = sharing.getShare(self.collection) + if (share.filterClasses != self.originalFilterClasses or + share.filterAttributes != self.originalFilterAttributes): + self.view.commit() + sharing.scheduleNow(self.view, collection=share.contents, + forceUpdate=True) def _loadAttributeFilterState(self, share): @@ -228,6 +231,8 @@ share.filterAttributes) self.CheckboxShareStatus.SetValue("transparency" not in \ share.filterAttributes) + self.CheckboxShareTriage.SetValue("triageStatus" not in \ + share.filterAttributes) def _getAttributeFilterState(self): @@ -239,6 +244,8 @@ attrs.append('expiredReminders') if not self.CheckboxShareStatus.GetValue(): attrs.append('transparency') + if not self.CheckboxShareTriage.GetValue(): + attrs.append('triageStatus') return attrs @@ -260,7 +267,21 @@ if "transparency" in share.filterAttributes: share.filterAttributes.remove("transparency") + if not self.CheckboxShareTriage.GetValue(): + if "triageStatus" not in share.filterAttributes: + share.filterAttributes.append("triageStatus") + else: + if "triageStatus" in share.filterAttributes: + share.filterAttributes.remove("triageStatus") + # Make sure no matter what we keep filtering out the attributes that + # never belong in the XML fork of a CalDAV share: + if "allDay" in share.filterAttributes: # this is such an XML fork + for attr in sharing.CALDAVFILTER: + if attr not in share.filterAttributes: + share.filterAttributes.append(attr) + + def _loadClassFilterState(self): # Based on which classes are listed in filterClasses, update the UI
Modified: trunk/chandler/application/dialogs/PublishCollection.wdr
(Binary files differ)
Modified: trunk/chandler/application/dialogs/PublishCollection_wdr.xrc (11340 => 11341)
--- trunk/chandler/application/dialogs/PublishCollection_wdr.xrc 2006-08-07 19:29:54 UTC (rev 11340) +++ trunk/chandler/application/dialogs/PublishCollection_wdr.xrc 2006-08-07 19:42:46 UTC (rev 11341) @@ -75,6 +75,20 @@ <label>Share event status</label> </object> </object> + <object class="sizeritem"> + <flag>wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL</flag> + <border>5</border> + <object class="wxStaticText" name="ID_TEXT"> + <label></label> + </object> + </object> + <object class="sizeritem"> + <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag> + <border>5</border> + <object class="wxCheckBox" name="CHECKBOX_TRIAGE"> + <label>Share triage status</label> + </object> + </object> </object> </object> </object> @@ -241,6 +255,20 @@ <label>Share event status</label> </object> </object> + <object class="sizeritem"> + <flag>wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL</flag> + <border>5</border> + <object class="wxStaticText" name="ID_TEXT"> + <label></label> + </object> + </object> + <object class="sizeritem"> + <flag>wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM</flag> + <border>5</border> + <object class="wxCheckBox" name="CHECKBOX_TRIAGE"> + <label>Share triage status</label> + </object> + </object> </object> </object> </object>
Modified: trunk/chandler/parcels/osaf/pim/items.py (11340 => 11341)
--- trunk/chandler/parcels/osaf/pim/items.py 2006-08-07 19:29:54 UTC (rev 11340) +++ trunk/chandler/parcels/osaf/pim/items.py 2006-08-07 19:42:46 UTC (rev 11341) @@ -176,7 +176,7 @@ ) triageStatus = schema.One(TriageEnum, indexed=True, - initialValue="now") + defaultValue="now") # We haven't ported the "other end" of these links, so we have to use # 'otherName' settings to ensure that they get hooked up correctly. @@ -198,7 +198,7 @@ schema.addClouds( sharing = schema.Cloud("displayName", body, createdOn, 'tags', - "description", lastModifiedBy), + "description", lastModifiedBy, triageStatus), copying = schema.Cloud() )
Modified: trunk/chandler/parcels/osaf/servlets/repo.py (11340 => 11341)
--- trunk/chandler/parcels/osaf/servlets/repo.py 2006-08-07 19:29:54 UTC (rev 11340) +++ trunk/chandler/parcels/osaf/servlets/repo.py 2006-08-07 19:42:46 UTC (rev 11341) @@ -932,7 +932,10 @@ - itemString = vr.Render(name) + try: + itemString = vr.Render(name) + except: + itemString = "Couldn't render %s" % name result += MakeValueRow(name, itemString, valueType) count += 1
Modified: trunk/chandler/parcels/osaf/sharing/Sharing.py (11340 => 11341)
--- trunk/chandler/parcels/osaf/sharing/Sharing.py 2006-08-07 19:29:54 UTC (rev 11340) +++ trunk/chandler/parcels/osaf/sharing/Sharing.py 2006-08-07 19:42:46 UTC (rev 11341) @@ -75,7 +75,8 @@ # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -def sync(collectionOrShares, modeOverride=None, updateCallback=None): +def sync(collectionOrShares, modeOverride=None, updateCallback=None, + forceUpdate=None): def mergeFunction(code, item, attribute, value): # 'value' is the one from the *this* view @@ -327,7 +328,8 @@ stat = share.conduit._put(contentView, putStartingVersion, putEndingVersion, - updateCallback=updateCallback) + updateCallback=updateCallback, + forceUpdate=forceUpdate) stats.append(stat) @@ -596,7 +598,7 @@ def _conditionalPutItem(self, contentView, item, changes, - updateCallback=None): + updateCallback=None, forceUpdate=None): """ Put an item if it's not on the server or is out of date """ @@ -618,23 +620,28 @@ reason = _(u"Not on server") else: - needsUpdate = False + if forceUpdate: + needsUpdate = True + result = 'modified' + reason = 'forced update' + else: + needsUpdate = False - # Check to see if the item or any of its itemCloud items have a - # more recent version than the last time we synced - for relatedItem in item.getItemCloud('sharing'): - if relatedItem.itsUUID in changes: - modifiedAttributes = changes[relatedItem.itsUUID] - sharedAttributes = \ - self.share.getSharedAttributes(relatedItem) - logger.debug("Changes for %s: %s", relatedItem.getItemDisplayName().encode('utf8', 'replace'), modifiedAttributes) - for change in modifiedAttributes: - if change in sharedAttributes: - logger.debug("A shared attribute (%s) changed for %s", change, relatedItem.getItemDisplayName()) - needsUpdate = True - result = 'modified' - reason = change - break + # Check to see if the item or any of its itemCloud items have a + # more recent version than the last time we synced + for relatedItem in item.getItemCloud('sharing'): + if relatedItem.itsUUID in changes: + modifiedAttributes = changes[relatedItem.itsUUID] + sharedAttributes = \ + self.share.getSharedAttributes(relatedItem) + logger.debug("Changes for %s: %s", relatedItem.getItemDisplayName().encode('utf8', 'replace'), modifiedAttributes) + for change in modifiedAttributes: + if change in sharedAttributes: + logger.debug("A shared attribute (%s) changed for %s", change, relatedItem.getItemDisplayName()) + needsUpdate = True + result = 'modified' + reason = change + break if needsUpdate: logger.info("...putting '%s' %s (%d vs %d) (%s)" % @@ -674,7 +681,8 @@ - def _put(self, contentView, startVersion, endVersion, updateCallback=None): + def _put(self, contentView, startVersion, endVersion, updateCallback=None, + forceUpdate=None): """ Transfer entire 'contents', transformed, to server. """ @@ -795,14 +803,16 @@ # Put the item result = self._conditionalPutItem(contentView, item, - changes, updateCallback=updateCallback) + changes, updateCallback=updateCallback, + forceUpdate=forceUpdate) if result in ('added', 'modified'): stats[result].append(item.itsUUID) # Put the Share item itself result = self._conditionalPutItem(contentView, cvSelf.share, - changes, updateCallback=updateCallback) + changes, updateCallback=updateCallback, + forceUpdate=forceUpdate) if result in ('added', 'modified'): stats[result].append(self.share.itsUUID)
Modified: trunk/chandler/parcels/osaf/sharing/__init__.py (11340 => 11341)
--- trunk/chandler/parcels/osaf/sharing/__init__.py 2006-08-07 19:29:54 UTC (rev 11340) +++ trunk/chandler/parcels/osaf/sharing/__init__.py 2006-08-07 19:42:46 UTC (rev 11341) @@ -249,6 +249,7 @@ return True modeOverride = kwds.get('modeOverride', None) + forceUpdate = kwds.get('forceUpdate', None) stats = [] try: @@ -287,7 +288,8 @@ try: stats.extend(sync(collection, modeOverride=modeOverride, - updateCallback=silentCallback)) + updateCallback=silentCallback, + forceUpdate=forceUpdate)) _clearError(collection) except Exception, e: @@ -1063,6 +1065,16 @@ if hasattr(subShare, 'filterClasses'): share.filterClasses = list(subShare.filterClasses) + # Because of a bug, we don't really know whether the + # publisher of this share intended to share alarms and + # event status (transparency). Let's assume not. However, + # we *can* determine their intention for sharing triage + # status. + share.filterAttributes = ['reminders', 'expiredReminders', + 'transparency'] + if 'triageStatus' in getattr(subShare, 'filterAttributes', []): + share.filterAttributes.append('triageStatus') + try: share.contents.shares.append(share, 'main') except ValueError: @@ -1071,11 +1083,6 @@ except Exception, err: logger.exception("Failed to subscribe to %s", url) - - if share: - share.delete(True) - if subShare: - subShare.delete(True) raise return share.contents
_______________________________________________ Commits mailing list [email protected] http://lists.osafoundation.org/mailman/listinfo/commits
