[Commits] (morgen) Sharing dialogs moved from Test > Share into the Collection menu

commits at osafoundation.org commits at osafoundation.org
Mon Apr 25 17:28:12 PDT 2005


Commit by: morgen
Modified files:
chandler/parcels/osaf/framework/sharing/SubscribeDialog.py None 1.1
chandler/parcels/osaf/framework/sharing/SubscribeDialog.wdr None 1.1
chandler/parcels/osaf/framework/sharing/SubscribeDialog_wdr.xrc None 1.1
chandler/parcels/osaf/framework/sharing/PublishCollection.py 1.3 1.4
chandler/parcels/osaf/framework/sharing/PublishCollection.wdr 1.1 1.2
chandler/parcels/osaf/framework/sharing/PublishCollection_wdr.xrc 1.1 1.2
chandler/parcels/osaf/framework/sharing/Sharing.py 1.92 1.93
chandler/parcels/osaf/views/main/Main.py 1.161 1.162
chandler/parcels/osaf/views/main/SideBar.py 1.43 1.44
chandler/parcels/osaf/views/main/parcel.xml 1.202 1.203

Log message:
Sharing dialogs moved from Test > Share into the Collection menu


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/sharing/SubscribeDialog.py?rev=1.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/sharing/SubscribeDialog.wdr?rev=1.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/sharing/SubscribeDialog_wdr.xrc?rev=1.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/sharing/PublishCollection.py.diff?r1=text&tr1=1.3&r2=text&tr2=1.4
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/sharing/PublishCollection.wdr.diff?r1=text&tr1=1.1&r2=text&tr2=1.2
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/sharing/PublishCollection_wdr.xrc.diff?r1=text&tr1=1.1&r2=text&tr2=1.2
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/sharing/Sharing.py.diff?r1=text&tr1=1.92&r2=text&tr2=1.93
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/main/Main.py.diff?r1=text&tr1=1.161&r2=text&tr2=1.162
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/main/SideBar.py.diff?r1=text&tr1=1.43&r2=text&tr2=1.44
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/main/parcel.xml.diff?r1=text&tr1=1.202&r2=text&tr2=1.203

Index: chandler/parcels/osaf/views/main/Main.py
diff -u chandler/parcels/osaf/views/main/Main.py:1.161 chandler/parcels/osaf/views/main/Main.py:1.162
--- chandler/parcels/osaf/views/main/Main.py:1.161	Wed Apr 20 18:16:20 2005
+++ chandler/parcels/osaf/views/main/Main.py	Mon Apr 25 17:28:10 2005
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.161 $"
-__date__ = "$Date: 2005/04/21 01:16:20 $"
+__version__ = "$Revision: 1.162 $"
+__date__ = "$Date: 2005/04/26 00:28:10 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -430,22 +430,19 @@
         theApp.RenderMainView ()
 
     def onSharingSubscribeToCollectionEvent(self, event):
-        # Triggered from "Tests | Subscribe to collection..."
-        Sharing.manualSubscribeToCollection(self.itsView)
+        # Triggered from "Collection | Subscribe to collection..."
 
-    def onSharingImportDemoCalendarEvent(self, event):
-        # Triggered from "Tests | Import demo calendar..."
-        Sharing.loadDemoCalendar(self.itsView)
+        import osaf.framework.sharing.SubscribeDialog
 
-    def onSharingSubscribeToICalendarEvent(self, event):
+        # @@@MOR Handy during development:
+        reload(osaf.framework.sharing.SubscribeDialog)
 
-        # Triggered from "Tests | Subscribe to ICalendar..."
-        import osaf.framework.sharing.ICalendarSubscribeDialog
+        osaf.framework.sharing.SubscribeDialog.Show(wx.GetApp().mainFrame, self.itsView)
 
-        # @@@MOR Handy during development:
-        reload(osaf.framework.sharing.ICalendarSubscribeDialog)
+    def onSharingImportDemoCalendarEvent(self, event):
+        # Triggered from "Tests | Import demo calendar..."
+        Sharing.loadDemoCalendar(self.itsView)
 
-        osaf.framework.sharing.ICalendarSubscribeDialog.Show(wx.GetApp().mainFrame, self.itsView)
 
     def onEditCollectionRuleEvent(self, event):
         # Triggered from "Tests | Edit collection rule..."
@@ -508,6 +505,9 @@
         The "Collection | Share collection " menu item
         """
     
+        self.onShareCollectionEvent(event)
+        return
+    
         # Make sure we have all the accounts; returns False if the user cancels out and we don't.
         if not Sharing.ensureAccountSetUp(self.itsView):
             return
@@ -538,9 +538,9 @@
         
         if collection is not None:
             # event.arguments['Enable'] = True
-            menuTitle = _('%s "%s" collection') % (verb, collection.displayName)
+            menuTitle = _('%s "%s" collection...') % (verb, collection.displayName)
         else:
-            menuTitle = _('%s a collection') % verb
+            menuTitle = _('%s a collection...') % verb
             
         event.arguments ['Text'] = menuTitle
         event.arguments['Enable'] = collection is not None and (doManage == Sharing.isShared(collection))
@@ -557,9 +557,9 @@
         self.itsView.commit() 
         collection = self.getSidebarSelectedCollection ()
         if collection is not None:
-            share = Sharing.getShare(collection)
-            if share is not None:
-                Sharing.syncShare(share)
+            for share in collection.shares:
+                if share.active:
+                    Sharing.syncShare(share)
 
     def onSyncCollectionEventUpdateUI (self, event):
         """
@@ -577,6 +577,26 @@
             menuTitle = _('Sync a collection')
         event.arguments ['Text'] = menuTitle
 
+    def onCopyCollectionURLEvent(self, event):
+        collection = self.getSidebarSelectedCollection()
+        if collection is not None:
+            share = Sharing.getShare(collection)
+            if share is not None:
+                url = str(share.getLocation())
+                gotClipboard = wx.TheClipboard.Open()        
+                if gotClipboard:
+                    wx.TheClipboard.SetData(wx.TextDataObject(url))
+                    wx.TheClipboard.Close()
+
+    def onCopyCollectionURLEventUpdateUI(self, event):
+        enable = False
+        collection = self.getSidebarSelectedCollection()
+        if collection is not None:
+            share = Sharing.getShare(collection)
+            if share is not None:
+                enable = True
+        event.arguments['Enable'] = enable
+        
     def onSyncWebDAVEvent (self, event):
         """
           Synchronize WebDAV sharing.

Index: chandler/parcels/osaf/framework/sharing/PublishCollection_wdr.xrc
diff -u chandler/parcels/osaf/framework/sharing/PublishCollection_wdr.xrc:1.1 chandler/parcels/osaf/framework/sharing/PublishCollection_wdr.xrc:1.2
--- chandler/parcels/osaf/framework/sharing/PublishCollection_wdr.xrc:1.1	Thu Apr 14 23:44:32 2005
+++ chandler/parcels/osaf/framework/sharing/PublishCollection_wdr.xrc	Mon Apr 25 17:28:09 2005
@@ -51,7 +51,7 @@
                     <flag>wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL</flag>
                     <border>5</border>
                     <object class="wxStaticText" name="ID_TEXT">
-                        <label>Publish as:</label>
+                        <label>Sharing name:</label>
                     </object>
                 </object>
                 <object class="sizeritem">
@@ -66,7 +66,7 @@
                     <flag>wxALIGN_RIGHT|wxALL</flag>
                     <border>5</border>
                     <object class="wxStaticText" name="ID_TEXT">
-                        <label></label>
+                        <label>Existing names:</label>
                     </object>
                 </object>
                 <object class="sizeritem">
@@ -90,7 +90,7 @@
                     <flag>wxGROW|wxALIGN_CENTER_VERTICAL|wxALL</flag>
                     <border>5</border>
                     <object class="wxCheckBox" name="CHECKBOX_ALARMS">
-                        <label>Publish alarms</label>
+                        <label>Share alarms</label>
                     </object>
                 </object>
                 <object class="sizeritem">
@@ -104,7 +104,7 @@
                     <flag>wxGROW|wxALIGN_CENTER_VERTICAL|wxALL</flag>
                     <border>5</border>
                     <object class="wxCheckBox" name="CHECKBOX_STATUS">
-                        <label>Publish event status</label>
+                        <label>Share event status</label>
                     </object>
                 </object>
             </object>
@@ -112,7 +112,7 @@
     </object>
 </object>
 
-<object class="wxPanel" name="ScrollStatusPanel">
+<object class="wxPanel" name="StatusPanel">
     <object class="wxBoxSizer">
         <orient>wxVERTICAL</orient>
         <object class="sizeritem">
@@ -124,12 +124,10 @@
             </object>
         </object>
         <object class="sizeritem">
-            <flag>wxGROW|wxALIGN_CENTER_VERTICAL|wxALL</flag>
-            <border>5</border>
-            <object class="wxTextCtrl" name="TEXT_SCROLLSTATUS">
-                <size>-1,100</size>
-                <style>wxTE_MULTILINE|wxTE_READONLY</style>
-                <value></value>
+            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
+            <border>10</border>
+            <object class="wxStaticText" name="TEXT_STATUS">
+                <label></label>
             </object>
         </object>
     </object>
@@ -139,7 +137,7 @@
     <object class="wxBoxSizer">
         <orient>wxVERTICAL</orient>
         <object class="sizeritem">
-            <flag>wxALIGN_CENTER|wxALL</flag>
+            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
             <border>5</border>
             <object class="wxFlexGridSizer">
                 <cols>2</cols>
@@ -154,7 +152,7 @@
                     </object>
                 </object>
                 <object class="sizeritem">
-                    <flag>wxALIGN_CENTER|wxALL</flag>
+                    <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                     <border>5</border>
                     <object class="wxStaticText" name="TEXT_MANAGE_COLLNAME">
                         <size>300,-1</size>
@@ -169,7 +167,7 @@
                     </object>
                 </object>
                 <object class="sizeritem">
-                    <flag>wxGROW|wxALIGN_CENTER_VERTICAL|wxALL</flag>
+                    <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                     <border>5</border>
                     <object class="wxStaticText" name="TEXT_ACCOUNT">
                         <label></label>
@@ -179,6 +177,21 @@
                     <flag>wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL</flag>
                     <border>5</border>
                     <object class="wxStaticText" name="ID_TEXT">
+                        <style>wxALIGN_RIGHT</style>
+                        <label>Sharing name:</label>
+                    </object>
+                </object>
+                <object class="sizeritem">
+                    <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
+                    <border>5</border>
+                    <object class="wxStaticText" name="TEXT_SHARINGNAME">
+                        <label></label>
+                    </object>
+                </object>
+                <object class="sizeritem">
+                    <flag>wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL</flag>
+                    <border>5</border>
+                    <object class="wxStaticText" name="ID_TEXT">
                         <label>Options:</label>
                     </object>
                 </object>
@@ -186,7 +199,7 @@
                     <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                     <border>5</border>
                     <object class="wxCheckBox" name="CHECKBOX_ALARMS">
-                        <label>Publish alarms</label>
+                        <label>Share alarms</label>
                     </object>
                 </object>
                 <object class="sizeritem">
@@ -200,7 +213,21 @@
                     <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                     <border>5</border>
                     <object class="wxCheckBox" name="CHECKBOX_STATUS">
-                        <label>Publish event status</label>
+                        <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>Sharing URL:</label>
+                    </object>
+                </object>
+                <object class="sizeritem">
+                    <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
+                    <border>5</border>
+                    <object class="wxStaticText" name="TEXT_URL">
+                        <label></label>
                     </object>
                 </object>
             </object>
@@ -219,16 +246,16 @@
                 <object class="sizeritem">
                     <flag>wxALIGN_CENTER|wxALL</flag>
                     <border>5</border>
-                    <object class="wxButton" name="wxID_OK">
-                        <label>Publish</label>
-                        <default>1</default>
+                    <object class="wxButton" name="wxID_CANCEL">
+                        <label>Cancel</label>
                     </object>
                 </object>
                 <object class="sizeritem">
                     <flag>wxALIGN_CENTER|wxALL</flag>
                     <border>5</border>
-                    <object class="wxButton" name="wxID_CANCEL">
-                        <label>Cancel</label>
+                    <object class="wxButton" name="wxID_OK">
+                        <label>Share</label>
+                        <default>1</default>
                     </object>
                 </object>
             </object>
@@ -261,9 +288,8 @@
                 <object class="sizeritem">
                     <flag>wxALIGN_CENTER|wxALL</flag>
                     <border>5</border>
-                    <object class="wxButton" name="wxID_OK">
-                        <label>OK</label>
-                        <default>1</default>
+                    <object class="wxStaticText" name="ID_TEXT">
+                        <label>   </label>
                     </object>
                 </object>
                 <object class="sizeritem">
@@ -273,6 +299,14 @@
                         <label>Cancel</label>
                     </object>
                 </object>
+                <object class="sizeritem">
+                    <flag>wxALIGN_CENTER|wxALL</flag>
+                    <border>5</border>
+                    <object class="wxButton" name="wxID_OK">
+                        <label>OK</label>
+                        <default>1</default>
+                    </object>
+                </object>
             </object>
         </object>
     </object>
@@ -291,7 +325,7 @@
                     <border>5</border>
                     <object class="wxButton" name="BUTTON_PUBLISHING">
                         <enabled>0</enabled>
-                        <label>Publishing...</label>
+                        <label>Copy URL to Clipboard</label>
                     </object>
                 </object>
                 <object class="sizeritem">

Index: chandler/parcels/osaf/framework/sharing/PublishCollection.py
diff -u chandler/parcels/osaf/framework/sharing/PublishCollection.py:1.3 chandler/parcels/osaf/framework/sharing/PublishCollection.py:1.4
--- chandler/parcels/osaf/framework/sharing/PublishCollection.py:1.3	Mon Apr 18 12:29:25 2005
+++ chandler/parcels/osaf/framework/sharing/PublishCollection.py	Mon Apr 25 17:28:09 2005
@@ -1,7 +1,7 @@
 import wx
 import os, urlparse, urllib
 import application.Globals as Globals
-import Sharing
+import Sharing, ICalendar
 import WebDAV
 from repository.item.Query import KindQuery
 
@@ -19,17 +19,16 @@
         
         self.mySizer = wx.BoxSizer(wx.VERTICAL)
         
-        self.share = Sharing.getShare(self.collection)
+        self.shareXML = Sharing.getShare(self.collection)
         
-        if self.share is None:
+        if self.shareXML is None:
             self.ShowPublishPanel()
         else:
             self.ShowManagePanel()
 
-        self.statusPanel = self.resources.LoadPanel(self, "ScrollStatusPanel")
+        self.statusPanel = self.resources.LoadPanel(self, "StatusPanel")
         self.statusPanel.Hide()
-        self.textStatus = wx.xrc.XRCCTRL(self, "TEXT_SCROLLSTATUS")        
-
+        self.textStatus = wx.xrc.XRCCTRL(self, "TEXT_STATUS")
        
         self.mySizer.Add(self.mainPanel, 0, wx.GROW|wx.ALL, 5)
         self.mySizer.Add(self.buttonPanel, 0, wx.GROW|wx.ALL, 5)        
@@ -57,25 +56,47 @@
             self.accountsControl.SetClientData(newIndex, account)
             if account is self.currentAccount:
                 self.accountsControl.SetSelection(newIndex)
-            
+        self.Bind(wx.EVT_CHOICE, self.OnChangeAccount,
+                  id=wx.xrc.XRCID("CHOICE_ACCOUNT"))    
+                  
         self.existingControl = wx.xrc.XRCCTRL(self, "LISTBOX_EXISTING")
         self._refreshExisting()
+        self._suggestName()
+
+        self.SetDefaultItem(wx.xrc.XRCCTRL(self, "wxID_OK"))
+        wx.xrc.XRCCTRL(self, "CHECKBOX_ALARMS").Enable(False)
+        wx.xrc.XRCCTRL(self, "CHECKBOX_STATUS").Enable(False)        
+    
+    def OnChangeAccount(self, evt):
+        accountIndex = self.accountsControl.GetSelection()
+        account = self.accountsControl.GetClientData(accountIndex)
+        self.currentAccount = account
+        self._refreshExisting()
+        self._suggestName()
         
-        self.publishNameControl = wx.xrc.XRCCTRL(self, "TEXTCTRL_NAME")
-        name = self.collection.displayName
+    def _suggestName(self):
+        collectionName = self.collection.displayName
+        try:
+            username = self.currentAccount.username
+        except:
+            username = ""
+        if not username:
+            username = "User"
+        basename = "%s's %s" % (username, collectionName)
+        name = basename
         
         counter = 1
         while name in self.existing:
-            name = "%s-%d" % (self.collection.displayName, counter)
+            name = "%s-%d" % (basename, counter)
             counter += 1
+        
+        self.publishNameControl = wx.xrc.XRCCTRL(self, "TEXTCTRL_NAME")
             
         self.publishNameControl.SetValue(name)
         self.publishNameControl.SetFocus()
-        self.publishNameControl.SetSelection(-1, -1)
-        self.SetDefaultItem(wx.xrc.XRCCTRL(self, "wxID_OK"))
-        wx.xrc.XRCCTRL(self, "CHECKBOX_ALARMS").Enable(False)
-        wx.xrc.XRCCTRL(self, "CHECKBOX_STATUS").Enable(False)        
-       
+        self.publishNameControl.SetSelection(-1, -1)            
+        
+        
     def ShowManagePanel(self):
         self.mainPanel = self.resources.LoadPanel(self, "ManageCollection")
         self.buttonPanel = self.resources.LoadPanel(self, 
@@ -87,7 +108,9 @@
         self.Bind(wx.EVT_BUTTON, self.OnCopy,
                   id=wx.xrc.XRCID("BUTTON_CLIPBOARD"))
         wx.xrc.XRCCTRL(self, "TEXT_MANAGE_COLLNAME").SetLabel(self.collection.displayName)
-        wx.xrc.XRCCTRL(self, "TEXT_ACCOUNT").SetLabel(self.share.conduit.account.displayName)
+        wx.xrc.XRCCTRL(self, "TEXT_ACCOUNT").SetLabel(self.shareXML.conduit.account.displayName)
+        wx.xrc.XRCCTRL(self, "TEXT_URL").SetLabel(self.shareXML.conduit.getLocation())
+        wx.xrc.XRCCTRL(self, "TEXT_SHARINGNAME").SetLabel(self.shareXML.displayName)
         self.SetDefaultItem(wx.xrc.XRCCTRL(self, "wxID_OK"))
         wx.xrc.XRCCTRL(self, "BUTTON_UNPUBLISH").Enable(False)
         wx.xrc.XRCCTRL(self, "CHECKBOX_ALARMS").Enable(False)
@@ -99,7 +122,7 @@
         self.mySizer.Detach(self.buttonPanel)
         self.buttonPanel = self.resources.LoadPanel(self, 
                                                     "PublishingButtonsPanel")
-        self.mySizer.Insert(1, self.buttonPanel, 0, wx.GROW|wx.ALL, 5)
+        self.mySizer.Add(self.buttonPanel, 0, wx.GROW|wx.ALL, 5)
         publishingButton = wx.xrc.XRCCTRL(self, "BUTTON_PUBLISHING")
         publishingButton.Enable(False)
         
@@ -109,36 +132,49 @@
         
         shareName = self.publishNameControl.GetValue()
         shareNameSafe = urllib.quote_plus(shareName)
-        share = Sharing.newOutboundShare(self.view, self.collection,
-                                         shareName=shareNameSafe,
-                                         account=self.currentAccount)
-        self.share = share
         
-        share.displayName = shareName
-
-        if not share.exists():
+        accountIndex = self.accountsControl.GetSelection()
+        account = self.accountsControl.GetClientData(accountIndex)
+        
+        shareXML = Sharing.newOutboundShare(self.view, self.collection,
+                                            shareName=shareNameSafe,
+                                            account=account)
+        self.shareXML = shareXML
+        shareXML.displayName = shareName
+        
+        iCalName = "%s.ics" % shareNameSafe
+        shareICal = Sharing.newOutboundShare(self.view, self.collection,
+                                             shareName=iCalName,
+                                             account=account)
+        self.shareICal = shareICal
+        shareICal.displayName = "%s.ics" % shareName
+        
+        format = ICalendar.ICalendarFormat(view=self.view)
+        shareICal.mode = "put"
+        shareICal.format = format
+        shareICal.hidden = True
+        
+        self._showStatus("Wait for Sharing URL...\n")
+        if not shareXML.exists():
             self._showStatus("Creating collection on server...")
-            share.create()
+            shareXML.create()
             self._showStatus(" done.\n")
             
         self._showStatus("Publishing collection to server...")
-        share.put()
+        shareXML.put()
         self._showStatus(" done.\n")
 
-        self._showStatus("URL of collection:\n")
-        self._showStatus("%s\n" % share.getLocation())
+        self._showStatus("Publishing calendar file to server...")
+        shareICal.put()
+        self._showStatus(" done.\n")
+        
+        self._showStatus("%s" % shareXML.getLocation())
 
-        gotClipboard = wx.TheClipboard.Open()
-        if gotClipboard:
-            wx.TheClipboard.SetData(wx.TextDataObject(share.getLocation()))
-            wx.TheClipboard.Close()
-            self._showStatus("(URL copied to clipboard)\n")
- 
         self.buttonPanel.Hide()
         self.mySizer.Detach(self.buttonPanel)
         self.buttonPanel = self.resources.LoadPanel(self, 
                                                     "PublishedButtonsPanel")
-        self.mySizer.Insert(1, self.buttonPanel, 0, wx.GROW|wx.ALL, 5)  
+        self.mySizer.Add(self.buttonPanel, 0, wx.GROW|wx.ALL, 5)  
         
         self.Bind(wx.EVT_BUTTON, self.OnDone, id=wx.ID_OK)
         self.Bind(wx.EVT_BUTTON, self.OnCopy, 
@@ -154,30 +190,27 @@
     def OnCopy(self, evt):
         gotClipboard = wx.TheClipboard.Open()        
         if gotClipboard:
-            wx.TheClipboard.SetData(wx.TextDataObject(self.share.getLocation()))
+            wx.TheClipboard.SetData(wx.TextDataObject(str(self.shareXML.getLocation())))
             wx.TheClipboard.Close()
-            self._showStatus("URL copied to clipboard\n")
-        else:
-            self._showStatus("Couldn't copy URL to clipboard\n")
-            
                 
     def _clearStatus(self):
-            self.textStatus.SetValue("")
+            self.textStatus.SetLabel("")
             
     def _showStatus(self, msg):
         if not self.statusPanel.IsShown():
-            self.mySizer.Add(self.statusPanel, 0, wx.GROW, 5)
+            self.mySizer.Insert(1, self.statusPanel, 0, wx.GROW, 5)
             self.statusPanel.Show()
-        self.textStatus.SetValue("%s%s" % (self.textStatus.GetValue(), msg))
-        self.textStatus.ShowPosition(self.textStatus.GetLastPosition())
+        self.textStatus.SetLabel("%s%s" % (self.textStatus.GetLabel(), msg))
+        # self.textStatus.ShowPosition(self.textStatus.GetLastPosition())
         self._resize()
         wx.Yield()
 
     def _hideStatus(self):
         if self.statusPanel.IsShown():
             self.statusPanel.Hide()
-            self.mySizer.Detach(self.statusPanel)
+            # self.mySizer.Detach(self.statusPanel)
             self._resize()
+        pass
             
     def _resize(self):
         self.mySizer.Layout()

Index: chandler/parcels/osaf/framework/sharing/Sharing.py
diff -u chandler/parcels/osaf/framework/sharing/Sharing.py:1.92 chandler/parcels/osaf/framework/sharing/Sharing.py:1.93
--- chandler/parcels/osaf/framework/sharing/Sharing.py:1.92	Fri Apr 15 17:07:41 2005
+++ chandler/parcels/osaf/framework/sharing/Sharing.py	Mon Apr 25 17:28:09 2005
@@ -1,5 +1,5 @@
-Allowed = "$Revision: 1.92 $"
-__date__ = "$Date: 2005/04/16 00:07:41 $"
+Allowed = "$Revision: 1.93 $"
+__date__ = "$Date: 2005/04/26 00:28:09 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -247,6 +247,7 @@
 
         retrievedItems = []
         self.resourceList = self._getResourceList(location)
+        
         self.__resetSeen()
 
         itemPath = self._getItemPath(self.share)
@@ -394,6 +395,7 @@
             if not value['seen']:
                 yield path
 
+
     def connect(self):
         pass
 
@@ -458,17 +460,17 @@
                 fileName = self.SHAREFILE
             else:
                 fileName = "%s.%s" % (item.itsUUID, extension)
-            return os.path.join(self.getLocation(), fileName)
+            return fileName
 
         elif style == ImportExportFormat.STYLE_SINGLE:
-            return self.getLocation()
+            return self.shareName
 
         else:
             print "@@@MOR Raise an exception here"
 
     def _putItem(self, item): # must implement
-        path = self._getItemPath(item)
-
+        path = self.__getItemFullPath(self._getItemPath(item))
+        
         try:
             text = self.share.format.exportProcess(item)
         except Exception, e:
@@ -483,13 +485,17 @@
         return stat.st_mtime
 
     def _deleteItem(self, itemPath): # must implement
-        logger.info("...removing from disk: %s" % itemPath)
-        os.remove(itemPath)
+        path = self.__getItemFullPath(itemPath)
+
+        logger.info("...removing from disk: %s" % path)
+        os.remove(path)
 
     def _getItem(self, itemPath, into=None): # must implement
         # logger.info("Getting item: %s" % itemPath)
-        extension = os.path.splitext(itemPath)[1].strip(os.path.extsep)
-        text = file(itemPath).read()
+        path = self.__getItemFullPath(itemPath)
+
+        extension = os.path.splitext(path)[1].strip(os.path.extsep)
+        text = file(path).read()
 
         try:
             item = self.share.format.importProcess(text, extension=extension,
@@ -497,7 +503,7 @@
         except Exception, e:
             raise TransformationFailed(message=str(e))
 
-        stat = os.stat(itemPath)
+        stat = os.stat(path)
         return (item, stat.st_mtime)
 
     def _getResourceList(self, location):
@@ -508,18 +514,27 @@
             for filename in os.listdir(location):
                 fullPath = os.path.join(location, filename)
                 stat = os.stat(fullPath)
-                fileList[fullPath] = { 'data' : stat.st_mtime }
+                fileList[filename] = { 'data' : stat.st_mtime }
 
         elif style == ImportExportFormat.STYLE_SINGLE:
             stat = os.stat(location)
-            fileList[location] = { 'data' : stat.st_mtime }
+            fileList[self.shareName] = { 'data' : stat.st_mtime }
 
         else:
             print "@@@MOR Raise an exception here"
 
         return fileList
 
+    def __getItemFullPath(self, path):
+        style = self.share.format.fileStyle()
+        if style == ImportExportFormat.STYLE_DIRECTORY:
+            path = os.path.join(self.sharePath, self.shareName, path)
+        elif style == ImportExportFormat.STYLE_SINGLE:
+            path = os.path.join(self.sharePath, self.shareName)
+        return path
 
+        
+        
     def exists(self):
         super(FileSystemConduit, self).exists()
 
@@ -646,28 +661,19 @@
         """ Return the path (not the full url) of an item given its external
         UUID """
 
-        (host, port, sharePath, username, password, useSSL) = self.__getSettings()
+        # (host, port, sharePath, username, password, useSSL) = self.__getSettings()
         extension = self.share.format.extension(item)
         style = self.share.format.fileStyle()
         if style == ImportExportFormat.STYLE_DIRECTORY:
             if isinstance(item, Share):
-                path = "/"
-                if sharePath:
-                    path += "%s/" % sharePath
-                path += "%s/share.xml" % self.shareName
+                path = "share.xml"
                 return path
             else:
-                path = "/"
-                if sharePath:
-                    path += "%s/" % sharePath
-                path += "%s/%s.%s" % (self.shareName, item.itsUUID, extension)
+                path = "%s.%s" % (item.itsUUID, extension)
                 return path
 
         elif style == ImportExportFormat.STYLE_SINGLE:
-            path = "/"
-            if sharePath:
-                path += "%s/" % sharePath
-            path += self.shareName
+            path = self.shareName
             return path
 
         else:
@@ -675,18 +681,23 @@
 
     def __getItemURL(self, item):
         """ Return the full url of an item """
-        path = self._getItemPath(item)
-        return self.__URLFromPath(path)
-
+        url = self.getLocation()
+        
+        style = self.share.format.fileStyle()
+        if style == ImportExportFormat.STYLE_DIRECTORY:
+            return "%s/%s" % (url, self._getItemPath(item))
+        else:
+            return url
+        
     def __URLFromPath(self, path):
-        # @@@MOR need to handle https
-
-        (host, port, sharePath, username, password, useSSL) = self.__getSettings()
-        if port == 80:
-            url = "http://%s%s" % (host, path)
+        url = self.getLocation()
+        
+        style = self.share.format.fileStyle()
+        if style == ImportExportFormat.STYLE_DIRECTORY:
+            return "%s/%s" % (url, path)
         else:
-            url = "http://%s:%s%s" % (host, port, path)
-        return url
+            return url
+      
 
     def exists(self):
         super(WebDAVConduit, self).exists()
@@ -872,6 +883,7 @@
                 raise
 
             for (path, etag) in resources:
+                path = path.split("/")[-1]
                 etag = self.__cleanEtag(etag)
                 resourceList[path] = { 'data' : etag }
 
@@ -894,6 +906,7 @@
             etag = resp.getheader('ETag', None)
             etag = self.__cleanEtag(etag)
             path = urlparse.urlparse(location)[2]
+            path = path.split("/")[-1]
             resourceList[path] = { 'data' : etag }
 
         return resourceList

Index: chandler/parcels/osaf/views/main/SideBar.py
diff -u chandler/parcels/osaf/views/main/SideBar.py:1.43 chandler/parcels/osaf/views/main/SideBar.py:1.44
--- chandler/parcels/osaf/views/main/SideBar.py:1.43	Wed Apr 20 18:16:20 2005
+++ chandler/parcels/osaf/views/main/SideBar.py	Mon Apr 25 17:28:10 2005
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.43 $"
-__date__ = "$Date: 2005/04/21 01:16:20 $"
+__version__ = "$Revision: 1.44 $"
+__date__ = "$Date: 2005/04/26 00:28:10 $"
 __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -10,6 +10,7 @@
 import wx
 import osaf.framework.blocks.DrawingUtilities as DrawingUtilities
 import os
+import osaf.framework.sharing.Sharing as Sharing
 
 
 def GetRenderEditorTextRect (rect):
@@ -108,10 +109,10 @@
             if len (item) == 0:
                 dc.SetTextForeground (wx.SystemSettings.GetColour (wx.SYS_COLOUR_GRAYTEXT))
 
-            numberOfShares = len (item.shares)
-            if numberOfShares > 0:
-                sharer = item.shares.first().sharer
-                if numberOfShares == 1 and str(sharer.itsPath) == "//userdata/me":
+            share = Sharing.getShare(item)
+            if share is not None:
+                if hasattr(share, 'sharer') and share.sharer is not None and \
+                   str(share.sharer.itsPath) == "//userdata/me":
                     imageName = "SidebarOut.png"
                 else:
                     imageName = "SidebarIn.png"

Index: chandler/parcels/osaf/views/main/parcel.xml
diff -u chandler/parcels/osaf/views/main/parcel.xml:1.202 chandler/parcels/osaf/views/main/parcel.xml:1.203
--- chandler/parcels/osaf/views/main/parcel.xml:1.202	Mon Apr 25 11:57:36 2005
+++ chandler/parcels/osaf/views/main/parcel.xml	Mon Apr 25 17:28:10 2005
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.202 $ -->
-<!-- $Date: 2005/04/25 18:57:36 $ -->
+<!-- $Revision: 1.203 $ -->
+<!-- $Date: 2005/04/26 00:28:10 $ -->
 <!-- Copyright (c) 2003-2004 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -308,15 +308,15 @@
     <dispatchEnum>SendToBlockByName</dispatchEnum>
     <dispatchToBlockName>MainView</dispatchToBlockName>
   </BlockEvent>
-
-  <BlockEvent itsName="SharingImportDemoCalendar">
-    <blockName>SharingImportDemoCalendar</blockName>
+  
+  <BlockEvent itsName="CopyCollectionURL">
+    <blockName>CopyCollectionURL</blockName>
     <dispatchEnum>SendToBlockByName</dispatchEnum>
     <dispatchToBlockName>MainView</dispatchToBlockName>
   </BlockEvent>
 
-  <BlockEvent itsName="SharingSubscribeToICalendar">
-    <blockName>SharingSubscribeToICalendar</blockName>
+  <BlockEvent itsName="SharingImportDemoCalendar">
+    <blockName>SharingImportDemoCalendar</blockName>
     <dispatchEnum>SendToBlockByName</dispatchEnum>
     <dispatchToBlockName>MainView</dispatchToBlockName>
   </BlockEvent>
@@ -400,6 +400,9 @@
     <title>&amp;Collection</title>
     <childrenBlocks itemref="doc:ShareSidebarCollectionItem"/>
     <childrenBlocks itemref="doc:ManageSidebarCollectionItem"/>
+    <childrenBlocks itemref="doc:CopyCollectionURLItem"/>
+    <childrenBlocks itemref="doc:SyncCollectionItem"/>
+    <childrenBlocks itemref="doc:SharingSubscribeToCollectionItem"/>
     <childrenBlocks itemref="doc:RenameItem"/>
   </Menu>
   
@@ -745,21 +748,10 @@
     <blockName>ShareMenu</blockName>
     <title>Share</title>
     <helpString>Sharing-related test commands</helpString>
-    <childrenBlocks itemref="doc:SharingSubscribeToCollectionItem"/>
-    <childrenBlocks itemref="doc:SharingSubscribeToICalendarItem"/>
     <childrenBlocks itemref="doc:SharingImportDemoCalendarItem"/>
-    <childrenBlocks itemref="doc:ShareCollectionItem"/>
-    <childrenBlocks itemref="doc:SyncCollectionItem"/>
     <childrenBlocks itemref="doc:ShareToolItem"/>
   </Menu>
 
-  <MenuItem itsName="ShareCollectionItem">
-    <blockName>ShareCollectionItem</blockName>
-    <title>Share collection</title>
-    <event itemref="doc:ShareCollection"/>
-    <helpString>Enable sharing a collection</helpString>
-  </MenuItem>
-
   <MenuItem itsName="ShareToolItem">
     <blockName>ShareToolItem</blockName>
     <title>Share tool...</title>
@@ -776,9 +768,9 @@
 
   <MenuItem itsName="SharingSubscribeToCollectionItem">
     <blockName>SharingSubscribeToCollectionItem</blockName>
-    <title>Subscribe to Collection...</title>
+    <title>Subscribe to collection...</title>
     <event itemref="doc:SharingSubscribeToCollection"/>
-    <helpString>Subscribe to a published item collection</helpString>
+    <helpString>Subscribe to a published collection</helpString>
   </MenuItem>
 
   <MenuItem itsName="SharingImportDemoCalendarItem">
@@ -788,13 +780,6 @@
     <helpString>Import a demo iCalendar file from osafoundation.org</helpString>
   </MenuItem>
 
-  <MenuItem itsName="SharingSubscribeToICalendarItem">
-    <blockName>SharingSubscribeToICalendarItem</blockName>
-    <title>Subscribe to remote iCalendar... (experimental dialog)</title>
-    <event itemref="doc:SharingSubscribeToICalendar"/>
-    <helpString>Subscribe to a remote iCalendar (.ics) file</helpString>
-  </MenuItem>
-
   <MenuItem itsName="EditCollectionRuleItem">
     <blockName>EditCollectionRuleItem</blockName>
     <title>Edit collection rule...</title>
@@ -948,6 +933,13 @@
     <helpString>Manage the selected collection</helpString>
   </MenuItem>
 
+  <MenuItem itsName="CopyCollectionURLItem">
+    <blockName>CopyCollectionURLItem</blockName>
+    <title>Copy URL to clipboard</title>
+    <event itemref="doc:CopyCollectionURL"/>
+    <helpString>Copy the selected collection's URL to the clipboard</helpString>
+  </MenuItem>
+
   <ContextMenu itsName="sidebarContextMenu">
     <childrenBlocks itemref="doc:OpenTabContextItem"/>
     <childrenBlocks itemref="doc:CloseTabContextItem"/>



More information about the Commits mailing list